public function __construct($id, $module, $config = [])
 {
     if ($this->isNeedLogin) {
         \Yii::$app->session->open();
         $model = new AdminUser();
         if (!$model->checkUserIsLogin()) {
             $this->redirect(Variable::$home_url);
             return;
         }
     }
     parent::__construct($id, $module, $config = []);
 }
 public function actionEditemploy()
 {
     $user = new AdminUser();
     if (!$user->checkUserIsLogin()) {
         $this->redirect(Variable::$home_url);
         return;
     }
     $req = Yii::$app->request;
     //创建一个请求对象
     $form = new EmployForm();
     $form->setScenario('update');
     $id = trim($req->get('id'));
     if (!is_numeric($id) || $id == 0) {
         $this->redirect(Variable::$employIndex_url);
         return;
     }
     //修改
     if ($form->load($req->post()) && $form->validate()) {
         $isSuccess = (new Employ())->updateEmploy($id, $form->department, $form->employName, $form->address, $form->employCode, $form->group, $form->count, $form->money, $form->type, $form->category, $form->description, $form->sendEmail, $form->status);
         if ($isSuccess) {
             //                $form->addError('','更新成功');
             //                echo Alert::widget([
             //                    'type' => Alert::TYPE_SUCCESS,
             //                    'options' => [
             //                        'title' => '',
             //                        'text' => "资料更新成功",
             //                        'confirmButtonText'  => "确定",
             //                        'cancelButtonText' =>  "取消"
             //                    ]
             //                ]);
             Yii::$app->session->setFlash(Variable::$flash_success, '招聘信息修改成功');
         } else {
             //                $form->addError('','更新失败');
             Yii::$app->session->setFlash(Variable::$flash_error, '招聘信息修改失败,请重试');
         }
     }
     $employModel = Employ::findOne($id);
     $form->department = $employModel->department;
     $form->employName = $employModel->employName;
     $form->employCode = $employModel->employCode;
     $form->sendEmail = $employModel->sendEmail;
     $form->count = $employModel->count;
     $form->money = $employModel->money;
     $form->category = $employModel->category;
     $form->type = $employModel->type;
     $form->group = $employModel->group;
     $form->address = $employModel->address;
     $form->status = $employModel->status;
     $form->description = $employModel->description;
     return $this->render(Variable::$editEmploy_view, ['model' => $form, 'employModel' => $employModel]);
 }
示例#3
0
 /**
  * Signs user up.
  *
  * @return User|null the saved model or null if saving fails
  */
 public function signup()
 {
     if ($this->validate()) {
         $user = new AdminUser();
         $user->username = $this->username;
         $user->email = $this->email;
         $user->setPassword($this->password);
         $user->generateAuthKey();
         if ($user->save()) {
             return $user;
         }
     }
     return null;
 }
示例#4
0
 /**
  * Finds user by [[username]]
  *
  * @return User|null
  */
 public function getUser()
 {
     if ($this->_admin_user === false) {
         $this->_admin_user = AdminUser::findByUsername($this->username);
     }
     return $this->_admin_user;
 }
示例#5
0
 public function shopId()
 {
     $session = new Session();
     $session->open();
     $shop = AdminUser::find($session['pk'])->one();
     return $shop->shopid;
 }
示例#6
0
 /**
  * Creates a form model given a token.
  *
  * @param  string                          $token
  * @param  array                           $config name-value pairs that will be used to initialize the object properties
  * @throws \yii\base\InvalidParamException if token is empty or not valid
  */
 public function __construct($token, $config = [])
 {
     if (empty($token) || !is_string($token)) {
         throw new InvalidParamException('Password reset token cannot be blank.');
     }
     $this->_user = AdminUser::findByPasswordResetToken($token);
     if (!$this->_user) {
         throw new InvalidParamException('Wrong password reset token.');
     }
     parent::__construct($config);
 }
 public function actionDeliverorder()
 {
     $user = new AdminUser();
     if (!$user->checkUserIsLogin()) {
         $this->redirect(Variable::$home_url);
         return;
     }
     $req = Yii::$app->request;
     //创建一个请求对象
     $form = new OrderDeliverForm();
     $form->setScenario('update');
     $id = trim($req->get('id'));
     if (!is_numeric($id) || $id == 0) {
         $this->redirect(Variable::$orderManger_url);
         return;
     }
     $orderModel = Order::findOne($id);
     $orderExpressInfoModel = (new OrderExpressInfo())->findOne(['orderId' => $id]);
     $userAddressModel = (new UserAddress())->findOne(['id' => $orderModel->addressId]);
     $orderStyleModel = (new Express())->find()->all();
     //修改
     if ($form->load($req->post()) && $form->validate()) {
         $isSuccess = (new OrderExpressInfo())->deliver($id, $form->expressNo, $form->expressStyle, $form->expressChart);
         if ($isSuccess) {
             $form->addError('', '订单发货成功');
         } else {
             $form->addError('', '订单发货失败');
         }
     }
     $form->orderNo = $orderModel->orderNo;
     $form->orderMoney = $orderModel->orderMoney;
     $form->orderStatus = $orderModel->orderStatus;
     $form->orderPayMethod = $orderModel->orderPayMethod;
     $form->orderStatus = $orderModel->orderStatus;
     if ($orderExpressInfoModel) {
         $form->expressNo = $orderExpressInfoModel->expressNo;
         $form->expressStyle = $orderExpressInfoModel->expressStyle;
     }
     return $this->render(Variable::$deliverOrder_view, ['model' => $form, 'orderModel' => $orderModel, 'orderExpressInfoModel' => $orderExpressInfoModel, 'orderStyleModel' => $orderStyleModel, 'userAddressModel' => $userAddressModel]);
 }
 /**
  * Sends an email with a link, for resetting the password.
  *
  * @return boolean whether the email was send
  */
 public function sendEmail()
 {
     /* @var $user User */
     $user = AdminUser::findOne(['status' => AdminUser::STATUS_ACTIVE, 'email' => $this->email]);
     if ($user) {
         if (!AdminUser::isPasswordResetTokenValid($user->password_reset_token)) {
             $user->generatePasswordResetToken();
         }
         if ($user->save()) {
             return \Yii::$app->mailer->compose(['html' => 'passwordResetToken-html', 'text' => 'passwordResetToken-text'], ['user' => $user])->setFrom([\Yii::$app->params['supportEmail'] => \Yii::$app->name . ' robot'])->setTo($this->email)->setSubject('Password reset for ' . \Yii::$app->name)->send();
         }
     }
     return false;
 }
 public function actionEditservice()
 {
     $user = new AdminUser();
     if (!$user->checkUserIsLogin()) {
         $this->redirect(Variable::$home_url);
         return;
     }
     $req = Yii::$app->request;
     //创建一个请求对象
     $form = new ArticleForm();
     $form->setScenario('service');
     $id = trim($req->get('id'));
     if (!is_numeric($id) || $id == 0) {
         $this->redirect(Variable::$employIndex_url);
         return;
     }
     //修改
     if ($form->load($req->post()) && $form->validate()) {
         $isSuccess = (new Article())->updateArticleByService($id, $form->title, $form->useId, $form->keywords, $form->pic, $form->content);
         //            $isSuccess = (new Employ())->updateEmploy($id,$form->department,$form->employName,$form->address,$form->employCode,$form->group,$form->count,$form->money,$form->type,$form->category,$form->description,$form->sendEmail,$form->status);
         if ($isSuccess) {
             Yii::$app->session->setFlash(Variable::$flash_success, '服务项修改成功');
             $this->redirect(Variable::$serviceIndex_url);
             return;
         } else {
             Yii::$app->session->setFlash(Variable::$flash_error, '服务项修改失败,请重试');
             return;
         }
     }
     $articleModel = Article::findOne($id);
     $form->title = $articleModel->title;
     $form->keywords = $articleModel->keywords;
     $form->pic = $articleModel->pic;
     $form->useId = $articleModel->useId;
     $form->content = $articleModel->content;
     return $this->render(Variable::$editService_view, ['model' => $form, 'articleModel' => $articleModel]);
 }
 public function actionEditprobanner()
 {
     $user = new AdminUser();
     if (!$user->checkUserIsLogin()) {
         $this->redirect(Variable::$home_url);
         return;
     }
     $req = Yii::$app->request;
     //创建一个请求对象
     $form = new MaterialForm();
     $form->setScenario('probanner');
     $id = trim($req->get('id'));
     if (!is_numeric($id) || $id == 0) {
         $this->redirect(Variable::$setting_url);
         return;
     }
     $materialModel = Material::findOne($id);
     $form->materialId = $materialModel->materialId;
     //修改
     if ($form->load($req->post()) && $form->validate()) {
         $isSuccess = (new Material())->updateMaterial($id, $form->materialId, $form->address, $form->isShow, $form->sort, $form->pcUrl, $form->wapUrl);
         if ($isSuccess) {
             Yii::$app->session->setFlash(Variable::$flash_success, '资料更新成功');
         } else {
             Yii::$app->session->setFlash(Variable::$flash_error, '资料更新失败,请刷新重试');
         }
         $this->redirect(Variable::$proBanner_url);
         return;
     }
     $materialModel = Material::findOne($id);
     $form->materialId = $materialModel->materialId;
     $form->id = $materialModel->id;
     $form->address = $materialModel->address;
     $form->isShow = $materialModel->isShow;
     $form->sort = $materialModel->sort;
     $form->pcUrl = $materialModel->pcUrl;
     $form->wapUrl = $materialModel->wapUrl;
     return $this->render(Variable::$editProBanner_view, ['model' => $form, 'materialModel' => $materialModel]);
 }
示例#11
0
 public function getAdminUser()
 {
     return $this->hasOne(AdminUser::className(), ['id' => 'addUser']);
 }
 public function actionEditactivity()
 {
     $user = new AdminUser();
     if (!$user->checkUserIsLogin()) {
         $this->redirect(Variable::$home_url);
         return;
     }
     $req = Yii::$app->request;
     //创建一个请求对象
     $form = new ActivityForm();
     $form->setScenario('update');
     $id = trim($req->get('id'));
     if (!is_numeric($id) || $id == 0) {
         $this->redirect(Variable::$activityList_url);
         return;
     }
     //修改
     if ($form->load($req->post()) && $form->validate()) {
         $isSuccess = (new Activity())->updateActivity($id, $form->name, $form->startTime, $form->endTime, $form->description, $form->rule, $form->isShow, $form->pcUrl, $form->wapUrl, $form->discount, $form->reduceMoney, $form->status);
         if ($isSuccess) {
             $form->addError('', '更新成功');
             echo Alert::widget(['type' => Alert::TYPE_SUCCESS, 'options' => ['title' => '', 'text' => "资料更新成功", 'confirmButtonText' => "确定", 'cancelButtonText' => "取消"]]);
         } else {
             $form->addError('', '更新失败');
         }
     }
     $activityModel = Activity::findOne($id);
     $form->name = $activityModel->name;
     $form->startTime = $activityModel->startTime;
     $form->endTime = $activityModel->endTime;
     $form->rule = $activityModel->rule;
     $form->description = $activityModel->description;
     $form->isShow = $activityModel->isShow;
     $form->pcUrl = $activityModel->pcUrl;
     $form->wapUrl = $activityModel->wapUrl;
     $form->discount = $activityModel->discount;
     $form->reduceMoney = $activityModel->reduceMoney;
     $form->status = $activityModel->status;
     return $this->render(Variable::$editActivity_view, ['model' => $form, 'activityModel' => $activityModel]);
 }
示例#13
0
 public function actionEditbarlist()
 {
     $user = new AdminUser();
     if (!$user->checkUserIsLogin()) {
         $this->redirect(Variable::$home_url);
         return;
     }
     //        $form=new BarForm();
     //        $req=Yii::$app->request;//创建一个请求对象
     //        $form->setScenario('update');
     //        if($form->load($req->post()) && $form->validate()){
     //            print_r($form);
     //        }
     //        $form->setScenario('update');
     $req = Yii::$app->request;
     //创建一个请求对象
     $id = trim($req->get('id'));
     if (!is_numeric($id) || $id == 0) {
         $this->redirect(Variable::$barIndex_url);
         return;
     }
     $barModel = Bar::findOne($id);
     $barListModel = Bar::find()->where(['parentBar' => $id])->all();
     return $this->render(Variable::$editBarList_view, ['barModel' => $barModel, 'barListModel' => $barListModel]);
 }
 public function actionAddproductcat()
 {
     $user = new AdminUser();
     if (!$user->checkUserIsLogin()) {
         $this->redirect(Variable::$home_url);
         return;
     }
     //请求处理
     $req = Yii::$app->request;
     $name = trim($req->post('name'));
     $sort = trim($req->post('sort'));
     $desc = trim($req->post('desc'));
     if ((new ProductCategory())->addCat($name, $sort, $desc)) {
         JsonParser::GenerateJsonResult('_0000', '添加成功');
         exit;
     }
     JsonParser::GenerateJsonResult('_0001', '添加失败');
     exit;
 }
 public function actionShowarticle()
 {
     $user = new AdminUser();
     if (!$user->checkUserIsLogin()) {
         $this->redirect(Variable::$home_url);
         return;
     }
     $req = Yii::$app->request;
     $id = trim($req->get('id'));
     if (!is_numeric($id) || $id == 0) {
         $this->redirect(Variable::$articleManger_url);
         return;
     }
     return $this->render(Variable::$showArticle_view, ['model' => (new Article())->findOne($id)]);
 }
 public function actionEditadminuser()
 {
     $user = new AdminUser();
     if (!$user->checkUserIsLogin()) {
         $this->redirect(Variable::$home_url);
         return;
     }
     $req = Yii::$app->request;
     //创建一个请求对象
     $form = new AdminUserForm();
     $form->setScenario('update');
     $adminUserModel = new AdminUser();
     $id = trim($req->get('id'));
     if (!is_numeric($id) || $id == 0) {
         $this->redirect(Variable::$adminUserManger_url);
         return;
     }
     //修改
     if ($form->load($req->post()) && $form->validate()) {
         $isSuccess = $adminUserModel->updateAdminUser($id, $form->password, $form->mobile, $form->role, $form->status);
         if ($isSuccess) {
             $form->addError('', '资料更新成功');
         } else {
             $form->addError('', '资料更新失败');
         }
     }
     $adminUserModel = $adminUserModel->findUserByUserId($id);
     $form->username = $adminUserModel->username;
     $form->password = $adminUserModel->password;
     $form->role = $adminUserModel->role;
     $form->mobile = $adminUserModel->mobile;
     $form->status = $adminUserModel->status;
     return $this->render(Variable::$editAdminUser_view, ['model' => $form, 'adminUserModel' => $adminUserModel]);
 }
 public function actionEditpointimg()
 {
     $user = new AdminUser();
     if (!$user->checkUserIsLogin()) {
         $this->redirect(Variable::$home_url);
         return;
     }
     $req = Yii::$app->request;
     //创建一个请求对象
     $form = new CustomerForm();
     $form->level = Variable::$customer_type_w;
     $form->setScenario('img');
     $id = trim($req->get('id'));
     if (!is_numeric($id) || $id == 0) {
         $this->redirect(Variable::$customerBrand_url);
         return;
     }
     //修改
     if ($form->load($req->post()) && $form->validate()) {
         $isSuccess = (new Customer())->updateCus($id, $form->name, $form->sort, $form->level, $form->blogo, $form->clogo, $form->img1, $form->img2, $form->img3, $form->img4, $form->img5);
         if ($isSuccess) {
             Yii::$app->session->setFlash(Variable::$flash_success, '设置成功');
         } else {
             //                $form->addError('','更新失败');
             Yii::$app->session->setFlash(Variable::$flash_error, '设置失败,请重试');
         }
     }
     $customerModel = Customer::findOne($id);
     $form->img1 = $customerModel->img1;
     $form->img2 = $customerModel->img2;
     $form->img3 = $customerModel->img3;
     $form->img4 = $customerModel->img4;
     $form->img5 = $customerModel->img5;
     $form->name = $customerModel->name;
     $form->id = $customerModel->id;
     $list = [];
     if (!empty($form->img1)) {
         array_push($list, $form->img1);
     }
     if (!empty($form->img2)) {
         array_push($list, $form->img2);
     }
     if (!empty($form->img3)) {
         array_push($list, $form->img3);
     }
     if (!empty($form->img4)) {
         array_push($list, $form->img4);
     }
     if (!empty($form->img5)) {
         array_push($list, $form->img5);
     }
     return $this->render(Variable::$editPointImg_view, ['model' => $form, 'customerModel' => $customerModel, 'list' => $list]);
 }
示例#18
0
 public function deleteAdminUser($id)
 {
     $model = AdminUser::find()->where(['id' => $id])->one();
     if (!$model) {
         return false;
     }
     if ($model->delete()) {
         return true;
     }
     return false;
 }
示例#19
0
 public function actionLogout()
 {
     $user = new AdminUser();
     $user->logOut();
     return $this->goHome();
 }
示例#20
0
 /**
  * Render ActiveField input based on provided settings
  *
  * @param ActiveForm $form
  * @param Model|ActiveRecord $model
  * @param string $attribute
  * @param array $settings
  * @return ActiveField|NULL|string
  */
 private function renderActiveInput($form, $model, $attribute, $settings)
 {
     if (is_string($settings) && $settings) {
         // no settings have been provided for the attribute so $settings will be the attribute name
         $attribute = $settings;
         $settings = [];
     }
     $settingsIn = $settings;
     if ($model instanceof AttributeSupportInterface) {
         //$activeConfig = $model->getAttributeConfig($attribute, 'active');
         $activeConfig = $model->getActiveFieldSettings($attribute);
         if ($activeConfig) {
             $settings = array_merge($activeConfig, $settings);
         }
     }
     $spec = false;
     if ($model instanceof YiiActiveRecord) {
         if ($this->spec === null) {
             $this->spec = $this->model->getTableSchema()->columns;
         }
         if ($this->spec && isset($this->spec[$attribute])) {
             $spec = isset($this->spec[$attribute]) ? $this->spec[$attribute] : false;
         }
     }
     $type = ArrayHelper::getValue($settings, 'type', null);
     $typeAutomatic = false;
     $label = null;
     $items = ArrayHelper::getValue($settings, 'items', []);
     if ($items instanceof \Closure) {
         $items = $items($model, $attribute);
     }
     if (!$items) {
         if (is_array($spec->enumValues) && $spec->enumValues) {
             foreach ($spec->enumValues as $k => $v) {
                 if (is_string($v) && $v == '') {
                 } else {
                     $items[$v] = $v;
                 }
             }
         }
     }
     $allowClear = false;
     if ($type === null && $items) {
         // we have been given items so assume a drop down list
         $type = InputField::INPUT_DROPDOWN_LIST;
     }
     if ($type === null) {
         // try to guess the appropriate type
         switch ($attribute) {
             case 'created_at':
             case 'createdAt':
                 $type = InputField::INPUT_STATIC;
                 $label = $model->getAttributeConfig($attribute, 'label');
                 $label = !$label ? ArrayHelper::getValue($settings, 'label', false) : $label;
                 $label = !$label ? 'Created' : $label;
                 $createAttribute = $attribute == 'created_at' ? 'created_by' : 'createdBy';
                 if ($model->hasAttribute($createAttribute)) {
                     if ($model->{$createAttribute} == Yii::$app->user->identity->id) {
                         $settings['options']['value'] = $model->{$attribute} . ' by ' . Yii::$app->user->identity->display_name;
                     } else {
                         $createData = AdminUser::find()->select('display_name')->where(['id' => $model->{$createAttribute}])->limit(1)->asArray()->column();
                         $settings['options']['value'] = $model->{$attribute} . ' by ' . $createData[0];
                     }
                 }
                 break;
             case 'modified_at':
             case 'modifiedAt':
                 $type = InputField::INPUT_STATIC;
                 $label = $model->getAttributeConfig($attribute, 'label');
                 $label = !$label ? ArrayHelper::getValue($settings, 'label', false) : $label;
                 $label = !$label ? 'Last Modified' : $label;
                 $modifiedAttribute = $attribute == 'modified_at' ? 'modified_by' : 'modifiedBy';
                 if ($model->hasAttribute($modifiedAttribute)) {
                     if ($model->{$modifiedAttribute} == Yii::$app->user->identity->id) {
                         $settings['options']['value'] = $model->{$attribute} . ' by ' . Yii::$app->user->identity->display_name;
                     } else {
                         $modifiedData = AdminUser::find()->select('display_name')->where(['id' => $model->{$modifiedAttribute}])->limit(1)->asArray()->column();
                         $settings['options']['value'] = $model->{$attribute} . ' by ' . $modifiedData[0];
                     }
                 }
                 break;
             case 'created_by':
             case 'createdBy':
             case 'modified_by':
             case 'modifiedBy':
             case 'id':
                 $type = InputField::INPUT_STATIC;
                 break;
             default:
                 $type = InputField::getDefaultInputFieldType($attribute, $spec, $settings);
                 if ($type) {
                     $typeAutomatic = true;
                 }
         }
         if ($type === null) {
             return '';
         }
     }
     $fieldConfig = ArrayHelper::getValue($settings, 'fieldConfig', []);
     $options = ArrayHelper::getValue($settings, 'options', []);
     $hint = ArrayHelper::getValue($settings, 'hint', null);
     $icon = ArrayHelper::getValue($settings, 'icon', $typeAutomatic && InputField::getIsIconSupportedFieldType($type) ? true : null);
     $tooltip = ArrayHelper::getValue($settings, 'tooltip', null);
     $focus = ArrayHelper::getValue($settings, 'focus', null);
     $addon = ArrayHelper::getValue($settings, 'addon', null);
     $clear = ArrayHelper::getValue($settings, 'clear', null);
     $label = $label === null ? ArrayHelper::getValue($settingsIn, 'label', $label) : $label;
     $label = $label === null ? $this->model->getAttributeLabel($attribute) : $label;
     $hideuseInlineHelp = $useLabelColumn = ArrayHelper::getValue($settings, 'useInlineHelp', true);
     // is the current field read only
     $readOnly = false;
     if ($type == InputField::INPUT_READONLY) {
         $type = InputField::INPUT_TEXT;
         $readOnly = true;
     } elseif (!$this->ignoreReadOnly && $model instanceof ActiveRecordReadOnlyInterface && $model->getReadOnly()) {
         $readOnly = true;
     } elseif (method_exists($form, 'isEditLocked') && $form->isEditLocked()) {
         $readOnly = true;
     } elseif (!$this->ignoreIsEditLocked && method_exists($model, 'isEditLocked') && $model->isEditLocked()) {
         $readOnly = true;
     } elseif (ArrayHelper::getValue($settings, 'readonly', false)) {
         $readOnly = true;
     }
     /*
      * apply any conversions if required or extra settings to apply
      */
     switch ($type) {
         case InputField::INPUT_CHECKBOX:
             if (!ArrayHelper::keyExists('class', $options)) {
                 // should we apply a default checkbox style or plugin
                 if ($this->defaultCheckboxPlugin !== null && $this->defaultCheckboxPlugin) {
                     Html::addCssClass($options, $this->defaultCheckboxPlugin);
                 }
             }
             break;
         case InputField::INPUT_CHECKBOX_BASIC:
             // revert back to basic checkbox
             $type = InputField::INPUT_CHECKBOX;
             break;
         case InputField::INPUT_CHECKBOX_ICHECK:
             // revert to basic checkbox with icheck class applied
             $type = InputField::INPUT_CHECKBOX;
             Html::addCssClass($options, 'icheck');
             break;
         case InputField::INPUT_CHECKBOX_SWITCH:
             // revert to basic checkbox with make-switch class applied
             $type = InputField::INPUT_CHECKBOX;
             Html::addCssClass($options, 'make-switch');
             break;
         case InputField::INPUT_DATE:
             $options['data-maxlength'] = false;
             $options['data-inputmask'] = ['alias' => 'yyyy-mm-dd'];
             $options['maxlength'] = 10;
             $addon = ['append' => [['class' => 'glyphicon glyphicon-th show-datepicker', 'title' => 'Click to select date']], 'groupOptions' => ['class' => 'date input-small']];
             //$options['widgetOptions']['pluginOptions']['autoclose'] = false; // optionally override plugin or widget options
             $clear = $clear !== false ? true : $clear;
             $allowClear['input'] = 'input';
             break;
         case InputField::INPUT_DATETIME:
             $options['data-maxlength'] = false;
             $options['data-inputmask'] = ['alias' => 'yyyy-mm-dd hh:mm:ss'];
             //$options['data-inputmask'] = ['alias' => 'yyyy-mm-dd hh:mm'];
             $options['maxlength'] = 19;
             $addon = ['append' => [['class' => 'glyphicon glyphicon-th show-date-time-picker', 'title' => 'Click to select date']], 'groupOptions' => ['class' => 'date input-medium']];
             //$options['widgetOptions']['pluginOptions']['autoclose'] = false; // optionally override plugin or widget options
             $clear = $clear !== false ? true : $clear;
             $allowClear['input'] = 'input';
             break;
         case InputField::INPUT_YEAR:
             $options['data-maxlength'] = false;
             $options['data-inputmask'] = ['mask' => '9999'];
             break;
         case InputField::INPUT_TIME:
             $options['data-maxlength'] = false;
             $options['data-inputmask'] = ['alias' => 'hh:mm:ss'];
             //$options['data-inputmask'] = ['alias' => 'hh:mm'];
             $options['maxlength'] = 8;
             $addon = ['append' => [['class' => 'glyphicon glyphicon-th clickable show-timepicker', 'title' => 'Click to select time']], 'groupOptions' => ['class' => 'input-small']];
             $clear = $clear !== false ? true : $clear;
             $allowClear['input'] = 'time';
             break;
         case InputField::INPUT_INTEGER:
             $options['data-maxlength'] = false;
             $options['data-inputmask'] = isset($options['data-inputmask']) ? $options['data-inputmask'] : [];
             $options['maxlength'] = isset($options['maxlength']) ? $options['maxlength'] : $spec->size + ($spec->unsigned ? 0 : 1);
             $defaults = ['alias' => 'numeric', 'allowMinus' => !$spec->unsigned, 'digits' => 0, 'rightAlign' => true];
             $options['data-inputmask'] = array_merge($defaults, $options['data-inputmask']);
             $clear = $clear !== false ? true : $clear;
             $allowClear['input'] = 'integer';
             //$allowClear['value'] = '0';
             break;
         case InputField::INPUT_DECIMAL:
             $options['data-maxlength'] = false;
             $options['data-inputmask'] = isset($options['data-inputmask']) ? $options['data-inputmask'] : [];
             $options['maxlength'] = isset($options['maxlength']) ? $options['maxlength'] : $spec->size + 1 + ($spec->unsigned ? 0 : 1);
             $defaults = ['alias' => 'decimal', 'allowMinus' => !$spec->unsigned, 'integerDigits' => $spec->size - $spec->scale, 'digits' => $spec->scale, 'rightAlign' => true];
             $options['data-inputmask'] = array_merge($defaults, $options['data-inputmask']);
             $clear = $clear !== false ? true : $clear;
             $allowClear['input'] = 'decimal';
             if ($spec->scale != 2) {
                 $allowClear['value'] = number_format(0, $spec->scale);
             }
             break;
         case InputField::INPUT_COLOR:
             $options['data-maxlength'] = false;
             $allowClear['input'] = 'colorpicker';
             break;
         case InputField::INPUT_MINI_COLORS:
             $options['data-maxlength'] = false;
             $allowClear['input'] = 'minicolors';
             break;
         case InputField::INPUT_TEXT:
         case InputField::INPUT_TEXTAREA:
             $allowClear['input'] = 'input';
             break;
         case InputField::INPUT_DROPDOWN_LIST:
         case InputField::INPUT_LIST_BOX:
             // will select first item in drop down list
             $allowClear['input'] = 'select';
             break;
         case InputField::INPUT_SELECT2:
         case InputField::INPUT_SELECT2_MULTI:
             $allowClear['input'] = 'select2';
             break;
         case InputField::INPUT_SELECT_PICKER:
         case InputField::INPUT_SELECT_PICKER_MULTI:
             $allowClear['input'] = 'selectpicker';
             break;
         case InputField::INPUT_MULTISELECT:
             $allowClear['input'] = 'multiselect';
             break;
         default:
     }
     /**
      * @var ActiveField $field
      */
     $field = $form->field($model, $attribute, $fieldConfig);
     switch ($type) {
         case InputField::INPUT_HIDDEN:
         case InputField::INPUT_STATIC:
             return static::getInput($field, $type, [$options], $label, $hint, $icon, $tooltip, null);
             break;
         case InputField::INPUT_TEXT:
         case InputField::INPUT_PASSWORD:
         case InputField::INPUT_PASSWORD_STRENGTH:
         case InputField::INPUT_TEXTAREA:
         case InputField::INPUT_INTEGER:
         case InputField::INPUT_DECIMAL:
         case InputField::INPUT_YEAR:
         case InputField::INPUT_TIME:
         case InputField::INPUT_DATE:
         case InputField::INPUT_DATETIME:
         case InputField::INPUT_COLOR:
         case InputField::INPUT_MINI_COLORS:
             Html::addCssClass($options, 'form-control');
             if (ArrayHelper::getValue($settings, 'placeholder', null) !== null) {
                 $options['placeholder'] = ArrayHelper::getValue($settings, 'placeholder', null);
             }
             if ($readOnly) {
                 $options['disabled'] = 'disabled';
                 $clear = false;
             }
             $clear = $clear === true ? true : false;
             // null defaults to false if still null at this stage
             if ($clear === false) {
                 $allowClear = false;
             }
             $maxlength = ArrayHelper::getValue($options, 'maxlength', $spec ? $spec->size : 0);
             $inputSize = ArrayHelper::getValue($settings, 'size', InputField::INPUT_SIZE_AUTO);
             if ($maxlength) {
                 $inputSize = $this->getDefaultInputSize($inputSize, $maxlength, $icon, $tooltip);
                 if (!$readOnly) {
                     $options['maxlength'] = $maxlength;
                     if (isset($options['data-maxlength']) && !$options['data-maxlength']) {
                         // do not use the plugin
                         unset($options['data-maxlength']);
                     } else {
                         BootstrapMaxlengthAsset::register($this->getView());
                         if (!isset($options['data-maxlength']['threshold'])) {
                             if ($maxlength > 99) {
                                 $options['data-maxlength']['threshold'] = '50';
                             } elseif ($maxlength > 50) {
                                 $options['data-maxlength']['threshold'] = '20';
                             } elseif ($maxlength > 10) {
                                 $options['data-maxlength']['threshold'] = '10';
                             } else {
                                 $options['data-maxlength']['threshold'] = $maxlength - 1;
                             }
                         }
                         if (!isset($options['data-maxlength']['placement'])) {
                             $options['data-maxlength']['placement'] = 'top';
                         }
                         $options['data-maxlength'] = Json::encode($options['data-maxlength']);
                         Html::addCssClass($options, 'bs-max-me');
                     }
                     if ($type == InputField::INPUT_PASSWORD_STRENGTH) {
                         BootstrapPasswordStrengthAsset::register($this->getView());
                         Html::addCssClass($options, 'strength-me');
                     }
                     $options = $this->setFocus($options, $field, $attribute, $focus);
                 }
             }
             if (isset($options['data-inputmask'])) {
                 Html::addCssClass($options, 'mask-me');
                 if (isset($options['data-inputmask'])) {
                     $options['data-inputmask'] = Json::encode($options['data-inputmask']);
                 }
                 InputMaskAsset::register($this->getView());
             }
             $options = $this->applyInputSize($inputSize, $options);
             // by default make inputs select their own content when they get focus
             Html::addCssClass($options, 'select-me');
             $options = $this->convertOptionsForWidgets($type, $options);
             if ($allowClear) {
                 $allowClear['size'] = $inputSize;
             }
             return static::getInput($field, $type, [$options], $label, $hint, $icon, $tooltip, $addon, $allowClear);
             break;
         case InputField::INPUT_FILE:
             return static::getInput($field, $type, [$options], $label, $hint, $icon, $tooltip, $addon);
             break;
         case InputField::INPUT_CHECKBOX:
             $enclosedByLabel = ArrayHelper::getValue($settings, 'enclosedByLabel', false);
             $useLabelColumn = ArrayHelper::getValue($settings, 'useLabelColumn', true);
             if ($label !== null && $label) {
                 $options['label'] = $useLabelColumn ? null : $label;
             }
             $useInlineHelp = ArrayHelper::getValue($settings, 'useInlineHelp', true);
             if ($useInlineHelp) {
                 $field->hintOptions = ['tag' => 'span', 'class' => 'help-inline'];
                 $field->template = str_replace("\n{error}", '', $field->template);
             }
             if ($readOnly) {
                 $options['disabled'] = 'disabled';
             }
             if (strpos(ArrayHelper::getValue($options, 'class', ''), 'make-switch') !== false) {
                 //$options['data-on-text'] = ArrayHelper::getValue($options, 'data-on-text', 'ON'); // value can be an icon e.g. <i class='fa fa-check'></i>
                 //$options['data-off-text'] = ArrayHelper::getValue($options, 'data-off-text', 'OFF'); // value can be an icon e.g. <i class='fa fa-times'></i>
                 //$options['data-on-color'] = ArrayHelper::getValue($options, 'data-on-color', 'primary');
                 //$options['data-off-color'] = ArrayHelper::getValue($options, 'data-off-color', 'default');
                 $options['data-size'] = ArrayHelper::getValue($options, 'data-size', 'small');
                 BootstrapSwitchAsset::register($this->getView());
             } elseif (strpos(ArrayHelper::getValue($options, 'class', ''), 'icheck') !== false) {
                 //Html::addCssClass($options, 'icheck');
                 $options['data-checkbox'] = ArrayHelper::getValue($options, 'data-checkbox', 'icheckbox_square-blue');
                 ICheckAsset::register($this->getView());
             }
             return $this->getInput($field->{$type}($options, $enclosedByLabel), $type, null, $useLabelColumn ? $label : null, $hint);
             break;
         case InputField::INPUT_RAW:
             $value = ArrayHelper::getValue($settings, 'value', '');
             if ($value instanceof \Closure) {
                 $value = $value();
             }
             return $value;
             break;
         case InputField::INPUT_SELECT_PICKER_MULTI:
         case InputField::INPUT_SELECT2_MULTI:
         case InputField::INPUT_MULTISELECT:
             $isMultiple = true;
             // no break
         // no break
         case InputField::INPUT_DROPDOWN_LIST:
         case InputField::INPUT_LIST_BOX:
         case InputField::INPUT_SELECT2:
         case InputField::INPUT_SELECT_PICKER:
         case InputField::INPUT_SELECT_SPLITTER:
             $isMultiple = isset($isMultiple) && $isMultiple || isset($options['multiple']) ? true : false;
             if ($isMultiple) {
                 $options['multiple'] = 'multiple';
                 $this->model->setAttribute($attribute, explode('|', $this->model->getAttribute($attribute)));
             }
             if ($isMultiple && !InputField::getIsWidgetFromFieldType($type) || $type == InputField::INPUT_LIST_BOX) {
                 $options['size'] = ArrayHelper::getValue($options, 'size', 4);
             }
             Html::addCssClass($options, 'form-control');
             if (ArrayHelper::getValue($settings, 'placeholder', null) !== null) {
                 $options['prompt'] = ArrayHelper::getValue($settings, 'placeholder', null);
             }
             if ($readOnly) {
                 $options['disabled'] = 'disabled';
                 $clear = false;
             } else {
                 $options = $this->setFocus($options, $field, $attribute, $focus);
             }
             $clear = $clear === true ? true : false;
             // null defaults to false if still null at this stage
             if ($clear === false) {
                 $allowClear = false;
             }
             if ($typeAutomatic && !isset($options['prompt'])) {
                 if ($model->hasAttribute($attribute) && $model->getAttribute($attribute) != '' && $model->getAttribute($attribute) !== null) {
                     // no prompt required by default
                 } else {
                     $options['prompt'] = 'Select...';
                     $options['promptValue'] = '';
                 }
             }
             switch ($type) {
                 case InputField::INPUT_SELECT2:
                 case InputField::INPUT_SELECT2_MULTI:
                 case InputField::INPUT_SELECT_PICKER:
                 case InputField::INPUT_SELECT_PICKER_MULTI:
                 case InputField::INPUT_SELECT_SPLITTER:
                     if (isset($options['prompt']) && $options['prompt'] != '') {
                         // default value will be blank and convert to null by default
                         if ($type == InputField::INPUT_SELECT2 || $type == InputField::INPUT_SELECT2_MULTI) {
                             $promptValue = isset($options['promptValue']) ? $options['promptValue'] : '0';
                             if (!isset($options['groups'])) {
                                 $options['widgetOptions']['pluginOptions']['placeholder'] = $options['prompt'];
                                 $options['widgetOptions']['pluginOptions']['id'] = $promptValue;
                             } else {
                                 $promptValue = $options['promptValue'];
                                 $items = array_merge([$promptValue => $options['prompt']], $items);
                             }
                         } elseif ($type == InputField::INPUT_SELECT_PICKER || $type == InputField::INPUT_SELECT_PICKER_MULTI) {
                             $promptValue = isset($options['promptValue']) ? $options['promptValue'] : '';
                             if ($promptValue != '') {
                                 $items = array_merge([$promptValue => $options['prompt']], $items);
                             } else {
                                 $options['title'] = $options['prompt'];
                                 if (!$isMultiple) {
                                     //wlchere - makes it work well front end but breaks back end when an array is submitted
                                     //$isMultiple = true;
                                     //$options['multiple'] = 'multiple';
                                     //$options['widgetOptions']['pluginOptions']['maxOptions'] = 1;
                                 }
                             }
                         } elseif ($type == InputField::INPUT_SELECT_SPLITTER) {
                             if (!$isMultiple) {
                                 $promptValue = isset($options['promptValue']) ? $options['promptValue'] : '';
                                 $items = array_merge(['' => [$promptValue => $options['prompt']]], $items);
                                 $options['groups'] = isset($options['groups']) ? $options['groups'] : [];
                                 $options['groups'] = array_merge(['' => ['label' => $options['prompt']]], $options['groups']);
                             }
                         }
                     }
                     break;
                 default:
                     if (!$isMultiple && isset($options['prompt']) && $options['prompt'] != '') {
                         // default value will be blank and convert to null by default
                         $promptValue = isset($options['promptValue']) ? $options['promptValue'] : '0';
                         $items = array_merge([$promptValue => $options['prompt']], $items);
                     }
             }
             unset($options['prompt']);
             unset($options['promptValue']);
             $inputSize = ArrayHelper::getValue($settings, 'size', InputField::INPUT_SIZE_AUTO);
             $inputSize = $this->getDefaultInputSize($inputSize, 0, $icon, $tooltip);
             $options = $this->applyInputSize($inputSize, $options);
             $options = $this->convertOptionsForWidgets($type, $options);
             if ($allowClear) {
                 $allowClear['size'] = $inputSize;
             }
             return $this->getInput($field, $type, [$items, $options], $label, $hint, $icon, $tooltip, $addon, $allowClear);
             break;
         case InputField::INPUT_CHECKBOX_LIST:
         case InputField::INPUT_CHECKBOX_LIST_ICHECK:
             $this->model->setAttribute($attribute, explode('|', $this->model->getAttribute($attribute)));
             $allowClear['input'] = 'checkbox';
             if (!isset($options['itemOptions'])) {
                 $options['itemOptions'] = [];
             }
             if (!isset($options['itemOptions']['labelOptions'])) {
                 $options['itemOptions']['labelOptions'] = [];
             }
             $inline = ArrayHelper::getValue($settings, 'inline', false);
             if ($inline) {
                 Html::addCssClass($options['itemOptions']['labelOptions'], 'checkbox-inline');
             } else {
                 // vertically listed so disable form control as well
                 $settings['noFormControl'] = true;
             }
             if (ArrayHelper::getValue($settings, 'noFormControl', false)) {
                 // icon and tooltip will not be supported
                 $icon = false;
                 $tooltip = false;
                 Html::addCssClass($options, 'checkbox-list');
                 $allowClear = false;
             } else {
                 // wrap the whole checkbox list in a form-control box
                 Html::addCssClass($options, 'form-control fc-checkbox-list checkbox-list');
             }
             if ($type == InputField::INPUT_CHECKBOX_LIST_ICHECK) {
                 $allowClear['input'] = 'icheckbox';
                 Html::addCssClass($options['itemOptions'], 'icheck');
                 $options['itemOptions']['data-checkbox'] = ArrayHelper::getValue($options['itemOptions'], 'data-checkbox', 'icheckbox_square-blue');
                 ICheckAsset::register($this->getView());
             }
             if ($readOnly) {
                 $options['disabled'] = 'disabled';
                 $options['itemOptions']['disabled'] = 'disabled';
                 $clear = false;
             }
             if ($allowClear) {
                 $clear = $clear === true ? true : false;
                 // null defaults to false if still null at this stage
                 if ($clear === false) {
                     $allowClear = false;
                 }
             }
             $options = $this->applyInputSize(ArrayHelper::getValue($settings, 'size', InputField::INPUT_SIZE_NONE), $options);
             return $this->getInput($field, 'checkboxList', [$items, $options], $label, $hint, $icon, $tooltip, $addon, $allowClear);
             break;
         case InputField::INPUT_RADIO_LIST:
         case InputField::INPUT_RADIO_LIST_ICHECK:
             $allowClear['input'] = 'radio';
             if (!isset($options['itemOptions'])) {
                 $options['itemOptions'] = [];
             }
             if (!isset($options['itemOptions']['labelOptions'])) {
                 $options['itemOptions']['labelOptions'] = [];
             }
             $inline = ArrayHelper::getValue($settings, 'inline', false);
             if ($inline) {
                 Html::addCssClass($options['itemOptions']['labelOptions'], 'radio-inline');
             } else {
                 // vertically listed so disable form control as well
                 $settings['noFormControl'] = true;
             }
             if (ArrayHelper::getValue($settings, 'noFormControl', false)) {
                 // icon and tooltip will not be supported
                 $icon = false;
                 $tooltip = false;
                 Html::addCssClass($options, 'radio-list');
                 $allowClear = false;
             } else {
                 // wrap the whole checkbox list in a form-control box
                 Html::addCssClass($options, 'form-control fc-radio-list radio-list');
             }
             if ($type == InputField::INPUT_RADIO_LIST_ICHECK) {
                 $allowClear['input'] = 'iradio';
                 if (!$inline) {
                     Html::addCssClass($options['itemOptions']['labelOptions'], 'radio-vertical');
                 }
                 Html::addCssClass($options['itemOptions'], 'icheck');
                 $options['itemOptions']['data-radio'] = ArrayHelper::getValue($options['itemOptions'], 'data-radio', 'iradio_square-blue');
                 ICheckAsset::register($this->getView());
             }
             if ($readOnly) {
                 $options['disabled'] = 'disabled';
                 $options['itemOptions']['disabled'] = 'disabled';
                 $clear = false;
             }
             if ($allowClear) {
                 $clear = $clear === true ? true : false;
                 // null defaults to false if still null at this stage
                 if ($clear === false) {
                     $allowClear = false;
                 }
             }
             $options = $this->applyInputSize(ArrayHelper::getValue($settings, 'size', InputField::INPUT_SIZE_NONE), $options);
             return $this->getInput($field, 'radioList', [$items, $options], $label, $hint, $icon, $tooltip, $addon, $allowClear);
             break;
         case InputField::INPUT_HTML5:
             return 'WORK IN PROGRESS: ' . $attribute . ' : ' . $type . '<br/>';
             break;
         case InputField::INPUT_EDITOR_CK:
         case InputField::INPUT_EDITOR_BS_WYSIHTML5:
         case InputField::INPUT_EDITOR_BS_SUMMERNOTE:
             //wlchere move to normal place above plus possibly switch this whole section into textarea above
             // and make use of InputField::getIsEditorFromFieldType($type)
             $allowClear['input'] = 'val';
             Html::addCssClass($options, 'form-control');
             if (ArrayHelper::getValue($settings, 'placeholder', null) !== null) {
                 $options['placeholder'] = ArrayHelper::getValue($settings, 'placeholder', null);
             }
             if ($readOnly) {
                 $options['disabled'] = 'disabled';
                 $clear = false;
             }
             $clear = $clear === true ? true : false;
             // null defaults to false if still null at this stage
             if ($clear === false) {
                 $allowClear = false;
             }
             $inputSize = ArrayHelper::getValue($settings, 'size', InputField::INPUT_SIZE_AUTO);
             $options = $this->applyInputSize($inputSize, $options);
             $options = $this->convertOptionsForWidgets($type, $options);
             if ($allowClear) {
                 $allowClear['size'] = $inputSize;
             }
             return static::getInput($field, $type, [$options], $label, $hint, $icon, $tooltip, $addon, $allowClear);
             break;
         case InputField::INPUT_SELECT2_TAGS:
         case InputField::INPUT_WIDGET:
             return 'WORK IN PROGRESS (other): ' . $attribute . ' : ' . $type . '<br/>';
             break;
         case InputField::INPUT_RADIO:
             return 'Not currently supported: ' . $attribute . ' : ' . $type . '<br/>';
             break;
         default:
             return 'WORK IN PROGRESS (other): ' . $attribute . ' : ' . $type . '<br/>';
     }
     return null;
 }