示例#1
0
 public function __construct(custom_menu_item $menunode)
 {
     parent::__construct($menunode->get_text(), $menunode->get_url(), $menunode->get_title(), $menunode->get_sort_order(), $menunode->get_parent());
     $this->children = $menunode->get_children();
     $matches = array();
     if (preg_match('/^\\[\\[([a-zA-Z0-9\\-\\_\\:]+)\\]\\]$/', $this->text, $matches)) {
         try {
             $this->text = get_string($matches[1], 'theme_rocket');
         } catch (Exception $e) {
             $this->text = $matches[1];
         }
     }
     $matches = array();
     if (preg_match('/^\\[\\[([a-zA-Z0-9\\-\\_\\:]+)\\]\\]$/', $this->title, $matches)) {
         try {
             $this->title = get_string($matches[1], 'theme_rocket');
         } catch (Exception $e) {
             $this->title = $matches[1];
         }
     }
 }
示例#2
0
 /**
  * Creates the custom menu
  *
  * @param string $definition the menu items definition in syntax required by {@link convert_text_to_menu_nodes()}
  * @param string $currentlanguage the current language code, null disables multilang support
  */
 public function __construct($definition = '', $currentlanguage = null)
 {
     $this->currentlanguage = $currentlanguage;
     parent::__construct('root');
     // create virtual root element of the menu
     if (!empty($definition)) {
         $this->override_children(self::convert_text_to_menu_nodes($definition, $currentlanguage));
     }
 }
示例#3
0
 /**
  * Creates the custom menu
  * @param string $text Sets the text for this custom menu, never gets used and is optional
  */
 public function __construct($text='base') {
     global $CFG;
     parent::__construct($text);
     if (!empty($CFG->custommenuitems)) {
         $this->override_children(self::convert_text_to_menu_nodes($CFG->custommenuitems));
     }
 }