ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
template.class.ilObjModuleName.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
13 require_once "class.ilObject.php";
14 
15 class ilObj<module_name> extends ilObject
16 {
23  function ilObj<module_name>($a_id = 0,$a_call_by_reference = true)
24  {
25  $this->type = "<type ID>";
26  $this->ilObject($a_id,$a_call_by_reference);
27  }
28 
35  function update()
36  {
37  if (!parent::update())
38  {
39  return false;
40  }
41 
42  // put here object specific stuff
43 
44  return true;
45  }
46 
47 
54  function delete()
55  {
56  // always call parent delete function first!!
57  if (!parent::delete())
58  {
59  return false;
60  }
61 
62  //put here your module specific stuff
63 
64  return true;
65  }
66 
76  function initDefaultRoles()
77  {
78  global $rbacadmin;
79 
80  // create a local role folder
81  //$rfoldObj = $this->createRoleFolder("Local roles","Role Folder of forum obj_no.".$this->getId());
82 
83  // create moderator role and assign role to rolefolder...
84  //$roleObj = $rfoldObj->createRole("Moderator","Moderator of forum obj_no.".$this->getId());
85  //$roles[] = $roleObj->getId();
86 
87  //unset($rfoldObj);
88  //unset($roleObj);
89 
90  return $roles ? $roles : array();
91  }
92 
106  function notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params = 0)
107  {
108  global $tree;
109 
110  switch ($a_event)
111  {
112  case "link":
113 
114  //var_dump("<pre>",$a_params,"</pre>");
115  //echo "Module name ".$this->getRefId()." triggered by link event. Objects linked into target object ref_id: ".$a_ref_id;
116  //exit;
117  break;
118 
119  case "cut":
120 
121  //echo "Module name ".$this->getRefId()." triggered by cut event. Objects are removed from target object ref_id: ".$a_ref_id;
122  //exit;
123  break;
124 
125  case "copy":
126 
127  //var_dump("<pre>",$a_params,"</pre>");
128  //echo "Module name ".$this->getRefId()." triggered by copy event. Objects are copied into target object ref_id: ".$a_ref_id;
129  //exit;
130  break;
131 
132  case "paste":
133 
134  //echo "Module name ".$this->getRefId()." triggered by paste (cut) event. Objects are pasted into target object ref_id: ".$a_ref_id;
135  //exit;
136  break;
137 
138  case "new":
139 
140  //echo "Module name ".$this->getRefId()." triggered by paste (new) event. Objects are applied to target object ref_id: ".$a_ref_id;
141  //exit;
142  break;
143  }
144 
145  // At the beginning of the recursive process it avoids second call of the notify function with the same parameter
146  if ($a_node_id==$_GET["ref_id"])
147  {
148  $parent_obj =& $this->ilias->obj_factory->getInstanceByRefId($a_node_id);
149  $parent_type = $parent_obj->getType();
150  if($parent_type == $this->getType())
151  {
152  $a_node_id = (int) $tree->getParentId($a_node_id);
153  }
154  }
155 
156  parent::notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params);
157  }
158 } // END class.ilObj<module_name>
159 ?>