상속: extends CActiveForm
예제 #1
0
 public function run()
 {
     echo '<div class="control-group">';
     $htmlOptions['class'] = 'control-label';
     echo $this->form->labelEx($this->model, $this->attribute, $htmlOptions);
     echo '<div class="controls">';
     parent::run();
     echo $this->form->error($this->model, $this->attribute);
     echo "</div>";
     echo "</div>";
 }
예제 #2
0
 /**
  * Runs the widget.
  */
 public function run()
 {
     list($name, $id) = $this->resolveNameID();
     if ($this->hasModel()) {
         if ($this->form) {
             echo $this->form->textField($this->model, $this->attribute, $this->htmlOptions);
         } else {
             echo CHtml::activeTextField($this->model, $this->attribute, $this->htmlOptions);
         }
     } else {
         echo CHtml::textField($name, $this->attribute, $this->htmlOptions);
     }
     $this->registerClientScript($id);
 }
예제 #3
0
 /**
  * Runs the widget.
  */
 public function run()
 {
     list($name, $id) = $this->resolveNameID();
     // Add a class of no-user-select to widget
     $this->htmlOptions['class'] = empty($this->htmlOptions['class']) ? 'no-user-select' : 'no-user-select ' . $this->htmlOptions['class'];
     if ($this->hasModel()) {
         if ($this->form) {
             echo $this->form->textField($this->model, $this->attribute, $this->htmlOptions);
         } else {
             echo CHtml::activeTextField($this->model, $this->attribute, $this->htmlOptions);
         }
     } else {
         echo CHtml::textField($name, $this->value, $this->htmlOptions);
     }
     $this->registerClientScript($id);
 }
예제 #4
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";
    }
예제 #5
0
 public function actionAdd($id = 0)
 {
     if (!empty($id)) {
         $Custom = Custom::model()->findByPk($id);
         if (!Yii::app()->user->checkAccess('admin') && ((Yii::app()->getUser()->getProfile()->modules->head != UserModules::DIRECTOR_COMPANY || Yii::app()->user->getProfile()->company_id != $Custom->user->company_id) && (Yii::app()->getUser()->getProfile()->modules->customs != '1' || $Custom->user_id != Yii::app()->user->id) || Yii::app()->getUser()->getProfile()->company->active == '0')) {
             throw new CHttpException(403);
         }
         $ContentManager = null;
     } else {
         if (Yii::app()->user->getProfile()->content_manager == '0') {
             if (!Yii::app()->user->checkAccess('admin') && (Yii::app()->getUser()->getProfile()->modules->head != UserModules::DIRECTOR_COMPANY && Yii::app()->getUser()->getProfile()->modules->customs != '1' || Yii::app()->getUser()->getProfile()->company->active == '0')) {
                 throw new CHttpException(403);
             } elseif (!Yii::app()->getUser()->getProfile()->company->validate) {
                 $this->redirect('/complete');
             }
             $ContentManager = null;
         } else {
             $ContentManager = new ContentManager();
         }
         $Custom = new Custom();
     }
     $contacts = User::getContact();
     if (!empty($_POST)) {
         if (!empty($_POST['Custom']['custom_id'])) {
             $Custom = Custom::model()->findByPk($_POST['Custom']['custom_id']);
         } else {
             $Custom = new Custom();
         }
         $Custom->setAttributes($_POST['Custom'], false);
         if (Yii::app()->user->getProfile()->content_manager == '1' && $id == 0) {
             $ContentManager->setAttributes($_POST['ContentManager'], false);
         }
         if (!$Custom->validate()) {
             Yii::import('bootstrap.widgets.TbActiveForm');
             if ($ContentManager) {
                 echo TbActiveForm::validate(array($Custom, $ContentManager));
             } else {
                 echo TbActiveForm::validate(array($Custom));
             }
             Yii::app()->end();
         } else {
             if (Yii::app()->user->getProfile()->content_manager == '1' && $id == 0) {
                 $Custom->user_id = User::createFakeUser($ContentManager);
                 $Custom->contact_id = $Custom->user_id;
             }
             $Custom->save();
             $Custom->setPacking($Custom->custom_id, $_POST['Custom']['packing_id']);
             $Custom->autosearch();
             echo CJSON::encode(array('status' => '500', 'redirect' => '/customsaddsuccess/' . $Custom->custom_id));
             Yii::app()->end();
         }
     }
     $this->render('add', ['Custom' => $Custom, 'contacts' => $contacts, 'ContentManager' => $ContentManager]);
 }
 /**
  * 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);
 }
예제 #7
0
    public function run()
    {
        $model = $this->model;
        $attribute = $this->attribute;
        $form = $this->form;
        echo '<style type="text/css">
		.controls-line {
			margin-bottom: 5px;
		}
		</style>';
        echo '<div class="control-group">';
        $htmlOptions['class'] = 'control-label';
        echo CHtml::activeLabelEx($model, $attribute, $htmlOptions);
        if (is_array($model->{$attribute})) {
            foreach ($model->{$attribute} as $id => $value) {
                $thumbnail = $value;
                if (!empty($this->thumbnailImage)) {
                    $thumbnail = $this->evaluateExpression($this->thumbnailImage, array('data' => $model, 'value' => $value));
                }
                $image = $this->evaluateExpression($this->image, array('data' => $model, 'value' => $value));
                echo '<div class="controls controls-line">';
                echo CHtml::link(CHtml::image($thumbnail, '', array('style' => "max-width:{$this->maxImageSize}px; max-height:{$this->maxImageSize}px")), $image, array('target' => '_blank', 'style' => 'margin-right:1em'));
                echo '<label class="checkbox" style="display:inline-block" for="' . EHtml::resolveId($model, $this->removeImageFieldName . "[{$id}]") . '">';
                echo $form->checkBox($model, $this->removeImageFieldName . "[{$id}]");
                echo $model->getAttributeLabel($this->removeImageFieldName);
                echo '</label></div>';
            }
        }
        echo '<div class="controls">';
        echo $this->form->error($model, $this->uploadedFileFieldName);
        echo '</div>';
        $fileUploadTemplate = '<div class="controls">';
        $fileUploadTemplate .= CHtml::activeFileField($model, $this->uploadedFileFieldName . "[]");
        $fileUploadTemplate .= "</div>";
        $fileUploadTemplate = json_encode($fileUploadTemplate);
        echo '<div class="controls js-button">';
        $this->widget('bootstrap.widgets.TbButton', array('label' => 'Добавить изображение', 'icon' => 'plus'));
        echo "</div>";
        echo '<script type="text/javascript">
		$("div.js-button a").bind("click", function() {
			$(' . $fileUploadTemplate . ').insertBefore($(this).closest("div.controls")).show();
		});
		</script>';
        echo "</div>";
    }
예제 #8
0
파일: ModelForm.php 프로젝트: schyzoo/giiy
 public function init()
 {
     $assets = Yii::app()->getAssetManager()->publish(dirname(__FILE__) . '/assets');
     Yii::app()->clientScript->registerScriptFile($assets . '/js/modelForm.js');
     Yii::app()->clientScript->registerPackage('modelForm');
     Yii::app()->clientScript->registerPackage('jquery.ui');
     Yii::app()->clientScript->registerPackage('jquery');
     Yii::app()->clientScript->registerPackage('cookie');
     Yii::app()->clientScript->registerScript('yiiParams', '
         var yiiParams = ' . json_encode(Yii::app()->params->toArray()) . ';
     ', CClientScript::POS_HEAD);
     if (!$this->fromModel && $this->model instanceof IFileBased) {
         echo $this->upload('id');
     }
     if (!$this->fromModel) {
         $this->htmlOptions['onsubmit'] = 'return modelFormSubmit();';
     }
     $this->htmlOptions['isNew'] = (int) (!$this->model->id);
     parent::init();
 }
예제 #9
0
 /**
  * Initializes the widget.
  * This renders the form open tag.
  */
 public function init()
 {
     // modal-form for popups
     if (Yii::app()->request->isAjaxRequest) {
         if (!isset($this->htmlOptions['class'])) {
             $this->htmlOptions['class'] = '';
         }
         $this->htmlOptions['class'] .= ' modal-form';
     }
     // get a model we can use for this form
     $this->model = $this->model ? $this->model : new YdActiveFormModel();
     // init the parent (output <form> tag)
     parent::init();
     // output the return url
     if ($this->returnUrl !== false) {
         echo CHtml::hiddenField('returnUrl', $this->returnUrl ? $this->returnUrl : Yii::app()->returnUrl->getFormValue());
     }
     // ask to save work
     if ($this->askToSaveWork) {
         Yii::app()->controller->widget('widgets.AskToSaveWork', array('watchElement' => '#setting-form :input', 'message' => Yii::t('dressing', 'Please save before leaving the page.')));
     }
 }
예제 #10
0
 /**
  * Initializes the widget.
  * This renders the form open tag.
  */
 public function init()
 {
     if (!isset($this->htmlOptions['class'])) {
         $this->htmlOptions['class'] = 'form-' . $this->type;
     } else {
         $this->htmlOptions['class'] .= ' form-' . $this->type;
     }
     if (!isset($this->inlineErrors)) {
         $this->inlineErrors = $this->type === self::TYPE_HORIZONTAL;
     }
     if (!isset($this->errorField)) {
         self::$showError = $this->errorField;
     }
     if ($this->inlineErrors) {
         $this->errorMessageCssClass = 'help-inline error';
     } else {
         $this->errorMessageCssClass = 'help-block has-error';
     }
     if ($this->enter2tab) {
         $this->enterToTab();
     }
     $this->htmlOptions['role'] = "form";
     parent::init();
 }
예제 #11
0
 /**
  * Create TbActiveForm widget.
  *
  * @param TbActiveForm $form
  * @param object $model Model
  * @param string $attribute Model attribute
  */
 public function createWidget($form, $model, $attribute)
 {
     $lang = Yii::app()->language;
     if ($lang == 'en_us') {
         $lang = 'en';
     }
     $widget = $this->getAttributeWidget($model, $attribute);
     switch ($widget) {
         case 'time':
             if ($form->type == TbActiveForm::TYPE_HORIZONTAL) {
                 echo '<div class="control-group">';
                 echo $form->labelEx($model, $attribute, array('class' => 'control-label'));
                 echo '<div class="controls">';
             } else {
                 echo $form->labelEx($model, $attribute);
             }
             echo '<div class="input-prepend"><span class="add-on"><i class="icon-time"></i></span>';
             $options = array('model' => $model, 'attribute' => $attribute, 'language' => $lang, 'mode' => 'time', 'htmlOptions' => array('class' => 'size-medium'), 'options' => array('timeFormat' => 'HH:mm:ss', 'showSecond' => true));
             $options = $this->getAttributeOptions($attribute, $options);
             $this->controller->widget($this->name . '.extensions.jui.EJuiDateTimePicker', $options);
             echo '</div>';
             echo $form->error($model, $attribute);
             if ($form->type == TbActiveForm::TYPE_HORIZONTAL) {
                 echo '</div></div>';
             }
             break;
         case 'datetime':
             if ($form->type == TbActiveForm::TYPE_HORIZONTAL) {
                 echo '<div class="control-group">';
                 echo $form->labelEx($model, $attribute, array('class' => 'control-label'));
                 echo '<div class="controls">';
             } else {
                 echo $form->labelEx($model, $attribute);
             }
             echo '<div class="input-prepend"><span class="add-on"><i class="icon-calendar"></i></span>';
             $options = array('model' => $model, 'attribute' => $attribute, 'language' => $lang, 'mode' => 'datetime', 'htmlOptions' => array('class' => 'size-medium'), 'options' => array('dateFormat' => 'yy-mm-dd', 'timeFormat' => 'HH:mm:ss', 'showSecond' => true));
             $options = $this->getAttributeOptions($attribute, $options);
             $this->controller->widget($this->name . '.extensions.jui.EJuiDateTimePicker', $options);
             echo '</div>';
             echo $form->error($model, $attribute);
             if ($form->type == TbActiveForm::TYPE_HORIZONTAL) {
                 echo '</div></div>';
             }
             break;
         case 'date':
             if ($form->type == TbActiveForm::TYPE_HORIZONTAL) {
                 echo '<div class="control-group">';
                 echo $form->labelEx($model, $attribute, array('class' => 'control-label'));
                 echo '<div class="controls">';
             } else {
                 echo $form->labelEx($model, $attribute);
             }
             echo '<div class="input-prepend"><span class="add-on"><i class="icon-calendar"></i></span>';
             $options = array('model' => $model, 'attribute' => $attribute, 'language' => $lang, 'mode' => 'date', 'htmlOptions' => array('class' => 'size-medium'), 'options' => array('dateFormat' => 'yy-mm-dd'));
             $options = $this->getAttributeOptions($attribute, $options);
             $this->controller->widget($this->name . '.extensions.jui.EJuiDateTimePicker', $options);
             echo '</div>';
             echo $form->error($model, $attribute);
             if ($form->type == TbActiveForm::TYPE_HORIZONTAL) {
                 echo '</div></div>';
             }
             break;
         case 'wysiwyg':
             if ($form->type == TbActiveForm::TYPE_HORIZONTAL) {
                 echo '<div class="control-group">';
                 echo $form->labelEx($model, $attribute, array('class' => 'control-label'));
                 echo '<div class="controls">';
             } else {
                 echo $form->labelEx($model, $attribute);
             }
             $options = array('model' => $model, 'attribute' => $attribute, 'options' => array('lang' => $lang, 'buttons' => array('formatting', '|', 'bold', 'italic', 'deleted', '|', 'unorderedlist', 'orderedlist', 'outdent', 'indent', '|', 'image', 'link', '|', 'html')));
             $options = $this->getAttributeOptions($attribute, $options);
             if ($this->redactorUpload === true) {
                 $redactorOptions = array('options' => array('imageUpload' => Yii::app()->createUrl($this->name . '/model/redactorImageUpload', array('name' => get_class($model), 'attr' => $attribute)), 'imageGetJson' => Yii::app()->createUrl($this->name . '/model/redactorImageList', array('name' => get_class($model), 'attr' => $attribute)), 'imageUploadErrorCallback' => new CJavaScriptExpression('function(obj,json) { alert(json.error); }')));
                 $options = array_merge_recursive($options, $redactorOptions);
             }
             $this->controller->widget($this->name . '.extensions.redactor.ERedactorWidget', $options);
             echo $form->error($model, $attribute);
             if ($form->type == TbActiveForm::TYPE_HORIZONTAL) {
                 echo '</div></div>';
             }
             break;
         case 'textArea':
             $options = array('rows' => 5, 'cols' => 50, 'class' => 'span8');
             $options = $this->getAttributeOptions($attribute, $options);
             echo $form->textAreaRow($model, $attribute, $options);
             break;
         case 'textField':
             $options = array('class' => 'span5');
             $options = $this->getAttributeOptions($attribute, $options);
             echo $form->textFieldRow($model, $attribute, $options);
             break;
         case 'chosen':
             $options = array('empty' => Yii::t('YcmModule.ycm', 'Choose {name}', array('{name}' => $model->getAttributeLabel($attribute))), 'class' => 'span5 chosen-select');
             $options = $this->getAttributeOptions($attribute, $options);
             $this->controller->widget($this->name . '.extensions.chosen.EChosenWidget');
             echo $form->dropDownListRow($model, $attribute, $this->getAttributeChoices($model, $attribute), $options);
             break;
         case 'chosenMultiple':
             $options = array('data-placeholder' => Yii::t('YcmModule.ycm', 'Choose {name}', array('{name}' => $model->getAttributeLabel($attribute))), 'multiple' => 'multiple', 'class' => 'span5 chosen-select');
             $options = $this->getAttributeOptions($attribute, $options);
             $this->controller->widget($this->name . '.extensions.chosen.EChosenWidget');
             echo $form->dropDownListRow($model, $attribute, $this->getAttributeChoices($model, $attribute), $options);
             break;
         case 'taggable':
             if ($form->type == TbActiveForm::TYPE_HORIZONTAL) {
                 echo '<div class="control-group">';
                 echo $form->labelEx($model, $attribute, array('class' => 'control-label'));
                 echo '<div class="controls">';
             } else {
                 echo $form->labelEx($model, $attribute);
             }
             $options = array('name' => $attribute, 'value' => $model->{$attribute}->toString(), 'url' => Yii::app()->createUrl($this->name . '/model/suggestTags', array('name' => get_class($model), 'attr' => $attribute)), 'multiple' => true, 'mustMatch' => false, 'matchCase' => false, 'htmlOptions' => array('size' => 50, 'class' => 'span5'));
             $options = $this->getAttributeOptions($attribute, $options);
             $this->controller->widget('CAutoComplete', $options);
             echo '<span class="help-inline">' . Yii::t('YcmModule.ycm', 'Separate words with commas.') . '</span>';
             echo $form->error($model, $attribute);
             if ($form->type == TbActiveForm::TYPE_HORIZONTAL) {
                 echo '</div></div>';
             }
             break;
         case 'dropDown':
             $options = array('empty' => Yii::t('YcmModule.ycm', 'Choose {name}', array('{name}' => $model->getAttributeLabel($attribute))), 'class' => 'span5');
             $options = $this->getAttributeOptions($attribute, $options);
             echo $form->dropDownListRow($model, $attribute, $this->getAttributeChoices($model, $attribute), $options);
             break;
         case 'typeHead':
             if ($form->type == TbActiveForm::TYPE_HORIZONTAL) {
                 echo '<div class="control-group">';
                 echo $form->labelEx($model, $attribute, array('class' => 'control-label'));
                 echo '<div class="controls">';
             } else {
                 echo $form->labelEx($model, $attribute);
             }
             $options = array('model' => $model, 'attribute' => $attribute, 'htmlOptions' => array('class' => 'span5', 'autocomplete' => 'off'), 'options' => array('name' => 'typeahead', 'source' => $this->getAttributeChoices($model, $attribute), 'matcher' => "js:function(item) {\n\t\t\t\t\t\t\treturn ~item.toLowerCase().indexOf(this.query.toLowerCase());\n\t\t\t\t\t\t}"));
             $options = $this->getAttributeOptions($attribute, $options, true);
             $this->controller->widget('bootstrap.widgets.TbTypeahead', $options);
             echo $form->error($model, $attribute);
             if ($form->type == TbActiveForm::TYPE_HORIZONTAL) {
                 echo '</div></div>';
             }
             break;
         case 'radioButton':
             $options = array();
             $options = $this->getAttributeOptions($attribute, $options);
             echo $form->radioButtonListRow($model, $attribute, $this->getAttributeChoices($model, $attribute), $options);
             break;
         case 'boolean':
             $options = array();
             $options = $this->getAttributeOptions($attribute, $options);
             echo $form->checkboxRow($model, $attribute, $options);
             break;
         case 'password':
             $options = array('class' => 'span5');
             $options = $this->getAttributeOptions($attribute, $options);
             echo $form->passwordFieldRow($model, $attribute, $options);
             break;
         case 'disabled':
             $options = array('class' => 'span5', 'disabled' => true);
             $options = $this->getAttributeOptions($attribute, $options);
             echo $form->textFieldRow($model, $attribute, $options);
             break;
         case 'file':
             $options = array('class' => 'span5');
             $options = $this->getAttributeOptions($attribute, $options);
             if (!$model->isNewRecord && !empty($model->{$attribute})) {
                 ob_start();
                 echo '<p>';
                 $this->controller->widget('bootstrap.widgets.TbButton', array('label' => Yii::t('YcmModule.ycm', 'Download'), 'type' => '', 'url' => $model->getFileUrl($attribute)));
                 echo '</p>';
                 $html = ob_get_clean();
                 $options['hint'] = $html;
             }
             echo $form->fileFieldRow($model, $attribute, $options);
             break;
         case 'image':
             $options = array('class' => 'span5');
             $options = $this->getAttributeOptions($attribute, $options);
             if (!$model->isNewRecord && !empty($model->{$attribute})) {
                 $modalName = 'modal-image-' . $attribute;
                 $image = CHtml::image($model->getFileUrl($attribute), Yii::t('YcmModule.ycm', 'Image'), array('class' => 'modal-image'));
                 ob_start();
                 $this->controller->beginWidget('bootstrap.widgets.TbModal', array('id' => $modalName));
                 echo '<div class="modal-header"><a class="close" data-dismiss="modal">&times;</a><h4>';
                 echo Yii::t('YcmModule.ycm', 'Image preview') . '</h4></div>';
                 echo '<div class="modal-body">' . $image . '</div>';
                 $this->controller->endWidget();
                 echo '<p>';
                 $this->controller->widget('bootstrap.widgets.TbButton', array('label' => Yii::t('YcmModule.ycm', 'Preview'), 'type' => '', 'htmlOptions' => array('data-toggle' => 'modal', 'data-target' => '#' . $modalName)));
                 echo '</p>';
                 $html = ob_get_clean();
                 $options['hint'] = $html;
             }
             echo $form->fileFieldRow($model, $attribute, $options);
             break;
         case 'hide':
             break;
         default:
             $options = array('class' => 'span5');
             $options = $this->getAttributeOptions($attribute, $options);
             echo $form->textFieldRow($model, $attribute, $options);
             break;
     }
 }
