[ Index ] |
PHP Cross Reference of Unnamed Project |
[Summary view] [Print] [Text view]
1 <?php 2 // This file is part of Moodle - http://moodle.org/ 3 // 4 // Moodle is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU General Public License as published by 6 // the Free Software Foundation, either version 3 of the License, or 7 // (at your option) any later version. 8 // 9 // Moodle is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU General Public License for more details. 13 // 14 // You should have received a copy of the GNU General Public License 15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 16 17 /** 18 * Class containing data for managecompetencyframeworks page 19 * 20 * @package tool_lp 21 * @copyright 2015 Damyon Wiese 22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 */ 24 namespace tool_lp\output; 25 defined('MOODLE_INTERNAL') || die(); 26 27 use renderable; 28 use templatable; 29 use renderer_base; 30 use single_button; 31 use stdClass; 32 use moodle_url; 33 use context; 34 use context_system; 35 use core_competency\api; 36 use core_competency\competency_framework; 37 use core_competency\external\competency_framework_exporter; 38 39 /** 40 * Class containing data for managecompetencyframeworks page 41 * 42 * @copyright 2015 Damyon Wiese 43 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 44 */ 45 class manage_competency_frameworks_page implements renderable, templatable { 46 47 /** @var context The context in which everything is happening. */ 48 protected $pagecontext; 49 50 /** @var array $navigation List of links to display on the page. Each link contains a url and a title. */ 51 protected $navigation = array(); 52 53 /** @var array $competencyframeworks List of competency frameworks. */ 54 protected $competencyframeworks = array(); 55 56 /** @var bool $canmanage Result of permissions checks. */ 57 protected $canmanage = false; 58 59 /** @var moodle_url $pluginurlbase Base url to use constructing links. */ 60 protected $pluginbaseurl = null; 61 62 /** 63 * Construct this renderable. 64 * 65 * @param context $pagecontext The page context 66 */ 67 public function __construct(context $pagecontext) { 68 $this->pagecontext = $pagecontext; 69 70 if (competency_framework::can_manage_context($this->pagecontext)) { 71 $addpage = new single_button( 72 new moodle_url('/admin/tool/lp/editcompetencyframework.php', array('pagecontextid' => $this->pagecontext->id)), 73 get_string('addnewcompetencyframework', 'tool_lp'), 74 'get' 75 ); 76 $this->navigation[] = $addpage; 77 } 78 79 $this->competencyframeworks = api::list_frameworks('shortname', 'ASC', 0, 0, $this->pagecontext); 80 } 81 82 /** 83 * Export this data so it can be used as the context for a mustache template. 84 * 85 * @param renderer_base $output Renderer base. 86 * @return stdClass 87 */ 88 public function export_for_template(renderer_base $output) { 89 $data = new stdClass(); 90 $data->competencyframeworks = array(); 91 $data->pagecontextid = $this->pagecontext->id; 92 foreach ($this->competencyframeworks as $framework) { 93 $exporter = new competency_framework_exporter($framework); 94 $data->competencyframeworks[] = $exporter->export($output); 95 } 96 $data->pluginbaseurl = (new moodle_url('/admin/tool/lp'))->out(true); 97 $data->navigation = array(); 98 foreach ($this->navigation as $button) { 99 $data->navigation[] = $output->render($button); 100 } 101 102 return $data; 103 } 104 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Thu Aug 11 10:00:09 2016 | Cross-referenced by PHPXref 0.7.1 |