Example #1
0
 /**
  * @inheritDoc
  */
 public function labelEx($model, $attribute, $htmlOptions = array())
 {
     if (!$this->qualifyNames && !isset($htmlOptions['for'])) {
         $htmlOptions['for'] = \CHtml::getIdByName($attribute);
     }
     return parent::labelEx($model, $attribute, $htmlOptions);
 }
Example #2
0
 /**
  * Renders an HTML label for a model attribute.
  * @param CModel $parentModel the parent data model
  * @param string $attributedPath the attribute or path to related model attribute
  * @param array $htmlOptions additional HTML attributes.
  * @return string the generated label tag
  */
 public function labelEx($parentModel, $attributedPath, $htmlOptions = array())
 {
     list($model, $attribute, $htmlOptions) = self::resolveArgs($parentModel, $attributedPath, $htmlOptions);
     $htmlOptions['for'] = CHtml::getIdByName($htmlOptions['name']);
     if (!isset($htmlOptions['label']) && ($label = self::resolveLabel($parentModel, $attributedPath)) !== null) {
         $htmlOptions['label'] = $label;
     }
     return parent::labelEx($model, $attribute, $htmlOptions);
 }
Example #3
0
  /**
   * Formats a set of input field that consists of label, input, and error message.
   * @param  CActiveForm $form the form
   * @param  string $type the input field method
   * @param  CModel $model the model
   * @param  string $attribute the attribute
   * @param  string $icon the icon
   * @param  array $htmlOptions the HTML option values
   * @param  array $otherOptions otherOptions
   * @return string the HTML of the set of the input field
   */
  public function formatInputField($form, $type, $model, $attribute, $icon, $htmlOptions = array(), $otherOptions = array())
  {
      return '<tr>
		<td>
			<div class="control-group attribute-' . $attribute . '">
				<i class="icon ' . $icon . '"></i> ' . $form->labelEx($model, $attribute, array('class' => 'control-label')) . '
			</div>
		</td>
		<td>
			<div class="control-group attribute-' . $attribute . '">' . @$otherOptions['beforeInput'] . (isset($otherOptions['data']) ? $form->{$type}($model, $attribute, $otherOptions['data'], $htmlOptions) : $form->{$type}($model, $attribute, $htmlOptions)) . @$otherOptions['afterInput'] . (isset($otherOptions['hint']) ? '<span class="hint">' . $otherOptions['hint'] . '</span>' : '') . $form->error($model, $attribute, array('inputContainer' => '.attribute-' . $attribute)) . '
			</div>
		</td>
	</tr>';
  }
Example #4
0
 /**
  * Label (Extra)
  *
  * A wrapper for CHtml::activeLabelEx(). It overrides the labelEx() method in the parent class, CActiveForm, to
  * allow for form objects to be passed as well as form models.
  *
  * @access public
  * @param CForm|CModel $formModel
  * @param string $attribute
  * @param array $htmlOptions
  * @return string
  */
 public function labelEx($formModel, $attribute, $htmlOptions = array())
 {
     if ($formModel instanceof \CForm && isset($formModel->model) && $formModel->model instanceof \CModel) {
         $formModel = $formModel->model;
     }
     return parent::labelEx($formModel, $attribute, $htmlOptions);
 }
Example #5
0
 /**
  * Renders an HTML label for a model attribute.
  * This method is a wrapper of {@link TbHtml::activeLabelEx}.
  * Please check {@link TbHtml::activeLabelEx} for detailed information
  * about the parameters for this method.
  * @param CModel $model the data model
  * @param string $attribute the attribute
  * @param array $htmlOptions additional HTML attributes.
  * @return string the generated label tag
  */
 public function labelEx($model, $attribute, $htmlOptions = array())
 {
     if ($this->type == TbHtml::FORM_HORIZONTAL) {
         $htmlOptions = TbHtml::addClassName('control-label', $htmlOptions);
     }
     return parent::labelEx($model, $attribute, $htmlOptions);
 }
 public function labelEx($model, $attribute, $htmlOptions = array())
 {
     $htmlOptions = CMap::mergeArray(array('class' => 'control-label'), $htmlOptions);
     return parent::labelEx($model, $attribute, $htmlOptions);
 }
    echo $form->labelEx($model, "[{$i}]text");
    ?>
            <?php 
    echo $form->textArea($model, "[{$i}]text", array("rows" => 6, "cols" => 50, 'class' => 'required'));
    ?>
            <?php 
    echo $form->error($model, "[{$i}]text");
    ?>
        </div>

        <div class="field">
            <?php 
    echo $form->labelEx($model, "[{$i}]percent");
    ?>
            <?php 
    echo $form->textField($model, "[{$i}]percent", array("size" => 10, "maxlength" => 10, 'class' => 'range(1,100)'));
    ?>
            <?php 
    echo $form->error($model, "[{$i}]percent");
    ?>
        </div>

        <div class="field">
            <?php 
    echo $form->labelEx($model, "[{$i}]cost");
    ?>
            <?php 
    echo $form->textField($model, "[{$i}]cost", array("size" => 60, "maxlength" => 64));
    ?>
            <?php 
    echo $form->error($model, "[{$i}]cost");
    ?>
        </div>

        <div class="field">
            <?php 
    echo $form->labelEx($model, "[{$i}]price");
Example #8
0
 public function labelEx($model, $attribute, $htmlOptions = array())
 {
     return parent::labelEx($model, $attribute, $htmlOptions);
 }