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


PHP App函数代码示例

本文整理汇总了PHP中App函数的典型用法代码示例。如果您正苦于以下问题:PHP App函数的具体用法?PHP App怎么用?PHP App使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: actionPublicList

 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()));
 }
开发者ID:krsandesh,项目名称:LimeSurvey,代码行数:7,代码来源:SurveysController.php

示例2: actionPublicList

 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;
 }
开发者ID:mfavetti,项目名称:LimeSurvey,代码行数:26,代码来源:SurveysController.php

示例3: run

 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);
 }
开发者ID:mfavetti,项目名称:LimeSurvey,代码行数:60,代码来源:index.php

示例4: test

 /**
  * 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>';
 }
开发者ID:jdbaltazar,项目名称:survey-office,代码行数:64,代码来源:remotecontrol.php

示例5: run

 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');
 }
开发者ID:mfavetti,项目名称:LimeSurvey,代码行数:28,代码来源:ListSurveysWidget.php

示例6: _renderWrappedTemplate

 /**
  * 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);
 }
开发者ID:jdbaltazar,项目名称:survey-office,代码行数:14,代码来源:assessments.php

示例7: upvote

 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;
 }
开发者ID:stevejobsii,项目名称:gg,代码行数:31,代码来源:RepliesController.php

示例8: run

 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;
 }
开发者ID:mfavetti,项目名称:LimeSurvey,代码行数:28,代码来源:FlashMessage.php

示例9: script

 public function script()
 {
     App()->setOutputMode(Application::OUTPUTMODE_JAVASCRIPT);
     $js = new Template('search/search.js');
     $js->comments = false;
     $js->render();
 }
开发者ID:ZackDev,项目名称:dcrec_website,代码行数:7,代码来源:search.php

示例10: newReplyNotify

 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);
 }
开发者ID:stevejobsii,项目名称:gg,代码行数:7,代码来源:Notifier.php

示例11: init

 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;
     }
 }
开发者ID:wrenchpilot,项目名称:LimeSurvey,代码行数:27,代码来源:DocWriter.php

示例12: getPluginSettings

 /**
  * 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;
 }
开发者ID:rouben,项目名称:LimeSurvey,代码行数:40,代码来源:AuthLDAP.php

示例13: run

 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');
     }
 }
开发者ID:mfavetti,项目名称:LimeSurvey,代码行数:29,代码来源:PositionWidget.php

示例14: getPluginSettings

 /**
  * 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;
 }
开发者ID:withhope,项目名称:HIT-Survey,代码行数:41,代码来源:AuthCAS.php

示例15: project

 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);
 }
开发者ID:jdbaltazar,项目名称:survey-office,代码行数:33,代码来源:reports.php


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