3 include_once(
"./Services/Component/classes/class.ilPlugin.php");
42 return "RepositoryObject";
70 case "small": $suff =
"";
break;
71 case "tiny": $suff =
"_s";
break;
72 default: $suff =
"_b";
break;
76 "icon_".$a_type.$suff.
".png");
100 $type = $this->
getId();
102 if (substr($type, 0, 1) !=
"x")
104 throw new ilPluginException(
"Object plugin type must start with an x. Current type is ".$type.
".");
108 $set = $ilDB->query(
"SELECT * FROM object_data ".
109 " WHERE type = ".$ilDB->quote(
"typ",
"text").
110 " AND title = ".$ilDB->quote($type,
"text")
112 if ($rec = $ilDB->fetchAssoc($set))
114 $t_id = $rec[
"obj_id"];
118 $t_id = $ilDB->nextId(
"object_data");
119 $ilDB->manipulate(
"INSERT INTO object_data ".
120 "(obj_id, type, title, description, owner, create_date, last_update) VALUES (".
121 $ilDB->quote($t_id,
"integer").
",".
122 $ilDB->quote(
"typ",
"text").
",".
123 $ilDB->quote($type,
"text").
",".
125 $ilDB->quote(-1,
"integer").
",".
133 $ops = array(1, 2, 3, 4, 6);
134 foreach ($ops as $op)
137 $set = $ilDB->query(
"SELECT * FROM rbac_ta ".
138 " WHERE typ_id = ".$ilDB->quote($t_id,
"integer").
139 " AND ops_id = ".$ilDB->quote($op,
"integer")
141 if (!$ilDB->fetchAssoc($set))
143 $ilDB->manipulate(
"INSERT INTO rbac_ta ".
144 "(typ_id, ops_id) VALUES (".
145 $ilDB->quote($t_id,
"integer").
",".
146 $ilDB->quote($op,
"integer").
152 $set = $ilDB->query(
"SELECT * FROM rbac_operations ".
153 " WHERE class = ".$ilDB->quote(
"create",
"text").
154 " AND operation = ".$ilDB->quote(
"create_".$type,
"text")
156 if ($rec = $ilDB->fetchAssoc($set))
158 $create_ops_id = $rec[
"ops_id"];
162 $create_ops_id = $ilDB->nextId(rbac_operations);
163 $ilDB->manipulate(
"INSERT INTO rbac_operations ".
164 "(ops_id, operation, description, class) VALUES (".
165 $ilDB->quote($create_ops_id,
"integer").
",".
166 $ilDB->quote(
"create_".$type,
"text").
",".
167 $ilDB->quote(
"create ".$type,
"text").
",".
168 $ilDB->quote(
"create",
"text").
173 $par_types = array(
"root",
"cat",
"crs",
"grp",
"fold");
174 foreach ($par_types as $par_type)
176 $set = $ilDB->query(
"SELECT obj_id FROM object_data ".
177 " WHERE type = ".$ilDB->quote(
"typ",
"text").
178 " AND title = ".$ilDB->quote($par_type,
"text")
180 if ($rec = $ilDB->fetchAssoc($set))
182 if ($rec[
"obj_id"] > 0)
184 $set = $ilDB->query(
"SELECT * FROM rbac_ta ".
185 " WHERE typ_id = ".$ilDB->quote($rec[
"obj_id"],
"integer").
186 " AND ops_id = ".$ilDB->quote($create_ops_id,
"integer")
188 if (!$ilDB->fetchAssoc($set))
190 $ilDB->manipulate(
"INSERT INTO rbac_ta ".
191 "(typ_id, ops_id) VALUES (".
192 $ilDB->quote($rec[
"obj_id"],
"integer").
",".
193 $ilDB->quote($create_ops_id,
"integer").