当前位置: 首页>>代码示例>>PHP>>正文


PHP Session::setFlash方法代码示例

本文整理汇总了PHP中yii\web\Session::setFlash方法的典型用法代码示例。如果您正苦于以下问题:PHP Session::setFlash方法的具体用法?PHP Session::setFlash怎么用?PHP Session::setFlash使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在yii\web\Session的用法示例。


在下文中一共展示了Session::setFlash方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: actionCompany

 public function actionCompany()
 {
     $company = Company::find()->one();
     if (empty($company)) {
         $company = new Company();
         $company->vat = 0;
         $company->logo = '';
     }
     $post = Yii::$app->request->post();
     if (!empty($post)) {
         if (!empty($_FILES['Company']['name']['logo'])) {
             $tmp_name = $_FILES['Company']['tmp_name']['logo'];
             $name = $_FILES['Company']['name']['logo'];
             if (file_exists('upload/' . $name)) {
                 unlink('upload' . $name);
             }
             if (move_uploaded_file($tmp_name, 'upload/' . $name)) {
                 $company->logo = $name;
             }
         }
         $company->name = $post['Company']['name'];
         $company->tax_code = $post['Company']['tax_code'];
         $company->tel = $post['Company']['tel'];
         $company->website = $post['Company']['website'];
         $company->address = $post['Company']['address'];
         $company->vat = $post['Company']['vat'];
         if ($company->save()) {
             $session = new Session();
             $session->setFlash('message', 'บันทึกรายการแล้ว');
             return $this->redirect(['company']);
         }
     }
     return $this->render('//config/company', ['company' => $company]);
 }
开发者ID:kaniou,项目名称:yii2pos,代码行数:34,代码来源:ConfigController.php

示例2: actionDelete

 public function actionDelete($id)
 {
     Category::findOne($id)->delete();
     $session = new Session();
     $session->open();
     $session->setFlash('message', 'Deleted.');
     return $this->redirect(['index']);
 }
开发者ID:pichai2514,项目名称:gov_book2016,代码行数:8,代码来源:CategoryController.php