예제 #12
0
<?php

/* @var $this PersonspecialityController */
/* @var $model Personspeciality */
/* @var $form CActiveForm */
?>

<div class="form">

    <?php 
$personid = $model->PersonID;
$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array('id' => 'spec-form-modal', 'enableAjaxValidation' => false));
$form = new TbActiveForm();
?>

    <?php 
echo $form->errorSummary($model);
?>
    <?php 
echo CHtml::hiddenField('personid', $personid);
?>
    <?php 
//echo !$model->isNewRecord ? $form->hiddenField($model,'idSpeciality') : "";
//debug($model->attributeLabels("isBudget"));
?>
    <div class="row-fluid">
        <div class="span5">
            <div class="row-fluid">
                <div class="span4">
                    <?php 
echo $form->labelEx($model, 'isBudget');
예제 #13
0
<?php

$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array('id' => 'specialitysubjects-form', 'enableAjaxValidation' => false));
$form = new TbActiveForm();
?>

	<p class="help-block">Fields with <span class="required">*</span> are required.</p>

	<?php 
if (empty($SpecialityID)) {
    $SpecialityID = 0;
}
echo CHtml::dropDownList("SpecialityID", $SpecialityID, Specialities::DropDown(), array('empty' => "", 'class' => 'span5'));
$c = new CDbCriteria();
$c->order = 'SubjectName';
$c->compare('idZNOSubject', '>0');
$data = CHtml::listData(Subjects::model()->findAll($c), "idSubjects", "SubjectName");
$dataCount = count($data);
?>
        <div class ="row-fluid">
            <?php 
echo $form->error($models[0], "SpecialityID");
?>
        </div>
        
        <div class ="row-fluid">
            <?php 
foreach ($models as $i => $model) {
    ?>
            <div class="span4">
                <?php 
예제 #14
0
<?php

$burl = Yii::app()->baseUrl;
Yii::app()->getClientScript()->registerCoreScript('jquery');
Yii::app()->clientScript->registerScriptFile($burl . "/js/bootstrap-datepicker.js");
Yii::app()->clientScript->registerScriptFile($burl . "/js/person.js");
$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array('id' => 'person-form', 'enableAjaxValidation' => false, 'htmlOptions' => array("class" => "well form")));
$form = new TbActiveForm();
?>
      


<p class="help-block"><strong>Особисті дані</strong></p>
        <hr>
<!--        <div class="row-fluid">
            <div class ="span12">
                <?php 
//echo $form->errorSummary($model)
?>
            </div>
        </div>-->
            
        <div class="row-fluid">
            <div class ="span9">
            <div class="row-fluid">
                <div class ="span4">
                <?php 
echo $form->labelEx($model, 'LastName');
//,array('class'=>'span3'));
?>
                <?php 
예제 #15
0
<?php

$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array('id' => 'user-form', 'enableAjaxValidation' => false));
$form = new TbActiveForm();
?>

	<p class="help-block">Поля з <span class="required">*</span> є обов'язковими для заповнення.</p>

	

	<?php 
echo $form->textFieldRow($model, 'username', array('class' => 'span5', 'maxlength' => 255));
?>

	<?php 
echo $form->passwordFieldRow($model, 'password', array('class' => 'span5', 'maxlength' => 255));
?>

	<?php 
echo $form->textFieldRow($model, 'email', array('class' => 'span5', 'maxlength' => 255));
?>
        
        <?php 
echo $form->dropDownListRow($model, 'SysPkID', CHtml::listData(SysPk::model()->findAll(), "idPk", "PkName"), array('empty' => "", 'class' => 'span5'));
?>

	<?php 
echo $form->textAreaRow($model, 'info', array('rows' => 6, 'cols' => 50, 'class' => 'span8'));
?>
        
        
예제 #16
0
 /**
  *  обавить
  * @param int $id
  * @param null $delivery
  * @throws CException
  * @throws CHttpException
  */
 public function actionAdd($id = 0, $delivery = null)
 {
     if (!empty($id)) {
         $Cargo = Cargo::model()->findByPk($id);
         if (!Yii::app()->user->checkAccess('admin') && ((Yii::app()->getUser()->getProfile()->modules->head != \UserModules::DIRECTOR_COMPANY || Yii::app()->user->getProfile()->company_id != $Cargo->user->company_id) && (Yii::app()->getUser()->getProfile()->modules->cargo != '1' || $Cargo->user_id != Yii::app()->user->id) || Yii::app()->getUser()->getProfile()->company->active == '0')) {
             throw new CHttpException(403);
         }
         $AddressesForm = $Cargo->getAddressForm();
         $CostForm = $Cargo->getCostForm();
         $ContentManager = null;
     } else {
         if (Yii::app()->user->getProfile()->content_manager == '0') {
             if (!Yii::app()->user->checkAccess('admin') && (Yii::app()->getUser()->getProfile()->modules->head != \UserModules::DIRECTOR_COMPANY && Yii::app()->getUser()->getProfile()->modules->cargo != '1' || Yii::app()->getUser()->getProfile()->company->active == '0')) {
                 throw new CHttpException(403);
             } elseif (!Yii::app()->getUser()->getProfile()->company->validate) {
                 $this->redirect('/complete');
             }
             $ContentManager = null;
         } else {
             $ContentManager = new ContentManager();
         }
         $Cargo = new Cargo();
         $AddressesForm = new AddressesForm();
         if (isset($delivery)) {
             $product = Product::model()->findByPk($delivery);
             $AddressesForm->from_1_name = $product->getEavAttribute('adres_name');
             $AddressesForm->from_1_address_lat = $product->getEavAttribute('adres_adress_lat');
             $AddressesForm->from_1_address_long = $product->getEavAttribute('adres_adress_long');
             $AddressesForm->from_1_ind = '';
         }
         $CostForm = new CostForm();
     }
     $contacts = User::getContact();
     $Cargo->contact_id = Yii::app()->user->id;
     if (!empty($_POST)) {
         $Cargo->setAttributes($_POST['Cargo'], false);
         $AddressesForm->setAttributes($_POST['AddressesForm'], false);
         if ($Cargo->price_asc == '0') {
             $CostForm->setAttributes($_POST['CostForm'], false);
         }
         if (Yii::app()->user->getProfile()->content_manager == '1' && $id == 0) {
             $ContentManager->setAttributes($_POST['ContentManager'], false);
             $contentValid = $ContentManager->validate();
         } else {
             $contentValid = true;
         }
         $valid = $AddressesForm->validate();
         $valid = $Cargo->validate() && $CostForm->validate() && $valid && $contentValid;
         if (!$valid) {
             Yii::import('bootstrap.widgets.TbActiveForm');
             if ($ContentManager) {
                 echo TbActiveForm::validate(array($Cargo, $AddressesForm, $CostForm, $ContentManager));
             } else {
                 echo TbActiveForm::validate(array($Cargo, $AddressesForm, $CostForm));
             }
             Yii::app()->end();
         } else {
             if (Yii::app()->user->getProfile()->content_manager == '1' && $id == 0) {
                 $Cargo->user_id = User::createFakeUser($ContentManager);
                 $Cargo->contact_id = $Cargo->user_id;
             }
             $Cargo->save();
             $_POST['Cargo']['type_transport'] = '';
             if (isset($Cargo->transport_type_id)) {
                 switch ($Cargo->transport_type_id) {
                     case 20:
                         $_POST['Cargo']['type_transport'] = $_POST['Cargo']['sea_transport'];
                         break;
                     case 21:
                         $_POST['Cargo']['type_transport'] = $_POST['Cargo']['zhd_transport'];
                         break;
                     case 22:
                         $_POST['Cargo']['type_transport'] = $_POST['Cargo']['air_transport'];
                         break;
                     case 72:
                         $_POST['Cargo']['type_transport'] = $_POST['Cargo']['river_transport'];
                         break;
                     default:
                         break;
                 }
             }
             $Cargo->setRelations($_POST['Cargo']);
             $Cargo->setAddress($AddressesForm);
             $Cargo->setCost($CostForm);
             $Cargo->autosearch();
             if ($_POST['Cargo']['customs_clearance'] == 1) {
                 if ($_POST['AddressesForm']['from_1_ind'] == 'RU') {
                     $_POST['AddressesForm']['from_1_ind'] = 'RUS';
                 }
                 if ($_POST['AddressesForm']['to_1_ind'] == 'RU') {
                     $_POST['AddressesForm']['to_1_ind'] = 'RUS';
                 }
                 if ($_POST['AddressesForm']['from_1_ind'] == 'CH') {
                     $_POST['AddressesForm']['from_1_ind'] = 'CHE';
                 }
                 if ($_POST['AddressesForm']['to_1_ind'] == 'CH') {
                     $_POST['AddressesForm']['to_1_ind'] = 'CHE';
                 }
                 $from = DictionaryData::model()->findByAttributes(['code' => $_POST['AddressesForm']['from_1_ind']]);
                 $to = DictionaryData::model()->findByAttributes(['code' => $_POST['AddressesForm']['to_1_ind']]);
                 $Custom = new Custom();
                 $Custom->type_id = $_POST['Cargo']['name_id'];
                 $Custom->packing_id = $_POST['Cargo']['packing_id'];
                 $Custom->country_from = isset($from) ? $from->id : 0;
                 $Custom->country_to = isset($to) ? $to->id : 0;
                 $Custom->weight_netto = $_POST['Cargo']['weight'];
                 $Custom->weight_brutto = $_POST['Cargo']['weight'];
                 $Custom->volume = $_POST['Cargo']['volume'];
                 $Custom->date_from = $_POST['Cargo']['when_from'];
                 $Custom->date_to = $_POST['Cargo']['when_to'];
                 $Custom->user_id = Yii::app()->user->id;
                 $Custom->contact_id = $_POST['Cargo']['contact_id'];
                 $Custom->save();
                 $Custom->autosearch();
             }
             if ($_POST['Cargo']['cargo_insurance'] == 1) {
                 $addrId = Yii::app()->db->createCommand()->select('address_id')->from('site_cargo_address u')->where('cargo_id=:cargo_id', array(':cargo_id' => $Cargo->cargo_id))->order('cargo_id ASC')->limit(1)->queryRow();
                 $addr = Address::model()->findByPk($addrId);
                 $Insurance = new Insurance();
                 $Insurance->category_id = 147;
                 $Insurance->address_id = $addr->address_id;
                 $Insurance->description = '';
                 $Insurance->contact_id = $_POST['Cargo']['contact_id'];
                 $Insurance->create = date('Y-m-d H:i:s');
                 $Insurance->user_id = Yii::app()->user->id;
                 $Insurance->date_to = $_POST['Cargo']['when_to'] != '' ? $_POST['Cargo']['when_to'] : '0000-00-00';
                 $Insurance->save();
                 $Insurance->autosearch();
             }
             echo CJSON::encode(array('status' => '500', 'redirect' => '/cargoaddsuccess/' . $Cargo->cargo_id));
             Yii::app()->end();
         }
     }
     $DictionaryData = \DictionaryData::model()->findAll('group_id=3');
     $this->render('add', ['Cargo' => $Cargo, 'addreses' => $AddressesForm, 'CostForm' => $CostForm, 'contacts' => $contacts, 'ContentManager' => $ContentManager, 'DictionaryData' => $DictionaryData]);
 }
