Exemplo n.º 1
0
 /**
  * Load any constraints present for the widget
  *
  * @param DOMElement $element
  * @param One_Form_Widget_Abstract $widget
  */
 protected static function loadConstraints(DOMElement $element, One_Form_Widget_Abstract &$widget)
 {
     $xpath = new DOMXPath(self::$_dom);
     $constraints = $xpath->query('./constraints/constraint', $element);
     if ($constraints->length > 0) {
         for ($i = 0; $i < $constraints->length; $i++) {
             $child = $constraints->item($i);
             $type = 0;
             $rawType = $child->getAttribute('type');
             $hasRegExp = stristr($rawType, 'R') !== false ? true : false;
             for ($j = 0; $j < strlen($rawType); $j++) {
                 switch (strtoupper($rawType[$j])) {
                     case 'N':
                         $type += One_Form_Constraint::N;
                         break;
                     case 'E':
                         if (!$hasRegExp) {
                             $type += One_Form_Constraint::E;
                         }
                         break;
                     case 'L':
                         if (!$hasRegExp) {
                             $type += One_Form_Constraint::L;
                         }
                         break;
                     case 'G':
                         if (!$hasRegExp) {
                             $type += One_Form_Constraint::G;
                         }
                         break;
                     case 'M':
                         if (!$hasRegExp) {
                             $type += One_Form_Constraint::M;
                         }
                         break;
                     case 'C':
                         if (!$hasRegExp) {
                             $type += One_Form_Constraint::C;
                         }
                         break;
                     case 'R':
                         $type += One_Form_Constraint::R;
                         break;
                 }
             }
             $value = trim($child->nodeValue);
             $error = $child->getAttribute('error');
             $widget->addConstraint($type, $value, $error);
         }
     }
 }
Exemplo n.º 2
0
 /**
  * Return the allowed options for this widget
  *
  * @return array
  */
 protected static function allowedOptions()
 {
     $additional = array('size' => 1, 'path' => 2);
     return array_merge(parent::allowedOptions(), $additional);
 }
Exemplo n.º 3
0
 /**
  * Return the allowed options for this widget
  *
  * @return array
  */
 protected static function allowedOptions()
 {
     $additional = array('dir' => 1, 'lang' => 1, 'xml:lang' => 1, 'disabled' => 1, 'size' => 1, 'options' => 2);
     return array_merge(parent::allowedOptions(), $additional);
 }
Exemplo n.º 4
0
 /**
  * Return the allowed options for this widget
  *
  * @return array
  */
 protected static function allowedOptions()
 {
     $additional = array('dir' => 1, 'lang' => 1, 'xml:lang' => 1, 'accesskey' => 1, 'tabindex' => 1, 'disabled' => 1, 'size' => 1, 'multiple' => 1, 'data-placeholder' => 1);
     return array_merge(parent::allowedOptions(), $additional);
 }
Exemplo n.º 5
0
 /**
  * Return the allowed options for this widget
  *
  * @return array
  */
 protected static function allowedOptions()
 {
     $extra = array('directory' => 2, 'authorfield' => 2);
     return array_merge(parent::allowedOptions(), $extra);
 }
Exemplo n.º 6
0
 /**
  * Return the allowed options for this widget
  *
  * @return array
  */
 protected static function allowedOptions()
 {
     $additional = array('dir' => 1, 'lang' => 1, 'xml:lang' => 1, 'code' => 4);
     return array_merge(parent::allowedOptions(), $additional);
 }
Exemplo n.º 7
0
 /**
  * Return the allowed options for this widget
  *
  * @return array
  */
 protected static function allowedOptions()
 {
     return parent::allowedOptions();
 }
Exemplo n.º 8
0
 protected static function allowedOptions()
 {
     $additional = array('explTxt' => 2, 'font_size' => 3, 'font_path' => 3, 'font_file' => 3, 'text_color' => 3, 'lines_color' => 3, 'background_color' => 3, 'width' => 3, 'height' => 3, 'output' => 3);
     return array_merge(parent::allowedOptions(), $additional);
 }
Exemplo n.º 9
0
 /**
  * Return the allowed options for this widget
  *
  * @return array
  */
 protected static function allowedOptions()
 {
     $extra = array('thWidth' => 2);
     return array_merge(parent::allowedOptions(), $extra);
 }
Exemplo n.º 10
0
 /**
  * Return the allowed options for this widget
  *
  * @return array
  */
 protected static function allowedOptions()
 {
     $additional = array('imgDir' => 4, 'showEmpty' => 2);
     return array_merge(parent::allowedOptions(), $additional);
 }
Exemplo n.º 11
0
 /**
  * Return the allowed options for this widget
  *
  * @return array
  */
 protected static function allowedOptions()
 {
     $additional = array('disabled' => 1, 'width' => 1, 'height' => 1, 'buttons' => 2);
     return array_merge(parent::allowedOptions(), $additional);
 }
Exemplo n.º 12
0
 /**
  * Add a OneFormWidget to the container
  *
  * @param One_Form_Widget_Abstract $widget
  */
 public function addWidget(One_Form_Widget_Abstract $widget)
 {
     if (!array_key_exists($widget->getID(), $this->getContent())) {
         $this->content[$widget->getID()] = $widget;
     } else {
         throw new Exception("A widget is already present with this ID:" . $widget->getID());
     }
 }
Exemplo n.º 13
0
 /**
  * Return the allowed options for this widget
  *
  * @return array
  */
 protected static function allowedOptions()
 {
     $additional = array('required' => 2, 'start' => 2);
     return array_merge(parent::allowedOptions(), $additional);
 }