Example #1
0
 public function beforeSave($insert)
 {
     $attributes = array_keys($this->getAttributes());
     // ID
     if ($this->isNewRecord and empty($this->_id)) {
         $this->_id = uniqid();
     }
     // SEO
     if (in_array('title', $attributes) and in_array('seo_url', $attributes) and empty($this->seo_url)) {
         $this->seo_url = StringHelper::asUrl($this->title);
     }
     if (in_array('title', $attributes) and in_array('seo_title', $attributes) and empty($this->seo_title)) {
         $this->seo_title = $this->title;
     }
     if (in_array('description', $attributes) and in_array('seo_desc', $attributes) and empty($this->seo_desc)) {
         $this->seo_desc = $this->description;
     }
     // Upload image
     $image = \yii\web\UploadedFile::getInstance($this, 'image');
     if (!empty($image)) {
         $this->image = \yii\web\UploadedFile::getInstance($this, 'image');
         $ext = FileHelper::getExtention($this->image);
         if (!empty($ext)) {
             $fileDir = LetHelper::getAvatarDir($this->primaryKey) . '/';
             $fileName = $this->primaryKey . '.jpg';
             //$fileName = $this->primaryKey . '.' . $ext;
             $folder = Yii::$app->params['uploadPath'] . '/' . Yii::$app->params['uploadDir'] . '/' . $fileDir;
             FileHelper::createDirectory($folder);
             $this->image->saveAs($folder . $fileName);
             $this->image = $fileDir . $fileName;
         }
     } else {
         $this->image = $this->image_old;
     }
     // creator, editor and time
     $now = new \MongoDate();
     if (in_array('update_time', $attributes) and empty($this->update_time)) {
         $this->update_time = $now;
     }
     if (in_array('editor', $attributes) and !ClientHelper::isCommandLine()) {
         $this->editor = Yii::$app->user->id;
     }
     if ($this->isNewRecord) {
         if (in_array('creator', $attributes) and !ClientHelper::isCommandLine()) {
             $this->creator = Yii::$app->user->id;
         }
         if (in_array('create_time', $attributes) and $this->create_time == null) {
             $this->create_time = $now;
         }
     }
     if (!empty($this->password)) {
         $this->password_hash = Yii::$app->getSecurity()->generatePasswordHash($this->password);
     }
     if ($this->isNewRecord) {
         $this->auth_key = bin2hex(Yii::$app->getSecurity()->generateRandomKey());
         $this->auth_key = substr($this->auth_key, 0, 32);
     }
     return true;
 }
Example #2
0
 public function init()
 {
     if (!empty($this->model->gallery)) {
         $gallery = explode(',', $this->model->gallery);
         foreach ($gallery as $image) {
             $this->pluginOptions['initialPreview'][] = Html::img(LetHelper::getFileUploaded($image), ['class' => 'file-preview-image']);
             $this->pluginOptions['initialPreviewConfig'][] = ['caption' => end(explode('/', $image)), 'url' => Url::to(['/common/upload/remove', 'id' => Yii::$app->request->get('id'), 'key' => $image, 'model' => get_class($this->model)]), 'key' => $image];
         }
     }
     $this->model->gallery = $this->model->gallery;
     parent::init();
 }
Example #3
0
 public function search($params, $pageSize = 20, $where)
 {
     $query = self::find();
     $query->orderBy(['date_time' => -1]);
     $query->where($where);
     $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => $pageSize]]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query = \app\helpers\LetHelper::addFilter($query, '_id', $this->_id, 'like');
     if (!empty($this->date_time)) {
         list($minDate, $maxDate) = explode(' to ', $this->date_time);
         $min_date = new \MongoDate(strtotime($minDate . ' 00:00:00'));
         $max_date = new \MongoDate(strtotime($maxDate . ' 23:59:59'));
         $query = \app\helpers\LetHelper::addFilter($query, 'date_time', [$min_date, $max_date], 'between');
     }
     return $dataProvider;
 }
