Skip to content

Commit

Permalink
Dev Removed obsolete functions
Browse files Browse the repository at this point in the history
  • Loading branch information
c-schmitz committed Jan 14, 2018
1 parent 9314b97 commit fb973c7
Show file tree
Hide file tree
Showing 17 changed files with 75 additions and 280 deletions.
18 changes: 9 additions & 9 deletions application/controllers/admin/database.php
Expand Up @@ -176,7 +176,7 @@ private function actionUpdateDefaultValues($iSurveyID)
$arQuestion = Question::model()->findByAttributes(array('qid'=>$this->iQuestionID));
$sQuestionType = $arQuestion['type'];

$aQuestionTypeList = getQuestionTypeList('', 'array');
$aQuestionTypeList = Question::typeList();
if ($aQuestionTypeList[$sQuestionType]['answerscales'] > 0 && $aQuestionTypeList[$sQuestionType]['subquestions'] == 0) {
for ($iScaleID = 0; $iScaleID < $aQuestionTypeList[$sQuestionType]['answerscales']; $iScaleID++) {
foreach ($aSurveyLanguages as $sLanguage) {
Expand Down Expand Up @@ -247,7 +247,7 @@ private function actionUpdateAnswerOptions($iSurveyID)
$survey = Survey::model()->findByPk($iSurveyID);
$arQuestion = Question::model()->findByAttributes(array('qid'=>$this->iQuestionID));
$sQuestionType = $arQuestion['type']; // Checked)
$aQuestionTypeList = getQuestionTypeList('', 'array');
$aQuestionTypeList = Question::typeList();
$iScaleCount = $aQuestionTypeList[$sQuestionType]['answerscales'];
/* for already activated survey and rank question type : fix the maxDbAnswer before deleting answers */
/* @todo : add it to upgrage DB system, and see for the lsa */
Expand Down Expand Up @@ -353,7 +353,7 @@ private function actionSubQuestions($iSurveyID)

$arQuestion = Question::model()->findByAttributes(array('qid'=>$this->iQuestionID));
$sQuestionType = $arQuestion['type']; // Checked
$aQuestionTypeList = getQuestionTypeList('', 'array');
$aQuestionTypeList = Question::typeList();
$iScaleCount = $aQuestionTypeList[$sQuestionType]['subquestions'];
// First delete any deleted ids
$aDeletedQIDs = explode(' ', trim(Yii::app()->request->getPost('deletedqids')));
Expand Down Expand Up @@ -605,7 +605,7 @@ private function actionUpdateQuestion($iSurveyID)
}
}

$aQuestionTypeList = getQuestionTypeList('', 'array');
$aQuestionTypeList = Question::typeList();
// These are the questions types that have no answers and therefore we delete the answer in that case
$iAnswerScales = $aQuestionTypeList[$sQuestionType]['answerscales'];
$iSubquestionScales = $aQuestionTypeList[$sQuestionType]['subquestions'];
Expand Down Expand Up @@ -673,18 +673,18 @@ private function actionUpdateQuestion($iSurveyID)
$oQuestion->modulename = '';
}
if ($oldgid != $this->iQuestionGroupID) {
if (getGroupOrder($iSurveyID, $oldgid) > getGroupOrder($iSurveyID, $this->iQuestionGroupID)) {
if (getGroupOrder($oldgid) > getGroupOrder($this->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($this->iQuestionGroupID, $iSurveyID) + 1;
$insertorder = getMaxQuestionOrder($this->iQuestionGroupID) + 1;
$oQuestion->question_order = $insertorder;
} else {
// Moving question to a 'lower' group
// insert question at the beginning of the destination group
shiftOrderQuestions($iSurveyID, $this->iQuestionGroupID, 1); // makes 1 spare room for new question at top of dest group
Question::model()->updateQuestionOrder($this->iQuestionGroupID, $iSurveyID); // makes 1 spare room for new question at top of dest group
$oQuestion->question_order = 0;
}
}
Expand Down Expand Up @@ -735,7 +735,7 @@ private function actionUpdateQuestion($iSurveyID)
Question::model()->updateQuestionOrder($this->iQuestionGroupID, $iSurveyID);
// If some questions have conditions set on this question's answers
// then change the cfieldname accordingly
fixMovedQuestionConditions($this->iQuestionID, $oldgid, $this->iQuestionGroupID);
Condition::model()->updateCFieldName($iSurveyID, $this->iQuestionID, $oldgid, $this->iQuestionGroupID);
}
// Update subquestions
if ($oldtype != $sQuestionType) {
Expand Down Expand Up @@ -1205,7 +1205,7 @@ private function actionInsertCopyQuestion($iSurveyID)
$sQuery = "UPDATE {{questions}} SET question_order=question_order+1 WHERE gid=:gid AND question_order >= :order";
Yii::app()->db->createCommand($sQuery)->bindValues(array(':gid'=>$this->iQuestionGroupID, ':order'=>$iQuestionOrder))->query();
} else {
$iQuestionOrder = getMaxQuestionOrder($this->iQuestionGroupID, $iSurveyID);
$iQuestionOrder = getMaxQuestionOrder($this->iQuestionGroupID);
$iQuestionOrder++;
}
$sQuestionText = Yii::app()->request->getPost('question_'.$sBaseLanguage, '');
Expand Down
2 changes: 1 addition & 1 deletion application/controllers/admin/globalsettings.php
Expand Up @@ -230,7 +230,7 @@ private function _saveSettings()

if (!Yii::app()->getConfig('demoMode')) {
$sTemplate = Yii::app()->getRequest()->getPost("defaulttheme");
if (array_key_exists($sTemplate, getTemplateList())) {
if (array_key_exists($sTemplate, Template::getTemplateList())) {
// Filter template name
setGlobalSetting('defaulttheme', $sTemplate);
}
Expand Down
7 changes: 1 addition & 6 deletions application/controllers/admin/questiongroups.php
Expand Up @@ -240,7 +240,7 @@ public function delete($iSurveyId, $iGroupId)
$iGroupsDeleted = QuestionGroup::deleteWithDependency($iGroupId, $iSurveyId);

if ($iGroupsDeleted > 0) {
fixSortOrderGroups($iSurveyId);
QuestionGroup::model()->updateGroupOrder($iSurveyId);
Yii::app()->setFlashMessage(gT('The question group was deleted.'));
} else {
Yii::app()->setFlashMessage(gT('Group could not be deleted'), 'error');
Expand Down Expand Up @@ -490,11 +490,6 @@ public function update($gid)
$oGroupLS->$k = $v;
}
$ugresult2 = $oGroupLS->save();


if ($ugresult && $ugresult2) {
$groupsummary = getGroupList($gid, $surveyid);
}
}
}

Expand Down
18 changes: 9 additions & 9 deletions application/controllers/admin/questions.php
Expand Up @@ -66,7 +66,7 @@ public function view($surveyid, $gid, $qid)
$aData['oQuestion'] = $oQuestion;
$qrrow = $oQuestion->attributes;
$aData['languagelist'] = $survey->allLanguages;
$aData['qtypes'] = getQuestionTypeList('', 'array');
$aData['qtypes'] = Question::typeList();

$qshowstyle = "";

Expand Down Expand Up @@ -275,7 +275,7 @@ public function editdefaultvalues($surveyid, $gid, $qid)

$questionrow = $oQuestion->attributes;

$qtproperties = getQuestionTypeList('', 'array');
$qtproperties = Question::typeList();

$langopts = array();
foreach ($survey->allLanguages as $language) {
Expand Down Expand Up @@ -473,7 +473,7 @@ public function _editansweroptions($surveyid, $gid, $qid)
$oQuestion = $qrow = Question::model()->findByPk($qid);
$qtype = $qrow['type'];

$qtypes = getQuestionTypeList('', 'array');
$qtypes = Question::typeList();

$scalecount = $qtypes[$qtype]['answerscales'];

Expand Down Expand Up @@ -685,7 +685,7 @@ public function _editsubquestion($surveyid, $gid, $qid)
$aParentQuestion = $oQuestion->attributes;

$sQuestiontype = $aParentQuestion['type'];
$aQuestiontypeInfo = getQuestionTypeList($sQuestiontype, 'array');
$aQuestiontypeInfo = Question::typeList();
$iScaleCount = $aQuestiontypeInfo[$sQuestiontype]['subquestions'];

for ($iScale = 0; $iScale < $iScaleCount; $iScale++) {
Expand Down Expand Up @@ -778,7 +778,7 @@ public function _editsubquestion($surveyid, $gid, $qid)
* The following line decides if the assessment input fields are visible or not
* for some question types the assessment values is set in the label set instead of the answers
*/
$qtypes = getQuestionTypeList('', 'array');
$qtypes = Question::typeList();
Yii::app()->loadHelper('surveytranslator');

$aData['scalecount'] = $scalecount = $qtypes[$qtype]['subquestions'];
Expand Down Expand Up @@ -998,7 +998,7 @@ public function newquestion($surveyid)

$baselang = $survey->language;

$qtypelist = getQuestionTypeList('', 'array');
$qtypelist = Question::typeList();

$aData['ajaxDatas']['qTypeOutput'] = json_encode($qtypelist);

Expand Down Expand Up @@ -1200,7 +1200,7 @@ public function index($sa, $surveyid, $gid, $qid = null)
LimeExpressionManager::StartProcessingPage(false, true); // so can click on syntax highlighting to edit questions
}

$qtypelist = getQuestionTypeList('', 'array');
$qtypelist = Question::typeList();
$aData['qTypeOutput'] = json_encode($qtypelist);

if ($adding) {
Expand Down Expand Up @@ -1426,7 +1426,7 @@ public function setMultipleQuestionGroup()
// If survey is active it should not be possible to update
if ($iQuestionOrder == "") {
// If asked "at the endd"
$iQuestionOrder = (getMaxQuestionOrder($oQuestionGroup->gid, $oSurvey->sid));
$iQuestionOrder = (getMaxQuestionOrder($oQuestionGroup->gid));

// We get the last question order, so we want the number just after it
// Unless it's 0
Expand Down Expand Up @@ -1812,7 +1812,7 @@ public function preview($surveyid, $qid, $lang = null)

$question = $answers[0][0];
$question['code'] = $answers[0][5];
$question['class'] = getQuestionClass($qrows['type']);
$question['class'] = Question::getQuestionClass($qrows['type']);
$question['essentials'] = 'id="question'.$qrows['qid'].'"';
$question['sgq'] = $ia[1];
$question['aid'] = 'unknown';
Expand Down
4 changes: 2 additions & 2 deletions application/controllers/admin/surveyadmin.php
Expand Up @@ -701,7 +701,7 @@ public function activate($iSurveyID)
Yii::app()->setFlashMessage(gT("This survey is already active."), 'error');
$this->getController()->redirect(array('admin/survey', 'sa'=>'view', 'surveyid'=>$iSurveyID));

} $qtypes = getQuestionTypeList('', 'array');
} $qtypes = Question::typeList();
Yii::app()->loadHelper("admin/activate");

if (Yii::app()->request->getPost('ok') == '') {
Expand Down Expand Up @@ -1188,7 +1188,7 @@ private function _reorderGroup($iSurveyID)
$oldGid = $oQuestion['gid'];

if ($oldGid != $gid) {
fixMovedQuestionConditions($qid, $oldGid, $gid, $iSurveyID);
Condition::model()->updateCFieldName($iSurveyID, $qid, $oldGid, $gid);
}
Question::model()->updateAll(array('question_order' => $aQuestionOrder[$gid], 'gid' => $gid), 'qid=:qid', array(':qid' => $qid));
Question::model()->updateAll(array('gid' => $gid), 'parent_qid=:parent_qid', array(':parent_qid' => $qid));
Expand Down
4 changes: 2 additions & 2 deletions application/controllers/admin/themes.php
Expand Up @@ -449,7 +449,7 @@ public function templaterename()
$sNewDirectoryPath = Yii::app()->getConfig('userthemerootdir')."/".$sNewName;
$sOldDirectoryPath = Yii::app()->getConfig('userthemerootdir')."/".returnGlobal('copydir');

if (isStandardTemplate(returnGlobal('newname'))) {
if (Template::isStandardTemplate(returnGlobal('newname'))) {
Yii::app()->user->setFlash('error', sprintf(gT("Template could not be renamed to '%s'."), $sNewName)." ".gT("This name is reserved for standard template."));

$this->getController()->redirect(array("admin/themes/sa/upload"));
Expand Down Expand Up @@ -857,7 +857,7 @@ protected function _initialise($templatename, $screenname, $editfile, $showsumma
if (in_array(Yii::app()->session['adminlang'], $availableeditorlanguages)) {
$sLanguageCode = Yii::app()->session['adminlang'];
}
$aAllTemplates = getTemplateList();
$aAllTemplates = Template::getTemplateList();
if (!isset($aAllTemplates[$templatename])) {
$templatename = getGlobalSetting('defaulttheme');
}
Expand Down
2 changes: 1 addition & 1 deletion application/controllers/admin/useraction.php
Expand Up @@ -696,7 +696,7 @@ private function _getUserNameFromUid($uid)

private function _refreshtemplates()
{
$template_a = getTemplateList();
$template_a = Template::getTemplateList();
foreach ($template_a as $tp => $fullpath) {
// check for each folder if there is already an entry in the database
// if not create it with current user as creator (user with rights "create user" can assign template rights)
Expand Down
2 changes: 1 addition & 1 deletion application/core/Survey_Common_Action.php
Expand Up @@ -551,7 +551,7 @@ public function _questionbar($aData)

$qrrow = $qrrow->attributes;
$aData['languagelist'] = $oSurvey->getAllLanguages();
$aData['qtypes'] = getQuestionTypeList('', 'array');
$aData['qtypes'] = Question::typeList();
$aData['action'] = $action;
$aData['surveyid'] = $iSurveyID;
$aData['qid'] = $qid;
Expand Down
2 changes: 1 addition & 1 deletion application/helpers/admin/template_helper.php
Expand Up @@ -113,7 +113,7 @@ function recursive_in_array($needle, $haystack)
*/
function is_template_editable($templatename)
{
if (isStandardTemplate($templatename) && Yii::app()->getConfig("standard_themes_readonly") == true) {
if (Template::isStandardTemplate($templatename) && Yii::app()->getConfig("standard_themes_readonly") == true) {
return false;
} else {
return true;
Expand Down

0 comments on commit fb973c7

Please sign in to comment.