本文整理汇总了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) ?*/
//.........这里部分代码省略.........
示例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));
}