Пример #1
0
 /**
  * Sets the form's onSuccess callback function.
  **/
 public function onSuccess($fn)
 {
     fxAssert::isNull($this->_onSuccess);
     fxAssert::isCallable($fn);
     $this->_onSuccess = $fn;
     return $this;
 }
Пример #2
0
 /**
  * Determines if the given string is a reference to the meta data. If it is, it converts it to
  * a key for accessing the _meta array and returns true. If not, it leaves it alone and returns false.
  *
  * Meta data is always accessed using a single underscore as the first character.
  **/
 public static function _isMeta(&$s)
 {
     fxAssert::isNonEmptyString($s, '$s');
     if (mb_substr($s, 0, 1) === '_' && mb_strlen($s) > 1) {
         $s = mb_substr($s, 1);
         return true;
     }
     return false;
 }
Пример #3
0
 public function __construct($name, $label, $members)
 {
     fxAssert::isArray($members, 'members') && fxAssert::isNotEmpty($members, 'members');
     parent::__construct($name, $label);
     $this->_members = $members;
     $this->id = $tmp = fxForm::_simplify($name);
     $this->name = $tmp . '[]';
     $this->_mmap = self::makeMemberMap($members);
 }
Пример #4
0
 /**
  * Takes an array of attributes ( name => values ) and creates an HTML formatted string from it.
  **/
 public function renderAtts($atts)
 {
     fxAssert::isArray($atts, '$atts');
     $o = '';
     if (!empty($atts)) {
         foreach ($atts as $k => $v) {
             $k = htmlspecialchars($k);
             // NULL values lead to output like <XYZ ... readonly ...>
             if (NULL === $v) {
                 $o .= " {$k}";
             } else {
                 $v = htmlspecialchars($v);
                 $o .= " {$k}=\"{$v}\"";
             }
         }
     }
     return $o;
 }