/**
  * Runs the widget.
  */
 public function run()
 {
     if (!isset($this->uploadFolder) || !isset($this->uploadActionUrl) || !isset($this->cropActionUrl)) {
         throw new CException("uploadFolder, uploadActionUrl, and cropActionUrl are required.");
     }
     list($name, $id) = $this->resolveNameID();
     $imagePath = $this->value;
     $imageTag = '';
     if ($this->hasModel()) {
         if ($this->form) {
             $content = $this->form->hiddenField($this->model, $this->attribute, $this->htmlOptions);
         } else {
             $content = CHtml::activeHiddenField($this->model, $this->attribute, $this->htmlOptions);
         }
         $imagePath = CHtml::resolveValue($this->model, $this->attribute);
         if (isset($this->model->attributes[$this->existingFileAttribute])) {
             if ($this->model->attributes[$this->existingFileAttribute] != '') {
                 if (isset($this->existingFileAttribute)) {
                     $imagePath = CHtml::resolveValue($this->model, $this->existingFileAttribute);
                 }
                 if (isset($this->existingFileFolder) && ($imagePath != null && $imagePath != '')) {
                     $imagePath = $this->existingFileFolder . '/' . $imagePath;
                 }
             }
         }
     } else {
         $content = CHtml::hiddenField($name, $this->value, $this->htmlOptions);
     }
     if ($imagePath != null && $imagePath != '') {
         $imageTag = CHtml::image($imagePath . '?_=' . time());
     }
     $content .= CHtml::tag('div', array('id' => $id . $this->uploadIdPostFix), '', true);
     $content .= CHtml::tag('div', array('id' => $id . $this->imageIdPostFix), $imageTag, true);
     echo CHtml::tag($this->tag, $this->tagHtmlOptions, $content, true);
     $this->registerClientScript($id);
 }
Пример #2
0
        <div class="span8">
            <div class="row-fluid">
                <div class="span2">
                    <?php 
echo $form->labelEx($model, 'CourseID');
?>
                    <?php 
echo $form->dropDownList($model, 'CourseID', CHtml::listData(Courses::model()->findAll(), 'idCourse', 'CourseName'), array('empty' => '', 'class' => 'span12', 'disabled' => !$model->isNewRecord || Yii::app()->user->isPkSet("CourseID")));
?>
                    <?php 
//echo $form->error($model,'CourseID');
?>
                </div>
                <div class="span3">
                    <?php 
echo $form->hiddenField($model, 'QualificationID');
echo $form->labelEx($model, 'QualificationID');
?>
                    <?php 
echo $form->dropDownList($model, 'QualificationID', CHtml::listData(Qualifications::model()->findAll("idQualification = 2 or idQualification = 3"), 'idQualification', 'QualificationName'), array('disabled' => !$model->isNewRecord, 'class' => "span12", 'id' => "QualificationID", 'onchange' => "PSN.changeQType(this ,'" . CController::createUrl('personspeciality/create', array("personid" => $personid, "reload" => 1)) . "');"));
?>
                    <?php 
//echo $form->error($model,'QualificationID');
?>
                </div>
                <div class="span3">
                    <?php 
echo $form->labelEx($model, 'EducationFormID');
?>
                    <?php 
echo $form->dropDownList($model, 'EducationFormID', CHtml::listData(Personeducationforms::model()->findAll("idPersonEducationForm in (1,2)"), 'idPersonEducationForm', 'PersonEducationFormName'), array('empty' => '', 'disabled' => !$model->isNewRecord, 'class' => "span12", 'onchange' => "PSN.onFacChange(this, '#" . CHtml::activeId($model, "SepcialityID") . "','" . CController::createUrl('personspeciality/speciality') . "');"));
Пример #3
0
    echo $form->dropDownList($model, 'StatusID', CHtml::listData(Personrequeststatustypes::model()->findAll(), "idPersonRequestStatusType", "PersonRequestStatusTypeName"), array('empty' => "", 'class' => "span12", 'disabled' => $access));
    ?>

                    </div>
                <?php 
}
?>

            </div>
        </div>
    </div>
    <hr>
    <div class="row-fluid">
        <div class="span1 priority-holder">
            <?php 
echo $form->hiddenField($model, 'priority');
?>
            <?php 
echo $form->labelEx($model, 'priority');
?>
            <?php 
$priority_data = array();
for ($i = 0; $i <= 15; $i++) {
    if ($i == 0) {
        $priority_data[$i] = "";
    } else {
        $priority_data[$i] = $i;
    }
}
echo $form->dropDownList($model, 'priority', $priority_data, array('class' => 'span12', "id" => "priority-select", 'disabled' => !empty($model->edboID)));
?>