本文整理汇总了PHP中getGroupOrder函数的典型用法代码示例。如果您正苦于以下问题:PHP getGroupOrder函数的具体用法?PHP getGroupOrder怎么用?PHP getGroupOrder使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getGroupOrder函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: foreach
foreach ($questlangs as $qlang) {
if ($filterxsshtml) {
$_POST['question_' . $qlang] = $myFilter->process(html_entity_decode($_POST['question_' . $qlang], ENT_QUOTES, "UTF-8"));
$_POST['help_' . $qlang] = $myFilter->process(html_entity_decode($_POST['help_' . $qlang], ENT_QUOTES, "UTF-8"));
} else {
$_POST['question_' . $qlang] = html_entity_decode($_POST['question_' . $qlang], ENT_QUOTES, "UTF-8");
$_POST['help_' . $qlang] = html_entity_decode($_POST['help_' . $qlang], ENT_QUOTES, "UTF-8");
}
// Fix bug with FCKEditor saving strange BR types
$_POST['question_' . $qlang] = fix_FCKeditor_text($_POST['question_' . $qlang]);
$_POST['help_' . $qlang] = fix_FCKeditor_text($_POST['help_' . $qlang]);
if (isset($qlang) && $qlang != "") {
// ToDo: Sanitize the POST variables !
$uqquery = "UPDATE " . db_table_name('questions') . "SET type='" . db_quote($_POST['type']) . "', title='" . db_quote($_POST['title']) . "', " . "question='" . db_quote($_POST['question_' . $qlang]) . "', preg='" . db_quote($_POST['preg']) . "', help='" . db_quote($_POST['help_' . $qlang]) . "', " . "gid='" . db_quote($postgid) . "', other='" . db_quote($_POST['other']) . "', " . "mandatory='" . db_quote($_POST['mandatory']) . "'" . ", relevance='" . db_quote($_POST['relevance']) . "'";
if ($oldgid != $postgid) {
if (getGroupOrder(returnglobal('sid'), $oldgid) > getGroupOrder(returnglobal('sid'), returnglobal('gid'))) {
// Moving question to a 'upper' group
// insert question at the end of the destination group
// this prevent breaking conditions if the target qid is in the dest group
$insertorder = getMaxquestionorder($postgid) + 1;
$uqquery .= ', question_order=' . $insertorder . ' ';
} else {
// Moving question to a 'lower' group
// insert question at the beginning of the destination group
shiftorderQuestions($postsid, $postgid, 1);
// makes 1 spare room for new question at top of dest group
$uqquery .= ', question_order=0 ';
}
}
$uqquery .= "WHERE sid='" . $postsid . "' AND qid='" . $postqid . "' AND language='{$qlang}'";
$uqresult = $connect->Execute($uqquery) or safe_die("Error Update Question: " . $uqquery . "<br />" . $connect->ErrorMsg());
开发者ID:ddrmoscow,项目名称:queXS,代码行数:31,代码来源:database.php
示例2: checkMoveQuestionConstraintsForConditions
/**
* checkMoveQuestionConstraintsForConditions()
* @param string $sid - the currently selected survey
* @param string $qid - qid of the question you want to check possible moves
* @param string $newgid - (optionnal) get only constraints when trying to move to this particular GroupId
* otherwise, get all moves constraints for this question
*
* @return array - returns an array describing the conditions
* Array
* (
* ['notAbove'] = null | Array
* (
* Array ( gid1, group_order1, qid1, cid1 )
* )
* ['notBelow'] = null | Array
* (
* Array ( gid2, group_order2, qid2, cid2 )
* )
* )
*
* This should be read as:
* - this question can't be move above group gid1 in position group_order1 because of the condition cid1 on question qid1
* - this question can't be move below group gid2 in position group_order2 because of the condition cid2 on question qid2
*
*/
function checkMoveQuestionConstraintsForConditions($sid, $qid, $newgid = "all")
{
$resarray = array();
$resarray['notAbove'] = null;
// defaults to no constraint
$resarray['notBelow'] = null;
// defaults to no constraint
$sid = sanitize_int($sid);
$qid = sanitize_int($qid);
if ($newgid != "all") {
$newgid = sanitize_int($newgid);
$newgorder = getGroupOrder($sid, $newgid);
} else {
$neworder = "";
// Not used in this case
}
$baselang = Survey::model()->findByPk($sid)->language;
// First look for 'my dependencies': questions on which I have set conditions
$condquery = "SELECT tq.qid as depqid, tq.gid as depgid, tg.group_order as depgorder, " . "tq2.qid as targqid, tq2.gid as targgid, tg2.group_order as targgorder, " . "tc.cid FROM " . "{{conditions}} AS tc, " . "{{questions}} AS tq, " . "{{questions}} AS tq2, " . "{{groups}} AS tg, " . "{{groups}} AS tg2 " . "WHERE tq.language='{$baselang}' AND tq2.language='{$baselang}' AND tc.qid = tq.qid AND tq.sid={$sid} " . "AND tq2.qid=tc.cqid AND tg.gid=tq.gid AND tg2.gid=tq2.gid AND tq.qid={$qid} ORDER BY tg2.group_order DESC";
$condresult = Yii::app()->db->createCommand($condquery)->query();
foreach ($condresult->readAll() as $condrow) {
// This Question can go up to the minimum GID on the 1st row
$depqid = $condrow['depqid'];
$depgid = $condrow['depgid'];
$depgorder = $condrow['depgorder'];
$targetqid = $condrow['targqid'];
$targetgid = $condrow['targgid'];
$targetgorder = $condrow['targgorder'];
$condid = $condrow['cid'];
//echo "This question can't go above to GID=$targetgid/order=$targetgorder because of CID=$condid";
if ($newgid != "all") {
// Get only constraints when trying to move to this group
if ($newgorder < $targetgorder) {
$resarray['notAbove'][] = array($targetgid, $targetgorder, $depqid, $condid);
}
} else {
// get all moves constraints
$resarray['notAbove'][] = array($targetgid, $targetgorder, $depqid, $condid);
}
}
// Secondly look for 'questions dependent on me': questions that have conditions on my answers
$condquery = "SELECT tq.qid as depqid, tq.gid as depgid, tg.group_order as depgorder, " . "tq2.qid as targqid, tq2.gid as targgid, tg2.group_order as targgorder, " . "tc.cid FROM {{conditions}} AS tc, " . "{{questions}} AS tq, " . "{{questions}} AS tq2, " . "{{groups}} AS tg, " . "{{groups}} AS tg2 " . "WHERE tq.language='{$baselang}' AND tq2.language='{$baselang}' AND tc.qid = tq.qid AND tq.sid={$sid} " . "AND tq2.qid=tc.cqid AND tg.gid=tq.gid AND tg2.gid=tq2.gid AND tq2.qid={$qid} ORDER BY tg.group_order";
$condresult = Yii::app()->db->createCommand($condquery)->query();
foreach ($condresult->readAll() as $condrow) {
// This Question can go down to the maximum GID on the 1st row
$depqid = $condrow['depqid'];
$depgid = $condrow['depgid'];
$depgorder = $condrow['depgorder'];
$targetqid = $condrow['targqid'];
$targetgid = $condrow['targgid'];
$targetgorder = $condrow['targgorder'];
$condid = $condrow['cid'];
//echo "This question can't go below to GID=$depgid/order=$depgorder because of CID=$condid";
if ($newgid != "all") {
// Get only constraints when trying to move to this group
if ($newgorder > $depgorder) {
$resarray['notBelow'][] = array($depgid, $depgorder, $depqid, $condid);
}
} else {
// get all moves constraints
$resarray['notBelow'][] = array($depgid, $depgorder, $depqid, $condid);
}
}
return $resarray;
}
开发者ID:GuillaumeSmaha,项目名称:LimeSurvey,代码行数:90,代码来源:common_helper.php
示例3: index
//.........这里部分代码省略.........
$qidlist = implode(", ", $qidarray);
}
}
if (isset($cccount) && $cccount) {
Yii::app()->setFlashMessage(gT("Question could not be updated. There are conditions for other questions that rely on the answers to this question and changing the type will cause problems. You must delete these conditions before you can change the type of this question."), 'error');
} else {
if (isset($iQuestionGroupID) && $iQuestionGroupID != "") {
// $array_result=checkMoveQuestionConstraintsForConditions(sanitize_int($surveyid),sanitize_int($qid), sanitize_int($gid));
// // If there is no blocking conditions that could prevent this move
//
// if (is_null($array_result['notAbove']) && is_null($array_result['notBelow']))
// {
$aSurveyLanguages = Survey::model()->findByPk($iSurveyID)->additionalLanguages;
$sBaseLanguage = Survey::model()->findByPk($iSurveyID)->language;
array_push($aSurveyLanguages, $sBaseLanguage);
foreach ($aSurveyLanguages as $qlang) {
if (isset($qlang) && $qlang != "") {
// é to é and & to & : really needed ? Why not for answers ? (130307)
$sQuestionText = Yii::app()->request->getPost('question_' . $qlang, '');
$sQuestionHelp = Yii::app()->request->getPost('help_' . $qlang, '');
// Fix bug with FCKEditor saving strange BR types : in rules ?
$sQuestionText = $oFixCKeditor->fixCKeditor($sQuestionText);
$sQuestionHelp = $oFixCKeditor->fixCKeditor($sQuestionHelp);
$udata = array('type' => $sQuestionType, 'title' => Yii::app()->request->getPost('title'), 'question' => $sQuestionText, 'preg' => Yii::app()->request->getPost('preg'), 'help' => $sQuestionHelp, 'gid' => $iQuestionGroupID, 'other' => Yii::app()->request->getPost('other'), 'mandatory' => Yii::app()->request->getPost('mandatory'), 'relevance' => Yii::app()->request->getPost('relevance'));
// Update question module
if (Yii::app()->request->getPost('module_name') != '') {
// The question module is not empty. So it's an external question module.
$udata['modulename'] = Yii::app()->request->getPost('module_name');
} else {
// If it was a module before, we must
$udata['modulename'] = '';
}
if ($oldgid != $iQuestionGroupID) {
if (getGroupOrder($iSurveyID, $oldgid) > getGroupOrder($iSurveyID, $iQuestionGroupID)) {
// TMSW Condition->Relevance: What is needed here?
// Moving question to a 'upper' group
// insert question at the end of the destination group
// this prevent breaking conditions if the target qid is in the dest group
$insertorder = getMaxQuestionOrder($iQuestionGroupID, $iSurveyID) + 1;
$udata = array_merge($udata, array('question_order' => $insertorder));
} else {
// Moving question to a 'lower' group
// insert question at the beginning of the destination group
shiftOrderQuestions($iSurveyID, $iQuestionGroupID, 1);
// makes 1 spare room for new question at top of dest group
$udata = array_merge($udata, array('question_order' => 0));
}
}
//$condn = array('sid' => $surveyid, 'qid' => $qid, 'language' => $qlang);
$oQuestion = Question::model()->findByPk(array("qid" => $iQuestionID, 'language' => $qlang));
foreach ($udata as $k => $v) {
$oQuestion->{$k} = $v;
}
$uqresult = $oQuestion->save();
//($uqquery); // or safeDie ("Error Update Question: ".$uqquery."<br />"); // Checked)
if (!$uqresult) {
$bOnError = true;
$aErrors = $oQuestion->getErrors();
if (count($aErrors)) {
foreach ($aErrors as $sAttribute => $aStringErrors) {
foreach ($aStringErrors as $sStringErrors) {
Yii::app()->setFlashMessage(sprintf(gT("Question could not be updated with error on %s: %s"), $sAttribute, $sStringErrors), 'error');
}
}
} else {
Yii::app()->setFlashMessage(gT("Question could not be updated."), 'error');
开发者ID:joaocc,项目名称:LimeSurvey--LimeSurvey,代码行数:67,代码来源:database.php
示例4: index
//.........这里部分代码省略.........
// TMSW Condition->Relevance: Do similar check via EM, but do allow such a change since will be easier to modify relevance
//Make sure there are no conditions based on this question, since we are changing the type
$ccresult = Condition::model()->findAllByAttributes(array('cqid' => $iQuestionID));
$cccount = count($ccresult);
foreach ($ccresult as $ccr) {
$qidarray[] = $ccr['qid'];
}
if (isset($qidarray) && $qidarray) {
$qidlist = implode(", ", $qidarray);
}
}
if (isset($cccount) && $cccount) {
Yii::app()->setFlashMessage(gT("Question could not be updated. There are conditions for other questions that rely on the answers to this question and changing the type will cause problems. You must delete these conditions before you can change the type of this question."), 'error');
} else {
if (isset($iQuestionGroupID) && $iQuestionGroupID != "") {
// $array_result=checkMoveQuestionConstraintsForConditions(sanitize_int($surveyid),sanitize_int($qid), sanitize_int($gid));
// // If there is no blocking conditions that could prevent this move
//
// if (is_null($array_result['notAbove']) && is_null($array_result['notBelow']))
// {
$aSurveyLanguages = Survey::model()->findByPk($iSurveyID)->additionalLanguages;
$sBaseLanguage = Survey::model()->findByPk($iSurveyID)->language;
array_push($aSurveyLanguages, $sBaseLanguage);
foreach ($aSurveyLanguages as $qlang) {
if (isset($qlang) && $qlang != "") {
// é to é and & to & : really needed ? Why not for answers ? (130307)
$sQuestionText = Yii::app()->request->getPost('question_' . $qlang, '');
$sQuestionHelp = Yii::app()->request->getPost('help_' . $qlang, '');
// Fix bug with FCKEditor saving strange BR types : in rules ?
$sQuestionText = $oFixCKeditor->fixCKeditor($sQuestionText);
$sQuestionHelp = $oFixCKeditor->fixCKeditor($sQuestionHelp);
$udata = array('type' => Yii::app()->request->getPost('type'), 'title' => Yii::app()->request->getPost('title'), 'question' => $sQuestionText, 'preg' => Yii::app()->request->getPost('preg'), 'help' => $sQuestionHelp, 'gid' => $iQuestionGroupID, 'other' => Yii::app()->request->getPost('other'), 'mandatory' => Yii::app()->request->getPost('mandatory'), 'relevance' => Yii::app()->request->getPost('relevance'));
if ($oldgid != $iQuestionGroupID) {
if (getGroupOrder($iSurveyID, $oldgid) > getGroupOrder($iSurveyID, $iQuestionGroupID)) {
// TMSW Condition->Relevance: What is needed here?
// Moving question to a 'upper' group
// insert question at the end of the destination group
// this prevent breaking conditions if the target qid is in the dest group
$insertorder = getMaxQuestionOrder($iQuestionGroupID, $iSurveyID) + 1;
$udata = array_merge($udata, array('question_order' => $insertorder));
} else {
// Moving question to a 'lower' group
// insert question at the beginning of the destination group
shiftOrderQuestions($iSurveyID, $iQuestionGroupID, 1);
// makes 1 spare room for new question at top of dest group
$udata = array_merge($udata, array('question_order' => 0));
}
}
//$condn = array('sid' => $surveyid, 'qid' => $qid, 'language' => $qlang);
$oQuestion = Question::model()->findByPk(array("qid" => $iQuestionID, 'language' => $qlang));
foreach ($udata as $k => $v) {
$oQuestion->{$k} = $v;
}
$uqresult = $oQuestion->save();
//($uqquery); // or safeDie ("Error Update Question: ".$uqquery."<br />"); // Checked)
if (!$uqresult) {
$bOnError = true;
$aErrors = $oQuestion->getErrors();
if (count($aErrors)) {
foreach ($aErrors as $sAttribute => $aStringErrors) {
foreach ($aStringErrors as $sStringErrors) {
Yii::app()->setFlashMessage(sprintf(gT("Question could not be updated with error on %s: %s"), $sAttribute, $sStringErrors), 'error');
}
}
} else {
Yii::app()->setFlashMessage(gT("Question could not be updated."), 'error');
开发者ID:nicbon,项目名称:LimeSurvey,代码行数:67,代码来源:database.php
示例5: checkMovequestionConstraintsForConditions
/**
* checkMovequestionConstraintsForConditions()
* @param string $sid - the currently selected survey
* @param string $qid - qid of the question you want to check possible moves
* @param string $newgid - (optionnal) get only constraints when trying to move to this particular GroupId
* otherwise, get all moves constraints for this question
*
* @return array - returns an array describing the conditions
* Array
* (
* ['notAbove'] = null | Array
* (
* Array ( gid1, group_order1, qid1, cid1 )
* )
* ['notBelow'] = null | Array
* (
* Array ( gid2, group_order2, qid2, cid2 )
* )
* )
*
* This should be read as:
* - this question can't be move above group gid1 in position group_order1 because of the condition cid1 on question qid1
* - this question can't be move below group gid2 in position group_order2 because of the condition cid2 on question qid2
*
*/
function checkMovequestionConstraintsForConditions($sid, $qid, $newgid = "all")
{
global $connect;
$resarray = array();
$resarray['notAbove'] = null;
// defaults to no constraint
$resarray['notBelow'] = null;
// defaults to no constraint
$sid = sanitize_int($sid);
$qid = sanitize_int($qid);
if ($newgid != "all") {
$newgid = sanitize_int($newgid);
$newgorder = getGroupOrder($sid, $newgid);
} else {
$neworder = "";
// Not used in this case
}
$baselang = GetBaseLanguageFromSurveyID($sid);
// First look for 'my dependencies': questions on which I have set conditions
$condquery = "SELECT tq.qid as depqid, tq.gid as depgid, tg.group_order as depgorder, " . "tq2.qid as targqid, tq2.gid as targgid, tg2.group_order as targgorder, " . "tc.cid FROM " . db_table_name('conditions') . " AS tc, " . db_table_name('questions') . " AS tq, " . db_table_name('questions') . " AS tq2, " . db_table_name('groups') . " AS tg, " . db_table_name('groups') . " AS tg2 " . "WHERE tq.language='{$baselang}' AND tq2.language='{$baselang}' AND tc.qid = tq.qid AND tq.sid={$sid} " . "AND tq2.qid=tc.cqid AND tg.gid=tq.gid AND tg2.gid=tq2.gid AND tq.qid={$qid} ORDER BY tg2.group_order DESC";
$condresult = db_execute_assoc($condquery) or safe_die($connect->ErrorMsg());
//Checked
if ($condresult->RecordCount() > 0) {
while ($condrow = $condresult->FetchRow()) {
// This Question can go up to the minimum GID on the 1st row
$depqid = $condrow['depqid'];
$depgid = $condrow['depgid'];
$depgorder = $condrow['depgorder'];
$targetqid = $condrow['targqid'];
$targetgid = $condrow['targgid'];
$targetgorder = $condrow['targgorder'];
$condid = $condrow['cid'];
//echo "This question can't go above to GID=$targetgid/order=$targetgorder because of CID=$condid";
if ($newgid != "all") {
// Get only constraints when trying to move to this group
if ($newgorder < $targetgorder) {
$resarray['notAbove'][] = array($targetgid, $targetgorder, $depqid, $condid);
}
} else {
// get all moves constraints
$resarray['notAbove'][] = array($targetgid, $targetgorder, $depqid, $condid);
}
}
}
// Secondly look for 'questions dependent on me': questions that have conditions on my answers
$condquery = "SELECT tq.qid as depqid, tq.gid as depgid, tg.group_order as depgorder, " . "tq2.qid as targqid, tq2.gid as targgid, tg2.group_order as targgorder, " . "tc.cid FROM " . db_table_name('conditions') . " AS tc, " . db_table_name('questions') . " AS tq, " . db_table_name('questions') . " AS tq2, " . db_table_name('groups') . " AS tg, " . db_table_name('groups') . " AS tg2 " . "WHERE tq.language='{$baselang}' AND tq2.language='{$baselang}' AND tc.qid = tq.qid AND tq.sid={$sid} " . "AND tq2.qid=tc.cqid AND tg.gid=tq.gid AND tg2.gid=tq2.gid AND tq2.qid={$qid} ORDER BY tg.group_order";
$condresult = db_execute_assoc($condquery) or safe_die($connect->ErrorMsg());
//Checked
if ($condresult->RecordCount() > 0) {
while ($condrow = $condresult->FetchRow()) {
// This Question can go down to the maximum GID on the 1st row
$depqid = $condrow['depqid'];
$depgid = $condrow['depgid'];
$depgorder = $condrow['depgorder'];
$targetqid = $condrow['targqid'];
$targetgid = $condrow['targgid'];
$targetgorder = $condrow['targgorder'];
$condid = $condrow['cid'];
//echo "This question can't go below to GID=$depgid/order=$depgorder because of CID=$condid";
if ($newgid != "all") {
// Get only constraints when trying to move to this group
if ($newgorder > $depgorder) {
$resarray['notBelow'][] = array($depgid, $depgorder, $depqid, $condid);
}
} else {
// get all moves constraints
$resarray['notBelow'][] = array($depgid, $depgorder, $depqid, $condid);
}
}
}
return $resarray;
}
开发者ID:karime7gezly,项目名称:OpenConextApps-LimeSurvey,代码行数:97,代码来源:common_functions.php
示例6: index
//.........这里部分代码省略.........
$databaseoutput .= "<script type=\"text/javascript\">\n<!--\n alert(\"" . $clang->gT("Question could not be updated. There are conditions for other questions that rely on the answers to this question and changing the type will cause problems. You must delete these conditions before you can change the type of this question.", "js") . " ({$qidlist})\")\n //-->\n</script>\n";
} else {
if (isset($gid) && $gid != "") {
// $array_result=checkMoveQuestionConstraintsForConditions(sanitize_int($surveyid),sanitize_int($qid), sanitize_int($gid));
// // If there is no blocking conditions that could prevent this move
//
// if (is_null($array_result['notAbove']) && is_null($array_result['notBelow']))
// {
$questlangs = Survey::model()->findByPk($surveyid)->additionalLanguages;
$baselang = Survey::model()->findByPk($surveyid)->language;
array_push($questlangs, $baselang);
if ($xssfilter) {
$_POST['title'] = $filter->purify($_POST['title']);
} else {
$_POST['title'] = html_entity_decode(Yii::app()->request->getPost('title'), ENT_QUOTES, "UTF-8");
}
// Fix bug with FCKEditor saving strange BR types
$_POST['title'] = fixCKeditorText(Yii::app()->request->getPost('title'));
foreach ($questlangs as $qlang) {
if ($xssfilter) {
$_POST['question_' . $qlang] = $filter->purify($_POST['question_' . $qlang]);
$_POST['help_' . $qlang] = $filter->purify($_POST['help_' . $qlang]);
} else {
$_POST['question_' . $qlang] = html_entity_decode(Yii::app()->request->getPost('question_' . $qlang), ENT_QUOTES, "UTF-8");
$_POST['help_' . $qlang] = html_entity_decode(Yii::app()->request->getPost('help_' . $qlang), ENT_QUOTES, "UTF-8");
}
// Fix bug with FCKEditor saving strange BR types
$_POST['question_' . $qlang] = fixCKeditorText(Yii::app()->request->getPost('question_' . $qlang));
$_POST['help_' . $qlang] = fixCKeditorText(Yii::app()->request->getPost('help_' . $qlang));
if (isset($qlang) && $qlang != "") {
// ToDo: Sanitize the POST variables !
$udata = array('type' => Yii::app()->request->getPost('type'), 'title' => Yii::app()->request->getPost('title'), 'question' => Yii::app()->request->getPost('question_' . $qlang), 'preg' => Yii::app()->request->getPost('preg'), 'help' => Yii::app()->request->getPost('help_' . $qlang), 'gid' => $gid, 'other' => Yii::app()->request->getPost('other'), 'mandatory' => Yii::app()->request->getPost('mandatory'), 'relevance' => Yii::app()->request->getPost('relevance'));
if ($oldgid != $gid) {
if (getGroupOrder($surveyid, $oldgid) > getGroupOrder($surveyid, $gid)) {
// TMSW Conditions->Relevance: What is needed here?
// Moving question to a 'upper' group
// insert question at the end of the destination group
// this prevent breaking conditions if the target qid is in the dest group
$insertorder = getMaxQuestionOrder($gid, $surveyid) + 1;
$udata = array_merge($udata, array('question_order' => $insertorder));
} else {
// Moving question to a 'lower' group
// insert question at the beginning of the destination group
shiftOrderQuestions($surveyid, $gid, 1);
// makes 1 spare room for new question at top of dest group
$udata = array_merge($udata, array('question_order' => 0));
}
}
$condn = array('sid' => $surveyid, 'qid' => $qid, 'language' => $qlang);
$question = Questions::model()->findByAttributes($condn);
foreach ($udata as $k => $v) {
$question->{$k} = $v;
}
$uqresult = $question->save();
//($uqquery); // or safeDie ("Error Update Question: ".$uqquery."<br />"); // Checked)
if (!$uqresult) {
$databaseoutput .= "<script type=\"text/javascript\">\n<!--\n alert(\"" . $clang->gT("Question could not be updated", "js") . "\n\")\n //-->\n</script>\n";
}
}
}
// Update the group ID on subquestions, too
if ($oldgid != $gid) {
Questions::model()->updateAll(array('gid' => $gid), 'qid=:qid and parent_qid>0', array(':qid' => $qid));
// if the group has changed then fix the sortorder of old and new group
Questions::model()->updateQuestionOrder($oldgid, $surveyid);
Questions::model()->updateQuestionOrder($gid, $surveyid);
开发者ID:pmaonline,项目名称:limesurvey-quickstart,代码行数:67,代码来源:database.php
示例7: index
//.........这里部分代码省略.........
if (isset($cccount) && $cccount) {
Yii::app()->setFlashMessage($clang->gT("Question could not be updated. There are conditions for other questions that rely on the answers to this question and changing the type will cause problems. You must delete these conditions before you can change the type of this question."), 'error');
} else {
if (isset($iQuestionGroupID) && $iQuestionGroupID != "") {
// $array_result=checkMoveQuestionConstraintsForConditions(sanitize_int($surveyid),sanitize_int($qid), sanitize_int($gid));
// // If there is no blocking conditions that could prevent this move
//
// if (is_null($array_result['notAbove']) && is_null($array_result['notBelow']))
// {
$aSurveyLanguages = Survey::model()->findByPk($iSurveyID)->additionalLanguages;
$sBaseLanguage = Survey::model()->findByPk($iSurveyID)->language;
array_push($aSurveyLanguages, $sBaseLanguage);
if ($bXSSFilter) {
$_POST['title'] = $oPurifier->purify($_POST['title']);
} else {
$_POST['title'] = html_entity_decode(Yii::app()->request->getPost('title'), ENT_QUOTES, "UTF-8");
}
// Fix bug with FCKEditor saving strange BR types
$_POST['title'] = fixCKeditorText(Yii::app()->request->getPost('title'));
foreach ($aSurveyLanguages as $qlang) {
if ($bXSSFilter) {
$_POST['question_' . $qlang] = $oPurifier->purify($_POST['question_' . $qlang]);
$_POST['help_' . $qlang] = $oPurifier->purify($_POST['help_' . $qlang]);
} else {
$_POST['question_' . $qlang] = html_entity_decode(Yii::app()->request->getPost('question_' . $qlang), ENT_QUOTES, "UTF-8");
$_POST['help_' . $qlang] = html_entity_decode(Yii::app()->request->getPost('help_' . $qlang), ENT_QUOTES, "UTF-8");
}
// Fix bug with FCKEditor saving strange BR types : in rules ?
$_POST['question_' . $qlang] = fixCKeditorText(Yii::app()->request->getPost('question_' . $qlang));
$_POST['help_' . $qlang] = fixCKeditorText(Yii::app()->request->getPost('help_' . $qlang));
if (isset($qlang) && $qlang != "") {
$udata = array('type' => Yii::app()->request->getPost('type'), 'title' => Yii::app()->request->getPost('title'), 'question' => Yii::app()->request->getPost('question_' . $qlang), 'preg' => Yii::app()->request->getPost('preg'), 'help' => Yii::app()->request->getPost('help_' . $qlang), 'gid' => $iQuestionGroupID, 'other' => Yii::app()->request->getPost('other'), 'mandatory' => Yii::app()->request->getPost('mandatory'), 'relevance' => Yii::app()->request->getPost('relevance'));
if ($oldgid != $iQuestionGroupID) {
if (getGroupOrder($iSurveyID, $oldgid) > getGroupOrder($iSurveyID, $iQuestionGroupID)) {
// TMSW Condition->Relevance: What is needed here?
// Moving question to a 'upper' group
// insert question at the end of the destination group
// this prevent breaking conditions if the target qid is in the dest group
$insertorder = getMaxQuestionOrder($iQuestionGroupID, $iSurveyID) + 1;
$udata = array_merge($udata, array('question_order' => $insertorder));
} else {
// Moving question to a 'lower' group
// insert question at the beginning of the destination group
shiftOrderQuestions($iSurveyID, $iQuestionGroupID, 1);
// makes 1 spare room for new question at top of dest group
$udata = array_merge($udata, array('question_order' => 0));
}
}
//$condn = array('sid' => $surveyid, 'qid' => $qid, 'language' => $qlang);
$oQuestion = Question::model()->findByPk(array("qid" => $iQuestionID, 'language' => $qlang));
foreach ($udata as $k => $v) {
$oQuestion->{$k} = $v;
}
$uqresult = $oQuestion->save();
//($uqquery); // or safeDie ("Error Update Question: ".$uqquery."<br />"); // Checked)
if (!$uqresult) {
$bOnError = true;
$aErrors = $oQuestion->getErrors();
if (count($aErrors)) {
foreach ($aErrors as $sAttribute => $aStringErrors) {
foreach ($aStringErrors as $sStringErrors) {
Yii::app()->setFlashMessage(sprintf($clang->gT("Question could not be updated with error on %s: %s"), $sAttribute, $sStringErrors), 'error');
}
}
} else {
Yii::app()->setFlashMessage($clang->gT("Question could not be updated."), 'error');
开发者ID:jdbaltazar,项目名称:survey-office,代码行数:67,代码来源:database.php
注:本文中的getGroupOrder函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论