예제 #1
0
 public function __construct($content = '', $icon = false)
 {
     parent::__construct($content);
     if ($icon) {
         $this->setIcon(is_string($icon) ? Icon::create2($icon) : $icon);
     }
 }
예제 #2
0
 /**
  * create a link for a widget
  *
  * @param String $label      Label/content of the link
  * @param String $url        URL/Location of the link
  * @param Mixed  $icon       Icon for the link, should be an Icon
  *                           object; until v3.6 this may be a string
  * @param array  $attributes HTML-attributes for the a-tag in an associative array.
  */
 public function __construct($label, $url, $icon = null, $attributes = array())
 {
     parent::__construct();
     $this->label = $label;
     $this->url = $url;
     $this->attributes = $attributes;
     // DEPRECATED
     // TODO icon may be a string until v3.6
     $this->icon = is_string($icon) ? Icon::create2($icon) : $icon;
 }
예제 #3
0
 public function __construct($label, $id, $language = null)
 {
     $language = $language ?: $GLOBALS['user']->preferred_language;
     try {
         $query = "SELECT content\n                      FROM help_content\n                      WHERE content_id = :id AND language = :language\n                      ORDER BY version DESC\n                      LIMIT 1";
         $statement = DBManager::get()->prepare($query);
         $statement->bindValue(':id', $id);
         $statement->bindValue(':language', $language);
         $statement->execute();
         $text = $statement->fetchColumn() ?: sprintf('Unknown help id "%s"', $id);
         $content = sprintf('<strong>%s</strong><p>%s</p>', htmlReady($label), formatReady($text));
     } catch (Exception $e) {
         if ($GLOBALS['user']->perms === 'root') {
             $content = 'DB-Error: please migrate';
         } else {
             $content = '';
         }
     }
     parent::__construct($content);
 }