ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilScormEditorDBMigrationUtil Class Reference

DB Migration helper class. More...

+ Collaboration diagram for ilScormEditorDBMigrationUtil:

Public Member Functions

 __construct ()
 Constructor. More...
 
 addStyleClass ($a_class, $a_type, $a_tag, $a_parameters="", $a_hide=0)
 Add style class. More...
 

Static Public Member Functions

static copyStyleClass ($a_orig_class, $a_class, $a_type, $a_tag, $a_hide=0)
 Create style class GlossaryLink, link, IntLink. More...
 

Protected Attributes

 $db
 

Detailed Description

DB Migration helper class.

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

Definition at line 11 of file class.ilScormEditorDBMigrationUtil.php.

Constructor & Destructor Documentation

◆ __construct()

ilScormEditorDBMigrationUtil::__construct ( )

Constructor.

Definition at line 22 of file class.ilScormEditorDBMigrationUtil.php.

23 {
24 global $DIC;
25
26 $this->db = $DIC->database();
27 }
global $DIC
Definition: saml.php:7

References $DIC.

Member Function Documentation

◆ addStyleClass()

ilScormEditorDBMigrationUtil::addStyleClass (   $a_class,
  $a_type,
  $a_tag,
  $a_parameters = "",
  $a_hide = 0 
)

Add style class.

Parameters

return

Definition at line 88 of file class.ilScormEditorDBMigrationUtil.php.

89 {
91
92 if ($a_parameters == "") {
93 $a_parameters = array();
94 }
95
96 $set = $ilDB->query("SELECT * FROM object_data WHERE type = 'sty'");
97 while ($rec = $ilDB->fetchAssoc($set)) { // all styles
98 $set2 = $ilDB->query("SELECT * FROM style_char WHERE " .
99 "style_id = " . $ilDB->quote($rec["obj_id"], "integer") . " AND " .
100 "characteristic = " . $ilDB->quote($a_class, "text") . " AND " .
101 "type = " . $ilDB->quote($a_type, "text"));
102 if (!$ilDB->fetchAssoc($set2)) {
103 $q = "INSERT INTO style_char (style_id, type, characteristic, hide)" .
104 " VALUES (" .
105 $ilDB->quote($rec["obj_id"], "integer") . "," .
106 $ilDB->quote($a_type, "text") . "," .
107 $ilDB->quote($a_class, "text") . "," .
108 $ilDB->quote($a_hide, "integer") . ")";
109
110 $ilDB->manipulate($q);
111 foreach ($a_parameters as $k => $v) {
112 $spid = $ilDB->nextId("style_parameter");
113 $q = "INSERT INTO style_parameter (id, style_id, type, class, tag, parameter, value)" .
114 " VALUES (" .
115 $ilDB->quote($spid, "integer") . "," .
116 $ilDB->quote($rec["obj_id"], "integer") . "," .
117 $ilDB->quote($a_type, "text") . "," .
118 $ilDB->quote($a_class, "text") . "," .
119 $ilDB->quote($a_tag, "text") . "," .
120 $ilDB->quote($k, "text") . "," .
121 $ilDB->quote($v, "text") .
122 ")";
123
124 $ilDB->manipulate($q);
125 }
126 }
127 }
128 }
global $ilDB
$a_type
Definition: workflow.php:92

References $a_type, $db, and $ilDB.

◆ copyStyleClass()

static ilScormEditorDBMigrationUtil::copyStyleClass (   $a_orig_class,
  $a_class,
  $a_type,
  $a_tag,
  $a_hide = 0 
)
static

Create style class GlossaryLink, link, IntLink.

Parameters

return

Definition at line 36 of file class.ilScormEditorDBMigrationUtil.php.

37 {
38 global $DIC;
39
40 $ilDB = $DIC->database();
41
42 $set = $ilDB->query("SELECT * FROM object_data WHERE type = 'sty'");
43 while ($rec = $ilDB->fetchAssoc($set)) { // all styles
44 $set2 = $ilDB->query("SELECT * FROM style_char WHERE " .
45 "style_id = " . $ilDB->quote($rec["obj_id"], "integer") . " AND " .
46 "characteristic = " . $ilDB->quote($a_class, "text") . " AND " .
47 "type = " . $ilDB->quote($a_type, "text"));
48 if (!$ilDB->fetchAssoc($set2)) {
49 $q = "INSERT INTO style_char (style_id, type, characteristic, hide)" .
50 " VALUES (" .
51 $ilDB->quote($rec["obj_id"], "integer") . "," .
52 $ilDB->quote($a_type, "text") . "," .
53 $ilDB->quote($a_class, "text") . "," .
54 $ilDB->quote($a_hide, "integer") . ")";
55 $ilDB->manipulate($q);
56
57 $set3 = $ilDB->query(
58 "SELECT * FROM style_parameter WHERE " .
59 "style_id = " . $ilDB->quote($rec["obj_id"], "integer") . " AND " .
60 "type = " . $ilDB->quote($a_type, "text") . " AND " .
61 "class = " . $ilDB->quote($a_orig_class, "text") . " AND " .
62 "tag = " . $ilDB->quote($a_tag, "text")
63 );
64 while ($rec3 = $ilDB->fetchAssoc($set3)) { // copy parameters
65 $spid = $ilDB->nextId("style_parameter");
66 $q = "INSERT INTO style_parameter (id, style_id, type, class, tag, parameter, value)" .
67 " VALUES (" .
68 $ilDB->quote($spid, "integer") . "," .
69 $ilDB->quote($rec["obj_id"], "integer") . "," .
70 $ilDB->quote($rec3["type"], "text") . "," .
71 $ilDB->quote($a_class, "text") . "," .
72 $ilDB->quote($a_tag, "text") . "," .
73 $ilDB->quote($rec3["parameter"], "text") . "," .
74 $ilDB->quote($rec3["value"], "text") .
75 ")";
76 $ilDB->manipulate($q);
77 }
78 }
79 }
80 }

References $a_type, $DIC, and $ilDB.

Field Documentation

◆ $db

ilScormEditorDBMigrationUtil::$db
protected

Definition at line 16 of file class.ilScormEditorDBMigrationUtil.php.

Referenced by addStyleClass().


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