public function actionPublicList($sLanguage = null) { if (isset($sLanguage)) { App()->setLanguage($sLanguage); } $this->render('publicSurveyList', array('publicSurveys' => Survey::model()->active()->open()->public()->with('languagesettings')->findAll(), 'futureSurveys' => Survey::model()->active()->registration()->public()->with('languagesettings')->findAll())); }
public function actionPublicList($lang = null) { if (!empty($lang)) { App()->setLanguage($lang); } else { App()->setLanguage(App()->getConfig('defaultlang')); } $oTemplate = Template::model()->getInstance(Yii::app()->getConfig("defaulttemplate")); if ($oTemplate->cssFramework == 'bootstrap') { // We now use the bootstrap package isntead of the Yiistrap TbApi::register() method // Then instead of using the composer dependency system for templates // We can use the package dependency system Yii::app()->getClientScript()->registerMetaTag('width=device-width, initial-scale=1.0', 'viewport'); App()->bootstrap->registerAllScripts(); } $aData = array('publicSurveys' => Survey::model()->active()->open()->public()->with('languagesettings')->findAll(), 'futureSurveys' => Survey::model()->active()->registration()->public()->with('languagesettings')->findAll()); $htmlOut = $this->render('publicSurveyList', $aData, true); $event = new PluginEvent('beforeSurveysStartpageRender', $this); $event->set('aData', $aData); App()->getPluginManager()->dispatchEvent($event); if ($event->get('result')) { $htmlFromEvent = $event->get('result'); $htmlOut = $htmlFromEvent['html']; } echo $htmlOut; }
public function run() { App()->loadHelper('surveytranslator'); $aData['issuperadmin'] = false; if (Permission::model()->hasGlobalPermission('superadmin', 'read')) { $aData['issuperadmin'] = true; } // We get the last survey visited by user $setting_entry = 'last_survey_' . Yii::app()->user->getId(); $lastsurvey = getGlobalSetting($setting_entry); $survey = Survey::model()->findByPk($lastsurvey); if ($lastsurvey != null && $survey) { $aData['showLastSurvey'] = true; $iSurveyID = $lastsurvey; $surveyinfo = $survey->surveyinfo; $aData['surveyTitle'] = $surveyinfo['surveyls_title'] . "(" . gT("ID") . ":" . $iSurveyID . ")"; $aData['surveyUrl'] = $this->getController()->createUrl("admin/survey/sa/view/surveyid/{$iSurveyID}"); } else { $aData['showLastSurvey'] = false; } // We get the last question visited by user $setting_entry = 'last_question_' . Yii::app()->user->getId(); $lastquestion = getGlobalSetting($setting_entry); // the question group of this question $setting_entry = 'last_question_gid_' . Yii::app()->user->getId(); $lastquestiongroup = getGlobalSetting($setting_entry); // the sid of this question : last_question_sid_1 $setting_entry = 'last_question_sid_' . Yii::app()->user->getId(); $lastquestionsid = getGlobalSetting($setting_entry); $survey = Survey::model()->findByPk($lastquestionsid); if ($lastquestion && $lastquestiongroup && $survey) { $baselang = $survey->language; $aData['showLastQuestion'] = true; $qid = $lastquestion; $gid = $lastquestiongroup; $sid = $lastquestionsid; $qrrow = Question::model()->findByAttributes(array('qid' => $qid, 'gid' => $gid, 'sid' => $sid, 'language' => $baselang)); if ($qrrow) { $aData['last_question_name'] = $qrrow['title']; if ($qrrow['question']) { $aData['last_question_name'] .= ' : ' . $qrrow['question']; } $aData['last_question_link'] = $this->getController()->createUrl("admin/questions/sa/view/surveyid/{$sid}/gid/{$gid}/qid/{$qid}"); } else { $aData['showLastQuestion'] = false; } } else { $aData['showLastQuestion'] = false; } $aData['countSurveyList'] = count(getSurveyList(true)); // We get the home page display setting $aData['bShowSurveyList'] = getGlobalSetting('show_survey_list') == "show"; $aData['bShowSurveyListSearch'] = getGlobalSetting('show_survey_list_search') == "show"; $aData['bShowLogo'] = getGlobalSetting('show_logo') == "show"; $aData['oSurveySearch'] = new Survey('search'); $aData['bShowLastSurveyAndQuestion'] = getGlobalSetting('show_last_survey_and_question') == "show"; $aData['iBoxesByRow'] = (int) getGlobalSetting('boxes_by_row'); $aData['sBoxesOffSet'] = (string) getGlobalSetting('boxes_offset'); $this->_renderWrappedTemplate('super', 'welcome', $aData); }
/** * Simple procedure to test most RPC functions * */ public function test() { $RPCType = Yii::app()->getConfig("RPCInterface"); $serverUrl = App()->createAbsoluteUrl('/admin/remotecontrol'); $sFileToImport = dirname(Yii::app()->basePath) . DIRECTORY_SEPARATOR . 'docs' . DIRECTORY_SEPARATOR . 'demosurveys' . DIRECTORY_SEPARATOR . 'limesurvey2_sample_survey_english.lss'; if ($RPCType == 'xml') { require_once 'Zend/XmlRpc/Client.php'; $client = new Zend_XmlRpc_Client($serverUrl); } elseif ($RPCType == 'json') { Yii::app()->loadLibrary('jsonRPCClient'); $client = new jsonRPCClient($serverUrl); } else { die('RPC interface not activated in global settings'); } $sSessionKey = $client->call('get_session_key', array('admin', 'password')); if (is_array($sSessionKey)) { echo $sSessionKey['status']; die; } else { echo 'Retrieved session key' . '<br>'; } $sLSSData = base64_encode(file_get_contents($sFileToImport)); $iSurveyID = $client->call('import_survey', array($sSessionKey, $sLSSData, 'lss', 'Test import by JSON_RPC', 1000)); echo 'Created new survey SID:' . $iSurveyID . '<br>'; $aResult = $client->call('activate_survey', array($sSessionKey, $iSurveyID)); if ($aResult['status'] == 'OK') { echo 'Survey ' . $iSurveyID . ' successfully activated.<br>'; } $aResult = $client->call('activate_tokens', array($sSessionKey, $iSurveyID, array(1, 2))); if ($aResult['status'] == 'OK') { echo 'Tokens for Survey ID ' . $iSurveyID . ' successfully activated.<br>'; } $aResult = $client->call('set_survey_properties', array($sSessionKey, $iSurveyID, array('faxto' => '0800-LIMESURVEY'))); if (!array_key_exists('status', $aResult)) { echo 'Modified survey settings for survey ' . $iSurveyID . '<br>'; } $aResult = $client->call('add_language', array($sSessionKey, $iSurveyID, 'ar')); if ($aResult['status'] == 'OK') { echo 'Added Arabian as additional language' . '<br>'; } $aResult = $client->call('set_language_properties', array($sSessionKey, $iSurveyID, array('surveyls_welcometext' => 'An Arabian welcome text!'), 'ar')); if ($aResult['status'] == 'OK') { echo 'Modified survey locale setting welcometext for Arabian in survey ID ' . $iSurveyID . '<br>'; } $aResult = $client->call('delete_language', array($sSessionKey, $iSurveyID, 'ar')); if ($aResult['status'] == 'OK') { echo 'Removed Arabian as additional language' . '<br>'; } //Very simple example to export responses as Excel file //$aResult=$client->call('export_responses', array($sSessionKey,$iSurveyID,'xls')); //$aResult=$client->call('export_responses', array($sSessionKey,$iSurveyID,'pdf')); //$aResult=$client->call('export_responses', array($sSessionKey,$iSurveyID,'doc')); $aResult = $client->call('export_responses', array($sSessionKey, $iSurveyID, 'csv')); //file_put_contents('test.xls',base64_decode(chunk_split($aResult))); $aResult = $client->call('delete_survey', array($sSessionKey, $iSurveyID)); echo 'Deleted survey SID:' . $iSurveyID . '-' . $aResult['status'] . '<br>'; // Release the session key - close the session $Result = $client->call('release_session_key', array($sSessionKey)); echo 'Closed the session' . '<br>'; }
public function run() { // Search if (isset($_GET['Survey']['searched_value'])) { $this->model->searched_value = $_GET['Survey']['searched_value']; } $this->model->active = null; // Filter state if (isset($_GET['active']) && !empty($_GET['active'])) { $this->model->active = $_GET['active']; } // Set number of page if (isset($_GET['pageSize'])) { Yii::app()->user->setState('pageSize', (int) $_GET['pageSize']); } $this->pageSize = Yii::app()->user->getState('pageSize', Yii::app()->params['defaultPageSize']); Yii::app()->getClientScript()->registerScriptFile(App()->getAssetManager()->publish(dirname(__FILE__) . '/assets/reload.js')); $this->massiveAction = $this->render('massive_actions/_selector', array(), true, false); if ($this->bRenderFooter) { $this->template = "{items}\n<div class=\"row-fluid\"><div class=\"col-sm-4\" id=\"massive-action-container\">{$this->massiveAction}</div><div class=\"col-sm-4 pager-container \">{pager}</div><div class=\"col-sm-4 summary-container\">{summary}</div></div>"; } else { $this->template = "{items}"; } if ($this->bRenderSearchBox) { $this->render('searchBox'); } $this->render('listSurveys'); }
/** * Renders template(s) wrapped in header and footer * * @param string $sAction Current action, the folder to fetch views from * @param string|array $aViewUrls View url(s) * @param array $aData Data to be passed on. Optional. */ protected function _renderWrappedTemplate($sAction = 'assessments', $aViewUrls = array(), $aData = array()) { App()->getClientScript()->registerScriptFile(Yii::app()->getConfig('adminscripts') . 'assessments.js'); App()->getClientScript()->registerPackage('jquery-tablesorter'); App()->getClientScript()->registerPackage('jquery-superfish'); parent::_renderWrappedTemplate($sAction, $aViewUrls, $aData); }
public function upvote($id, Request $request) { //upvote reply $reply = Reply::find($id); //notify commenter if (Auth::check()) { App('App\\Notification')->notify('reply_upvote', Auth::user(), $reply->user, $reply->article, $reply); if ($reply->votes()->ByWhom(Auth::id())->count()) { // click twice for remove upvote $reply->votes()->ByWhom(Auth::id())->delete(); $reply->decrement('vote_count', 1); $reply->article()->decrement('vote_count', 1); } else { // first time click $reply->votes()->create(['user_id' => Auth::id()]); $reply->increment('vote_count', 1); $reply->article()->increment('vote_count', 1); } } else { //匿名投票 App('App\\Notification')->nonamenotify('reply_upvote', $reply->user, $reply->article, $reply); if ($reply->votes()->ByWhom($request->ip())->count()) { $reply->votes()->ByWhom($request->ip())->delete(); $reply->decrement('vote_count', 1); } else { $reply->votes()->create(['user_id' => $request->ip()]); $reply->increment('vote_count', 1); } } return $reply->vote_count; }
public function run() { $aMessage = array(); $assetUrl = Yii::app()->assetManager->publish(dirname(__FILE__) . '/assets'); if (!empty(App()->session['aFlashMessage']) && count(Yii::app()->session['aFlashMessage'])) { $aMessage = App()->session['aFlashMessage']; unset(App()->session['aFlashMessage']); } if (!empty(App()->session['flashmessage']) && Yii::app()->session['flashmessage'] != '') { $message = App()->session['flashmessage']; unset(App()->session['flashmessage']); if ($message) { $aMessage[] = array('message' => $message); } } foreach (Yii::app()->user->getFlashes() as $key => $message) { if (is_string($message)) { $aMessage[] = array('message' => $message, 'type' => $key); } elseif (is_array($message) && is_string($message['message']) && isset($message['type'])) { $aMessage[] = array('message' => $message['message'], 'type' => $message['type']); } elseif (is_array($message) && is_string($message['message'])) { $aMessage[] = array('message' => $message['message']); } } //Yii::app()->clientScript->registerScript('notify-messages',"LS.messages=".json_encode($aMessage).';',CClientScript::POS_HEAD); //$this->render('message', array('aMessage'=>$aMessage)); App()->session['arrayNotificationMessages'] = $aMessage; }
public function script() { App()->setOutputMode(Application::OUTPUTMODE_JAVASCRIPT); $js = new Template('search/search.js'); $js->comments = false; $js->render(); }
public function newReplyNotify($fromUser, Mention $mentionParser, $article, $reply) { // Notify the author App('App\\Notification')->batchNotify('new_reply', $fromUser, $this->removeDuplication([$article->user]), $article, $reply); //Notify mentioned users @回复评论者 App('App\\Notification')->batchNotify('at', $fromUser, $this->removeDuplication($mentionParser->users), $article, $reply); }
public function init(SurveyObj $survey, $sLanguageCode, FormattingOptions $oOptions) { parent::init($survey, $sLanguageCode, $oOptions); App()->setLanguage($sLanguageCode); if ($oOptions->output == 'display') { header("Content-Disposition: attachment; filename=results-survey" . $survey->id . ".doc"); header("Content-type: application/vnd.ms-word"); } $sOutput = '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <style> table { border-collapse:collapse; } td, th { border:solid black 1.0pt; } th { background: #c0c0c0; } </style>'; if ($oOptions->output == 'display') { echo $sOutput; } elseif ($oOptions->output == 'file') { $this->file = fopen($this->filename, 'w'); $this->output = $sOutput; } }
/** * Modified getPluginSettings since we have a select box that autosubmits * and we only want to show the relevant options. * * @param boolean $getValues * @return array */ public function getPluginSettings($getValues = true) { $aPluginSettings = parent::getPluginSettings($getValues); if ($getValues) { $ldapmode = $aPluginSettings['ldapmode']['current']; $ldapver = $aPluginSettings['ldapversion']['current']; // If it is a post request, it could be an autosubmit so read posted // value over the saved value if (App()->request->isPostRequest) { $ldapmode = App()->request->getPost('ldapmode', $ldapmode); $aPluginSettings['ldapmode']['current'] = $ldapmode; $ldapver = App()->request->getPost('ldapversion', $ldapver); $aPluginSettings['ldapversion']['current'] = $ldapver; } if ($ldapver == '2') { unset($aPluginSettings['ldaptls']); } if ($ldapmode == 'searchandbind') { // Hide simple settings unset($aPluginSettings['userprefix']); unset($aPluginSettings['domainsuffix']); } else { // Hide searchandbind settings unset($aPluginSettings['searchuserattribute']); unset($aPluginSettings['usersearchbase']); unset($aPluginSettings['extrauserfilter']); unset($aPluginSettings['binddn']); unset($aPluginSettings['bindpwd']); unset($aPluginSettings['ldapoptreferrals']); } } return $aPluginSettings; }
public function run() { // We first check if a question group object has been provided if (is_a($this->oQuestionGroup, 'QuestionGroup') || is_a($this->oSurvey, 'Survey')) { // If oQuestionGroup is not defined, we take the first group in the survey if (!is_a($this->oQuestionGroup, 'QuestionGroup')) { $aGroups = $this->oSurvey->groups; if (count($aGroups) > 0) { $this->oQuestionGroup = $aGroups[0]; } else { return; } } $aQuestions = $this->oQuestionGroup->questions; // Get the list of questions in this group // We check if the required view exists. In the future, if we want other type of rendering could be useful if ($this->isView($this->display)) { $this->render($this->display, array('aQuestions' => $aQuestions)); // In ajax mode, we need to register this JS file if ($this->display == 'ajax_form_group') { Yii::app()->getClientScript()->registerScriptFile(App()->getAssetManager()->publish(dirname(__FILE__) . '/assets/reload_position.js')); } } else { return $this->render('unkown_view'); } } else { return $this->render('no_group'); } }
/** * Modified getPluginSettings since we have a select box that autosubmits * and we only want to show the relevant options. * * @param boolean $getValues * @return array */ public function getPluginSettings($getValues = true) { $aPluginSettings = parent::getPluginSettings($getValues); if ($getValues) { $ldapver = $aPluginSettings['ldapversion']['current']; $autoCreate = $aPluginSettings['autoCreate']['current']; // If it is a post request, it could be an autosubmit so read posted // value over the saved value if (App()->request->isPostRequest) { $ldapver = App()->request->getPost('ldapversion', $ldapver); $aPluginSettings['ldapversion']['current'] = $ldapver; $autoCreate = App()->request->getPost('autoCreate', $autoCreate); $aPluginSettings['autoCreate']['current'] = $autoCreate; } if ($autoCreate == 0) { // Don't create user. Hide unneeded ldap settings unset($aPluginSettings['server']); unset($aPluginSettings['ldapport']); unset($aPluginSettings['ldapversion']); unset($aPluginSettings['ldapoptreferrals']); unset($aPluginSettings['ldaptls']); unset($aPluginSettings['searchuserattribute']); unset($aPluginSettings['usersearchbase']); unset($aPluginSettings['extrauserfilter']); unset($aPluginSettings['binddn']); unset($aPluginSettings['bindpwd']); } else { if ($ldapver == '2') { unset($aPluginSettings['ldaptls']); } } } return $aPluginSettings; }
public function project() { $clang = Yii::app()->lang; if (!Permission::model()->hasGlobalPermission('Reports', 'read')) { Yii::app()->setFlashMessage($clang->gT("You do not have sufficient rights to access this page."), 'error'); $this->getController()->redirect(array("admin/index")); } App()->getClientScript()->registerCssFile(Yii::app()->getConfig('styleurl') . "jquery.dataTables.css"); App()->getClientScript()->registerScriptFile(Yii::app()->getConfig('adminscripts') . 'jquery.dataTables.min.js'); $sql = "SELECT Company_name,AVG(IFNULL(cpc,0)) AS avg_ven_cpc, AVG(IFNULL(proj_CPC,0)) AS avg_comp_cpc\n , SUM(IFNULL(cpc*total_completed,0)) AS tot_cost, SUM(IFNULL(proj_CPC,0)) AS tot_revenues\n , SUM(IFNULL(proj_CPC*total_completed,0)-IFNULL(cpc*total_completed,0)) AS tot_profit, SUM(IFNULL(total_completed,0)) AS tot_completed\n FROM {{view_project_master_vendors}} WHERE ifnull(total_completed,0)>0 GROUP BY company_name"; $sqlsum = ' SELECT SUM(IFNULL(tot_completed,0)) AS total_completed, SUM(IFNULL(tot_profit,0)) AS total_profit , SUM(IFNULL(tot_cost,0)) AS total_cost,SUM(IFNULL(tot_revenues,0)) AS total_revenues FROM ( ' . $sql . ' ) AS totals'; $dr_det1 = Yii::app()->db->createCommand($sql . ' ORDER BY tot_profit ')->query()->readAll(); $dr_sum1 = Yii::app()->db->createCommand($sqlsum)->query()->readAll(); $sql = "SELECT sales_name,AVG(IFNULL(cpc,0)) AS avg_ven_cpc, AVG(IFNULL(proj_CPC,0)) AS avg_comp_cpc\n , SUM(IFNULL(cpc*total_completed,0)) AS tot_cost, SUM(IFNULL(proj_CPC,0)) AS tot_revenues\n , SUM(IFNULL(proj_CPC*total_completed,0)-IFNULL(cpc*total_completed,0)) AS tot_profit, SUM(IFNULL(total_completed,0)) AS tot_completed\n FROM {{view_project_master_vendors}} WHERE ifnull(total_completed,0)>0 GROUP BY sales_name"; $dr_det2 = Yii::app()->db->createCommand($sql . ' ORDER BY tot_profit ')->query()->readAll(); $aData['row'] = 0; $aData['dr_det1'] = $dr_det1; $aData['dr_det2'] = $dr_det2; $aData['dr_sum1'] = $dr_sum1; $aData['imageurl'] = Yii::app()->getConfig("adminimageurl"); if (strpos($_SERVER['REQUEST_URI'], '/print')) { $aData['display']['header'] = false; $aData['display']['menu_bars'] = false; $aData['display']['footer'] = false; } else { $aData['display']['header'] = true; $aData['display']['menu_bars'] = true; $aData['display']['footer'] = true; } $this->_renderWrappedTemplate('reports', 'view_project', $aData); }
public function show() { $news = App('news_model')->getLatestByLanguage(Env()->main['amount_latest_news']); $pages = App('page_model')->getLatestByLanguage(Env()->main['amount_latest_pages']); $breadcrumbs = App()->sitemap_model->getBreadcrumbs('main'); View()->render('show', array('title' => Env()->main['title'], 'description' => Env()->main['description'], 'news' => $news, 'pages' => $pages, 'breadcrumbs' => $breadcrumbs)); }
public function index() { $surveyid = intval(App()->request->getQuery('surveyid')); $gid = intval(App()->request->getQuery('gid')); $qid = intval(App()->request->getQuery('qid')); $fieldtype = sanitize_xss_string(App()->request->getQuery('fieldtype')); $action = sanitize_xss_string(App()->request->getQuery('action')); if (!Yii::app()->session['loginID']) { throw new CHttpException(401); } list($replacementFields, $isInstertAnswerEnabled) = $this->_getReplacementFields($fieldtype, $surveyid); if ($isInstertAnswerEnabled === true) { //2: Get all other questions that occur before this question that are pre-determined answer types $fieldmap = createFieldMap($surveyid, 'full', false, false, getBaseLanguageFromSurveyID($surveyid)); $surveyInfo = getSurveyInfo($surveyid); $surveyformat = $surveyInfo['format']; // S, G, A //Go through each question until we reach the current one //error_log(print_r($qrows,true)); $questionlist = $this->_getQuestionList($action, $gid, $qid, $fieldmap, $fieldtype, $surveyformat); $childQuestions = $this->_getChildQuestions($questionlist); } $data['countfields'] = count($replacementFields); $data['replFields'] = $replacementFields; if (isset($childQuestions)) { $data['cquestions'] = $childQuestions; } if (isset($surveyformat)) { $data['surveyformat'] = $surveyformat; } $this->getController()->render('/admin/limeReplacementFields_view', $data); }
public function actionPublicList($lang = null) { $this->sessioncontrol(); if (isset($lang)) { App()->setLang(new Limesurvey_lang($lang)); } $this->render('publicSurveyList', array('publicSurveys' => Survey::model()->active()->open()->public()->with('languagesettings')->findAll(), 'futureSurveys' => Survey::model()->active()->registration()->public()->with('languagesettings')->findAll())); }
public function GetAffiliateReport($AffiliateId) { $results = App('App\\Entities\\Report')->ByAffiliate($AffiliateId); $resultset = count($results) + 1; $filename = isset($results[0]['affiliate_name']) ? $results[0]['affiliate_name'] . '-' : 'No-Result-'; // dd($results); $this->Parse($results, $resultset, $filename); }
public function run() { $htmlOptions = $this->htmlOptions; list($name, $id) = $this->resolveNameID(); echo CHtml::tag('div', $htmlOptions, CHtml::textArea($name, $this->value, array('id' => $id))); $config = json_encode($this->editorOptions); App()->getClientScript()->registerScript("initJsonEditor" . $id, "\$('#{$id}').jsonEditor({$config});", CClientScript::POS_READY); }
protected function _init() { parent::_init(); App()->getComponent('bootstrap'); $this->_sessioncontrol(); //unset(Yii::app()->session['FileManagerContext']); App()->getClientScript()->registerScriptFile(Yii::app()->getConfig('adminscripts') . "admin_core.js"); }
/** * Returns the title of the survey. Uses the current language and * falls back to the surveys' default language if the current language is not available. */ public function getLocalizedTitle() { if (isset($this->languagesettings[App()->lang->langcode])) { return $this->languagesettings[App()->lang->langcode]->surveyls_title; } else { return $this->languagesettings[$this->language]->surveyls_title; } }
public function actionPublicList($lang = null) { $this->sessioncontrol(); if (isset($lang)) { App()->setLang(new Limesurvey_lang($lang)); } // Custom index page for Neill Watson print file_get_contents("custom-homepage.html"); }
public function server($serverid, $page = false) { $page = $page ? (int) $page : 1; $games = Game::gamelist($serverid, $page, Game::$pagesize); $view = new Template('gamelist'); $view->load_data('list', $games['page']); $view->load_data('pagination', self::pagination($page, $games['total'], App()->site_url("gamelist/server/" . (int) $serverid))); $view->render(); }
/** * method for dispatching plugin events * * See {@link find()} for detailed explanation about $condition and $params. * @param string $sEventName event name to dispatch * @param array $criteria array containing attributes, conditions and params for the filter query * @return PluginEvent the dispatched event */ public function dispatchPluginModelEvent($sEventName, $criteria = null) { $oPluginEvent = new PluginEvent($sEventName, $this); $oPluginEvent->set('model', $this->owner); if (isset($criteria)) { $oPluginEvent->set('filterCriteria', $criteria); } return App()->getPluginManager()->dispatchEvent($oPluginEvent); }
public function actionPublicList($lang = null) { if (!empty($lang)) { App()->setLanguage(sanitize_languagecode($lang)); } else { App()->setLanguage(App()->getConfig('defaultlang')); } $this->render('publicSurveyList', array('publicSurveys' => Survey::model()->active()->open()->public()->with('languagesettings')->findAll(), 'futureSurveys' => Survey::model()->active()->registration()->public()->with('languagesettings')->findAll())); }
public function run() { if (YII_DEBUG && in_array(getIPAddress(), array("127.0.0.1", "::1"))) { $data = array('session' => $_SESSION, 'server' => $_SERVER); $json = json_encode($data, JSON_FORCE_OBJECT); $script = "LSdebug = {$json};\n"; $script .= "console.dir(LSdebug)\n"; App()->getClientScript()->registerScript('LimeDebug', $script, CClientScript::POS_HEAD); } }
public function __construct($childquery = null, $query, $limit = 10, $links = 7) { $this->db = App('App\\DB')->conn(); $this->query = $query; $this->page = isset($_GET['page']) ? $_GET['page'] : 1; $this->validatePageNumber(); $this->limit = $limit; $this->links = $links; $this->baseUrl = config('base_url') . geturi(); $this->childquery = $childquery; }
/** * Sets the locale if it exists in the session or uses preferred or default locale * * @return void */ public function configureLocale() { $defaultLocale = static::getDefaultLocale(); // set fallback locale \App('translator')->setFallback($defaultLocale); // set main locale \Request::setDefaultLocale($defaultLocale); $sessionKey = static::getLocaleSessionKey(); $preferredLocale = \Request::getPreferredLanguage(static::getAllowedLocales()); \App::setLocale($sessionKey ? \Session::get($sessionKey, $preferredLocale) : $preferredLocale); }
private function _printOnLoad($which) { switch ($which) { case 'relevance': App()->getClientScript()->registerScript("emscript", "ExprMgr_process_relevance_and_tailoring();", CClientScript::POS_LOAD); break; case 'unit': App()->getClientScript()->registerScript("emscript", "recompute();", CClientScript::POS_LOAD); break; } }