From: <gem...@li...> - 2011-09-23 07:57:48
|
Revision: 71 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=71&view=rev Author: mennodekker Date: 2011-09-23 07:57:42 +0000 (Fri, 23 Sep 2011) Log Message: ----------- Updated new project to allow stand alone surveys Fixed AddTracks to display only what the Gems_Project marker interfaces allow TODO: what to do when add track/survey is not allowed? now we get a not allowed error Modified Paths: -------------- trunk/library/snippets/AddTracksSnippet.php trunk/new_project/application/classes/NewProject/Escort.php Modified: trunk/library/snippets/AddTracksSnippet.php =================================================================== --- trunk/library/snippets/AddTracksSnippet.php 2011-09-22 14:13:27 UTC (rev 70) +++ trunk/library/snippets/AddTracksSnippet.php 2011-09-23 07:57:42 UTC (rev 71) @@ -1,5 +1,4 @@ <?php - /** * Copyright (c) 2011, Erasmus MC * All rights reserved. @@ -36,8 +35,12 @@ */ /** - * Displays a toolbox of drop down UL's om tracks/ surveys toe te voegen. + * Displays a toolbox of drop down UL's to assign tracks / surveys to a patient. * + * If project uses the Gems_Project_Tracks_MultiTracksInterface, show a track drowpdown + * If project uses the Gems_Project_Tracks_StandAloneSurveysInterface, show a survey + * drowpdown for both staff and patient + * * A snippet is a piece of html output that is reused on multiple places in the code. * * Variables are intialized using the {@see MUtil_Registry_TargetInterface} mechanism. @@ -178,23 +181,34 @@ } /** - * Create the snippets content + * Allow manual assignment of surveys/tracks to a patient * - * This is a stub function either override getHtmlOutput() or override render() + * If project uses the Gems_Project_Tracks_MultiTracksInterface, show a track drowpdown + * If project uses the Gems_Project_Tracks_StandAloneSurveysInterface, show a survey + * drowpdown for both staff and patient * * @param Zend_View_Abstract $view Just in case it is needed here * @return MUtil_Html_HtmlInterface Something that can be rendered */ public function getHtmlOutput(Zend_View_Abstract $view) { - $pageRef = array(MUtil_Model::REQUEST_ID => $this->request->getParam(MUtil_Model::REQUEST_ID)); + if ($this->escort instanceof Gems_Project_Tracks_MultiTracksInterface || + $this->escort instanceof Gems_Project_Tracks_StandAloneSurveysInterface) { - $addToLists = MUtil_Html::create()->div(array('class' => 'tooldock')); - $addToLists->strong($this->_('Add')); - $addToLists[] = $this->_getTracks('T', $pageRef); - $addToLists[] = $this->_getTracks('S', $pageRef); - $addToLists[] = $this->_getTracks('M', $pageRef); + $pageRef = array(MUtil_Model::REQUEST_ID => $this->request->getParam(MUtil_Model::REQUEST_ID)); - return $addToLists; + $addToLists = MUtil_Html::create()->div(array('class' => 'tooldock')); + $addToLists->strong($this->_('Add')); + if ($this->escort instanceof Gems_Project_Tracks_MultiTracksInterface) { + $addToLists[] = $this->_getTracks('T', $pageRef); + } + if ($this->escort instanceof Gems_Project_Tracks_StandAloneSurveysInterface) { + $addToLists[] = $this->_getTracks('S', $pageRef); + $addToLists[] = $this->_getTracks('M', $pageRef); + } + + return $addToLists; + } + return null; } } Modified: trunk/new_project/application/classes/NewProject/Escort.php =================================================================== --- trunk/new_project/application/classes/NewProject/Escort.php 2011-09-22 14:13:27 UTC (rev 70) +++ trunk/new_project/application/classes/NewProject/Escort.php 2011-09-23 07:57:42 UTC (rev 71) @@ -1,51 +1,51 @@ <?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. + */ + include_once('GemsEscort.php'); include_once('Gems/Project/Layout/SingleLayoutInterface.php'); include_once('Gems/Project/Log/LogRespondentAccessInterface.php'); include_once('Gems/Project/Organization/MultiOrganizationInterface.php'); include_once('Gems/Project/Tracks/MultiTracksInterface.php'); -include_once('Gems/Project/Tracks/TracksOnlyInterface.php'); +include_once('Gems/Project/Tracks/StandAloneSurveysInterface.php'); class NewProject_Escort extends GemsEscort implements Gems_Project_Layout_SingleLayoutInterface, Gems_Project_Log_LogRespondentAccessInterface, Gems_Project_Organization_MultiOrganizationInterface, Gems_Project_Tracks_MultiTracksInterface, - Gems_Project_Tracks_TracksOnlyInterface + Gems_Project_Tracks_StandAloneSurveysInterface { public function getUserOrganization() { // Gems_Project_Organization_MultiOrganizationInterface return $this->session->user_organization_id; } - + public function getAllowedOrganizations($userId = null) { // Gems_Project_Organization_MultiOrganizationInterface return parent::getAllowedOrganizations($userId); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |