public static function OpignoTincanQuestionTypeQuestion::getInfoFromExtractedPackage in Opigno TinCan Question Type 7
This method will return the Activity ID and the launch file.
These information must be in the tincan.xml file that is in the extracted package. You can find more information in the README.md file of this module.
Parameters
object $file: The file that was unzipped.
Return value
array|bool An array('id', 'launch') if all the information are found, FALSE if not.
2 calls to OpignoTincanQuestionTypeQuestion::getInfoFromExtractedPackage()
- OpignoTincanQuestionTypeQuestion::saveNodeProperties in includes/
opigno_tincan_question_type.question.inc - Save question type specific node properties.
- OpignoTincanQuestionTypeQuestion::validateNode in includes/
opigno_tincan_question_type.question.inc - Provides validation for question before it is created.
File
- includes/
opigno_tincan_question_type.question.inc, line 359 - This file contains the class OpignoTincanQuestionTypeQuestion.
Class
- OpignoTincanQuestionTypeQuestion
- This class goal is to provide specific TinCan question information.
Code
public static function getInfoFromExtractedPackage($file) {
$tincan_file = self::getExtractPath($file) . 'tincan.xml';
if (!file_exists(self::getExtractPath($file) . 'tincan.xml')) {
return FALSE;
}
$xml = simplexml_load_file($tincan_file);
if (!$xml) {
return FALSE;
}
// Check if the launch exists.
if (!isset($xml->activities->activity->launch)) {
return FALSE;
}
// Check if the activity ID exists.
if (!isset($xml->activities->activity['id'])) {
return FALSE;
}
return array(
'launch' => (string) $xml->activities->activity->launch,
'id' => (string) $xml->activities->activity['id'],
);
}