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"))
737 $items = $ilUser->getDesktopItems();
738 if (count($items) > 0)
742 foreach($items as $item)
744 $ref_ids[] = $item[
"ref_id"];
746 $ilObjDataCache->preloadReferenceCache($ref_ids);
751 $objtype_groups = $objDefinition->getGroupedRepositoryObjectTypes(
752 array(
"cat",
"crs",
"grp",
"fold"));
755 foreach($objtype_groups as $grp => $grpdata)
759 "title" => $this->lng->txt(
"objs_".$grp),
760 "types" => $grpdata[
"objs"]);
763 foreach ($types as
$t)
770 $items = $ilUser->getDesktopItems(
$type);
771 $item_html = array();
775 $rel_header =
"th_".$grp;
778 if (count($items) > 0)
786 if (strcmp($a_type,
"tst") == 0) {
787 $items = $this->multiarray_sort($items,
"used_tries; title");
788 foreach ($items as $tst_item) {
789 if (!isset($tst_item[
"used_tries"])) {
792 elseif ($tst_item[
"used_tries"] == 0) {
798 foreach($items as $item)
801 if ($cur_obj_type != $item[
"type"])
803 $class = $objDefinition->getClassName($item[
"type"]);
804 $location = $objDefinition->getLocation($item[
"type"]);
805 $full_class =
"ilObj".$class.
"ListGUI";
806 include_once(
$location.
"/class.".$full_class.
".php");
807 $item_list_gui =
new $full_class();
808 $item_list_gui->enableIcon(
true);
809 $item_list_gui->enableDelete(
false);
810 $item_list_gui->enableCut(
false);
811 $item_list_gui->enableCopy(
false);
812 $item_list_gui->enablePayment(
false);
813 $item_list_gui->enableLink(
false);
814 $item_list_gui->enableInfoScreen(
false);
815 $item_list_gui->setContainerObject($this);
818 $item_list_gui->enableDescription(
false);
819 $item_list_gui->enableProperties(
false);
820 $item_list_gui->enablePreconditions(
false);
821 $item_list_gui->enableNoticeProperties(
false);
825 $item_list_gui->enableCommands(
true,
true);
829 $ilBench->start(
"ilPersonalDesktopGUI",
"getListHTML");
831 $html = $item_list_gui->getListItemHTML($item[
"ref_id"],
832 $item[
"obj_id"], $item[
"title"], $item[
"description"]);
833 $ilBench->stop(
"ilPersonalDesktopGUI",
"getListHTML");
837 $item_html[] = array(
839 "item_ref_id" => $item[
"ref_id"],
840 "item_obj_id" => $item[
"obj_id"],
841 'item_icon_image_type' => (method_exists($item_list_gui,
'getIconImageType')) ?
842 $item_list_gui->getIconImageType() :
850 if (count($item_html) > 0)
855 if ($ilSetting->get(
"icon_position_in_lists") ==
"item_rows")
867 foreach($item_html as $item)
870 $ilSetting->get(
"icon_position_in_lists") ==
"item_rows")
873 $this->
addStandardRow(
$tpl, $item[
"html"], $item[
"item_ref_id"], $item[
"item_obj_id"],
874 $item[
'item_icon_image_type'],
880 $this->
addStandardRow(
$tpl, $item[
"html"], $item[
"item_ref_id"], $item[
"item_obj_id"],
"", $rel_header);
900 $items = $ilUser->getDesktopItems();
901 $item_html = array();
903 if (count($items) > 0)
907 foreach($items as $item)
909 $ref_ids[] = $item[
"ref_id"];
912 $ilObjDataCache->preloadReferenceCache($ref_ids);
914 foreach($items as $item)
918 if ($cur_obj_type != $item[
"type"])
922 $item_list_gui->enableIcon(
true);
923 $item_list_gui->enableDelete(
false);
924 $item_list_gui->enableCut(
false);
925 $item_list_gui->enableCopy(
false);
926 $item_list_gui->enablePayment(
false);
927 $item_list_gui->enableLink(
false);
928 $item_list_gui->enableInfoScreen(
false);
932 $item_list_gui->enableDescription(
false);
933 $item_list_gui->enableProperties(
false);
934 $item_list_gui->enablePreconditions(
false);
938 $item_list_gui->enableCommands(
true,
true);
942 $ilBench->start(
"ilPersonalDesktopGUI",
"getListHTML");
943 $item_list_gui->setContainerObject($this);
944 $html = $item_list_gui->getListItemHTML($item[
"ref_id"],
945 $item[
"obj_id"], $item[
"title"], $item[
"description"]);
946 $ilBench->stop(
"ilPersonalDesktopGUI",
"getListHTML");
950 $item_html[] = array(
952 "item_ref_id" => $item[
"ref_id"],
953 "item_obj_id" => $item[
"obj_id"],
954 "parent_ref" => $item[
"parent_ref"],
955 "type" => $item[
"type"],
956 'item_icon_image_type' => $item_list_gui->getIconImageType()
963 if (count($item_html) > 0)
968 foreach($item_html as $item)
971 if ($cur_parent_ref != $item[
"parent_ref"])
973 if ($ilSetting->get(
"icon_position_in_lists") ==
"item_rows")
982 $cur_parent_ref = $item[
"parent_ref"];
986 $this->
addStandardRow(
$tpl, $item[
"html"], $item[
"item_ref_id"], $item[
"item_obj_id"],
987 $item[
'item_icon_image_type'],
988 "th_".$cur_parent_ref);
1000 $this->cur_row_type =
"";
1011 $tpl =
new ilTemplate (
"tpl.pd_list_block.html",
true,
true,
"Services/PersonalDesktop");
1012 $this->cur_row_type =
"";
1021 global $objDefinition;
1023 if (!is_object($this->item_list_guis[$a_type]))
1025 $class = $objDefinition->getClassName($a_type);
1026 $location = $objDefinition->getLocation($a_type);
1027 $full_class =
"ilObj".$class.
"ListGUI";
1029 include_once(
$location.
"/class.".$full_class.
".php");
1030 $item_list_gui =
new $full_class();
1031 $this->item_list_guis[$a_type] =& $item_list_gui;
1035 $item_list_gui =& $this->item_list_guis[$a_type];
1037 return $item_list_gui;
1049 global $objDefinition;
1052 if (!$objDefinition->isPlugin($a_type))
1054 $title = $this->lng->txt(
"objs_".$a_type);
1058 include_once(
"./Services/Component/classes/class.ilPlugin.php");
1063 $header_id =
"th_".$a_type;
1067 $a_tpl->setCurrentBlock(
"container_header_row_image");
1068 $a_tpl->setVariable(
"HEADER_IMG", $icon);
1069 $a_tpl->setVariable(
"HEADER_ALT",
$title);
1073 $a_tpl->setCurrentBlock(
"container_header_row");
1076 $a_tpl->setVariable(
"BLOCK_HEADER_CONTENT",
$title);
1077 $a_tpl->setVariable(
"BLOCK_HEADER_ID", $header_id);
1078 $a_tpl->parseCurrentBlock();
1079 $a_tpl->touchBlock(
"container_row");
1095 if (!in_array(
$type, array(
"lm",
"dbk",
"sahs",
"htlm")))
1105 if ($ilSetting->get(
"custom_icons") &&
1106 in_array(
$type, array(
"cat",
"grp",
"crs",
"root")))
1108 require_once(
"./Services/Container/classes/class.ilContainer.php");
1115 if ($tree->getRootId() != $par_id)
1121 $nd = $tree->getNodeData(ROOT_FOLDER_ID);
1125 $title = $this->lng->txt(
"repository");
1154 $a_tpl->setCurrentBlock(
"container_header_row");
1157 $a_tpl->setVariable(
"BLOCK_HEADER_CONTENT",
$title);
1160 $a_tpl->parseCurrentBlock();
1161 $a_tpl->touchBlock(
"container_row");
1172 $a_image_type =
"", $a_related_header =
"")
1176 $this->cur_row_type = ($this->cur_row_type ==
"row_type_1")
1179 $a_tpl->touchBlock($this->cur_row_type);
1181 if ($a_image_type !=
"")
1183 if (!is_array($a_image_type) && !in_array($a_image_type, array(
"lm",
"dbk",
"htlm",
"sahs")))
1186 $title = $this->lng->txt(
"obj_".$a_image_type);
1191 $title = $this->lng->txt(
"learning_resource");
1195 if ($ilSetting->get(
"custom_icons") &&
1196 in_array($a_image_type, array(
"cat",
"grp",
"crs")))
1198 require_once(
"./Services/Container/classes/class.ilContainer.php");
1205 $a_tpl->setCurrentBlock(
"block_row_image");
1206 $a_tpl->setVariable(
"ROW_IMG", $icon);
1207 $a_tpl->setVariable(
"ROW_ALT",
$title);
1208 $a_tpl->parseCurrentBlock();
1212 $a_tpl->setVariable(
"ROW_NBSP",
" ");
1214 $a_tpl->setCurrentBlock(
"container_standard_row");
1215 $a_tpl->setVariable(
"BLOCK_ROW_CONTENT", $a_html);
1216 $rel_headers = ($a_related_header !=
"")
1217 ?
"th_selected_items ".$a_related_header
1218 :
"th_selected_items";
1219 $a_tpl->setVariable(
"BLOCK_ROW_HEADERS", $rel_headers);
1220 $a_tpl->parseCurrentBlock();
1221 $a_tpl->touchBlock(
"container_row");
1231 switch((
int)$this->view)
1233 case self::VIEW_MY_MEMBERSHIPS:
1234 $tpl =
new ilTemplate(
'tpl.pd_my_memberships_intro.html',
true,
true,
'Services/PersonalDesktop');
1236 $tpl->setVariable(
'TXT_WELCOME', $lng->txt(
'pd_my_memberships_intro'));
1237 $tpl->setVariable(
'TXT_INTRO_1', $lng->txt(
'pd_my_memberships_intro2'));
1240 case self::VIEW_MY_OFFERS:
1243 $nd = $tree->getNodeData(ROOT_FOLDER_ID);
1247 $title = $lng->txt(
"repository");
1250 $tpl =
new ilTemplate(
"tpl.pd_intro.html",
true,
true,
"Services/PersonalDesktop");
1252 $tpl->setVariable(
"TXT_WELCOME", $lng->txt(
"pdesk_intro"));
1253 $tpl->setVariable(
"TXT_INTRO_1", sprintf($lng->txt(
"pdesk_intro2"), $lng->txt(
"to_desktop")));
1254 $tpl->setVariable(
"TXT_INTRO_2", sprintf($lng->txt(
"pdesk_intro3"),
1255 '<a href="repository.php?cmd=frameset&getlast=true">'.$title.
'</a>'));
1256 $tpl->setVariable(
"TXT_INTRO_3", $lng->txt(
"pdesk_intro4"));
1270 $ilUser->writePref(
"pd_order_items",
"location");
1272 if ($ilCtrl->isAsynch())
1279 $ilCtrl->redirectByClass(
"ilpersonaldesktopgui",
"show");
1290 $ilUser->writePref(
"pd_order_items",
"type");
1292 if ($ilCtrl->isAsynch())
1299 $ilCtrl->redirectByClass(
"ilpersonaldesktopgui",
"show");