model() public static method

Returns the static model of the specified AR class.
public static model ( $className = __CLASS__ ) : Type
return Type the static model class
Exemplo n.º 1
0
 /**
  * This is the default 'index' action that is invoked
  * when an action is not explicitly requested by users.
  */
 public function actionIndex()
 {
     #if (Yii::app()->user->isGuest) {
     #    $this->render('index');
     #} else {
     #    if (Yii::app()->user->checkAccess('admin')) {
     #        $this->redirect(array('admin/index'));
     #    } else {
     #        $this->redirect(array('user/accountBalance', 'id'=>Yii::app()->user->_id));
     #    }
     #}
     $form = new SearchForm();
     // Use for Form
     $dataset = new Dataset();
     // Use for auto suggestion
     $datasetModel = $this->getDatasetByType(0);
     // Use for image slider content
     $publicIds = Yii::app()->db->createCommand()->select("id")->from("dataset")->where("upload_status = 'Published'")->queryAll();
     $datasettypes_hints = Type::model()->findAll(array('order' => 'name ASC'));
     $news = News::model()->findAll("start_date<=current_date AND end_date>=current_date");
     $criteria = new CDbCriteria();
     $criteria->limit = 10;
     $criteria->condition = "upload_status = 'Published'";
     #$criteria->order = "id DESC";
     $criteria->order = 'publication_date DESC';
     $latest_datasets = Dataset::model()->findAll($criteria);
     $criteria->condition = null;
     $criteria->order = 'publication_date DESC';
     $latest_messages = RssMessage::model()->findAll($criteria);
     $rss_arr = array_merge($latest_datasets, $latest_messages);
     $this->sortRssArray($rss_arr);
     $this->render('index', array('datasets' => $datasetModel, 'form' => $form, 'dataset' => $dataset, 'news' => $news, 'dataset_hint' => $datasettypes_hints, 'rss_arr' => $rss_arr, 'count' => count($publicIds), 'latest_datasets' => $latest_datasets));
 }
Exemplo n.º 2
0
 /**
  * @param $id
  * @return Type
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Type::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, Yii::t('StoreModule.store', 'Page not found!'));
     }
     return $model;
 }
Exemplo n.º 3
0
 public function getFormattedList()
 {
     $types = Type::model()->findAll();
     $list = [];
     foreach ($types as $key => $type) {
         $list[$type->id] = $type->name;
     }
     return $list;
 }
Exemplo n.º 4
0
	public function run()
	{
		/*Top nxb*/
		$criteria = new CDbCriteria ();
		$list = Type::model()->findAll($criteria);		
		$this->render('category', array(
			'list'=>$list,			
		));
	}
Exemplo n.º 5
0
 public static function getListTypes()
 {
     $models = Type::model()->findAll();
     $list = array();
     foreach ($models as $key => $model) {
         $list[$model->id] = $model->name;
     }
     return $list;
 }
Exemplo n.º 6
0
 public function selectAll()
 {
     $criteria = new CDbCriteria();
     $criteria->select = 'id,name';
     $result = Type::model()->findAll($criteria);
     foreach ($result as $value) {
         $data[$value->id]['name'] = $value->name;
     }
     $data['subject'] = array('name');
     return $data;
 }
Exemplo n.º 7
0
 /**
  * @param $id
  * @throws CHttpException
  */
 public function actionUpdate($id)
 {
     $model = $this->loadModel($id);
     if (($data = Yii::app()->getRequest()->getPost('Attribute')) !== null) {
         $currentType = $model->type;
         $model->setAttributes(Yii::app()->getRequest()->getPost('Attribute'));
         if ($model->save() && $model->changeType($currentType, $model->type) && $model->setTypes(Yii::app()->getRequest()->getPost('types', []))) {
             Yii::app()->getUser()->setFlash(yupe\widgets\YFlashMessages::SUCCESS_MESSAGE, Yii::t('StoreModule.store', 'Attribute updated'));
             $this->redirect((array) Yii::app()->getRequest()->getPost('submit-type', ['update', 'id' => $model->id]));
         }
     }
     $this->render('update', ['model' => $model, 'types' => Type::model()->findAll()]);
 }
