public function runAction($action, $data) { $this->id = $data; $s = new CHttpSession(); $s->open(); $storedData = $s[$this->id]; $s->close(); $this->model = $storedData['model']; if ($action == 'listitems') { $parent_id = null; if (isset($_GET['id'])) { $parent_id = $_GET['id']; } return $this->model->eyuiformeditordb_listitems($_GET['item_type'], $parent_id); } if ($action == 'newitem') { $parent_id = null; if (isset($_GET['id'])) { $parent_id = $_GET['id']; } return $this->model->eyuiformeditordb_newitem($_GET['item_type'], self::t("New Item"), $parent_id); } if ($action == 'deleteitem') { if ($this->model->eyuiformeditordb_deleteitem($_GET['id'])) { return "OK"; } } if ($action == 'updateitem') { $obj = CJSON::decode(trim(file_get_contents('php://input'))); if ($this->model->eyuiformeditordb_updateitem($obj) == true) { return "OK"; } } }
public function actionScheduleBackupGeneratePdf() { $session=new CHttpSession; $session->open(); Yii::import('application.extensions.tcpdf.*'); require_once('tcpdf/tcpdf.php'); require_once('tcpdf/config/lang/eng.php'); if(isset($session['DatabaseBackupCron_records'])) { $d=$_SESSION['DatabaseBackupCron_records']; $model = array(); if($d->data) $model[]=array_keys($d->data[0]->attributes);//headers: cols name else { $this->render('no_data_found',array('last_page'=>$_SERVER['HTTP_REFERER'],)); exit; } foreach ($d->data as $item) { $model[] = $item->attributes; } //print_r($model);exit; } $html = $this->renderPartial('/databaseBackupCron/exportGridtoReport', array( 'model'=>$model ), true); $this->exporttopdf('Schedule Database Backup','ScheduleDatabaseBackup.pdf',$html); }
/** * This is the default 'index' action that is invoked * when an action is not explicitly requested by users. */ public function actionIndex() { //print_r($_GET); //die; if (isset($_GET['de'])) { $translator = self::translator(); $translator->setLanguage('de'); } if (isset($_GET['fr'])) { $translator = self::translator(); $translator->setLanguage('fr'); } /** @var $cs CClientScript */ $cs = Yii::app()->clientScript; $cs->registerCssFile(Yii::app()->baseUrl . '/js/plugins/maximage/jquery.maximage.min.css'); Yii::app()->clientScript->registerCoreScript('jquery.ui'); Yii::app()->clientScript->registerCssFile(Yii::app()->clientScript->getCoreScriptUrl() . '/jui/css/base/jquery-ui.css'); $cs->registerScriptFile(Yii::app()->baseUrl . '/js/plugins/maximage/jquery.maximage.min.js'); $cs->registerScriptFile(Yii::app()->baseUrl . '/js/plugins/maximage/jquery.cycle.all.js'); $cs->registerScriptFile(Yii::app()->baseUrl . '/js/plugins/jquery.easing.1.3.js'); $cs->registerScriptFile(Yii::app()->baseUrl . '/js/catalog.min.js'); $cs->registerScriptFile(Yii::app()->baseUrl . '/js/custom.js'); $cs->registerCssFile(Yii::app()->baseUrl . '/js/plugins/to_ui_slider/css/ui.slider.extras.css'); $cs->registerScriptFile(Yii::app()->baseUrl . '/js/plugins/to_ui_slider/js/selectToUISlider.jQuery.js'); if (isset($_POST['VariationID'])) { $session = new CHttpSession(); $session->open(); $aOrderVariations = $session['orderVariations']; $aOrderVariations[$_POST['VariationID']] = $_POST['VariationID']; $session['orderVariations'] = $aOrderVariations; echo json_encode(array('counter' => count($aOrderVariations), 'message' => 'success')); exit; } $this->render('index', array('categories' => Category::model()->getCategoriesTree())); }
public function getDevice() { $device = new CHttpSession(); $device->open(); $type = $device['device-type']; return $type; }
/** * */ public function init() { $this->session = Yii::app()->getSession(); if (null === $this->session->get($this->key)) { $this->session->add($this->key, []); } }
/** * doCallback * you must process a calilback response comming from host auth provider. * * you pass remote data to your local system using: * $this->setData($anydata); * $this->setLastError('error message'); * * @access public * @return bool boolean result true if login is correct. */ public function doCallback() { if (isset($_REQUEST['error'])) { if ($_REQUEST['error'] == 'access_denied') { $this->setLastError($_REQUEST['error_description']); return false; } } $s = new CHttpSession(); $s->open(); if (isset($s['state'])) { if ($s['state'] === $_REQUEST['state']) { $ac = $this->_getAccessToken($_REQUEST['code']); $this->setData($this->_requestUser($ac)); $s->close(); return true; } else { $this->setLastError('CRSF validation failed.'); $s->close(); return false; } } else { $this->setLastError('invalid state argument.'); $s->close(); return false; } }
public function actionGeneratePdf() { $session = new CHttpSession(); $session->open(); Yii::import('application.modules.admin.extensions.giiplus.bootstrap.*'); require_once 'tcpdf/tcpdf.php'; require_once 'tcpdf/config/lang/eng.php'; if (isset($session['IguProductCategory_records'])) { $model = $session['IguProductCategory_records']; } else { $model = IguProductCategory::model()->findAll(); } $html = $this->renderPartial('expenseGridtoReport', array('model' => $model), true); //die($html); $pdf = new TCPDF(); $pdf->SetCreator(PDF_CREATOR); $pdf->SetAuthor(Yii::app()->name); $pdf->SetTitle('IguProductCategory Report'); $pdf->SetSubject('IguProductCategory Report'); //$pdf->SetKeywords('example, text, report'); $pdf->SetHeaderData('', 0, "Report", ''); $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, "Example Report by " . Yii::app()->name, ""); $pdf->setHeaderFont(array('helvetica', '', 8)); $pdf->setFooterFont(array('helvetica', '', 6)); $pdf->SetMargins(15, 18, 15); $pdf->SetHeaderMargin(5); $pdf->SetFooterMargin(10); $pdf->SetAutoPageBreak(TRUE, 0); $pdf->SetFont('dejavusans', '', 7); $pdf->AddPage(); $pdf->writeHTML($html, true, false, true, false, ''); $pdf->LastPage(); $pdf->Output("IguProductCategory_002.pdf", "I"); }
public function actionLogOut() { $session = new CHttpSession(); $session->open(); $session->remove('usuarioSesion'); $this->redirect('login.php'); }
protected function renderContent() { yii::beginProfile('loc'); $session = new CHttpSession(); $session->open(); $newCountry = $this->newCountry ? $this->newCountry : ($session['top-country'] ? $session['top-country'] : $this->defaultCountry); $session['top-country'] = $newCountry; $newCity = $this->newCity ? $this->newCity : ($session['top-city'] ? $session['top-city'] : $this->defaultCity); $session['top-location'] = $newCity; if ($newCountry == "international") { $country = 'international'; $city = GeoCityApi::getCityByName($newCity); if ($city) { $cities = GeoCityApi::getTopPrioritiesInternational($city->id); } else { $cities = GeoCityApi::getTopPrioritiesInternational(); } } else { $country = GeoCountryApi::getCountryByName($newCountry); $city = GeoCityApi::getCityByName($newCity); if ($country && $city) { $cities = GeoCityApi::getTopPrioritiesByCountry($country->id, $city->id); } elseif ($country) { $cities = GeoCityApi::getTopPrioritiesByCountry($country->id); } } if ($country && $cities) { $this->render('topLocation', array('city' => $city, 'country' => $country, 'current' => $this->current, 'cities' => $cities)); } yii::endProfile('loc'); }
public function checkUserAdmin($accessRole_id = '') { $session = new CHttpSession(); $session->open(); $user_id = $session['uid']; // App::pr($user_id,2); $user_rid = $session['rid']; if (!empty($user_id)) { if (!empty($accessRole_id)) { // App::pr($accessRole_id,2); $record = UserMaster::model()->find("u_id = {$user_id} AND ur_id IN({$accessRole_id})"); // App::pr($record,2); if (!empty($record)) { return true; } else { return false; } } else { $record = UserMaster::model()->findByPk($user_id); if (!empty($record)) { return true; } else { return false; } } } else { return FALSE; } }
/** * @param $id * @param $criteria * @return CActiveRecord * @throws CHttpException */ public function loadModel($id, $criteria = false) { if (!$id) { throw new CHttpException(404, 'Property not found'); } $criteria = $criteria ?: new CDbCriteria(); $previewSession = new CHttpSession(); $previewSession->open(); $previewString = isset($previewSession['preview']) && $previewSession['preview'] ? $previewSession['preview'] : null; $previewString = isset($_GET['preview']) && $_GET['preview'] ? $_GET['preview'] : $previewString; if (Yii::app()->user->isGuest) { $criteria->scopes = ['notUnderTheRadar']; if ($previewString) { $criteria->compare('emailLinkString', $previewString); } else { $criteria->scopes = ['publicAvailable', 'notUnderTheRadar']; } } $model = Deal::model()->findByPk($id, $criteria); if (!$model) { throw new CHttpException(404, 'Property not found'); } else { $previewSession['preview'] = $previewString; $previewSession->close(); } return $model; }
public function run() { $session = new CHttpSession(); $session->open(); $surSess = Yii::app()->session->get("favorites"); if (!Yii::app()->user->isGuest) { Yii::import('mod.users.models.UserFavorites'); $modelClass = $this->model; $currentModule = Yii::app()->controller->module->id; echo Html::openTag('div', array('id' => 'fav' . $this->model->id, 'class' => 'favorite')); $modelc = UserFavorites::model()->findAll(array('condition' => '`t`.`user_id`=:userid', 'params' => array(':userid' => Yii::app()->user->getId()))); if (count($modelc) < Yii::app()->settings->get('users', 'favorite_limit')) { if (isset($modelClass)) { $model = UserFavorites::model()->find(array('condition' => '`t`.`user_id`=:userid AND `t`.`model_class`=:model_class AND `t`.`object_id`=:id', 'params' => array(':userid' => Yii::app()->user->getId(), ':model_class' => $modelClass->getModelName(), ':id' => $modelClass->id))); if ($this->view && !isset($model)) { // $view = "add"; $params = array('model' => $this->model, 'mod' => $currentModule); } else { $view = "remove"; $params = array('favorite_id' => $model->id, 'model' => $this->model, 'object_id' => $this->model->id, 'mod' => $currentModule); } } } $this->render($view, $params); echo Html::closeTag('div'); } }
public function flushUploadDir() { $session = new CHttpSession(); $session->open(); $folder = $_SERVER['DOCUMENT_ROOT'] . '/upload/tmp/' . $session->SessionID; Y::recursiveRemDir($folder); }
/** * */ public function init() { $this->session = Yii::app()->getSession(); $this->productRepository = Yii::app()->getComponent('productRepository'); if (null === $this->session->get($this->key)) { $this->session->add($this->key, []); } }
public function actionSeenOffer() { $session = new CHttpSession(); $session->open(); $session['seenBackout'] = 1; echo "<russia>Have nice day</russia>"; exit; }
/** * This is the default 'index' action that is invoked * when an action is not explicitly requested by users. */ public function actionIndex() { // renders the view file 'protected/views/site/index.php' // using the default layout 'protected/views/layouts/main.php' $session = new CHttpSession(); $session->open(); $this->render('index', array('username' => $session["fullname"])); }
protected function preFilter($filterChain) { /** @var CHttpSession */ self::$session = Yii::app()->session; if (self::$session->get('appointmentBuilder')) { self::$current = self::$session->get('appointmentBuilder'); } return parent::preFilter($filterChain); }
public function actionIndex() { $session = new CHttpSession(); $session->open(); $user = $session['login']; $session->closeSession(true); $sql = Yii::app()->db->createCommand("SELECT User.Num_bank_cart, Credit.Type_credit, Credit.Sum_credit, Credit.Proc_stavka, Credit.Srok, Credit.Type_credit, Calendar.Month_pay, Credit.Num_credit, Credit.Type_platezh, Credit.Oforml_credit_date, Calendar.Pay_sum, Calendar.P_sum, Calendar.P_proc, Calendar.Less_sum\nFROM (User INNER JOIN Credit ON User.id_user = Credit.id_user) INNER JOIN Calendar ON Credit.id_credit = Calendar.id_credit WHERE Num_bank_cart = {$user} ")->queryAll(); echo $this->render('index', array('variable' => $sql)); }
public function getFromMemory() { $session = new CHttpSession(); $session->open(); $this->date_from = $session[$this->session_name] ? $session[$this->session_name]['date_from'] : ''; $this->date_to = $session[$this->session_name] ? $session[$this->session_name]['date_to'] : ''; $this->time_from = $session[$this->session_name] ? $session[$this->session_name]['time_from'] : '00:00'; $this->time_to = $session[$this->session_name] ? $session[$this->session_name]['time_to'] : '23:59'; }
public function actionPost() { $session = new CHttpSession(); $session->open(); $text = $_POST['text']; $fp = fopen("log.html", 'a'); fwrite($fp, "<div class='msgln'>(" . date("g:i A") . ") <b>" . $session['chatuser'] . "</b>: " . stripslashes(htmlspecialchars($text)) . "<br></div>"); fclose($fp); }
/** * Logs in the user using the given username and password in the model. * @return boolean whether login is successful */ public function login() { $session = new CHttpSession(); $session->open(); $session['chatuser'] = $this->username; $fp = fopen("log.html", 'a'); fwrite($fp, "<div class='msgln'><i>User " . $session['chatuser'] . " has join the chat session.</i><br></div>"); fclose($fp); return true; }
public function filterEnforcelogin($filterChain) { $session = new CHttpSession(); $session->open(); $userSesion = $session->get('usuarioSesion'); if (empty($userSesion)) { $this->redirect("login.php"); } $filterChain->run(); }
public function verificarSessiousuario() { $session = new CHttpSession(); $session->open(); $userSesion = $session->get('usuarioSesion'); if (empty($userSesion)) { $RESP = FALSE; } else { $RESP = TRUE; } return $RESP; }
public function actionSearch() { Yii::beginProfile('search_jukebox'); $questions = null; $data = null; $jukeboxCount = ''; $session = new CHttpSession(); $session->open(); $modelJukeboxQuestions = new JukeboxQuestions(); //$questions = JukeboxQuestionsApi::searchQuestion($data); if (isset($_POST['JukeboxMin']) && isset($_POST['JukeboxQuestions'])) { $modelJukeboxQuestions->attributes = $_POST['JukeboxQuestions']; $data['keyword'] = $_POST['keyword']; $criteria = JukeboxQuestionsApi::getCriteriaObject($data); $total = JukeboxQuestions::model()->count($criteria); $pages = new CPagination($total); $pages->pageSize = Yii::app()->params['resultsPerPage']; $pages->applyLimit($criteria); $questions = JukeboxQuestionsApi::searchJukeboxWithCriteria($criteria); $jukeboxCount = $total; $session['search-criteria-jukebox'] = $criteria; $session['results-page'] = $total; } elseif (isset($_POST['submit']) && isset($_POST['JukeboxQuestions'])) { $modelJukeboxQuestions->attributes = $_POST['JukeboxQuestions']; $data = $_POST['JukeboxQuestions']; $data['keyword'] = $_POST['keyword']; $data['time'] = $_POST['time']; $criteria = JukeboxQuestionsApi::getCriteriaObject($data); $total = JukeboxQuestions::model()->count($criteria); $pages = new CPagination($total); $pages->pageSize = Yii::app()->params['resultsPerPage']; $pages->applyLimit($criteria); $questions = JukeboxQuestionsApi::searchJukeboxWithCriteria($criteria); $jukeboxCount = $total; $session['search-criteria-jukebox'] = $criteria; $session['results-page'] = $total; } else { if (isset($session['search-criteria-jukebox'])) { $criteria = $session['search-criteria-jukebox']; //$criteria = new CDbCriteria; } else { $criteria = JukeboxQuestionsApi::getCriteriaObject($data); } $total = JukeboxQuestions::model()->count($criteria); $pages = new CPagination($total); $pages->pageSize = Yii::app()->params['resultsPerPage']; $pages->applyLimit($criteria); $questions = JukeboxQuestionsApi::searchJukeboxWithCriteria($criteria); $jukeboxCount = $total; } $this->render('search', array('modelJukeboxQuestions' => $modelJukeboxQuestions, 'questions' => $questions, 'pages' => $pages, 'jukeboxCount' => $jukeboxCount)); Yii::endProfile('search_jukebox'); }
public function actionList() { $search = $this->request->getParam("search"); $session = new CHttpSession(); $session->open(); $firmId = $this->request->getParam("firm_id"); $subspecialtyId = $this->request->getParam("subspecialty_id"); if ($firmId > 0 && (isset($search['filterid']['subspecialty_id']['value']) && $search['filterid']['subspecialty_id']['value'] > 0)) { $session['lastSubspecialtyId'] = $search['filterid']['subspecialty_id']['value']; $this->redirect('/oeadmin/LeafletSubspecialtyFirm/list?search[filterid][firm_id][value]=' . $firmId . '&subspecialty_id=' . $search['filterid']['subspecialty_id']['value']); } $lastSubspecialtyId = $session['lastSubspecialtyId']; // check if it's been already set if (!($lastSubspecialtyId > 0)) { if (isset($search['filterid']['subspecialty_id']['value'])) { $session['lastSubspecialtyId'] = $search['filterid']['subspecialty_id']['value']; } else { $session['lastSubspecialtyId'] = Firm::model()->findByPk(Yii::app()->session['selected_firm_id'])->serviceSubspecialtyAssignment->subspecialty_id; } } // || ($this->request->getParam("subspecialty_id")!=$session['lastSubspecialtyId'] && $search['filterid']['firm_id']['value']=="") if ($subspecialtyId > 0 && $subspecialtyId != $session['lastSubspecialtyId'] && isset($search['filterid']['firm_id']['value']) || $subspecialtyId == $session['lastSubspecialtyId'] && $search['filterid']['firm_id']['value'] == "") { $session['lastSubspecialtyId'] = ""; $this->redirect('/oeadmin/LeafletSubspecialtyFirm/list?search[filterid][subspecialty_id][value]=' . $subspecialtyId); } if (isset($search['filterid']['firm_id']['value']) && $search['filterid']['firm_id']['value'] > 0) { $excludeSubspecialty = true; $excludeFirm = false; $admin = new AdminListAutocomplete(OphTrConsent_Leaflet_Firm::model(), $this); $admin->setCustomDeleteURL('/oeadmin/LeafletSubspecialtyFirm/deleteFirm'); } else { $excludeSubspecialty = false; $excludeFirm = true; $admin = new AdminListAutocomplete(OphTrConsent_Leaflet_Subspecialty::model(), $this); $admin->setCustomDeleteURL('/oeadmin/LeafletSubspecialtyFirm/deleteSubspecialty'); } $admin->setListFields(array('id', 'leaflet.name')); $admin->setCustomSaveURL('/oeadmin/LeafletSubspecialtyFirm/add'); $admin->setModelDisplayName('Leaflet-Subspecialty-Firm Assignment'); if ($subspecialtyId > 0) { $defaultSubspecialty = $subspecialtyId; } else { $defaultSubspecialty = Firm::model()->findByPk(Yii::app()->session['selected_firm_id'])->serviceSubspecialtyAssignment->subspecialty_id; } $admin->setFilterFields(array(array('label' => 'Subspecialty', 'dropDownName' => 'subspecialty_id', 'defaultValue' => $defaultSubspecialty, 'listModel' => Subspecialty::model(), 'listIdField' => 'id', 'listDisplayField' => 'name', 'excludeSearch' => $excludeSubspecialty), array('label' => 'Firm', 'dropDownName' => 'firm_id', 'defaultValue' => null, 'listModel' => Firm::model(), 'listIdField' => 'id', 'listDisplayField' => 'name', 'emptyLabel' => '-- All --', 'dependsOnFilterName' => 'subspecialty_id', 'dependsOnDbFieldName' => 'subspecialty_id', 'dependsOnJoinedTable' => 'serviceSubspecialtyAssignment', 'excludeSearch' => $excludeFirm))); // we set default search options if ($this->request->getParam('search') == '') { $admin->getSearch()->initSearch(array('filterid' => array('subspecialty_id' => Firm::model()->findByPk(Yii::app()->session['selected_firm_id'])->serviceSubspecialtyAssignment->subspecialty_id))); } $admin->setAutocompleteField(array('fieldName' => 'leaflet_id', 'allowBlankSearch' => 1, 'jsonURL' => '/oeadmin/LeafletSubspecialtyFirm/search', 'placeholder' => 'search for leaflets')); //$admin->searchAll(); $admin->listModel(); }
public function actionGeneratePdf() { $session = new CHttpSession(); $session->open(); if (isset($session['ReporteGeneral_model_search'])) { $model = $session['ReporteGeneral_model_search']; $model = ReporteGeneral::model()->findAll($model->search()->criteria); } else { $model = ReporteGeneral::model()->findAll(); } $this->toExcel($model, array('id', 'fecha_ingreso', 'celular', 'compania', 'monto', 'fecha_atencion', 'nombre_operador', 'nombre_cliente', 'nombre', 'ciudad_local', 'estado', 'tiempo_respuesta', 'nombre_operador', 'nombre_cliente', 'nombre_empleado', '', ''), date('Y-m-d-H-i-s'), array(), 'PDF'); }
public function getFromMemory() { $session = new CHttpSession(); $session->open(); $this->source = $session[$this->session_name] ? $session[$this->session_name]['source'] : 0; $this->date_from = $session[$this->session_name] ? $session[$this->session_name]['date_from'] : ''; $this->date_to = $session[$this->session_name] ? $session[$this->session_name]['date_to'] : ''; $this->time_from = $session[$this->session_name] ? $session[$this->session_name]['time_from'] : '00:00'; $this->time_to = $session[$this->session_name] ? $session[$this->session_name]['time_to'] : '23:59'; $this->order_field = $session[$this->session_name] ? $session[$this->session_name]['order_field'] : 'date'; $this->order_direction = $session[$this->session_name] ? $session[$this->session_name]['order_direction'] : 'DESC'; }
public function getFromMemory() { $session = new CHttpSession(); $session->open(); $this->types = $session[$this->session_name] ? $session[$this->session_name]['types'] : array('failed', 'warning'); $this->date_from = $session[$this->session_name] ? $session[$this->session_name]['date_from'] : ''; $this->date_to = $session[$this->session_name] ? $session[$this->session_name]['date_to'] : ''; $this->time_from = $session[$this->session_name] ? $session[$this->session_name]['time_from'] : '00:00'; $this->time_to = $session[$this->session_name] ? $session[$this->session_name]['time_to'] : ''; $this->order_field = $session[$this->session_name] ? $session[$this->session_name]['order_field'] : 'date'; $this->order_direction = $session[$this->session_name] ? $session[$this->session_name]['order_direction'] : 'DESC'; $this->total = $session[$this->session_name] ? $session[$this->session_name]['total'] : '0'; }
/** * This is the default 'index' action that is invoked * when an action is not explicitly requested by users. */ public function actionIndex() { $session = new CHttpSession(); $session->open(); $userSesion = $session->get('usuarioSesion'); if (empty($userSesion)) { $this->redirect("login.php"); } else { $this->render('index'); } // renders the view file 'protected/views/site/index.php' // using the default layout 'protected/views/layouts/main.php' }
/** * This is the default 'index' action that is invoked * when an action is not explicitly requested by users. */ public function actionIndex() { //Yii::app()->clientScript->registerCoreScript("jquery"); header('P3P: CP="HONK"'); $session=new CHttpSession; //making session object $session->open(); /* if(isset($_REQUEST['name'])) { echo "name:".$_REQUEST['name']; return; } */ /* $facebook = new Facebook(array( 'appId' => Yii::app()->params['fb_app_id'], 'secret' => Yii::app()->params['fb_app_secret'], )); $signedRequest=$facebook->getSignedRequest(); if($signedRequest) { print_r($signedRequest); } else { echo "No signed request"; } // $me=$facebook->api('/me'); // echo "id:".Yii::app()->params['fb_app_id']."|"."secret:".Yii::app()->params['fb_app_secret']; $userId = $facebook->getUser(); if($userId!=0) { $me=$facebook->api('/me'); $session['me']=$me; print_r($me); } else { echo "Not logged in"; } */ $userId=0; // renders the view file 'protected/views/site/index.php' // using the default layout 'protected/views/layouts/main.php' $this->render('index',array('userId'=>$userId)); }