• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP getSurveyInfo函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: actionLocal

 function actionLocal($surveyid, $token, $langcode = '')
 {
     Yii::app()->loadHelper('database');
     Yii::app()->loadHelper('sanitize');
     $sLanguageCode = $langcode;
     $iSurveyID = $surveyid;
     $sToken = $token;
     $sToken = sanitize_token($sToken);
     if (!$iSurveyID) {
         $this->redirect($this->getController()->createUrl('/'));
     }
     $iSurveyID = (int) $iSurveyID;
     //Check that there is a SID
     // Get passed language from form, so that we dont loose this!
     if (!isset($sLanguageCode) || $sLanguageCode == "" || !$sLanguageCode) {
         $baselang = Survey::model()->findByPk($iSurveyID)->language;
         Yii::import('application.libraries.Limesurvey_lang', true);
         $clang = new Limesurvey_lang($baselang);
     } else {
         $sLanguageCode = sanitize_languagecode($sLanguageCode);
         Yii::import('application.libraries.Limesurvey_lang', true);
         $clang = new Limesurvey_lang($sLanguageCode);
         $baselang = $sLanguageCode;
     }
     Yii::app()->lang = $clang;
     $thissurvey = getSurveyInfo($iSurveyID, $baselang);
     if ($thissurvey == false || Yii::app()->db->schema->getTable("{{tokens_{$iSurveyID}}}") == null) {
         $html = $clang->gT('This survey does not seem to exist.');
     } else {
         $row = Tokens_dynamic::getEmailStatus($iSurveyID, $sToken);
         if ($row == false) {
             $html = $clang->gT('You are not a participant in this survey.');
         } else {
             $usresult = $row['emailstatus'];
             if ($usresult == 'OptOut') {
                 $usresult = Tokens_dynamic::updateEmailStatus($iSurveyID, $sToken, 'OK');
                 $html = $clang->gT('You have been successfully added back to this survey.');
             } else {
                 if ($usresult == 'OK') {
                     $html = $clang->gT('You are already a part of this survey.');
                 } else {
                     $html = $clang->gT('You have been already removed from this survey.');
                 }
             }
         }
     }
     //PRINT COMPLETED PAGE
     if (!$thissurvey['templatedir']) {
         $thistpl = getTemplatePath(Yii::app()->getConfig("defaulttemplate"));
     } else {
         $thistpl = getTemplatePath($thissurvey['templatedir']);
     }
     $this->_renderHtml($html, $thistpl, $clang);
 }
开发者ID:rawaludin,项目名称:LimeSurvey,代码行数:54,代码来源:OptinController.php


示例2: _getData

 private function _getData($params)
 {
     if (is_numeric($params)) {
         $iSurveyId = $params;
     } elseif (is_array($params)) {
         extract($params);
     }
     $aData = array();
     // Set the variables in an array
     $aData['surveyid'] = $aData['iSurveyId'] = (int) $iSurveyId;
     if (!empty($iId)) {
         $aData['iId'] = (int) $iId;
     }
     $aData['clang'] = $clang = $this->getController()->lang;
     $aData['imageurl'] = Yii::app()->getConfig('imageurl');
     $aData['action'] = Yii::app()->request->getParam('action');
     $aData['all'] = Yii::app()->request->getParam('all');
     $oCriteria = new CDbCriteria();
     $oCriteria->select = 'sid, active';
     $oCriteria->join = 'INNER JOIN {{surveys_languagesettings}} as b on (b.surveyls_survey_id=sid and b.surveyls_language=language)';
     $oCriteria->condition = 'sid=:survey';
     $oCriteria->params = array('survey' => $iSurveyId);
     $actresult = Survey::model()->findAll($oCriteria);
     if (count($actresult) > 0) {
         foreach ($actresult as $actrow) {
             if ($actrow['active'] == 'N') {
                 Yii::app()->session['flashmessage'] = $clang->gT("This survey has not been activated. There are no results to browse.");
                 $this->getController()->redirect($this->getController()->createUrl("/admin/survey/sa/view/surveyid/{$iSurveyId}"));
             }
         }
     } else {
         Yii::app()->session['flashmessage'] = $clang->gT("Invalid survey ID");
         $this->getController()->redirect($this->getController()->createUrl("admin/index"));
     }
     //OK. IF WE GOT THIS FAR, THEN THE SURVEY EXISTS AND IT IS ACTIVE, SO LETS GET TO WORK.
     $aData['surveyinfo'] = getSurveyInfo($iSurveyId);
     if (isset($browselang) && $browselang != '') {
         Yii::app()->session['browselang'] = $browselang;
         $aData['language'] = Yii::app()->session['browselang'];
     } elseif (isset(Yii::app()->session['browselang'])) {
         $aData['language'] = Yii::app()->session['browselang'];
         $aData['languagelist'] = $languagelist = Survey::model()->findByPk($iSurveyId)->additionalLanguages;
         $aData['languagelist'][] = Survey::model()->findByPk($iSurveyId)->language;
         if (!in_array($aData['language'], $languagelist)) {
             $aData['language'] = Survey::model()->findByPk($iSurveyId)->language;
         }
     } else {
         $aData['language'] = Survey::model()->findByPk($iSurveyId)->language;
     }
     $aData['qulanguage'] = Survey::model()->findByPk($iSurveyId)->language;
     $aData['surveyoptions'] = '';
     $aData['browseoutput'] = '';
     return $aData;
 }
开发者ID:ryu1inaba,项目名称:LimeSurvey,代码行数:54,代码来源:responses.php