Exemplo n.º 8
0
 public function actionPortfolio()
 {
     $type = Type::model()->findAll();
     $criteria = new CDbCriteria();
     $criteria->select = '*';
     $criteria->order = 'id_portfolio DESC';
     $total = Portfolio::model()->count();
     $pages = new CPagination($total);
     $pages->pageSize = $total;
     $pages->applyLimit($criteria);
     $port = Portfolio::model()->findAll($criteria);
     $this->render('portfolio', array('type' => $type, 'port' => $port, 'pages' => $pages));
 }
Exemplo n.º 9
0
 public function actionDeleteattrgr($id)
 {
     $gr = Type::model()->findByPk($id);
     if (!empty($gr)) {
         try {
             $gr->delete();
         } catch (CDbException $e) {
             $this->redirect($this->createUrl('install/index', array('msg' => $e->getMessage(), 'msgtype' => 'error')));
         }
         $this->redirect($this->createUrl('install/index', array('msg' => '[!] Группа аттрибутов успешно удалена', 'msgtype' => 'success')));
     } else {
         $this->redirect($this->createUrl('install/index', array('msg' => '[!] Ошибка: нет такой группы атрибутов', 'msgtype' => 'error')));
     }
 }
Exemplo n.º 10
0
 public function actionIndex()
 {
     $type = Type::model()->findAll();
     $skill = Skill::model()->findAll();
     $usr = User::model()->findbyPk(1);
     $criteria = new CDbCriteria();
     $criteria->select = '*';
     $criteria->order = 'rand()';
     $total = Portfolio::model()->count();
     $pages = new CPagination($total);
     $pages->pageSize = 10;
     $pages->applyLimit($criteria);
     $port = Portfolio::model()->findAll($criteria);
     $this->render('index', array('type' => $type, 'port' => $port, 'pages' => $pages, 'skill' => $skill, 'usr' => $usr));
 }
Exemplo n.º 11
0
 function actionIndex()
 {
     //首页幻灯片展示,读取最新4条
     $ppt = Article::model()->findAll(array('order' => 'create_time desc', 'limit' => 4));
     //首页最新微语展示
     $wei = Weiyu::model()->findAll(array('order' => 'create_time desc'));
     // 首页点击率思想展示
     $sixiang = Article::model()->findAll(array('order' => 'click desc', 'limit' => 8));
     // 首页得瑟会员、小丫丫展示
     $jiaoya = User::model()->findAll(array('order' => 'regtime desc', 'limit' => 5));
     //首页展示标签
     $pictag = Albumcate::model()->findAll();
     $articletag = Type::model()->findAll();
     //首页展示新的图
     $likepic = Album::model()->findAll(array('order' => 'create_time desc', 'limit' => 9));
     $data = array('quote' => $this->getRandomQuote(), 'ppt' => $ppt, 'wei' => $wei, 'sixiang' => $sixiang, 'jiaoya' => $jiaoya, 'pictag' => $pictag, 'likepic' => $likepic, 'articletag' => $articletag);
     $this->render('index', $data);
 }
 public function actionTypeAttributes($id)
 {
     $type = Type::model()->findByPk($id);
     if (null === $type) {
         throw new CHttpException(404);
     }
     $out = [];
     foreach ($type->typeAttributes as $attr) {
         if ($attr->type == Attribute::TYPE_DROPDOWN) {
             $out[] = array_merge($attr->attributes, ['options' => $attr->options]);
         } else {
             if (in_array($attr->type, [Attribute::TYPE_CHECKBOX, Attribute::TYPE_SHORT_TEXT])) {
                 $out[] = array_merge($attr->attributes, ['options' => []]);
             }
         }
     }
     Yii::app()->ajax->rawText(CJSON::encode($out));
 }
Exemplo n.º 13
0
 /**
  * @return array
  */
 public function getFormattedList()
 {
     return CHtml::listData(Type::model()->findAll(), 'id', 'name');
 }
Exemplo n.º 14
0
echo Yii::t('ListnerModule.listner', 'Поля, отмеченные');
?>
    <span class="required">*</span>
    <?php 
echo Yii::t('ListnerModule.listner', 'обязательны.');
?>
</div>

<?php 
echo $form->errorSummary($model);
?>

    <div class="row">
        <div class="col-sm-7">
            <?php 
echo $form->dropDownListGroup($model, 'type_id', ['widgetOptions' => ['data' => CHtml::listData(Type::model()->findAll(), 'id', 'name')]]);
?>
        </div>
    </div>
    <div class="row">
        <div class="col-sm-7">
            <?php 
echo $form->textFieldGroup($model, 'name', ['widgetOptions' => ['htmlOptions' => ['class' => 'popover-help', 'data-original-title' => $model->getAttributeLabel('name'), 'data-content' => $model->getAttributeDescription('name')]]]);
?>
        </div>
    </div>
    <div class="row">
        <div class="col-sm-7">
            <?php 
echo $form->textFieldGroup($model, 'description', ['widgetOptions' => ['htmlOptions' => ['class' => 'popover-help', 'data-original-title' => $model->getAttributeLabel('description'), 'data-content' => $model->getAttributeDescription('description')]]]);
?>
Exemplo n.º 15
0
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer $id the ID of the model to be loaded
  * @return Type the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Type::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Exemplo n.º 16
0
 public function getTypeOptions()
 {
     return CHtml::listData(Type::model()->findAll(), 'id', 'name');
 }
 /**
  * @param $id
  * @throws CHttpException
  */
 public function actionTypeAttributes($id)
 {
     $type = Type::model()->findByPk($id);
     if (null === $type) {
         throw new CHttpException(404);
     }
     $types = [];
     $noSupported = [Attribute::TYPE_FILE, Attribute::TYPE_TEXT, Attribute::TYPE_CHECKBOX_LIST];
     foreach ($type->typeAttributes as $attr) {
         if (in_array($attr->type, $noSupported)) {
             continue;
         }
         if ($attr->type == Attribute::TYPE_DROPDOWN) {
             $types[] = array_merge($attr->attributes, ['options' => $attr->options]);
         } else {
             if (in_array($attr->type, [Attribute::TYPE_CHECKBOX, Attribute::TYPE_SHORT_TEXT])) {
                 $types[] = array_merge($attr->attributes, ['options' => []]);
             } else {
                 $types[] = $attr->attributes;
             }
         }
     }
     Yii::app()->ajax->raw($types);
 }
Exemplo n.º 18
0
Arquivo: _form.php Projeto: yupe/yupe
    }
    ?>
                        </tbody>
                    </table>
                <?php 
}
?>
            </div>
        </div>
    </div>

    <div class="tab-pane" id="attributes">
        <div class="row">
            <div class="col-sm-3">
                <?php 
echo $form->dropDownListGroup($model, 'type_id', ['widgetOptions' => ['data' => CHtml::listData(Type::model()->findAll(), 'id', 'name'), 'htmlOptions' => ['empty' => '---', 'encode' => false, 'id' => 'product-type']]]);
?>
            </div>
        </div>
        <div id="attributes-panel">
            <?php 
$this->renderPartial('_attribute_form', ['groups' => $model->getAttributeGroups(), 'model' => $model]);
?>
        </div>
    </div>

    <div class="tab-pane" id="seo">
        <div class="row">
            <div class="col-sm-7">
                <?php 
echo $form->textFieldGroup($model, 'title');
Exemplo n.º 19
0
        <?php 
echo Yii::t('StoreModule.store', 'Products');
?>
        <small><?php 
echo Yii::t('StoreModule.store', 'administration');
?>
</small>
    </h1>
</div>

<?php 
$this->widget('yupe\\widgets\\CustomGridView', ['id' => 'product-grid', 'sortableRows' => true, 'sortableAjaxSave' => true, 'sortableAttribute' => 'position', 'sortableAction' => '/store/productBackend/sortable', 'type' => 'condensed', 'dataProvider' => $model->search(), 'filter' => $model, 'actionsButtons' => ['add' => CHtml::link(Yii::t('StoreModule.store', 'Add'), ['/store/productBackend/create'], ['class' => 'btn btn-sm btn-success pull-right']), 'copy' => CHtml::link(Yii::t('StoreModule.store', 'Copy'), '#', ['id' => 'copy-products', 'class' => 'btn btn-sm btn-default pull-right', 'style' => 'margin-right: 4px;'])], 'columns' => [['type' => 'raw', 'value' => function ($data) {
    return CHtml::image($data->getImageUrl(40, 40), "", ["class" => "img-thumbnail"]);
}], ['name' => 'name', 'type' => 'raw', 'value' => function ($data) {
    return CHtml::link($data->name, ["/store/productBackend/update", "id" => $data->id]);
}], ['class' => 'bootstrap.widgets.TbEditableColumn', 'name' => 'sku', 'editable' => ['emptytext' => '---', 'url' => $this->createUrl('/store/productBackend/inline'), 'mode' => 'inline', 'params' => [Yii::app()->getRequest()->csrfTokenName => Yii::app()->getRequest()->csrfToken]], 'filter' => CHtml::activeTextField($model, 'sku', ['class' => 'form-control'])], ['class' => 'yupe\\widgets\\EditableStatusColumn', 'name' => 'type_id', 'url' => $this->createUrl('/store/productBackend/inline'), 'source' => CMap::mergeArray(['' => '---'], Type::model()->getFormattedList()), 'editable' => ['emptytext' => '---']], ['name' => 'category_id', 'value' => function ($data) {
    $categoryList = '<span class="label label-primary">' . (isset($data->mainCategory) ? $data->mainCategory->name : '---') . '</span>';
    foreach ($data->categories as $category) {
        $categoryList .= '<br>' . $category->name;
    }
    return $categoryList;
}, 'type' => 'raw', 'filter' => CHtml::activeDropDownList($model, 'category', StoreCategory::model()->getFormattedList(), ['encode' => false, 'empty' => '', 'class' => 'form-control']), 'htmlOptions' => ['width' => '220px']], ['class' => 'bootstrap.widgets.TbEditableColumn', 'name' => 'price', 'value' => function ($data) {
    return (double) $data->price;
}, 'editable' => ['url' => $this->createUrl('/store/productBackend/inline'), 'mode' => 'inline', 'params' => [Yii::app()->getRequest()->csrfTokenName => Yii::app()->getRequest()->csrfToken]], 'filter' => CHtml::activeTextField($model, 'price', ['class' => 'form-control'])], ['class' => 'bootstrap.widgets.TbEditableColumn', 'name' => 'discount', 'editable' => ['emptytext' => '---', 'url' => $this->createUrl('/store/productBackend/inline'), 'mode' => 'inline', 'params' => [Yii::app()->getRequest()->csrfTokenName => Yii::app()->getRequest()->csrfToken]], 'filter' => CHtml::activeTextField($model, 'discount', ['class' => 'form-control'])], ['class' => 'bootstrap.widgets.TbEditableColumn', 'name' => 'discount_price', 'editable' => ['emptytext' => '---', 'url' => $this->createUrl('/store/productBackend/inline'), 'mode' => 'inline', 'params' => [Yii::app()->getRequest()->csrfTokenName => Yii::app()->getRequest()->csrfToken]], 'filter' => CHtml::activeTextField($model, 'discount_price', ['class' => 'form-control'])], ['class' => 'yupe\\widgets\\EditableStatusColumn', 'name' => 'in_stock', 'url' => $this->createUrl('/store/productBackend/inline'), 'source' => $model->getInStockList(), 'options' => [Product::STATUS_IN_STOCK => ['class' => 'label-success'], Product::STATUS_NOT_IN_STOCK => ['class' => 'label-danger']]], ['class' => 'yupe\\widgets\\EditableStatusColumn', 'name' => 'status', 'url' => $this->createUrl('/store/productBackend/inline'), 'source' => $model->getStatusList(), 'options' => [Product::STATUS_ACTIVE => ['class' => 'label-success'], Product::STATUS_NOT_ACTIVE => ['class' => 'label-info'], Product::STATUS_ZERO => ['class' => 'label-default']]], ['class' => 'yupe\\widgets\\CustomButtonColumn', 'buttons' => ['front_view' => ['visible' => function ($row, $data) {
    return $data->status == Product::STATUS_ACTIVE;
}]]]]]);
?>

<?php 
$url = Yii::app()->createUrl('/store/productBackend/copy');
$tokenName = Yii::app()->getRequest()->csrfTokenName;
 /**
  * Возвращает модель по указанному идентификатору
  * Если модель не будет найдена - возникнет HTTP-исключение.
  *
  * @param integer идентификатор нужной модели
  *
  * @return void
  */
 public function loadModel($id)
 {
     $model = Type::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, Yii::t('ListnerModule.listner', 'Запрошенная страница не найдена.'));
     }
     return $model;
 }
Exemplo n.º 21
0
 public static function getTypeList($ids)
 {
     $crit = new CDbCriteria();
     $crit->join = "join dataset_type dt on dt.type_id = t.id";
     $crit->addInCondition("dt.dataset_id", $ids);
     return Type::model()->findAll($crit);
 }
Exemplo n.º 22
0
	</div>

	<div class="row">
		<p>Nhập tên sách</p>
		<?php 
echo $form->textField($model, 'name', array('size' => 60, 'maxlength' => 200, 'class' => 'form-control input-traodoi'));
?>
		<?php 
echo $form->error($model, 'name');
?>
	</div>

	<div class="row">
		<p>Nhập loại sách</p>
		<?php 
echo $form->dropDownList($model, 'type', CHtml::listData(Type::model()->findAll(), 'id', 'name'), array('class' => 'form-control input-traodoi'));
?>
		<?php 
echo $form->error($model, 'type');
?>
	</div>

	<div class="row">
		<p>Nhập giá sách</p>
		<?php 
echo $form->textField($model, 'cost', array('class' => 'form-control input-traodoi'));
?>
		<?php 
echo $form->error($model, 'cost');
?>
	</div>
Exemplo n.º 23
0
echo CHtml::textField("email", $email, array('size' => 60, 'maxlength' => 300, 'readonly' => "readonly"));
?>
 
                </div>
            </div>

            <div class="control-group">
                <?php 
echo $form->labelEx($model, 'types', array('class' => 'control-label'));
?>
                <a class="myHint" data-content="Select the type of data to be included 
                   in this submission, you may select more than 1. If a 
                   data type is missing please contact us on database@gigasciencejournal.com."></a>
                <div class="controls">
                    <?
                    $datasetTypes = MyHtml::listData(Type::model()->findAll(), 'id', 'name');
                    foreach ($datasetTypes as $id => $datasetType) {
                        $checkedHtml = in_array($id, $model->types) ? 'checked="checked"' : '';
                        echo '<input type="checkbox" name="datasettypes[]" value="'.$id.'"' . $checkedHtml . '/> ' . $datasetType . '<br/>';
                    }
                    ?>
                </div>
            </div>

            <div class="control-group">
                <?php 
echo $form->labelEx($model, 'title', array('class' => 'control-label'));
?>
                <a class="myHint" data-content="This should be a short descriptive title
                   of the dataset to be submitted"></a>
                <div class="controls">
Exemplo n.º 24
0
 public function getTypesList()
 {
     $TypeList = Type::model()->findAll();
     return CHtml::listData($TypeList, 'id', 'type_name');
 }
Exemplo n.º 25
0
<?php

$array = Type::model()->findAll(array('select' => 'name'));
?>

    
<?php 
$form = $this->beginWidget('bootstrap.widgets.BsActiveForm', array('id' => 'portfolio-form', 'htmlOptions' => array('enctype' => 'multipart/form-data'), 'enableAjaxValidation' => false));
?>
    <div class="box-body">
        <p class="help-block">Fields with <span class="required">*</span> are required.</p>

        <?php 
echo $form->errorSummary($model);
?>

        <?php 
echo $form->textFieldControlGroup($model, 'title', array('maxlength' => 255));
?>
        <?php 
echo BsHtml::exLabel('Description');
?>
        <?php 
$this->widget('ext.editMe.widgets.ExtEditMe', array('model' => $model, 'attribute' => 'description', 'id' => 'editor', 'toolbar' => Yii::app()->params['toolbar_editor'], 'filebrowserBrowseUrl' => Yii::app()->baseUrl . '/kcfinder/browse.php?type=files', 'filebrowserImageBrowseUrl' => Yii::app()->baseUrl . '/kcfinder/browse.php?type=images', 'filebrowserFlashBrowseUrl' => Yii::app()->baseUrl . '/kcfinder/browse.php?type=flash', 'filebrowserUploadUrl' => Yii::app()->baseUrl . '/kcfinder/upload.php?type=files', 'filebrowserImageUploadUrl' => Yii::app()->baseUrl . '/kcfinder/upload.php?type=images', 'filebrowserFlashUploadUrl' => Yii::app()->baseUrl . '/kcfinder/upload.php?type=flash'));
?>
        <?php 
echo $form->textFieldControlGroup($model, 'url', array('maxlength' => 100));
?>
        <!--
        <?php 
echo $form->textAreaControlGroup($model, 'photo1', array('rows' => 6));
Exemplo n.º 26
0
 /**
  *  Добавление товара
  * @param int $id
  * @throws CHttpException
  * @throws \CException
  */
 public function actionStoreadd($id = 0)
 {
     \Yii::import('application.modules.store.models.*');
     \Yii::import('application.modules.cabinet.*');
     $photos = array();
     $values = array();
     $request = Yii::app()->request->pathInfo;
     $type = preg_match('/(service)/', $request);
     $StoreCategory = new \StoreCategory();
     $ProductaForm = new \ProductaForm();
     $Address = new \Address();
     if ($id != 0) {
         $Product = \Product::model()->findByPk($id);
         if (!Yii::app()->user->checkAccess('admin') && ((Yii::app()->getUser()->getProfile()->modules->head != \UserModules::DIRECTOR_COMPANY || Yii::app()->user->getProfile()->company_id != $Product->user->company_id) && (Yii::app()->getUser()->getProfile()->modules->product != '1' || $Product->user_id != Yii::app()->user->id) || Yii::app()->getUser()->getProfile()->company->active == '0')) {
             throw new CHttpException(403);
         }
         $StoreCategory = \StoreCategory::model()->findByPk($Product->category_id);
         $Address->name = $Product->address_name;
         $Address->lat = $Product->address_lat;
         $Address->long = $Product->address_long;
         $OptionForm = $Product->getOptionForm();
         $ProductaForm->SetCategoryId($Product->category_id);
         $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->product != '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();
         }
         $Product = new \Product();
         $Product->payment_id = 2;
         $Product->price = '';
         $StoreCategory = new \StoreCategory();
         $StoreCategory->slug = 'tmp';
         $OptionForm = new \OptionForm();
     }
     $Product->type_id = 1;
     $Product->tiu_id = 0;
     if (\Yii::app()->getRequest()->getPost('call')) {
         $Product->scenario = 'call';
     }
     if (\Yii::app()->getRequest()->getPost('Product')) {
         $photos = \Yii::app()->getRequest()->getPost('photos');
         $attributes = \Yii::app()->getRequest()->getPost('Product');
         if (Yii::app()->user->getProfile()->content_manager == '1' && $id == 0) {
             $ContentManager->setAttributes($_POST['ContentManager'], false);
             $contentValid = $ContentManager->validate();
         } else {
             $contentValid = true;
         }
         $OptionForm->setAttributes($_POST['OptionForm'], false);
         $valid = $OptionForm->validate();
         $Address->setAttributes($_POST['Address'], false);
         $Product->address_name = $Address->name;
         $Product->address_lat = $Address->lat;
         $Product->address_long = $Address->long;
         if (isset($attributes['category_id'])) {
             $StoreCategory = \StoreCategory::model()->findByPk($attributes['category_id']);
             $ProductaForm->SetCategoryId($attributes['category_id']);
             if (isset($StoreCategory)) {
                 $type = \Type::model()->findByAttributes(['name' => $StoreCategory->slug]);
                 $attributes['type_id'] = $type->id;
             } else {
                 $StoreCategory = new \StoreCategory();
                 $StoreCategory->addErrors(['name' => Yii::t('default', "Необходимо заполнить поле «{title}».", array('{title}' => $StoreCategory->attributeLabels()['name']))]);
             }
         }
         if ($ProductaForm->validate()) {
             $Product = $Product->saveData($attributes, array(), array(), $photos);
         } else {
             $contentValid = false;
         }
         if (empty($_POST['Address']['name']) || empty($_POST['Address']['lat']) && empty($_POST['Address']['long'])) {
             if ($type) {
                 $Address->addError('name', Yii::t('default', "Необходимо заполнить поле «Адрес оказания услуги»."));
             } else {
                 $Address->addError('name', Yii::t('default', "Необходимо заполнить поле «Адрес товара»."));
             }
         }
         if (!$Product->hasErrors() && $contentValid == true) {
             if (Yii::app()->user->getProfile()->content_manager == '1' && $id == 0) {
                 $user_id = \User::createFakeUser($ContentManager);
                 Yii::app()->db->createCommand()->update('tbl_user', array('user_id' => $user_id), 'id=:id', array(':id' => $Product->id));
             }
             $Product->setOption($OptionForm);
             $Product->autosearch();
             $this->render('storeaddsuccess', ['Product' => $Product, 'StoreCategory' => $StoreCategory, 'Address' => $Address, 'type' => $type]);
             exit;
         }
     }
     $this->render('productadd', ['Product' => $Product, 'StoreCategory' => $StoreCategory, 'Address' => $Address, 'OptionForm' => $OptionForm, 'ContentManager' => $ContentManager, 'photos' => $photos, 'values' => $values, 'ProductaForm' => $ProductaForm]);
 }
Exemplo n.º 27
0
<!-- 右边开始 -->
<div class="edit">
    <div class="menu">
                    <a href="" class="on">修改感觉</a>
                </div>
                <?php 
$form = $this->beginWidget('CActiveForm');
?>
                <ul class="fabu">
                    <h3 style="font-size: 1.5em;font-weight: bold;padding: 5px 0;" class="margin-10">标题</h3>
                    <?php 
echo $form->textField($model, 'title', array('size' => 40, 'maxlength' => 40, 'class' => 'input'));
?>
                    <h3 class="margin-10" style="font-size: 1.5em;font-weight: bold;padding: 5px 0;">所属分类&nbsp;<?php 
echo $form->dropDownList($model, 'type_id', Type::model()->getTypesList(), array('class' => 'select2'));
?>
                    </h3>
                    <li class="text-fa">
                        <?php 
echo $form->textArea($model, 'des', array('cols' => 45, 'rows' => 3, 'maxlength' => 50));
?>
 (简单的描述或摘要)
                    </li><br/>
                    <li class="text-fa">
                        <?php 
echo $form->textArea($model, 'content', array('cols' => 45, 'rows' => 15));
?>
                    </li>
                    <li>
                        <?php 
Exemplo n.º 28
0
                    </div>

                <?php 
    }
    ?>
            <?php 
}
?>
        </div>
    </div>

    <div class="tab-pane" id="attributes">
        <div class="row">
            <div class="col-sm-3">
                <?php 
echo $form->dropDownListGroup($model, 'type_id', ['widgetOptions' => ['data' => Type::model()->getFormattedList(), 'htmlOptions' => ['empty' => '---', 'encode' => false, 'id' => 'product-type']]]);
?>
            </div>
        </div>
        <div id="attributes-panel">
            <?php 
$this->renderPartial('_attribute_form', ['groups' => $model->getAttributeGroups(), 'model' => $model]);
?>
        </div>
    </div>

    <div class="tab-pane" id="seo">
        <div class="row">
            <div class="col-sm-7">
                <?php 
echo $form->textFieldGroup($model, 'meta_title');
Exemplo n.º 29
0
?>
                <?php 
echo "<ul class=\"authors\">";
foreach ($model->authors as $auth) {
    echo $this->renderPartial('//includes/author_li', array('model' => $model, 'author' => $auth));
}
echo "</ul>";
?>
       </div>

	<div class="row">
		<?php 
echo $form->labelEx($model, 'type_id');
?>
		<?php 
echo $form->dropDownList($model, 'type_id', Type::model()->getOptions());
?>
		<?php 
echo $form->error($model, 'type_id');
?>
	</div>

	<div class="row">
		<?php 
echo $form->labelEx($model, 'publication_date');
?>
		<?php 
$this->widget('zii.widgets.jui.CJuiDatePicker', array('name' => 'publication_date', 'attribute' => 'publication_date', 'model' => $model, 'options' => array('dateFormat' => 'yy-mm-dd', 'altFormat' => 'yy-mm-dd')));
?>
		<?php 
echo $form->error($model, 'publication_date');
Exemplo n.º 30
0
<?php 
/* @var $this Controller */
$types = Type::model()->findAll();
$cities = City::model()->findAll();
?>
 
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" debug="true"><div id="FirebugChannel" style="display: none;"></div><script src="chrome-extension://bmagokdooijbeehmkpknfglimnifench/firebug-lite.js" id="FirebugLite" firebugignore="true" extension="Chrome"></script><head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<meta name="language" content="en">

	<!-- blueprint CSS framework -->
<!--	<link rel="stylesheet" type="text/css" href="/agendamientocita/css/screen.css" media="screen, projection" />
	<link rel="stylesheet" type="text/css" href="/agendamientocita/css/print.css" media="print" />
	[if lt IE 8]>
	<link rel="stylesheet" type="text/css" href="/agendamientocita/css/ie.css" media="screen, projection" />
	<![endif]

	<link rel="stylesheet" type="text/css" href="/agendamientocita/css/main.css" />
	<link rel="stylesheet" type="text/css" href="/agendamientocita/css/form.css" />-->
        <link rel="stylesheet" type="text/css" href="<?php 
echo Yii::app()->request->getBaseUrl(true);
?>
/css/styles-rep.css">
        <link rel="stylesheet" type="text/css" href="<?php 
echo Yii::app()->request->getBaseUrl(true);
?>
/css/fotorama.css">
        <link rel="stylesheet" href="https://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css">
      
		<script src="<?php 
echo Yii::app()->request->getBaseUrl(true);