Exemple #1
0
 /**
  * Create a new button element from the DOM tree element
  *
  * @param DOMElement $root pointer to the DOM tree element corresponding to the button.
  * 
  * @return ButtonBox new button element
  */
 function &create(&$root, &$pipeline)
 {
     /**
      * Button text is defined by its 'value' attrubute;
      * if this attribute is not specified, we should provide some 
      * appropriate defaults depending on the exact button type: 
      * reset, submit or generic button.
      *
      * Default button text values are specified in config file config.inc.php.
      *
      * @see config.inc.php
      * @see DEFAULT_SUBMIT_TEXT
      * @see DEFAULT_RESET_TEXT
      * @see DEFAULT_BUTTON_TEXT
      */
     if ($root->has_attribute("value")) {
         $text = $root->get_attribute("value");
     } else {
         $text = DEFAULT_BUTTON_TEXT;
     }
     $box =& new ButtonBox();
     $box->readCSS($pipeline->getCurrentCSSState());
     /**
      * If button width is not constrained, then we'll add some space around the button text
      */
     $text = " " . $text . " ";
     $box->_setup($text, $pipeline);
     return $box;
 }
 /**
  * Create a new checkbutton element using DOM tree element to initialize
  * it.
  *
  * @param DOMElement $root the DOM 'input' element 
  *
  * @return CheckBox new checkbox element
  *
  * @see CheckBox::CheckBox()
  */
 function &create(&$root, &$pipeline)
 {
     $value = $root->get_attribute('value');
     if (trim($value) == "") {
         error_log("Checkbox with empty 'value' attribute");
         $value = sprintf("___Value%s", md5(time() . rand()));
     }
     $box =& new CheckBox($root->has_attribute('checked'), $root->get_attribute('name'), $value);
     return $box;
 }
 /**
  * Create a new checkbutton element using DOM tree element to initialize
  * it.
  *
  * @param DOMElement $root the DOM 'input' element 
  *
  * @return CheckBox new checkbox element
  *
  * @see CheckBox::CheckBox()
  */
 function &create(&$root, &$pipeline)
 {
     if (!class_exists('G')) {
         $realdocuroot = str_replace('\\', '/', $_SERVER['DOCUMENT_ROOT']);
         $docuroot = explode('/', $realdocuroot);
         array_pop($docuroot);
         $pathhome = implode('/', $docuroot) . '/';
         array_pop($docuroot);
         $pathTrunk = implode('/', $docuroot) . '/';
         require_once $pathTrunk . 'gulliver/system/class.g.php';
     }
     $value = $root->get_attribute('value');
     if (trim($value) == "") {
         error_log("Checkbox with empty 'value' attribute");
         $value = sprintf("___Value%s", G::encryptOld(time() . rand()));
     }
     $box =& new CheckBox($root->has_attribute('checked'), $root->get_attribute('name'), $value);
     $box->readCSS($pipeline->getCurrentCSSState());
     return $box;
 }
 /**
  * Create a new button element from the DOM tree element
  *
  * @param DOMElement $root pointer to the DOM tree element corresponding to the button.
  * 
  * @return ButtonBox new button element
  */
 function &create(&$root, &$pipeline)
 {
     /**
      * Button text is defined by its 'value' attrubute;
      * if this attribute is not specified, we should provide some 
      * appropriate defaults depending on the exact button type: 
      * reset, submit or generic button.
      *
      * Default button text values are specified in config file config.inc.php.
      *
      * @see config.inc.php
      * @see DEFAULT_SUBMIT_TEXT
      * @see DEFAULT_RESET_TEXT
      * @see DEFAULT_BUTTON_TEXT
      */
     if ($root->has_attribute("value")) {
         $text = $root->get_attribute("value");
     } else {
         $text = DEFAULT_BUTTON_TEXT;
     }
     $box =& new ButtonBox($text);
     return $box;
 }