Example #4
0
 public function search($params, $pageSize = 20)
 {
     $query = self::find();
     $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => $pageSize]]);
     $this->load($params);
     if (!$this->validate()) {
         return $dataProvider;
     }
     // condition here
     $query->andFilterWhere(['like', '_id', $this->_id])->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'sort', $this->sort])->andFilterWhere(['like', 'status', $this->status])->andFilterWhere(['like', 'creator', $this->creator])->andFilterWhere(['like', 'create_time', $this->create_time])->andFilterWhere(['like', 'editor', $this->editor])->andFilterWhere(['like', 'update_time', $this->update_time]);
     if (!empty($this->create_time)) {
         list($minDate, $maxDate) = explode(' to ', $this->create_time);
         $min_date = new \MongoDate(strtotime($minDate . ' 00:00:00'));
         $max_date = new \MongoDate(strtotime($maxDate . ' 23:59:59'));
         $query = \app\helpers\LetHelper::addFilter($query, 'create_time', [$min_date, $max_date], 'between');
     }
     if (\app\helpers\ArrayHelper::getValue($params, 'sort') == NULL) {
         $query->orderBy('create_time DESC');
     }
     return $dataProvider;
 }
 public function actionRegisterExtra()
 {
     $model = new User(['scenario' => 'register']);
     $modelExtra = new UserExtra();
     $oauth = false;
     // Dung kiem tra xem co dang ky qua OAuth hay ko
     if (($oauthParam = Yii::$app->request->getQueryParam('oauth')) != null) {
         if (($oauthData = StringHelper::decrypt($oauthParam)) != null) {
             $oauth = true;
             if ($model->email === null) {
                 $model->email = $oauthData['email'];
             }
             if ($model->display_name === null) {
                 $model->display_name = $oauthData['name'];
             }
         }
     }
     if ($model->load(Yii::$app->request->post()) and $model->validate() and $modelAdditionBlocks = LetHelper::saveAdditionBlocks($model)) {
         // Default value
         $model->status = User::STATUS_ACTIVE;
         // Bỏ qua bước xác thực khi đăng ký qua OAuth
         if ($oauth === true && !empty($oauthData)) {
             $model->openids = [$oauthData['provider'] => $oauthData['uid']];
         }
         if ($model->save()) {
             if (is_array($modelAdditionBlocks)) {
                 foreach ($modelAdditionBlocks as $modelAdditionBlock) {
                     $modelAdditionBlock->_id = (string) $model->_id;
                     $modelAdditionBlock->save();
                 }
             }
             Yii::$app->user->login($model);
             return $this->goHome();
         }
     }
     return $this->render('registerExtra', ['model' => $model, 'modelExtra' => $modelExtra]);
 }
?>
<!-- MAIN -->
<main id="main" class="main-container">
    <!-- SECTION 1 -->
    <div class="section section-1">
        <div class="container">
            <div class="row">
                <div class="col-xs-12">
                    <div class="media avatar">
                        <div class="media-left">
                            <a href="<?php 
echo Url::to(['/account/public-profile'], ['display_name' => $user->display_name]);
?>
">
                                <?php 
echo Html::img(\app\helpers\LetHelper::getFileUploaded($user->image), ['class' => 'media-object', 'width' => '80', 'height' => '80']);
?>
                            </a>
                        </div>
                        <div class="media-body">
                            <h4 class="media-heading"><?php 
echo Html::encode($user->userJob->getDisplayName());
?>
</h4>
                        </div>
                    </div>
                    <dl class="row information">
                        <dt class="col-xs-12 col-sm-4">Company Name:</dt>
                        <dd class="col-xs-12 col-sm-8"><?php 
echo $user->userJob->agent_company_name ? Html::encode($user->userJob->agent_company_name) : Yii::t('common', 'Not set');
?>
Example #7
0
                <div class="ibox-title">
                    <h5><?php 
echo Yii::t('common', 'Edit avatar');
?>
</h5>
                </div>
                <div class="ibox-content">
                    <?php 
