芝麻web文件管理V1.00
编辑当前文件:/home2/sdektunc/public_html/cepali/admin/tool/lp/classes/output/module_navigation.php
. /** * User navigation class. * * @package tool_lp * @copyright 2019 Damyon Wiese * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ namespace tool_lp\output; defined('MOODLE_INTERNAL') || die(); use renderable; use renderer_base; use templatable; use context_course; use core_course\external\course_module_summary_exporter; use stdClass; /** * User course navigation class. * * @package tool_lp * @copyright 2015 Damyon Wiese * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class module_navigation implements renderable, templatable { /** @var courseid */ protected $courseid; /** @var moduleid */ protected $moduleid; /** @var baseurl */ protected $baseurl; /** * Construct. * * @param int $courseid * @param int $moduleid * @param string $baseurl */ public function __construct($courseid, $moduleid, $baseurl) { $this->courseid = $courseid; $this->moduleid = $moduleid; $this->baseurl = $baseurl; } /** * Export the data. * * @param renderer_base $output * @return stdClass */ public function export_for_template(renderer_base $output) { $context = context_course::instance($this->courseid); $data = new stdClass(); $data->courseid = $this->courseid; $data->moduleid = $this->moduleid; $data->baseurl = $this->baseurl; $data->hasmodules = false; $data->modules = array(); $data->hasmodules = true; $data->modules = array(); $empty = (object)['id' => 0, 'name' => get_string('nofiltersapplied')]; $data->modules[] = $empty; $modinfo = get_fast_modinfo($this->courseid); foreach ($modinfo->get_cms() as $cm) { if ($cm->uservisible) { $exporter = new course_module_summary_exporter(null, ['cm' => $cm]); $module = $exporter->export($output); if ($module->id == $this->moduleid) { $module->selected = true; } $data->modules[] = $module; $data->hasmodules = true; } } return $data; } }