24 include_once(
"Services/Block/classes/class.ilBlockGUI.php");
53 $lng->loadLanguageModule(
'pd');
62 $this->allow_moving =
false;
76 if(in_array((
int)
$_GET[
'view'], $this->allowed_views))
78 $ilUser->writePref(
'pd_view', (
int)$_GET[
'view']);
82 @reset($this->allowed_views);
83 $view = (int)@current($this->allowed_views);
84 $ilUser->writePref(
'pd_view',
$view);
87 $ilCtrl->redirectByClass(
'ilpersonaldesktopgui',
'show');
99 $this->allowed_views = array();
102 if($ilSetting->get(
'disable_my_offers') == 1 &&
103 $ilSetting->get(
'disable_my_memberships') == 1)
106 $ilSetting->set(
'personal_items_default_view', self::VIEW_MY_OFFERS);
110 else if($ilSetting->get(
'disable_my_offers') == 0 &&
111 $ilSetting->get(
'disable_my_memberships') == 0)
116 else if($ilSetting->get(
'disable_my_offers') == 0 &&
117 $ilSetting->get(
'disable_my_memberships') == 1)
126 $this->view = (int)$ilUser->getPref(
'pd_view');
127 if(!in_array($this->view, $this->allowed_views))
129 @reset($this->allowed_views);
130 $view = (int)@current($this->allowed_views);
131 $ilUser->writePref(
'writePref',
$view);
162 if($ilSetting->get(
'disable_my_offers') == 0 &&
163 $ilSetting->get(
'disable_my_memberships') == 0)
165 $ilCtrl->setParameter($this,
'block_type', $this->
getBlockType());
166 $ilCtrl->setParameter($this,
'view', self::VIEW_MY_OFFERS);
167 $this->
addHeaderLink($ilCtrl->getLinkTarget($this,
'changeView'), $this->lng->txt(
'pd_my_offers'),
168 ($this->view == self::VIEW_MY_OFFERS ?
false :
true)
170 $ilCtrl->setParameter($this,
'view', self::VIEW_MY_MEMBERSHIPS);
171 $this->
addHeaderLink($ilCtrl->getLinkTarget($this,
'changeView'), $this->lng->txt(
'pd_my_memberships'),
172 ($this->view == self::VIEW_MY_MEMBERSHIPS ?
false :
true)
174 $ilCtrl->clearParameters($this);
178 $this->
setData(array(
"dummy"));
180 switch((
int)$this->view)
182 case self::VIEW_MY_MEMBERSHIPS:
183 $this->
setTitle($this->lng->txt(
'pd_my_memberships'));
187 case self::VIEW_MY_OFFERS:
189 if(!in_array(self::VIEW_MY_MEMBERSHIPS, $this->allowed_views))
191 $this->
setTitle($this->lng->txt(
'selected_items'));
195 $this->
setTitle($this->lng->txt(
'pd_my_offers'));
206 $ilCtrl->clearParametersByClass(
"ilpersonaldesktopgui");
207 $ilCtrl->clearParameters($this);
218 $next_class = $ilCtrl->getNextClass();
219 $cmd = $ilCtrl->getCmd(
"getHTML");
221 return $this->
$cmd();
226 return $this->content;
231 $this->content = $a_content;
243 $this->tpl->setVariable(
"BLOCK_ROW", $this->
getContent());
261 $this->tpl->setVariable(
"FCOLSPAN", $this->
getColSpan());
262 if ($this->tpl->blockExists(
"block_footer"))
264 $this->tpl->setCurrentBlock(
"block_footer");
265 $this->tpl->parseCurrentBlock();
283 if ($ilUser->getPref(
"pd_order_items") ==
'location')
286 $ilCtrl->getLinkTarget($this,
287 "orderPDItemsByType"),
288 $ilCtrl->getLinkTarget($this,
289 "orderPDItemsByType",
"",
true),
299 if ($ilUser->getPref(
"pd_order_items") ==
'location')
306 $ilCtrl->getLinkTarget($this,
307 "orderPDItemsByLocation"),
308 $ilCtrl->getLinkTarget($this,
309 "orderPDItemsByLocation",
"",
true),
323 global $tree, $ilUser, $ilObjDataCache;
325 include_once
'Services/Membership/classes/class.ilParticipants.php';
328 if(is_array($types) && count($types))
330 foreach($types as $type)
349 $items = array_merge($crs_mbs, $grp_mbs);
352 $references = array();
353 foreach($items as $key => $obj_id)
356 if(is_array($item_references) && count($item_references))
358 foreach($item_references as
$ref_id)
360 $title = $ilObjDataCache->lookupTitle($obj_id);
361 $type = $ilObjDataCache->lookupType($obj_id);
363 $references[
$title.$ref_id] =
364 array(
'ref_id' => $ref_id,
368 'description' => $ilObjDataCache->lookupDescription($obj_id),
369 'parent_ref' => $tree->getParentId($ref_id));
374 return is_array($references) ? $references : array();
385 global $ilUser, $rbacsystem, $objDefinition,
$ilBench,
$ilSetting, $ilObjDataCache, $rbacreview;
390 $item_html = array();
391 if(count($items) > 0)
395 foreach($items as $item)
397 $ref_ids[] = $item[
'ref_id'];
400 $ilObjDataCache->preloadReferenceCache($ref_ids);
402 foreach($items as $item)
406 if ($cur_obj_type != $item[
"type"])
410 $item_list_gui->enableDelete(
false);
411 $item_list_gui->enableCut(
false);
412 $item_list_gui->enablePayment(
false);
413 $item_list_gui->enableLink(
false);
414 $item_list_gui->enableInfoScreen(
false);
415 $item_list_gui->enableSubscribe(
false);
419 $item_list_gui->enableDescription(
false);
420 $item_list_gui->enableProperties(
false);
421 $item_list_gui->enablePreconditions(
false);
425 $item_list_gui->enableCommands(
true,
true);
429 $ilBench->start(
"ilPersonalDesktopGUI",
"getListHTML");
431 if (is_object($item_list_gui))
433 $html = $item_list_gui->getListItemHTML($item[
"ref_id"],
434 $item[
"obj_id"], $item[
"title"], $item[
"description"]);
435 $ilBench->stop(
"ilPersonalDesktopGUI",
"getListHTML");
439 $item_html[] = array(
441 "item_ref_id" => $item[
"ref_id"],
442 "item_obj_id" => $item[
"obj_id"],
443 "parent_ref" => $item[
"parent_ref"],
444 "type" => $item[
"type"],
445 'item_icon_image_type' => $item_list_gui->getIconImageType()
453 if (count($item_html) > 0)
458 foreach($item_html as $item)
461 if ($cur_parent_ref != $item[
"parent_ref"])
463 if ($ilSetting->get(
"icon_position_in_lists") ==
"item_rows")
472 $cur_parent_ref = $item[
"parent_ref"];
476 $this->
addStandardRow(
$tpl, $item[
"html"], $item[
"item_ref_id"], $item[
"item_obj_id"],
477 $item[
'item_icon_image_type'],
478 "th_".$cur_parent_ref);
500 $objtype_groups = $objDefinition->getGroupedRepositoryObjectTypes(
501 array(
"cat",
"crs",
"grp",
"fold"));
504 foreach($objtype_groups as $grp => $grpdata)
508 "title" => $this->lng->txt(
"objs_".$grp),
509 "types" => $grpdata[
"objs"]);
512 foreach ($types as
$t)
522 foreach($items as $item)
524 $ref_ids[] = $item[
'ref_id'];
527 $ilObjDataCache->preloadReferenceCache($ref_ids);
528 $item_html = array();
532 $rel_header =
"th_".$grp;
535 if (count($items) > 0)
543 if (strcmp($a_type,
"tst") == 0) {
544 $items = $this->multiarray_sort($items,
"used_tries; title");
545 foreach ($items as $tst_item) {
546 if (!isset($tst_item[
"used_tries"])) {
549 elseif ($tst_item[
"used_tries"] == 0) {
555 foreach($items as $item)
558 if ($cur_obj_type != $item[
"type"])
560 $class = $objDefinition->getClassName($item[
"type"]);
561 $location = $objDefinition->getLocation($item[
"type"]);
562 $full_class =
"ilObj".$class.
"ListGUI";
563 include_once(
$location.
"/class.".$full_class.
".php");
564 $item_list_gui =
new $full_class();
565 $item_list_gui->enableDelete(
false);
566 $item_list_gui->enableCut(
false);
567 $item_list_gui->enablePayment(
false);
568 $item_list_gui->enableLink(
false);
569 $item_list_gui->enableInfoScreen(
false);
570 $item_list_gui->enableSubscribe(
false);
573 $item_list_gui->enableDescription(
false);
574 $item_list_gui->enableProperties(
false);
575 $item_list_gui->enablePreconditions(
false);
576 $item_list_gui->enableNoticeProperties(
false);
580 $item_list_gui->enableCommands(
true,
true);
584 $ilBench->start(
"ilPersonalDesktopGUI",
"getListHTML");
586 $html = $item_list_gui->getListItemHTML($item[
"ref_id"],
587 $item[
"obj_id"], $item[
"title"], $item[
"description"]);
588 $ilBench->stop(
"ilPersonalDesktopGUI",
"getListHTML");
592 $item_html[] = array(
594 "item_ref_id" => $item[
"ref_id"],
595 "item_obj_id" => $item[
"obj_id"],
596 'item_icon_image_type' => (method_exists($item_list_gui,
'getIconImageType')) ?
597 $item_list_gui->getIconImageType() :
605 if (count($item_html) > 0)
610 if ($ilSetting->get(
"icon_position_in_lists") ==
"item_rows")
622 foreach($item_html as $item)
625 $ilSetting->get(
"icon_position_in_lists") ==
"item_rows")
628 $this->
addStandardRow(
$tpl, $item[
"html"], $item[
"item_ref_id"], $item[
"item_obj_id"],
629 $item[
'item_icon_image_type'],
635 $this->
addStandardRow(
$tpl, $item[
"html"], $item[
"item_ref_id"], $item[
"item_obj_id"],
"", $rel_header);
658 switch($ilUser->getPref(
'pd_order_items'))
677 global $ilUser, $rbacsystem, $objDefinition,
$ilBench;
681 switch ($ilUser->getPref(
"pd_order_items"))
702 $items = $ilUser->getDesktopItems();
703 if (count($items) > 0)
707 foreach($items as $item)
709 $ref_ids[] = $item[
"ref_id"];
711 $ilObjDataCache->preloadReferenceCache($ref_ids);
716 $objtype_groups = $objDefinition->getGroupedRepositoryObjectTypes(
717 array(
"cat",
"crs",
"grp",
"fold"));
720 foreach($objtype_groups as $grp => $grpdata)
724 "title" => $this->lng->txt(
"objs_".$grp),
725 "types" => $grpdata[
"objs"]);
728 foreach ($types as
$t)
735 $items = $ilUser->getDesktopItems($type);
737 $item_html = array();
741 $rel_header =
"th_".$grp;
744 if (count($items) > 0)
752 if (strcmp($a_type,
"tst") == 0) {
753 $items = $this->multiarray_sort($items,
"used_tries; title");
754 foreach ($items as $tst_item) {
755 if (!isset($tst_item[
"used_tries"])) {
758 elseif ($tst_item[
"used_tries"] == 0) {
764 foreach($items as $item)
767 if ($cur_obj_type != $item[
"type"])
769 $class = $objDefinition->getClassName($item[
"type"]);
770 $location = $objDefinition->getLocation($item[
"type"]);
771 $full_class =
"ilObj".$class.
"ListGUI";
772 include_once(
$location.
"/class.".$full_class.
".php");
773 $item_list_gui =
new $full_class();
774 $item_list_gui->enableDelete(
false);
775 $item_list_gui->enableCut(
false);
776 $item_list_gui->enablePayment(
false);
777 $item_list_gui->enableLink(
false);
778 $item_list_gui->enableInfoScreen(
false);
781 $item_list_gui->enableDescription(
false);
782 $item_list_gui->enableProperties(
false);
783 $item_list_gui->enablePreconditions(
false);
784 $item_list_gui->enableNoticeProperties(
false);
788 $item_list_gui->enableCommands(
true,
true);
792 $ilBench->start(
"ilPersonalDesktopGUI",
"getListHTML");
794 $html = $item_list_gui->getListItemHTML($item[
"ref_id"],
795 $item[
"obj_id"], $item[
"title"], $item[
"description"]);
796 $ilBench->stop(
"ilPersonalDesktopGUI",
"getListHTML");
800 $item_html[] = array(
802 "item_ref_id" => $item[
"ref_id"],
803 "item_obj_id" => $item[
"obj_id"],
804 'item_icon_image_type' => (method_exists($item_list_gui,
'getIconImageType')) ?
805 $item_list_gui->getIconImageType() :
813 if (count($item_html) > 0)
818 if ($ilSetting->get(
"icon_position_in_lists") ==
"item_rows")
830 foreach($item_html as $item)
833 $ilSetting->get(
"icon_position_in_lists") ==
"item_rows")
836 $this->
addStandardRow(
$tpl, $item[
"html"], $item[
"item_ref_id"], $item[
"item_obj_id"],
837 $item[
'item_icon_image_type'],
843 $this->
addStandardRow(
$tpl, $item[
"html"], $item[
"item_ref_id"], $item[
"item_obj_id"],
"", $rel_header);
863 $items = $ilUser->getDesktopItems();
864 $item_html = array();
866 if (count($items) > 0)
870 foreach($items as $item)
872 $ref_ids[] = $item[
"ref_id"];
875 $ilObjDataCache->preloadReferenceCache($ref_ids);
877 foreach($items as $item)
881 if ($cur_obj_type != $item[
"type"])
885 $item_list_gui->enableDelete(
false);
886 $item_list_gui->enableCut(
false);
887 $item_list_gui->enablePayment(
false);
888 $item_list_gui->enableLink(
false);
889 $item_list_gui->enableInfoScreen(
false);
893 $item_list_gui->enableDescription(
false);
894 $item_list_gui->enableProperties(
false);
895 $item_list_gui->enablePreconditions(
false);
899 $item_list_gui->enableCommands(
true,
true);
903 $ilBench->start(
"ilPersonalDesktopGUI",
"getListHTML");
905 $html = $item_list_gui->getListItemHTML($item[
"ref_id"],
906 $item[
"obj_id"], $item[
"title"], $item[
"description"]);
907 $ilBench->stop(
"ilPersonalDesktopGUI",
"getListHTML");
911 $item_html[] = array(
913 "item_ref_id" => $item[
"ref_id"],
914 "item_obj_id" => $item[
"obj_id"],
915 "parent_ref" => $item[
"parent_ref"],
916 "type" => $item[
"type"],
917 'item_icon_image_type' => $item_list_gui->getIconImageType()
924 if (count($item_html) > 0)
929 foreach($item_html as $item)
932 if ($cur_parent_ref != $item[
"parent_ref"])
934 if ($ilSetting->get(
"icon_position_in_lists") ==
"item_rows")
943 $cur_parent_ref = $item[
"parent_ref"];
947 $this->
addStandardRow(
$tpl, $item[
"html"], $item[
"item_ref_id"], $item[
"item_obj_id"],
948 $item[
'item_icon_image_type'],
949 "th_".$cur_parent_ref);
961 $this->cur_row_type =
"";
972 $tpl =
new ilTemplate (
"tpl.pd_list_block.html",
true,
true,
"Services/PersonalDesktop");
973 $this->cur_row_type =
"";
982 global $objDefinition;
984 if (!is_object($this->item_list_guis[$a_type]))
986 $class = $objDefinition->getClassName($a_type);
987 $location = $objDefinition->getLocation($a_type);
988 $full_class =
"ilObj".$class.
"ListGUI";
990 include_once(
$location.
"/class.".$full_class.
".php");
991 $item_list_gui =
new $full_class();
992 $this->item_list_guis[$a_type] =& $item_list_gui;
996 $item_list_gui =& $this->item_list_guis[$a_type];
998 return $item_list_gui;
1011 $title = $this->lng->txt(
"objs_".$a_type);
1012 $header_id =
"th_".$a_type;
1016 $a_tpl->setCurrentBlock(
"container_header_row_image");
1017 $a_tpl->setVariable(
"HEADER_IMG", $icon);
1018 $a_tpl->setVariable(
"HEADER_ALT",
$title);
1022 $a_tpl->setCurrentBlock(
"container_header_row");
1025 $a_tpl->setVariable(
"BLOCK_HEADER_CONTENT",
$title);
1026 $a_tpl->setVariable(
"BLOCK_HEADER_ID", $header_id);
1027 $a_tpl->parseCurrentBlock();
1028 $a_tpl->touchBlock(
"container_row");
1044 if (!in_array($type, array(
"lm",
"dbk",
"sahs",
"htlm")))
1054 if ($ilSetting->get(
"custom_icons") &&
1055 in_array($type, array(
"cat",
"grp",
"crs",
"root")))
1057 require_once(
"./Services/Container/classes/class.ilContainer.php");
1064 if ($tree->getRootId() != $par_id)
1070 $nd = $tree->getNodeData(ROOT_FOLDER_ID);
1074 $title = $this->lng->txt(
"repository");
1080 $item_list_gui->enableDelete(
false);
1081 $item_list_gui->enableCut(
false);
1082 $item_list_gui->enablePayment(
false);
1083 $item_list_gui->enableLink(
false);
1084 $item_list_gui->enableDescription(
false);
1085 $item_list_gui->enableProperties(
false);
1086 $item_list_gui->enablePreconditions(
false);
1087 $item_list_gui->enablePath(
true);
1088 $item_list_gui->enableCommands(
false);
1089 $html = $item_list_gui->getListItemHTML($a_ref_id,
1094 $a_tpl->setCurrentBlock(
"container_header_row_image");
1095 $a_tpl->setVariable(
"HEADER_IMG", $icon);
1096 $a_tpl->setVariable(
"HEADER_ALT",
$title);
1100 $a_tpl->setCurrentBlock(
"container_header_row");
1103 $a_tpl->setVariable(
"BLOCK_HEADER_CONTENT", $html);
1104 $a_tpl->setVariable(
"BLOCK_HEADER_ID",
"th_".$a_ref_id);
1105 $a_tpl->parseCurrentBlock();
1106 $a_tpl->touchBlock(
"container_row");
1117 $a_image_type =
"", $a_related_header =
"")
1121 $this->cur_row_type = ($this->cur_row_type ==
"row_type_1")
1124 $a_tpl->touchBlock($this->cur_row_type);
1126 if ($a_image_type !=
"")
1128 if (!is_array($a_image_type) && !in_array($a_image_type, array(
"lm",
"dbk",
"htlm",
"sahs")))
1131 $title = $this->lng->txt(
"obj_".$a_image_type);
1136 $title = $this->lng->txt(
"learning_resource");
1140 if ($ilSetting->get(
"custom_icons") &&
1141 in_array($a_image_type, array(
"cat",
"grp",
"crs")))
1143 require_once(
"./Services/Container/classes/class.ilContainer.php");
1150 $a_tpl->setCurrentBlock(
"block_row_image");
1151 $a_tpl->setVariable(
"ROW_IMG", $icon);
1152 $a_tpl->setVariable(
"ROW_ALT",
$title);
1153 $a_tpl->parseCurrentBlock();
1157 $a_tpl->setVariable(
"ROW_NBSP",
" ");
1159 $a_tpl->setCurrentBlock(
"container_standard_row");
1160 $a_tpl->setVariable(
"BLOCK_ROW_CONTENT", $a_html);
1161 $rel_headers = ($a_related_header !=
"")
1162 ?
"th_selected_items ".$a_related_header
1163 :
"th_selected_items";
1164 $a_tpl->setVariable(
"BLOCK_ROW_HEADERS", $rel_headers);
1165 $a_tpl->parseCurrentBlock();
1166 $a_tpl->touchBlock(
"container_row");
1176 switch((
int)$this->view)
1178 case self::VIEW_MY_MEMBERSHIPS:
1179 $tpl =
new ilTemplate(
'tpl.pd_my_memberships_intro.html',
true,
true,
'Services/PersonalDesktop');
1181 $tpl->setVariable(
'TXT_WELCOME', $lng->txt(
'pd_my_memberships_intro'));
1182 $tpl->setVariable(
'TXT_INTRO_1', $lng->txt(
'pd_my_memberships_intro2'));
1185 case self::VIEW_MY_OFFERS:
1188 $nd = $tree->getNodeData(ROOT_FOLDER_ID);
1192 $title = $lng->txt(
"repository");
1195 $tpl =
new ilTemplate(
"tpl.pd_intro.html",
true,
true,
"Services/PersonalDesktop");
1197 $tpl->setVariable(
"TXT_WELCOME", $lng->txt(
"pdesk_intro"));
1198 $tpl->setVariable(
"TXT_INTRO_1", sprintf($lng->txt(
"pdesk_intro2"), $lng->txt(
"to_desktop")));
1199 $tpl->setVariable(
"TXT_INTRO_2", sprintf($lng->txt(
"pdesk_intro3"),
1200 '<a href="repository.php?cmd=frameset&getlast=true">'.$title.
'</a>'));
1201 $tpl->setVariable(
"TXT_INTRO_3", $lng->txt(
"pdesk_intro4"));
1215 $ilUser->writePref(
"pd_order_items",
"location");
1217 if ($ilCtrl->isAsynch())
1224 $ilCtrl->redirectByClass(
"ilpersonaldesktopgui",
"show");
1235 $ilUser->writePref(
"pd_order_items",
"type");
1237 if ($ilCtrl->isAsynch())
1244 $ilCtrl->redirectByClass(
"ilpersonaldesktopgui",
"show");