• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Zebra_Form_Control类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Zebra_Form_Control的典型用法代码示例。如果您正苦于以下问题:PHP Zebra_Form_Control类的具体用法?PHP Zebra_Form_Control怎么用?PHP Zebra_Form_Control使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Zebra_Form_Control类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: Zebra_Form_Submit

 /**
  *  Adds an <input type="submit"> control to the form.
  *
  *  <b>Do not instantiate this class directly! Use the {@link Zebra_Form::add() add()} method instead!</b>
  *
  *  <code>
  *  //  create a new form
  *  $form = new Zebra_Form('my_form');
  *
  *  /**
  *   *  add a submit control to the form
  *   *  the "&" symbol is there so that $obj will be a reference to the object in PHP 4
  *   *  for PHP 5+ there is no need for it
  *   {@*}
  *  $obj = &$form->add('submit', 'my_submit', 'Submit');
  *
  *  // don't forget to always call this method before rendering the form
  *  if ($form->validate()) {
  *      // put code here
  *  }
  *
  *  //  output the form using an automatically generated template
  *  $form->render();
  *  </code>
  *
  *  @param  string  $id             Unique name to identify the control in the form.
  *
  *                                  The control's <b>name</b> attribute will be the same as the <b>id</b> attribute!
  *
  *                                  This is the name to be used when referring to the control's value in the
  *                                  POST/GET superglobals, after the form was submitted.
  *
  *                                  This is also the name of the variable to be used in the template file, containing
  *                                  the generated HTML for the control.
  *
  *                                  <code>
  *                                  /**
  *                                   *  in a template file, in order to print the generated HTML
  *                                   *  for a control named "my_submit", one would use:
  *                                   {@*}
  *                                  echo $my_submit;
  *                                  </code>
  *
  *  @param  string  $caption        Caption of the submit button control.
  *
  *  @param  array   $attributes     (Optional) An array of attributes valid for
  *                                  {@link http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.4 input}
  *                                  controls (size, readonly, style, etc)
  *
  *                                  Must be specified as an associative array, in the form of <i>attribute => value</i>.
  *                                  <code>
  *                                  //  setting the "alt" attribute
  *                                  $obj = &$form->add(
  *                                      'submit',
  *                                      'my_submit',
  *                                      'Submit',
  *                                      array(
  *                                          'alt' => 'Click to submit values'
  *                                      )
  *                                  );
  *                                  </code>
  *
  *                                  See {@link Zebra_Form_Control::set_attributes() set_attributes()} on how to set
  *                                  attributes, other than through the constructor.
  *
  *                                  The following attributes are automatically set when the control is created and
  *                                  should not be altered manually:<br>
  *                                  <b>type</b>, <b>id</b>, <b>name</b>, <b>value</b>, <b>class</b>
  *
  *  @return void
  */
 function Zebra_Form_Submit($id, $caption, $attributes = '')
 {
     // call the constructor of the parent class
     parent::Zebra_Form_Control();
     // set the private attributes of this control
     // these attributes are private for this control and are for internal use only
     // and will not be rendered by the _render_attributes() method
     $this->private_attributes = array('disable_xss_filters', 'locked');
     // set the default attributes for the submit button control
     // put them in the order you'd like them rendered
     $this->set_attributes(array('type' => 'submit', 'name' => $id, 'id' => $id, 'value' => $caption, 'class' => 'submit'));
     // sets user specified attributes for the control
     $this->set_attributes($attributes);
 }
开发者ID:paarma,项目名称:BibliotecaFupWeb,代码行数:85,代码来源:Submit.php


示例2: Zebra_Form_Hidden

 /**
  *  Adds an <input type="hidden"> control to the form.
  *
  *  <b>Do not instantiate this class directly! Use the {@link Zebra_Form::add() add()} method instead!</b>
  *
  *  <code>
  *  // create a new form
  *  $form = new Zebra_Form('my_form');
  *
  *  // add a hidden control to the form
  *  // the "&" symbol is there so that $obj will be a reference to the object in PHP 4
  *  // for PHP 5+ there is no need for it
  *  $obj = &$form->add('hidden', 'my_hidden', 'Secret value');
  *
  *  // don't forget to always call this method before rendering the form
  *  if ($form->validate()) {
  *      // put code here
  *  }
  *
  *  // output the form using an automatically generated template
  *  $form->render();
  *  </code>
  *
  *  @param  string  $id             Unique name to identify the control in the form.
  *
  *                                  The control's <b>name</b> attribute will be the same as the <b>id</b> attribute!
  *
  *                                  This is the name to be used when referring to the control's value in the
  *                                  POST/GET superglobals, after the form is submitted.
  *
  *                                  <b>Hidden controls are automatically rendered when the {@link Zebra_Form::render() render()}
  *                                  method is called!</b><br>
  *                                  <b>Do not print them in template files!</b>
  *
  *  @param  string  $default        (Optional) Default value of the text box.
  *
  *  @return void
  */
 function Zebra_Form_Hidden($id, $default = '')
 {
     // call the constructor of the parent class
     parent::Zebra_Form_Control();
     // set the private attributes of this control
     // these attributes are private for this control and are for internal use only
     // and will not be rendered by the _render_attributes() method
     $this->private_attributes = array('disable_xss_filters', 'locked');
     // set the default attributes for the hidden control
     // put them in the order you'd like them rendered
     // notice that if control's name is 'MAX_FILE_SIZE' we'll generate a random ID attribute for the control
     // as, with multiple forms having upload controls on them, this hidden control appears as many times as the
     // forms do and we don't want to have the same ID assigned to multiple controls
     $this->set_attributes(array('type' => 'hidden', 'name' => $id, 'id' => $id != 'MAX_FILE_SIZE' ? $id : 'mfs_' . rand(0, 100000), 'value' => $default));
 }
开发者ID:ChrisKun,项目名称:ucm-fdi-isbc,代码行数:53,代码来源:Hidden.php


示例3: Zebra_Form_Textarea

 /**
  *  Adds an <textarea> control to the form.
  *
  *  <b>Do not instantiate this class directly! Use the {@link Zebra_Form::add() add()} method instead!</b>
  *
  *  <code>
  *  // create a new form
  *  $form = new Zebra_Form('my_form');
  *
  *  // add a textarea control to the form
  *  // the "&" symbol is there so that $obj will be a reference to the object in PHP 4
  *  // for PHP 5+ there is no need for it
  *  $obj = &$form->add('textarea', 'my_textarea');
  *
  *  // don't forget to always call this method before rendering the form
  *  if ($form->validate()) {
  *      // put code here
  *  }
  *
  *  // output the form using an automatically generated template
  *  $form->render();
  *  </code>
  *
  *  @param  string  $id             Unique name to identify the control in the form.
  *
  *                                  The control's <b>name</b> attribute will be the same as the <b>id</b> attribute!
  *
  *                                  This is the name to be used when referring to the control's value in the
  *                                  POST/GET superglobals, after the form is submitted.
  *
  *                                  This is also the name of the variable to be used in custom template files, in
  *                                  order to display the control.
  *
  *                                  <code>
  *                                  // in a template file, in order to print the generated HTML
  *                                  // for a control named "my_textarea", one would use:
  *                                  echo $my_textarea;
  *                                  </code>
  *
  *  @param  string  $default        (Optional) Default value of the textarea.
  *
  *  @param  array   $attributes     (Optional) An array of attributes valid for
  *                                  <b>{@link http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.7 textarea}</b>
  *                                  controls (rows, cols, style, etc)
  *
  *                                  Must be specified as an associative array, in the form of <i>attribute => value</i>.
  *                                  <code>
  *                                  // setting the "rows" attribute
  *                                  $obj = &$form->add(
  *                                      'textarea',
  *                                      'my_textarea',
  *                                      '',
  *                                      array(
  *                                          'rows' => 10
  *                                      )
  *                                  );
  *                                  </code>
  *
  *                                  See {@link Zebra_Form_Control::set_attributes() set_attributes()} on how to set
  *                                  attributes, other than through the constructor.
  *
  *                                  The following attributes are automatically set when the control is created and
  *                                  should not be altered manually:<br>
  *
  *                                  <b>id</b>, <b>name</b>, <b>class</b>
  *
  *  @return void
  */
 function Zebra_Form_Textarea($id, $default = '', $attributes = '')
 {
     // call the constructor of the parent class
     parent::Zebra_Form_Control();
     // set the private attributes of this control
     // these attributes are private for this control and are for internal use only
     // and will not be rendered by the _render_attributes() method
     $this->private_attributes = array('default_value', 'disable_xss_filters', 'locked', 'type', 'value');
     // set the default attributes for the textarea control
     // put them in the order you'd like them rendered
     $this->set_attributes(array('name' => $id, 'id' => $id, 'rows' => 5, 'cols' => '80', 'class' => 'control', 'type' => 'textarea', 'value' => $default));
     // if "class" is amongst user specified attributes
     if (isset($attributes['class'])) {
         // we need to set the "class" attribute like this, so it doesn't overwrite previous values
         $this->set_attributes(array('class' => $attributes['class']), false);
         // make sure we don't set it again below
         unset($attributes['class']);
     }
     // sets user specified attributes for the control
     $this->set_attributes($attributes);
 }
开发者ID:ChrisKun,项目名称:ucm-fdi-isbc,代码行数:89,代码来源:Textarea.php


示例4: array

 /**
  *  Adds an <input type="reset"> control to the form.
  *
  *  <b>Do not instantiate this class directly! Use the {@link Zebra_Form::add() add()} method instead!</b>
  *
  *  <code>
  *  // create a new form
  *  $form = new Zebra_Form('my_form');
  *
  *  // add a reset control to the form
  *  $obj = $form->add('reset', 'my_reset', 'Reset');
  *
  *  // don't forget to always call this method before rendering the form
  *  if ($form->validate()) {
  *      // put code here
  *  }
  *
  *  // output the form using an automatically generated template
  *  $form->render();
  *  </code>
  *
  *  @param  string  $id             Unique name to identify the control in the form.
  *
  *                                  The control's <b>name</b> attribute will be the same as the <b>id</b> attribute!
  *
  *                                  This is the name to be used when referring to the control's value in the
  *                                  POST/GET superglobals, after the form is submitted.
  *
  *                                  This is also the name of the variable to be used in custom template files, in
  *                                  order to display the control.
  *
  *                                  <code>
  *                                  // in a template file, in order to print the generated HTML
  *                                  // for a control named "my_reset", one would use:
  *                                  echo $my_reset;
  *                                  </code>
  *
  *  @param  string  $caption        Caption of the reset button control.
  *
  *  @param  array   $attributes     (Optional) An array of attributes valid for
  *                                  {@link http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.4 input}
  *                                  controls (size, readonly, style, etc)
  *
  *                                  Must be specified as an associative array, in the form of <i>attribute => value</i>.
  *                                  <code>
  *                                  // setting the "alt" attribute
  *                                  $obj = $form->add(
  *                                      'reset',
  *                                      'my_reset',
  *                                      'Reset',
  *                                      array(
  *                                          'alt' => 'Click to reset values'
  *                                      )
  *                                  );
  *                                  </code>
  *
  *                                  See {@link Zebra_Form_Control::set_attributes() set_attributes()} on how to set
  *                                  attributes, other than through the constructor.
  *
  *                                  The following attributes are automatically set when the control is created and
  *                                  should not be altered manually:<br>
  *                                  <b>type</b>, <b>id</b>, <b>name</b>, <b>value</b>, <b>class</b>
  *
  *  @return void
  */
 function __construct($id, $caption, $attributes = '')
 {
     // call the constructor of the parent class
     parent::__construct();
     // set the private attributes of this control
     // these attributes are private for this control and are for internal use only
     // and will not be rendered by the _render_attributes() method
     $this->private_attributes = array('disable_xss_filters', 'locked');
     // set the default attributes for the reset button control
     // put them in the order you'd like them rendered
     $this->set_attributes(array('type' => 'reset', 'name' => $id, 'id' => $id, 'value' => $caption, 'class' => 'reset'));
     // if "class" is amongst user specified attributes
     if (is_array($attributes) && isset($attributes['class'])) {
         // we need to set the "class" attribute like this, so it doesn't overwrite previous values
         $this->set_attributes(array('class' => $attributes['class']), false);
         // make sure we don't set it again below
         unset($attributes['class']);
     }
     // sets user specified attributes for the control
     $this->set_attributes($attributes);
 }
开发者ID:nanhuacrab,项目名称:jhysns,代码行数:86,代码来源:Reset.php


示例5: Zebra_Form_Password

 /**
  *  Adds an <input type="password"> control to the form.
  *
  *  <b>Do not instantiate this class directly! Use the {@link Zebra_Form::add() add()} method instead!</b>
  *
  *  <code>
  *  //  create a new form
  *  $form = new Zebra_Form('my_form');
  *
  *  /**
  *   *  add a password control to the form
  *   *  the "&" symbol is there so that $obj will be a reference to the object in PHP 4
  *   *  for PHP 5+ there is no need for it
  *   {@*}
  *  $obj = &$form->add('password', 'my_password');
  *
  *  // don't forget to always call this method before rendering the form
  *  if ($form->validate()) {
  *      // put code here
  *  }
  *
  *  //  output the form using an automatically generated template
  *  $form->render();
  *  </code>
  *
  *  @param  string  $id             Unique name to identify the control in the form.
  *
  *                                  The control's <b>name</b> attribute will be the same as the <b>id</b> attribute!
  *
  *                                  This is the name to be used when referring to the control's value in the
  *                                  POST/GET superglobals, after the form was submitted.
  *
  *                                  This is also the name of the variable to be used in the template file, containing
  *                                  the generated HTML for the control.
  *
  *                                  <code>
  *                                  /**
  *                                   *  in a template file, in order to print the generated HTML
  *                                   *  for a control named "my_password", one would use:
  *                                   {@*}
  *                                  echo $my_password;
  *                                  </code>
  *
  *  @param  string  $default        (Optional) Default value of the password field.
  *
  *  @param  array   $attributes     (Optional) An array of attributes valid for
  *                                  {@link http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.4 input}
  *                                  controls (size, readonly, style, etc)
  *
  *                                  Must be specified as an associative array, in the form of <i>attribute => value</i>.
  *                                  <code>
  *                                  //  setting the "disabled" attribute
  *                                  $obj = &$form->add(
  *                                      'password',
  *                                      'my_password',
  *                                      '',
  *                                      array(
  *                                          'disabled' => 'disabled'
  *                                      )
  *                                  );
  *                                  </code>
  *
  *                                  See {@link Zebra_Form_Control::set_attributes() set_attributes()} on how to set
  *                                  attributes, other than through the constructor.
  *
  *                                  The following attributes are automatically set when the control is created and
  *                                  should not be altered manually:<br>
  *
  *                                  <b>type</b>, <b>id</b>, <b>name</b>, <b>value</b>, <b>class</b>
  *
  *  @return void
  */
 function Zebra_Form_Password($id, $default = '', $attributes = '')
 {
     // call the constructor of the parent class
     parent::Zebra_Form_Control();
     // set the private attributes of this control
     // these attributes are private for this control and are for internal use only
     // and will not be rendered by the _render_attributes() method
     $this->private_attributes = array('default_value', 'disable_xss_filters', 'locked');
     // set the default attributes for the button control
     $this->set_attributes(array('type' => 'password', 'name' => $id, 'id' => $id, 'value' => $default, 'class' => 'control password'));
     // sets user specified attributes for the control
     $this->set_attributes($attributes);
 }
