コード例 #1
0
 /**
  * {@inheritDoc}
  */
 public function setName($name)
 {
     if (is_array($name)) {
         $name = implode(',', $name);
     }
     parent::setName($name);
 }
コード例 #2
0
 /**
  * Create new min length rule.
  *
  * @param string name The field name.
  * @param string table The database table.
  * @param string column The table column.
  * @param string msg Optional message.
  */
 public function __construct($name, $table, $column, $msg = null)
 {
     parent::__construct($name, "%s must not be longer than %s characters.", $msg);
     $this->table = $table;
     $this->column = $column;
     $this->max = -1;
 }
コード例 #3
0
ファイル: ZMWrapperRule.php プロジェクト: zenmagick/zenmagick
 /**
  * Create new rule.
  *
  * @param string name The field name; default is <code>null</code>.
  * @param string msg Optional message; default is <code>null</code>.
  * @param mixed function The function name or array; default is <code>null</code>.
  */
 public function __construct($name = null, $msg = null, $function = null)
 {
     parent::__construct($name, "Please enter a value for %s.", $msg);
     $this->function = null;
     $this->setJavaScript('');
     $this->setFunction($function);
 }
コード例 #4
0
 /**
  * Create new field match rule.
  *
  * @param string name The field name; default is <code>null</code>.
  * @param string other The other fields name; default is <code>null</code>.
  * @param string msg Optional message; default is <code>null</code>.
  */
 public function __construct($name = null, $other = null, $msg = null)
 {
     parent::__construct($name, "%s and %s must match.", $msg);
     $this->setOther($other);
 }
コード例 #5
0
 /**
  * Create new required rule.
  *
  * @param string name The field name.
  * @param string msg Optional message.
  */
 public function __construct($name, $msg = null)
 {
     parent::__construct($name, "Invalid Gift Certificate value.", $msg);
 }
コード例 #6
0
ファイル: ZMMinRule.php プロジェクト: zenmagick/zenmagick
 /**
  * Create new min length rule.
  *
  * @param string name The field name.
  * @param int min The minimun length.
  * @param string msg Optional message.
  */
 public function __construct($name, $min, $msg = null)
 {
     parent::__construct($name, "%s must be at least %s characters long.", $msg);
     $this->min = $min;
 }
コード例 #7
0
ファイル: ZMDateRule.php プロジェクト: zenmagick/zenmagick
 /**
  * Create new date rule.
  *
  * @param string name The field name.
  * @param string format The date format (eg: DD/MM/YYYY); if not set, the date/long format of the current locale will be used.
  * @param string msg Optional message.
  */
 public function __construct($name, $format = null, $msg = null)
 {
     parent::__construct($name, "Please enter a valid date (%s).", $msg);
     $this->format = $format;
 }
コード例 #8
0
 /**
  * Create new required rule.
  *
  * @param string name The field name.
  * @param string msg Optional message.
  */
 public function __construct($name, $msg = null)
 {
     parent::__construct($name, "Please enter a state.", $msg);
 }
コード例 #9
0
 /**
  * Create new required rule.
  *
  * @param string name The field name.
  * @param string msg Optional message.
  */
 public function __construct($name, $msg = null)
 {
     parent::__construct($name, "Email already in use.", $msg);
 }
コード例 #10
0
ファイル: ZMEmailRule.php プロジェクト: zenmagick/zenmagick
 /**
  * Create new email rule.
  *
  * @param string name The field name; default is <code>null</code>.
  * @param string msg Optional message; default is <code>null</code>.
  */
 public function __construct($name = null, $msg = null)
 {
     parent::__construct($name, "%s is not a valid email.", $msg);
 }
コード例 #11
0
ファイル: ZMRegexpRule.php プロジェクト: zenmagick/zenmagick
 /**
  * Create new regexp rule.
  *
  * @param string name The field name; default is <code>null</code>.
  * @param string regexp The regular expression; default is <code>null</code>.
  * @param string msg Optional message; default is <code>null</code>.
  */
 public function __construct($name = null, $regexp = null, $msg = null)
 {
     parent::__construct($name, "%s is not valid.", $msg);
     $this->setRegexp($regexp);
 }
コード例 #12
0
ファイル: ZMListRule.php プロジェクト: zenmagick/zenmagick
 /**
  * Create new list rule.
  *
  * @param string name The field name; default is <code>null</code>.
  * @param mixed values The list of valid values as either a comma separated string or array; default is <code>null</code>.
  * @param string msg Optional message; default is <code>null</code>.
  */
 public function __construct($name = null, $values = null, $msg = null)
 {
     parent::__construct($name, "%s is not valid.", $msg);
     $this->setValues($values);
 }
コード例 #13
0
ファイル: ZMMinMaxRule.php プロジェクト: zenmagick/zenmagick
 /**
  * Create new min/max length rule.
  *
  * @param string name The field name; default is <code>null</code>.
  * @param int min The minimun length; default is <em>1</em>.
  * @param int max The maximum length; default is <em>0</em> for unlimited.
  * @param string msg Optional message.
  */
 public function __construct($name = null, $min = 1, $max = 0, $msg = null)
 {
     parent::__construct($name, "%s must be between %s and %s characters long.", $msg);
     $this->setMin($min);
     $this->setMax($max);
 }