示例3: actionCreate

 /**
  * Creates a new Saleorderinvoice model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $searchModel = \backend\models\Saleorderinvoiceline::find()->where(['invid' => 0]);
     $model = new Saleorderinvoice();
     if ($model->load(Yii::$app->request->post())) {
         $chkcount = Saleorderinvoice::find()->where(['invoiceno' => $_POST['Saleorderinvoice']['invoiceno']])->count();
         if ($chkcount > 0) {
             //                print_r($model->errors);
             //                echo 'Not save';
             $session = new Session();
             $session->open();
             $session->setFlash('modelerror', 'เลขที่ Invoice ซ้ำ');
             return $this->render('create', ['model' => $model, 'saleline' => $searchModel, 'rowcount' => 0, 'saleincluded' => null, 'saleincludedcount' => 0]);
         }
         $saledate = $_POST['Saleorderinvoice']['invoicedate'];
         $model->invoicedate = date('d/M/Y H:i:s', strtotime($saledate));
         // $model->createby =$session['username'];
         if ($model->save()) {
             $uploaded = UploadedFile::getInstance($model, 'upfile');
             $result = 0;
             if (!empty($uploaded)) {
                 $upfiles = time() . "." . $uploaded->getExtension();
                 $uploaded->saveAs('../../uploads/' . $upfiles);
                 $handle = fopen('../../uploads/' . $upfiles, 'r');
                 $n = 0;
                 while (($fileop = fgetcsv($handle, 1000, ",")) !== false) {
                     if ($n < 1) {
                         $n++;
                         continue;
                     }
                     $model2 = new \backend\models\Saleorderinvoiceline();
                     $model2->invid = $model->recid;
                     $model2->invline = $fileop[0];
                     $model2->partno = $fileop[1];
                     $model2->description = iconv("TIS-620", "UTF-8", $fileop[2]);
                     $model2->quantity = $fileop[3];
                     $model2->unitprice = $fileop[4];
                     $model2->totalamount = $fileop[5];
                     $model2->unit = 1;
                     if ($model2->save()) {
                         $result++;
                     }
                 }
                 fclose($handle);
                 if ($result > 0) {
                     $session = new \yii\web\Session();
                     $session->open();
                     $session->setFlash('msgsuccess', 'บันทึกรายการเรียบร้อย');
                     return $this->redirect(['update', 'id' => $model->recid]);
                 }
             }
         } else {
         }
     }
     return $this->render('create', ['model' => $model, 'saleline' => $searchModel, 'rowcount' => 0, 'saleincluded' => null, 'saleincludedcount' => 0]);
 }
开发者ID:nirantarnoy,项目名称:ST,代码行数:61,代码来源:SaleorderinvoiceController.php

示例4: actionDelete

 public function actionDelete($id)
 {
     $productImage = BookImage::findOne($id);
     $product = $productImage->book;
     $image_url = $productImage->url;
     if ($productImage->delete()) {
         $session = new Session();
         $session->open();
         $session->setFlash('message', 'Data Deleted.');
         unlink('../uploads/' . $image_url);
         return $this->redirect(['index', 'book_id' => $product->id]);
     }
 }
开发者ID:pichai2514,项目名称:gov_book2016,代码行数:13,代码来源:BookImageController.php

示例5: actionShowjob

 public function actionShowjob($type)
 {
     $session = new Session();
     $session->open();
     if ($type == 1) {
         $session->setFlash('msg', "แจ้งปัญหาข้อมูลและโปรแกรมคอมพิวเตอร์");
     }
     if ($type == 2) {
         $session->setFlash('msg', "ร้องขอผู้ใช้งาน");
     }
     if ($type == 3) {
         $session->setFlash('msg', "ร้องขอรายงาน");
     }
     if ($type == 4) {
         $session->setFlash('msg', "ร้องขออุปกรณ์คอมพิวเตอร์");
     }
     if ($type == 5) {
         $session->setFlash('msg', "แจ้งปัญหากล้องวงจรปิด");
     }
     if ($type == 6) {
         $session->setFlash('msg', "แจ้งปัญหาโทรศัพท์");
     }
     if ($type == 7) {
         $session->setFlash('msg', "ร้องขอกู้ข้อมูล");
     }
     $searchModel = new AdashboardSearch();
     $dataProvider = $searchModel->search($type);
     $dataProvider->pagination->pageSize = 10;
     //
     //        return $this->render('index', [
     //            'searchModel' => $searchModel,
     //            'dataProvider' => $dataProvider,
     //        ]);
     $session = new Session();
     $session->open();
     $countJob = Adashboard::find()->count();
     $countProgramActive = Adashboard::find()->where(['jobstatus' => 1, 'jobtype' => 1])->count();
     $countUserActive = Adashboard::find()->where(['jobstatus' => 1, 'jobtype' => 2])->count();
     $countReportActive = Adashboard::find()->where(['jobstatus' => 1, 'jobtype' => 3])->count();
     $countDeviceActive = Adashboard::find()->where(['jobstatus' => 1, 'jobtype' => 4])->count();
     $countCameraActive = Adashboard::find()->where(['jobstatus' => 1, 'jobtype' => 5])->count();
     $countPhoneActive = Adashboard::find()->where(['jobstatus' => 1, 'jobtype' => 6])->count();
     $countRestoreActive = Adashboard::find()->where(['jobstatus' => 1, 'jobtype' => 7])->count();
     $totalCount = Adashboard::find()->count();
     $pages = new Pagination(['totalCount' => $totalCount, 'pageSize' => 10]);
     $model = Adashboard::find()->offset($pages->offset)->limit($pages->limit)->all();
     return $this->render('index', ['model' => $model, 'searchModel' => $searchModel, 'dataProvider' => $dataProvider, 'programactive' => $countProgramActive, 'useractive' => $countUserActive, 'reportactive' => $countReportActive, 'deviceactive' => $countDeviceActive, 'cameraactive' => $countCameraActive, 'phoneactive' => $countPhoneActive, 'restoreactive' => $countRestoreActive, 'alljob' => $countJob, 'pages' => $pages]);
 }
开发者ID:nirantarnoy,项目名称:paperless,代码行数:48,代码来源:AdashboardController.php

示例6: actionLogin

 public function actionLogin()
 {
     $Tb_Users = new Tb_Users();
     $post = Yii::$app->request->post();
     $session = new Session();
     if (!empty($post)) {
         $user = Tb_Users::find()->where(['usr' => $post['Tb_Users']['usr'], 'pwd' => $post['Tb_Users']['pwd']])->one();
         if (!empty($user)) {
             $session['usr'] = $user->usr;
             $session['active_menu'] = "";
             return $this->redirect('index.php?r=site/index');
         } else {
             $session->setFlash('message', 'Username หรือ Password ไม่ถูกต้อง');
         }
     }
     $login_read = new Tb_Users();
     return $this->render('//site/login', ['login' => $login_read]);
 }
开发者ID:riskiidice,项目名称:Yii2project,代码行数:18,代码来源:UserController.php

示例7: actionIndex

 public function actionIndex()
 {
     $company = Company::find()->orderBy('id')->one();
     if (!empty($_POST)) {
         if (!empty($_FILES['Company'])) {
             // remove old logo
             if (!empty($company->logo)) {
                 $old_img = $company->logo;
                 unlink('../uploads/' . $old_img);
             }
             // upload new logo
             $img = $_FILES['Company']['name']['logo'];
             $ext = end(explode(".", $img));
             $name = microtime();
             $name = str_replace(' ', '', $name);
             $name = str_replace('.', '', $name);
             $name = $name . '.' . $ext;
             $tmp = $_FILES['Company']['tmp_name']['logo'];
             $company->logo = $name;
             move_uploaded_file($tmp, '../uploads/' . $name);
         }
         $company->name = $_POST['Company']['name'];
         $company->web_title = $_POST['Company']['web_title'];
         $company->tel = $_POST['Company']['tel'];
         $company->email = $_POST['Company']['email'];
         $company->fax = $_POST['Company']['fax'];
         $company->website = $_POST['Company']['website'];
         $company->facebook = $_POST['Company']['facebook'];
         $company->line_id = $_POST['Company']['line_id'];
         $company->address = $_POST['Company']['address'];
         $company->tax_code = $_POST['Company']['tax_code'];
         $company->payment = $_POST['Company']['payment'];
         $company->about = $_POST['Company']['about'];
         if ($company->save()) {
             $session = new Session();
             $session->open();
             $session->setFlash('message', 'Data Saved.');
             return $this->redirect(['index']);
         }
     }
     return $this->render('//Company/Index', ['company' => $company]);
 }
开发者ID:pichai2514,项目名称:gov_book2016,代码行数:42,代码来源:CompanyController.php

示例8: actionSignin

 public function actionSignin()
 {
     if (!empty($_POST)) {
         $count = \common\models\Dbusers::find()->where(['username' => $_POST['Mylogin']['username'], 'password' => $_POST['Mylogin']['password']])->count();
         $query = \common\models\Dbusers::find()->where(['username' => $_POST['Mylogin']['username'], 'password' => $_POST['Mylogin']['password']])->one();
         if ($count <= 0) {
             $this->layout = 'mylayout';
             $userlogin = new \backend\models\Mylogin();
             $session = new Session();
             $session->open();
             $session->setFlash('msg', 'Username or password incorect');
             return $this->render('index', ['model' => $userlogin]);
         } else {
             $userlogin = new \backend\models\Mylogin();
             $session = new Session();
             $session->open();
             $session['userid'] = $query->recid;
             $session['username'] = $query->fname;
             return $this->redirect(['/saleorder/index']);
         }
     }
 }
开发者ID:nirantarnoy,项目名称:ST,代码行数:22,代码来源:LoginController.php

示例9: actionForgot

 /**
  * [actionForgot description]
  * @return [type] [description]
  */
 public function actionForgot()
 {
     $model = new ForgotForm();
     $session = new Session();
     if ($model->load(Yii::$app->request->post()) && $model->validate()) {
         $getEmail = $model->email;
         $getIdentity = User::find()->where(['email' => $getEmail])->one();
         $getToken = rand(0, 99999);
         $getTime = date("H:i:s");
         $calcToken = md5($getToken . $getTime);
         $getIdentity->token = $calcToken;
         $getEmail = "kevinaud@gmail.com";
         $emailAdmin = "kaud@Jobocracy.org";
         $senderName = "Jobocracy";
         $senderName = '=?UTF-8?B?' . base64_encode($senderName) . '?=';
         $subject = "Reset Password";
         $subject = '=?UTF-8?B?' . base64_encode($subject) . '?=';
         $message = 'You have successfully reset your password<br>
                    <a href="localhost/application/basic/web/index.php?r=site/ver-token&token=' . $calcToken . '">Click Here to Reset Your Password</a>';
         $headers = "From: {$senderName} <{$emailAdmin}>\r\n" . "Reply To: {$emailAdmin}\r\n" . "MIME-Version: 1.0\r\n" . "Content-type: text/html; charset=UTF-8";
         $getIdentity->save();
         $session->setFlash('forgot', 'A link to reset your password
             has been sent to your email address.');
         mail($getEmail, $subject, $message, $headers);
         return $this->render('forgot', ['session' => $session]);
     }
     return $this->render('forgot', ['model' => $model, 'session' => $session]);
 }
开发者ID:kevinaud,项目名称:Jobocracy,代码行数:32,代码来源:SiteController.php

示例10: actionProfile

 public function actionProfile()
 {
     $session = new Session();
     $session->open();
     $id = $session->get('member_id');
     $member = Member::findOne($id);
     if (!empty($_POST)) {
         $member->name = $_POST['Member']['name'];
         $member->username = $_POST['Member']['username'];
         $member->password = $_POST['Member']['password'];
         if ($member->save()) {
             $session->setFlash('message', 'Update member info success.');
             return $this->redirect(['profile']);
         }
     }
     return $this->render('//Frontend/Profile', ['member' => $member]);
 }
开发者ID:pichai2514,项目名称:gov_book2016,代码行数:17,代码来源:FrontendController.php

示例11: actionUpdate

 public function actionUpdate($id)
 {
     $session = new Session();
     $session->open();
     $totalCount = Saleorderline::find()->where(['saleid' => $id])->count();
     $pages = new Pagination(['totalCount' => $totalCount, 'pageSize' => 20]);
     $searchModel = Saleorderline::find()->where(['saleid' => $id])->orderBy('recid')->offset($pages->offset)->limit($pages->limit)->all();
     $model = $this->findModel($id);
     if ($model->load(Yii::$app->request->post())) {
         $saledate = $_POST['Saleorder']['saledate'];
         $shipdate = $_POST['Saleorder']['shipdate'];
         $model->saledate = date('d/M/Y H:i:s', strtotime($saledate));
         $model->shipdate = date('d/M/Y H:i:s', strtotime($shipdate));
         //         $model->shipfrom = $_POST['Saleorder']['shipfrom'];
         $model->shipto = isset($session['shipto']) ? $session['shipto'] : '';
         $model->saleman = isset($session['salecode']) ? $session['salecode'] : NULL;
         $model->createby = $session['userid'];
         if ($model->save()) {
             $uploaded = UploadedFile::getInstance($model, 'upfile');
             $result = 0;
             if (!empty($uploaded)) {
                 //                    print_r($uploaded);
                 //                    return;
                 $deldetail = Saleorderline::deleteAll('saleid = :saleid', [':saleid' => $id]);
                 $upfiles = time() . "." . $uploaded->getExtension();
                 $uploaded->saveAs('../../uploads/' . $upfiles);
                 //                    // $uploaded->saveAs();
                 //                  //  move_uploaded_file($uploaded, '../../uploads/' . $upfiles);
                 //
                 $handle = fopen('../../uploads/' . $upfiles, 'r');
                 //                  $handle = fopen($uploaded, 'r');
                 $n = 0;
                 setlocale(LC_ALL, 'en_US.UTF-8');
                 while (($fileop = fgetcsv($handle, 1000, ",")) !== false) {
                     if ($n < 1) {
                         $n++;
                         continue;
                     }
                     $model2 = new \backend\models\Saleorderline();
                     $model2->saleid = $model->recid;
                     $model2->saleline = $fileop[0];
                     $model2->partno = $fileop[1];
                     $model2->custorderno = iconv("TIS-620", "UTF-8", $fileop[2]);
                     $model2->customername = iconv("TIS-620", "UTF-8", $fileop[3]);
                     $model2->quantity = $fileop[4];
                     $model2->unitprice = $fileop[5];
                     $model2->totalamount = $fileop[6];
                     $model2->unit = 1;
                     //                         $model2->partno=$fileop[7];
                     //  echo $name."<BR />";
                     // $age = $fileop[1];
                     //$location = $fileop[2];
                     //print_r($fileop);exit();
                     //                        $sql = "INSERT INTO details(name, age, location) VALUES ('$name', '$age', '$location')";
                     //                        $query = Yii::$app->db->createCommand($sql)->execute();
                     if ($model2->save()) {
                         $result++;
                     }
                 }
                 fclose($handle);
                 unlink('../../uploads/' . $upfiles);
                 if ($result > 0) {
                     $session = new \yii\web\Session();
                     $session->open();
                     $session->setFlash('msgsuccess', 'บันทึกรายการเรียบร้อย');
                     return $this->redirect(['update', 'id' => $model->recid]);
                 }
             }
         }
     } else {
         return $this->render('update', ['model' => $model, 'saleline' => $searchModel, 'pages' => $pages, 'rowcount' => $totalCount]);
     }
     return $this->render('update', ['model' => $model, 'saleline' => $searchModel, 'pages' => $pages, 'rowcount' => $totalCount]);
 }
开发者ID:nirantarnoy,项目名称:st2,代码行数:74,代码来源:SaleorderController.php

示例12: actionUpdate

 public function actionUpdate($id)
 {
     $totalCount = \backend\models\Saleorderinvoiceline::find()->where(['invid' => $id])->count();
     $saleincluded = \backend\models\Invoicerefsale::find()->where(['invid' => $id])->all();
     $saleincludedcount = \backend\models\Invoicerefsale::find()->where(['invid' => $id])->count();
     $pages = new Pagination(['totalCount' => $totalCount, 'pageSize' => 20]);
     $searchModel = \backend\models\Saleorderinvoiceline::find()->where(['invid' => $id])->orderBy('recid')->offset($pages->offset)->limit($pages->limit)->all();
     $model = $this->findModel($id);
     if ($model->load(Yii::$app->request->post())) {
         $saledate = $_POST['Saleorderinvoice']['invoicedate'];
         $model->invoicedate = date('d/M/Y H:i:s', strtotime($saledate));
         if ($model->save()) {
             $uploaded = UploadedFile::getInstance($model, 'upfile');
             $result = 0;
             if (!empty($uploaded)) {
                 $upfiles = time() . "." . $uploaded->getExtension();
                 $uploaded->saveAs('../../uploads/' . $upfiles);
                 $handle = fopen('../../uploads/' . $upfiles, 'r');
                 $n = 0;
                 while (($fileop = fgetcsv($handle, 1000, ",")) !== false) {
                     if ($n < 1) {
                         $n++;
                         continue;
                     }
                     $model2 = new \backend\models\Saleorderinvoiceline();
                     $model2->invid = $model->recid;
                     $model2->invline = $fileop[0];
                     $model2->partno = $fileop[1];
                     $model2->description = $fileop[2];
                     $model2->quantity = $fileop[3];
                     $model2->unitprice = $fileop[4];
                     $model2->totalamount = $fileop[5];
                     $model2->unit = 1;
                     if ($model2->save()) {
                         $result++;
                     }
                 }
                 fclose($handle);
                 if ($result > 0) {
                     $session = new \yii\web\Session();
                     $session->open();
                     $session->setFlash('msgsuccess', 'บันทึกรายการเรียบร้อย');
                     return $this->redirect(['update', 'id' => $model->recid]);
                 }
             }
         } else {
         }
     } else {
         return $this->render('update', ['model' => $model, 'saleline' => $searchModel, 'pages' => $pages, 'rowcount' => $totalCount, 'saleincluded' => $saleincluded, 'saleincludedcount' => $saleincludedcount]);
     }
     return $this->render('update', ['model' => $model, 'saleline' => $searchModel, 'pages' => $pages, 'rowcount' => $totalCount, 'saleincluded' => $saleincluded, 'saleincludedcount' => $saleincludedcount]);
 }
开发者ID:nirantarnoy,项目名称:ST,代码行数:52,代码来源:SaleorderinvoiceController.php

示例13: actionCreate

 public function actionCreate()
 {
     $session = new Session();
     $session->open();
     //        Yii::$app->params['uploadPath'] = realpath(Yii::$app->basePath) . '\\uploads\\';
     $searchModel = Saleorderline::find()->where(['saleid' => 0]);
     $model = new Saleorder();
     if ($model->load(Yii::$app->request->post())) {
         $chkcount = Saleorder::find()->where(['saleno' => $_POST['Saleorder']['saleno']])->count();
         if ($chkcount > 0) {
             //                print_r($model->errors);
             //                echo 'Not save';
             $session = new Session();
             $session->open();
             $session->setFlash('modelerror', 'เลขที่ SO ซ้ำ');
             return $this->render('create', ['model' => $model, 'saleline' => $searchModel, 'rowcount' => 0]);
         }
         $saledate = $_POST['Saleorder']['saledate'];
         $shipdate = $_POST['Saleorder']['shipdate'];
         $model->saledate = date('d/M/Y H:i:s', strtotime($saledate));
         $model->shipdate = date('d/M/Y H:i:s', strtotime($shipdate));
         //            $model->shipfrom = $_POST['Saleorder']['shipfrom'];
         $model->shipto = isset($session['shipto']) ? $session['shipto'] : '';
         $model->saleman = isset($session['salecode']) ? $session['salecode'] : NULL;
         $model->createby = $session['userid'];
         // $model->saleman = $_POST['saleman'];
         //echo $session['salecode'];
         // return;
         if ($model->save()) {
             $uploaded = UploadedFile::getInstance($model, 'upfile');
             $result = 0;
             if (!empty($uploaded)) {
                 $upfiles = time() . "." . $uploaded->getExtension();
                 if ($uploaded->saveAs('../../uploads/' . $upfiles)) {
                     $handle = fopen('../../uploads/' . $upfiles, 'r');
                 }
                 //            $uploaded->saveAs(Yii::$app->params['uploadPath'].$upfiles);
                 //
                 //                $handle = fopen(Yii::$app->params['uploadPath'].$upfiles, 'r');
                 $n = 0;
                 $nonepartcount = 0;
                 setlocale(LC_ALL, 'en_US.UTF-8');
                 while (($fileop = fgetcsv($handle, 1000, ",")) !== false) {
                     if ($n < 1) {
                         $n++;
                         continue;
                     }
                     if ($this->Validpart($fileop[1]) <= 0) {
                         $nonepartcount += 1;
                         $nonepart = new \backend\models\Nonepartnumber();
                         $nonepart->partno = $fileop[1];
                         $nonepart->description = iconv("TIS-620", "UTF-8", $fileop[2]);
                         $nonepart->salerefid = $model->recid;
                         $nonepart->createdate = date('Y-m-d H:i:s');
                         $nonepart->save();
                         //                            $nonepart->partno = '12';
                         //                            $nonepart->description = 'xxxx';
                         //                            $nonepart->salerefid = $model->recid;
                         //                            $nonepart->createdate = date('Y-m-d H:i:s');
                         //                            $nonepart->save();
                     }
                     $model2 = new \backend\models\Saleorderline();
                     $model2->saleid = $model->recid;
                     $model2->saleline = $fileop[0];
                     $model2->partno = $fileop[1];
                     $model2->custorderno = iconv("TIS-620", "UTF-8", $fileop[2]);
                     $model2->customername = iconv("TIS-620", "UTF-8", $fileop[3]);
                     $model2->quantity = $fileop[4];
                     $model2->unitprice = $fileop[5];
                     $model2->totalamount = $fileop[6];
                     $model2->unit = 1;
                     //                         $model2->partno=$fileop[7];
                     //  echo $name."<BR />";
                     // $age = $fileop[1];
                     //$location = $fileop[2];
                     //print_r($fileop);exit();
                     //                        $sql = "INSERT INTO details(name, age, location) VALUES ('$name', '$age', '$location')";
                     //                        $query = Yii::$app->db->createCommand($sql)->execute();
                     //                      iconv("TIS-620", "UTF-8", $fileop[2]);
                     //   return;
                     if ($model2->save()) {
                         $result++;
                     }
                 }
                 if ($nonepartcount > 0) {
                     $result = 0;
                     Saleorderline::deleteAll(['saleid' => $model->recid]);
                     //Saleorder::deleteAll(['recid'=>$model->recid]);
                     //  echo "OKKK";
                     //  return;
                 }
                 fclose($handle);
                 unlink('../../uploads/' . $upfiles);
                 if ($result > 0) {
                     $session = new \yii\web\Session();
                     $session->open();
                     $session->setFlash('msgsuccess', 'บันทึกรายการเรียบร้อย');
                     return $this->redirect(['update', 'id' => $model->recid]);
                 } else {
                     $session = new \yii\web\Session();
//.........这里部分代码省略.........
开发者ID:nirantarnoy,项目名称:st2,代码行数:101,代码来源:SaleorderController.php

示例14: actionMultidelete

 public function actionMultidelete()
 {
     if (\yii::$app->request->isAjax) {
         $pk = \yii::$app->request->post('pk');
         foreach ($pk as $data) {
             $this->findModel($data)->delete();
         }
     }
     $session = new Session();
     $session->open();
     $session->setFlash('msg', 'ทำรายการเรียบร้อย');
     return $this->redirect(['index']);
 }
开发者ID:nirantarnoy,项目名称:Tapp_Final,代码行数:13,代码来源:Car4Controller.php

示例15: actionApproveprocess

 public function actionApproveprocess()
 {
     $session = new Session();
     $session->open();
     if (\Yii::$app->request->post()) {
         $count = User::find()->where(['username' => $_POST['Jobapprove']['username']])->count();
         $uid = User::find()->where(['username' => $_POST['Jobapprove']['username']])->all();
         $isuser = User::findOne(['username' => $_POST['Jobapprove']['username']]);
         $ispwd = $isuser->validatePassword($_POST['Jobapprove']['password']);
         if ($count <= 0 || $ispwd == false) {
             $session = new Session();
             $session->open();
             $session->setFlash('msg', 'คุณไม่มีสิทธิอนุมัติใบสั่งงานนี้');
             $model = new Jobapprove();
             $pagename = "reqdevice";
             //  return $this->render('approvefail');
             return $this->render('index', ['model' => $model]);
         }
         foreach ($uid as $value) {
             $roleid = $value->roleid;
         }
         $depid = \backend\Models\Assignroledetail::findAll(['roleid' => $roleid]);
         $approve = false;
         $res = 0;
         foreach ($depid as $did) {
             foreach ($session['recid'] as $idd) {
                 $model2 = Jobs::findOne($idd);
                 $userdep = User::findOne(['id' => $model2->requestby]);
                 if ($userdep->departmentid == $did->departmentid) {
                     $model2->jobstatus = 2;
                     if ($model2->save()) {
                         $res = 1;
                     }
                 }
             }
         }
         if ($res == 1) {
             $session = new Session();
             $session->open();
             $session->setFlash('msg', 'อนุมัติใบสั่งงานเรียบร้อย');
             unset($session['recid']);
             if ($session['module'] == 'device') {
                 unset($session['module']);
                 unset($session['department']);
                 return $this->redirect(['reqdevice/index']);
             } else {
                 if ($session['module'] == 'report') {
                     unset($session['module']);
                     unset($session['department']);
                     return $this->redirect(['reqreport/index']);
                 } else {
                     if ($session['module'] == 'user') {
                         unset($session['module']);
                         unset($session['department']);
                         return $this->redirect(['requser/index']);
                     }
                 }
             }
         } else {
             $session = new Session();
             $session->open();
             $session->setFlash('msg', 'คุณไม่มีสิทธิอนุมัติใบสั่งงานนี้');
             $model = new Jobapprove();
             $pagename = "reqdevice";
             //    return $this->render('approvefail');
             return $this->render('index', ['model' => $model]);
         }
         // echo var_dump($ispwd);return;
     }
     //        else {
     //            $session = new Session();
     //            $session->open();
     //            $session->setFlash('msg', 'คุณไม่มีสิทธิอนุมัติใบสั่งงานนี้');
     //            $model = new Jobapprove();
     //            $pagename = "reqdevice";
     //            //    return $this->render('approvefail');
     //            return $this->render('index', ['model' => $model]);
     //        }
 }
开发者ID:nirantarnoy,项目名称:paperless,代码行数:79,代码来源:JobapproveController.php


注:本文中的yii\web\Session::setFlash方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。