Esempio n. 1
0
 public function actionHospLst()
 {
     $Hosp = new Hosp();
     $Hosp->set_prop_from_arr($_REQUEST);
     $ar['tbl'] = $Hosp->lst();
     Core::encode_echo($ar);
 }
Esempio n. 2
0
 public function actionGet()
 {
     $Hosp = new Hosp();
     $Hosp->set_prop_from_arr($_REQUEST);
     $ar['get'] = $Hosp->get();
     Core::encode_echo($ar);
 }
Esempio n. 3
0
 public function actionDel()
 {
     $Doctor = new Doctor();
     $Doctor->set_prop_from_arr($_REQUEST);
     $Doctor->hosp_id = $this->_user['hosp_id'];
     $ar['get'] = $Doctor->del();
     Core::encode_echo($ar);
 }
Esempio n. 4
0
 public function actionInit()
 {
     $transaction = \yii::$app->db->getTransaction();
     if (!$transaction) {
         $transaction = \Yii::$app->db->beginTransaction();
     }
     try {
         $auth = \Yii::$app->authManager;
         $auth->init();
         $auth->removeAll();
         $role_adm = $auth->createRole('role_adm');
         $role_adm_boss = $auth->createRole('role_adm_boss');
         $auth->add($role_adm);
         $auth->add($role_adm_boss);
         $adm = $auth->createPermission('adm');
         // доступ к администрированию проекта
         $adm_user = $auth->createPermission('adm_user');
         // управление учетными записями, всеми
         $adm_hosp = $auth->createPermission('adm_hosp');
         // управление больгицами, всеми
         $auth->add($adm);
         $auth->add($adm_user);
         $auth->add($adm_hosp);
         $auth->addChild($role_adm, $adm);
         $auth->addChild($role_adm_boss, $role_adm);
         $auth->addChild($role_adm_boss, $adm_user);
         $auth->addChild($role_adm_boss, $adm_hosp);
         $role_doctor = $auth->createRole('role_doctor');
         $role_doctor_boss = $auth->createRole('role_doctor_boss');
         $auth->add($role_doctor);
         $auth->add($role_doctor_boss);
         $doctor = $auth->createPermission('doctor');
         // докторский доступ
         $doctor_user = $auth->createPermission('doctor_user');
         // // управление учетными записями, докторскими
         $doctor_control = $auth->createPermission('doctor_control');
         // доступ к контрольной отчетности
         $auth->add($doctor);
         $auth->add($doctor_user);
         $auth->add($doctor_control);
         $auth->addChild($role_doctor, $doctor);
         $auth->addChild($role_doctor_boss, $role_doctor);
         $auth->addChild($role_doctor_boss, $doctor_user);
         $auth->addChild($role_doctor_boss, $doctor_control);
         if (\app\component\Core::hasError() === false) {
             $transaction->commit();
         } else {
             $transaction->rollBack();
         }
     } catch (Exception $e) {
         $transaction->rollBack();
     }
 }
Esempio n. 5
0
 public function init()
 {
     parent::init();
     if (!\Yii::$app->user->can('adm')) {
         if (!\Yii::$app->request->isAjax) {
             \Yii::$app->getResponse()->redirect('/login?err=1');
         } else {
             Core::error('У Вас нет прав на контроллер');
             Core::encode_echo();
         }
     }
 }
Esempio n. 6
0
 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);
 }
Esempio n. 7
0
 public function actionLogin()
 {
     $t = \Yii::$app->request->post('t');
     $ar = [];
     $ar['t'] = $t;
     if ($t == 'adm') {
         $Adm = new Adm();
         $Adm->set_prop_from_arr($_REQUEST);
         $Adm->login();
     }
     if ($t == 'doctor') {
         $Doctor = new Doctor();
         $Doctor->set_prop_from_arr($_REQUEST);
         $Doctor->login();
     }
     Core::encode_echo($ar);
 }
Esempio n. 8
0
 public function set()
 {
     $this->city_id = $this->city_id > 0 ? $this->city_id : null;
     $this->id = $this->id > 0 ? $this->id : null;
     $this->fld_name['city_id'] = 'Город';
     $this->fld_name['name'] = 'Название';
     $this->fld_name['num'] = 'Номер';
     $this->fld_name['address'] = 'Адрес';
     $ar = ['city_id' => 'req', 'name' => 'req', 'num' => 'req', 'address' => 'req'];
     $this->validate_ar($ar);
     if (Core::hasError() === true) {
         return;
     }
     $transaction = \yii::$app->db->getTransaction();
     if (!$transaction) {
         $transaction = \Yii::$app->db->beginTransaction();
     }
     try {
         $fld = $params = [];
         $fld['city_id'] = $this->city_id;
         $fld['name'] = $this->name;
         $fld['num'] = $this->num;
         $fld['address'] = $this->address;
         $fld['note'] = $this->note;
         if ($this->id === null) {
             \yii::$app->db->createCommand()->insert('lib_hosp', $fld)->execute();
             $this->id = \yii::$app->db->getLastInsertID('lib_hosp_id_seq');
         } else {
             $params['id'] = $this->id;
             $where = 'id=:id';
             \yii::$app->db->createCommand()->update('lib_hosp', $fld, $where, $params)->execute();
         }
         if (\app\component\Core::hasError() === false) {
             $transaction->commit();
         } else {
             $transaction->rollBack();
         }
     } catch (Exception $e) {
         $transaction->rollBack();
     }
 }
