From: <gem...@li...> - 2012-06-21 10:00:57
|
Revision: 775 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=775&view=rev Author: matijsdejong Date: 2012-06-21 10:00:46 +0000 (Thu, 21 Jun 2012) Log Message: ----------- Stage 2 multi organization: internally all patient identification is done by id1 + id2 for org Still working on output and finding and fixing bugs Modified Paths: -------------- trunk/library/classes/Gems/Default/RespondentAction.php trunk/library/classes/Gems/Default/TrackActionAbstract.php trunk/library/classes/Gems/Menu/ParameterSource.php trunk/library/classes/Gems/Menu/SubMenuItem.php trunk/library/classes/Gems/Menu.php trunk/library/classes/Gems/Model/HiddenOrganizationModel.php trunk/library/classes/MUtil/Model.php Modified: trunk/library/classes/Gems/Default/RespondentAction.php =================================================================== --- trunk/library/classes/Gems/Default/RespondentAction.php 2012-06-21 09:38:22 UTC (rev 774) +++ trunk/library/classes/Gems/Default/RespondentAction.php 2012-06-21 10:00:46 UTC (rev 775) @@ -347,10 +347,10 @@ { switch ($name) { case 'gr2o_patient_nr': - return $this->_getParam(MUtil_Model::REQUEST_ID, $this->_getParam(MUtil_Model::REQUEST_ID . '1', $default)); + return $this->_getParam(MUtil_Model::REQUEST_ID, $this->_getParam(MUtil_Model::REQUEST_ID1, $default)); case 'gr2o_id_organization': - return $this->_getParam(MUtil_Model::REQUEST_ID . '1', $default ? $default : $this->loader->getCurrentUser()->getCurrentOrganizationId()); + return $this->_getParam(MUtil_Model::REQUEST_ID1, $default ? $default : $this->loader->getCurrentUser()->getCurrentOrganizationId()); case 'gto_id_token': return null; Modified: trunk/library/classes/Gems/Default/TrackActionAbstract.php =================================================================== --- trunk/library/classes/Gems/Default/TrackActionAbstract.php 2012-06-21 09:38:22 UTC (rev 774) +++ trunk/library/classes/Gems/Default/TrackActionAbstract.php 2012-06-21 10:00:46 UTC (rev 775) @@ -138,8 +138,8 @@ */ protected function _getPatientAndOrganisationParam() { - $patientId = $this->_getParam(MUtil_Model::REQUEST_ID . '1'); - $orgId = $this->_getParam(MUtil_Model::REQUEST_ID . '2'); + $patientId = $this->_getParam(MUtil_Model::REQUEST_ID1); + $orgId = $this->_getParam(MUtil_Model::REQUEST_ID2); // When no resp id, check the current menu item paramter filter that MUtil_Model::REQUEST_ID does not contain a token if ((! $patientId) && $this->menu->getCurrent()->checkParameterFilter(Gems_Model::ID_TYPE)) { @@ -333,10 +333,11 @@ if (isset($data[MUtil_Model::REQUEST_ID])) { $keys[] = MUtil_Model::REQUEST_ID; - } elseif (isset($data[MUtil_Model::REQUEST_ID . '1'])) { + } elseif (isset($data[MUtil_Model::REQUEST_ID1])) { $i = 1; while (isset($data[MUtil_Model::REQUEST_ID . $i])) { $keys[] = MUtil_Model::REQUEST_ID . $i; + $i++; } } else { $keys = $model->getKeys(); @@ -376,16 +377,11 @@ public function initFilter() { // FROM REQUEST - if ($param = $this->_getParam(MUtil_Model::REQUEST_ID . '1')) { + if ($param = $this->_getParam(MUtil_Model::REQUEST_ID1)) { $this->filterStandard['gr2o_patient_nr'] = $param; - - } elseif ($param = $this->_getParam(MUtil_Model::REQUEST_ID)) { - $this->filterStandard['gr2o_patient_nr'] = $param; } - if ($param = $this->_getParam(MUtil_Model::REQUEST_ID . '2')) { + if ($param = $this->_getParam(MUtil_Model::REQUEST_ID2)) { $this->filterStandard['gr2o_id_organization'] = $param; - } else { - $this->filterStandard['gr2o_id_organization'] = $this->escort->getCurrentOrganization(); } if ($param = $this->_getParam(Gems_Model::RESPONDENT_TRACK)) { Modified: trunk/library/classes/Gems/Menu/ParameterSource.php =================================================================== --- trunk/library/classes/Gems/Menu/ParameterSource.php 2012-06-21 09:38:22 UTC (rev 774) +++ trunk/library/classes/Gems/Menu/ParameterSource.php 2012-06-21 10:00:46 UTC (rev 775) @@ -85,13 +85,9 @@ public function setPatient($patientNumber, $organizationId) { - if (! $this->offsetExists(MUtil_Model::REQUEST_ID)) { - $this->offsetSet(MUtil_Model::REQUEST_ID, $patientNumber); - } + $this->_setMulti($patientNumber, MUtil_Model::REQUEST_ID1, 'gr2o_patient_nr'); + $this->_setMulti($organizationId, MUtil_Model::REQUEST_ID2, 'gr2o_id_organization'); - $this->_setMulti($patientNumber, MUtil_Model::REQUEST_ID . '1', 'gr2o_patient_nr'); - $this->_setMulti($organizationId, MUtil_Model::REQUEST_ID . '2', 'gr2o_id_organization'); - return $this; } Modified: trunk/library/classes/Gems/Menu/SubMenuItem.php =================================================================== --- trunk/library/classes/Gems/Menu/SubMenuItem.php 2012-06-21 09:38:22 UTC (rev 774) +++ trunk/library/classes/Gems/Menu/SubMenuItem.php 2012-06-21 10:00:46 UTC (rev 775) @@ -187,11 +187,11 @@ if ($this->_hiddenOrgId) { // Remove org paramter that should remain hidden. - if (isset($parameters[MUtil_Model::REQUEST_ID . '1'], $parameters[MUtil_Model::REQUEST_ID . '2']) && - (! $parameters[MUtil_Model::REQUEST_ID . '2'] instanceof MUtil_Lazy_LazyInterface) && - ($parameters[MUtil_Model::REQUEST_ID . '2'] == $this->_hiddenOrgId)) { - $parameters[MUtil_Model::REQUEST_ID] = $parameters[MUtil_Model::REQUEST_ID . '1']; - unset($parameters[MUtil_Model::REQUEST_ID . '1'], $parameters[MUtil_Model::REQUEST_ID . '2']); + if (isset($parameters[MUtil_Model::REQUEST_ID1], $parameters[MUtil_Model::REQUEST_ID2]) && + (! $parameters[MUtil_Model::REQUEST_ID2] instanceof MUtil_Lazy_LazyInterface) && + ($parameters[MUtil_Model::REQUEST_ID2] == $this->_hiddenOrgId)) { + $parameters[MUtil_Model::REQUEST_ID] = $parameters[MUtil_Model::REQUEST_ID1]; + unset($parameters[MUtil_Model::REQUEST_ID1], $parameters[MUtil_Model::REQUEST_ID2]); } } @@ -573,6 +573,12 @@ $source[$key] = $value; } } + if ($this->_hiddenOrgId) { + if ($patientId = $request->getParam(MUtil_Model::REQUEST_ID)) { + $request->setParam(MUtil_Model::REQUEST_ID1, $patientId); + $request->setParam(MUtil_Model::REQUEST_ID2, $this->_hiddenOrgId); + } + } return $this; } Modified: trunk/library/classes/Gems/Menu.php =================================================================== --- trunk/library/classes/Gems/Menu.php 2012-06-21 09:38:22 UTC (rev 774) +++ trunk/library/classes/Gems/Menu.php 2012-06-21 10:00:46 UTC (rev 775) @@ -264,8 +264,8 @@ { $orgId = $this->escort->getLoader()->getCurrentUser()->getCurrentOrganizationId(); - $params = array(MUtil_Model::REQUEST_ID => 'gr2o_patient_nr'); - $params = array(MUtil_Model::REQUEST_ID . '1' => 'gr2o_patient_nr', MUtil_Model::REQUEST_ID . '2' => 'gr2o_id_organization'); + // $params = array(MUtil_Model::REQUEST_ID => 'gr2o_patient_nr'); + $params = array(MUtil_Model::REQUEST_ID1 => 'gr2o_patient_nr', MUtil_Model::REQUEST_ID2 => 'gr2o_id_organization'); // MAIN RESPONDENTS ITEM $page = $this->addPage($label, 'pr.respondent', 'respondent'); @@ -275,12 +275,11 @@ ->setNamedParameters($params) ->setHiddenOrgId($orgId); - /* iff( is('gr2o_id_organization', $this->escort->getCurrentOrganization()), - aget(MUtil_Model::REQUEST_ID, 'gr2o_patient_nr'), - aget(MUtil_Model::REQUEST_ID . '1', 'gr2o_patient_nr', MUtil_Model::REQUEST_ID . '2', 'gr2o_id_organization') + aget(MUtil_Model::REQUEST_ID, 'gr2o_patient_nr'), + aget(MUtil_Model::REQUEST_ID1, 'gr2o_patient_nr', MUtil_Model::REQUEST_ID2, 'gr2o_id_organization') ); */ Modified: trunk/library/classes/Gems/Model/HiddenOrganizationModel.php =================================================================== --- trunk/library/classes/Gems/Model/HiddenOrganizationModel.php 2012-06-21 09:38:22 UTC (rev 774) +++ trunk/library/classes/Gems/Model/HiddenOrganizationModel.php 2012-06-21 10:00:46 UTC (rev 775) @@ -93,6 +93,8 @@ if ($field2 = array_shift($keys)) { $parameters[$field2] = $this->getCurrentOrganization(); + MUtil_Echo::r('Still using old HiddenModel parameters.', 'DEPRECIATION WARNING'); + MUtil_Echo::r($parameters); } unset($parameters[MUtil_Model::REQUEST_ID]); @@ -149,11 +151,11 @@ } if ($organizationInKey) { - $href[MUtil_Model::REQUEST_ID] = self::_getValueFrom(reset($keys), $forData); + $href[MUtil_Model::REQUEST_ID] = self::_getValueFrom(reset($keys), $forData); } else { - $href[MUtil_Model::REQUEST_ID . '1'] = self::_getValueFrom(reset($keys), $forData); + $href[MUtil_Model::REQUEST_ID1] = self::_getValueFrom(reset($keys), $forData); next($keys); - $href[MUtil_Model::REQUEST_ID . '2'] = self::_getValueFrom(key($keys), $forData); + $href[MUtil_Model::REQUEST_ID2] = self::_getValueFrom(key($keys), $forData); } return $href; Modified: trunk/library/classes/MUtil/Model.php =================================================================== --- trunk/library/classes/MUtil/Model.php 2012-06-21 09:38:22 UTC (rev 774) +++ trunk/library/classes/MUtil/Model.php 2012-06-21 10:00:46 UTC (rev 775) @@ -1,33 +1,33 @@ <?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. - */ - + /** + * 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 @@ -36,11 +36,46 @@ */ class MUtil_Model { + /** + * 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. + */ const REQUEST_ID = 'id'; + /** + * Helper constant for first key value in multi value key. + */ + const REQUEST_ID1 = 'id1'; + + /** + * Helper constant for second key value in multi value key. + */ + const REQUEST_ID2 = 'id2'; + + /** + * Helper constant for third key value in multi value key. + */ + const REQUEST_ID3 = 'id3'; + + /** + * Helper constant for forth key value in multi value key. + */ + const REQUEST_ID4 = 'id4'; + + /** + * Default parameter name for sorting ascending. + */ const SORT_ASC_PARAM = 'asort'; + + /** + * Default parameter name for sorting descending. + */ const SORT_DESC_PARAM = 'dsort'; + /** + * Default parameter name for wildcard text search. + */ const TEXT_FILTER = 'search'; const TYPE_STRING = 1; @@ -65,4 +100,3 @@ */ public static $verbose = false; } - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |