当前位置: 首页>>代码示例>>PHP>>正文


PHP CModel::getError方法代码示例

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


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

示例1: fieldClass

 /**
  * Returns input container class for any given attribute, depending on validation conditions.
  * @param CModel $model the data model
  * @param string $attribute the attribute name
  */
 public function fieldClass($model, $attribute)
 {
     $class = 'control-group';
     if ($model->getError($attribute)) {
         $class .= ' error';
     }
     return $class;
 }
开发者ID:rzamarripa,项目名称:masoftproyectos,代码行数:13,代码来源:BActiveForm.php

示例2: errorModelSummery

 /**
  * get error info from model
  * 
  * @param CModel $model
  * @return string
  * @see CModel
  */
 public static function errorModelSummery($model, $attribute = null)
 {
     if (is_null($attribute)) {
         return self::errorSummery($model->getErrors());
     } else {
         $aryError = $model->getError($attribute, false);
         return empty($aryError) ? '' : self::errorSummery(array($aryError));
     }
 }
开发者ID:erdincay,项目名称:WIIBOX,代码行数:16,代码来源:CHtml.php

示例3: customActiveControlGroup

 /**
  * Generates a custom (pre-rendered) active form control group.
  * @param string $input the rendered input.
  * @param CModel $model the data model.
  * @param string $attribute the attribute.
  * @param array $htmlOptions additional HTML attributes.
  * @return string the generated control group.
  */
 public static function customActiveControlGroup($input, $model, $attribute, $htmlOptions = array())
 {
     // modificado segun lo visto en el foro de yii
     $htmlOptions['input'] = $input;
     if ($model->hasErrors($attribute)) {
         $htmlOptions['color'] = TbHtml::INPUT_COLOR_ERROR;
         $htmlOptions['help'] = $model->getError($attribute);
         $htmlOptions['helpOptions'] = array('type' => TbHtml::HELP_TYPE_BLOCK);
     }
     return self::activeControlGroup(self::INPUT_TYPE_CUSTOM, $model, $attribute, $htmlOptions);
 }
开发者ID:juankie,项目名称:gestcb9git,代码行数:19,代码来源:TbHtml.php

示例4: error

 /**
  * Displays the first validation error for a model attribute.
  * @param CModel $model the data model
  * @param string $attribute the attribute name
  * @param array $htmlOptions additional HTML attributes to be rendered in the container div tag.
  * This parameter has been available since version 1.0.7.
  * @return string the error display. Empty if no errors are found.
  * @see CModel::getErrors
  * @see errorMessageCss
  */
 public static function error($model, $attribute, $htmlOptions = array())
 {
     $error = $model->getError($attribute);
     if ($error != '') {
         if (!isset($htmlOptions['class'])) {
             $htmlOptions['class'] = self::$errorMessageCss;
         }
         return self::tag('div', $htmlOptions, $error);
     } else {
         return '';
     }
 }
开发者ID:IuriiP,项目名称:yii-tracker,代码行数:22,代码来源:CHtml.php

示例5: beginControlGroup

 /**
  * Begins a form group.
  *
  * Into the form group belongs the label, the input and the error.
  *
  * @param CModel $model The model
  * @param string $attribute The attribute
  *
  * @access public
  * @return string
  */
 public function beginControlGroup($model, $attribute, $options = array())
 {
     $option = array();
     $option['class'] = 'form-group';
     $error = $model->getError($attribute);
     if (!empty($error)) {
         EBootstrap::mergeClass($option, array('has-error'));
     }
     EBootstrap::mergeClass($options, $option);
     return EBootstrap::openTag('div', $options);
 }
开发者ID:raphaelrocha,项目名称:mtcontrool_mtcontext,代码行数:22,代码来源:EBootstrapActiveForm.php

示例6: renderGroup

 /**
  * @param string $method the CActiveForm method name, e.g. textField, dropDownList, etc.
  * @param CModel $model the form model
  * @param string $attribute the attribute name
  * @param bool|array $listOptions list options or false if none
  * @param array $options group options
  * @return string the rendered form group
  */
 protected function renderGroup($method, $model, $attribute, $listOptions, $options)
 {
     if (isset($options['label']) && $options['label'] === false) {
         $beginLabel = $endLabel = $labelTitle = $label = '';
     } else {
         $beginLabel = \CHtml::openTag('label', $options['labelOptions']);
         $endLabel = \CHtml::closeTag('label');
         $labelTitle = isset($options['label']) ? $options['label'] : $model->getAttributeLabel($attribute);
         $label = \CHtml::tag('label', $options['labelOptions'], $labelTitle);
     }
     $beginWrapper = \CHtml::openTag($options['wrapperTag'], $options['wrapperOptions']);
     $endWrapper = \CHtml::closeTag($options['wrapperTag']);
     if ($model->hasErrors($attribute) && $options['enableErrorBlock']) {
         $error = \CHtml::tag($options['errorTag'], $options['errorOptions'], $model->getError($attribute));
         $options['groupOptions']['class'] = isset($options['groupOptions']['class']) ? $options['groupOptions']['class'] . ' has-error' : 'has-error';
     } else {
         $error = '';
     }
     $help = isset($options['helpText']) ? \CHtml::tag($options['helpTag'], $options['helpOptions'], $options['helpText']) : '';
     if ($this->layout === 'inline' && !isset($options['inputOptions']['placeholder'])) {
         $options['inputOptions']['placeholder'] = $labelTitle;
     }
     if ($listOptions) {
         $input = parent::$method($model, $attribute, $listOptions, $options['inputOptions']);
     } else {
         $input = parent::$method($model, $attribute, $options['inputOptions']);
     }
     if (isset($options['inputTemplate'])) {
         $input = strtr($options['inputTemplate'], array('{input}' => $input));
     }
     $content = strtr($options['template'], array('{label}' => $label, '{beginLabel}' => $beginLabel, '{labelTitle}' => $labelTitle, '{endLabel}' => $endLabel, '{beginWrapper}' => $beginWrapper, '{endWrapper}' => $endWrapper, '{input}' => $input, '{error}' => $error, '{help}' => $help));
     return \CHtml::tag($options['groupTag'], $options['groupOptions'], $content);
 }
开发者ID:codemix,项目名称:bs3activeform,代码行数:41,代码来源:BS3ActiveForm.php


注:本文中的CModel::getError方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。