本文整理汇总了PHP中getQuestionTypeList函数的典型用法代码示例。如果您正苦于以下问题:PHP getQuestionTypeList函数的具体用法?PHP getQuestionTypeList怎么用?PHP getQuestionTypeList使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getQuestionTypeList函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _questionbar
/**
* Shows admin menu for question
* @param int Survey id
* @param int Group id
* @param int Question id
* @param string action
*/
function _questionbar($iSurveyID, $gid, $qid, $action = null)
{
$baselang = Survey::model()->findByPk($iSurveyID)->language;
//Show Question Details
$qrrow = Question::model()->findByAttributes(array('qid' => $qid, 'gid' => $gid, 'sid' => $iSurveyID, 'language' => $baselang));
if (is_null($qrrow)) {
return;
}
// Throw 404 ....
$questionsummary = "<div class='menubar'>\n";
// Check if other questions in the Survey are dependent upon this question
$condarray = getQuestDepsForConditions($iSurveyID, "all", "all", $qid, "by-targqid", "outsidegroup");
$sumresult1 = Survey::model()->findByPk($iSurveyID);
if (is_null($sumresult1)) {
Yii::app()->session['flashmessage'] = gT("Invalid survey ID");
$this->getController()->redirect(array("admin/index"));
}
// if surveyid is invalid then die to prevent errors at a later time
$surveyinfo = $sumresult1->attributes;
$surveyinfo = array_map('flattenText', $surveyinfo);
$aData['activated'] = $surveyinfo['active'];
$qrrow = $qrrow->attributes;
$aData['languagelist'] = Survey::model()->findByPk($iSurveyID)->getAllLanguages();
$aData['qtypes'] = $qtypes = getQuestionTypeList('', 'array');
// Warning of lack of sub-questions or answers
$aWarnings = array();
if ($qtypes[$qrrow['type']]['answerscales'] > 0 && !Answer::model()->count("qid=:qid AND language=:language and scale_id=0", array(':qid' => $qid, ':language' => $baselang))) {
$aWarnings[] = array('url' => App()->createUrl("admin/questions", array("sa" => "answeroptions", "surveyid" => $iSurveyID, "gid" => $gid, "qid" => $qid)), 'img' => 'answers_20.png', 'text' => gT("You need to add answer options to this question.", 'unescaped'), 'help' => gT("Edit answer options for this question.", 'unescaped'));
} elseif ($qtypes[$qrrow['type']]['answerscales'] > 1 && !Answer::model()->count("qid=:qid AND language=:language and scale_id=1", array(':qid' => $qid, ':language' => $baselang))) {
$aWarnings[] = array('url' => App()->createUrl("admin/questions", array("sa" => "answeroptions", "surveyid" => $iSurveyID, "gid" => $gid, "qid" => $qid)), 'img' => 'answers_20.png', 'text' => gT("You need to add answer options to this question.", 'unescaped'), 'help' => gT("Edit answer options for this question.", 'unescaped'));
}
if ($qtypes[$qrrow['type']]['subquestions'] > 0 && !Question::model()->count("parent_qid=:qid AND language=:language and scale_id=0", array(':qid' => $qid, ':language' => $baselang))) {
$aWarnings[] = array('url' => App()->createUrl("admin/questions", array("sa" => "subquestions", "surveyid" => $iSurveyID, "gid" => $gid, "qid" => $qid)), 'img' => $qtypes[$qrrow['type']]['subquestions'] > 1 ? "subquestions2d_20.png" : "subquestions_20.png", 'text' => gT("You need to add subquestions options to this question.", 'unescaped'), 'help' => gT("Edit subquestions options for this question.", 'unescaped'));
} elseif ($qtypes[$qrrow['type']]['subquestions'] > 1 && !Question::model()->count("parent_qid=:qid AND language=:language and scale_id=1", array(':qid' => $qid, ':language' => $baselang))) {
$aWarnings[] = array('url' => App()->createUrl("admin/questions", array("sa" => "subquestions", "surveyid" => $iSurveyID, "gid" => $gid, "qid" => $qid)), 'img' => 'subquestions2d_20.png', 'text' => gT("You need to add subquestions to this question.", 'unescaped'), 'help' => gT("Edit subquestions for this question.", 'unescaped'));
}
$aData['aWarnings'] = $aWarnings;
if ($action == 'editansweroptions' || $action == "editsubquestions" || $action == "editquestion" || $action == "editdefaultvalues" || $action == "editdefaultvalues" || $action == "copyquestion") {
$qshowstyle = "style='display: none'";
} else {
$qshowstyle = "";
}
$aData['qshowstyle'] = $qshowstyle;
$aData['action'] = $action;
$aData['surveyid'] = $iSurveyID;
$aData['qid'] = $qid;
$aData['gid'] = $gid;
$aData['qrrow'] = $qrrow;
$aData['baselang'] = $baselang;
$aAttributesWithValues = Question::model()->getAdvancedSettingsWithValues($qid, $qrrow['type'], $iSurveyID, $baselang);
$DisplayArray = array();
foreach ($aAttributesWithValues as $aAttribute) {
if ($aAttribute['i18n'] == false && isset($aAttribute['value']) && $aAttribute['value'] != $aAttribute['default'] || $aAttribute['i18n'] == true && isset($aAttribute['value'][$baselang]) && $aAttribute['value'][$baselang] != $aAttribute['default']) {
if ($aAttribute['inputtype'] == 'singleselect') {
$aAttribute['value'] = $aAttribute['options'][$aAttribute['value']];
}
/*
if ($aAttribute['name']=='relevance')
{
$sRelevance = $aAttribute['value'];
if ($sRelevance !== '' && $sRelevance !== '1' && $sRelevance !== '0')
{
LimeExpressionManager::ProcessString("{" . $sRelevance . "}"); // tests Relevance equation so can pretty-print it
$aAttribute['value']= LimeExpressionManager::GetLastPrettyPrintExpression();
}
}
*/
$DisplayArray[] = $aAttribute;
}
}
$aData['advancedsettings'] = $DisplayArray;
$aData['condarray'] = $condarray;
$aData['sImageURL'] = Yii::app()->getConfig('adminimageurl');
$aData['iIconSize'] = Yii::app()->getConfig('adminthemeiconsize');
$questionsummary .= $this->getController()->renderPartial('/admin/survey/Question/questionbar_view', $aData, true);
$finaldata['display'] = $questionsummary;
$this->getController()->renderPartial('/survey_view', $finaldata);
}
示例2: index
/**
* Database::index()
*
* @param mixed $sa
* @return
*/
function index($sa = null)
{
$sAction = Yii::app()->request->getPost('action');
$iSurveyID = isset($_POST['sid']) ? $_POST['sid'] : returnGlobal('sid');
$iQuestionGroupID = returnGlobal('gid');
$iQuestionID = returnGlobal('qid');
// TODO: This variable seems to be never set or used in any function call?
$sDBOutput = '';
$oFixCKeditor = new LSYii_Validators();
$oFixCKeditor->fixCKeditor = true;
$oFixCKeditor->xssfilter = false;
if ($sAction == "updatedefaultvalues" && Permission::model()->hasSurveyPermission($iSurveyID, 'surveycontent', 'update')) {
$aSurveyLanguages = Survey::model()->findByPk($iSurveyID)->additionalLanguages;
$sBaseLanguage = Survey::model()->findByPk($iSurveyID)->language;
array_unshift($aSurveyLanguages, $sBaseLanguage);
Question::model()->updateAll(array('same_default' => Yii::app()->request->getPost('samedefault') ? 1 : 0), 'sid=:sid ANd qid=:qid', array(':sid' => $iSurveyID, ':qid' => $iQuestionID));
$arQuestion = Question::model()->findByAttributes(array('qid' => $iQuestionID));
$sQuestionType = $arQuestion['type'];
$aQuestionTypeList = getQuestionTypeList('', 'array');
if ($aQuestionTypeList[$sQuestionType]['answerscales'] > 0 && $aQuestionTypeList[$sQuestionType]['subquestions'] == 0) {
for ($iScaleID = 0; $iScaleID < $aQuestionTypeList[$sQuestionType]['answerscales']; $iScaleID++) {
foreach ($aSurveyLanguages as $sLanguage) {
if (!is_null(Yii::app()->request->getPost('defaultanswerscale_' . $iScaleID . '_' . $sLanguage))) {
$this->_updateDefaultValues($iQuestionID, 0, $iScaleID, '', $sLanguage, Yii::app()->request->getPost('defaultanswerscale_' . $iScaleID . '_' . $sLanguage), true);
}
if (!is_null(Yii::app()->request->getPost('other_' . $iScaleID . '_' . $sLanguage))) {
$this->_updateDefaultValues($iQuestionID, 0, $iScaleID, 'other', $sLanguage, Yii::app()->request->getPost('other_' . $iScaleID . '_' . $sLanguage), true);
}
}
}
}
if ($aQuestionTypeList[$sQuestionType]['subquestions'] > 0) {
foreach ($aSurveyLanguages as $sLanguage) {
$arQuestions = Question::model()->findAllByAttributes(array('sid' => $iSurveyID, 'gid' => $iQuestionGroupID, 'parent_qid' => $iQuestionID, 'language' => $sLanguage, 'scale_id' => 0));
for ($iScaleID = 0; $iScaleID < $aQuestionTypeList[$sQuestionType]['subquestions']; $iScaleID++) {
foreach ($arQuestions as $aSubquestionrow) {
if (!is_null(Yii::app()->request->getPost('defaultanswerscale_' . $iScaleID . '_' . $sLanguage . '_' . $aSubquestionrow['qid']))) {
$this->_updateDefaultValues($iQuestionID, $aSubquestionrow['qid'], $iScaleID, '', $sLanguage, Yii::app()->request->getPost('defaultanswerscale_' . $iScaleID . '_' . $sLanguage . '_' . $aSubquestionrow['qid']), true);
}
}
}
}
}
if ($aQuestionTypeList[$sQuestionType]['answerscales'] == 0 && $aQuestionTypeList[$sQuestionType]['subquestions'] == 0) {
foreach ($aSurveyLanguages as $sLanguage) {
// Qick and dirty insert for yes/no defaul value
// write the the selectbox option, or if "EM" is slected, this value to table
if ($sQuestionType == 'Y') {
/// value for all langs
if (Yii::app()->request->getPost('samedefault') == 1) {
$sLanguage = $aSurveyLanguages[0];
// turn
} else {
$sCurrentLang = $sLanguage;
// edit the next lines
}
if (Yii::app()->request->getPost('defaultanswerscale_0_' . $sLanguage) == 'EM') {
// Case EM, write expression to database
$this->_updateDefaultValues($iQuestionID, 0, 0, '', $sLanguage, Yii::app()->request->getPost('defaultanswerscale_0_' . $sLanguage . '_EM'), true);
} else {
// Case "other", write list value to database
$this->_updateDefaultValues($iQuestionID, 0, 0, '', $sLanguage, Yii::app()->request->getPost('defaultanswerscale_0_' . $sLanguage), true);
}
///// end yes/no
} else {
if (!is_null(Yii::app()->request->getPost('defaultanswerscale_0_' . $sLanguage . '_0'))) {
$this->_updateDefaultValues($iQuestionID, 0, 0, '', $sLanguage, Yii::app()->request->getPost('defaultanswerscale_0_' . $sLanguage . '_0'), true);
}
}
}
}
Yii::app()->session['flashmessage'] = gT("Default value settings were successfully saved.");
LimeExpressionManager::SetDirtyFlag();
if ($sDBOutput != '') {
echo $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));
}
$this->getController()->redirect(array('admin/questions/sa/editdefaultvalues/surveyid/' . $iSurveyID . '/gid/' . $iQuestionGroupID . '/qid/' . $iQuestionID));
}
}
if ($sAction == "updateansweroptions" && Permission::model()->hasSurveyPermission($iSurveyID, 'surveycontent', 'update')) {
Yii::app()->loadHelper('database');
$aSurveyLanguages = Survey::model()->findByPk($iSurveyID)->additionalLanguages;
$sBaseLanguage = Survey::model()->findByPk($iSurveyID)->language;
array_unshift($aSurveyLanguages, $sBaseLanguage);
$arQuestion = Question::model()->findByAttributes(array('qid' => $iQuestionID));
$sQuestionType = $arQuestion['type'];
// Checked)
$aQuestionTypeList = getQuestionTypeList('', 'array');
$iScaleCount = $aQuestionTypeList[$sQuestionType]['answerscales'];
//First delete all answers
Answer::model()->deleteAllByAttributes(array('qid' => $iQuestionID));
//.........这里部分代码省略.........
示例3: index
/**
* Load edit/new question screen depending on $action.
*
* @access public
* @param string $sa subaction
* @param int $surveyid
* @param int $gid
* @param int $qid
* @return void
*/
public function index($sa, $surveyid, $gid, $qid = null)
{
App()->getClientScript()->registerPackage('qTip2');
$action = $sa;
$surveyid = $iSurveyID = sanitize_int($surveyid);
$gid = sanitize_int($gid);
if (isset($qid)) {
$qid = sanitize_int($qid);
}
$aViewUrls = array();
$aData['surveyid'] = $surveyid;
$aData['gid'] = $gid;
$aData['qid'] = $qid;
$aData['display']['menu_bars']['surveysummary'] = 'viewgroup';
$aData['display']['menu_bars']['gid_action'] = 'addquestion';
$surveyinfo = Survey::model()->findByPk($iSurveyID)->surveyinfo;
$aData['title_bar']['title'] = $surveyinfo['surveyls_title'] . "(" . gT("ID") . ":" . $iSurveyID . ")";
$aData['questiongroupbar']['savebutton']['form'] = 'frmeditgroup';
$aData['questiongroupbar']['saveandclosebutton']['form'] = 'frmeditgroup';
$aData['questiongroupbar']['closebutton']['url'] = 'admin/questions/sa/view/surveyid/' . $surveyid . '/gid/' . $gid . '/qid/' . $qid;
Yii::app()->session['FileManagerContext'] = "create:question:{$surveyid}";
if (Permission::model()->hasSurveyPermission($surveyid, 'surveycontent', 'read')) {
$surveyinfo = getSurveyInfo($surveyid);
Yii::app()->loadHelper('admin/htmleditor');
Yii::app()->loadHelper('surveytranslator');
if (isset($_POST['sortorder'])) {
$postsortorder = sanitize_int($_POST['sortorder']);
}
$aData['adding'] = $adding = $action == 'addquestion';
$aData['copying'] = $copying = $action == 'copyquestion';
$questlangs = Survey::model()->findByPk($surveyid)->additionalLanguages;
$baselang = Survey::model()->findByPk($surveyid)->language;
$questlangs[] = $baselang;
$questlangs = array_flip($questlangs);
// Prepare selector Mode TODO: with and without image
if (!$adding) {
Yii::app()->session['FileManagerContext'] = "edit:question:{$surveyid}";
$aData['display']['menu_bars']['qid_action'] = 'editquestion';
$egresult = Question::model()->findAllByAttributes(array('sid' => $surveyid, 'gid' => $gid, 'qid' => $qid));
foreach ($egresult as $esrow) {
if (!array_key_exists($esrow->language, $questlangs)) {
// Language Exists, BUT ITS NOT ON THE SURVEY ANYMORE.
$esrow->delete();
} else {
$questlangs[$esrow->language] = 99;
}
if ($esrow->language == $baselang) {
$esrow = $esrow->attributes;
$basesettings = array('question_order' => $esrow['question_order'], 'other' => $esrow['other'], 'mandatory' => $esrow['mandatory'], 'type' => $esrow['type'], 'title' => $esrow['title'], 'preg' => $esrow['preg'], 'question' => $esrow['question'], 'help' => $esrow['help']);
}
}
if (!$egresult) {
$this->getController()->error('Invalid question id');
}
while (list($key, $value) = each($questlangs)) {
if ($value != 99) {
$arQuestion = new Question();
$arQuestion->qid = $qid;
$arQuestion->sid = $surveyid;
$arQuestion->gid = $gid;
$arQuestion->type = $basesettings['type'];
$arQuestion->title = $basesettings['title'];
$arQuestion->question = $basesettings['question'];
$arQuestion->preg = $basesettings['preg'];
$arQuestion->help = $basesettings['help'];
$arQuestion->other = $basesettings['other'];
$arQuestion->mandatory = $basesettings['mandatory'];
$arQuestion->question_order = $basesettings['question_order'];
$arQuestion->language = $key;
$arQuestion->insert();
}
}
$eqresult = Question::model()->with('groups')->together()->findByAttributes(array('sid' => $surveyid, 'gid' => $gid, 'qid' => $qid, 'language' => $baselang));
} else {
// This is needed to properly color-code content if it contains replacements
LimeExpressionManager::StartProcessingPage(false, Yii::app()->baseUrl, true);
// so can click on syntax highlighting to edit questions
}
$qtypelist = getQuestionTypeList('', 'array');
$qDescToCode = 'qDescToCode = {';
$qCodeToInfo = 'qCodeToInfo = {';
foreach ($qtypelist as $qtype => $qdesc) {
$qDescToCode .= " '{$qdesc['description']}' : '{$qtype}', \n";
$qCodeToInfo .= " '{$qtype}' : '" . ls_json_encode($qdesc) . "', \n";
}
$aData['qTypeOutput'] = "{$qDescToCode} 'null':'null' }; \n {$qCodeToInfo} 'null':'null' };";
if (!$adding) {
if (is_object($eqresult->groups)) {
$eqrow = array_merge($eqresult->attributes, $eqresult->groups->attributes);
} else {
//.........这里部分代码省略.........
示例4: _questionbar
/**
* Shows admin menu for question
*
* @param int Survey id
* @param int Group id
* @param int Question id
* @param string action
*/
function _questionbar($aData)
{
if (isset($aData['questionbar'])) {
if (is_object($aData['oSurvey'])) {
$iSurveyID = $aData['surveyid'];
$oSurvey = $aData['oSurvey'];
$gid = $aData['gid'];
$qid = $aData['qid'];
// action
$action = !empty($aData['display']['menu_bars']['qid_action']) ? $aData['display']['menu_bars']['qid_action'] : null;
$baselang = $oSurvey->language;
//Show Question Details
//Count answer-options for this question
$qrr = Answer::model()->findAllByAttributes(array('qid' => $qid, 'language' => $baselang));
$aData['qct'] = $qct = count($qrr);
//Count sub-questions for this question
$sqrq = Question::model()->findAllByAttributes(array('parent_qid' => $qid, 'language' => $baselang));
$aData['sqct'] = $sqct = count($sqrq);
$qrrow = Question::model()->findByAttributes(array('qid' => $qid, 'gid' => $gid, 'sid' => $iSurveyID, 'language' => $baselang));
if (is_null($qrrow)) {
return;
}
$questionsummary = "<div class='menubar'>\n";
// Check if other questions in the Survey are dependent upon this question
$condarray = getQuestDepsForConditions($iSurveyID, "all", "all", $qid, "by-targqid", "outsidegroup");
$surveyinfo = $oSurvey->attributes;
$surveyinfo = array_map('flattenText', $surveyinfo);
$aData['activated'] = $surveyinfo['active'];
$qrrow = $qrrow->attributes;
$aData['languagelist'] = $oSurvey->getAllLanguages();
$aData['qtypes'] = $qtypes = getQuestionTypeList('', 'array');
$aData['action'] = $action;
$aData['surveyid'] = $iSurveyID;
$aData['qid'] = $qid;
$aData['gid'] = $gid;
$aData['qrrow'] = $qrrow;
$aData['baselang'] = $baselang;
$aAttributesWithValues = Question::model()->getAdvancedSettingsWithValues($qid, $qrrow['type'], $iSurveyID, $baselang);
$DisplayArray = array();
foreach ($aAttributesWithValues as $aAttribute) {
if ($aAttribute['i18n'] == false && isset($aAttribute['value']) && $aAttribute['value'] != $aAttribute['default'] || $aAttribute['i18n'] == true && isset($aAttribute['value'][$baselang]) && $aAttribute['value'][$baselang] != $aAttribute['default']) {
if ($aAttribute['inputtype'] == 'singleselect') {
$aAttribute['value'] = $aAttribute['options'][$aAttribute['value']];
}
$DisplayArray[] = $aAttribute;
}
}
$aData['advancedsettings'] = $DisplayArray;
$aData['condarray'] = $condarray;
$questionsummary .= $this->getController()->renderPartial('/admin/survey/Question/questionbar_view', $aData, true);
$finaldata['display'] = $questionsummary;
$this->getController()->renderPartial('/survey_view', $finaldata);
} else {
Yii::app()->session['flashmessage'] = gT("Invalid survey ID");
$this->getController()->redirect(array("admin/index"));
}
}
}
示例5: set_question_sub_questions
public function set_question_sub_questions($sSessionKey, $iSurveyID, $iQuestionID, $data)
{
$data_array = unserialize($data);
Yii::app()->loadHelper('database');
$aSurveyLanguages = Survey::model()->findByPk($iSurveyID)->additionalLanguages;
$sBaseLanguage = Survey::model()->findByPk($iSurveyID)->language;
array_unshift($aSurveyLanguages, $sBaseLanguage);
$arQuestion = Question::model()->findByAttributes(array('qid' => $iQuestionID));
$sQuestionType = $arQuestion['type'];
// Checked
$aQuestionTypeList = getQuestionTypeList('', 'array');
$iScaleCount = $aQuestionTypeList[$sQuestionType]['subquestions'];
//$clang = $this->getController()->lang;
// First delete any deleted ids
//$aDeletedQIDs = explode(' ', trim($data));
$aDeletedQIDs = explode('+', $data_array['deletedqids']);
$iQuestionGroupID = $data_array['gid'];
LimeExpressionManager::RevertUpgradeConditionsToRelevance($iSurveyID);
$aDeletedQIDs = array_unique($aDeletedQIDs, SORT_NUMERIC);
foreach ($aDeletedQIDs as $iDeletedQID) {
$iDeletedQID = (int) $iDeletedQID;
if ($iDeletedQID > 0) {
// don't remove undefined
$iInsertCount = Question::model()->deleteAllByAttributes(array('qid' => $iDeletedQID));
if (!$iInsertCount) {
return "Failed to delete answer";
}
}
}
//Determine ids by evaluating the hidden field
$aRows = array();
$aCodes = array();
$aOldCodes = array();
foreach ($data_array as $key => $value) {
$key = explode('_', $key);
if ($key[0] == 'answer') {
$aRows[$key[3]][$key[1]][$key[2]] = $value;
}
if ($key[0] == 'code') {
$aCodes[$key[2]][] = $value;
}
if ($key[0] == 'oldcode') {
$aOldCodes[$key[2]][] = $value;
}
}
$aInsertQID = array();
for ($iScaleID = 0; $iScaleID < $iScaleCount; $iScaleID++) {
foreach ($aSurveyLanguages as $sLanguage) {
$iPosition = 0;
$test = '';
foreach ($aRows[$iScaleID][$sLanguage] as $subquestionkey => $subquestionvalue) {
$test .= $subquestionvalue . ', ';
// create a new sub question
if (substr($subquestionkey, 0, 3) != 'new') {
$oSubQuestion = Question::model()->find("qid=:qid AND language=:language", array(":qid" => $subquestionkey, ':language' => $sLanguage));
$oSubQuestion->question_order = $iPosition + 1;
$oSubQuestion->title = $aCodes[$iScaleID][$iPosition];
$oSubQuestion->question = $subquestionvalue;
$oSubQuestion->scale_id = $iScaleID;
// update the old sub questions
} else {
if (!isset($aInsertQID[$iScaleID][$iPosition])) {
$oSubQuestion = new Question();
$oSubQuestion->sid = $iSurveyID;
$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;
// update old sub questions
} 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->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;
}
}
$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)) {
foreach ($aErrors as $sAttribute => $aStringErrors) {
foreach ($aStringErrors as $sStringErrors) {
//.........这里部分代码省略.........
示例6: array
$groups[$questionType['group']] = array();
}
$groups[$questionType['group']][$key] = $questionType['description'];
}
$this->widget('ext.bootstrap.widgets.TbSelect2', array('data' => $groups, 'name' => 'type', 'options' => array('width' => '300px', 'minimumResultsForSearch' => 1000), 'events' => array(), 'htmlOptions' => array('id' => 'question_type', 'options' => array($eqrow['type'] => array('selected' => true)))));
$script = '$("#question_type option").addClass("questionType");';
App()->getClientScript()->registerScript('add_class_to_options', $script);
} else {
$aQtypeData = array();
foreach (getQuestionTypeList($eqrow['type'], 'array') as $key => $questionType) {
$aQtypeData[] = array('code' => $key, 'description' => $questionType['description'], 'group' => $questionType['group']);
}
echo CHtml::dropDownList('type', 'category', CHtml::listData($aQtypeData, 'code', 'description', 'group'), array('class' => 'none', 'id' => 'question_type', 'options' => array($eqrow['type'] => array('selected' => true))));
}
} else {
$qtypelist = getQuestionTypeList('', 'array');
echo "{$qtypelist[$eqrow['type']]['description']} - " . gT("Cannot be changed (survey is active)");
?>
<input type='hidden' name='type' id='question_type' value='<?php
echo $eqrow['type'];
?>
' />
<?php
}
?>
</li>
<?php
示例7: activate
/**
* Function responsible to activate survey.
*
* @access public
* @param int $iSurveyID
* @return void
*/
public function activate($iSurveyID)
{
if (!Permission::model()->hasSurveyPermission($iSurveyID, 'surveyactivation', 'update')) {
die;
}
$iSurveyID = (int) $iSurveyID;
$aData = array();
$aData['sidemenu']['state'] = false;
$aData['aSurveysettings'] = getSurveyInfo($iSurveyID);
$aData['surveyid'] = $iSurveyID;
$surveyinfo = Survey::model()->findByPk($iSurveyID)->surveyinfo;
$aData['title_bar']['title'] = $surveyinfo['surveyls_title'] . "(" . gT("ID") . ":" . $iSurveyID . ")";
// Die if this is not possible
if (!isset($aData['aSurveysettings']['active']) || $aData['aSurveysettings']['active'] == 'Y') {
$this->getController()->error('Survey not active');
}
$qtypes = getQuestionTypeList('', 'array');
Yii::app()->loadHelper("admin/activate");
if (empty($_POST['ok'])) {
if (isset($_GET['fixnumbering']) && $_GET['fixnumbering']) {
fixNumbering($_GET['fixnumbering'], $iSurveyID);
}
// Check consistency for groups and questions
$failedgroupcheck = checkGroup($iSurveyID);
$failedcheck = checkQuestions($iSurveyID, $iSurveyID, $qtypes);
$aData['failedcheck'] = $failedcheck;
$aData['failedgroupcheck'] = $failedgroupcheck;
$aData['aSurveysettings'] = getSurveyInfo($iSurveyID);
$this->_renderWrappedTemplate('survey', 'activateSurvey_view', $aData);
} else {
$survey = Survey::model()->findByAttributes(array('sid' => $iSurveyID));
if (!is_null($survey)) {
$survey->anonymized = Yii::app()->request->getPost('anonymized');
$survey->datestamp = Yii::app()->request->getPost('datestamp');
$survey->ipaddr = Yii::app()->request->getPost('ipaddr');
$survey->refurl = Yii::app()->request->getPost('refurl');
$survey->savetimings = Yii::app()->request->getPost('savetimings');
$survey->save();
Survey::model()->resetCache();
// Make sure the saved values will be picked up
}
$aResult = activateSurvey($iSurveyID);
if (isset($aResult['error'])) {
$aViewUrls['output'] = "<br />\n<div class='messagebox ui-corner-all'>\n";
if ($aResult['error'] == 'surveytablecreation') {
$aViewUrls['output'] .= "<div class='alert alert-warning' role='alert'>" . gT("Survey table could not be created.") . "</div>\n";
} else {
$aViewUrls['output'] .= "<div class='alert alert-success' role='alert'>" . gT("Timings table could not be created.") . "</div>\n";
}
$aViewUrls['output'] .= "<strong class='text-warning'>" . gT("Database error!!") . "\n " . "\n" . "<pre>" . var_export($aResult['error'], true) . "</pre>\n\n <a href='" . Yii::app()->getController()->createUrl("admin/survey/sa/view/surveyid/" . $iSurveyID) . "'>" . gT("Main Admin Screen") . "</a>\n</strong><br/>";
} else {
$warning = isset($aResult['warning']) ? true : false;
$allowregister = $survey->allowregister == 'Y' ? true : false;
$onclickAction = convertGETtoPOST(Yii::app()->getController()->createUrl("admin/tokens/sa/index/surveyid/" . $iSurveyID));
$closedOnclickAction = convertGETtoPOST(Yii::app()->getController()->createUrl("admin/tokens/sa/index/surveyid/" . $iSurveyID));
$noOnclickAction = convertGETtoPOST(Yii::app()->getController()->createUrl("admin/survey/sa/view/surveyid/" . $iSurveyID));
$activationData = array('iSurveyID' => $iSurveyID, 'warning' => $warning, 'allowregister' => $allowregister, 'onclickAction' => $onclickAction, 'closedOnclickAction' => $closedOnclickAction, 'noOnclickAction' => $noOnclickAction);
$aViewUrls['output'] = $this->getController()->renderPartial('/admin/survey/_activation_feedback', $activationData, true);
}
$this->_renderWrappedTemplate('survey', $aViewUrls, $aData);
}
}
示例8: buildsurveysession
//.........这里部分代码省略.........
$aEnterTokenData = array();
$aEnterTokenData['bNewTest'] = false;
$aEnterTokenData['bDirectReload'] = false;
$aEnterTokenData['error'] = $secerror;
$aEnterTokenData['iSurveyId'] = $surveyid;
$aEnterTokenData['sKpClass'] = $kpclass;
// ???
$aEnterTokenData['sLangCode'] = $sLangCode;
if (isset($_GET['bNewTest']) && $_GET['newtest'] == "Y") {
$aEnterTokenData['bNewTest'] = true;
}
// If this is a direct Reload previous answers URL, then add hidden fields
if (isset($loadall) && isset($scid) && isset($loadname) && isset($loadpass)) {
$aEnterTokenData['bDirectReload'] = true;
$aEnterTokenData['sCid'] = $scid;
$aEnterTokenData['sLoadname'] = htmlspecialchars($loadname);
$aEnterTokenData['sLoadpass'] = htmlspecialchars($loadpass);
}
$FlashError = "";
// Scenario => Captcha required
if ($scenarios['captchaRequired'] && !$preview) {
list($renderCaptcha, $FlashError) = testCaptcha($aEnterTokenData, $subscenarios, $surveyid, $loadsecurity);
}
// Scenario => Token required
if ($scenarios['tokenRequired'] && !$preview) {
//Test if token is valid
list($renderToken, $FlashError) = testIfTokenIsValid($subscenarios, $thissurvey, $aEnterTokenData, $clienttoken);
}
//If there were errors, display through yii->FlashMessage
if ($FlashError !== "") {
$aEnterTokenData['errorMessage'] = $FlashError;
}
$renderWay = getRenderWay($renderToken, $renderCaptcha);
$redata = compact(array_keys(get_defined_vars()));
renderRenderWayForm($renderWay, $redata, $scenarios, $sTemplateViewPath, $aEnterTokenData, $surveyid);
// Reset all the session variables and start again
resetAllSessionVariables($surveyid);
// Multi lingual support order : by REQUEST, if not by Token->language else by survey default language
if (returnGlobal('lang', true)) {
$language_to_set = returnGlobal('lang', true);
} elseif (isset($oTokenEntry) && $oTokenEntry) {
// If survey have token : we have a $oTokenEntry
// Can use $oTokenEntry = Token::model($surveyid)->findByAttributes(array('token'=>$clienttoken)); if we move on another function : this par don't validate the token validity
$language_to_set = $oTokenEntry->language;
} else {
$language_to_set = $thissurvey['language'];
}
// Always SetSurveyLanguage : surveys controller SetSurveyLanguage too, if different : broke survey (#09769)
SetSurveyLanguage($surveyid, $language_to_set);
UpdateGroupList($surveyid, $_SESSION['survey_' . $surveyid]['s_lang']);
$totalquestions = Question::model()->getTotalQuestions($surveyid);
$iTotalGroupsWithoutQuestions = QuestionGroup::model()->getTotalGroupsWithoutQuestions($surveyid);
// Fix totalquestions by substracting Test Display questions
$iNumberofQuestions = Question::model()->getNumberOfQuestions($surveyid);
$_SESSION['survey_' . $surveyid]['totalquestions'] = $totalquestions - (int) reset($iNumberofQuestions);
// 2. SESSION VARIABLE: totalsteps
setTotalSteps($surveyid, $thissurvey, $totalquestions);
// Break out and crash if there are no questions!
if ($totalquestions == 0 || $iTotalGroupsWithoutQuestions > 0) {
$redata = compact(array_keys(get_defined_vars()));
breakOutAndCrash($redata, $sTemplateViewPath, $totalquestions, $iTotalGroupsWithoutQuestions, $thissurvey);
}
//Perform a case insensitive natural sort on group name then question title of a multidimensional array
// usort($arows, 'groupOrderThenQuestionOrder');
//3. SESSION VARIABLE - insertarray
//An array containing information about used to insert the data into the db at the submit stage
//4. SESSION VARIABLE - fieldarray
//See rem at end..
if ($tokensexist == 1 && $clienttoken) {
$_SESSION['survey_' . $surveyid]['token'] = $clienttoken;
}
if ($thissurvey['anonymized'] == "N") {
$_SESSION['survey_' . $surveyid]['insertarray'][] = "token";
}
$qtypes = getQuestionTypeList('', 'array');
$fieldmap = createFieldMap($surveyid, 'full', true, false, $_SESSION['survey_' . $surveyid]['s_lang']);
//$seed = ls\mersenne\getSeed($surveyid, $preview);
// Randomization groups for groups
list($fieldmap, $randomized1) = randomizationGroup($surveyid, $fieldmap, $preview);
// Randomization groups for questions
list($fieldmap, $randomized2) = randomizationQuestion($surveyid, $fieldmap, $preview);
$randomized = $randomized1 || $randomized2;
if ($randomized === true) {
$fieldmap = finalizeRandomization($fieldmap);
$_SESSION['survey_' . $surveyid]['fieldmap-' . $surveyid . $_SESSION['survey_' . $surveyid]['s_lang']] = $fieldmap;
$_SESSION['survey_' . $surveyid]['fieldmap-' . $surveyid . '-randMaster'] = 'fieldmap-' . $surveyid . $_SESSION['survey_' . $surveyid]['s_lang'];
}
// TMSW Condition->Relevance: don't need hasconditions, or usedinconditions
$_SESSION['survey_' . $surveyid]['fieldmap'] = $fieldmap;
initFieldArray($surveyid, $fieldmap);
// Prefill questions/answers from command line params
prefillFromCommandLine($surveyid);
if (isset($_SESSION['survey_' . $surveyid]['fieldarray'])) {
$_SESSION['survey_' . $surveyid]['fieldarray'] = array_values($_SESSION['survey_' . $surveyid]['fieldarray']);
}
//Check if a passthru label and value have been included in the query url
checkPassthruLabel($surveyid, $preview, $fieldmap);
Yii::trace('end', 'survey.buildsurveysession');
//traceVar($_SESSION['survey_' . $surveyid]);
}
示例9: index
/**
* Database::index()
*
* @param mixed $action
* @return
*/
function index($sa = null)
{
$action = Yii::app()->request->getPost('action');
$clang = $this->getController()->lang;
$postsid = returnGlobal('sid');
$postgid = returnGlobal('gid');
$postqid = returnGlobal('qid');
$postqaid = returnGlobal('qaid');
$databaseoutput = '';
$surveyid = returnGlobal('sid');
$gid = returnGlobal('gid');
$qid = returnGlobal('qid');
// if $action is not passed, check post data.
if (Yii::app()->getConfig('filterxsshtml') && Yii::app()->session['USER_RIGHT_SUPERADMIN'] != 1) {
$filter = new CHtmlPurifier();
$filter->options = array('URI.AllowedSchemes' => array('http' => true, 'https' => true));
$xssfilter = true;
} else {
$xssfilter = false;
}
if ($action == "updatedefaultvalues" && hasSurveyPermission($surveyid, 'surveycontent', 'update')) {
$questlangs = Survey::model()->findByPk($surveyid)->additionalLanguages;
$baselang = Survey::model()->findByPk($surveyid)->language;
array_unshift($questlangs, $baselang);
Questions::model()->updateAll(array('same_default' => Yii::app()->request->getPost('samedefault') ? 1 : 0), 'sid=:sid ANd qid=:qid', array(':sid' => $surveyid, ':qid' => $qid));
$resrow = Questions::model()->findByAttributes(array('qid' => $qid));
$questiontype = $resrow['type'];
$qtproperties = getQuestionTypeList('', 'array');
if ($qtproperties[$questiontype]['answerscales'] > 0 && $qtproperties[$questiontype]['subquestions'] == 0) {
for ($scale_id = 0; $scale_id < $qtproperties[$questiontype]['answerscales']; $scale_id++) {
foreach ($questlangs as $language) {
if (!is_null(Yii::app()->request->getPost('defaultanswerscale_' . $scale_id . '_' . $language))) {
$this->_updateDefaultValues($qid, 0, $scale_id, '', $language, Yii::app()->request->getPost('defaultanswerscale_' . $scale_id . '_' . $language), true);
}
if (!is_null(Yii::app()->request->getPost('other_' . $scale_id . '_' . $language))) {
$this->_updateDefaultValues($qid, 0, $scale_id, 'other', $language, Yii::app()->request->getPost('other_' . $scale_id . '_' . $language), true);
}
}
}
}
if ($qtproperties[$questiontype]['subquestions'] > 0) {
foreach ($questlangs as $language) {
$sqresult = Questions::model()->findAllByAttributes(array('sid' => $surveyid, 'gid' => $gid, 'parent_qid' => $qid, 'language' => $language, 'scale_id' => 0));
for ($scale_id = 0; $scale_id < $qtproperties[$questiontype]['subquestions']; $scale_id++) {
foreach ($sqresult as $aSubquestionrow) {
if (!is_null(Yii::app()->request->getPost('defaultanswerscale_' . $scale_id . '_' . $language . '_' . $aSubquestionrow['qid']))) {
$this->_updateDefaultValues($qid, $aSubquestionrow['qid'], $scale_id, '', $language, Yii::app()->request->getPost('defaultanswerscale_' . $scale_id . '_' . $language . '_' . $aSubquestionrow['qid']), true);
}
}
}
}
}
if ($qtproperties[$questiontype]['answerscales'] == 0 && $qtproperties[$questiontype]['subquestions'] == 0) {
foreach ($questlangs as $language) {
if (!is_null(Yii::app()->request->getPost('defaultanswerscale_0_' . $language . '_0'))) {
$this->_updateDefaultValues($postqid, 0, 0, '', $language, Yii::app()->request->getPost('defaultanswerscale_0_' . $language . '_0'), true);
}
}
}
Yii::app()->session['flashmessage'] = $clang->gT("Default value settings were successfully saved.");
LimeExpressionManager::SetDirtyFlag();
if ($databaseoutput != '') {
echo $databaseoutput;
} else {
$this->getController()->redirect($this->getController()->createUrl('admin/survey/sa/view/surveyid/' . $surveyid . '/gid/' . $gid . '/qid/' . $qid));
}
}
if ($action == "updateansweroptions" && hasSurveyPermission($surveyid, 'surveycontent', 'update')) {
Yii::app()->loadHelper('database');
$anslangs = Survey::model()->findByPk($surveyid)->additionalLanguages;
$baselang = Survey::model()->findByPk($surveyid)->language;
$alllanguages = $anslangs;
array_unshift($alllanguages, $baselang);
$resrow = Questions::model()->findByAttributes(array('qid' => $qid));
$questiontype = $resrow['type'];
// Checked)
$qtypes = getQuestionTypeList('', 'array');
$scalecount = $qtypes[$questiontype]['answerscales'];
$count = 0;
$invalidCode = 0;
$duplicateCode = 0;
//require_once("../classes/inputfilter/class.inputfilter_clean.php");
//$myFilter = new InputFilter('','',1,1,1);
//First delete all answers
Answers::model()->deleteAllByAttributes(array('qid' => $qid));
LimeExpressionManager::RevertUpgradeConditionsToRelevance($surveyid);
for ($scale_id = 0; $scale_id < $scalecount; $scale_id++) {
$maxcount = (int) Yii::app()->request->getPost('answercount_' . $scale_id);
for ($sortorderid = 1; $sortorderid < $maxcount; $sortorderid++) {
$code = sanitize_paranoid_string(Yii::app()->request->getPost('code_' . $sortorderid . '_' . $scale_id));
if (Yii::app()->request->getPost('oldcode_' . $sortorderid . '_' . $scale_id)) {
$oldcode = sanitize_paranoid_string(Yii::app()->request->getPost('oldcode_' . $sortorderid . '_' . $scale_id));
if ($code !== $oldcode) {
Conditions::model()->updateAll(array('value' => $code), 'cqid=:cqid AND value=:value', array(':cqid' => $qid, ':value' => $oldcode));
//.........这里部分代码省略.........
示例10: ShowSurveyLogicFile
/**
* Create HTML view of the survey, showing everything that uses EM
* @param <type> $sid
* @param <type> $gid
* @param <type> $qid
*/
public static function ShowSurveyLogicFile($sid, $gid = NULL, $qid = NULL, $LEMdebugLevel = 0, $assessments = false)
{
// Title
// Welcome
// G1, name, relevance, text
// *Q1, name [type], relevance [validation], text, help, default, help_msg
// SQ1, name [scale], relevance [validation], text
// A1, code, assessment_value, text
// End Message
$LEM =& LimeExpressionManager::singleton();
$LEM->sPreviewMode = 'logic';
$aSurveyInfo = getSurveyInfo($sid, $_SESSION['LEMlang']);
$allErrors = array();
$warnings = 0;
$surveyOptions = array('assessments' => $aSurveyInfo['assessments'] == 'Y', 'hyperlinkSyntaxHighlighting' => true);
$varNamesUsed = array();
// keeps track of whether variables have been declared
if (!is_null($qid)) {
$surveyMode = 'question';
LimeExpressionManager::StartSurvey($sid, 'question', $surveyOptions, false, $LEMdebugLevel);
$qseq = LimeExpressionManager::GetQuestionSeq($qid);
$moveResult = LimeExpressionManager::JumpTo($qseq + 1, true, false, true);
} else {
if (!is_null($gid)) {
$surveyMode = 'group';
LimeExpressionManager::StartSurvey($sid, 'group', $surveyOptions, false, $LEMdebugLevel);
$gseq = LimeExpressionManager::GetGroupSeq($gid);
$moveResult = LimeExpressionManager::JumpTo($gseq + 1, true, false, true);
} else {
$surveyMode = 'survey';
LimeExpressionManager::StartSurvey($sid, 'survey', $surveyOptions, false, $LEMdebugLevel);
$moveResult = LimeExpressionManager::NavigateForwards();
}
}
$qtypes = getQuestionTypeList('', 'array');
if (is_null($moveResult) || is_null($LEM->currentQset) || count($LEM->currentQset) == 0) {
return array('errors' => 1, 'html' => sprintf($LEM->gT('Invalid question - probably missing sub-questions or language-specific settings for language %s'), $_SESSION['LEMlang']));
}
$surveyname = templatereplace('{SURVEYNAME}', array('SURVEYNAME' => $aSurveyInfo['surveyls_title']));
$out = '<div id="showlogicfilediv" ><H3>' . $LEM->gT('Logic File for Survey # ') . '[' . $LEM->sid . "]: {$surveyname}</H3>\n";
$out .= "<table class='table' id='logicfiletable'>";
if (is_null($gid) && is_null($qid)) {
if ($aSurveyInfo['surveyls_description'] != '') {
$LEM->ProcessString($aSurveyInfo['surveyls_description'], 0);
$sPrint = $LEM->GetLastPrettyPrintExpression();
$errClass = $LEM->em->HasErrors() ? 'LEMerror' : '';
$out .= "<tr class='LEMgroup {$errClass}'><td colspan=2>" . $LEM->gT("Description:") . "</td><td colspan=2>" . $sPrint . "</td></tr>";
}
if ($aSurveyInfo['surveyls_welcometext'] != '') {
$LEM->ProcessString($aSurveyInfo['surveyls_welcometext'], 0);
$sPrint = $LEM->GetLastPrettyPrintExpression();
$errClass = $LEM->em->HasErrors() ? 'LEMerror' : '';
$out .= "<tr class='LEMgroup {$errClass}'><td colspan=2>" . $LEM->gT("Welcome:") . "</td><td colspan=2>" . $sPrint . "</td></tr>";
}
if ($aSurveyInfo['surveyls_endtext'] != '') {
$LEM->ProcessString($aSurveyInfo['surveyls_endtext']);
$sPrint = $LEM->GetLastPrettyPrintExpression();
$errClass = $LEM->em->HasErrors() ? 'LEMerror' : '';
$out .= "<tr class='LEMgroup {$errClass}'><td colspan=2>" . $LEM->gT("End message:") . "</td><td colspan=2>" . $sPrint . "</td></tr>";
}
if ($aSurveyInfo['surveyls_url'] != '') {
$LEM->ProcessString($aSurveyInfo['surveyls_urldescription'] . " - " . $aSurveyInfo['surveyls_url']);
$sPrint = $LEM->GetLastPrettyPrintExpression();
$errClass = $LEM->em->HasErrors() ? 'LEMerror' : '';
$out .= "<tr class='LEMgroup {$errClass}'><td colspan=2>" . $LEM->gT("End URL:") . "</td><td colspan=2>" . $sPrint . "</td></tr>";
}
}
$out .= "<tr><th>#</th><th>" . $LEM->gT('Name [ID]') . "</th><th>" . $LEM->gT('Relevance [Validation] (Default value)') . "</th><th>" . $LEM->gT('Text [Help] (Tip)') . "</th></tr>\n";
$_gseq = -1;
foreach ($LEM->currentQset as $q) {
$gseq = $q['info']['gseq'];
$gid = $q['info']['gid'];
$qid = $q['info']['qid'];
$qseq = $q['info']['qseq'];
$errorCount = 0;
//////
// SHOW GROUP-LEVEL INFO
//////
if ($gseq != $_gseq) {
$LEM->ParseResultCache = array();
// reset for each group so get proper color coding?
$_gseq = $gseq;
$ginfo = $LEM->gseq2info[$gseq];
$grelevance = '{' . ($ginfo['grelevance'] == '' ? 1 : $ginfo['grelevance']) . '}';
$gtext = trim($ginfo['description']) == '' ? ' ' : $ginfo['description'];
$editlink = Yii::app()->getController()->createUrl('admin/questiongroups/sa/view/surveyid/' . $LEM->sid . '/gid/' . $gid);
$groupRow = "<tr class='LEMgroup'>" . "<td>G-{$gseq}</td>" . "<td><b>" . $ginfo['group_name'] . "</b><br />[<a target='_blank' href='{$editlink}'>GID " . $gid . "</a>]</td>" . "<td>" . $grelevance . "</td>" . "<td>" . $gtext . "</td>" . "</tr>\n";
$LEM->ProcessString($groupRow, $qid, NULL, false, 1, 1, false, false);
$out .= $LEM->GetLastPrettyPrintExpression();
if ($LEM->em->HasErrors()) {
++$errorCount;
}
}
//////
//.........这里部分代码省略.........
示例11: index
/**
* Database::index()
*
* @param mixed $sa
* @return
*/
function index($sa = null)
{
$sAction = Yii::app()->request->getPost('action');
$iSurveyID = returnGlobal('sid');
$iQuestionGroupID = returnGlobal('gid');
$iQuestionID = returnGlobal('qid');
$sDBOutput = '';
$oFixCKeditor = new LSYii_Validators();
$oFixCKeditor->fixCKeditor = true;
$oFixCKeditor->xssfilter = false;
if ($sAction == "updatedefaultvalues" && Permission::model()->hasSurveyPermission($iSurveyID, 'surveycontent', 'update')) {
$aSurveyLanguages = Survey::model()->findByPk($iSurveyID)->additionalLanguages;
$sBaseLanguage = Survey::model()->findByPk($iSurveyID)->language;
array_unshift($aSurveyLanguages, $sBaseLanguage);
Question::model()->updateAll(array('same_default' => Yii::app()->request->getPost('samedefault') ? 1 : 0), 'sid=:sid ANd qid=:qid', array(':sid' => $iSurveyID, ':qid' => $iQuestionID));
$arQuestion = Question::model()->findByAttributes(array('qid' => $iQuestionID));
$sQuestionType = $arQuestion['type'];
$aQuestionTypeList = getQuestionTypeList('', 'array');
if ($aQuestionTypeList[$sQuestionType]['answerscales'] > 0 && $aQuestionTypeList[$sQuestionType]['subquestions'] == 0) {
for ($iScaleID = 0; $iScaleID < $aQuestionTypeList[$sQuestionType]['answerscales']; $iScaleID++) {
foreach ($aSurveyLanguages as $sLanguage) {
if (!is_null(Yii::app()->request->getPost('defaultanswerscale_' . $iScaleID . '_' . $sLanguage))) {
$this->_updateDefaultValues($iQuestionID, 0, $iScaleID, '', $sLanguage, Yii::app()->request->getPost('defaultanswerscale_' . $iScaleID . '_' . $sLanguage), true);
}
if (!is_null(Yii::app()->request->getPost('other_' . $iScaleID . '_' . $sLanguage))) {
$this->_updateDefaultValues($iQuestionID, 0, $iScaleID, 'other', $sLanguage, Yii::app()->request->getPost('other_' . $iScaleID . '_' . $sLanguage), true);
}
}
}
}
if ($aQuestionTypeList[$sQuestionType]['subquestions'] > 0) {
foreach ($aSurveyLanguages as $sLanguage) {
$arQuestions = Question::model()->findAllByAttributes(array('sid' => $iSurveyID, 'gid' => $iQuestionGroupID, 'parent_qid' => $iQuestionID, 'language' => $sLanguage, 'scale_id' => 0));
for ($iScaleID = 0; $iScaleID < $aQuestionTypeList[$sQuestionType]['subquestions']; $iScaleID++) {
foreach ($arQuestions as $aSubquestionrow) {
if (!is_null(Yii::app()->request->getPost('defaultanswerscale_' . $iScaleID . '_' . $sLanguage . '_' . $aSubquestionrow['qid']))) {
$this->_updateDefaultValues($iQuestionID, $aSubquestionrow['qid'], $iScaleID, '', $sLanguage, Yii::app()->request->getPost('defaultanswerscale_' . $iScaleID . '_' . $sLanguage . '_' . $aSubquestionrow['qid']), true);
}
}
}
}
}
if ($aQuestionTypeList[$sQuestionType]['answerscales'] == 0 && $aQuestionTypeList[$sQuestionType]['subquestions'] == 0) {
foreach ($aSurveyLanguages as $sLanguage) {
// Qick and dirty insert for yes/no defaul value
// write the the selectbox option, or if "EM" is slected, this value to table
if ($sQuestionType == 'Y') {
/// value for all langs
if (Yii::app()->request->getPost('samedefault') == 1) {
$sLanguage = $aSurveyLanguages[0];
// turn
} else {
$sCurrentLang = $sLanguage;
// edit the next lines
}
if (Yii::app()->request->getPost('defaultanswerscale_0_' . $sLanguage) == 'EM') {
// Case EM, write expression to database
$this->_updateDefaultValues($iQuestionID, 0, 0, '', $sLanguage, Yii::app()->request->getPost('defaultanswerscale_0_' . $sLanguage . '_EM'), true);
} else {
// Case "other", write list value to database
$this->_updateDefaultValues($iQuestionID, 0, 0, '', $sLanguage, Yii::app()->request->getPost('defaultanswerscale_0_' . $sLanguage), true);
}
///// end yes/no
} else {
if (!is_null(Yii::app()->request->getPost('defaultanswerscale_0_' . $sLanguage . '_0'))) {
$this->_updateDefaultValues($iQuestionID, 0, 0, '', $sLanguage, Yii::app()->request->getPost('defaultanswerscale_0_' . $sLanguage . '_0'), true);
}
}
}
}
Yii::app()->session['flashmessage'] = gT("Default value settings were successfully saved.");
LimeExpressionManager::SetDirtyFlag();
if ($sDBOutput != '') {
echo $sDBOutput;
} else {
$this->getController()->redirect(array('admin/survey/sa/view/surveyid/' . $iSurveyID . '/gid/' . $iQuestionGroupID . '/qid/' . $iQuestionID));
}
}
if ($sAction == "updateansweroptions" && Permission::model()->hasSurveyPermission($iSurveyID, 'surveycontent', 'update')) {
Yii::app()->loadHelper('database');
$aSurveyLanguages = Survey::model()->findByPk($iSurveyID)->additionalLanguages;
$sBaseLanguage = Survey::model()->findByPk($iSurveyID)->language;
array_unshift($aSurveyLanguages, $sBaseLanguage);
$arQuestion = Question::model()->findByAttributes(array('qid' => $iQuestionID));
$sQuestionType = $arQuestion['type'];
// Checked)
$aQuestionTypeList = getQuestionTypeList('', 'array');
$iScaleCount = $aQuestionTypeList[$sQuestionType]['answerscales'];
//First delete all answers
Answer::model()->deleteAllByAttributes(array('qid' => $iQuestionID));
LimeExpressionManager::RevertUpgradeConditionsToRelevance($iSurveyID);
for ($iScaleID = 0; $iScaleID < $iScaleCount; $iScaleID++) {
$iMaxCount = (int) Yii::app()->request->getPost('answercount_' . $iScaleID);
for ($iSortOrderID = 1; $iSortOrderID < $iMaxCount; $iSortOrderID++) {
//.........这里部分代码省略.........
示例12: CSVImportSurvey
//.........这里部分代码省略.........
$fieldorders = convertCSVRowToArray($surveylsarray[0], ',', '"');
unset($surveylsarray[0]);
foreach ($surveylsarray as $slsrow) {
$fieldcontents = convertCSVRowToArray($slsrow, ',', '"');
$surveylsrowdata = array_combine($fieldorders, $fieldcontents);
// convert back the '\'.'n' char from the CSV file to true return char "\n"
$surveylsrowdata = array_map('convertCSVReturnToReturn', $surveylsrowdata);
// Convert the \n return char from welcometext to <br />
// translate internal links
if ($bTranslateLinks) {
$surveylsrowdata['surveyls_title'] = translateLinks('survey', $iOldSID, $iNewSID, $surveylsrowdata['surveyls_title']);
$surveylsrowdata['surveyls_description'] = translateLinks('survey', $iOldSID, $iNewSID, $surveylsrowdata['surveyls_description']);
$surveylsrowdata['surveyls_welcometext'] = translateLinks('survey', $iOldSID, $iNewSID, $surveylsrowdata['surveyls_welcometext']);
$surveylsrowdata['surveyls_urldescription'] = translateLinks('survey', $iOldSID, $iNewSID, $surveylsrowdata['surveyls_urldescription']);
$surveylsrowdata['surveyls_email_invite'] = translateLinks('survey', $iOldSID, $iNewSID, $surveylsrowdata['surveyls_email_invite']);
$surveylsrowdata['surveyls_email_remind'] = translateLinks('survey', $iOldSID, $iNewSID, $surveylsrowdata['surveyls_email_remind']);
$surveylsrowdata['surveyls_email_register'] = translateLinks('survey', $iOldSID, $iNewSID, $surveylsrowdata['surveyls_email_register']);
$surveylsrowdata['surveyls_email_confirm'] = translateLinks('survey', $iOldSID, $iNewSID, $surveylsrowdata['surveyls_email_confirm']);
}
unset($surveylsrowdata['lastpage']);
$surveylsrowdata['surveyls_survey_id'] = $iNewSID;
$lsiresult = Surveys_languagesettings::model()->insertNewSurvey($surveylsrowdata) or safeDie("<br />" . $clang->gT("Import of this survey file failed") . "<br />");
}
// The survey languagesettings are imported now
$aLanguagesSupported = array();
// this array will keep all the languages supported for the survey
$sBaseLanguage = Survey::model()->findByPk($iNewSID)->language;
$aLanguagesSupported[] = $sBaseLanguage;
// adds the base language to the list of supported languages
$aLanguagesSupported = array_merge($aLanguagesSupported, Survey::model()->findByPk($iNewSID)->additionalLanguages);
// DO SURVEY_RIGHTS
Survey_permissions::model()->giveAllSurveyPermissions(Yii::app()->session['loginID'], $iNewSID);
$importresults['deniedcountls'] = 0;
$qtypes = getQuestionTypeList("", "array");
$results['labels'] = 0;
$results['labelsets'] = 0;
$results['answers'] = 0;
$results['subquestions'] = 0;
//Do label sets
if (isset($labelsetsarray) && $labelsetsarray) {
$csarray = buildLabelSetCheckSumArray();
// build checksums over all existing labelsets
$count = 0;
foreach ($labelsetsarray as $lsa) {
$fieldorders = convertCSVRowToArray($labelsetsarray[0], ',', '"');
$fieldcontents = convertCSVRowToArray($lsa, ',', '"');
if ($count == 0) {
$count++;
continue;
}
$labelsetrowdata = array_combine($fieldorders, $fieldcontents);
// Save old labelid
$oldlid = $labelsetrowdata['lid'];
unset($labelsetrowdata['lid']);
$lblsets = Labelsets::model();
$lsiresult = $lblsets->insertRecords($labelsetrowdata);
$results['labelsets']++;
// Get the new insert id for the labels inside this labelset
$newlid = Yii::app()->db->createCommand('Select LAST_INSERT_ID()')->query()->read();
$newlid = $newlid['LAST_INSERT_ID()'];
if ($labelsarray) {
$count = 0;
foreach ($labelsarray as $la) {
$lfieldorders = convertCSVRowToArray($labelsarray[0], ',', '"');
$lfieldcontents = convertCSVRowToArray($la, ',', '"');
if ($count == 0) {
示例13: createFieldMap
//.........这里部分代码省略.........
$fieldmap["refurl"] = array("fieldname" => "refurl", 'type' => "url", 'sid' => $surveyid, "gid" => "", "qid" => "", "aid" => "");
if ($style == "full") {
$fieldmap["refurl"]['title'] = "";
$fieldmap["refurl"]['question'] = gT("Referrer URL");
$fieldmap["refurl"]['group_name'] = "";
}
}
// Collect all default values once so don't need separate query for each question with defaults
// First collect language specific defaults
$defaultsQuery = "SELECT a.qid, a.sqid, a.scale_id, a.specialtype, a.defaultvalue" . " FROM {{defaultvalues}} as a, {{questions}} as b" . " WHERE a.qid = b.qid" . " AND a.language = b.language" . " AND a.language = '{$sLanguage}'" . " AND b.same_default=0" . " AND b.sid = " . $surveyid;
$defaultResults = Yii::app()->db->createCommand($defaultsQuery)->queryAll();
$defaultValues = array();
// indexed by question then subquestion
foreach ($defaultResults as $dv) {
if ($dv['specialtype'] != '') {
$sq = $dv['specialtype'];
} else {
$sq = $dv['sqid'];
}
$defaultValues[$dv['qid'] . '~' . $sq] = $dv['defaultvalue'];
}
// Now overwrite language-specific defaults (if any) base language values for each question that uses same_defaults=1
$baseLanguage = getBaseLanguageFromSurveyID($surveyid);
$defaultsQuery = "SELECT a.qid, a.sqid, a.scale_id, a.specialtype, a.defaultvalue" . " FROM {{defaultvalues}} as a, {{questions}} as b" . " WHERE a.qid = b.qid" . " AND a.language = b.language" . " AND a.language = '{$baseLanguage}'" . " AND b.same_default=1" . " AND b.sid = " . $surveyid;
$defaultResults = Yii::app()->db->createCommand($defaultsQuery)->queryAll();
foreach ($defaultResults as $dv) {
if ($dv['specialtype'] != '') {
$sq = $dv['specialtype'];
} else {
$sq = $dv['sqid'];
}
$defaultValues[$dv['qid'] . '~' . $sq] = $dv['defaultvalue'];
}
$qtypes = getQuestionTypeList('', 'array');
// Main query
$aquery = "SELECT * " . " FROM {{questions}} as questions, {{groups}} as groups" . " WHERE questions.gid=groups.gid AND " . " questions.sid={$surveyid} AND " . " questions.language='{$sLanguage}' AND " . " questions.parent_qid=0 AND " . " groups.language='{$sLanguage}' ";
if ($questionid !== false) {
$aquery .= " and questions.qid={$questionid} ";
}
$aquery .= " ORDER BY group_order, question_order";
$aresult = Yii::app()->db->createCommand($aquery)->queryAll();
$questionSeq = -1;
// this is incremental question sequence across all groups
$groupSeq = -1;
$_groupOrder = -1;
foreach ($aresult as $arow) {
++$questionSeq;
// fix fact taht group_order may have gaps
if ($_groupOrder != $arow['group_order']) {
$_groupOrder = $arow['group_order'];
++$groupSeq;
}
// Condition indicators are obsolete with EM. However, they are so tightly coupled into LS code that easider to just set values to 'N' for now and refactor later.
$conditions = 'N';
$usedinconditions = 'N';
// Field identifier
// GXQXSXA
// G=Group Q=Question S=Subquestion A=Answer Option
// If S or A don't exist then set it to 0
// Implicit (subqestion intermal to a question type ) or explicit qubquestions/answer count starts at 1
// Types "L", "!", "O", "D", "G", "N", "X", "Y", "5", "S", "T", "U"
$fieldname = "{$arow['sid']}X{$arow['gid']}X{$arow['qid']}";
if ($qtypes[$arow['type']]['subquestions'] == 0 && $arow['type'] != "R" && $arow['type'] != "|") {
if (isset($fieldmap[$fieldname])) {
$aDuplicateQIDs[$arow['qid']] = array('fieldname' => $fieldname, 'question' => $arow['question'], 'gid' => $arow['gid']);
}
示例14: index
/**
* Database::index()
*
* @param mixed $sa
* @return
*/
function index($sa = null)
{
$sAction = Yii::app()->request->getPost('action');
$clang = $this->getController()->lang;
$iSurveyID = returnGlobal('sid');
$iQuestionGroupID = returnGlobal('gid');
$iQuestionID = returnGlobal('qid');
$sDBOutput = '';
if (Yii::app()->getConfig('filterxsshtml') && !Permission::model()->hasGlobalPermission('superadmin', 'read')) {
$oPurifier = new CHtmlPurifier();
$oPurifier->options = array('URI.AllowedSchemes' => array('http' => true, 'https' => true));
$bXSSFilter = true;
} else {
$bXSSFilter = false;
}
if ($sAction == "updatedefaultvalues" && Permission::model()->hasSurveyPermission($iSurveyID, 'surveycontent', 'update')) {
$aSurveyLanguages = Survey::model()->findByPk($iSurveyID)->additionalLanguages;
$sBaseLanguage = Survey::model()->findByPk($iSurveyID)->language;
array_unshift($aSurveyLanguages, $sBaseLanguage);
Question::model()->updateAll(array('same_default' => Yii::app()->request->getPost('samedefault') ? 1 : 0), 'sid=:sid ANd qid=:qid', array(':sid' => $iSurveyID, ':qid' => $iQuestionID));
$arQuestion = Question::model()->findByAttributes(array('qid' => $iQuestionID));
$sQuestionType = $arQuestion['type'];
$aQuestionTypeList = getQuestionTypeList('', 'array');
if ($aQuestionTypeList[$sQuestionType]['answerscales'] > 0 && $aQuestionTypeList[$sQuestionType]['subquestions'] == 0) {
for ($iScaleID = 0; $iScaleID < $aQuestionTypeList[$sQuestionType]['answerscales']; $iScaleID++) {
foreach ($aSurveyLanguages as $sLanguage) {
if (!is_null(Yii::app()->request->getPost('defaultanswerscale_' . $iScaleID . '_' . $sLanguage))) {
$this->_updateDefaultValues($iQuestionID, 0, $iScaleID, '', $sLanguage, Yii::app()->request->getPost('defaultanswerscale_' . $iScaleID . '_' . $sLanguage), true);
}
if (!is_null(Yii::app()->request->getPost('other_' . $iScaleID . '_' . $sLanguage))) {
$this->_updateDefaultValues($iQuestionID, 0, $iScaleID, 'other', $sLanguage, Yii::app()->request->getPost('other_' . $iScaleID . '_' . $sLanguage), true);
}
}
}
}
if ($aQuestionTypeList[$sQuestionType]['subquestions'] > 0) {
foreach ($aSurveyLanguages as $sLanguage) {
$arQuestions = Question::model()->findAllByAttributes(array('sid' => $iSurveyID, 'gid' => $iQuestionGroupID, 'parent_qid' => $iQuestionID, 'language' => $sLanguage, 'scale_id' => 0));
for ($iScaleID = 0; $iScaleID < $aQuestionTypeList[$sQuestionType]['subquestions']; $iScaleID++) {
foreach ($arQuestions as $aSubquestionrow) {
if (!is_null(Yii::app()->request->getPost('defaultanswerscale_' . $iScaleID . '_' . $sLanguage . '_' . $aSubquestionrow['qid']))) {
$this->_updateDefaultValues($iQuestionID, $aSubquestionrow['qid'], $iScaleID, '', $sLanguage, Yii::app()->request->getPost('defaultanswerscale_' . $iScaleID . '_' . $sLanguage . '_' . $aSubquestionrow['qid']), true);
}
}
}
}
}
if ($aQuestionTypeList[$sQuestionType]['answerscales'] == 0 && $aQuestionTypeList[$sQuestionType]['subquestions'] == 0) {
foreach ($aSurveyLanguages as $sLanguage) {
if (!is_null(Yii::app()->request->getPost('defaultanswerscale_0_' . $sLanguage . '_0'))) {
$this->_updateDefaultValues($iQuestionID, 0, 0, '', $sLanguage, Yii::app()->request->getPost('defaultanswerscale_0_' . $sLanguage . '_0'), true);
}
}
}
Yii::app()->session['flashmessage'] = $clang->gT("Default value settings were successfully saved.");
LimeExpressionManager::SetDirtyFlag();
if ($sDBOutput != '') {
echo $sDBOutput;
} else {
$this->getController()->redirect(array('admin/survey/sa/view/surveyid/' . $iSurveyID . '/gid/' . $iQuestionGroupID . '/qid/' . $iQuestionID));
}
}
if ($sAction == "updateansweroptions" && Permission::model()->hasSurveyPermission($iSurveyID, 'surveycontent', 'update')) {
Yii::app()->loadHelper('database');
$aSurveyLanguages = Survey::model()->findByPk($iSurveyID)->additionalLanguages;
$sBaseLanguage = Survey::model()->findByPk($iSurveyID)->language;
array_unshift($aSurveyLanguages, $sBaseLanguage);
$arQuestion = Question::model()->findByAttributes(array('qid' => $iQuestionID));
$sQuestionType = $arQuestion['type'];
// Checked)
$aQuestionTypeList = getQuestionTypeList('', 'array');
$iScaleCount = $aQuestionTypeList[$sQuestionType]['answerscales'];
//First delete all answers
Answer::model()->deleteAllByAttributes(array('qid' => $iQuestionID));
LimeExpressionManager::RevertUpgradeConditionsToRelevance($iSurveyID);
for ($iScaleID = 0; $iScaleID < $iScaleCount; $iScaleID++) {
$iMaxCount = (int) Yii::app()->request->getPost('answercount_' . $iScaleID);
for ($iSortOrderID = 1; $iSortOrderID < $iMaxCount; $iSortOrderID++) {
$sCode = sanitize_paranoid_string(Yii::app()->request->getPost('code_' . $iSortOrderID . '_' . $iScaleID));
if (Yii::app()->request->getPost('oldcode_' . $iSortOrderID . '_' . $iScaleID)) {
$sOldCode = sanitize_paranoid_string(Yii::app()->request->getPost('oldcode_' . $iSortOrderID . '_' . $iScaleID));
if ($sCode !== $sOldCode) {
Condition::model()->updateAll(array('value' => $sCode), 'cqid=:cqid AND value=:value', array(':cqid' => $iQuestionID, ':value' => $sOldCode));
}
}
$iAssessmentValue = (int) Yii::app()->request->getPost('assessment_' . $iSortOrderID . '_' . $iScaleID);
foreach ($aSurveyLanguages as $sLanguage) {
$sAnswerText = Yii::app()->request->getPost('answer_' . $sLanguage . '_' . $iSortOrderID . '_' . $iScaleID);
if ($bXSSFilter) {
$sAnswerText = $oPurifier->purify($sAnswerText);
} else {
$sAnswerText = html_entity_decode($sAnswerText, ENT_QUOTES, "UTF-8");
}
// Fix bug with FCKEditor saving strange BR types
//.........这里部分代码省略.........
示例15: activate
/**
* Function responsible to activate survey.
*
* @access public
* @param int $iSurveyID
* @return void
*/
public function activate($iSurveyID)
{
if (!Permission::model()->hasSurveyPermission($iSurveyID, 'surveyactivation', 'update')) {
die;
}
$iSurveyID = (int) $iSurveyID;
$aData = array();
$aData['aSurveysettings'] = getSurveyInfo($iSurveyID);
$aData['surveyid'] = $iSurveyID;
// Die if this is not possible
if (!isset($aData['aSurveysettings']['active']) || $aData['aSurveysettings']['active'] == 'Y') {
$this->getController()->error('Survey not active');
}
$qtypes = getQuestionTypeList('', 'array');
Yii::app()->loadHelper("admin/activate");
if (empty($_POST['ok'])) {
if (isset($_GET['fixnumbering']) && $_GET['fixnumbering']) {
fixNumbering($_GET['fixnumbering'], $iSurveyID);
}
// Check consistency for groups and questions
$failedgroupcheck = checkGroup($iSurveyID);
$failedcheck = checkQuestions($iSurveyID, $iSurveyID, $qtypes);
$aData['failedcheck'] = $failedcheck;
$aData['failedgroupcheck'] = $failedgroupcheck;
$aData['aSurveysettings'] = getSurveyInfo($iSurveyID);
$this->_renderWrappedTemplate('survey', 'activateSurvey_view', $aData);
} else {
$survey = Survey::model()->findByAttributes(array('sid' => $iSurveyID));
if (!is_null($survey)) {
$survey->anonymized = Yii::app()->request->getPost('anonymized');
$survey->datestamp = Yii::app()->request->getPost('datestamp');
$survey->ipaddr = Yii::app()->request->getPost('ipaddr');
$survey->refurl = Yii::app()->request->getPost('refurl');
$survey->savetimings = Yii::app()->request->getPost('savetimings');
$survey->save();
Survey::model()->resetCache();
// Make sure the saved values will be picked up
}
$aResult = activateSurvey($iSurveyID);
if (isset($aResult['error'])) {
$aViewUrls['output'] = "<br />\n<div class='messagebox ui-corner-all'>\n" . "<div class='header ui-widget-header'>" . gT("Activate Survey") . " ({$iSurveyID})</div>\n";
if ($aResult['error'] == 'surveytablecreation') {
$aViewUrls['output'] .= "<div class='warningheader'>" . gT("Survey table could not be created.") . "</div>\n";
} else {
$aViewUrls['output'] .= "<div class='warningheader'>" . gT("Timings table could not be created.") . "</div>\n";
}
$aViewUrls['output'] .= "<p>" . gT("Database error!!") . "\n <font color='red'>" . "</font>\n" . "<pre>" . var_export($aResult['error'], true) . "</pre>\n\n <a href='" . Yii::app()->getController()->createUrl("admin/survey/sa/view/surveyid/" . $iSurveyID) . "'>" . gT("Main Admin Screen") . "</a>\n</div>";
} else {
$aViewUrls['output'] = "<br />\n<div class='messagebox ui-corner-all'>\n" . "<div class='header ui-widget-header'>" . gT("Activate Survey") . " ({$iSurveyID})</div>\n" . "<div class='successheader'>" . gT("Survey has been activated. Results table has been successfully created.") . "</div><br /><br />\n";
if (isset($aResult['warning'])) {
$aViewUrls['output'] .= "<div class='warningheader'>" . gT("The required directory for saving the uploaded files couldn't be created. Please check file premissions on the /upload/surveys directory.") . "</div>";
}
if ($survey->allowregister == 'Y') {
$aViewUrls['output'] .= gT("This survey allows public registration. A token table must also be created.") . "<br /><br />\n" . "<input type='submit' value='" . gT("Initialise tokens") . "' onclick=\"" . convertGETtoPOST(Yii::app()->getController()->createUrl("admin/tokens/sa/index/surveyid/" . $iSurveyID)) . "\" />\n";
} else {
$aViewUrls['output'] .= gT("This survey is now active, and responses can be recorded.") . "<br /><br />\n" . "<strong>" . gT("Open-access mode") . ":</strong> " . gT("No invitation code is needed to complete the survey.") . "<br />" . gT("You can switch to the closed-access mode by initialising a token table with the button below.") . "<br /><br />\n" . "<input type='submit' value='" . gT("Switch to closed-access mode") . "' onclick=\"" . convertGETtoPOST(Yii::app()->getController()->createUrl("admin/tokens/sa/index/surveyid/" . $iSurveyID)) . "\" />\n" . "<input type='submit' value='" . gT("No, thanks.") . "' onclick=\"" . convertGETtoPOST(Yii::app()->getController()->createUrl("admin/survey/sa/view/surveyid/" . $iSurveyID)) . "\" />\n";
}
$aViewUrls['output'] .= "</div><br /> \n";
}
$this->_renderWrappedTemplate('survey', $aViewUrls, $aData);
}
}