Exemplo n.º 1
0
 /**
  * Export this data so it can be used as the context for a mustache template.
  *
  * @return stdClass
  */
 public function export_for_template(renderer_base $output)
 {
     $data = new stdClass();
     $data->allcomponents = array();
     $fulltemplatenames = api::list_templates();
     $pluginmanager = core_plugin_manager::instance();
     $components = array();
     foreach ($fulltemplatenames as $templatename) {
         list($component, $templatename) = explode('/', $templatename, 2);
         $components[$component] = 1;
     }
     $components = array_keys($components);
     foreach ($components as $component) {
         $info = new stdClass();
         $info->component = $component;
         if (strpos($component, 'core') === 0) {
             $info->name = get_string('coresubsystem', 'tool_templatelibrary', $component);
         } else {
             $info->name = $pluginmanager->plugin_name($component);
         }
         $data->allcomponents[] = $info;
     }
     return $data;
 }
Exemplo n.º 2
0
 /**
  * Return a mustache template.
  * Note - this function differs from the function core_output_load_template
  * because it will never return a theme overridden version of a template.
  *
  * @param string $component The component that holds the template.
  * @param string $template The name of the template.
  * @return string the template
  */
 public static function load_canonical_template($component, $template)
 {
     $params = self::validate_parameters(self::load_canonical_template_parameters(), array('component' => $component, 'template' => $template));
     $component = $params['component'];
     $template = $params['template'];
     return api::load_canonical_template($component, $template);
 }
Exemplo n.º 3
0
 /**
  * Loads the list of templates.
  * @param string $component Limit the search to a component.
  * @param string $search The search string.
  * @return array[string]
  */
 public static function list_templates($component, $search)
 {
     $params = self::validate_parameters(self::list_templates_parameters(), array('component' => $component, 'search' => $search));
     return api::list_templates($component, $search);
 }