/** * internal helper function, that converts between the format constant, * which might be too specific (eg 'image') and the class in our *supported* list * which might be higher up the format hierarchy tree (eg 'file') */ private function resolve_format() { global $CFG; $thisformat = $this->get_export_config('format'); $allformats = portfolio_supported_formats(); require_once($CFG->libdir . '/portfolio/formats.php'); $thisobj = new $allformats[$thisformat]; foreach ($this->supported_formats() as $f) { $class = $allformats[$f]; if ($thisobj instanceof $class) { return $f; } } }
/** * helper function to return a format object from the constant * * @param string $name the constant PORTFOLIO_FORMAT_XXX * * @return portfolio_format object */ function portfolio_format_object($name) { $formats = portfolio_supported_formats(); return new $formats[$name](); }
/** * helper function to return a format object from the constant * * @param string $name the constant PORTFOLIO_FORMAT_XXX * * @return portfolio_format object */ function portfolio_format_object($name) { global $CFG; require_once $CFG->libdir . '/portfolio/formats.php'; $formats = portfolio_supported_formats(); return new $formats[$name](); }
private function resolve_format() { $thisformat = $this->get_export_config('format'); $allformats = portfolio_supported_formats(); $thisobj = new $allformats[$thisformat](); foreach ($this->supported_formats() as $f) { $class = $allformats[$f]; if ($thisobj instanceof $class) { return $f; } } }