public function actionSet() { $Mam = new Mam(); $Mam->set_prop_from_arr($_REQUEST); $user = Doctor::getInstance()->get(\Yii::$app->user->id); $Mam->hosp_id = $user['hosp_id']; $Mam->doctor_id = $user['id']; $Mam->set(); if (Core::hasError() === false) { $ar['success_txt'] = 'Запись успешно сохранена'; } Core::encode_echo($ar); }
public function init() { parent::init(); // TODO: Change the autogenerated stub if (!\Yii::$app->user->can('doctor_user')) { if (!\Yii::$app->request->isAjax) { \Yii::$app->getResponse()->redirect('/login?err=1'); } else { Core::error('У Вас нет прав на контроллер'); Core::encode_echo(); } } $this->_user = Doctor::getInstance()->get(\Yii::$app->user->id); }
</div> </div> <div class="form-group"> <label for="name_o" class="col-sm-8 control-label">Заметки</label> <div class="col-sm-16"> <input value="" type="text" class="form-control" id="note" name="note" placeholder="Заметки"> </div> </div> </fieldset> <fieldset class="sm"> <legend>Права</legend> <?php foreach (\app\models\Doctor::getInstance()->perm_ar as $item) { ?> <div class="checkbox"> <label> <input type="checkbox" id="perm_<?php echo $item['id']; ?> " name="perm[]" value="<?php echo $item['id']; ?> "> <?php echo $item['title']; ?> </label> </div>