identifier = $id; $this->type = $type; $this->file = $file; } /** * Check if the given type is allowed as a QTI Resource * * @param string $type * @return boolean */ public static function isAllowed($type) { return (!empty($type) && (in_array($type, self::$allowedTypes))) || self::isAssessmentItem($type) || self::isAssessmentTest($type); } /** * Check if the given type is allowed as a QTI item type * * @param string $type * @return boolean */ public static function isAssessmentItem($type) { return (!empty($type) && in_array($type, self::$itemTypes)); } /** * Check if the given type is allowed as a QTI test type * * @param string $type * @return boolean */ public static function isAssessmentTest($type) { return (!empty($type) && in_array($type, self::$testTypes)); } /** * Get all valid test types * * @return array */ public static function getTestTypes() { return self::$testTypes; } /** * Get all valid item types * * @return array */ public static function getItemTypes() { return self::$itemTypes; } /** * Get the identifier of the resource. * * @return string */ public function getIdentifier() { return $this->identifier; } public function setIdentifier($identifier) { $this->identifier = $identifier; } /** * Get the URI of the main referenced file. * * @return string */ public function getFile() { return (string) $this->file; } /** * Get the qti resource type: * * @return string */ public function getType() { return (string) $this->type; } /** * Set the list of auxiliary files bound to this resource. * * @param array $files An array of strings representing URIs. */ public function setAuxiliaryFiles(array $files) { $this->auxiliaryFiles = $files; } /** * Add an auxiliary file to the resource. * * @param string $file The URI referencing the file. */ public function addAuxiliaryFile($file) { $this->auxiliaryFiles[] = $file; } /** * Get the list of auxiliary files bound to this resource. * * @return array An array of strings representing URIs. */ public function getAuxiliaryFiles() { return (array) $this->auxiliaryFiles; } /** * Set the list of dependencies to this resource. * * @param array $dependencies An array of strings representing identifiers. */ public function setDependencies(array $dependencies) { $this->dependencies = $dependencies; } /** * Add a dependency to this resource. * * @param string $dependency An identifier. */ public function addDependency($dependency) { $this->dependencies[] = $dependency; } /** * Get the list of dependencies to this resource. * * @return array An array of strings representing identifiers. */ public function getDependencies() { return $this->dependencies; } }