示例3: actiontokens

 function actiontokens($surveyid, $token, $langcode = '')
 {
     Yii::app()->loadHelper('database');
     Yii::app()->loadHelper('sanitize');
     $sLanguageCode = $langcode;
     $iSurveyID = $surveyid;
     $sToken = $token;
     $sToken = sanitize_token($sToken);
     if (!$iSurveyID) {
         $this->redirect(array('/'));
     }
     $iSurveyID = (int) $iSurveyID;
     //Check that there is a SID
     // Get passed language from form, so that we dont loose this!
     if (!isset($sLanguageCode) || $sLanguageCode == "" || !$sLanguageCode) {
         $sBaseLanguage = Survey::model()->findByPk($iSurveyID)->language;
         Yii::import('application.libraries.Limesurvey_lang', true);
         $clang = new Limesurvey_lang($sBaseLanguage);
     } else {
         $sLanguageCode = sanitize_languagecode($sLanguageCode);
         Yii::import('application.libraries.Limesurvey_lang', true);
         $clang = new Limesurvey_lang($sLanguageCode);
         $sBaseLanguage = $sLanguageCode;
     }
     Yii::app()->lang = $clang;
     $aSurveyInfo = getSurveyInfo($iSurveyID, $sBaseLanguage);
     if ($aSurveyInfo == false || !tableExists("{{tokens_{$iSurveyID}}}")) {
         $sMessage = $clang->gT('This survey does not seem to exist.');
     } else {
         $oToken = Token::model($iSurveyID)->findByAttributes(array('token' => $token));
         if (!isset($oToken)) {
             $sMessage = $clang->gT('You are not a participant in this survey.');
         } else {
             if ($oToken->emailstatus == 'OptOut') {
                 $oToken->emailstatus = 'OK';
                 $oToken->save();
                 $sMessage = $clang->gT('You have been successfully added back to this survey.');
             } elseif ($oToken->emailstatus == 'OK') {
                 $sMessage = $clang->gT('You are already a part of this survey.');
             } else {
                 $sMessage = $clang->gT('You have been already removed from this survey.');
             }
         }
     }
     //PRINT COMPLETED PAGE
     if (!$aSurveyInfo['templatedir']) {
         $sTemplate = getTemplatePath(Yii::app()->getConfig("defaulttemplate"));
     } else {
         $sTemplate = getTemplatePath($aSurveyInfo['templatedir']);
     }
     $this->_renderHtml($sMessage, $sTemplate, $clang, $aSurveyInfo);
 }
开发者ID:josetorerobueno,项目名称:test_repo,代码行数:52,代码来源:OptinController.php


示例4: loadSurveyById

 /**
  * Loads a survey from the database that has the given ID.  If no matching
  * survey is found then null is returned.  Note that no results are loaded
  * from this function call, only survey structure/definition.
  *
  * In the future it would be nice to load all languages from the db at
  * once and have the infrastructure be able to return responses based
  * on language codes.
  *
  * @param int $id
  * @return SurveyObj
  */
 public function loadSurveyById($id, $lang = null)
 {
     $survey = new SurveyObj();
     $clang = Yii::app()->lang;
     $intId = sanitize_int($id);
     $survey->id = $intId;
     $survey->info = getSurveyInfo($survey->id);
     $availableLanguages = Survey::model()->findByPk($intId)->getAllLanguages();
     if (is_null($lang) || in_array($lang, $availableLanguages) === false) {
         // use base language when requested language is not found or no specific language is requested
         $lang = Survey::model()->findByPk($intId)->language;
     }
     $clang = new limesurvey_lang($lang);
     $survey->fieldMap = createFieldMap($intId, 'full', true, false, $lang);
     // Check to see if timings are present and add to fieldmap if needed
     if ($survey->info['savetimings'] == "Y") {
         $survey->fieldMap = $survey->fieldMap + createTimingsFieldMap($intId, 'full', true, false, $lang);
     }
     if (empty($intId)) {
         //The id given to us is not an integer, croak.
         safeDie("An invalid survey ID was encountered: {$sid}");
     }
     //Load groups
     $sQuery = 'SELECT g.* FROM {{groups}} AS g ' . 'WHERE g.sid = ' . $intId . ' AND g.language = \'' . $lang . '\' ' . 'ORDER BY g.group_order;';
     $recordSet = Yii::app()->db->createCommand($sQuery)->query()->readAll();
     $survey->groups = $recordSet;
     //Load questions
     $sQuery = 'SELECT q.* FROM {{questions}} AS q ' . 'JOIN {{groups}} AS g ON (q.gid = g.gid and q.language = g.language) ' . 'WHERE q.sid = ' . $intId . ' AND q.language = \'' . $lang . '\' ' . 'ORDER BY g.group_order, q.question_order;';
     $survey->questions = Yii::app()->db->createCommand($sQuery)->query()->readAll();
     //Load answers
     $sQuery = 'SELECT DISTINCT a.* FROM {{answers}} AS a ' . 'JOIN {{questions}} AS q ON a.qid = q.qid ' . 'WHERE q.sid = ' . $intId . ' AND a.language = \'' . $lang . '\' ' . 'ORDER BY a.qid, a.sortorder;';
     //$survey->answers = Yii::app()->db->createCommand($sQuery)->queryAll();
     $aAnswers = Yii::app()->db->createCommand($sQuery)->queryAll();
     foreach ($aAnswers as $aAnswer) {
         if (Yii::app()->controller->action->id != 'remotecontrol') {
             $aAnswer['answer'] = stripTagsFull($aAnswer['answer']);
         }
         $survey->answers[$aAnswer['qid']][$aAnswer['scale_id']][$aAnswer['code']] = $aAnswer;
     }
     //Load language settings for requested language
     $sQuery = 'SELECT * FROM {{surveys_languagesettings}} WHERE surveyls_survey_id = ' . $intId . ' AND surveyls_language = \'' . $lang . '\';';
     $recordSet = Yii::app()->db->createCommand($sQuery)->query();
     $survey->languageSettings = $recordSet->read();
     $recordSet->close();
     if (tableExists('tokens_' . $survey->id) && array_key_exists('token', SurveyDynamic::model($survey->id)->attributes) && Permission::model()->hasSurveyPermission($survey->id, 'tokens', 'read')) {
         // Now add the tokenFields
         $survey->tokenFields = getTokenFieldsAndNames($survey->id);
         unset($survey->tokenFields['token']);
     }
     return $survey;
 }
