From: <gem...@li...> - 2012-05-18 10:29:36
|
Revision: 686 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=686&view=rev Author: michieltcs Date: 2012-05-18 10:29:26 +0000 (Fri, 18 May 2012) Log Message: ----------- Show track fields, list of tokens, only show answers of completed tokens Modified Paths: -------------- trunk/library/classes/Gems/Default/RespondentExportAction.php Modified: trunk/library/classes/Gems/Default/RespondentExportAction.php =================================================================== --- trunk/library/classes/Gems/Default/RespondentExportAction.php 2012-05-16 15:11:59 UTC (rev 685) +++ trunk/library/classes/Gems/Default/RespondentExportAction.php 2012-05-18 10:29:26 UTC (rev 686) @@ -75,16 +75,29 @@ */ protected function _exportTrackTokens(Gems_Tracker_RespondentTrack $track) { + $table = $this->html->table(array('class' => 'browser')); + $table->th($this->_('Survey')) + ->th($this->_('Round')) + ->th($this->_('Token')) + ->th($this->_('Completed')); + + $this->html->br(); + $token = $track->getFirstToken(); - + while ($token) { - $this->html->span()->b($token->getSurveyName() . ($token->getRoundDescription() ? ' (' . $token->getRoundDescription() . ')' : '')); - //$this->addSnippets($token->getAnswerSnippetNames(), 'token', $token, 'tokenId', $token->getTokenId(), - // 'showHeaders', false, 'showButtons', false, 'showSelected', false, 'showTakeButton', false); - $this->addSnippet('AnswerModelSnippet', 'token', $token, 'tokenId', $token->getTokenId(), - 'showHeaders', false, 'showButtons', false, 'showSelected', false, 'showTakeButton', false); + $table->tr()->td($token->getSurveyName()) + ->td($token->getRoundDescription()) + ->td(strtoupper($token->getTokenId())) + ->td(($token->isCompleted() ? $this->_('Yes') : $this->_('No'))); - $this->html->br(); + if ($token->isCompleted()) { + $this->html->span()->b($token->getSurveyName() . ($token->getRoundDescription() ? ' (' . $token->getRoundDescription() . ')' : '')); + $this->addSnippet('AnswerModelSnippet', 'token', $token, 'tokenId', $token->getTokenId(), + 'showHeaders', false, 'showButtons', false, 'showSelected', false, 'showTakeButton', false); + + $this->html->br(); + } $token = $token->getNextToken(); } @@ -123,7 +136,17 @@ } } - $this->html[] = $bridge->getTable(); + $table = $bridge->getTable(); + + foreach ($track->getFieldData() as $field => $value) { + if (is_int($field)) { + continue; + } + + $table->tr()->th($field)->td($value); + } + + $this->html[] = $table; $this->html->br(); $this->_exportTrackTokens($track); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-05-20 19:48:30
|
Revision: 693 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=693&view=rev Author: mennodekker Date: 2012-05-20 19:48:24 +0000 (Sun, 20 May 2012) Log Message: ----------- layoutswitch is only for multi-layout projects Modified Paths: -------------- trunk/library/classes/Gems/Default/RespondentExportAction.php Modified: trunk/library/classes/Gems/Default/RespondentExportAction.php =================================================================== --- trunk/library/classes/Gems/Default/RespondentExportAction.php 2012-05-18 14:45:28 UTC (rev 692) +++ trunk/library/classes/Gems/Default/RespondentExportAction.php 2012-05-20 19:48:24 UTC (rev 693) @@ -217,7 +217,9 @@ $this->_exportRespondent($respondentId); $this->escort->menu->setVisible(false); - $this->escort->layoutSwitch(); + if ($this->escort instanceof Gems_Project_Layout_MultiLayoutInterface) { + $this->escort->layoutSwitch(); + } $this->escort->postDispatch($this->getRequest()); $this->_helper->layout()->disableLayout(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-05-29 10:52:57
|
Revision: 701 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=701&view=rev Author: michieltcs Date: 2012-05-29 10:52:46 +0000 (Tue, 29 May 2012) Log Message: ----------- Include option to group surveys Modified Paths: -------------- trunk/library/classes/Gems/Default/RespondentExportAction.php Modified: trunk/library/classes/Gems/Default/RespondentExportAction.php =================================================================== --- trunk/library/classes/Gems/Default/RespondentExportAction.php 2012-05-24 13:29:00 UTC (rev 700) +++ trunk/library/classes/Gems/Default/RespondentExportAction.php 2012-05-29 10:52:46 UTC (rev 701) @@ -60,6 +60,10 @@ $element->setLabel($this->_('Respondent number')); $form->addElement($element); + $element = new Zend_Form_Element_Checkbox('group'); + $element->setLabel($this->_('Group surveys')); + $form->addElement($element); + $element = new Zend_Form_Element_Submit('export'); $element->setLabel($this->_('Export')) ->setAttrib('class', 'button'); @@ -75,30 +79,40 @@ */ protected function _exportTrackTokens(Gems_Tracker_RespondentTrack $track) { + $groupSurveys = $this->getRequest()->getParam('group'); + $token = $track->getFirstToken(); $engine = $track->getTrackEngine(); + $surveys = array(); $table = $this->html->table(array('class' => 'browser')); $table->th($this->_('Survey')) ->th($this->_('Round')) ->th($this->_('Token')) ->th($this->_('Completed')); - $this->html->br(); - $token = $track->getFirstToken(); - while ($token) { $table->tr()->td($token->getSurveyName()) ->td(($engine->getTrackType() == 'T' ? $token->getRoundDescription() : $this->_('Single Survey'))) ->td(strtoupper($token->getTokenId())) ->td(($token->isCompleted() ? $this->_('Yes') : $this->_('No'))); - if ($token->isCompleted()) { + if (($engine->getTrackType() == 'S' || !$groupSurveys) && $token->isCompleted()) { $this->html->span()->b($token->getSurveyName() . ($token->getRoundDescription() ? ' (' . $token->getRoundDescription() . ')' : '')); $this->addSnippet('AnswerModelSnippet', 'token', $token, 'tokenId', $token->getTokenId(), 'showHeaders', false, 'showButtons', false, 'showSelected', false, 'showTakeButton', false); $this->html->br(); + } else { + if (!isset($surveys[$token->getSurveyId()])) { + $surveys[$token->getSurveyId()] = true; + + $this->html->span()->b($token->getSurveyName()); + $this->addSnippet('TrackAnswersModelSnippet', 'token', $token, 'tokenId', $token->getTokenId(), + 'showHeaders', false, 'showButtons', false, 'showSelected', false, 'showTakeButton', false); + + $this->html->br(); + } } $token = $token->getNextToken(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-05-30 14:05:35
|
Revision: 706 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=706&view=rev Author: michieltcs Date: 2012-05-30 14:05:24 +0000 (Wed, 30 May 2012) Log Message: ----------- Add support for conversion to pdf by means of wkhtmltopdf Modified Paths: -------------- trunk/library/classes/Gems/Default/RespondentExportAction.php Modified: trunk/library/classes/Gems/Default/RespondentExportAction.php =================================================================== --- trunk/library/classes/Gems/Default/RespondentExportAction.php 2012-05-30 14:02:15 UTC (rev 705) +++ trunk/library/classes/Gems/Default/RespondentExportAction.php 2012-05-30 14:05:24 UTC (rev 706) @@ -45,6 +45,17 @@ class Gems_Default_RespondentExportAction extends Gems_Controller_Action { public $useHtmlView = true; + + protected $_wkhtmltopdfLocation = ""; + + public function init() + { + parent::init(); + + if (isset($this->project->export['wkhtmltopdf'])) { + $this->_wkhtmltopdfLocation = $this->project->export['wkhtmltopdf']; + } + } /** * Constructs the form @@ -64,6 +75,16 @@ $element->setLabel($this->_('Group surveys')); $form->addElement($element); + $outputFormats = array('html' => 'HTML'); + if (!empty($this->_wkhtmltopdfLocation)) { + $outputFormats['pdf'] = 'PDF'; + } + + $element = new Zend_Form_Element_Select('format'); + $element->setLabel($this->_('Output format')); + $element->setMultiOptions($outputFormats); + $form->addElement($element); + $element = new Zend_Form_Element_Submit('export'); $element->setLabel($this->_('Export')) ->setAttrib('class', 'button'); @@ -71,7 +92,39 @@ return $form; } + + /** + * Calls 'wkhtmltopdf' to convert HTML to PDF + * + * @param string $content The HTML source + * @return string The converted PDF file + * @throws Exception + */ + protected function _convertToPdf($content) + { + $tempInputFilename = tempnam(sys_get_temp_dir(), 'gemshtml') . '.html'; + $tempOutputFilename = tempnam(sys_get_temp_dir(), 'gemspdf') . '.pdf'; + if (empty($tempInputFilename) || empty($tempOutputFilename)) { + throw new Exception("Unable to create temporary file(s)"); + } + + file_put_contents($tempInputFilename, $content); + + $lastLine = exec($this->_wkhtmltopdfLocation . ' ' . $tempInputFilename . ' ' . $tempOutputFilename, $outputLines, $return); + + if ($return > 0) { + throw new Exception("Unable to run PDF conversion: {$lastLine}"); + } + + $pdfContents = file_get_contents($tempOutputFilename); + + @unlink($tempInputFilename); + @unlink($tempOutputFilename); + + return $pdfContents; + } + /** * Exports all the tokens of a single track, grouped by round * @@ -239,10 +292,23 @@ $this->_helper->layout()->disableLayout(); $this->_helper->viewRenderer->setNoRender(true); - $htmlData = $this->html->render($this->view); - $this->view->layout()->content = $htmlData; + $this->view->layout()->content = $this->html->render($this->view); - echo $this->view->layout->render(); + $content = $this->view->layout->render(); + + if ($this->getRequest()->getParam('format') == 'pdf') { + $content = $this->_convertToPdf($content); + $filename = 'respondent-export-' . strtolower($respondentId) . '.pdf'; + + header('Content-Type: application/x-download'); + header('Content-Length: '.strlen($content)); + header('Content-Disposition: inline; filename="'.$filename.'"'); + header('Cache-Control: private, max-age=0, must-revalidate'); + header('Pragma: public'); + } + + echo $content; + $this->escort->menu->setVisible(true); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-05-31 09:12:02
|
Revision: 713 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=713&view=rev Author: michieltcs Date: 2012-05-31 09:11:51 +0000 (Thu, 31 May 2012) Log Message: ----------- Use escapeshellarg() to escape the command, delete temp files before throwing exception Modified Paths: -------------- trunk/library/classes/Gems/Default/RespondentExportAction.php Modified: trunk/library/classes/Gems/Default/RespondentExportAction.php =================================================================== --- trunk/library/classes/Gems/Default/RespondentExportAction.php 2012-05-31 08:11:00 UTC (rev 712) +++ trunk/library/classes/Gems/Default/RespondentExportAction.php 2012-05-31 09:11:51 UTC (rev 713) @@ -111,10 +111,13 @@ file_put_contents($tempInputFilename, $content); - $lastLine = exec(escapeshellcmd($this->_wkhtmltopdfLocation) . ' ' . escapeshellarg($tempInputFilename) + $lastLine = exec(escapeshellarg($this->_wkhtmltopdfLocation) . ' ' . escapeshellarg($tempInputFilename) . ' ' . escapeshellarg($tempOutputFilename), $outputLines, $return); if ($return > 0) { + @unlink($tempInputFilename); + @unlink($tempOutputFilename); + throw new Exception(sprintf($this->_('Unable to run PDF conversion: "%s"'), $lastLine)); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-05-31 09:16:10
|
Revision: 714 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=714&view=rev Author: michieltcs Date: 2012-05-31 09:16:04 +0000 (Thu, 31 May 2012) Log Message: ----------- Move names of survey snippets to properties Modified Paths: -------------- trunk/library/classes/Gems/Default/RespondentExportAction.php Modified: trunk/library/classes/Gems/Default/RespondentExportAction.php =================================================================== --- trunk/library/classes/Gems/Default/RespondentExportAction.php 2012-05-31 09:11:51 UTC (rev 713) +++ trunk/library/classes/Gems/Default/RespondentExportAction.php 2012-05-31 09:16:04 UTC (rev 714) @@ -48,6 +48,9 @@ protected $_wkhtmltopdfLocation = ""; + protected $_groupedSurveySnippet = 'AnswerModelSnippet'; + protected $_singleSurveySnippet = 'TrackAnswersModelSnippet'; + public function init() { parent::init(); @@ -156,7 +159,7 @@ if (($engine->getTrackType() == 'S' || !$groupSurveys) && $token->isCompleted()) { $this->html->span()->b($token->getSurveyName() . ($token->getRoundDescription() ? ' (' . $token->getRoundDescription() . ')' : '')); - $this->addSnippet('AnswerModelSnippet', 'token', $token, 'tokenId', $token->getTokenId(), + $this->addSnippet($this->_singleSurveySnippet, 'token', $token, 'tokenId', $token->getTokenId(), 'showHeaders', false, 'showButtons', false, 'showSelected', false, 'showTakeButton', false); $this->html->br(); @@ -165,7 +168,7 @@ $surveys[$token->getSurveyId()] = true; $this->html->span()->b($token->getSurveyName()); - $this->addSnippet('TrackAnswersModelSnippet', 'token', $token, 'tokenId', $token->getTokenId(), + $this->addSnippet($this->_groupedSurveySnippet, 'token', $token, 'tokenId', $token->getTokenId(), 'showHeaders', false, 'showButtons', false, 'showSelected', false, 'showTakeButton', false); $this->html->br(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-05-31 10:04:26
|
Revision: 716 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=716&view=rev Author: michieltcs Date: 2012-05-31 10:04:17 +0000 (Thu, 31 May 2012) Log Message: ----------- Fix wrong survey names Modified Paths: -------------- trunk/library/classes/Gems/Default/RespondentExportAction.php Modified: trunk/library/classes/Gems/Default/RespondentExportAction.php =================================================================== --- trunk/library/classes/Gems/Default/RespondentExportAction.php 2012-05-31 09:17:16 UTC (rev 715) +++ trunk/library/classes/Gems/Default/RespondentExportAction.php 2012-05-31 10:04:17 UTC (rev 716) @@ -48,8 +48,8 @@ protected $_wkhtmltopdfLocation = ""; - protected $_groupedSurveySnippet = 'AnswerModelSnippet'; - protected $_singleSurveySnippet = 'TrackAnswersModelSnippet'; + protected $_groupedSurveySnippet = 'TrackAnswersModelSnippet'; + protected $_singleSurveySnippet = 'AnswerModelSnippet'; public function init() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-05-31 12:22:46
|
Revision: 717 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=717&view=rev Author: michieltcs Date: 2012-05-31 12:22:35 +0000 (Thu, 31 May 2012) Log Message: ----------- Store temporary files in <app>/var/tmp, show message if respondent is not found Modified Paths: -------------- trunk/library/classes/Gems/Default/RespondentExportAction.php Modified: trunk/library/classes/Gems/Default/RespondentExportAction.php =================================================================== --- trunk/library/classes/Gems/Default/RespondentExportAction.php 2012-05-31 10:04:17 UTC (rev 716) +++ trunk/library/classes/Gems/Default/RespondentExportAction.php 2012-05-31 12:22:35 UTC (rev 717) @@ -105,8 +105,8 @@ */ protected function _convertToPdf($content) { - $tempInputFilename = tempnam(sys_get_temp_dir(), 'gemshtml') . '.html'; - $tempOutputFilename = tempnam(sys_get_temp_dir(), 'gemspdf') . '.pdf'; + $tempInputFilename = tempnam(GEMS_ROOT_DIR . '/var/tmp/', 'gemshtml') . '.html'; + $tempOutputFilename = tempnam(GEMS_ROOT_DIR . '/var/tmp/', 'gemspdf') . '.pdf'; if (empty($tempInputFilename) || empty($tempOutputFilename)) { throw new Exception("Unable to create temporary file(s)"); @@ -245,6 +245,11 @@ $respondentModel->setFilter(array('gr2o_patient_nr' => $respondentId)); $respondentData = $respondentModel->loadFirst(); + if (empty($respondentData)) { + $this->html->p()->b(sprintf('Unknown respondent %s', $respondentId)); + return; + } + $bridge = new MUtil_Model_VerticalTableBridge($respondentModel, array('class' => 'browser')); $bridge->setRepeater(MUtil_Lazy::repeat(array($respondentData))); $bridge->th($this->_('Respondent information'), array('colspan' => 4)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-05-31 13:44:46
|
Revision: 719 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=719&view=rev Author: mennodekker Date: 2012-05-31 13:44:35 +0000 (Thu, 31 May 2012) Log Message: ----------- fixed notice Modified Paths: -------------- trunk/library/classes/Gems/Default/RespondentExportAction.php Modified: trunk/library/classes/Gems/Default/RespondentExportAction.php =================================================================== --- trunk/library/classes/Gems/Default/RespondentExportAction.php 2012-05-31 13:36:48 UTC (rev 718) +++ trunk/library/classes/Gems/Default/RespondentExportAction.php 2012-05-31 13:44:35 UTC (rev 719) @@ -55,7 +55,7 @@ { parent::init(); - if (isset($this->project->export['wkhtmltopdf'])) { + if (isset($this->project->export) && isset($this->project->export['wkhtmltopdf'])) { $this->_wkhtmltopdfLocation = $this->project->export['wkhtmltopdf']; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-05-31 20:05:20
|
Revision: 723 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=723&view=rev Author: michieltcs Date: 2012-05-31 20:05:14 +0000 (Thu, 31 May 2012) Log Message: ----------- Fix if statement Modified Paths: -------------- trunk/library/classes/Gems/Default/RespondentExportAction.php Modified: trunk/library/classes/Gems/Default/RespondentExportAction.php =================================================================== --- trunk/library/classes/Gems/Default/RespondentExportAction.php 2012-05-31 15:35:25 UTC (rev 722) +++ trunk/library/classes/Gems/Default/RespondentExportAction.php 2012-05-31 20:05:14 UTC (rev 723) @@ -157,12 +157,14 @@ ->td(strtoupper($token->getTokenId())) ->td(($token->isCompleted() ? $this->_('Yes') : $this->_('No'))); - if (($engine->getTrackType() == 'S' || !$groupSurveys) && $token->isCompleted()) { - $this->html->span()->b($token->getSurveyName() . ($token->getRoundDescription() ? ' (' . $token->getRoundDescription() . ')' : '')); - $this->addSnippet($this->_singleSurveySnippet, 'token', $token, 'tokenId', $token->getTokenId(), - 'showHeaders', false, 'showButtons', false, 'showSelected', false, 'showTakeButton', false); - - $this->html->br(); + if ($engine->getTrackType() == 'S' || !$groupSurveys) { + if ($token->isCompleted()) { + $this->html->span()->b($token->getSurveyName() . ($token->getRoundDescription() ? ' (' . $token->getRoundDescription() . ')' : '')); + $this->addSnippet($this->_singleSurveySnippet, 'token', $token, 'tokenId', $token->getTokenId(), + 'showHeaders', false, 'showButtons', false, 'showSelected', false, 'showTakeButton', false); + + $this->html->br(); + } } else { if (!isset($surveys[$token->getSurveyId()])) { $surveys[$token->getSurveyId()] = true; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-05-31 20:11:41
|
Revision: 724 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=724&view=rev Author: michieltcs Date: 2012-05-31 20:11:35 +0000 (Thu, 31 May 2012) Log Message: ----------- Allow export of multiple respondents Modified Paths: -------------- trunk/library/classes/Gems/Default/RespondentExportAction.php Modified: trunk/library/classes/Gems/Default/RespondentExportAction.php =================================================================== --- trunk/library/classes/Gems/Default/RespondentExportAction.php 2012-05-31 20:05:14 UTC (rev 723) +++ trunk/library/classes/Gems/Default/RespondentExportAction.php 2012-05-31 20:11:35 UTC (rev 724) @@ -72,6 +72,7 @@ $element = new Zend_Form_Element_Text('id'); $element->setLabel($this->_('Respondent number')); + $element->setDescription($this->_('Separate multiple respondents with a comma (,)')); $form->addElement($element); $element = new Zend_Form_Element_Checkbox('group'); @@ -262,6 +263,7 @@ } } + $this->html->h2($respondentId); $this->html[] = $bridge->getTable(); $this->html->hr(); @@ -276,9 +278,9 @@ /** * Renders the entire report (including layout) * - * @param string $respondentId + * @param string[] $respondentId */ - protected function _render($respondentId) + protected function _render($respondents) { $this->html = new MUtil_Html_Sequence(); $this->html->h1($this->_('Respondent report')); @@ -295,7 +297,11 @@ $this->html->br(); - $this->_exportRespondent($respondentId); + foreach ($respondents as $respondentId) { + $this->_exportRespondent($respondentId); + + $this->html->div(array('style' => 'height: 100px')); + } $this->escort->menu->setVisible(false); if ($this->escort instanceof Gems_Project_Layout_MultiLayoutInterface) { @@ -338,11 +344,9 @@ $form->populate($request->getParams()); if ($request->isPost()) { - $respondentId = $request->getParam('id'); + $respondents = explode(',', $request->getParam('id')); - if (!empty($respondentId)) { - $this->_render($respondentId); - } + $this->_render($respondents); } } } \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-05-31 20:57:19
|
Revision: 727 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=727&view=rev Author: michieltcs Date: 2012-05-31 20:57:12 +0000 (Thu, 31 May 2012) Log Message: ----------- Show completed/missed/open Modified Paths: -------------- trunk/library/classes/Gems/Default/RespondentExportAction.php Modified: trunk/library/classes/Gems/Default/RespondentExportAction.php =================================================================== --- trunk/library/classes/Gems/Default/RespondentExportAction.php 2012-05-31 20:52:10 UTC (rev 726) +++ trunk/library/classes/Gems/Default/RespondentExportAction.php 2012-05-31 20:57:12 UTC (rev 727) @@ -149,14 +149,21 @@ $table->th($this->_('Survey')) ->th($this->_('Round')) ->th($this->_('Token')) - ->th($this->_('Completed')); + ->th($this->_('Status')); $this->html->br(); while ($token) { + $missed = false; + $validUntil = $token->getValidUntil(); + + if (!empty($validUntil)) { + $missed = $validUntil->isEarlier(new Zend_Date()); + } + $table->tr()->td($token->getSurveyName()) ->td(($engine->getTrackType() == 'T' ? $token->getRoundDescription() : $this->_('Single Survey'))) ->td(strtoupper($token->getTokenId())) - ->td(($token->isCompleted() ? $this->_('Yes') : $this->_('No'))); + ->td(($token->isCompleted() ? $this->_('Completed') : ($missed ? $this->_('Missed') : $this->_('Open')))); if ($engine->getTrackType() == 'S' || !$groupSurveys) { if ($token->isCompleted()) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-05-31 21:07:52
|
Revision: 728 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=728&view=rev Author: michieltcs Date: 2012-05-31 21:07:46 +0000 (Thu, 31 May 2012) Log Message: ----------- Fix spacer Modified Paths: -------------- trunk/library/classes/Gems/Default/RespondentExportAction.php Modified: trunk/library/classes/Gems/Default/RespondentExportAction.php =================================================================== --- trunk/library/classes/Gems/Default/RespondentExportAction.php 2012-05-31 20:57:12 UTC (rev 727) +++ trunk/library/classes/Gems/Default/RespondentExportAction.php 2012-05-31 21:07:46 UTC (rev 728) @@ -307,7 +307,7 @@ foreach ($respondents as $respondentId) { $this->_exportRespondent($respondentId); - $this->html->div(array('style' => 'height: 100px')); + $this->html->div('', array('style' => 'height: 100px')); } $this->escort->menu->setVisible(false); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-06-01 06:55:50
|
Revision: 729 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=729&view=rev Author: michieltcs Date: 2012-06-01 06:55:43 +0000 (Fri, 01 Jun 2012) Log Message: ----------- No longer use tempnam() to create temporary files Modified Paths: -------------- trunk/library/classes/Gems/Default/RespondentExportAction.php Modified: trunk/library/classes/Gems/Default/RespondentExportAction.php =================================================================== --- trunk/library/classes/Gems/Default/RespondentExportAction.php 2012-05-31 21:07:46 UTC (rev 728) +++ trunk/library/classes/Gems/Default/RespondentExportAction.php 2012-06-01 06:55:43 UTC (rev 729) @@ -106,15 +106,15 @@ */ protected function _convertToPdf($content) { - $tempInputFilename = tempnam(GEMS_ROOT_DIR . '/var/tmp/', 'gemshtml') . '.html'; - $tempOutputFilename = tempnam(GEMS_ROOT_DIR . '/var/tmp/', 'gemspdf') . '.pdf'; + $tempInputFilename = GEMS_ROOT_DIR . '/var/tmp/export-' . md5(time() . rand()) . '.html'; + $tempOutputFilename = GEMS_ROOT_DIR . '/var/tmp/export-' . md5(time() . rand()) . '.pdf'; + + file_put_contents($tempInputFilename, $content); - if (empty($tempInputFilename) || empty($tempOutputFilename)) { - throw new Exception("Unable to create temporary file(s)"); + if (!file_exists($tempInputFilename)) { + throw new Exception("Unable to create temporary file '{$tempInputFilename}'"); } - file_put_contents($tempInputFilename, $content); - $lastLine = exec(escapeshellarg($this->_wkhtmltopdfLocation) . ' ' . escapeshellarg($tempInputFilename) . ' ' . escapeshellarg($tempOutputFilename), $outputLines, $return); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-06-01 12:10:53
|
Revision: 730 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=730&view=rev Author: michieltcs Date: 2012-06-01 12:10:47 +0000 (Fri, 01 Jun 2012) Log Message: ----------- Implement some additional changes - trim respondent ids, change to missing/open/completed/future, some misc bits and bobs Modified Paths: -------------- trunk/library/classes/Gems/Default/RespondentExportAction.php Modified: trunk/library/classes/Gems/Default/RespondentExportAction.php =================================================================== --- trunk/library/classes/Gems/Default/RespondentExportAction.php 2012-06-01 06:55:43 UTC (rev 729) +++ trunk/library/classes/Gems/Default/RespondentExportAction.php 2012-06-01 12:10:47 UTC (rev 730) @@ -72,7 +72,12 @@ $element = new Zend_Form_Element_Text('id'); $element->setLabel($this->_('Respondent number')); - $element->setDescription($this->_('Separate multiple respondents with a comma (,)')); + + // only show description if we got here directly (id is empty) + if ($this->getRequest()->getParam('id') == '') { + $element->setDescription($this->_('Separate multiple respondents with a comma (,)')); + } + $form->addElement($element); $element = new Zend_Form_Element_Checkbox('group'); @@ -141,9 +146,10 @@ protected function _exportTrackTokens(Gems_Tracker_RespondentTrack $track) { $groupSurveys = $this->getRequest()->getParam('group'); - $token = $track->getFirstToken(); - $engine = $track->getTrackEngine(); - $surveys = array(); + $token = $track->getFirstToken(); + $engine = $track->getTrackEngine(); + $today = new Zend_Date(); + $surveys = array(); $table = $this->html->table(array('class' => 'browser')); $table->th($this->_('Survey')) @@ -153,19 +159,27 @@ $this->html->br(); while ($token) { - $missed = false; - $validUntil = $token->getValidUntil(); + $status = $this->_('Open'); - if (!empty($validUntil)) { - $missed = $validUntil->isEarlier(new Zend_Date()); + if ($token->isCompleted()) { + $status = $this->_('Completed'); + } else { + $validFrom = $token->getValidFrom(); + $validUntil = $token->getValidUntil(); + + if (!empty($validUntil) && $validUntil->isEarlier($today)) { + $status = $this->_('Missed'); + } else if (!empty($validFrom) && $validFrom->isLater($today)) { + $status = $this->_('Future'); + } } $table->tr()->td($token->getSurveyName()) ->td(($engine->getTrackType() == 'T' ? $token->getRoundDescription() : $this->_('Single Survey'))) ->td(strtoupper($token->getTokenId())) - ->td(($token->isCompleted() ? $this->_('Completed') : ($missed ? $this->_('Missed') : $this->_('Open')))); + ->td($status); - if ($engine->getTrackType() == 'S' || !$groupSurveys) { + if ($engine->getTrackType() == 'S' || !$groupSurveys) { if ($token->isCompleted()) { $this->html->span()->b($token->getSurveyName() . ($token->getRoundDescription() ? ' (' . $token->getRoundDescription() . ')' : '')); $this->addSnippet($this->_singleSurveySnippet, 'token', $token, 'tokenId', $token->getTokenId(), @@ -270,7 +284,7 @@ } } - $this->html->h2($respondentId); + $this->html->h2($this->_('Respondent information') . ': ' . $respondentId); $this->html[] = $bridge->getTable(); $this->html->hr(); @@ -352,6 +366,7 @@ if ($request->isPost()) { $respondents = explode(',', $request->getParam('id')); + $respondents = array_map('trim', $respondents); $this->_render($respondents); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-06-04 11:58:29
|
Revision: 733 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=733&view=rev Author: michieltcs Date: 2012-06-04 11:58:23 +0000 (Mon, 04 Jun 2012) Log Message: ----------- Change defaults Modified Paths: -------------- trunk/library/classes/Gems/Default/RespondentExportAction.php Modified: trunk/library/classes/Gems/Default/RespondentExportAction.php =================================================================== --- trunk/library/classes/Gems/Default/RespondentExportAction.php 2012-06-03 09:25:41 UTC (rev 732) +++ trunk/library/classes/Gems/Default/RespondentExportAction.php 2012-06-04 11:58:23 UTC (rev 733) @@ -82,15 +82,16 @@ $element = new Zend_Form_Element_Checkbox('group'); $element->setLabel($this->_('Group surveys')); + $element->setValue(1); $form->addElement($element); + $element = new Zend_Form_Element_Select('format'); + $element->setLabel($this->_('Output format')); $outputFormats = array('html' => 'HTML'); if (!empty($this->_wkhtmltopdfLocation)) { $outputFormats['pdf'] = 'PDF'; + $element->setValue('pdf'); } - - $element = new Zend_Form_Element_Select('format'); - $element->setLabel($this->_('Output format')); $element->setMultiOptions($outputFormats); $form->addElement($element); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-06-06 12:12:13
|
Revision: 738 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=738&view=rev Author: michieltcs Date: 2012-06-06 12:12:07 +0000 (Wed, 06 Jun 2012) Log Message: ----------- Add filtering method (useful for overriding classes) Modified Paths: -------------- trunk/library/classes/Gems/Default/RespondentExportAction.php Modified: trunk/library/classes/Gems/Default/RespondentExportAction.php =================================================================== --- trunk/library/classes/Gems/Default/RespondentExportAction.php 2012-06-05 13:33:53 UTC (rev 737) +++ trunk/library/classes/Gems/Default/RespondentExportAction.php 2012-06-06 12:12:07 UTC (rev 738) @@ -138,6 +138,18 @@ return $pdfContents; } + + /** + * Determines if this particular token should be included + * in the report + * + * @param Gems_Tracker_Token $token + * @return boolean This dummy implementation always returns true + */ + protected function _isTokenInFilter(Gems_Tracker_Token $token) + { + return true; + } /** * Exports all the tokens of a single track, grouped by round @@ -160,6 +172,11 @@ $this->html->br(); while ($token) { + if (!$this->_isTokenInFilter($token)) { + $token = $token->getNextToken(); + continue; + } + $status = $this->_('Open'); if ($token->isCompleted()) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-06-08 15:21:53
|
Revision: 749 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=749&view=rev Author: michieltcs Date: 2012-06-08 15:21:47 +0000 (Fri, 08 Jun 2012) Log Message: ----------- Consider tokens with empty valid from AND valid until as future tokens Modified Paths: -------------- trunk/library/classes/Gems/Default/RespondentExportAction.php Modified: trunk/library/classes/Gems/Default/RespondentExportAction.php =================================================================== --- trunk/library/classes/Gems/Default/RespondentExportAction.php 2012-06-08 15:16:57 UTC (rev 748) +++ trunk/library/classes/Gems/Default/RespondentExportAction.php 2012-06-08 15:21:47 UTC (rev 749) @@ -189,6 +189,8 @@ $status = $this->_('Missed'); } else if (!empty($validFrom) && $validFrom->isLater($today)) { $status = $this->_('Future'); + } else if (empty($validFrom) && empty($validUntil)) { + $status = $this->_('Future'); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2012-06-18 08:45:24
|
Revision: 771 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=771&view=rev Author: mennodekker Date: 2012-06-18 08:45:13 +0000 (Mon, 18 Jun 2012) Log Message: ----------- RespondentExport: Moved decision to display a token or skip it to a helper method to allow projects to have their own logic Modified Paths: -------------- trunk/library/classes/Gems/Default/RespondentExportAction.php Modified: trunk/library/classes/Gems/Default/RespondentExportAction.php =================================================================== --- trunk/library/classes/Gems/Default/RespondentExportAction.php 2012-06-18 07:25:26 UTC (rev 770) +++ trunk/library/classes/Gems/Default/RespondentExportAction.php 2012-06-18 08:45:13 UTC (rev 771) @@ -142,6 +142,21 @@ return $pdfContents; } + + /** + * Returns true when this token should be displayed + * + * @param Gems_Tracker_Token $token + * @return boolean + */ + public function _displayToken($token) + { + if ($token->isCompleted()) { + return true; + } + + return false; + } /** * Determines if this particular token should be included @@ -187,7 +202,7 @@ ->td($token->getStatus()); //Should we display the answers? - if (!$token->isCompleted()) { + if (!$this->_displayToken($token)) { $token = $token->getNextToken(); continue; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2013-02-21 15:49:55
|
Revision: 1151 http://sourceforge.net/p/gemstracker/code/1151 Author: matijsdejong Date: 2013-02-21 15:49:51 +0000 (Thu, 21 Feb 2013) Log Message: ----------- Standardized for neater multi id Modified Paths: -------------- trunk/library/classes/Gems/Default/RespondentExportAction.php Modified: trunk/library/classes/Gems/Default/RespondentExportAction.php =================================================================== --- trunk/library/classes/Gems/Default/RespondentExportAction.php 2013-02-20 16:12:24 UTC (rev 1150) +++ trunk/library/classes/Gems/Default/RespondentExportAction.php 2013-02-21 15:49:51 UTC (rev 1151) @@ -69,8 +69,7 @@ $form->populate($request->getParams()); if ($request->isPost()) { - $respondents = preg_split('/[\s,]/', $request->getParam('id')); - $respondents = array_filter(array_map('trim', $respondents)); + $respondents = preg_split('/[\s,;]+/', $request->getParam('id'), -1, PREG_SPLIT_NO_EMPTY); $export->render($respondents, $this->getRequest()->getParam('group'), $this->getRequest()->getParam('format')); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |