/**
  * Create the snippets content
  *
  * This is a stub function either override getHtmlOutput() or override render()
  *
  * @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)
 {
     $url = $view->url(array('action' => 'export'));
     $container = \MUtil_Html::div(array('id' => 'export-container'));
     $button = $container->button(array($this->_('Export'), 'id' => 'modelExport'));
     return $container;
 }
예제 #2
0
 public function testDiv()
 {
     $div = MUtil_Html::div('bar', array('id' => 'foo'));
     $this->assertInstanceOf('MUtil_Html_HtmlElement', $div);
     $this->assertEquals('div', $div->getTagName());
     $this->assertEquals('foo', $div->getAttrib('id'));
 }
 public function getHtmlOutput(\Zend_View_Abstract $view)
 {
     $post = $this->request->getPost();
     $export = $this->loader->getExport();
     $exportTypes = $export->getExportClasses();
     if (isset($post['type'])) {
         $currentType = $post['type'];
     } else {
         reset($exportTypes);
         $currentType = key($exportTypes);
     }
     if (\MUtil_Bootstrap::enabled()) {
         $form = new \Gems_Form(array('id' => 'exportOptionsForm', 'class' => 'form-horizontal'));
     } else {
         $form = new \Gems_Form_TableForm();
     }
     $url = $view->url() . '/step/batch';
     $form->setAction($url);
     $elements = array();
     $elements['type'] = $form->createElement('select', 'type', array('label' => $this->_('Export to'), 'multiOptions' => $exportTypes, 'class' => 'autosubmit'));
     $form->addElements($elements);
     $exportClass = $export->getExport($currentType);
     $exportName = $exportClass->getName();
     $exportFormElements['firstCheck'] = $form->createElement('hidden', $currentType);
     $exportFormElements = $exportClass->getFormElements($form, $data);
     if ($exportFormElements) {
         $form->addElements($exportFormElements);
     }
     if (!isset($post[$currentType])) {
         $post[$exportName] = $exportClass->getDefaultFormValues();
     }
     $element = $form->createElement('submit', 'export_submit', array('label' => $this->_('Export')));
     $form->addElement($element);
     if ($post) {
         $form->populate($post);
     }
     $container = \MUtil_Html::div(array('id' => 'export-form'));
     $container->append($form);
     $form->setAttrib('id', 'autosubmit');
     $form->setAutoSubmit(\MUtil_Html::attrib('href', array('action' => $this->request->getActionName(), 'RouteReset' => true)), 'export-form', true);
     return $container;
 }
 /**
  * Create the snippets content
  *
  * This is a stub function either override getHtmlOutput() or override render()
  *
  * @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)
 {
     if ($table = parent::getHtmlOutput($view)) {
         if ($title = $this->getTitle()) {
             $htmlDiv = \MUtil_Html::div();
             $htmlDiv->h3($title);
             $this->applyHtmlAttributes($table);
             $htmlDiv[] = $table;
             return $htmlDiv;
         } else {
             return $table;
         }
     }
 }
 /**
  * Create the snippets content
  *
  * This is a stub function either override getHtmlOutput() or override render()
  *
  * @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)
 {
     $htmlDiv = \MUtil_Html::div();
     $htmlDiv->h3($this->getTitle(), array('class' => 'title'));
     $form = parent::getHtmlOutput($view);
     $htmlDiv[] = $form;
     return $htmlDiv;
 }
 public function getHtmlOutput(\Zend_View_Abstract $view)
 {
     $post = $this->request->getPost();
     $currentTrack = null;
     if (isset($post['gto_id_track'])) {
         $currentTrack = $post['gto_id_track'];
     }
     $currentRound = null;
     if (isset($post['gto_round_description'])) {
         $currentRound = $post['gto_round_description'];
     }
     $export = $this->loader->getExport();
     $exportTypes = $export->getExportClasses();
     if (isset($post['type'])) {
         $currentType = $post['type'];
     } else {
         reset($exportTypes);
         $currentType = key($exportTypes);
     }
     $dbLookup = $this->util->getDbLookup();
     $translated = $this->util->getTranslated();
     $noRound = array(self::NoRound => $this->_('No round description'));
     $empty = $translated->getEmptyDropdownArray();
     $tracks = $empty + $this->util->getTrackData()->getAllTracks();
     $rounds = $empty + $noRound + $dbLookup->getRoundsForExport($currentTrack);
     $surveys = $dbLookup->getSurveysForExport($currentTrack, $currentRound, true);
     $organizations = $this->currentUser->getRespondentOrganizations();
     if (\MUtil_Bootstrap::enabled()) {
         $this->form = new \Gems_Form(array('class' => 'form-horizontal'));
     } else {
         $this->form = new \Gems_Form_TableForm();
     }
     $url = \MUtil_Html::attrib('href', array('action' => 'index', 'step' => 'batch'));
     $this->form->setAction($url);
     $elements = array();
     $elements['gto_id_track'] = $this->form->createElement('select', 'gto_id_track', array('label' => $this->_('Track'), 'multiOptions' => $tracks, 'class' => 'autosubmit'));
     if (isset($post['gto_id_track']) && $post['gto_id_track']) {
         $element = $this->form->createElement('checkbox', 'add_track_fields');
         $element->setLabel($this->_('Track fields'));
         $element->setDescription($this->_('Add track fields to export'));
         $elements['add_track_fields'] = $element;
         if (!array_key_exists('add_track_fields', $post)) {
             $post['add_track_fields'] = 1;
         }
     }
     $elements['gto_round_description'] = $this->form->createElement('select', 'gto_round_description', array('label' => $this->_('Round'), 'multiOptions' => $rounds, 'class' => 'autosubmit'));
     $elements['gto_id_survey'] = $this->form->createElement('multiCheckbox', 'gto_id_survey', array('label' => $this->_('Survey'), 'multiOptions' => $surveys));
     $elements['gto_id_survey']->setRequired(true);
     $elements['gto_id_survey']->setSeparator('');
     if (\MUtil_Bootstrap::enabled()) {
         $element = new \MUtil_Bootstrap_Form_Element_ToggleCheckboxes('toggleOrg', array('selector' => 'input[name^=gto_id_survey]'));
     } else {
         $element = new \Gems_JQuery_Form_Element_ToggleCheckboxes('toggleOrg', array('selector' => 'input[name^=gto_id_survey]'));
     }
     $element->setLabel($this->_('Toggle'));
     $elements[] = $element;
     if (count($organizations) > 1) {
         $elements['gto_id_organization'] = $this->form->createElement('multiCheckbox', 'gto_id_organization', array('label' => $this->_('Organizations'), 'multiOptions' => $organizations));
         if (\MUtil_Bootstrap::enabled()) {
             $element = new \MUtil_Bootstrap_Form_Element_ToggleCheckboxes('toggleOrg', array('selector' => 'input[name^=gto_id_organization]'));
         } else {
             $element = new \Gems_JQuery_Form_Element_ToggleCheckboxes('toggleOrg', array('selector' => 'input[name^=gto_id_organization]'));
         }
         $element->setLabel($this->_('Toggle'));
         $elements[] = $element;
     }
     $dates = array('gto_start_date' => $this->_('Track start'), 'gto_end_date' => $this->_('Track end'), 'gto_valid_from' => $this->_('Valid from'), 'gto_valid_until' => $this->_('Valid until'));
     // $dates = 'gto_valid_from';
     $periodElements = $this->getPeriodSelectors($dates, 'gto_valid_from');
     $elements += $periodElements;
     $element = $this->form->createElement('textarea', 'ids');
     $element->setLabel($this->_('Respondent id\'s'))->setAttrib('cols', 60)->setAttrib('rows', 4)->setDescription($this->_("Not respondent nr, but respondent id as exported here. Separate multiple id's with , or ;"));
     $elements[] = $element;
     $element = $this->form->createElement('checkbox', 'column_identifiers');
     $element->setLabel($this->_('Column Identifiers'));
     $element->setDescription($this->_('Prefix the column labels with an identifier. (A) Answers, (TF) Trackfields, (D) Description'));
     $elements['column_identifiers'] = $element;
     $element = $this->form->createElement('checkbox', 'show_parent');
     $element->setLabel($this->_('Show parent'));
     $element->setDescription($this->_('Show the parent column even if it doesn\'t have answers'));
     $elements['show_parent'] = $element;
     $element = $this->form->createElement('checkbox', 'prefix_child');
     $element->setLabel($this->_('Prefix child'));
     $element->setDescription($this->_('Prefix the child column labels with parent question label'));
     $elements['prefix_child'] = $element;
     $elements['type'] = $this->form->createElement('select', 'type', array('label' => $this->_('Export to'), 'multiOptions' => $exportTypes, 'class' => 'autosubmit'));
     $this->form->addElements($elements);
     $exportClass = $export->getExport($currentType);
     $exportName = $exportClass->getName();
     $exportFormElements = $exportClass->getFormElements($this->form, $data);
     if ($exportFormElements) {
         $exportFormElements['firstCheck'] = $this->form->createElement('hidden', $currentType);
         $exportFormElements['firstCheck']->setBelongsTo($exportName);
         $this->form->addElements($exportFormElements);
     }
     if (!isset($post[$currentType])) {
         $post[$exportName] = $exportClass->getDefaultFormValues();
     }
     $element = $this->form->createElement('submit', 'export_submit', array('label' => $this->_('Export')));
     $this->form->addElement($element);
     if ($post) {
         $this->form->populate($post);
     }
     $container = \MUtil_Html::div(array('id' => 'export-surveys-form'));
     $container->append($this->form);
     $this->form->setAttrib('id', 'autosubmit');
     $this->form->setAutoSubmit(\MUtil_Html::attrib('href', array('action' => 'index', 'RouteReset' => true)), 'export-surveys-form', true);
     return $container;
 }
 /**
  * Create the snippets content
  *
  * This is a stub function either override getHtmlOutput() or override render()
  *
  * @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)
 {
     if ($this->roundId) {
         $htmlDiv = \MUtil_Html::div();
         if ($this->showTitle) {
             $htmlDiv->h3(sprintf($this->_('%s round'), $this->trackEngine->getName()));
         }
         $table = parent::getHtmlOutput($view);
         $this->applyHtmlAttributes($table);
         // Make sure deactivated rounds are show as deleted
         foreach ($table->tbody() as $tr) {
             $skip = true;
             foreach ($tr as $td) {
                 if ($skip) {
                     $skip = false;
                 } else {
                     $td->appendAttrib('class', $table->getRepeater()->row_class);
                 }
             }
         }
         if ($this->showMenu) {
             $table->tfrow($this->getMenuList(), array('class' => 'centerAlign'));
         }
         $htmlDiv[] = $table;
         return $htmlDiv;
     } else {
         $this->addMessage($this->_('No round specified.'));
     }
 }
 /**
  * Create the snippets content
  *
  * This is a stub function either override getHtmlOutput() or override render()
  *
  * @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)
 {
     // If there is data, populate
     if (!empty($this->formData)) {
         $this->form->populate($this->formData);
     }
     if ($this->mailer->bounceCheck()) {
         $this->addMessage($this->_('On this test system all mail will be delivered to the from address.'));
     }
     $this->beforeDisplay();
     $htmlDiv = \MUtil_Html::div();
     $htmlDiv->h3($this->getTitle());
     $htmlDiv[] = $this->form;
     return $htmlDiv;
 }
 /**
  * Create the snippets content
  *
  * This is a stub function either override getHtmlOutput() or override render()
  *
  * @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)
 {
     if ($this->tokenId) {
         if ($this->token->exists) {
             $htmlDiv = \MUtil_Html::div();
             $htmlDiv->h3($this->getTitle());
             $table = parent::getHtmlOutput($view);
             $this->applyHtmlAttributes($table);
             $htmlDiv[] = $table;
             return $htmlDiv;
         } else {
             $this->addMessage(sprintf($this->_('Token %s not found.'), $this->tokenId));
         }
     } else {
         $this->addMessage($this->_('No token specified.'));
     }
 }