예제 #17
0
<?php

/* @var $this PersonspecialityController */
/* @var $model Personspeciality */
/* @var $form CActiveForm */
?>

<div class="form">

<?php 
$personid = $model->PersonID;
$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array('id' => 'spec-form-modal', 'enableAjaxValidation' => false));
$form = new TbActiveForm();
?>

	<?php 
echo $form->errorSummary($model);
?>
        <?php 
echo CHtml::hiddenField('personid', $personid);
?>
        <?php 
//echo !$model->isNewRecord ? $form->hiddenField($model,'idSpeciality') : "";
//debug($model->attributeLabels("isBudget"));
?>
        <div class="row-fluid">
            <div class="span2">
                 <?php 
echo $form->labelEx($model, 'isBudget');
?>
                 <div class="switch" data-on-label="Так" data-off-label="Ні">
예제 #18
0
 /**
  * TbActiveForm::textFieldRow() with min/max character length support.
  * @param  CActiveForm      $form        The CActiveForm element
  * @param  CiiSettingsModel $model       The model that we are operating on
  * @param  string           $property    The name of the property we are working with
  * @param  array            $htmlOptions An array of HTML Options
  * @param  CValidator       $validators  The Validator(s) for this property
  *                                       Since we already have it, it's worth passing through
  */
 public function textFieldRow($model, $property, $htmlOptions = array(), $validators = NULL)
 {
     if ($validators !== NULL) {
         foreach ($validators as $k => $v) {
             if (get_class($v) == "CStringValidator") {
                 if (isset($v->min)) {
                     $htmlOptions['min'] = $v->min;
                 }
                 if (isset($v->max)) {
                     $htmlOptions['max'] = $v->max;
                 }
             }
             if (get_class($v) == "CRequiredValidator") {
                 $htmlOptions['required'] = true;
             }
         }
     }
     echo parent::textFieldRow($model, $property, $htmlOptions);
 }
예제 #19
0
 public function actionAddcall($id = 0)
 {
     $flZayavka = 1;
     if (!empty($id)) {
         $this->pageTitle = Yii::t('MarketModule.default', 'Редактирование спецтехники');
         $title = Yii::t('MarketModule.default', 'Редактирование заявки на спецтехнику');
     } else {
         $this->pageTitle = Yii::t('MarketModule.default', 'Добавление спецтехники');
         $title = Yii::t('MarketModule.default', 'Добавление заявки на спецтехнику');
     }
     $this->breadcrumbs = array_merge([CHtml::encode(Yii::t('MarketModule.default', 'Заявки на спецтехнику')) => ['/specialtechniquecall']], [CHtml::encode($this->pageTitle)]);
     if (!empty($id)) {
         $SpecialTechnique = SpecialTechnique::model()->findByPk($id);
         if (!Yii::app()->user->checkAccess('admin') && ((Yii::app()->getUser()->getProfile()->modules->head != UserModules::DIRECTOR_COMPANY || Yii::app()->user->getProfile()->company_id != $SpecialTechnique->user->company_id) && (Yii::app()->getUser()->getProfile()->modules->specialtech != '1' || $SpecialTechnique->user_id != Yii::app()->user->id) || Yii::app()->getUser()->getProfile()->company->active == '0')) {
             throw new CHttpException(403);
         }
         $Address = $SpecialTechnique->address;
         $CostForm = $SpecialTechnique->getCostForm();
         $ContentManager = null;
     } else {
         if (Yii::app()->user->getProfile()->content_manager == '0') {
             if (!Yii::app()->user->checkAccess('admin') && (Yii::app()->getUser()->getProfile()->modules->head != UserModules::DIRECTOR_COMPANY && Yii::app()->getUser()->getProfile()->modules->specialtech != '1' || Yii::app()->getUser()->getProfile()->company->active == '0')) {
                 throw new CHttpException(403);
             } elseif (!Yii::app()->getUser()->getProfile()->company->validate) {
                 $this->redirect('/complete');
             }
             $ContentManager = null;
         } else {
             $ContentManager = new ContentManager();
         }
         $SpecialTechnique = new SpecialTechnique();
         $Address = new Address();
         $Address->setscenario('specialtechnique');
         $CostForm = new CostForm();
     }
     $contacts = User::getContact();
     if (!empty($_POST)) {
         if (!empty($SpecialTechnique->address)) {
             Address::model()->deleteByPk($SpecialTechnique->address->address_id);
         }
         $SpecialTechnique->setAttributes($_POST['SpecialTechnique'], false);
         $SpecialTechnique->type_request = 'request';
         $CostForm->setAttributes($_POST['CostForm'], false);
         $Address->setAttributes($_POST['Address'], false);
         if (Yii::app()->user->getProfile()->content_manager == '1' && $id == 0) {
             $ContentManager->setAttributes($_POST['ContentManager'], false);
             $contentValid = $ContentManager->validate();
         } else {
             $contentValid = true;
         }
         $valid = $Address->validate();
         $valid = $SpecialTechnique->validate() && $CostForm->validate() && $valid && $contentValid;
         if (!$valid) {
             Yii::import('bootstrap.widgets.TbActiveForm');
             if ($ContentManager) {
                 echo TbActiveForm::validate(array($SpecialTechnique, $Address, $CostForm, $ContentManager));
             } else {
                 echo TbActiveForm::validate(array($SpecialTechnique, $Address, $CostForm));
             }
             Yii::app()->end();
         } else {
             if (Yii::app()->user->getProfile()->content_manager == '1' && $id == 0) {
                 $SpecialTechnique->user_id = User::createFakeUser($ContentManager);
                 $SpecialTechnique->contact_id = $SpecialTechnique->user_id;
             }
             $Address->save();
             $SpecialTechnique->address_id = $Address->address_id;
             $SpecialTechnique->save();
             $SpecialTechnique->setRelations($_POST['SpecialTechnique']);
             $SpecialTechnique->setCost($CostForm);
             $SpecialTechnique->autosearch();
             //$this->redirect('/specialtechniquecall');
             echo CJSON::encode(array('status' => '500', 'redirect' => '/specialaddcallsuccess/' . $SpecialTechnique->special_technique_id));
             Yii::app()->end();
         }
     }
     $this->render('add', ['showPhoto' => false, 'CostForm' => $CostForm, 'SpecialTechnique' => $SpecialTechnique, 'contacts' => $contacts, 'Address' => $Address, 'title' => $title, 'ContentManager' => $ContentManager, 'flZayavka' => $flZayavka]);
 }
예제 #20
0
파일: _form.php 프로젝트: lhfcainiao/basic
            },
            onRowAdd: function() {
                //Do something when a row is added
            },
            onTableEmpty: function() {
                //Do something when ALL rows have been removed
            },
            onRowReorder: function() {
                //Do something when table rows have been rearranged
            }
        });
    });
