Пример #1
0
 /**
  * 
  * Adds static form elements like 'header', 'static', 'submit' or 'reset' to
  * a pre-existing HTML_QuickForm object.
  * 
  * @static
  * 
  * @access public
  * 
  * @param object &$form An HTML_QuickForm object.
  * 
  * @param array $elements A sequential array of form element definitions.
  * 
  * @return void
  * 
  */
 function addStaticElements(&$form, $elements)
 {
     foreach ($elements as $name => $elemDef) {
         DB_Table_QuickForm::fixColDef($elemDef, $name);
         $element =& DB_Table_QuickForm::getElement($elemDef, $name);
         if (!is_object($element)) {
             continue;
         }
         if (isset($elemDef['before']) && !empty($elemDef['before'])) {
             $form->insertElementBefore($element, $elemDef['before']);
         } else {
             $form->addElement($element);
         }
     }
 }
Пример #2
0
 /**
  * 
  * Creates and returns a single QuickForm element based on a DB_Table
  * column name.
  * 
  * @access public
  * 
  * @param string $column A DB_Table column name.
  * 
  * @param string $elemname The name to use for the generated QuickForm
  * element.
  * 
  * @return object HTML_QuickForm_Element
  * 
  * @see HTML_QuickForm
  * 
  * @see DB_Table_QuickForm
  * 
  */
 function &getFormElement($column, $elemname)
 {
     include_once 'DB/Table/QuickForm.php';
     $coldef = $this->_getFormColDefs($column);
     DB_Table_QuickForm::fixColDef($coldef[$column], $elemname);
     $element =& DB_Table_QuickForm::getElement($coldef[$column], $elemname);
     return $element;
 }
Пример #3
0
 /**
  * 
  * Build an array of form elements based from DB_Table columns.
  * 
  * @static
  * 
  * @access public
  * 
  * @param array $cols A sequential array of DB_Table column
  * definitions from which to create form elements.
  * 
  * @param string $arrayName By default, the form will use the names
  * of the columns as the names of the form elements.  If you pass
  * $arrayName, the column names will become keys in an array named
  * for this parameter.
  * 
  * @return array An array of HTML_QuickForm_Element objects.
  * 
  */
 function &getGroup($cols, $arrayName = null)
 {
     $group = array();
     foreach ($cols as $name => $col) {
         if ($arrayName) {
             $elemname = $arrayName . "[{$name}]";
         } else {
             $elemname = $name;
         }
         DB_Table_QuickForm::fixColDef($col, $elemname);
         $group[] =& DB_Table_QuickForm::getElement($col, $elemname);
     }
     return $group;
 }