本文整理汇总了PHP中getLanguageDetails函数的典型用法代码示例。如果您正苦于以下问题:PHP getLanguageDetails函数的具体用法?PHP getLanguageDetails怎么用?PHP getLanguageDetails使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getLanguageDetails函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add_language
/**
* RPC Routine to add a survey language.
*
* @access public
* @param string $sSessionKey Auth credentials
* @param integer $iSurveyID ID of the survey where a token table will be created for
* @param string $sLanguage A valid language shortcut to add to the current survey. If the language already exists no error will be given.
* @return array Status=>OK when successfull, otherwise the error description
*/
public function add_language($sSessionKey, $iSurveyID, $sLanguage)
{
if ($this->_checkSessionKey($sSessionKey)) {
$oSurvey = Survey::model()->findByPk($iSurveyID);
if (is_null($oSurvey)) {
return array('status' => 'Error: Invalid survey ID');
}
if (Permission::model()->hasSurveyPermission($iSurveyID, 'surveysettings', 'update')) {
Yii::app()->loadHelper('surveytranslator');
$aLanguages = getLanguageData();
if (!isset($aLanguages[$sLanguage])) {
return array('status' => 'Invalid language');
}
$oSurvey = Survey::model()->findByPk($iSurveyID);
if ($sLanguage == $oSurvey->language) {
return array('status' => 'OK');
}
$aLanguages = $oSurvey->getAdditionalLanguages();
$aLanguages[] = $sLanguage;
$aLanguages = array_unique($aLanguages);
$oSurvey->additional_languages = implode(' ', $aLanguages);
try {
$oSurvey->save();
// save the change to database
$languagedetails = getLanguageDetails($sLanguage);
$insertdata = array('surveyls_survey_id' => $iSurveyID, 'surveyls_language' => $sLanguage, 'surveyls_title' => '', 'surveyls_dateformat' => $languagedetails['dateformat']);
$setting = new SurveyLanguageSetting();
foreach ($insertdata as $k => $v) {
$setting->{$k} = $v;
}
$setting->save();
fixLanguageConsistency($iSurveyID, $sLanguage);
return array('status' => 'OK');
} catch (Exception $e) {
return array('status' => 'Error');
}
} else {
return array('status' => 'No permission');
}
}
}
示例2: update
//.........这里部分代码省略.........
$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) ?*/
$aAvailableLanguage = $oSurvey->getAllLanguages();
$oCriteria = new CDbCriteria();
$oCriteria->compare('surveyls_survey_id', $iSurveyId);
$oCriteria->addNotInCondition('surveyls_language', $aAvailableLanguage);
SurveyLanguageSetting::model()->deleteAll($oCriteria);
/* Add new language fixLanguageConsistency do it ?*/
foreach ($oSurvey->additionalLanguages as $sLang) {
if ($sLang) {
$oLanguageSettings = SurveyLanguageSetting::model()->find('surveyls_survey_id=:surveyid AND surveyls_language=:langname', array(':surveyid' => $iSurveyId, ':langname' => $sLang));
if (!$oLanguageSettings) {
$oLanguageSettings = new SurveyLanguageSetting();
$languagedetails = getLanguageDetails($sLang);
$oLanguageSettings->surveyls_survey_id = $iSurveyId;
$oLanguageSettings->surveyls_language = $sLang;
$oLanguageSettings->surveyls_title = '';
// Not in default model ?
$oLanguageSettings->surveyls_dateformat = $languagedetails['dateformat'];
if (!$oLanguageSettings->save()) {
Yii::app()->setFlashMessage(gT("Survey language could not be created."), "error");
tracevar($oLanguageSettings->getErrors());
}
}
}
}
/* Language fix : remove and add question/group */
cleanLanguagesFromSurvey($iSurveyId, implode(" ", $oSurvey->additionalLanguages));
fixLanguageConsistency($iSurveyId, implode(" ", $oSurvey->additionalLanguages));
// Url params in json
$aURLParams = json_decode(Yii::app()->request->getPost('allurlparams'), true);
SurveyURLParameter::model()->deleteAllByAttributes(array('sid' => $iSurveyId));
if (isset($aURLParams)) {
foreach ($aURLParams as $aURLParam) {
$aURLParam['parameter'] = trim($aURLParam['parameter']);
if ($aURLParam['parameter'] == '' || !preg_match('/^[a-zA-Z_][a-zA-Z0-9_]*$/', $aURLParam['parameter']) || $aURLParam['parameter'] == 'sid' || $aURLParam['parameter'] == 'newtest' || $aURLParam['parameter'] == 'token' || $aURLParam['parameter'] == 'lang') {
continue;
// this parameter name seems to be invalid - just ignore it
}
unset($aURLParam['act']);
unset($aURLParam['title']);
unset($aURLParam['id']);
if ($aURLParam['targetqid'] == '') {
$aURLParam['targetqid'] = NULL;
}
if ($aURLParam['targetsqid'] == '') {
$aURLParam['targetsqid'] = NULL;
}
$aURLParam['sid'] = $iSurveyId;
$param = new SurveyURLParameter();
foreach ($aURLParam as $k => $v) {
$param->{$k} = $v;
}
$param->save();
}
}
if (Yii::app()->request->getPost('redirect')) {
$this->getController()->redirect(Yii::app()->request->getPost('redirect'));
App()->end();
}
}
示例3: index
//.........这里部分代码省略.........
$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 = Survey::transcribeCaptchaOptions();
$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) ?*/
$aAvailableLanguage = $oSurvey->getAllLanguages();
$oCriteria = new CDbCriteria();
$oCriteria->compare('surveyls_survey_id', $iSurveyID);
$oCriteria->addNotInCondition('surveyls_language', $aAvailableLanguage);
SurveyLanguageSetting::model()->deleteAll($oCriteria);
/* Add new language fixLanguageConsistency do it ?*/
foreach ($oSurvey->additionalLanguages as $sLang) {
if ($sLang) {
$oLanguageSettings = SurveyLanguageSetting::model()->find('surveyls_survey_id=:surveyid AND surveyls_language=:langname', array(':surveyid' => $iSurveyID, ':langname' => $sLang));
if (!$oLanguageSettings) {
$oLanguageSettings = new SurveyLanguageSetting();
$languagedetails = getLanguageDetails($sLang);
$oLanguageSettings->surveyls_survey_id = $iSurveyID;
$oLanguageSettings->surveyls_language = $sLang;
$oLanguageSettings->surveyls_title = '';
// Not in default model ?
$oLanguageSettings->surveyls_dateformat = $languagedetails['dateformat'];
if (!$oLanguageSettings->save()) {
Yii::app()->setFlashMessage(gT("Survey language could not be created."), "error");
tracevar($oLanguageSettings->getErrors());
}
}
}
}
/* Language fix : remove and add question/group */
cleanLanguagesFromSurvey($iSurveyID, implode(" ", $oSurvey->additionalLanguages));
fixLanguageConsistency($iSurveyID, implode(" ", $oSurvey->additionalLanguages));
// Url params in json
$aURLParams = json_decode(Yii::app()->request->getPost('allurlparams'), true);
SurveyURLParameter::model()->deleteAllByAttributes(array('sid' => $iSurveyID));
if (isset($aURLParams)) {
foreach ($aURLParams as $aURLParam) {
$aURLParam['parameter'] = trim($aURLParam['parameter']);
if ($aURLParam['parameter'] == '' || !preg_match('/^[a-zA-Z_][a-zA-Z0-9_]*$/', $aURLParam['parameter']) || $aURLParam['parameter'] == 'sid' || $aURLParam['parameter'] == 'newtest' || $aURLParam['parameter'] == 'token' || $aURLParam['parameter'] == 'lang') {
continue;
// this parameter name seems to be invalid - just ignore it
}
unset($aURLParam['act']);
unset($aURLParam['title']);
unset($aURLParam['id']);
if ($aURLParam['targetqid'] == '') {
$aURLParam['targetqid'] = NULL;
}
if ($aURLParam['targetsqid'] == '') {
$aURLParam['targetsqid'] = NULL;
}
$aURLParam['sid'] = $iSurveyID;
$param = new SurveyURLParameter();
foreach ($aURLParam as $k => $v) {
$param->{$k} = $v;
}
$param->save();
}
}
////////////////////////////////////////
if ($sDBOutput != '') {
echo $sDBOutput;
} else {
if (Yii::app()->request->getPost('close-after-save') === 'true') {
$this->getController()->redirect(array('admin/survey/sa/view/surveyid/' . $iSurveyID));
}
$this->getController()->redirect(array('/admin/survey/sa/editlocalsettings/surveyid/' . $iSurveyID));
}
}
$this->getController()->redirect(array("/admin"), "refresh");
}
示例4: foreach
// Checked
foreach (GetAdditionalLanguagesFromSurveyID($surveyid) as $langname) {
if ($langname) {
$usquery = "select * from " . db_table_name('surveys_languagesettings') . " where surveyls_survey_id={$postsid} and surveyls_language='" . $langname . "'";
$usresult = $connect->Execute($usquery) or safe_die("Error deleting obsolete surveysettings<br />" . $usquery . "<br /><br /><strong>" . $connect->ErrorMsg());
// Checked
if ($usresult->RecordCount() == 0) {
$bplang = new limesurvey_lang($langname);
$aDefaultTexts = aTemplateDefaultTexts($bplang, 'unescaped');
if (getEmailFormat($surveyid) == "html") {
$ishtml = true;
$aDefaultTexts['admin_detailed_notification'] = $aDefaultTexts['admin_detailed_notification_css'] . $aDefaultTexts['admin_detailed_notification'];
} else {
$ishtml = false;
}
$languagedetails = getLanguageDetails($langname);
$usquery = "INSERT INTO " . db_table_name('surveys_languagesettings') . " (surveyls_survey_id, surveyls_language, surveyls_title, " . " surveyls_email_invite_subj, surveyls_email_invite, " . " surveyls_email_remind_subj, surveyls_email_remind, " . " surveyls_email_confirm_subj, surveyls_email_confirm, " . " surveyls_email_register_subj, surveyls_email_register, " . " email_admin_notification_subj, email_admin_notification, " . " email_admin_responses_subj, email_admin_responses, " . " surveyls_dateformat) " . " VALUES ({$postsid}, '" . $langname . "', ''," . db_quoteall($aDefaultTexts['invitation_subject']) . "," . db_quoteall($aDefaultTexts['invitation']) . "," . db_quoteall($aDefaultTexts['reminder_subject']) . "," . db_quoteall($aDefaultTexts['reminder']) . "," . db_quoteall($aDefaultTexts['confirmation_subject']) . "," . db_quoteall($aDefaultTexts['confirmation']) . "," . db_quoteall($aDefaultTexts['registration_subject']) . "," . db_quoteall($aDefaultTexts['registration']) . "," . db_quoteall($aDefaultTexts['admin_notification_subject']) . "," . db_quoteall($aDefaultTexts['admin_notification']) . "," . db_quoteall($aDefaultTexts['admin_detailed_notification_subject']) . "," . db_quoteall($aDefaultTexts['admin_detailed_notification']) . "," . $languagedetails['dateformat'] . ")";
unset($bplang);
$usresult = $connect->Execute($usquery) or safe_die("Error deleting obsolete surveysettings<br />" . $usquery . "<br /><br />" . $connect->ErrorMsg());
// Checked
}
}
}
if ($usresult) {
$surveyselect = getsurveylist();
$_SESSION['flashmessage'] = $clang->gT("Survey settings were successfully saved.");
} else {
$databaseoutput .= "<script type=\"text/javascript\">\n<!--\n alert(\"" . $clang->gT("Survey could not be updated", "js") . "\n" . $connect->ErrorMsg() . " ({$usquery})\")\n //-->\n</script>\n";
}
} elseif ($action == "updateemailtemplates" && bHasSurveyPermission($surveyid, 'surveylocale', 'update')) {
$_POST = array_map('db_quote', $_POST);
示例5: _generalTabNewSurvey
/**
* survey::_generalTabNewSurvey()
* Load "General" tab of new survey screen.
* @return
*/
private function _generalTabNewSurvey()
{
$clang = $this->getController()->lang;
//Use the current user details for the default administrator name and email for this survey
$user = User::model()->findByPk(Yii::app()->session['loginID']);
$owner = $user->attributes;
//Degrade gracefully to $siteadmin details if anything is missing.
if (empty($owner['full_name'])) {
$owner['full_name'] = getGlobalSetting('siteadminname');
}
if (empty($owner['email'])) {
$owner['email'] = getGlobalSetting('siteadminemail');
}
//Bounce setting by default to global if it set globally
if (getGlobalSetting('bounceaccounttype') != 'off') {
$owner['bounce_email'] = getGlobalSetting('siteadminbounce');
} else {
$owner['bounce_email'] = $owner['email'];
}
$aData['action'] = "newsurvey";
$aData['clang'] = $clang;
$aData['owner'] = $owner;
$aLanguageDetails = getLanguageDetails(Yii::app()->session['adminlang']);
$aData['sRadixDefault'] = $aLanguageDetails['radixpoint'];
$aData['sDateFormatDefault'] = $aLanguageDetails['dateformat'];
foreach (getRadixPointData() as $index => $radixptdata) {
$aRadixPointData[$index] = $radixptdata['desc'];
}
$aData['aRadixPointData'] = $aRadixPointData;
foreach (getDateFormatData(0, Yii::app()->session['adminlang']) as $index => $dateformatdata) {
$aDateFormatData[$index] = $dateformatdata['dateformat'];
}
$aData['aDateFormatData'] = $aDateFormatData;
return $aData;
}
示例6: _checkintegrity
//.........这里部分代码省略.........
}
foreach ($assessments as $assessment) {
$iAssessmentCount = count(QuestionGroup::model()->findAllByPk(array('gid' => $assessment['gid'], 'language' => $assessment['language'])));
if (QuestionGroup::model()->hasErrors()) {
safeDie(QuestionGroup::model()->getError());
}
if (!$iAssessmentCount) {
$aDelete['assessments'][] = array('id' => $assessment['id'], 'assessment' => $assessment['name'], 'reason' => $clang->gT('No matching group'));
}
}
unset($assessments);
/**********************************************************************/
/* Check answers */
/**********************************************************************/
$oCriteria = new CDbCriteria();
$oCriteria->join = 'LEFT JOIN {{questions}} q ON t.qid=q.qid';
$oCriteria->condition = '(q.qid IS NULL)';
$answers = Answer::model()->findAll($oCriteria);
foreach ($answers as $answer) {
$aDelete['answers'][] = array('qid' => $answer['qid'], 'code' => $answer['code'], 'reason' => $clang->gT('No matching question'));
}
/***************************************************************************/
/* Check survey languagesettings and restore them if they don't exist */
/***************************************************************************/
$surveys = Survey::model()->findAll();
foreach ($surveys as $survey) {
$aLanguages = $survey->additionalLanguages;
$aLanguages[] = $survey->language;
foreach ($aLanguages as $langname) {
if ($langname) {
$oLanguageSettings = SurveyLanguageSetting::model()->find('surveyls_survey_id=:surveyid AND surveyls_language=:langname', array(':surveyid' => $survey->sid, ':langname' => $langname));
if (!$oLanguageSettings) {
$oLanguageSettings = new SurveyLanguageSetting();
$languagedetails = getLanguageDetails($langname);
$insertdata = array('surveyls_survey_id' => $survey->sid, 'surveyls_language' => $langname, 'surveyls_title' => '', 'surveyls_dateformat' => $languagedetails['dateformat']);
foreach ($insertdata as $k => $v) {
$oLanguageSettings->{$k} = $v;
}
$usresult = $oLanguageSettings->save();
}
}
}
}
/**********************************************************************/
/* Check survey language settings */
/**********************************************************************/
$surveys = Survey::model()->findAll();
if (Survey::model()->hasErrors()) {
safeDie(Survey::model()->getError());
}
$sids = array();
foreach ($surveys as $survey) {
$sids[] = $survey['sid'];
}
$oCriteria = new CDbCriteria();
$oCriteria->addNotInCondition('surveyls_survey_id', $sids);
$surveys_languagesettings = SurveyLanguageSetting::model()->findAll($oCriteria);
if (SurveyLanguageSetting::model()->hasErrors()) {
safeDie(SurveyLanguageSetting::model()->getError());
}
foreach ($surveys_languagesettings as $surveys_languagesetting) {
$aDelete['surveylanguagesettings'][] = array('slid' => $surveys_languagesetting['surveyls_survey_id'], 'reason' => $clang->gT('The related survey is missing.'));
}
/**********************************************************************/
/* Check questions */
/**********************************************************************/
示例7: index
//.........这里部分代码省略.........
} else {
Yii::app()->loadLibrary('Date_Time_Converter');
$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");
}
$startdate = $_POST['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");
}
//make sure only numbers are passed within the $_POST variable
$tokenlength = (int) $_POST['tokenlength'];
//token length has to be at least 5, otherwise set it to default (15)
if ($tokenlength < 5) {
$tokenlength = 15;
}
cleanLanguagesFromSurvey($surveyid, Yii::app()->request->getPost('languageids'));
fixLanguageConsistency($surveyid, Yii::app()->request->getPost('languageids'));
$template = Yii::app()->request->getPost('template');
if (Yii::app()->session['USER_RIGHT_SUPERADMIN'] != 1 && Yii::app()->session['USER_RIGHT_MANAGE_TEMPLATE'] != 1 && !hasTemplateManageRights(Yii::app()->session['loginID'], $template)) {
$template = "default";
}
$aURLParams = json_decode(Yii::app()->request->getPost('allurlparams'), true);
Survey_url_parameters::model()->deleteAllByAttributes(array('sid' => $surveyid));
foreach ($aURLParams as $aURLParam) {
$aURLParam['parameter'] = trim($aURLParam['parameter']);
if ($aURLParam['parameter'] == '' || !preg_match('/^[a-zA-Z_][a-zA-Z0-9_]*$/', $aURLParam['parameter']) || $aURLParam['parameter'] == 'sid' || $aURLParam['parameter'] == 'newtest' || $aURLParam['parameter'] == 'token' || $aURLParam['parameter'] == 'lang') {
continue;
// this parameter name seems to be invalid - just ignore it
}
unset($aURLParam['act']);
unset($aURLParam['title']);
unset($aURLParam['id']);
if ($aURLParam['targetqid'] == '') {
$aURLParam['targetqid'] = NULL;
}
if ($aURLParam['targetsqid'] == '') {
$aURLParam['targetsqid'] = NULL;
}
$aURLParam['sid'] = $surveyid;
$param = new Survey_url_parameters();
foreach ($aURLParam as $k => $v) {
$param->{$k} = $v;
}
$param->save();
}
$updatearray = array('admin' => Yii::app()->request->getPost('admin'), 'expires' => $expires, 'adminemail' => Yii::app()->request->getPost('adminemail'), 'startdate' => $startdate, 'bounce_email' => Yii::app()->request->getPost('bounce_email'), 'anonymized' => Yii::app()->request->getPost('anonymized'), 'faxto' => Yii::app()->request->getPost('faxto'), 'format' => Yii::app()->request->getPost('format'), 'savetimings' => Yii::app()->request->getPost('savetimings'), 'template' => $template, 'assessments' => Yii::app()->request->getPost('assessments'), 'language' => Yii::app()->request->getPost('language'), 'additional_languages' => Yii::app()->request->getPost('languageids'), 'datestamp' => Yii::app()->request->getPost('datestamp'), 'ipaddr' => Yii::app()->request->getPost('ipaddr'), 'refurl' => Yii::app()->request->getPost('refurl'), 'publicgraphs' => Yii::app()->request->getPost('publicgraphs'), 'usecookie' => Yii::app()->request->getPost('usecookie'), 'allowregister' => Yii::app()->request->getPost('allowregister'), 'allowsave' => Yii::app()->request->getPost('allowsave'), 'navigationdelay' => Yii::app()->request->getPost('navigationdelay'), 'printanswers' => Yii::app()->request->getPost('printanswers'), 'publicstatistics' => Yii::app()->request->getPost('publicstatistics'), 'autoredirect' => Yii::app()->request->getPost('autoredirect'), 'showxquestions' => Yii::app()->request->getPost('showxquestions'), 'showgroupinfo' => Yii::app()->request->getPost('showgroupinfo'), 'showqnumcode' => Yii::app()->request->getPost('showqnumcode'), 'shownoanswer' => Yii::app()->request->getPost('shownoanswer'), 'showwelcome' => Yii::app()->request->getPost('showwelcome'), 'allowprev' => Yii::app()->request->getPost('allowprev'), 'allowjumps' => Yii::app()->request->getPost('allowjumps'), 'nokeyboard' => Yii::app()->request->getPost('nokeyboard'), 'showprogress' => Yii::app()->request->getPost('showprogress'), 'listpublic' => Yii::app()->request->getPost('public'), 'htmlemail' => Yii::app()->request->getPost('htmlemail'), 'sendconfirmation' => Yii::app()->request->getPost('sendconfirmation'), 'tokenanswerspersistence' => Yii::app()->request->getPost('tokenanswerspersistence'), 'alloweditaftercompletion' => Yii::app()->request->getPost('alloweditaftercompletion'), 'usecaptcha' => Yii::app()->request->getPost('usecaptcha'), 'emailresponseto' => trim(Yii::app()->request->getPost('emailresponseto')), 'emailnotificationto' => trim(Yii::app()->request->getPost('emailnotificationto')), 'googleanalyticsapikey' => trim(Yii::app()->request->getPost('googleanalyticsapikey')), 'googleanalyticsstyle' => trim(Yii::app()->request->getPost('googleanalyticsstyle')), 'tokenlength' => $tokenlength);
// use model
$Survey = Survey::model()->findByPk($surveyid);
foreach ($updatearray as $k => $v) {
$Survey->{$k} = $v;
}
$Survey->save();
# Survey::model()->updateByPk($surveyid, $updatearray);
$sqlstring = "surveyls_survey_id=:sid AND surveyls_language <> :base ";
$params = array(':sid' => $surveyid, ':base' => Survey::model()->findByPk($surveyid)->language);
$i = 100000;
foreach (Survey::model()->findByPk($surveyid)->additionalLanguages as $langname) {
if ($langname) {
$sqlstring .= "AND surveyls_language <> :{$i} ";
$params[':' . $i] = $langname;
}
$i++;
}
Surveys_languagesettings::model()->deleteAll($sqlstring, $params);
$usresult = true;
foreach (Survey::model()->findByPk($surveyid)->additionalLanguages as $langname) {
if ($langname) {
$oLanguageSettings = Surveys_languagesettings::model()->find('surveyls_survey_id=:surveyid AND surveyls_language=:langname', array(':surveyid' => $surveyid, ':langname' => $langname));
if (!$oLanguageSettings) {
$oLanguageSettings = new Surveys_languagesettings();
$languagedetails = getLanguageDetails($langname);
$insertdata = array('surveyls_survey_id' => $surveyid, 'surveyls_language' => $langname, 'surveyls_title' => '', 'surveyls_dateformat' => $languagedetails['dateformat']);
foreach ($insertdata as $k => $v) {
$oLanguageSettings->{$k} = $v;
}
$usresult = $oLanguageSettings->save();
}
}
}
if ($usresult) {
Yii::app()->session['flashmessage'] = $clang->gT("Survey settings were successfully saved.");
} else {
Yii::app()->session['flashmessage'] = $clang->gT("Error:") . '<br>' . $clang->gT("Survey could not be updated.");
}
if (Yii::app()->request->getPost('action') == "updatesurveysettingsandeditlocalesettings") {
$this->getController()->redirect($this->getController()->createUrl('admin/survey/sa/editlocalsettings/surveyid/' . $surveyid));
} else {
$this->getController()->redirect($this->getController()->createUrl('admin/survey/sa/view/surveyid/' . $surveyid));
}
}
if (!$action) {
$this->getController()->redirect("/admin", "refresh");
}
}
示例8: index
//.........这里部分代码省略.........
if ($tokenlength < 5) {
$tokenlength = 15;
}
if ($tokenlength > 36) {
$tokenlength = 36;
}
cleanLanguagesFromSurvey($iSurveyID, Yii::app()->request->getPost('languageids'));
fixLanguageConsistency($iSurveyID, Yii::app()->request->getPost('languageids'));
$template = Yii::app()->request->getPost('template');
if (!Permission::model()->hasGlobalPermission('superadmin', 'read') && !Permission::model()->hasGlobalPermission('templates', 'read') && !hasTemplateManageRights(Yii::app()->session['loginID'], $template)) {
$template = "default";
}
$aURLParams = json_decode(Yii::app()->request->getPost('allurlparams'), true);
SurveyURLParameter::model()->deleteAllByAttributes(array('sid' => $iSurveyID));
if (isset($aURLParams)) {
foreach ($aURLParams as $aURLParam) {
$aURLParam['parameter'] = trim($aURLParam['parameter']);
if ($aURLParam['parameter'] == '' || !preg_match('/^[a-zA-Z_][a-zA-Z0-9_]*$/', $aURLParam['parameter']) || $aURLParam['parameter'] == 'sid' || $aURLParam['parameter'] == 'newtest' || $aURLParam['parameter'] == 'token' || $aURLParam['parameter'] == 'lang') {
continue;
// this parameter name seems to be invalid - just ignore it
}
unset($aURLParam['act']);
unset($aURLParam['title']);
unset($aURLParam['id']);
if ($aURLParam['targetqid'] == '') {
$aURLParam['targetqid'] = NULL;
}
if ($aURLParam['targetsqid'] == '') {
$aURLParam['targetsqid'] = NULL;
}
$aURLParam['sid'] = $iSurveyID;
$param = new SurveyURLParameter();
foreach ($aURLParam as $k => $v) {
$param->{$k} = $v;
}
$param->save();
}
}
$updatearray = array('admin' => Yii::app()->request->getPost('admin'), 'expires' => $expires, 'startdate' => $startdate, 'anonymized' => Yii::app()->request->getPost('anonymized'), 'faxto' => Yii::app()->request->getPost('faxto'), 'format' => Yii::app()->request->getPost('format'), 'savetimings' => Yii::app()->request->getPost('savetimings'), 'template' => $template, 'assessments' => Yii::app()->request->getPost('assessments'), 'language' => Yii::app()->request->getPost('language'), 'additional_languages' => Yii::app()->request->getPost('languageids'), 'datestamp' => Yii::app()->request->getPost('datestamp'), 'ipaddr' => Yii::app()->request->getPost('ipaddr'), 'refurl' => Yii::app()->request->getPost('refurl'), 'publicgraphs' => Yii::app()->request->getPost('publicgraphs'), 'usecookie' => Yii::app()->request->getPost('usecookie'), 'allowregister' => Yii::app()->request->getPost('allowregister'), 'allowsave' => Yii::app()->request->getPost('allowsave'), 'navigationdelay' => Yii::app()->request->getPost('navigationdelay'), 'printanswers' => Yii::app()->request->getPost('printanswers'), 'publicstatistics' => Yii::app()->request->getPost('publicstatistics'), 'autoredirect' => Yii::app()->request->getPost('autoredirect'), 'showxquestions' => Yii::app()->request->getPost('showxquestions'), 'showgroupinfo' => Yii::app()->request->getPost('showgroupinfo'), 'showqnumcode' => Yii::app()->request->getPost('showqnumcode'), 'shownoanswer' => Yii::app()->request->getPost('shownoanswer'), 'showwelcome' => Yii::app()->request->getPost('showwelcome'), 'allowprev' => Yii::app()->request->getPost('allowprev'), 'questionindex' => Yii::app()->request->getPost('questionindex'), 'nokeyboard' => Yii::app()->request->getPost('nokeyboard'), 'showprogress' => Yii::app()->request->getPost('showprogress'), 'listpublic' => Yii::app()->request->getPost('public'), 'htmlemail' => Yii::app()->request->getPost('htmlemail'), 'sendconfirmation' => Yii::app()->request->getPost('sendconfirmation'), 'tokenanswerspersistence' => Yii::app()->request->getPost('tokenanswerspersistence'), 'alloweditaftercompletion' => Yii::app()->request->getPost('alloweditaftercompletion'), 'usecaptcha' => Yii::app()->request->getPost('usecaptcha'), 'emailresponseto' => trim(Yii::app()->request->getPost('emailresponseto')), 'emailnotificationto' => trim(Yii::app()->request->getPost('emailnotificationto')), 'googleanalyticsapikey' => trim(Yii::app()->request->getPost('googleanalyticsapikey')), 'googleanalyticsstyle' => trim(Yii::app()->request->getPost('googleanalyticsstyle')), 'tokenlength' => $tokenlength);
$warning = '';
// make sure we only update admin email if it is valid
if (Yii::app()->request->getPost('adminemail', '') == '' || validateEmailAddress(Yii::app()->request->getPost('adminemail'))) {
$updatearray['adminemail'] = Yii::app()->request->getPost('adminemail');
} else {
$warning .= $clang->gT("Warning! Notification email was not updated because it was not valid.") . '<br/>';
}
// make sure we only update bounce email if it is valid
if (Yii::app()->request->getPost('bounce_email', '') == '' || validateEmailAddress(Yii::app()->request->getPost('bounce_email'))) {
$updatearray['bounce_email'] = Yii::app()->request->getPost('bounce_email');
} else {
$warning .= $clang->gT("Warning! Bounce email was not updated because it was not valid.") . '<br/>';
}
// use model
$Survey = Survey::model()->findByPk($iSurveyID);
foreach ($updatearray as $k => $v) {
$Survey->{$k} = $v;
}
$Survey->save();
# Survey::model()->updateByPk($surveyid, $updatearray);
$sqlstring = "surveyls_survey_id=:sid AND surveyls_language <> :base ";
$params = array(':sid' => $iSurveyID, ':base' => Survey::model()->findByPk($iSurveyID)->language);
$i = 100000;
foreach (Survey::model()->findByPk($iSurveyID)->additionalLanguages as $langname) {
if ($langname) {
$sqlstring .= "AND surveyls_language <> :{$i} ";
$params[':' . $i] = $langname;
}
$i++;
}
SurveyLanguageSetting::model()->deleteAll($sqlstring, $params);
$usresult = true;
foreach (Survey::model()->findByPk($iSurveyID)->additionalLanguages as $langname) {
if ($langname) {
$oLanguageSettings = SurveyLanguageSetting::model()->find('surveyls_survey_id=:surveyid AND surveyls_language=:langname', array(':surveyid' => $iSurveyID, ':langname' => $langname));
if (!$oLanguageSettings) {
$oLanguageSettings = new SurveyLanguageSetting();
$languagedetails = getLanguageDetails($langname);
$insertdata = array('surveyls_survey_id' => $iSurveyID, 'surveyls_language' => $langname, 'surveyls_title' => '', 'surveyls_dateformat' => $languagedetails['dateformat']);
foreach ($insertdata as $k => $v) {
$oLanguageSettings->{$k} = $v;
}
$usresult = $oLanguageSettings->save();
}
}
}
if ($usresult) {
Yii::app()->session['flashmessage'] = $warning . $clang->gT("Survey settings were successfully saved.");
} else {
Yii::app()->session['flashmessage'] = $clang->gT("Error:") . '<br>' . $clang->gT("Survey could not be updated.");
}
if (Yii::app()->request->getPost('action') == "updatesurveysettingsandeditlocalesettings") {
$this->getController()->redirect(array('admin/survey/sa/editlocalsettings/surveyid/' . $iSurveyID));
} else {
$this->getController()->redirect(array('admin/survey/sa/view/surveyid/' . $iSurveyID));
}
}
if (!$sAction) {
$this->getController()->redirect(array("/admin"), "refresh");
}
}
示例9: savescript
function savescript($postvars = array())
{
$username = $this->session->userdata('user_name');
if (empty($username) || is_null($username)) {
$this->commonhelper->deletesession($_SERVER['REMOTE_ADDR']);
#die("Error: Session expired kindly re-login");
}
$go_SuccessNewlimesurveycreated = $this->lang->line('go_SuccessNewlimesurveycreated');
$go_Erroronsavingdatacontactyoursupport = $this->lang->line('go_Erroronsavingdatacontactyoursupport');
$go_Errornodatatoprocess = $this->lang->line('go_Errornodatatoprocess');
if (!empty($postvars)) {
if ($postvars['script_type'] == 'default') {
if ($this->commonhelper->checkIfTenant($this->session->userdata('user_group'))) {
$accounts = $this->session->userdata('user_group');
} else {
if (array_key_exists('accounts', $postvars)) {
$accounts = $postvars['accounts'];
} else {
$accounts = $this->session->userdata('user_group');
}
}
$data['vicidial_scripts'] = array('data' => array('script_id' => $postvars['script_id'], 'script_name' => $postvars['script_name'], 'script_comments' => $postvars['script_comments'], 'active' => $postvars['active'], 'script_text' => $postvars['script_text'], 'user_group' => $accounts));
$data['go_scripts'] = array('data' => array('account_num' => $accounts, 'script_id' => $postvars['script_id'], 'campaign_id' => $postvars['campaign_id'], 'surveyid' => ''));
$data['vicidial_campaigns'] = array('data' => array('campaign_script' => $postvars['script_id']), 'condition' => array('campaign_id' => $postvars['campaign_id']));
$result = $this->go_script->savedefaultscript($data);
die($result);
} else {
$rootdir = $this->config->item('lime_path') . "/limesurvey";
require_once $rootdir . '/classes/adodb/adodb.inc.php';
require_once $rootdir . '/common_functions_ci.php';
require_once $rootdir . '/admin/admin_functions.php';
require_once $rootdir . '/classes/core/sanitize.php';
require_once $rootdir . '/classes/core/language.php';
require_once $rootdir . '/admin/classes/core/sha256.php';
$clang = new limesurvey_lang('en');
require_once $rootdir . '/classes/core/surveytranslator_ci.php';
do {
$surveyid = sRandomChars(5, '123456789');
$this->go_script->limesurveyDB->where(array('sid' => $surveyid));
$isexist = $this->go_script->limesurveyDB->get('lime_surveys');
} while ($isexist->num_rows > 0);
$userInfo = $this->go_script->collectfromviciuser($username);
if ($userInfo->num_rows() > 0) {
$userDetail = $userInfo->result();
$viciemail = $userDetail[0]->email;
$viciuseralias = $userDetail[0]->user;
$vicipass = $userDetail[0]->pass;
$vicicompany = $userDetail[0]->full_name;
#$viciuser = $userDetail[0]->user_group;
if ($this->commonhelper->checkIfTenant($this->session->userdata('user_group'))) {
$viciuser = $userDetail[0]->user_group;
} else {
$viciuser = "lime";
}
}
$userInfo = $this->go_script->collectfromlimesurvey($viciuseralias);
$userlevel = $this->session->userdata('users_level');
if ($userInfo->num_rows() < 1) {
# create new limesurvey user
$newUser = array('users_name' => $viciuseralias, 'password' => SHA256::hashing($vicipass), 'full_name' => $vicicompany, 'parent_id' => '1', 'lang' => 'auto', 'email' => $viciemail, 'create_survey' => '1', 'create_user' => '1', 'delete_user' => '1', 'configurator' => '1', 'manage_template' => '1', 'manage_label' => '1');
$this->go_script->insertTolimesurvey($newUser, 'lime_users', $newId);
if (!empty($newId)) {
$this->go_script->insertTolimesurvey(array('uid' => $newId, 'folder' => 'default', 'use' => '1'), 'lime_templates_rights');
}
$uid = $newId;
} else {
$userDetail = $userInfo->result();
$uid = $userDetail[0]->uid;
}
$aDefaultTexts = aTemplateDefaultTexts($clang, 'unescaped');
$languagedetails = getLanguageDetails($postvars['lang'], $clang);
$aDefaultTexts['admin_detailed_notification'] = $aDefaultTexts['admin_detailed_notification_css'] . $aDefaultTexts['admin_detailed_notification'];
$this->go_script->limesurveyDB->where(array('sid' => $surveyid));
$group = $this->go_script->limesurveyDB->get('lime_groups');
$count = $group->num_rows();
$count++;
if ($count < 100) {
$lastGroup = "0{$count}";
} elseif ($count < 10) {
$lastGroup = "00{$count}";
}
$data['limesurvey'] = array('lime_surveys' => array('data' => array(array('sid' => $surveyid, 'owner_id' => $uid, 'admin' => $vicicompany, 'adminemail' => $viciemail, 'active' => 'N', 'format' => 'G', 'language' => $postvars['lang'], 'datecreated' => date('Y-m-d'), 'htmlemail' => 'Y', 'usecaptcha' => 'D', 'bounce_email' => $viciemail))), 'lime_surveys_languagesettings' => array('data' => array(array('surveyls_survey_id' => $surveyid, 'surveyls_language' => $postvars['lang'], 'surveyls_title' => $postvars['script_name'], 'surveyls_email_invite_subj' => str_replace("'", "\\'", str_replace("\n", "<br />", $aDefaultTexts['invitation_subject'])), 'surveyls_email_invite' => str_replace("'", "\\'", str_replace("\n", "<br />", $aDefaultTexts['invitation'])), 'surveyls_email_remind_subj' => str_replace("'", "\\'", str_replace("\n", "<br />", $aDefaultTexts['reminder_subject'])), 'surveyls_email_remind' => str_replace("'", "\\'", str_replace("\n", "<br />", $aDefaultTexts['reminder'])), 'surveyls_email_confirm_subj' => str_replace("'", "\\'", str_replace("\n", "<br />", $aDefaultTexts['confirmation_subject'])), 'surveyls_email_confirm' => str_replace("'", "\\'", str_replace("\n", "<br />", $aDefaultTexts['confirmation'])), 'surveyls_email_register_subj' => str_replace("'", "\\'", str_replace("\n", "<br />", $aDefaultTexts['registration_subject'])), 'surveyls_email_register' => str_replace("'", "\\'", str_replace("\n", "<br />", $aDefaultTexts['registration'])), 'email_admin_notification_subj' => str_replace("'", "\\'", str_replace("\n", "<br />", $aDefaultTexts['admin_notification_subject'])), 'email_admin_notification' => str_replace("'", "\\'", str_replace("\n", "<br />", $aDefaultTexts['admin_notification'])), 'email_admin_responses_subj' => str_replace("'", "\\'", str_replace("\n", "<br />", $aDefaultTexts['admin_detailed_notification_subject'])), 'email_admin_responses' => str_replace("'", "\\'", str_replace("\n", "<br />", $aDefaultTexts['admin_detailed_notification'])), 'surveyls_dateformat' => $languagedetails['dateformat'], 'surveyls_description' => $postvars['script_comments'], 'surveyls_welcometext' => $postvars['welcome_message'], 'surveyls_endtext' => $postvars['end_message'], 'surveyls_url' => $postvars['survey_url'], 'surveyls_urldescription' => $postvars['survey_url_desc']))), 'lime_survey_permissions' => array('data' => array(array('sid' => $surveyid, 'uid' => $uid, 'permission' => 'assessments', 'create_p' => '1', 'read_p' => '1', 'update_p' => '1', 'delete_p' => '1', 'import_p' => '0', 'export_p' => '0'), array('sid' => $surveyid, 'uid' => $uid, 'permission' => 'translations', 'create_p' => '0', 'read_p' => '1', 'update_p' => '1', 'delete_p' => '0', 'import_p' => '0', 'export_p' => '0'), array('sid' => $surveyid, 'uid' => $uid, 'permission' => 'quotas', 'create_p' => '1', 'read_p' => '1', 'update_p' => '1', 'delete_p' => '1', 'import_p' => '0', 'export_p' => '0'), array('sid' => $surveyid, 'uid' => $uid, 'permission' => 'responses', 'create_p' => '1', 'read_p' => '1', 'update_p' => '1', 'delete_p' => '1', 'import_p' => '1', 'export_p' => '1'), array('sid' => $surveyid, 'uid' => $uid, 'permission' => 'statistics', 'create_p' => '0', 'read_p' => '1', 'update_p' => '0', 'delete_p' => '0', 'import_p' => '0', 'export_p' => '0'), array('sid' => $surveyid, 'uid' => $uid, 'permission' => 'surveyactivation', 'create_p' => '0', 'read_p' => '0', 'update_p' => '1', 'delete_p' => '0', 'import_p' => '0', 'export_p' => '0'), array('sid' => $surveyid, 'uid' => $uid, 'permission' => 'surveycontent', 'create_p' => '1', 'read_p' => '1', 'update_p' => '1', 'delete_p' => '1', 'import_p' => '1', 'export_p' => '1'), array('sid' => $surveyid, 'uid' => $uid, 'permission' => 'survey', 'create_p' => '0', 'read_p' => '1', 'update_p' => '0', 'delete_p' => '1', 'import_p' => '0', 'export_p' => '0'), array('sid' => $surveyid, 'uid' => $uid, 'permission' => 'surveylocale', 'create_p' => '0', 'read_p' => '1', 'update_p' => '1', 'delete_p' => '0', 'import_p' => '0', 'export_p' => '0'), array('sid' => $surveyid, 'uid' => $uid, 'permission' => 'surveysecurity', 'create_p' => '1', 'read_p' => '1', 'update_p' => '1', 'delete_p' => '1', 'import_p' => '0', 'export_p' => '0'), array('sid' => $surveyid, 'uid' => $uid, 'permission' => 'surveysettings', 'create_p' => '0', 'read_p' => '1', 'update_p' => '1', 'delete_p' => '0', 'import_p' => '0', 'export_p' => '0'), array('sid' => $surveyid, 'uid' => $uid, 'permission' => 'tokens', 'create_p' => '1', 'read_p' => '1', 'update_p' => '1', 'delete_p' => '1', 'import_p' => '1', 'export_p' => '1'))), 'lime_groups' => array('data' => array(array('sid' => $surveyid, 'group_name' => "{$vicicompany} Group {$lastGroup}", 'description' => "{$vicicompany} Group {$lastGroup}", 'language' => $postvars['lang']))), 'lime_questions' => array('format_data' => array("lime_groups_0"), 'data' => array(array('parent_qid' => '0', 'sid' => $surveyid, 'gid' => "{lime_groups_0}", 'type' => 'T', 'title' => 'Q1', 'question' => 'Lead ID:', 'preg' => '', 'help' => '', 'other' => 'N', 'mandatory' => 'N', 'question_order' => '0', 'language' => $postvars['lang'], 'scale_id' => '0', 'same_default' => '0'), array('parent_qid' => '0', 'sid' => $surveyid, 'gid' => "{lime_groups_0}", 'type' => 'T', 'title' => 'Q2', 'question' => 'Firstname:', 'preg' => '', 'help' => '', 'other' => 'N', 'mandatory' => 'N', 'question_order' => '1', 'language' => $postvars['lang'], 'scale_id' => '0', 'same_default' => '0'), array('parent_qid' => '0', 'sid' => $surveyid, 'gid' => "{lime_groups_0}", 'type' => 'T', 'title' => 'Q3', 'question' => 'Lastname:', 'preg' => '', 'help' => '', 'other' => 'N', 'mandatory' => 'N', 'question_order' => '2', 'language' => $postvars['lang'], 'scale_id' => '0', 'same_default' => '0'), array('parent_qid' => '0', 'sid' => $surveyid, 'gid' => "{lime_groups_0}", 'type' => 'T', 'title' => 'Q4', 'question' => 'Phone Number:', 'preg' => '', 'help' => '', 'other' => 'N', 'mandatory' => 'N', 'question_order' => '3', 'language' => $postvars['lang'], 'scale_id' => '0', 'same_default' => '0'), array('parent_qid' => '0', 'sid' => $surveyid, 'gid' => "{lime_groups_0}", 'type' => 'T', 'title' => 'Q5', 'question' => 'Address:', 'preg' => '', 'help' => '', 'other' => 'N', 'mandatory' => 'N', 'question_order' => '4', 'language' => $postvars['lang'], 'scale_id' => '0', 'same_default' => '0'))));
// end lime survey collected data
$script_text = '<iframe src="' . $this->config->item('base_url') . '/limesurvey/index.php?sid=' . $surveyid . '&lang=' . $postvars['lang'] . '&' . $surveyid . 'X{lime_groups_0}X{lime_questions_0}=--A--lead_id--B--&' . $surveyid . 'X{lime_groups_0}X{lime_questions_1}=--A--first_name--B--&' . $surveyid . 'X{lime_groups_0}X{lime_questions_2}=--A--last_name--B--&' . $surveyid . 'X{lime_groups_0}X{lime_questions_3}=--A--phone_number--B--&' . $surveyid . 'X{lime_groups_0}X{lime_questions_4}=--A--address1--B--&lead_id=--A--lead_id--B--&first_name=--A--first_name--B--&last_name=--A--last_name--B--&phone_number=--A--phone_number--B--&address1=--A--address1--B--" style="background-color:transparent;" scrolling="auto" frameborder="0" allowtransparency="true" id="popupFrame" name="popupFrame" width="--A--script_width--B--" height="--A--script_height--B--" STYLE="z-index:17"></iframe>';
$data['vicidial'] = array('vicidial_scripts' => array('format_data' => array("lime_groups_0", "lime_questions_0", "lime_questions_1", "lime_questions_2", "lime_questions_3", "lime_questions_4"), 'data' => array(array('script_id' => $postvars['script_id'], 'script_name' => $postvars['script_name'], 'script_text' => $script_text, 'active' => 'N', 'user_group' => $viciuser))), 'go_scripts' => array('data' => array(array('account_num' => $viciuser, 'script_id' => $postvars['script_id'], 'campaign_id' => $postvars['campaign_id'], 'surveyid' => $surveyid))), 'vicidial_campaigns' => array('condition' => array("campaign_id" => $postvars['campaign_id']), 'data' => array(array('campaign_script' => $postvars['script_id']))));
// saving the script data
$result = $this->go_script->saveadvancescript($data);
if ($result) {
die('' . $this->lang->line("go_success_new_lime_survey") . '');
//die("Success: New limesurvey created");
} else {
die('' . $this->lang->line("go_error_saving_data_support") . '');
//die("Error on saving data contact your support");
}
}
} else {
die('' . $this->lang->line("go_error_no_data_process") . '');
//die("Error: no data to process");
}
}