Пример #1
0
 public function actionEditProcess()
 {
     try {
         $post = StringHelper::filterArrayString($_POST);
         $result = WantedAbroad::model()->edit($_POST);
         if ($result == 1) {
             Yii::app()->user->setFlash('success', 'Cập nhật dữ liệu thành công !');
             $this->redirect(Yii::app()->createUrl('wantedAbroad/edit', array('id' => $post['id'])));
         } else {
             if ($result == 2) {
                 Yii::app()->user->setFlash('error', 'Cập nhật dữ liệu thất bại !');
                 $this->redirect(Yii::app()->createUrl('wantedAbroad/edit', array('id' => $post['id'])));
             } else {
                 Yii::app()->user->setFlash('error', 'Không tồn tại tài liệu !');
                 $this->redirect(Yii::app()->createUrl('wantedAbroad/edit', array('id' => $post['id'])));
             }
         }
     } catch (Exception $ex) {
         var_dump($ex->getMessage());
     }
 }
Пример #2
0
 public function actionPrintArea()
 {
     $documentary = Documentary::model()->searchByCondition($_GET, null, 2);
     $wanted_abroad = WantedAbroad::model()->searchByCondition($_GET, null, 2);
     $letters = Letters::model()->searchByCondition($_GET, null, 2);
     $cases = Cases::model()->searchByCondition($_GET, null, 2);
     $cases_abroad = CasesAbroadOther::model()->searchByCondition($_GET, null, 2);
     $opinion = Opinion::model()->searchByCondition($_GET, null, 2);
     $documentary_recieve = DocumentaryRecieve::model()->searchByCondition($_GET, null, 2);
     $documentary_abroad = DocumentaryAbroad::model()->searchByCondition($_GET, null, 2);
     $guide = Guide::model()->searchByCondition($_GET, null, 2);
     $result = array('documentary' => $documentary, 'wanted_abroad' => $wanted_abroad, 'letters' => $letters, 'cases' => $cases, 'cases_abroad' => $cases_abroad, 'opinion' => $opinion, 'documentary_recieve' => $documentary_recieve, 'documentary_abroad' => $documentary_abroad, 'guide' => $guide);
     $this->render('printArea', $result);
 }
Пример #3
0
 public function searchByCondition($attr, $cnt = null, $pagination = 1)
 {
     $criteria = new CDbCriteria();
     if (!empty($attr['date_start']) && !empty($attr['date_end'])) {
         $date_start = strtotime($attr['date_start']);
         $date_end = strtotime($attr['date_end']);
         $criteria->addBetweenCondition('date_publish', $date_start, $date_end);
     }
     if (!empty($attr['obj_name'])) {
         $obj_name = $attr['obj_name'];
         $criteria->addSearchCondition('object_name', $obj_name);
     }
     if (!empty($attr['nation'])) {
         $nation = $attr['nation'];
         $criteria->addSearchCondition('nation_request', $nation);
     }
     if (!empty($attr['assignee'])) {
         $assignee = $attr['assignee'];
         $criteria->addSearchCondition('staff_assigned', $assignee);
     }
     if (!empty($attr['keyword'])) {
         $keyword = $attr['keyword'];
         $criteria->addSearchCondition('nation_request', $keyword, true, "OR", "LIKE");
         $criteria->addSearchCondition('object_name', $keyword, true, "OR", "LIKE");
         $criteria->addSearchCondition('wanted_number', $keyword, true, "OR", "LIKE");
         $criteria->addSearchCondition('crime', $keyword, true, "OR", "LIKE");
         $criteria->addSearchCondition('staff_assigned', $keyword, true, "OR", "LIKE");
     }
     $count = WantedAbroad::model()->count($criteria);
     if (!empty($cnt)) {
         return $count;
     }
     if ($pagination != 1) {
         $result = WantedAbroad::model()->findAll($criteria);
         return $result;
     }
     $pages = new CPagination($count);
     // results per page
     $pages->pageSize = Yii::app()->params['limit'];
     $pages->applyLimit($criteria);
     $result = WantedAbroad::model()->findAll($criteria);
     return array('models' => $result, 'pages' => $pages);
 }