You can subscribe to this list here.
2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(84) |
Oct
(70) |
Nov
(164) |
Dec
(71) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2012 |
Jan
(52) |
Feb
(77) |
Mar
(70) |
Apr
(58) |
May
(81) |
Jun
(74) |
Jul
(87) |
Aug
(30) |
Sep
(45) |
Oct
(37) |
Nov
(51) |
Dec
(31) |
2013 |
Jan
(47) |
Feb
(29) |
Mar
(40) |
Apr
(33) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <gem...@li...> - 2013-01-16 18:46:23
|
Revision: 1108 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=1108&view=rev Author: matijsdejong Date: 2013-01-16 18:46:11 +0000 (Wed, 16 Jan 2013) Log Message: ----------- SelectModel now has some minimal intelligence as to contents New Summary controller for tracks Modified Paths: -------------- trunk/library/classes/Gems/Menu/MenuAbstract.php trunk/library/classes/Gems/Snippets/Tracker/Compliance/ComplianceSearchFormSnippet.php trunk/library/classes/Gems/Snippets/Tracker/Compliance/ComplianceTableSnippet.php trunk/library/classes/MUtil/Model/ModelAbstract.php trunk/library/classes/MUtil/Model/SelectModel.php trunk/library/classes/MUtil/Snippets/ModelTableSnippetAbstract.php trunk/library/configs/db/patches.sql trunk/library/languages/default-en.mo trunk/library/languages/default-en.po trunk/library/languages/default-nl.mo trunk/library/languages/default-nl.po Added Paths: ----------- trunk/library/classes/Gems/Default/SummaryAction.php trunk/library/classes/Gems/Snippets/Tracker/Summary/ trunk/library/classes/Gems/Snippets/Tracker/Summary/SummarySearchFormSnippet.php trunk/library/classes/Gems/Snippets/Tracker/Summary/SummaryTableSnippet.php trunk/library/controllers/SummaryController.php Copied: trunk/library/classes/Gems/Default/SummaryAction.php (from rev 1107, trunk/library/classes/Gems/Default/ComplianceAction.php) =================================================================== --- trunk/library/classes/Gems/Default/SummaryAction.php (rev 0) +++ trunk/library/classes/Gems/Default/SummaryAction.php 2013-01-16 18:46:11 UTC (rev 1108) @@ -0,0 +1,192 @@ +<?php + +/** + * Copyright (c) 2012, Erasmus MC + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Erasmus MC nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * @package Gems + * @subpackage Default + * @author Matijs de Jong <mj...@ma...> + * @copyright Copyright (c) 2012 Erasmus MC + * @license New BSD License + * @version $id: ComplianceAction.php 203 2012-01-01t 12:51:32Z matijs $ + */ + +/** + * + * + * @package Gems + * @subpackage Default + * @copyright Copyright (c) 2012 Erasmus MC + * @license New BSD License + * @since Class available since version 1.6 + */ +class Gems_Default_SummaryAction extends Gems_Controller_ModelSnippetActionAbstract +{ + /** + * The parameters used for the autofilter action. + * + * When the value is a function name of that object, then that functions is executed + * with the array key as single parameter and the return value is set as the used value + * - unless the key is an integer in which case the code is executed but the return value + * is not stored. + * + * @var array Mixed key => value array for snippet initialization + */ + protected $autofilterParameters = array('browse' => false); + + /** + * The snippets used for the autofilter action. + * + * @var mixed String or array of snippets name + */ + protected $autofilterSnippets = 'Tracker_Summary_SummaryTableSnippet'; + + /** + * + * @var Zend_Db_Adapter_Abstract + */ + public $db; + + /** + * The snippets used for the index action, before those in autofilter + * + * @var mixed String or array of snippets name + */ + protected $indexStartSnippets = array('Generic_ContentTitleSnippet', 'Tracker_Summary_SummarySearchFormSnippet'); + + /** + * Creates a model for getModel(). Called only for each new $action. + * + * The parameters allow you to easily adapt the model to the current action. The $detailed + * parameter was added, because the most common use of action is a split between detailed + * and summarized actions. + * + * @param boolean $detailed True when the current action is not in $summarizedActions. + * @param string $action The current action. + * @return MUtil_Model_ModelAbstract + */ + public function createModel($detailed, $action) + { + $select = $this->db->select(); + + $fields['answered'] = new Zend_Db_Expr("SUM( + CASE + WHEN grc_success = 1 AND gto_completion_time IS NOT NULL + THEN 1 ELSE 0 END + )"); + $fields['missed'] = new Zend_Db_Expr('SUM( + CASE + WHEN grc_success = 1 AND gto_completion_time IS NULL AND gto_valid_until < CURRENT_TIMESTAMP + THEN 1 ELSE 0 END + )'); + $fields['open'] = new Zend_Db_Expr('SUM( + CASE + WHEN grc_success = 1 AND gto_completion_time IS NULL AND + gto_valid_from <= CURRENT_TIMESTAMP AND + (gto_valid_until >= CURRENT_TIMESTAMP OR gto_valid_until IS NULL) + THEN 1 ELSE 0 END + )'); + $fields['future'] = new Zend_Db_Expr('SUM( + CASE + WHEN grc_success = 1 AND gto_completion_time IS NULL AND gto_valid_from > CURRENT_TIMESTAMP + THEN 1 ELSE 0 END + )'); + $fields['unknown'] = new Zend_Db_Expr('SUM( + CASE + WHEN grc_success = 1 AND gto_completion_time IS NULL AND gto_valid_from IS NULL + THEN 1 ELSE 0 END + )'); + $fields['is'] = new Zend_Db_Expr("'='"); + $fields['success'] = new Zend_Db_Expr('SUM( + CASE + WHEN grc_success = 1 + THEN 1 ELSE 0 END + )'); + $fields['removed'] = new Zend_Db_Expr('SUM( + CASE + WHEN grc_success = 0 + THEN 1 ELSE 0 END + )'); + + $select = $this->db->select(); + $select->from('gems__tokens', $fields) + ->joinInner('gems__reception_codes', 'gto_reception_code = grc_id_reception_code', array()) + ->joinInner('gems__rounds', 'gto_id_round = gro_id_round', + array('gro_round_description', 'gro_id_survey')) + ->joinInner('gems__surveys', 'gro_id_survey = gsu_id_survey', + array('gsu_survey_name', 'gsu_id_primary_group')) + ->group(array('gro_round_description', 'gro_id_order', 'gsu_survey_name', 'gsu_id_primary_group')) + ->order('gto_round_order'); + + // MUtil_Model::$verbose = true; + $model = new MUtil_Model_SelectModel($select, 'summary'); + + // Make sure of filter for these fields + $model->set('gto_id_track'); + $model->set('gto_id_organization'); + $model->set('gsu_id_primary_group'); + + $model->resetOrder(); + $model->set('gro_round_description', 'label', $this->_('Round')); + $model->set('gsu_survey_name', 'label', $this->_('Survey')); + $model->set('gsu_id_primary_group', 'label', $this->_('Filler'), + 'multiOptions', $this->util->getDbLookup()->getGroups()); + + $model->set('answered', 'label', $this->_('Answered'), 'tdClass', 'centerAlign', 'thClass', 'centerAlign'); + $model->set('missed', 'label', $this->_('Missed'), 'tdClass', 'centerAlign', 'thClass', 'centerAlign'); + $model->set('open', 'label', $this->_('Open'), 'tdClass', 'centerAlign', 'thClass', 'centerAlign'); + $model->set('future', 'label', $this->_('Future'), 'tdClass', 'centerAlign', 'thClass', 'centerAlign'); + $model->set('unknown', 'label', $this->_('Unknown'), 'tdClass', 'centerAlign', 'thClass', 'centerAlign'); + // $model->set('is', 'label', ' ', 'tdClass', 'centerAlign', 'thClass', 'centerAlign'); + $model->set('success', 'label', $this->_('Success'), 'tdClass', 'centerAlign', 'thClass', 'centerAlign'); + $model->set('removed', 'label', $this->_('Removed'), 'tdClass', 'deleted centerAlign', + 'thClass', 'centerAlign'); + + return $model; + } + + /** + * Helper function to get the title for the index action. + * + * @return $string + */ + public function getIndexTitle() + { + return $this->_('Summary'); + } + + /** + * Helper function to allow generalized statements about the items in the model. + * + * @param int $count + * @return $string + */ + public function getTopic($count = 1) + { + return $this->plural('token', 'tokens', $count); + } +} Modified: trunk/library/classes/Gems/Menu/MenuAbstract.php =================================================================== --- trunk/library/classes/Gems/Menu/MenuAbstract.php 2013-01-16 12:56:22 UTC (rev 1107) +++ trunk/library/classes/Gems/Menu/MenuAbstract.php 2013-01-16 18:46:11 UTC (rev 1108) @@ -322,8 +322,10 @@ { $infoPage = $this->addContainer($label); - $infoPage->addPage($this->_('Compliance'), 'pr.plan.compliance', 'compliance', 'index') + $infoPage->addPage($this->_('Track Summary'), 'pr.plan.summary', 'summary', 'index') ->addAutofilterAction(); + $infoPage->addPage($this->_('Track Compliance'), 'pr.plan.compliance', 'compliance', 'index') + ->addAutofilterAction(); $plans[] = $infoPage->addPage($this->_('By period'), 'pr.plan.overview', 'overview-plan', 'index'); $plans[] = $infoPage->addPage($this->_('By token'), 'pr.plan.token', 'token-plan', 'index'); Modified: trunk/library/classes/Gems/Snippets/Tracker/Compliance/ComplianceSearchFormSnippet.php =================================================================== --- trunk/library/classes/Gems/Snippets/Tracker/Compliance/ComplianceSearchFormSnippet.php 2013-01-16 12:56:22 UTC (rev 1107) +++ trunk/library/classes/Gems/Snippets/Tracker/Compliance/ComplianceSearchFormSnippet.php 2013-01-16 18:46:11 UTC (rev 1108) @@ -44,7 +44,7 @@ * @license New BSD License * @since Class available since version 1.5 */ -class Gems_Snippets_Tracker_Compliance_ComplianceSearchFormSnippet extends Gems_Snippets_AutosearchFormSnippet +class Gems_Snippets_Tracker_Compliance_ComplianceSearchFormSnippet extends Gems_Snippets_AutosearchFormSnippet { /** * Returns a text element for autosearch. Can be overruled. @@ -61,7 +61,7 @@ $this->util->getTrackData()->getAllTracks(), $this->_('(select a track)')); - $elements[] = $this->_createSelectElement('gr2o_id_organization', + $elements[] = $this->_createSelectElement('gr2t_id_organization', $this->util->getDbLookup()->getOrganizationsWithRespondents(), $this->_('(all organizations)')); Modified: trunk/library/classes/Gems/Snippets/Tracker/Compliance/ComplianceTableSnippet.php =================================================================== --- trunk/library/classes/Gems/Snippets/Tracker/Compliance/ComplianceTableSnippet.php 2013-01-16 12:56:22 UTC (rev 1107) +++ trunk/library/classes/Gems/Snippets/Tracker/Compliance/ComplianceTableSnippet.php 2013-01-16 18:46:11 UTC (rev 1108) @@ -93,8 +93,6 @@ END "); - // $labels = $model->getCol('label'); - $select = $this->db->select(); $select->from('gems__tokens', array('gto_id_respondent_track', 'gto_id_round', 'status' => $status)) ->joinInner('gems__reception_codes', 'gto_reception_code = grc_id_reception_code', array()) @@ -107,10 +105,6 @@ $newModel = new MUtil_Model_SelectModel($select, 'tok'); $newModel->setKeys(array('gto_id_respondent_track')); - // $model->addLeftTable('gems__tokens', array('gr2t_id_track' => 'gto_id_track')); - // $model->addLeftTable('gems__reception_codes', array('gto_reception_code' => 'grc_id_reception_code')); - // $model->addFilter(array('grc_success' => 1)); - // $newModel = $model; $transformer = new MUtil_Model_Transform_CrossTabTransformer(); $transformer->setCrosstabFields('gto_id_round', 'status'); @@ -118,7 +112,6 @@ foreach ($data as $row) { $name = 'col_' . $row['gro_id_round']; $transformer->set($name, 'label', $row['gro_id_order'], 'description', $row['gro_round_description']); - // break; } $newModel->addTransformer($transformer); @@ -132,8 +125,6 @@ $model->set('gr2t_start_date'); $model->addTransformer($joinTrans); return $model; - - return $newModel; } /** Copied: trunk/library/classes/Gems/Snippets/Tracker/Summary/SummarySearchFormSnippet.php (from rev 1107, trunk/library/classes/Gems/Snippets/Tracker/Compliance/ComplianceSearchFormSnippet.php) =================================================================== --- trunk/library/classes/Gems/Snippets/Tracker/Summary/SummarySearchFormSnippet.php (rev 0) +++ trunk/library/classes/Gems/Snippets/Tracker/Summary/SummarySearchFormSnippet.php 2013-01-16 18:46:11 UTC (rev 1108) @@ -0,0 +1,84 @@ +<?php + +/** + * Copyright (c) 2012, Erasmus MC + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Erasmus MC nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * @package Gems + * @subpackage Tracker + * @author Matijs de Jong <mj...@ma...> + * @copyright Copyright (c) 2012 Erasmus MC + * @license New BSD License + * @version $id: ComplianceSearchFormSnippet.php 203 2012-01-01t 12:51:32Z matijs $ + */ + +/** + * + * + * @package Gems + * @subpackage Tracker + * @copyright Copyright (c) 2012 Erasmus MC + * @license New BSD License + * @since Class available since version 1.5 + */ +class Gems_Snippets_Tracker_Summary_SummarySearchFormSnippet extends Gems_Snippets_AutosearchFormSnippet +{ + /** + * Returns a text element for autosearch. Can be overruled. + * + * The form / html elements to search on. Elements can be grouped by inserting null's between them. + * That creates a distinct group of elements + * + * @param array $data The $form field values (can be usefull, but no need to set them) + * @return array Of Zend_Form_Element's or static tekst to add to the html or null for group breaks. + */ + protected function getAutoSearchElements(array $data) + { + $elements[] = $this->_createSelectElement('gto_id_track', + $this->util->getTrackData()->getAllTracks(), + $this->_('(select a track)')); + + $elements[] = $this->_createSelectElement('gto_id_organization', + $this->util->getDbLookup()->getOrganizationsWithRespondents(), + $this->_('(all organizations)')); + + $elements[] = null; + + $sql = "SELECT DISTINCT ggp_id_group, ggp_name + FROM gems__groups INNER JOIN gems__surveys ON ggp_id_group = gsu_id_primary_group + INNER JOIN gems__rounds ON gsu_id_survey = gro_id_survey + INNER JOIN gems__tracks ON gro_id_track = gtr_id_track + WHERE ggp_group_active = 1 AND + gro_active=1 AND + gtr_active=1 AND + gtr_track_type='T' + ORDER BY ggp_name"; + $elements[] = $this->_createSelectElement('gsu_id_primary_group', $sql, $this->_('(all fillers)')); + + return $elements; + } + +} Copied: trunk/library/classes/Gems/Snippets/Tracker/Summary/SummaryTableSnippet.php (from rev 1107, trunk/library/classes/Gems/Snippets/Tracker/Compliance/ComplianceTableSnippet.php) =================================================================== --- trunk/library/classes/Gems/Snippets/Tracker/Summary/SummaryTableSnippet.php (rev 0) +++ trunk/library/classes/Gems/Snippets/Tracker/Summary/SummaryTableSnippet.php 2013-01-16 18:46:11 UTC (rev 1108) @@ -0,0 +1,127 @@ +<?php + +/** + * Copyright (c) 2012, Erasmus MC + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Erasmus MC nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * @package Gems + * @subpackage Tracker + * @author Matijs de Jong <mj...@ma...> + * @copyright Copyright (c) 2012 Erasmus MC + * @license New BSD License + * @version $id: ComplianceTableSnippet.php 203 2012-01-01t 12:51:32Z matijs $ + */ + +/** + * + * + * @package Gems + * @subpackage Tracker + * @copyright Copyright (c) 2012 Erasmus MC + * @license New BSD License + * @since Class available since version 1.5 + */ +class Gems_Snippets_Tracker_Summary_SummaryTableSnippet extends Gems_Snippets_ModelTableSnippetGeneric +{ + /** + * When true (= default) the headers get sortable links. + * + * @var boolean + */ + public $sortableLinks = false; + + /** + * Adds columns from the model to the bridge that creates the browse table. + * + * Overrule this function to add different columns to the browse table, without + * having to recode the core table building code. + * + * @param MUtil_Model_TableBridge $bridge + * @param MUtil_Model_ModelAbstract $model + * @return void + */ + protected function addBrowseTableColumns(MUtil_Model_TableBridge $bridge, MUtil_Model_ModelAbstract $model) + { + $bridge->getTable()->setAlternateRowClass('odd', 'odd', 'even', 'even'); + + $bridge->add('gro_round_description'); + $bridge->add('answered'); + $bridge->add('missed'); + $bridge->add('open'); + $bridge->add('future'); + $bridge->add('unknown'); + $bridge->addColumn(array('=', 'class' => 'centerAlign')); + $bridge->add('success'); + $bridge->tr(); + // $bridge->add('gsu_survey_name')->colspan = 4; + // $bridge->add('gsu_id_primary_group')->colspan = 2; + // $bridge->addColumn(); + $bridge->addColumn( + array( + $bridge->gsu_survey_name, + MUtil_Html::create('em', ' - ', $bridge->gsu_id_primary_group) + ), + array( + $model->get('gsu_survey_name', 'label'), + MUtil_Html::create('em', ' - ', $model->get('gsu_id_primary_group', 'label')) + ) + )->colspan = 7; + $bridge->add('removed'); + } + + /** + * + * @return int Return the track id if any or null + */ + public function getTrackId() + { + if ($this->requestCache) { + $data = $this->requestCache->getProgramParams(); + if (isset($data['gto_id_track'])) { + return $data['gto_id_track']; + } + } else { + return $this->request->getParam('gto_id_track'); + } + } + + /** + * Overrule to implement snippet specific filtering and sorting. + * + * @param MUtil_Model_ModelAbstract $model + */ + protected function processFilterAndSort(MUtil_Model_ModelAbstract $model) + { + $trackId = $this->getTrackId(); + + if ($trackId) { + parent::processFilterAndSort($model); + } else { + $model->setFilter(array('1=0')); + $this->onEmpty = $this->_('No track selected...'); + } + } +} Modified: trunk/library/classes/MUtil/Model/ModelAbstract.php =================================================================== --- trunk/library/classes/MUtil/Model/ModelAbstract.php 2013-01-16 12:56:22 UTC (rev 1107) +++ trunk/library/classes/MUtil/Model/ModelAbstract.php 2013-01-16 18:46:11 UTC (rev 1108) @@ -937,7 +937,7 @@ public function has($name, $subkey = null) { if (null === $subkey) { - return isset($this->_model[$name]); + return array_key_exists($name, $this->_model); } else { return isset($this->_model[$name][$subkey]); } @@ -1258,27 +1258,32 @@ $args = func_get_args(); $args = MUtil_Ra::pairs($args, 1); - foreach ($args as $key => $value) { - // If $key end with ] it is array value - if (substr($key, -1) == ']') { - if (substr($key, -2) == '[]') { - // If $key ends with [], append it to array - $key = substr($key, 0, -2); - $this->_model[$name][$key][] = $value; + if ($args) { + foreach ($args as $key => $value) { + // If $key end with ] it is array value + if (substr($key, -1) == ']') { + if (substr($key, -2) == '[]') { + // If $key ends with [], append it to array + $key = substr($key, 0, -2); + $this->_model[$name][$key][] = $value; + } else { + // Otherwise extract subkey + $pos = strpos($key, '['); + $subkey = substr($key, $pos + 1, -1); + $key = substr($key, 0, $pos); + + $this->_model[$name][$key][$subkey] = $value; + } } else { - // Otherwise extract subkey - $pos = strpos($key, '['); - $subkey = substr($key, $pos + 1, -1); - $key = substr($key, 0, $pos); - - $this->_model[$name][$key][$subkey] = $value; + $this->_model[$name][$key] = $value; } - } else { - $this->_model[$name][$key] = $value; } + } elseif (!array_key_exists($name, $this->_model)) { + // Make sure this key occurs + $this->_model[$name] = array(); } - //Now set the order (repeat always, because order can be changed later on) + // Now set the order (repeat always, because order can be changed later on) if (isset($this->_model[$name]['order'])) { $order = $this->_model[$name]['order']; } elseif (isset($this->_model_order[$name]) && is_int($this->_model_order[$name])) { Modified: trunk/library/classes/MUtil/Model/SelectModel.php =================================================================== --- trunk/library/classes/MUtil/Model/SelectModel.php 2013-01-16 12:56:22 UTC (rev 1107) +++ trunk/library/classes/MUtil/Model/SelectModel.php 2013-01-16 18:46:11 UTC (rev 1108) @@ -1,39 +1,48 @@ <?php - -/** - * Copyright (c) 2011, Erasmus MC - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Erasmus MC nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - + /** - * @author Matijs de Jong - * @since 1.0 - * @version 1.1 - * @package MUtil + * Copyright (c) 2011, Erasmus MC + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Erasmus MC nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * @package MUtil * @subpackage Model + * @author Matijs de Jong <mj...@ma...> + * @copyright Copyright (c) 2011 Erasmus MC + * @license New BSD License + * @version $Id$ */ + +/** + * A model that takes any Zend_Db_Select statement as a source + * + * @package MUtil + * @subpackage Model + * @copyright Copyright (c) 2011 Erasmus MC + * @license New BSD License + * @since Class available since version 1.0 + */ class MUtil_Model_SelectModel extends MUtil_Model_DatabaseModelAbstract { /** @@ -45,12 +54,30 @@ */ public $canCreate = false; + /** + * + * @var Zend_Db_Select + */ private $_select; + /** + * + * @param Zend_Db_Select $select + * @param string $name Optiona name + */ public function __construct(Zend_Db_Select $select, $name = null) { $this->_select = $select; + // Make sure the columns are known to the model + foreach ($select->getPart(Zend_Db_Select::COLUMNS) as $column) { + if (isset($column[2])) { + $this->set($column[2]); + } elseif (is_string($column[1])) { + $this->set($column[1]); + } + } + if (null === $name) { $name = 'rnd' . rand(10000, 999999); } @@ -58,21 +85,45 @@ parent::__construct($name); } + /** + * Delete items from the model + * + * @param mixed $filter True to use the stored filter, array to specify a different filter + * @return int The number of items deleted + */ public function delete($filter = true) { throw new Exception('Cannot delete ' . __CLASS__ . ' data.'); } + /** + * The database adapter used by the model. + * + * @return Zend_Db_Adapter_Abstract + */ public function getAdapter() { return $this->_select->getAdapter(); } + /** + * The select object where we get the query from. + * + * @return Zend_Db_Table_Select + */ public function getSelect() { return clone $this->_select; } + /** + * Save a single model item. + * + * @param array $newValues The values to store for a single model item. + * @param array $filter If the filter contains old key values these are used + * to decide on update versus insert. + * @return array The values as they are after saving (they may change). + */ public function save(array $newValues, array $filter = null) { throw new Exception('Cannot save ' . __CLASS__ . ' data.'); Modified: trunk/library/classes/MUtil/Snippets/ModelTableSnippetAbstract.php =================================================================== --- trunk/library/classes/MUtil/Snippets/ModelTableSnippetAbstract.php 2013-01-16 12:56:22 UTC (rev 1107) +++ trunk/library/classes/MUtil/Snippets/ModelTableSnippetAbstract.php 2013-01-16 18:46:11 UTC (rev 1108) @@ -121,7 +121,7 @@ } else { foreach($model->getItemsOrdered() as $name) { if ($label = $model->get($name, 'label')) { - $bridge->addColumn($bridge->$name, $label); + $bridge->add($name, $label); } } } Modified: trunk/library/configs/db/patches.sql =================================================================== --- trunk/library/configs/db/patches.sql 2013-01-16 12:56:22 UTC (rev 1107) +++ trunk/library/configs/db/patches.sql 2013-01-16 18:46:11 UTC (rev 1108) @@ -465,3 +465,5 @@ UPDATE gems__roles SET grl_privileges = CONCAT(grl_privileges, ',pr.plan.compliance') WHERE grl_privileges LIKE '%pr.plan.%' AND grl_privileges NOT LIKE '%pr.plan.compliance%'; +UPDATE gems__roles SET grl_privileges = CONCAT(grl_privileges, ',pr.plan.summary') + WHERE grl_privileges LIKE '%pr.plan.%' AND grl_privileges NOT LIKE '%pr.plan.summary%'; Copied: trunk/library/controllers/SummaryController.php (from rev 1107, trunk/library/controllers/ComplianceController.php) =================================================================== --- trunk/library/controllers/SummaryController.php (rev 0) +++ trunk/library/controllers/SummaryController.php 2013-01-16 18:46:11 UTC (rev 1108) @@ -0,0 +1,50 @@ +<?php + +/** + * Copyright (c) 2012, Erasmus MC + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Erasmus MC nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * @package Gems + * @subpackage Default + * @author Matijs de Jong <mj...@ma...> + * @copyright Copyright (c) 2012 Erasmus MC + * @license New BSD License + * @version $id: ComplianceController.php 203 2012-01-01t 12:51:32Z matijs $ + */ + +/** + * + * + * @package Gems + * @subpackage Default + * @copyright Copyright (c) 2012 Erasmus MC + * @license New BSD License + * @since Class available since version 1.6 + */ +class SummaryController extends Gems_Default_SummaryAction +{ + +} Modified: trunk/library/languages/default-en.mo =================================================================== (Binary files differ) Modified: trunk/library/languages/default-en.po =================================================================== --- trunk/library/languages/default-en.po 2013-01-16 12:56:22 UTC (rev 1107) +++ trunk/library/languages/default-en.po 2013-01-16 18:46:11 UTC (rev 1108) @@ -2,7 +2,7 @@ msgstr "" "Project-Id-Version: GemsTracker EN\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-01-15 19:02+0100\n" +"POT-Creation-Date: 2013-01-16 19:26+0100\n" "PO-Revision-Date: \n" "Last-Translator: Matijs de Jong <mj...@ma...>\n" "Language-Team: Erasmus MGZ <mat...@ma...>\n" @@ -329,15 +329,15 @@ #: classes/Gems/Menu.php:323 classes/Gems/Menu.php:423 #: classes/Gems/Email/EmailFormAbstract.php:280 #: classes/Gems/Email/EmailFormAbstract.php:291 -#: classes/Gems/Menu/MenuAbstract.php:381 -#: classes/Gems/Menu/MenuAbstract.php:394 +#: classes/Gems/Menu/MenuAbstract.php:383 +#: classes/Gems/Menu/MenuAbstract.php:396 msgid "Preview" msgstr "Preview" #: classes/Gems/Menu.php:332 classes/Gems/Default/ExportAction.php:149 #: classes/Gems/Default/TrackMaintenanceAction.php:336 -#: classes/Gems/Menu/MenuAbstract.php:390 -#: classes/Gems/Menu/MenuAbstract.php:472 snippets/AddTracksSnippet.php:238 +#: classes/Gems/Menu/MenuAbstract.php:392 +#: classes/Gems/Menu/MenuAbstract.php:474 snippets/AddTracksSnippet.php:238 msgid "Tracks" msgstr "Tracks" @@ -355,8 +355,8 @@ #: classes/Gems/Menu.php:377 #: classes/Gems/Default/SurveyMaintenanceAction.php:586 -#: classes/Gems/Menu/MenuAbstract.php:397 -#: classes/Gems/Menu/MenuAbstract.php:459 +#: classes/Gems/Menu/MenuAbstract.php:399 +#: classes/Gems/Menu/MenuAbstract.php:461 #: classes/Gems/Tracker/Model/TrackModel.php:100 msgid "Surveys" msgstr "Surveys" @@ -388,7 +388,7 @@ msgid "Overview" msgstr "Overview" -#: classes/Gems/Menu.php:593 classes/Gems/Menu/MenuAbstract.php:354 +#: classes/Gems/Menu.php:593 classes/Gems/Menu/MenuAbstract.php:356 msgid "Project" msgstr "Project" @@ -817,7 +817,6 @@ msgstr "End date" #: classes/Gems/Default/ComplianceAction.php:98 -#: classes/Gems/Menu/MenuAbstract.php:325 msgid "Compliance" msgstr "Compliance" @@ -1222,6 +1221,7 @@ #: classes/Gems/Default/ExportAction.php:154 #: classes/Gems/Default/MailJobAction.php:100 #: classes/Gems/Default/ProjectSurveysAction.php:67 +#: classes/Gems/Default/SummaryAction.php:155 #: classes/Gems/Default/SurveyAction.php:201 #: classes/Gems/Email/OneMailForm.php:57 #: classes/Gems/Export/RespondentExport.php:156 @@ -1757,6 +1757,7 @@ #: classes/Gems/Default/StaffAction.php:335 #: classes/Gems/Default/StaffAction.php:405 #: classes/Gems/Snippets/Tracker/Compliance/ComplianceSearchFormSnippet.php:66 +#: classes/Gems/Snippets/Tracker/Summary/SummarySearchFormSnippet.php:66 msgid "(all organizations)" msgstr "(all organizations)" @@ -2054,7 +2055,7 @@ msgstr "Session content" #: classes/Gems/Default/ProjectInformationAction.php:226 -#: classes/Gems/Menu/MenuAbstract.php:355 +#: classes/Gems/Menu/MenuAbstract.php:357 msgid "Session" msgstr "Session" @@ -2524,7 +2525,7 @@ msgstr[1] "sources" #: classes/Gems/Default/SourceAction.php:249 -#: classes/Gems/Menu/MenuAbstract.php:450 +#: classes/Gems/Menu/MenuAbstract.php:452 msgid "Survey Sources" msgstr "Survey Sources" @@ -2606,6 +2607,68 @@ msgid "You are not allowed to change this password." msgstr "You are not allowed to change this password." +#: classes/Gems/Default/SummaryAction.php:154 +#: classes/Gems/Email/OneMailForm.php:55 +#: classes/Gems/Export/RespondentExport.php:157 +#: classes/Gems/Menu/MenuAbstract.php:497 +#: classes/Gems/Tracker/Model/StandardTokenModel.php:196 +msgid "Round" +msgstr "Round" + +#: classes/Gems/Default/SummaryAction.php:156 +msgid "Filler" +msgstr "Filler" + +#: classes/Gems/Default/SummaryAction.php:159 +#: classes/Gems/Default/TokenPlanAction.php:326 +#: classes/Gems/Selector/TokenByGroupDateSelector.php:139 +msgid "Answered" +msgstr "Answered" + +#: classes/Gems/Default/SummaryAction.php:160 +#: classes/Gems/Default/TokenPlanAction.php:327 +#: classes/Gems/Selector/TokenByGroupDateSelector.php:129 +#: classes/Gems/Tracker/Token.php:1038 +#: snippets/RespondentTokenTabsSnippet.php:68 +msgid "Missed" +msgstr "Missed" + +#: classes/Gems/Default/SummaryAction.php:161 +#: classes/Gems/Tracker/Token.php:1044 +msgid "Open" +msgstr "Open" + +#: classes/Gems/Default/SummaryAction.php:162 +#: classes/Gems/Tracker/Token.php:1040 classes/Gems/Tracker/Token.php:1042 +msgid "Future" +msgstr "Future" + +#: classes/Gems/Default/SummaryAction.php:163 +#: classes/Gems/Util/Translated.php:233 +msgid "Unknown" +msgstr "Unknown" + +#: classes/Gems/Default/SummaryAction.php:165 +msgid "Success" +msgstr "Success" + +#: classes/Gems/Default/SummaryAction.php:166 +msgid "Removed" +msgstr "Removed" + +#: classes/Gems/Default/SummaryAction.php:179 +msgid "Summary" +msgstr "Summary" + +#: classes/Gems/Default/SummaryAction.php:190 +#: classes/Gems/Default/TokenPlanAction.php:480 +#: classes/Gems/Default/TrackAction.php:450 +#: classes/Gems/Tracker/Snippets/EditTokenSnippetAbstract.php:141 +msgid "token" +msgid_plural "tokens" +msgstr[0] "token" +msgstr[1] "tokens" + #: classes/Gems/Default/SurveyAction.php:72 #: classes/Gems/Tracker/Snippets/EditSingleSurveyTokenSnippetAbstract.php:179 msgid "Add survey" @@ -2912,19 +2975,8 @@ msgid "Yet to Answer" msgstr "Yet to Answer" -#: classes/Gems/Default/TokenPlanAction.php:326 -#: classes/Gems/Selector/TokenByGroupDateSelector.php:139 -msgid "Answered" -msgstr "Answered" - -#: classes/Gems/Default/TokenPlanAction.php:327 -#: classes/Gems/Selector/TokenByGroupDateSelector.php:129 -#: classes/Gems/Tracker/Token.php:1038 -#: snippets/RespondentTokenTabsSnippet.php:68 -msgid "Missed" -msgstr "Missed" - #: classes/Gems/Default/TokenPlanAction.php:341 +#: classes/Gems/Snippets/Tracker/Summary/SummarySearchFormSnippet.php:79 msgid "(all fillers)" msgstr "(all fillers)" @@ -2940,14 +2992,6 @@ msgid "+" msgstr "+" -#: classes/Gems/Default/TokenPlanAction.php:480 -#: classes/Gems/Default/TrackAction.php:450 -#: classes/Gems/Tracker/Snippets/EditTokenSnippetAbstract.php:141 -msgid "token" -msgid_plural "tokens" -msgstr[0] "token" -msgstr[1] "tokens" - #: classes/Gems/Default/TokenPlanAction.php:485 msgid "Token planning" msgstr "Token planning" @@ -3175,7 +3219,7 @@ msgstr[1] "fields" #: classes/Gems/Default/TrackFieldsAction.php:175 -#: classes/Gems/Menu/MenuAbstract.php:475 +#: classes/Gems/Menu/MenuAbstract.php:477 msgid "Fields" msgstr "Fields" @@ -3304,7 +3348,7 @@ msgstr[1] "rounds" #: classes/Gems/Default/TrackRoundsAction.php:227 -#: classes/Gems/Menu/MenuAbstract.php:483 +#: classes/Gems/Menu/MenuAbstract.php:485 msgid "Rounds" msgstr "Rounds" @@ -3384,11 +3428,6 @@ msgid "BBCode info page" msgstr "BBCode info page" -#: classes/Gems/Email/Mailer.php:235 classes/Gems/Email/TemplateMailer.php:360 -#, php-format -msgid "Invalid e-mail address '%s'." -msgstr "Invalid e-mail address '%s'." - #: classes/Gems/Email/MailTemplateForm.php:56 msgid "Send (test)" msgstr "Send (test)" @@ -3430,13 +3469,6 @@ msgid "Survey cannot be taken at this moment." msgstr "Survey cannot be taken at this moment." -#: classes/Gems/Email/OneMailForm.php:55 -#: classes/Gems/Export/RespondentExport.php:157 -#: classes/Gems/Menu/MenuAbstract.php:495 -#: classes/Gems/Tracker/Model/StandardTokenModel.php:196 -msgid "Round" -msgstr "Round" - #: classes/Gems/Email/OneMailForm.php:58 #: classes/Gems/Tracker/Model/StandardTokenModel.php:199 msgid "Last contact" @@ -3462,6 +3494,11 @@ msgid "Sent %d e-mails, updated %d tokens." msgstr "Sent %d e-mails, updated %d tokens." +#: classes/Gems/Email/TemplateMailer.php:360 +#, php-format +msgid "Invalid e-mail address '%s'." +msgstr "Invalid e-mail address '%s'." + #: classes/Gems/Event/Survey/BeforeAnswering/GetPreviousAnswers.php:64 msgid "Previous Version Answers Lookup" msgstr "Previous Version Answers Lookup" @@ -3569,77 +3606,85 @@ msgid "Templates" msgstr "Templates" -#: classes/Gems/Menu/MenuAbstract.php:328 +#: classes/Gems/Menu/MenuAbstract.php:325 +msgid "Track Summary" +msgstr "Track Summary" + +#: classes/Gems/Menu/MenuAbstract.php:327 +msgid "Track Compliance" +msgstr "Track Compliance" + +#: classes/Gems/Menu/MenuAbstract.php:330 msgid "By period" msgstr "By period" -#: classes/Gems/Menu/MenuAbstract.php:329 +#: classes/Gems/Menu/MenuAbstract.php:331 msgid "By token" msgstr "By token" -#: classes/Gems/Menu/MenuAbstract.php:330 +#: classes/Gems/Menu/MenuAbstract.php:332 msgid "By respondent" msgstr "By patient" -#: classes/Gems/Menu/MenuAbstract.php:334 +#: classes/Gems/Menu/MenuAbstract.php:336 msgid "Bulk mail" msgstr "Bulk mail" -#: classes/Gems/Menu/MenuAbstract.php:352 +#: classes/Gems/Menu/MenuAbstract.php:354 msgid "Errors" msgstr "Errors" -#: classes/Gems/Menu/MenuAbstract.php:353 +#: classes/Gems/Menu/MenuAbstract.php:355 msgid "PHP" msgstr "PHP" -#: classes/Gems/Menu/MenuAbstract.php:356 +#: classes/Gems/Menu/MenuAbstract.php:358 msgid "Maintenance mode" msgstr "Maintenance mode" -#: classes/Gems/Menu/MenuAbstract.php:357 +#: classes/Gems/Menu/MenuAbstract.php:359 msgid "Clean cache" msgstr "Clean cache" -#: classes/Gems/Menu/MenuAbstract.php:424 +#: classes/Gems/Menu/MenuAbstract.php:426 msgid "Reset password" msgstr "Reset password" -#: classes/Gems/Menu/MenuAbstract.php:451 +#: classes/Gems/Menu/MenuAbstract.php:453 msgid "Check status" msgstr "Check status" -#: classes/Gems/Menu/MenuAbstract.php:452 +#: classes/Gems/Menu/MenuAbstract.php:454 msgid "Synchronize surveys" msgstr "Synchronize surveys" -#: classes/Gems/Menu/MenuAbstract.php:453 -#: classes/Gems/Menu/MenuAbstract.php:466 +#: classes/Gems/Menu/MenuAbstract.php:455 +#: classes/Gems/Menu/MenuAbstract.php:468 msgid "Check is answered" msgstr "Check is answered" -#: classes/Gems/Menu/MenuAbstract.php:454 +#: classes/Gems/Menu/MenuAbstract.php:456 msgid "Check attributes" msgstr "Check attributes" -#: classes/Gems/Menu/MenuAbstract.php:455 +#: classes/Gems/Menu/MenuAbstract.php:457 msgid "Synchronize all surveys" msgstr "Synchronize all surveys" -#: classes/Gems/Menu/MenuAbstract.php:456 -#: classes/Gems/Menu/MenuAbstract.php:467 +#: classes/Gems/Menu/MenuAbstract.php:458 +#: classes/Gems/Menu/MenuAbstract.php:469 msgid "Check all is answered" msgstr "Check all is answered" -#: classes/Gems/Menu/MenuAbstract.php:463 +#: classes/Gems/Menu/MenuAbstract.php:465 msgid "PDF" msgstr "PDF" -#: classes/Gems/Menu/MenuAbstract.php:501 +#: classes/Gems/Menu/MenuAbstract.php:503 msgid "Check assignments" msgstr "Check assignments" -#: classes/Gems/Menu/MenuAbstract.php:504 +#: classes/Gems/Menu/MenuAbstract.php:506 msgid "Check all assignments" msgstr "Check all assignments" @@ -3862,10 +3907,12 @@ msgstr "Unknown respondent %s" #: classes/Gems/Snippets/Tracker/Compliance/ComplianceSearchFormSnippet.php:62 +#: classes/Gems/Snippets/Tracker/Summary/SummarySearchFormSnippet.php:62 msgid "(select a track)" msgstr "(select a track)" #: classes/Gems/Snippets/Tracker/Compliance/ComplianceTableSnippet.php:178 +#: classes/Gems/Snippets/Tracker/Summary/SummaryTableSnippet.php:124 msgid "No track selected..." msgstr "No track selected..." @@ -3953,14 +4000,6 @@ msgid "Completed" msgstr "Completed" -#: classes/Gems/Tracker/Token.php:1040 classes/Gems/Tracker/Token.php:1042 -msgid "Future" -msgstr "Future" - -#: classes/Gems/Tracker/Token.php:1044 -msgid "Open" -msgstr "Open" - #: classes/Gems/Tracker/Batch/SynchronizeSourcesBatch.php:135 msgid "No surveys were changed." msgstr "No surveys were changed." @@ -4733,10 +4772,6 @@ msgid "Send one mail per respondent, mark only mailed tokens as send." msgstr "Send one mail per patient, mark only mailed tokens as send." -#: classes/Gems/Util/Translated.php:233 -msgid "Unknown" -msgstr "Unknown" - #: classes/Gems/Util/Translated.php:246 msgid "mr." msgstr "Mr." Modified: trunk/library/languages/default-nl.mo =================================================================== (Binary files differ) Modified: trunk/library/languages/default-nl.po =================================================================== --- trunk/library/languages/default-nl.po 2013-01-16 12:56:22 UTC (rev 1107) +++ trunk/library/languages/default-nl.po 2013-01-16 18:46:11 UTC (rev 1108) @@ -2,7 +2,7 @@ msgstr "" "Project-Id-Version: GemsTracker NL\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-01-15 19:03+0100\n" +"POT-Creation-Date: 2013-01-16 19:27+0100\n" "PO-Revision-Date: \n" "Last-Translator: Matijs de Jong <mj...@ma...>\n" "Language-Team: Erasmus MGZ <mat...@ma...>\n" @@ -329,15 +329,15 @@ #: classes/Gems/Menu.php:323 classes/Gems/Menu.php:423 #: classes/Gems/Email/EmailFormAbstract.php:280 #: classes/Gems/Email/EmailFormAbstract.php:291 -#: classes/Gems/Menu/MenuAbstract.php:381 -#: classes/Gems/Menu/MenuAbstract.php:394 +#: classes/Gems/Menu/MenuAbstract.php:383 +#: classes/Gems/Menu/MenuAbstract.php:396 msgid "Preview" msgstr "Preview" #: classes/Gems/Menu.php:332 classes/Gems/Default/ExportAction.php:149 #: classes/Gems/Default/TrackMaintenanceAction.php:336 -#: classes/Gems/Menu/MenuAbstract.php:390 -#: classes/Gems/Menu/MenuAbstract.php:472 snippets/AddTracksSnippet.php:238 +#: classes/Gems/Menu/MenuAbstract.php:392 +#: classes/Gems/Menu/MenuAbstract.php:474 snippets/AddTracksSnippet.php:238 msgid "Tracks" msgstr "Trajecten" @@ -355,8 +355,8 @@ #: classes/Gems/Menu.php:377 #: classes/Gems/Default/SurveyMaintenanceAction.php:586 -#: classes/Gems/Menu/MenuAbstract.php:397 -#: classes/Gems/Menu/MenuAbstract.php:459 +#: classes/Gems/Menu/MenuAbstract.php:399 +#: classes/Gems/Menu/MenuAbstract.php:461 #: classes/Gems/Tracker/Model/TrackModel.php:100 msgid "Surveys" msgstr "Vragenlijsten" @@ -388,7 +388,7 @@ msgid "Overview" msgstr "Overzicht" -#: classes/Gems/Menu.php:593 classes/Gems/Menu/MenuAbstract.php:354 +#: classes/Gems/Menu.php:593 classes/Gems/Menu/MenuAbstract.php:356 msgid "Project" msgstr "Project" @@ -819,7 +819,6 @@ msgstr "Einddatum" #: classes/Gems/Default/ComplianceAction.php:98 -#: classes/Gems/Menu/MenuAbstract.php:325 msgid "Compliance" msgstr "Voortgang" @@ -1227,6 +1226,7 @@ #: classes/Gems/Default/ExportAction.php:154 #: classes/Gems/Default/MailJobAction.php:100 #: classes/Gems/Default/ProjectSurveysAction.php:67 +#: classes/Gems/Default/SummaryAction.php:155 #: classes/Gems/Default/SurveyAction.php:201 #: classes/Gems/Email/OneMailForm.php:57 #: classes/Gems/Export/RespondentExport.php:156 @@ -1766,6 +1766,7 @@ #: classes/Gems/Default/StaffAction.php:335 #: classes/Gems/Default/StaffAction.php:405 #: classes/Gems/Snippets/Tracker/Compliance/ComplianceSearchFormSnippet.php:66 +#: classes/Gems/Snippets/Tracker/Summary/SummarySearchFormSnippet.php:66 msgid "(all organizations)" msgstr "(alle organisaties)" @@ -2065,7 +2066,7 @@ msgstr "Sessie inhoud" #: classes/Gems/Default/ProjectInformationAction.php:226 -#: classes/Gems/Menu/MenuAbstract.php:355 +#: classes/Gems/Menu/MenuAbstract.php:357 msgid "Session" msgstr "Sessie" @@ -2538,7 +2539,7 @@ msgstr[1] "bronnen" #: classes/Gems/Default/SourceAction.php:249 -#: classes/Gems/Menu/MenuAbstract.php:450 +#: classes/Gems/Menu/MenuAbstract.php:452 msgid "Survey Sources" msgstr "Bronnen" @@ -2622,6 +2623,68 @@ msgid "You are not allowed to change this password." msgstr "U mag dit wachtwoord niet wijzigen." +#: classes/Gems/Default/SummaryAction.php:154 +#: classes/Gems/Email/OneMailForm.php:55 +#: classes/Gems/Export/RespondentExport.php:157 +#: classes/Gems/Menu/MenuAbstract.php:497 +#: classes/Gems/Tracker/Model/StandardTokenModel.php:196 +msgid "Round" +msgstr "Ronde" + +#: classes/Gems/Default/SummaryAction.php:156 +msgid "Filler" +msgstr "Invuller" + +#: classes/Gems/Default/SummaryAction.php:159 +#: classes/Gems/Default/TokenPlanAction.php:326 +#: classes/Gems/Selector/TokenByGroupDateSelector.php:139 +msgid "Answered" +msgstr "Beantwoord" + +#: classes/Gems/Default/SummaryAction.php:160 +#: classes/Gems/Default/TokenPlanAction.php:327 +#: classes/Gems/Selector/TokenByGroupDateSelector.php:129 +#: classes/Gems/Tracker/Token.php:1038 +#: snippets/RespondentTokenTabsSnippet.php:68 +msgid "Missed" +msgstr "Gemist" + +#: classes/Gems/Default/SummaryAction.php:161 +#: classes/Gems/Tracker/Token.php:1044 +msgid "Open" +msgstr "Open" + +#: classes/Gems/Default/SummaryAction.php:162 +#: classes/Gems/Tracker/Token.php:1040 classes/Gems/Tracker/Token.php:1042 +msgid "Future" +msgstr "Toekomstig" + +#: classes/Gems/Default/SummaryAction.php:163 +#: classes/Gems/Util/Translated.php:233 +msgid "Unknown" +msgstr "Onbekend" + +#: classes/Gems/Default/SummaryAction.php:165 +msgid "Success" +msgstr "Succes" + +#: classes/Gems/Default/SummaryAction.php:166 +msgid "Removed" +msgstr "Verwijderd" + +#: classes/Gems/Default/SummaryAction.php:179 +msgid "Summary" +msgstr "Samenvatting" + +#: classes/Gems/Default/SummaryAction.php:190 +#: classes/Gems/Default/TokenPlanAction.php:480 +#: classes/Gems/Default/TrackAction.php:450 +#: classes/Gems/Tracker/Snippets/EditTokenSnippetAbstract.php:141 +msgid "token" +msgid_plural "tokens" +msgstr[0] "kenmerk" +msgstr[1] "kenmerken" + #: classes/Gems/Default/SurveyAction.php:72 #: classes/Gems/Tracker/Snippets/EditSingleSurveyTokenSnippetAbstract.php:179 msgid "Add survey" @@ -2931,19 +2994,8 @@ msgid "Yet to Answer" msgstr "Nog te beantwoorden" -#: classes/Gems/Default/TokenPlanAction.php:326 -#: classes/Gems/Selector/TokenByGroupDateSelector.php:139 -msgid "Answered" -msgstr "Beantwoord" - -#: classes/Gems/Default/TokenPlanAction.php:327 -#: classes/Gems/Selector/TokenByGroupDateSelector.php:129 -#: classes/Gems/Tracker/Token.php:1038 -#: snippets/RespondentTokenTabsSnippet.php:68 -msgid "Missed" -msgstr "Gemist" - #: classes/Gems/Default/TokenPlanAction.php:341 +#: classes/Gems/Snippets/Tracker/Summary/SummarySearchFormSnippet.php:79 msgid "(all fillers)" msgstr "(alle invullers)" @@ -2959,14 +3011,6 @@ msgid "+" msgstr "+" -#: classes/Gems/Default/TokenPlanAction.php:480 -#: classes/Gems/Default/TrackAction.php:450 -#: classes/Gems/Tracker/Snippets/EditTokenSnippetAbstract.php:141 -msgid "token" -msgid_plural "tokens" -msgstr[0] "kenmerk" -msgstr[1] "kenmerken" - #: classes/Gems/Default/TokenPlanAction.php:485 msgid "Token planning" msgstr "Per kenmerk plannen" @@ -3199,7 +3243,7 @@ msgstr[1] "velden" #: classes/Gems/Default/TrackFieldsAction.php:175 -#: classes/Gems/Menu/MenuAbstract.php:475 +#: classes/Gems/Menu/MenuAbstract.php:477 msgid "Fields" msgstr "Velden" @@ -3331,7 +3375,7 @@ msgstr[1] "rondes" #: classes/Gems/Default/TrackRoundsAction.php:227 -#: classes/Gems/Menu/MenuAbstract.php:483 +#: classes/Gems/Menu/MenuAbstract.php:485 msgid "Rounds" msgstr "Rondes" @@ -3411,11 +3455,6 @@ msgid "BBCode info page" msgstr "BBCode info pagina" -#: classes/Gems/Email/Mailer.php:235 classes/Gems/Email/TemplateMailer.php:360 -#, php-format -msgid "Invalid e-mail address '%s'." -msgstr "Ongeldig email adres '%s'." - #: classes/Gems/Email/MailTemplateForm.php:56 msgid "Send (test)" msgstr "Verstuur (test)" @@ -3457,13 +3496,6 @@ msgid "Survey cannot be taken at this moment." msgstr "Deze vragenlijst kan op dit moment niet afgenomen worden." -#: classes/Gems/Email/OneMailForm.php:55 -#: classes/Gems/Export/RespondentExport.php:157 -#: classes/Gems/Menu/MenuAbstract.php:495 -#: classes/Gems/Tracker/Model/StandardTokenModel.php:196 -msgid "Round" -msgstr "Ronde" - #: classes/Gems/Email/OneMailForm.php:58 #: classes/Gems/Tracker/Model/StandardTokenModel.php:199 msgid "Last contact" @@ -3489,6 +3521,11 @@ msgid "Sent %d e-mails, updated %d tokens." msgstr "%d emails verzonden en %d kenmerken bijgewerkt." +#: classes/Gems/Email/TemplateMailer.php:360 +#, php-format +msgid "Invalid e-mail address '%s'." +msgstr "Ongeldig email adres '%s'." + #: classes/Gems/Event/Survey/BeforeAnswering/GetPreviousAnswers.php:64 msgid "Previous Version Answers Lookup" msgstr "Antwoorden overnemen van vorige keer" @@ -3597,77 +3634,85 @@ msgid "Templates" msgstr "Sjablonen" -#: classes/Gems/Menu/MenuAbstract.php:328 +#: classes/Gems/Menu/MenuAbstract.php:325 +msgid "Track Summary" +msgstr "Traject Samenvatting" + +#: classes/Gems/Menu/MenuAbstract.php:327 +msgid "Track Compliance" +msgstr "Traject Voortgang" + +#: classes/Gems/Menu/MenuAbstract.php:330 msgid "By period" msgstr "Per periode" -#: classes/Gems/Menu/MenuAbstract.php:329 +#: classes/Gems/Menu/MenuAbstract.php:331 msgid "By token" msgstr "Per kenmerk" -#: classes/Gems/Menu/MenuAbstract.php:330 +#: classes/Gems/Menu/MenuAbstract.php:332 msgid "By respondent" msgstr "Per patiënt" -#: classes/Gems/Menu/MenuAbstract.php:334 +#: classes/Gems/Menu/MenuAbstract.php:336 msgid "Bulk mail" msgstr "Bulk mail" -#: classes/Gems/Menu/MenuAbstract.php:352 +#: classes/Gems/Menu/MenuAbstract.php:354 msgid "Errors" msgstr "Foutmeldingen" -#: classes/Gems/Menu/MenuAbstract.php:353 +#: classes/Gems/Menu/MenuAbstract.php:355 msgid "PHP" msgstr "PHP" -#: classes/Gems/Menu/MenuAbstract.php:356 +#: classes/Gems/Menu/MenuAbstract.php:358 msgid "Maintenance mode" msgstr "Onderhoudsmodus" -#: classes/Gems/Menu/MenuAbstract.php:357 +#: classes/Gems/Menu/MenuAbstract.php:359 msgid "Clean cache" msgstr "Cache opruimen" -#: classes/Gems/Menu/MenuAbstract.php:424 +#: classes/Gems/Menu/MenuAbstract.php:426 msgid "Reset password" msgstr "Wijzig wachtwoord" -#: classes/Gems/Menu/MenuAbstract.php:451 +#: classes/Gems/Menu/MenuAbstract.php:453 msgid "Check status" msgstr "Status controle" -#: classes/Gems/Menu/MenuAbstract.php:452 +#: classes/Gems/Menu/MenuAbstract.php:454 msgid "Synchronize surveys" msgstr "Synchroniseer vragenlijsten" -#: classes/Gems/Menu/MenuAbstract.php:453 -#: classes/Gems/Menu/MenuAbstract.php:466 +#: classes/Gems/Menu/MenuAbstract.php:455 +#: classes/Gems/Menu/MenuAbstract.php:468 msgid "Check is answered" msgstr "Controleer op antwoorden" -#: classes/Gems/Menu/MenuAbstract.php:454 +#: classes/Gems/Menu/MenuAbstract.php:456 msgid "Check attributes" msgstr "Controleer attributen" -#: classes/Gems/Menu/MenuAbstract.php:455 +#: classes/Gems/Menu/MenuAbstract.php:457 msgid "Synchronize all surveys" msgstr "Synchroniseer alle vragenlijsten" -#: classes/Gems/Menu/MenuAbstract.php:456 -#: classes/Gems/Menu/MenuAbstract.php:467 +#: classes/Gems/Menu/MenuAbstract.php:458 +#: classes/Gems/Menu/MenuAbstract.php:469 msgid "Check all is answered" msgstr "Controleer alles op antwoorden" -#: classes/Gems/Menu/MenuAbstract.php:463 +#: classes/Gems/Menu/MenuAbstract.php:465 msgid "PDF" msgstr "PDF" -#: classes/Gems/Menu/MenuAbstract.php:501 +#: classes/Gems/Menu/MenuAbstract.php:503 msgid "Check assignments" msgstr "Controleer toewijzingen" -#: classes/Gems/Menu/MenuAbstract.php:504 +#: classes/Gems/Menu/MenuAbstract.php:506 msgid "Check all assignments" msgstr "Controleer alle toewijzingen" @@ -3890,10 +3935,12 @@ msgstr "Onbekende patiënt %s" #: classes/Gems/Snippets/Tracker/Compliance/ComplianceSearchFormSnippet.php:62 +#: classes/Gems/Snippets/Tracker/Summary/SummarySearchFormSnippet.php:62 msgid "(select a track)" msgstr "(selecteer een traject)" #: classes/Gems/Snippets/Tracker/Compliance/ComplianceTableSnippet.php:178 +#: classes/Gems/Snippets/Tracker/Summary/SummaryTableSnippet.php:124 msgid "No track selected..." msgstr "Geen traject geselecteerd..." @@ -3983,14 +4030,6 @@ msgid "Completed" msgstr "Ingevuld" -#: classes/Gems/Tracker/Token.php:1040 classes/Gems/Tracker/Token.php:1042 -msgid "Future" -msgstr "Toekomstig" - -#: classes/Gems/Tracker/Token.php:1044 -msgid "Open" -msgstr "Open" - #: classes/Gems/Tracker/Batch/SynchronizeSourcesBatch.php:135 msgid "No surveys were changed... [truncated message content] |
From: <gem...@li...> - 2013-01-16 12:56:29
|
Revision: 1107 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=1107&view=rev Author: matijsdejong Date: 2013-01-16 12:56:22 +0000 (Wed, 16 Jan 2013) Log Message: ----------- PluginLoader.php paths no longer have to reverse themselves for every load Snippets/SnippetLoader.php loads non-prefixed classes last Modified Paths: -------------- trunk/library/classes/Gems/Snippets/SnippetLoader.php trunk/library/classes/MUtil/Loader/PluginLoader.php Modified: trunk/library/classes/Gems/Snippets/SnippetLoader.php =================================================================== --- trunk/library/classes/Gems/Snippets/SnippetLoader.php 2013-01-16 12:34:42 UTC (rev 1106) +++ trunk/library/classes/Gems/Snippets/SnippetLoader.php 2013-01-16 12:56:22 UTC (rev 1107) @@ -72,13 +72,8 @@ GEMS_LIBRARY_DIR . '/snippets', GEMS_ROOT_DIR . '/application/snippets', ); - foreach ($noPrefixDirs as $dir) { - if (file_exists($dir)) { - $this->_loader->addPrefixPath('', $dir); - } - } - - // $this->_loader->addPrefixPath('MUtil_Snippets', GEMS_LIBRARY_DIR . '/classes/MUtil/Snippets/Standard'); + $this->_loader->addPrefixPath('', $noPrefixDirs, false); + // $this->_loader->addFallBackPath(); // Enable to allow full class name specification } /** Modified: trunk/library/classes/MUtil/Loader/PluginLoader.php =================================================================== --- trunk/library/classes/MUtil/Loader/PluginLoader.php 2013-01-16 12:34:42 UTC (rev 1106) +++ trunk/library/classes/MUtil/Loader/PluginLoader.php 2013-01-16 12:56:22 UTC (rev 1107) @@ -49,17 +49,14 @@ /** * Add the default autoloader to this plugin loader. * + * @param boolean $prepend Put path at the beginning of the stack, the default is false * @return Zend_Loader_PluginLoader (continuation pattern) */ - public function addFallBackPath() + public function addFallBackPath($prepend = false) { // Add each of the classpath directories to the prefixpaths // with an empty prefix. - foreach (Zend_Loader::explodeIncludePath() as $include) { - if ($real = realpath($include)) { - parent::addPrefixPath('', $real); - } - } + $this->addPrefixPath('', Zend_Loader::explodeIncludePath(), $prepend); return $this; } @@ -68,20 +65,72 @@ * Add prefixed paths to the registry of paths * * @param string $prefix - * @param string $path + * @param mixed $paths String or an array of strings + * @param boolean $prepend Put path at the beginning of the stack (has no effect when prefix / dir already set) * @return Zend_Loader_PluginLoader (continuation pattern) */ - public function addPrefixPath($prefix, $path) + public function addPrefixPath($prefix, $paths, $prepend = true) { - if (!is_string($prefix) || !is_string($path)) { + if (!is_string($prefix) || !(is_string($paths) || is_array($paths))) { throw new Zend_Loader_PluginLoader_Exception('Zend_Loader_PluginLoader::addPrefixPath() method only takes strings for prefix and path.'); } - // MUtil_Echo::track(self::getAbsolutePaths($path)); - foreach (self::getAbsolutePaths($path) as $sub) { - parent::addPrefixPath($prefix, $sub); + $prefix = $this->_formatPrefix($prefix); + if ($this->_useStaticRegistry) { + $registry = self::$_staticPrefixToPaths[$this->_useStaticRegistry]; + } else { + $registry = $this->_prefixToPaths; } + if (isset($registry[$prefix])) { + $newPaths = $registry[$prefix]; + } else { + $newPaths = array(); + } + + $changed = false; + foreach ((array) $paths as $path) { + $path = rtrim($path, '/\\') . '/'; + + // MUtil_Echo::track(self::getAbsolutePaths($path)); + foreach (self::getAbsolutePaths($path) as $sub) { + if (! in_array($sub, $newPaths)) { + if ($prepend) { + array_unshift($newPaths, $sub . DIRECTORY_SEPARATOR); + } else { + array_push($newPaths, $sub . DIRECTORY_SEPARATOR); + } + $changed = true; + } + } + } + + if ($changed) { + if ($this->_useStaticRegistry) { + if ($prepend && !isset(self::$_staticPrefixToPaths[$this->_useStaticRegistry][$prefix])) { + self::$_staticPrefixToPaths[$this->_useStaticRegistry] = + array($prefix => $newPaths) + + self::$_staticPrefixToPaths[$this->_useStaticRegistry]; + } else { + self::$_staticPrefixToPaths[$this->_useStaticRegistry][$prefix] = $newPaths; + } + } else { + if ($prepend && !isset($this->_prefixToPaths[$prefix])) { + $this->_prefixToPaths = + array($prefix => $newPaths) + + $this->_prefixToPaths; + } else { + $this->_prefixToPaths[$prefix] = $newPaths; + } + } + } + /* + if (isset($this->_prefixToPaths[$prefix])) { + MUtil_Echo::track($prefix, $this->_prefixToPaths); + } else { + MUtil_Echo::track($prefix); + } // */ + return $this; } @@ -208,7 +257,7 @@ // Check simple concatenation foreach ($includePaths as $include) { if ($real = realpath($include . $path)) { - $results[] = $real;; + $results[] = $real; } } @@ -217,6 +266,18 @@ } /** + * Get path stack + * + * @param string $prefix + * @return false|array False if prefix does not exist, array otherwise + */ + public function getPaths($prefix = null) + { + // To return the same result as in the past. + return array_reverse(parent::getPaths($prefix)); + } + + /** * Do a quick check for a path being absolute (may not work for some exotic absolute paths though) * * @param string $path @@ -265,7 +326,6 @@ $registry = $this->_prefixToPaths; } - $registry = array_reverse($registry, true); $found = false; $classFile = str_replace('_', DIRECTORY_SEPARATOR, $name) . '.php'; $incFile = self::getIncludeFileCache(); @@ -277,8 +337,6 @@ break; } - $paths = array_reverse($paths, true); - foreach ($paths as $path) { $loadFile = $path . $classFile; // Can use file_exist now, as any paths in the class path that This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2013-01-16 12:34:48
|
Revision: 1106 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=1106&view=rev Author: mennodekker Date: 2013-01-16 12:34:42 +0000 (Wed, 16 Jan 2013) Log Message: ----------- quickfix for fallback path Modified Paths: -------------- trunk/library/classes/Gems/Loader/LoaderAbstract.php Modified: trunk/library/classes/Gems/Loader/LoaderAbstract.php =================================================================== --- trunk/library/classes/Gems/Loader/LoaderAbstract.php 2013-01-16 12:16:50 UTC (rev 1105) +++ trunk/library/classes/Gems/Loader/LoaderAbstract.php 2013-01-16 12:34:42 UTC (rev 1106) @@ -103,7 +103,7 @@ foreach ($dirs as $prefix => $path) { $newdirs[$prefix . '_' . $this->cascade] = $path . '/' . strtr($this->cascade, '_', '/'); } - $this->_dirs = $newdirs; + $this->_dirs = array ('' =>'') + $newdirs; // Quick fix for fallback path } $this->_loader = new MUtil_Loader_PluginLoader($this->_dirs); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2013-01-16 12:16:56
|
Revision: 1105 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=1105&view=rev Author: mennodekker Date: 2013-01-16 12:16:50 +0000 (Wed, 16 Jan 2013) Log Message: ----------- Don't set default track end date to creation date Modified Paths: -------------- trunk/library/classes/Gems/Tracker/Snippets/EditTrackSnippetAbstract.php Modified: trunk/library/classes/Gems/Tracker/Snippets/EditTrackSnippetAbstract.php =================================================================== --- trunk/library/classes/Gems/Tracker/Snippets/EditTrackSnippetAbstract.php 2013-01-16 11:20:38 UTC (rev 1104) +++ trunk/library/classes/Gems/Tracker/Snippets/EditTrackSnippetAbstract.php 2013-01-16 12:16:50 UTC (rev 1105) @@ -156,7 +156,7 @@ $model->set('gr2t_end_date', 'label', $this->_('Ending on'), 'dateFormat', 'dd-MM-yyyy', 'formatFunction', $this->loader->getUtil()->getTranslated()->formatDate, - 'default', new Zend_Date()); + 'default', null); $model->set('gr2t_reception_code'); $model->set('gr2t_comment', 'label', $this->_('Comment')); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2013-01-16 11:20:45
|
Revision: 1104 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=1104&view=rev Author: mennodekker Date: 2013-01-16 11:20:38 +0000 (Wed, 16 Jan 2013) Log Message: ----------- Removed mailer class and moved Gems specific mail handling to Gems_Mail Modified Paths: -------------- trunk/library/classes/Gems/Mail.php Removed Paths: ------------- trunk/library/classes/Gems/Email/Mailer.php Deleted: trunk/library/classes/Gems/Email/Mailer.php =================================================================== --- trunk/library/classes/Gems/Email/Mailer.php 2013-01-15 20:18:29 UTC (rev 1103) +++ trunk/library/classes/Gems/Email/Mailer.php 2013-01-16 11:20:38 UTC (rev 1104) @@ -1,322 +0,0 @@ -<?php - -/** - * Copyright (c) 2011, Erasmus MC - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Erasmus MC nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * @version $Id: TemplateMailer.php 792 2012-06-27 11:59:17Z matijsdejong $ - * @package Gems - * @subpackage Email - * @copyright Copyright (c) 2011 Erasmus MC - * @license New BSD License - */ - -/** - * Mailer utility class - * - * @author Michiel Rook <mi...@to...> - * @package Gems - * @subpackage Email - * @copyright Copyright (c) 2011 Erasmus MC - * @license New BSD License - */ -class Gems_Email_Mailer -{ - const MAIL_NO_ENCRYPT = 0; - const MAIL_SSL = 1; - const MAIL_TLS = 2; - - /** - * Should the mailer continue sending mails, even when it encounters errors? - * - * @var boolean - */ - public $continueOnError = false; - - /** - * - * @var Zend_Mail_Transport - */ - protected $defaultTransport = null; - - /** - * @var GemsEscort $escort - */ - protected $escort; - - /** - * Feedback messages for this action. - * - * @var array of string - */ - protected $messages = array(); - - private $_changeDate; - private $_mailSubject; - private $_mailDate; - - private $_subject = null; - private $_body = null; - private $_templateId = null; // Not used for lookup - - private $_verbose = false; - - /** - * Constructs a new Gems_Email_TemplateMailer - * @param GemsEscort $escort - */ - public function __construct(GemsEscort $escort) - { - $this->escort = $escort; - $this->_mailDate = MUtil_Date::format(new Zend_Date(), 'yyyy-MM-dd'); - } - - protected function addMessage($message) - { - $this->messages[] = $message; - return $this; - } - - /** - * Returns true if the "email.bounce" setting exists in the project - * configuration and is true - * @return boolean - */ - public function bounceCheck() - { - return $this->escort->project->getEmailBounce(); - } - - /** - * Returns Zend_Mail_Transport_Abstract when something else than the default mail protocol should be used. - * - * @staticvar array $mailServers - * @param email address $from - * @return Zend_Mail_Transport_Abstract or null - */ - public function checkTransport($from) - { - static $mailServers = array(); - - if (! array_key_exists($from, $mailServers)) { - $sql = 'SELECT * FROM gems__mail_servers WHERE ? LIKE gms_from ORDER BY LENGTH(gms_from) DESC LIMIT 1'; - - // Always set cache, se we know when not to check for this row. - $serverData = $this->escort->db->fetchRow($sql, $from); - - // MUtil_Echo::track($serverData); - - if (isset($serverData['gms_server'])) { - $options = array(); - if (isset($serverData['gms_user'], $serverData['gms_password'])) { - $options['auth'] = 'login'; - $options['username'] = $serverData['gms_user']; - $options['password'] = $serverData['gms_password']; - } - if (isset($serverData['gms_port'])) { - $options['port'] = $serverData['gms_port']; - } - if (isset($serverData['gms_ssl'])) { - switch ($serverData['gms_ssl']) { - case self::MAIL_SSL: - $options['ssl'] = 'ssl'; - break; - - case self::MAIL_TLS: - $options['ssl'] = 'tls'; - break; - - default: - // intentional fall through - - } - } - - $mailServers[$from] = new Zend_Mail_Transport_Smtp($serverData['gms_server'], $options); - } else { - $mailServers[$from] = $this->defaultTransport; - } - } - - return $mailServers[$from]; - } - - public function getMessages() - { - return $this->messages; - } - - /** - * Logs the communication if needed - * - * @param string $to Optional, if available the communication is logged. - * @param string $from Optional - * @param array $tokenData Optional, array containing grs_id_user, gor_id_organization, gto_id_token - */ - protected function logCommunication($to = null, $from = null, $tokenData = array() ) - { - if (null === $this->_changeDate) { - $this->_changeDate = new MUtil_Db_Expr_CurrentTimestamp(); - } - - $db = $this->escort->db; - $uid = $this->escort->getCurrentUserId(); - - if ($to) { - $cdata['grco_id_to'] = array_key_exists('grs_id_user', $tokenData) ? $tokenData['grs_id_user'] : 0 ; - $cdata['grco_id_by'] = $uid; - $cdata['grco_organization'] = array_key_exists('gor_id_organization', $tokenData) ? $tokenData['gor_id_organization'] : 0; - $cdata['grco_id_token'] = array_key_exists('gto_id_token', $tokenData) ? $tokenData['gto_id_token'] : null ; - - $cdata['grco_method'] = 'email'; - $cdata['grco_topic'] = substr($this->_mailSubject, 0, 120); - $cdata['grco_address'] = substr($to, 0, 120); - $cdata['grco_sender'] = substr($from, 0, 120); - - $cdata['grco_id_message'] = $this->_templateId ? $this->_templateId : null; - - $cdata['grco_changed'] = $this->_changeDate; - $cdata['grco_changed_by'] = $uid; - $cdata['grco_created'] = $this->_changeDate; - $cdata['grco_created_by'] = $uid; - - $db->insert('gems__log_respondent_communications', $cdata); - } - } - - /** - * Sends a single e-mail - * @param string $to - * @param string $to_name - * @param string $from - * @param string $from_name - * @param array $tokenData - * @return boolean|string String = error message from protocol. - */ - public function sendMail($to, $to_name, $from, $from_name, array $tokenData) - { - if (empty($from) || empty($to)) { - return "Need a sender and a recipient to continue"; - } - - if ($this->_verbose) { - MUtil_Echo::r($to, $to_name); - MUtil_Echo::r($from, $from_name); - } - - - // If bounce is active, the Gems_Mail will take care of resetting the to field - if (!$this->bounceCheck()) { - $validate = new Zend_Validate_EmailAddress(); - - if (!$validate->isValid($to)) { - return sprintf($this->escort->_("Invalid e-mail address '%s'."), $to); - } - } - - $mail = new Gems_Mail(); - - $mail->setFrom($from, $from_name); - $mail->addTo($to, $to_name); - if (isset($this->escort->project->email['bcc'])) { - $mail->addBcc($this->escort->project->email['bcc']); - } - - $subject = $this->_subject; - $body = $this->_body; - - $mail->setSubject($subject); - $mail->setBodyBBCode($body); - - $this->_mailSubject = $subject; - - try { - $mail->send($this->checkTransport($from)); - $result = false; - - // communication successful, now log it - $this->logCommunication($to, $from, $tokenData); - - } catch (Exception $e) { - $result = $e->getMessage(); - - // Log to error file - $this->escort->logger->logError($e, $this->escort->request); - } - - return $result; - } - - /** - * Sets the body of the mail - * @param string $body - * @return Gems_Email_TemplateMailer (continuation pattern) - */ - public function setBody($body) - { - $this->_body = $body; - return $this; - } - - /** - * Set a different default transport protocol. - * - * @param Zend_Mail_Transport_Abstract $transport - * @return Gems_Email_TemplateMailer (continuation pattern) - */ - public function setDefaultTransport(Zend_Mail_Transport_Abstract $transport) - { - $this->defaultTransport = $transport; - return $this; - } - - /** - * Sets the subject of the mail - * @param string $subject - * @return Gems_Email_TemplateMailer (continuation pattern) - */ - public function setSubject($subject) - { - $this->_subject = $subject; - } - - public function setTemplateId($templatedId) - { - $this->_templateId = $templatedId; - return $this; - } - - /** - * Sets verbose (noisy) operation - * - * @param boolean $verbose - * @return Gems_Email_TemplateMailer (continuation pattern) - */ - public function setVerbose($verbose) - { - $this->_verbose = $verbose; - return $this; - } -} \ No newline at end of file Modified: trunk/library/classes/Gems/Mail.php =================================================================== --- trunk/library/classes/Gems/Mail.php 2013-01-15 20:18:29 UTC (rev 1103) +++ trunk/library/classes/Gems/Mail.php 2013-01-16 11:20:38 UTC (rev 1104) @@ -46,17 +46,36 @@ */ class Gems_Mail extends MUtil_Mail { + const MAIL_NO_ENCRYPT = 0; + const MAIL_SSL = 1; + const MAIL_TLS = 2; + /** + * @var GemsEscort + */ + public $escort = null; + + protected static $mailServers = array(); + + public function __construct($charset = null) { + parent::__construct($charset); + $this->escort = GemsEscort::getInstance(); + } + + /** * Adds To-header and recipient, $email can be an array, or a single string address * * @param string|array $email * @param string $name - * @param boolean $bounce When true the e-mail is bounced to the from address + * @param boolean $bounce When true the e-mail is bounced to the from address, when omitted bounce is read from project settings * @return Zend_Mail Provides fluent interface */ - public function addTo($email, $name = '', $bounce = false) + public function addTo($email, $name = '', $bounce = null) { - if ($bounce) { + if (is_null($bounce)) { + $bounce = $this->bounceCheck(); + } + if ($bounce === true) { $name = str_replace('@', ' at ', $email); $email = $this->getFrom(); @@ -67,7 +86,69 @@ return parent::addTo($email, $name); } + + /** + * Returns true if the "email.bounce" setting exists in the project + * configuration and is true + * @return boolean + */ + public function bounceCheck() + { + return $this->escort->project->getEmailBounce(); + } + + /** + * Returns Zend_Mail_Transport_Abstract when something else than the default mail protocol should be used. + * + * @staticvar array $mailServers + * @param email address $from + * @return Zend_Mail_Transport_Abstract or null + */ + public function checkTransport($from) + { + if (! array_key_exists($from, self::$mailServers)) { + $sql = 'SELECT * FROM gems__mail_servers WHERE ? LIKE gms_from ORDER BY LENGTH(gms_from) DESC LIMIT 1'; + // Always set cache, se we know when not to check for this row. + $serverData = $this->escort->db->fetchRow($sql, $from); + + // MUtil_Echo::track($serverData); + + if (isset($serverData['gms_server'])) { + $options = array(); + if (isset($serverData['gms_user'], $serverData['gms_password'])) { + $options['auth'] = 'login'; + $options['username'] = $serverData['gms_user']; + $options['password'] = $serverData['gms_password']; + } + if (isset($serverData['gms_port'])) { + $options['port'] = $serverData['gms_port']; + } + if (isset($serverData['gms_ssl'])) { + switch ($serverData['gms_ssl']) { + case self::MAIL_SSL: + $options['ssl'] = 'ssl'; + break; + + case self::MAIL_TLS: + $options['ssl'] = 'tls'; + break; + + default: + // intentional fall through + + } + } + + self::$mailServers[$from] = new Zend_Mail_Transport_Smtp($serverData['gms_server'], $options); + } else { + self::$mailServers[$from] = $this->getDefaultTransport(); + } + } + + return self::$mailServers[$from]; + } + /** * Returns the the current template * @@ -97,4 +178,13 @@ return $this; } + + public function send($transport = null) { + // Before we forward to the Zend_Mail send method, first perfom a bounce check + if (is_null($transport)) { + $transport = $this->checkTransport($this->getFrom()); + } + + parent::send($transport); + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2013-01-15 20:18:35
|
Revision: 1103 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=1103&view=rev Author: michieltcs Date: 2013-01-15 20:18:29 +0000 (Tue, 15 Jan 2013) Log Message: ----------- Correctly encode array values Modified Paths: -------------- trunk/library/classes/MUtil/Html/UrlArrayAttribute.php Modified: trunk/library/classes/MUtil/Html/UrlArrayAttribute.php =================================================================== --- trunk/library/classes/MUtil/Html/UrlArrayAttribute.php 2013-01-15 18:05:38 UTC (rev 1102) +++ trunk/library/classes/MUtil/Html/UrlArrayAttribute.php 2013-01-15 20:18:29 UTC (rev 1103) @@ -126,7 +126,9 @@ foreach ($request->getParams() as $key => $value) { if (!array_key_exists($key, $url_parameters)) { // E.g. Exceptions are stored as parameters :( - if (! is_object($value)) { + if (is_array($value)) { + $url_parameters[$key] = array_map('rawurlencode', $value); + } else if (! is_object($value)) { $url_parameters[$key] = rawurlencode($value); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2013-01-15 18:05:48
|
Revision: 1102 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=1102&view=rev Author: matijsdejong Date: 2013-01-15 18:05:38 +0000 (Tue, 15 Jan 2013) Log Message: ----------- Updated translations Modified Paths: -------------- trunk/library/languages/default-en.mo trunk/library/languages/default-en.po trunk/library/languages/default-nl.mo trunk/library/languages/default-nl.po Modified: trunk/library/languages/default-en.mo =================================================================== (Binary files differ) Modified: trunk/library/languages/default-en.po =================================================================== --- trunk/library/languages/default-en.po 2013-01-15 18:02:16 UTC (rev 1101) +++ trunk/library/languages/default-en.po 2013-01-15 18:05:38 UTC (rev 1102) @@ -2,7 +2,7 @@ msgstr "" "Project-Id-Version: GemsTracker EN\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-12-13 17:56+0100\n" +"POT-Creation-Date: 2013-01-15 19:02+0100\n" "PO-Revision-Date: \n" "Last-Translator: Matijs de Jong <mj...@ma...>\n" "Language-Team: Erasmus MGZ <mat...@ma...>\n" @@ -17,38 +17,38 @@ "X-Generator: Poedit 1.5.4\n" "X-Poedit-SearchPath-0: .\n" -#: classes/GemsEscort.php:228 +#: classes/GemsEscort.php:297 #, php-format msgid "Path %s not writable" msgstr "Path %s not writable" -#: classes/GemsEscort.php:619 +#: classes/GemsEscort.php:695 msgid " > " msgstr " > " -#: classes/GemsEscort.php:819 +#: classes/GemsEscort.php:888 #, php-format msgid "You are logged in as %s" msgstr "You are logged in as %s" -#: classes/GemsEscort.php:821 classes/Gems/Menu.php:263 +#: classes/GemsEscort.php:890 classes/Gems/Menu.php:263 msgid "Logoff" msgstr "Logoff" -#: classes/GemsEscort.php:824 +#: classes/GemsEscort.php:893 msgid "You are not logged in" msgstr "You are not logged in" -#: classes/GemsEscort.php:1018 +#: classes/GemsEscort.php:1087 #, php-format msgid "User: %s" msgstr "User: %s" -#: classes/GemsEscort.php:1043 +#: classes/GemsEscort.php:1112 msgid "version" msgstr "version" -#: classes/GemsEscort.php:1518 +#: classes/GemsEscort.php:1567 msgid "" "Take note: your session has expired, your inputs were not saved. Please " "check the input data and try again" @@ -56,50 +56,50 @@ "Take note: your session has expired, your inputs were not saved. Please " "check the input data and try again" -#: classes/GemsEscort.php:1647 +#: classes/GemsEscort.php:1717 msgid "Please check back later." msgstr "Please check back later." -#: classes/GemsEscort.php:1649 classes/GemsEscort.php:1653 -#: classes/GemsEscort.php:1654 +#: classes/GemsEscort.php:1719 classes/GemsEscort.php:1723 +#: classes/GemsEscort.php:1724 msgid "System is in maintenance mode" msgstr "System is in maintenance mode" -#: classes/GemsEscort.php:1665 +#: classes/GemsEscort.php:1735 msgid "No access to site." msgstr "No access to site." -#: classes/GemsEscort.php:1667 classes/GemsEscort.php:1710 +#: classes/GemsEscort.php:1737 classes/GemsEscort.php:1780 msgid "You have no access to this site." msgstr "You have no access to this site." -#: classes/GemsEscort.php:1683 classes/Gems/Default/StaffAction.php:317 +#: classes/GemsEscort.php:1753 classes/Gems/Default/StaffAction.php:317 msgid "No access to page" msgstr "No access to page" -#: classes/GemsEscort.php:1685 classes/Gems/Default/OrganizationAction.php:106 +#: classes/GemsEscort.php:1755 classes/Gems/Default/OrganizationAction.php:106 #: classes/Gems/Default/StaffAction.php:318 #: classes/Gems/Model/HiddenOrganizationModel.php:115 #, php-format msgid "Access to this page is not allowed for current role: %s." msgstr "Access to this page is not allowed for current role: %s." -#: classes/GemsEscort.php:1695 classes/GemsEscort.php:1708 +#: classes/GemsEscort.php:1765 classes/GemsEscort.php:1778 msgid "You are no longer logged in." msgstr "You are no longer logged in." -#: classes/GemsEscort.php:1696 +#: classes/GemsEscort.php:1766 msgid "You must login to access this page." msgstr "You must login to access this page." -#: classes/GemsEscort.php:1842 classes/GemsEscort.php:1844 +#: classes/GemsEscort.php:1912 classes/GemsEscort.php:1914 #, php-format msgid "%d survey" msgid_plural "%d surveys" msgstr[0] "%d survey" msgstr[1] "%d surveys" -#: classes/Gems/AccessLog.php:236 +#: classes/Gems/AccessLog.php:235 msgid "Database needs to be updated!" msgstr "Database needs to be updated!" @@ -311,7 +311,7 @@ #: classes/Gems/Export/RespondentExport.php:235 #: classes/Gems/Export/RespondentExport.php:247 #: classes/Gems/Tracker/Engine/StepEngineAbstract.php:484 -#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:752 +#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:728 #: classes/Gems/Tracker/Model/StandardTokenModel.php:216 #: classes/Gems/Tracker/Snippets/EditTrackSnippetAbstract.php:149 #: classes/Gems/Tracker/Snippets/ShowTrackUsageAbstract.php:146 @@ -322,22 +322,22 @@ #: classes/Gems/Menu.php:317 classes/Gems/Menu.php:342 #: classes/Gems/Menu.php:384 #: classes/Gems/Default/TrackMaintenanceAction.php:389 -#: snippets/AddTracksSnippet.php:239 +#: snippets/AddTracksSnippet.php:241 msgid "Add" msgstr "Add" #: classes/Gems/Menu.php:323 classes/Gems/Menu.php:423 #: classes/Gems/Email/EmailFormAbstract.php:280 #: classes/Gems/Email/EmailFormAbstract.php:291 -#: classes/Gems/Menu/MenuAbstract.php:378 -#: classes/Gems/Menu/MenuAbstract.php:391 +#: classes/Gems/Menu/MenuAbstract.php:381 +#: classes/Gems/Menu/MenuAbstract.php:394 msgid "Preview" msgstr "Preview" #: classes/Gems/Menu.php:332 classes/Gems/Default/ExportAction.php:149 #: classes/Gems/Default/TrackMaintenanceAction.php:336 -#: classes/Gems/Menu/MenuAbstract.php:387 -#: classes/Gems/Menu/MenuAbstract.php:469 snippets/AddTracksSnippet.php:236 +#: classes/Gems/Menu/MenuAbstract.php:390 +#: classes/Gems/Menu/MenuAbstract.php:472 snippets/AddTracksSnippet.php:238 msgid "Tracks" msgstr "Tracks" @@ -355,8 +355,8 @@ #: classes/Gems/Menu.php:377 #: classes/Gems/Default/SurveyMaintenanceAction.php:586 -#: classes/Gems/Menu/MenuAbstract.php:394 -#: classes/Gems/Menu/MenuAbstract.php:456 +#: classes/Gems/Menu/MenuAbstract.php:397 +#: classes/Gems/Menu/MenuAbstract.php:459 #: classes/Gems/Tracker/Model/TrackModel.php:100 msgid "Surveys" msgstr "Surveys" @@ -388,7 +388,7 @@ msgid "Overview" msgstr "Overview" -#: classes/Gems/Menu.php:593 classes/Gems/Menu/MenuAbstract.php:351 +#: classes/Gems/Menu.php:593 classes/Gems/Menu/MenuAbstract.php:354 msgid "Project" msgstr "Project" @@ -418,7 +418,7 @@ msgid "Changelog" msgstr "Changelog" -#: classes/Gems/Model.php:212 +#: classes/Gems/Model.php:212 classes/Gems/Default/ComplianceAction.php:84 #: classes/Gems/Tracker/Model/StandardTokenModel.php:213 msgid "Respondent nr" msgstr "Patient nr" @@ -624,7 +624,7 @@ #: classes/Gems/Tracker/Source/LimeSurvey1m9FieldMap.php:143 #: classes/Gems/Tracker/Source/LimeSurvey1m9FieldMap.php:147 #: classes/Gems/Tracker/Source/LimeSurvey1m9FieldMap.php:166 -#: classes/Gems/Util/Translated.php:263 +#: classes/Gems/Util/Translated.php:267 #: classes/MUtil/Snippets/ModelYesNoDeleteSnippetAbstract.php:192 #: snippets/DeleteSingleSurveyNotUsedTokenSnippet.php:124 msgid "Yes" @@ -642,7 +642,7 @@ #: classes/Gems/Tracker/Source/LimeSurvey1m9FieldMap.php:167 #: classes/Gems/Util/ReceptionCodeLibrary.php:99 #: classes/Gems/Util/ReceptionCodeLibrary.php:123 -#: classes/Gems/Util/Translated.php:263 +#: classes/Gems/Util/Translated.php:267 #: classes/MUtil/Snippets/ModelYesNoDeleteSnippetAbstract.php:194 #: snippets/DeleteSingleSurveyNotUsedTokenSnippet.php:125 msgid "No" @@ -808,6 +808,30 @@ msgid "The survey for token %s is no longer active." msgstr "The survey for token %s is no longer active." +#: classes/Gems/Default/ComplianceAction.php:85 +msgid "Start date" +msgstr "Start date" + +#: classes/Gems/Default/ComplianceAction.php:86 +msgid "End date" +msgstr "End date" + +#: classes/Gems/Default/ComplianceAction.php:98 +#: classes/Gems/Menu/MenuAbstract.php:325 +msgid "Compliance" +msgstr "Compliance" + +#: classes/Gems/Default/ComplianceAction.php:109 +#: classes/Gems/Default/ProjectTracksAction.php:85 +#: classes/Gems/Default/TrackAction.php:452 +#: classes/Gems/Default/TrackMaintenanceAction.php:331 +#: classes/Gems/Tracker/Snippets/EditTrackEngineSnippetGeneric.php:191 +#: classes/Gems/Tracker/Snippets/EditTrackSnippetAbstract.php:174 +msgid "track" +msgid_plural "tracks" +msgstr[0] "track" +msgstr[1] "tracks" + #: classes/Gems/Default/ConsentAction.php:68 #: classes/Gems/Default/GroupAction.php:116 #: classes/Gems/Default/ReceptionAction.php:81 @@ -818,7 +842,7 @@ #: classes/Gems/Default/TrackFieldsAction.php:101 #: classes/Gems/Default/UpgradeAction.php:176 #: classes/Gems/Export/RespondentExport.php:236 -#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:758 +#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:734 #: classes/Gems/Tracker/Model/StandardTokenModel.php:214 #: classes/Gems/Tracker/Snippets/EditTrackSnippetAbstract.php:150 #: classes/Gems/Tracker/Snippets/ShowTrackUsageAbstract.php:147 @@ -829,7 +853,7 @@ #: classes/Gems/Default/ConsentAction.php:70 #: classes/Gems/Default/DatabaseAction.php:139 #: classes/Gems/Default/TrackFieldsAction.php:97 -#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:757 +#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:733 msgid "Order" msgstr "Order" @@ -902,7 +926,7 @@ msgstr "On this test system all mail will be delivered to the from address." #: classes/Gems/Default/DatabaseAction.php:75 -#: classes/Gems/Default/ProjectInformationAction.php:191 +#: classes/Gems/Default/ProjectInformationAction.php:193 #: classes/Gems/Task/CleanCache.php:58 msgid "Cache cleaned" msgstr "Cache cleaned" @@ -1201,7 +1225,7 @@ #: classes/Gems/Default/SurveyAction.php:201 #: classes/Gems/Email/OneMailForm.php:57 #: classes/Gems/Export/RespondentExport.php:156 -#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:755 +#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:731 #: classes/Gems/Tracker/Model/StandardTokenModel.php:215 #: snippets/TrackSurveyOverviewSnippet.php:111 msgid "Survey" @@ -1242,7 +1266,7 @@ #: classes/Gems/Default/SourceAction.php:101 #: classes/Gems/Default/SurveyMaintenanceAction.php:448 #: classes/Gems/Default/SurveyMaintenanceAction.php:503 -#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:761 +#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:737 #: classes/Gems/Tracker/Model/TrackModel.php:102 #: classes/Gems/Util/TrackData.php:147 msgid "Active" @@ -1732,6 +1756,7 @@ #: classes/Gems/Default/RespondentAction.php:386 #: classes/Gems/Default/StaffAction.php:335 #: classes/Gems/Default/StaffAction.php:405 +#: classes/Gems/Snippets/Tracker/Compliance/ComplianceSearchFormSnippet.php:66 msgid "(all organizations)" msgstr "(all organizations)" @@ -1957,71 +1982,79 @@ msgstr "Gems web directory" #: classes/Gems/Default/ProjectInformationAction.php:140 +msgid "Gems root directory" +msgstr "Gems root directory" + +#: classes/Gems/Default/ProjectInformationAction.php:141 msgid "Gems code directory" msgstr "Gems code directory" -#: classes/Gems/Default/ProjectInformationAction.php:141 +#: classes/Gems/Default/ProjectInformationAction.php:142 msgid "MUtil version" msgstr "MUtil version" -#: classes/Gems/Default/ProjectInformationAction.php:142 +#: classes/Gems/Default/ProjectInformationAction.php:143 msgid "Zend version" msgstr "Zend version" -#: classes/Gems/Default/ProjectInformationAction.php:143 +#: classes/Gems/Default/ProjectInformationAction.php:144 msgid "Application environment" msgstr "Application environment" -#: classes/Gems/Default/ProjectInformationAction.php:144 +#: classes/Gems/Default/ProjectInformationAction.php:145 msgid "Application baseuri" msgstr "Application baseuri" -#: classes/Gems/Default/ProjectInformationAction.php:145 +#: classes/Gems/Default/ProjectInformationAction.php:146 msgid "Application directory" msgstr "Application directory" -#: classes/Gems/Default/ProjectInformationAction.php:146 +#: classes/Gems/Default/ProjectInformationAction.php:147 +msgid "Application encoding" +msgstr "Application encoding" + +#: classes/Gems/Default/ProjectInformationAction.php:148 msgid "PHP version" msgstr "PHP version" -#: classes/Gems/Default/ProjectInformationAction.php:147 +#: classes/Gems/Default/ProjectInformationAction.php:149 msgid "Server Hostname" msgstr "Server Hostname" -#: classes/Gems/Default/ProjectInformationAction.php:148 +#: classes/Gems/Default/ProjectInformationAction.php:150 msgid "Server OS" msgstr "Server OS" -#: classes/Gems/Default/ProjectInformationAction.php:149 +#: classes/Gems/Default/ProjectInformationAction.php:151 msgid "Time on server" msgstr "Time on server" -#: classes/Gems/Default/ProjectInformationAction.php:153 +#: classes/Gems/Default/ProjectInformationAction.php:155 msgid "Turn Maintenance Mode OFF" msgstr "Turn Maintenance Mode OFF" -#: classes/Gems/Default/ProjectInformationAction.php:155 +#: classes/Gems/Default/ProjectInformationAction.php:157 msgid "Turn Maintenance Mode ON" msgstr "Turn Maintenance Mode ON" -#: classes/Gems/Default/ProjectInformationAction.php:165 +#: classes/Gems/Default/ProjectInformationAction.php:167 msgid "Version information" msgstr "Version information" -#: classes/Gems/Default/ProjectInformationAction.php:199 +#: classes/Gems/Default/ProjectInformationAction.php:201 msgid "Server PHP Info" msgstr "Server PHP Info" -#: classes/Gems/Default/ProjectInformationAction.php:216 +#: classes/Gems/Default/ProjectInformationAction.php:218 msgid "Project settings" msgstr "Project settings" -#: classes/Gems/Default/ProjectInformationAction.php:223 +#: classes/Gems/Default/ProjectInformationAction.php:225 msgid "Session content" msgstr "Session content" -#: classes/Gems/Default/ProjectInformationAction.php:224 -#: classes/Gems/Menu/MenuAbstract.php:352 +#: classes/Gems/Default/ProjectInformationAction.php:226 +#: classes/Gems/Menu/MenuAbstract.php:355 msgid "Session" msgstr "Session" @@ -2058,16 +2091,6 @@ msgid "Survey #" msgstr "Survey #" -#: classes/Gems/Default/ProjectTracksAction.php:85 -#: classes/Gems/Default/TrackAction.php:452 -#: classes/Gems/Default/TrackMaintenanceAction.php:331 -#: classes/Gems/Tracker/Snippets/EditTrackEngineSnippetGeneric.php:191 -#: classes/Gems/Tracker/Snippets/EditTrackSnippetAbstract.php:174 -msgid "track" -msgid_plural "tracks" -msgstr[0] "track" -msgstr[1] "tracks" - #: classes/Gems/Default/ProjectTracksAction.php:90 msgid "Active tracks" msgstr "Active tracks" @@ -2501,7 +2524,7 @@ msgstr[1] "sources" #: classes/Gems/Default/SourceAction.php:249 -#: classes/Gems/Menu/MenuAbstract.php:447 +#: classes/Gems/Menu/MenuAbstract.php:450 msgid "Survey Sources" msgstr "Survey Sources" @@ -2769,7 +2792,7 @@ msgstr "After completion" #: classes/Gems/Default/SurveyMaintenanceAction.php:469 -#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:760 +#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:736 msgid "Answer display" msgstr "Answer display" @@ -2896,7 +2919,7 @@ #: classes/Gems/Default/TokenPlanAction.php:327 #: classes/Gems/Selector/TokenByGroupDateSelector.php:129 -#: classes/Gems/Tracker/Token.php:1032 +#: classes/Gems/Tracker/Token.php:1038 #: snippets/RespondentTokenTabsSnippet.php:68 msgid "Missed" msgstr "Missed" @@ -3152,7 +3175,7 @@ msgstr[1] "fields" #: classes/Gems/Default/TrackFieldsAction.php:175 -#: classes/Gems/Menu/MenuAbstract.php:472 +#: classes/Gems/Menu/MenuAbstract.php:475 msgid "Fields" msgstr "Fields" @@ -3281,7 +3304,7 @@ msgstr[1] "rounds" #: classes/Gems/Default/TrackRoundsAction.php:227 -#: classes/Gems/Menu/MenuAbstract.php:480 +#: classes/Gems/Menu/MenuAbstract.php:483 msgid "Rounds" msgstr "Rounds" @@ -3361,6 +3384,11 @@ msgid "BBCode info page" msgstr "BBCode info page" +#: classes/Gems/Email/Mailer.php:235 classes/Gems/Email/TemplateMailer.php:360 +#, php-format +msgid "Invalid e-mail address '%s'." +msgstr "Invalid e-mail address '%s'." + #: classes/Gems/Email/MailTemplateForm.php:56 msgid "Send (test)" msgstr "Send (test)" @@ -3404,7 +3432,7 @@ #: classes/Gems/Email/OneMailForm.php:55 #: classes/Gems/Export/RespondentExport.php:157 -#: classes/Gems/Menu/MenuAbstract.php:492 +#: classes/Gems/Menu/MenuAbstract.php:495 #: classes/Gems/Tracker/Model/StandardTokenModel.php:196 msgid "Round" msgstr "Round" @@ -3434,11 +3462,6 @@ msgid "Sent %d e-mails, updated %d tokens." msgstr "Sent %d e-mails, updated %d tokens." -#: classes/Gems/Email/TemplateMailer.php:360 -#, php-format -msgid "Invalid e-mail address '%s'." -msgstr "Invalid e-mail address '%s'." - #: classes/Gems/Event/Survey/BeforeAnswering/GetPreviousAnswers.php:64 msgid "Previous Version Answers Lookup" msgstr "Previous Version Answers Lookup" @@ -3546,77 +3569,77 @@ msgid "Templates" msgstr "Templates" -#: classes/Gems/Menu/MenuAbstract.php:325 +#: classes/Gems/Menu/MenuAbstract.php:328 msgid "By period" msgstr "By period" -#: classes/Gems/Menu/MenuAbstract.php:326 +#: classes/Gems/Menu/MenuAbstract.php:329 msgid "By token" msgstr "By token" -#: classes/Gems/Menu/MenuAbstract.php:327 +#: classes/Gems/Menu/MenuAbstract.php:330 msgid "By respondent" msgstr "By patient" -#: classes/Gems/Menu/MenuAbstract.php:331 +#: classes/Gems/Menu/MenuAbstract.php:334 msgid "Bulk mail" msgstr "Bulk mail" -#: classes/Gems/Menu/MenuAbstract.php:349 +#: classes/Gems/Menu/MenuAbstract.php:352 msgid "Errors" msgstr "Errors" -#: classes/Gems/Menu/MenuAbstract.php:350 +#: classes/Gems/Menu/MenuAbstract.php:353 msgid "PHP" msgstr "PHP" -#: classes/Gems/Menu/MenuAbstract.php:353 +#: classes/Gems/Menu/MenuAbstract.php:356 msgid "Maintenance mode" msgstr "Maintenance mode" -#: classes/Gems/Menu/MenuAbstract.php:354 +#: classes/Gems/Menu/MenuAbstract.php:357 msgid "Clean cache" msgstr "Clean cache" -#: classes/Gems/Menu/MenuAbstract.php:421 +#: classes/Gems/Menu/MenuAbstract.php:424 msgid "Reset password" msgstr "Reset password" -#: classes/Gems/Menu/MenuAbstract.php:448 +#: classes/Gems/Menu/MenuAbstract.php:451 msgid "Check status" msgstr "Check status" -#: classes/Gems/Menu/MenuAbstract.php:449 +#: classes/Gems/Menu/MenuAbstract.php:452 msgid "Synchronize surveys" msgstr "Synchronize surveys" -#: classes/Gems/Menu/MenuAbstract.php:450 -#: classes/Gems/Menu/MenuAbstract.php:463 +#: classes/Gems/Menu/MenuAbstract.php:453 +#: classes/Gems/Menu/MenuAbstract.php:466 msgid "Check is answered" msgstr "Check is answered" -#: classes/Gems/Menu/MenuAbstract.php:451 +#: classes/Gems/Menu/MenuAbstract.php:454 msgid "Check attributes" msgstr "Check attributes" -#: classes/Gems/Menu/MenuAbstract.php:452 +#: classes/Gems/Menu/MenuAbstract.php:455 msgid "Synchronize all surveys" msgstr "Synchronize all surveys" -#: classes/Gems/Menu/MenuAbstract.php:453 -#: classes/Gems/Menu/MenuAbstract.php:464 +#: classes/Gems/Menu/MenuAbstract.php:456 +#: classes/Gems/Menu/MenuAbstract.php:467 msgid "Check all is answered" msgstr "Check all is answered" -#: classes/Gems/Menu/MenuAbstract.php:460 +#: classes/Gems/Menu/MenuAbstract.php:463 msgid "PDF" msgstr "PDF" -#: classes/Gems/Menu/MenuAbstract.php:498 +#: classes/Gems/Menu/MenuAbstract.php:501 msgid "Check assignments" msgstr "Check assignments" -#: classes/Gems/Menu/MenuAbstract.php:501 +#: classes/Gems/Menu/MenuAbstract.php:504 msgid "Check all assignments" msgstr "Check all assignments" @@ -3693,48 +3716,48 @@ msgid "Now!" msgstr "Now!" -#: classes/Gems/Selector/DateSelectorAbstract.php:360 +#: classes/Gems/Selector/DateSelectorAbstract.php:361 msgid "Show by day" msgstr "Show by day" -#: classes/Gems/Selector/DateSelectorAbstract.php:361 +#: classes/Gems/Selector/DateSelectorAbstract.php:362 msgid "Show by week" msgstr "Show by week" -#: classes/Gems/Selector/DateSelectorAbstract.php:362 +#: classes/Gems/Selector/DateSelectorAbstract.php:363 msgid "Show by month" msgstr "Show by month" -#: classes/Gems/Selector/DateSelectorAbstract.php:363 +#: classes/Gems/Selector/DateSelectorAbstract.php:364 msgid "Show by year" msgstr "Show by year" -#: classes/Gems/Selector/DateSelectorAbstract.php:370 +#: classes/Gems/Selector/DateSelectorAbstract.php:371 msgid "D" msgstr "D" -#: classes/Gems/Selector/DateSelectorAbstract.php:371 +#: classes/Gems/Selector/DateSelectorAbstract.php:372 msgid "W" msgstr "W" -#: classes/Gems/Selector/DateSelectorAbstract.php:372 +#: classes/Gems/Selector/DateSelectorAbstract.php:373 msgid "M" msgstr "M" -#: classes/Gems/Selector/DateSelectorAbstract.php:373 +#: classes/Gems/Selector/DateSelectorAbstract.php:374 msgid "Y" msgstr "Y" -#: classes/Gems/Selector/DateSelectorAbstract.php:562 +#: classes/Gems/Selector/DateSelectorAbstract.php:563 #: classes/Gems/Util/Translated.php:81 msgid "-" msgstr "n/a" -#: classes/Gems/Selector/DateSelectorAbstract.php:605 +#: classes/Gems/Selector/DateSelectorAbstract.php:606 msgid "Period" msgstr "Period" -#: classes/Gems/Selector/DateSelectorAbstract.php:633 +#: classes/Gems/Selector/DateSelectorAbstract.php:634 #, php-format msgid "week %s" msgstr "week %s" @@ -3838,6 +3861,14 @@ msgid "Unknown respondent %s" msgstr "Unknown respondent %s" +#: classes/Gems/Snippets/Tracker/Compliance/ComplianceSearchFormSnippet.php:62 +msgid "(select a track)" +msgstr "(select a track)" + +#: classes/Gems/Snippets/Tracker/Compliance/ComplianceTableSnippet.php:178 +msgid "No track selected..." +msgstr "No track selected..." + #: classes/Gems/Task/Db/ExecutePatch.php:66 #, php-format msgid "Executing patchlevel %d" @@ -3863,14 +3894,14 @@ #: classes/Gems/Task/Tracker/CheckTrackTokens.php:64 #: classes/Gems/Tracker/ChangeTracker.php:81 -#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:431 +#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:407 #, php-format msgid "%2$d token date changes in %1$d tracks." msgstr "%2$d token date changes in %1$d tracks." #: classes/Gems/Task/Tracker/CheckTrackTokens.php:67 #: classes/Gems/Tracker/ChangeTracker.php:64 -#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:434 +#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:410 #, php-format msgid "Checked %d tracks." msgstr "Checked %d tracks." @@ -3896,19 +3927,19 @@ msgstr[1] "Check %s sources" #: classes/Gems/Tracker/ChangeTracker.php:84 -#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:417 +#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:393 #, php-format msgid "Round changes propagated to %d tokens." msgstr "Round changes propagated to %d tokens." #: classes/Gems/Tracker/ChangeTracker.php:87 -#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:421 +#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:397 #, php-format msgid "%d tokens deleted by round changes." msgstr "%d tokens deleted by round changes." #: classes/Gems/Tracker/ChangeTracker.php:90 -#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:425 +#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:401 #, php-format msgid "%d tokens created to by round changes." msgstr "%d tokens created to by round changes." @@ -3917,16 +3948,16 @@ msgid "No tokens were changed." msgstr "No tokens were changed." -#: classes/Gems/Tracker/Token.php:1026 +#: classes/Gems/Tracker/Token.php:1032 #: classes/Gems/Tracker/Model/StandardTokenModel.php:200 msgid "Completed" msgstr "Completed" -#: classes/Gems/Tracker/Token.php:1034 classes/Gems/Tracker/Token.php:1036 +#: classes/Gems/Tracker/Token.php:1040 classes/Gems/Tracker/Token.php:1042 msgid "Future" msgstr "Future" -#: classes/Gems/Tracker/Token.php:1038 +#: classes/Gems/Tracker/Token.php:1044 msgid "Open" msgstr "Open" @@ -4046,33 +4077,33 @@ msgid "Use a track level date." msgstr "Use a track level date." -#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:446 +#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:422 #, php-format msgid "%s track engines cannot be converted to %s track engines." msgstr "%s track engines cannot be converted to %s track engines." -#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:707 +#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:683 #, php-format msgid "%d: %s - %s" msgstr "%d: %s - %s" -#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:710 -#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:713 +#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:686 +#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:689 #, php-format msgid "%d: %s" msgstr "%d: %s" -#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:716 +#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:692 #: classes/Gems/Tracker/Source/LimeSurvey1m9FieldMap.php:759 #, php-format msgid "%s - %s" msgstr "%s - %s" -#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:756 +#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:732 msgid "Icon" msgstr "Icon" -#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:759 +#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:735 msgid "After change" msgstr "After change" @@ -4237,84 +4268,84 @@ msgid "Please answer this survey before %s." msgstr "Please answer this survey before %s." -#: classes/Gems/Tracker/Source/LimeSurvey1m9Database.php:376 -#: classes/Gems/Tracker/Source/LimeSurvey1m9Database.php:1173 +#: classes/Gems/Tracker/Source/LimeSurvey1m9Database.php:377 +#: classes/Gems/Tracker/Source/LimeSurvey1m9Database.php:1174 #, php-format msgid "" "The '%s' survey is no longer active. The survey was removed from LimeSurvey!" msgstr "" "The '%s' survey is no longer active. The survey was removed from LimeSurvey!" -#: classes/Gems/Tracker/Source/LimeSurvey1m9Database.php:407 +#: classes/Gems/Tracker/Source/LimeSurvey1m9Database.php:408 #, php-format msgid "Corrected anonymization for survey '%s'" msgstr "Corrected anonymization for survey '%s'" -#: classes/Gems/Tracker/Source/LimeSurvey1m9Database.php:436 +#: classes/Gems/Tracker/Source/LimeSurvey1m9Database.php:437 msgid ", " msgstr ", " -#: classes/Gems/Tracker/Source/LimeSurvey1m9Database.php:440 +#: classes/Gems/Tracker/Source/LimeSurvey1m9Database.php:441 #, php-format msgid "Added to token table '%s' the field(s): %s" msgstr "Added to token table '%s' the field(s): %s" -#: classes/Gems/Tracker/Source/LimeSurvey1m9Database.php:445 +#: classes/Gems/Tracker/Source/LimeSurvey1m9Database.php:446 #, php-format msgid "Attribute fields not created for token table for '%s'" msgstr "Attribute fields not created for token table for '%s'" -#: classes/Gems/Tracker/Source/LimeSurvey1m9Database.php:446 +#: classes/Gems/Tracker/Source/LimeSurvey1m9Database.php:447 #, php-format msgid "Required fields: %s" msgstr "Required fields: %s" -#: classes/Gems/Tracker/Source/LimeSurvey1m9Database.php:471 -#: classes/Gems/Tracker/Source/LimeSurvey1m9Database.php:1326 +#: classes/Gems/Tracker/Source/LimeSurvey1m9Database.php:472 +#: classes/Gems/Tracker/Source/LimeSurvey1m9Database.php:1327 #, php-format msgid "The status of the '%s' survey has changed." msgstr "The status of the '%s' survey has changed." -#: classes/Gems/Tracker/Source/LimeSurvey1m9Database.php:477 -#: classes/Gems/Tracker/Source/LimeSurvey1m9Database.php:1332 +#: classes/Gems/Tracker/Source/LimeSurvey1m9Database.php:478 +#: classes/Gems/Tracker/Source/LimeSurvey1m9Database.php:1333 #, php-format msgid "Survey '%s' IS NO LONGER ACTIVE!!!" msgstr "Survey '%s' IS NO LONGER ACTIVE!!!" -#: classes/Gems/Tracker/Source/LimeSurvey1m9Database.php:483 -#: classes/Gems/Tracker/Source/LimeSurvey1m9Database.php:1338 +#: classes/Gems/Tracker/Source/LimeSurvey1m9Database.php:484 +#: classes/Gems/Tracker/Source/LimeSurvey1m9Database.php:1339 #, php-format msgid "The status of the '%s' survey has changed to '%s'." msgstr "The status of the '%s' survey has changed to '%s'." -#: classes/Gems/Tracker/Source/LimeSurvey1m9Database.php:486 -#: classes/Gems/Tracker/Source/LimeSurvey1m9Database.php:1341 +#: classes/Gems/Tracker/Source/LimeSurvey1m9Database.php:487 +#: classes/Gems/Tracker/Source/LimeSurvey1m9Database.php:1342 #, php-format msgid "The status warning for the '%s' survey was removed." msgstr "The status warning for the '%s' survey was removed." -#: classes/Gems/Tracker/Source/LimeSurvey1m9Database.php:492 -#: classes/Gems/Tracker/Source/LimeSurvey1m9Database.php:1347 +#: classes/Gems/Tracker/Source/LimeSurvey1m9Database.php:493 +#: classes/Gems/Tracker/Source/LimeSurvey1m9Database.php:1348 #, php-format msgid "The name of the '%s' survey has changed to '%s'." msgstr "The name of the '%s' survey has changed to '%s'." -#: classes/Gems/Tracker/Source/LimeSurvey1m9Database.php:503 -#: classes/Gems/Tracker/Source/LimeSurvey1m9Database.php:1357 +#: classes/Gems/Tracker/Source/LimeSurvey1m9Database.php:504 +#: classes/Gems/Tracker/Source/LimeSurvey1m9Database.php:1358 #, php-format msgid "Imported the '%s' survey." msgstr "Imported the '%s' survey." -#: classes/Gems/Tracker/Source/LimeSurvey1m9Database.php:728 +#: classes/Gems/Tracker/Source/LimeSurvey1m9Database.php:729 msgid "Submitdate" msgstr "Submitdate" -#: classes/Gems/Tracker/Source/LimeSurvey1m9Database.php:1153 +#: classes/Gems/Tracker/Source/LimeSurvey1m9Database.php:1154 #, php-format msgid "Updated %d Gems tokens to new token definition." msgstr "Updated %d Gems tokens to new token definition." -#: classes/Gems/Tracker/Source/LimeSurvey1m9Database.php:1308 +#: classes/Gems/Tracker/Source/LimeSurvey1m9Database.php:1309 #, php-format msgid "Updated %d token to new token definition in survey '%s'." msgid_plural "Updated %d tokens to new token definition in survey '%s'." @@ -4338,12 +4369,12 @@ msgstr "Decrease" #: classes/Gems/Tracker/Source/LimeSurvey1m9FieldMap.php:157 -#: classes/Gems/Util/Translated.php:229 +#: classes/Gems/Util/Translated.php:233 msgid "Female" msgstr "Female" #: classes/Gems/Tracker/Source/LimeSurvey1m9FieldMap.php:158 -#: classes/Gems/Util/Translated.php:229 +#: classes/Gems/Util/Translated.php:233 msgid "Male" msgstr "Male" @@ -4645,88 +4676,88 @@ msgid "never" msgstr "never" -#: classes/Gems/Util/Translated.php:139 +#: classes/Gems/Util/Translated.php:143 msgid "2 days ago" msgstr "2 days ago" -#: classes/Gems/Util/Translated.php:142 +#: classes/Gems/Util/Translated.php:146 msgid "Yesterday" msgstr "Yesterday" -#: classes/Gems/Util/Translated.php:145 +#: classes/Gems/Util/Translated.php:149 msgid "Today" msgstr "Today" -#: classes/Gems/Util/Translated.php:148 +#: classes/Gems/Util/Translated.php:152 msgid "Tomorrow" msgstr "Tomorrow" -#: classes/Gems/Util/Translated.php:151 +#: classes/Gems/Util/Translated.php:155 msgid "Over 2 days" msgstr "Over 2 days" -#: classes/Gems/Util/Translated.php:156 +#: classes/Gems/Util/Translated.php:160 #, php-format msgid "Over %d days" msgstr "Over %d days" -#: classes/Gems/Util/Translated.php:158 +#: classes/Gems/Util/Translated.php:162 #, php-format msgid "%d days ago" msgstr "%d days ago" -#: classes/Gems/Util/Translated.php:186 +#: classes/Gems/Util/Translated.php:190 #, php-format msgid "%d days %d:%s:%s" msgstr "%d days %d:%s:%s" -#: classes/Gems/Util/Translated.php:188 +#: classes/Gems/Util/Translated.php:192 #, php-format msgid "%d:%s:%s" msgstr "%d:%s:%s" -#: classes/Gems/Util/Translated.php:190 +#: classes/Gems/Util/Translated.php:194 #, php-format msgid "%d:%s" msgstr "%d:%s" -#: classes/Gems/Util/Translated.php:202 +#: classes/Gems/Util/Translated.php:206 msgid "Send multiple mails per respondent, one for each checked token." msgstr "Send multiple mails per patient, one for each checked token." -#: classes/Gems/Util/Translated.php:203 +#: classes/Gems/Util/Translated.php:207 msgid "Send one mail per respondent, mark all checked tokens as send." msgstr "Send one mail per patient, mark all checked tokens as send." -#: classes/Gems/Util/Translated.php:204 +#: classes/Gems/Util/Translated.php:208 msgid "Send one mail per respondent, mark only mailed tokens as send." msgstr "Send one mail per patient, mark only mailed tokens as send." -#: classes/Gems/Util/Translated.php:229 +#: classes/Gems/Util/Translated.php:233 msgid "Unknown" msgstr "Unknown" -#: classes/Gems/Util/Translated.php:242 +#: classes/Gems/Util/Translated.php:246 msgid "mr." msgstr "Mr." -#: classes/Gems/Util/Translated.php:242 +#: classes/Gems/Util/Translated.php:246 msgid "mrs." msgstr "Mrs." -#: classes/Gems/Util/Translated.php:242 +#: classes/Gems/Util/Translated.php:246 msgid "mr./mrs." msgstr "Mr./Mrs." -#: classes/Gems/Util/Translated.php:255 +#: classes/Gems/Util/Translated.php:259 msgid "Mr." msgstr "Mr." -#: classes/Gems/Util/Translated.php:255 +#: classes/Gems/Util/Translated.php:259 msgid "Mrs." msgstr "Mrs." -#: classes/Gems/Util/Translated.php:255 +#: classes/Gems/Util/Translated.php:259 msgid "Mr./Mrs." msgstr "Mr./Mrs." @@ -4917,11 +4948,11 @@ msgid "None available" msgstr "None available" -#: snippets/AddTracksSnippet.php:230 +#: snippets/AddTracksSnippet.php:232 msgid "by Respondents" msgstr "by Patients" -#: snippets/AddTracksSnippet.php:233 +#: snippets/AddTracksSnippet.php:235 msgid "by Staff" msgstr "by Staff" @@ -5383,9 +5414,6 @@ #~ msgid "Physician" #~ msgstr "Physician" -#~ msgid "Track deleted." -#~ msgstr "Track deleted." - #~ msgid "Cookies must be enabled." #~ msgstr "Cookies must be enabled." @@ -5833,9 +5861,6 @@ #~ msgid "Last >>" #~ msgstr "Last >>" -#~ msgid "Gems project directory" -#~ msgstr "Gems project directory" - #~ msgid "Delete this token!" #~ msgstr "Delete this token!" Modified: trunk/library/languages/default-nl.mo =================================================================== (Binary files differ) Modified: trunk/library/languages/default-nl.po =================================================================== --- trunk/library/languages/default-nl.po 2013-01-15 18:02:16 UTC (rev 1101) +++ trunk/library/languages/default-nl.po 2013-01-15 18:05:38 UTC (rev 1102) @@ -2,7 +2,7 @@ msgstr "" "Project-Id-Version: GemsTracker NL\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-12-13 17:55+0100\n" +"POT-Creation-Date: 2013-01-15 19:03+0100\n" "PO-Revision-Date: \n" "Last-Translator: Matijs de Jong <mj...@ma...>\n" "Language-Team: Erasmus MGZ <mat...@ma...>\n" @@ -17,38 +17,38 @@ "X-Generator: Poedit 1.5.4\n" "X-Poedit-SearchPath-0: .\n" -#: classes/GemsEscort.php:228 +#: classes/GemsEscort.php:297 #, php-format msgid "Path %s not writable" msgstr "Path %s niet schrijfbaar" -#: classes/GemsEscort.php:619 +#: classes/GemsEscort.php:695 msgid " > " msgstr " | " -#: classes/GemsEscort.php:819 +#: classes/GemsEscort.php:888 #, php-format msgid "You are logged in as %s" msgstr "Ingelogd als %s" -#: classes/GemsEscort.php:821 classes/Gems/Menu.php:263 +#: classes/GemsEscort.php:890 classes/Gems/Menu.php:263 msgid "Logoff" msgstr "Uitloggen" -#: classes/GemsEscort.php:824 +#: classes/GemsEscort.php:893 msgid "You are not logged in" msgstr "U bent niet ingelogd" -#: classes/GemsEscort.php:1018 +#: classes/GemsEscort.php:1087 #, php-format msgid "User: %s" msgstr "Login: %s" -#: classes/GemsEscort.php:1043 +#: classes/GemsEscort.php:1112 msgid "version" msgstr "versie" -#: classes/GemsEscort.php:1518 +#: classes/GemsEscort.php:1567 msgid "" "Take note: your session has expired, your inputs were not saved. Please " "check the input data and try again" @@ -56,50 +56,50 @@ "Let op: uw sessie is verlopen, uw invoer is niet opgeslagen. Controleer uw " "gegevens en probeer a.u.b. opnieuw." -#: classes/GemsEscort.php:1647 +#: classes/GemsEscort.php:1717 msgid "Please check back later." msgstr "Probeer het later opnieuw." -#: classes/GemsEscort.php:1649 classes/GemsEscort.php:1653 -#: classes/GemsEscort.php:1654 +#: classes/GemsEscort.php:1719 classes/GemsEscort.php:1723 +#: classes/GemsEscort.php:1724 msgid "System is in maintenance mode" msgstr "Systeem is in onderhoudsmodus" -#: classes/GemsEscort.php:1665 +#: classes/GemsEscort.php:1735 msgid "No access to site." msgstr "Geen toegang tot website." -#: classes/GemsEscort.php:1667 classes/GemsEscort.php:1710 +#: classes/GemsEscort.php:1737 classes/GemsEscort.php:1780 msgid "You have no access to this site." msgstr "U heeft geen toegang tot deze website." -#: classes/GemsEscort.php:1683 classes/Gems/Default/StaffAction.php:317 +#: classes/GemsEscort.php:1753 classes/Gems/Default/StaffAction.php:317 msgid "No access to page" msgstr "Geen toegang tot pagina" -#: classes/GemsEscort.php:1685 classes/Gems/Default/OrganizationAction.php:106 +#: classes/GemsEscort.php:1755 classes/Gems/Default/OrganizationAction.php:106 #: classes/Gems/Default/StaffAction.php:318 #: classes/Gems/Model/HiddenOrganizationModel.php:115 #, php-format msgid "Access to this page is not allowed for current role: %s." msgstr "U heeft geen toegang tot deze pagina. Uw huidige rol is: %s." -#: classes/GemsEscort.php:1695 classes/GemsEscort.php:1708 +#: classes/GemsEscort.php:1765 classes/GemsEscort.php:1778 msgid "You are no longer logged in." msgstr "U bent niet meer ingelogd." -#: classes/GemsEscort.php:1696 +#: classes/GemsEscort.php:1766 msgid "You must login to access this page." msgstr "U moet ingelogd zijn voor toegang tot deze pagina." -#: classes/GemsEscort.php:1842 classes/GemsEscort.php:1844 +#: classes/GemsEscort.php:1912 classes/GemsEscort.php:1914 #, php-format msgid "%d survey" msgid_plural "%d surveys" msgstr[0] "%d vragenlijst" msgstr[1] "%d vragenlijsten" -#: classes/Gems/AccessLog.php:236 +#: classes/Gems/AccessLog.php:235 msgid "Database needs to be updated!" msgstr "Database dient ververst te worden!" @@ -311,7 +311,7 @@ #: classes/Gems/Export/RespondentExport.php:235 #: classes/Gems/Export/RespondentExport.php:247 #: classes/Gems/Tracker/Engine/StepEngineAbstract.php:484 -#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:752 +#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:728 #: classes/Gems/Tracker/Model/StandardTokenModel.php:216 #: classes/Gems/Tracker/Snippets/EditTrackSnippetAbstract.php:149 #: classes/Gems/Tracker/Snippets/ShowTrackUsageAbstract.php:146 @@ -322,22 +322,22 @@ #: classes/Gems/Menu.php:317 classes/Gems/Menu.php:342 #: classes/Gems/Menu.php:384 #: classes/Gems/Default/TrackMaintenanceAction.php:389 -#: snippets/AddTracksSnippet.php:239 +#: snippets/AddTracksSnippet.php:241 msgid "Add" msgstr "Voeg toe" #: classes/Gems/Menu.php:323 classes/Gems/Menu.php:423 #: classes/Gems/Email/EmailFormAbstract.php:280 #: classes/Gems/Email/EmailFormAbstract.php:291 -#: classes/Gems/Menu/MenuAbstract.php:378 -#: classes/Gems/Menu/MenuAbstract.php:391 +#: classes/Gems/Menu/MenuAbstract.php:381 +#: classes/Gems/Menu/MenuAbstract.php:394 msgid "Preview" msgstr "Preview" #: classes/Gems/Menu.php:332 classes/Gems/Default/ExportAction.php:149 #: classes/Gems/Default/TrackMaintenanceAction.php:336 -#: classes/Gems/Menu/MenuAbstract.php:387 -#: classes/Gems/Menu/MenuAbstract.php:469 snippets/AddTracksSnippet.php:236 +#: classes/Gems/Menu/MenuAbstract.php:390 +#: classes/Gems/Menu/MenuAbstract.php:472 snippets/AddTracksSnippet.php:238 msgid "Tracks" msgstr "Trajecten" @@ -355,8 +355,8 @@ #: classes/Gems/Menu.php:377 #: classes/Gems/Default/SurveyMaintenanceAction.php:586 -#: classes/Gems/Menu/MenuAbstract.php:394 -#: classes/Gems/Menu/MenuAbstract.php:456 +#: classes/Gems/Menu/MenuAbstract.php:397 +#: classes/Gems/Menu/MenuAbstract.php:459 #: classes/Gems/Tracker/Model/TrackModel.php:100 msgid "Surveys" msgstr "Vragenlijsten" @@ -388,7 +388,7 @@ msgid "Overview" msgstr "Overzicht" -#: classes/Gems/Menu.php:593 classes/Gems/Menu/MenuAbstract.php:351 +#: classes/Gems/Menu.php:593 classes/Gems/Menu/MenuAbstract.php:354 msgid "Project" msgstr "Project" @@ -418,7 +418,7 @@ msgid "Changelog" msgstr "Changelog" -#: classes/Gems/Model.php:212 +#: classes/Gems/Model.php:212 classes/Gems/Default/ComplianceAction.php:84 #: classes/Gems/Tracker/Model/StandardTokenModel.php:213 msgid "Respondent nr" msgstr "Patiënt nr" @@ -624,7 +624,7 @@ #: classes/Gems/Tracker/Source/LimeSurvey1m9FieldMap.php:143 #: classes/Gems/Tracker/Source/LimeSurvey1m9FieldMap.php:147 #: classes/Gems/Tracker/Source/LimeSurvey1m9FieldMap.php:166 -#: classes/Gems/Util/Translated.php:263 +#: classes/Gems/Util/Translated.php:267 #: classes/MUtil/Snippets/ModelYesNoDeleteSnippetAbstract.php:192 #: snippets/DeleteSingleSurveyNotUsedTokenSnippet.php:124 msgid "Yes" @@ -642,7 +642,7 @@ #: classes/Gems/Tracker/Source/LimeSurvey1m9FieldMap.php:167 #: classes/Gems/Util/ReceptionCodeLibrary.php:99 #: classes/Gems/Util/ReceptionCodeLibrary.php:123 -#: classes/Gems/Util/Translated.php:263 +#: classes/Gems/Util/Translated.php:267 #: classes/MUtil/Snippets/ModelYesNoDeleteSnippetAbstract.php:194 #: snippets/DeleteSingleSurveyNotUsedTokenSnippet.php:125 msgid "No" @@ -810,6 +810,30 @@ msgid "The survey for token %s is no longer active." msgstr "De vragenlijst voor kenmerk %s is niet meer in gebruik." +#: classes/Gems/Default/ComplianceAction.php:85 +msgid "Start date" +msgstr "Startdatum" + +#: classes/Gems/Default/ComplianceAction.php:86 +msgid "End date" +msgstr "Einddatum" + +#: classes/Gems/Default/ComplianceAction.php:98 +#: classes/Gems/Menu/MenuAbstract.php:325 +msgid "Compliance" +msgstr "Voortgang" + +#: classes/Gems/Default/ComplianceAction.php:109 +#: classes/Gems/Default/ProjectTracksAction.php:85 +#: classes/Gems/Default/TrackAction.php:452 +#: classes/Gems/Default/TrackMaintenanceAction.php:331 +#: classes/Gems/Tracker/Snippets/EditTrackEngineSnippetGeneric.php:191 +#: classes/Gems/Tracker/Snippets/EditTrackSnippetAbstract.php:174 +msgid "track" +msgid_plural "tracks" +msgstr[0] "traject" +msgstr[1] "trajecten" + #: classes/Gems/Default/ConsentAction.php:68 #: classes/Gems/Default/GroupAction.php:116 #: classes/Gems/Default/ReceptionAction.php:81 @@ -820,7 +844,7 @@ #: classes/Gems/Default/TrackFieldsAction.php:101 #: classes/Gems/Default/UpgradeAction.php:176 #: classes/Gems/Export/RespondentExport.php:236 -#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:758 +#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:734 #: classes/Gems/Tracker/Model/StandardTokenModel.php:214 #: classes/Gems/Tracker/Snippets/EditTrackSnippetAbstract.php:150 #: classes/Gems/Tracker/Snippets/ShowTrackUsageAbstract.php:147 @@ -831,7 +855,7 @@ #: classes/Gems/Default/ConsentAction.php:70 #: classes/Gems/Default/DatabaseAction.php:139 #: classes/Gems/Default/TrackFieldsAction.php:97 -#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:757 +#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:733 msgid "Order" msgstr "Volgorde" @@ -905,7 +929,7 @@ "Op dit test systeem worden alle emails gestuurd naar het \"van\" adres." #: classes/Gems/Default/DatabaseAction.php:75 -#: classes/Gems/Default/ProjectInformationAction.php:191 +#: classes/Gems/Default/ProjectInformationAction.php:193 #: classes/Gems/Task/CleanCache.php:58 msgid "Cache cleaned" msgstr "Cache opgeschoond" @@ -1206,7 +1230,7 @@ #: classes/Gems/Default/SurveyAction.php:201 #: classes/Gems/Email/OneMailForm.php:57 #: classes/Gems/Export/RespondentExport.php:156 -#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:755 +#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:731 #: classes/Gems/Tracker/Model/StandardTokenModel.php:215 #: snippets/TrackSurveyOverviewSnippet.php:111 msgid "Survey" @@ -1247,7 +1271,7 @@ #: classes/Gems/Default/SourceAction.php:101 #: classes/Gems/Default/SurveyMaintenanceAction.php:448 #: classes/Gems/Default/SurveyMaintenanceAction.php:503 -#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:761 +#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:737 #: classes/Gems/Tracker/Model/TrackModel.php:102 #: classes/Gems/Util/TrackData.php:147 msgid "Active" @@ -1741,6 +1765,7 @@ #: classes/Gems/Default/RespondentAction.php:386 #: classes/Gems/Default/StaffAction.php:335 #: classes/Gems/Default/StaffAction.php:405 +#: classes/Gems/Snippets/Tracker/Compliance/ComplianceSearchFormSnippet.php:66 msgid "(all organizations)" msgstr "(alle organisaties)" @@ -1968,71 +1993,79 @@ msgstr "Gems web folder" #: classes/Gems/Default/ProjectInformationAction.php:140 +msgid "Gems root directory" +msgstr "Gems start folder" + +#: classes/Gems/Default/ProjectInformationAction.php:141 msgid "Gems code directory" msgstr "Gems code folder" -#: classes/Gems/Default/ProjectInformationAction.php:141 +#: classes/Gems/Default/ProjectInformationAction.php:142 msgid "MUtil version" msgstr "MUtil versie" -#: classes/Gems/Default/ProjectInformationAction.php:142 +#: classes/Gems/Default/ProjectInformationAction.php:143 msgid "Zend version" msgstr "Zend versie" -#: classes/Gems/Default/ProjectInformationAction.php:143 +#: classes/Gems/Default/ProjectInformationAction.php:144 msgid "Application environment" msgstr "Applicatie omgeving" -#: classes/Gems/Default/ProjectInformationAction.php:144 +#: classes/Gems/Default/ProjectInformationAction.php:145 msgid "Application baseuri" msgstr "Applicatie baseuri" -#: classes/Gems/Default/ProjectInformationAction.php:145 +#: classes/Gems/Default/ProjectInformationAction.php:146 msgid "Application directory" msgstr "Applicatie folder" -#: classes/Gems/Default/ProjectInformationAction.php:146 +#: classes/Gems/Default/ProjectInformationAction.php:147 +msgid "Application encoding" +msgstr "Applicatie tekenset" + +#: classes/Gems/Default/ProjectInformationAction.php:148 msgid "PHP version" msgstr "PHP versie" -#: classes/Gems/Default/ProjectInformationAction.php:147 +#: classes/Gems/Default/ProjectInformationAction.php:149 msgid "Server Hostname" msgstr "Webserver naam" -#: classes/Gems/Default/ProjectInformationAction.php:148 +#: classes/Gems/Default/ProjectInformationAction.php:150 msgid "Server OS" msgstr "Server besturingssysteem" -#: classes/Gems/Default/ProjectInformationAction.php:149 +#: classes/Gems/Default/ProjectInformationAction.php:151 msgid "Time on server" msgstr "De tijd op de server" -#: classes/Gems/Default/ProjectInformationAction.php:153 +#: classes/Gems/Default/ProjectInformationAction.php:155 msgid "Turn Maintenance Mode OFF" msgstr "Onderhoudsmodus UITzetten" -#: classes/Gems/Default/ProjectInformationAction.php:155 +#: classes/Gems/Default/ProjectInformationAction.php:157 msgid "Turn Maintenance Mode ON" msgstr "Onderhoudsmodus AANzetten" -#: classes/Gems/Default/ProjectInformationAction.php:165 +#: classes/Gems/Default/ProjectInformationAction.php:167 msgid "Version information" msgstr "Versie informatie" -#: classes/Gems/Default/ProjectInformationAction.php:199 +#: classes/Gems/Default/ProjectInformationAction.php:201 msgid "Server PHP Info" msgstr "Server PHP Info" -#: classes/Gems/Default/ProjectInformationAction.php:216 +#: classes/Gems/Default/ProjectInformationAction.php:218 msgid "Project settings" msgstr "Project instellingen" -#: classes/Gems/Default/ProjectInformationAction.php:223 +#: classes/Gems/Default/ProjectInformationAction.php:225 msgid "Session content" msgstr "Sessie inhoud" -#: classes/Gems/Default/ProjectInformationAction.php:224 -#: classes/Gems/Menu/MenuAbstract.php:352 +#: classes/Gems/Default/ProjectInformationAction.php:226 +#: classes/Gems/Menu/MenuAbstract.php:355 msgid "Session" msgstr "Sessie" @@ -2069,16 +2102,6 @@ msgid "Survey #" msgstr "Vragenlijsten" -#: classes/Gems/Default/ProjectTracksAction.php:85 -#: classes/Gems/Default/TrackAction.php:452 -#: classes/Gems/Default/TrackMaintenanceAction.php:331 -#: classes/Gems/Tracker/Snippets/EditTrackEngineSnippetGeneric.php:191 -#: classes/Gems/Tracker/Snippets/EditTrackSnippetAbstract.php:174 -msgid "track" -msgid_plural "tracks" -msgstr[0] "traject" -msgstr[1] "trajecten" - #: classes/Gems/Default/ProjectTracksAction.php:90 msgid "Active tracks" msgstr "Beschikbare trajecten" @@ -2515,7 +2538,7 @@ msgstr[1] "bronnen" #: classes/Gems/Default/SourceAction.php:249 -#: classes/Gems/Menu/MenuAbstract.php:447 +#: classes/Gems/Menu/MenuAbstract.php:450 msgid "Survey Sources" msgstr "Bronnen" @@ -2788,7 +2811,7 @@ msgstr "Na afronding" #: classes/Gems/Default/SurveyMaintenanceAction.php:469 -#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:760 +#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:736 msgid "Answer display" msgstr "Antwoord weergave" @@ -2915,7 +2938,7 @@ #: classes/Gems/Default/TokenPlanAction.php:327 #: classes/Gems/Selector/TokenByGroupDateSelector.php:129 -#: classes/Gems/Tracker/Token.php:1032 +#: classes/Gems/Tracker/Token.php:1038 #: snippets/RespondentTokenTabsSnippet.php:68 msgid "Missed" msgstr "Gemist" @@ -3176,7 +3199,7 @@ msgstr[1] "velden" #: classes/Gems/Default/TrackFieldsAction.php:175 -#: classes/Gems/Menu/MenuAbstract.php:472 +#: classes/Gems/Menu/MenuAbstract.php:475 msgid "Fields" msgstr "Velden" @@ -3308,7 +3331,7 @@ msgstr[1] "rondes" #: classes/Gems/Default/TrackRoundsAction.php:227 -#: classes/Gems/Menu/MenuAbstract.php:480 +#: classes/Gems/Menu/MenuAbstract.php:483 msgid "Rounds" msgstr "Rondes" @@ -3388,6 +3411,11 @@ msgid "BBCode info page" msgstr "BBCode info pagina" +#: classes/Gems/Email/Mailer.php:235 classes/Gems/Email/TemplateMailer.php:360 +#, php-format +msgid "Invalid e-mail address '%s'." +msgstr "Ongeldig email adres '%s'." + #: classes/Gems/Email/MailTemplateForm.php:56 msgid "Send (test)" msgstr "Verstuur (test)" @@ -3431,7 +3459,7 @@ #: classes/Gems/Email/OneMailForm.php:55 #: classes/Gems/Export/RespondentExport.php:157 -#: classes/Gems/Menu/MenuAbstract.php:492 +#: classes/Gems/Menu/MenuAbstract.php:495 #: classes/Gems/Tracker/Model/StandardTokenModel.php:196 msgid "Round" msgstr "Ronde" @@ -3461,11 +3489,6 @@ msgid "Sent %d e-mails, updated %d tokens." msgstr "%d emails verzonden en %d kenmerken bijgewerkt." -#: classes/Gems/Email/TemplateMailer.php:360 -#, php-format -msgid "Invalid e-mail address '%s'." -msgstr "Ongeldig email adres '%s'." - #: classes/Gems/Event/Survey/BeforeAnswering/GetPreviousAnswers.php:64 msgid "Previous Version Answers Lookup" msgstr "Antwoorden overnemen van vorige keer" @@ -3574,77 +3597,77 @@ msgid "Templates" msgstr "Sjablonen" -#: classes/Gems/Menu/MenuAbstract.php:325 +#: classes/Gems/Menu/MenuAbstract.php:328 msgid "By period" msgstr "Per periode" -#: classes/Gems/Menu/MenuAbstract.php:326 +#: classes/Gems/Menu/MenuAbstract.php:329 msgid "By token" msgstr "Per kenmerk" -#: classes/Gems/Menu/MenuAbstract.php:327 +#: classes/Gems/Menu/MenuAbstract.php:330 msgid "By respondent" msgstr "Per patiënt" -#: classes/Gems/Menu/MenuAbstract.php:331 +#: classes/Gems/Menu/MenuAbstract.php:334 msgid "Bulk mail" msgstr "Bulk mail" -#: classes/Gems/Menu/MenuAbstract.php:349 +#: classes/Gems/Menu/MenuAbstract.php:352 msgid "Errors" msgstr "Foutmeldingen" -#: classes/Gems/Menu/MenuAbstract.php:350 +#: classes/Gems/Menu/MenuAbstract.php:353 msgid "PHP" msgstr "PHP" -#: classes/Gems/Menu/MenuAbstract.php:353 +#: classes/Gems/Menu/MenuAbstract.php:356 msgid "Maintenance mode" msgstr "Onderhoudsmodus" -#: classes/Gems/Menu/MenuAbstract.php:354 +#: classes/Gems/Menu/MenuAbstract.php:357 msgid "Clean cache" msgstr "Cache opruimen" -#: classes/Gems/Menu/MenuAbstract.php:421 +#: classes/Gems/Menu/MenuAbstract.php:424 msgid "Reset password" msgstr "Wijzig wachtwoord" -#: classes/Gems/Menu/MenuAbstract.php:448 +#: classes/Gems/Menu/MenuAbstract.php:451 msgid "Check status" msgstr "Status controle" -#: classes/Gems/Menu/MenuAbstract.php:449 +#: classes/Gems/Menu/MenuAbstract.php:452 msgid "Synchronize surveys" msgstr "Synchroniseer vragenlijsten" -#: classes/Gems/Menu/MenuAbstract.php:450 -#: classes/Gems/Menu/MenuAbstract.php:463 +#: classes/Gems/Menu/MenuAbstract.php:453 +#: classes/Gems/Menu/MenuAbstract.php:466 msgid "Check is answered" msgstr "Controleer op antwoorden" -#: classes/Gems/Menu/MenuAbstract.php:451 +#: classes/Gems/Menu/MenuAbstract.php:454 msgid "Check attributes" msgstr "Controleer attributen" -#: classes/Gems/Menu/MenuAbstract.php:452 +#: classes/Gems/Menu/MenuAbstract.php:455 msgid "Synchronize all surveys" msgstr "Synchroniseer alle vragenlijsten" -#: classes/Gems/Menu/MenuAbstract.php:453 -#: classes/Gems/Menu/MenuAbstract.php:464 +#: classes/Gems/Menu/MenuAbstract.php:456 +#: classes/Gems/Menu/MenuAbstract.php:467 msgid "Check all is answered" msgstr "Controleer alles op antwoorden" -#: classes/Gems/Menu/MenuAbstract.php:460 +#: classes/Gems/Menu/MenuAbstract.php:463 msgid "PDF" msgstr "PDF" -#: classes/Gems/Menu/MenuAbstract.php:498 +#: classes/Gems/Menu/MenuAbstract.php:501 msgid "Check assignments" msgstr "Controleer toewijzingen" -#: classes/Gems/Menu/MenuAbstract.php:501 +#: classes/Gems/Menu/MenuAbstract.php:504 msgid "Check all assignments" msgstr "Controleer alle toewijzingen" @@ -3721,48 +3744,48 @@ msgid "Now!" msgstr "Nu!" -#: classes/Gems/Selector/DateSelectorAbstract.php:360 +#: classes/Gems/Selector/DateSelectorAbstract.php:361 msgid "Show by day" msgstr "Toon per dag" -#: classes/Gems/Selector/DateSelectorAbstract.php:361 +#: classes/Gems/Selector/DateSelectorAbstract.php:362 msgid "Show by week" msgstr "Toon per weerk" -#: classes/Gems/Selector/DateSelectorAbstract.php:362 +#: classes/Gems/Selector/DateSelectorAbstract.php:363 msgid "Show by month" msgstr "Toon per maand" -#: classes/Gems/Selector/DateSelectorAbstract.php:363 +#: classes/Gems/Selector/DateSelectorAbstract.php:364 msgid "Show by year" msgstr "Toon per jaar" -#: classes/Gems/Selector/DateSelectorAbstract.php:370 +#: classes/Gems/Selector/DateSelectorAbstract.php:371 msgid "D" msgstr "D" -#: classes/Gems/Selector/DateSelectorAbstract.php:371 +#: classes/Gems/Selector/DateSelectorAbstract.php:372 msgid "W" msgstr "W" -#: classes/Gems/Selector/DateSelectorAbstract.php:372 +#: classes/Gems/Selector/DateSelectorAbstract.php:373 msgid "M" msgstr "M" -#: classes/Gems/Selector/DateSelectorAbstract.php:373 +#: classes/Gems/Selector/DateSelectorAbstract.php:374 msgid "Y" msgstr "J" -#: classes/Gems/Selector/DateSelectorAbstract.php:562 +#: classes/Gems/Selector/DateSelectorAbstract.php:563 #: classes/Gems/Util/Translated.php:81 msgid "-" msgstr "n.v.t." -#: classes/Gems/Selector/DateSelectorAbstract.php:605 +#: classes/Gems/Selector/DateSelectorAbstract.php:606 msgid "Period" msgstr "Periode" -#: classes/Gems/Selector/DateSelectorAbstract.php:633 +#: classes/Gems/Selector/DateSelectorAbstract.php:634 #, php-format msgid "week %s" msgstr "week %s" @@ -3866,6 +3889,14 @@ msgid "Unknown respondent %s" msgstr "Onbekende patiënt %s" +#: classes/Gems/Snippets/Tracker/Compliance/ComplianceSearchFormSnippet.php:62 +msgid "(select a track)" +msgstr "(selecteer een traject)" + +#: classes/Gems/Snippets/Tracker/Compliance/ComplianceTableSnippet.php:178 +msgid "No track selected..." +msgstr "Geen traject geselecteerd..." + #: classes/Gems/Task/Db/ExecutePatch.php:66 #, php-format msgid "Executing patchlevel %d" @@ -3893,14 +3924,14 @@ #: classes/Gems/Task/Tracker/CheckTrackTokens.php:64 #: classes/Gems/Tracker/ChangeTracker.php:81 -#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:431 +#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:407 #, php-format msgid "%2$d token date changes in %1$d tracks." msgstr "De datum van %2$d kenmerken is aangepast in %1$d trajecten." #: classes/Gems/Task/Tracker/CheckTrackTokens.php:67 #: classes/Gems/Tracker/ChangeTracker.php:64 -#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:434 +#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:410 #, php-format msgid "Checked %d tracks." msgstr "%d trajecten gecontroleerd." @@ -3926,19 +3957,19 @@ msgstr[1] "Controleer %s bronnen" #: classes/Gems/Tracker/ChangeTracker.php:84 -#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:417 +#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:393 #, php-format msgid "Round changes propagated to %d tokens." msgstr "%d kenmerken veranderd door ronde aanpassingen." #: classes/Gems/Tracker/ChangeTracker.php:87 -#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:421 +#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:397 #, php-format msgid "%d tokens deleted by round changes." msgstr "Vanwege ronde aanpassingen zijn %d kenmerken verwijderd." #: classes/Gems/Tracker/ChangeTracker.php:90 -#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:425 +#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:401 #, php-format msgid "%d tokens created to by round changes." msgstr "Vanwege ronde aanpassingen zijn nieuwe %d kenmerken gecreëerd." @@ -3947,16 +3978,16 @@ msgid "No tokens were changed." msgstr "Geen kenmerken veranderd." -#: classes/Gems/Tracker/Token.php:1026 +#: classes/Gems/Tracker/Token.php:1032 #: classes/Gems/Tracker/Model/StandardTokenModel.php:200 msgid "Completed" msgstr "Ingevuld" -#: classes/Gems/Tracker/Token.php:1034 classes/Gems/Tracker/Token.php:1036 +#: classes/Gems/Tracker/Token.php:1040 classes/Gems/Tracker/Token.php:1042 msgid "Future" msgstr "Toekomstig" -#: classes/Gems/Tracker/Token.php:1038 +#: classes/Gems/Tracker/Token.php:1044 msgid "Open" msgstr "Open" @@ -4078,33 +4109,33 @@ msgid "Use a track level date." msgstr "Gebruik een op traject niveau ingestelde datum." -#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:446 +#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:422 #, php-format msgid "%s track engines cannot be converted to %s track engines." msgstr "Traject type %s kan niet geconverteerd worden naar %s." -#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:707 +#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:683 #, php-format msgid "%d: %s - %s" msgstr "%d: %s - %s" -#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:710 -#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:713 +#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:686 +#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:689 #, php-format msgid "%d: %s" msgstr "%d: %s" -#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:716 +#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:692 #: classes/Gems/Tracker/Source/LimeSurvey1m9FieldMap.php:759 #, php-format msgid "%s - %s" msgstr "%s - %s" -#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:756 +#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:732 msgid "Icon" msgstr "Icoon" -#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:759 +#: classes/Gems/Tracker/Engine/TrackEngineAbstract.php:735 msgid "After change" msgstr "Ronde veranderingscode" @@ -4270,8 +4301,8 @@ msgid "Please answer this survey before %s." msgstr "Wij verzoeken u deze vragenlijst voor %s in te vullen." -#: classes/Gems/Tracker/Source/LimeSurvey1m9Database.php:376 -#: classes/Gems/Tracker/Source/LimeSurvey1m9Database.php:1173 +#: classes/Gems/Tracker/Source/LimeSurvey1m9Database.php:377 +#: classes/Gems/Tracker/Source/LimeSurvey1m9Database.php:1174 #, php-format msgid "" "The '%s' survey is no longer active. The survey was removed from LimeSurvey!" @@ -4279,76 +4310,76 @@ "De vragenlijst '%s' is niet meer actief. De vragenlijst is verwijderd uit " "LimeSurvey!" -#: classes/Gems/Tracker/Source/LimeSurvey1m9Database.php:407 +#: classes/Gems/Tracker/Source/LimeSurvey1m9Database.php:408 #, php-format msgid "Corrected anonymization for survey '%s'" msgstr "Anonimizatie gecorrigeerd van vragenlijst '%s'" -#: classes/Gems/Tracker/Source/LimeSurvey1m9Database.php:436 +#: classes/Gems/Tracker/Source/LimeSurvey1m9Database.php:437 msgid ", " msgstr ", " -#: classes/Gems/Tracker/Source/LimeSurvey1m9Database.php:440 +#: classes/Gems/Tracker/Source/LimeSurvey1m9Database.php:441 #, php-format msgid "Added to token table '%s' the field(s): %s" msgstr "Toegevoegd aan kenmerk tabel '%s', de velden: %s" -#: classes/Gems/Tracker/Source/LimeSurvey1m9Database.php:445 +#: classes/Gems/Tracker/Source/LimeSurvey1m9Database.php:446 #, php-format msgid "Attribute fields not created fo... [truncated message content] |
From: <gem...@li...> - 2013-01-15 18:02:35
|
Revision: 1101 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=1101&view=rev Author: matijsdejong Date: 2013-01-15 18:02:16 +0000 (Tue, 15 Jan 2013) Log Message: ----------- new ComplianceAction to show an overview of track progress (first version only: layout needs work) new MUtil/Model/ModelTransformerInterface.php with three implementations Modified Paths: -------------- trunk/library/classes/Gems/Menu/MenuAbstract.php trunk/library/classes/Gems/Selector/DateSelectorAbstract.php trunk/library/classes/MUtil/Model/DatabaseModelAbstract.php trunk/library/classes/MUtil/Model/ModelAbstract.php trunk/library/classes/MUtil/Model/ModelTransformerAbstract.php trunk/library/classes/MUtil/Model/SelectModelPaginator.php trunk/library/classes/MUtil/Model/Transform/RequiredRowsTransformer.php trunk/library/configs/db/patches.sql Added Paths: ----------- trunk/library/classes/Gems/Default/ComplianceAction.php trunk/library/classes/Gems/Snippets/Tracker/Compliance/ trunk/library/classes/Gems/Snippets/Tracker/Compliance/ComplianceSearchFormSnippet.php trunk/library/classes/Gems/Snippets/Tracker/Compliance/ComplianceTableSnippet.php trunk/library/classes/MUtil/Model/ModelTransformerInterface.php trunk/library/classes/MUtil/Model/Transform/CrossTabTransformer.php trunk/library/classes/MUtil/Model/Transform/JoinTransformer.php trunk/library/controllers/ComplianceController.php Added: trunk/library/classes/Gems/Default/ComplianceAction.php =================================================================== --- trunk/library/classes/Gems/Default/ComplianceAction.php (rev 0) +++ trunk/library/classes/Gems/Default/ComplianceAction.php 2013-01-15 18:02:16 UTC (rev 1101) @@ -0,0 +1,111 @@ +<?php + +/** + * Copyright (c) 2012, Erasmus MC + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Erasmus MC nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * @package Gems + * @subpackage Default + * @author Matijs de Jong <mj...@ma...> + * @copyright Copyright (c) 2012 Erasmus MC + * @license New BSD License + * @version $id: ComplianceAction.php 203 2012-01-01t 12:51:32Z matijs $ + */ + +/** + * + * + * @package Gems + * @subpackage Default + * @copyright Copyright (c) 2012 Erasmus MC + * @license New BSD License + * @since Class available since version 1.6 + */ +class Gems_Default_ComplianceAction extends Gems_Controller_ModelSnippetActionAbstract +{ + /** + * The snippets used for the autofilter action. + * + * @var mixed String or array of snippets name + */ + protected $autofilterSnippets = 'Tracker_Compliance_ComplianceTableSnippet'; + + /** + * The snippets used for the index action, before those in autofilter + * + * @var mixed String or array of snippets name + */ + protected $indexStartSnippets = array('Generic_ContentTitleSnippet', 'Tracker_Compliance_ComplianceSearchFormSnippet'); + + /** + * Creates a model for getModel(). Called only for each new $action. + * + * The parameters allow you to easily adapt the model to the current action. The $detailed + * parameter was added, because the most common use of action is a split between detailed + * and summarized actions. + * + * @param boolean $detailed True when the current action is not in $summarizedActions. + * @param string $action The current action. + * @return MUtil_Model_ModelAbstract + */ + public function createModel($detailed, $action) + { + $model = new Gems_Model_JoinModel('resptrack' , 'gems__respondent2track'); + $model->addTable('gems__respondent2org', array( + 'gr2t_id_user' => 'gr2o_id_user', + 'gr2t_id_organization' => 'gr2o_id_organization' + )); + $model->addTable('gems__tracks', array('gr2t_id_track' => 'gtr_id_track')); + + $model->resetOrder(); + $model->set('gr2o_patient_nr', 'label', $this->_('Respondent nr')); + $model->set('gr2t_start_date', 'label', $this->_('Start date'), 'dateFormat', 'dd-MM-yyyy'); + $model->set('gr2t_end_date', 'label', $this->_('End date'), 'dateFormat', 'dd-MM-yyyy'); + + return $model; + } + + /** + * Helper function to get the title for the index action. + * + * @return $string + */ + public function getIndexTitle() + { + return $this->_('Compliance'); + } + + /** + * Helper function to allow generalized statements about the items in the model. + * + * @param int $count + * @return $string + */ + public function getTopic($count = 1) + { + return $this->plural('track', 'tracks', $count); + } +} Modified: trunk/library/classes/Gems/Menu/MenuAbstract.php =================================================================== --- trunk/library/classes/Gems/Menu/MenuAbstract.php 2013-01-14 18:21:45 UTC (rev 1100) +++ trunk/library/classes/Gems/Menu/MenuAbstract.php 2013-01-15 18:02:16 UTC (rev 1101) @@ -322,6 +322,9 @@ { $infoPage = $this->addContainer($label); + $infoPage->addPage($this->_('Compliance'), 'pr.plan.compliance', 'compliance', 'index') + ->addAutofilterAction(); + $plans[] = $infoPage->addPage($this->_('By period'), 'pr.plan.overview', 'overview-plan', 'index'); $plans[] = $infoPage->addPage($this->_('By token'), 'pr.plan.token', 'token-plan', 'index'); $plans[] = $infoPage->addPage($this->_('By respondent'), 'pr.plan.respondent', 'respondent-plan', 'index'); Modified: trunk/library/classes/Gems/Selector/DateSelectorAbstract.php =================================================================== --- trunk/library/classes/Gems/Selector/DateSelectorAbstract.php 2013-01-14 18:21:45 UTC (rev 1100) +++ trunk/library/classes/Gems/Selector/DateSelectorAbstract.php 2013-01-15 18:02:16 UTC (rev 1101) @@ -329,7 +329,7 @@ } else { $this->dateFactorChanges = array_fill_keys(array('D', 'W', 'M', 'Y'), 0); } - // MUtil_Echo::r($requiredRows); + // M qUtil_Echo::track($requiredRows); // MUtil_Echo::rs($start, $end, $where); $select = new Zend_Db_Select($this->db); @@ -346,12 +346,13 @@ // Display by column cannot use formatFunction as it is a simple repeater // $model->set('duration_avg', 'formatFunction', $this->util->getLocalized()->formatNumber); - $tmodel = new MUtil_Model_Transform_RequiredRowsTransformer($model); - $tmodel->setDefaultRow($this->getDefaultRow()); - $tmodel->setRequiredRows($requiredRows); - $tmodel->setKeyItemCount($keyCount); + $transformer = new MUtil_Model_Transform_RequiredRowsTransformer(); + $transformer->setDefaultRow($this->getDefaultRow()); + $transformer->setRequiredRows($requiredRows); + $transformer->setKeyItemCount($keyCount); + $model->addTransformer($transformer); - return $tmodel; + return $model; } protected function getDateDescriptions() Added: trunk/library/classes/Gems/Snippets/Tracker/Compliance/ComplianceSearchFormSnippet.php =================================================================== --- trunk/library/classes/Gems/Snippets/Tracker/Compliance/ComplianceSearchFormSnippet.php (rev 0) +++ trunk/library/classes/Gems/Snippets/Tracker/Compliance/ComplianceSearchFormSnippet.php 2013-01-15 18:02:16 UTC (rev 1101) @@ -0,0 +1,71 @@ +<?php + +/** + * Copyright (c) 2012, Erasmus MC + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Erasmus MC nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * @package Gems + * @subpackage Tracker + * @author Matijs de Jong <mj...@ma...> + * @copyright Copyright (c) 2012 Erasmus MC + * @license New BSD License + * @version $id: ComplianceSearchFormSnippet.php 203 2012-01-01t 12:51:32Z matijs $ + */ + +/** + * + * + * @package Gems + * @subpackage Tracker + * @copyright Copyright (c) 2012 Erasmus MC + * @license New BSD License + * @since Class available since version 1.5 + */ +class Gems_Snippets_Tracker_Compliance_ComplianceSearchFormSnippet extends Gems_Snippets_AutosearchFormSnippet +{ + /** + * Returns a text element for autosearch. Can be overruled. + * + * The form / html elements to search on. Elements can be grouped by inserting null's between them. + * That creates a distinct group of elements + * + * @param array $data The $form field values (can be usefull, but no need to set them) + * @return array Of Zend_Form_Element's or static tekst to add to the html or null for group breaks. + */ + protected function getAutoSearchElements(array $data) + { + $elements[] = $this->_createSelectElement('gr2t_id_track', + $this->util->getTrackData()->getAllTracks(), + $this->_('(select a track)')); + + $elements[] = $this->_createSelectElement('gr2o_id_organization', + $this->util->getDbLookup()->getOrganizationsWithRespondents(), + $this->_('(all organizations)')); + + return $elements; + } + +} Added: trunk/library/classes/Gems/Snippets/Tracker/Compliance/ComplianceTableSnippet.php =================================================================== --- trunk/library/classes/Gems/Snippets/Tracker/Compliance/ComplianceTableSnippet.php (rev 0) +++ trunk/library/classes/Gems/Snippets/Tracker/Compliance/ComplianceTableSnippet.php 2013-01-15 18:02:16 UTC (rev 1101) @@ -0,0 +1,181 @@ +<?php + +/** + * Copyright (c) 2012, Erasmus MC + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Erasmus MC nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * @package Gems + * @subpackage Tracker + * @author Matijs de Jong <mj...@ma...> + * @copyright Copyright (c) 2012 Erasmus MC + * @license New BSD License + * @version $id: ComplianceTableSnippet.php 203 2012-01-01t 12:51:32Z matijs $ + */ + +/** + * + * + * @package Gems + * @subpackage Tracker + * @copyright Copyright (c) 2012 Erasmus MC + * @license New BSD License + * @since Class available since version 1.5 + */ +class Gems_Snippets_Tracker_Compliance_ComplianceTableSnippet extends Gems_Snippets_ModelTableSnippetGeneric +{ + /** + * + * @var Zend_Db_Adapter_Abstract + */ + protected $db; + + /** + * + * @var Gems_Loader + */ + protected $loader; + + /** + * Creates the model + * + * @return MUtil_Model_ModelAbstract + */ + protected function createModel() + { + $model = parent::createModel(); + $trackId = $this->getTrackId(); + + if (! $trackId) { + return $model; + } + + $select = $this->db->select(); + $select->from('gems__rounds', array('gro_id_round', 'gro_id_order', 'gro_round_description')) + ->where('gro_id_track = ?', $trackId) + ->order('gro_id_order'); + + $data = $this->db->fetchAll($select); + + if (! $data) { + return $model; + } + + $status = new Zend_Db_Expr(" + CASE + WHEN gto_completion_time IS NOT NULL THEN 'A' + WHEN gto_valid_from IS NULL THEN 'U' + WHEN gto_valid_from > CURRENT_TIMESTAMP THEN 'W' + WHEN gto_valid_until < CURRENT_TIMESTAMP THEN 'M' + ELSE 'O' + END + "); + + // $labels = $model->getCol('label'); + + $select = $this->db->select(); + $select->from('gems__tokens', array('gto_id_respondent_track', 'gto_id_round', 'status' => $status)) + ->joinInner('gems__reception_codes', 'gto_reception_code = grc_id_reception_code', array()) + ->where('grc_success = 1') + ->where('gto_id_track = ?', $trackId) + ->order('gto_id_respondent_track') + ->order('gto_round_order'); + + // MUtil_Echo::track($this->db->fetchAll($select)); + + $newModel = new MUtil_Model_SelectModel($select, 'tok'); + $newModel->setKeys(array('gto_id_respondent_track')); + // $model->addLeftTable('gems__tokens', array('gr2t_id_track' => 'gto_id_track')); + // $model->addLeftTable('gems__reception_codes', array('gto_reception_code' => 'grc_id_reception_code')); + // $model->addFilter(array('grc_success' => 1)); + // $newModel = $model; + + $transformer = new MUtil_Model_Transform_CrossTabTransformer(); + $transformer->setCrosstabFields('gto_id_round', 'status'); + + foreach ($data as $row) { + $name = 'col_' . $row['gro_id_round']; + $transformer->set($name, 'label', $row['gro_id_order'], 'description', $row['gro_round_description']); + // break; + } + + $newModel->addTransformer($transformer); + // MUtil_Echo::track($data); + + $joinTrans = new MUtil_Model_Transform_JoinTransformer(); + $joinTrans->addModel($newModel, array('gr2t_id_respondent_track' => 'gto_id_respondent_track')); + + $model->resetOrder(); + $model->set('gr2o_patient_nr'); + $model->set('gr2t_start_date'); + $model->addTransformer($joinTrans); + return $model; + + return $newModel; + } + + /** + * Returns a show menu item, if access is allowed by privileges + * + * @return Gems_Menu_SubMenuItem + */ + protected function getShowMenuItem() + { + return $this->findMenuItem('track', 'show-track'); + } + + /** + * + * @return int Return the track id if any or null + */ + public function getTrackId() + { + if ($this->requestCache) { + $data = $this->requestCache->getProgramParams(); + if (isset($data['gr2t_id_track'])) { + return $data['gr2t_id_track']; + } + } else { + return $this->request->getParam('gr2t_id_track'); + } + } + + /** + * Overrule to implement snippet specific filtering and sorting. + * + * @param MUtil_Model_ModelAbstract $model + */ + protected function processFilterAndSort(MUtil_Model_ModelAbstract $model) + { + $trackId = $this->getTrackId(); + + if ($trackId) { + parent::processFilterAndSort($model); + } else { + $model->setFilter(array('1=0')); + $this->onEmpty = $this->_('No track selected...'); + } + } +} Modified: trunk/library/classes/MUtil/Model/DatabaseModelAbstract.php =================================================================== --- trunk/library/classes/MUtil/Model/DatabaseModelAbstract.php 2013-01-14 18:21:45 UTC (rev 1100) +++ trunk/library/classes/MUtil/Model/DatabaseModelAbstract.php 2013-01-15 18:02:16 UTC (rev 1101) @@ -166,6 +166,16 @@ } if (null === $value) { $select->where($name . ' IS NULL'); + } elseif (is_array($value)) { + if ($value) { + foreach ($value as $sub) { + $subs[] = $adapter->quote($value); + } + $select->where($name . ' IN (' . implode(', ', $subs) . ')'); + } else { + // Never a result when a value should be one of an empty set. + $select->where('1=0'); + } } else { $select->where($name . ' = ?', $value); } @@ -318,6 +328,23 @@ return $this->_createSelect($filter, $sort)->query(Zend_Db::FETCH_ASSOC)->fetchAll(); } + /** + * Returns an array containing the first requested item. + * + * @param mixed $filter True to use the stored filter, array to specify a different filter + * @param mixed $sort True to use the stored sort, array to specify a different sort + * @return array An array or false + */ + protected function _loadFirst($filter = true, $sort = true) + { + $select = $this->_createSelect($filter, $sort); + $select->limit(1, 0); + + $data = $select->query(Zend_Db::FETCH_ASSOC)->fetch(); + + return $data; + } + protected function _loadTableMetaData(Zend_Db_Table_Abstract $table) { $table_name = $this->_getTableName($table); @@ -703,10 +730,10 @@ public function formatLoadDate($value, $isNew = false, $name = null, array $context = array()) { // If not empty or zend_db_expression and not already a zend date, we - // transform to a Zend_Date using the ISO_8601 format + // transform to a Zend_Date using the ISO_8601 format if (!empty($value) && !($value instanceof Zend_Date) && !($value instanceof Zend_Db_Expr)) { try { - $tmpDate = new MUtil_Date($value, Zend_Date::ISO_8601); + $tmpDate = new MUtil_Date($value, Zend_Date::ISO_8601); } catch (Exception $exc) { // On failure, we use the input value $tmpDate = $value; @@ -895,26 +922,6 @@ } /** - * Returns an array containing the first requested item. - * - * @param mixed $filter True to use the stored filter, array to specify a different filter - * @param mixed $sort True to use the stored sort, array to specify a different sort - * @return array An array or false - */ - public function loadFirst($filter = true, $sort = true) - { - $select = $this->_createSelect($filter, $sort); - $select->limit(1, 0); - - $data = $select->query(Zend_Db::FETCH_ASSOC)->fetch(); - if (is_array($data)) { - $data = $this->_filterDataAfterLoad($data, false); - } - - return $data; - } - - /** * Returns a Zend_Paginator for the items in the model * * @param mixed $filter True to use the stored filter, array to specify a different filter @@ -929,26 +936,6 @@ return new Zend_Paginator($adapter); } - /** - * Helper function for SelectModelPaginator to process - * setOnLoads. - * - * @see MUtil_Model_SelectModelPaginator - * - * @param array $data Nested array - * @return array Nested - */ - public function processAfterLoad(array $data) - { - if ($this->getMeta(parent::LOAD_TRANSFORMER)) { - foreach ($data as $key => $row) { - $data[$key] = $this->_filterDataAfterLoad($row, false); - } - } - - return $data; - } - // abstract public function save(array $newValues); /** Modified: trunk/library/classes/MUtil/Model/ModelAbstract.php =================================================================== --- trunk/library/classes/MUtil/Model/ModelAbstract.php 2013-01-14 18:21:45 UTC (rev 1100) +++ trunk/library/classes/MUtil/Model/ModelAbstract.php 2013-01-15 18:02:16 UTC (rev 1101) @@ -110,12 +110,22 @@ private $_model_used = false; /** + * + * @var array of MUtil_Model_ModelTransformerInterface + */ + private $_transformers = array(); + + /** * The increment for item ordering, default is 10 * * @var int */ public $orderIncrement = 10; + /** + * + * @param string $modelName Hopefully unique model name + */ public function __construct($modelName) { $this->_model_name = $modelName; @@ -267,6 +277,20 @@ */ abstract protected function _load($filter = true, $sort = true); + /** + * Returns a nested array containing the items requested. + * + * @param mixed $filter True to use the stored filter, array to specify a different filter + * @param mixed $sort True to use the stored sort, array to specify a different sort + * @return array Nested array or false + */ + protected function _loadFirst($filter = true, $sort = true) + { + $data = $this->_load($filter, $sort); + + return reset($data); + } + protected function addChanged($add = 1) { $this->_changedCount += $add; @@ -310,6 +334,21 @@ } /** + * Add a model transformer + * + * @param MUtil_Model_ModelTransformerInterface $transformer + * @return MUtil_Model_ModelAbstract (continuation pattern) + */ + public function addTransformer(MUtil_Model_ModelTransformerInterface $transformer) + { + foreach ($transformer->getFieldInfo($this) as $name => $info) { + $this->set($name, $info); + } + $this->_transformers[] = $transformer; + return $this; + } + + /** * Stores the fields that can be used for sorting or filtering in the * sort / filter objects attached to this model. * @@ -864,6 +903,17 @@ } /** + * Get the model transformers + * + * @return array of MUtil_Model_ModelTransformerInterface + */ + public function getTransformers() + { + $this->_transformers[] = $transformer; + return $this; + } + + /** * Splits a wildcard search text into its constituent parts. * * @param string $searchText @@ -1000,10 +1050,8 @@ { $data = $this->_load($filter, $sort); - if (is_array($data) && $this->getMeta(self::LOAD_TRANSFORMER)) { - foreach ($data as $key => $row) { - $data[$key] = $this->_filterDataAfterLoad($row, false); - } + if (is_array($data)) { + $data = $this->processAfterLoad($data); } return $data; @@ -1018,13 +1066,20 @@ */ public function loadFirst($filter = true, $sort = true) { - $data = $this->_load($filter, $sort); - // Return the first row or null. - $data = reset($data); - if (is_array($data) && $this->getMeta(self::LOAD_TRANSFORMER)) { - $data = $this->_filterDataAfterLoad($data, false); + $row = $this->_loadFirst($filter, $sort); + MUtil_Echo::track($row); + + if (! is_array($row)) { + // Return false + return false; } - return $data; + + // Transform the row + $data = $this->processAfterLoad(array($row)); + MUtil_Echo::track($data); + + // Return resulting first row + return reset($data); } /** @@ -1084,6 +1139,29 @@ /** + * Helper function that procesess the raw data after a load. + * + * @see MUtil_Model_SelectModelPaginator + * + * @param array $data Nested array containing rows + * @return array Nested + */ + public function processAfterLoad(array $data) + { + foreach ($this->_transformers as $transformer) { + $data = $transformer->transformLoad($this, $data); + } + + if ($this->getMeta(self::LOAD_TRANSFORMER)) { + foreach ($data as $key => $row) { + $data[$key] = $this->_filterDataAfterLoad($row, false); + } + } + + return $data; + } + + /** * Remove one attribute for a field name in the model. * * Example: @@ -1094,7 +1172,7 @@ * * @param string $name The fieldname * @param string $key The name of the key - * @return $this + * @return MUtil_Model_ModelAbstract (continuation pattern) */ public function remove($name, $key = null) { @@ -1167,13 +1245,13 @@ * </code> * Both set the attribute 'save' to true for 'field_x'. * - * @param string $name The fieldname + * @param string $name The fieldname * @param mixed $arrayOrKey1 A key => value array or the name of the first key, see MUtil_Args::pairs() * @param mixed $value1 The value for $arrayOrKey1 or null when $arrayOrKey1 is an array * @param string $key2 Optional second key when $arrayOrKey1 is a string * @param mixed $value2 Optional second value when $arrayOrKey1 is a string, * an unlimited number of $key values pairs can be given. - * @return $this + * @return \MUtil_Model_ModelAbstract */ public function set($name, $arrayOrKey1 = null, $value1 = null, $key2 = null, $value2 = null) { @@ -1261,7 +1339,7 @@ * @param mixed $value1 The value for $arrayOrKey1 or null when $arrayOrKey1 is an array * @param string $key2 Optional second key when $arrayOrKey1 is a string * @param mixed $value2 Optional second value when $arrayOrKey1 is a string, an unlimited number of $key values pairs can be given. - * @return $this + * @return MUtil_Model_ModelAbstract (continuation pattern) */ public function setCol($arrayOrKey1 = null, $value1 = null, $key2 = null, $value2 = null) { @@ -1353,7 +1431,7 @@ * @param mixed $value1 The value for $arrayOrKey1 or null when $arrayOrKey1 is an array * @param string $key2 Optional second key when $arrayOrKey1 is a string * @param mixed $value2 Optional second value when $arrayOrKey1 is a string, an unlimited number of $key values pairs can be given. - * @return $this + * @return MUtil_Model_ModelAbstract (continuation pattern) */ public function setMulti(array $names, $arrayOrKey1 = null, $value1 = null, $key2 = null, $value2 = null) { @@ -1443,6 +1521,22 @@ return $this->setSaveWhen($name, array(__CLASS__, 'whenNotNull')); } + /** + * set the model transformers + * + * @param array $transformers of MUtil_Model_ModelTransformerInterface + * @return MUtil_Model_ModelAbstract (continuation pattern) + */ + public function setTransformers(array $transformers) + { + $this->_transformers = array(); + foreach ($transformers as $transformer) { + $this->addTransformer($transformer); + } + return $this; + } + + public function setSort($value) { return $this->setMeta('sort', $this->_checkSortValue($value)); Modified: trunk/library/classes/MUtil/Model/ModelTransformerAbstract.php =================================================================== --- trunk/library/classes/MUtil/Model/ModelTransformerAbstract.php 2013-01-14 18:21:45 UTC (rev 1100) +++ trunk/library/classes/MUtil/Model/ModelTransformerAbstract.php 2013-01-15 18:02:16 UTC (rev 1101) @@ -25,208 +25,140 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * @package MUtil + * @subpackage Model + * @author Matijs de Jong <mj...@ma...> + * @copyright Copyright (c) 2012 Erasmus MC + * @license New BSD License + * @version $id: ModelTransformerInterface.php 203 2012-01-01t 12:51:32Z matijs $ */ /** - * @author Matijs de Jong - * @since 1.0 - * @version 1.1 - * @package MUtil + * A general transformer that implements all required functions, without + * them doing anything so you can just implement what you need. + * + * @package MUtil * @subpackage Model + * @copyright Copyright (c) 2012 Erasmus MC + * @license New BSD License + * @since Class available since MUtil version 1.2 (in current form) */ -abstract class MUtil_Model_ModelTransformerAbstract extends MUtil_Model_ModelAbstract +abstract class MUtil_Model_ModelTransformerAbstract implements MUtil_Model_ModelTransformerInterface { - protected $sourceModel; - - public function __construct(array $args, array $paramTypes = array()) - { - $paramTypes['sourceModel'] = 'MUtil_Model_ModelAbstract'; - $paramTypes['name'] = 'is_string'; - - $args = MUtil_Ra::args($args, $paramTypes); - - if (isset($args['name'])) { - $name = $args['name']; - unset($args['name']); - } else { - if (isset($args['sourceModel'])) { - $name = $args['sourceModel']->getName(); - } else { - // MUtil_Echo::r($args); - throw new MUtil_Model_ModelException('No $name or $sourceModel parameter specified for ' . get_class($this) . ' constructor.'); - } - } - // MUtil_Echo::r($args, $name); - - parent::__construct($name); - - foreach ($args as $name => $arg) { - $function = 'set' . ucfirst($name); - if (method_exists($this, $function)) { - $this->$function($arg); - } else { - throw new MUtil_Model_ModelException("Unknown argument $name in " . get_class($this) . ' constructor.'); - } - } - } - - protected function _getKeyValue($name, $key) - { - if ($this->sourceModel) { - return $this->sourceModel->_getKeyValue($name, $key); - } - } - /** - * Returns a nested array containing the items requested. * - * @param mixed $filter True to use the stored filter, array to specify a different filter - * @param mixed $sort True to use the stored sort, array to specify a different sort - * @return array Nested array or false + * @var array */ - protected function _load($filter = true, $sort = true) - { - $data = $this->sourceModel->_load($filter, $sort); + protected $_fields = array(); - return $this->transform($data, $filter, $sort); - } - - public function delete($filter = true) - { - throw new Exception('Cannot delete ' . get_class($this) . ' data.'); - } - + /** + * Gets one or more values for a certain field name. + * + * @see MUtil_Model_ModelAbstract->get() + * + * @param string $name Field name + * @param string|array|null $arrayOrKey1 Null or the name of a single attribute or an array of attribute names + * @param string $key2 Optional a second attribute name. + * @return mixed + */ public function get($name, $arrayOrKey1 = null, $key2 = null) { - if ($this->sourceModel) { - $args = func_get_args(); + $args = func_get_args(); + $args = MUtil_Ra::args($args, 1); - call_user_func_array(array($this->sourceModel, 'get'), $args); - } - return $this; - } + switch (count($args)) { + case 0: + if (isset($this->_fields[$name])) { + return $this->_fields[$name]; + } else { + return array(); + } - public function getAlias($name) - { - if ($this->sourceModel) { - return $this->sourceModel->getAlias($name); - } - } + case 1: + $key = $arrayOrKey1; + if (isset($this->_fields[$name][$arrayOrKey1])) { + return $this->_fields[$name][$arrayOrKey1]; + } else { + return null; + } - public function getItemNames() - { - if ($this->sourceModel) { - return $this->sourceModel->getItemNames(); + default: + $results = array(); + foreach ($args as $key) { + if (isset($this->_fields[$name][$arrayOrKey1])) { + $results[$key] = $this->_fields[$name][$arrayOrKey1]; + } + } + return $results; } } - public function getItemsOrdered() + /** + * If the transformer add's fields, these should be returned here. + * Called in $model->AddTransformer(), so the transformer MUST + * know which fields to add by then (optionally using the model + * for that). + * + * @param MUtil_Model_ModelAbstract $model The parent model + * @return array Of filedname => set() values + */ + public function getFieldInfo(MUtil_Model_ModelAbstract $model) { - if ($this->sourceModel) { - return $this->sourceModel->getItemsOrdered(); - } + return $this->_fields; } /** - * Return an identifier the item specified by $forData + * Set one or more attributes for a field names in the model. * - * basically transforms the fieldnames ointo oan IDn => value array + * @see MUtil_Model_ModelAbstract->set() * - * @param mixed $forData Array value to vilter on - * @param array $href Or ArrayObject - * @return array That can by used as href + * @param string $name The fieldname + * @param mixed $arrayOrKey1 A key => value array or the name of the first key, see MUtil_Args::pairs() + * @param mixed $value1 The value for $arrayOrKey1 or null when $arrayOrKey1 is an array + * @param string $key2 Optional second key when $arrayOrKey1 is a string + * @param mixed $value2 Optional second value when $arrayOrKey1 is a string, + * an unlimited number of $key values pairs can be given. + * @return \MUtil_Model_ModelTransformerAbstract */ - public function getKeyRef($forData, $href = array()) - { - if ($this->sourceModel) { - return $this->sourceModel->getKeyRef($forData, $href); - } - } - - public function getKeys($reset = false) - { - if ($this->sourceModel) { - return $this->sourceModel->getKeys($reset); - } - } - - public function getMeta($key, $default = null) - { - if ($this->sourceModel) { - return $this->sourceModel->getMeta($key, $default); - } - } - - public function getSourceModel() - { - return $this->sourceModel; - } - - public function has($name, $subkey = null) - { - if ($this->sourceModel) { - return $this->sourceModel->has($name, $subkey); - } - return false; - } - - public function hasMeta($key) - { - if ($this->sourceModel) { - return $this->sourceModel->hasMeta($key); - } - return false; - } - - public function hasNew() - { - return false; - } - - public function resetOrder() - { - if ($this->sourceModel) { - $this->sourceModel->resetOrder(); - } - return $this; - } - - public function save(array $newValues, array $filter = null) - { - throw new Exception('Cannot save ' . get_class($this) . ' data.'); - } - public function set($name, $arrayOrKey1 = null, $value1 = null, $key2 = null, $value2 = null) { - if ($this->sourceModel) { - $args = func_get_args(); + $args = func_get_args(); + $args = MUtil_Ra::pairs($args, 1); - call_user_func_array(array($this->sourceModel, 'set'), $args); - } - return $this; - } + foreach ($args as $key => $value) { + // If $key end with ] it is array value + if (substr($key, -1) == ']') { + if (substr($key, -2) == '[]') { + // If $key ends with [], append it to array + $key = substr($key, 0, -2); + $this->_fields[$name][$key][] = $value; + } else { + // Otherwise extract subkey + $pos = strpos($key, '['); + $subkey = substr($key, $pos + 1, -1); + $key = substr($key, 0, $pos); - public function setKeys(array $keys) - { - if ($this->sourceModel) { - $this->sourceModel->setKeys($key, $value); + $this->_fields[$name][$key][$subkey] = $value; + } + } else { + $this->_fields[$name][$key] = $value; + } } - return $this; - } - public function setMeta($key, $value) - { - if ($this->sourceModel) { - $this->sourceModel->setMeta($key, $value); - } return $this; } - public function setSourceModel(MUtil_Model_ModelAbstract $model) + /** + * The transform function performs the actual transformation of the data and is called after + * the loading of the data in the source model. + * + * @param MUtil_Model_ModelAbstract $model The parent model + * @param array $data Nested array + * @return array Nested array containing (optionally) transformed data + */ + public function transformLoad(MUtil_Model_ModelAbstract $model, array $data) { - $this->sourceModel = $model; - return $this; + return $data; } - - abstract public function transform($data, $filter = true, $sort = true); } Added: trunk/library/classes/MUtil/Model/ModelTransformerInterface.php =================================================================== --- trunk/library/classes/MUtil/Model/ModelTransformerInterface.php (rev 0) +++ trunk/library/classes/MUtil/Model/ModelTransformerInterface.php 2013-01-15 18:02:16 UTC (rev 1101) @@ -0,0 +1,69 @@ +<?php + +/** + * Copyright (c) 2012, Erasmus MC + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Erasmus MC nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * @package MUtil + * @subpackage Model + * @author Matijs de Jong <mj...@ma...> + * @copyright Copyright (c) 2012 Erasmus MC + * @license New BSD License + * @version $id: ModelTransformerInterface.php 203 2012-01-01t 12:51:32Z matijs $ + */ + +/** + * An general interface to transform the data retrieved by a model + * + * @package MUtil + * @subpackage Model + * @copyright Copyright (c) 2012 Erasmus MC + * @license New BSD License + * @since Class available since MUtil version 1.2 + */ +interface MUtil_Model_ModelTransformerInterface +{ + /** + * If the transformer add's fields, these should be returned here. + * Called in $model->AddTransformer(), so the transformer MUST + * know which fields to add by then (optionally using the model + * for that). + * + * @param MUtil_Model_ModelAbstract $model The parent model + * @return array Of filedname => set() values + */ + public function getFieldInfo(MUtil_Model_ModelAbstract $model); + + /** + * The transform function performs the actual transformation of the data and is called after + * the loading of the data in the source model. + * + * @param MUtil_Model_ModelAbstract $model The parent model + * @param array $data Nested array + * @return array Nested array containing (optionally) transformed data + */ + public function transformLoad(MUtil_Model_ModelAbstract $model, array $data); +} Modified: trunk/library/classes/MUtil/Model/SelectModelPaginator.php =================================================================== --- trunk/library/classes/MUtil/Model/SelectModelPaginator.php 2013-01-14 18:21:45 UTC (rev 1100) +++ trunk/library/classes/MUtil/Model/SelectModelPaginator.php 2013-01-15 18:02:16 UTC (rev 1101) @@ -94,7 +94,7 @@ $items = $this->_selectAdapter->getItems($offset, $itemCountPerPage); // MUtil_Echo::track($items); - if ($items && is_array($items)) { + if (is_array($items)) { $items = $this->_model->processAfterLoad($items); } // MUtil_Echo::track($items); Added: trunk/library/classes/MUtil/Model/Transform/CrossTabTransformer.php =================================================================== --- trunk/library/classes/MUtil/Model/Transform/CrossTabTransformer.php (rev 0) +++ trunk/library/classes/MUtil/Model/Transform/CrossTabTransformer.php 2013-01-15 18:02:16 UTC (rev 1101) @@ -0,0 +1,122 @@ +<?php + +/** + * Copyright (c) 2012, Erasmus MC + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Erasmus MC nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * @package MUtil + * @subpackage Model + * @author Matijs de Jong <mj...@ma...> + * @copyright Copyright (c) 2012 Erasmus MC + * @license New BSD License + * @version $id: CrossTabTransformer.php 203 2012-01-01t 12:51:32Z matijs $ + */ + +/** + * + * + * @package MUtil + * @subpackage Model + * @copyright Copyright (c) 2012 Erasmus MC + * @license New BSD License + * @since Class available since MUtil version 1.2 + */ +class MUtil_Model_Transform_CrossTabTransformer extends MUtil_Model_ModelTransformerAbstract +{ + /** + * The field to crosstab over + * + * @var string + */ + protected $idField; + + /** + * + * @var string + */ + protected $valueField; + + /** + * + * @param string $idField The field values to perform the crosstab over + * @param string $valueField The field values to crosstab + * @return MUtil_Model_Transform_CrossTabTransformer (continuation pattern) + */ + public function setCrosstabFields($idField, $valueField) + { + $this->idField = $idField; + $this->valueField = $valueField; + + return $this; + + } + + /** + * The transform function performs the actual transformation of the data and is called after + * the loading of the data in the source model. + * + * @param MUtil_Model_ModelAbstract $model The parent model + * @param array $data Nested array + * @return array Nested array containing (optionally) transformed data + */ + public function transformLoad(MUtil_Model_ModelAbstract $model, array $data) + { + if (! $data) { + return $data; + } + + //* + $row = reset($data); + if (! ($this->idField && + $this->valueField && + isset($row[$this->idField]) && + array_key_exists($this->valueField, $row) + )) { + return $data; + } + + $keys = $model->getKeys(); + $keys = array_combine($keys, $keys); + $default = array_fill_keys(array_keys($this->_fields), null); + $except = array($this->idField => 1, $this->valueField => 1); + $results = array(); + foreach ($data as $row) { + $name = 'col_' . $row[$this->idField]; + + if (isset($this->_fields[$name])) { + $key = implode("\t", array_intersect_key($row, $keys)); + + if (! isset($results[$key])) { + $results[$key] = array_diff_key($row, $except) + $default; + } + $results[$key][$name] = $row[$this->valueField]; + } + } + + // MUtil_Echo::track($results, $data); + return $results; + } +} Added: trunk/library/classes/MUtil/Model/Transform/JoinTransformer.php =================================================================== --- trunk/library/classes/MUtil/Model/Transform/JoinTransformer.php (rev 0) +++ trunk/library/classes/MUtil/Model/Transform/JoinTransformer.php 2013-01-15 18:02:16 UTC (rev 1101) @@ -0,0 +1,143 @@ +<?php + +/** + * Copyright (c) 2012, Erasmus MC + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Erasmus MC nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * @package MUtil + * @subpackage Model + * @author Matijs de Jong <mj...@ma...> + * @copyright Copyright (c) 2012 Erasmus MC + * @license New BSD License + * @version $id: JoinTransformer.php 203 2012-01-01t 12:51:32Z matijs $ + */ + +/** + * Transform that can be used to join models to another model in non-relational + * ways. + * + * @package MUtil + * @subpackage Model + * @copyright Copyright (c) 2012 Erasmus MC + * @license New BSD License + * @since Class available since MUtil version 1.2 + */ +class MUtil_Model_Transform_JoinTransformer implements MUtil_Model_ModelTransformerInterface +{ + /** + * + * @var array of join functions + */ + protected $_joins = array(); + + /** + * + * @var array of MUtil_Model_ModelAbstract + */ + protected $_subModels = array(); + + public function addModel(MUtil_Model_ModelAbstract $subModel, array $joinFields) + { + $name = $subModel->getName(); + $this->_subModels[$name] = $subModel; + $this->_joins[$name] = $joinFields; + + if (count($joinFields) > 1) { + throw new MUtil_Model_ModelException(__CLASS__ . " currently accepts single field joins only."); + } + + return $this; + } + + /** + * If the transformer add's fields, these should be returned here. + * Called in $model->AddTransformer(), so the transformer MUST + * know which fields to add by then (optionally using the model + * for that). + * + * @param MUtil_Model_ModelAbstract $model The parent model + * @return array Of filedname => set() values + */ + public function getFieldInfo(MUtil_Model_ModelAbstract $model) + { + $data = array(); + foreach ($this->_subModels as $sub) { + foreach ($sub->getItemNames() as $name) { + if (! $model->has($name)) { + $data[$name] = $sub->get($name); + } + } + } + return $data; + } + + /** + * The transform function performs the actual transformation of the data and is called after + * the loading of the data in the source model. + * + * @param MUtil_Model_ModelAbstract $model The parent model + * @param array $data Nested array + * @return array Nested array containing (optionally) transformed data + */ + public function transformLoad(MUtil_Model_ModelAbstract $model, array $data) + { + if (! $data) { + return $data; + } + + foreach ($this->_subModels as $name => $sub) { + /* @var $sub MUtil_Model_ModelAbstract */ + + if (1 === count($this->_joins[$name])) { + $mkey = key($this->_joins[$name]); + $skey = reset($this->_joins[$name]); + + $mfor = MUtil_Ra::column($mkey, $data); + + // MUtil_Echo::track($mfor); + + $sdata = $sub->load(array($skey => $mfor)); + // MUtil_Echo::track($sdata); + + $skeys = array_flip(MUtil_Ra::column($skey, $sdata)); + $empty = array_fill_keys(array_keys(reset($sdata)), null); + + foreach ($data as &$mrow) { + $mfind = $mrow[$mkey]; + + if (isset($skeys[$mfind])) { + $mrow += $sdata[$skeys[$mfind]]; + } else { + $mrow += $empty; + } + } + } + } + // MUtil_Echo::track($data); + + return $data; + } +} Modified: trunk/library/classes/MUtil/Model/Transform/RequiredRowsTransformer.php =================================================================== --- trunk/library/classes/MUtil/Model/Transform/RequiredRowsTransformer.php 2013-01-14 18:21:45 UTC (rev 1100) +++ trunk/library/classes/MUtil/Model/Transform/RequiredRowsTransformer.php 2013-01-15 18:02:16 UTC (rev 1101) @@ -49,22 +49,33 @@ */ class MUtil_Model_Transform_RequiredRowsTransformer extends MUtil_Model_ModelTransformerAbstract { + /** + * Contains default values for all missing row values + * + * @var mixed Something that can be made into an array using MUtil_Ra::to() + */ protected $_defaultRow; + + /** + * The number of key values to compare, if empty the number of fields in the first required row + * + * @var int + */ protected $_keyItemCount; + + /** + * + * @var mixed Something that can be made into an array using MUtil_Ra::to() + */ protected $_requiredRows; - public function __construct($requiredRows, $sourceModel_args = null) - { - $args = func_get_args(); - $paramTypes = array( - 'sourceModel' => 'MUtil_Model_ModelAbstract', - 'requiredRows' => 'is_ra_array', - 'keyItemCount' => 'is_int', - ); - - parent::__construct($args, $paramTypes); - } - + /** + * + * @param array $required + * @param array $row + * @param int $count + * @return boolean True if the rows refer to the same row + */ protected function _compareRows($required, $row, $count) { if ($row) { @@ -87,10 +98,16 @@ } } - public function getDefaultRow() + /** + * Returns the required rows set or calculates the rows using the $model and the required rows info + * + * @param MUtil_Model_ModelAbstract $model Optional model for calculation + * @return array + * @throws MUtil_Model_ModelException + */ + public function getDefaultRow(MUtil_Model_ModelAbstract $model = null) { if (! $this->_defaultRow) { - $model = $this->getSourceModel(); $requireds = $this->getRequiredRows(); $required = MUtil_Ra::to(reset($requireds)); @@ -98,7 +115,7 @@ $this->setKeyItemCount(count($required)); } - if ($model && $required) { + if ($required && ($model instanceof MUtil_Model_ModelAbstract)) { $defaults = array(); foreach ($model->getItemNames() as $name) { if (! array_key_exists($name, $required)) { @@ -116,6 +133,11 @@ return $this->_defaultRow; } + /** + * The number of key values to compare + * + * @return int + */ public function getKeyItemCount() { if (! $this->_keyItemCount) { @@ -126,6 +148,11 @@ return $this->_keyItemCount; } + /** + * Array of required rows + * + * @return array + */ public function getRequiredRows() { if (! is_array($this->_requiredRows)) { @@ -135,6 +162,13 @@ return $this->_requiredRows; } + /** + * Contains default values for all missing row values + * + * @param mixed $defaultRow Something that can be made into an array using MUtil_Ra::to() + * @return \MUtil_Model_Transform_RequiredRowsTransformer + * @throws MUtil_Model_ModelException + */ public function setDefaultRow($defaultRow) { if (MUtil_Ra::is($defaultRow)) { @@ -145,12 +179,25 @@ throw new MUtil_Model_ModelException('Invalid parameter type for ' . __FUNCTION__ . ': $rows cannot be converted to an array.'); } + /** + * The number of key values to compare + * + * @param int $count + * @return \MUtil_Model_Transform_RequiredRowsTransformer + */ public function setKeyItemCount($count) { $this->_keyItemCount = $count; return $this; } + /** + * The keys for the required rows + * + * @param mixed $rows Something that can be made into an array using MUtil_Ra::to() + * @return \MUtil_Model_Transform_RequiredRowsTransformer + * @throws MUtil_Model_ModelException + */ public function setRequiredRows($rows) { if (MUtil_Ra::is($rows)) { @@ -161,9 +208,17 @@ throw new MUtil_Model_ModelException('Invalid parameter type for ' . __FUNCTION__ . ': $rows cannot be converted to an array.'); } - public function transform($data, $filter = true, $sort = true) + /** + * The transform function performs the actual transformation of the data and is called after + * the loading of the data in the source model. + * + * @param MUtil_Model_ModelAbstract $model The parent model + * @param array $data Nested array + * @return array Nested array containing (optionally) transformed data + */ + public function transformLoad(MUtil_Model_ModelAbstract $model... [truncated message content] |
From: <gem...@li...> - 2013-01-14 18:21:52
|
Revision: 1100 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=1100&view=rev Author: matijsdejong Date: 2013-01-14 18:21:45 +0000 (Mon, 14 Jan 2013) Log Message: ----------- Further speedup of PluginLoader Modified Paths: -------------- trunk/library/classes/MUtil/Loader/PluginLoader.php Modified: trunk/library/classes/MUtil/Loader/PluginLoader.php =================================================================== --- trunk/library/classes/MUtil/Loader/PluginLoader.php 2013-01-14 12:12:28 UTC (rev 1099) +++ trunk/library/classes/MUtil/Loader/PluginLoader.php 2013-01-14 18:21:45 UTC (rev 1100) @@ -53,7 +53,13 @@ */ public function addFallBackPath() { - parent::addPrefixPath('', ''); + // Add each of the classpath directories to the prefixpaths + // with an empty prefix. + foreach (Zend_Loader::explodeIncludePath() as $include) { + if ($real = realpath($include)) { + parent::addPrefixPath('', $real); + } + } return $this; } @@ -235,4 +241,81 @@ return false; } + + /** + * Load a plugin via the name provided + * + * @param string $name + * @param bool $throwExceptions Whether or not to throw exceptions if the + * class is not resolved + * @return string|false Class name of loaded class; false if $throwExceptions + * if false and no class found + * @throws Zend_Loader_Exception if class not found + */ + public function load($name, $throwExceptions = true) + { + if ($this->isLoaded($name)) { + return $this->getClassName($name); + } + $name = $this->_formatName($name); + + if ($this->_useStaticRegistry) { + $registry = self::$_staticPrefixToPaths[$this->_useStaticRegistry]; + } else { + $registry = $this->_prefixToPaths; + } + + $registry = array_reverse($registry, true); + $found = false; + $classFile = str_replace('_', DIRECTORY_SEPARATOR, $name) . '.php'; + $incFile = self::getIncludeFileCache(); + foreach ($registry as $prefix => $paths) { + $className = $prefix . $name; + + if (class_exists($className, false)) { + $found = true; + break; + } + + $paths = array_reverse($paths, true); + + foreach ($paths as $path) { + $loadFile = $path . $classFile; + // Can use file_exist now, as any paths in the class path that + // could be use are already in use. + // if (Zend_Loader::isReadable($loadFile)) { + if (file_exists($loadFile)) { + // include_once $loadFile; + include $loadFile; // Is faster + if (class_exists($className, false)) { + if (null !== $incFile) { + self::_appendIncFile($loadFile); + } + $found = true; + break 2; + } + } + } + } + + if (!$found) { + if (!$throwExceptions) { + return false; + } + + $message = "Plugin by name '$name' was not found in the registry; used paths:"; + foreach ($registry as $prefix => $paths) { + $message .= "\n$prefix: " . implode(PATH_SEPARATOR, $paths); + } + require_once 'Zend/Loader/PluginLoader/Exception.php'; + throw new Zend_Loader_PluginLoader_Exception($message); + } + + if ($this->_useStaticRegistry) { + self::$_staticLoadedPlugins[$this->_useStaticRegistry][$name] = $className; + } else { + $this->_loadedPlugins[$name] = $className; + } + return $className; + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2013-01-14 12:12:40
|
Revision: 1099 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=1099&view=rev Author: matijsdejong Date: 2013-01-14 12:12:28 +0000 (Mon, 14 Jan 2013) Log Message: ----------- Fixed issue where only some of the url parameters where encoded Modified Paths: -------------- trunk/library/classes/MUtil/Html/UrlArrayAttribute.php Modified: trunk/library/classes/MUtil/Html/UrlArrayAttribute.php =================================================================== --- trunk/library/classes/MUtil/Html/UrlArrayAttribute.php 2013-01-13 20:03:13 UTC (rev 1098) +++ trunk/library/classes/MUtil/Html/UrlArrayAttribute.php 2013-01-14 12:12:28 UTC (rev 1099) @@ -42,7 +42,7 @@ * @subpackage Html * @copyright Copyright (c) 2011 Erasmus MC * @license New BSD License - * @since Class available since version 1.0 + * @since Class available since MUtil version 1.0 */ class MUtil_Html_UrlArrayAttribute extends MUtil_Html_ArrayAttribute { @@ -99,7 +99,7 @@ } else { // Prevent double escaping by using rawurlencode() instead // of urlencode() that is used by Zend_Controller_Router_Route - $url_parameters[$key] = rawurlencode($value); + $url_parameters[$key] = rawurlencode($value); } } @@ -117,11 +117,27 @@ // Only when no string is defined we assume this is a Zend MVC url if ($url_parameters) { + + if (! $this->getRouteReset()) { + // Add the request parameters here as otherwise $router->assemble() + // will add the existing parameters without escaping. + $request = $this->getRequest(); + + foreach ($request->getParams() as $key => $value) { + if (!array_key_exists($key, $url_parameters)) { + // E.g. Exceptions are stored as parameters :( + if (! is_object($value)) { + $url_parameters[$key] = rawurlencode($value); + } + } + } + } + // Make sure controllor, action, module are specified $url_parameters = self::rerouteUrl($this->getRequest(), $url_parameters); $router = $this->getRouter(); - return $router->assemble($url_parameters, null, $this->getRouteReset(), false); + return $router->assemble($url_parameters, null, true, false); } return null; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2013-01-13 20:03:25
|
Revision: 1098 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=1098&view=rev Author: matijsdejong Date: 2013-01-13 20:03:13 +0000 (Sun, 13 Jan 2013) Log Message: ----------- Loader/PluginLoader.php now checks the include path for possible loading directories Assemblers and Processors can be loaded through (centrally defined) plugin Loader/PluginLoader.php Model/Input loads options lazily Model/AssemblerInterface allows options to be set during processor construction Modified Paths: -------------- trunk/library/classes/MUtil/Loader/PluginLoader.php trunk/library/classes/MUtil/Model/Assembler/FormAssembler.php trunk/library/classes/MUtil/Model/AssemblerAbstract.php trunk/library/classes/MUtil/Model/AssemblerInterface.php trunk/library/classes/MUtil/Model/Input.php trunk/library/classes/MUtil/Model/ModelAbstract.php trunk/library/classes/MUtil/Model/Processor/ElementProcessorAbstract.php trunk/library/classes/MUtil/Model.php Added Paths: ----------- trunk/library/classes/MUtil/Model/Processor/Element/SelectElementProcessor.php Modified: trunk/library/classes/MUtil/Loader/PluginLoader.php =================================================================== --- trunk/library/classes/MUtil/Loader/PluginLoader.php 2013-01-11 18:28:58 UTC (rev 1097) +++ trunk/library/classes/MUtil/Loader/PluginLoader.php 2013-01-13 20:03:13 UTC (rev 1098) @@ -71,15 +71,10 @@ throw new Zend_Loader_PluginLoader_Exception('Zend_Loader_PluginLoader::addPrefixPath() method only takes strings for prefix and path.'); } - if ($path) { - if (('/' == $path[0]) || ('.' == $path[0]) || ((strlen($path) > 1) && (':' == $path[1]))) { - // Only add existing directories - if (! file_exists(rtrim($path, '/\\'))) { - return $this; - } - } + // MUtil_Echo::track(self::getAbsolutePaths($path)); + foreach (self::getAbsolutePaths($path) as $sub) { + parent::addPrefixPath($prefix, $sub); } - parent::addPrefixPath($prefix, $path); return $this; } @@ -163,4 +158,81 @@ ); } } + + /** + * Add existing include path directories to subdirectory (if not absolute) + * + * @staticvar string $includePaths Array containing exploded and checked include path + * @param string $path + * @return array Can be empty if none of the options exist + */ + public static function getAbsolutePaths($path) + { + static $includePaths; + + if ($path) { + // Try to see if the path is an absolute path. Some exotic absolute paths can fail this test, + // but it is more error prone to test for them here than to loop through them afterwards. + if (self::isAbsolutePath($path)) { + if ($real = realpath($path)) { + return array($real); + } else { + return array(); + } + } + } + + if (! is_array($includePaths)) { + // Make sure the include path are loaded + foreach (Zend_Loader::explodeIncludePath() as $include) { + // Current path will be checked, for each file + // but check the other paths for exiistence + if (('.' != $include) && ($real = realpath($include))) { + $includePaths[] = $real . DIRECTORY_SEPARATOR; + } + } + } + + // Check path name + $results = array(); + if ($real = realpath($path)) { + $results[] = $real; + } + + // Check simple concatenation + foreach ($includePaths as $include) { + if ($real = realpath($include . $path)) { + $results[] = $real;; + } + } + + // Reverse the result as that is the order this loader handles the directories + return array_reverse($results); + } + + /** + * Do a quick check for a path being absolute (may not work for some exotic absolute paths though) + * + * @param string $path + * @return boolean + */ + public static function isAbsolutePath($path) + { + if ($path) { + // Try to see if the path is an absolute path. Some exotic absolute paths can fail this test, + // but it is more error prone to test for them here than to loop through them afterwards. + if (substr(PHP_OS, 0, 1) === 'WIN') { + // Match for A:\ and \\ network paths + if (preg_match('/([A-Za-z]:\\|\\\\)./', $path)) { + return true; + } + } else { + if (strlen($path) && (DIRECTORY_SEPARATOR === $path[0])) { + return true; + } + } + } + + return false; + } } Modified: trunk/library/classes/MUtil/Model/Assembler/FormAssembler.php =================================================================== --- trunk/library/classes/MUtil/Model/Assembler/FormAssembler.php 2013-01-11 18:28:58 UTC (rev 1097) +++ trunk/library/classes/MUtil/Model/Assembler/FormAssembler.php 2013-01-13 20:03:13 UTC (rev 1098) @@ -49,12 +49,18 @@ /** * Create the processor for this name * + * @param MUtil_Model_ModelAbstract $model * @param string $name - * @return MUtil_Model_ProcessorInterface or null when it does not exist + * @return MUtil_Model_ProcessorInterface or string or array for creation null when it does not exist */ - protected function _assemble($name) + protected function _assemble(MUtil_Model_ModelAbstract $model, $name) { - return new MUtil_Model_Processor_Element_TextElementProcessor(); + + if ($model->has($name, 'multiOptions')) { + return 'Element_SelectElementProcessor'; + } + + return 'Element_TextElementProcessor'; } } Modified: trunk/library/classes/MUtil/Model/AssemblerAbstract.php =================================================================== --- trunk/library/classes/MUtil/Model/AssemblerAbstract.php 2013-01-11 18:28:58 UTC (rev 1097) +++ trunk/library/classes/MUtil/Model/AssemblerAbstract.php 2013-01-13 20:03:13 UTC (rev 1098) @@ -36,8 +36,14 @@ */ /** + * Abstract implementation of AssemblerInterface, only _assmble() needs to be + * implemented. * + * This abstract class contains helper functions to facilitate working + * with processors. * + * @see MUtil_Model_AssemblerInterface + * * @package MUtil * @subpackage Model * @copyright Copyright (c) 2012 Erasmus MC @@ -54,12 +60,24 @@ /** * + * @var array name => extra options for name + */ + protected $_extraArgs = array(); + + /** + * * @var MUtil_Model_ModelAbstract */ protected $_model; /** * + * @var MUtil_Loader_PluginLoader + */ + private $_processorLoader = array(); + + /** + * * @var array Of name => MUtil_Model_ProcessorInterface */ protected $_processors = array(); @@ -79,21 +97,37 @@ /** * Create the processor for this name * + * @param MUtil_Model_ModelAbstract $model * @param string $name - * @return MUtil_Model_ProcessorInterface or null when it does not exist + * @return MUtil_Model_ProcessorInterface or string or array for creation null when it does not exist */ - abstract protected function _assemble($name); + abstract protected function _assemble(MUtil_Model_ModelAbstract $model, $name); /** * Get the processed output of the input or a lazy object if the data is repeated * or not yet set using setRepeater() or setRow(). * * @param string $name + * @param mixed $arrayOrKey1 A key => value array or the name of the first key, see MUtil_Args::pairs() + * These setting are applied to the model. + * @param mixed $value1 The value for $arrayOrKey1 or null when $arrayOrKey1 is an array + * @param string $key2 Optional second key when $arrayOrKey1 is a string + * @param mixed $value2 Optional second value when $arrayOrKey1 is a string, + * an unlimited number of $key values pairs can be given. * @return mixed MUtil_Lazy_Call when not using setRow(), actual output otherwise */ - public function getOutput($name) + public function getOutput($name, $arrayOrKey1 = null, $value1 = null, $key2 = null, $value2 = null) { - if (! $this->hasProcessor($name)) { + // Process new settings + if ($args = MUtil_Ra::pairs(func_get_args(), 1)) { + if (! $this->_model) { + throw new MUtil_Model_ModelException("Cannot use processor without a model."); + } + + $this->_model->set($name, $args); + } + + if (! $this->hasProcessor($name, $args)) { if ($this->_row) { if (isset($this->_row[$name])) { return $this->_row[$name]; @@ -119,14 +153,44 @@ return new MUtil_Lazy_Call(array($this, 'output'), array($name)); } + /** + * Returns the plugin loader for processors. + * + * @return MUtil_Loader_PluginLoader + */ + public function getProcessorLoader() + { + if (! $this->_processorLoader) { + $this->setProcessorLoader(MUtil_Model::getProcessorLoader()); + } + + return $this->_processorLoader; + } + + /** * Returns the processor for the name * * @param string $name + * @param mixed $arrayOrKey1 A key => value array or the name of the first key, see MUtil_Args::pairs() + * These setting are applied to the model. + * @param mixed $value1 The value for $arrayOrKey1 or null when $arrayOrKey1 is an array + * @param string $key2 Optional second key when $arrayOrKey1 is a string + * @param mixed $value2 Optional second value when $arrayOrKey1 is a string, + * an unlimited number of $key values pairs can be given. * @return MUtil_Model_ProcessorInterface or null when it does not exist */ - public function getProcessor($name) + public function getProcessor($name, $arrayOrKey1 = null, $value1 = null, $key2 = null, $value2 = null) { + // Process new settings + if ($args = MUtil_Ra::pairs(func_get_args(), 1)) { + if (! $this->_model) { + throw new MUtil_Model_ModelException("Cannot use processor without a model."); + } + + $this->_model->set($name, $args); + } + if ($this->hasProcessor($name)) { return $this->_processors[$name]; } @@ -140,13 +204,17 @@ */ public function hasProcessor($name) { + if (! $this->_model) { + throw new MUtil_Model_ModelException("Cannot use processor without a model."); + } + if (! array_key_exists($name, $this->_processors)) { // Default if nothing there $this->_processors[$name] = false; // Try to create one if ($this->_model->has($name)) { - if ($processor = $this->_assemble($name)) { + if ($processor = $this->_assemble($this->_model, $name)) { $this->setProcessor($name, $processor); } } @@ -185,30 +253,57 @@ } /** - * Set the processor for a name + * Set the model of this assembler * - * @param string $name - * $param MUtil_Model_ProcessorInterface $processor + * @param MUtil_Model_ModelAbstract $model * @return MUtil_Model_AssemblerInterface (continuation pattern) */ - public function setProcessor($name, MUtil_Model_ProcessorInterface $processor) + public function setModel(MUtil_Model_ModelAbstract $model) { - $this->_processors[$name] = $processor; + $this->_model = $model; return $this; } /** - * Set the model of this assembler + * Sets the plugin loader for processors. * - * @param MUtil_Model_ModelAbstract $model + * @param MUtil_Loader_PluginLoader $loader + */ + public function setProcessorLoader(MUtil_Loader_PluginLoader $loader) + { + $this->_processorLoader = $loader; + } + + /** + * Set the processor for a name + * + * @param string $name + * $param mixed $processor MUtil_Model_ProcessorInterface or string or array that can be used to create processor * @return MUtil_Model_AssemblerInterface (continuation pattern) */ - public function setModel(MUtil_Model_ModelAbstract $model) + public function setProcessor($name, $processor) { - $this->_model = $model; + if (is_string($processor)) { + $loader = $this->getProcessorLoader(); + $processor = $loader->createClass($processor); - return $this; + } elseif (is_array($processor)) { + $loader = $this->getProcessorLoader(); + $arguments = $processor; + $processor = array_shift($arguments); + + $processor = $loader->createClass($processor, $arguments); + + } + + if ($processor instanceof MUtil_Model_ProcessorInterface) { + $this->_processors[$name] = $processor; + + return $this; + } + + throw new MUtil_Model_ModelException("No valid processor set for '$name'."); } /** Modified: trunk/library/classes/MUtil/Model/AssemblerInterface.php =================================================================== --- trunk/library/classes/MUtil/Model/AssemblerInterface.php 2013-01-11 18:28:58 UTC (rev 1097) +++ trunk/library/classes/MUtil/Model/AssemblerInterface.php 2013-01-13 20:03:13 UTC (rev 1098) @@ -36,7 +36,12 @@ */ /** + * An assembler creates Processors that generate output for fieldnames. * + * The processer for a field (accessed through getProcessor()) does not depend + * on the specific current row data, but the output of that processor + * (accesible through getOutput()) can change depending on the content + * of the row data. * * @package MUtil * @subpackage Model @@ -51,17 +56,29 @@ * or not yet set using setRepeater() or setRow(). * * @param string $name + * @param mixed $arrayOrKey1 A key => value array or the name of the first key, see MUtil_Args::pairs() + * These setting are applied to the model. + * @param mixed $value1 The value for $arrayOrKey1 or null when $arrayOrKey1 is an array + * @param string $key2 Optional second key when $arrayOrKey1 is a string + * @param mixed $value2 Optional second value when $arrayOrKey1 is a string, + * an unlimited number of $key values pairs can be given. * @return mixed MUtil_Lazy_Call when not using setRow(), actual output otherwise */ - public function getOutput($name); + public function getOutput($name, $arrayOrKey1 = null, $value1 = null, $key2 = null, $value2 = null); /** * Returns the processor for the name * * @param string $name + * @param mixed $arrayOrKey1 A key => value array or the name of the first key, see MUtil_Args::pairs() + * These setting are applied to the model. + * @param mixed $value1 The value for $arrayOrKey1 or null when $arrayOrKey1 is an array + * @param string $key2 Optional second key when $arrayOrKey1 is a string + * @param mixed $value2 Optional second value when $arrayOrKey1 is a string, + * an unlimited number of $key values pairs can be given. * @return MUtil_Model_ProcessorInterface or null when it does not exist */ - public function getProcessor($name); + public function getProcessor($name, $arrayOrKey1 = null, $value1 = null, $key2 = null, $value2 = null); /** * Returns true if a processor exist for $name @@ -83,10 +100,10 @@ * Set the processor for a name * * @param string $name - * $param MUtil_Model_ProcessorInterface $processor + * $param mixed $processor MUtil_Model_ProcessorInterface or string or array that can be used to create processor * @return MUtil_Model_AssemblerInterface (continuation pattern) */ - public function setProcessor($name, MUtil_Model_ProcessorInterface $processor); + public function setProcessor($name, $processor); /** * Use this method when you want to repeat the output for each row when rendering. Modified: trunk/library/classes/MUtil/Model/Input.php =================================================================== --- trunk/library/classes/MUtil/Model/Input.php 2013-01-11 18:28:58 UTC (rev 1097) +++ trunk/library/classes/MUtil/Model/Input.php 2013-01-13 20:03:13 UTC (rev 1098) @@ -70,7 +70,7 @@ * * @var array */ - protected $_options; + protected $_options = array(); /** * The original begin value @@ -102,7 +102,6 @@ $this->_context = $context; $this->_model = $model; $this->_name = $name; - $this->_options = $model->get($name); $this->_origValue = $context[$name]; $this->_output = $this->_origValue; } @@ -144,17 +143,29 @@ { if (array_key_exists($name, $this->_options)) { return $this->_options[$name]; + } else { + return $this->_model->get($this->_name, $name); } } /** - * Return all options + * Return all or a named subset of options * + * @param array $names Optional: an array of names to get the options from * @return array */ - public function getOptions() + public function getOptions(array $names = null) { - return $this->_options; + if (null === $names) { + // Return all + return $this->_options + $this->_model->get($this->_name); + } + + $result = array(); + foreach ($names as $name) { + $result[$name] = $this->getOption($name); + } + return $result; } /** @@ -206,6 +217,11 @@ { // If $key end with ] it is array value if (substr($name, -1) == ']') { + // Load from original model + if (! isset($this->_options[$name])) { + $this->_options[$name] = $this->_model->get($this->_name, $name); + } + if (substr($name, -2) == '[]') { // If $name ends with [], append it to array $name = substr($name, 0, -2); Modified: trunk/library/classes/MUtil/Model/ModelAbstract.php =================================================================== --- trunk/library/classes/MUtil/Model/ModelAbstract.php 2013-01-11 18:28:58 UTC (rev 1097) +++ trunk/library/classes/MUtil/Model/ModelAbstract.php 2013-01-13 20:03:13 UTC (rev 1098) @@ -569,24 +569,27 @@ { $assemblers = $this->getMeta(MUtil_Model::META_ASSEMBLERS); - if (isset($assemblers[$identifier])) { - if ($assemblers[$identifier] instanceof MUtil_Model_AssemblerInterface) { - return $assemblers[$identifier]; - } + if (! isset($assemblers[$identifier])) { + // We cannot create when noting is specified + return null; + } - $loader = MUtil_Model::getAssemblerLoader(); - $assembler = $loader->createClass($assemblers[$identifier]); - $assembler->setModel($this); + if ($assemblers[$identifier] instanceof MUtil_Model_AssemblerInterface) { + return $assemblers[$identifier]; + } - if (null !== $data) { - $assembler->setRow($data); - } + $loader = MUtil_Model::getAssemblerLoader(); + $assembler = $loader->createClass($assemblers[$identifier]); + $assembler->setModel($this); - $assemblers[$identifier] = $assembler; - $this->setMeta(MUtil_Model::META_ASSEMBLERS, $assemblers); + if (null !== $data) { + $assembler->setRow($data); + } - return $assembler; - } + $assemblers[$identifier] = $assembler; + $this->setMeta(MUtil_Model::META_ASSEMBLERS, $assemblers); + + return $assembler; } /** @@ -1165,10 +1168,11 @@ * Both set the attribute 'save' to true for 'field_x'. * * @param string $name The fieldname - * @param string|array $arrayOrKey1 A key => value array or the name of the first key - * @param mixed $value1 The value for $arrayOrKey1 or null when $arrayOrKey1 is an array - * @param string $key2 Optional second key when $arrayOrKey1 is a string - * @param mixed $value2 Optional second value when $arrayOrKey1 is a string, an unlimited number of $key values pairs can be given. + * @param mixed $arrayOrKey1 A key => value array or the name of the first key, see MUtil_Args::pairs() + * @param mixed $value1 The value for $arrayOrKey1 or null when $arrayOrKey1 is an array + * @param string $key2 Optional second key when $arrayOrKey1 is a string + * @param mixed $value2 Optional second value when $arrayOrKey1 is a string, + * an unlimited number of $key values pairs can be given. * @return $this */ public function set($name, $arrayOrKey1 = null, $value1 = null, $key2 = null, $value2 = null) Added: trunk/library/classes/MUtil/Model/Processor/Element/SelectElementProcessor.php =================================================================== --- trunk/library/classes/MUtil/Model/Processor/Element/SelectElementProcessor.php (rev 0) +++ trunk/library/classes/MUtil/Model/Processor/Element/SelectElementProcessor.php 2013-01-13 20:03:13 UTC (rev 1098) @@ -0,0 +1,74 @@ +<?php + +/** + * Copyright (c) 2012, Erasmus MC + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Erasmus MC nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * @package MUtil + * @subpackage Model + * @author Matijs de Jong <mj...@ma...> + * @copyright Copyright (c) 2012 Erasmus MC + * @license New BSD License + * @version $id: DateProcessor.php 203 2012-01-01t 12:51:32Z matijs $ + */ + +/** + * + * + * @package MUtil + * @subpackage Model + * @copyright Copyright (c) 2012 Erasmus MC + * @license New BSD License + * @since Class available since MUtil version 1.2 + */ +class MUtil_Model_Processor_Element_SelectElementProcessor extends MUtil_Model_Processor_ElementProcessorAbstract +{ + /** + * Allow use of answers select specific options + * + * @var boolean + */ + protected $useMultiOptions = true; + + /** + * Processes the input, changing e.g. the result, context or options + * + * @param MUtil_Model_Input $input + * @return void + */ + public function process(MUtil_Model_Input $input) + { + $options = $this->getFilteredOptions($input); + + // Is sometimes added automatically, but should not be used here + unset($options['maxlength']); + + $this->applyElement( + $input, + new Zend_Form_Element_Select($input->getName(), $options) + ); + } +} Modified: trunk/library/classes/MUtil/Model/Processor/ElementProcessorAbstract.php =================================================================== --- trunk/library/classes/MUtil/Model/Processor/ElementProcessorAbstract.php 2013-01-11 18:28:58 UTC (rev 1097) +++ trunk/library/classes/MUtil/Model/Processor/ElementProcessorAbstract.php 2013-01-13 20:03:13 UTC (rev 1098) @@ -62,10 +62,17 @@ protected $useDisplayOptions = true; /** - * Allow use textbox specific options + * Allow use of answers select specific options * * @var boolean */ + protected $useMultiOptions = false; + + /** + * Allow use of textbox specific options + * + * @var boolean + */ protected $useTextOptions = false; /** @@ -111,6 +118,18 @@ ); } + if ($this->useMultiOptions) { + $options[] = array( + 'disable', + 'multiOptions', + 'onchange', + 'separator', + 'size', + 'disableTranslator' + ); + + } + if ($this->useTextOptions) { $options[] = array( 'maxlength', @@ -120,6 +139,7 @@ 'onselect', 'size'); } + /* self::CHECK_OPTIONS => array('checkedValue', 'uncheckedValue'), self::DATE_OPTIONS => array('dateFormat', 'storageFormat'), @@ -127,7 +147,6 @@ self::FILE_OPTIONS => array('accept', 'count', 'destination', 'valueDisabled'), self::GROUP_OPTIONS => array('elements', 'legend', 'separator'), self::JQUERY_OPTIONS => array('jQueryParams'), - self::MULTI_OPTIONS => array('disable', 'multiOptions', 'onchange', 'separator', 'size', 'disableTranslator'), self::PASSWORD_OPTIONS => array('repeatLabel'), self::TAB_OPTIONS => array('value'), self::TEXTAREA_OPTIONS => array('cols', 'rows', 'wrap'), @@ -146,7 +165,7 @@ { $allowedOptions = MUtil_Ra::flatten($this->getAllowedOptionsNames()); - $options = $input->getOptions(); + $options = $input->getOptions($allowedOptions); return array_intersect_key($options, array_flip($allowedOptions)); } Modified: trunk/library/classes/MUtil/Model.php =================================================================== --- trunk/library/classes/MUtil/Model.php 2013-01-11 18:28:58 UTC (rev 1097) +++ trunk/library/classes/MUtil/Model.php 2013-01-13 20:03:13 UTC (rev 1098) @@ -97,11 +97,17 @@ /** * - * @var MUtil_Loader_PluginLoader + * @var array of MUtil_Loader_PluginLoader */ - private static $_assemblerLoader; + private static $_loaders = array(); /** + * + * @var array of global for directory paths + */ + private static $_nameSpaces = array('MUtil'); + + /** * Static variable for debuggging purposes. Toggles the echoing of e.g. of sql * select statements, using MUtil_Echo. * @@ -124,26 +130,72 @@ */ public static function getAssemblerLoader() { - if (! self::$_assemblerLoader) { + return self::getLoader('Assembler'); + // maybe add interface def to plugin loader: MUtil_Model_AssemblerInterface + } + + /** + * Returns a subClass plugin loader + * + * @param string $prefix The prefix to load the loader for. CamelCase and should not contain an '_', '/' or '\'. + * @return MUtil_Loader_PluginLoader + */ + public static function getLoader($subClass) + { + if (! isset(self::$_loaders[$subClass])) { $loader = new MUtil_Loader_PluginLoader(); - $loader->addPrefixPath('MUtil_Model_Assembler', __DIR__ . '/Model/Assembler') - ->addFallBackPath(); - // maybe add interface def to plugin loader: MUtil_Model_AssemblerInterface + foreach (self::$_nameSpaces as $nameSpace) { + $loader->addPrefixPath( + $nameSpace . '_Model_' . $subClass, + $nameSpace . DIRECTORY_SEPARATOR . 'Model' . DIRECTORY_SEPARATOR . $subClass); + } + $loader->addFallBackPath(); - self::$_assemblerLoader = $loader; + self::$_loaders[$subClass] = $loader; } - return self::$_assemblerLoader; + return self::$_loaders[$subClass]; } /** + * Returns the plugin loader for processors. + * + * @return MUtil_Loader_PluginLoader + */ + public static function getProcessorLoader() + { + return self::getLoader('Processor'); + // maybe add interface def to plugin loader: MUtil_Model_AssemblerInterface + } + + /** * Sets the plugin loader for assemblers * * @param MUtil_Loader_PluginLoader $loader */ public static function setAssemblerLoader(MUtil_Loader_PluginLoader $loader) { - self::$_assemblerLoader = $loader; + self::setLoader($loader, 'Assembler'); } + + /** + * Sets the plugin loader for assemblers + * + * @param MUtil_Loader_PluginLoader $loader + */ + public static function setLoader(MUtil_Loader_PluginLoader $loader, $subClass) + { + self::$_loaders[$subClass] = $loader; + } + + /** + * Sets the plugin loader for processors. + * + * @param MUtil_Loader_PluginLoader $loader + */ + public static function setProcessorLoader(MUtil_Loader_PluginLoader $loader) + { + self::setLoader($loader, 'Processor'); + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2013-01-11 18:29:09
|
Revision: 1097 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=1097&view=rev Author: matijsdejong Date: 2013-01-11 18:28:58 +0000 (Fri, 11 Jan 2013) Log Message: ----------- Check for absolute paths in PluginLoader Modified Paths: -------------- trunk/library/classes/MUtil/Form.php trunk/library/classes/MUtil/Loader/PluginLoader.php Modified: trunk/library/classes/MUtil/Form.php =================================================================== --- trunk/library/classes/MUtil/Form.php 2013-01-11 18:14:20 UTC (rev 1096) +++ trunk/library/classes/MUtil/Form.php 2013-01-11 18:28:58 UTC (rev 1097) @@ -80,9 +80,6 @@ */ public function __construct($options = null) { - $this->addPrefixPath('MUtil_Form_Decorator', 'MUtil/Form/Decorator/', Zend_Form::DECORATOR); - $this->addPrefixPath('MUtil_Form_Element', 'MUtil/Form/Element/', Zend_Form::ELEMENT); - $this->addElementPrefixPath('MUtil_Form_Decorator', 'MUtil/Form/Decorator', Zend_Form_Element::DECORATOR); $this->addElementPrefixPath('MUtil_Validate', 'MUtil/Validate/', Zend_Form_Element::VALIDATE); @@ -238,6 +235,46 @@ } /** + * Retrieve plugin loader for given type + * + * $type may be one of: + * - decorator + * - element + * + * If a plugin loader does not exist for the given type, defaults are + * created. + * + * @param string $type + * @return Zend_Loader_PluginLoader_Interface + */ + public function getPluginLoader($type = null) + { + $type = strtoupper($type); + if (!isset($this->_loaders[$type])) { + switch ($type) { + case self::DECORATOR: + $prefixSegment = 'Form_Decorator'; + $pathSegment = 'Form/Decorator'; + break; + case self::ELEMENT: + $prefixSegment = 'Form_Element'; + $pathSegment = 'Form/Element'; + break; + default: + require_once 'Zend/Form/Exception.php'; + throw new Zend_Form_Exception(sprintf('Invalid type "%s" provided to getPluginLoader()', $type)); + } + + $this->_loaders[$type] = new MUtil_Loader_PluginLoader(array( + 'Zend_' . $prefixSegment . '_' => 'Zend/' . $pathSegment . '/', + 'MUtil_' . $prefixSegment . '_' => 'MUtil/' . $pathSegment . '/', + )); + } + + return $this->_loaders[$type]; + } + + /** * Return true when the form is lazy * * @return boolean Modified: trunk/library/classes/MUtil/Loader/PluginLoader.php =================================================================== --- trunk/library/classes/MUtil/Loader/PluginLoader.php 2013-01-11 18:14:20 UTC (rev 1096) +++ trunk/library/classes/MUtil/Loader/PluginLoader.php 2013-01-11 18:28:58 UTC (rev 1097) @@ -71,10 +71,15 @@ throw new Zend_Loader_PluginLoader_Exception('Zend_Loader_PluginLoader::addPrefixPath() method only takes strings for prefix and path.'); } - // Only add existing directories - if (file_exists(rtrim($path, '/\\'))) { - parent::addPrefixPath($prefix, $path); + if ($path) { + if (('/' == $path[0]) || ('.' == $path[0]) || ((strlen($path) > 1) && (':' == $path[1]))) { + // Only add existing directories + if (! file_exists(rtrim($path, '/\\'))) { + return $this; + } + } } + parent::addPrefixPath($prefix, $path); return $this; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2013-01-11 18:14:28
|
Revision: 1096 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=1096&view=rev Author: matijsdejong Date: 2013-01-11 18:14:20 +0000 (Fri, 11 Jan 2013) Log Message: ----------- Continuing on the method to format values Modified Paths: -------------- trunk/library/classes/MUtil/Loader/PluginLoader.php trunk/library/classes/MUtil/Model/ModelAbstract.php trunk/library/classes/MUtil/Model.php Modified: trunk/library/classes/MUtil/Loader/PluginLoader.php =================================================================== --- trunk/library/classes/MUtil/Loader/PluginLoader.php 2013-01-11 15:24:03 UTC (rev 1095) +++ trunk/library/classes/MUtil/Loader/PluginLoader.php 2013-01-11 18:14:20 UTC (rev 1096) @@ -47,11 +47,23 @@ class MUtil_Loader_PluginLoader extends Zend_Loader_PluginLoader { /** + * Add the default autoloader to this plugin loader. + * + * @return Zend_Loader_PluginLoader (continuation pattern) + */ + public function addFallBackPath() + { + parent::addPrefixPath('', ''); + + return $this; + } + + /** * Add prefixed paths to the registry of paths * * @param string $prefix * @param string $path - * @return Zend_Loader_PluginLoader + * @return Zend_Loader_PluginLoader (continuation pattern) */ public function addPrefixPath($prefix, $path) { @@ -66,6 +78,7 @@ return $this; } + /** * Instantiate a new class using the arguments array for initiation * @@ -75,7 +88,7 @@ */ public function createClass($className, array $arguments = array()) { - if (!class_exists($className)) { + if (!class_exists($className, false)) { $className = $this->load($className); } Modified: trunk/library/classes/MUtil/Model/ModelAbstract.php =================================================================== --- trunk/library/classes/MUtil/Model/ModelAbstract.php 2013-01-11 15:24:03 UTC (rev 1095) +++ trunk/library/classes/MUtil/Model/ModelAbstract.php 2013-01-11 18:14:20 UTC (rev 1096) @@ -67,10 +67,46 @@ private $_changedCount = 0; private $_keys; + + /** + * Contains the per field settings of the model + * + * @var array field_name => array(settings) + */ private $_model = array(); - private $_model_meta; + + /** + * Contains the settings for the model as a whole + * + * @var array + */ + private $_model_meta = array( + MUtil_Model::META_ASSEMBLERS => array( + MUtil_Model::FORM => 'FormAssembler', + ), + ); + + /** + * An identifying name for the model + * + * @var string + */ private $_model_name; + + /** + * The order in which field names where ->set() since + * the last ->resetOrder() - minus those not set. + * + * @var array + */ private $_model_order; + + /** + * Contains the (order in which) fields where accessed using + * ->get(), containing only those fields that where accesed. + * + * @var type + */ private $_model_used = false; /** @@ -509,6 +545,12 @@ } } + /** + * Returns the field that name is an Alias of + * + * @param string $name + * @return string + */ public function getAlias($name) { if (isset($this->_model[$name][self::ALIAS_OF])) { @@ -516,6 +558,42 @@ } } + /** + * Get/load the assembler for the specific idenitifier + * + * @param string $identifier + * @param array $data Optional array with data. + * @return MUtil_Model_AssemblerInterface + */ + public function getAssemblerFor($identifier, array $data = null) + { + $assemblers = $this->getMeta(MUtil_Model::META_ASSEMBLERS); + + if (isset($assemblers[$identifier])) { + if ($assemblers[$identifier] instanceof MUtil_Model_AssemblerInterface) { + return $assemblers[$identifier]; + } + + $loader = MUtil_Model::getAssemblerLoader(); + $assembler = $loader->createClass($assemblers[$identifier]); + $assembler->setModel($this); + + if (null !== $data) { + $assembler->setRow($data); + } + + $assemblers[$identifier] = $assembler; + $this->setMeta(MUtil_Model::META_ASSEMBLERS, $assemblers); + + return $assembler; + } + } + + /** + * The number of item rows changed since the last save or delete + * + * @return int + */ public function getChanged() { return $this->_changedCount; @@ -546,11 +624,30 @@ return $results; } + /** + * Get the current default filter for save/loade + * @return array + */ public function getFilter() { return $this->getMeta('filter', array()); } + /** + * Get/load the assembler for forms + * + * @param array $data Optional array with data. + * @return MUtil_Model_AssemblerInterface + */ + public function getFormAssembler(array $data = null) + { + return $this->getAssemblerFor(MUtil_Model::FORM, $data); + } + + /** + * Returns all the field names in this model + * @return array + */ public function getItemNames() { return array_keys($this->_model); Modified: trunk/library/classes/MUtil/Model.php =================================================================== --- trunk/library/classes/MUtil/Model.php 2013-01-11 15:24:03 UTC (rev 1095) +++ trunk/library/classes/MUtil/Model.php 2013-01-11 18:14:20 UTC (rev 1096) @@ -37,6 +37,16 @@ class MUtil_Model { /** + * Indentifier for form (meta) assemblers and (field) processors + */ + const FORM = 'form'; + + /** + * Indentifier for assemblers meta key + */ + const META_ASSEMBLERS = 'assemblers'; + + /** * In order to keep the url's short and to hide any field names from * the user, model identifies key values by using 'id' for a single * key value and id1, id2, etc... for multiple keys. @@ -86,6 +96,12 @@ const TYPE_TIME = 5; /** + * + * @var MUtil_Loader_PluginLoader + */ + private static $_assemblerLoader; + + /** * Static variable for debuggging purposes. Toggles the echoing of e.g. of sql * select statements, using MUtil_Echo. * @@ -100,4 +116,34 @@ * @var boolean $verbose If true echo retrieval statements. */ public static $verbose = false; + + /** + * Returns the plugin loader for assemblers + * + * @return MUtil_Loader_PluginLoader + */ + public static function getAssemblerLoader() + { + if (! self::$_assemblerLoader) { + $loader = new MUtil_Loader_PluginLoader(); + + $loader->addPrefixPath('MUtil_Model_Assembler', __DIR__ . '/Model/Assembler') + ->addFallBackPath(); + // maybe add interface def to plugin loader: MUtil_Model_AssemblerInterface + + self::$_assemblerLoader = $loader; + } + + return self::$_assemblerLoader; + } + + /** + * Sets the plugin loader for assemblers + * + * @param MUtil_Loader_PluginLoader $loader + */ + public static function setAssemblerLoader(MUtil_Loader_PluginLoader $loader) + { + self::$_assemblerLoader = $loader; + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2013-01-11 15:24:10
|
Revision: 1095 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=1095&view=rev Author: michieltcs Date: 2013-01-11 15:24:03 +0000 (Fri, 11 Jan 2013) Log Message: ----------- Fix case sensitivity Modified Paths: -------------- trunk/library/pre_bootstrap.php Modified: trunk/library/pre_bootstrap.php =================================================================== --- trunk/library/pre_bootstrap.php 2013-01-10 17:22:13 UTC (rev 1094) +++ trunk/library/pre_bootstrap.php 2013-01-11 15:24:03 UTC (rev 1095) @@ -62,7 +62,7 @@ ); // Set up autoload for MUtil -require_once 'Zend/Loader/AutoLoader.php'; +require_once 'Zend/Loader/Autoloader.php'; $autoloader = Zend_Loader_Autoloader::getInstance(); $autoloader->registerNamespace('MUtil_'); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2013-01-10 17:22:21
|
Revision: 1094 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=1094&view=rev Author: matijsdejong Date: 2013-01-10 17:22:13 +0000 (Thu, 10 Jan 2013) Log Message: ----------- Do not check non-existing directories Modified Paths: -------------- trunk/library/classes/MUtil/Loader/PluginLoader.php Modified: trunk/library/classes/MUtil/Loader/PluginLoader.php =================================================================== --- trunk/library/classes/MUtil/Loader/PluginLoader.php 2013-01-10 17:08:49 UTC (rev 1093) +++ trunk/library/classes/MUtil/Loader/PluginLoader.php 2013-01-10 17:22:13 UTC (rev 1094) @@ -47,6 +47,26 @@ class MUtil_Loader_PluginLoader extends Zend_Loader_PluginLoader { /** + * Add prefixed paths to the registry of paths + * + * @param string $prefix + * @param string $path + * @return Zend_Loader_PluginLoader + */ + public function addPrefixPath($prefix, $path) + { + if (!is_string($prefix) || !is_string($path)) { + throw new Zend_Loader_PluginLoader_Exception('Zend_Loader_PluginLoader::addPrefixPath() method only takes strings for prefix and path.'); + } + + // Only add existing directories + if (file_exists(rtrim($path, '/\\'))) { + parent::addPrefixPath($prefix, $path); + } + + return $this; + } + /** * Instantiate a new class using the arguments array for initiation * * @param string $className This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2013-01-10 17:08:56
|
Revision: 1093 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=1093&view=rev Author: matijsdejong Date: 2013-01-10 17:08:49 +0000 (Thu, 10 Jan 2013) Log Message: ----------- Updated tests and default installation to 1.6 Modified Paths: -------------- trunk/new_project/application/configs/application.ini trunk/test/bootstrap.php trunk/test/library/Gems/Test/DbTestAbstract.php trunk/test/library/Gems/Test/TestAbstract.php trunk/test/library/project-bootstrap.php Modified: trunk/new_project/application/configs/application.ini =================================================================== --- trunk/new_project/application/configs/application.ini 2013-01-10 16:43:36 UTC (rev 1092) +++ trunk/new_project/application/configs/application.ini 2013-01-10 17:08:49 UTC (rev 1093) @@ -5,6 +5,8 @@ bootstrap.path = "NewProject/Escort.php" bootstrap.class = "NewProject_Escort" +loaderDirs.NewProject = APPLICATION_PATH "/classes/NewProject" +loaderDirs.Gems = GEMS_LIBRARY_DIR "/classes/Gems" ; resources.db.adapter = PDO_MYSQL resources.db.adapter = Mysqli resources.db.params.charset = utf8 @@ -31,3 +33,4 @@ phpSettings.display_startup_errors = 1 phpSettings.display_errors = 1 firebug.log = 1 +zfdebug.activate = 0 Modified: trunk/test/bootstrap.php =================================================================== --- trunk/test/bootstrap.php 2013-01-10 16:43:36 UTC (rev 1092) +++ trunk/test/bootstrap.php 2013-01-10 17:08:49 UTC (rev 1093) @@ -3,7 +3,7 @@ /** * Copyright (c) 2011, Erasmus MC * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright @@ -14,7 +14,7 @@ * * Neither the name of Erasmus MC nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE @@ -25,7 +25,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * Unit test bootstrap * * @author Michiel Rook <mi...@to...> @@ -33,10 +33,7 @@ * @package Gems */ -// Needed for strict on >= PHP 5.1.2 -if (version_compare(phpversion(), '5.1.2') > 0) { - date_default_timezone_set('Europe/Amsterdam'); -} +date_default_timezone_set('Europe/Amsterdam'); /** * Setup environment @@ -49,11 +46,6 @@ define('APPLICATION_ENV', 'development'); define('APPLICATION_PATH', GEMS_ROOT_DIR . '/application'); -$GLOBALS['GEMS_DIRS'] = array( - GEMS_PROJECT_NAME_UC => APPLICATION_PATH . '/classes', - 'Gems' => GEMS_LIBRARY_DIR . '/classes' -); - /** * Setup include path */ Modified: trunk/test/library/Gems/Test/DbTestAbstract.php =================================================================== --- trunk/test/library/Gems/Test/DbTestAbstract.php 2013-01-10 16:43:36 UTC (rev 1092) +++ trunk/test/library/Gems/Test/DbTestAbstract.php 2013-01-10 17:08:49 UTC (rev 1093) @@ -70,14 +70,14 @@ protected function setUp() { parent::setUp(); - - global $GEMS_DIRS; $this->db = $this->getConnection()->getConnection(); Zend_Registry::set('db', $this->db); - $this->loader = new Gems_Loader(Zend_Registry::getInstance(), $GEMS_DIRS); + $settings = new Zend_Config_Ini(GEMS_ROOT_DIR . '/application/configs/application.ini', APPLICATION_ENV); + $sa = $settings->toArray(); + $this->loader = new Gems_Loader(Zend_Registry::getInstance(), $sa['loaderDirs']); Zend_Registry::set('loader', $this->loader); } Modified: trunk/test/library/Gems/Test/TestAbstract.php =================================================================== --- trunk/test/library/Gems/Test/TestAbstract.php 2013-01-10 16:43:36 UTC (rev 1092) +++ trunk/test/library/Gems/Test/TestAbstract.php 2013-01-10 17:08:49 UTC (rev 1093) @@ -53,7 +53,7 @@ * @var Gems_Loader */ protected $loader = null; - + /** * @var Zend_Db */ @@ -63,25 +63,25 @@ * @var Gems_Tracker */ protected $tracker = null; - + /** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. */ protected function setUp() { - global $GEMS_DIRS; - $this->db = Zend_Db::factory('pdo_sqlite', array('dbname'=>':memory:')); - + Zend_Registry::set('db', $this->db); - - $this->loader = new Gems_Loader(Zend_Registry::getInstance(), $GEMS_DIRS); - + + $settings = new Zend_Config_Ini(GEMS_ROOT_DIR . '/application/configs/application.ini', APPLICATION_ENV); + $sa = $settings->toArray(); + $this->loader = new Gems_Loader(Zend_Registry::getInstance(), $sa['loaderDirs']); + Zend_Registry::set('loader', $this->loader); - + $this->tracker = $this->loader->getTracker(); - + Zend_Registry::set('tracker', $this->tracker); } } Modified: trunk/test/library/project-bootstrap.php =================================================================== --- trunk/test/library/project-bootstrap.php 2013-01-10 16:43:36 UTC (rev 1092) +++ trunk/test/library/project-bootstrap.php 2013-01-10 17:08:49 UTC (rev 1093) @@ -16,11 +16,6 @@ define('APPLICATION_ENV', 'development'); define('APPLICATION_PATH', GEMS_ROOT_DIR . '/application'); -$GLOBALS['GEMS_DIRS'] = array( - GEMS_PROJECT_NAME_UC => APPLICATION_PATH . '/classes', - 'Gems' => GEMS_LIBRARY_DIR . '/classes' -); - /** * Setup include path */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2013-01-10 16:43:46
|
Revision: 1092 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=1092&view=rev Author: matijsdejong Date: 2013-01-10 16:43:36 +0000 (Thu, 10 Jan 2013) Log Message: ----------- ZFDebug now set from application.ini and JQuery local aware $GEMS_DIRS no longer used (except as backup) new SnippetLoaderInterface using pluginsLoader Modified Paths: -------------- trunk/library/changelog.txt trunk/library/classes/Gems/Events.php trunk/library/classes/Gems/Loader/LoaderAbstract.php trunk/library/classes/Gems/Project/ProjectSettings.php trunk/library/classes/Gems/Snippets/SnippetLoader.php trunk/library/classes/GemsEscort.php trunk/library/classes/MUtil/Loader/CachedLoader.php trunk/library/classes/MUtil/Snippets/SnippetLoader.php trunk/library/classes/MUtil/Snippets/SnippetLoaderInterface.php trunk/library/classes/ZFDebug/Controller/Plugin/Debug.php trunk/library/pre_bootstrap.php Added Paths: ----------- trunk/library/classes/MUtil/Loader/PluginLoader.php Modified: trunk/library/changelog.txt =================================================================== --- trunk/library/changelog.txt 2013-01-09 17:30:52 UTC (rev 1091) +++ trunk/library/changelog.txt 2013-01-10 16:43:36 UTC (rev 1092) @@ -2,6 +2,8 @@ ============================================================ Defined constant GEMS_PROJECT_PATH removed from code (update at least your application.ini and use APPLICATION_PATH instead) Moved date_default_timezone_set to index.php (can generate warnings) +The global variable $GEMS_DIRS is deprecated, redefine it the application.ini using loaderDirs.Gems = .... (see NewProject) +ZFDebug is now activated in the application.ini using: zfdebug.activate = 1 Important changes from 1.5.6 => 1.5.7 ============================================================ Modified: trunk/library/classes/Gems/Events.php =================================================================== --- trunk/library/classes/Gems/Events.php 2013-01-09 17:30:52 UTC (rev 1091) +++ trunk/library/classes/Gems/Events.php 2013-01-10 16:43:36 UTC (rev 1092) @@ -46,8 +46,6 @@ */ class Gems_Events extends Gems_Loader_TargetLoaderAbstract { - const EVENTS_DIR = 'Event'; - const TRACK_COMPLETION_EVENT = 'Track/Completed'; const ROUND_CHANGED_EVENT = 'Round/Changed'; const SURVEY_BEFORE_ANSWERING_EVENT = 'Survey/BeforeAnswering'; @@ -96,22 +94,19 @@ /** * - * @global array $GEMS_DIRS An array of directories that specify where to look for code. * @param string $eventType An event subdirectory (may contain multiple levels split by '/' * @return array An array of type prefix => classname */ protected function _getEventDirs($eventType) { - global $GEMS_DIRS; - $eventClass = str_replace('/', '_', $eventType); - foreach ($GEMS_DIRS as $name => $dir) { - $prefix = $name . '_' . self::EVENTS_DIR . '_' . $eventClass . '_'; - $paths[$prefix] = $dir . '/' . $name . '/' . self::EVENTS_DIR . '/' . $eventType; + foreach ($this->_dirs as $name => $dir) { + $prefix = $name . '_' . $eventClass . '_'; + $paths[$prefix] = $dir . DIRECTORY_SEPARATOR . $eventType; } - $paths[''] = APPLICATION_PATH . '/' . strtolower(self::EVENTS_DIR . 's/' . $eventType); - // MUtil_Echo::track($paths); + $paths[''] = APPLICATION_PATH . '/events/' . strtolower($eventType); + MUtil_Echo::track($paths); return $paths; } @@ -182,7 +177,7 @@ if (! class_exists($eventName, true)) { // Autoload is used for Zend standard defined classnames, // so if the class is not autoloaded, define the path here. - $filename = APPLICATION_PATH . '/' . strtolower(self::EVENTS_DIR . 's/' . $eventType) . '/' . $eventName . '.php'; + $filename = APPLICATION_PATH . '/events/' . strtolower($eventType) . '/' . $eventName . '.php'; if (! file_exists($filename)) { throw new Gems_Exception_Coding("The event '$eventName' of type '$eventType' does not exist at location: $filename."); Modified: trunk/library/classes/Gems/Loader/LoaderAbstract.php =================================================================== --- trunk/library/classes/Gems/Loader/LoaderAbstract.php 2013-01-09 17:30:52 UTC (rev 1091) +++ trunk/library/classes/Gems/Loader/LoaderAbstract.php 2013-01-10 16:43:36 UTC (rev 1092) @@ -76,20 +76,12 @@ protected $_dirs; /** - * This array holds a cache of requested class -> resulting classname pairs so we don't have - * to check all prefixes and paths over and over again * - * @var array classname->resulting class + * @var MUtil_Loader_PluginLoader */ - private $_loaded = array(); + protected $_loader; /** - * - * @var Zend_Loader_PluginLoader_Interface - */ - private $_loader; - - /** * Allows sub classes of Gems_Loader_LoaderAbstract to specify the subdirectory where to look for. * * @var string $cascade An optional subdirectory where this subclass always loads from. @@ -109,22 +101,13 @@ if ($this->cascade) { foreach ($dirs as $prefix => $path) { - $newdirs[$prefix . '_' . $this->cascade] = $path; - // $newdirs[$prefix . '_' . $this->cascade] = $path . '/' . str_replace('_', '/', $this->cascade); + $newdirs[$prefix . '_' . $this->cascade] = $path . '/' . strtr($this->cascade, '_', '/'); } $this->_dirs = $newdirs; } - //$this->_loader = new Zend_Loader_PluginLoader($this->_dirs); - //* - // Set the directories to the used cascade pattern - $this->_loader = new Zend_Loader_PluginLoader(); - foreach (array_reverse($this->_dirs) as $prefix => $path) { - $this->_loader->addPrefixPath($prefix, $path . '/' . str_replace('_', '/', $prefix)); - } - // */ + $this->_loader = new MUtil_Loader_PluginLoader($this->_dirs); - if (MUtil_Registry_Source::$verbose) { MUtil_Echo::r($this->_dirs, '$this->_dirs in ' . get_class($this) . '->' . __FUNCTION__ . '():'); } @@ -174,180 +157,30 @@ */ protected function _loadClass($name, $create = false, array $arguments = array()) { - /* $className = $this->_loader->load($name); // MUtil_Echo::track($className); if (is_subclass_of($className, __CLASS__)) { $create = true; - // error_log($className); $arguments = array($this->_containers[0], $this->_dirs); } elseif (is_subclass_of($className, 'MUtil_Registry_TargetInterface')) { $create = true; } - if ($create) { - switch (count($arguments)) { - case 0: - $obj = new $className(); - break; - - case 1: - $obj = new $className($arguments[0]); - break; - - case 2: - $obj = new $className($arguments[0], $arguments[1]); - break; - - case 3: - $obj = new $className($arguments[0], $arguments[1], $arguments[2]); - break; - - default: - throw new Gems_Exception_Coding(__CLASS__ . '->' . __FUNCTION__ . ' cannot create class with ' . count($arguments) . ' parameters.'); - } - } else { - $obj = new MUtil_Lazy_StaticCall($className); + if (! $create) { + return new MUtil_Lazy_StaticCall($className); } + $obj = $this->_loader->createClass($className, $arguments); + if ($obj instanceof MUtil_Registry_TargetInterface) { - // error_log(get_class($obj)); if ((! $this->applySource($obj)) && parent::$verbose) { MUtil_Echo::track("Source apply to object of type $name failed."); } } return $obj; - // */ - - // echo $name . ($create ? ' create' : ' not created') . "<br/>\n"; - - $cname = trim(str_replace('/', '_', ucfirst($name)), '_'); - $cfile = str_replace('_', '/', $cname) . '.php'; - - $found = false; - - /** - * First check if the class was already loaded - * If so, we don't have to try loading from the other paths - **/ - if (array_key_exists($cname, $this->_loaded) && $obj = $this->_loadClassPath('', $this->_loaded[$cname], $create, $arguments)) { - $found = true; - } - - if (!$found) { - foreach ($this->_dirs as $prefix => $paths) { - if (!empty($prefix)) { - $fprefix = '/' . str_replace('_', '/', $prefix); - $prefix .= '_'; - } else { - $fprefix = ''; - } - - if (!is_array($paths)) { - $paths = array($paths); - } - foreach ($paths as $path) { - /* - $className = $prefix . $cname; - - if ($this->_loader->loadClass($className, $path . $fprefix . '/' . $cfile)) { - if (is_subclass_of($className, __CLASS__)) { - $create = true; - $arguments = array($this->_containers[0], $this->_dirs); - - } elseif (is_subclass_of($className, 'MUtil_Registry_TargetInterface')) { - $create = true; - } - - - if ($create) { - $obj = $this->_loader->createClass($className, $arguments); - } else { - $obj = new MUtil_Lazy_StaticCall($className); - } - - $found = true; - $this->_loaded[$cname] = get_class($obj); - break 2; - } // */ - - //* - if ($obj = $this->_loadClassPath($path . $fprefix . '/' . $cfile, $prefix . $cname, $create, $arguments)) { - MUtil_Echo::track($prefix . $cname); - $found = true; - $this->_loaded[$cname] = get_class($obj); - break 2; - } // */ - } - } - } - - if ($found) { - if ($obj instanceof MUtil_Registry_TargetInterface) { - // error_log(get_class($obj)); - if ((! $this->applySource($obj)) && parent::$verbose) { - MUtil_Echo::track("Source apply to object of type $name failed."); - } - } - - return $obj; - } - - // Throw exception when not found - throw new Gems_Exception_Coding(__CLASS__ . '->' . __FUNCTION__ . ' cannot find class with name ' .$name . ' in ' . print_r($this->_dirs, true)); } - - /** - * Try the actual loading of the class. - * - * @param string $filepath The full path to the class - * @param string $classname The full class name. - * @param boolean $create Create the object, or only when an MUtil_Registry_TargetInterface instance. - * @param array $arguments Class initialization arguments. - * @return mixed Null or object of type $classname or MUtil_Lazy_StaticCall - */ - private function _loadClassPath($filepath, $classname, $create, array $arguments) - { - // echo '_loadClassPath: ' . $this->cascade . '-' . $classname . '-' . ($create ? 1 : 0) . "<br/>\n"; - // debug_print_backtrace(); - // MUtil_Echo::track($filepath, $classname, $this->cascade); - - if (! class_exists($classname, false)) { - if (file_exists($filepath)) { - // echo $classname . ' :: ' . $filepath . "<br/>\n"; - include_once($filepath); - } else { - return; - } - } - - if (is_subclass_of($classname, __CLASS__)) { - return new $classname($this->_containers[0], $this->_dirs); - - } elseif ($create || is_subclass_of($classname, 'MUtil_Registry_TargetInterface')) { - switch (count($arguments)) { - case 0: - return new $classname(); - - case 1: - return new $classname($arguments[0]); - - case 2: - return new $classname($arguments[0], $arguments[1]); - - case 3: - return new $classname($arguments[0], $arguments[1], $arguments[2]); - - default: - throw new Gems_Exception_Coding(__CLASS__ . '->' . __FUNCTION__ . ' cannot create class with ' . count($arguments) . ' parameters.'); - } - - } else { - return new MUtil_Lazy_StaticCall($classname); - } - } } \ No newline at end of file Modified: trunk/library/classes/Gems/Project/ProjectSettings.php =================================================================== --- trunk/library/classes/Gems/Project/ProjectSettings.php 2013-01-09 17:30:52 UTC (rev 1091) +++ trunk/library/classes/Gems/Project/ProjectSettings.php 2013-01-10 16:43:36 UTC (rev 1092) @@ -533,4 +533,14 @@ { return isset($this['jquery'], $this['jquery']['local']); } + + /** + * Is this project use a multi locale project + * + * @return boolean + */ + public function isMultiLocale() + { + return (boolean) (isset($this['multiLocale']) && $this['multiLocale']); + } } \ No newline at end of file Modified: trunk/library/classes/Gems/Snippets/SnippetLoader.php =================================================================== --- trunk/library/classes/Gems/Snippets/SnippetLoader.php 2013-01-09 17:30:52 UTC (rev 1091) +++ trunk/library/classes/Gems/Snippets/SnippetLoader.php 2013-01-10 16:43:36 UTC (rev 1092) @@ -57,66 +57,45 @@ */ protected $cascade = 'Snippets'; - protected $loader; - /** - * @var MUtil_Snippets_SnippetLoader - */ - protected $backup; - - /** - * Initialize the snippetloader (Gems style) + * Sets the source of variables and the first directory for snippets * - * @param mixed $container A container acting as source for MUtil_Registry_Source - * @param array $dirs The directories where to look for requested classes + * @param mixed $source Something that is or can be made into MUtil_Registry_SourceInterface, otheriwse Zend_Registry is used. + * @param array $dirs prefix => pathname The inital paths to load from */ - public function __construct($container = null, $dirs = array()) + public function __construct($source = null, array $dirs = array()) { - parent::__construct($container, $dirs); + parent::__construct($source, $dirs); - $this->backup = new MUtil_Snippets_SnippetLoader($this); - $this->addDirectory(GEMS_LIBRARY_DIR . '/classes/MUtil/Snippets/Standard'); - } - - - /** - * Add a directory to the front of the list of places where snippets are loaded from. - * - * @param string $dir - * @return MUtil_Snippets_SnippetLoader - */ - public function addDirectory($dir) - { - if (!array_key_exists('', $this->_dirs)) { - $this->_dirs[''] = array(); + $noPrefixDirs = array( + GEMS_LIBRARY_DIR . '/classes/MUtil/Snippets/Standard', + GEMS_LIBRARY_DIR . '/snippets', + GEMS_ROOT_DIR . '/application/snippets', + ); + foreach ($noPrefixDirs as $dir) { + if (file_exists($dir)) { + $this->_loader->addPrefixPath('', $dir); + } } - array_unshift($this->_dirs[''], $dir); - return $this->backup->addDirectory($dir); + // $this->_loader->addPrefixPath('MUtil_Snippets', GEMS_LIBRARY_DIR . '/classes/MUtil/Snippets/Standard'); } /** - * Add parameter values to the source for snippets. + * Add prefixed paths to the registry of paths * - * @param mixed $container_or_pairs This function can be called with either a single container or a list of name/value pairs. - * @return MUtil_Snippets_SnippetLoader + * @param string $prefix + * @param string $path + * @return MUtil_Snippets_SnippetLoaderInterface */ - public function addSource($container_or_pairs) + public function addPrefixPath($prefix, $path) { - return $this->backup->addSource($container_or_pairs); - } + $this->_loader->addPrefixPath($prefix, $path); - /** - * Returns the directories where snippets are loaded from. - * - * @param array $dirs - * @return array - */ - public function getDirectories() - { - return $this->backup->getDirectories(); + return $this; } + /** * Searches and loads a .php snippet file. * @@ -133,8 +112,6 @@ } catch (Exception $exc) { MUtil_Echo::track($exc->getMessage()); throw $exc; - //Class loading failed, now defer - //$snippet = $this->backup->getSnippet($filename, $extraSourceParameters); } return $snippet; @@ -147,18 +124,21 @@ */ public function getSource() { - return $this->backup->getSource(); + return $this; } /** - * Set the directories where snippets are loaded from. + * Remove a prefix (or prefixed-path) from the registry * - * @param array $dirs - * @return MUtil_Snippets_SnippetLoader (continuation pattern) + * @param string $prefix + * @param string $path OPTIONAL + * @return MUtil_Snippets_SnippetLoaderInterface */ - public function setDirectories(array $dirs) + public function removePrefixPath($prefix, $path = null) { - return $this->backup->setDirectories($dirs); + $this->_loader->removePrefixPath($prefix, $path); + + return $this; } /** @@ -169,6 +149,6 @@ */ public function setSource(MUtil_Registry_SourceInterface $source) { - return $this->backup->setSource($source); + throw new Gems_Exception_Coding('Cannot set source for ' . __CLASS__); } } \ No newline at end of file Modified: trunk/library/classes/GemsEscort.php =================================================================== --- trunk/library/classes/GemsEscort.php 2013-01-09 17:30:52 UTC (rev 1091) +++ trunk/library/classes/GemsEscort.php 2013-01-10 16:43:36 UTC (rev 1092) @@ -51,41 +51,54 @@ */ class GemsEscort extends MUtil_Application_Escort { + /** + * Default reception code value + */ const RECEPTION_OK = 'OK'; + /** + * Static instance + * + * @var self + */ private static $_instanceOfSelf; + /** + * Targets for _updateVariable + * + * @var array + */ private $_copyDestinations; - private $_startFirebird; /** - * The menu variable + * The prefix / directory paths where the Gems Loaders should look * - * @var Gems_Menu + * @var array prefix => path */ - public $menu; + private $_loaderDirs; /** - * Copy from Zend_Translate_Adapter + * The project loader * - * Translates the given string - * returns the translation + * @var MUtil_Loader_PluginLoader + */ + private $_projectLoader; + + /** + * Is firebird logging on (set by constructor from application.ini) * - * @param string $text Translation string - * @param string|Zend_Locale $locale (optional) Locale/Language to use, identical with locale - * identifier, @see Zend_Locale for more information - * @return string + * @var boolean */ - public function _($text, $locale = null) - { - if (! isset($this->request)) { - // Locale is fixed by request. - $this->setException(new Gems_Exception_Coding('Requested translation before request was made available.')); - } - return $this->translate->getAdapter()->_($text, $locale); - } + private $_startFirebird; /** + * The menu variable + * + * @var Gems_Menu + */ + public $menu; + + /** * Constructor * * @param Zend_Application|Zend_Application_Bootstrap_Bootstrapper $application @@ -97,18 +110,73 @@ self::$_instanceOfSelf = $this; + // DIRECTORIES USED BY LOADER + $dirs = $this->getOption('loaderDirs'); + if (! $dirs) { + global $GEMS_DIRS; + + // Use $GEMS_DIRS if defined + if (isset($GEMS_DIRS)) { + $dirs = array(); + + foreach ($GEMS_DIRS as $prefix => $dir) { + $dirs[$prefix] = $dir . '/' . strtr($prefix, '_', '/'); + } + } else { + // Default setting + $dirs = array( + GEMS_PROJECT_NAME_UC => APPLICATION_PATH . '/classes/' .GEMS_PROJECT_NAME_UC, + 'Gems' => GEMS_LIBRARY_DIR . '/classes/Gems' + ); + } + } + // MUtil_Echo::track($dirs); + $this->_loaderDirs = array_reverse($dirs); + + // NAMESPACES + $autoloader = Zend_Loader_Autoloader::getInstance(); + foreach ($this->_loaderDirs as $prefix => $path) { + if ($prefix) { + $autoloader->registerNamespace($prefix . '_'); + } + } + + // PROJECT LOADER + $this->_projectLoader = new MUtil_Loader_PluginLoader($this->_loaderDirs); + + // FIRE BUG $firebug = $application->getOption('firebug'); $this->_startFirebird = $firebug['log']; + // START SESSIE $sessionOptions['name'] = GEMS_PROJECT_NAME_UC . '_' . md5(APPLICATION_PATH) . '_SESSID'; $sessionOptions['cookie_path'] = strtr(dirname($_SERVER['SCRIPT_NAME']), '\\', '/'); $sessionOptions['cookie_httponly'] = true; $sessionOptions['cookie_secure'] = (APPLICATION_ENV == 'production'); - Zend_Session::start($sessionOptions); } /** + * Copy from Zend_Translate_Adapter + * + * Translates the given string + * returns the translation + * + * @param string $text Translation string + * @param string|Zend_Locale $locale (optional) Locale/Language to use, identical with locale + * identifier, @see Zend_Locale for more information + * @return string + */ + public function _($text, $locale = null) + { + if (! isset($this->request)) { + // Locale is fixed by request. + $this->setException(new Gems_Exception_Coding('Requested translation before request was made available.')); + } + return $this->translate->getAdapter()->_($text, $locale); + } + + /** * Function to maintain uniformity of access to variables from the bootstrap object. * Copies all variables to the target object. * @@ -310,25 +378,7 @@ */ protected function _initLoader() { - global $GEMS_DIRS; - - /* - $dirs = $this->getOption('loaderDirs'); - - if (! $dirs) { - - $dirs = array(); - - foreach ($GEMS_DIRS as $prefix => $dir) { - $dirs[$prefix] = $dir . '/' . str_replace('_', '/', $prefix); - } - } - - MUtil_Echo::track($dirs); - - return $this->createProjectClass('Loader', $this->getContainer(), array_reverse($dirs)); - // */ - return $this->createProjectClass('Loader', $this->getContainer(), $GEMS_DIRS); + return $this->createProjectClass('Loader', $this->getContainer(), $this->_loaderDirs); } /** @@ -552,40 +602,47 @@ * Add ZFDebug info to the page output. * * @return void - * / + */ protected function _initZFDebug() { - // if ((APPLICATION_ENV === 'development') && - if ((APPLICATION_ENV !== 'production') && - (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 6.') === FALSE)) { + if ((APPLICATION_ENV === 'production') && + (false !== strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 6.'))) { + // Never on on production systems, never for IE 6 + return; + } - $autoloader = Zend_Loader_Autoloader::getInstance(); - $autoloader->registerNamespace('ZFDebug'); + $debug = $this->getOption('zfdebug'); + if (! isset($debug['activate']) || ('1' !== $debug['activate'])) { + // Only turn on when activated + return; + } - $options = array( - 'plugins' => array('Variables', - 'File' => array('base_path' => '/path/to/project'), - 'Memory', - 'Time', - 'Registry', - 'Exception'), - // 'jquery_path' => not yet initialized - ); + $autoloader = Zend_Loader_Autoloader::getInstance(); + $autoloader->registerNamespace('ZFDebug'); - # Instantiate the database adapter and setup the plugin. - # Alternatively just add the plugin like above and rely on the autodiscovery feature. - $this->bootstrap('db'); - $db = $this->getPluginResource('db'); - $options['plugins']['Database']['adapter'] = $db->getDbAdapter(); + $options = array( + 'plugins' => array('Variables', + 'File' => array('base_path' => '/path/to/project'), + 'Memory', + 'Time', + 'Registry', + 'Exception'), + // 'jquery_path' => not yet initialized + ); - $debug = new ZFDebug_Controller_Plugin_Debug($options); + # Instantiate the database adapter and setup the plugin. + # Alternatively just add the plugin like above and rely on the autodiscovery feature. + $this->bootstrap('db'); + $db = $this->getPluginResource('db'); + $options['plugins']['Database']['adapter'] = $db->getDbAdapter(); - $this->bootstrap('frontController'); - $frontController = $this->getResource('frontController'); - $frontController->registerPlugin($debug); - } - }// */ + $debug = new ZFDebug_Controller_Plugin_Debug($options); + $this->bootstrap('frontController'); + $frontController = $this->getResource('frontController'); + $frontController->registerPlugin($debug); + } + /** * Function called if specified in the Project.ini layoutPrepare section before * the layout is drawn, but after the rest of the program has run it's course. @@ -1126,14 +1183,6 @@ { $this->_copyVariables($actionController ? $actionController : $this->controllerAfterAction); - // Ste the directories where the snippets are/ - if ($actionController instanceof MUtil_Controller_Action) { - $snippetLoader = $actionController->getSnippetLoader(); - $snippetLoader->addDirectory(GEMS_ROOT_DIR . '/library/Gems/snippets'); - $snippetLoader->addDirectory(APPLICATION_PATH . '/snippets'); - // MUtil_Echo::track($snippetLoader->getDirectories()); - } - $this->prepareController(); // Now set some defaults @@ -1151,32 +1200,20 @@ Zend_Registry::set(MUtil_Model_FormBridge::REGISTRY_KEY, array('date' => $dateFormOptions)); } + /** + * Creates an object of the specified className seareching the loader dirs path + * + * @param string $className + * @param mixed $paramOne Optional + * @param mixed $paramTwo Optional + * @return object + */ protected function createProjectClass($className, $paramOne = null, $paramTwo = null) { - $filename = APPLICATION_PATH . '/classes/' . GEMS_PROJECT_NAME_UC . '/'; - $filename .= str_replace('_', '/', $className) . '.php'; - if (file_exists($filename)) { - $className = GEMS_PROJECT_NAME_UC . '_' . $className; - } else { - $className = 'Gems_' . $className; - } + $arguments = func_get_args(); + array_shift($arguments); - switch (func_num_args()) - { - case 1: - return new $className(); - - case 2: - return new $className($paramOne); - - case 3: - return new $className($paramOne, $paramTwo); - - default: - throw new Gems_Exception_Coding( - __CLASS__ . '->' . __FUNCTION__ . '() called with more parameters than possible.' - ); - } + return $this->_projectLoader->createClass($className, $arguments); } /** @@ -1564,7 +1601,7 @@ */ public function requestChanged(Zend_Controller_Request_Abstract $request) { - if ($this->project->multiLocale) { + if ($this->project->isMultiLocale()) { // Get the choosen language $localeId = Gems_Cookies::getLocale($request); Modified: trunk/library/classes/MUtil/Loader/CachedLoader.php =================================================================== --- trunk/library/classes/MUtil/Loader/CachedLoader.php 2013-01-09 17:30:52 UTC (rev 1091) +++ trunk/library/classes/MUtil/Loader/CachedLoader.php 2013-01-10 16:43:36 UTC (rev 1092) @@ -44,7 +44,7 @@ * @license New BSD License * @since Class available since MUtil version 1.2 */ -class MUtil_Loader_CachedLoader +class MUtil_Loader_CachedLoader implements Zend_Loader_Autoloader_Interface { /** * @@ -241,6 +241,46 @@ } /** + * Autoload a class + * + * @abstract + * @param string $class + * @return mixed + * False [if unable to load $class] + * get_class($class) [if $class is successfully loaded] + */ + public function autoload($class) + { + $className = ltrim($class, '\\'); + $file = ''; + $namespace = ''; + if ($lastNsPos = strripos($className, '\\')) { + $namespace = substr($className, 0, $lastNsPos); + $className = substr($className, $lastNsPos + 1); + $file = strtr($namespace, '\\', DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR; + } + $file .= strtr($className, '_', DIRECTORY_SEPARATOR) . '.php'; + + if (isset($this->_cacheClassArray[$class])) { + if ($this->_cacheClassArray[$class]) { + return (boolean) $this->includeFile($this->_cacheClassArray[$class]); + } + } else { + $dirs = $this->_includeDirs; + + foreach ($dirs as $dir) { + // error_log($dir . $file); + if ($this->includeFile($dir . $file)) { + $this->_cacheClassArray[$class] = $dir . $file; + $this->_cacheChanged = true; + return true; + } + } + } + return false; + } + + /** * Create a new instance of a class * * @param string $className The name of the class @@ -341,13 +381,14 @@ * Include a file with cached existence check * * @param string $file The full path to the file + * @return mixed The load return value if available, "1" if loaded without return, false otherwise */ public function includeFile($file) { if (file_exists($file)) { $result = include $file; - return $result ? $result : true; + return $result ? $result : false; } return false; @@ -431,9 +472,9 @@ if ($lastNsPos = strripos($className, '\\')) { $namespace = substr($className, 0, $lastNsPos); $className = substr($className, $lastNsPos + 1); - $file = str_replace('\\', DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR; + $file = strtr($namespace, '\\', DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR; } - $file .= str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php'; + $file .= strtr($className, '_', DIRECTORY_SEPARATOR) . '.php'; if (isset($this->_cacheClassArray[$class])) { if ($this->_cacheClassArray[$class]) { Added: trunk/library/classes/MUtil/Loader/PluginLoader.php =================================================================== --- trunk/library/classes/MUtil/Loader/PluginLoader.php (rev 0) +++ trunk/library/classes/MUtil/Loader/PluginLoader.php 2013-01-10 16:43:36 UTC (rev 1092) @@ -0,0 +1,128 @@ +<?php + +/** + * Copyright (c) 2011, Erasmus MC + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Erasmus MC nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * @package MUtil + * @subpackage Loader + * @author Matijs de Jong <mj...@ma...> + * @copyright Copyright (c) 2011 Erasmus MC + * @license New BSD License + * @version $Id: PluginLoader.php$ + */ + +/** + * Extension of PluginLoader with class instantiation + * + * @package MUtil + * @subpackage Loader + * @copyright Copyright (c) 2011 Erasmus MC + * @license New BSD License + * @since Class available since MUtil version 1.2 + */ +class MUtil_Loader_PluginLoader extends Zend_Loader_PluginLoader +{ + /** + * Instantiate a new class using the arguments array for initiation + * + * @param string $className + * @param array $arguments Instanciation arguments + * @return className + */ + public function createClass($className, array $arguments = array()) + { + if (!class_exists($className)) { + $className = $this->load($className); + } + + switch (count($arguments)) { + case 0: + return new $className(); + + case 1: + return new $className( + $arguments[0] + ); + + case 2: + return new $className( + $arguments[0], $arguments[1] + ); + + case 3: + return new $className( + $arguments[0], $arguments[1], $arguments[2] + ); + + case 4: + return new $className( + $arguments[0], $arguments[1], $arguments[2], $arguments[3] + ); + + case 5: + return new $className( + $arguments[0], $arguments[1], $arguments[2], $arguments[3], $arguments[4] + ); + + case 6: + return new $className( + $arguments[0], $arguments[1], $arguments[2], $arguments[3], $arguments[4], + $arguments[5] + ); + + case 7: + return new $className( + $arguments[0], $arguments[1], $arguments[2], $arguments[3], $arguments[4], + $arguments[5], $arguments[6] + ); + + case 8: + return new $className( + $arguments[0], $arguments[1], $arguments[2], $arguments[3], $arguments[4], + $arguments[5], $arguments[6], $arguments[7] + ); + + case 9: + return new $className( + $arguments[0], $arguments[1], $arguments[2], $arguments[3], $arguments[4], + $arguments[5], $arguments[6], $arguments[7], $arguments[8] + ); + + case 10: + return new $className( + $arguments[0], $arguments[1], $arguments[2], $arguments[3], $arguments[4], + $arguments[5], $arguments[6], $arguments[7], $arguments[8], $arguments[9] + ); + + default: + throw new Zend_Exception( + 'MUtil Plugin Loader cannot create a class with ' . + count($arguments) . ' parameters.' + ); + } + } +} Modified: trunk/library/classes/MUtil/Snippets/SnippetLoader.php =================================================================== --- trunk/library/classes/MUtil/Snippets/SnippetLoader.php 2013-01-09 17:30:52 UTC (rev 1091) +++ trunk/library/classes/MUtil/Snippets/SnippetLoader.php 2013-01-10 16:43:36 UTC (rev 1092) @@ -48,6 +48,12 @@ class MUtil_Snippets_SnippetLoader implements MUtil_Snippets_SnippetLoaderInterface { /** + * + * @var MUtil_Loader_PluginLoader + */ + protected $loader; + + /** * The file locations where to look for snippets. * * Can be overruled in descendants @@ -67,118 +73,65 @@ * Sets the source of variables and the first directory for snippets * * @param mixed $source Something that is or can be made into MUtil_Registry_SourceInterface, otheriwse Zend_Registry is used. + * @param array $dirs prefix => pathname The inital paths to load from */ - public function __construct($source = null) + public function __construct($source = null, array $dirs = array()) { if (! $source instanceof MUtil_Registry_Source) { $source = new MUtil_Registry_Source($source); } $this->setSource($source); - $this->setDirectories(array(dirname(__FILE__) . '/Standard')); + $this->loader = new MUtil_Loader_PluginLoader($dirs); + $this->loader->addPrefixPath('', dirname(__FILE__) . '/Standard'); } /** - * Add a directory to the front of the list of places where snippets are loaded from. + * Add prefixed paths to the registry of paths * - * @param string $dir - * @return MUtil_Snippets_SnippetLoader + * @param string $prefix + * @param string $path + * @return MUtil_Snippets_SnippetLoaderInterface */ - public function addDirectory($dir) + public function addPrefixPath($prefix, $path) { - if (! in_array($dir, $this->snippetsDirectories)) { - if (file_exists($dir)) { - array_unshift($this->snippetsDirectories, $dir); - } - } + $this->loader->addPrefixPath($prefix, $path); return $this; } /** - * Add parameter values to the source for snippets. - * - * @param mixed $container_or_pairs This function can be called with either a single container or a list of name/value pairs. - * @return MUtil_Snippets_SnippetLoader - */ - public function addSource($container_or_pairs) - { - if (1 == func_num_args()) { - $container = $container_or_pairs; - } else { - $container = MUtil_Ra::pairs(func_get_args()); - } - - $source = $this->getSnippetsSource(); - $source->addRegistryContainer($container); - - return $this; - } - - /** - * Returns the directories where snippets are loaded from. - * - * @param array $dirs - * @return array - */ - public function getDirectories() - { - return $this->snippetsDirectories; - } - - /** * Searches and loads a .php snippet file. * - * @param string $filename The name of the snippet + * @param string $className The name of the snippet * @param array $extraSourceParameters name/value pairs to add to the source for this snippet * @return MUtil_Snippets_SnippetInterface The snippet */ - public function getSnippet($filename, array $extraSourceParameters = null) + public function getSnippet($className, array $extraSourceParameters = null) { - $source = $this->getSource(); + $className = $this->loader->load($className); - // Add extra parameters when specified - if ($extraSourceParameters) { - $extraSourceName = __CLASS__ . '->' . __FUNCTION__; - $source->addRegistryContainer($extraSourceParameters, $extraSourceName); - } + $snippet = new $className(); - $dirs = $this->getDirectories(); + if ($snippet instanceof MUtil_Snippets_SnippetInterface) { + // Add extra parameters when specified + if ($extraSourceParameters) { + $this->snippetsSource->addRegistryContainer($extraSourceParameters, 'tmpContainer'); + } - $classname = $filename; - if (strpos($filename, '_') === false) { - $filename = $filename . '.php'; - } else { - $filename = str_replace('_', '/', $filename) . '.php'; - } + if ($this->snippetsSource->applySource($snippet)) { + if ($extraSourceParameters) { + // Can remove now, it was applied + $this->snippetsSource->removeRegistryContainer('tmpContainer'); + } - foreach ($dirs as $dir) { - $filepath = $dir . '/' . $filename; + return $snippet; - // MUtil_Echo::r($filepath); - if (file_exists($filepath)) { - require_once($filepath); - - $snippet = new $classname(); - - if ($snippet instanceof MUtil_Snippets_SnippetInterface) { - if ($source->applySource($snippet)) { - if ($extraSourceParameters) { - // Can remove now, it was applied - $source->removeRegistryContainer($extraSourceName); - } - - return $snippet; - - } else { - throw new Zend_Exception("Not all parameters set for html snippet: '$filepath'. \n\nRequested variables were: " . implode(", ", $snippet->getRegistryRequests())); - } - } else { - throw new Zend_Exception("The snippet: '$filepath' does not implement the MUtil_Snippets_SnippetInterface interface."); - } + } else { + throw new Zend_Exception("Not all parameters set for html snippet: '$className'. \n\nRequested variables were: " . implode(", ", $snippet->getRegistryRequests())); } + } else { + throw new Zend_Exception("The snippet: '$className' does not implement the MUtil_Snippets_SnippetInterface interface."); } - - throw new Zend_Exception("Call for non existing html snippet: '$filename'. \n\nLooking in directories: " . implode(", ", $dirs)); } /** @@ -192,14 +145,15 @@ } /** - * Set the directories where snippets are loaded from. + * Remove a prefix (or prefixed-path) from the registry * - * @param array $dirs - * @return MUtil_Snippets_SnippetLoader (continuation pattern) + * @param string $prefix + * @param string $path OPTIONAL + * @return MUtil_Snippets_SnippetLoaderInterface */ - public function setDirectories(array $dirs) + public function removePrefixPath($prefix, $path = null) { - $this->snippetsDirectories = array_reverse($dirs); + $this->loader->removePrefixPath($prefix, $path); return $this; } Modified: trunk/library/classes/MUtil/Snippets/SnippetLoaderInterface.php =================================================================== --- trunk/library/classes/MUtil/Snippets/SnippetLoaderInterface.php 2013-01-09 17:30:52 UTC (rev 1091) +++ trunk/library/classes/MUtil/Snippets/SnippetLoaderInterface.php 2013-01-10 16:43:36 UTC (rev 1092) @@ -2,7 +2,7 @@ /** * Copyright (c) 2011, Erasmus MC * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright @@ -13,7 +13,7 @@ * * Neither the name of Erasmus MC nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE @@ -47,41 +47,27 @@ * Sets the source of variables and the first directory for snippets * * @param mixed $source Something that is or can be made into MUtil_Registry_SourceInterface, otheriwse Zend_Registry is used. + * @param array $dirs prefix => pathname The inital paths to load from */ - public function __construct($source = null); + public function __construct($source = null, array $dirs = array()); /** - * Add a directory to the front of the list of places where snippets are loaded from. + * Add prefixed paths to the registry of paths * - * @param string $dir + * @param string $prefix + * @param string $path * @return MUtil_Snippets_SnippetLoaderInterface */ - public function addDirectory($dir); + public function addPrefixPath($prefix, $path); /** - * Add parameter values to the source for snippets. - * - * @param mixed $container_or_pairs This function can be called with either a single container or a list of name/value pairs. - * @return MUtil_Snippets_SnippetLoaderInterface - */ - public function addSource($container_or_pairs); - - /** - * Returns the directories where snippets are loaded from. - * - * @param array $dirs - * @return array - */ - public function getDirectories(); - - /** * Searches and loads a .php snippet file. * - * @param string $filename The name of the snippet + * @param string $className The name of the snippet * @param array $extraSourceParameters name/value pairs to add to the source for this snippet * @return MUtil_Snippets_SnippetInterface The snippet */ - public function getSnippet($filename, array $extraSourceParameters = null); + public function getSnippet($className, array $extraSourceParameters = null); /** * Returns a source of values for snippets. @@ -91,18 +77,19 @@ public function getSource(); /** - * Set the directories where snippets are loaded from. + * Remove a prefix (or prefixed-path) from the registry * - * @param array $dirs - * @return MUtil_Snippets_SnippetLoaderInterface (continuation pattern) + * @param string $prefix + * @param string $path OPTIONAL + * @return MUtil_Snippets_SnippetLoaderInterface */ - public function setDirectories(array $dirs); + public function removePrefixPath($prefix, $path = null); /** * Sets the source of variables for snippets * * @param MUtil_Registry_SourceInterface $source - * @return MUtil_Snippets_SnippetLoaderInterface (continuation pattern) + * @return MUtil_Snippets_SnippetLoader (continuation pattern) */ public function setSource(MUtil_Registry_SourceInterface $source); } \ No newline at end of file Modified: trunk/library/classes/ZFDebug/Controller/Plugin/Debug.php =================================================================== --- trunk/library/classes/ZFDebug/Controller/Plugin/Debug.php 2013-01-09 17:30:52 UTC (rev 1091) +++ trunk/library/classes/ZFDebug/Controller/Plugin/Debug.php 2013-01-10 16:43:36 UTC (rev 1092) @@ -410,6 +410,11 @@ protected function _headerOutput() { $collapsed = isset($_COOKIE['ZFDebugCollapsed']) ? $_COOKIE['ZFDebugCollapsed'] : 0; + $jquery = MUtil_JQuery::jQuery(); + if ($jquery->useLocalPath()) { + $this->_options['jquery_path'] = $jquery->getLocalPath(); + } + return (' <style type="text/css" media="screen"> #ZFDebug_debug { font: 11px/1.4em Lucida Grande, Lucida Sans Unicode, sans-serif; position:fixed; bottom:5px; left:5px; color:#000; z-index: ' . $this->_options['z-index'] . ';} Modified: trunk/library/pre_bootstrap.php =================================================================== --- trunk/library/pre_bootstrap.php 2013-01-09 17:30:52 UTC (rev 1091) +++ trunk/library/pre_bootstrap.php 2013-01-10 16:43:36 UTC (rev 1092) @@ -59,25 +59,16 @@ APPLICATION_PATH . '/classes' . PATH_SEPARATOR . GEMS_LIBRARY_DIR . '/classes' . PATH_SEPARATOR . get_include_path() - //. PATH_SEPARATOR . GEMS_ROOT_DIR . '/library' //Shouldn't be needed, uncomment when neccessary ); -$GEMS_DIRS = array( - GEMS_PROJECT_NAME_UC => APPLICATION_PATH . '/classes', - 'Gems' => GEMS_LIBRARY_DIR . '/classes' -); - -// Set up autoload +// Set up autoload for MUtil require_once 'Zend/Loader/AutoLoader.php'; -$autoloader = Zend_Loader_Autoloader::getInstance(); +$autoloader = Zend_Loader_Autoloader::getInstance(); $autoloader->registerNamespace('MUtil_'); -$autoloader->registerNamespace('Gems_'); -$autoloader->registerNamespace(GEMS_PROJECT_NAME_UC . '_'); // Start using cached Loader -// require_once 'MUtil/Loader/CachedLoader.php'; -// $cachedloader = MUtil_Loader_CachedLoader::getInstance(GEMS_ROOT_DIR . '\var\cache'); -// $autoloader->setDefaultAutoloader(array($cachedloader, 'loadClassByPaths')); +// $cachedloader = MUtil_Loader_CachedLoader::getInstance(GEMS_ROOT_DIR . '/var/cache'); +// $autoloader->setDefaultAutoloader(array($cachedloader, 'autoload')); // Create application, bootstrap, and run $application = new Zend_Application( This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2013-01-09 17:31:00
|
Revision: 1091 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=1091&view=rev Author: matijsdejong Date: 2013-01-09 17:30:52 +0000 (Wed, 09 Jan 2013) Log Message: ----------- Made Renderer and Echo __PHP_Incomplete_Class proof Added documentation and disableOnLoad to ModelAbstract Switched ZFDebug to jQuery 1.8.3 Made CachedLoader that does not seem to speed things up Prepared switch to using pluginloader for LoaderAbstract and removing $GEMS_DIR from pre_bootstrap.php Modified Paths: -------------- trunk/library/classes/Gems/Loader/LoaderAbstract.php trunk/library/classes/GemsEscort.php trunk/library/classes/MUtil/Echo.php trunk/library/classes/MUtil/Html/Renderer.php trunk/library/classes/MUtil/Loader/CachedLoader.php trunk/library/classes/MUtil/Model/ModelAbstract.php trunk/library/classes/ZFDebug/Controller/Plugin/Debug.php trunk/library/pre_bootstrap.php Modified: trunk/library/classes/Gems/Loader/LoaderAbstract.php =================================================================== --- trunk/library/classes/Gems/Loader/LoaderAbstract.php 2013-01-07 16:04:05 UTC (rev 1090) +++ trunk/library/classes/Gems/Loader/LoaderAbstract.php 2013-01-09 17:30:52 UTC (rev 1091) @@ -85,7 +85,7 @@ /** * - * @var MUtil_Loader_CachedLoader + * @var Zend_Loader_PluginLoader_Interface */ private $_loader; @@ -107,16 +107,24 @@ $this->_dirs = $dirs; - // Set the directories to the used cascade pattern if ($this->cascade) { foreach ($dirs as $prefix => $path) { $newdirs[$prefix . '_' . $this->cascade] = $path; + // $newdirs[$prefix . '_' . $this->cascade] = $path . '/' . str_replace('_', '/', $this->cascade); } $this->_dirs = $newdirs; } - $this->_loader = MUtil_Loader_CachedLoader::getInstance(); + //$this->_loader = new Zend_Loader_PluginLoader($this->_dirs); + //* + // Set the directories to the used cascade pattern + $this->_loader = new Zend_Loader_PluginLoader(); + foreach (array_reverse($this->_dirs) as $prefix => $path) { + $this->_loader->addPrefixPath($prefix, $path . '/' . str_replace('_', '/', $prefix)); + } + // */ + if (MUtil_Registry_Source::$verbose) { MUtil_Echo::r($this->_dirs, '$this->_dirs in ' . get_class($this) . '->' . __FUNCTION__ . '():'); } @@ -166,6 +174,55 @@ */ protected function _loadClass($name, $create = false, array $arguments = array()) { + /* + $className = $this->_loader->load($name); + + // MUtil_Echo::track($className); + + if (is_subclass_of($className, __CLASS__)) { + $create = true; + // error_log($className); + $arguments = array($this->_containers[0], $this->_dirs); + + } elseif (is_subclass_of($className, 'MUtil_Registry_TargetInterface')) { + $create = true; + } + + if ($create) { + switch (count($arguments)) { + case 0: + $obj = new $className(); + break; + + case 1: + $obj = new $className($arguments[0]); + break; + + case 2: + $obj = new $className($arguments[0], $arguments[1]); + break; + + case 3: + $obj = new $className($arguments[0], $arguments[1], $arguments[2]); + break; + + default: + throw new Gems_Exception_Coding(__CLASS__ . '->' . __FUNCTION__ . ' cannot create class with ' . count($arguments) . ' parameters.'); + } + } else { + $obj = new MUtil_Lazy_StaticCall($className); + } + + if ($obj instanceof MUtil_Registry_TargetInterface) { + // error_log(get_class($obj)); + if ((! $this->applySource($obj)) && parent::$verbose) { + MUtil_Echo::track("Source apply to object of type $name failed."); + } + } + + return $obj; + // */ + // echo $name . ($create ? ' create' : ' not created') . "<br/>\n"; $cname = trim(str_replace('/', '_', ucfirst($name)), '_'); @@ -194,7 +251,7 @@ $paths = array($paths); } foreach ($paths as $path) { - //* + /* $className = $prefix . $cname; if ($this->_loader->loadClass($className, $path . $fprefix . '/' . $cfile)) { @@ -218,8 +275,9 @@ break 2; } // */ - /* + //* if ($obj = $this->_loadClassPath($path . $fprefix . '/' . $cfile, $prefix . $cname, $create, $arguments)) { + MUtil_Echo::track($prefix . $cname); $found = true; $this->_loaded[$cname] = get_class($obj); break 2; Modified: trunk/library/classes/GemsEscort.php =================================================================== --- trunk/library/classes/GemsEscort.php 2013-01-07 16:04:05 UTC (rev 1090) +++ trunk/library/classes/GemsEscort.php 2013-01-09 17:30:52 UTC (rev 1091) @@ -95,10 +95,6 @@ { parent::__construct($application); - $autoloader = Zend_Loader_Autoloader::getInstance(); - $cachedloader = MUtil_Loader_CachedLoader::getInstance(GEMS_ROOT_DIR . DIRECTORY_SEPARATOR . 'var' . DIRECTORY_SEPARATOR . 'cache'); - $autoloader->setDefaultAutoloader(array($cachedloader, 'loadClassByPaths')); - self::$_instanceOfSelf = $this; $firebug = $application->getOption('firebug'); @@ -315,6 +311,23 @@ protected function _initLoader() { global $GEMS_DIRS; + + /* + $dirs = $this->getOption('loaderDirs'); + + if (! $dirs) { + + $dirs = array(); + + foreach ($GEMS_DIRS as $prefix => $dir) { + $dirs[$prefix] = $dir . '/' . str_replace('_', '/', $prefix); + } + } + + MUtil_Echo::track($dirs); + + return $this->createProjectClass('Loader', $this->getContainer(), array_reverse($dirs)); + // */ return $this->createProjectClass('Loader', $this->getContainer(), $GEMS_DIRS); } @@ -555,7 +568,8 @@ 'Memory', 'Time', 'Registry', - 'Exception') + 'Exception'), + // 'jquery_path' => not yet initialized ); # Instantiate the database adapter and setup the plugin. Modified: trunk/library/classes/MUtil/Echo.php =================================================================== --- trunk/library/classes/MUtil/Echo.php 2013-01-07 16:04:05 UTC (rev 1090) +++ trunk/library/classes/MUtil/Echo.php 2013-01-09 17:30:52 UTC (rev 1091) @@ -154,7 +154,7 @@ { $session = self::getSession(); - if (is_array($var) || is_object($var)) { + if (is_array($var) || is_object($var) || ($var instanceof __PHP_Incomplete_Class)) { ob_start(); var_dump($var); $content = ob_get_clean(); Modified: trunk/library/classes/MUtil/Html/Renderer.php =================================================================== --- trunk/library/classes/MUtil/Html/Renderer.php 2013-01-07 16:04:05 UTC (rev 1090) +++ trunk/library/classes/MUtil/Html/Renderer.php 2013-01-09 17:30:52 UTC (rev 1091) @@ -196,6 +196,11 @@ // $new_content = 'WARNING: Object of type ' . get_class($content) . ' cannot be converted to string.'; throw new MUtil_Html_HtmlException('WARNING: Object of type ' . get_class($content) . ' cannot be converted to string.'); } + + } elseif ($content instanceof __PHP_Incomplete_Class) { + MUtil_Echo::track($content); + return ''; + } else { $new_content = (string) $content; } Modified: trunk/library/classes/MUtil/Loader/CachedLoader.php =================================================================== --- trunk/library/classes/MUtil/Loader/CachedLoader.php 2013-01-07 16:04:05 UTC (rev 1090) +++ trunk/library/classes/MUtil/Loader/CachedLoader.php 2013-01-09 17:30:52 UTC (rev 1091) @@ -50,26 +50,45 @@ * * @var array */ - protected $_cacheArray = array(); + private $_cacheClassArray = array(); /** * + * @var array + */ + // private $_cacheFileArray = array(); + + /** + * + * @var boolean + */ + private $_cacheChanged = false; + + /** + * Unix timestamp cahce file load time + * + * @var int + */ + private $_cacheLoadTime; + + /** + * * @var string */ - protected $_cacheDir = null; + private $_cacheDir = null; /** * * @var string */ - protected $_cacheFile = 'cached.loader.mutil.php'; + private $_cacheFile = 'cached.loader.mutil.php'; /** * An array containg include dir pathNames * * @var array */ - protected $_includeDirs; + private $_includeDirs; /** * @@ -93,7 +112,10 @@ } if (! file_exists($this->_cacheFile)) { - $this->_saveCache(); + $this->_cacheChanged = true; + $this->_cacheLoadTime = 0; + + // $this->_saveCache(); } else { if (! is_writable($this->_cacheFile)) { throw new Zend_Exception(sprintf('Cache file %s not writeable.', $this->_cacheFile)); @@ -107,6 +129,14 @@ } /** + * Make sure the changes ot the cache are saved. + */ + public function __destruct() + { + $this->_saveCache(); + } + + /** * Check for file existence and append status to the cache * * @param mixed $file String path to file or false if does not exist @@ -114,25 +144,18 @@ */ protected function _checkFile($file) { - if (array_key_exists($file, $this->_cacheArray)) { - return $this->_cacheArray[$file]; + return file_exists($file); + /* + if (array_key_exists($file, $this->_cacheFileArray)) { + return $this->_cacheFileArray[$file]; } // MUtil_Echo::track($file); - $this->_cacheArray[$file] = file_exists($file); + $this->_cacheFileArray[$file] = file_exists($file); + $this->_cacheChanged = true; - if (! file_exists($this->_cacheFile)) { - $this->_saveCache(); - } else { - if (false === $this->_cacheArray[$file]) { - $content = "\$this->_cacheArray['$file'] = false;\n"; - } else { - $content = "\$this->_cacheArray['$file'] = true;\n"; - } - file_put_contents($this->_cacheFile, $content, FILE_APPEND | LOCK_EX ); - } - - return $this->_cacheArray[$file]; + return $this->_cacheFileArray[$file]; + // */ } /** @@ -142,10 +165,16 @@ { include $this->_cacheFile; - // Include path has changed - if (!isset($include) || (get_include_path() != $include)) { - $this->_cacheArray = array(); + // if (isset($cacheArray, $fileArray, $include) && (get_include_path() != $include)) { + if (isset($cacheArray, $include) && (get_include_path() != $include)) { + $this->_cacheClassArray = $classArray; + // $this->_cacheFileArray = $fileArray; + $this->_cacheLoadTime = filemtime($this->_cacheFile); } + + $this->_cacheClassArray = array(); + // $this->_cacheFileArray = array(); + $this->_cacheChanged = true; } /** @@ -164,20 +193,50 @@ } /** - * Save the cache to file + * Save the cache to file (if changed) */ protected function _saveCache() { - $content = "<?php\n\n"; - $content .= "\$include = '" . get_include_path() . "';\n\n"; + // MUtil_Echo::track(filemtime($this->_cacheFile), $this->_cacheLoadTime, $this->_cacheChanged); + if (file_exists($this->_cacheFile)) { + if ((! $this->_cacheChanged) && (filemtime($this->_cacheFile) >= $this->_cacheLoadTime)) { + return; + } + } + /* + MUtil_Echo::r('Saving load cache (from previous call)'); - foreach ($this->_cacheArray as $file => $exists) { - if (false === $file) { - $content .= "\$this->_cacheArray['$file'] = false;\n"; + include $this->_cacheFile; + + MUtil_Echo::r(array_diff(array_keys($this->_cacheClassArray), array_keys($classArray))); + // */ + + $content = "<?php\n"; + $content .= "\$include = '" . get_include_path() . "';\n"; + + ksort($this->_cacheClassArray); + + $content .= "\$classArray = array(\n"; + foreach ($this->_cacheClassArray as $class => $file) { + $content .= "'$class' => '$file',\n"; + } + $content .= ");\n"; + + /* + ksort($this->_cacheFileArray); + + $content .= "\$fileArray = array(\n"; + + foreach ($this->_cacheFileArray as $file => $exists) { + if (false === $exists) { + $content .= "'$file' => false,\n"; } else { - $content .= "\$this->_cacheArray['$file'] = true;\n"; + $content .= "'$file' => true,\n"; } } + $content .= ");"; + // */ + file_put_contents($this->_cacheFile, $content, LOCK_EX); } @@ -269,6 +328,10 @@ if (! $instance) { $instance = new self($dir); + + if (is_subclass_of('Zend_Loader', 'MUtil_Loader_LoaderMarkerInterface')) { + Zend_Loader::setCachedLoader($instance); + } } return $instance;; @@ -281,7 +344,7 @@ */ public function includeFile($file) { - if ($this->_checkFile($file)) { + if (file_exists($file)) { $result = include $file; return $result ? $result : true; @@ -299,18 +362,35 @@ */ public function loadClass($className, $file) { + if (isset($this->_cacheClassArray[$className])) { + if ($this->_cacheClassArray[$className]) { + $this->includeFile($this->_cacheClassArray[$className]); + + return true; + } else { + // return false; + } + } + if (class_exists($className, false) || interface_exists($className, false)) { return true; } if ($this->includeFile($file)) { if (class_exists($className, false) || interface_exists($className, false)) { + $this->_cacheClassArray[$className] = $file; + $this->_cacheChanged = true; return true; } throw new Zend_Exception("The file '$file' does not contain the class '$class'."); } + if (! isset($this->_cacheClassArray[$className])) { + $this->_cacheClassArray[$className] = ''; + $this->_cacheChanged = true; + } + return false; } @@ -355,38 +435,26 @@ } $file .= str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php'; - if (null === $dirs) { - $dirs = $this->_includeDirs; + if (isset($this->_cacheClassArray[$class])) { + if ($this->_cacheClassArray[$class]) { + $this->includeFile($this->_cacheClassArray[$class]); + } } else { - $dirs = array_merge($dirs, $this->_includeDirs); - } + if (null === $dirs) { + $dirs = $this->_includeDirs; + } else { + $dirs = array_merge($dirs, $this->_includeDirs); + } - foreach ($dirs as $dir) { - // error_log($dir . $file); - if ($this->includeFile($dir . $file)) { - break; + foreach ($dirs as $dir) { + // error_log($dir . $file); + if ($this->includeFile($dir . $file)) { + $this->_cacheClassArray[$class] = $dir . $file; + $this->_cacheChanged = true; + break; + } } } - /* - if (!empty($dirs)) { - // use the autodiscovered path - $dirPath = dirname($file); - if (is_string($dirs)) { - $dirs = explode(PATH_SEPARATOR, $dirs); - } - foreach ($dirs as $key => $dir) { - if ($dir == '.') { - $dirs[$key] = $dirPath; - } else { - $dir = rtrim($dir, '\\/'); - $dirs[$key] = $dir . DIRECTORY_SEPARATOR . $dirPath; - } - } - $file = basename($file); - self::loadFile($file, $dirs, true); - } else { - self::loadFile($file, null, true); - } // */ if (!class_exists($class, false) && !interface_exists($class, false)) { require_once 'Zend/Exception.php'; Modified: trunk/library/classes/MUtil/Model/ModelAbstract.php =================================================================== --- trunk/library/classes/MUtil/Model/ModelAbstract.php 2013-01-07 16:04:05 UTC (rev 1090) +++ trunk/library/classes/MUtil/Model/ModelAbstract.php 2013-01-09 17:30:52 UTC (rev 1091) @@ -390,6 +390,13 @@ return $this; } + /** + * Delete all, one or some values for a certain field name. + * + * @param string $name Field name + * @param string|array|null $arrayOrKey1 Null or the name of a single attribute or an array of attribute names + * @param string $key2 Optional a second attribute name. + */ public function del($name, $arrayOrKey1 = null, $key2 = null) { if (func_num_args() == 1) { @@ -406,6 +413,18 @@ } /** + * Disable tyhe onload settings. This is sometimes needed for speed/ + * + * @return MUtil_Model_ModelAbstract (continuation pattern) + */ + public function disableOnLoad() + { + $this->setMeta(self::LOAD_TRANSFORMER, false); + + return $this; + } + + /** * Delete items from the model * * @param mixed $filter True to use the stored filter, array to specify a different filter Modified: trunk/library/classes/ZFDebug/Controller/Plugin/Debug.php =================================================================== --- trunk/library/classes/ZFDebug/Controller/Plugin/Debug.php 2013-01-07 16:04:05 UTC (rev 1090) +++ trunk/library/classes/ZFDebug/Controller/Plugin/Debug.php 2013-01-09 17:30:52 UTC (rev 1091) @@ -3,7 +3,7 @@ /** * Copyright (c) 2011, Erasmus MC * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright @@ -14,7 +14,7 @@ * * Neither the name of Erasmus MC nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE @@ -65,10 +65,10 @@ 'Time' => null, 'Memory' => null), 'z-index' => 255, - 'jquery_path' => 'https://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js', + 'jquery_path' => 'http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js', 'image_path' => null ); - + /** * Standard plugins * @@ -107,7 +107,7 @@ $this->setOptions($options); } - + /** * Creating ZF Version Tab always shown */ @@ -122,7 +122,7 @@ */ $this->_loadPlugins(); } - + /** * Sets options of the Debug Bar * @@ -142,7 +142,7 @@ if (isset($options['image_path'])) { $this->_options['image_path'] = $options['image_path']; } - + if (isset($options['plugins'])) { $this->_options['plugins'] = $options['plugins']; } @@ -183,7 +183,7 @@ } return $this; } - + /** * Get a registered plugin in the Debug Bar * @@ -198,7 +198,7 @@ } return false; } - + /** * Defined by Zend_Controller_Plugin_Abstract */ @@ -440,7 +440,7 @@ jQuery.noConflict(); ZFDebugCollapsed(); }; - + function ZFDebugCollapsed() { if ('.$collapsed.' == 1) { ZFDebugPanel(); @@ -448,7 +448,7 @@ return jQuery("#ZFDebug_debug").css("left", "-"+parseInt(jQuery("#ZFDebug_debug").outerWidth()-jQuery("#ZFDebug_toggler").outerWidth()+1)+"px"); } } - + function ZFDebugPanel(name) { jQuery(".ZFDebug_panel").each(function(i){ if(jQuery(this).css("display") == "block") { Modified: trunk/library/pre_bootstrap.php =================================================================== --- trunk/library/pre_bootstrap.php 2013-01-07 16:04:05 UTC (rev 1090) +++ trunk/library/pre_bootstrap.php 2013-01-09 17:30:52 UTC (rev 1091) @@ -67,21 +67,24 @@ 'Gems' => GEMS_LIBRARY_DIR . '/classes' ); -// Zend_Application: loads the autoloader -require_once 'Zend/Application.php'; +// Set up autoload +require_once 'Zend/Loader/AutoLoader.php'; +$autoloader = Zend_Loader_Autoloader::getInstance(); +$autoloader->registerNamespace('MUtil_'); +$autoloader->registerNamespace('Gems_'); +$autoloader->registerNamespace(GEMS_PROJECT_NAME_UC . '_'); +// Start using cached Loader +// require_once 'MUtil/Loader/CachedLoader.php'; +// $cachedloader = MUtil_Loader_CachedLoader::getInstance(GEMS_ROOT_DIR . '\var\cache'); +// $autoloader->setDefaultAutoloader(array($cachedloader, 'loadClassByPaths')); + // Create application, bootstrap, and run $application = new Zend_Application( APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini' ); -// Set up autoload (included by Zend_Application). -$autoloader = Zend_Loader_Autoloader::getInstance(); -$autoloader->registerNamespace('MUtil_'); -$autoloader->registerNamespace('Gems_'); -$autoloader->registerNamespace(GEMS_PROJECT_NAME_UC . '_'); - // MUtil_Model::$verbose = true; $application->bootstrap() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2013-01-07 16:04:12
|
Revision: 1090 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=1090&view=rev Author: michieltcs Date: 2013-01-07 16:04:05 +0000 (Mon, 07 Jan 2013) Log Message: ----------- OS-dependent separators Modified Paths: -------------- trunk/library/classes/GemsEscort.php Modified: trunk/library/classes/GemsEscort.php =================================================================== --- trunk/library/classes/GemsEscort.php 2013-01-04 16:21:50 UTC (rev 1089) +++ trunk/library/classes/GemsEscort.php 2013-01-07 16:04:05 UTC (rev 1090) @@ -96,7 +96,7 @@ parent::__construct($application); $autoloader = Zend_Loader_Autoloader::getInstance(); - $cachedloader = MUtil_Loader_CachedLoader::getInstance(GEMS_ROOT_DIR . '\var\cache'); + $cachedloader = MUtil_Loader_CachedLoader::getInstance(GEMS_ROOT_DIR . DIRECTORY_SEPARATOR . 'var' . DIRECTORY_SEPARATOR . 'cache'); $autoloader->setDefaultAutoloader(array($cachedloader, 'loadClassByPaths')); self::$_instanceOfSelf = $this; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2013-01-04 16:21:56
|
Revision: 1089 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=1089&view=rev Author: matijsdejong Date: 2013-01-04 16:21:50 +0000 (Fri, 04 Jan 2013) Log Message: ----------- ZfDebug code switched off Modified Paths: -------------- trunk/library/classes/GemsEscort.php Modified: trunk/library/classes/GemsEscort.php =================================================================== --- trunk/library/classes/GemsEscort.php 2013-01-04 16:20:22 UTC (rev 1088) +++ trunk/library/classes/GemsEscort.php 2013-01-04 16:21:50 UTC (rev 1089) @@ -539,7 +539,7 @@ * Add ZFDebug info to the page output. * * @return void - */ + * / protected function _initZFDebug() { // if ((APPLICATION_ENV === 'development') && This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2013-01-04 16:20:30
|
Revision: 1088 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=1088&view=rev Author: matijsdejong Date: 2013-01-04 16:20:22 +0000 (Fri, 04 Jan 2013) Log Message: ----------- Snippets should not use translate functions before call to afterRegistry() CachedLoader is now default loader Modified Paths: -------------- trunk/library/classes/Gems/Form/AutoLoadFormAbstract.php trunk/library/classes/Gems/Loader/LoaderAbstract.php trunk/library/classes/Gems/Snippets/AutosearchFormSnippet.php trunk/library/classes/Gems/Task/Db/CreateNewTable.php trunk/library/classes/Gems/Task/Db/CreateNewTables.php trunk/library/classes/GemsEscort.php trunk/library/classes/MUtil/Loader/CachedLoader.php trunk/library/classes/MUtil/Registry/Source.php trunk/library/snippets/AddTracksSnippet.php Modified: trunk/library/classes/Gems/Form/AutoLoadFormAbstract.php =================================================================== --- trunk/library/classes/Gems/Form/AutoLoadFormAbstract.php 2013-01-03 17:23:59 UTC (rev 1087) +++ trunk/library/classes/Gems/Form/AutoLoadFormAbstract.php 2013-01-04 16:20:22 UTC (rev 1088) @@ -67,18 +67,18 @@ protected $translate; /** - * Should be called after answering the request to allow the Target - * to check if all required registry values have been set correctly. + * Called after the check that all required registry values + * have been set correctly has run. * - * @return boolean False if required values are missing. + * @return void */ - public function checkRegistryRequestsAnswers() + public function afterRegistry() { + parent::afterRegistry(); + if ($this->loadDefault) { $this->loadDefaultElements(); } - - return true; } /** Modified: trunk/library/classes/Gems/Loader/LoaderAbstract.php =================================================================== --- trunk/library/classes/Gems/Loader/LoaderAbstract.php 2013-01-03 17:23:59 UTC (rev 1087) +++ trunk/library/classes/Gems/Loader/LoaderAbstract.php 2013-01-04 16:20:22 UTC (rev 1088) @@ -84,6 +84,12 @@ private $_loaded = array(); /** + * + * @var MUtil_Loader_CachedLoader + */ + private $_loader; + + /** * Allows sub classes of Gems_Loader_LoaderAbstract to specify the subdirectory where to look for. * * @var string $cascade An optional subdirectory where this subclass always loads from. @@ -108,6 +114,9 @@ } $this->_dirs = $newdirs; } + $this->_loader = MUtil_Loader_CachedLoader::getInstance(); + + if (MUtil_Registry_Source::$verbose) { MUtil_Echo::r($this->_dirs, '$this->_dirs in ' . get_class($this) . '->' . __FUNCTION__ . '():'); } @@ -162,8 +171,6 @@ $cname = trim(str_replace('/', '_', ucfirst($name)), '_'); $cfile = str_replace('_', '/', $cname) . '.php'; - // MUtil_Loader_CachedLoader::getInstance(GEMS_ROOT_DIR . '\var\cache'); - $found = false; /** @@ -187,18 +194,44 @@ $paths = array($paths); } foreach ($paths as $path) { + //* + $className = $prefix . $cname; + + if ($this->_loader->loadClass($className, $path . $fprefix . '/' . $cfile)) { + if (is_subclass_of($className, __CLASS__)) { + $create = true; + $arguments = array($this->_containers[0], $this->_dirs); + + } elseif (is_subclass_of($className, 'MUtil_Registry_TargetInterface')) { + $create = true; + } + + + if ($create) { + $obj = $this->_loader->createClass($className, $arguments); + } else { + $obj = new MUtil_Lazy_StaticCall($className); + } + + $found = true; + $this->_loaded[$cname] = get_class($obj); + break 2; + } // */ + + /* if ($obj = $this->_loadClassPath($path . $fprefix . '/' . $cfile, $prefix . $cname, $create, $arguments)) { $found = true; $this->_loaded[$cname] = get_class($obj); break 2; - } + } // */ } } } if ($found) { if ($obj instanceof MUtil_Registry_TargetInterface) { - if ((!$this->applySource($obj)) && parent::$verbose) { + // error_log(get_class($obj)); + if ((! $this->applySource($obj)) && parent::$verbose) { MUtil_Echo::track("Source apply to object of type $name failed."); } } Modified: trunk/library/classes/Gems/Snippets/AutosearchFormSnippet.php =================================================================== --- trunk/library/classes/Gems/Snippets/AutosearchFormSnippet.php 2013-01-03 17:23:59 UTC (rev 1087) +++ trunk/library/classes/Gems/Snippets/AutosearchFormSnippet.php 2013-01-04 16:20:22 UTC (rev 1088) @@ -120,13 +120,15 @@ } /** - * Should be called after answering the request to allow the Target - * to check if all required registry values have been set correctly. + * Called after the check that all required registry values + * have been set correctly has run. * - * @return boolean False if required are missing. + * @return void */ - public function checkRegistryRequestsAnswers() + public function afterRegistry() { + parent::afterRegistry(); + if ($this->util && (! $this->requestCache)) { $this->requestCache = $this->util->getRequestCache(); } @@ -134,8 +136,6 @@ // Do not store searchButtonId $this->requestCache->removeParams($this->searchButtonId); } - - return parent::checkRegistryRequestsAnswers(); } /** Modified: trunk/library/classes/Gems/Task/Db/CreateNewTable.php =================================================================== --- trunk/library/classes/Gems/Task/Db/CreateNewTable.php 2013-01-03 17:23:59 UTC (rev 1087) +++ trunk/library/classes/Gems/Task/Db/CreateNewTable.php 2013-01-04 16:20:22 UTC (rev 1088) @@ -68,7 +68,7 @@ public function execute($tableData = array()) { $this->_batch->addToCounter('createTableStep'); - + $result = $this->dbaModel->runScript($tableData); $result[] = sprintf($this->translate->_('Finished %s creation script for object %d of %d'), $this->translate->_(strtolower($tableData['type'])), $this->_batch->getCounter('createTableStep'), $this->_batch->getCounter('NewTableCount')) . '<br/>'; @@ -87,7 +87,8 @@ * * @return boolean */ - public function checkRegistryRequestsAnswers() { + public function checkRegistryRequestsAnswers() + { $this->escort = GemsEscort::getInstance(); //Load the dbaModel Modified: trunk/library/classes/Gems/Task/Db/CreateNewTables.php =================================================================== --- trunk/library/classes/Gems/Task/Db/CreateNewTables.php 2013-01-03 17:23:59 UTC (rev 1087) +++ trunk/library/classes/Gems/Task/Db/CreateNewTables.php 2013-01-04 16:20:22 UTC (rev 1088) @@ -79,7 +79,8 @@ * * @return boolean */ - public function checkRegistryRequestsAnswers() { + public function checkRegistryRequestsAnswers() + { $this->escort = GemsEscort::getInstance(); //Load the dbaModel Modified: trunk/library/classes/GemsEscort.php =================================================================== --- trunk/library/classes/GemsEscort.php 2013-01-03 17:23:59 UTC (rev 1087) +++ trunk/library/classes/GemsEscort.php 2013-01-04 16:20:22 UTC (rev 1088) @@ -38,6 +38,7 @@ // $autoloader->registerNamespace has not yet run!! include_once('MUtil/Application/Escort.php'); +include_once('MUtil/Loader/CachedLoader.php'); /** * Project Application Core code @@ -94,6 +95,10 @@ { parent::__construct($application); + $autoloader = Zend_Loader_Autoloader::getInstance(); + $cachedloader = MUtil_Loader_CachedLoader::getInstance(GEMS_ROOT_DIR . '\var\cache'); + $autoloader->setDefaultAutoloader(array($cachedloader, 'loadClassByPaths')); + self::$_instanceOfSelf = $this; $firebug = $application->getOption('firebug'); @@ -534,7 +539,7 @@ * Add ZFDebug info to the page output. * * @return void - * / + */ protected function _initZFDebug() { // if ((APPLICATION_ENV === 'development') && Modified: trunk/library/classes/MUtil/Loader/CachedLoader.php =================================================================== --- trunk/library/classes/MUtil/Loader/CachedLoader.php 2013-01-03 17:23:59 UTC (rev 1087) +++ trunk/library/classes/MUtil/Loader/CachedLoader.php 2013-01-04 16:20:22 UTC (rev 1088) @@ -65,7 +65,14 @@ protected $_cacheFile = 'cached.loader.mutil.php'; /** + * An array containg include dir pathNames * + * @var array + */ + protected $_includeDirs; + + /** + * * @param string $dir */ protected function __construct($dir = null) @@ -94,52 +101,164 @@ $this->_loadCache(); } + + $this->_loadIncludePath(); // MUtil_Echo::track($this->_cacheFile, $this->_cacheDir, file_exists($this->_cacheDir)); } /** - * Append a new found file to the cache + * Check for file existence and append status to the cache * - * @param string $class The name of the class to load * @param mixed $file String path to file or false if does not exist + * @return boolean True if the file exists */ - protected function _appendToCache($class, $file) + protected function _checkFile($file) { - $this->_cacheArray[$class] = $file; + if (array_key_exists($file, $this->_cacheArray)) { + return $this->_cacheArray[$file]; + } + // MUtil_Echo::track($file); + $this->_cacheArray[$file] = file_exists($file); + if (! file_exists($this->_cacheFile)) { $this->_saveCache(); } else { - if (false === $file) { - $content = "\$this->_cacheArray['$class'] = false;\n"; + if (false === $this->_cacheArray[$file]) { + $content = "\$this->_cacheArray['$file'] = false;\n"; } else { - $content = "\$this->_cacheArray['$class'] = '$file';\n"; + $content = "\$this->_cacheArray['$file'] = true;\n"; } file_put_contents($this->_cacheFile, $content, FILE_APPEND | LOCK_EX ); } + + return $this->_cacheArray[$file]; } + /** + * Loads the class from file with a check on changes to the include path + */ protected function _loadCache() { include $this->_cacheFile; + + // Include path has changed + if (!isset($include) || (get_include_path() != $include)) { + $this->_cacheArray = array(); + } } + /** + * Initialize the _includeDirs variable + */ + protected function _loadIncludePath() + { + $dirs = Zend_Loader::explodeIncludePath(); + + foreach ($dirs as $dir) { + if (('.' != $dir) && is_dir($dir)) { + $this->_includeDirs[] = realpath($dir) . DIRECTORY_SEPARATOR; +; + } + } + } + + /** + * Save the cache to file + */ protected function _saveCache() { - $content = "<?php\n"; + $content = "<?php\n\n"; + $content .= "\$include = '" . get_include_path() . "';\n\n"; - foreach ($this->_cacheArray as $class => $file) { + foreach ($this->_cacheArray as $file => $exists) { if (false === $file) { - $content .= "\$this->_cacheArray['$class'] = false;\n"; + $content .= "\$this->_cacheArray['$file'] = false;\n"; } else { - $content .= "\$this->_cacheArray['$class'] = '$file';\n"; + $content .= "\$this->_cacheArray['$file'] = true;\n"; } } file_put_contents($this->_cacheFile, $content, LOCK_EX); } /** + * Create a new instance of a class * + * @param string $className The name of the class + * @param array $arguments Class initialization arguments. + * @return boolean True if the class exists. + */ + public function createClass($className, array $arguments) + { + switch (count($arguments)) { + case 0: + return new $className(); + + case 1: + return new $className( + $arguments[0] + ); + + case 2: + return new $className( + $arguments[0], $arguments[1] + ); + + case 3: + return new $className( + $arguments[0], $arguments[1], $arguments[2] + ); + + case 4: + return new $className( + $arguments[0], $arguments[1], $arguments[2], $arguments[3] + ); + + case 5: + return new $className( + $arguments[0], $arguments[1], $arguments[2], $arguments[3], $arguments[4] + ); + + case 6: + return new $className( + $arguments[0], $arguments[1], $arguments[2], $arguments[3], $arguments[4], + $arguments[5] + ); + + case 7: + return new $className( + $arguments[0], $arguments[1], $arguments[2], $arguments[3], $arguments[4], + $arguments[5], $arguments[6] + ); + + case 8: + return new $className( + $arguments[0], $arguments[1], $arguments[2], $arguments[3], $arguments[4], + $arguments[5], $arguments[6], $arguments[7] + ); + + case 9: + return new $className( + $arguments[0], $arguments[1], $arguments[2], $arguments[3], $arguments[4], + $arguments[5], $arguments[6], $arguments[7], $arguments[8] + ); + + case 10: + return new $className( + $arguments[0], $arguments[1], $arguments[2], $arguments[3], $arguments[4], + $arguments[5], $arguments[6], $arguments[7], $arguments[8], $arguments[9] + ); + + default: + throw new Zend_Exception( + __CLASS__ . '->' . __FUNCTION__ . ' cannot create class with ' . + count($arguments) . ' parameters.' + ); + } + } + + /** + * * @static MUtil_Loader_CachedLoader $instance * @param stirng $dir * @return MUtil_Loader_CachedLoader @@ -155,11 +274,123 @@ return $instance;; } - protected function isClass($className, $paths) + /** + * Include a file with cached existence check + * + * @param string $file The full path to the file + */ + public function includeFile($file) { - // Zend_Loader::standardiseFile($file) - //if (file_exists($path . $className)) { + if ($this->_checkFile($file)) { + $result = include $file; -// /} + return $result ? $result : true; + } + + return false; } + + /** + * Load a class, but do not create it + * + * @param string $className The name of the class + * @param string $file The full path to the file + * @return boolean True if the class exists. + */ + public function loadClass($className, $file) + { + if (class_exists($className, false) || interface_exists($className, false)) { + return true; + } + + if ($this->includeFile($file)) { + if (class_exists($className, false) || interface_exists($className, false)) { + return true; + } + + throw new Zend_Exception("The file '$file' does not contain the class '$class'."); + } + + return false; + } + + /** + * Loads a class from a PHP file. The filename must be formatted + * as "$class.php". + * + * If $dirs is a string or an array, it will search the directories + * in the order supplied, and attempt to load the first matching file. + * + * If $dirs is null, it will split the class name at underscores to + * generate a path hierarchy (e.g., "Zend_Example_Class" will map + * to "Zend/Example/Class.php"). + * + * If the file was not found in the $dirs, or if no $dirs were specified, + * it will attempt to load it from PHP's include_path. + * + * @param string $class - The full class name of a Zend component. + * @param string|array $dirs - OPTIONAL Either a path or an array of paths + * to search. + * @return void + * @throws Zend_Exception + */ + public function loadClassByPaths($class, $dirs = null) + { + if (class_exists($class, false) || interface_exists($class, false)) { + return; + } + + if ((null !== $dirs) && !is_string($dirs) && !is_array($dirs)) { + require_once 'Zend/Exception.php'; + throw new Zend_Exception('Directory argument must be a string or an array'); + } + + $className = ltrim($class, '\\'); + $file = ''; + $namespace = ''; + if ($lastNsPos = strripos($className, '\\')) { + $namespace = substr($className, 0, $lastNsPos); + $className = substr($className, $lastNsPos + 1); + $file = str_replace('\\', DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR; + } + $file .= str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php'; + + if (null === $dirs) { + $dirs = $this->_includeDirs; + } else { + $dirs = array_merge($dirs, $this->_includeDirs); + } + + foreach ($dirs as $dir) { + // error_log($dir . $file); + if ($this->includeFile($dir . $file)) { + break; + } + } + /* + if (!empty($dirs)) { + // use the autodiscovered path + $dirPath = dirname($file); + if (is_string($dirs)) { + $dirs = explode(PATH_SEPARATOR, $dirs); + } + foreach ($dirs as $key => $dir) { + if ($dir == '.') { + $dirs[$key] = $dirPath; + } else { + $dir = rtrim($dir, '\\/'); + $dirs[$key] = $dir . DIRECTORY_SEPARATOR . $dirPath; + } + } + $file = basename($file); + self::loadFile($file, $dirs, true); + } else { + self::loadFile($file, null, true); + } // */ + + if (!class_exists($class, false) && !interface_exists($class, false)) { + require_once 'Zend/Exception.php'; + throw new Zend_Exception("File \"$file\" does not exist or class \"$class\" was not found in the file"); + } + } } Modified: trunk/library/classes/MUtil/Registry/Source.php =================================================================== --- trunk/library/classes/MUtil/Registry/Source.php 2013-01-03 17:23:59 UTC (rev 1087) +++ trunk/library/classes/MUtil/Registry/Source.php 2013-01-04 16:20:22 UTC (rev 1088) @@ -144,13 +144,12 @@ } // */ } } - if ($target->checkRegistryRequestsAnswers()) { - $target->afterRegistry(); - return true; - } else { - return false; - } + $result = $target->checkRegistryRequestsAnswers(); + + $target->afterRegistry(); + + return $result; } /** Modified: trunk/library/snippets/AddTracksSnippet.php =================================================================== --- trunk/library/snippets/AddTracksSnippet.php 2013-01-03 17:23:59 UTC (rev 1087) +++ trunk/library/snippets/AddTracksSnippet.php 2013-01-04 16:20:22 UTC (rev 1088) @@ -219,13 +219,15 @@ } /** - * Should be called after answering the request to allow the Target - * to check if all required registry values have been set correctly. + * Called after the check that all required registry values + * have been set correctly has run. * - * @return boolean False if required are missing. + * @return void */ - public function checkRegistryRequestsAnswers() + public function afterRegistry() { + parent::afterRegistry(); + if ($this->showForRespondents && is_bool($this->showForRespondents)) { $this->showForRespondents = $this->_('by Respondents'); } @@ -238,8 +240,6 @@ if ($this->showTitle && is_bool($this->showTitle)) { $this->showTitle = $this->_('Add'); } - - return parent::checkRegistryRequestsAnswers(); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2013-01-03 17:24:07
|
Revision: 1087 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=1087&view=rev Author: matijsdejong Date: 2013-01-03 17:23:59 +0000 (Thu, 03 Jan 2013) Log Message: ----------- Added info to ProjectInformationAction.php Made a non-functional start on CachedLoader.php Modified Paths: -------------- trunk/library/classes/Gems/Default/ProjectInformationAction.php trunk/library/classes/Gems/Loader/LoaderAbstract.php Added Paths: ----------- trunk/library/classes/MUtil/Loader/ trunk/library/classes/MUtil/Loader/CachedLoader.php Modified: trunk/library/classes/Gems/Default/ProjectInformationAction.php =================================================================== --- trunk/library/classes/Gems/Default/ProjectInformationAction.php 2013-01-03 08:22:06 UTC (rev 1086) +++ trunk/library/classes/Gems/Default/ProjectInformationAction.php 2013-01-03 17:23:59 UTC (rev 1087) @@ -136,7 +136,8 @@ $data[$this->_('Gems version')] = $versions->getGemsVersion(); $data[$this->_('Gems build')] = $versions->getBuild(); $data[$this->_('Gems project')] = GEMS_PROJECT_NAME; - $data[$this->_('Gems web directory')] = GEMS_ROOT_DIR; + $data[$this->_('Gems web directory')] = GEMS_WEB_DIR; + $data[$this->_('Gems root directory')] = GEMS_ROOT_DIR; $data[$this->_('Gems code directory')] = GEMS_LIBRARY_DIR; $data[$this->_('MUtil version')] = MUtil_Version::get(); $data[$this->_('Zend version')] = Zend_Version::VERSION; Modified: trunk/library/classes/Gems/Loader/LoaderAbstract.php =================================================================== --- trunk/library/classes/Gems/Loader/LoaderAbstract.php 2013-01-03 08:22:06 UTC (rev 1086) +++ trunk/library/classes/Gems/Loader/LoaderAbstract.php 2013-01-03 17:23:59 UTC (rev 1087) @@ -162,6 +162,8 @@ $cname = trim(str_replace('/', '_', ucfirst($name)), '_'); $cfile = str_replace('_', '/', $cname) . '.php'; + // MUtil_Loader_CachedLoader::getInstance(GEMS_ROOT_DIR . '\var\cache'); + $found = false; /** @@ -189,7 +191,7 @@ $found = true; $this->_loaded[$cname] = get_class($obj); break 2; - } + } } } } Added: trunk/library/classes/MUtil/Loader/CachedLoader.php =================================================================== --- trunk/library/classes/MUtil/Loader/CachedLoader.php (rev 0) +++ trunk/library/classes/MUtil/Loader/CachedLoader.php 2013-01-03 17:23:59 UTC (rev 1087) @@ -0,0 +1,165 @@ +<?php + +/** + * Copyright (c) 2011, Erasmus MC + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Erasmus MC nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * @package MUtil + * @subpackage Loader + * @author Matijs de Jong <mj...@ma...> + * @copyright Copyright (c) 2011 Erasmus MC + * @license New BSD License + * @version $Id: CachedLoader.php$ + */ + +/** + * + * + * @package MUtil + * @subpackage Loader + * @copyright Copyright (c) 2011 Erasmus MC + * @license New BSD License + * @since Class available since MUtil version 1.2 + */ +class MUtil_Loader_CachedLoader +{ + /** + * + * @var array + */ + protected $_cacheArray = array(); + + /** + * + * @var string + */ + protected $_cacheDir = null; + + /** + * + * @var string + */ + protected $_cacheFile = 'cached.loader.mutil.php'; + + /** + * + * @param string $dir + */ + protected function __construct($dir = null) + { + if (null === $dir) { + $dir = getenv('TMP'); + } + + $this->_cacheDir = rtrim($dir, '\\/') . DIRECTORY_SEPARATOR; + $this->_cacheFile = $this->_cacheDir . $this->_cacheFile; + + if (! file_exists($this->_cacheDir)) { + throw new Zend_Exception(sprintf('Cache directory %s does not exist.', $this->_cacheDir)); + } + + if (! is_writable($this->_cacheDir)) { + throw new Zend_Exception(sprintf('Cache directory %s is not writeable.', $this->_cacheFile)); + } + + if (! file_exists($this->_cacheFile)) { + $this->_saveCache(); + } else { + if (! is_writable($this->_cacheFile)) { + throw new Zend_Exception(sprintf('Cache file %s not writeable.', $this->_cacheFile)); + } + + $this->_loadCache(); + } + // MUtil_Echo::track($this->_cacheFile, $this->_cacheDir, file_exists($this->_cacheDir)); + } + + /** + * Append a new found file to the cache + * + * @param string $class The name of the class to load + * @param mixed $file String path to file or false if does not exist + */ + protected function _appendToCache($class, $file) + { + $this->_cacheArray[$class] = $file; + + if (! file_exists($this->_cacheFile)) { + $this->_saveCache(); + } else { + if (false === $file) { + $content = "\$this->_cacheArray['$class'] = false;\n"; + } else { + $content = "\$this->_cacheArray['$class'] = '$file';\n"; + } + file_put_contents($this->_cacheFile, $content, FILE_APPEND | LOCK_EX ); + } + } + + protected function _loadCache() + { + include $this->_cacheFile; + } + + protected function _saveCache() + { + $content = "<?php\n"; + + foreach ($this->_cacheArray as $class => $file) { + if (false === $file) { + $content .= "\$this->_cacheArray['$class'] = false;\n"; + } else { + $content .= "\$this->_cacheArray['$class'] = '$file';\n"; + } + } + file_put_contents($this->_cacheFile, $content, LOCK_EX); + } + + /** + * + * @static MUtil_Loader_CachedLoader $instance + * @param stirng $dir + * @return MUtil_Loader_CachedLoader + */ + public static function getInstance($dir = null) + { + static $instance; + + if (! $instance) { + $instance = new self($dir); + } + + return $instance;; + } + + protected function isClass($className, $paths) + { + // Zend_Loader::standardiseFile($file) + //if (file_exists($path . $className)) { + +// /} + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2013-01-03 08:22:13
|
Revision: 1086 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=1086&view=rev Author: mennodekker Date: 2013-01-03 08:22:06 +0000 (Thu, 03 Jan 2013) Log Message: ----------- Replaced GEMS_PROJECT_PATH with APPLICATION_PATH and updated changelog.txt Modified Paths: -------------- trunk/library/changelog.txt trunk/new_project/application/configs/application.ini Modified: trunk/library/changelog.txt =================================================================== --- trunk/library/changelog.txt 2013-01-02 14:04:56 UTC (rev 1085) +++ trunk/library/changelog.txt 2013-01-03 08:22:06 UTC (rev 1086) @@ -1,6 +1,6 @@ Important changes from 1.5.7 => 1.6 ============================================================ -Defined constant GEMS_PROJECT_PATH removed from code +Defined constant GEMS_PROJECT_PATH removed from code (update at least your application.ini and use APPLICATION_PATH instead) Moved date_default_timezone_set to index.php (can generate warnings) Important changes from 1.5.6 => 1.5.7 Modified: trunk/new_project/application/configs/application.ini =================================================================== --- trunk/new_project/application/configs/application.ini 2013-01-02 14:04:56 UTC (rev 1085) +++ trunk/new_project/application/configs/application.ini 2013-01-03 08:22:06 UTC (rev 1086) @@ -13,7 +13,7 @@ resources.db.params.username = USER resources.db.params.password = PASSWD resources.db.isDefaultTableAdapter = true -resources.frontController.controllerDirectory = GEMS_PROJECT_PATH "/controllers" +resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers" resources.layout.layout = "gems-fluid" resources.layout.layoutPath = GEMS_LIBRARY_DIR "/layouts/scripts" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2013-01-02 10:22:12
|
Revision: 1084 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=1084&view=rev Author: mennodekker Date: 2013-01-02 10:22:05 +0000 (Wed, 02 Jan 2013) Log Message: ----------- Fixed error when expression was cast to string Modified Paths: -------------- trunk/library/classes/MUtil/Model/DatabaseModelAbstract.php Modified: trunk/library/classes/MUtil/Model/DatabaseModelAbstract.php =================================================================== --- trunk/library/classes/MUtil/Model/DatabaseModelAbstract.php 2012-12-30 18:25:39 UTC (rev 1083) +++ trunk/library/classes/MUtil/Model/DatabaseModelAbstract.php 2013-01-02 10:22:05 UTC (rev 1084) @@ -703,9 +703,15 @@ public function formatLoadDate($value, $isNew = false, $name = null, array $context = array()) { // If not empty or zend_db_expression and not already a zend date, we - // transform to a Zend_Date using the ISO_8601 format + // transform to a Zend_Date using the ISO_8601 format if (!empty($value) && !($value instanceof Zend_Date) && !($value instanceof Zend_Db_Expr)) { - $tmpDate = new MUtil_Date($value, Zend_Date::ISO_8601); + try { + $tmpDate = new MUtil_Date($value, Zend_Date::ISO_8601); + } catch (Exception $exc) { + // On failure, we use the input value + $tmpDate = $value; + } + return $tmpDate; } return $value; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-12-30 18:25:46
|
Revision: 1083 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=1083&view=rev Author: matijsdejong Date: 2012-12-30 18:25:39 +0000 (Sun, 30 Dec 2012) Log Message: ----------- Added new information Modified Paths: -------------- trunk/library/classes/Gems/Default/ProjectInformationAction.php Modified: trunk/library/classes/Gems/Default/ProjectInformationAction.php =================================================================== --- trunk/library/classes/Gems/Default/ProjectInformationAction.php 2012-12-30 18:24:01 UTC (rev 1082) +++ trunk/library/classes/Gems/Default/ProjectInformationAction.php 2012-12-30 18:25:39 UTC (rev 1083) @@ -143,6 +143,7 @@ $data[$this->_('Application environment')] = APPLICATION_ENV; $data[$this->_('Application baseuri')] = $this->loader->getUtil()->getCurrentURI(); $data[$this->_('Application directory')] = APPLICATION_PATH; + $data[$this->_('Application encoding')] = APPLICATION_ENCODING; $data[$this->_('PHP version')] = phpversion(); $data[$this->_('Server Hostname')] = php_uname('n'); $data[$this->_('Server OS')] = php_uname('s'); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |