ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
class.ilObjectOwnershipManagementGUI.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
4
14{
15 protected $user_id; // [int]
16
17 function __construct($a_user_id = null)
18 {
19 global $ilUser;
20
21 if($a_user_id === null)
22 {
23 $a_user_id = $ilUser->getId();
24 }
25 $this->user_id = (int)$a_user_id;
26 }
27
28 function &executeCommand()
29 {
30 global $ilCtrl;
31
32 $next_class =$ilCtrl->getNextClass($this);
33 $cmd = $ilCtrl->getCmd();
34
35 switch($next_class)
36 {
37 default:
38 if(!$cmd)
39 {
40 $cmd = "listObjects";
41 }
42 $this->$cmd();
43 break;
44 }
45
46 return true;
47 }
48
49 function listObjects()
50 {
51 global $tpl, $ilToolbar, $lng, $ilCtrl, $objDefinition;
52
53
54 $objects = ilObject::getAllOwnedRepositoryObjects($this->user_id);
55
56 if(sizeof($objects))
57 {
58 include_once "Services/Form/classes/class.ilSelectInputGUI.php";
59 $sel = new ilSelectInputGUI($lng->txt("type"), "type");
60 $ilToolbar->addInputItem($sel, true);
61 $ilToolbar->setFormAction($ilCtrl->getFormAction($this, "listObjects"));
62 $ilToolbar->addFormButton($lng->txt("ok"), "listObjects");
63
64 $options = array();
65 foreach(array_keys($objects) as $type)
66 {
67 // #11050
68 if(!$objDefinition->isPlugin($type))
69 {
70 $options[$type] = $lng->txt("obj_".$type);
71 }
72 else
73 {
74 include_once("./Services/Component/classes/class.ilPlugin.php");
75 $options[$type] = ilPlugin::lookupTxt("rep_robj", $type, "obj_".$type);
76 }
77 }
78 asort($options);
79 $sel->setOptions($options);
80
81 $sel_type = (string)$_REQUEST["type"];
82 if($sel_type)
83 {
84 $sel->setValue($sel_type);
85 }
86 else
87 {
88 $sel_type = array_keys($options);
89 $sel_type = array_shift($sel_type);
90 }
91 $ilCtrl->setParameter($this, "type", $sel_type);
92 }
93
94 include_once "Services/Object/classes/class.ilObjectOwnershipManagementTableGUI.php";
95 $tbl = new ilObjectOwnershipManagementTableGUI($this, "listObjects", $this->user_id, $objects[$sel_type]);
96 $tpl->setContent($tbl->getHTML());
97 }
98
99 function applyFilter()
100 {
101 include_once "Services/Object/classes/class.ilObjectOwnershipManagementTableGUI.php";
102 $tbl = new ilObjectOwnershipManagementTableGUI($this, "listObjects", $this->user_id);
103 $tbl->resetOffset();
104 $tbl->writeFilterToSession();
105 $this->listObjects();
106 }
107
108 function resetFilter()
109 {
110 include_once "Services/Object/classes/class.ilObjectOwnershipManagementTableGUI.php";
111 $tbl = new ilObjectOwnershipManagementTableGUI($this, "listObjects", $this->user_id);
112 $tbl->resetOffset();
113 $tbl->resetFilter();
114 $this->listObjects();
115 }
116
117 protected function redirectParentCmd($a_ref_id, $a_cmd)
118 {
119 global $tree, $ilCtrl;
120
121 $parent = $tree->getParentId($a_ref_id);
122 $ilCtrl->setParameterByClass("ilRepositoryGUI", "ref_id", $parent);
123 $ilCtrl->setParameterByClass("ilRepositoryGUI", "item_ref_id", $a_ref_id);
124 $ilCtrl->setParameterByClass("ilRepositoryGUI", "cmd", $a_cmd);
125 $ilCtrl->redirectByClass("ilRepositoryGUI");
126 }
127
128 protected function redirectCmd($a_ref_id, $a_class, $a_cmd = null)
129 {
130 global $ilCtrl, $tree, $objDefinition;
131
132 $node = $tree->getNodeData($a_ref_id);
133 $gui_class = "ilObj".$objDefinition->getClassName($node["type"])."GUI";
134 $path = array("ilRepositoryGUI", $gui_class, $a_class);
135
136 // #10495 - check if object type supports ilexportgui "directly"
137 if($a_class == "ilExportGUI")
138 {
139 try
140 {
141 $ilCtrl->getLinkTargetByClass($path);
142 }
143 catch(Exception $e)
144 {
145 switch($node["type"])
146 {
147 case "glo":
148 $cmd = "exportList";
149 $path = array("ilRepositoryGUI", "ilGlossaryEditorGUI", $gui_class);
150 break;
151
152 default:
153 $cmd = "export";
154 $path = array("ilRepositoryGUI", $gui_class);
155 break;
156 }
157 $ilCtrl->setParameterByClass($gui_class, "ref_id", $a_ref_id);
158 $ilCtrl->setParameterByClass($gui_class, "cmd", $cmd);
159 $ilCtrl->redirectByClass($path);
160 }
161 }
162
163 $ilCtrl->setParameterByClass($a_class, "ref_id", $a_ref_id);
164 $ilCtrl->setParameterByClass($a_class, "cmd", $a_cmd);
165 $ilCtrl->redirectByClass($path);
166 }
167
168 function delete()
169 {
170 $ref_id = (int)$_REQUEST["ownid"];
171 $this->redirectParentCmd($ref_id, "delete");
172 }
173
174 function move()
175 {
176 $ref_id = (int)$_REQUEST["ownid"];
177 $this->redirectParentCmd($ref_id, "cut");
178 }
179
180 function export()
181 {
182 $ref_id = (int)$_REQUEST["ownid"];
183 $this->redirectCmd($ref_id, "ilExportGUI");
184 }
185
186 function changeOwner()
187 {
188 $ref_id = (int)$_REQUEST["ownid"];
189 $this->redirectCmd($ref_id, "ilPermissionGUI", "owner");
190 }
191}
192
193?>
global $tpl
Definition: ilias.php:8
Class ilObjectOwnershipManagementGUI.
static getAllOwnedRepositoryObjects($a_user_id)
Get all ids of objects user owns.
static lookupTxt($a_mod_prefix, $a_pl_id, $a_lang_var)
Lookup language text.
This class represents a selection list property in a property form.
global $ilCtrl
Definition: ilias.php:18
global $lng
Definition: privfeed.php:40
$cmd
Definition: sahs_server.php:35
$ref_id
Definition: sahs_server.php:39
$path
Definition: index.php:22
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
if(!is_array($argv)) $options
global $ilUser
Definition: imgupload.php:15