public function actionSetwindowguid() { $guid = (string) filter_input(INPUT_POST, 'guid'); $pathname = (string) filter_input(INPUT_POST, 'path'); $search = (string) filter_input(INPUT_POST, 'search'); $session = new Session(); $session->open(); $res = isset($session['WindowsGUIDs']) ? $session['WindowsGUIDs'] : []; $currentguid = $session['WindowsGUIDCurrent']; $gohome = false; $homeurls = ["", "?r=site%2Findex", "?r=site%2Flogin", "?r=site%2Flogout", "?r=site%2Ferror"]; $ishome = in_array($search, $homeurls); if (empty($guid)) { // Если новая вкладка for ($i = 0; $i < 6; $i++) { $guid .= dechex(rand(0, 15)); } $res[$guid] = 1; $session['WindowsGUIDs'] = $res; $session['WindowsGUIDCurrent'] = $guid; $gohome = !$ishome; } else { // Если существующая вкладка if ($session['WindowsGUIDCurrent'] === $guid) { // Если текущая вкладка } else { // Если другая существующая вкладка $session['WindowsGUIDCurrent'] = $guid; $gohome = !$ishome; } $session['WindowsGUIDs'] = $res; } $session->close(); echo json_encode((object) ['guid' => $guid, 'gohome' => $gohome]); }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Reqdevice::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } // $query->andFilterWhere([ // 'recid' => $this->recid, // 'jobtype' => $this->jobtype, // 'jobaction' => $this->jobaction, // 'jobdate' => $this->jobdate, // 'aproveddate' => $this->aproveddate, // 'requestby' => $this->requestby, // 'approvedby' => $this->approvedby, // 'jobstatus' => $this->jobstatus, // 'startdate' => $this->startdate, // 'enddate' => $this->enddate, // 'operateby' => $this->operateby, // ]); $session = new Session(); $session->open(); if ($session['groupid'] != 1) { $query->orFilterWhere(['like', 'jobtitle', $this->globalSearch])->orFilterWhere(['like', 'comment', $this->globalSearch])->andFilterWhere(['=', 'jobtype', 4])->andFilterWhere(['=', 'requestby', $session['userid']]); } else { $query->orFilterWhere(['like', 'jobtitle', $this->globalSearch])->orFilterWhere(['like', 'comment', $this->globalSearch])->andFilterWhere(['=', 'jobtype', 4]); } return $dataProvider; }
private function redirect($tud) { $session = new Session(); $session->open(); $session['tud'] = $tud; return \Yii::$app->response->redirect(Url::to(['/authentication/response'])); }
/** * Updates an existing Books model. * If update is successful, the browser will be redirected to the 'view' page. * @param integer $id * @return mixed */ public function actionUpdate($id) { $model = $this->findModel($id); $session = new Session(); $session->open(); $oldFile = $model->preview; if ($model->load(Yii::$app->request->post()) && $model->validate()) { $file = UploadedFile::getInstance($model, 'image'); $model->image = $file; // Если изображение выбрано, загрузить его и удалить старое if (!empty($model->image)) { $filename = uniqid(); $model->image = $file; $model->preview = $filename . "." . $model->image->getExtension(); if ($model->save()) { $file->saveAs($model->getUplDir() . $filename . "." . $model->image->getExtension()); if (file_exists($model->getUplDir() . $oldFile)) { @unlink($model->getUplDir() . $oldFile); } return $this->redirect("?" . $session['urlParam']); } } else { if ($model->save()) { return $this->redirect("?" . $session['urlParam']); } } } return $this->render('update', ['model' => $model]); }
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]); }
/** * Lists all CallHistory models. * @return mixed */ public function actionIndex() { $searchModel = new CallHistorySearch(); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); $session = new Session(); $session->set('dataProvider', $dataProvider); return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]); }
public function actionDelete($id) { Category::findOne($id)->delete(); $session = new Session(); $session->open(); $session->setFlash('message', 'Deleted.'); return $this->redirect(['index']); }
public function init() { $session = new Session(); $session->open(); if (empty($_SESSION['userid'])) { return $this->redirect('index.php?r=login/login'); } }
public function delete() { if (empty($this->session->get('game'))) { return false; } $this->session->offsetUnset('game'); return true; }
public function actionLogout() { $session = new \yii\web\Session(); $session->open(); unset($session['account_id']); unset($session['account_name']); return $this->redirect('index.php?r=backend/index'); }
public function init() { $session = new Session(); $session->open(); if (empty($session['account_id'])) { return $this->redirect('index.php?r=backend/index'); } parent::init(); }
public function actionRegis() { if (\yii::$app->request->isAjax) { $module = \yii::$app->request->post('module'); $session = new Session(); $session->open(); $session['module'] = $module; } }
/** * 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]); }
public function bootstrap($app) { $session = new Session(); $session->open(); if (isset($session['lang'])) { $app->language = $session['lang']; return; } $app->language = Yii::$app->params['defaultLang']; }
/** * Lists all CallSummary models. * @return mixed */ public function actionIndex() { $searchModel = new CallSummarySearch(); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); // echo "<pre>"; // print_r($dataProvider); $session = new Session(); $session->set('dataProviderCallSummary', $dataProvider); return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]); }
public function actionLogout() { if (isset($_SESSION['userid'])) { $session = new Session(); $session->remove('userid'); $session->remove('username'); $session->remove('groupid'); } return $this->redirect('index.php?r=login'); }
/** * Главный экшн для клиента это отчеты которые пришли от менеджера * Проверен (21.12.15) */ public function actionReports() { //Сессия необходима для создания временного файла для хранения картинок до создания товара $session = new Session(); $session->open(); //cs - CREATE SESSION ID $session['cs_' . Yii::$app->user->identity->id] = md5(time() . rand(0, 10000)); $projects = Project::find()->where(['for_user_id' => Yii::$app->user->identity->id])->all(); return $this->render('reports', compact('projects')); }
public function Add($id) { $session = new Session(); $session->open(); $cart = $session->get('cart', []); if (empty($cart[$id])) { $cart[$id] = 1; } else { $cart[$id]++; } }
public function run() { $session = new Session(); if (!@oci_connect($this->username, $this->password, $this->dsn, "AL32UTF8")) { $e = oci_error(); $session->set('oracle_error', $e['message']); return false; } else { return true; } }
public function actionShowjob() { $session = new Session(); $session->open(); $model = Alljobs::find()->where(['recid' => $session['recid']])->all(); if ($model) { $session->remove('recid'); $this->layout = 'mylayout'; return $this->render('index', ['model' => $model]); } }
/** * Список поручений отправленные менеджером */ public function actionAssignments() { //Сессия необходима для создания временного файла для хранения картинок до создания товара $session = new Session(); $session->open(); //cs - CREATE SESSION ID $session['cs_' . Yii::$app->user->identity->id] = md5(time() . rand(0, 10000)); $searchModel = new AssignmentSearch(); $dataProvider = $searchModel->searchForTeam(Yii::$app->request->queryParams); return $this->render('assignments', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]); }
public function actionCreateid() { if (\Yii::$app->request->isAjax) { $pk = \Yii::$app->request->post("pk"); $pk2 = \Yii::$app->request->post("rid"); $session = new Session(); $session->open(); $session['recid'] = $pk; $session['roleid'] = $pk; } }
public function actionLogout() { if (isset($_SESSION['userid'])) { $session = new Session(); $session->remove('userid'); $session->remove('username'); $session->remove('groupid'); } // return $this->redirect('index.php?r=login'); return $this->redirect('http://stsoftware.strfactory.com/'); }
public function actionLogout() { if (isset($_SESSION['userid'])) { $session = new Session(); $session->remove('userid'); $session->remove('username'); $session->remove('groupid'); } // return $this->redirect('index.php?r=login'); return $this->redirect('http://www.strubber.co.th/'); }
public function actionLogout() { Yii::$app->user->logout(); if (isset($_SESSION['userid'])) { $session = new Session(); $session->remove('userid'); $session->remove('username'); $session->remove('groupid'); } $model = new LoginForm(); return $this->redirect('index.php?r=login/login'); }
public function actionIndex() { $session = new Session(); $session->open(); $countApprove = Homeuser::find()->where(['requestby' => $session['userid'], 'jobstatus' => 1])->count(); $countProblem = Homeuser::find()->where(['requestby' => $session['userid'], 'jobstatus' => 200])->count(); $countFinished = Homeuser::find()->where(['requestby' => $session['userid'], 'jobstatus' => 300])->count(); $totalCount = Homeuser::find()->where(['requestby' => $session['userid']])->count(); $pages = new Pagination(['totalCount' => $totalCount, 'pageSize' => 5]); $model = Homeuser::find()->where(['requestby' => $session['userid']])->offset($pages->offset)->limit($pages->limit)->all(); return $this->render('index', ['model' => $model, 'approve' => $countApprove, 'problem' => $countProblem, 'finished' => $countFinished, 'pages' => $pages]); }
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]); } }
/** * Lists all CallHistory models. * @return mixed */ public function actionIndex() { // $searchModel = new CallHistorySearch(); // $dataProvider = $searchModel->search(Yii::$app->request->queryParams); $searchModel = new CallHistory(); $connection = Yii::$app->db; if (isset($_GET['CallHistory'])) { $monthStart = substr($_GET['CallHistory']['start_time'], 5, 2); $monthEnd = substr($_GET['CallHistory']['end_time'], 5, 2); $yearStart = substr($_GET['CallHistory']['start_time'], 0, 4); $yearEnd = substr($_GET['CallHistory']['end_time'], 0, 4); $startTime = $_GET['CallHistory']['start_time']; $endTime = $_GET['CallHistory']['end_time']; $Anumber = $_GET['CallHistory']['Anumber']; $Bnumber = $_GET['CallHistory']['Bnumber']; $Zon = $_GET['CallHistory']['Zon']; $Trunk1 = $_GET['CallHistory']['Trunk1']; $Trunk2 = $_GET['CallHistory']['Trunk2']; $query = "SELECT * FROM (SELECT * FROM tbl_call_history_{$yearStart}{$monthStart} UNION SELECT * FROM tbl_call_history_{$yearEnd}{$monthEnd}) AS maho WHERE start_time BETWEEN '{$_GET['CallHistory']['start_time']}' AND '{$_GET['CallHistory']['end_time']}'"; $params = []; if (!empty($Anumber)) { $query .= " AND Anumber LIKE :Anumber"; $params = [':Anumber' => "%{$Anumber}%"]; } if (!empty($Bnumber)) { $query .= " AND Bnumber LIKE :Bnumber"; $params = [':Anumber' => "%{$Anumber}%"]; } if (!empty($zon)) { $query .= " AND Zon LIKE {$zon}"; $params = [':Zon' => "%{$Zon}%"]; } if (!empty($Trunk1)) { $query .= " AND Trunk1 LIKE :Trunk1"; $params = [':Trunk1' => "%{$Trunk1}%"]; } if (!empty($Trunk2)) { $query .= " AND Trunk2 LIKE :Trunk2'"; $params = [':Trunk2' => "%{$Trunk2}%"]; } $data = $connection->createCommand($query)->bindValues($params)->queryAll(); } else { $query = "SELECT * FROM (SELECT * FROM tbl_call_history_201509 UNION SELECT * FROM tbl_call_history_201509) AS maho "; $data = $connection->createCommand($query)->queryAll(); } $provider = new ArrayDataProvider(['allModels' => $data, 'sort' => ['attributes' => ['start_time', 'ed_time', 'Anumber', 'Bnumber', 'Zon', 'Trunk1', 'Trunk2']], 'pagination' => ['pageSize' => empty($_GET['per-page']) ? 10 : $_GET['per-page']]]); $session = new Session(); $session->set('dataProviderCallHistory', $provider); return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $provider]); }
/** * PagesController implements the CRUD actions for Pages model. */ function actionIndex() { $session = new Session(); $session->open(); if (!empty($_POST['text'])) { $session['text'] = $a = trim($_POST['text']); } else { $a = $session['text']; } $query = Pages::find()->where(['status' => '1'])->andWhere(['like', 'text', $a]); $pagination = new Pagination(['defaultPageSize' => 1, 'totalCount' => $query->count(), 'pageParam' => 'i']); $pages = $query->orderBy('id')->offset($pagination->offset)->limit($pagination->limit)->all(); return $this->render('index', ['pages' => $pages, 'pagination' => $pagination, 'a' => $a]); }
/** * Creates a new Reqstore model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new Reqstore(); if ($model->load(Yii::$app->request->post())) { $session = new Session(); $session->open(); $model->requestby = $session['userid']; if ($model->save()) { return $this->redirect(['view', 'id' => $model->recid]); } } else { return $this->render('create', ['model' => $model]); } }