Esempio n. 1
0
 /**
  * Add the columns to the table
  *
  * This is a default implementation, overrule at will
  *
  * @param \MUtil_Html_TableElement $table
  */
 protected function addColumns(\MUtil_Html_TableElement $table)
 {
     if ($this->data) {
         $row = reset($this->data);
     } else {
         $this->repeater->__start();
         $row = $this->repeater->__current();
     }
     foreach ($row as $name => $value) {
         $table->addColumn($this->repeater->{$name}, $name);
     }
 }
 /**
  * Add the columns ot the table
  *
  * This is a default implementation, overrule at will
  *
  * @param \MUtil_Html_TableElement $table
  */
 protected function addColumns(\MUtil_Html_TableElement $table)
 {
     $table->addColumn(array(\MUtil_Html::raw($this->repeater->key), 'class' => $this->repeater->class), $this->_('Question code'));
     $table->addColumn(array(\MUtil_Html::raw($this->repeater->question), 'class' => $this->repeater->class), $this->_('Question'));
     $table->addColumn($this->repeater->answers->call($this, 'showAnswers', $this->repeater->answers), $this->_('Answer options'));
     // $table->addColumn($this->repeater->type, 'Type');
 }
 /**
  * Add the columns to the table
  *
  * @param \MUtil_Html_TableElement $table
  */
 protected function addColumns(\MUtil_Html_TableElement $table)
 {
     foreach ($this->columns as $name => $label) {
         $table->addColumn($this->repeater->{$name}, $label);
     }
 }
 public function getFieldTable($id)
 {
     $tData = $this->getModel()->loadTable($id);
     if (!$tData) {
         return sprintf($this->_('%s no longer exists in the database.'), $id);
     }
     if (\Gems_Model_DbaModel::STATE_DEFINED == $tData['state']) {
         return sprintf($this->_('%s does not yet exist in the database.'), ucfirst($tData['type']));
     }
     if ('table' !== $tData['type']) {
         return sprintf($this->_('%s object does exist.'), ucfirst($tData['type']));
     }
     try {
         $table = new \Zend_DB_Table(array(\Zend_Db_Table_Abstract::NAME => $id, \Zend_Db_Table_Abstract::ADAPTER => $tData['db']));
         $data = \MUtil_Lazy::repeat($table->info('metadata'));
         $html = new \MUtil_Html_TableElement($data);
         $html->addColumn($data->COLUMN_NAME, 'Column');
         $html->addColumn($data->DATA_TYPE, 'Type');
         $html->addColumn($data->LENGTH, 'Length');
         $html->addColumn($data->SCALE, 'Precision');
         $html->addColumn($data->UNSIGNED, 'Unsigned');
         $html->addColumn($data->NULLABLE, 'Nullable');
         $html->addColumn($data->DEFAULT, 'Default');
     } catch (\Zend_Db_Table_Exception $zdte) {
         $html = $this->_('Object is not a table.');
     }
     return $html;
 }
Esempio n. 5
0
 /**
  * Add the elements from the model to the bridge for the current step
  *
  * @param \MUtil_Model_Bridge_FormBridgeInterface $bridge
  * @param \MUtil_Model_ModelAbstract $model
  */
 protected function addStep3(\MUtil_Model_Bridge_FormBridgeInterface $bridge, \MUtil_Model_ModelAbstract $model)
 {
     if ($this->loadSourceModel()) {
         $this->displayHeader($bridge, $this->_('Upload successful!'));
         $this->displayErrors($bridge, $this->_('Check the input visually.'));
         // \MUtil_Echo::track($this->sourceModel->load());
         $element = $bridge->getForm()->createElement('html', 'importdisplay');
         $repeater = \MUtil_Lazy::repeat(new \LimitIterator($this->sourceModel->loadIterator(), 0, 20));
         $table = new \MUtil_Html_TableElement($repeater, array('class' => $this->formatBoxClass));
         foreach ($this->sourceModel->getItemsOrdered() as $name) {
             $table->addColumn($repeater->{$name}, $name);
         }
         // Extra div for CSS settings
         $element->setValue(new \MUtil_Html_HtmlElement('div', $table, array('class' => $this->formatBoxClass)));
         $bridge->addElement($element);
     } else {
         $this->displayHeader($bridge, $this->_('Upload error!'));
         $this->displayErrors($bridge);
         $this->nextDisabled = true;
     }
 }
 public function displayMailFields($mailFields)
 {
     $mailFieldsRepeater = new \MUtil_Lazy_RepeatableByKeyValue($mailFields);
     $mailFieldsHtml = new \MUtil_Html_TableElement($mailFieldsRepeater, array('class' => 'table table-striped table-bordered table-condensed'));
     $mailFieldsHtml->addColumn($mailFieldsRepeater->key, $this->translate->_('Field'));
     $mailFieldsHtml->addColumn($mailFieldsRepeater->value, $this->translate->_('Value'));
     $container = \MUtil_Html::create()->div(array('class' => 'table-container'));
     $container[] = $mailFieldsHtml;
     return $container;
 }