Esempio n. 9
0
File: Mam.php Progetto: kutsanov/med
 public function lst()
 {
     $page = $this->page > 1 ? $this->page : 1;
     $limit = $this->limit > 0 ? $this->limit : \Yii::$app->params['limit'];
     $this->hosp_id = $this->hosp_id > 0 ? $this->hosp_id : null;
     if ($this->fnd != '') {
         $this->fnd = "%{$this->fnd}%";
     } else {
         $this->fnd = null;
     }
     $sql = "Select auth.*, auth_mam.*,\n        lib_hosp.name as hosp_name, lib_city.name as city_name,\n        auth_doctor.name_f || auth_doctor.name_i || auth_doctor.name_o as doctor_name\n        from auth\n        join auth_mam ON auth.id = auth_mam.auth_id\n        left join lib_hosp on auth_mam.hosp_id=lib_hosp.id\n        left JOIN  lib_city on lib_hosp.city_id = lib_city.id\n        left join auth_doctor on auth_doctor.auth_id=auth_mam.doctor_id\n        where auth.active = 't'\n         and (auth_mam.hosp_id=:hosp_id or :hosp_id is null)\n        and\n        (\n          UPPER(auth_mam.email) LIKE UPPER (:fnd)\n          OR UPPER(auth_mam.name_f) LIKE UPPER (:fnd)\n          OR :fnd IS NULL\n        )\n        order by name_f";
     $params = [];
     $params['fnd'] = $this->fnd;
     $params['hosp_id'] = $this->hosp_id;
     $ret = Core::execPage($sql, $params, $page, $limit);
     return $ret;
 }
Esempio n. 10
0
 static function encode($ar = array(), $with_debug = false)
 {
     $error = \yii::$app->params['error'];
     $info = \yii::$app->params['info'];
     $errorFld = \yii::$app->params['errorFld'];
     $debug = \yii::$app->params['debug'];
     if (!isset($ar['success'])) {
         $ar['success'] = true;
     }
     if (count($error) > 0) {
         $ar['error'] = implode('<br />', (array) $error);
         $ar['errorFld'] = $errorFld;
         $ar['success'] = false;
     }
     if (count($info) > 0) {
         $ar['info'] = implode('<br />', (array) $info);
     }
     if ($with_debug === true) {
         $dbStats = Yii::getLogger()->getLogs('profile');
         $ar['debug'] = Core::dump($debug, 10, true, false);
         $ar['debug'] .= '<br /><br />SQL:';
         foreach ($dbStats as $item) {
             $ar['debug'] .= '<br />' . $item[0];
         }
     }
     $js = \yii\helpers\Json::encode($ar);
     return $js;
 }
Esempio n. 11
0
            <div class="col-sm-16">
                <select name="t" id="t" class="form-control">
                    <option value="doctor" selected>Доктор</option>
                    <option value="adm">Администрация</option>
                </select>
            </div>
        </div>

<input type="hidden" id="id" name="id" />

                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-primary" onclick="javascript:$('#formLogin').submit(); return false;">Войти</button>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div><!-- /.modal -->


<br />
<br />
<br />
<br />
<br />
<br />
<?php 
\app\component\Core::dump(Yii::$app->user->id);
\app\component\Core::dump(\Yii::$app->user->can('doctor'));
\app\component\Core::dump(\Yii::$app->user->can('role_doctor_boss'));
Esempio n. 12
0
 public function __construct()
 {
     parent::__construct();
 }
Esempio n. 13
0
    <?php 
$this->head();
?>
</head>
<body>
<?php 
$this->beginBody();
?>

<?php 
if (\app\component\Core::hasError() === true) {
    ?>
<div class="col-xs-12 col-lg-offset-6">
    <div class="alert alert-danger" role="alert">
        <?php 
    echo \app\component\Core::viewError();
    ?>
    </div>
</div>
    <div class="clearfix"></div>
<?php 
}
?>

        <?php 
echo $content;
?>
<div id="alertMessage"></div>
<?php 
$this->endBody();
?>
Esempio n. 14
0
 public function actionDoctorDel()
 {
     $Doctor = new Doctor();
     $Doctor->set_prop_from_arr($_REQUEST);
     $ar['get'] = $Doctor->del();
     Core::encode_echo($ar);
 }
Esempio n. 15
0
File: Adm.php Progetto: kutsanov/med
 public function lst()
 {
     $page = $this->page > 1 ? $this->page : 1;
     $limit = \Yii::$app->params['limit'];
     if ($this->fnd != '') {
         $this->fnd = "%{$this->fnd}%";
     } else {
         $this->fnd = null;
     }
     $sql = "Select auth.*, auth_adm.*\n        from auth\n        join auth_adm ON auth.id = auth_adm.auth_id\n        where auth.active = 't' and\n        (\n          UPPER(auth_adm.email) LIKE UPPER (:fnd)\n          OR UPPER(auth_adm.name_f) LIKE UPPER (:fnd)\n          OR :fnd IS NULL\n        )\n        order by auth_adm.name_f asc";
     $params = [];
     $params['fnd'] = $this->fnd;
     $ret = Core::execPage($sql, $params, $page, $limit);
     return $ret;
 }
Esempio n. 16
0
    <h1><?php 
echo $this->context->action->uniqueId;
?>
</h1>
    <p>
        This is the view content for action "<?php 
echo $this->context->action->id;
?>
".
        The action belongs to the controller "<?php 
echo get_class($this->context);
?>
"
        in the "<?php 
echo $this->context->module->id;
?>
" module.
    </p>
    <p>
        You may customize this page by editing the following file:<br>
        <code><?php 
echo __FILE__;
?>
</code>
    </p>
</div>


<?php 
\app\component\Core::dump(\Yii::$app->user->can('adm_user'));