本文整理汇总了PHP中SurveyLanguageSetting类的典型用法代码示例。如果您正苦于以下问题:PHP SurveyLanguageSetting类的具体用法?PHP SurveyLanguageSetting怎么用?PHP SurveyLanguageSetting使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SurveyLanguageSetting类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: insert
/**
* Saves the new survey after the creation screen is submitted
*
* @param $iSurveyID The survey id to be used for the new survey. If already taken a new random one will be used.
*/
function insert($iSurveyID = null)
{
if (Permission::model()->hasGlobalPermission('surveys', 'create')) {
// Check if survey title was set
if (!$_POST['surveyls_title']) {
Yii::app()->session['flashmessage'] = gT("Survey could not be created because it did not have a title");
redirect($this->getController()->createUrl('admin'));
return;
}
Yii::app()->loadHelper("surveytranslator");
// If start date supplied convert it to the right format
$aDateFormatData = getDateFormatData(Yii::app()->session['dateformat']);
$sStartDate = $_POST['startdate'];
if (trim($sStartDate) != '') {
Yii::import('application.libraries.Date_Time_Converter');
$converter = new Date_Time_Converter($sStartDate, $aDateFormatData['phpdate'] . ' H:i:s');
$sStartDate = $converter->convert("Y-m-d H:i:s");
}
// If expiry date supplied convert it to the right format
$sExpiryDate = $_POST['expires'];
if (trim($sExpiryDate) != '') {
Yii::import('application.libraries.Date_Time_Converter');
$converter = new Date_Time_Converter($sExpiryDate, $aDateFormatData['phpdate'] . ' H:i:s');
$sExpiryDate = $converter->convert("Y-m-d H:i:s");
}
$iTokenLength = $_POST['tokenlength'];
//token length has to be at least 5, otherwise set it to default (15)
if ($iTokenLength < 5) {
$iTokenLength = 15;
}
if ($iTokenLength > 36) {
$iTokenLength = 36;
}
// Insert base settings into surveys table
$aInsertData = array('expires' => $sExpiryDate, 'startdate' => $sStartDate, 'template' => App()->request->getPost('template'), 'owner_id' => Yii::app()->session['loginID'], 'admin' => App()->request->getPost('admin'), 'active' => 'N', 'anonymized' => App()->request->getPost('anonymized'), 'faxto' => App()->request->getPost('faxto'), 'format' => App()->request->getPost('format'), 'savetimings' => App()->request->getPost('savetimings'), 'language' => App()->request->getPost('language'), 'datestamp' => App()->request->getPost('datestamp'), 'ipaddr' => App()->request->getPost('ipaddr'), 'refurl' => App()->request->getPost('refurl'), 'usecookie' => App()->request->getPost('usecookie'), 'emailnotificationto' => App()->request->getPost('emailnotificationto'), 'allowregister' => App()->request->getPost('allowregister'), 'allowsave' => App()->request->getPost('allowsave'), 'navigationdelay' => App()->request->getPost('navigationdelay'), 'autoredirect' => App()->request->getPost('autoredirect'), 'showxquestions' => App()->request->getPost('showxquestions'), 'showgroupinfo' => App()->request->getPost('showgroupinfo'), 'showqnumcode' => App()->request->getPost('showqnumcode'), 'shownoanswer' => App()->request->getPost('shownoanswer'), 'showwelcome' => App()->request->getPost('showwelcome'), 'allowprev' => App()->request->getPost('allowprev'), 'questionindex' => App()->request->getPost('questionindex'), 'nokeyboard' => App()->request->getPost('nokeyboard'), 'showprogress' => App()->request->getPost('showprogress'), 'printanswers' => App()->request->getPost('printanswers'), 'listpublic' => App()->request->getPost('public'), 'htmlemail' => App()->request->getPost('htmlemail'), 'sendconfirmation' => App()->request->getPost('sendconfirmation'), 'tokenanswerspersistence' => App()->request->getPost('tokenanswerspersistence'), 'alloweditaftercompletion' => App()->request->getPost('alloweditaftercompletion'), 'usecaptcha' => App()->request->getPost('usecaptcha'), 'publicstatistics' => App()->request->getPost('publicstatistics'), 'publicgraphs' => App()->request->getPost('publicgraphs'), 'assessments' => App()->request->getPost('assessments'), 'emailresponseto' => App()->request->getPost('emailresponseto'), 'tokenlength' => $iTokenLength);
$warning = '';
// make sure we only update emails if they are valid
if (Yii::app()->request->getPost('adminemail', '') == '' || validateEmailAddress(Yii::app()->request->getPost('adminemail'))) {
$aInsertData['adminemail'] = Yii::app()->request->getPost('adminemail');
} else {
$aInsertData['adminemail'] = '';
$warning .= gT("Warning! Notification email was not updated because it was not valid.") . '<br/>';
}
if (Yii::app()->request->getPost('bounce_email', '') == '' || validateEmailAddress(Yii::app()->request->getPost('bounce_email'))) {
$aInsertData['bounce_email'] = Yii::app()->request->getPost('bounce_email');
} else {
$aInsertData['bounce_email'] = '';
$warning .= gT("Warning! Bounce email was not updated because it was not valid.") . '<br/>';
}
if (!is_null($iSurveyID)) {
$aInsertData['wishSID'] = $iSurveyID;
}
$iNewSurveyid = Survey::model()->insertNewSurvey($aInsertData);
if (!$iNewSurveyid) {
die('Survey could not be created.');
}
// Prepare locale data for surveys_language_settings table
$sTitle = $_POST['surveyls_title'];
$sDescription = $_POST['description'];
$sWelcome = $_POST['welcome'];
$sURLDescription = $_POST['urldescrip'];
$sTitle = html_entity_decode($sTitle, ENT_QUOTES, "UTF-8");
$sDescription = html_entity_decode($sDescription, ENT_QUOTES, "UTF-8");
$sWelcome = html_entity_decode($sWelcome, ENT_QUOTES, "UTF-8");
$sURLDescription = html_entity_decode($sURLDescription, ENT_QUOTES, "UTF-8");
// Fix bug with FCKEditor saving strange BR types
$sTitle = fixCKeditorText($sTitle);
$sDescription = fixCKeditorText($sDescription);
$sWelcome = fixCKeditorText($sWelcome);
// Insert base language into surveys_language_settings table
$aInsertData = array('surveyls_survey_id' => $iNewSurveyid, 'surveyls_title' => $sTitle, 'surveyls_description' => $sDescription, 'surveyls_welcometext' => $sWelcome, 'surveyls_language' => $_POST['language'], 'surveyls_urldescription' => $_POST['urldescrip'], 'surveyls_endtext' => $_POST['endtext'], 'surveyls_url' => $_POST['url'], 'surveyls_dateformat' => (int) $_POST['dateformat'], 'surveyls_numberformat' => (int) $_POST['numberformat']);
$langsettings = new SurveyLanguageSetting();
$langsettings->insertNewSurvey($aInsertData);
Yii::app()->session['flashmessage'] = $warning . gT("Survey was successfully added.");
// Update survey permissions
Permission::model()->giveAllSurveyPermissions(Yii::app()->session['loginID'], $iNewSurveyid);
$this->getController()->redirect(array('admin/survey/sa/view/surveyid/' . $iNewSurveyid));
}
}
开发者ID:nicbon,项目名称:LimeSurvey,代码行数:84,代码来源:surveyadmin.php
示例2: TSVImportSurvey
//.........这里部分代码省略.........
// Create the survey entry
$surveyinfo['startdate'] = NULL;
$surveyinfo['active'] = 'N';
// unset($surveyinfo['datecreated']);
$iNewSID = Survey::model()->insertNewSurvey($surveyinfo);
//or safeDie($clang->gT("Error").": Failed to insert survey<br />");
if (!$iNewSID) {
$results['error'] = Survey::model()->getErrors();
$results['bFailed'] = true;
return $results;
}
$surveyinfo['sid'] = $iNewSID;
$results['surveys']++;
$results['newsid'] = $iNewSID;
$gid = 0;
$gseq = 0;
// group_order
$qid = 0;
$qseq = 0;
// question_order
$qtype = 'T';
$aseq = 0;
// answer sortorder
// set the language for the survey
$_title = 'Missing Title';
foreach ($surveyls as $_lang => $insertdata) {
$insertdata['surveyls_survey_id'] = $iNewSID;
$insertdata['surveyls_language'] = $_lang;
if (isset($insertdata['surveyls_title'])) {
$_title = $insertdata['surveyls_title'];
} else {
$insertdata['surveyls_title'] = $_title;
}
$result = SurveyLanguageSetting::model()->insertNewSurvey($insertdata);
//
if (!$result) {
$results['error'][] = $clang->gT("Error") . " : " . $clang->gT("Failed to insert survey language");
break;
}
$results['languages']++;
}
$ginfo = array();
$qinfo = array();
$sqinfo = array();
if (isset($surveyinfo['language'])) {
$baselang = $surveyinfo['language'];
// the base language
}
$rownumber = 1;
$lastglang = '';
foreach ($adata as $row) {
$rownumber += 1;
switch ($row['class']) {
case 'G':
// insert group
$insertdata = array();
$insertdata['sid'] = $iNewSID;
$gname = !empty($row['name']) ? $row['name'] : 'G' . $gseq;
$glang = !empty($row['language']) ? $row['language'] : $baselang;
// when a multi-lang tsv-file without information on the group id/number (old style) is imported,
// we make up this information by giving a number 0..[numberofgroups-1] per language.
// the number and order of groups per language should be the same, so we can also import these files
if ($lastglang != $glang) {
$iGroupcounter = 0;
}
$lastglang = $glang;
开发者ID:rouben,项目名称:LimeSurvey,代码行数:67,代码来源:import_helper.php
示例3: list_surveys
/**
* RPC Routine to list the ids and info of surveys belonging to a user.
* Returns array of ids and info.
* If user is admin he can get surveys of every user (parameter sUser) or all surveys (sUser=null)
* Else only the syrveys belonging to the user requesting will be shown.
*
* @access public
* @param string $sSessionKey Auth credentials
* @param string $sUser Optional username to get list of surveys
* @return array The list of surveys
*/
public function list_surveys($sSessionKey, $sUsername = NULL)
{
if ($this->_checkSessionKey($sSessionKey)) {
$oSurvey = new Survey();
if (!Permission::model()->hasGlobalPermission('superadmin', 'read') && $sUsername == null) {
$oSurvey->permission(Yii::app()->user->getId());
} elseif ($sUsername != null) {
$aUserData = User::model()->findByAttributes(array('users_name' => $sUsername));
if (!isset($aUserData)) {
return array('status' => 'Invalid user');
} else {
$sUid = $aUserData->attributes['uid'];
}
$oSurvey->permission($sUid);
}
$aUserSurveys = $oSurvey->with(array('languagesettings' => array('condition' => 'surveyls_language=language'), 'owner'))->findAll();
if (count($aUserSurveys) == 0) {
return array('status' => 'No surveys found');
}
foreach ($aUserSurveys as $oSurvey) {
$oSurveyLanguageSettings = SurveyLanguageSetting::model()->findByAttributes(array('surveyls_survey_id' => $oSurvey->primaryKey, 'surveyls_language' => $oSurvey->language));
if (!isset($oSurveyLanguageSettings)) {
$aSurveyTitle = '';
} else {
$aSurveyTitle = $oSurveyLanguageSettings->attributes['surveyls_title'];
}
$aData[] = array('sid' => $oSurvey->primaryKey, 'surveyls_title' => $aSurveyTitle, 'startdate' => $oSurvey->attributes['startdate'], 'expires' => $oSurvey->attributes['expires'], 'active' => $oSurvey->attributes['active']);
}
return $aData;
} else {
return array('status' => 'Invalid session key');
}
}
开发者ID:kasutori,项目名称:LimeSurvey,代码行数:44,代码来源:remotecontrol_handle.php
示例4: update
/**
* Function responsible to process any change in email template.
* @return
*/
function update($iSurveyId)
{
$uploadUrl = Yii::app()->getBaseUrl(true) . substr(Yii::app()->getConfig('uploadurl'), strlen(Yii::app()->getConfig('publicurl')) - 1);
// We need the real path since we check that the resolved file name starts with this path.
$uploadDir = realpath(Yii::app()->getConfig('uploaddir'));
$sSaveMethod = Yii::app()->request->getPost('save', '');
$clang = $this->getController()->lang;
if (Permission::model()->hasSurveyPermission($iSurveyId, 'surveylocale', 'update') && $sSaveMethod != '') {
$languagelist = Survey::model()->findByPk($iSurveyId)->additionalLanguages;
$languagelist[] = Survey::model()->findByPk($iSurveyId)->language;
array_filter($languagelist);
foreach ($languagelist as $langname) {
if (isset($_POST['attachments'][$langname])) {
foreach ($_POST['attachments'][$langname] as $template => &$attachments) {
foreach ($attachments as $index => &$attachment) {
// We again take the real path.
$localName = realpath(urldecode(str_replace($uploadUrl, $uploadDir, $attachment['url'])));
if ($localName !== false) {
if (strpos($localName, $uploadDir) === 0) {
$attachment['url'] = $localName;
$attachment['size'] = filesize($localName);
} else {
unset($attachments[$index]);
}
} else {
unset($attachments[$index]);
}
}
unset($attachments);
}
} else {
$_POST['attachments'][$langname] = array();
}
$attributes = array('surveyls_email_invite_subj' => $_POST['email_invitation_subj_' . $langname], 'surveyls_email_invite' => $_POST['email_invitation_' . $langname], 'surveyls_email_remind_subj' => $_POST['email_reminder_subj_' . $langname], 'surveyls_email_remind' => $_POST['email_reminder_' . $langname], 'surveyls_email_register_subj' => $_POST['email_registration_subj_' . $langname], 'surveyls_email_register' => $_POST['email_registration_' . $langname], 'surveyls_email_confirm_subj' => $_POST['email_confirmation_subj_' . $langname], 'surveyls_email_confirm' => $_POST['email_confirmation_' . $langname], 'email_admin_notification_subj' => $_POST['email_admin_notification_subj_' . $langname], 'email_admin_notification' => $_POST['email_admin_notification_' . $langname], 'email_admin_responses_subj' => $_POST['email_admin_detailed_notification_subj_' . $langname], 'email_admin_responses' => $_POST['email_admin_detailed_notification_' . $langname], 'attachments' => serialize($_POST['attachments'][$langname]));
$usquery = SurveyLanguageSetting::model()->updateAll($attributes, 'surveyls_survey_id = :ssid AND surveyls_language = :sl', array(':ssid' => $iSurveyId, ':sl' => $langname));
}
Yii::app()->session['flashmessage'] = $clang->gT("Email templates successfully saved.");
$this->getController()->redirect(array('admin/emailtemplates/sa/index/surveyid/' . $iSurveyId));
}
if ($sSaveMethod == 'saveclose') {
$this->getController()->redirect(array('admin/survey/sa/view/surveyid/' . $iSurveyId));
} else {
self::index($iSurveyId);
}
}
开发者ID:rouben,项目名称:LimeSurvey,代码行数:49,代码来源:emailtemplates.php
示例5: query
private function query($type, $action, $iSurveyID, $tolang, $baselang, $id1 = "", $id2 = "", $iScaleID = "", $new = "")
{
$amTypeOptions = array();
switch ($action) {
case "queryto":
$baselang = $tolang;
case "querybase":
switch ($type) {
case 'title':
case 'description':
case 'welcome':
case 'end':
case 'emailinvite':
case 'emailinvitebody':
case 'emailreminder':
case 'emailreminderbody':
case 'emailconfirmation':
case 'emailconfirmationbody':
case 'emailregistration':
case 'emailregistrationbody':
case 'email_confirm':
case 'email_confirmbody':
return SurveyLanguageSetting::model()->findAllByPk(array('surveyls_survey_id' => $iSurveyID, 'surveyls_language' => $baselang));
case 'group':
case 'group_desc':
return QuestionGroup::model()->findAllByAttributes(array('sid' => $iSurveyID, 'language' => $baselang), array('order' => 'gid'));
case 'question':
case 'question_help':
return Question::model()->with('parents', 'groups')->findAllByAttributes(array('sid' => $iSurveyID, 'language' => $baselang, 'parent_qid' => 0), array('order' => 'groups.group_order, t.question_order, t.scale_id'));
case 'subquestion':
return Question::model()->with('parents', 'groups')->findAllByAttributes(array('sid' => $iSurveyID, 'language' => $baselang), array('order' => 'groups.group_order, parents.question_order, t.scale_id, t.question_order', 'condition' => 'parents.language=:baselang1 AND groups.language=:baselang2 AND t.parent_qid>0', 'params' => array(':baselang1' => $baselang, ':baselang2' => $baselang)));
case 'answer':
return Answer::model()->with('questions', 'groups')->findAllByAttributes(array('language' => $baselang), array('order' => 'groups.group_order, questions.question_order, t.scale_id, t.sortorder', 'condition' => 'questions.sid=:sid AND questions.language=:baselang1 AND groups.language=:baselang2', 'params' => array(':baselang1' => $baselang, ':baselang2' => $baselang, ':sid' => $iSurveyID)));
}
case "queryupdate":
switch ($type) {
case 'title':
return SurveyLanguageSetting::model()->updateByPk(array('surveyls_survey_id' => $iSurveyID, 'surveyls_language' => $tolang), array('surveyls_title' => $new));
case 'description':
return SurveyLanguageSetting::model()->updateByPk(array('surveyls_survey_id' => $iSurveyID, 'surveyls_language' => $tolang), array('surveyls_description' => $new));
case 'welcome':
return SurveyLanguageSetting::model()->updateByPk(array('surveyls_survey_id' => $iSurveyID, 'surveyls_language' => $tolang), array('surveyls_welcometext' => $new));
case 'end':
return SurveyLanguageSetting::model()->updateByPk(array('surveyls_survey_id' => $iSurveyID, 'surveyls_language' => $tolang), array('surveyls_endtext' => $new));
case 'emailinvite':
return SurveyLanguageSetting::model()->updateByPk(array('surveyls_survey_id' => $iSurveyID, 'surveyls_language' => $tolang), array('surveyls_email_invite_subj' => $new));
case 'emailinvitebody':
return SurveyLanguageSetting::model()->updateByPk(array('surveyls_survey_id' => $iSurveyID, 'surveyls_language' => $tolang), array('surveyls_email_invite' => $new));
case 'emailreminder':
return SurveyLanguageSetting::model()->updateByPk(array('surveyls_survey_id' => $iSurveyID, 'surveyls_language' => $tolang), array('surveyls_email_remind_subj' => $new));
case 'emailreminderbody':
return SurveyLanguageSetting::model()->updateByPk(array('surveyls_survey_id' => $iSurveyID, 'surveyls_language' => $tolang), array('surveyls_email_remind' => $new));
case 'emailconfirmation':
return SurveyLanguageSetting::model()->updateByPk(array('surveyls_survey_id' => $iSurveyID, 'surveyls_language' => $tolang), array('surveyls_email_confirm_subj' => $new));
case 'emailconfirmationbody':
return SurveyLanguageSetting::model()->updateByPk(array('surveyls_survey_id' => $iSurveyID, 'surveyls_language' => $tolang), array('surveyls_email_confirm' => $new));
case 'emailregistration':
return SurveyLanguageSetting::model()->updateByPk(array('surveyls_survey_id' => $iSurveyID, 'surveyls_language' => $tolang), array('surveyls_email_register_subj' => $new));
case 'emailregistrationbody':
return SurveyLanguageSetting::model()->updateByPk(array('surveyls_survey_id' => $iSurveyID, 'surveyls_language' => $tolang), array('surveyls_email_register' => $new));
case 'email_confirm':
return SurveyLanguageSetting::model()->updateByPk(array('surveyls_survey_id' => $iSurveyID, 'surveyls_language' => $tolang), array('surveyls_email_confirm_subject' => $new));
case 'email_confirmbody':
return SurveyLanguageSetting::model()->updateByPk(array('surveyls_survey_id' => $iSurveyID, 'surveyls_language' => $tolang), array('surveyls_email_confirm' => $new));
case 'group':
return QuestionGroup::model()->updateByPk(array('gid' => $id1, 'language' => $tolang), array('group_name' => $new), 'sid=:sid', array(':sid' => $iSurveyID));
case 'group_desc':
return QuestionGroup::model()->updateByPk(array('gid' => $id1, 'language' => $tolang), array('description' => $new), 'sid=:sid', array(':sid' => $iSurveyID));
case 'question':
return Question::model()->updateByPk(array('qid' => $id1, 'language' => $tolang), array('question' => $new), 'sid=:sid AND parent_qid=0', array(':sid' => $iSurveyID));
case 'question_help':
return Question::model()->updateByPk(array('qid' => $id1, 'language' => $tolang), array('help' => $new), 'sid=:sid AND parent_qid=0', array(':sid' => $iSurveyID));
case 'subquestion':
return Question::model()->updateByPk(array('qid' => $id1, 'language' => $tolang), array('question' => $new), 'sid=:sid', array(':sid' => $iSurveyID));
case 'answer':
return Answer::model()->updateByPk(array('qid' => $id1, 'code' => $id2, 'language' => $tolang, 'scale_id' => $iScaleID), array('answer' => $new));
}
}
}
开发者ID:joaocc,项目名称:LimeSurvey--LimeSurvey,代码行数:79,代码来源:translate.php
示例6: emailTokens
/**
* Sends email to tokens - invitation and reminders
*
* @param mixed $iSurveyID
* @param array $aResultTokens
* @param string $sType type of notification invite|register|remind
* @return array of results
*/
function emailTokens($iSurveyID, $aResultTokens, $sType)
{
Yii::app()->loadHelper('common');
$oSurvey = Survey::model()->findByPk($iSurveyID);
if (getEmailFormat($iSurveyID) == 'html') {
$bHtml = true;
} else {
$bHtml = false;
}
$attributes = array_keys(getTokenFieldsAndNames($iSurveyID));
$oSurveyLocale = SurveyLanguageSetting::model()->findAllByAttributes(array('surveyls_survey_id' => $iSurveyID));
$oTokens = Token::model($iSurveyID);
$aSurveyLangs = $oSurvey->additionalLanguages;
array_unshift($aSurveyLangs, $oSurvey->language);
//Convert result to associative array to minimize SurveyLocale access attempts
foreach ($oSurveyLocale as $rows) {
$oTempObject = array();
foreach ($rows as $k => $v) {
$oTempObject[$k] = $v;
}
$aSurveyLocaleData[$rows['surveyls_language']] = $oTempObject;
}
foreach ($aResultTokens as $aTokenRow) {
//Select language
$aTokenRow['language'] = trim($aTokenRow['language']);
$found = array_search($aTokenRow['language'], $aSurveyLangs);
if ($aTokenRow['language'] == '' || $found == false) {
$aTokenRow['language'] = $oSurvey['language'];
}
$sTokenLanguage = $aTokenRow['language'];
//Build recipient
$to = array();
$aEmailaddresses = explode(';', $aTokenRow['email']);
foreach ($aEmailaddresses as $sEmailaddress) {
$to[] = $aTokenRow['firstname'] . " " . $aTokenRow['lastname'] . " <{$sEmailaddress}>";
}
//Populate attributes
$fieldsarray["{SURVEYNAME}"] = $aSurveyLocaleData[$sTokenLanguage]['surveyls_title'];
if ($fieldsarray["{SURVEYNAME}"] == '') {
$fieldsarray["{SURVEYNAME}"] = $aSurveyLocaleData[$oSurvey['language']]['surveyls_title'];
}
$fieldsarray["{SURVEYDESCRIPTION}"] = $aSurveyLocaleData[$sTokenLanguage]['surveyls_description'];
if ($fieldsarray["{SURVEYDESCRIPTION}"] == '') {
$fieldsarray["{SURVEYDESCRIPTION}"] = $aSurveyLocaleData[$oSurvey['language']]['surveyls_description'];
}
$fieldsarray["{ADMINNAME}"] = $oSurvey['admin'];
$fieldsarray["{ADMINEMAIL}"] = $oSurvey['adminemail'];
$from = $fieldsarray["{ADMINNAME}"] . ' <' . $fieldsarray["{ADMINEMAIL}"] . '>';
if ($from == '') {
$from = Yii::app()->getConfig('siteadminemail');
}
foreach ($attributes as $attributefield) {
$fieldsarray['{' . strtoupper($attributefield) . '}'] = $aTokenRow[$attributefield];
$fieldsarray['{TOKEN:' . strtoupper($attributefield) . '}'] = $aTokenRow[$attributefield];
}
//create urls
$fieldsarray["{OPTOUTURL}"] = Yii::app()->getController()->createAbsoluteUrl("/optout/tokens/langcode/" . trim($aTokenRow['language']) . "/surveyid/{$iSurveyID}/token/{$aTokenRow['token']}");
$fieldsarray["{OPTINURL}"] = Yii::app()->getController()->createAbsoluteUrl("/optin/tokens/langcode/" . trim($aTokenRow['language']) . "/surveyid/{$iSurveyID}/token/{$aTokenRow['token']}");
$fieldsarray["{SURVEYURL}"] = Yii::app()->getController()->createAbsoluteUrl("/survey/index/sid/{$iSurveyID}/token/{$aTokenRow['token']}/lang/" . trim($aTokenRow['language']) . "/");
if ($bHtml) {
foreach (array('OPTOUT', 'OPTIN', 'SURVEY') as $key) {
$url = $fieldsarray["{{$key}URL}"];
$fieldsarray["{{$key}URL}"] = "<a href='{$url}'>" . htmlspecialchars($url) . '</a>';
if ($key == 'SURVEY') {
$barebone_link = $url;
}
}
}
//mail headers
$customheaders = array('1' => "X-surveyid: " . $iSurveyID, '2' => "X-tokenid: " . $fieldsarray["{TOKEN}"]);
global $maildebug;
//choose appriopriate email message
if ($sType == 'invite') {
$sSubject = $aSurveyLocaleData[$sTokenLanguage]['surveyls_email_invite_subj'];
$sMessage = $aSurveyLocaleData[$sTokenLanguage]['surveyls_email_invite'];
} else {
if ($sType == 'register') {
$sSubject = $aSurveyLocaleData[$sTokenLanguage]['surveyls_email_register_subj'];
$sMessage = $aSurveyLocaleData[$sTokenLanguage]['surveyls_email_register'];
} else {
$sSubject = $aSurveyLocaleData[$sTokenLanguage]['surveyls_email_remind_subj'];
$sMessage = $aSurveyLocaleData[$sTokenLanguage]['surveyls_email_remind'];
}
}
$modsubject = Replacefields($sSubject, $fieldsarray);
$modmessage = Replacefields($sMessage, $fieldsarray);
if (isset($barebone_link)) {
$modsubject = str_replace("@@SURVEYURL@@", $barebone_link, $modsubject);
$modmessage = str_replace("@@SURVEYURL@@", $barebone_link, $modmessage);
}
if (isset($aTokenRow['validfrom']) && trim($aTokenRow['validfrom']) != '' && convertDateTimeFormat($aTokenRow['validfrom'], 'Y-m-d H:i:s', 'U') * 1 > date('U') * 1) {
$aResult[$aTokenRow['tid']] = array('name' => $fieldsarray["{FIRSTNAME}"] . " " . $fieldsarray["{LASTNAME}"], 'email' => $fieldsarray["{EMAIL}"], 'status' => 'fail', 'error' => 'Token not valid yet');
//.........这里部分代码省略.........
开发者ID:withhope,项目名称:HIT-Survey,代码行数:101,代码来源:token_helper.php
示例7: index
//.........这里部分代码省略.........
if (Yii::app()->request->getPost('redirection') == "edit") {
$this->getController()->redirect(array('admin/questions/sa/editquestion/surveyid/' . $iSurveyID . '/gid/' . $iQuestionGroupID . '/qid/' . $iQuestionID));
} else {
$this->getController()->redirect(array('admin/survey/sa/view/surveyid/' . $iSurveyID . '/gid/' . $iQuestionGroupID . '/qid/' . $iQuestionID));
}
}
}
if ($sAction == "updatesurveylocalesettings" && Permission::model()->hasSurveyPermission($iSurveyID, 'surveylocale', 'update')) {
$languagelist = Survey::model()->findByPk($iSurveyID)->additionalLanguages;
$languagelist[] = Survey::model()->findByPk($iSurveyID)->language;
Yii::app()->loadHelper('database');
foreach ($languagelist as $langname) {
if ($langname) {
$url = Yii::app()->request->getPost('url_' . $langname);
if ($url == 'http://') {
$url = "";
}
$short_title = html_entity_decode(Yii::app()->request->getPost('short_title_' . $langname), ENT_QUOTES, "UTF-8");
$description = html_entity_decode(Yii::app()->request->getPost('description_' . $langname), ENT_QUOTES, "UTF-8");
$welcome = html_entity_decode(Yii::app()->request->getPost('welcome_' . $langname), ENT_QUOTES, "UTF-8");
$endtext = html_entity_decode(Yii::app()->request->getPost('endtext_' . $langname), ENT_QUOTES, "UTF-8");
$sURLDescription = html_entity_decode(Yii::app()->request->getPost('urldescrip_' . $langname), ENT_QUOTES, "UTF-8");
$sURL = html_entity_decode(Yii::app()->request->getPost('url_' . $langname), ENT_QUOTES, "UTF-8");
// Fix bug with FCKEditor saving strange BR types
$short_title = Yii::app()->request->getPost('short_title_' . $langname);
$description = Yii::app()->request->getPost('description_' . $langname);
$welcome = Yii::app()->request->getPost('welcome_' . $langname);
$endtext = Yii::app()->request->getPost('endtext_' . $langname);
$short_title = fixCKeditorText($short_title);
$description = fixCKeditorText($description);
$welcome = fixCKeditorText($welcome);
$endtext = fixCKeditorText($endtext);
$data = array('surveyls_title' => $short_title, 'surveyls_description' => $description, 'surveyls_welcometext' => $welcome, 'surveyls_endtext' => $endtext, 'surveyls_url' => $sURL, 'surveyls_urldescription' => $sURLDescription, 'surveyls_dateformat' => Yii::app()->request->getPost('dateformat_' . $langname), 'surveyls_numberformat' => Yii::app()->request->getPost('numberformat_' . $langname));
$SurveyLanguageSetting = SurveyLanguageSetting::model()->findByPk(array('surveyls_survey_id' => $iSurveyID, 'surveyls_language' => $langname));
$SurveyLanguageSetting->attributes = $data;
$SurveyLanguageSetting->save();
// save the change to database
}
}
Yii::app()->session['flashmessage'] = $clang->gT("Survey text elements successfully saved.");
if ($sDBOutput != '') {
echo $sDBOutput;
} else {
$this->getController()->redirect(array('admin/survey/sa/view/surveyid/' . $iSurveyID));
}
}
if (($sAction == "updatesurveysettingsandeditlocalesettings" || $sAction == "updatesurveysettings") && Permission::model()->hasSurveyPermission($iSurveyID, 'surveysettings', 'update')) {
// 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);
}
Yii::app()->loadHelper('surveytranslator');
Yii::app()->loadHelper('database');
$formatdata = getDateFormatData(Yii::app()->session['dateformat']);
$expires = $_POST['expires'];
if (trim($expires) == "") {
$expires = null;
} 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");
开发者ID:jdbaltazar,项目名称:survey-office,代码行数:67,代码来源:database.php
示例8: index
//.........这里部分代码省略.........
Question::model()->updateQuestionOrder($iQuestionGroupID, $iSurveyID);
// If some questions have conditions set on this question's answers
// then change the cfieldname accordingly
fixMovedQuestionConditions($iQuestionID, $oldgid, $iQuestionGroupID);
}
if ($oldtype != Yii::app()->request->getPost('type')) {
Question::model()->updateAll(array('type' => Yii::app()->request->getPost('type')), 'parent_qid=:qid', array(':qid' => $iQuestionID));
}
Answer::model()->deleteAllByAttributes(array('qid' => $iQuestionID), 'scale_id >= :scale_id', array(':scale_id' => $iAnswerScales));
// Remove old subquestion scales
Question::model()->deleteAllByAttributes(array('parent_qid' => $iQuestionID), 'scale_id >= :scale_id', array(':scale_id' => $iSubquestionScales));
if (!isset($bOnError) || !$bOnError) {
// This really a quick hack and need a better system
Yii::app()->setFlashMessage(gT("Question was successfully saved."));
}
// }
// else
// {
//
// // There are conditions constraints: alert the user
// $errormsg="";
// if (!is_null($array_result['notAbove']))
// {
// $errormsg.=gT("This question relies on other question's answers and can't be moved above groupId:","js")
// . " " . $array_result['notAbove'][0][0] . " " . gT("in position","js")." ".$array_result['notAbove'][0][1]."\\n"
// . gT("See conditions:")."\\n";
//
// foreach ($array_result['notAbove'] as $notAboveCond)
// {
// $errormsg.="- cid:". $notAboveCond[3]."\\n";
// }
//
// }
// if (!is_null($array_result['notBelow']))
// {
// $errormsg.=gT("Some questions rely on this question's answers. You can't move this question below groupId:","js")
// . " " . $array_result['notBelow'][0][0] . " " . gT("in position","js")." ".$array_result['notBelow'][0][1]."\\n"
// . gT("See conditions:")."\\n";
//
// foreach ($array_result['notBelow'] as $notBelowCond)
// {
// $errormsg.="- cid:". $notBelowCond[3]."\\n";
// }
// }
//
// $databaseoutput .= "<script type=\"text/javascript\">\n<!--\n alert(\"$errormsg\")\n //-->\n</script>\n";
// $gid= $oldgid; // group move impossible ==> keep display on oldgid
// }
} else {
Yii::app()->setFlashMessage(gT("Question could not be updated"), 'error');
}
}
LimeExpressionManager::UpgradeConditionsToRelevance($iSurveyID);
if ($sDBOutput != '') {
echo $sDBOutput;
} else {
if (Yii::app()->request->getPost('redirection') == "edit") {
$this->getController()->redirect(array('admin/questions/sa/editquestion/surveyid/' . $iSurveyID . '/gid/' . $iQuestionGroupID . '/qid/' . $iQuestionID));
} else {
$this->getController()->redirect(array('admin/survey/sa/view/surveyid/' . $iSurveyID . '/gid/' . $iQuestionGroupID . '/qid/' . $iQuestionID));
}
}
}
if ($sAction == "updatesurveylocalesettings" && Permission::model()->hasSurveyPermission($iSurveyID, 'surveylocale', 'update')) {
$languagelist = Survey::model()->findByPk($iSurveyID)->additionalLanguages;
$languagelist[] = Survey::model()->findByPk($iSurveyID)->language;
Yii::app()->loadHelper('database');
foreach ($languagelist as $langname) {
if ($langname) {
$url = Yii::app()->request->getPost('url_' . $langname);
if ($url == 'http://') {
$url = "";
}
$sURLDescription = html_entity_decode(Yii::app()->request->getPost('urldescrip_' . $langname), ENT_QUOTES, "UTF-8");
$sURL = html_entity_decode(Yii::app()->request->getPost('url_' . $langname), ENT_QUOTES, "UTF-8");
// Fix bug with FCKEditor saving strange BR types
$short_title = Yii::app()->request->getPost('short_title_' . $langname);
$description = Yii::app()->request->getPost('description_' . $langname);
$welcome = Yii::app()->request->getPost('welcome_' . $langname);
$endtext = Yii::app()->request->getPost('endtext_' . $langname);
$short_title = $oFixCKeditor->fixCKeditor($short_title);
$description = $oFixCKeditor->fixCKeditor($description);
$welcome = $oFixCKeditor->fixCKeditor($welcome);
$endtext = $oFixCKeditor->fixCKeditor($endtext);
$data = array('surveyls_title' => $short_title, 'surveyls_description' => $description, 'surveyls_welcometext' => $welcome, 'surveyls_endtext' => $endtext, 'surveyls_url' => $sURL, 'surveyls_urldescription' => $sURLDescription, 'surveyls_dateformat' => Yii::app()->request->getPost('dateformat_' . $langname), 'surveyls_numberformat' => Yii::app()->request->getPost('numberformat_' . $langname));
$SurveyLanguageSetting = SurveyLanguageSetting::model()->findByPk(array('surveyls_survey_id' => $iSurveyID, 'surveyls_language' => $langname));
$SurveyLanguageSetting->attributes = $data;
$SurveyLanguageSetting->save();
// save the change to database
}
}
Yii::app()->session['flashmessage'] = gT("Survey text elements successfully saved.");
if ($sDBOutput != '') {
echo $sDBOutput;
} else {
$this->getController()->redirect(array('admin/survey/sa/view/surveyid/' . $iSurveyID));
}
}
$this->getController()->redirect(array("/admin"), "refresh");
}
开发者ID:nicbon,项目名称:LimeSurvey,代码行数:101,代码来源:database.php
示例9: index
//.........这里部分代码省略.........
$this->getController()->redirect(array('admin/questions/sa/view/surveyid/' . $iSurveyID . '/gid/' . $iQuestionGroupID . '/qid/' . $iQuestionID));
} else {
// Redirect to edit
$this->getController()->redirect(array('admin/questions/sa/editquestion/surveyid/' . $iSurveyID . '/gid/' . $iQuestionGroupID . '/qid/' . $iQuestionID));
// This works too: $this->getController()->redirect(Yii::app()->request->urlReferrer);
}
}
}
/**
* updatesurveylocalesettings
*/
if ($sAction == "updatesurveylocalesettings" && Permission::model()->hasSurveyPermission($iSurveyID, 'surveylocale', 'update')) {
$languagelist = Survey::model()->findByPk($iSurveyID)->additionalLanguages;
$languagelist[] = Survey::model()->findByPk($iSurveyID)->language;
Yii::app()->loadHelper('database');
foreach ($languagelist as $langname) {
if ($langname) {
$url = Yii::app()->request->getPost('url_' . $langname);
if ($url == 'http://') {
$url = "";
}
$sURLDescription = html_entity_decode(Yii::app()->request->getPost('urldescrip_' . $langname), ENT_QUOTES, "UTF-8");
$sURL = html_entity_decode(Yii::app()->request->getPost('url_' . $langname), ENT_QUOTES, "UTF-8");
// Fix bug with FCKEditor saving strange BR types
$short_title = Yii::app()->request->getPost('short_title_' . $langname);
$description = Yii::app()->request->getPost('description_' . $langname);
$welcome = Yii::app()->request->getPost('welcome_' . $langname);
$endtext = Yii::app()->request->getPost('endtext_' . $langname);
$short_title = $oFixCKeditor->fixCKeditor($short_title);
$description = $oFixCKeditor->fixCKeditor($description);
$welcome = $oFixCKeditor->fixCKeditor($welcome);
$endtext = $oFixCKeditor->fixCKeditor($endtext);
$data = array('surveyls_title' => $short_title, 'surveyls_description' => $description, 'surveyls_welcometext' => $welcome, 'surveyls_endtext' => $endtext, 'surveyls_url' => $sURL, 'surveyls_urldescription' => $sURLDescription, 'surveyls_dateformat' => Yii::app()->request->getPost('dateformat_' . $langname), 'surveyls_numberformat' => Yii::app()->request->getPost('numberformat_' . $langname));
$SurveyLanguageSetting = SurveyLanguageSetting::model()->findByPk(array('surveyls_survey_id' => $iSurveyID, 'surveyls_language' => $langname));
$SurveyLanguageSetting->attributes = $data;
$SurveyLanguageSetting->save();
// save the change to database
}
}
//Yii::app()->session['flashmessage'] = gT("Survey text elements successfully saved.");
////////////////////////////////////////////////////////////////////////////////////
// General settings (copy / paste from surveyadmin::update)
// 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");
}
开发者ID:joaocc,项目名称:LimeSurvey--LimeSurvey,代码行数:67,代码来源:database.php
示例10: getDateFormatForSID
/**
* Get the date format for a specified survey
*
* @param $surveyid integer Survey id
* @param $languagecode string Survey language code (optional)
* @returns integer
*
*/
function getDateFormatForSID($surveyid, $languagecode = '')
{
if (!isset($languagecode) || $languagecode == '') {
$languagecode = Survey::model()->findByPk($surveyid)->language;
}
$data = SurveyLanguageSetting::model()->getDateFormat($surveyid, $languagecode);
if (empty($data)) {
$dateformat = 0;
} else {
$dateformat = (int) $data;
}
return (int) $dateformat;
}
开发者ID:GuillaumeSmaha,项目名称:LimeSurvey,代码行数:21,代码来源:surveytranslator_helper.php
示例11: updatetokenattributedescriptions
/**
* updatetokenattributedescriptions action
*/
public function updatetokenattributedescriptions($iSurveyId)
{
$iSurveyId = sanitize_int($iSurveyId);
if (!Permission::model()->hasSurveyPermission($iSurveyId, 'tokens', 'update') && !Permission::model()->hasSurveyPermission($iSurveyId, 'surveysettings', 'update')) {
Yii::app()->session['flashmessage'] = gT("You do not have permission to access this page.");
$this->getController()->redirect(array("/admin/survey/sa/view/surveyid/{$iSurveyId}"));
}
// CHECK TO SEE IF A TOKEN TABLE EXISTS FOR THIS SURVEY
$bTokenExists = tableExists('{{tokens_' . $iSurveyId . '}}');
if (!$bTokenExists) {
self::_newtokentable($iSurveyI
|
请发表评论