5 include_once(
"Services/Block/classes/class.ilBlockGUI.php");
6 include_once
'./Services/PersonalDesktop/interfaces/interface.ilDesktopItemHandling.php';
36 $lng->loadLanguageModule(
'pd');
45 $this->allow_moving =
false;
57 include_once
'./Services/PersonalDesktop/classes/class.ilDesktopItemGUI.php';
59 $ilCtrl->redirectByClass(
'ilpersonaldesktopgui',
'show');
69 include_once
'./Services/PersonalDesktop/classes/class.ilDesktopItemGUI.php';
71 $ilCtrl->redirectByClass(
'ilpersonaldesktopgui',
'show');
84 if(in_array((
int)
$_GET[
'view'], $this->allowed_views))
86 $ilUser->writePref(
'pd_view', (
int)$_GET[
'view']);
90 @reset($this->allowed_views);
91 $view = (int)@current($this->allowed_views);
92 $ilUser->writePref(
'pd_view',
$view);
95 $ilCtrl->redirectByClass(
'ilpersonaldesktopgui',
'show');
107 $this->allowed_views = array();
110 if($ilSetting->get(
'disable_my_offers') == 1 &&
111 $ilSetting->get(
'disable_my_memberships') == 1)
114 $ilSetting->set(
'personal_items_default_view', self::VIEW_MY_OFFERS);
118 else if($ilSetting->get(
'disable_my_offers') == 0 &&
119 $ilSetting->get(
'disable_my_memberships') == 0)
124 else if($ilSetting->get(
'disable_my_offers') == 0 &&
125 $ilSetting->get(
'disable_my_memberships') == 1)
134 $this->view = $ilUser->getPref(
'pd_view');
135 if($this->view ===
false || !in_array((
int)$this->view, $this->allowed_views))
137 $ilUser->writePref(
'pd_view', (
int)$ilSetting->get(
'personal_items_default_view'));
138 $this->view = (int)$ilSetting->get(
'personal_items_default_view');
168 if($ilSetting->get(
'disable_my_offers') == 0 &&
169 $ilSetting->get(
'disable_my_memberships') == 0)
184 $this->
setData(array(
"dummy"));
186 include_once
"Services/Object/classes/class.ilObjectListGUI.php";
187 ilObjectListGUI::prepareJSLinks(
"",
188 $ilCtrl->getLinkTargetByClass(array(
"ilcommonactiondispatchergui",
"ilnotegui"),
"",
"",
true,
false),
189 $ilCtrl->getLinkTargetByClass(array(
"ilcommonactiondispatchergui",
"iltagginggui"),
"",
"",
true,
false));
193 case self::VIEW_MY_MEMBERSHIPS:
194 if ($ilSetting->get(
'disable_my_offers') == 0)
196 $tpl->setTitle($lng->txt(
"my_courses_groups"));
198 $this->
setTitle($this->lng->txt(
'pd_my_memberships'));
202 case self::VIEW_MY_OFFERS:
204 if(!in_array(self::VIEW_MY_MEMBERSHIPS, $this->allowed_views))
206 $this->
setTitle($this->lng->txt(
'selected_items'));
210 $this->
setTitle($this->lng->txt(
'pd_my_offers'));
221 $ilCtrl->clearParametersByClass(
"ilpersonaldesktopgui");
222 $ilCtrl->clearParameters($this);
233 $next_class = $ilCtrl->getNextClass();
234 $cmd = $ilCtrl->getCmd(
"getHTML");
238 case "ilcommonactiondispatchergui":
239 include_once(
"Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
241 $ilCtrl->forwardCommand($gui);
245 if(method_exists($this,
$cmd))
247 return $this->
$cmd();
252 return $this->
$cmd();
259 return $this->content;
264 $this->content = $a_content;
276 $this->tpl->setVariable(
"BLOCK_ROW", $this->
getContent());
294 $this->tpl->setVariable(
"FCOLSPAN", $this->
getColSpan());
295 if ($this->tpl->blockExists(
"block_footer"))
297 $this->tpl->setCurrentBlock(
"block_footer");
298 $this->tpl->parseCurrentBlock();
316 if ($ilUser->getPref(
"pd_order_items") ==
'location')
319 $ilCtrl->getLinkTarget($this,
320 "orderPDItemsByType"),
321 $ilCtrl->getLinkTarget($this,
322 "orderPDItemsByType",
"",
true),
332 if ($ilUser->getPref(
"pd_order_items") ==
'location')
339 $ilCtrl->getLinkTarget($this,
340 "orderPDItemsByLocation"),
341 $ilCtrl->getLinkTarget($this,
342 "orderPDItemsByLocation",
"",
true),
356 global $tree, $ilUser, $ilObjDataCache;
358 include_once
'Services/Membership/classes/class.ilParticipants.php';
361 if(is_array($types) && count($types))
363 foreach($types as $type)
382 $items = array_merge($crs_mbs, $grp_mbs);
385 $references = array();
386 foreach($items as $key => $obj_id)
389 if(is_array($item_references) && count($item_references))
391 foreach($item_references as
$ref_id)
393 $title = $ilObjDataCache->lookupTitle($obj_id);
394 $type = $ilObjDataCache->lookupType($obj_id);
396 $references[
$title.$ref_id] =
397 array(
'ref_id' => $ref_id,
401 'description' => $ilObjDataCache->lookupDescription($obj_id),
402 'parent_ref' => $tree->getParentId($ref_id));
407 return is_array($references) ? $references : array();
418 global $ilUser, $rbacsystem, $objDefinition,
$ilBench,
$ilSetting, $ilObjDataCache, $rbacreview;
422 $item_html = array();
423 if(count($items) > 0)
427 foreach($items as $item)
429 $ref_ids[] = $item[
'ref_id'];
432 $ilObjDataCache->preloadReferenceCache($ref_ids);
434 foreach($items as $item)
438 if ($cur_obj_type != $item[
"type"])
446 $item_list_gui->enableNotes(
true);
447 $item_list_gui->enableComments(
true);
448 $item_list_gui->enableTags(
true);
450 $item_list_gui->enableIcon(
true);
451 $item_list_gui->enableDelete(
false);
452 $item_list_gui->enableCut(
false);
453 $item_list_gui->enableCopy(
false);
454 $item_list_gui->enablePayment(
false);
455 $item_list_gui->enableLink(
false);
456 $item_list_gui->enableInfoScreen(
false);
457 $item_list_gui->enableSubscribe(
false);
461 $item_list_gui->enableDescription(
false);
462 $item_list_gui->enableProperties(
false);
463 $item_list_gui->enablePreconditions(
false);
467 $item_list_gui->enableCommands(
true,
true);
471 $ilBench->start(
"ilPersonalDesktopGUI",
"getListHTML");
473 if (is_object($item_list_gui))
475 $html = $item_list_gui->getListItemHTML($item[
"ref_id"],
476 $item[
"obj_id"], $item[
"title"], $item[
"description"]);
477 $ilBench->stop(
"ilPersonalDesktopGUI",
"getListHTML");
481 $item_html[] = array(
483 "item_ref_id" => $item[
"ref_id"],
484 "item_obj_id" => $item[
"obj_id"],
485 "parent_ref" => $item[
"parent_ref"],
486 "type" => $item[
"type"],
487 'item_icon_image_type' => $item_list_gui->getIconImageType()
495 if (count($item_html) > 0)
500 foreach($item_html as $item)
503 if ($cur_parent_ref != $item[
"parent_ref"])
505 if ($ilSetting->get(
"icon_position_in_lists") ==
"item_rows")
514 $cur_parent_ref = $item[
"parent_ref"];
518 $this->
addStandardRow(
$tpl, $item[
"html"], $item[
"item_ref_id"], $item[
"item_obj_id"],
519 $item[
'item_icon_image_type'],
520 "th_".$cur_parent_ref);
542 $objtype_groups = $objDefinition->getGroupedRepositoryObjectTypes(
543 array(
"cat",
"crs",
"grp",
"fold"));
546 foreach($objtype_groups as $grp => $grpdata)
550 "title" => $this->lng->txt(
"objs_".$grp),
551 "types" => $grpdata[
"objs"]);
554 foreach ($types as
$t)
564 foreach($items as $item)
566 $ref_ids[] = $item[
'ref_id'];
569 $ilObjDataCache->preloadReferenceCache($ref_ids);
570 $item_html = array();
574 $rel_header =
"th_".$grp;
577 if (count($items) > 0)
585 if (strcmp($a_type,
"tst") == 0) {
586 $items = $this->multiarray_sort($items,
"used_tries; title");
587 foreach ($items as $tst_item) {
588 if (!isset($tst_item[
"used_tries"])) {
591 elseif ($tst_item[
"used_tries"] == 0) {
597 foreach($items as $item)
600 if ($cur_obj_type != $item[
"type"])
602 $class = $objDefinition->getClassName($item[
"type"]);
603 $location = $objDefinition->getLocation($item[
"type"]);
604 $full_class =
"ilObj".$class.
"ListGUI";
605 include_once(
$location.
"/class.".$full_class.
".php");
606 $item_list_gui =
new $full_class();
608 $item_list_gui->enableNotes(
true);
609 $item_list_gui->enableComments(
true);
610 $item_list_gui->enableTags(
true);
612 $item_list_gui->enableIcon(
true);
613 $item_list_gui->enableDelete(
false);
614 $item_list_gui->enableCut(
false);
615 $item_list_gui->enableCopy(
false);
616 $item_list_gui->enablePayment(
false);
617 $item_list_gui->enableLink(
false);
618 $item_list_gui->enableInfoScreen(
false);
619 $item_list_gui->enableSubscribe(
false);
622 $item_list_gui->enableDescription(
false);
623 $item_list_gui->enableProperties(
false);
624 $item_list_gui->enablePreconditions(
false);
625 $item_list_gui->enableNoticeProperties(
false);
629 $item_list_gui->enableCommands(
true,
true);
633 $ilBench->start(
"ilPersonalDesktopGUI",
"getListHTML");
635 $html = $item_list_gui->getListItemHTML($item[
"ref_id"],
636 $item[
"obj_id"], $item[
"title"], $item[
"description"]);
637 $ilBench->stop(
"ilPersonalDesktopGUI",
"getListHTML");
641 $item_html[] = array(
643 "item_ref_id" => $item[
"ref_id"],
644 "item_obj_id" => $item[
"obj_id"],
645 'item_icon_image_type' => (method_exists($item_list_gui,
'getIconImageType')) ?
646 $item_list_gui->getIconImageType() :
654 if (count($item_html) > 0)
659 if ($ilSetting->get(
"icon_position_in_lists") ==
"item_rows")
671 foreach($item_html as $item)
674 $ilSetting->get(
"icon_position_in_lists") ==
"item_rows")
677 $this->
addStandardRow(
$tpl, $item[
"html"], $item[
"item_ref_id"], $item[
"item_obj_id"],
678 $item[
'item_icon_image_type'],
684 $this->
addStandardRow(
$tpl, $item[
"html"], $item[
"item_ref_id"], $item[
"item_obj_id"],
"", $rel_header);
707 switch($ilUser->getPref(
'pd_order_items'))
726 global $ilUser, $rbacsystem, $objDefinition,
$ilBench;
730 switch ($ilUser->getPref(
"pd_order_items"))
749 global $ilUser, $rbacsystem, $objDefinition,
$ilBench,
$ilSetting, $ilObjDataCache, $tree;
751 $items = $ilUser->getDesktopItems();
752 if (count($items) > 0)
756 foreach($items as $item)
758 $ref_ids[] = $item[
"ref_id"];
760 $tree->preloadDeleted($ref_ids);
761 $tree->preloadDepthParent($ref_ids);
762 $ilObjDataCache->preloadReferenceCache($ref_ids,
true);
767 $objtype_groups = $objDefinition->getGroupedRepositoryObjectTypes(
768 array(
"cat",
"crs",
"grp",
"fold"));
771 foreach($objtype_groups as $grp => $grpdata)
775 "title" => $this->lng->txt(
"objs_".$grp),
776 "types" => $grpdata[
"objs"]);
779 foreach ($types as
$t)
786 $items = $ilUser->getDesktopItems($type);
787 $item_html = array();
791 $rel_header =
"th_".$grp;
794 if (count($items) > 0)
802 if (strcmp($a_type,
"tst") == 0) {
803 $items = $this->multiarray_sort($items,
"used_tries; title");
804 foreach ($items as $tst_item) {
805 if (!isset($tst_item[
"used_tries"])) {
808 elseif ($tst_item[
"used_tries"] == 0) {
814 foreach($items as $item)
817 if ($cur_obj_type != $item[
"type"])
819 $class = $objDefinition->getClassName($item[
"type"]);
820 $location = $objDefinition->getLocation($item[
"type"]);
821 $full_class =
"ilObj".$class.
"ListGUI";
822 include_once(
$location.
"/class.".$full_class.
".php");
823 $item_list_gui =
new $full_class();
825 $item_list_gui->enableNotes(
true);
826 $item_list_gui->enableComments(
true);
827 $item_list_gui->enableTags(
true);
829 $item_list_gui->enableIcon(
true);
830 $item_list_gui->enableDelete(
false);
831 $item_list_gui->enableCut(
false);
832 $item_list_gui->enableCopy(
false);
833 $item_list_gui->enablePayment(
false);
834 $item_list_gui->enableLink(
false);
835 $item_list_gui->enableInfoScreen(
false);
836 $item_list_gui->setContainerObject($this);
839 $item_list_gui->enableDescription(
false);
840 $item_list_gui->enableProperties(
false);
841 $item_list_gui->enablePreconditions(
false);
842 $item_list_gui->enableNoticeProperties(
false);
846 $item_list_gui->enableCommands(
true,
true);
850 $ilBench->start(
"ilPersonalDesktopGUI",
"getListHTML");
852 $html = $item_list_gui->getListItemHTML($item[
"ref_id"],
853 $item[
"obj_id"], $item[
"title"], $item[
"description"]);
854 $ilBench->stop(
"ilPersonalDesktopGUI",
"getListHTML");
858 $item_html[] = array(
860 "item_ref_id" => $item[
"ref_id"],
861 "item_obj_id" => $item[
"obj_id"],
862 'item_icon_image_type' => (method_exists($item_list_gui,
'getIconImageType')) ?
863 $item_list_gui->getIconImageType() :
871 if (count($item_html) > 0)
876 if ($ilSetting->get(
"icon_position_in_lists") ==
"item_rows")
888 foreach($item_html as $item)
891 $ilSetting->get(
"icon_position_in_lists") ==
"item_rows")
894 $this->
addStandardRow(
$tpl, $item[
"html"], $item[
"item_ref_id"], $item[
"item_obj_id"],
895 $item[
'item_icon_image_type'],
901 $this->
addStandardRow(
$tpl, $item[
"html"], $item[
"item_ref_id"], $item[
"item_obj_id"],
"", $rel_header);
917 global $ilUser, $rbacsystem, $objDefinition,
$ilBench,
$ilSetting, $ilObjDataCache, $tree;
921 $items = $ilUser->getDesktopItems();
922 $item_html = array();
925 if (count($items) > 0)
929 foreach($items as $item)
931 $ref_ids[] = $item[
"ref_id"];
934 $tree->preloadDeleted($ref_ids);
935 $tree->preloadDepthParent($ref_ids);
936 $ilObjDataCache->preloadReferenceCache($ref_ids);
938 foreach($items as $item)
942 if ($cur_obj_type != $item[
"type"])
950 $item_list_gui->enableNotes(
true);
951 $item_list_gui->enableComments(
true);
952 $item_list_gui->enableTags(
true);
954 $item_list_gui->enableIcon(
true);
955 $item_list_gui->enableDelete(
false);
956 $item_list_gui->enableCut(
false);
957 $item_list_gui->enableCopy(
false);
958 $item_list_gui->enablePayment(
false);
959 $item_list_gui->enableLink(
false);
960 $item_list_gui->enableInfoScreen(
false);
964 $item_list_gui->enableDescription(
false);
965 $item_list_gui->enableProperties(
false);
966 $item_list_gui->enablePreconditions(
false);
970 $item_list_gui->enableCommands(
true,
true);
974 $ilBench->start(
"ilPersonalDesktopGUI",
"getListHTML");
975 $item_list_gui->setContainerObject($this);
976 $html = $item_list_gui->getListItemHTML($item[
"ref_id"],
977 $item[
"obj_id"], $item[
"title"], $item[
"description"]);
978 $ilBench->stop(
"ilPersonalDesktopGUI",
"getListHTML");
982 $item_html[] = array(
984 "item_ref_id" => $item[
"ref_id"],
985 "item_obj_id" => $item[
"obj_id"],
986 "parent_ref" => $item[
"parent_ref"],
987 "type" => $item[
"type"],
988 'item_icon_image_type' => $item_list_gui->getIconImageType()
995 if (count($item_html) > 0)
1000 foreach($item_html as $item)
1003 if ($cur_parent_ref != $item[
"parent_ref"])
1005 if ($ilSetting->get(
"icon_position_in_lists") ==
"item_rows")
1014 $cur_parent_ref = $item[
"parent_ref"];
1018 $this->
addStandardRow(
$tpl, $item[
"html"], $item[
"item_ref_id"], $item[
"item_obj_id"],
1019 $item[
'item_icon_image_type'],
1020 "th_".$cur_parent_ref);
1032 $this->cur_row_type =
"";
1043 $tpl =
new ilTemplate (
"tpl.pd_list_block.html",
true,
true,
"Services/PersonalDesktop");
1044 $this->cur_row_type =
"";
1053 global $objDefinition;
1055 if (!isset($this->item_list_guis[$a_type]))
1057 $class = $objDefinition->getClassName($a_type);
1064 $location = $objDefinition->getLocation($a_type);
1070 $full_class =
"ilObj".$class.
"ListGUI";
1072 include_once(
$location.
"/class.".$full_class.
".php");
1073 $item_list_gui =
new $full_class();
1074 $this->item_list_guis[$a_type] =& $item_list_gui;
1078 $item_list_gui =& $this->item_list_guis[$a_type];
1080 return $item_list_gui;
1092 global $objDefinition;
1095 if (!$objDefinition->isPlugin($a_type))
1097 $title = $this->lng->txt(
"objs_".$a_type);
1101 include_once(
"./Services/Component/classes/class.ilPlugin.php");
1106 $header_id =
"th_".$a_type;
1110 $a_tpl->setCurrentBlock(
"container_header_row_image");
1111 $a_tpl->setVariable(
"HEADER_IMG", $icon);
1112 $a_tpl->setVariable(
"HEADER_ALT",
$title);
1116 $a_tpl->setCurrentBlock(
"container_header_row");
1119 $a_tpl->setVariable(
"BLOCK_HEADER_CONTENT",
$title);
1120 $a_tpl->setVariable(
"BLOCK_HEADER_ID", $header_id);
1121 $a_tpl->parseCurrentBlock();
1122 $a_tpl->touchBlock(
"container_row");
1138 if (!in_array($type, array(
"lm",
"dbk",
"sahs",
"htlm")))
1148 if ($ilSetting->get(
"custom_icons") &&
1149 in_array($type, array(
"cat",
"grp",
"crs",
"root")))
1151 require_once(
"./Services/Container/classes/class.ilContainer.php");
1158 if ($tree->getRootId() != $par_id)
1164 $nd = $tree->getNodeData(ROOT_FOLDER_ID);
1168 $title = $this->lng->txt(
"repository");
1197 $a_tpl->setCurrentBlock(
"container_header_row");
1200 $a_tpl->setVariable(
"BLOCK_HEADER_CONTENT",
$title);
1203 $a_tpl->parseCurrentBlock();
1204 $a_tpl->touchBlock(
"container_row");
1215 $a_image_type =
"", $a_related_header =
"")
1219 $this->cur_row_type = ($this->cur_row_type ==
"row_type_1")
1222 $a_tpl->touchBlock($this->cur_row_type);
1224 if ($a_image_type !=
"")
1226 if (!is_array($a_image_type) && !in_array($a_image_type, array(
"lm",
"dbk",
"htlm",
"sahs")))
1229 $title = $this->lng->txt(
"obj_".$a_image_type);
1234 $title = $this->lng->txt(
"learning_resource");
1238 if ($ilSetting->get(
"custom_icons") &&
1239 in_array($a_image_type, array(
"cat",
"grp",
"crs")))
1241 require_once(
"./Services/Container/classes/class.ilContainer.php");
1248 $a_tpl->setCurrentBlock(
"block_row_image");
1249 $a_tpl->setVariable(
"ROW_IMG", $icon);
1250 $a_tpl->setVariable(
"ROW_ALT",
$title);
1251 $a_tpl->parseCurrentBlock();
1255 $a_tpl->setVariable(
"ROW_NBSP",
" ");
1257 $a_tpl->setCurrentBlock(
"container_standard_row");
1258 $a_tpl->setVariable(
"BLOCK_ROW_CONTENT", $a_html);
1259 $rel_headers = ($a_related_header !=
"")
1260 ?
"th_selected_items ".$a_related_header
1261 :
"th_selected_items";
1262 $a_tpl->setVariable(
"BLOCK_ROW_HEADERS", $rel_headers);
1263 $a_tpl->parseCurrentBlock();
1264 $a_tpl->touchBlock(
"container_row");
1274 switch((
int)$this->view)
1276 case self::VIEW_MY_MEMBERSHIPS:
1277 $tpl =
new ilTemplate(
'tpl.pd_my_memberships_intro.html',
true,
true,
'Services/PersonalDesktop');
1279 $tpl->setVariable(
'TXT_WELCOME', $lng->txt(
'pd_my_memberships_intro'));
1280 $tpl->setVariable(
'TXT_INTRO_1', $lng->txt(
'pd_my_memberships_intro2'));
1283 case self::VIEW_MY_OFFERS:
1286 $nd = $tree->getNodeData(ROOT_FOLDER_ID);
1290 $title = $lng->txt(
"repository");
1293 $tpl =
new ilTemplate(
"tpl.pd_intro.html",
true,
true,
"Services/PersonalDesktop");
1295 $tpl->setVariable(
"TXT_WELCOME", $lng->txt(
"pdesk_intro"));
1296 $tpl->setVariable(
"TXT_INTRO_1", sprintf($lng->txt(
"pdesk_intro2"), $lng->txt(
"to_desktop")));
1297 $tpl->setVariable(
"TXT_INTRO_2", sprintf($lng->txt(
"pdesk_intro3"),
1298 '<a href="repository.php?cmd=frameset&getlast=true">'.$title.
'</a>'));
1299 $tpl->setVariable(
"TXT_INTRO_3", $lng->txt(
"pdesk_intro4"));
1313 $ilUser->writePref(
"pd_order_items",
"location");
1315 if ($ilCtrl->isAsynch())
1322 $ilCtrl->redirectByClass(
"ilpersonaldesktopgui",
"show");
1333 $ilUser->writePref(
"pd_order_items",
"type");
1335 if ($ilCtrl->isAsynch())
1342 $ilCtrl->redirectByClass(
"ilpersonaldesktopgui",
"show");