示例#1
0
 /**
  * Constructor.
  *
  * @param stdClass $module The module.
  * @param context $context The relevant context.
  */
 public function __construct($module, context $context)
 {
     // The property 'name' may contain more than just the module, in which case we need to extract the true module name.
     $modulename = $module->name;
     if ($colon = strpos($modulename, ':')) {
         $modulename = substr($modulename, 0, $colon);
     }
     $icon = new pix_icon('icon', '', $modulename, ['class' => 'icon']);
     $help = isset($module->help) ? $module->help : new lang_string('nohelpforactivityorresource', 'moodle');
     parent::__construct($module->name, $module->title, $module->link->out(false), $icon, $help, $context);
 }
示例#2
0
 /**
  * Constructor.
  *
  * @param object $qtype The question type.
  * @param context $context The relevant context.
  */
 public function __construct($qtype, $context)
 {
     $icon = new pix_icon('icon', $qtype->local_name(), $qtype->plugin_name(), ['class' => 'icon', 'title' => $qtype->local_name()]);
     $help = new lang_string('pluginnamesummary', $qtype->plugin_name());
     parent::__construct($qtype->plugin_name(), $qtype->menu_name(), $qtype->name(), $icon, $help, $context);
 }