public function run() { $this->filter(); $this->buildRange(); $this->buildData(); $overall = $this->buildOverAllStatistics(); $datetime_range = ArrayHelper::getValue($this->from_time, 'date') . '/' . ArrayHelper::getValue($this->to_time, 'date'); $this->model->datetime_range = $datetime_range; echo $this->render('member-report', ['model' => $this->model, 'overall_statistics' => $overall, 'gridview' => $this->buildGridview()]); $this->registerAssets(); }
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', 'education_name', $this->keyword])->orFilterWhere(['like', 'phone_number', $this->keyword])->orFilterWhere(['like', 'social_facebook', $this->keyword])->orFilterWhere(['like', 'social_twitter', $this->keyword])->orFilterWhere(['like', 'latest_company', $this->keyword])->orFilterWhere(['like', 'latest_position', $this->keyword])->orFilterWhere(['like', 'education_study', $this->keyword]); //get user's _ids by keyword from user document $this->_ids = array_keys(ArrayHelper::map(User::find()->orFilterWhere(['like', 'email', $this->keyword])->orFilterWhere(['like', 'fullname', $this->keyword])->orFilterWhere(['like', 'displayname', $this->keyword])->orFilterWhere(['like', 'first_name', $this->keyword])->orFilterWhere(['like', 'last_name', $this->keyword])->orFilterWhere(['like', 'phone', $this->keyword])->asArray()->all(), '_id', '_id')); } if ($this->search_mode == 'AND') { if (!empty($this->_ids)) { $query->where(['in', '_id', $this->_ids]); } if (!empty($this->nationality)) { $query->andFilterWhere(['=', 'nationality', $this->nationality]); } if (!empty($this->location)) { $query->andFilterWhere(['=', 'location', $this->location]); } if (!empty($this->functions)) { $query->andFilterWhere(['in', 'functions', $this->functions]); } if (!empty($this->industries)) { $query->andFilterWhere(['industries' => [$this->industries]]); } } else { if (!empty($this->_ids)) { $query->orFilterWhere(['in', '_id', $this->_ids]); } if (!empty($this->nationality)) { $query->orFilterWhere(['=', 'nationality', $this->nationality]); } if (!empty($this->location)) { $query->orFilterWhere(['=', 'location', $this->location]); } if (!empty($this->functions)) { $query->orFilterWhere(['in', 'functions', $this->functions]); } if (!empty($this->industries)) { $query->orFilterWhere(['industries' => [$this->industries]]); } } if (\app\helpers\ArrayHelper::getValue($params, 'sort') == NULL) { $query->orderBy('candidate_id DESC'); } return $dataProvider; }
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; } $query->andFilterWhere(['create_time' => $this->create_time, 'target' => $this->target, 'status' => $this->status, 'about_me' => $this->about_me, 'about_you' => $this->about_you, 'category' => $this->category, 'creator' => $this->creator]); $query->andFilterWhere(['like', '_id', $this->_id])->andFilterWhere(['like', 'title', $this->title]); if (\app\helpers\ArrayHelper::getValue($params, 'sort') == NULL) { $query->orderBy('create_time DESC'); } return $dataProvider; }
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; } // $query->andFilterWhere([ // 'model' => $this->model, // ]); $query->andFilterWhere(['like', '_id', $this->_id])->andFilterWhere(['like', 'file_path', $this->file_path])->andFilterWhere(['like', 'model_namespace', $this->model_namespace]); if (\app\helpers\ArrayHelper::getValue($params, 'sort') == NULL) { $query->orderBy('create_time DESC'); } return $dataProvider; }
public function actionIndex() { Yii::$app->view->title = Yii::t('common', 'Setting'); $module = Yii::$app->request->get('module', ''); if (!empty($module)) { $label = Yii::t($module, ucfirst($module)); Yii::$app->view->params['breadcrumbs'][] = ['label' => $label, 'url' => ['/' . $module . '/default']]; } $models = Setting::find()->where(['module' => Yii::$app->request->get('module', 'common')])->all(); if (Yii::$app->request->post()) { foreach ($models as $model) { $settingPosted = Yii::$app->request->post('setting'); $model->value = ArrayHelper::getValue($settingPosted, (string) $model->_id, ''); $model->save(); } } Yii::$app->view->params['breadcrumbs'][] = Yii::$app->view->title; return $this->render('index', ['models' => $models]); }
/** * Renders the widget. */ public function run() { if (!isset($this->options['class']) or empty($this->options['class'])) { $this->options['class'] = 'form-control'; } $name = Html::getInputName($this->model, $this->attribute); $value = Html::getAttributeValue($this->model, $this->attribute); echo Html::beginTag('div', ['class' => 'row']); echo Html::beginTag('div', ['class' => 'col-lg-4']); echo Html::textInput($name . '[1]', ArrayHelper::getValue($value, '1', ''), $this->options); echo Html::endTag('div'); echo Html::beginTag('div', ['class' => 'col-lg-4']); echo Html::textInput($name . '[2]', ArrayHelper::getValue($value, '2', ''), $this->options); echo Html::endTag('div'); echo Html::beginTag('div', ['class' => 'col-lg-4']); echo Html::textInput($name . '[3]', ArrayHelper::getValue($value, '3', ''), $this->options); echo Html::endTag('div'); echo Html::endTag('div'); }
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; }
/** * Renders the widget. */ public function run() { if (!isset($this->options['class']) or empty($this->options['class'])) { $this->options['class'] = 'form-control m-t-xs'; } $name = Html::getInputName($this->model, $this->attribute); $id = Html::getInputId($this->model, $this->attribute); $value = Html::getAttributeValue($this->model, $this->attribute); $interestList = ArrayHelper::getValue(UserExtra::$options, 'interest', []); foreach ($interestList as $key => $label) { $this->options['id'] = $id . '-' . $key; echo Html::beginTag('div', ['class' => 'm-b-md']); echo Html::beginTag('label', ['class' => 'control-label', 'for' => $this->options['id']]); echo Yii::t('account', $label); echo Html::endTag('label'); echo Html::beginTag('div'); echo Html::textInput($name . '[' . $key . ']', ArrayHelper::getValue($value, $key, ''), $this->options); echo Html::endTag('div'); echo Html::endTag('div'); } }
/** * Ham lay ra gia tri cua option setting * @param string $module ten module * @param string $key config key * @return string tra ve gia tri cua config key */ public static function getValue($module, $key) { $model = self::findOne(['module' => $module, 'key' => $key]); if (!$model) { $model = new self(); $model->module = $module; $model->type = 'text'; $model->key = $key; $model->value = ''; $model->save(); } $attributes = array_keys($model->getAttributes()); $value = in_array('value', $attributes) ? $model->value : ''; if ($model->type == 'text') { return $value; } elseif (in_array($model->type, ['checkbox', 'radio', 'dropdown']) and property_exists($model, 'items')) { return \app\helpers\ArrayHelper::getValue($model->items, $model->value, ''); } else { return ''; } }
protected function renderPanel() { if (!$this->bootstrap || !is_array($this->panel) || empty($this->panel)) { return; } $type = 'panel-' . ArrayHelper::getValue($this->panel, 'type', 'default'); $heading = ArrayHelper::getValue($this->panel, 'heading', ''); $footer = ArrayHelper::getValue($this->panel, 'footer', ''); $before = ArrayHelper::getValue($this->panel, 'before', ''); $after = ArrayHelper::getValue($this->panel, 'after', ''); $headingOptions = ArrayHelper::getValue($this->panel, 'headingOptions', []); $footerOptions = ArrayHelper::getValue($this->panel, 'footerOptions', []); $beforeOptions = ArrayHelper::getValue($this->panel, 'beforeOptions', []); $afterOptions = ArrayHelper::getValue($this->panel, 'afterOptions', []); $panelHeading = ''; $panelBefore = ''; $panelAfter = ''; $panelFooter = ''; if ($heading !== false) { Html::addCssClass($headingOptions, 'ibox-title'); $content = strtr($this->panelHeadingTemplate, ['{heading}' => $heading]); $panelHeading = Html::tag('div', $content, $headingOptions); } if ($footer !== false) { Html::addCssClass($footerOptions, 'ibox-title'); $content = strtr($this->panelFooterTemplate, ['{footer}' => $footer]); $panelFooter = Html::tag('div', $content, $footerOptions); } if ($before !== false) { Html::addCssClass($beforeOptions, 'kv-panel-before'); $content = strtr($this->panelBeforeTemplate, ['{before}' => $before]); $panelBefore = Html::tag('div', $content, $beforeOptions); } if ($after !== false) { Html::addCssClass($afterOptions, 'kv-panel-after'); $content = strtr($this->panelAfterTemplate, ['{after}' => $after]); $panelAfter = Html::tag('div', $content, $afterOptions); } $this->layout = strtr($this->panelTemplate, ['{panelHeading}' => $panelHeading, '{type}' => $type, '{panelFooter}' => $panelFooter, '{panelBefore}' => $panelBefore, '{panelAfter}' => $panelAfter]); }
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; }
/** * Gui nhung tin nhan cua status = 0 * Use: php yii sendsms/daily */ public function actionDaily() { $stats = []; $limit = 100; for ($i = 0; $i < 10000; $i++) { $model = Sms::find()->where(['status' => 0])->limit($limit)->all(); if ($model) { foreach ($model as $sms) { $sendSms = new \app\modules\sms\helpers\SmsBrandname(); $sendSms->model = $sms; $sended = $sendSms->sent(); if (property_exists($sended, 'status')) { $stats[$sended->status] = ArrayHelper::getValue($stats, $sended->status, 0) + 1; } } } else { break; } } echo "Thong ke gui sms:\n"; foreach ($stats as $status => $value) { echo $status . ': ' . $value . "\n"; } }
/** * Ham tao cau dieu kien * @param object $query * @param string $attribute Ten attribute in collection * @param string|array $values Gia tri cua attribute * @param string|array $operator Dieu kien cua attribute va value: like, between, gt, gte, lt, lte * @return object $query */ public static function addFilter($query, $attribute, $values, $operator = null) { if ($operator == 'between' and isset($values[1])) { $where = [$attribute => ['$gte' => ArrayHelper::getValue($values, 0), '$lte' => ArrayHelper::getValue($values, 1)]]; } elseif (in_array($operator, ['gt', 'gte', 'lt', 'lte'])) { $where = [$attribute => ['$' . $operator => $values]]; } elseif ($operator == 'like') { $where = [$attribute => ['$regex' => $values]]; } else { $where = [$attribute => $values]; } // if (empty($operator)){// Neu operators rong thi attribute = values // $query->andFilterWhere([ // $attribute => $values // ]); // } else if (!is_array($values) && !(is_array($operator))){ // $query->andFilterWhere([ // $attribute => [ // $operator => $values, // ] // ]); // } else { // // Tao dieu kien theo mang value va operators // $where = []; // foreach ($values as $key => $value) { // $operator = (isset($operators[$key])) ? $operators[$key] : ''; // $where[$operator] = $value; // } // // $query->andFilterWhere([ // $attribute => $where // ]); // } return $query->andFilterWhere($where); }
<td><?php echo Html::encode($model->title); ?> </td> </tr> <tr> <td colspan="2">Job Code</td> <td><?php echo Html::encode($model->code); ?> </td> </tr> <tr> <td colspan="2">Location</td> <td><?php echo ArrayHelper::getValue(\app\modules\job\models\JobLocation::getOptions(), ArrayHelper::getValue($model, 'country_id')); ?> </td> </tr> <tr> <td colspan="2">Jobs Industry</td> <td><?php echo $model->getIndustryNames(); ?> </td> </tr> <tr> <td colspan="2">Company Info</td> <td> <?php if (UserJob::canView()) {
public static function updateTreeStructure($children = [], $parent = null, $module = null) { if (empty($module) or !is_array($children) or empty($children)) { return false; } if (empty($parent)) { $parent = self::find()->where(['module' => $module])->andWhere(['lft' => 1])->addOrderBy('lft')->one(); } foreach ($children as $child) { $model = self::findOne(ArrayHelper::getValue($child, 'id')); if ($model) { $model->appendTo($parent); self::updateTreeStructure(ArrayHelper::getValue($child, 'children'), $model, $module); } } return true; }
<?php use app\components\fields\FieldDropdownList; use app\modules\account\components\fields\FieldMeasure; use app\helpers\ArrayHelper; use app\modules\account\models\UserExtra; return [['label' => Yii::t('account', 'Personal infomation'), 'content' => $form->field($model, 'introduce')->textArea() . $form->field($model, 'address')->textInput() . $form->field($model, 'height')->widget(FieldDropdownList::classname(), ['items' => range(130, 200)]) . $form->field($model, 'weight')->widget(FieldDropdownList::classname(), ['items' => range(35, 100)]) . $form->field($model, 'sex')->widget(FieldDropdownList::classname(), ['items' => ArrayHelper::getValue(UserExtra::$options, 'sex', [])]) . $form->field($model, 'measure')->widget(FieldMeasure::classname()) . $form->field($model, 'job')->textInput() . $form->field($model, 'housing')->widget(FieldDropdownList::classname(), ['items' => ArrayHelper::getValue(UserExtra::$options, 'housing', [])]) . $form->field($model, 'marriage')->widget(FieldDropdownList::classname(), ['items' => ArrayHelper::getValue(UserExtra::$options, 'marriage', [])]) . $form->field($model, 'children')->widget(FieldDropdownList::classname(), ['items' => range(0, 10)]) . $form->field($model, 'religion')->widget(FieldDropdownList::classname(), ['items' => ArrayHelper::getValue(UserExtra::$options, 'religion', [])]) . $form->field($model, 'free_time')->textInput()], ['label' => Yii::t('account', 'Interest'), 'content' => $form->field($model, 'interest')->widget(\app\modules\account\components\fields\FieldInterest::className())]];
<?php use yii\helpers\Url; use yii\helpers\Html; use app\helpers\ArrayHelper; use app\components\GridView; ?> <style type="text/css"> /*.ibox-title, .kv-panel-before{display: none;}*/ </style> <?php echo GridView::widget(['panel' => ['tableOptions' => ['id' => 'listCandidate']], 'pjax' => true, 'dataProvider' => $dataProvider, 'toolbar' => [['content' => Html::a('<i class="glyphicon glyphicon-repeat"></i>', [''], ['data-pjax' => 0, 'class' => 'btn btn-default', 'title' => Yii::t('kvgrid', 'Reset Grid')])]], 'columns' => [['attribute' => 'candidate_id', 'format' => 'raw', 'value' => function ($model, $key, $index, $widget) { if (\app\modules\job\models\UserFavourite::isFavourite($model->_id, 'seeker', Yii::$app->user->id)) { $class = "favourites"; $title = Yii::t('job', 'Remove from favourites list?'); } else { $class = "un-favourites"; $title = Yii::t('job', 'Add to favourites list?'); } return Html::a('<i class="fa fa-star"></i>', ['account/favourite'], ['title' => $title, 'class' => $class, 'onclick' => 'js:favourite($(this)); return false', 'data-id' => $model->_id, 'data-type' => 'seeker']) . ' ' . Html::a($model->candidate_id, ['/job/account/public-profile', 'display_name' => $model->user->display_name], ['title' => Yii::t('job', 'View detail'), 'class' => 'view-detail']); }], ['attribute' => 'latest_company'], ['attribute' => 'latest_position'], ['attribute' => 'location', 'value' => function ($model, $key, $index, $widget) { return ArrayHelper::getValue(\app\modules\job\models\JobLocation::getOptions(), ArrayHelper::getValue($model, 'location')); }]], 'responsive' => true, 'hover' => true]);
/** * Update Template model * * @param $id * @return array * @throws \yii\db\Exception */ public function actionUpdateTemplate($id) { if (Yii::$app->request->isAjax) { // Response fornat Yii::$app->response->format = Response::FORMAT_JSON; // Extract FormBuilder data from post request $post = Yii::$app->request->post(); $data = ['FormBuilder' => Json::decode($post['FormBuilder'], true)]; $formBuilder = new FormBuilder(); $success = false; $message = ''; $code = 0; // Form Builder Validation if ($formBuilder->load($data) && $formBuilder->validate()) { // Save data in single transaction $transaction = Template::getDb()->beginTransaction(); try { // Parse html form fields to array $formDOM = new FormDOM(); // If two elements has same id, throw a exception $formDOM->loadHTML(ArrayHelper::getValue($data, 'FormBuilder.html')); // Get Template Model $templateModel = $this->findTemplateModel($id); // Post Template $postTemplate = ['Template' => ['name' => ArrayHelper::getValue($data, 'FormBuilder.data.settings.name'), 'builder' => Json::htmlEncode(ArrayHelper::getValue($data, 'FormBuilder.data')), 'html' => Html::encode(ArrayHelper::getValue($data, 'FormBuilder.html'))]]; if (!$templateModel->load($postTemplate) || !$templateModel->save()) { throw new Exception(Yii::t('app', 'Error saving data'), 1); } $transaction->commit(); // Change success flag and message $success = true; $message = Yii::t("app", "The template has been successfully updated"); } catch (Exception $e) { // Rolls back the transaction $transaction->rollBack(); // Rethrow the exception // throw $e; $message = $e->getMessage(); $code = $e->getCode(); } } // Response to Client $res = array('success' => $success, 'id' => $id, 'action' => 'update', 'message' => $message, 'code' => $code); return $res; } return ''; }
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; }
use app\helpers\Val; use yii\web\View; /** * @var $prefixNo integer * @var $podrazdelRecord PodrazdelKursa * @var $this View */ $prefixNo = $prefixNo . '.' . Val::of($podrazdelRecord, 'nomer'); ?> <h3><?php echo $prefixNo . ' ' . Val::asText($podrazdelRecord, 'nazvanie'); ?> </h3> <?php if (ArrayHelper::getValue($podrazdelRecord, 'chasy_kontrolya') || ArrayHelper::getValue($podrazdelRecord, ['formaKontrolyaVTechenieKursaRel', 'nazvanie'])) { ?> <div class="kontrol-block"> <div class="inner"> <dl> <dt>Форма</dt> <dd><?php echo Val::asText($podrazdelRecord, 'formaKontrolyaVTechenieKursaRel', 'nazvanie'); ?> </dd> <dt>Часы</dt> <dd><?php echo Val::asText($podrazdelRecord, 'chasy_kontrolya'); ?> </dd>
<?php use yii\bootstrap\Html; use app\components\DetailView; use app\helpers\ArrayHelper; use app\modules\job\models\Job; ?> <!-- MAIN --> <main id="main" class="main-container"> <!-- SECTION 1 --> <div class="section section-1"> <div class="container"> <div class="row jobs-posted"> <div class="section-title section-title-style-2"> <h2 class="title"> <?php echo Yii::t('job', "Job Informations"); ?> </h2> </div> <?php echo DetailView::widget(['model' => $model, 'attributes' => ['code', ['attribute' => 'country_id', 'value' => ArrayHelper::getValue(\app\modules\job\models\JobLocation::getOptions(), ArrayHelper::getValue($model, 'country_id'))], ['attribute' => 'category_ids', 'value' => $model->getCategoryNames(), 'format' => 'raw'], 'city_name', ['attribute' => 'annual_salary_from', 'value' => ArrayHelper::getValue(\app\modules\job\models\JobSalary::getOptions(), ArrayHelper::getValue($model, 'annual_salary_from'))], ['attribute' => 'annual_salary_to', 'value' => ArrayHelper::getValue(\app\modules\job\models\JobSalary::getOptions(), ArrayHelper::getValue($model, 'annual_salary_to'))], ['attribute' => 'functions', 'value' => $model->getFunctionNames(), 'format' => 'raw'], ['attribute' => 'work_type', 'value' => ArrayHelper::getValue(app\modules\job\models\JobWorkType::getOptions(), ArrayHelper::getValue($model, 'work_type'))], ['attribute' => 'industry', 'value' => $model->getIndustryNames(), 'format' => 'raw'], 'company_name', 'company_description:html', 'description:html', 'seo_url', 'seo_title', 'seo_desc', ['attribute' => 'created_time', 'format' => ['datetime', 'php:m/d/Y H:i:s'], 'value' => $model->created_time->sec], ['attribute' => 'updated_time', 'format' => ['datetime', 'php:m/d/Y H:i:s'], 'value' => $model->updated_time->sec], ['attribute' => 'satus', 'value' => ArrayHelper::getValue(Job::getStatusOptions(), ArrayHelper::getValue($model, 'status'))], 'hits']]); ?> </div> </div> </div> <!-- # SECTION 1 --> </main> <!-- # MAIN -->
}); }); }); JS; $this->registerJs($js); function hasFilter() { foreach (Yii::$app->request->get() as $k => $v) { if ($k !== 'page' && $v) { return true; } } return false; } $this->title = ArrayHelper::getValue([TipKursa::PK => 'Курсы повышения квалификации', TipKursa::PP => 'Курсы профессиональной переподготовки', TipKursa::PO => 'Курсы профессионального обучения'], $tip); ?> <h2><?php echo $this->title; ?> </h2> <div class="spisok-kursov-filter"> <div class="switch-container"><a class="switch" href="#">Фильтры</a></div> <?php echo Html::beginTag('div', ['class' => 'form-container', 'style' => hasFilter() ? null : 'display:none']); ?> <?php $form = ActiveForm::begin(['method' => 'get', 'action' => [Yii::$app->controller->id . '/' . Yii::$app->controller->action->id]]); ?>
<div class="form-group"> <div class="col-sm-12"> <input type="reset" id="btn-reset" value="Reset" class="button"> <input type="submit" id="bnt-save" value="Save" class="button button-primary" name="btn_create"> </div> </div> <?php ActiveForm::end(); ?> </div> <div role="tabpanel" class="tab-pane active" id="all-project"> <div class="table-responsive"> <?php echo GridView::widget(['panel' => ['tableOptions' => ['id' => 'listDefault']], 'pjax' => true, 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'toolbar' => [['content' => Html::a('<i class="glyphicon glyphicon-repeat"></i>', ['projects'], ['data-pjax' => 0, 'class' => 'btn btn-default', 'title' => Yii::t('kvgrid', 'Reset Grid')])], '{toggleData}'], 'columns' => [['class' => 'kartik\\grid\\CheckboxColumn'], ['class' => 'yii\\grid\\SerialColumn'], ['attribute' => 'status', 'label' => Yii::t('job', 'Satus'), 'value' => function ($model, $key, $index, $widget) { return ArrayHelper::getValue(\app\modules\job\models\Project::getStatusOptions(), ArrayHelper::getValue($model, 'status')); }, 'contentOptions' => ['style' => 'min-width: 150px;'], 'filterType' => GridView::FILTER_SELECT2, 'filter' => \app\modules\job\models\Project::getStatusOptions(true)], ['attribute' => 'name', 'label' => Yii::t('job', 'Name')], ['attribute' => 'description', 'label' => Yii::t('job', 'Description'), 'format' => 'raw'], ['attribute' => 'created_time', 'label' => Yii::t('job', 'Date'), 'filterType' => GridView::FILTER_DATE_RANGE, 'format' => 'raw', 'filterWidgetOptions' => ['pluginOptions' => ['format' => 'Y-m-d', 'separator' => ' to ', 'opens' => 'left'], 'presetDropdown' => true, 'hideInput' => true, 'convertFormat' => true], 'value' => function ($model, $key, $index, $widget) { //return date('Y-m-d h:i:s', $model->created_time->sec); return Yii::$app->formatter->asDate(date('Y-m-d h:i:s', $model->created_time->sec), 'long'); }], ['class' => '\\kartik\\grid\\ActionColumn']], 'responsive' => true, 'hover' => true]); ?> </div> </div> </div> </div> <div class="col-xs-12 col-sm-3 col-sm-pull-9 col-sidebar"> <ul class="nav nav-pills nav-stacked" role="tablist"> <li role="presentation"> <a href="#add-new-project" aria-controls="add-new-project" role="tab" data-toggle="tab">Create A New Project</a> </li> <li role="presentation" class="active">
$time .= ",{$nbsp}"; } $time .= "{$nedelya}{$nbsp}неделя"; } $caption = $prefixNo . ' ' . Val::asText($temaRecord, 'nazvanie'); if ($time) { $caption .= " ({$time})"; } ?> <h4><?php echo $caption; ?> </h4> <?php if (ArrayHelper::getValue($temaRecord, ['formaKontrolyaVTechenieKursaRel', 'nazvanie'])) { ?> <div class="kontrol-block"> <div class="inner"> <?php echo Val::asText($temaRecord, 'formaKontrolyaVTechenieKursaRel', 'nazvanie'); ?> </div> </div> <?php } ?> <?php if ($temaRecord->umkRel) { ?>
/** * @param $item * @param $from * @param $prefix * @param $props ['nomer', 'nazvanie' => 'text', 'prop' => function ($value, $formatter, $from) {...}] */ private function setProperties(&$item, $from, $prefix, $props) { /* @var $formatter Formatter */ $formatter = Yii::$app->formatter; foreach ($props as $prop => $format) { if (is_integer($prop)) { $prop = $format; $format = null; } $value = ArrayHelper::getValue($from, $prefix . '_' . $prop); if (is_callable($format)) { $formatted = $format($value, $formatter, $from); } elseif (is_string($format)) { $formatted = $formatter->format($value, $format); } else { $formatted = $value; } $item[$prop] = $formatted; } }
/** * @inheritdoc */ public function next() { $this->currentData = ArrayHelper::getValue($this->resultRows, $this->position, false); $this->position++; return $this->currentData; }
<?php use yii\helpers\Url; use yii\helpers\Html; use app\helpers\ArrayHelper; use app\components\GridView; ?> <?php echo GridView::widget(['panel' => ['tableOptions' => ['id' => 'listJobs']], 'pjax' => true, 'dataProvider' => $dataProvider, 'toolbar' => [['content' => Html::a('<i class="glyphicon glyphicon-repeat"></i>', [''], ['data-pjax' => 0, 'class' => 'btn btn-default', 'title' => Yii::t('kvgrid', 'Reset Grid')])]], 'columns' => ['title', ['attribute' => 'annual_salary_from', 'value' => function ($model, $key, $index, $widget) { return Html::encode(ArrayHelper::getValue(\app\modules\job\models\JobSalary::getOptions(), ArrayHelper::getValue($model, 'annual_salary_from')) . ' to ' . ArrayHelper::getValue(\app\modules\job\models\JobSalary::getOptions(), ArrayHelper::getValue($model, 'annual_salary_to'))); }], ['attribute' => 'company_name', 'value' => function ($model, $key, $index, $widget) { return Html::encode($model->company_name); }], ['attribute' => 'updated_time', 'value' => function ($model, $key, $index, $widget) { return Yii::$app->formatter->asDate($model->updated_time->sec); }], ['class' => '\\kartik\\grid\\ActionColumn', 'template' => '{view}', 'buttons' => ['view' => function ($url, $model) { return Html::a('<span class="glyphicon glyphicon-eye-open"></span>', ['job-detail', 'id' => $model->_id], ['data-pjax' => '0', 'title' => Yii::t('yii', 'View')]); }]]], 'responsive' => true, 'hover' => true]);
<p> <?php echo Html::a(Yii::t(Yii::$app->controller->module->id, 'Update'), ['update', 'id' => (string) $model->_id], ['class' => 'btn btn-primary']); ?> <?php echo Html::a(Yii::t(Yii::$app->controller->module->id, 'Delete'), ['delete', 'id' => (string) $model->_id], ['class' => 'btn btn-danger', 'data' => ['confirm' => Yii::t(Yii::$app->controller->module->id, 'Are you sure you want to delete this item?'), 'method' => 'post']]); ?> </p> </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(Yii::$app->controller->module->id, 'Infomation'); ?> </h5> </div> <div class="ibox-content"> <?php echo DetailView::widget(['model' => $model, 'attributes' => ['_id', ['attribute' => 'role', 'value' => ArrayHelper::getValue(\app\modules\job\models\UserJob::getRoleOptions(), ArrayHelper::getValue($model, 'role'))], 'title', 'days', 'editor', 'creator', 'price', 'sort', 'status', ['attribute' => 'create_time', 'value' => Yii::$app->formatter->asDatetime($model->create_time->sec)], ['attribute' => 'update_time', 'value' => Yii::$app->formatter->asDatetime($model->update_time->sec)]]]); ?> </div> </div> </div> </div> </div>