Skip to content

Commit

Permalink
Fixed issue #15585: Custom question attributes not available
Browse files Browse the repository at this point in the history
  • Loading branch information
ptelu committed Jan 16, 2020
1 parent 7c04afd commit 43300c5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion application/models/Question.php
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ public static function getQuestionTemplateAttributes($aAttributeNames, $aAttribu
$oQuestionTemplate = QuestionTemplate::getInstance($oQuestion);
if ($oQuestionTemplate->bHasCustomAttributes) {
// Add the custom attributes to the list
foreach ($oQuestionTemplate->oConfig->attributes as $attribute) {
foreach ($oQuestionTemplate->oConfig->attributes->attribute as $attribute) {
$sAttributeName = (string) $attribute->name;
$sInputType = (string)$attribute->inputtype;
// remove attribute if inputtype is empty
Expand Down
1 change: 1 addition & 0 deletions application/models/QuestionAttribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ public function getQuestionAttributes($iQuestionID, $sLanguage = null)
/* Get whole existing attribute for this question in an array*/
$oAttributeValues = self::model()->findAll("qid=:qid", array('qid'=>$iQuestionID));

// insert additional attributes from an extended question theme
foreach ($oAttributeValues as $oAttributeValue) {
if ($oAttributeValue->attribute == 'question_template') {
$aAttributeValues['question_template'] = $oAttributeValue->value;
Expand Down
8 changes: 4 additions & 4 deletions application/models/QuestionTemplate.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,10 @@ public function getTemplatePath()
$sUserQTemplateRootDir = Yii::app()->getConfig("userquestionthemerootdir");

// Core templates come first
if (is_dir("$sCoreQTemplateRootDir/$sTemplateFolderName/")) {
$this->sTemplatePath = "$sCoreQTemplateRootDir/$sTemplateFolderName/";
} elseif (is_dir("$sUserQTemplateRootDir/$sTemplateFolderName/")) {
$this->sTemplatePath = "$sUserQTemplateRootDir/$sTemplateFolderName/";
if (is_dir("$sCoreQTemplateRootDir/$sTemplateFolderName")) {
$this->sTemplatePath = "$sCoreQTemplateRootDir/$sTemplateFolderName";
} elseif (is_dir("$sUserQTemplateRootDir/$sTemplateFolderName")) {
$this->sTemplatePath = "$sUserQTemplateRootDir/$sTemplateFolderName";
}
}
return $this->sTemplatePath;
Expand Down

0 comments on commit 43300c5

Please sign in to comment.