开发者ID:jdbaltazar,项目名称:survey-office,代码行数:63,代码来源:SurveyDao.php


示例5: actiontokens

 function actiontokens($surveyid, $token, $langcode = '')
 {
     Yii::app()->loadHelper('database');
     Yii::app()->loadHelper('sanitize');
     $sLanguageCode = $langcode;
     $iSurveyID = $surveyid;
     $sToken = $token;
     $sToken = sanitize_token($sToken);
     if (!$iSurveyID) {
         $this->redirect(array('/'));
     }
     $iSurveyID = (int) $iSurveyID;
     //Check that there is a SID
     // Get passed language from form, so that we dont loose this!
     if (!isset($sLanguageCode) || $sLanguageCode == "" || !$sLanguageCode) {
         $sBaseLanguage = Survey::model()->findByPk($iSurveyID)->language;
     } else {
         $sBaseLanguage = sanitize_languagecode($sLanguageCode);
     }
     Yii::app()->setLanguage($sBaseLanguage);
     $aSurveyInfo = getSurveyInfo($iSurveyID, $sBaseLanguage);
     if ($aSurveyInfo == false || !tableExists("{{tokens_{$iSurveyID}}}")) {
         throw new CHttpException(404, "This survey does not seem to exist. It may have been deleted or the link you were given is outdated or incorrect.");
     } else {
         LimeExpressionManager::singleton()->loadTokenInformation($iSurveyID, $token, false);
         $oToken = Token::model($iSurveyID)->findByAttributes(array('token' => $token));
         if (!isset($oToken)) {
             $sMessage = gT('You are not a participant in this survey.');
         } else {
             if ($oToken->emailstatus == 'OptOut') {
                 $oToken->emailstatus = 'OK';
                 $oToken->save();
                 $sMessage = gT('You have been successfully added back to this survey.');
             } elseif ($oToken->emailstatus == 'OK') {
                 $sMessage = gT('You are already a part of this survey.');
             } else {
                 $sMessage = gT('You have been already removed from this survey.');
             }
         }
     }
     //PRINT COMPLETED PAGE
     if (!$aSurveyInfo['templatedir']) {
         $sTemplate = getTemplatePath(Yii::app()->getConfig("defaulttemplate"));
     } else {
         $sTemplate = getTemplatePath($aSurveyInfo['templatedir']);
     }
     $this->_renderHtml($sMessage, $sTemplate, $aSurveyInfo);
 }
开发者ID:wrenchpilot,项目名称:LimeSurvey,代码行数:48,代码来源:OptinController.php


示例6: view

 public function view($iSurveyId)
 {
     $iSurveyId = sanitize_int($iSurveyId);
     $aViewUrls = array();
     if (!Permission::model()->hasSurveyPermission($iSurveyId, 'responses', 'read')) {
         die;
     }
     App()->getClientScript()->registerPackage('jquery-tablesorter');
     App()->getClientScript()->registerScriptFile(Yii::app()->getConfig('adminscripts') . 'saved.js');
     $aThisSurvey = getSurveyInfo($iSurveyId);
     $aData['sSurveyName'] = $aThisSurvey['name'];
     $aData['iSurveyId'] = $iSurveyId;
     $aViewUrls[] = 'savedbar_view';
     $aViewUrls['savedlist_view'][] = $this->_showSavedList($iSurveyId);
     $this->_renderWrappedTemplate('saved', $aViewUrls, $aData);
 }
开发者ID:withhope,项目名称:HIT-Survey,代码行数:16,代码来源:saved.php


示例7: sidebody

 /**
  * Helper function to let a plugin put content
  * into the side-body easily.
  * 
  * @param int $surveyId
  * @param string $plugin Name of the plugin class
  * @param string $method Name of the plugin method
  * @return void
  */
 public function sidebody($surveyId, $plugin, $method)
 {
     $aData = array();
     $surveyId = sanitize_int($surveyId);
     $surveyinfo = getSurveyInfo($surveyId);
     $aData['surveyid'] = $surveyId;
     $aData['surveybar']['buttons']['view'] = true;
     $aData['title_bar']['title'] = $surveyinfo['surveyls_title'] . "(" . gT("ID") . ":" . $surveyId . ")";
     $content = $this->getContent($surveyId, $plugin, $method);
     $aData['sidemenu'] = array();
     $aData['sidemenu']['state'] = false;
     $aData['sideMenuBehaviour'] = getGlobalSetting('sideMenuBehaviour');
     $aData['content'] = $content;
     $aData['activated'] = $surveyinfo['active'];
     $this->_renderWrappedTemplate(null, array('super/sidebody'), $aData);
 }