开发者ID:paarma,项目名称:BibliotecaFupWeb,代码行数:85,代码来源:Password.php


示例6: array

 /**
  *  Adds a time picker control to the form.
  *
  *  <b>Do not instantiate this class directly! Use the {@link Zebra_Form::add() add()} method instead!</b>
  *
  *  The output of this control will be one, two, three or four {@link Zebra_Form_Select select} controls for hour,
  *  minutes, seconds and AM/PM respectively, according to the given format as set by the <i>$attributes</i> argument.
  *
  *  Note that even though there will be more select boxes, the submitted values will be available as a single merged
  *  value (in the form of hh:mm:ss AM/PM, depending on the format), with the name as given by the <i>id</i> argument.
  *
  *  <code>
  *  // create a new form
  *  $form = new Zebra_Form('my_form');
  *
  *  // add a time picker control for hour and minutes
  *  $obj = $form->add('time', 'my_time', date('H:i'), array('format' => 'hm'));
  *
  *  // don't forget to always call this method before rendering the form
  *  if ($form->validate()) {
  *
  *      // note that even though there will be more select boxes, the submitted
  *      // values will be available as a single merged value (in the form of
  *      // mm:mm:ss AM/PM, depending on the format), with the name as given by
  *      // the "id" argument:
  *      echo $_POST['my_time'];
  *
  *  }
  *
  *  // output the form using an automatically generated template
  *  $form->render();
  *  </code>
  *
  *  @param  string  $id             Unique name to identify the control in the form.
  *
  *                                  The control's <b>name</b> attribute will be the same as the <b>id</b> attribute!
  *
  *                                  This is the name to be used when referring to the control's value in the
  *                                  POST/GET superglobals, after the form is submitted.
  *
  *                                  This is also the name of the variable to be used in custom template files, in
  *                                  order to display the control.
  *
  *                                  <code>
  *                                  // in a template file, in order to print the generated HTML
  *                                  // for a control named "my_time", one would use:
  *                                  echo $my_time;
  *                                  </code>
  *
  *  @param  string  $default        (Optional) String representing the default time to be shown. Must be set according
  *                                  to the format of the time, as specified in <i>$attributes</i>. For example, for a
  *                                  time format of "hm", one would set the default time in the form of "hh:mm" while
  *                                  for a time format of "hms", one would set the time in the form of "hh:mm:ss".
  *
  *                                  Default is current system time.
  *
  *  @param  array   $attributes     (Optional) An array of user specified attributes valid for an time picker
  *                                  control (format, hours, minutes, seconds, am/pm).
  *
  *                                  Must be specified as an associative array, in the form of <i>attribute => value</i>.
  *
  *                                  Available attributes are:
  *
  *                                  -   format - format of time; a string containing one, or a combination of the four
  *                                      allowed characters: "h" (hours), "m" (minutes) and "s" (seconds) and "g" for
  *                                      using 12-hours format instead of the default 23-hours format; (i.e. setting the
  *                                      format to "hm" would allow the selection of hours and minutes, setting the
  *                                      format to "hms" would allow the selection of hours, minutes and seconds, and
  *                                      setting the format to "hmg" would allow the selection of hours and minutes
  *                                      using the 12-hours format instead of the 24-hours format)
  *
  *                                  -   hours - an array of selectable hours (i.e. array(10, 11, 12))
  *
  *                                  -   minutes - an array of selectable minutes (i.e. array(15, 30, 45))
  *
  *                                  -   seconds - an array of selectable seconds
  *
  *                                  See {@link Zebra_Form_Control::set_attributes() set_attributes()} on how to set
  *                                  attributes, other than through the constructor.
  *
  *  @return void
  */
 function __construct($id, $default = '', $attributes = '')
 {
     // call the constructor of the parent class
     parent::__construct();
     // these will hold the default selectable hours, minutes and seconds
     $hours = $minutes = $seconds = array();
     // all the 24 hours are available by default
     for ($i = 0; $i < 24; $i++) {
         $hours[] = $i;
     }
     // all the minutes and seconds are available by default
     for ($i = 0; $i < 60; $i++) {
         $minutes[] = $seconds[] = $i;
     }
     // set the private attributes of this control
     // these attributes are private for this control and are for internal use only
     // and will not be rendered by the _render_attributes() method
     $this->private_attributes = array('disable_xss_filters', 'locked', 'type', 'name', 'id', 'format', 'hours', 'minutes', 'seconds', 'value');
//.........这里部分代码省略.........
开发者ID:Tomas-Vahalik,项目名称:priklad-limonade-zebraform,代码行数:101,代码来源:Time.php


示例7: Zebra_Form_Note

 /**
  *  Adds a "note" to the form, attached to a control.
  *
  *  <b>Do not instantiate this class directly! Use the {@link Zebra_Form::add() add()} method instead!</b>
  *
  *  <code>
  *  //  create a new form
  *  $form = new Zebra_Form('my_form');
  *
  *  /**
  *   *  add a text control to the form
  *   *  the "&" symbol is there so that $obj will be a reference to the object in PHP 4
  *   *  for PHP 5+ there is no need for it
  *   {@*}
  *  $obj = &$form->add('text', 'my_text');
  *
  *  //  attach a note to the textbox control
  *  $form->add('none', 'note_my_text', 'my_text', 'Enter some text in the field above');
  *
  *  // don't forget to always call this method before rendering the form
  *  if ($form->validate()) {
  *      // put code here
  *  }
  *
  *  //  output the form using an automatically generated template
  *  $form->render();
  *  </code>
  *
  *  @param  string  $id             Unique name to identify the control in the form.
  *
  *                                  This is the name of the variable to be used in the template file, containing
  *                                  the generated HTML for the control.
  *
  *                                  <code>
  *                                  /**
  *                                   *  in a template file, in order to print the generated HTML
  *                                   *  for a control named "my_note", one would use:
  *                                   {@*}
  *                                  echo $my_note;
  *                                  </code>
  *
  *  @param  string  $attach_to      The <b>id</b> attribute of the control to attach the note to.
  *
  *                                  <i>Notice that this must be the "id" attribute of the control you are attaching
  *                                  the label to, and not the "name" attribute!</i>
  *
  *                                  This is important as while most of the controls have their <b>id</b> attribute
  *                                  set to the same value as their <b>name</b> attribute, for {@link Zebra_Form_Checkbox checkboxes},
  *                                  {@link Zebra_Form_Select selects} and {@link Zebra_Form_Radio radio&nbsp;buttons} this
  *                                  is different.
  *
  *                                  <b>Exception to the rule:</b>
  *
  *                                  Just like in the case of {@link Zebra_Form_Label labels}, if you want a <b>master</b>
  *                                  note, a note that is attached to a <b>group</b> of checkboxes/radio buttons rather than
  *                                  individual controls, this attribute must instead refer to the <b>name</b> of the
  *                                  controls (which, for groups of checkboxes/radio buttons, is one and the same). 
  *
  *  @param  string  $caption        Content of the note (can be both plain text and/or HTML)
  *
  *  @param  array   $attributes     (Optional) An array of attributes valid for
  *                                  {@link http://www.w3.org/TR/REC-html40/struct/global.html#h-7.5.4 div}
  *                                  elements (style, etc)
  *
  *                                  Must be specified as an associative array, in the form of <i>attribute => value</i>.
  *                                  <code>
  *                                  //  setting the "style" attribute
  *                                  $obj = &$form->add(
  *                                      'note',
  *                                      'note_my_text',
  *                                      'my_text',
  *                                      array(
  *                                          'style' => 'width:250px'
  *                                      )
  *                                  );
  *                                  </code>
  *
  *                                  See {@link Zebra_Form_Control::set_attributes() set_attributes()} on how to set
  *                                  attributes, other than through the constructor.
  *
  *                                  The following attributes are automatically set when the control is created and
  *                                  should not be altered manually:<br>
  *                                  <b>class</b>
  *
  *  @return void
  */
 function Zebra_Form_Note($id, $attach_to, $caption, $attributes = '')
 {
     // call the constructor of the parent class
     parent::Zebra_Form_Control();
     // set the private attributes of this control
     // these attributes are private for this control and are for internal use only
     $this->private_attributes = array('caption', 'disable_xss_filters', 'locked', 'for', 'name', 'type');
     // set the default attributes for the HTML control
     $this->set_attributes(array('class' => 'note', 'caption' => $caption, 'for' => $attach_to, 'id' => $id, 'name' => $id, 'type' => 'note'));
     // sets user specified attributes for the control
     $this->set_attributes($attributes);
 }
开发者ID:paarma,项目名称:BibliotecaFupWeb,代码行数:98,代码来源:Note.php


示例8: array

 /**
  *  Add an <label> control to the form.
  *
  *  <b>Do not instantiate this class directly! Use the {@link Zebra_Form::add() add()} method instead!</b>
  *
  *  <code>
  *  // create a new form
  *  $form = new Zebra_Form('my_form');
  *
  *  // add a label, attached to a textbox control
  *  $form->add('label', 'label_my_text', 'my_text', 'Enter some text:');
  *
  *  // add a text control to the form
  *  $obj = $form->add('text', 'my_text');
  *
  *  // don't forget to always call this method before rendering the form
  *  if ($form->validate()) {
  *      // put code here
  *  }
  *
  *  // output the form using an automatically generated template
  *  $form->render();
  *  </code>
  *
  *  @param  string  $id             Unique name to identify the control in the form.
  *
  *                                  This is the name of the variable to be used in the template file, containing
  *                                  the generated HTML for the control.
  *
  *                                  <code>
  *                                  // in a template file, in order to print the generated HTML
  *                                  // for a control named "my_label", one would use:
  *                                  echo $my_label;
  *                                  </code>
  *
  *  @param  string  $attach_to      The <b>id</b> attribute of the control to attach the note to.
  *
  *                                  <i>Notice that this must be the "id" attribute of the control you are attaching
  *                                  the label to, and not the "name" attribute!</i>
  *
  *                                  This is important as while most of the controls have their <b>id</b> attribute
  *                                  set to the same value as their <b>name</b> attribute, for {@link Zebra_Form_Checkbox checkboxes},
  *                                  {@link Zebra_Form_Select selects} and {@link Zebra_Form_Radio radio&nbsp;buttons} this
  *                                  is different.
  *
  *                                  <b>Exception to the rule:</b>
  *
  *                                  Just like in the case of {@link Zebra_Form_Note notes}, if you want a <b>master</b>
  *                                  label, a label that is attached to a <b>group</b> of checkboxes/radio buttons
  *                                  rather than individual controls, this attribute must instead refer to the <b>name</b>
  *                                  of the controls (which, for groups of checkboxes/radio buttons, is one and the same).
  *                                  This is important because if the group of checkboxes/radio buttons have the
  *                                  <i>required</i> rule set, this is the only way in which the "required" symbol
  *                                  (the red asterisk) will be attached to the master label instead of being attached
  *                                  to the first checkbox/radio button from the group.
  *
  *  @param  mixed   $caption        Caption of the label.
  *
  *                                  <i>Putting a $ (dollar) sign before a character will turn that specific character into
  *                                  the accesskey.</i><br>
  *                                  <i>If you need the dollar sign in the label, escape it with</i> \ <i>(backslash)</i>
  *
  *  @param  array   $attributes     (Optional) An array of attributes valid for
  *                                  {@link http://www.w3.org/TR/REC-html40/interact/forms.html#edef-LABEL label}
  *                                  elements (style, etc)
  *
  *                                  Must be specified as an associative array, in the form of <i>attribute => value</i>.
  *                                  <code>
  *                                  // setting the "style" attribute
  *                                  $obj = $form->add(
  *                                      'label',
  *                                      'label_my_text',
  *                                      'my_text',
  *                                      'My Label:'
  *                                      array(
  *                                          'style' => 'font-weight: normal'
  *                                      )
  *                                  );
  *                                  </code>
  *
  *                                  <b>Special attribute:</b>
  *
  *                                  When setting the special attribute <b>inside</b> to <b>true</b>, the label will
  *                                  appear inside the control is attached to (if the control the label is attached to
  *                                  is a {@link Zebra_Form_Text textbox} or a {@link Zebra_Form_Textarea textarea}) and
  *                                  will disappear when the control will receive focus. When the "inside" attribute is
  *                                  set to TRUE, the label will not be available in the template file as it will be
  *                                  contained by the control the label is attached to!
  *
  *                                  <code>
  *                                  $form->add('label', 'my_label', 'my_control', 'My Label:', array('inside' => true));
  *                                  </code>
  *
  *                                  <samp>Sometimes, when using floats, the inside-labels will not be correctly positioned
  *                                  as jQuery will return invalid numbers for the parent element's position; If this is
  *                                  the case, make sure you enclose the form in a div with position:relative to fix
  *                                  this issue.</samp>
  *
  *                                  See {@link Zebra_Form_Control::set_attributes() set_attributes()} on how to set
  *                                  attributes, other than through the constructor.
//.........这里部分代码省略.........
开发者ID:harmofwk,项目名称:harmofwk,代码行数:101,代码来源:Label.php


示例9: array

 /**
  *  Adds a "note" to the form, attached to a control.
  *
  *  <b>Do not instantiate this class directly! Use the {@link Zebra_Form::add() add()} method instead!</b>
  *
  *  <code>
  *  // create a new form
  *  $form = new Zebra_Form('my_form');
  *
  *  // add a text control to the form
  *  $obj = $form->add('text', 'my_text');
  *
  *  // attach a note to the textbox control
  *  $form->add('note', 'note_my_text', 'my_text', 'Enter some text in the field above');
  *
  *  // don't forget to always call this method before rendering the form
  *  if ($form->validate()) {
  *      // put code here
  *  }
  *
  *  // output the form using an automatically generated template
  *  $form->render();
  *  </code>
  *
  *  @param  string  $id             Unique name to identify the control in the form.
  *
  *                                  This is the name of the variable to be used in the template file, containing
  *                                  the generated HTML for the control.
  *
  *                                  <code>
  *                                  // in a template file, in order to print the generated HTML
  *                                  // for a control named "my_note", one would use:
  *                                  echo $my_note;
  *                                  </code>
  *
  *  @param  string  $attach_to      The <b>id</b> attribute of the control to attach the note to.
  *
  *                                  <i>Notice that this must be the "id" attribute of the control you are attaching
  *                                  the label to, and not the "name" attribute!</i>
  *
  *                                  This is important as while most of the controls have their <b>id</b> attribute
  *                                  set to the same value as their <b>name</b> attribute, for {@link Zebra_Form_Checkbox checkboxes},
  *                                  {@link Zebra_Form_Select selects} and {@link Zebra_Form_Radio radio&nbsp;buttons} this
  *                                  is different.
  *
  *                                  <b>Exception to the rule:</b>
  *
  *                                  Just like in the case of {@link Zebra_Form_Label labels}, if you want a <b>master</b>
  *                                  note, a note that is attached to a <b>group</b> of checkboxes/radio buttons rather than
  *                                  individual controls, this attribute must instead refer to the <b>name</b> of the
  *                                  controls (which, for groups of checkboxes/radio buttons, is one and the same). 
  *
  *  @param  string  $caption        Content of the note (can be both plain text and/or HTML)
  *
  *  @param  array   $attributes     (Optional) An array of attributes valid for
  *                                  {@link http://www.w3.org/TR/REC-html40/struct/global.html#h-7.5.4 div}
  *                                  elements (style, etc)
  *
  *                                  Must be specified as an associative array, in the form of <i>attribute => value</i>.
  *                                  <code>
  *                                  // setting the "style" attribute
  *                                  $obj = $form->add(
  *                                      'note',
  *                                      'note_my_text',
  *                                      'my_text',
  *                                      array(
  *                                          'style' => 'width:250px'
  *                                      )
  *                                  );
  *                                  </code>
  *
  *                                  See {@link Zebra_Form_Control::set_attributes() set_attributes()} on how to set
  *                                  attributes, other than through the constructor.
  *
  *                                  The following attributes are automatically set when the control is created and
  *                                  should not be altered manually:<br>
  *                                  <b>class</b>
  *
  *  @return void
  */
 function __construct($id, $attach_to, $caption, $attributes = '')
 {
     // call the constructor of the parent class
     parent::__construct();
     // set the private attributes of this control
     // these attributes are private for this control and are for internal use only
     $this->private_attributes = array('caption', 'disable_xss_filters', 'locked', 'for', 'name', 'type');
     // set the default attributes for the HTML control
     $this->set_attributes(array('class' => 'note', 'caption' => $caption, 'for' => $attach_to, 'id' => $id, 'name' => $id, 'type' => 'note'));
     // if "class" is amongst user specified attributes
     if (is_array($attributes) && isset($attributes['class'])) {
         // we need to set the "class" attribute like this, so it doesn't overwrite previous values
         $this->set_attributes(array('class' => $attributes['class']), false);
         // make sure we don't set it again below
         unset($attributes['class']);
     }
     // sets user specified attributes for the control
     $this->set_attributes($attributes);
 }
开发者ID:nanhuacrab,项目名称:jhysns,代码行数:99,代码来源:Note.php


示例10: array

 /**
  *  Adds a date control to the form.
  *
  *  <b>Do not instantiate this class directly! Use the {@link Zebra_Form::add() add()} method instead!</b>
  *
  *  The output of this control will be a {@link Zebra_Form_Text textbox} control with an icon to the right of it.<br>
  *  Clicking the icon will open an inline JavaScript date picker.<br>
  *
  *  <code>
  *  // create a new form
  *  $form = new Zebra_Form('my_form');
  *
  *  // add a date control to the form
  *  $mydate = $form->add('date', 'my_date', date('Y-m-d'));
  *
  *  // you *have* to set the "date" rule
  *  $mydate->set_rule(array(
  *      'date'  =>  array('error', 'Invalid date specified!'),
  *  ));
  *
  *  // set the date's format
  *  $mydate->format('M d, Y');
  *
  *  // don't forget to always call this method before rendering the form
  *  if ($form->validate()) {
  *
  *      // get the date in YYYY-MM-DD format so you can play with is easily
  *      $date = $mydate->get_date();
  *
  *  }
  *
  *  // output the form using an automatically generated template
  *  $form->render();
  *  </code>
  *
  *  @param  string  $id             Unique name to identify the control in the form.
  *
  *                                  The control's <b>name</b> attribute will be the same as the <b>id</b> attribute!
  *
  *                                  This is the name to be used when referring to the control's value in the
  *                                  POST/GET superglobals, after the form is submitted.
  *
  *                                  This is also the name of the variable to be used in custom template files, in
  *                                  order to display the control.
  *
  *                                  <code>
  *                                  // in a template file, in order to print the generated HTML
  *                                  // for a control named "my_date", one would use:
  *                                  echo $my_date;
  *                                  </code>
  *
  *  @param  string  $default        (Optional) Default date, formatted according to {@link format() format}.
  *
  *  @param  array   $attributes     (Optional) An array of attributes valid for
  *                                  {@link http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.4 input}
  *                                  controls (size, readonly, style, etc)
  *
  *                                  Must be specified as an associative array, in the form of <i>attribute => value</i>.
  *                                  <code>
  *                                  // setting the "readonly" attribute
  *                                  $obj = $form->add(
  *                                      'date',
  *                                      'my_date',
  *                                      '',
  *                                      array(
  *                                          'readonly' => 'readonly'
  *                                      )
  *                                  );
  *                                  </code>
  *
  *                                  See {@link Zebra_Form_Control::set_attributes() set_attributes()} on how to set
  *                                  attributes, other than through the constructor.
  *
  *                                  The following attributes are automatically set when the control is created and
  *                                  should not be altered manually:<br>
  *
  *                                  <b>type</b>, <b>id</b>, <b>name</b>, <b>value</b>, <b>class</b>
  *
  *  @return void
  */
 function __construct($id, $default = '', $attributes = '')
 {
     // call the constructor of the parent class
     parent::__construct();
     // set the private attributes of this control
     // these attributes are private for this control and are for internal use only
     // and will not be rendered by the _render_attributes() method
     $this->private_attributes = array('locked', 'disable_xss_filters', 'disable_zebra_datepicker', 'date', 'always_visible', 'days', 'days_abbr', 'direction', 'disabled_dates', 'enabled_dates', 'first_day_of_week', 'format', 'header_captions', 'header_navigation', 'inside_icon', 'lang_clear_date', 'months', 'months_abbr', 'offset', 'pair', 'readonly_element', 'show_clear_date', 'show_other_months', 'show_select_today', 'show_week_number', 'select_other_months', 'start_date', 'strict', 'view', 'weekend_days', 'zero_pad');
     // set the javascript attributes of this control
     // these attributes will be used by the JavaScript date picker object
     $this->javascript_attributes = array('always_visible', 'days', 'days_abbr', 'direction', 'disabled_dates', 'enabled_dates', 'first_day_of_week', 'format', 'header_captions', 'header_navigation', 'inside_icon', 'lang_clear_date', 'months', 'months_abbr', 'offset', 'pair', 'readonly_element', 'show_clear_date', 'show_other_months', 'show_select_today', 'show_week_number', 'select_other_months', 'start_date', 'strict', 'view', 'weekend_days', 'zero_pad');
     // set the default attributes for the text control
     // put them in the order you'd like them rendered
     $this->set_attributes(array('type' => 'text', 'name' => $id, 'id' => $id, 'value' => $default, 'class' => 'control text date', 'always_visible' => null, 'days' => null, 'days_abbr' => null, 'direction' => null, 'disable_zebra_datepicker' => false, 'disabled_dates' => null, 'enabled_dates' => null, 'first_day_of_week' => null, 'format' => 'Y-m-d', 'header_captions' => null, 'header_navigation' => null, 'inside_icon' => null, 'months' => null, 'months_abbr' => null, 'offset' => null, 'pair' => null, 'readonly_element' => null, 'show_clear_date' => null, 'show_other_months' => null, 'show_select_today' => null, 'show_week_number' => null, 'select_other_months' => null, 'start_date' => null, 'strict' => null, 'view' => null, 'weekend_days' => nul 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Zend类代码示例发布时间:2022-05-23
下一篇:
PHP ZPush类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap