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:
195 if ($ilSetting->get(
'disable_my_offers') == 0)
197 $tpl->setTitle($lng->txt(
"my_courses_groups"));
199 $this->
setTitle($this->lng->txt(
'pd_my_memberships'));
203 case self::VIEW_MY_OFFERS:
206 if(!in_array(self::VIEW_MY_MEMBERSHIPS, $this->allowed_views))
208 $this->
setTitle($this->lng->txt(
'selected_items'));
212 $this->
setTitle($this->lng->txt(
'pd_my_offers'));
223 $ilCtrl->clearParametersByClass(
"ilpersonaldesktopgui");
224 $ilCtrl->clearParameters($this);
235 $next_class = $ilCtrl->getNextClass();
236 $cmd = $ilCtrl->getCmd(
"getHTML");
240 case "ilcommonactiondispatchergui":
241 include_once(
"Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
243 $ilCtrl->forwardCommand($gui);
247 if(method_exists($this,
$cmd))
249 return $this->
$cmd();
254 return $this->
$cmd();
261 return $this->content;
266 $this->content = $a_content;
278 $this->tpl->setVariable(
"BLOCK_ROW", $this->
getContent());
296 $this->tpl->setVariable(
"FCOLSPAN", $this->
getColSpan());
297 if ($this->tpl->blockExists(
"block_footer"))
299 $this->tpl->setCurrentBlock(
"block_footer");
300 $this->tpl->parseCurrentBlock();
321 $ilCtrl->getLinkTarget($this,
322 "orderPDItemsByType"),
323 $ilCtrl->getLinkTarget($this,
324 "orderPDItemsByType",
"",
true),
326 false,
false, ($ilUser->getPref(
"pd_order_items") !=
'location')
342 $ilCtrl->getLinkTarget($this,
343 "orderPDItemsByLocation"),
344 $ilCtrl->getLinkTarget($this,
345 "orderPDItemsByLocation",
"",
true),
347 false,
false, ($ilUser->getPref(
"pd_order_items") ==
'location')
360 global $tree,
$ilUser, $ilObjDataCache;
362 include_once
'Services/Membership/classes/class.ilParticipants.php';
365 if(is_array($types) && count($types))
367 foreach($types as $type)
386 $items = array_merge($crs_mbs, $grp_mbs);
389 $references = array();
390 foreach($items as $key => $obj_id)
393 foreach($item_references as
$ref_id)
395 if($tree->isInTree($ref_id))
397 $title = $ilObjDataCache->lookupTitle($obj_id);
398 $type = $ilObjDataCache->lookupType($obj_id);
400 $parent_ref_id = $tree->getParentId($ref_id);
401 $par_left = $tree->getLeftValue($parent_ref_id);
402 $par_left = sprintf(
"%010d", $par_left);
409 'description' => $ilObjDataCache->lookupDescription($obj_id),
410 'parent_ref' => $parent_ref_id
416 return is_array($references) ? $references : array();
431 $item_html = array();
432 if(count($items) > 0)
436 foreach($items as $item)
438 $ref_ids[] = $item[
'ref_id'];
441 $ilObjDataCache->preloadReferenceCache($ref_ids);
443 include_once
"Services/Object/classes/class.ilObjectActivation.php";
446 foreach($items as $item)
450 if ($cur_obj_type != $item[
"type"])
461 $item_list_gui->enableNotes(
false);
462 $item_list_gui->enableComments(
false);
463 $item_list_gui->enableTags(
false);
465 $item_list_gui->enableIcon(
true);
466 $item_list_gui->enableDelete(
false);
467 $item_list_gui->enableCut(
false);
468 $item_list_gui->enableCopy(
false);
469 $item_list_gui->enablePayment(
false);
470 $item_list_gui->enableLink(
false);
471 $item_list_gui->enableInfoScreen(
true);
472 $item_list_gui->enableSubscribe(
false);
476 $item_list_gui->enableDescription(
false);
477 $item_list_gui->enableProperties(
false);
478 $item_list_gui->enablePreconditions(
false);
482 $item_list_gui->enableCommands(
true,
true);
486 $ilBench->start(
"ilPersonalDesktopGUI",
"getListHTML");
488 if (is_object($item_list_gui))
490 $html = $item_list_gui->getListItemHTML($item[
"ref_id"],
491 $item[
"obj_id"], $item[
"title"], $item[
"description"]);
492 $ilBench->stop(
"ilPersonalDesktopGUI",
"getListHTML");
496 $item_html[] = array(
498 "item_ref_id" => $item[
"ref_id"],
499 "item_obj_id" => $item[
"obj_id"],
500 "parent_ref" => $item[
"parent_ref"],
501 "type" => $item[
"type"],
502 'item_icon_image_type' => $item_list_gui->getIconImageType()
510 if (count($item_html) > 0)
515 foreach($item_html as $item)
518 if ($cur_parent_ref != $item[
"parent_ref"])
520 if ($ilSetting->get(
"icon_position_in_lists") ==
"item_rows")
529 $cur_parent_ref = $item[
"parent_ref"];
533 $this->
addStandardRow(
$tpl, $item[
"html"], $item[
"item_ref_id"], $item[
"item_obj_id"],
534 $item[
'item_icon_image_type'],
535 "th_".$cur_parent_ref);
557 $objtype_groups = $objDefinition->getGroupedRepositoryObjectTypes(
558 array(
"cat",
"crs",
"grp",
"fold"));
561 foreach($objtype_groups as $grp => $grpdata)
565 "title" => $this->lng->txt(
"objs_".$grp),
566 "types" => $grpdata[
"objs"]);
569 foreach ($types as
$t)
579 foreach($items as $item)
581 $ref_ids[] = $item[
'ref_id'];
584 $ilObjDataCache->preloadReferenceCache($ref_ids);
586 include_once
"Services/Object/classes/class.ilObjectActivation.php";
589 $item_html = array();
593 $rel_header =
"th_".$grp;
596 if (count($items) > 0)
604 if (strcmp($a_type,
"tst") == 0) {
605 $items = $this->multiarray_sort($items,
"used_tries; title");
606 foreach ($items as $tst_item) {
607 if (!isset($tst_item[
"used_tries"])) {
610 elseif ($tst_item[
"used_tries"] == 0) {
616 foreach($items as $item)
619 if ($cur_obj_type != $item[
"type"])
621 $class = $objDefinition->getClassName($item[
"type"]);
622 $location = $objDefinition->getLocation($item[
"type"]);
623 $full_class =
"ilObj".$class.
"ListGUI";
624 include_once(
$location.
"/class.".$full_class.
".php");
625 $item_list_gui =
new $full_class();
630 $item_list_gui->enableNotes(
false);
631 $item_list_gui->enableComments(
false);
632 $item_list_gui->enableTags(
false);
634 $item_list_gui->enableIcon(
true);
635 $item_list_gui->enableDelete(
false);
636 $item_list_gui->enableCut(
false);
637 $item_list_gui->enableCopy(
false);
638 $item_list_gui->enablePayment(
false);
639 $item_list_gui->enableLink(
false);
640 $item_list_gui->enableInfoScreen(
true);
641 $item_list_gui->enableSubscribe(
false);
644 $item_list_gui->enableDescription(
false);
645 $item_list_gui->enableProperties(
false);
646 $item_list_gui->enablePreconditions(
false);
647 $item_list_gui->enableNoticeProperties(
false);
651 $item_list_gui->enableCommands(
true,
true);
655 $ilBench->start(
"ilPersonalDesktopGUI",
"getListHTML");
657 $html = $item_list_gui->getListItemHTML($item[
"ref_id"],
658 $item[
"obj_id"], $item[
"title"], $item[
"description"]);
659 $ilBench->stop(
"ilPersonalDesktopGUI",
"getListHTML");
663 $item_html[] = array(
665 "item_ref_id" => $item[
"ref_id"],
666 "item_obj_id" => $item[
"obj_id"],
667 'item_icon_image_type' => (method_exists($item_list_gui,
'getIconImageType')) ?
668 $item_list_gui->getIconImageType() :
676 if (count($item_html) > 0)
681 if ($ilSetting->get(
"icon_position_in_lists") ==
"item_rows")
693 foreach($item_html as $item)
696 $ilSetting->get(
"icon_position_in_lists") ==
"item_rows")
699 $this->
addStandardRow(
$tpl, $item[
"html"], $item[
"item_ref_id"], $item[
"item_obj_id"],
700 $item[
'item_icon_image_type'],
706 $this->
addStandardRow(
$tpl, $item[
"html"], $item[
"item_ref_id"], $item[
"item_obj_id"],
"", $rel_header);
729 switch($ilUser->getPref(
'pd_order_items'))
752 switch ($ilUser->getPref(
"pd_order_items"))
773 $items = $ilUser->getDesktopItems();
774 if (count($items) > 0)
778 foreach($items as $item)
780 $ref_ids[] = $item[
"ref_id"];
782 $tree->preloadDeleted($ref_ids);
783 $tree->preloadDepthParent($ref_ids);
784 $ilObjDataCache->preloadReferenceCache($ref_ids,
true);
786 include_once
"Services/Object/classes/class.ilObjectActivation.php";
792 $objtype_groups = $objDefinition->getGroupedRepositoryObjectTypes(
793 array(
"cat",
"crs",
"grp",
"fold"));
796 foreach($objtype_groups as $grp => $grpdata)
800 "title" => $this->lng->txt(
"objs_".$grp),
801 "types" => $grpdata[
"objs"]);
804 foreach ($types as
$t)
811 $items = $ilUser->getDesktopItems($type);
812 $item_html = array();
816 $rel_header =
"th_".$grp;
819 if (count($items) > 0)
827 if (strcmp($a_type,
"tst") == 0) {
828 $items = $this->multiarray_sort($items,
"used_tries; title");
829 foreach ($items as $tst_item) {
830 if (!isset($tst_item[
"used_tries"])) {
833 elseif ($tst_item[
"used_tries"] == 0) {
839 foreach($items as $item)
842 if ($cur_obj_type != $item[
"type"])
844 $class = $objDefinition->getClassName($item[
"type"]);
845 $location = $objDefinition->getLocation($item[
"type"]);
846 $full_class =
"ilObj".$class.
"ListGUI";
847 include_once(
$location.
"/class.".$full_class.
".php");
848 $item_list_gui =
new $full_class();
853 $item_list_gui->enableNotes(
false);
854 $item_list_gui->enableComments(
false);
855 $item_list_gui->enableTags(
false);
857 $item_list_gui->enableIcon(
true);
858 $item_list_gui->enableDelete(
false);
859 $item_list_gui->enableCut(
false);
860 $item_list_gui->enableCopy(
false);
861 $item_list_gui->enablePayment(
false);
862 $item_list_gui->enableLink(
false);
863 $item_list_gui->enableInfoScreen(
true);
864 $item_list_gui->setContainerObject($this);
867 $item_list_gui->enableDescription(
false);
868 $item_list_gui->enableProperties(
false);
869 $item_list_gui->enablePreconditions(
false);
870 $item_list_gui->enableNoticeProperties(
false);
874 $item_list_gui->enableCommands(
true,
true);
878 $ilBench->start(
"ilPersonalDesktopGUI",
"getListHTML");
880 $html = $item_list_gui->getListItemHTML($item[
"ref_id"],
881 $item[
"obj_id"], $item[
"title"], $item[
"description"]);
882 $ilBench->stop(
"ilPersonalDesktopGUI",
"getListHTML");
886 $item_html[] = array(
888 "item_ref_id" => $item[
"ref_id"],
889 "item_obj_id" => $item[
"obj_id"],
890 'item_icon_image_type' => (method_exists($item_list_gui,
'getIconImageType')) ?
891 $item_list_gui->getIconImageType() :
899 if (count($item_html) > 0)
904 if ($ilSetting->get(
"icon_position_in_lists") ==
"item_rows")
916 foreach($item_html as $item)
919 $ilSetting->get(
"icon_position_in_lists") ==
"item_rows")
922 $this->
addStandardRow(
$tpl, $item[
"html"], $item[
"item_ref_id"], $item[
"item_obj_id"],
923 $item[
'item_icon_image_type'],
929 $this->
addStandardRow(
$tpl, $item[
"html"], $item[
"item_ref_id"], $item[
"item_obj_id"],
"", $rel_header);
949 $items = $ilUser->getDesktopItems();
950 $item_html = array();
953 if (count($items) > 0)
957 foreach($items as $item)
959 $ref_ids[] = $item[
"ref_id"];
962 $tree->preloadDeleted($ref_ids);
963 $tree->preloadDepthParent($ref_ids);
964 $ilObjDataCache->preloadReferenceCache($ref_ids);
966 include_once
"Services/Object/classes/class.ilObjectActivation.php";
969 foreach($items as $item)
973 if ($cur_obj_type != $item[
"type"])
984 $item_list_gui->enableNotes(
false);
985 $item_list_gui->enableComments(
false);
986 $item_list_gui->enableTags(
false);
988 $item_list_gui->enableIcon(
true);
989 $item_list_gui->enableDelete(
false);
990 $item_list_gui->enableCut(
false);
991 $item_list_gui->enableCopy(
false);
992 $item_list_gui->enablePayment(
false);
993 $item_list_gui->enableLink(
false);
994 $item_list_gui->enableInfoScreen(
true);
998 $item_list_gui->enableDescription(
false);
999 $item_list_gui->enableProperties(
false);
1000 $item_list_gui->enablePreconditions(
false);
1004 $item_list_gui->enableCommands(
true,
true);
1008 $ilBench->start(
"ilPersonalDesktopGUI",
"getListHTML");
1009 $item_list_gui->setContainerObject($this);
1010 $html = $item_list_gui->getListItemHTML($item[
"ref_id"],
1011 $item[
"obj_id"], $item[
"title"], $item[
"description"]);
1012 $ilBench->stop(
"ilPersonalDesktopGUI",
"getListHTML");
1016 $item_html[] = array(
1018 "item_ref_id" => $item[
"ref_id"],
1019 "item_obj_id" => $item[
"obj_id"],
1020 "parent_ref" => $item[
"parent_ref"],
1021 "type" => $item[
"type"],
1022 'item_icon_image_type' => $item_list_gui->getIconImageType()
1029 if (count($item_html) > 0)
1031 $cur_parent_ref = 0;
1034 foreach($item_html as $item)
1037 if ($cur_parent_ref != $item[
"parent_ref"])
1039 if ($ilSetting->get(
"icon_position_in_lists") ==
"item_rows")
1048 $cur_parent_ref = $item[
"parent_ref"];
1052 $this->
addStandardRow(
$tpl, $item[
"html"], $item[
"item_ref_id"], $item[
"item_obj_id"],
1053 $item[
'item_icon_image_type'],
1054 "th_".$cur_parent_ref);
1066 $this->cur_row_type =
"";
1077 $tpl =
new ilTemplate(
"tpl.pd_list_block.html",
true,
true,
"Services/PersonalDesktop");
1078 $this->cur_row_type =
"";
1087 global $objDefinition;
1089 if (!isset($this->item_list_guis[$a_type]))
1091 $class = $objDefinition->getClassName($a_type);
1098 $location = $objDefinition->getLocation($a_type);
1104 $full_class =
"ilObj".$class.
"ListGUI";
1106 include_once(
$location.
"/class.".$full_class.
".php");
1107 $item_list_gui =
new $full_class();
1108 $this->item_list_guis[$a_type] =& $item_list_gui;
1112 $item_list_gui =& $this->item_list_guis[$a_type];
1114 return $item_list_gui;
1126 global $objDefinition;
1129 if (!$objDefinition->isPlugin($a_type))
1131 $title = $this->lng->txt(
"objs_".$a_type);
1135 include_once(
"./Services/Component/classes/class.ilPlugin.php");
1140 $header_id =
"th_".$a_type;
1144 $a_tpl->setCurrentBlock(
"container_header_row_image");
1145 $a_tpl->setVariable(
"HEADER_IMG", $icon);
1146 $a_tpl->setVariable(
"HEADER_ALT",
$title);
1150 $a_tpl->setCurrentBlock(
"container_header_row");
1153 $a_tpl->setVariable(
"BLOCK_HEADER_CONTENT",
$title);
1154 $a_tpl->setVariable(
"BLOCK_HEADER_ID", $header_id);
1155 $a_tpl->parseCurrentBlock();
1156 $a_tpl->touchBlock(
"container_row");
1172 if (!in_array($type, array(
"lm",
"dbk",
"sahs",
"htlm")))
1182 if ($ilSetting->get(
"custom_icons") &&
1183 in_array($type, array(
"cat",
"grp",
"crs",
"root")))
1185 require_once(
"./Services/Container/classes/class.ilContainer.php");
1192 if ($tree->getRootId() != $par_id)
1198 $nd = $tree->getNodeData(ROOT_FOLDER_ID);
1202 $title = $this->lng->txt(
"repository");
1231 $a_tpl->setCurrentBlock(
"container_header_row");
1234 $a_tpl->setVariable(
"BLOCK_HEADER_CONTENT",
$title);
1237 $a_tpl->parseCurrentBlock();
1238 $a_tpl->touchBlock(
"container_row");
1249 $a_image_type =
"", $a_related_header =
"")
1253 $this->cur_row_type = ($this->cur_row_type ==
"row_type_1")
1256 $a_tpl->touchBlock($this->cur_row_type);
1258 if ($a_image_type !=
"")
1260 if (!is_array($a_image_type) && !in_array($a_image_type, array(
"lm",
"dbk",
"htlm",
"sahs")))
1263 $title = $this->lng->txt(
"obj_".$a_image_type);
1268 $title = $this->lng->txt(
"learning_resource");
1272 if ($ilSetting->get(
"custom_icons") &&
1273 in_array($a_image_type, array(
"cat",
"grp",
"crs")))
1275 require_once(
"./Services/Container/classes/class.ilContainer.php");
1282 $a_tpl->setCurrentBlock(
"block_row_image");
1283 $a_tpl->setVariable(
"ROW_IMG", $icon);
1284 $a_tpl->setVariable(
"ROW_ALT",
$title);
1285 $a_tpl->parseCurrentBlock();
1289 $a_tpl->setVariable(
"ROW_NBSP",
" ");
1291 $a_tpl->setCurrentBlock(
"container_standard_row");
1292 $a_tpl->setVariable(
"BLOCK_ROW_CONTENT", $a_html);
1293 $rel_headers = ($a_related_header !=
"")
1294 ?
"th_selected_items ".$a_related_header
1295 :
"th_selected_items";
1296 $a_tpl->setVariable(
"BLOCK_ROW_HEADERS", $rel_headers);
1297 $a_tpl->parseCurrentBlock();
1298 $a_tpl->touchBlock(
"container_row");
1308 switch((
int)$this->view)
1310 case self::VIEW_MY_MEMBERSHIPS:
1311 $tpl =
new ilTemplate(
'tpl.pd_my_memberships_intro.html',
true,
true,
'Services/PersonalDesktop');
1313 $tpl->setVariable(
'TXT_WELCOME', $lng->txt(
'pd_my_memberships_intro'));
1314 $tpl->setVariable(
'TXT_INTRO_1', $lng->txt(
'pd_my_memberships_intro2'));
1317 case self::VIEW_MY_OFFERS:
1320 $nd = $tree->getNodeData(ROOT_FOLDER_ID);
1324 $title = $lng->txt(
"repository");
1327 $tpl =
new ilTemplate(
"tpl.pd_intro.html",
true,
true,
"Services/PersonalDesktop");
1329 $tpl->setVariable(
"TXT_WELCOME", $lng->txt(
"pdesk_intro"));
1330 $tpl->setVariable(
"TXT_INTRO_1", sprintf($lng->txt(
"pdesk_intro2"), $lng->txt(
"to_desktop")));
1331 include_once(
"./Services/Link/classes/class.ilLink.php");
1332 $tpl->setVariable(
"TXT_INTRO_2", sprintf($lng->txt(
"pdesk_intro3"),
1333 '<a href="'.ilLink::_getStaticLink(1,
'root',
true).
'">'.
$title.
'</a>'));
1334 $tpl->setVariable(
"TXT_INTRO_3", $lng->txt(
"pdesk_intro4"));
1348 $ilUser->writePref(
"pd_order_items",
"location");
1350 if ($ilCtrl->isAsynch())
1357 $ilCtrl->redirectByClass(
"ilpersonaldesktopgui",
"show");
1368 $ilUser->writePref(
"pd_order_items",
"type");
1370 if ($ilCtrl->isAsynch())
1377 $ilCtrl->redirectByClass(
"ilpersonaldesktopgui",
"show");