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


PHP SurveyLanguageSetting::getErrors方法代码示例

本文整理汇总了PHP中SurveyLanguageSetting::getErrors方法的典型用法代码示例。如果您正苦于以下问题:PHP SurveyLanguageSetting::getErrors方法的具体用法?PHP SurveyLanguageSetting::getErrors怎么用?PHP SurveyLanguageSetting::getErrors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SurveyLanguageSetting的用法示例。


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

示例1: update

 /**
  * Update survey settings with post value
  *
  * @param $iSurveyId  The survey id
  */
 function update($iSurveyId)
 {
     if (!Yii::app()->request->isPostRequest) {
         throw new CHttpException(500);
     }
     if (!Permission::model()->hasSurveyPermission($iSurveyId, 'surveysettings', 'update')) {
         throw new CHttpException(401, "401 Unauthorized");
     }
     // Preload survey
     $oSurvey = Survey::model()->findByPk($iSurveyId);
     // Save plugin settings.
     $pluginSettings = App()->request->getPost('plugin', array());
     foreach ($pluginSettings as $plugin => $settings) {
         $settingsEvent = new PluginEvent('newSurveySettings');
         $settingsEvent->set('settings', $settings);
         $settingsEvent->set('survey', $iSurveyId);
         App()->getPluginManager()->dispatchEvent($settingsEvent, $plugin);
     }
     /* Start to fix some param before save (TODO : use models directly ?) */
     /* Date management */
     Yii::app()->loadHelper('surveytranslator');
     $formatdata = getDateFormatData(Yii::app()->session['dateformat']);
     Yii::app()->loadLibrary('Date_Time_Converter');
     $startdate = App()->request->getPost('startdate');
     if (trim($startdate) == "") {
         $startdate = null;
     } else {
         Yii::app()->loadLibrary('Date_Time_Converter');
         $datetimeobj = new date_time_converter($startdate, $formatdata['phpdate'] . ' H:i');
         //new Date_Time_Converter($startdate,$formatdata['phpdate'].' H:i');
         $startdate = $datetimeobj->convert("Y-m-d H:i:s");
     }
     $expires = App()->request->getPost('expires');
     if (trim($expires) == "") {
         $expires = null;
     } else {
         $datetimeobj = new date_time_converter($expires, $formatdata['phpdate'] . ' H:i');
         //new Date_Time_Converter($expires, $formatdata['phpdate'].' H:i');
         $expires = $datetimeobj->convert("Y-m-d H:i:s");
     }
     // We have $oSurvey : update and save it
     $oSurvey->admin = Yii::app()->request->getPost('admin');
     $oSurvey->expires = $expires;
     $oSurvey->startdate = $startdate;
     $oSurvey->faxto = App()->request->getPost('faxto');
     $oSurvey->format = App()->request->getPost('format');
     $oSurvey->template = Yii::app()->request->getPost('template');
     $oSurvey->assessments = App()->request->getPost('assessments');
     $oSurvey->additional_languages = implode(' ', Yii::app()->request->getPost('additional_languages', array()));
     if ($oSurvey->active != 'Y') {
         $oSurvey->anonymized = App()->request->getPost('anonymized');
         $oSurvey->savetimings = App()->request->getPost('savetimings');
         $oSurvey->datestamp = App()->request->getPost('datestamp');
         $oSurvey->ipaddr = App()->request->getPost('ipaddr');
         $oSurvey->refurl = App()->request->getPost('refurl');
     }
     $oSurvey->publicgraphs = App()->request->getPost('publicgraphs');
     $oSurvey->usecookie = App()->request->getPost('usecookie');
     $oSurvey->allowregister = App()->request->getPost('allowregister');
     $oSurvey->allowsave = App()->request->getPost('allowsave');
     $oSurvey->navigationdelay = App()->request->getPost('navigationdelay');
     $oSurvey->printanswers = App()->request->getPost('printanswers');
     $oSurvey->publicstatistics = App()->request->getPost('publicstatistics');
     $oSurvey->autoredirect = App()->request->getPost('autoredirect');
     $oSurvey->showxquestions = App()->request->getPost('showxquestions');
     $oSurvey->showgroupinfo = App()->request->getPost('showgroupinfo');
     $oSurvey->showqnumcode = App()->request->getPost('showqnumcode');
     $oSurvey->shownoanswer = App()->request->getPost('shownoanswer');
     $oSurvey->showwelcome = App()->request->getPost('showwelcome');
     $oSurvey->allowprev = App()->request->getPost('allowprev');
     $oSurvey->questionindex = App()->request->getPost('questionindex');
     $oSurvey->nokeyboard = App()->request->getPost('nokeyboard');
     $oSurvey->showprogress = App()->request->getPost('showprogress');
     $oSurvey->listpublic = App()->request->getPost('public');
     $oSurvey->htmlemail = App()->request->getPost('htmlemail');
     $oSurvey->sendconfirmation = App()->request->getPost('sendconfirmation');
     $oSurvey->tokenanswerspersistence = App()->request->getPost('tokenanswerspersistence');
     $oSurvey->alloweditaftercompletion = App()->request->getPost('alloweditaftercompletion');
     $oSurvey->usecaptcha = App()->request->getPost('usecaptcha');
     $oSurvey->emailresponseto = App()->request->getPost('emailresponseto');
     $oSurvey->emailnotificationto = App()->request->getPost('emailnotificationto');
     $oSurvey->googleanalyticsapikey = App()->request->getPost('googleanalyticsapikey');
     $oSurvey->googleanalyticsstyle = App()->request->getPost('googleanalyticsstyle');
     $oSurvey->tokenlength = App()->request->getPost('tokenlength');
     $oSurvey->adminemail = App()->request->getPost('adminemail');
     $oSurvey->bounce_email = App()->request->getPost('bounce_email');
     if ($oSurvey->save()) {
         Yii::app()->setFlashMessage(gT("Survey settings were successfully saved."));
     } else {
         Yii::app()->setFlashMessage(gT("Survey could not be updated."), "error");
         tracevar($oSurvey->getErrors());
     }
     /* Reload $oSurvey (language are fixed : need it ?) */
     $oSurvey = Survey::model()->findByPk($iSurveyId);
     /* Delete removed language cleanLanguagesFromSurvey do it already why redo it (cleanLanguagesFromSurvey must be moved to model) ?*/
//.........这里部分代码省略.........
开发者ID:nicbon,项目名称:LimeSurvey,代码行数:101,代码来源:surveyadmin.php

示例2: index


//.........这里部分代码省略.........
                             $oSubQuestion->relevance = isset($aRelevance[$iScaleID][$iPosition]) ? $aRelevance[$iScaleID][$iPosition] : "";
                         } else {
                             $oSubQuestion = Question::model()->find("qid=:qid AND language=:language", array(":qid" => $aInsertQID[$iScaleID][$iPosition], ':language' => $sLanguage));
                             if (!$oSubQuestion) {
                                 $oSubQuestion = new Question();
                             }
                             $oSubQuestion->sid = $iSurveyID;
                             $oSubQuestion->qid = $aInsertQID[$iScaleID][$iPosition];
                             $oSubQuestion->gid = $iQuestionGroupID;
                             $oSubQuestion->question_order = $iPosition + 1;
                             $oSubQuestion->title = $aCodes[$iScaleID][$iPosition];
                             $oSubQuestion->question = $subquestionvalue;
                             $oSubQuestion->parent_qid = $iQuestionID;
                             $oSubQuestion->language = $sLanguage;
                             $oSubQuestion->scale_id = $iScaleID;
                             $oSubQuestion->relevance = isset($aRelevance[$iScaleID][$iPosition]) ? $aRelevance[$iScaleID][$iPosition] : "";
                         }
                     }
                     if ($oSubQuestion->qid) {
                         switchMSSQLIdentityInsert('questions', true);
                         $bSubQuestionResult = $oSubQuestion->save();
                         switchMSSQLIdentityInsert('questions', false);
                     } else {
                         $bSubQuestionResult = $oSubQuestion->save();
                     }
                     if ($bSubQuestionResult) {
                         if (substr($subquestionkey, 0, 3) != 'new' && isset($aOldCodes[$iScaleID][$iPosition]) && $aCodes[$iScaleID][$iPosition] !== $aOldCodes[$iScaleID][$iPosition]) {
                             Condition::model()->updateAll(array('cfieldname' => '+' . $iSurveyID . 'X' . $iQuestionGroupID . 'X' . $iQuestionID . $aCodes[$iScaleID][$iPosition], 'value' => $aCodes[$iScaleID][$iPosition]), 'cqid=:cqid AND cfieldname=:cfieldname AND value=:value', array(':cqid' => $iQuestionID, ':cfieldname' => $iSurveyID . 'X' . $iQuestionGroupID . 'X' . $iQuestionID, ':value' => $aOldCodes[$iScaleID][$iPosition]));
                         }
                         if (!isset($aInsertQID[$iScaleID][$iPosition])) {
                             $aInsertQID[$iScaleID][$iPosition] = $oSubQuestion->qid;
                         }
                     } else {
                         $aErrors = $oSubQuestion->getErrors();
                         if (count($aErrors)) {
                             //$sErrorMessage=gT("Question could not be updated with this errors:");
                             foreach ($aErrors as $sAttribute => $aStringErrors) {
                                 foreach ($aStringErrors as $sStringErrors) {
                                     Yii::app()->setFlashMessage(sprintf(gT("Error on %s for subquestion %s: %s"), $sAttribute, $aCodes[$iScaleID][$iPosition], $sStringErrors), 'error');
                                 }
                             }
                         } else {
                             Yii::app()->setFlashMessage(sprintf(gT("Subquestions %s could not be updated."), $aCodes[$iScaleID][$iPosition]), 'error');
                         }
                     }
                     $iPosition++;
                 }
             }
         }
         LimeExpressionManager::UpgradeConditionsToRelevance($iSurveyID);
         // Do it only if there are no error ?
         if (!isset($aErrors) || !count($aErrors)) {
             if (!Yii::app()->request->getPost('bFullPOST')) {
                 Yii::app()->session['flashmessage'] = gT("Not all subquestions were saved. This usually happens due to server limitations ( PHP setting max_input_vars) - please contact your system administrator.");
             } else {
                 Yii::app()->session['flashmessage'] = gT("Subquestions were successfully saved.");
             }
         }
         //$action='editsubquestions';
         LimeExpressionManager::SetDirtyFlag();
         if ($sDBOutput != '') {
             echo 'Problem in database controller: ' . $sDBOutput;
         } else {
             if (Yii::app()->request->getPost('close-after-save') === 'true') {
                 $this->getController()->redirect(array('/admin/questions/sa/view/surveyid/' . $iSurveyID . '/gid/' . $iQuestionGroupID . '/qid/' . $iQuestionID));
             }
开发者ID:joaocc,项目名称:LimeSurvey--LimeSurvey,代码行数:67,代码来源:database.php


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