开发者ID:sickpig,项目名称:LimeSurvey,代码行数:25,代码来源:PluginHelper.php


示例8: index

 public function index()
 {
     $iSurveyID = sanitize_int($_REQUEST['surveyid']);
     $tolang = Yii::app()->getRequest()->getParam('lang');
     $action = Yii::app()->getRequest()->getParam('action');
     $actionvalue = Yii::app()->getRequest()->getPost('actionvalue');
     if ($action == "ajaxtranslategoogleapi") {
         echo $this->translate_google_api();
         return;
     }
     App()->getClientScript()->registerScriptFile(App()->getAssetManager()->publish(ADMIN_SCRIPT_PATH . 'translation.js'));
     $baselang = Survey::model()->findByPk($iSurveyID)->language;
     $langs = Survey::model()->findByPk($iSurveyID)->additionalLanguages;
     Yii::app()->loadHelper("database");
     Yii::app()->loadHelper("admin/htmleditor");
     if (empty($tolang) && count($langs) > 0) {
         $tolang = $langs[0];
     }
     // TODO need to do some validation here on surveyid
     $surveyinfo = getSurveyInfo($iSurveyID);
     $survey_title = $surveyinfo['name'];
     Yii::app()->loadHelper("surveytranslator");
     $supportedLanguages = getLanguageData(FALSE, Yii::app()->session['adminlang']);
     $baselangdesc = $supportedLanguages[$baselang]['description'];
     $aData = array("surveyid" => $iSurveyID, "survey_title" => $survey_title, "tolang" => $tolang, "adminmenu" => $this->showTranslateAdminmenu($iSurveyID, $survey_title, $tolang));
     $aViewUrls['translateheader_view'][] = $aData;
     $tab_names = array("title", "welcome", "group", "question", "subquestion", "answer", "emailinvite", "emailreminder", "emailconfirmation", "emailregistration");
     if (!empty($tolang)) {
         // Only save if the administration user has the correct permission
         if ($actionvalue == "translateSave" && Permission::model()->hasSurveyPermission($iSurveyID, 'translations', 'update')) {
             $this->_translateSave($iSurveyID, $tolang, $baselang, $tab_names);
             Yii::app()->setFlashMessage(gT("Saved"), 'success');
         }
         $tolangdesc = $supportedLanguages[$tolang]['description'];
         // Display tabs with fields to translate, as well as input fields for translated values
         $aViewUrls = array_merge($aViewUrls, $this->_displayUntranslatedFields($iSurveyID, $tolang, $baselang, $tab_names, $baselangdesc, $tolangdesc));
         //var_dump(array_keys($aViewUrls));die();
     }
     $aData['sidemenu']['state'] = false;
     $surveyinfo = Survey::model()->findByPk($iSurveyID)->surveyinfo;
     $aData['title_bar']['title'] = $surveyinfo['surveyls_title'] . "(" . gT("ID") . ":" . $iSurveyID . ")";
     $aData['surveybar']['savebutton']['form'] = 'frmeditgroup';
     $aData['surveybar']['closebutton']['url'] = 'admin/survey/sa/view/surveyid/' . $iSurveyID;
     // Close button
     $this->_renderWrappedTemplate('translate', $aViewUrls, $aData);
 }
开发者ID:joaocc,项目名称:LimeSurvey--LimeSurvey,代码行数:46,代码来源:translate.php


示例9: view

 public function view($iSurveyId)
 {
     $iSurveyId = sanitize_int($iSurveyId);
     $clang = $this->getController()->lang;
     $aViewUrls = array();
     if (!hasSurveyPermission($iSurveyId, 'responses', 'read')) {
         die;
     }
     $this->getController()->_js_admin_includes(Yii::app()->getConfig('generalscripts') . 'jquery/jquery.tablesorter.min.js');
     $this->getController()->_js_admin_includes(Yii::app()->getConfig('adminscripts') . 'saved.js');
     $aThisSurvey = getSurveyInfo($iSurveyId);
     $aData['sSurveyName'] = $aThisSurvey['name'];
     $aData['iSurveyId'] = $iSurveyId;
     $aViewUrls[] = 'savedbar_view';
     $aViewUrls['savedlist_view'][] = $this->_showSavedList($iSurveyId);
     $this->_renderWrappedTemplate('saved', $aViewUrls, $aData);
 }
开发者ID:rawaludin,项目名称:LimeSurvey,代码行数:17,代码来源:saved.php


示例10: view

 public function view($iSurveyId)
 {
     $iSurveyId = sanitize_int($iSurveyId);
     $aViewUrls = array();
     if (!Permission::model()->hasSurveyPermission($iSurveyId, 'responses', 'read')) {
         die;
     }
     $aThisSurvey = getSurveyInfo($iSurveyId);
     $aData['sSurveyName'] = $aThisSurvey['name'];
     $aData['iSurveyId'] = $iSurveyId;
     $aViewUrls[] = 'savedbar_view';
     $aViewUrls['savedlist_view'][] = $this->_showSavedList($iSurveyId);
     // saved.js bugs if table is empty
     if (count($aViewUrls['savedlist_view'][0]['aResults'])) {
         App()->getClientScript()->registerPackage('jquery-tablesorter');
         $this->registerScriptFile('ADMIN_SCRIPT_PATH', 'saved.js');
     }
     $this->_renderWrappedTemplate('saved', $aViewUrls, $aData);
 }
开发者ID:mfavetti,项目名称:LimeSurvey,代码行数:19,代码来源:saved.php


