24 include_once(
"Services/Block/classes/class.ilBlockGUI.php");
25 include_once
'./Services/PersonalDesktop/interfaces/interface.ilDesktopItemHandling.php';
54 $lng->loadLanguageModule(
'pd');
63 $this->allow_moving =
false;
75 include_once
'./Services/PersonalDesktop/classes/class.ilDesktopItemGUI.php';
77 $ilCtrl->redirectByClass(
'ilpersonaldesktopgui',
'show');
87 include_once
'./Services/PersonalDesktop/classes/class.ilDesktopItemGUI.php';
89 $ilCtrl->redirectByClass(
'ilpersonaldesktopgui',
'show');
102 if(in_array((
int)
$_GET[
'view'], $this->allowed_views))
104 $ilUser->writePref(
'pd_view', (
int)$_GET[
'view']);
108 @reset($this->allowed_views);
109 $view = (int)@current($this->allowed_views);
110 $ilUser->writePref(
'pd_view',
$view);
113 $ilCtrl->redirectByClass(
'ilpersonaldesktopgui',
'show');
125 $this->allowed_views = array();
128 if($ilSetting->get(
'disable_my_offers') == 1 &&
129 $ilSetting->get(
'disable_my_memberships') == 1)
132 $ilSetting->set(
'personal_items_default_view', self::VIEW_MY_OFFERS);
136 else if($ilSetting->get(
'disable_my_offers') == 0 &&
137 $ilSetting->get(
'disable_my_memberships') == 0)
142 else if($ilSetting->get(
'disable_my_offers') == 0 &&
143 $ilSetting->get(
'disable_my_memberships') == 1)
152 $this->view = $ilUser->getPref(
'pd_view');
153 if($this->view ===
false || !in_array((
int)$this->view, $this->allowed_views))
155 $ilUser->writePref(
'pd_view', (
int)$ilSetting->get(
'personal_items_default_view'));
156 $this->view = (int)$ilSetting->get(
'personal_items_default_view');
186 if($ilSetting->get(
'disable_my_offers') == 0 &&
187 $ilSetting->get(
'disable_my_memberships') == 0)
189 $ilCtrl->setParameter($this,
'block_type', $this->
getBlockType());
190 $ilCtrl->setParameter($this,
'view', self::VIEW_MY_OFFERS);
191 $this->
addHeaderLink($ilCtrl->getLinkTarget($this,
'changeView'), $this->lng->txt(
'pd_my_offers'),
192 ($this->view == self::VIEW_MY_OFFERS ?
false :
true)
194 $ilCtrl->setParameter($this,
'view', self::VIEW_MY_MEMBERSHIPS);
195 $this->
addHeaderLink($ilCtrl->getLinkTarget($this,
'changeView'), $this->lng->txt(
'pd_my_memberships'),
196 ($this->view == self::VIEW_MY_MEMBERSHIPS ?
false :
true)
198 $ilCtrl->clearParameters($this);
202 $this->
setData(array(
"dummy"));
204 switch((
int)$this->view)
206 case self::VIEW_MY_MEMBERSHIPS:
207 $this->
setTitle($this->lng->txt(
'pd_my_memberships'));
211 case self::VIEW_MY_OFFERS:
213 if(!in_array(self::VIEW_MY_MEMBERSHIPS, $this->allowed_views))
215 $this->
setTitle($this->lng->txt(
'selected_items'));
219 $this->
setTitle($this->lng->txt(
'pd_my_offers'));
230 $ilCtrl->clearParametersByClass(
"ilpersonaldesktopgui");
231 $ilCtrl->clearParameters($this);
242 $next_class = $ilCtrl->getNextClass();
243 $cmd = $ilCtrl->getCmd(
"getHTML");
245 if(method_exists($this,
$cmd))
247 return $this->
$cmd();
252 return $this->
$cmd();
258 return $this->content;
263 $this->content = $a_content;
275 $this->tpl->setVariable(
"BLOCK_ROW", $this->
getContent());
293 $this->tpl->setVariable(
"FCOLSPAN", $this->
getColSpan());
294 if ($this->tpl->blockExists(
"block_footer"))
296 $this->tpl->setCurrentBlock(
"block_footer");
297 $this->tpl->parseCurrentBlock();
315 if ($ilUser->getPref(
"pd_order_items") ==
'location')
318 $ilCtrl->getLinkTarget($this,
319 "orderPDItemsByType"),
320 $ilCtrl->getLinkTarget($this,
321 "orderPDItemsByType",
"",
true),
331 if ($ilUser->getPref(
"pd_order_items") ==
'location')
338 $ilCtrl->getLinkTarget($this,
339 "orderPDItemsByLocation"),
340 $ilCtrl->getLinkTarget($this,
341 "orderPDItemsByLocation",
"",
true),
355 global $tree, $ilUser, $ilObjDataCache;
357 include_once
'Services/Membership/classes/class.ilParticipants.php';
360 if(is_array($types) && count($types))
362 foreach($types as
$type)
381 $items = array_merge($crs_mbs, $grp_mbs);
384 $references = array();
385 foreach($items as $key => $obj_id)
388 if(is_array($item_references) && count($item_references))
390 foreach($item_references as
$ref_id)
392 $title = $ilObjDataCache->lookupTitle($obj_id);
393 $type = $ilObjDataCache->lookupType($obj_id);
395 $references[
$title.$ref_id] =
396 array(
'ref_id' => $ref_id,
400 'description' => $ilObjDataCache->lookupDescription($obj_id),
401 'parent_ref' => $tree->getParentId($ref_id));
406 return is_array($references) ? $references : array();
417 global $ilUser, $rbacsystem, $objDefinition,
$ilBench,
$ilSetting, $ilObjDataCache, $rbacreview;
421 $item_html = array();
422 if(count($items) > 0)
426 foreach($items as $item)
428 $ref_ids[] = $item[
'ref_id'];
431 $ilObjDataCache->preloadReferenceCache($ref_ids);
433 foreach($items as $item)
437 if ($cur_obj_type != $item[
"type"])
441 $item_list_gui->enableIcon(
true);
442 $item_list_gui->enableDelete(
false);
443 $item_list_gui->enableCut(
false);
444 $item_list_gui->enableCopy(
false);
445 $item_list_gui->enablePayment(
false);
446 $item_list_gui->enableLink(
false);
447 $item_list_gui->enableInfoScreen(
false);
448 $item_list_gui->enableSubscribe(
false);
452 $item_list_gui->enableDescription(
false);
453 $item_list_gui->enableProperties(
false);
454 $item_list_gui->enablePreconditions(
false);
458 $item_list_gui->enableCommands(
true,
true);
462 $ilBench->start(
"ilPersonalDesktopGUI",
"getListHTML");
464 if (is_object($item_list_gui))
466 $html = $item_list_gui->getListItemHTML($item[
"ref_id"],
467 $item[
"obj_id"], $item[
"title"], $item[
"description"]);
468 $ilBench->stop(
"ilPersonalDesktopGUI",
"getListHTML");
472 $item_html[] = array(
474 "item_ref_id" => $item[
"ref_id"],
475 "item_obj_id" => $item[
"obj_id"],
476 "parent_ref" => $item[
"parent_ref"],
477 "type" => $item[
"type"],
478 'item_icon_image_type' => $item_list_gui->getIconImageType()
486 if (count($item_html) > 0)
491 foreach($item_html as $item)
494 if ($cur_parent_ref != $item[
"parent_ref"])
496 if ($ilSetting->get(
"icon_position_in_lists") ==
"item_rows")
505 $cur_parent_ref = $item[
"parent_ref"];
509 $this->
addStandardRow(
$tpl, $item[
"html"], $item[
"item_ref_id"], $item[
"item_obj_id"],
510 $item[
'item_icon_image_type'],
511 "th_".$cur_parent_ref);
533 $objtype_groups = $objDefinition->getGroupedRepositoryObjectTypes(
534 array(
"cat",
"crs",
"grp",
"fold"));
537 foreach($objtype_groups as $grp => $grpdata)
541 "title" => $this->lng->txt(
"objs_".$grp),
542 "types" => $grpdata[
"objs"]);
545 foreach ($types as
$t)
555 foreach($items as $item)
557 $ref_ids[] = $item[
'ref_id'];
560 $ilObjDataCache->preloadReferenceCache($ref_ids);
561 $item_html = array();
565 $rel_header =
"th_".$grp;
568 if (count($items) > 0)
576 if (strcmp($a_type,
"tst") == 0) {
577 $items = $this->multiarray_sort($items,
"used_tries; title");
578 foreach ($items as $tst_item) {
579 if (!isset($tst_item[
"used_tries"])) {
582 elseif ($tst_item[
"used_tries"] == 0) {
588 foreach($items as $item)
591 if ($cur_obj_type != $item[
"type"])
593 $class = $objDefinition->getClassName($item[
"type"]);
594 $location = $objDefinition->getLocation($item[
"type"]);
595 $full_class =
"ilObj".$class.
"ListGUI";
596 include_once(
$location.
"/class.".$full_class.
".php");
597 $item_list_gui =
new $full_class();
598 $item_list_gui->enableIcon(
true);
599 $item_list_gui->enableDelete(
false);
600 $item_list_gui->enableCut(
false);
601 $item_list_gui->enableCopy(
false);
602 $item_list_gui->enablePayment(
false);
603 $item_list_gui->enableLink(
false);
604 $item_list_gui->enableInfoScreen(
false);
605 $item_list_gui->enableSubscribe(
false);
608 $item_list_gui->enableDescription(
false);
609 $item_list_gui->enableProperties(
false);
610 $item_list_gui->enablePreconditions(
false);
611 $item_list_gui->enableNoticeProperties(
false);
615 $item_list_gui->enableCommands(
true,
true);
619 $ilBench->start(
"ilPersonalDesktopGUI",
"getListHTML");
621 $html = $item_list_gui->getListItemHTML($item[
"ref_id"],
622 $item[
"obj_id"], $item[
"title"], $item[
"description"]);
623 $ilBench->stop(
"ilPersonalDesktopGUI",
"getListHTML");
627 $item_html[] = array(
629 "item_ref_id" => $item[
"ref_id"],
630 "item_obj_id" => $item[
"obj_id"],
631 'item_icon_image_type' => (method_exists($item_list_gui,
'getIconImageType')) ?
632 $item_list_gui->getIconImageType() :
640 if (count($item_html) > 0)
645 if ($ilSetting->get(
"icon_position_in_lists") ==
"item_rows")
657 foreach($item_html as $item)
660 $ilSetting->get(
"icon_position_in_lists") ==
"item_rows")
663 $this->
addStandardRow(
$tpl, $item[
"html"], $item[
"item_ref_id"], $item[
"item_obj_id"],
664 $item[
'item_icon_image_type'],
670 $this->
addStandardRow(
$tpl, $item[
"html"], $item[
"item_ref_id"], $item[
"item_obj_id"],
"", $rel_header);
693 switch($ilUser->getPref(
'pd_order_items'))
712 global $ilUser, $rbacsystem, $objDefinition,
$ilBench;
716 switch ($ilUser->getPref(
"pd_order_items"))
735 global $ilUser, $rbacsystem, $objDefinition,
$ilBench,
$ilSetting, $ilObjDataCache, $tree;
737 $items = $ilUser->getDesktopItems();
738 if (count($items) > 0)
742 foreach($items as $item)
744 $ref_ids[] = $item[
"ref_id"];
746 $tree->preloadDeleted($ref_ids);
747 $tree->preloadDepthParent($ref_ids);
748 $ilObjDataCache->preloadReferenceCache($ref_ids,
true);
753 $objtype_groups = $objDefinition->getGroupedRepositoryObjectTypes(
754 array(
"cat",
"crs",
"grp",
"fold"));
757 foreach($objtype_groups as $grp => $grpdata)
761 "title" => $this->lng->txt(
"objs_".$grp),
762 "types" => $grpdata[
"objs"]);
765 foreach ($types as
$t)
772 $items = $ilUser->getDesktopItems(
$type);
773 $item_html = array();
777 $rel_header =
"th_".$grp;
780 if (count($items) > 0)
788 if (strcmp($a_type,
"tst") == 0) {
789 $items = $this->multiarray_sort($items,
"used_tries; title");
790 foreach ($items as $tst_item) {
791 if (!isset($tst_item[
"used_tries"])) {
794 elseif ($tst_item[
"used_tries"] == 0) {
800 foreach($items as $item)
803 if ($cur_obj_type != $item[
"type"])
805 $class = $objDefinition->getClassName($item[
"type"]);
806 $location = $objDefinition->getLocation($item[
"type"]);
807 $full_class =
"ilObj".$class.
"ListGUI";
808 include_once(
$location.
"/class.".$full_class.
".php");
809 $item_list_gui =
new $full_class();
810 $item_list_gui->enableIcon(
true);
811 $item_list_gui->enableDelete(
false);
812 $item_list_gui->enableCut(
false);
813 $item_list_gui->enableCopy(
false);
814 $item_list_gui->enablePayment(
false);
815 $item_list_gui->enableLink(
false);
816 $item_list_gui->enableInfoScreen(
false);
817 $item_list_gui->setContainerObject($this);
820 $item_list_gui->enableDescription(
false);
821 $item_list_gui->enableProperties(
false);
822 $item_list_gui->enablePreconditions(
false);
823 $item_list_gui->enableNoticeProperties(
false);
827 $item_list_gui->enableCommands(
true,
true);
831 $ilBench->start(
"ilPersonalDesktopGUI",
"getListHTML");
833 $html = $item_list_gui->getListItemHTML($item[
"ref_id"],
834 $item[
"obj_id"], $item[
"title"], $item[
"description"]);
835 $ilBench->stop(
"ilPersonalDesktopGUI",
"getListHTML");
839 $item_html[] = array(
841 "item_ref_id" => $item[
"ref_id"],
842 "item_obj_id" => $item[
"obj_id"],
843 'item_icon_image_type' => (method_exists($item_list_gui,
'getIconImageType')) ?
844 $item_list_gui->getIconImageType() :
852 if (count($item_html) > 0)
857 if ($ilSetting->get(
"icon_position_in_lists") ==
"item_rows")
869 foreach($item_html as $item)
872 $ilSetting->get(
"icon_position_in_lists") ==
"item_rows")
875 $this->
addStandardRow(
$tpl, $item[
"html"], $item[
"item_ref_id"], $item[
"item_obj_id"],
876 $item[
'item_icon_image_type'],
882 $this->
addStandardRow(
$tpl, $item[
"html"], $item[
"item_ref_id"], $item[
"item_obj_id"],
"", $rel_header);
898 global $ilUser, $rbacsystem, $objDefinition,
$ilBench,
$ilSetting, $ilObjDataCache, $tree;
902 $items = $ilUser->getDesktopItems();
903 $item_html = array();
906 if (count($items) > 0)
910 foreach($items as $item)
912 $ref_ids[] = $item[
"ref_id"];
915 $tree->preloadDeleted($ref_ids);
916 $tree->preloadDepthParent($ref_ids);
917 $ilObjDataCache->preloadReferenceCache($ref_ids);
919 foreach($items as $item)
923 if ($cur_obj_type != $item[
"type"])
927 $item_list_gui->enableIcon(
true);
928 $item_list_gui->enableDelete(
false);
929 $item_list_gui->enableCut(
false);
930 $item_list_gui->enableCopy(
false);
931 $item_list_gui->enablePayment(
false);
932 $item_list_gui->enableLink(
false);
933 $item_list_gui->enableInfoScreen(
false);
937 $item_list_gui->enableDescription(
false);
938 $item_list_gui->enableProperties(
false);
939 $item_list_gui->enablePreconditions(
false);
943 $item_list_gui->enableCommands(
true,
true);
947 $ilBench->start(
"ilPersonalDesktopGUI",
"getListHTML");
948 $item_list_gui->setContainerObject($this);
949 $html = $item_list_gui->getListItemHTML($item[
"ref_id"],
950 $item[
"obj_id"], $item[
"title"], $item[
"description"]);
951 $ilBench->stop(
"ilPersonalDesktopGUI",
"getListHTML");
955 $item_html[] = array(
957 "item_ref_id" => $item[
"ref_id"],
958 "item_obj_id" => $item[
"obj_id"],
959 "parent_ref" => $item[
"parent_ref"],
960 "type" => $item[
"type"],
961 'item_icon_image_type' => $item_list_gui->getIconImageType()
968 if (count($item_html) > 0)
973 foreach($item_html as $item)
976 if ($cur_parent_ref != $item[
"parent_ref"])
978 if ($ilSetting->get(
"icon_position_in_lists") ==
"item_rows")
987 $cur_parent_ref = $item[
"parent_ref"];
991 $this->
addStandardRow(
$tpl, $item[
"html"], $item[
"item_ref_id"], $item[
"item_obj_id"],
992 $item[
'item_icon_image_type'],
993 "th_".$cur_parent_ref);
1005 $this->cur_row_type =
"";
1016 $tpl =
new ilTemplate (
"tpl.pd_list_block.html",
true,
true,
"Services/PersonalDesktop");
1017 $this->cur_row_type =
"";
1026 global $objDefinition;
1028 if (!isset($this->item_list_guis[$a_type]))
1030 $class = $objDefinition->getClassName($a_type);
1031 $location = $objDefinition->getLocation($a_type);
1032 $full_class =
"ilObj".$class.
"ListGUI";
1034 include_once(
$location.
"/class.".$full_class.
".php");
1035 $item_list_gui =
new $full_class();
1036 $this->item_list_guis[$a_type] =& $item_list_gui;
1040 $item_list_gui =& $this->item_list_guis[$a_type];
1042 return $item_list_gui;
1054 global $objDefinition;
1057 if (!$objDefinition->isPlugin($a_type))
1059 $title = $this->lng->txt(
"objs_".$a_type);
1063 include_once(
"./Services/Component/classes/class.ilPlugin.php");
1068 $header_id =
"th_".$a_type;
1072 $a_tpl->setCurrentBlock(
"container_header_row_image");
1073 $a_tpl->setVariable(
"HEADER_IMG", $icon);
1074 $a_tpl->setVariable(
"HEADER_ALT",
$title);
1078 $a_tpl->setCurrentBlock(
"container_header_row");
1081 $a_tpl->setVariable(
"BLOCK_HEADER_CONTENT",
$title);
1082 $a_tpl->setVariable(
"BLOCK_HEADER_ID", $header_id);
1083 $a_tpl->parseCurrentBlock();
1084 $a_tpl->touchBlock(
"container_row");
1100 if (!in_array(
$type, array(
"lm",
"dbk",
"sahs",
"htlm")))
1110 if ($ilSetting->get(
"custom_icons") &&
1111 in_array(
$type, array(
"cat",
"grp",
"crs",
"root")))
1113 require_once(
"./Services/Container/classes/class.ilContainer.php");
1120 if ($tree->getRootId() != $par_id)
1126 $nd = $tree->getNodeData(ROOT_FOLDER_ID);
1130 $title = $this->lng->txt(
"repository");
1159 $a_tpl->setCurrentBlock(
"container_header_row");
1162 $a_tpl->setVariable(
"BLOCK_HEADER_CONTENT",
$title);
1165 $a_tpl->parseCurrentBlock();
1166 $a_tpl->touchBlock(
"container_row");
1177 $a_image_type =
"", $a_related_header =
"")
1181 $this->cur_row_type = ($this->cur_row_type ==
"row_type_1")
1184 $a_tpl->touchBlock($this->cur_row_type);
1186 if ($a_image_type !=
"")
1188 if (!is_array($a_image_type) && !in_array($a_image_type, array(
"lm",
"dbk",
"htlm",
"sahs")))
1191 $title = $this->lng->txt(
"obj_".$a_image_type);
1196 $title = $this->lng->txt(
"learning_resource");
1200 if ($ilSetting->get(
"custom_icons") &&
1201 in_array($a_image_type, array(
"cat",
"grp",
"crs")))
1203 require_once(
"./Services/Container/classes/class.ilContainer.php");
1210 $a_tpl->setCurrentBlock(
"block_row_image");
1211 $a_tpl->setVariable(
"ROW_IMG", $icon);
1212 $a_tpl->setVariable(
"ROW_ALT",
$title);
1213 $a_tpl->parseCurrentBlock();
1217 $a_tpl->setVariable(
"ROW_NBSP",
" ");
1219 $a_tpl->setCurrentBlock(
"container_standard_row");
1220 $a_tpl->setVariable(
"BLOCK_ROW_CONTENT", $a_html);
1221 $rel_headers = ($a_related_header !=
"")
1222 ?
"th_selected_items ".$a_related_header
1223 :
"th_selected_items";
1224 $a_tpl->setVariable(
"BLOCK_ROW_HEADERS", $rel_headers);
1225 $a_tpl->parseCurrentBlock();
1226 $a_tpl->touchBlock(
"container_row");
1236 switch((
int)$this->view)
1238 case self::VIEW_MY_MEMBERSHIPS:
1239 $tpl =
new ilTemplate(
'tpl.pd_my_memberships_intro.html',
true,
true,
'Services/PersonalDesktop');
1241 $tpl->setVariable(
'TXT_WELCOME', $lng->txt(
'pd_my_memberships_intro'));
1242 $tpl->setVariable(
'TXT_INTRO_1', $lng->txt(
'pd_my_memberships_intro2'));
1245 case self::VIEW_MY_OFFERS:
1248 $nd = $tree->getNodeData(ROOT_FOLDER_ID);
1252 $title = $lng->txt(
"repository");
1255 $tpl =
new ilTemplate(
"tpl.pd_intro.html",
true,
true,
"Services/PersonalDesktop");
1257 $tpl->setVariable(
"TXT_WELCOME", $lng->txt(
"pdesk_intro"));
1258 $tpl->setVariable(
"TXT_INTRO_1", sprintf($lng->txt(
"pdesk_intro2"), $lng->txt(
"to_desktop")));
1259 $tpl->setVariable(
"TXT_INTRO_2", sprintf($lng->txt(
"pdesk_intro3"),
1260 '<a href="repository.php?cmd=frameset&getlast=true">'.$title.
'</a>'));
1261 $tpl->setVariable(
"TXT_INTRO_3", $lng->txt(
"pdesk_intro4"));
1275 $ilUser->writePref(
"pd_order_items",
"location");
1277 if ($ilCtrl->isAsynch())
1284 $ilCtrl->redirectByClass(
"ilpersonaldesktopgui",
"show");
1295 $ilUser->writePref(
"pd_order_items",
"type");
1297 if ($ilCtrl->isAsynch())
1304 $ilCtrl->redirectByClass(
"ilpersonaldesktopgui",
"show");