</script>
<?php 
$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array('id' => 'item-prop-form', 'htmlOptions' => array('class' => 'form-horizontal'), 'enableAjaxValidation' => false));
$form = new TbActiveForm();
if ($model->hasErrors()) {
    ?>
    <div class="control-group">
        <?php 
    echo $form->errorSummary($model);
    ?>
    </div>
<?php 
}
?>
<div class="control-group"><p class="help-block">带 <span class="required">*</span> 的字段为必填项.</p></div>
<?php 
echo $form->dropDownListControlGroup($model, 'category_id', $model->getCategory());
echo $form->dropDownListControlGroup($model, 'parent_prop_id', $props);
echo $form->textFieldControlGroup($model, 'prop_name');
예제 #21
0
 public function actionAdd($id = 0)
 {
     //	 !\Yii::app()->user->getProfile()->company->validate
     if (\Yii::app()->user->getProfile()->company->validate && !\ext\services\AccountingPayed::getInstance()->checkPayed()) {
         $this->redirect('/cabinet/tarif');
     }
     $AddressesForm = new AddressesForm();
     if (!empty($id)) {
         $Reis = Reis::model()->findByPk($id);
         if (!Yii::app()->user->checkAccess('admin') && ((Yii::app()->getUser()->getProfile()->modules->head != UserModules::DIRECTOR_COMPANY || Yii::app()->user->getProfile()->company_id != $Reis->user->company_id) && (Yii::app()->getUser()->getProfile()->modules->transport != '1' || $Reis->user_id != Yii::app()->user->id) || Yii::app()->getUser()->getProfile()->company->active == '0')) {
             throw new CHttpException(403);
         }
         $i = 1;
         $AddressesForm = $Reis->getAddressForm();
         $CostForm = $Reis->getCostForm();
         $ContentManager = null;
     } else {
         if (Yii::app()->user->getProfile()->content_manager == '0') {
             if (!Yii::app()->user->checkAccess('admin') && (Yii::app()->getUser()->getProfile()->modules->head != UserModules::DIRECTOR_COMPANY && Yii::app()->getUser()->getProfile()->modules->transport != '1' || Yii::app()->getUser()->getProfile()->company->active == '0')) {
                 throw new CHttpException(403);
             } elseif (!Yii::app()->getUser()->getProfile()->company->validate) {
                 $this->redirect('/complete');
             }
             $ContentManager = null;
         } else {
             $ContentManager = new ContentManager();
         }
         $Reis = new Reis();
         $Reis->when_type_id = 40;
         $Reis->when_from = date("Y-m-d");
         $Reis->when_to = date("Y-m-d", time() + 60 * 60 * 24 * 15);
         $CostForm = new CostForm();
     }
     $company_id = Yii::app()->getUser()->getProfile()->company_id;
     $Contacts = User::model()->findAllByAttributes(['company_id' => $company_id]);
     $contacts = [];
     foreach ($Contacts as $Contact) {
         $contacts[$Contact->id] = $Contact->first_name . ' ' . $Contact->last_name . ' (' . $Contact->contact_phone . ')';
     }
     $AddressesForm->setScenario('reis');
     // alternative validation
     if (!empty($_POST)) {
         if (!empty($_POST['Reis']['reis_id'])) {
             $Reis = Reis::model()->findByPk($_POST['Reis']['reis_id']);
         } else {
             $Reis = new Reis();
         }
         $postReis = $Reis->processComplexAttributes($_POST);
         $Reis->setAttributes($postReis['Reis'], false);
         $AddressesForm->setAttributes($_POST['AddressesForm'], false);
         if ($Reis->price_asc == '0') {
             $CostForm->setAttributes($_POST['CostForm'], false);
         }
         if (Yii::app()->user->getProfile()->content_manager == '1' && $id == 0) {
             $ContentManager->setAttributes($_POST['ContentManager'], false);
             $contentValid = $ContentManager->validate();
         } else {
             $contentValid = true;
         }
         $valid = $AddressesForm->validate();
         $valid = $Reis->validate() && $CostForm->validate() && $valid && $contentValid;
         if (!$valid) {
             Yii::import('bootstrap.widgets.TbActiveForm');
             if ($ContentManager) {
                 echo TbActiveForm::validate(array($Reis, $AddressesForm, $CostForm, $ContentManager));
             } else {
                 echo TbActiveForm::validate(array($Reis, $AddressesForm, $CostForm));
             }
             Yii::app()->end();
         } else {
             if (Yii::app()->user->getProfile()->content_manager == '1' && $id == 0) {
                 $Reis->user_id = User::createFakeUser($ContentManager);
                 $Reis->contact_id = $Reis->user_id;
             }
             $Reis->save();
             $Reis->setRelations($postReis['Reis']);
             $Reis->setAddress($AddressesForm);
             $Reis->setCost($CostForm);
             $Reis->autosearch();
             echo CJSON::encode(array('status' => '500', 'redirect' => '/transportaddsuccess/' . $Reis->reis_id));
             Yii::app()->end();
         }
     }
     // список своего транспорта
     $listAvtopark = null;
     if (Yii::app()->user->checkAccess('avtopark')) {
         $criteria = new CDbCriteria();
         $criteria->with = ['user' => ['joinType' => 'INNER JOIN', 'condition' => 'user.company_id = :company_id']];
         $criteria->params = [':company_id' => $company_id];
         $listAvtoparkTmp = Transport::model()->findAll($criteria);
         $arrAttr = ['transport_id', 'name'];
         // только 2 этих аттрибута, остальное подгрузить через ajax
         foreach ($listAvtoparkTmp as $vlist) {
             $arrTmp = [];
             foreach ($arrAttr as $vattr) {
                 $arrTmp[$vattr] = $vlist->attributes[$vattr];
             }
             $listAvtopark[] = $arrTmp;
         }
     }
     $this->render('add', ['Reis' => $Reis, 'addreses' => $AddressesForm, 'CostForm' => $CostForm, 'contacts' => $contacts, 'listAvtopark' => $listAvtopark, 'ContentManager' => $ContentManager]);
 }
예제 #22
0
 /**
  * Generates a control group for a model attribute.
  * @param string $type the input type.
  * @param CModel $model the data model.
  * @param string $attribute the attribute name.
  * @param array $htmlOptions additional HTML attributes.
  * @param array $data data for generating the list options (value=>display).
  * @return string the generated control group.
  * @see TbActiveForm::createControlGroup
  */
 public function createControlGroup($type, $model, $attribute, $htmlOptions = array(), $data = array())
 {
     $this->registerValidators($model, $attribute, $htmlOptions);
     return parent::createControlGroup($type, $model, $attribute, $htmlOptions, $data);
 }
예제 #23
0
<?php

/* @var $this PersonspecialityController */
/* @var $model Personspeciality */
/* @var $form CActiveForm */
?>

<div class="form">

    <?php 
$personid = $model->PersonID;
$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array('id' => 'spec-form-modal', 'enableAjaxValidation' => false));
$form = new TbActiveForm();
?>

    <?php 
echo $form->errorSummary($model);
?>
    <?php 
echo CHtml::hiddenField('personid', $personid);
?>
    <?php 
//echo !$model->isNewRecord ? $form->hiddenField($model,'idSpeciality') : "";
//debug($model->attributeLabels("isBudget"));
?>
    <div class="row-fluid">
        <div class="span4">
            <div class="row-fluid">
                <div class="span4">
                    <?php 
echo $form->labelEx($model, 'isBudget');
예제 #24
0
<?php

$burl = Yii::app()->baseUrl;
Yii::app()->clientScript->registerScriptFile($burl . "/js/bootstrap-datepicker.js");
Yii::app()->clientScript->registerScriptFile($burl . "/js/person.js");
$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array('id' => 'edebo-form', 'enableAjaxValidation' => false));
$form = new TbActiveForm();
?>

<?php 
echo $form->errorSummary($model);
if (Yii::app()->user->hasFlash("message")) {
}
?>
<b>Заявки які буде змінено:</b>
<hr />
<div class="row-fluid">
    <div class="span4">
        <?php 
echo $form->labelEx($model, 'StatusID');
?>
        <?php 
echo $form->dropDownList($model, 'StatusID', CHtml::listData(Personrequeststatustypes::model()->findAll(), "idPersonRequestStatusType", "PersonRequestStatusTypeName"), array('empty' => "", 'class' => "span12"));
?>

    </div>
    <div class="span6">
        <?php 
echo $form->labelEx($model, 'QualificationID');
?>
        <?php 
예제 #25
0
<?php

$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array('id' => 'specialitysubjects-form', 'enableAjaxValidation' => false));
$form = new TbActiveForm();
?>



	<?php 
//        $SpecialityID = $model->SpecialityID;
//        if (!$SpecialityID) $SpecialityID = 0;
//        echo CHtml::dropDownList("SpecialityID", $SpecialityID , Specialities::DropDown(), array('empty'=>"",'class'=>'span5'));
//
//        $c = new CDbCriteria();
//        $c->order = 'SubjectName';
//        $c->compare('idZNOSubject', '>0');
//        $data = CHtml::listData(Subjects::model()->findAll($c), "idSubjects", "SubjectName");
//        $dataCount  = count($data);
//
//        unset($c);
$Specialities = new Specialities();
$d = $Specialities->getSpecialityFullNames();
?>
        <div class ="row-fluid">

        </div>
        
        <div class ="row-fluid">
            
            <div class="span4">