示例11: index

 public function index()
 {
     $iSurveyID = sanitize_int($_REQUEST['surveyid']);
     $tolang = Yii::app()->getRequest()->getParam('lang');
     $action = Yii::app()->getRequest()->getParam('action');
     $actionvalue = Yii::app()->getRequest()->getPost('actionvalue');
     //echo $this->query('title','querybase');
     //die();
     if ($action == "ajaxtranslategoogleapi") {
         echo $this->translate_google_api();
         return;
     }
     App()->getClientScript()->registerScriptFile(Yii::app()->getConfig("adminscripts") . 'translation.js');
     $clang = Yii::app()->lang;
     $baselang = Survey::model()->findByPk($iSurveyID)->language;
     $langs = Survey::model()->findByPk($iSurveyID)->additionalLanguages;
     Yii::app()->loadHelper("database");
     Yii::app()->loadHelper("admin/htmleditor");
     if (empty($tolang) && count($langs) > 0) {
         $tolang = $langs[0];
     }
     // TODO need to do some validation here on surveyid
     $surveyinfo = getSurveyInfo($iSurveyID);
     $survey_title = $surveyinfo['name'];
     Yii::app()->loadHelper("surveytranslator");
     $supportedLanguages = getLanguageData(FALSE, Yii::app()->session['adminlang']);
     $baselangdesc = $supportedLanguages[$baselang]['description'];
     $aData = array("surveyid" => $iSurveyID, "survey_title" => $survey_title, "tolang" => $tolang, "clang" => $clang, "adminmenu" => $this->showTranslateAdminmenu($iSurveyID, $survey_title, $tolang));
     $aViewUrls['translateheader_view'][] = $aData;
     $tab_names = array("title", "welcome", "group", "question", "subquestion", "answer", "emailinvite", "emailreminder", "emailconfirmation", "emailregistration");
     if (!empty($tolang)) {
         // Only save if the administration user has the correct permission
         if ($actionvalue == "translateSave" && Permission::model()->hasSurveyPermission($iSurveyID, 'translations', 'update')) {
             $this->_translateSave($iSurveyID, $tolang, $baselang, $tab_names);
         }
         $tolangdesc = $supportedLanguages[$tolang]['description'];
         // Display tabs with fields to translate, as well as input fields for translated values
         $aViewUrls = array_merge($aViewUrls, $this->_displayUntranslatedFields($iSurveyID, $tolang, $baselang, $tab_names, $baselangdesc, $tolangdesc));
         //var_dump(array_keys($aViewUrls));die();
     }
     $this->_renderWrappedTemplate('translate', $aViewUrls, $aData);
 }
开发者ID:rouben,项目名称:LimeSurvey,代码行数:42,代码来源:translate.php


示例12: _getData

 private function _getData($params)
 {
     if (is_numeric($params)) {
         $iSurveyId = $params;
     } elseif (is_array($params)) {
         extract($params);
     }
     $aData = array();
     // Set the variables in an array
     $aData['surveyid'] = $aData['iSurveyId'] = (int) $iSurveyId;
     if (!empty($iId)) {
         $aData['iId'] = (int) $iId;
     }
     $aData['clang'] = $clang = $this->getController()->lang;
     $aData['imageurl'] = Yii::app()->getConfig('imageurl');
     $aData['action'] = Yii::app()->request->getParam('action');
     $aData['all'] = Yii::app()->request->getParam('all');
     $thissurvey = getSurveyInfo($iSurveyId);
     if (!$thissurvey) {
         Yii::app()->session['flashmessage'] = $clang->gT("Invalid survey ID");
         $this->getController()->redirect(array("admin/index"));
     } elseif ($thissurvey['active'] != 'Y') {
         Yii::app()->session['flashmessage'] = $clang->gT("This survey has not been activated. There are no results to browse.");
         $this->getController()->redirect(array("/admin/survey/sa/view/surveyid/{$iSurveyId}"));
     }
     //OK. IF WE GOT THIS FAR, THEN THE SURVEY EXISTS AND IT IS ACTIVE, SO LETS GET TO WORK.
     $aData['surveyinfo'] = $thissurvey;
     if (Yii::app()->request->getParam('browselang')) {
         $aData['language'] = Yii::app()->request->getParam('browselang');
         $aData['languagelist'] = $languagelist = Survey::model()->findByPk($iSurveyId)->additionalLanguages;
         $aData['languagelist'][] = Survey::model()->findByPk($iSurveyId)->language;
         if (!in_array($aData['language'], $languagelist)) {
             $aData['language'] = $thissurvey['language'];
         }
     } else {
         $aData['language'] = $thissurvey['language'];
     }
     $aData['qulanguage'] = Survey::model()->findByPk($iSurveyId)->language;
     $aData['surveyoptions'] = '';
     $aData['browseoutput'] = '';
     return $aData;
 }
开发者ID:Narasimman,项目名称:UrbanExpansion,代码行数:42,代码来源:responses.php


示例13: setJavascriptVar

 /**
  * setJavascriptVar
  *
  * @return @void
  * @param integer $iSurveyId : the survey id for the script
  */
 public function setJavascriptVar($iSurveyId)
 {
     $aSurveyinfo = getSurveyInfo($iSurveyId, App()->getLanguage());
     if (isset($aSurveyinfo['surveyls_numberformat'])) {
         $aLSJavascriptVar = array();
         $aLSJavascriptVar['bFixNumAuto'] = (int) (bool) Yii::app()->getConfig('bFixNumAuto', 1);
         $aLSJavascriptVar['bNumRealValue'] = (int) (bool) Yii::app()->getConfig('bNumRealValue', 0);
         $aRadix = getRadixPointData($aSurveyinfo['surveyls_numberformat']);
         $aLSJavascriptVar['sLEMradix'] = $aRadix['separator'];
         $sLSJavascriptVar = "LSvar=" . json_encode($aLSJavascriptVar) . ';';
         App()->clientScript->registerScript('sLSJavascriptVar', $sLSJavascriptVar, CClientScript::POS_HEAD);
     }
     // Maybe remove one from index and allow empty $surveyid here.
 }
