コード例 #1
0
 public function actionResetBally()
 {
     \Yii::$app->response->format = Response::FORMAT_JSON;
     $response = new JsResponse();
     $listId = \Yii::$app->request->post('id');
     $transaction = \Yii::$app->db->beginTransaction();
     try {
         $list = OtsenochnyjListZayavleniya::findOne($listId);
         $list->status = StatusOtsenochnogoLista::REDAKTITUETSYA;
         $list->save();
         StrukturaOtsenochnogoListaZayvaleniya::updateAll(['bally' => null], ['otsenochnyj_list_zayavleniya' => $listId]);
         $transaction->commit();
     } catch (Exception $e) {
         $transaction->rollBack();
         $response->type = JsResponse::ERROR;
         $response->msg = 'Произошла ошибка при выполнении запроса к базе данных! ' . $e->getMessage();
     }
     return $response;
 }
コード例 #2
0
ファイル: ListController.php プロジェクト: agarb7/mybriop
 public function actionOtsenochnyjList()
 {
     $request = \Yii::$app->request;
     $type = $request->get('type', '');
     $id = $request->get('id', 0);
     $zid = $request->get('zid', 0);
     $zayavlenie = ZayavlenieNaAttestaciyu::findOne($zid);
     $query = OtsenochnyjListZayavleniya::find()->joinWith('strukturaOtsenochnogoListaZayvaleniyaRel')->joinWith('rabotnikKomissiiFizLicoRel')->orderBy('fiz_lico.familiya, fiz_lico.imya, fiz_lico.otchestvo')->where(['otsenochnyj_list_zayavleniya.zayavlenie_na_attestaciyu' => $zid]);
     $ispytanie = [];
     if ($type == 'postoyannoe') {
         $query = $query->andWhere(['otsenochnyj_list_zayavleniya.postoyannoe_ispytanie' => $id]);
         $ispytanie = PostoyannoeIspytanie::findOne($id);
     } elseif ($type == 'variativnoe') {
         $query = $query->andWhere(['otsenochnyj_list_zayavleniya.var_ispytanie_3' => $id]);
         $ispytanie = AttestacionnoeVariativnoeIspytanie_3::findOne($id);
     }
     $data = $query->all();
     $content = $this->renderPartial('otsenochnyj-list', compact('data', 'zayavlenie', 'ispytanie'));
     $pdf = new Pdf($this->getPdfSeetings($content));
     // return the pdf output as per the destination setting
     return $pdf->render();
 }
コード例 #3
0
 public function actionSaveOtsenki()
 {
     \Yii::$app->response->format = Response::FORMAT_JSON;
     $response = new JsResponse();
     $list = \Yii::$app->request->post('list');
     $transaction = \Yii::$app->db->beginTransaction();
     try {
         foreach ($list['struktura'] as $item) {
             $struktura = StrukturaOtsenochnogoListaZayvaleniya::findOne($item['id']);
             $struktura->bally = $item['bally'];
             $struktura->save();
         }
         $list = OtsenochnyjListZayavleniya::findOne($list['id']);
         $list->status = StatusOtsenochnogoLista::ZAPOLNENO;
         $list->save();
         $transaction->commit();
         $response->data = StatusOtsenochnogoLista::ZAPOLNENO;
     } catch (Exception $e) {
         $transaction->rollBack();
         $response->type = JsResponse::ERROR;
         $response->msg = 'Данные не сохранены';
     }
     return $response;
 }
コード例 #4
0
 public function getOtsenochnyjListZayvleniyaRel()
 {
     return $this->hasOne(OtsenochnyjListZayavleniya::className(), ['id' => 'otsenochnyj_list_zayavleniya'])->inverseOf('strukturaOtsenochnogoListaZayvaleniyaRel');
 }
コード例 #5
0
 public function getOtsenochnyjListZayvleniyaRel()
 {
     return $this->hasMany(OtsenochnyjListZayavleniya::className(), ['zayavlenie_na_attestaciyu' => 'id'])->inverseOf('zayavlenieNaAttestaciyuRel');
 }