From: <gem...@li...> - 2012-02-05 16:22:32
|
Revision: 449 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=449&view=rev Author: matijsdejong Date: 2012-02-05 16:22:26 +0000 (Sun, 05 Feb 2012) Log Message: ----------- RespondentTokenSnippet filters on the current organization AddTracksSnippet and AnswerModelSnippetGeneric parts can be turned on or off Extra Lazy concat function Modified Paths: -------------- branches/1.5.x/library/classes/Gems/Tracker/Snippets/AnswerModelSnippetGeneric.php branches/1.5.x/library/classes/MUtil/Lazy.php branches/1.5.x/library/snippets/AddTracksSnippet.php branches/1.5.x/library/snippets/RespondentTokenSnippet.php Modified: branches/1.5.x/library/classes/Gems/Tracker/Snippets/AnswerModelSnippetGeneric.php =================================================================== --- branches/1.5.x/library/classes/Gems/Tracker/Snippets/AnswerModelSnippetGeneric.php 2012-02-02 17:01:28 UTC (rev 448) +++ branches/1.5.x/library/classes/Gems/Tracker/Snippets/AnswerModelSnippetGeneric.php 2012-02-05 16:22:26 UTC (rev 449) @@ -90,6 +90,13 @@ protected $showButtons = true; /** + * Switch to put the display of the headers on or off + * + * @var boolean + */ + protected $showHeaders = true; + + /** * Switch to put the display of the current token as select to true or false. * * @var boolean @@ -204,14 +211,16 @@ if ($this->tokenId) { if ($this->token->exists) { - $htmlDiv->h3(sprintf($this->_('%s answers for patient number %s'), $this->token->getSurveyName(), $this->token->getPatientNumber())); + if ($this->showHeaders) { + $htmlDiv->h3(sprintf($this->_('%s answers for patient number %s'), $this->token->getSurveyName(), $this->token->getPatientNumber())); - $htmlDiv->pInfo(sprintf( - $this->_('Answers for token %s, patient number %s: %s.'), - strtoupper($this->tokenId), - $this->token->getPatientNumber(), - $this->token->getRespondentName())) - ->appendAttrib('class', 'noprint'); + $htmlDiv->pInfo(sprintf( + $this->_('Answers for token %s, patient number %s: %s.'), + strtoupper($this->tokenId), + $this->token->getPatientNumber(), + $this->token->getRespondentName())) + ->appendAttrib('class', 'noprint'); + } $table = parent::getHtmlOutput($view); $table->setPivot(true, 2, 1); Modified: branches/1.5.x/library/classes/MUtil/Lazy.php =================================================================== --- branches/1.5.x/library/classes/MUtil/Lazy.php 2012-02-02 17:01:28 UTC (rev 448) +++ branches/1.5.x/library/classes/MUtil/Lazy.php 2012-02-05 16:22:26 UTC (rev 449) @@ -73,6 +73,20 @@ return new MUtil_Lazy_Call($lambda, array($opLeft, $opRight)); } + /** + * The arguments are flattened lazily into one single array + * and then joined together without separator. + * + * @param mixed $arg_array + * @return MUtil_Lazy_Call + */ + public static function concat($arg_array = null) + { + $args = func_get_args(); + + return new MUtil_Lazy_Call('implode', array('', new MUtil_Lazy_Call('MUtil_Ra::flatten', $args))); + } + public static function first($args_array) { $args = func_get_args(); Modified: branches/1.5.x/library/snippets/AddTracksSnippet.php =================================================================== --- branches/1.5.x/library/snippets/AddTracksSnippet.php 2012-02-02 17:01:28 UTC (rev 448) +++ branches/1.5.x/library/snippets/AddTracksSnippet.php 2012-02-05 16:22:26 UTC (rev 449) @@ -84,6 +84,28 @@ */ public $session; + /** + * Switch to set display of respondent dropdown on or off + * + * @var boolean + */ + public $showForRespondents = true; + + /** + * Switch to set display of staff dropdown on or off + * + * @var boolean + */ + public $showForStaff = true; + + + /** + * Switch to set display of track dropdown on or off + * + * @var boolean + */ + public $showForTracks = true; + protected function _getTracks($trackType, $pageRef) { switch ($trackType) { @@ -193,6 +215,10 @@ */ public function getHtmlOutput(Zend_View_Abstract $view) { + if (! $this->escort) { + $this->escort = GemsEscort::getInstance(); + } + if ($this->escort instanceof Gems_Project_Tracks_MultiTracksInterface || $this->escort instanceof Gems_Project_Tracks_StandAloneSurveysInterface) { @@ -200,12 +226,16 @@ $addToLists = MUtil_Html::create()->div(array('class' => 'tooldock')); $addToLists->strong($this->_('Add')); - if ($this->escort instanceof Gems_Project_Tracks_MultiTracksInterface) { + if ($this->showForTracks && ($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); + if ($this->showForRespondents) { + $addToLists[] = $this->_getTracks('S', $pageRef); + } + if ($this->showForStaff) { + $addToLists[] = $this->_getTracks('M', $pageRef); + } } return $addToLists; Modified: branches/1.5.x/library/snippets/RespondentTokenSnippet.php =================================================================== --- branches/1.5.x/library/snippets/RespondentTokenSnippet.php 2012-02-02 17:01:28 UTC (rev 448) +++ branches/1.5.x/library/snippets/RespondentTokenSnippet.php 2012-02-05 16:22:26 UTC (rev 449) @@ -186,7 +186,8 @@ */ protected function processFilterAndSort(MUtil_Model_ModelAbstract $model) { - $filter['gto_id_respondent'] = $this->respondentData['grs_id_user']; + $filter['gto_id_respondent'] = $this->respondentData['grs_id_user']; + $filter['gto_id_organization'] = $this->respondentData['gr2o_id_organization']; $filter[] = 'gr2t_reception_code IN (SELECT grc_id_reception_code FROM gems__reception_codes WHERE grc_success = 1)'; $filter['grc_success'] = 1; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |