ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5
class.ilScormEditorDBMigrationUtil.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
12 {
13 
20  static function copyStyleClass($a_orig_class, $a_class, $a_type, $a_tag, $a_hide = 0)
21  {
22  global $ilDB;
23 
24  $set = $ilDB->query("SELECT * FROM object_data WHERE type = 'sty'");
25  while ($rec = $ilDB->fetchAssoc($set)) // all styles
26  {
27  $set2 = $ilDB->query("SELECT * FROM style_char WHERE ".
28  "style_id = ".$ilDB->quote($rec["obj_id"], "integer")." AND ".
29  "characteristic = ".$ilDB->quote($a_class, "text")." AND ".
30  "type = ".$ilDB->quote($a_type, "text"));
31  if (!$ilDB->fetchAssoc($set2))
32  {
33  $q = "INSERT INTO style_char (style_id, type, characteristic, hide)".
34  " VALUES (".
35  $ilDB->quote($rec["obj_id"], "integer").",".
36  $ilDB->quote($a_type, "text").",".
37  $ilDB->quote($a_class, "text").",".
38  $ilDB->quote($a_hide, "integer").")";
39  $ilDB->manipulate($q);
40 
41  $set3 = $ilDB->query("SELECT * FROM style_parameter WHERE ".
42  "style_id = ".$ilDB->quote($rec["obj_id"], "integer")." AND ".
43  "type = ".$ilDB->quote($a_type, "text")." AND ".
44  "class = ".$ilDB->quote($a_orig_class, "text")." AND ".
45  "tag = ".$ilDB->quote($a_tag, "text")
46  );
47  while ($rec3 = $ilDB->fetchAssoc($set3)) // copy parameters
48  {
49  $spid = $ilDB->nextId("style_parameter");
50  $q = "INSERT INTO style_parameter (id, style_id, type, class, tag, parameter, value)".
51  " VALUES (".
52  $ilDB->quote($spid, "integer").",".
53  $ilDB->quote($rec["obj_id"], "integer").",".
54  $ilDB->quote($rec3["type"], "text").",".
55  $ilDB->quote($a_class, "text").",".
56  $ilDB->quote($a_tag, "text").",".
57  $ilDB->quote($rec3["parameter"], "text").",".
58  $ilDB->quote($rec3["value"], "text").
59  ")";
60  $ilDB->manipulate($q);
61  }
62  }
63  }
64  }
65 
72  function addStyleClass($a_class, $a_type, $a_tag, $a_parameters = "", $a_hide = 0)
73  {
74  global $ilDB;
75 
76  if ($a_parameters == "")
77  {
78  $a_parameters = array();
79  }
80 
81  $set = $ilDB->query("SELECT * FROM object_data WHERE type = 'sty'");
82  while ($rec = $ilDB->fetchAssoc($set)) // all styles
83  {
84  $set2 = $ilDB->query("SELECT * FROM style_char WHERE ".
85  "style_id = ".$ilDB->quote($rec["obj_id"], "integer")." AND ".
86  "characteristic = ".$ilDB->quote($a_class, "text")." AND ".
87  "type = ".$ilDB->quote($a_type, "text"));
88  if (!$ilDB->fetchAssoc($set2))
89  {
90  $q = "INSERT INTO style_char (style_id, type, characteristic, hide)".
91  " VALUES (".
92  $ilDB->quote($rec["obj_id"], "integer").",".
93  $ilDB->quote($a_type, "text").",".
94  $ilDB->quote($a_class, "text").",".
95  $ilDB->quote($a_hide, "integer").")";
96 
97  $ilDB->manipulate($q);
98  foreach ($a_parameters as $k => $v)
99  {
100  $spid = $ilDB->nextId("style_parameter");
101  $q = "INSERT INTO style_parameter (id, style_id, type, class, tag, parameter, value)".
102  " VALUES (".
103  $ilDB->quote($spid, "integer").",".
104  $ilDB->quote($rec["obj_id"], "integer").",".
105  $ilDB->quote($a_type, "text").",".
106  $ilDB->quote($a_class, "text").",".
107  $ilDB->quote($a_tag, "text").",".
108  $ilDB->quote($k, "text").",".
109  $ilDB->quote($v, "text").
110  ")";
111 
112  $ilDB->manipulate($q);
113  }
114  }
115  }
116  }
117 
118 }
119 ?>
static copyStyleClass($a_orig_class, $a_class, $a_type, $a_tag, $a_hide=0)
Create style class GlossaryLink, link, IntLink.
addStyleClass($a_class, $a_type, $a_tag, $a_parameters="", $a_hide=0)
Add style class.
global $ilDB