Skip to content

Commit

Permalink
Dev: Factor out getAttributeNames()
Browse files Browse the repository at this point in the history
  • Loading branch information
olleharstedt committed Oct 6, 2016
1 parent a83ebf8 commit de3bf36
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
11 changes: 11 additions & 0 deletions application/helpers/QuestionObjectHelper.php
Expand Up @@ -59,6 +59,7 @@ public static function getQuestionText($extendedType)
}

/**
* @todo Order of this and getQuestionCodes matter, should be fixed.
* @param string $extendedType
* @return string html
*/
Expand All @@ -81,6 +82,16 @@ public static function getQuestionCodes($extendedType)
return $question->getQuestionCodes();
}

/**
* @param string $extendedType
* @return array
*/
public static function getAttributeNames($extendedType)
{
$question = self::getInstance($extendedType);
return $question->getAttributeNames();
}

/**
* @todo Validate $extendedType
* @todo Check if extended type is core type
Expand Down
4 changes: 1 addition & 3 deletions application/models/QuestionAttribute.php
Expand Up @@ -202,9 +202,7 @@ public function getQuestionAttributes($iQuestionID)

//$extendedType = $oQuestion->extended_type;
// TODO: Should check installation table and match question class name with extended_type.
require_once(Yii::app()->basePath . '/core/questions/TestQuestionObject/TestQuestionObject.php');
$extendedQuestion = TestQuestionObject::getInstance();
$aAttributeNames = $extendedQuestion->getAttributeNames();
$aAttributeNames = \ls\helpers\QuestionObjectHelper::getAttributeNames($oQuestion->extended_type);
}
else
{
Expand Down

0 comments on commit de3bf36

Please sign in to comment.