From: <gem...@li...> - 2011-09-22 09:31:30
|
Revision: 69 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=69&view=rev Author: mennodekker Date: 2011-09-22 09:31:24 +0000 (Thu, 22 Sep 2011) Log Message: ----------- fixed logging of export Modified Paths: -------------- trunk/library/classes/Gems/Default/ExportAction.php Modified: trunk/library/classes/Gems/Default/ExportAction.php =================================================================== --- trunk/library/classes/Gems/Default/ExportAction.php 2011-09-22 09:30:10 UTC (rev 68) +++ trunk/library/classes/Gems/Default/ExportAction.php 2011-09-22 09:31:24 UTC (rev 69) @@ -161,7 +161,7 @@ $element->setLabel($this->_('Survey')) ->setMultiOptions($surveys); $elements[] = $element; - + //Add a field to the form showing the record count. If this is too slow for large recordsets //then remove it or make it more efficient unset($data['records']); @@ -246,9 +246,9 @@ if (isset($data['type'])) { //Do the logging - $message = join(', ', $data); + $message = Zend_Json::encode($data); Gems_AccessLog::getLog()->log('export', $this->getRequest(), $message, null, true); - + //And delegate the export to the right class $exportClass = $this->export->getExport($data['type']); $exportClass->handleExport($data, $survey, $answers, $answerModel, $language); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2011-10-12 08:40:16
|
Revision: 94 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=94&view=rev Author: mennodekker Date: 2011-10-12 08:40:10 +0000 (Wed, 12 Oct 2011) Log Message: ----------- Some cleanup and a little formatting Modified Paths: -------------- trunk/library/classes/Gems/Default/ExportAction.php Modified: trunk/library/classes/Gems/Default/ExportAction.php =================================================================== --- trunk/library/classes/Gems/Default/ExportAction.php 2011-10-12 08:26:48 UTC (rev 93) +++ trunk/library/classes/Gems/Default/ExportAction.php 2011-10-12 08:40:10 UTC (rev 94) @@ -124,14 +124,10 @@ $form = $this->getForm($data); + //Make the form 'autosubmit' so it can refresh $form->setAttrib('id', 'autosubmit'); $form->setAutoSubmit(MUtil_Html::attrib('href', array('action' => 'index', MUtil_Model::TEXT_FILTER => null, 'RouteReset' => true)), 'mainform'); - //$this->html[] = new Gems_JQuery_AutoSubmitForm(MUtil_Html::attrib('href', array('action' => 'index', MUtil_Model::TEXT_FILTER => null, 'RouteReset' => true)), 'mainform', $form); - if ($request->isPost()) { - $form->populate($data); - } - if ($data) { $form->populate($data); } @@ -147,19 +143,18 @@ public function getForm(&$data) { //Read some data from tables, initialize defaults... - $surveys = $this->db->fetchPairs('SELECT gsu_id_survey, gsu_survey_name FROM gems__surveys WHERE gsu_active = 1 ORDER BY gsu_survey_name'); + $surveys = $this->db->fetchPairs('SELECT gsu_id_survey, gsu_survey_name FROM gems__surveys WHERE gsu_active = 1 ORDER BY gsu_survey_name'); $organizations = $this->escort->getAllowedOrganizations(); - $types = $this->export->getExportClasses(); + $types = $this->export->getExportClasses(); //Create the basic form $form = new Gems_Form_TableForm(); - $form->loadDefaultDecorators(); $form->removeDecorator('TabPane'); //Start adding elements $element = new Zend_Form_Element_Select('sid'); $element->setLabel($this->_('Survey')) - ->setMultiOptions($surveys); + ->setMultiOptions($surveys); $elements[] = $element; //Add a field to the form showing the record count. If this is too slow for large recordsets @@ -180,15 +175,16 @@ $element = new Zend_Form_Element_MultiCheckbox('oid'); $element->setLabel($this->_('Organization')) - ->setMultiOptions($organizations); + ->setMultiOptions($organizations); $elements[] = $element; + $element = new Gems_JQuery_Form_Element_ToggleCheckboxes('toggleOrg', array('selector'=>'input[name^=oid]')); $element->setLabel('Toggle'); $elements[] = $element; $element = new Zend_Form_Element_Select('type'); $element->setLabel($this->_('Export to')) - ->setMultiOptions($types); + ->setMultiOptions($types); $elements[] = $element; //Add all elements to the form @@ -198,8 +194,9 @@ //Now make a change for the selected export type if (isset($data['type'])) { $exportClass = $this->export->getExport($data['type']); - $formFields = $exportClass->getFormElements($form, $data); - $exportName = $exportClass->getName(); + $formFields = $exportClass->getFormElements($form, $data); + $exportName = $exportClass->getName(); + //Now add a hidden field so we know that when this is present in the $data //we don't need to set the defaults $formFields[] = new Zend_Form_Element_Hidden($exportName); @@ -216,7 +213,7 @@ //Finally create a submit button and add to the form $element = new Zend_Form_Element_Submit('export'); $element->setLabel('Export') - ->setAttrib('class', 'button'); + ->setAttrib('class', 'button'); $form->addElement($element); return $form; @@ -231,12 +228,13 @@ { $language = $this->locale->getLanguage(); $emptyMsg = sprintf($this->_('No %s found.'), $this->getTopic(0)); - $gsu_id = intval($data['sid']); - $survey = $this->loader->getTracker()->getSurvey($gsu_id); + $gsu_id = intval($data['sid']); + $survey = $this->loader->getTracker()->getSurvey($gsu_id); - $filter = $this->_getFilter($data); - $answers = $survey->getRawTokenAnswerRows($filter); + $filter = $this->_getFilter($data); + $answers = $survey->getRawTokenAnswerRows($filter); $answerModel = $survey->getAnswerModel($language); + //Now add the organization id => name mapping $answerModel->set('organizationid', 'multiOptions', $this->escort->getAllowedOrganizations()); @@ -255,6 +253,15 @@ } } + /** + * Convert the submitted form-data to a filter to be used for retrieving the data to export + * + * Now only handles the organization ID and consent codes, but can be extended to + * include track info or perform some checks + * + * @param array $data + * @return array + */ public function _getFilter($data) { $filter = array(); if (isset($data['oid'])) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
[Gemstracker-svn] SF.net SVN: gemstracker:[971]
trunk/library/classes/Gems/Default/ ExportAction.php
From: <gem...@li...> - 2012-10-02 14:39:06
|
Revision: 971 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=971&view=rev Author: mennodekker Date: 2012-10-02 14:38:55 +0000 (Tue, 02 Oct 2012) Log Message: ----------- removed search parameter in submiturl (probably copy/pasted) Modified Paths: -------------- trunk/library/classes/Gems/Default/ExportAction.php Modified: trunk/library/classes/Gems/Default/ExportAction.php =================================================================== --- trunk/library/classes/Gems/Default/ExportAction.php 2012-10-02 09:54:51 UTC (rev 970) +++ trunk/library/classes/Gems/Default/ExportAction.php 2012-10-02 14:38:55 UTC (rev 971) @@ -314,7 +314,7 @@ //Make the form 'autosubmit' so it can refresh $form->setAttrib('id', 'autosubmit'); - $form->setAutoSubmit(MUtil_Html::attrib('href', array('action' => 'index', MUtil_Model::TEXT_FILTER => null, 'RouteReset' => true)), 'mainform'); + $form->setAutoSubmit(MUtil_Html::attrib('href', array('action' => 'index', 'RouteReset' => true)), 'mainform'); if ($data) { $form->populate($data); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gem...@li...> - 2011-10-13 07:21:51
|
Revision: 97 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=97&view=rev Author: mennodekker Date: 2011-10-13 07:21:45 +0000 (Thu, 13 Oct 2011) Log Message: ----------- removed obsolete line Modified Paths: -------------- trunk/library/classes/Gems/Default/ExportAction.php Modified: trunk/library/classes/Gems/Default/ExportAction.php =================================================================== --- trunk/library/classes/Gems/Default/ExportAction.php 2011-10-13 07:21:15 UTC (rev 96) +++ trunk/library/classes/Gems/Default/ExportAction.php 2011-10-13 07:21:45 UTC (rev 97) @@ -149,7 +149,6 @@ //Create the basic form $form = new Gems_Form_TableForm(); - $form->removeDecorator('TabPane'); //Start adding elements $element = new Zend_Form_Element_Select('sid'); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |