/**
  * @param integer $object_model_id
  * @param string $type
  * @return string
  */
 public static function getSumPrice($object_model_id, $type)
 {
     $objects = static::find()->select('price')->where(['special_price_list_id' => ArrayHelper::map(SpecialPriceList::getModelsByKey($type), 'id', 'id'), 'object_model_id' => $object_model_id])->asArray()->all();
     return array_reduce($objects, function ($result, $item) {
         return $result += $item['price'];
     }, 0);
 }
 public function run()
 {
     $request = Yii::$app->request;
     $user = Yii::createObject($this->modelClass, ['scenario' => $this->scenario]);
     $profile = Yii::createObject($this->profileClass);
     $roles = [];
     if ($this->roleArray !== null) {
         $roles = call_user_func($this->roleArray, $this);
     }
     $roleArray = ArrayHelper::map($roles, 'name', 'description');
     $statusArray = [];
     if ($this->statusArray !== null) {
         $statusArray = call_user_func($this->statusArray, $this);
     }
     if ($user->load($request->post()) && $profile->load($request->post())) {
         if ($user->validate() && $profile->validate()) {
             $user->populateRelation('profile', $profile);
             if ($user->save(false)) {
                 $this->trigger('success', new Event(['data' => $user]));
                 return $this->controller->redirect(Url::to([$this->updateRoute, 'id' => $user->id]));
             } else {
                 $this->trigger('success', new Event(['data' => Module::t('admin', 'Failed create user')]));
                 return $this->controller->refresh();
             }
         } elseif ($request->isAjax) {
             Yii::$app->response->format = Response::FORMAT_JSON;
             return array_merge(ActiveForm::validate($user), ActiveForm::validate($profile));
         }
     }
     return $this->render(compact(['user', 'profile', 'roleArray', 'statusArray']));
 }
 public function actionIndex()
 {
     $rate = new Rate();
     $currency = new Currency();
     $billing = ArrayHelper::map(Billing::find()->asArray()->all(), 'id', 'name');
     return $this->render('index', ['rate' => $rate, 'billing' => $billing, 'currency' => $currency]);
 }
 /**
  * Lists all Pay models.
  * @return mixed
  */
 public function actionIndex()
 {
     $ticketsArray = ArrayHelper::map(SeasonTicket::find()->asArray()->select('id, title')->orderBy('title')->all(), 'id', 'title');
     $searchModel = new PaySearch();
     $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
     return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider, 'ticketsArray' => $ticketsArray]);
 }
 public function actionSite()
 {
     $params = ['today' => new \DateTime(), 'metrics' => empty(YII_DEBUG), 'review' => $day_review = Yii::$app->hryvna->getAvg(), 'banks_exchanges' => $banks_days = Yii::$app->hryvna->getBankDays(null, -10), 'banks_names' => $banks_names = ArrayHelper::map(models\Bank::find()->orderBy([new \yii\db\Expression('FIELD(rate, 0), rate, id')])->all(), 'id', 'title')];
     // generate days
     $periods = ['week' => ['delta' => 1, 'story_one' => 'останній тиждень', 'story_two' => 'десять днів'], 'month' => ['delta' => 3, 'story_one' => 'останній місяць', 'story_two' => 'тридцять днів'], 'kvartal' => ['delta' => 9, 'story_one' => 'останній квартал', 'story_two' => "дев'яносто днів"], 'halfyear' => ['delta' => 18, 'story_one' => 'останні півроку', 'story_two' => 'сто вісімдесят днів'], 'year' => ['delta' => 36, 'story_one' => 'останній рік', 'story_two' => 'триста шістдесят днів']];
     $data_tank = [];
     foreach ($periods as $period_code => $period_info) {
         $data_tank[$period_code] = Storyteller::describePeriod($period_info['delta'], $period_info['story_one'], $period_info['story_two']);
     }
     $params['days'] = $data_tank;
     // generate exchange rates table
     $converter_exchanges = end($banks_days);
     foreach ($converter_exchanges as $bank_id => $exchange) {
         // change NBU to avg exchange rates
         if ($bank_id == 1) {
             $exchange['dollar_buy'] = ['value' => $day_review['dollar_buy_banks']['value']];
             $exchange['dollar_sale'] = ['value' => $day_review['dollar_sale_banks']['value']];
             $exchange['euro_buy'] = ['value' => $day_review['euro_buy_banks']['value']];
             $exchange['euro_sale'] = ['value' => $day_review['euro_sale_banks']['value']];
             $exchange['title'] = 'Середній банковий курс';
         } else {
             $exchange['title'] = $banks_names[$bank_id];
         }
         $converter_exchanges[$bank_id] = $exchange;
     }
     $params['converter_exchanges'] = $converter_exchanges;
     // render site
     $site = $this->view->render('@app/views/templates/site.tpl', $params);
     $js = $this->view->render('@app/views/templates/js.tpl', $params);
     // save generated files to public dir
     echo file_put_contents(Yii::$app->params['site']['index'], $site) . PHP_EOL;
     echo file_put_contents(Yii::$app->params['site']['js'], $js) . PHP_EOL;
 }
Beispiel #6
0
 /**
  * Function return array map for drop down list
  * @return array
  */
 public static function getAvailableApis()
 {
     static::getEnabledApiId();
     $all = static::find()->all();
     $map = ArrayHelper::map($all, 'id', 'name');
     return ArrayHelper::merge([0 => Yii::t('app', 'Not selected')], $map);
 }
 /**
  * Creates a new ClnMedicineTest model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $user_id = 'admin';
     $model = new ClnMedicineTest();
     if ($model->load(Yii::$app->request->post())) {
         $model->MEDICINE_GEN_NO = ClnMedicineTest::getNewID();
         $model->CREATE_BY = $user_id;
         $model->CREATE_DATE = new \yii\db\Expression('SYSDATE');
         $model->UPDATE_BY = $user_id;
         $model->UPDATE_DATE = new \yii\db\Expression('SYSDATE');
         if ($model->save()) {
             $data['result'] = 'success';
         } else {
             $data['result'] = 'error';
         }
         header('Content-type: application/json');
         echo json_encode($data);
     } else {
         $getData = unserialize(base64_decode(Yii::$app->request->get('params')));
         $cureItems = ArrayHelper::map(ClnCure::find()->all(), 'CURE_GEN_NO', 'CURE_NAME');
         $model->TRAN_INJ_GEN_NO = $getData['TRAN_INJ_GEN_NO'];
         $seqNumItems = Yii::$app->utilsHelper->getSeqNum10();
         return $this->renderAjax('create', ['model' => $model, 'cureItems' => $cureItems, 'seqNumItems' => $seqNumItems]);
     }
 }
Beispiel #8
0
 /**
  * @return \yii\widgets\ActiveField
  */
 public function renderForActiveForm()
 {
     $field = parent::renderForActiveForm();
     $find = CmsContentElement::find()->active();
     if ($this->content_id) {
         $find->andWhere(['content_id' => $this->content_id]);
     }
     if ($this->fieldElement == self::FIELD_ELEMENT_SELECT) {
         $field = $this->activeForm->fieldSelect($this->model->relatedPropertiesModel, $this->property->code, ArrayHelper::map($find->all(), 'id', 'name'), []);
     } else {
         if ($this->fieldElement == self::FIELD_ELEMENT_SELECT_MULTI) {
             $field = $this->activeForm->fieldSelectMulti($this->model->relatedPropertiesModel, $this->property->code, ArrayHelper::map($find->all(), 'id', 'name'), []);
         } else {
             if ($this->fieldElement == self::FIELD_ELEMENT_RADIO_LIST) {
                 $field = parent::renderForActiveForm();
                 $field->radioList(ArrayHelper::map($find->all(), 'id', 'name'));
             } else {
                 if ($this->fieldElement == self::FIELD_ELEMENT_CHECKBOX_LIST) {
                     $field = parent::renderForActiveForm();
                     $field->checkboxList(ArrayHelper::map($find->all(), 'id', 'name'));
                 }
             }
         }
     }
     if (!$field) {
         return '';
     }
     return $field;
 }
 public function init()
 {
     parent::init();
     $this->layout = $this->layoutMittente;
     //se sono il widget di destinazione per le scelte delle associazioni
     if (!$this->targetUrl) {
         $this->layout = $this->layoutTarget;
         if (!$this->modelTargetSearch) {
             throw new InvalidConfigException($this->throwErrorMessage('modelTargetSearch'));
         }
         if (!$this->modelTargetSearch['class']) {
             throw new InvalidConfigException($this->throwErrorMessage('modelTargetSearch[class]'));
         }
         if (!$this->modelTargetSearch['action']) {
             throw new InvalidConfigException($this->throwErrorMessage('modelTargetSearch[action]'));
         }
         $this->modelTarget = \Yii::createObject($this->modelTargetSearch['class']);
         $this->modelTargetData = $this->modelTarget->{$this->modelTargetSearch['action']}(\Yii::$app->request->getQueryParams());
     }
     if (!$this->modelData) {
         throw new InvalidConfigException($this->throwErrorMessage('modelData'));
     }
     if (!$this->modelId) {
         throw new InvalidConfigException($this->throwErrorMessage('modelId'));
     }
     if (!$this->model) {
         throw new InvalidConfigException($this->throwErrorMessage('model'));
     }
     $this->modelDataArr = ArrayHelper::map($this->modelData->all(), 'id', 'id');
 }
 public function actionProcess()
 {
     $order = $this->basket->getOrder();
     $deliveries = ArrayHelper::map($order->getDeliveries(), "id", "title");
     $payments = ArrayHelper::map($order->getPayments(), "id", "title");
     return $this->render('process', ["order" => $order, "deliveries" => $deliveries, "payments" => $payments]);
 }
Beispiel #11
0
 public static function getList()
 {
     if (!self::$_list) {
         self::$_list = ArrayHelper::map(self::find()->all(), 'id', 'content.name');
     }
     return self::$_list;
 }
Beispiel #12
0
 public static function activeRoleAssignmentsField($model, $attribute, $options = [])
 {
     $authManager = \Yii::$app->authManager;
     $items = ArrayHelper::map($authManager->getItems(1), 'name', 'name');
     $values = $model->isNewRecord ? [] : ArrayHelper::getColumn($authManager->getItemsByUser($model->getId()), 'name');
     $options["values"] = $values;
     if (!empty($_POST['RoleAssignments'])) {
         $options["values"] = $_POST['RoleAssignments'];
     }
     $options["name"] = 'RoleAssignments';
     $options['id'] = self::getInputId($model, $attribute);
     $prompt = 'Select ' . $model->getAttributeLabel($attribute);
     if (isset($options['prompt'])) {
         $prompt = $options['prompt'];
         unset($options['prompt']);
     }
     $retFields = '<div class="role-assigments">';
     foreach ($authManager->getItems(1) as $item) {
         if (empty($item->children)) {
             $retFields .= self::wrapCheckbox($options["name"], $item->name, null, $options["values"]);
         } else {
             $retFields .= self::wrapCheckbox($options["name"], $item->name, null, $options["values"]);
             foreach ($item->children as $child) {
                 $retFields .= self::wrapCheckbox($options["name"], $child->name, $item->name, $options["values"], 1);
             }
         }
     }
     $retFields .= '</div>';
     \Yii::$app->view->registerJs("\n\n\t\t\t\$('.role-assigments input:checkbox').change(function() {\n\t\t\t\tvar isChecked = \$(this).attr('checked') !== undefined,\n\t\t\t\tparentItem = \$(this).attr('data-parent');\n\n\t\t\t\tif(isChecked && parentItem != null) {\n\t\t\t\t\tvar parentCheckedOnInit = \$('input[value=\"' + parentItem + '\"]').attr('data-checked') !== undefined;\n\n\t\t\t\t\tif(!parentCheckedOnInit)\n\t\t\t\t\t\t\$('input[value=\"' + parentItem + '\"]').prop('checked', false).removeAttr('checked').removeAttr('data-checked');\n\n\t\t\t\t\t\$(this).prop('checked', false).removeAttr('checked').removeAttr('data-checked');\n\t\t\t\t}\n\n\t\t\t\tif(!isChecked && parentItem != null) {\n\t\t\t\t\tvar parentCheckedOnInit = \$('input[value=\"' + parentItem + '\"]').attr('data-checked') !== undefined;\n\t\t\t\t\tif(!parentCheckedOnInit)\n\t\t\t\t\t\t\$('input[value=\"' + parentItem + '\"]').prop('checked', true).attr('checked', 'checked');\n\t\t\t\t\t\$(this).prop('checked', true).attr('checked', 'checked').attr('data-checked', 'true');\n\t\t\t\t}\n\n\t\t\t\tif(!isChecked && parentItem == null) {\n\t\t\t\t\t\$(this).attr('checked', 'checked');\n\t\t\t\t}\n\n\t\t\t\tif(isChecked && parentItem == null) {\n\t\t\t\t\t\$(this).removeAttr('checked').removeAttr('data-checked');\n\t\t\t\t\t\$('input[data-parent=\"' + \$(this).val() + '\"]').prop('checked', false).removeAttr('checked').removeAttr('data-checked');\n\t\t\t\t}\n\t\t\t});\n\t\t", View::POS_READY);
     return $retFields;
 }
 public function actionView($id)
 {
     $model = new AssignmentForm();
     $model->setScenario('auth');
     $permissions = [];
     $app = [];
     $authManager = Yii::$app->authManager;
     if ($model->load(Yii::$app->request->post()) && $model->validate()) {
         foreach ($model->getAttributes() as $key => $value) {
             if (empty($value)) {
                 $model->{$key} = [];
             }
         }
         //Revokes all roles from a user.
         try {
             $authManager->revokeAll($id);
             //角色
             if (is_array($model->roles)) {
                 foreach ($model->roles as $name) {
                     $item = $authManager->getRole($name);
                     $authManager->assign($item, $id);
                 }
             }
             //权限
             $roles = ArrayHelper::merge($model->permissions, $model->app);
             if (is_array($roles)) {
                 foreach ($roles as $name) {
                     $item = $authManager->getPermission($name);
                     $authManager->assign($item, $id);
                 }
             }
         } catch (\Exception $e) {
             Yii::$app->session->setFlash('fail', $e->getMessage());
             $this->refresh();
             Yii::$app->end();
         }
         Yii::$app->session->setFlash('success', '授权成功');
         $this->redirect(['index']);
     }
     $roles = $authManager->getRoles();
     $roles = ArrayHelper::map($roles, 'name', 'name');
     foreach ($authManager->getPermissions() as $name => $role) {
         if ($role->name[0] == '/') {
             $permissions[$name] = $role->description;
         } elseif (substr($role->name, 0, 3) == 'app') {
             $app[$name] = $role->description;
         }
     }
     foreach ($authManager->getAssignments($id) as $name => $item) {
         if ($name[0] == '/') {
             $model->permissions[$authManager->getPermission($name)->description] = $name;
         } elseif (substr($name, 0, 3) == 'app') {
             $model->app[$name] = $name;
         } else {
             $model->roles[$name] = $name;
         }
     }
     $permissions = Tools::serializeRoutes($permissions);
     return $this->render('view', ['model' => $model, 'roles' => $roles, 'permissions' => $permissions, 'app' => $app]);
 }
 public function actionView($id)
 {
     $roles = ArrayHelper::map(Yii::$app->authManager->getRoles(), 'name', 'description');
     $user_permit = array_keys(Yii::$app->authManager->getRolesByUser($id));
     $user = $this->findUser($id);
     return $this->render('view', ['user' => $user, 'roles' => $roles, 'user_permit' => $user_permit, 'moduleName' => Yii::$app->controller->module->id]);
 }
 public function afterSaveEvent()
 {
     //Обновление цены у родительского элемента если она есть
     if ($this->product->cmsContentElement->parent_content_element_id) {
         $parentProduct = $this->product->cmsContentElement->parentContentElement->shopProduct;
         if ($parentProduct) {
             $minPriceValue = $this->price;
             $minPriceCurrency = $this->currency_code;
             //У родительского элемента уже есть предложения
             if ($offers = $parentProduct->tradeOffers) {
                 //Все цены оферов этого типа
                 $minPrice = ShopProductPrice::find()->where(['product_id' => ArrayHelper::map($offers, 'id', 'id')])->andWhere(['type_price_id' => $this->type_price_id])->orderBy(['price' => SORT_ASC])->one();
                 if ($minPrice) {
                     $minPriceValue = $minPrice->price;
                     $minPriceCurrency = $minPrice->currency_code;
                 }
             }
             $query = $parentProduct->getShopProductPrices()->andWhere(['type_price_id' => $this->type_price_id]);
             /**
              * @var $price self
              */
             if ($price = $query->one()) {
                 $price->price = $minPriceValue;
                 $price->currency_code = $minPriceCurrency;
                 $price->save();
             }
         }
     }
 }
Beispiel #16
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Users::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $sort = $dataProvider->getSort();
     $sort->attributes['officeName'] = ['asc' => ['questionlist_office.name' => SORT_ASC], 'desc' => ['questionlist_office.name' => SORT_DESC], 'label' => 'Имя офиса'];
     $dataProvider->setSort($sort);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         $query->joinWith(['questionlist_office']);
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id]);
     if ($this->roleName) {
         $this->profile_office_role = $this->roleName;
     }
     $query->andFilterWhere(['like', 'profile_id', $this->profile_id])->andFilterWhere(['like', 'profile_office_role', $this->profile_office_role]);
     if ($this->scenario == 'managerSearch') {
         $userRoles = Users::findAll(['profile_id' => Yii::$app->user->identity->username, 'profile_office_role' => 'commercial_director']);
         $userRegions = array_values(ArrayHelper::map($userRoles, 'region_id', 'region_id'));
         $query->andFilterWhere(['like', 'profile_office_role', 'manager']);
         $query->andFilterWhere(['in', 'questionlist_users_offices.region_id', $userRegions]);
     }
     $query->joinWith(['office' => function ($q) {
         $q->andFilterWhere(['like', 'questionlist_office.name', $this->officeName]);
     }]);
     $query->joinWith(['region' => function ($q) {
         $q->andFilterWhere(['like', 'questionlist_region.name', $this->regionName]);
     }]);
     return $dataProvider;
 }
Beispiel #17
0
 public function getUomList()
 {
     if ($this->_uomList === null) {
         $this->_uomList = ArrayHelper::map($this->uoms, 'id', 'name');
     }
     return $this->_uomList;
 }
Beispiel #18
0
 /**
  * @return mixed
  */
 public static function getCountries()
 {
     $model = self::find()->all();
     return self::getDb()->cache(function () use($model) {
         return ArrayHelper::map($model, 'id', 'name');
     }, 3600);
 }
Beispiel #19
0
 /**
  * Get all authors for dropdownlist widget
  * @return array|\yii\db\ActiveRecord[]
  */
 public static function getDropdownList()
 {
     $authors = self::find()->all();
     $authors = \yii\helpers\ArrayHelper::map($authors, 'id', 'fullName');
     array_unshift($authors, '');
     return $authors;
 }
Beispiel #20
0
 public static function FetchDistrict()
 {
     $sql = 'SELECT  DISTINCT district FROM app_customers_items  ';
     $countries = Item::findBySql($sql)->all();
     $listData = ArrayHelper::map($countries, 'district', 'district');
     return $listData;
 }
 public static function map($tipo)
 {
     //entrada ou saida
     $tipo = self::find()->where(['tipo' => $tipo])->asArray()->all();
     $tipoMap = ArrayHelper::map($tipo, 'id', 'descricao');
     return $tipoMap;
 }
Beispiel #22
0
 public static function FetchProducts()
 {
     $sql = 'SELECT * FROM easyii_catalog_items where category_id=2';
     $allProducts = Item::findBySql($sql)->all();
     $listData = ArrayHelper::map($allProducts, 'item_code', 'title');
     return $listData;
 }
 /**
  * @inheritdoc
  */
 public function actions()
 {
     return ArrayHelper::merge(parent::actions(), ['index' => ["gridConfig" => ['settingsData' => ['order' => SORT_ASC, 'orderBy' => "priority"]], "columns" => ['name', 'code', ['value' => function (\skeeks\cms\models\CmsContentType $model) {
         $contents = \yii\helpers\ArrayHelper::map($model->cmsContents, 'id', 'name');
         return implode(', ', $contents);
     }, 'label' => 'Контент'], 'priority']]]);
 }
Beispiel #24
0
 public function actionStock()
 {
     $debug = '';
     $model = new DynamicModel(['vins', 'diller']);
     $model->addRule('vins', 'string')->addRule('diller', 'integer')->addRule(['diller', 'vins'], 'required');
     $list = ArrayHelper::map(Mod\cats\Stock::find()->all(), 'id', 'name');
     $prompt = Yii::t('app', 'Select stock');
     $arrError = [];
     if ($model->load(Yii::$app->request->post()) && $model->validate()) {
         $arrvin = explode("\n", $model->vins);
         foreach ($arrvin as $vin) {
             if ($car = Mod\Car::findOne(['vin' => trim($vin)])) {
                 $status = Mod\CarStatus::findOne(['car_id' => $car->id]);
                 $status->stock_id = $model->diller;
                 $status->save();
             } else {
                 $arrError[] = $vin . ' не найден VIN';
             }
         }
         //			$debug = print_r($arrError, true);
         $debug = implode('<br>', $arrError);
         return $this->render('finish', ['debug' => $debug]);
     }
     $arrVars = ['model' => $model, 'list' => $list, 'prompt' => $prompt, 'selLabel' => 'Склад', 'title' => 'Пакетное перемещение'];
     return $this->render('index', $arrVars);
 }
 public function getArrTema()
 {
     $arrTema = $this->getIdTemas();
     $arrTema = $arrTema->all();
     $arrMapped = ArrayHelper::map($arrTema, 'id', 'dsc_tema');
     return $arrMapped;
 }
 /**
  * @return array
  */
 protected function getMenu()
 {
     $menu = Post::find()->with(['currentTranslate' => function (ActiveQuery $q) {
         $q->select(['post_id', 'lang_id', 'title'])->asArray();
     }])->orderBy(['slug' => SORT_ASC])->all();
     return ArrayHelper::map($menu, 'slug', 'title');
 }
Beispiel #27
0
 public function actionDrop()
 {
     $model = new SurveyResult();
     $catList = ArrayHelper::map(Category::find()->asArray()->all(), 'id', 'name');
     $subcatList = ArrayHelper::map(Subcategory::find()->asArray()->all(), 'id', 'name');
     return $this->render('drop', ['model' => $model, 'catList' => $catList, 'subcatList' => $subcatList]);
 }
Beispiel #28
0
 public static function getOptions($projectId)
 {
     if (empty(self::$tagOptions[$projectId])) {
         self::$tagOptions[$projectId] = ArrayHelper::map(self::find()->where(['project_id' => $projectId])->all(), 'id', 'name');
     }
     return self::$tagOptions[$projectId];
 }
Beispiel #29
-1
 /**
  * Modifies the group input to let the user choose all existing groups.
  *
  * @param $cells
  * @return array
  */
 private function modifyGroupInput($cells)
 {
     foreach ($cells as $cell) {
         if (is_numeric(strpos($cell, '[group]'))) {
             $searchModel = new PasswordSearch();
             $acc_groups = Password::find()->select(['id', 'group'])->where(['is not', 'group', null])->asArray()->all();
             // Filter unique group items from all account credentials.
             $acc_groups = self::getUniqueArrItems($acc_groups, 'group');
             // Groups for which the user has access.
             $allowed_acc_groups = array();
             if (is_object(\Yii::$app->user->identity) && intval(\Yii::$app->user->identity->is_admin) !== 1) {
                 foreach ($acc_groups as $a_group) {
                     // Iterate all groups and check if user is allowed.
                     if (PasswordController::checkAccessByAccId($a_group['id'])) {
                         $allowed_acc_groups[] = $a_group;
                     }
                 }
             } else {
                 // Admin can access everything.
                 $allowed_acc_groups = $acc_groups;
             }
             $arr_dropdown = ArrayHelper::map($allowed_acc_groups, 'group', 'group');
             $cell = Html::activeDropDownList($searchModel, 'group', $arr_dropdown, ['class' => 'form-control', 'prompt' => 'Select Group']);
             $cell = $this->render('@app/modules/yiipass/views/elements/dropdown', array('group_input' => $cell));
         }
         // Remove "lastaccess" input. Working sorting is enough here. Input for date works not good.
         if (is_numeric(strpos($cell, '[lastaccess]'))) {
             $cell = '';
         }
         $new_cells[] = $cell;
     }
     return $new_cells;
 }
Beispiel #30
-2
 /**
  * create key-value array from entered class name
  * (for drop down list)
  *
  * @param $class -  name class => table
  * @param $key - column from table
  * @param $value - column from table
  * @return array
  */
 public static function createArrayMap($class, $key, $value)
 {
     $d = $class::find()->select([$key, $value])->orderBy([$value => SORT_ASC])->asArray()->all();
     $map = ArrayHelper::map($d, $key, $value);
     unset($d);
     return $map;
 }