ILIAS  Release_4_2_x_branch Revision 61807
 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 
24 {
25  var $tpl;
26  var $lng;
27  var $ilias;
28 
29  var $cmdClass = '';
30 
35  {
36  global $ilias, $tpl, $lng, $rbacsystem, $ilCtrl, $ilMainMenu, $ilUser, $tree;
37 
38 
39  $this->tpl =& $tpl;
40  $this->lng =& $lng;
41  $this->ilias =& $ilias;
42  $this->ctrl =& $ilCtrl;
43 
44  $ilCtrl->setContext($ilUser->getId(),
45  "user");
46 
47  $ilMainMenu->setActive("desktop");
48  $this->lng->loadLanguageModule("pdesk");
49 
50  // catch hack attempts
51  if ($_SESSION["AccountId"] == ANONYMOUS_USER_ID)
52  {
53  $this->ilias->raiseError($this->lng->txt("msg_not_available_for_anon"),$this->ilias->error_obj->MESSAGE);
54  }
55  $this->cmdClass = $_GET['cmdClass'];
56 
57  //$tree->useCache(false);
58  }
59 
63  function &executeCommand()
64  {
65  global $ilUser, $ilSetting, $rbacsystem;
66 
67  $next_class = $this->ctrl->getNextClass();
68  $this->ctrl->setReturn($this, "show");
69 
70  $this->tpl->addCss(ilUtil::getStyleSheetLocation('filesystem','delos.css','Services/Calendar'));
71 
72  // check whether password of user have to be changed
73  // due to first login or password of user is expired
74  if( ($ilUser->isPasswordChangeDemanded() || $ilUser->isPasswordExpired())
75  && $next_class != "ilpersonalsettingsgui"
76  )
77  {
78  $this->ctrl->redirectByClass("ilpersonalsettingsgui");
79  }
80 
81  // check whether personal profile of user is incomplete
82  if ($ilUser->getProfileIncomplete() && $next_class != "ilpersonalprofilegui" && !($ilUser->isPasswordChangeDemanded() || $ilUser->isPasswordExpired()))
83  {
84  $this->ctrl->redirectByClass("ilpersonalprofilegui");
85  }
86 
87  // read last active subsection
88  if (isset($_GET['PDHistory']) && $_GET['PDHistory'])
89  {
90  $next_class = $this->__loadNextClass();
91  }
92  $this->__storeLastClass($next_class);
93 
94 
95  // check for permission to view contacts
96  if (
97  $next_class == 'ilmailaddressbookgui' && ($this->ilias->getSetting("disable_contacts") ||
98  (
99  !$this->ilias->getSetting("disable_contacts_require_mail") &&
100  !$rbacsystem->checkAccess('mail_visible', ilMailGlobalServices::getMailObjectRefId())
101  ))
102  ) // if
103  {
104  $next_class = '';
105  ilUtil::sendFailure($this->lng->txt('no_permission'));
106  }
107 
108  switch($next_class)
109  {
110  //Feedback
111  case "ilfeedbackgui":
112  $this->getStandardTemplates();
113  $this->setTabs();
114  $this->tpl->setTitle($this->lng->txt("personal_desktop"));
115  //$this->tpl->setTitleIcon(ilUtil::getImagePath("icon_pd_b.gif"),
116  // $this->lng->txt("personal_desktop"));
117  $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_pd_b.gif"),
118  "");
119 
120  include_once("Services/Feedback/classes/class.ilFeedbackGUI.php");
121  $feedback_gui = new ilFeedbackGUI();
122  $ret =& $this->ctrl->forwardCommand($feedback_gui);
123  break;
124  // bookmarks
125  case "ilbookmarkadministrationgui":
126  if ($ilSetting->get('disable_bookmarks'))
127  {
128  ilUtil::sendFailure($this->lng->txt('permission_denied'), true);
129  ilUtil::redirect('ilias.php?baseClass=ilPersonalDesktopGUI');
130  return;
131  }
132  include_once("./Services/PersonalDesktop/classes/class.ilBookmarkAdministrationGUI.php");
133  $bookmark_gui = new ilBookmarkAdministrationGUI();
134  if ($bookmark_gui->getMode() == 'tree') {
135  $this->getTreeModeTemplates();
136  } else {
137  $this->getStandardTemplates();
138  }
139  $this->setTabs();
140  $ret =& $this->ctrl->forwardCommand($bookmark_gui);
141  break;
142 
143  // profile
144  case "ilpersonalprofilegui":
145  $this->getStandardTemplates();
146  $this->setTabs();
147  include_once("./Services/User/classes/class.ilPersonalProfileGUI.php");
148  $profile_gui = new ilPersonalProfileGUI();
149  $ret =& $this->ctrl->forwardCommand($profile_gui);
150  break;
151 
152  // settings
153  case "ilpersonalsettingsgui":
154  $this->getStandardTemplates();
155  $this->setTabs();
156  include_once("./Services/User/classes/class.ilPersonalSettingsGUI.php");
157  $settings_gui = new ilPersonalSettingsGUI();
158  $ret =& $this->ctrl->forwardCommand($settings_gui);
159  break;
160 
161  // profile
162  case "ilobjusergui":
163  include_once('./Services/User/classes/class.ilObjUserGUI.php');
164  $user_gui = new ilObjUserGUI("",$_GET["user"], false, false);
165  $ret =& $this->ctrl->forwardCommand($user_gui);
166  break;
167 
168  case 'ilcalendarpresentationgui':
169  $this->getStandardTemplates();
170  $this->displayHeader();
171  $this->tpl->setTitle($this->lng->txt("calendar"));
172  $this->setTabs();
173  include_once('./Services/Calendar/classes/class.ilCalendarPresentationGUI.php');
174  $cal = new ilCalendarPresentationGUI();
175  $ret = $this->ctrl->forwardCommand($cal);
176  $this->tpl->show();
177  break;
178 
179  // pd notes
180  case "ilpdnotesgui":
181  if ($ilSetting->get('disable_notes'))
182  {
183  ilUtil::sendFailure($this->lng->txt('permission_denied'), true);
184  ilUtil::redirect('ilias.php?baseClass=ilPersonalDesktopGUI');
185  return;
186  }
187 
188  $this->getStandardTemplates();
189  $this->setTabs();
190  include_once("./Services/Notes/classes/class.ilPDNotesGUI.php");
191  $pd_notes_gui = new ilPDNotesGUI();
192  $ret =& $this->ctrl->forwardCommand($pd_notes_gui);
193  break;
194 
195  // pd news
196  case "ilpdnewsgui":
197  $this->getStandardTemplates();
198  $this->setTabs();
199  include_once("./Services/News/classes/class.ilPDNewsGUI.php");
200  $pd_news_gui = new ilPDNewsGUI();
201  $ret =& $this->ctrl->forwardCommand($pd_news_gui);
202  break;
203 
204  case "illearningprogressgui":
205  $this->getStandardTemplates();
206  $this->setTabs();
207  include_once './Services/Tracking/classes/class.ilLearningProgressGUI.php';
209  $ret =& $this->ctrl->forwardCommand($new_gui);
210 
211  break;
212 
213  case "ilcolumngui":
214  $this->getStandardTemplates();
215  $this->setTabs();
216  include_once("./Services/Block/classes/class.ilColumnGUI.php");
217  $column_gui = new ilColumnGUI("pd");
218  $this->initColumn($column_gui);
219  $this->show();
220  break;
221 
222  // contacts
223  case 'ilmailaddressbookgui':
224  $this->getStandardTemplates();
225  $this->setTabs();
226  $this->tpl->setTitle($this->lng->txt("mail_addressbook"));
227 
228  include_once 'Services/Contact/classes/class.ilMailAddressbookGUI.php';
229  $mailgui = new ilMailAddressbookGUI();
230  $ret = $this->ctrl->forwardCommand($mailgui);
231  break;
232 
233  case 'ilpersonalworkspacegui':
234  $this->getStandardTemplates();
235  $this->setTabs();
236  include_once 'Services/PersonalWorkspace/classes/class.ilPersonalWorkspaceGUI.php';
237  $wsgui = new ilPersonalWorkspaceGUI();
238  $ret = $this->ctrl->forwardCommand($wsgui);
239  $this->tpl->show();
240  break;
241 
242  case 'ilobjportfoliogui':
243  $this->getStandardTemplates();
244  $this->setTabs();
245  include_once 'Services/Portfolio/classes/class.ilObjPortfolioGUI.php';
246  $pfgui = new ilObjPortfolioGUI();
247  $ret = $this->ctrl->forwardCommand($pfgui);
248  $this->tpl->show();
249  break;
250 
251  case 'ilpersonalskillsgui':
252  $this->setTabs();
253  include_once './Services/Skill/classes/class.ilPersonalSkillsGUI.php';
254  $skgui = new ilPersonalSkillsGUI();
255  $this->getStandardTemplates();
256  $ret = $this->ctrl->forwardCommand($skgui);
257  $this->tpl->show();
258  break;
259 
260  case 'redirect':
261  $this->redirect();
262  break;
263 
264  default:
265  $this->getStandardTemplates();
266  $this->setTabs();
267  $cmd = $this->ctrl->getCmd("show");
268  $this->$cmd();
269  break;
270  }
271  $ret = null;
272  return $ret;
273  }
274 
278  public function redirect()
279  {
280  if(is_array($_GET))
281  {
282  foreach($_GET as $key => $val)
283  {
284  if(substr($key, 0, strlen('param_')) == 'param_')
285  {
286  $this->ctrl->setParameterByClass($_GET['redirectClass'], substr($key, strlen('param_')), $val);
287  }
288  }
289  }
290  ilUtil::redirect($this->ctrl->getLinkTargetByClass($_GET['redirectClass'], $_GET['redirectCmd'], '', true));
291  }
292 
297  {
298  $this->tpl->getStandardTemplate();
299  // add template for content
300 // $this->tpl->addBlockFile("CONTENT", "content", "tpl.adm_content.html");
301 // $this->tpl->addBlockFile("STATUSLINE", "statusline", "tpl.statusline.html");
302  }
303 
308  {
309  // add template for content
310  //$this->tpl->addBlockFile("CONTENT", "content", "tpl.adm_tree_content.html");
311  $this->tpl->addBlockFile("CONTENT", "content", "tpl.adm_content.html");
312  $this->tpl->addBlockFile("STATUSLINE", "statusline", "tpl.statusline.html");
313  }
314 
318  function show()
319  {
320 
321  // preload block settings
322  include_once("Services/Block/classes/class.ilBlockSetting.php");
324 
325  // add template for content
326  $this->pd_tpl = new ilTemplate("tpl.usr_personaldesktop.html", true, true);
327  $this->tpl->getStandardTemplate();
328 
329  // display infopanel if something happened
331 
332  //$this->tpl->setTitleIcon(ilUtil::getImagePath("icon_pd_b.gif"),
333  // $this->lng->txt("personal_desktop"));
334 // $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_pd_b.gif"),
335 // "");
336  $this->tpl->setTitle($this->lng->txt("overview"));
337  $this->tpl->setVariable("IMG_SPACE", ilUtil::getImagePath("spacer.gif", false));
338 
339  $this->tpl->setContent($this->getCenterColumnHTML());
340  $this->tpl->setRightContent($this->getRightColumnHTML());
341  $this->tpl->setLeftContent($this->getLeftColumnHTML());
342  $this->tpl->show();
343  }
344 
345 
350  {
351  global $ilCtrl, $ilPluginAdmin;
352 
353  include_once("Services/Block/classes/class.ilColumnGUI.php");
354  $column_gui = new ilColumnGUI("pd", IL_COL_CENTER);
355  $this->initColumn($column_gui);
356 
357  if ($ilCtrl->getNextClass() == "ilcolumngui" &&
358  $column_gui->getCmdSide() == IL_COL_CENTER)
359  {
360  $html = $ilCtrl->forwardCommand($column_gui);
361  }
362  else
363  {
364  if (!$ilCtrl->isAsynch())
365  {
366  if ($column_gui->getScreenMode() != IL_SCREEN_SIDE)
367  {
368  // right column wants center
369  if ($column_gui->getCmdSide() == IL_COL_RIGHT)
370  {
371  $column_gui = new ilColumnGUI("pd", IL_COL_RIGHT);
372  $this->initColumn($column_gui);
373  $html = $ilCtrl->forwardCommand($column_gui);
374  }
375  // left column wants center
376  if ($column_gui->getCmdSide() == IL_COL_LEFT)
377  {
378  $column_gui = new ilColumnGUI("pd", IL_COL_LEFT);
379  $this->initColumn($column_gui);
380  $html = $ilCtrl->forwardCommand($column_gui);
381  }
382  }
383  else
384  {
385  $html = "";
386 
387  // user interface plugin slot + default rendering
388  include_once("./Services/UIComponent/classes/class.ilUIHookProcessor.php");
389  $uip = new ilUIHookProcessor("Services/PersonalDesktop", "center_column",
390  array("personal_desktop_gui" => $this));
391  if (!$uip->replaced())
392  {
393  $html = $ilCtrl->getHTML($column_gui);
394  }
395  $html = $uip->getHTML($html);
396 
397  }
398  }
399  }
400  return $html;
401  }
402 
407  {
408  global $ilUser, $lng, $ilCtrl, $ilPluginAdmin;
409 
410  include_once("Services/Block/classes/class.ilColumnGUI.php");
411  $column_gui = new ilColumnGUI("pd", IL_COL_RIGHT);
412  $this->initColumn($column_gui);
413 
414  if ($column_gui->getScreenMode() == IL_SCREEN_FULL)
415  {
416  return "";
417  }
418 
419  if ($ilCtrl->getNextClass() == "ilcolumngui" &&
420  $column_gui->getCmdSide() == IL_COL_RIGHT &&
421  $column_gui->getScreenMode() == IL_SCREEN_SIDE)
422  {
423  $html = $ilCtrl->forwardCommand($column_gui);
424  }
425  else
426  {
427  if (!$ilCtrl->isAsynch())
428  {
429  $html = "";
430 
431  // user interface plugin slot + default rendering
432  include_once("./Services/UIComponent/classes/class.ilUIHookProcessor.php");
433  $uip = new ilUIHookProcessor("Services/PersonalDesktop", "right_column",
434  array("personal_desktop_gui" => $this));
435  if (!$uip->replaced())
436  {
437  $html = $ilCtrl->getHTML($column_gui);
438  }
439  $html = $uip->getHTML($html);
440  }
441  }
442 
443  return $html;
444  }
445 
449  function getLeftColumnHTML()
450  {
451  global $ilUser, $lng, $ilCtrl, $ilPluginAdmin;
452 
453  include_once("Services/Block/classes/class.ilColumnGUI.php");
454  $column_gui = new ilColumnGUI("pd", IL_COL_LEFT);
455  $this->initColumn($column_gui);
456 
457  if ($column_gui->getScreenMode() == IL_SCREEN_FULL)
458  {
459  return "";
460  }
461 
462  if ($ilCtrl->getNextClass() == "ilcolumngui" &&
463  $column_gui->getCmdSide() == IL_COL_LEFT &&
464  $column_gui->getScreenMode() == IL_SCREEN_SIDE)
465  {
466  $html = $ilCtrl->forwardCommand($column_gui);
467  }
468  else
469  {
470  if (!$ilCtrl->isAsynch())
471  {
472  $html = "";
473 
474  // user interface plugin slot + default rendering
475  include_once("./Services/UIComponent/classes/class.ilUIHookProcessor.php");
476  $uip = new ilUIHookProcessor("Services/PersonalDesktop", "left_column",
477  array("personal_desktop_gui" => $this));
478  if (!$uip->replaced())
479  {
480  $html = $ilCtrl->getHTML($column_gui);
481  }
482  $html = $uip->getHTML($html);
483  }
484  }
485 
486  return $html;
487  }
488 
490  {
491  // add template for content
492  $this->pd_tpl = new ilTemplate("tpl.usr_personaldesktop.html", true, true);
493  $this->tpl->getStandardTemplate();
494 
495  // display infopanel if something happened
497 
498  //$this->tpl->setTitleIcon(ilUtil::getImagePath("icon_pd_b.gif"),
499  // $this->lng->txt("personal_desktop"));
500  $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_pd_b.gif"),
501  "");
502  $this->tpl->setTitle($this->lng->txt("personal_desktop"));
503  $this->tpl->setVariable("IMG_SPACE", ilUtil::getImagePath("spacer.gif", false));
504  }
505 
506 
510  function removeMember()
511  {
512  global $err_msg;
513  if (strlen($err_msg) > 0)
514  {
515  $this->ilias->raiseError($this->lng->txt($err_msg),$this->ilias->error_obj->MESSAGE);
516  }
517  $this->show();
518  }
519 
524  {
525  include_once("Services/Mail/classes/class.ilPDSysMessageBlockGUI.php");
526  $sys_block = new ilPDSysMessageBlockGUI("ilpersonaldesktopgui", "show");
527  return $sys_block->getHTML();
528  }
529 
530 
534  function displayFeedback()
535  {
536  include_once("./Services/Feedback/classes/class.ilPDFeedbackBlockGUI.php");
537  $fb_block = new ilPDFeedbackBlockGUI("ilpersonaldesktopgui", "show");
538  return $fb_block->getHTML();
539 
540  include_once('Services/Feedback/classes/class.ilFeedbackGUI.php');
541  $feedback_gui = new ilFeedbackGUI();
542  return $feedback_gui->getPDFeedbackListHTML();
543  }
544 
555  function multiarray_sort ($array, $key_sort)
556  {
557  if ($array) {
558  $key_sorta = explode(";", $key_sort);
559 
560  $multikeys = array_keys($array);
561  $keys = array_keys($array[$multikeys[0]]);
562 
563  for($m=0; $m < count($key_sorta); $m++) {
564  $nkeys[$m] = trim($key_sorta[$m]);
565  }
566  $n += count($key_sorta);
567 
568  for($i=0; $i < count($keys); $i++){
569  if(!in_array($keys[$i], $key_sorta)) {
570  $nkeys[$n] = $keys[$i];
571  $n += "1";
572  }
573  }
574 
575  for($u=0;$u<count($array); $u++) {
576  $arr = $array[$multikeys[$u]];
577  for($s=0; $s<count($nkeys); $s++) {
578  $k = $nkeys[$s];
579  $output[$multikeys[$u]][$k] = $array[$multikeys[$u]][$k];
580  }
581  }
582  sort($output);
583  return $output;
584  }
585  }
586 
590  function setTabs()
591  {
592 
593  }
594 
598  function jumpToMemberships()
599  {
600  global $ilSetting, $ilUser;
601 
602  if ($ilSetting->get('disable_my_memberships') == 0)
603  {
604  $ilUser->writePref('pd_view', 1);
605  }
606  $this->show();
607  }
608 
613  {
614  global $ilSetting, $ilUser;
615 
616  if ($ilSetting->get('disable_my_offers') == 0)
617  {
618  $ilUser->writePref('pd_view', 0);
619  }
620  $this->show();
621  }
622 
623 
627  function jumpToProfile()
628  {
629  $this->ctrl->redirectByClass("ilpersonalprofilegui");
630  }
631 
635  function jumpToPortfolio()
636  {
637  // incoming back link from shared resource
638  $cmd = "";
639  if($_REQUEST["dsh"])
640  {
641  $this->ctrl->setParameterByClass("ilobjportfoliogui", "user", $_REQUEST["dsh"]);
642  $cmd = "showOther";
643  }
644 
645  // used for goto links
646  if($_GET["prt_id"])
647  {
648  $this->ctrl->setParameterByClass("ilobjportfoliogui", "prt_id", $_GET["prt_id"]);
649  $this->ctrl->redirectByClass("ilobjportfoliogui", "preview");
650  }
651  else
652  {
653  $this->ctrl->redirectByClass("ilobjportfoliogui", $cmd);
654  }
655  }
656 
660  function jumpToSettings()
661  {
662  $this->ctrl->redirectByClass("ilpersonalsettingsgui");
663  }
664 
668  function jumpToBookmarks()
669  {
670  if ($this->ilias->getSetting("disable_bookmarks"))
671  {
672  ilUtil::sendFailure($this->lng->txt('permission_denied'), true);
673  ilUtil::redirect('ilias.php?baseClass=ilPersonalDesktopGUI');
674  return;
675  }
676 
677  $this->ctrl->redirectByClass("ilbookmarkadministrationgui");
678  }
679 
683  function jumpToNotes()
684  {
685  if ($this->ilias->getSetting('disable_notes'))
686  {
687  ilUtil::sendFailure($this->lng->txt('permission_denied'), true);
688  ilUtil::redirect('ilias.php?baseClass=ilPersonalDesktopGUI');
689  return;
690  }
691 
692  $this->ctrl->redirectByClass("ilpdnotesgui");
693  }
694 
698  function jumpToNews()
699  {
700  $this->ctrl->redirectByClass("ilpdnewsgui");
701  }
702 
706  function jumpToLP()
707  {
708  $this->ctrl->redirectByClass("illearningprogressgui");
709  }
710 
714  function jumpToCalendar()
715  {
716  $this->ctrl->redirectByClass("ilcalendarpresentationgui");
717  }
718 
722  function jumpToContacts()
723  {
724  $this->ctrl->redirectByClass("ilmailaddressbookgui");
725  }
726 
730  function jumpToWorkspace()
731  {
732  // incoming back link from shared resource
733  $cmd = "";
734  if($_REQUEST["dsh"])
735  {
736  $this->ctrl->setParameterByClass("ilpersonalworkspacegui", "user", $_REQUEST["dsh"]);
737  $cmd = "share";
738  }
739 
740  if($_REQUEST["wsp_id"])
741  {
742  $this->ctrl->setParameterByClass("ilpersonalworkspacegui", "wsp_id", (int)$_REQUEST["wsp_id"]);
743  }
744 
745  if($_REQUEST["gtp"])
746  {
747  $this->ctrl->setParameterByClass("ilpersonalworkspacegui", "gtp", (int)$_REQUEST["gtp"]);
748  }
749 
750  $this->ctrl->redirectByClass("ilpersonalworkspacegui", $cmd);
751  }
752 
756  function jumpToSkills()
757  {
758  $this->ctrl->redirectByClass("ilpersonalskillsgui");
759  }
760 
761  function __loadNextClass()
762  {
763  $stored_classes = array('ilpersonaldesktopgui',
764  'ilpersonalprofilegui',
765  'ilpdnotesgui',
766  'ilcalendarpresentationgui',
767  'ilbookmarkadministrationgui',
768  'illearningprogressgui');
769 
770  if(isset($_SESSION['il_pd_history']) and in_array($_SESSION['il_pd_history'],$stored_classes))
771  {
772  return $_SESSION['il_pd_history'];
773  }
774  else
775  {
776  $this->ctrl->getNextClass($this);
777  }
778  }
779  function __storeLastClass($a_class)
780  {
781  $_SESSION['il_pd_history'] = $a_class;
782  $this->cmdClass = $a_class;
783  }
784 
788  function initColumn($a_column_gui)
789  {
790  $pd_set = new ilSetting("pd");
791  if ($pd_set->get("enable_block_moving"))
792  {
793  $a_column_gui->setEnableMovement(true);
794  }
795  }
796 
800  function displayHeader()
801  {
802  //$this->tpl->setTitleIcon(ilUtil::getImagePath("icon_pd_b.gif"),
803  // $this->lng->txt("personal_desktop"));
804 // $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_pd_b.gif"),
805 // "");
806  $this->tpl->setTitle($this->lng->txt("personal_desktop"));
807  }
808 
809 
810 }
811 ?>