ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilContentStyleSettings Class Reference

Content style settings. More...

+ Collaboration diagram for ilContentStyleSettings:

Public Member Functions

 __construct ()
 
 addStyle (int $a_style_id)
 Add style to style folder. More...
 
 removeStyle (int $a_id)
 remove Style from style list More...
 
 update ()
 
 read ()
 
 getStyles ()
 

Data Fields

array $styles = array()
 

Protected Attributes

ilDBInterface $db
 

Detailed Description

Content style settings.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e

Definition at line 25 of file class.ilContentStyleSettings.php.

Constructor & Destructor Documentation

◆ __construct()

ilContentStyleSettings::__construct ( )

Definition at line 30 of file class.ilContentStyleSettings.php.

31 {
32 global $DIC;
33
34 $this->db = $DIC->database();
35 $this->read();
36 }
global $DIC
Definition: shib_login.php:26

References $DIC, and read().

+ Here is the call graph for this function:

Member Function Documentation

◆ addStyle()

ilContentStyleSettings::addStyle ( int  $a_style_id)

Add style to style folder.

Definition at line 41 of file class.ilContentStyleSettings.php.

41 : void
42 {
43 $this->styles[$a_style_id] =
44 array("id" => $a_style_id,
45 "title" => ilObject::_lookupTitle($a_style_id));
46 }
static _lookupTitle(int $obj_id)

References ilObject\_lookupTitle().

+ Here is the call graph for this function:

◆ getStyles()

ilContentStyleSettings::getStyles ( )

Definition at line 94 of file class.ilContentStyleSettings.php.

94 : array
95 {
96 return $this->styles;
97 }

References $styles.

◆ read()

ilContentStyleSettings::read ( )

Definition at line 74 of file class.ilContentStyleSettings.php.

74 : void
75 {
77
78 // get styles of style folder
79 $q = "SELECT * FROM style_folder_styles JOIN style_data ON (style_id = style_data.id)";
80
81 $style_set = $ilDB->query($q);
82 $this->styles = array();
83 while ($style_rec = $ilDB->fetchAssoc($style_set)) {
84 $this->styles[$style_rec["style_id"]] =
85 array("id" => $style_rec["style_id"],
86 "title" => ilObject::_lookupTitle((int) $style_rec["style_id"]),
87 "category" => $style_rec["category"]);
88 }
89
90 $this->styles =
91 ilArrayUtil::sortArray($this->styles, "title", "asc", false, true);
92 }
static sortArray(array $array, string $a_array_sortby_key, string $a_array_sortorder="asc", bool $a_numeric=false, bool $a_keep_keys=false)
$q
Definition: shib_logout.php:23

References $db, $ilDB, $q, ilObject\_lookupTitle(), and ilArrayUtil\sortArray().

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeStyle()

ilContentStyleSettings::removeStyle ( int  $a_id)

remove Style from style list

Definition at line 51 of file class.ilContentStyleSettings.php.

51 : void
52 {
53 unset($this->styles[$a_id]);
54 }

◆ update()

ilContentStyleSettings::update ( )

Definition at line 56 of file class.ilContentStyleSettings.php.

56 : bool
57 {
59
60 // save styles of style folder
61 // note: there are no different style folders in ILIAS, only the one in the settings
62 $q = "DELETE FROM style_folder_styles";
63 $ilDB->manipulate($q);
64 foreach ($this->styles as $style) {
65 $q = "INSERT INTO style_folder_styles (folder_id, style_id) VALUES" .
66 "(" . $ilDB->quote(0, "integer") . ", " .
67 $ilDB->quote((int) $style["id"], "integer") . ")";
68 $ilDB->manipulate($q);
69 }
70
71 return true;
72 }

References $db, $ilDB, and $q.

Field Documentation

◆ $db

ilDBInterface ilContentStyleSettings::$db
protected

Definition at line 27 of file class.ilContentStyleSettings.php.

Referenced by read(), and update().

◆ $styles

array ilContentStyleSettings::$styles = array()

Definition at line 28 of file class.ilContentStyleSettings.php.

Referenced by getStyles().


The documentation for this class was generated from the following file: