/**
  * Renvoie une ligne à insérer dans le tableau 'attributes' d'un widget de type CDetailView, CGridView...
  * Le formatage varie selon le type de la colonne $column
  * @param CDbColumnSchema $column
  * @param CActiveRecord   $templateRecord
  * @return string
  */
 public static function getViewAttributesEntry(CDbColumnSchema $column, CActiveRecord $templateRecord)
 {
     switch ($column->dbType) {
         case 'date':
             $out = "{$column->name}:date:" . $templateRecord->getAttributeLabel($column->name);
             break;
         case 'datetime':
             $out = "{$column->name}:datetime:" . $templateRecord->getAttributeLabel($column->name);
             break;
         default:
             $out = $column->name;
     }
     return $out;
 }
Example #2
0
    public function run()
    {
        $idFrom = EHtml::resolveId($this->model, $this->attributeName);
        $idTo = EHtml::resolveId($this->model, $this->attributeDateTo);
        Yii::app()->clientScript->registerScript('datePickerInitialize', '
			$.datepicker.setDefaults( $.datepicker.regional["ru"] );
			$("#' . $idFrom . '").datepicker({
				onSelect: function( selectedDate ) {
					$( "#' . $idTo . '" ).datepicker( "option", "minDate", selectedDate );
				}
			});
			$("#' . $idTo . '").datepicker({
				onSelect: function( selectedDate ) {
					$( "#' . $idFrom . '" ).datepicker( "option", "maxDate", selectedDate );
				}
			});
		');
        echo "\n<style type='text/css'>\n.controls-line {\n\tmargin-bottom: 5px;\n}\n</style>\n<div class='control-group'>\n\t" . CHtml::activeLabelEx($this->model, $this->attributeName, array('class' => 'control-label')) . "\n\t<div class='controls controls-line'>\n\t\t<div class='input-append'>\n\t\t\t{$this->form->textField($this->model, $this->attributeName)}<span class='add-on'><i class='icon-calendar'></i></span>\n\t\t</div>\n\t\t<div class='input-append'>\n\t\t\t<label style='margin: 0 20px; display:inline;' for='" . $idTo . "'>\n\t\t\t\t{$this->model->getAttributeLabel($this->attributeDateTo)}\n\t\t\t</label>\n\t\t\t{$this->form->textField($this->model, $this->attributeDateTo)}<span class='add-on'><i class='icon-calendar'></i></span>\n\t\t</div>\n\t</div>\n\t<div class='controls'>\n\t\t{$this->form->error($this->model, $this->attributeName)}\n\t\t{$this->form->error($this->model, $this->attributeDateTo)}\n\t</div>\n</div>\n";
    }
Example #3
0
 public function renderForm()
 {
     echo '<br />';
     echo '<br />';
     echo CHtml::tag('h3', array(), $this->exoModel->getAttributeLabel($this->exoAttr));
     echo '<hr />';
     $this->renderInputs();
     echo '<br />';
     echo '<br />';
 }
Example #4
0
File: Wms.php Project: Gnafu/wiz
 /**
  * This function internationalize the labels using Yii::t()
  * @see CActiveRecord::getAttributeLabel()
  */
 public function getAttributeLabel($attribute)
 {
     $baseLabel = parent::getAttributeLabel($attribute);
     return Yii::t('waterrequest', $baseLabel);
 }
Example #5
0
 /**
  * @param CActiveRecord $model
  * @param array $attributes
  * @return array
  */
 public static function getElements($model, $attributes = [])
 {
     $modelAttributes = $model->getAttributes();
     $modelElements = [];
     foreach ($modelAttributes as $attrName => $attrVal) {
         if (!empty($attributes)) {
             foreach ($attributes as $attr) {
                 if ($attrName === $attr) {
                     $modelElements[$attr] = ['label' => $model->getAttributeLabel($attr), 'required' => $model->isAttributeRequired($attr), 'type' => 'text'];
                 }
             }
             continue;
         }
         $modelElements[$attrName] = ['label' => $model->getAttributeLabel($attrName), 'required' => $model->isAttributeRequired($attrName), 'type' => 'text'];
         //			if ($field->inputType == 'dropdownlist') {
         //				$elements['elements']['contextFields']['elements'][$field->inputName . '-' . $field->id]['items'] =
         //					Options::model()->getContextFieldOptions($field->id);
         //			}
     }
     return $modelElements;
 }
 public function getAttributeLabel($attribute)
 {
     if (!$this->eavEnable) {
         return parent::getAttributeLabel($attribute);
     }
     if ($this->hasEavAttribute($attribute)) {
         if (!is_null($this->eavAttributeInstances[$attribute]->label) && $this->eavAttributeInstances[$attribute]->label !== '') {
             return $this->eavAttributeInstances[$attribute]->label;
         }
     }
     return parent::getAttributeLabel($attribute);
 }
Example #7
0
 /**
  * This function internationalize the labels using Yii::t()
  * @see CActiveRecord::getAttributeLabel()
  */
 public function getAttributeLabel($attribute)
 {
     $baseLabel = parent::getAttributeLabel($attribute);
     return Yii::t('user', $baseLabel);
 }
Example #8
0
 public function attributeLabels()
 {
     return array('email' => $this->_model->getAttributeLabel($this->emailAtt), 'username' => $this->_model->getAttributeLabel($this->nameAtt), 'password' => HOAuthAction::t('Password'));
 }