ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilObjTypeDefinitionGUI Class Reference

Class ilObjTypeDefinitionGUI. More...

+ Inheritance diagram for ilObjTypeDefinitionGUI:
+ Collaboration diagram for ilObjTypeDefinitionGUI:

Public Member Functions

 ilObjTypeDefinitionGUI ($a_data, $a_id, $a_call_by_reference)
 Constructor. More...
 
 viewObject ()
 list operations of object type @access public More...
 
 displayList ()
 display object list More...
 
 saveObject ()
 save (de-)activation of operations on object More...
 
 editObject ()
 display edit form More...
 
executeCommand ()
 execute command More...
 
 getTabs (&$tabs_gui)
 get tabs @access public More...
 
- Public Member Functions inherited from ilObjectGUI
 ilObjectGUI ($a_data, $a_id=0, $a_call_by_reference=true, $a_prepare_output=true)
 Constructor @access public. More...
 
executeCommand ()
 execute command More...
 
 withReferences ()
 determines wether objects are referenced or not (got ref ids or not) More...
 
 setCreationMode ($a_mode=true)
 if true, a creation screen is displayed the current $_GET[ref_id] don't belong to the current class! the mode is determined in ilrepositorygui More...
 
 getCreationMode ()
 get creation mode More...
 
 getAdminTabs (&$tabs_gui)
 administration tabs show only permissions and trash folder More...
 
 getHTML ()
 
 confirmedDeleteObject ()
 confirmed deletion of object -> objects are moved to trash or deleted immediately, if trash is disabled More...
 
 cancelDeleteObject ()
 cancel deletion of object More...
 
 cancelObject ($in_rep=false)
 cancel action and go back to previous page @access public More...
 
 createObject ()
 create new object form More...
 
 cancelCreation ()
 cancel create action and go back to repository parent More...
 
 saveObject ()
 save object More...
 
 editObject ()
 edit object More...
 
 addExternalEditFormCustom (ilPropertyFormGUI $a_form)
 
 updateObject ()
 updates object entry in object_data More...
 
 getFormAction ($a_cmd, $a_formaction="")
 get form action for command (command is method name without "Object", e.g. More...
 
 isVisible ($a_ref_id, $a_type)
 
 viewObject ()
 list childs of current object More...
 
 deleteObject ($a_error=false)
 Display deletion confirmation screen. More...
 
 cloneAllObject ()
 Clone single (not container object) Method is overwritten in ilContainerGUI. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from ilObjectGUI
static _gotoRepositoryRoot ($a_raise_error=false)
 Goto repository root. More...
 
static _gotoRepositoryNode ($a_ref_id, $a_cmd="frameset")
 Goto repository root. More...
 
- Data Fields inherited from ilObjectGUI
const COPY_WIZARD_NEEDS_PAGE = 1
 
 $ilias
 
 $objDefinition
 
 $tpl
 
 $tree
 
 $lng
 
 $data
 
 $object
 
 $ref_id
 
 $obj_id
 
 $maxcount
 
 $formaction
 
 $return_location
 
 $target_frame
 
 $tab_target_script
 
 $actions
 
 $sub_objects
 
 $omit_locator = false
 
const CFORM_NEW = 1
 
const CFORM_IMPORT = 2
 
const CFORM_CLONE = 3
 
- Protected Member Functions inherited from ilObjectGUI
 assignObject ()
 
 prepareOutput ()
 prepare output More...
 
 setTitleAndDescription ()
 called by prepare output More...
 
 initHeaderAction ($a_sub_type=null, $a_sub_id=null)
 Add header action menu. More...
 
 insertHeaderAction ($a_list_gui)
 Insert header action into main template. More...
 
 addHeaderAction ()
 Add header action menu. More...
 
 redrawHeaderActionObject ()
 Ajax call: redraw action header only. More...
 
 showMountWebfolderIcon ()
 
 setTabs ()
 set admin tabs @access public More...
 
 setAdminTabs ()
 set admin tabs @access public More...
 
 setLocator ()
 set Locator More...
 
 addLocatorItems ()
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 omitLocator ($a_omit=true)
 
 addAdminLocatorItems ($a_do_not_add_object=false)
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 initCreationForms ($a_new_type)
 Init creation froms. More...
 
 getCreationFormsHTML (array $a_forms)
 Get HTML for creation forms (accordion) More...
 
 initCreateForm ($a_new_type)
 Init object creation form. More...
 
 initDidacticTemplate (ilPropertyFormGUI $form)
 Show didactic template types. More...
 
 addDidacticTemplateOptions (array &$a_options)
 Add custom templates. More...
 
 getDidacticTemplateVar ($a_type)
 Get didactic template setting from creation screen. More...
 
 putObjectInTree (ilObject $a_obj, $a_parent_node_id=null)
 Add object to tree at given position. More...
 
 afterSave (ilObject $a_new_object)
 Post (successful) object creation hook. More...
 
 initEditForm ()
 Init object edit form. More...
 
 initEditCustomForm (ilPropertyFormGUI $a_form)
 Add custom fields to update form. More...
 
 getEditFormValues ()
 Get values for edit form. More...
 
 getEditFormCustomValues (array &$a_values)
 Add values to custom edit fields. More...
 
 validateCustom (ilPropertyFormGUI $a_form)
 Validate custom values (if not possible with checkInput()) More...
 
 updateCustom (ilPropertyFormGUI $a_form)
 Insert custom update form values into object. More...
 
 afterUpdate ()
 Post (successful) object update hook. More...
 
 initImportForm ($a_new_type)
 Init object import form. More...
 
 importFileObject ($parent_id=null, $a_catch_errors=true)
 Import. More...
 
 afterImport (ilObject $a_new_object)
 Post (successful) object import hook. More...
 
 setFormAction ($a_cmd, $a_formaction)
 set specific form action for command More...
 
 getReturnLocation ($a_cmd, $a_location="")
 get return location for command (command is method name without "Object", e.g. More...
 
 setReturnLocation ($a_cmd, $a_location)
 set specific return location for command More...
 
 getTargetFrame ($a_cmd, $a_target_frame="")
 get target frame for command (command is method name without "Object", e.g. More...
 
 setTargetFrame ($a_cmd, $a_target_frame)
 set specific target frame for command More...
 
 showPossibleSubObjects ()
 show possible subobjects (pulldown menu) More...
 
 getTemplateFile ($a_cmd, $a_type="")
 get a template blockfile format: tpl. More...
 
 getTitlesByRefId ($a_ref_ids)
 get Titles of objects this method is used for error messages in methods cut/copy/paste More...
 
 getTabs (&$tabs_gui)
 get tabs abstract method. More...
 
 __showButton ($a_cmd, $a_text, $a_target='')
 
 hitsperpageObject ()
 
__initTableGUI ()
 
 __setTableGUIBasicData (&$tbl, &$result_set, $a_from="")
 standard implementation for tables use 'from' variable use different initial setting of table More...
 
 redirectToRefId ($a_ref_id, $a_cmd="")
 redirects to (repository) view per ref id usually to a container and usually used at the end of a save/import method where the object gui type (of the new object) doesn't match with the type of the current $_GET["ref_id"] value More...
 
 fillCloneTemplate ($a_tpl_varname, $a_type)
 Fill object clone template This method can be called from any object GUI class that wants to offer object cloning. More...
 
 getCenterColumnHTML ()
 Get center column. More...
 
 getRightColumnHTML ()
 Display right column. More...
 
 setColumnSettings ($column_gui)
 May be overwritten in subclasses. More...
 
 checkPermission ($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
 Check permission and redirect on error. More...
 
 checkPermissionBool ($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
 Check permission. More...
 
 enableDragDropFileUpload ()
 Enables the file upload into this object by dropping files. More...
 
 handleAutoRating (ilObject $a_new_obj)
 Activate rating automatically if parent container setting. More...
 
- Protected Attributes inherited from ilObjectGUI
 $tmp_import_dir
 

Detailed Description

Class ilObjTypeDefinitionGUI.

handles operation assignment to objects (ONLY FOR TESTING PURPOSES!)

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om $Id$Id: class.ilObjTypeDefinitionGUI.php,v 1.14 2005/11/21 17:12:08 shofmann Exp $

Definition at line 18 of file class.ilObjTypeDefinitionGUI.php.

Member Function Documentation

◆ displayList()

ilObjTypeDefinitionGUI::displayList ( )

display object list

@access public

Definition at line 97 of file class.ilObjTypeDefinitionGUI.php.

98 {
99 include_once "./Services/Table/classes/class.ilTableGUI.php";
100
101 // load template for table
102 $this->tpl->addBlockfile("ADM_CONTENT", "adm_content", "tpl.table.html");
103 // load template for table content data
104 $this->tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.obj_tbl_rows.html");
105
106 $num = 0;
107
108 $obj_str = ($this->call_by_reference) ? "" : "&obj_id=".$this->obj_id;
109 $this->tpl->setVariable("FORMACTION", "adm_object.php?ref_id=".$this->ref_id."$obj_str&cmd=gateway");
110
111 // create table
112 $tbl = new ilTableGUI();
113
114 // title & header columns
115 $tbl->setTitle($this->lng->txt("obj_".$this->object->getType())." '".$this->object->getTitle()."'");
116
117 foreach ($this->data["cols"] as $val)
118 {
119 $header_names[] = $this->lng->txt($val);
120 }
121
122 $tbl->setHeaderNames($header_names);
123
124 $header_params = array("ref_id" => $this->ref_id,"obj_id" => $this->id);
125 $tbl->setHeaderVars($this->data["cols"],$header_params);
126
127 // control
128 $tbl->setOrderColumn($_GET["sort_by"]);
129 $tbl->setOrderDirection($_GET["sort_order"]);
130 $tbl->setLimit(0);
131 $tbl->setOffset(0);
132 $tbl->setMaxCount($this->maxcount);
133
134 // footer
135 $tbl->setFooter("tblfooter",$this->lng->txt("previous"),$this->lng->txt("next"));
136 //$tbl->disable("footer");
137
138 // render table
139 $tbl->render();
140
141 if (is_array($this->data["data"][0]))
142 {
143 //table cell
144 for ($i=0; $i < count($this->data["data"]); $i++)
145 {
146 $data = $this->data["data"][$i];
147 $ctrl = $this->data["ctrl"][$i];
148
149 // color changing
150 $css_row = ilUtil::switchColor($i+1,"tblrow1","tblrow2");
151
152 $this->tpl->setCurrentBlock("table_cell");
153 $this->tpl->setVariable("CELLSTYLE", "tblrow1");
154 $this->tpl->parseCurrentBlock();
155
156 foreach ($data as $key => $val)
157 {
158 // color for status
159 if ($key == "status")
160 {
161 if ($val == "enabled")
162 {
163 $color = "green";
164 }
165 else
166 {
167 $color = "red";
168 }
169
170 $val = "<font color=\"".$color."\">".$this->lng->txt($val)."</font>";
171 }
172
173 $this->tpl->setCurrentBlock("text");
174
175 if ($key == "type")
176 {
177 $val = ilUtil::getImageTagByType($val,$this->tpl->tplPath);
178 }
179
180 $this->tpl->setVariable("TEXT_CONTENT", $val);
181 $this->tpl->parseCurrentBlock();
182
183 $this->tpl->setCurrentBlock("table_cell");
184 $this->tpl->parseCurrentBlock();
185
186 } //foreach
187
188 $this->tpl->setCurrentBlock("tbl_content");
189 $this->tpl->setVariable("CSS_ROW", $css_row);
190 $this->tpl->parseCurrentBlock();
191 } //for
192 } //if is_array
193 }
$_GET["client_id"]
Class ilTableGUI.
static getImageTagByType($a_type, $a_path, $a_big=false)
Builds an html image tag TODO: function still in use, but in future use getImagePath and move HTML-Co...
static switchColor($a_num, $a_css1, $a_css2)
switches style sheets for each even $a_num (used for changing colors of different result rows)
$tbl
Definition: example_048.php:81

References $_GET, ilObjectGUI\$data, $tbl, ilUtil\getImageTagByType(), and ilUtil\switchColor().

Referenced by viewObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ editObject()

ilObjTypeDefinitionGUI::editObject ( )

display edit form

@access public

Reimplemented from ilObjectGUI.

Definition at line 244 of file class.ilObjTypeDefinitionGUI.php.

245 {
246 global $rbacsystem, $rbacreview;
247
248 if (!$rbacsystem->checkAccess("edit_permission",$_GET["ref_id"]))
249 {
250 $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
251 }
252
253 //prepare objectlist
254 $this->data = array();
255 $this->data["data"] = array();
256 $this->data["ctrl"] = array();
257 $this->data["cols"] = array("type", "operation", "description", "status");
258
259 $ops_valid = $rbacreview->getOperationsOnType($this->obj_id);
260
261 if ($ops_arr = ilRbacReview::_getOperationList('', $a_order, $a_direction))
262 {
263 $options = array("e" => "enabled","d" => "disabled");
264
265 foreach ($ops_arr as $key => $ops)
266 {
267 // BEGIN ROW
268 if (in_array($ops["ops_id"],$ops_valid))
269 {
270 $ops_status = 'e';
271 }
272 else
273 {
274 $ops_status = 'd';
275 }
276
277 $obj = $ops["ops_id"];
278 $ops_options = ilUtil::formSelect($ops_status,"id[$obj]",$options);
279
280 //visible data part
281 $this->data["data"][] = array(
282 "type" => "perm",
283 "operation" => $ops["operation"],
284 "description" => $ops["desc"],
285 "status" => $ops_status,
286 "status_html" => $ops_options,
287 "obj_id" => $val["ops_id"]
288 );
289 }
290 } //if typedata
291
292 $this->maxcount = count($this->data["data"]);
293
294 // sorting array
295 $this->data["data"] = ilUtil::sortArray($this->data["data"],$_GET["sort_by"],$_GET["sort_order"]);
296
297 // now compute control information
298 foreach ($this->data["data"] as $key => $val)
299 {
300 $this->data["ctrl"][$key] = array(
301 "obj_id" => $val["obj_id"],
302 "type" => $val["type"]
303 );
304
305 unset($this->data["data"][$key]["obj_id"]);
306 $this->data["data"][$key]["status"] = $this->data["data"][$key]["status_html"];
307 unset($this->data["data"][$key]["status_html"]);
308 }
309
310 // build table
311 include_once "./Services/Table/classes/class.ilTableGUI.php";
312
313 // load template for table
314 $this->tpl->addBlockfile("ADM_CONTENT", "adm_content", "tpl.table.html");
315 // load template for table content data
316 $this->tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.obj_tbl_rows.html");
317
318 $num = 0;
319
320 $obj_str = ($this->call_by_reference) ? "" : "&obj_id=".$this->obj_id;
321 $this->tpl->setVariable("FORMACTION", "adm_object.php?ref_id=".$this->ref_id."$obj_str&cmd=save");
322
323 // create table
324 $tbl = new ilTableGUI();
325
326 // title & header columns
327 $tbl->setTitle($this->lng->txt("edit_operations")." ".strtolower($this->lng->txt("of"))." '".$this->object->getTitle()."'");
328
329 foreach ($this->data["cols"] as $val)
330 {
331 $header_names[] = $this->lng->txt($val);
332 }
333
334 $tbl->setHeaderNames($header_names);
335
336 $header_params = array("ref_id" => $this->ref_id,"obj_id" => $this->id,"cmd" => "edit");
337 $tbl->setHeaderVars($this->data["cols"],$header_params);
338
339 // control
340 $tbl->setOrderColumn($_GET["sort_by"]);
341 $tbl->setOrderDirection($_GET["sort_order"]);
342 $tbl->setLimit(0);
343 $tbl->setOffset(0);
344 $tbl->setMaxCount($this->maxcount);
345
346 // SHOW VALID ACTIONS
347 $this->tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.svg"));
348 $this->tpl->setVariable("COLUMN_COUNTS",count($this->data["cols"]));
349
350 // footer
351 $tbl->setFooter("tblfooter",$this->lng->txt("previous"),$this->lng->txt("next"));
352 //$tbl->disable("footer");
353
354 // render table
355 $tbl->render();
356
357 if (is_array($this->data["data"][0]))
358 {
359 //table cell
360 for ($i=0; $i < count($this->data["data"]); $i++)
361 {
362 $data = $this->data["data"][$i];
363 $ctrl = $this->data["ctrl"][$i];
364
365 // color changing
366 $css_row = ilUtil::switchColor($i+1,"tblrow1","tblrow2");
367
368 $this->tpl->setCurrentBlock("table_cell");
369 $this->tpl->setVariable("CELLSTYLE", "tblrow1");
370 $this->tpl->parseCurrentBlock();
371
372 foreach ($data as $key => $val)
373 {
374 $this->tpl->setCurrentBlock("text");
375
376 if ($key == "type")
377 {
378 $val = ilUtil::getImageTagByType($val,$this->tpl->tplPath);
379 }
380
381 $this->tpl->setVariable("TEXT_CONTENT", $val);
382 $this->tpl->parseCurrentBlock();
383
384 $this->tpl->setCurrentBlock("table_cell");
385 $this->tpl->parseCurrentBlock();
386
387 } //foreach
388
389 $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("save"));
390
391 $this->tpl->setCurrentBlock("tbl_content");
392 $this->tpl->setVariable("CSS_ROW", $css_row);
393 $this->tpl->parseCurrentBlock();
394 } //for
395 } //if is_array
396 }
static _getOperationList($a_type=null)
get operation list by object type @access public @access static
static sortArray($array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
static formSelect($selected, $varname, $options, $multiple=false, $direct_text=false, $size="0", $style_class="", $attribs="", $disabled=false)
Builds a select form field with options and shows the selected option first.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
redirection script todo: (a better solution should control the processing via a xml file)
if(!is_array($argv)) $options

References $_GET, ilObjectGUI\$data, $options, $tbl, ilRbacReview\_getOperationList(), ilUtil\formSelect(), ilUtil\getImagePath(), ilUtil\getImageTagByType(), ilUtil\sortArray(), and ilUtil\switchColor().

+ Here is the call graph for this function:

◆ executeCommand()

& ilObjTypeDefinitionGUI::executeCommand ( )

execute command

Reimplemented from ilObjectGUI.

Definition at line 398 of file class.ilObjTypeDefinitionGUI.php.

399 {
400 $next_class = $this->ctrl->getNextClass($this);
401 $cmd = $this->ctrl->getCmd();
402
403 switch($next_class)
404 {
405 default:
406 if(!$cmd)
407 {
408 $cmd = "view";
409 }
410 $cmd .= "Object";
411 $this->$cmd();
412
413 break;
414 }
415 return true;
416 }
$cmd
Definition: sahs_server.php:35

References $cmd.

◆ getTabs()

ilObjTypeDefinitionGUI::getTabs ( $tabs_gui)

get tabs @access public

Parameters
objecttabs gui object

Reimplemented from ilObjectGUI.

Definition at line 423 of file class.ilObjTypeDefinitionGUI.php.

424 {
425 global $rbacsystem;
426
427 if ($rbacsystem->checkAccess('edit_permission',$this->object->getRefId()))
428 {
429 $tabs_gui->addTarget("settings",
430 $this->ctrl->getLinkTarget($this, "view"), array("view",""), "", "");
431
432 $tabs_gui->addTarget("edit_operations",
433 $this->ctrl->getLinkTarget($this, "edit"), "edit", "", "");
434 }
435 }

◆ ilObjTypeDefinitionGUI()

ilObjTypeDefinitionGUI::ilObjTypeDefinitionGUI (   $a_data,
  $a_id,
  $a_call_by_reference 
)

Constructor.

@access public

Definition at line 25 of file class.ilObjTypeDefinitionGUI.php.

26 {
27 $this->type = "typ";
28 $this->ilObjectGUI($a_data,$a_id,$a_call_by_reference);
29 }
ilObjectGUI($a_data, $a_id=0, $a_call_by_reference=true, $a_prepare_output=true)
Constructor @access public.

References ilObjectGUI\ilObjectGUI().

+ Here is the call graph for this function:

◆ saveObject()

ilObjTypeDefinitionGUI::saveObject ( )

save (de-)activation of operations on object

@access public

Reimplemented from ilObjectGUI.

Definition at line 200 of file class.ilObjTypeDefinitionGUI.php.

201 {
202 global $rbacsystem, $rbacadmin, $rbacreview;
203
204 if (!$rbacsystem->checkAccess('edit_permission', $_GET["ref_id"]))
205 {
206 $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->WARNING);
207 }
208
209 $ops_valid = $rbacreview->getOperationsOnType($_GET["obj_id"]);
210
211 foreach ($_POST["id"] as $ops_id => $status)
212 {
213 if ($status == 'enabled')
214 {
215 if (!in_array($ops_id,$ops_valid))
216 {
217 $rbacadmin->assignOperationToObject($_GET["obj_id"],$ops_id);
218 }
219 }
220
221 if ($status == 'disabled')
222 {
223 if (in_array($ops_id,$ops_valid))
224 {
225 $rbacadmin->deassignOperationFromObject($_GET["obj_id"],$ops_id);
226 }
227 }
228 }
229
230 $this->update = $this->object->update();
231
232 ilUtil::sendSuccess($this->lng->txt("saved_successfully"),true);
233
234 header("Location: adm_object.php?ref_id=".$_GET["ref_id"]."&obj_id=".$_GET["obj_id"]);
235 exit();
236 }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_POST['username']
Definition: cron.php:12
exit
Definition: login.php:54

References $_GET, $_POST, exit, and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ viewObject()

ilObjTypeDefinitionGUI::viewObject ( )

list operations of object type @access public

Reimplemented from ilObjectGUI.

Definition at line 35 of file class.ilObjTypeDefinitionGUI.php.

36 {
37 global $rbacadmin, $rbacreview;
38
39 //prepare objectlist
40 $this->data = array();
41 $this->data["data"] = array();
42 $this->data["ctrl"] = array();
43 $this->data["cols"] = array("type", "operation", "description", "status");
44
45 $ops_valid = $rbacreview->getOperationsOnType($_GET["obj_id"]);
46
47 if ($list = ilRbacReview::_getOperationList("",$_GET["order"], $_GET["direction"]))
48 {
49 foreach ($list as $key => $val)
50 {
51
52 if (in_array($val["ops_id"],$ops_valid))
53 {
54 $ops_status = 'enabled';
55 }
56 else
57 {
58 $ops_status = 'disabled';
59 }
60
61 //visible data part
62 $this->data["data"][] = array(
63 "type" => "perm",
64 "operation" => $val["operation"],
65 "description" => $val["desc"],
66 "status" => $ops_status,
67 "obj_id" => $val["ops_id"]
68 );
69
70 }
71 } //if typedata
72
73 $this->maxcount = count($this->data["data"]);
74
75 // sorting array
76 $this->data["data"] = ilUtil::sortArray($this->data["data"],$_GET["sort_by"],$_GET["sort_order"]);
77
78 // now compute control information
79 foreach ($this->data["data"] as $key => $val)
80 {
81 $this->data["ctrl"][$key] = array(
82 "obj_id" => $val["obj_id"],
83 "type" => $val["type"]
84 );
85
86 unset($this->data["data"][$key]["obj_id"]);
87 }
88
89 $this->displayList();
90 }

References $_GET, ilRbacReview\_getOperationList(), displayList(), and ilUtil\sortArray().

+ Here is the call graph for this function:

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