$form = ActiveForm::begin(['id' => 'formDefault', 'options' => ['enctype' => 'multipart/form-data']]);
echo Html::hiddenInput('submit', 1);
?>
                    <div class="row">
                        <div class="col-md-6">
                            <div class="image-crop">
                                <img src="<?php 
echo app\helpers\LetHelper::getAvatar(Yii::$app->user->id, LetHelper::URL, true, 48) . '?time=' . time();
?>
">
                            </div>
                        </div>
                        <div class="col-md-6">
                            <h4>Preview image</h4>
                            <div class="img-preview img-preview-sm"></div>
                            <h4>Comon method</h4>
                            <p>
                                You can upload new image to crop container and easy download new cropped image.
                            </p>
                            <input class="avatar-data" name="data" type="hidden">
                            <div class="btn-group">
                                <label title="Upload image file" for="inputImage" class="btn btn-primary">
                                    <input type="file" accept="image/*" name="User[avatar]" id="inputImage" class="hide">
Example #8
0
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row m-b-sm">
        <div class="col-lg-12">
            <div class="btn-group pull-right">
                <?php 
echo $buttons;
?>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-lg-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5><?php 
echo Yii::t('common', 'Information');
?>
</h5>
                </div>
                <div class="ibox-content">
                    <?php 
$form = ActiveForm::begin(['id' => 'formDefault', 'layout' => 'horizontal', 'options' => ['enctype' => 'multipart/form-data'], 'fieldConfig' => ['horizontalCssClasses' => ['label' => 'col-sm-2', 'wrapper' => 'col-sm-10', 'error' => 'help-block m-b-none', 'hint' => '']]]);
echo Html::hiddenInput('save_type', 'save');
echo yii\bootstrap\Tabs::widget(['items' => [['label' => Yii::t('common', 'General information'), 'content' => $form->field($model, 'module')->dropDownList(LetHelper::setValueForKey(array_keys(Yii::$app->modules)), ['options' => [Yii::$app->request->get('module') => ['selected ' => true]]]) . $form->field($model, 'type')->dropDownList(\app\modules\common\models\Setting::$options['type']) . $form->field($model, 'key')->textInput() . $form->field($model, 'items')->widget(\app\modules\common\components\fields\FieldSettingItems::className()), 'active' => true]]]);
ActiveForm::end();
?>
                </div>
            </div>
        </div>
    </div>
</div>
Example #9
0
                                            <span class="text-uppercase">Posted by this approved recruiter</span>
                                        </td>
                                        <td>
                                            <?php 
echo Html::a(Yii::t('job', 'View All Jobs'), ['job-search', 'Job[created_by]' => $userJob->_id], ['class' => '']);
?>
                                        </td>
                                        <td colspan="2"><?php 
echo Html::a(Yii::t('job', 'View Detail'), ['account/public-profile', 'display_name' => (string) $userJob->user->display_name]);
?>
</td>
                                    </tr>
                                    <tr>
                                        <td rowspan="5">
                                            <?php 
echo Html::img(\app\helpers\LetHelper::getFileUploaded($userJob->user->image), ['class' => 'avatar avatar-100 photo', 'width' => '100', 'height' => '100']);
?>
                                        </td>
                                        <td>Recruiter Name</td>
                                        <td colspan="2">
                                            <?php 
if (UserJob::canView()) {
    ?>
                                                <span><?php 
    echo $userJob->getDisplayName();
    ?>
</span>
                                            <?php 
} else {
    ?>
                                                <a href="<?php 
Example #10
0
    <body>
        <?php 
$this->beginBody();
?>
        <div id="wrapper">
            <nav class="navbar-default navbar-static-side" role="navigation">
                <div class="sidebar-collapse">
                    <ul class="nav">
                        <li class="nav-header">
                            <div class="dropdown profile-element">
                                <span>
                                    <a href="<?php 
echo Url::to(['/account/backend/default/editavatar']);
?>
"><?php 
echo \app\helpers\LetHelper::getAvatar(Yii::$app->user->id, 'image', false, 48, ['class' => 'img-circle']);
?>
</a>
                                </span>
                                <a data-toggle="dropdown" class="dropdown-toggle" href="#">
                                    <span class="clear"> <span class="block m-t-xs"> 
                                        <strong class="font-bold">
                                            <?php 
echo Yii::$app->user->identity->display_name;
?>
                                        </strong>
                                    </span></span>
                                </a>
                            </div>
                            <div class="logo-element">
                                Letyii
Example #11
0
 public function actionRegister()
 {
     $isAjax = Yii::$app->request->get('ajax', '0');
     $model = new User();
     $message = [];
     $extraModel = new \app\modules\account\models\UserExtra();
     $jobModel = new \app\modules\account\models\UserJob();
     $jobModel->type = Yii::$app->request->get('type', 'recruiter');
     if ($model->load(Yii::$app->request->post()) and $model->validate() and $modelAdditionBlocks = \app\helpers\LetHelper::saveAdditionBlocks($model)) {
         $model->status = User::STATUS_ACTIVE;
         if ($model->save()) {
             if (is_array($modelAdditionBlocks)) {
                 foreach ($modelAdditionBlocks as $modelAdditionBlock) {
                     $modelAdditionBlock->_id = $model->_id;
                     $modelAdditionBlock->save();
                 }
             }
             $message = ['message' => 'Đăng ký tài khoản thành công'];
             if (!$isAjax) {
                 $this->redirect($this->goBack());
             }
         }
     } else {
         $message = ['message' => $model->getErrors()];
     }
     if ($isAjax) {
         echo json_encode($message);
     } else {
         Yii::$app->view->title = Yii::t($this->module->id, 'Register');
         Yii::$app->view->params['breadcrumbs'][] = Yii::$app->view->title;
         $renderView = $jobModel->type == 'recruiter' ? 'register-recruiter' : 'register-seeker';
         return $this->render($renderView, ['model' => $model, 'extraModel' => $extraModel, 'jobModel' => $jobModel]);
     }
 }
Example #12
0
?>
</a>
                                </li>-->
                            </ul>
                            <div class="tab-content">
                                <div role="tabpanel" class="tab-pane active">
                                    <div class="table-responsive">
                                        <table class="table table-bordered table-hovered table-striped" id="table-basic-infomation">
                                            <tbody>
                                            <tr>
                                                <th><?php 
echo Yii::t('job', 'Avatar Image');
?>
</th>
                                                <td><?php 
echo Html::img(\app\helpers\LetHelper::getFileUploaded(Yii::$app->user->identity->image), ['class' => 'media-object', 'width' => '100']);
?>
</td>
                                            </tr>
                                            <?php 
if (($latestEmployer = $model->getLatestEmployer()) != null) {
    ?>
                                            <tr>
                                                <th><?php 
    echo Yii::t('job', 'Latest Employer');
    ?>
</th>
                                                <td><?php 
    echo Html::encode($latestEmployer->company_name);
    ?>
</td>
Example #13
0
echo $buttons;
?>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-lg-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5><?php 
echo Yii::t('common', 'Information');
?>
</h5>
                </div>
                <div class="ibox-content">
                    <?php 
$form = ActiveForm::begin(['id' => 'formDefault', 'layout' => 'horizontal', 'options' => ['enctype' => 'multipart/form-data'], 'fieldConfig' => ['horizontalCssClasses' => ['label' => 'col-sm-2', 'wrapper' => 'col-sm-10', 'error' => 'help-block m-b-none', 'hint' => '']]]);
$tabs = [['label' => Yii::t('common', 'General information'), 'content' => $form->field($model, 'display_name')->textInput() . $form->field($model, 'email')->textInput() . $form->field($model, 'password')->passwordInput() . $form->field($model, 'phone')->textInput() . $form->field($model, 'status')->widget(SwitchInput::classname(), ['containerOptions' => []]), 'active' => true]];
$tabs = LetHelper::buildAdditionBlocksForm($model, $form, $tabs, dirname(__FILE__));
echo Html::hiddenInput('save_type', 'save');
echo yii\bootstrap\Tabs::widget(['items' => $tabs]);
ActiveForm::end();
?>
                </div>
            </div>
        </div>
    </div>
</div>


Example #14
0
 public function search($params, $pageSize = 20)
 {
     $query = self::find();
     $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => $pageSize]]);
     if (!($this->load($params) and $this->validate())) {
         return $dataProvider;
     }
     if (!empty($this->keyword)) {
         $query->orFilterWhere(['like', 'title', $this->keyword])->orFilterWhere(['like', 'company_name', $this->keyword]);
     }
     if (!empty($this->_ids)) {
         $query->andFilterWhere(['in', '_id', $this->_ids]);
     }
     if (!empty($this->code)) {
         $query->andFilterWhere(['like', 'code', $this->code]);
     }
     if (!empty($this->title)) {
         $query->andFilterWhere(['like', 'title', $this->title]);
     }
     if (!empty($this->company_name)) {
         $query->andFilterWhere(['like', 'company_name', $this->company_name]);
     }
     if (!empty($this->status)) {
         $query->andFilterWhere(['=', 'status', $this->status]);
     }
     if (!empty($this->category_ids)) {
         $query->andFilterWhere(['category_ids' => $this->category_ids]);
     }
     if (!empty($this->created_by)) {
         $query->andFilterWhere(['=', 'created_by', $this->created_by]);
     }
     if (!empty($this->created_time)) {
         list($minDate, $maxDate) = explode(' to ', $this->created_time);
         $min_date = new \MongoDate(strtotime($minDate . ' 00:00:00'));
         $max_date = new \MongoDate(strtotime($maxDate . ' 23:59:59'));
         $query = \app\helpers\LetHelper::addFilter($query, 'created_time', [$min_date, $max_date], 'between');
     }
     if (!empty($this->updated_time)) {
         list($minDate, $maxDate) = explode(' to ', $this->updated_time);
         $min_date = new \MongoDate(strtotime($minDate . ' 00:00:00'));
         $max_date = new \MongoDate(strtotime($maxDate . ' 23:59:59'));
         $query = \app\helpers\LetHelper::addFilter($query, 'updated_time', [$min_date, $max_date], 'between');
     }
     if (\app\helpers\ArrayHelper::getValue($params, 'sort') == NULL) {
         $query->orderBy('created_time DESC');
     }
     return $dataProvider;
 }
Example #15
0
 public function actionEditavatar()
 {
     $model = Yii::$app->user->identity;
     if (Yii::$app->request->post('submit')) {
         $imageUploaded = \yii\web\UploadedFile::getInstanceByName('avatar');
         $cropper = new \letyii\cropper\Cropper();
         $cropper->src = Yii::$app->request->post('src');
         $cropper->data = Yii::$app->request->post('data');
         $cropper->fileName = Yii::$app->user->id;
         $cropper->file = $imageUploaded ? $imageUploaded : LetHelper::getAvatar(Yii::$app->user->id, LetHelper::URL, true, 48);
         $md5FileName = md5(Yii::$app->user->id);
         $folder = substr($md5FileName, 0, 2) . DIRECTORY_SEPARATOR . substr($md5FileName, 2, 2) . DIRECTORY_SEPARATOR . substr($md5FileName, 4, 2);
         $cropper->folder = Yii::$app->params['uploadDir'] . DIRECTORY_SEPARATOR . $model->moduleName . DIRECTORY_SEPARATOR . $folder;
         $cropper->crop();
     }
     Yii::$app->view->title = Yii::t($this->module->id, 'Edit Avatar "{title}"', ['title' => $model->email]);
     Yii::$app->view->params['breadcrumbs'][] = ['label' => Yii::t($this->module->id, 'Account'), 'url' => ['index']];
     Yii::$app->view->params['breadcrumbs'][] = Yii::$app->view->title;
     return $this->render('editavatar', ['model' => $model]);
     //        $model = $this->findModel(Yii::$app->user->id);
     //        $submit = Yii::$app->request->post('cropImage');
     //        $image = \yii\web\UploadedFile::getInstance($model, 'avatar');
     //
     //        Yii::$app->view->title = Yii::t($this->module->id, 'Edit Avatar "{title}"', ['title' => $model->email]);
     //        Yii::$app->view->params['breadcrumbs'][] = ['label' => Yii::t($this->module->id, 'Account'), 'url' => ['index']];
     //        Yii::$app->view->params['breadcrumbs'][] = Yii::$app->view->title;
     //
     //        if (isset($submit) && !empty($image)) {
     //            $crop = new CropHelper(Yii::$app->request->post('avatar_src'), Yii::$app->request->post('avatar_data'), $image, Yii::$app->user->id);
     //            $message = $crop->getMsg();
     //            if (!empty($crop->getResult())) {
     //                $model->avatar = $crop->getResult();
     //                $model->save();
     //            }
     //
     //            return $this->render('editavatar', [
     //                'model' => $model,
     //                'message' => $message
     //            ]);
     //        } else {
     //
     //        }
 }
Example #16
0
                            <div class="row">
                                <div class="col-xs-12 col-sm-6 col-md-3 col-lg-3">
                                    <div class="block block-login">
                                        <div class="block-content">
                                        <?php 
if (!Yii::$app->user->isGuest) {
    ?>
                                            <h4 class="welcome">Welcome <?php 
    echo Html::encode(Yii::$app->user->identity->email);
    ?>
</h4>
                                            <div class="media author">
                                                <div class="media-left text-center">
                                                    <a href="#">
                                                        <?php 
    echo \app\helpers\LetHelper::getAvatar(Yii::$app->user->id, \app\helpers\LetHelper::IMAGE, false, 48, ['class' => 'media-object', 'width' => '64', 'height' => '64']);
    ?>
                                                    </a>
                                                </div>
                                                <div class="media-body">
                                                    <p class="media-heading">Logged in as <strong><?php 
    echo Html::encode(Yii::$app->user->identity->email);
    ?>
</strong></p>
                                                    <ul class="list-inline list-separator">
                                                        <li><a href="<?php 
    echo \app\modules\job\models\UserJob::getDashboardUrl();
    ?>
">Dashboard</a></li>
                                                        <li><a href="<?php 
    echo \app\modules\job\models\UserJob::getProfileUrl();
Example #17
0
 /**
  * Get path file
  * @return string Path cua file
  */
 public function getFilePath()
 {
     return LetHelper::getFileUploaded($this->file_path, LetHelper::PATH);
 }
Example #18
0
    <div class="row">
        <div class="col-lg-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5><?php 
echo Yii::t('common', 'Information');
?>
</h5>
                </div>
                <div class="ibox-content">
                    <?php 
$form = ActiveForm::begin(['id' => 'formDefault', 'layout' => 'horizontal', 'options' => ['enctype' => 'multipart/form-data'], 'fieldConfig' => ['horizontalCssClasses' => ['label' => 'col-sm-2', 'wrapper' => 'col-sm-10', 'error' => 'help-block m-b-none', 'hint' => '']]]);
// Image
$imageConfig = ['options' => ['accept' => 'uploads/*'], 'pluginOptions' => ['previewFileType' => 'image', 'showCaption' => FALSE, 'showRemove' => FALSE, 'showUpload' => FALSE, 'browseClass' => 'btn btn-primary btn-block', 'browseIcon' => '<i class="glyphicon glyphicon-camera"></i> ', 'browseLabel' => 'Select Photo', 'removeClass' => 'btn btn-danger', 'removeLabel' => "Delete", 'removeIcon' => '<i class="glyphicon glyphicon-trash"></i>', 'allowedFileExtensions' => ['jpg', 'gif', 'png', 'jpeg']]];
if (!empty($model->image)) {
    $imageConfig['pluginOptions']['initialPreview'] = [Html::img(LetHelper::getFileUploaded($model->image), ['class' => 'file-preview-image'])];
}
// END Image
$tabs = [['label' => Yii::t('common', 'General information'), 'content' => $form->field($model, 'name')->textInput() . $form->field($model, 'class')->textInput() . $form->field($model, 'skin')->textInput() . $form->field($model, 'image')->widget(FileInput::classname(), $imageConfig) . $form->field($model, 'content')->widget(letyii\tinymce\Tinymce::className(), ['options' => ['style' => 'height: 400px;'], 'configs' => ['plugins' => 'moxiemanager advlist autolink lists link image charmap print preview hr anchor pagebreak ' . 'searchreplace wordcount visualblocks visualchars code fullscreen ' . 'insertdatetime media nonbreaking save table contextmenu directionality ' . 'emoticons template paste textcolor colorpicker textpattern', 'toolbar1' => 'insertfile undo redo | styleselect | fontselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image', 'toolbar2' => 'print preview media | forecolor backcolor emoticons', 'moxiemanager_image_settings' => ['moxiemanager_title' => 'Images', 'moxiemanager_extensions' => 'jpg,png,gif', 'moxiemanager_rootpath' => '/uploads/editor', 'moxiemanager_view' => 'thumbs'], 'external_plugins' => ['moxiemanager' => Url::base() . '/plugins/moxiemanager/plugin.min.js'], 'entity_encoding' => 'raw', 'force_p_newlines' => true, 'force_br_newlines' => false, 'auto_cleanup_word' => false, 'relative_urls' => true, 'convert_urls' => false, 'remove_script_host' => true, 'verify_html' => false, 'forced_root_block' => false, 'content_css' => 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css', 'templates' => Url::to(['template'])]]) . $form->field($model, 'description')->textarea() . $form->field($model, 'promotion')->widget(SwitchInput::className(['type' => SwitchInput::RADIO])) . $form->field($model, 'status')->widget(SwitchInput::className(['type' => SwitchInput::RADIO])), 'active' => true], ['label' => 'Seo', 'content' => $form->field($model, 'slug')->textInput() . $form->field($model, 'slug_prefix')->textInput() . $form->field($model, 'seo_url')->textInput() . $form->field($model, 'seo_title')->textInput() . $form->field($model, 'seo_desc')->textInput(), $form->field($model, 'seo_keyword')->textInput()]];
echo Html::hiddenInput('save_type', 'save');
echo yii\bootstrap\Tabs::widget(['items' => $tabs]);
ActiveForm::end();
?>
                </div>
            </div>
        </div>
    </div>
</div>


Example #19
0
 public function search($params, $pageSize = 20)
 {
     $query = self::find();
     $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => $pageSize]]);
     if (!empty($this->created_by)) {
         $query = \app\helpers\LetHelper::addFilter($query, 'created_by', $this->created_by);
     }
     if (\app\helpers\ArrayHelper::getValue($params, 'sort') == NULL) {
         $query->orderBy('created_time DESC');
     }
     if (!($this->load($params) and $this->validate())) {
         return $dataProvider;
     }
     if (!empty($this->name)) {
         $query = \app\helpers\LetHelper::addFilter($query, 'name', $this->name, 'like');
     }
     if (!empty($this->description)) {
         $query = \app\helpers\LetHelper::addFilter($query, 'description', $this->description, 'like');
     }
     if (!empty($this->status)) {
         $query = \app\helpers\LetHelper::addFilter($query, 'status', $this->status);
     }
     if (!empty($this->created_time)) {
         list($minDate, $maxDate) = explode(' to ', $this->created_time);
         $min_date = new \MongoDate(strtotime($minDate . ' 00:00:00'));
         $max_date = new \MongoDate(strtotime($maxDate . ' 23:59:59'));
         $query = \app\helpers\LetHelper::addFilter($query, 'created_time', [$min_date, $max_date], 'between');
     }
     if (!empty($this->updated_time)) {
         list($minDate, $maxDate) = explode(' to ', $this->updated_time);
         $min_date = new \MongoDate(strtotime($minDate . ' 00:00:00'));
         $max_date = new \MongoDate(strtotime($maxDate . ' 23:59:59'));
         $query = \app\helpers\LetHelper::addFilter($query, 'updated_time', [$min_date, $max_date], 'between');
     }
     return $dataProvider;
 }