本文整理匯總了PHP中grading_manager::set_context方法的典型用法代碼示例。如果您正苦於以下問題:PHP grading_manager::set_context方法的具體用法?PHP grading_manager::set_context怎麽用?PHP grading_manager::set_context使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類grading_manager
的用法示例。
在下文中一共展示了grading_manager::set_context方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: get_grading_manager
/**
* Factory method returning an instance of the grading manager
*
* There are basically ways how to use this factory method. If the area record
* id is known to the caller, get the manager for that area by providing just
* the id. If the area record id is not know, the context, component and area name
* can be provided. Note that null values are allowed in the second case as the context,
* component and the area name can be set explicitly later.
*
* @category grading
* @example $manager = get_grading_manager($areaid);
* @example $manager = get_grading_manager(context_system::instance());
* @example $manager = get_grading_manager($context, 'mod_assignment', 'submission');
* @param stdClass|int|null $context_or_areaid if $areaid is passed, no other parameter is needed
* @param string|null $component the frankenstyle name of the component
* @param string|null $area the name of the gradable area
* @return grading_manager
*/
function get_grading_manager($context_or_areaid = null, $component = null, $area = null)
{
global $DB;
$manager = new grading_manager();
if (is_object($context_or_areaid)) {
$context = $context_or_areaid;
} else {
$context = null;
if (is_numeric($context_or_areaid)) {
$manager->load($context_or_areaid);
return $manager;
}
}
if (!is_null($context)) {
$manager->set_context($context);
}
if (!is_null($component)) {
$manager->set_component($component);
}
if (!is_null($area)) {
$manager->set_area($area);
}
return $manager;
}