ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilContentStyleSettings Class Reference

Content style settings. More...

+ Collaboration diagram for ilContentStyleSettings:

Public Member Functions

 __construct ()
 Constructor. More...
 
 addStyle ($a_style_id)
 Add style to style folder. More...
 
 removeStyle ($a_id)
 remove Style from style list More...
 
 update ()
 update object data More...
 
 read ()
 read style folder data More...
 
 getStyles ()
 get style ids More...
 

Data Fields

 $styles = array()
 

Protected Attributes

 $db
 

Detailed Description

Content style settings.

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

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

Constructor & Destructor Documentation

◆ __construct()

ilContentStyleSettings::__construct ( )

Constructor.

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

References $DIC, and read().

25  {
26  global $DIC;
27 
28  $this->db = $DIC->database();
29  $this->read();
30  }
global $DIC
Definition: saml.php:7
+ Here is the call graph for this function:

Member Function Documentation

◆ addStyle()

ilContentStyleSettings::addStyle (   $a_style_id)

Add style to style folder.

Parameters
int$a_style_idstyle id

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

References ilObject\_lookupTitle().

38  {
39  $this->styles[$a_style_id] =
40  array("id" => $a_style_id,
41  "title" => ilObject::_lookupTitle($a_style_id));
42  }
static _lookupTitle($a_id)
lookup object title
+ Here is the call graph for this function:

◆ getStyles()

ilContentStyleSettings::getStyles ( )

get style ids

Returns
array ids

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

References $styles.

◆ read()

ilContentStyleSettings::read ( )

read style folder data

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

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

Referenced by __construct().

81  {
82  $ilDB = $this->db;
83 
84  // get styles of style folder
85  $q = "SELECT * FROM style_folder_styles JOIN style_data ON (style_id = style_data.id)";
86 
87  $style_set = $ilDB->query($q);
88  $this->styles = array();
89  while ($style_rec = $ilDB->fetchAssoc($style_set)) {
90  $this->styles[$style_rec["style_id"]] =
91  array("id" => $style_rec["style_id"],
92  "title" => ilObject::_lookupTitle($style_rec["style_id"]),
93  "category" => $style_rec["category"]);
94  }
95 
96  $this->styles =
97  ilUtil::sortArray($this->styles, "title", "asc", false, true);
98  }
static sortArray( $array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
static _lookupTitle($a_id)
lookup object title
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeStyle()

ilContentStyleSettings::removeStyle (   $a_id)

remove Style from style list

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

49  {
50  unset($this->styles[$a_id]);
51  }

◆ update()

ilContentStyleSettings::update ( )

update object data

Returns
boolean

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

References $db, $ilDB, and $style.

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

Field Documentation

◆ $db

ilContentStyleSettings::$db
protected

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

Referenced by read(), and update().

◆ $styles

ilContentStyleSettings::$styles = array()

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

Referenced by getStyles().


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