开发者ID:BertHankes,项目名称:LimeSurvey,代码行数:20,代码来源:SurveyRuntimeHelper.php


示例14: getQuotaInformation

/**
* getQuotaInformation() returns quota information for the current survey
* @param string $surveyid - Survey identification number
* @param string $language - Language of the quota
* @param string $quotaid - Optional quotaid that restricts the result to a given quota
* @return array - nested array, Quotas->Members
*/
function getQuotaInformation($surveyid, $language, $iQuotaID = null)
{
    Yii::log('getQuotaInformation');
    $baselang = Survey::model()->findByPk($surveyid)->language;
    $aAttributes = array('sid' => $surveyid);
    if ((int) $iQuotaID) {
        $aAttributes['id'] = $iQuotaID;
    }
    $aQuotas = Quota::model()->with(array('languagesettings' => array('condition' => "quotals_language='{$language}'")))->findAllByAttributes($aAttributes);
    $aSurveyQuotasInfo = array();
    $x = 0;
    $surveyinfo = getSurveyInfo($surveyid, $language);
    // Check all quotas for the current survey
    if (count($aQuotas) > 0) {
        foreach ($aQuotas as $oQuota) {
            // Array for each quota
            $aQuotaInfo = array_merge($oQuota->attributes, $oQuota->languagesettings[0]->attributes);
            // We have only one language, then we can use first only
            $aQuotaMembers = QuotaMember::model()->findAllByAttributes(array('quota_id' => $oQuota->id));
            $aQuotaInfo['members'] = array();
            if (count($aQuotaMembers) > 0) {
                foreach ($aQuotaMembers as $oQuotaMember) {
                    $oMemberQuestion = Question::model()->findByAttributes(array('qid' => $oQuotaMember->qid, 'language' => $baselang));
                    if ($oMemberQuestion) {
                        $sFieldName = "0";
                        if ($oMemberQuestion->type == "I" || $oMemberQuestion->type == "G" || $oMemberQuestion->type == "Y") {
                            $sFieldName = $surveyid . 'X' . $oMemberQuestion->gid . 'X' . $oQuotaMember->qid;
                            $sValue = $oQuotaMember->code;
                        }
                        if ($oMemberQuestion->type == "L" || $oMemberQuestion->type == "O" || $oMemberQuestion->type == "!") {
                            $sFieldName = $surveyid . 'X' . $oMemberQuestion->gid . 'X' . $oQuotaMember->qid;
                            $sValue = $oQuotaMember->code;
                        }
                        if ($oMemberQuestion->type == "M") {
                            $sFieldName = $surveyid . 'X' . $oMemberQuestion->gid . 'X' . $oQuotaMember->qid . $oQuotaMember->code;
                            $sValue = "Y";
                        }
                        if ($oMemberQuestion->type == "A" || $oMemberQuestion->type == "B") {
                            $temp = explode('-', $oQuotaMember->code);
                            $sFieldName = $surveyid . 'X' . $oMemberQuestion->gid . 'X' . $oQuotaMember->qid . $temp[0];
                            $sValue = $temp[1];
                        }
                        $aQuotaInfo['members'][] = array('title' => $oMemberQuestion->title, 'type' => $oMemberQuestion->type, 'code' => $oQuotaMember->code, 'value' => $sValue, 'qid' => $oQuotaMember->qid, 'fieldname' => $sFieldName);
                    }
                }
            }
            // Push this quota Information to all survey quota
            array_push($aSurveyQuotasInfo, $aQuotaInfo);
        }
    }
    return $aSurveyQuotasInfo;
}
开发者ID:GuillaumeSmaha,项目名称:LimeSurvey,代码行数:59,代码来源:common_helper.php


示例15: _newtokentable

 /**
  * Show dialogs and create a new tokens table
  */
 function _newtokentable($iSurveyId)
 {
     $clang = $this->getController()->lang;
     $aSurveyInfo = getSurveyInfo($iSurveyId);
     if (!Permission::model()->hasSurveyPermission($iSurveyId, 'surveysettings', 'update') && !Permission::model()->hasSurveyPermission($iSurveyId, 'tokens', 'create')) {
         Yii::app()->session['flashmessage'] = $clang->gT("Tokens have not been initialised for this survey.");
         $this->getController()->redirect(array("/admin/survey/sa/view/surveyid/{$iSurveyId}"));
     }
     $bTokenExists = tableExists('{{tokens_' . $iSurveyId . '}}');
     if ($bTokenExists) {
         Yii::app()->session['flashmessage'] = $clang->gT("Tokens already exist for this survey.");
         $this->getController()->redirect(array("/admin/survey/sa/view/surveyid/{$iSurveyId}"));
     }
     // The user have rigth to create token, then don't test right after
     Yii::import('application.helpers.admin.token_helper', true);
     if (Yii::app()->request->getQuery('createtable') == "Y") {
         createTokenTable($iSurveyId);
         LimeExpressionManager::SetDirtyFlag();
         // LimeExpressionManager needs to know about the new token table
         $this->_renderWrappedTemplate('token', array('message' => array('title' => $clang->gT("Token control"), 'message' => $clang->gT("A token table has been created for this survey.") . " (\"" . Yii::app()->db->tablePrefix . "tokens_{$iSurveyId}\")<br /><br />\n" . "<input type='submit' value='" . $clang->gT("Continue") . "' onclick=\"window.open('" . $this->getController()->createUrl("admin/tokens/sa/index/surveyid/{$iSurveyId}") . "', '_top')\" />\n")));
     } elseif (returnGlobal('restoretable') == "Y" && Yii::app()->request->getPost('oldtable')) {
         //Rebuild attributedescription value for the surveys table
         $table = Yii::app()->db->schema->getTable(Yii::app()->request->getPost('oldtable'));
         $fields = array_filter(array_keys($table->columns), 'filterForAttributes');
         $fieldcontents = $aSurveyInfo['attributedescriptions'];
         if (!is_array($fieldcontents)) {
             $fieldcontents = array();
         }
         foreach ($fields as $fieldname) {
             $name = $fieldname;
             if ($fieldname[10] == 'c') {
                 //This belongs to a cpdb attribute
                 $cpdbattid = substr($fieldname, 15);
                 $data = ParticipantAttributeName::model()->getAttributeName($cpdbattid, Yii::app()->session['adminlang']);
                 $name = $data['attribute_name'];
             }
             if (!isset($fieldcontents[$fieldname])) {
                 $fieldcontents[$fieldname] = array('description' => $name, 'mandatory' => 'N', 'show_register' => 'N');
             }
         }
         Survey::model()->updateByPk($iSurveyId, array('attributedescriptions' => serialize($fieldcontents)));
         Yii::app()->db->createCommand()->renameTable(Yii::app()->request->getPost('oldtable'), Yii::app()->db->tablePrefix . "tokens_" . intval($iSurveyId));
         Yii::app()->db->schema->getTable(Yii::app()->db->tablePrefix . "tokens_" . intval($iSurveyId), true);
         // Refresh schema cache just in case the table existed in the past
         //Check that the tokens table has the required fields
         TokenDynamic::model($iSurveyId)->checkColumns();
         //Add any survey_links from the renamed table
         SurveyLink::model()->rebuildLinksFromTokenTable($iSurveyId);
         $this->_renderWrappedTemplate('token', array('message' => array('title' => $clang->gT("Import old tokens"), 'message' => $clang->gT("A token table has been created for this survey and the old tokens were imported.") . " (\"" . Yii::app()->db->tablePrefix . "tokens_{$iSurveyId}" . "\")<br /><br />\n" . "<input type='submit' value='" . $clang->gT("Continue") . "' onclick=\"window.open('" . $this->getController()->createUrl("admin/tokens/sa/index/surveyid/{$iSurveyId}") . "', '_top')\" />\n")));
         LimeExpressionManager::SetDirtyFlag();
         // so that knows that token tables have changed
     } else {
         $this->getController()->loadHelper('database');
         $result = Yii::app()->db->createCommand(dbSelectTablesLike("{{old_tokens_" . intval($iSurveyId) . "_%}}"))->queryAll();
         $tcount = count($result);
         if ($tcount > 0) {
             foreach ($result as $rows) {
                 $oldlist[] = reset($rows);
             }
             $aData['oldlist'] = $oldlist;
         }
         $thissurvey = getSurveyInfo($iSurveyId);
         $aData['thissurvey'] = $thissurvey;
         $aData['surveyid'] = $iSurveyId;
         $aData['tcount'] = $tcount;
         $aData['databasetype'] = Yii::app()->db->getDriverName();
         $this->_renderWrappedTemplate('token', 'tokenwarning', $aData);
     }
 }
开发者ID:josetorerobueno,项目名称:test_repo,代码行数:72,代码来源:tokens.php


示例16: actionView

 /**
  * printanswers::view()
  * View answers at the end of a survey in one place. To export as pdf, set 'usepdfexport' = 1 in lsconfig.php and $printableexport='pdf'.
  * @param mixed $surveyid
  * @param bool $printableexport
  * @return
  */
 function actionView($surveyid, $printableexport = FALSE)
 {
     Yii::app()->loadHelper("frontend");
     Yii::import('application.libraries.admin.pdf');
     $iSurveyID = (int) $surveyid;
     $sExportType = $printableexport;
     Yii::app()->loadHelper('database');
     if (isset($_SESSION['survey_' . $iSurveyID]['sid'])) {
         $iSurveyID = $_SESSION['survey_' . $iSurveyID]['sid'];
     } else {
         //die('Invalid survey/session');
     }
     // Get the survey inforamtion
     // Set the language for dispay
     if (isset($_SESSION['survey_' . $iSurveyID]['s_lang'])) {
         $sLanguage = $_SESSION['survey_' . $iSurveyID]['s_lang'];
     } elseif (Survey::model()->findByPk($iSurveyID)) {
         $sLanguage = Survey::model()->findByPk($iSurveyID)->language;
     } else {
         $iSurveyID = 0;
         $sLanguage = Yii::app()->getConfig("defaultlang");
     }
     $clang = SetSurveyLanguage($iSurveyID, $sLanguage);
     $aSurveyInfo = getSurveyInfo($iSurveyID, $sLanguage);
     //SET THE TEMPLATE DIRECTORY
     if (!isset($aSurveyInfo['templatedir']) || !$aSurveyInfo['templatedir']) {
         $aSurveyInfo['templatedir'] = Yii::app()->getConfig('defaulttemplate');
     }
     $sTemplate = validateTemplateDir($aSurveyInfo['templatedir']);
     //Survey is not finished or don't exist
     if (!isset($_SESSION['survey_' . $iSurveyID]['finished']) || !isset($_SESSION['survey_' . $iSurveyID]['srid'])) {
         sendCacheHeaders();
         doHeader();
         echo templatereplace(file_get_contents(getTemplatePath($sTemplate) . '/startpage.pstpl'), array());
         echo "<center><br />\n" . "\t<font color='RED'><strong>" . $clang->gT("Error") . "</strong></font><br />\n" . "\t" . $clang->gT("We are sorry but your session has expired.") . "<br />" . $clang->gT("Either you have been inactive for too long, you have cookies disabled for your browser, or there were problems with your connection.") . "<br />\n" . "\t" . sprintf($clang->gT("Please contact %s ( %s ) for further assistance."), Yii::app()->getConfig("siteadminname"), Yii::app()->getConfig("siteadminemail")) . "\n" . "</center><br />\n";
         echo templatereplace(file_get_contents(getTemplatePath($sTemplate) . '/endpage.pstpl'), array());
         doFooter();
         exit;
     }
     //Fin session time out
     $sSRID = $_SESSION['survey_' . $iSurveyID]['srid'];
     //I want to see the answers with this id
     //Ensure script is not run directly, avoid path disclosure
     //if (!isset($rootdir) || isset($_REQUEST['$rootdir'])) {die( "browse - Cannot run this script directly");}
     if ($aSurveyInfo['printanswers'] == 'N') {
         die;
         //Die quietly if print answers is not permitted
     }
     //CHECK IF SURVEY IS ACTIVATED AND EXISTS
     $sSurveyName = $aSurveyInfo['surveyls_title'];
     $sAnonymized = $aSurveyInfo['anonymized'];
     //OK. IF WE GOT THIS FAR, THEN THE SURVEY EXISTS AND IT IS ACTIVE, SO LETS GET TO WORK.
     //SHOW HEADER
     $sOutput = CHtml::form(array("printanswers/view/surveyid/{$iSurveyID}/printableexport/pdf"), 'post') . "<center><input type='submit' value='" . $clang->gT("PDF export") . "'id=\"exportbutton\"/><input type='hidden' name='printableexport' /></center></form>";
     if ($sExportType == 'pdf') {
         //require (Yii::app()->getConfig('rootdir').'/application/config/tcpdf.php');
         Yii::import('application.libraries.admin.pdf', true);
         Yii::import('application.helpers.pdfHelper');
         $aPdfLanguageSettings = pdfHelper::getPdfLanguageSettings($clang->langcode);
         $oPDF = new pdf();
         $oPDF->SetTitle($clang->gT("Survey name (ID)", 'unescaped') . ": {$sSurveyName} ({$iSurveyID})");
         $oPDF->SetSubject($sSurveyName);
         $oPDF->SetDisplayMode('fullpage', 'two');
         $oPDF->setLanguageArray($aPdfLanguageSettings['lg']);
         $oPDF->setHeaderFont(array($aPdfLanguageSettings['pdffont'], '', PDF_FONT_SIZE_MAIN));
         $oPDF->setFooterFont(array($aPdfLanguageSettings['pdffont'], '', PDF_FONT_SIZE_DATA));
         $oPDF->SetFont($aPdfLanguageSettings['pdffont'], '', $aPdfLanguageSettings['pdffontsize']);
         $oPDF->AddPage();
         $oPDF->titleintopdf($clang->gT("Survey name (ID)", 'unescaped') . ": {$sSurveyName} ({$iSurveyID})");
     }
     $sOutput .= "\t<div class='printouttitle'><strong>" . $clang->gT("Survey name (ID):") . "</strong> {$sSurveyName} ({$iSurveyID})</div><p>&nbsp;\n";
     LimeExpressionManager::StartProcessingPage(true);
     // means that all variables are on the same page
     // Since all data are loaded, and don't need JavaScript, pretend all from Group 1
     LimeExpressionManager::StartProcessingGroup(1, $aSurveyInfo['anonymized'] != "N", $iSurveyID);
     $printanswershonorsconditions = Yii::app()->getConfig('printanswershonorsconditions');
     $aFullResponseTable = getFullResponseTable($iSurveyID, $sSRID, $sLanguage, $printanswershonorsconditions);
     //Get the fieldmap @TODO: do we need to filter out some fields?
     if ($aSurveyInfo['datestamp'] != "Y" || $sAnonymized == 'Y') {
         unset($aFullResponseTable['submitdate']);
     } else {
         unset($aFullResponseTable['id']);
     }
     unset($aFullResponseTable['token']);
     unset($aFullResponseTable['lastpage']);
     unset($aFullResponseTable['startlanguage']);
     unset($aFullResponseTable['datestamp']);
     unset($aFullResponseTable['startdate']);
     $sOutput .= "<table class='printouttable' >\n";
     foreach ($aFullResponseTable as $sFieldname => $fname) {
         if (substr($sFieldname, 0, 4) == 'gid_') {
             $sOutput .= "\t<tr class='printanswersgroup'><td colspan='2'>{$fname[0]}</td></tr>\n";
         } elseif (substr($sFieldname, 0, 4) == 'qid_') {
//.........这里部分代码省略.........
开发者ID:josetorerobueno,项目名称:test_repo,代码行数:101,代码来源:PrintanswersController.php


示例17: activate


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP getSurveyList函数代码示例发布时间:2022-05-15
下一篇:
PHP getSuffix函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap