ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilPersonalDesktopGUI.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 
5 include_once './Services/User/classes/class.ilObjUser.php';
6 include_once "Services/Mail/classes/class.ilMail.php";
7 include_once 'Services/Mail/classes/class.ilMailGlobalServices.php';
8 include_once 'Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php';
9 
25 {
26  var $tpl;
27  var $lng;
28  var $ilias;
29 
30  var $cmdClass = '';
31 
35  protected $action_menu;
36 
41  {
42  global $ilias, $tpl, $lng, $rbacsystem, $ilCtrl, $ilMainMenu, $ilUser, $tree;
43 
44 
45  $this->tpl =& $tpl;
46  $this->lng =& $lng;
47  $this->ilias =& $ilias;
48  $this->ctrl =& $ilCtrl;
49 
50  $ilCtrl->setContext($ilUser->getId(),
51  "user");
52 
53  $ilMainMenu->setActive("desktop");
54  $this->lng->loadLanguageModule("pdesk");
55 
56  // catch hack attempts
57  if ($_SESSION["AccountId"] == ANONYMOUS_USER_ID)
58  {
59  $this->ilias->raiseError($this->lng->txt("msg_not_available_for_anon"),$this->ilias->error_obj->MESSAGE);
60  }
61  $this->cmdClass = $_GET['cmdClass'];
62 
63  //$tree->useCache(false);
64 
65  $this->action_menu = new ilAdvancedSelectionListGUI();
66  }
67 
71  function &executeCommand()
72  {
73  global $ilSetting, $rbacsystem;
74 
75  $next_class = $this->ctrl->getNextClass();
76  $this->ctrl->setReturn($this, "show");
77 
78  $this->tpl->addCss(ilUtil::getStyleSheetLocation('filesystem','delos.css','Services/Calendar'));
79 
80  // read last active subsection
81  if (isset($_GET['PDHistory']) && $_GET['PDHistory'])
82  {
83  $next_class = $this->__loadNextClass();
84  }
85  $this->__storeLastClass($next_class);
86 
87 
88  // check for permission to view contacts
89  if (
90  $next_class == 'ilmailaddressbookgui' && ($this->ilias->getSetting("disable_contacts") ||
91  (
92  !$this->ilias->getSetting("disable_contacts_require_mail") &&
93  !$rbacsystem->checkAccess('internal_mail', ilMailGlobalServices::getMailObjectRefId())
94  ))
95  ) // if
96  {
97  $next_class = '';
98  ilUtil::sendFailure($this->lng->txt('no_permission'));
99  }
100 
101  switch($next_class)
102  {
103  case "ilbookmarkadministrationgui":
104  if ($ilSetting->get('disable_bookmarks'))
105  {
106  ilUtil::sendFailure($this->lng->txt('permission_denied'), true);
107  ilUtil::redirect('ilias.php?baseClass=ilPersonalDesktopGUI');
108  return;
109  }
110  include_once("./Services/Bookmarks/classes/class.ilBookmarkAdministrationGUI.php");
111  $bookmark_gui = new ilBookmarkAdministrationGUI();
112  if ($bookmark_gui->getMode() == 'tree') {
113  $this->getTreeModeTemplates();
114  } else {
115  $this->getStandardTemplates();
116  }
117  $this->setTabs();
118  $ret =& $this->ctrl->forwardCommand($bookmark_gui);
119  break;
120 
121  // profile
122  case "ilpersonalprofilegui":
123  $this->getStandardTemplates();
124  $this->setTabs();
125  include_once("./Services/User/classes/class.ilPersonalProfileGUI.php");
126  $profile_gui = new ilPersonalProfileGUI();
127  $ret =& $this->ctrl->forwardCommand($profile_gui);
128  break;
129 
130  // settings
131  case "ilpersonalsettingsgui":
132  $this->getStandardTemplates();
133  $this->setTabs();
134  include_once("./Services/User/classes/class.ilPersonalSettingsGUI.php");
135  $settings_gui = new ilPersonalSettingsGUI();
136  $ret =& $this->ctrl->forwardCommand($settings_gui);
137  break;
138 
139  // profile
140  case "ilobjusergui":
141  include_once('./Services/User/classes/class.ilObjUserGUI.php');
142  $user_gui = new ilObjUserGUI("",$_GET["user"], false, false);
143  $ret =& $this->ctrl->forwardCommand($user_gui);
144  break;
145 
146  case 'ilcalendarpresentationgui':
147  $this->getStandardTemplates();
148  $this->displayHeader();
149  $this->tpl->setTitle($this->lng->txt("calendar"));
150  $this->setTabs();
151  include_once('./Services/Calendar/classes/class.ilCalendarPresentationGUI.php');
152  $cal = new ilCalendarPresentationGUI();
153  $ret = $this->ctrl->forwardCommand($cal);
154  $this->tpl->show();
155  break;
156 
157  // pd notes
158  case "ilpdnotesgui":
159  if ($ilSetting->get('disable_notes'))
160  {
161  ilUtil::sendFailure($this->lng->txt('permission_denied'), true);
162  ilUtil::redirect('ilias.php?baseClass=ilPersonalDesktopGUI');
163  return;
164  }
165 
166  $this->getStandardTemplates();
167  $this->setTabs();
168  include_once("./Services/Notes/classes/class.ilPDNotesGUI.php");
169  $pd_notes_gui = new ilPDNotesGUI();
170  $ret =& $this->ctrl->forwardCommand($pd_notes_gui);
171  break;
172 
173  // pd news
174  case "ilpdnewsgui":
175  $this->getStandardTemplates();
176  $this->setTabs();
177  include_once("./Services/News/classes/class.ilPDNewsGUI.php");
178  $pd_news_gui = new ilPDNewsGUI();
179  $ret =& $this->ctrl->forwardCommand($pd_news_gui);
180  break;
181 
182  case "illearningprogressgui":
183  $this->getStandardTemplates();
184  $this->setTabs();
185  include_once './Services/Tracking/classes/class.ilLearningProgressGUI.php';
187  $ret =& $this->ctrl->forwardCommand($new_gui);
188 
189  break;
190 
191  case "ilcolumngui":
192  $this->getStandardTemplates();
193  $this->setTabs();
194  include_once("./Services/Block/classes/class.ilColumnGUI.php");
195  $column_gui = new ilColumnGUI("pd");
196  $this->initColumn($column_gui);
197  $this->show();
198  break;
199 
200  // contacts
201  case 'ilmailaddressbookgui':
202  $this->getStandardTemplates();
203  $this->setTabs();
204  $this->tpl->setTitle($this->lng->txt("mail_addressbook"));
205 
206  include_once 'Services/Contact/classes/class.ilMailAddressbookGUI.php';
207  $mailgui = new ilMailAddressbookGUI();
208  $ret = $this->ctrl->forwardCommand($mailgui);
209  break;
210 
211  case 'ilpersonalworkspacegui':
212  $this->getStandardTemplates();
213  $this->setTabs();
214  include_once 'Services/PersonalWorkspace/classes/class.ilPersonalWorkspaceGUI.php';
215  $wsgui = new ilPersonalWorkspaceGUI();
216  $ret = $this->ctrl->forwardCommand($wsgui);
217  $this->tpl->show();
218  break;
219 
220  case 'ilportfoliorepositorygui':
221  $this->getStandardTemplates();
222  $this->setTabs();
223  include_once 'Modules/Portfolio/classes/class.ilPortfolioRepositoryGUI.php';
224  $pfgui = new ilPortfolioRepositoryGUI();
225  $ret = $this->ctrl->forwardCommand($pfgui);
226  $this->tpl->show();
227  break;
228 
229  case 'ilpersonalskillsgui':
230  $this->setTabs();
231  include_once './Services/Skill/classes/class.ilPersonalSkillsGUI.php';
232  $skgui = new ilPersonalSkillsGUI();
233  $this->getStandardTemplates();
234  $ret = $this->ctrl->forwardCommand($skgui);
235  $this->tpl->show();
236  break;
237 
238  case 'redirect':
239  $this->redirect();
240  break;
241 
242  default:
243  $this->getStandardTemplates();
244  $this->setTabs();
245  $cmd = $this->ctrl->getCmd("show");
246  $this->$cmd();
247  break;
248  }
249  $ret = null;
250  return $ret;
251  }
252 
256  public function redirect()
257  {
258  if(is_array($_GET))
259  {
260  foreach($_GET as $key => $val)
261  {
262  if(substr($key, 0, strlen('param_')) == 'param_')
263  {
264  $this->ctrl->setParameterByClass($_GET['redirectClass'], substr($key, strlen('param_')), $val);
265  }
266  }
267  }
268  ilUtil::redirect($this->ctrl->getLinkTargetByClass($_GET['redirectClass'], $_GET['redirectCmd'], '', true));
269  }
270 
275  {
276  $this->tpl->getStandardTemplate();
277  // add template for content
278 // $this->tpl->addBlockFile("CONTENT", "content", "tpl.adm_content.html");
279 // $this->tpl->addBlockFile("STATUSLINE", "statusline", "tpl.statusline.html");
280  }
281 
286  {
287  // add template for content
288  $this->tpl->addBlockFile("CONTENT", "content", "tpl.adm_content.html");
289  $this->tpl->addBlockFile("STATUSLINE", "statusline", "tpl.statusline.html");
290  }
291 
295  function show()
296  {
297 
298  // preload block settings
299  include_once("Services/Block/classes/class.ilBlockSetting.php");
301 
302  // add template for content
303  $this->pd_tpl = new ilTemplate("tpl.usr_personaldesktop.html", true, true, "Services/PersonalDesktop");
304  $this->tpl->getStandardTemplate();
305 
306  // display infopanel if something happened
308 
309  //$this->tpl->setTitleIcon(ilUtil::getImagePath("icon_pd_b.png"),
310  // $this->lng->txt("personal_desktop"));
311 // $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_pd_b.png"),
312 // "");
313  $this->tpl->setTitle($this->lng->txt("overview"));
314  $this->tpl->setVariable("IMG_SPACE", ilUtil::getImagePath("spacer.png", false));
315 
316  $this->tpl->setContent($this->getCenterColumnHTML());
317  $this->tpl->setRightContent($this->getRightColumnHTML());
318  $this->tpl->setLeftContent($this->getLeftColumnHTML());
319 
320  if(count($this->action_menu->getItems()))
321  {
326  global $tpl, $lng;
327 
328  $this->action_menu->setAsynch(false);
329  $this->action_menu->setAsynchUrl('');
330  $this->action_menu->setListTitle($lng->txt('actions'));
331  $this->action_menu->setId('act_pd');
332  $this->action_menu->setSelectionHeaderClass('small');
333  $this->action_menu->setItemLinkClass('xsmall');
334  $this->action_menu->setLinksMode('il_ContainerItemCommand2');
335  $this->action_menu->setHeaderIcon(ilAdvancedSelectionListGUI::DOWN_ARROW_DARK);
336  $this->action_menu->setUseImages(false);
337 
338  $htpl = new ilTemplate('tpl.header_action.html', true, true, 'Services/Repository');
339  $htpl->setVariable('ACTION_DROP_DOWN', $this->action_menu->getHTML());
340 
341  $tpl->setHeaderActionMenu($htpl->get());
342  }
343 
344  $this->tpl->show();
345  }
346 
347 
352  {
353  global $ilCtrl, $ilPluginAdmin;
354 
355  include_once("Services/Block/classes/class.ilColumnGUI.php");
356  $column_gui = new ilColumnGUI("pd", IL_COL_CENTER);
357  $this->initColumn($column_gui);
358 
359  if ($ilCtrl->getNextClass() == "ilcolumngui" &&
360  $column_gui->getCmdSide() == IL_COL_CENTER)
361  {
362  $html = $ilCtrl->forwardCommand($column_gui);
363  }
364  else
365  {
366  if (!$ilCtrl->isAsynch())
367  {
368  if ($column_gui->getScreenMode() != IL_SCREEN_SIDE)
369  {
370  // right column wants center
371  if ($column_gui->getCmdSide() == IL_COL_RIGHT)
372  {
373  $column_gui = new ilColumnGUI("pd", IL_COL_RIGHT);
374  $this->initColumn($column_gui);
375  $html = $ilCtrl->forwardCommand($column_gui);
376  }
377  // left column wants center
378  if ($column_gui->getCmdSide() == IL_COL_LEFT)
379  {
380  $column_gui = new ilColumnGUI("pd", IL_COL_LEFT);
381  $this->initColumn($column_gui);
382  $html = $ilCtrl->forwardCommand($column_gui);
383  }
384  }
385  else
386  {
387  $html = "";
388 
389  // user interface plugin slot + default rendering
390  include_once("./Services/UIComponent/classes/class.ilUIHookProcessor.php");
391  $uip = new ilUIHookProcessor("Services/PersonalDesktop", "center_column",
392  array("personal_desktop_gui" => $this));
393  if (!$uip->replaced())
394  {
395  $html = $ilCtrl->getHTML($column_gui);
396  }
397  $html = $uip->getHTML($html);
398 
399  }
400  }
401  }
402  return $html;
403  }
404 
409  {
410  global $ilUser, $lng, $ilCtrl, $ilPluginAdmin;
411 
412  include_once("Services/Block/classes/class.ilColumnGUI.php");
413  $column_gui = new ilColumnGUI("pd", IL_COL_RIGHT);
414  $this->initColumn($column_gui);
415 
416  if ($column_gui->getScreenMode() == IL_SCREEN_FULL)
417  {
418  return "";
419  }
420 
421  if ($ilCtrl->getNextClass() == "ilcolumngui" &&
422  $column_gui->getCmdSide() == IL_COL_RIGHT &&
423  $column_gui->getScreenMode() == IL_SCREEN_SIDE)
424  {
425  $html = $ilCtrl->forwardCommand($column_gui);
426  }
427  else
428  {
429  if (!$ilCtrl->isAsynch())
430  {
431  $html = "";
432 
433  // user interface plugin slot + default rendering
434  include_once("./Services/UIComponent/classes/class.ilUIHookProcessor.php");
435  $uip = new ilUIHookProcessor("Services/PersonalDesktop", "right_column",
436  array("personal_desktop_gui" => $this));
437  if (!$uip->replaced())
438  {
439  $html = $ilCtrl->getHTML($column_gui);
440  }
441  $html = $uip->getHTML($html);
442  }
443  }
444 
445  return $html;
446  }
447 
451  function getLeftColumnHTML()
452  {
453  global $ilUser, $lng, $ilCtrl, $ilPluginAdmin;
454 
455  include_once("Services/Block/classes/class.ilColumnGUI.php");
456  $column_gui = new ilColumnGUI("pd", IL_COL_LEFT);
457  $this->initColumn($column_gui);
458 
459  if ($column_gui->getScreenMode() == IL_SCREEN_FULL)
460  {
461  return "";
462  }
463 
464  if ($ilCtrl->getNextClass() == "ilcolumngui" &&
465  $column_gui->getCmdSide() == IL_COL_LEFT &&
466  $column_gui->getScreenMode() == IL_SCREEN_SIDE)
467  {
468  $html = $ilCtrl->forwardCommand($column_gui);
469  }
470  else
471  {
472  if (!$ilCtrl->isAsynch())
473  {
474  $html = "";
475 
476  // user interface plugin slot + default rendering
477  include_once("./Services/UIComponent/classes/class.ilUIHookProcessor.php");
478  $uip = new ilUIHookProcessor("Services/PersonalDesktop", "left_column",
479  array("personal_desktop_gui" => $this));
480  if (!$uip->replaced())
481  {
482  $html = $ilCtrl->getHTML($column_gui);
483  }
484  $html = $uip->getHTML($html);
485  }
486  }
487 
488  return $html;
489  }
490 
492  {
493  // add template for content
494  $this->pd_tpl = new ilTemplate("tpl.usr_personaldesktop.html", true, true, "Services/PersonalDesktop");
495  $this->tpl->getStandardTemplate();
496 
497  // display infopanel if something happened
499 
500  //$this->tpl->setTitleIcon(ilUtil::getImagePath("icon_pd_b.png"),
501  // $this->lng->txt("personal_desktop"));
502  $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_pd_b.png"),
503  "");
504  $this->tpl->setTitle($this->lng->txt("personal_desktop"));
505  $this->tpl->setVariable("IMG_SPACE", ilUtil::getImagePath("spacer.png", false));
506  }
507 
508 
512  function removeMember()
513  {
514  global $err_msg;
515  if (strlen($err_msg) > 0)
516  {
517  $this->ilias->raiseError($this->lng->txt($err_msg),$this->ilias->error_obj->MESSAGE);
518  }
519  $this->show();
520  }
521 
526  {
527  include_once("Services/Mail/classes/class.ilPDSysMessageBlockGUI.php");
528  $sys_block = new ilPDSysMessageBlockGUI("ilpersonaldesktopgui", "show");
529  return $sys_block->getHTML();
530  }
531 
542  function multiarray_sort ($array, $key_sort)
543  {
544  if ($array) {
545  $key_sorta = explode(";", $key_sort);
546 
547  $multikeys = array_keys($array);
548  $keys = array_keys($array[$multikeys[0]]);
549 
550  for($m=0; $m < count($key_sorta); $m++) {
551  $nkeys[$m] = trim($key_sorta[$m]);
552  }
553  $n += count($key_sorta);
554 
555  for($i=0; $i < count($keys); $i++){
556  if(!in_array($keys[$i], $key_sorta)) {
557  $nkeys[$n] = $keys[$i];
558  $n += "1";
559  }
560  }
561 
562  for($u=0;$u<count($array); $u++) {
563  $arr = $array[$multikeys[$u]];
564  for($s=0; $s<count($nkeys); $s++) {
565  $k = $nkeys[$s];
566  $output[$multikeys[$u]][$k] = $array[$multikeys[$u]][$k];
567  }
568  }
569  sort($output);
570  return $output;
571  }
572  }
573 
577  function setTabs()
578  {
579  global $ilHelp;
580 
581  $ilHelp->setScreenIdComponent("pd");
582  }
583 
587  function jumpToMemberships()
588  {
589  global $ilSetting, $ilUser;
590 
591  if ($ilSetting->get('disable_my_memberships') == 0)
592  {
593  $ilUser->writePref('pd_view', 1);
594  }
595  $this->show();
596  }
597 
602  {
603  global $ilSetting, $ilUser;
604 
605  if ($ilSetting->get('disable_my_offers') == 0)
606  {
607  $ilUser->writePref('pd_view', 0);
608  }
609  $this->show();
610  }
611 
612 
616  function jumpToProfile()
617  {
618  $this->ctrl->redirectByClass("ilpersonalprofilegui");
619  }
620 
621  function jumpToPortfolio()
622  {
623  // incoming back link from shared resource
624  $cmd = "";
625  if($_REQUEST["dsh"])
626  {
627  $this->ctrl->setParameterByClass("ilportfoliorepositorygui", "shr_id", $_REQUEST["dsh"]);
628  $cmd = "showOther";
629  }
630 
631  // used for goto links
632  if($_GET["prt_id"])
633  {
634  $this->ctrl->setParameterByClass("ilobjportfoliogui", "prt_id", (int)$_GET["prt_id"]);
635  $this->ctrl->setParameterByClass("ilobjportfoliogui", "gtp", (int)$_GET["gtp"]);
636  $this->ctrl->redirectByClass(array("ilportfoliorepositorygui", "ilobjportfoliogui"), "preview");
637  }
638  else
639  {
640  $this->ctrl->redirectByClass("ilportfoliorepositorygui", $cmd);
641  }
642  }
643 
647  function jumpToSettings()
648  {
649  $this->ctrl->redirectByClass("ilpersonalsettingsgui");
650  }
651 
655  function jumpToBookmarks()
656  {
657  if ($this->ilias->getSetting("disable_bookmarks"))
658  {
659  ilUtil::sendFailure($this->lng->txt('permission_denied'), true);
660  ilUtil::redirect('ilias.php?baseClass=ilPersonalDesktopGUI');
661  return;
662  }
663 
664  $this->ctrl->redirectByClass("ilbookmarkadministrationgui");
665  }
666 
670  function jumpToNotes()
671  {
672  if ($this->ilias->getSetting('disable_notes'))
673  {
674  ilUtil::sendFailure($this->lng->txt('permission_denied'), true);
675  ilUtil::redirect('ilias.php?baseClass=ilPersonalDesktopGUI');
676  return;
677  }
678 
679  $this->ctrl->redirectByClass("ilpdnotesgui");
680  }
681 
685  function jumpToNews()
686  {
687  $this->ctrl->redirectByClass("ilpdnewsgui");
688  }
689 
693  function jumpToLP()
694  {
695  $this->ctrl->redirectByClass("illearningprogressgui");
696  }
697 
701  function jumpToCalendar()
702  {
703  $this->ctrl->redirectByClass("ilcalendarpresentationgui");
704  }
705 
709  function jumpToContacts()
710  {
711  $this->ctrl->redirectByClass("ilmailaddressbookgui");
712  }
713 
717  function jumpToWorkspace()
718  {
719  // incoming back link from shared resource
720  $cmd = "";
721  if($_REQUEST["dsh"])
722  {
723  $this->ctrl->setParameterByClass("ilpersonalworkspacegui", "shr_id", $_REQUEST["dsh"]);
724  $cmd = "share";
725  }
726 
727  if($_REQUEST["wsp_id"])
728  {
729  $this->ctrl->setParameterByClass("ilpersonalworkspacegui", "wsp_id", (int)$_REQUEST["wsp_id"]);
730  }
731 
732  if($_REQUEST["gtp"])
733  {
734  $this->ctrl->setParameterByClass("ilpersonalworkspacegui", "gtp", (int)$_REQUEST["gtp"]);
735  }
736 
737  $this->ctrl->redirectByClass("ilpersonalworkspacegui", $cmd);
738  }
739 
743  function jumpToSkills()
744  {
745  $this->ctrl->redirectByClass("ilpersonalskillsgui");
746  }
747 
748  function __loadNextClass()
749  {
750  $stored_classes = array('ilpersonaldesktopgui',
751  'ilpersonalprofilegui',
752  'ilpdnotesgui',
753  'ilcalendarpresentationgui',
754  'ilbookmarkadministrationgui',
755  'illearningprogressgui');
756 
757  if(isset($_SESSION['il_pd_history']) and in_array($_SESSION['il_pd_history'],$stored_classes))
758  {
759  return $_SESSION['il_pd_history'];
760  }
761  else
762  {
763  $this->ctrl->getNextClass($this);
764  }
765  }
766  function __storeLastClass($a_class)
767  {
768  $_SESSION['il_pd_history'] = $a_class;
769  $this->cmdClass = $a_class;
770  }
771 
776  function initColumn($a_column_gui)
777  {
778  $pd_set = new ilSetting("pd");
779  if ($pd_set->get("enable_block_moving"))
780  {
781  $a_column_gui->setEnableMovement(true);
782  }
783  $a_column_gui->setActionMenu($this->action_menu);
784  }
785 
789  function displayHeader()
790  {
791  //$this->tpl->setTitleIcon(ilUtil::getImagePath("icon_pd_b.png"),
792  // $this->lng->txt("personal_desktop"));
793 // $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_pd_b.png"),
794 // "");
795  $this->tpl->setTitle($this->lng->txt("personal_desktop"));
796  }
797 
798 
799 }
800 ?>