예제 #26
0
 public function init()
 {
     $this->htmlOptions = array_merge(array('class' => 'well'), $this->htmlOptions);
     parent::init();
 }
예제 #27
0
 /**
  * Create TbActiveForm widget.
  *
  * @param TbActiveForm $form
  * @param object $model Model
  * @param string $attribute Model attribute
  */
 public function createWidget($form, $model, $attribute, $extraOptions = '', $extraHtml = '')
 {
     $lang = Yii::app()->language;
     if ($lang == 'en_us') {
         $lang = 'en';
     }
     $widget = $this->getAttributeWidget($model, $attribute);
     switch ($widget) {
         case 'time':
             if ($form->type == TbActiveForm::TYPE_HORIZONTAL) {
                 echo '<div class="control-group">';
                 echo $form->labelEx($model, $attribute, array('class' => 'control-label'));
                 echo '<div class="controls">';
             } else {
                 echo $form->labelEx($model, $attribute);
             }
             echo '<div class="input-prepend"><span class="add-on"><i class="icon-time"></i></span>';
             $options = array('model' => $model, 'attribute' => $attribute, 'language' => $lang, 'mode' => 'time', 'htmlOptions' => array('class' => 'size-medium'), 'options' => array('timeFormat' => 'HH:mm', 'showSecond' => false, 'stepMinute' => '10'));
             $options = $this->getAttributeOptions($attribute, $options);
             $this->controller->widget($this->name . '.extensions.jui.EJuiDateTimePicker', $options);
             echo '</div>';
             echo $form->error($model, $attribute);
             if ($form->type == TbActiveForm::TYPE_HORIZONTAL) {
                 echo '</div></div>';
             }
             break;
         case 'datetime':
             if ($form->type == TbActiveForm::TYPE_HORIZONTAL) {
                 echo '<div class="control-group">';
                 echo $form->labelEx($model, $attribute, array('class' => 'control-label'));
                 echo '<div class="controls">';
             } else {
                 echo $form->labelEx($model, $attribute);
             }
             echo '<div class="input-prepend"><span class="add-on"><i class="icon-calendar"></i></span>';
             $options = array('model' => $model, 'attribute' => $attribute, 'language' => $lang, 'mode' => 'datetime', 'htmlOptions' => array('class' => 'size-medium'), 'options' => array('dateFormat' => 'yy-mm-dd', 'timeFormat' => 'HH:mm', 'showSecond' => false));
             $options = $this->getAttributeOptions($attribute, $options);
             $this->controller->widget($this->name . '.extensions.jui.EJuiDateTimePicker', $options);
             echo '</div>';
             echo $form->error($model, $attribute);
             if ($form->type == TbActiveForm::TYPE_HORIZONTAL) {
                 echo '</div></div>';
             }
             break;
         case 'date':
             if ($form->type == TbActiveForm::TYPE_HORIZONTAL) {
                 echo '<div class="control-group">';
                 echo $form->labelEx($model, $attribute, array('class' => 'control-label'));
                 echo '<div class="controls">';
             } else {
                 echo $form->labelEx($model, $attribute);
             }
             echo '<div class="input-prepend"><span class="add-on"><i class="icon-calendar"></i></span>';
             $options = array('model' => $model, 'attribute' => $attribute, 'language' => $lang, 'mode' => 'date', 'htmlOptions' => array('class' => 'size-medium'), 'options' => array('dateFormat' => 'yy-mm-dd', 'changeMonth' => true, 'changeYear' => true, 'yearRange' => '1998:2030'));
             $options = $this->getAttributeOptions($attribute, $options);
             $this->controller->widget($this->name . '.extensions.jui.EJuiDateTimePicker', $options);
             echo '</div>';
             echo $form->error($model, $attribute);
             if ($form->type == TbActiveForm::TYPE_HORIZONTAL) {
                 echo '</div></div>';
             }
             break;
         case 'wysiwyg':
             if ($form->type == TbActiveForm::TYPE_HORIZONTAL) {
                 echo '<div class="control-group">';
                 echo $form->labelEx($model, $attribute, array('class' => 'control-label'));
                 echo '<div class="controls">';
             } else {
                 echo $form->labelEx($model, $attribute);
             }
             $options = array('model' => $model, 'attribute' => $attribute, 'options' => array('lang' => $lang, 'buttons' => array('formatting', '|', 'bold', 'italic', 'deleted', '|', 'unorderedlist', 'orderedlist', 'outdent', 'indent', '|', 'image', 'link', '|', 'html')));
             $options = $this->getAttributeOptions($attribute, $options);
             if ($this->redactorUpload === true) {
                 $redactorOptions = array('options' => array('imageUpload' => Yii::app()->createUrl($this->name . '/model/redactorImageUpload', array('name' => get_class($model), 'attr' => $attribute)), 'imageGetJson' => Yii::app()->createUrl($this->name . '/model/redactorImageList', array('name' => get_class($model), 'attr' => $attribute)), 'imageUploadErrorCallback' => new CJavaScriptExpression('function(obj,json) { alert(json.error); }')));
                 $options = array_merge_recursive($options, $redactorOptions);
             }
             $this->controller->widget($this->name . '.extensions.redactor.ERedactorWidget', $options);
             echo $form->error($model, $attribute);
             if ($form->type == TbActiveForm::TYPE_HORIZONTAL) {
                 echo '</div></div>';
             }
             break;
         case 'textArea':
             $options = array('rows' => 5, 'cols' => 50, 'class' => 'span8');
             $data_caracters = '';
             foreach ($model->getValidators($attribute) as $validator) {
                 if ($validator instanceof CStringValidator && $validator->max !== null) {
                     $data_caracters = 'Cantidad de caracteres permitidos (' . $validator->max . ' max.)';
                     break;
                 }
             }
             $options = $this->getAttributeOptions($attribute, $options);
             echo $form->textAreaRow($model, $attribute, $options);
             echo "<span class='textnum' data-caracters='{$data_caracters}'></span>";
             break;
         case 'textField':
             $options = array('class' => 'span5');
             if ($extraOptions != '' && isset($extraOptions[$attribute])) {
                 $options = $extraOptions[$attribute];
             }
             $data_caracters = '';
             foreach ($model->getValidators($attribute) as $validator) {
                 if ($validator instanceof CStringValidator && $validator->max !== null) {
                     $data_caracters = 'Cantidad de caracteres permitidos (' . $validator->max . ' max.)';
                     break;
                 }
             }
             $options = $this->getAttributeOptions($attribute, $options);
             echo $form->textFieldRow($model, $attribute, $options);
             echo "<span class='textnum' data-caracters='{$data_caracters}'></span>";
             break;
         case 'chosen':
             $options = array('empty' => Yii::t('YcmModule.ycm', 'Selecciona {name}', array('{name}' => strtolower($model->getAttributeLabel($attribute)))), 'class' => 'span5 chosen-select');
             $options = $this->getAttributeOptions($attribute, $options);
             $this->controller->widget($this->name . '.extensions.chosen.EChosenWidget');
             echo $form->dropDownListRow($model, $attribute, $this->getAttributeChoices($model, $attribute), $options);
             if ($extraHtml != '' && isset($extraHtml[$attribute])) {
                 echo $extraHtml[$attribute];
             }
             break;
         case 'chosenMultiple':
             $options = array('data-placeholder' => Yii::t('YcmModule.ycm', 'Selecciona {name}', array('{name}' => strtolower($model->getAttributeLabel($attribute)))), 'multiple' => 'multiple', 'class' => 'span5 chosen-select');
             $options = $this->getAttributeOptions($attribute, $options);
             $this->controller->widget($this->name . '.extensions.chosen.EChosenWidget');
             echo $form->dropDownListRow($model, $attribute, $this->getAttributeChoices($model, $attribute), $options);
             if ($extraHtml != '' && isset($extraHtml[$attribute])) {
                 echo $extraHtml[$attribute];
             }
             break;
         case 'taggable':
             if ($form->type == TbActiveForm::TYPE_HORIZONTAL) {
                 echo '<div class="control-group">';
                 echo $form->labelEx($model, $attribute, array('class' => 'control-label'));
                 echo '<div class="controls">';
             } else {
                 echo $form->labelEx($model, $attribute);
             }
             $options = array('name' => $attribute, 'value' => $model->{$attribute}->toString(), 'url' => Yii::app()->createUrl($this->name . '/model/suggestTags', array('name' => get_class($model), 'attr' => $attribute)), 'multiple' => true, 'mustMatch' => false, 'matchCase' => false, 'htmlOptions' => array('size' => 50, 'class' => 'span5'));
             $options = $this->getAttributeOptions($attribute, $options);
             $this->controller->widget('CAutoComplete', $options);
             echo '<span class="help-inline">' . Yii::t('YcmModule.ycm', 'Separate words with commas.') . '</span>';
             echo $form->error($model, $attribute);
             if ($form->type == TbActiveForm::TYPE_HORIZONTAL) {
                 echo '</div></div>';
             }
             break;
         case 'dropDown':
             $options = array('empty' => Yii::t('YcmModule.ycm', 'Selecciona {name}', array('{name}' => strtolower($model->getAttributeLabel($attribute)))), 'class' => 'span5');
             $options = $this->getAttributeOptions($attribute, $options);
             echo $form->dropDownListRow($model, $attribute, $this->getAttributeChoices($model, $attribute), $options);
             break;
         case 'typeHead':
             if ($form->type == TbActiveForm::TYPE_HORIZONTAL) {
                 echo '<div class="control-group">';
                 echo $form->labelEx($model, $attribute, array('class' => 'control-label'));
                 echo '<div class="controls">';
             } else {
                 echo $form->labelEx($model, $attribute);
             }
             $options = array('model' => $model, 'attribute' => $attribute, 'htmlOptions' => array('class' => 'span5', 'autocomplete' => 'off'), 'options' => array('name' => 'typeahead', 'source' => $this->getAttributeChoices($model, $attribute), 'matcher' => "js:function(item) {\n\t\t\t\t\t\t\treturn ~item.toLowerCase().indexOf(this.query.toLowerCase());\n\t\t\t\t\t\t}"));
             $options = $this->getAttributeOptions($attribute, $options, true);
             $this->controller->widget('bootstrap.widgets.TbTypeahead', $options);
             echo $form->error($model, $attribute);
             if ($form->type == TbActiveForm::TYPE_HORIZONTAL) {
                 echo '</div></div>';
             }
             break;
         case 'radioButton':
             $options = array();
             $options = $this->getAttributeOptions($attribute, $options);
             echo $form->radioButtonListRow($model, $attribute, $this->getAttributeChoices($model, $attribute), $options);
             break;
         case 'boolean':
             $options = array();
             $options = $this->getAttributeOptions($attribute, $options);
             echo $form->checkboxRow($model, $attribute, $options);
             break;
         case 'password':
             $options = array('class' => 'span5');
             $options = $this->getAttributeOptions($attribute, $options);
             echo $form->passwordFieldRow($model, $attribute, $options);
             break;
         case 'disabled':
             $options = array('class' => 'span5', 'disabled' => true);
             $options = $this->getAttributeOptions($attribute, $options);
             echo $form->textFieldRow($model, $attribute, $options);
             break;
         case 'file':
             $options = array('class' => 'span5');
             $options = $this->getAttributeOptions($attribute, $options);
             if (!$model->isNewRecord && !empty($model->{$attribute})) {
                 ob_start();
                 echo '<p>';
                 $this->controller->widget('bootstrap.widgets.TbButton', array('label' => Yii::t('YcmModule.ycm', 'Descargar'), 'type' => '', 'url' => $model->getFileUrl($attribute), 'htmlOptions' => array('target' => '_blank')));
                 echo '</p>';
                 $html = ob_get_clean();
                 $options['hint'] = $html;
             }
             echo $form->fileFieldRow($model, $attribute, $options);
             break;
         case 'image':
             $options = array('class' => 'span5');
             if ($extraOptions != '' && isset($extraOptions[$attribute])) {
                 $options = $extraOptions[$attribute];
             }
             $options = $this->getAttributeOptions($attribute, $options);
             if (!$model->isNewRecord && !empty($model->{$attribute})) {
                 $modalName = 'modal-image-' . $attribute;
                 $image = CHtml::image($model->getFileUrl($attribute), Yii::t('YcmModule.ycm', 'Image'), array('class' => 'modal-image'));
                 ob_start();
                 $this->controller->beginWidget('bootstrap.widgets.TbModal', array('id' => $modalName));
                 echo '<div class="modal-header"><a class="close" data-dismiss="modal">&times;</a><h4>';
                 echo Yii::t('YcmModule.ycm', 'Image preview') . '</h4></div>';
                 echo '<div class="modal-body">' . $image . '</div>';
                 $this->controller->endWidget();
                 echo '<p>';
                 $this->controller->widget('bootstrap.widgets.TbButton', array('label' => Yii::t('YcmModule.ycm', 'Vista previa'), 'type' => '', 'htmlOptions' => array('data-toggle' => 'modal', 'data-target' => '#' . $modalName)));
                 echo '</p>';
                 $html = ob_get_clean();
                 $options['hint'] = $html;
             }
             echo $form->fileFieldRow($model, $attribute, $options);
             echo '<span class="filetext"></span>';
             if ($model->allowDelImage() && !$model->isAttributeRequired($attribute)) {
                 echo '<div class="control-group ">
                                         <label for="__link" class="control-label"></label>
                                         <div class="controls">
                                             <label for="eliminate_image_' . $attribute . '" class="checkbox">
                                                 <input type="hidden" name="eliminate_image[' . $attribute . ']" value="0" id="yteliminate_image_' . $attribute . '">
                                                 <input type="checkbox" value="1" id="eliminate_image_' . $attribute . '" name="eliminate_image[' . $attribute . ']"><span style="font-style: italic;">Eliminar imagen</span>
                                             </label>
                                         </div>
                                     </div>';
             }
             if ($extraHtml != '' && isset($extraHtml[$attribute])) {
                 echo $extraHtml[$attribute];
             }
             break;
         case 'hide':
             break;
         case 'label':
             $options = array('class' => 'span5');
             $options = $this->getAttributeOptions($attribute, $options);
             echo '<div class="control-group">';
             echo '<label class="control-label">' . $model->getAttributeLabel($attribute) . ':</label>';
             echo '<div class="controls">';
             echo '<label style="font-style: italic; padding-top: 5px;">', $model->grado, '</label>';
             echo '</div>';
             echo '</div>';
             break;
         default:
             $options = array('class' => 'span5');
             $data_caracters = '';
             foreach ($model->getValidators($attribute) as $validator) {
                 if ($validator instanceof CStringValidator && $validator->max !== null) {
                     $data_caracters = 'Cantidad de caracteres permitidos (' . $validator->max . ' max.)';
                     break;
                 }
             }
             $options = $this->getAttributeOptions($attribute, $options);
             echo $form->textFieldRow($model, $attribute, $options);
             echo "<span class='textnum' data-caracters='{$data_caracters}'></span>";
             break;
     }
 }
예제 #28
0
            onRowAdd: function() {
                //Do something when a row is added
            },
            onTableEmpty: function() {
                //Do something when ALL rows have been removed
            },
            onRowReorder: function() {
                //Do something when table rows have been rearranged
            }
        });
    });
</script>
<div style="padding:20px">
    <?php 
$form = $this->beginWidget('booster.widgets.TbActiveForm', array('id' => 'item-prop-form', 'htmlOptions' => array('class' => 'form-horizontal'), 'enableAjaxValidation' => false));
$form = new TbActiveForm();
if ($model->hasErrors()) {
    ?>

        <div class="control-group">
            <?php 
    echo $form->errorSummary($model);
    ?>
        </div>
    <?php 
}
?>

    <div class="control-group"><p class="help-block">带 <span class="required">*</span> 的字段为必填项.</p></div>
    <?php 
$item = new Item();