3 include_once(
"./Services/Component/classes/class.ilPlugin.php");
42 return "RepositoryObject";
78 "icon_".$a_type.
".svg");
102 $type = $this->
getId();
104 if (substr($type, 0, 1) !=
"x")
106 throw new ilPluginException(
"Object plugin type must start with an x. Current type is ".$type.
".");
110 $set = $ilDB->query(
"SELECT * FROM object_data ".
111 " WHERE type = ".$ilDB->quote(
"typ",
"text").
112 " AND title = ".$ilDB->quote($type,
"text")
114 if ($rec = $ilDB->fetchAssoc($set))
116 $t_id = $rec[
"obj_id"];
120 $t_id = $ilDB->nextId(
"object_data");
121 $ilDB->manipulate(
"INSERT INTO object_data ".
122 "(obj_id, type, title, description, owner, create_date, last_update) VALUES (".
123 $ilDB->quote($t_id,
"integer").
",".
124 $ilDB->quote(
"typ",
"text").
",".
125 $ilDB->quote($type,
"text").
",".
127 $ilDB->quote(-1,
"integer").
",".
135 $ops = array(1, 2, 3, 4, 6);
136 foreach ($ops as $op)
139 $set = $ilDB->query(
"SELECT * FROM rbac_ta ".
140 " WHERE typ_id = ".$ilDB->quote($t_id,
"integer").
141 " AND ops_id = ".$ilDB->quote($op,
"integer")
143 if (!$ilDB->fetchAssoc($set))
145 $ilDB->manipulate(
"INSERT INTO rbac_ta ".
146 "(typ_id, ops_id) VALUES (".
147 $ilDB->quote($t_id,
"integer").
",".
148 $ilDB->quote($op,
"integer").
154 $set = $ilDB->query(
"SELECT * FROM rbac_operations ".
155 " WHERE class = ".$ilDB->quote(
"create",
"text").
156 " AND operation = ".$ilDB->quote(
"create_".$type,
"text")
158 if ($rec = $ilDB->fetchAssoc($set))
160 $create_ops_id = $rec[
"ops_id"];
164 $create_ops_id = $ilDB->nextId(rbac_operations);
165 $ilDB->manipulate(
"INSERT INTO rbac_operations ".
166 "(ops_id, operation, description, class) VALUES (".
167 $ilDB->quote($create_ops_id,
"integer").
",".
168 $ilDB->quote(
"create_".$type,
"text").
",".
169 $ilDB->quote(
"create ".$type,
"text").
",".
170 $ilDB->quote(
"create",
"text").
175 $par_types = array(
"root",
"cat",
"crs",
"grp",
"fold");
176 foreach ($par_types as $par_type)
178 $set = $ilDB->query(
"SELECT obj_id FROM object_data ".
179 " WHERE type = ".$ilDB->quote(
"typ",
"text").
180 " AND title = ".$ilDB->quote($par_type,
"text")
182 if ($rec = $ilDB->fetchAssoc($set))
184 if ($rec[
"obj_id"] > 0)
186 $set = $ilDB->query(
"SELECT * FROM rbac_ta ".
187 " WHERE typ_id = ".$ilDB->quote($rec[
"obj_id"],
"integer").
188 " AND ops_id = ".$ilDB->quote($create_ops_id,
"integer")
190 if (!$ilDB->fetchAssoc($set))
192 $ilDB->manipulate(
"INSERT INTO rbac_ta ".
193 "(typ_id, ops_id) VALUES (".
194 $ilDB->quote($rec[
"obj_id"],
"integer").
",".
195 $ilDB->quote($create_ops_id,
"integer").
getComponentType()
Get Component Type.
slotInit()
Object initialization done by slot.
static _getImagePath($a_ctype, $a_cname, $a_slot_id, $a_pname, $a_img)
Get image path.
lookupNameForId($a_ctype, $a_cname, $a_slot_id, $a_plugin_id)
Lookup name for id.
static _getIcon($a_type, $a_size)
Get Icon.
static now()
Return current timestamp in Y-m-d H:i:s format.
Abstract parent class for all repository object plugin classes.
_getName($a_id)
Get class name.
beforeActivation()
Before activation processing.
getPluginName()
Get Plugin Name.
getComponentName()
Get Component Name.