ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
ilBookmarkAdministrationGUI Class Reference

GUI class for personal bookmark administration. More...

+ Collaboration diagram for ilBookmarkAdministrationGUI:

Public Member Functions

 ilBookmarkAdministrationGUI ()
 Constructor @access public. More...
 
executeCommand ()
 execute command More...
 
 executeAction ()
 
 getMode ()
 return display mode flat or tree More...
 
 explorer ()
 output explorer tree with bookmark folders More...
 
 displayHeader ()
 display header and locator More...
 
 view ()
 
 add_cell ($val, $link="")
 output a cell in object list More...
 
 displayLocator ()
 display locator More...
 
 newForm ($type)
 new form More...
 
 newFormBookmarkFolder ()
 display new bookmark folder form More...
 
 editFormBookmarkFolder ()
 display edit bookmark folder form More...
 
 newFormBookmark ()
 display new bookmark form More...
 
 get_last ($a_var, $a_value)
 get stored post var in case of an error/warning otherwise return passed value More...
 
 editFormBookmark ()
 display edit bookmark form More...
 
 createBookmarkFolder ()
 create new bookmark folder in db More...
 
 updateBookmarkFolder ()
 update bookmark folder More...
 
 createBookmark ()
 create new bookmark in db More...
 
 updateBookmark ()
 update bookmark in db More...
 
 export ($deliver=true)
 export bookmarks More...
 
 sendmail ()
 send bookmarks as attachment More...
 
 delete ()
 display deletion conformation screen More...
 
 cancel ()
 cancel deletion,insert, update More...
 
 confirm ()
 deletion confirmed -> delete folders / bookmarks More...
 
 showPossibleSubObjects ()
 display subobject addition selection More...
 
 getHTML ()
 Get Bookmark list for personal desktop. More...
 
 importFile ()
 imports a bookmark file into database display status information or report errors messages in case of error @access public More...
 
 __importBookmarks (&$objects, &$num_create, $folder_id, $start_key=0)
 creates the bookmarks and folders More...
 
 move ()
 
 confirmedMove ()
 

Data Fields

 $user_id
 
 $ilias
 
 $tpl
 
 $lng
 
 $tree
 
 $id
 
 $data
 
 $textwidth = 100
 

Private Member Functions

 initFormBookmarkFolder ($action='createBookmarkFolder')
 init bookmark folder create/edit form More...
 
 initFormBookmark ($action='createBookmark')
 init Bookmark create/edit form More...
 
 initImportBookmarksForm ()
 Init import bookmark form. More...
 

Detailed Description

GUI class for personal bookmark administration.

It manages folders and bookmarks with the help of the two corresponding core classes ilBookmarkFolder and ilBookmark. Their methods are called in this User Interface class.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Manfred Thaler manfr.nosp@m.ed.t.nosp@m.haler.nosp@m.@end.nosp@m.o7.co.nosp@m.m
Version
$Id$

@ilCtrl_Calls ilBookmarkAdministrationGUI:

Definition at line 19 of file class.ilBookmarkAdministrationGUI.php.

Member Function Documentation

◆ __importBookmarks()

ilBookmarkAdministrationGUI::__importBookmarks ( $objects,
$num_create,
  $folder_id,
  $start_key = 0 
)

creates the bookmarks and folders

Parameters
arrayarray of objects
arraystores the number of created objects
folder_idid where to store the bookmarks
start_keykey of the objects array where to start @access private

Definition at line 977 of file class.ilBookmarkAdministrationGUI.php.

978 {
979 if(is_array($objects[$start_key]))
980 {
981 foreach($objects[$start_key] as $obj_key=> $object)
982 {
983 switch($object['type'])
984 {
985 case 'bm':
986 if(!$object["title"]) continue;
987 if(!$object["target"]) continue;
988 $bm = new ilBookmark();
989 $bm->setTitle($object["title"]);
990 $bm->setDescription($object["description"]);
991 $bm->setTarget($object["target"]);
992 $bm->setParent($folder_id);
993 $bm->create();
994 $num_create['bm']++;
995 break;
996 case 'bmf':
997 if(!$object["title"]) continue;
998 $bmf = new ilBookmarkFolder();
999 $bmf->setTitle($object["title"]);
1000 $bmf->setParent($folder_id);
1001 $bmf->create();
1002 $num_create['bmf']++;
1003 if(is_array($objects[$obj_key]))
1004 {
1005 $this->__importBookmarks($objects, $num_create,
1006 $bmf->getId(), $obj_key);
1007 }
1008 break;
1009 }
1010 }
1011 }
1012 }
__importBookmarks(&$objects, &$num_create, $folder_id, $start_key=0)
creates the bookmarks and folders
bookmark folder (note: this class handles personal bookmarks folders only)
Class Bookmarks Bookmark management.

References __importBookmarks().

Referenced by __importBookmarks(), and importFile().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ add_cell()

ilBookmarkAdministrationGUI::add_cell (   $val,
  $link = "" 
)

output a cell in object list

Definition at line 192 of file class.ilBookmarkAdministrationGUI.php.

193 {
194 if(!empty($link))
195 {
196 $this->tpl->setCurrentBlock("begin_link");
197 $this->tpl->setVariable("LINK_TARGET", $link);
198 $this->tpl->parseCurrentBlock();
199 $this->tpl->touchBlock("end_link");
200 }
201
202 $this->tpl->setCurrentBlock("text");
203 $this->tpl->setVariable("TEXT_CONTENT", $val);
204 $this->tpl->parseCurrentBlock();
205 $this->tpl->setCurrentBlock("table_cell");
206 $this->tpl->parseCurrentBlock();
207 }

◆ cancel()

ilBookmarkAdministrationGUI::cancel ( )

cancel deletion,insert, update

Definition at line 809 of file class.ilBookmarkAdministrationGUI.php.

810 {
811 if($_POST['return_to'])
812 ilUtil::redirect($_POST['return_to_url']);
813 else
814 $this->view();
815 }
static redirect($a_script)
http redirect to other script
$_POST['username']
Definition: cron.php:12

References $_POST, ilUtil\redirect(), and view().

+ Here is the call graph for this function:

◆ confirm()

ilBookmarkAdministrationGUI::confirm ( )

deletion confirmed -> delete folders / bookmarks

Definition at line 820 of file class.ilBookmarkAdministrationGUI.php.

821 {
822 global $tree, $rbacsystem, $rbacadmin;
823 // AT LEAST ONE OBJECT HAS TO BE CHOSEN.
824 if(!$_POST["id"])
825 {
826 $this->ilias->raiseError($this->lng->txt("no_checkbox"), $this->ilias->error_obj->MESSAGE);
827 }
828
829 // FOR ALL SELECTED OBJECTS
830 foreach($_POST["id"] as $id)
831 {
833
834 // get node data and subtree nodes
835 if($this->tree->isInTree($id))
836 {
837 $node_data = $this->tree->getNodeData($id);
838 $subtree_nodes = $this->tree->getSubTree($node_data);
839 }
840 else
841 {
842 continue;
843 }
844
845 // delete tree
846 $this->tree->deleteTree($node_data);
847
848 // delete objects of subtree nodes
849 foreach($subtree_nodes as $node)
850 {
851 switch($node["type"])
852 {
853 case "bmf":
854 $BookmarkFolder = new ilBookmarkFolder($node["obj_id"]);
855 $BookmarkFolder->delete();
856 break;
857
858 case "bm":
859 $Bookmark = new ilBookmark($node["obj_id"]);
860 $Bookmark->delete();
861 break;
862 }
863 }
864 }
865
866 // Feedback
867 ilUtil::sendSuccess($this->lng->txt("info_deleted"), true);
868
869 $this->view();
870 }
static _getTypeOfId($a_id)
get type of a given id
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
redirection script todo: (a better solution should control the processing via a xml file)

References $_POST, $id, $tree, ilBookmark\_getTypeOfId(), ilUtil\sendSuccess(), and view().

+ Here is the call graph for this function:

◆ confirmedMove()

ilBookmarkAdministrationGUI::confirmedMove ( )

Definition at line 1038 of file class.ilBookmarkAdministrationGUI.php.

1039 {
1040 global $ilUser;
1041
1042 $tgt = (int)$_REQUEST["bmfmv_id"];
1043 $bm_ids = explode(";", $_REQUEST['bm_id_tgt']);
1044 if(!$bm_ids || !$tgt)
1045 {
1046 ilUtil::sendFailure($this->lng->txt("no_checkbox"));
1047 return $this->view();
1048 }
1049
1050 $tree = new ilTree($ilUser->getId());
1051 $tree->setTableNames('bookmark_tree', 'bookmark_data');
1052
1053 $tgt_node = $tree->getNodeData($tgt);
1054
1055 // sanity check
1056 foreach($bm_ids as $node_id)
1057 {
1058 if($tree->isGrandChild($node_id, $tgt))
1059 {
1060 ilUtil::sendFailure($this->lng->txt("error"), true);
1061 $this->ctrl->redirect($this, "view");
1062 }
1063
1064 $node = $tree->getNodeData($node_id);
1065
1066 // already at correct position
1067 if($node["parent"] == $tgt)
1068 {
1069 continue;
1070 }
1071
1072 $tree->moveTree($node_id, $tgt);
1073 }
1074
1075 ilUtil::sendSuccess($this->lng->txt("bookmark_moved_ok"), true);
1076 $this->ctrl->setParameter($this, "bmf_id", $tgt);
1077 $this->ctrl->redirect($this, "view");
1078 }
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
global $ilUser
Definition: imgupload.php:15

References $_REQUEST, $ilUser, $tree, ilUtil\sendFailure(), ilUtil\sendSuccess(), and view().

+ Here is the call graph for this function:

◆ createBookmark()

ilBookmarkAdministrationGUI::createBookmark ( )

create new bookmark in db

Definition at line 605 of file class.ilBookmarkAdministrationGUI.php.

606 {
607 global $lng, $ilCtrl;
608
609 if(!$this->tree->isInTree($this->id))
610 {
611 $this->ctrl->setParameter($this, 'bmf_id', '');
612 $this->ctrl->redirect($this);
613 }
614
615 // check title and target
616 if(empty($_POST["title"]))
617 {
618 ilUtil::sendFailure($this->lng->txt("please_enter_title"));
619 $this->newFormBookmark();
620 }
621 else if(empty($_POST["target"]))
622 {
623 ilUtil::sendFailure($this->lng->txt("please_enter_target"));
624 $this->newFormBookmark();
625 }
626 else
627 {
628 // create bookmark
629 $bm = new ilBookmark();
630 $bm->setTitle(ilUtil::stripSlashes($_POST["title"]));
631 $bm->setDescription(ilUtil::stripSlashes($_POST["description"]));
632 $bm->setTarget(ilUtil::stripSlashes($_POST["target"]));
633 $bm->setParent($this->id);
634 $bm->create();
635
636 ilUtil::sendInfo($lng->txt('bookmark_added'), true);
637
638 if($_POST['return_to'])
639 ilUtil::redirect($_POST['return_to_url']);
640 else
641 {
642 $ilCtrl->saveParameter($this, 'bmf_id');
643 $ilCtrl->redirect($this, 'view');
644 }
645 }
646 }
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
global $ilCtrl
Definition: ilias.php:18

References $_POST, $ilCtrl, $lng, newFormBookmark(), ilUtil\redirect(), ilUtil\sendFailure(), ilUtil\sendInfo(), and ilUtil\stripSlashes().

+ Here is the call graph for this function:

◆ createBookmarkFolder()

ilBookmarkAdministrationGUI::createBookmarkFolder ( )

create new bookmark folder in db

Definition at line 541 of file class.ilBookmarkAdministrationGUI.php.

542 {
543 if(!$this->tree->isInTree($this->id))
544 {
545 $this->ctrl->setParameter($this, 'bmf_id', '');
546 $this->ctrl->redirect($this);
547 }
548
549 // check title
550 if(empty($_POST["title"]))
551 {
552 ilUtil::sendFailure($this->lng->txt("please_enter_title"));
553 $this->newFormBookmarkFolder();
554 }
555 else
556 {
557 // create bookmark folder
558 $bmf = new ilBookmarkFolder();
559 $bmf->setTitle(ilUtil::stripSlashes($_POST["title"]));
560 $bmf->setParent($this->id);
561 $bmf->create();
562
563 global $ilCtrl;
564 $ilCtrl->saveParameter($this, 'bmf_id');
565 $ilCtrl->redirect($this, 'view');
566 }
567 }
newFormBookmarkFolder()
display new bookmark folder form

References $_POST, $ilCtrl, newFormBookmarkFolder(), ilUtil\sendFailure(), and ilUtil\stripSlashes().

+ Here is the call graph for this function:

◆ delete()

ilBookmarkAdministrationGUI::delete ( )

display deletion conformation screen

Definition at line 749 of file class.ilBookmarkAdministrationGUI.php.

750 {
751 $bm_ids = $_GET['bm_id'] ? array($_GET['bm_id']) : $_POST['bm_id'];
752 if(!$bm_ids)
753 {
754 $this->ilias->raiseError($this->lng->txt("no_checkbox"), $this->ilias->error_obj->MESSAGE);
755 }
756
757 $this->ctrl->setParameter($this, "bmf_id", $this->id);
758
759 // display confirmation message
760 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
761 $cgui = new ilConfirmationGUI();
762 $cgui->setFormAction($this->ctrl->getFormAction($this));
763 $cgui->setHeaderText($this->lng->txt("info_delete_sure"));
764 $cgui->setCancel($this->lng->txt("cancel"), "cancel");
765 $cgui->setConfirm($this->lng->txt("confirm"), "confirm");
766
767 foreach($bm_ids as $obj_id)
768 {
769 $type = ilBookmark::_getTypeOfId($obj_id);
770
771 if(!$this->tree->isInTree($obj_id))
772 {
773 continue;
774 }
775
776 switch($type)
777 {
778 case "bmf":
779 $BookmarkFolder = new ilBookmarkFolder($obj_id);
780 $title = $BookmarkFolder->getTitle();
781 $target = "";
782 unset($BookmarkFolder);
783 break;
784
785 case "bm":
786 $Bookmark = new ilBookmark($obj_id);
787 $title = $Bookmark->getTitle();
788 $target = $Bookmark->getTarget();
789 unset($Bookmark);
790 break;
791 }
792
793 $caption = ilUtil::getImageTagByType($type, $this->tpl->tplPath) .
794 " " . $title;
795 if($target)
796 {
797 $caption .= " (" . ilUtil::shortenText($target, $this->textwidth, true) . ")";
798 }
799
800 $cgui->addItem("id[]", $obj_id, $caption);
801 }
802
803 $this->tpl->setContent($cgui->getHTML());
804 }
$_GET["client_id"]
Confirmation screen class.
static shortenText($a_str, $a_len, $a_dots=false, $a_next_blank=false, $a_keep_extension=false)
shorten a string to given length.
static getImageTagByType($a_type, $a_path, $a_big=false)
Builds an html image tag TODO: function still in use, but in future use getImagePath and move HTML-Co...

References $_GET, $_POST, ilBookmark\_getTypeOfId(), ilUtil\getImageTagByType(), and ilUtil\shortenText().

+ Here is the call graph for this function:

◆ displayHeader()

ilBookmarkAdministrationGUI::displayHeader ( )

display header and locator

Definition at line 147 of file class.ilBookmarkAdministrationGUI.php.

148 {
149 // output locator
150 $this->displayLocator();
151
152 // output message
153 if($this->message)
154 {
155 ilUtil::sendInfo($this->message);
156 }
158
159 $this->tpl->setTitle($this->lng->txt("bookmarks"));
160 }
static infoPanel($a_keep=true)

References displayLocator(), ilUtil\infoPanel(), and ilUtil\sendInfo().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ displayLocator()

ilBookmarkAdministrationGUI::displayLocator ( )

display locator

Definition at line 212 of file class.ilBookmarkAdministrationGUI.php.

213 {
214 global $lng;
215
216 if(empty($this->id))
217 {
218 return;
219 }
220
221 if(!$this->tree->isInTree($this->id))
222 {
223 return;
224 }
225
226 $this->tpl->addBlockFile("LOCATOR", "locator", "tpl.locator.html", "Services/Locator");
227
228 $path = $this->tree->getPathFull($this->id);
229//print_r($path);
230 $modifier = 1;
231
232 return;
233 $this->tpl->setVariable("TXT_LOCATOR", $this->lng->txt("locator"));
234 $this->tpl->touchBlock("locator_separator");
235 $this->tpl->touchBlock("locator_item");
236 //$this->tpl->setCurrentBlock("locator_item");
237 //$this->tpl->setVariable("ITEM", $this->lng->txt("personal_desktop"));
238 //$this->tpl->setVariable("LINK_ITEM", $this->ctrl->getLinkTargetByClass("ilpersonaldesktopgui"));
239 //$this->tpl->setVariable("LINK_TARGET","target=\"".
240 // ilFrameTargetInfo::_getFrame("MainContent")."\"");
241 //$this->tpl->parseCurrentBlock();
242
243 foreach($path as $key => $row)
244 {
245 if($key < count($path) - $modifier)
246 {
247 $this->tpl->touchBlock("locator_separator");
248 }
249
250 $this->tpl->setCurrentBlock("locator_item");
251 $title = ($row["child"] == 1) ?
252 $lng->txt("bookmarks") :
253 $row["title"];
254 $this->tpl->setVariable("ITEM", $title);
255 $this->ctrl->setParameter($this, "bmf_id", $row["child"]);
256 $this->tpl->setVariable("LINK_ITEM",
257 $this->ctrl->getLinkTarget($this));
258 $this->tpl->parseCurrentBlock();
259 }
260
261 $this->tpl->setCurrentBlock("locator");
262
263 $this->tpl->parseCurrentBlock();
264 }
$path
Definition: index.php:22

References $lng, $path, and $row.

Referenced by displayHeader().

+ Here is the caller graph for this function:

◆ editFormBookmark()

ilBookmarkAdministrationGUI::editFormBookmark ( )

display edit bookmark form

Definition at line 511 of file class.ilBookmarkAdministrationGUI.php.

512 {
513 global $lng, $ilCtrl;
514
515 if(!$this->tree->isInTree($_GET["obj_id"]))
516 {
517 $this->ctrl->setParameter($this, 'obj_id', '');
518 $this->ctrl->setParameter($this, 'bmf_id', '');
519 $this->ctrl->redirect($this);
520 }
521
522 $form = $this->initFormBookmark('updateBookmark');
523 $bookmark = new ilBookmark($_GET["obj_id"]);
524 $form->setValuesByArray
525 (
526 array
527 (
528 "title" => $bookmark->getTitle(),
529 "target" => $bookmark->getTarget(),
530 "description" => $bookmark->getDescription(),
531 "obj_id" => $_GET["obj_id"],
532 )
533 );
534 $this->tpl->setVariable("ADM_CONTENT", $form->getHTML());
535 }
initFormBookmark($action='createBookmark')
init Bookmark create/edit form

References $_GET, $ilCtrl, $lng, and initFormBookmark().

Referenced by updateBookmark().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ editFormBookmarkFolder()

ilBookmarkAdministrationGUI::editFormBookmarkFolder ( )

display edit bookmark folder form

Definition at line 348 of file class.ilBookmarkAdministrationGUI.php.

349 {
350 if(!$this->tree->isInTree($_GET["obj_id"]))
351 {
352 $this->ctrl->setParameter($this, 'bmf_id', '');
353 $this->ctrl->setParameter($this, 'obj_id', '');
354 $this->ctrl->redirect($this);
355 }
356
357 $bmf = new ilBookmarkFolder($_GET["obj_id"]);
358 $form = $this->initFormBookmarkFolder('updateBookmarkFolder', $this->id);
359 $form->setValuesByArray
360 (
361 array
362 (
363 "title" => $this->get_last("title", $bmf->getTitle()),
364 "obj_id" => $_GET["obj_id"],
365 )
366 );
367 $this->tpl->setVariable("ADM_CONTENT", $form->getHTML());
368 }
initFormBookmarkFolder($action='createBookmarkFolder')
init bookmark folder create/edit form
get_last($a_var, $a_value)
get stored post var in case of an error/warning otherwise return passed value

References $_GET, get_last(), and initFormBookmarkFolder().

Referenced by updateBookmarkFolder().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeAction()

ilBookmarkAdministrationGUI::executeAction ( )

Definition at line 99 of file class.ilBookmarkAdministrationGUI.php.

100 {
101 switch($_POST["selected_cmd"])
102 {
103 case "delete":
104 $this->delete();
105 break;
106 case "export":
107 $this->export();
108 break;
109 case "sendmail":
110 $this->sendmail();
111 break;
112 default:
113 $this->view();
114 break;
115 }
116 return true;
117 }

References $_POST, export(), sendmail(), and view().

+ Here is the call graph for this function:

◆ executeCommand()

& ilBookmarkAdministrationGUI::executeCommand ( )

execute command

Definition at line 79 of file class.ilBookmarkAdministrationGUI.php.

80 {
81 $next_class = $this->ctrl->getNextClass();
82
83 switch($next_class)
84 {
85 default:
86 $cmd = $this->ctrl->getCmd("view");
87 $this->displayHeader();
88 $this->$cmd();
89 if($this->getMode() == 'tree')
90 {
91 $this->explorer();
92 }
93 break;
94 }
95 $this->tpl->show(true);
96 return true;
97 }
explorer()
output explorer tree with bookmark folders
getMode()
return display mode flat or tree
$cmd
Definition: sahs_server.php:35

References $cmd, displayHeader(), explorer(), and getMode().

+ Here is the call graph for this function:

◆ explorer()

ilBookmarkAdministrationGUI::explorer ( )

output explorer tree with bookmark folders

Definition at line 131 of file class.ilBookmarkAdministrationGUI.php.

132 {
133 global $tpl;
134
135 include_once("./Services/Bookmarks/classes/class.ilBookmarkExplorerGUI.php");
136 $exp = new ilBookmarkExplorerGUI($this, "explorer");
137 if (!$exp->handleCommand())
138 {
139 $tpl->setLeftNavContent($exp->getHTML());
140 }
141 }
Bookmark explorer GUI class.

References $tpl.

Referenced by executeCommand().

+ Here is the caller graph for this function:

◆ export()

ilBookmarkAdministrationGUI::export (   $deliver = true)

export bookmarks

Definition at line 687 of file class.ilBookmarkAdministrationGUI.php.

688 {
689 $bm_ids = $_GET['bm_id'] ? array($_GET['bm_id']) : $_POST['bm_id'];
690 if(!$bm_ids)
691 {
692 $this->ilias->raiseError($this->lng->txt("no_checkbox"), $this->ilias->error_obj->MESSAGE);
693 }
694 $export_ids = array();
695 foreach($bm_ids as $id)
696 {
697 if($this->tree->isInTree($id))
698 {
699 //list($type, $obj_id) = explode(":", $id);
700 //$export_ids[]=$obj_id;
701 $export_ids[] = $id;
702 }
703 }
704
705 require_once ("./Services/Bookmarks/classes/class.ilBookmarkImportExport.php");
706 $html_content = ilBookmarkImportExport::_exportBookmark($export_ids, true,
707 $this->lng->txt("bookmarks_of") . " " . $this->ilias->account->getFullname());
708
709 if($deliver)
710 {
711 ilUtil::deliverData($html_content, 'bookmarks.html', "application/save", $charset = "");
712 }
713 else
714 {
715 return $html_content;
716 }
717 }
_exportBookmark($obj_ids, $recursive=true, $title='')
export bookmarks static method return html string
static deliverData($a_data, $a_filename, $mime="application/octet-stream", $charset="")
deliver data for download via browser.

References $_GET, $_POST, $id, ilBookmarkImportExport\_exportBookmark(), and ilUtil\deliverData().

Referenced by executeAction(), and sendmail().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_last()

ilBookmarkAdministrationGUI::get_last (   $a_var,
  $a_value 
)

get stored post var in case of an error/warning otherwise return passed value

Definition at line 501 of file class.ilBookmarkAdministrationGUI.php.

502 {
503 return (!empty($_POST[$a_var])) ?
504 ilUtil::prepareFormOutput(($_POST[$a_var]), true) :
505 ilUtil::prepareFormOutput($a_value);
506 }
Util class various functions, usage as namespace.
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms @access public

References $_POST, and ilUtil\prepareFormOutput().

Referenced by editFormBookmarkFolder().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getHTML()

ilBookmarkAdministrationGUI::getHTML ( )

Get Bookmark list for personal desktop.

Definition at line 922 of file class.ilBookmarkAdministrationGUI.php.

923 {
924 include_once("./Services/Bookmarks/classes/class.ilBookmarkBlockGUI.php");
925 $bookmark_block_gui = new ilBookmarkBlockGUI("ilpersonaldesktopgui", "show");
926
927 return $bookmark_block_gui->getHTML();
928 }
BlockGUI class for Bookmarks block.

◆ getMode()

ilBookmarkAdministrationGUI::getMode ( )

return display mode flat or tree

Definition at line 123 of file class.ilBookmarkAdministrationGUI.php.

124 {
125 return $this->mode;
126 }

Referenced by executeCommand().

+ Here is the caller graph for this function:

◆ ilBookmarkAdministrationGUI()

ilBookmarkAdministrationGUI::ilBookmarkAdministrationGUI ( )

Constructor @access public.

Parameters
integeruser_id (optional)

Definition at line 47 of file class.ilBookmarkAdministrationGUI.php.

48 {
49 global $ilias, $tpl, $lng, $ilCtrl, $ilUser;
50
51// $tpl->enableAdvancedColumnLayout(true, false);
52
53 $tpl->getStandardTemplate();
54
55 //print_r($_SESSION["error_post_vars"]);
56 // if no bookmark folder id is given, take dummy root node id (that is 1)
57 $this->id = (empty($_GET["bmf_id"]))
58 ? 1
59 : $_GET["bmf_id"];
60
61 // initiate variables
62 $this->ilias =& $ilias;
63 $this->tpl =& $tpl;
64 $this->lng =& $lng;
65 $this->ctrl =& $ilCtrl;
66 $this->ctrl->setParameter($this, "bmf_id", $this->id);
67 $this->user_id = $ilUser->getId();
68
69 $this->tree = new ilTree($this->user_id);
70 $this->tree->setTableNames('bookmark_tree', 'bookmark_data');
71 $this->root_id = $this->tree->readRootId();
72
73 $this->mode = "tree";
74 }

References $_GET, $ilCtrl, $ilias, $ilUser, $lng, and $tpl.

◆ importFile()

ilBookmarkAdministrationGUI::importFile ( )

imports a bookmark file into database display status information or report errors messages in case of error @access public

Definition at line 936 of file class.ilBookmarkAdministrationGUI.php.

937 {
938 if(!$this->tree->isInTree($this->id))
939 {
940 $this->ctrl->setParameter($this, 'bmf_id', '');
941 $this->ctrl->redirect($this);
942 }
943
944 if($_FILES["bkmfile"]["error"] > UPLOAD_ERR_OK)
945 {
946 ilUtil::sendFailure($this->lng->txt("import_file_not_valid"));
947 $this->newFormBookmark();
948 return;
949 }
950 require_once ("./Services/Bookmarks/classes/class.ilBookmarkImportExport.php");
951 $objects = ilBookmarkImportExport::_parseFile($_FILES["bkmfile"]['tmp_name']);
952 if($objects === false)
953 {
954 ilUtil::sendFailure($this->lng->txt("import_file_not_valid"));
955 $this->newFormBookmark();
956 return;
957 }
958 // holds the number of created objects
959 $num_create = array('bm'=> 0, 'bmf'=> 0);
960 $this->__importBookmarks($objects, $num_create, $this->id, 0);
961
962 ilUtil::sendSuccess(sprintf($this->lng->txt("bkm_import_ok"), $num_create['bm'],
963 $num_create['bmf']));
964 $this->view();
965
966
967 }
_parseFile($file)
parse Bookmark file static method returns 3 dimensional array of bookmarks and folders

References __importBookmarks(), ilBookmarkImportExport\_parseFile(), newFormBookmark(), ilUtil\sendFailure(), ilUtil\sendSuccess(), and view().

+ Here is the call graph for this function:

◆ initFormBookmark()

ilBookmarkAdministrationGUI::initFormBookmark (   $action = 'createBookmark')
private

init Bookmark create/edit form

Parameters
stringform action type; valid values: createBookmark, updateBookmark

Definition at line 375 of file class.ilBookmarkAdministrationGUI.php.

376 {
377 global $lng, $ilCtrl, $ilUser;
378
379 if(!$this->tree->isInTree($this->id))
380 {
381 $this->ctrl->setParameter($this, 'bmf_id', '');
382 $this->ctrl->redirect($this);
383 }
384
385 include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
386 $form = new ilPropertyFormGUI();
387 $form->setTopAnchor("bookmark_top");
388
389 $form->setTitle($lng->txt("bookmark_new"));
390
391 if($action == 'updateBookmark')
392 {
393 $ilCtrl->setParameter($this, 'bmf_id', $this->id);
394 $ilCtrl->setParameter($this, 'obj_id', $_GET["obj_id"]);
395 }
396
397 $hash = ($ilUser->prefs["screen_reader_optimization"])
398 ? "bookmark_top"
399 : "";
400
401 $form->setFormAction($ilCtrl->getFormAction($this, $action, $hash));
402 $ilCtrl->clearParameters($this);
403 // title
404 $prop = new ilTextInputGUI($lng->txt("title"), "title");
405 $prop->setValue($_GET['bm_title']);
406 $prop->setRequired(true);
407 $form->addItem($prop);
408
409 // description
410 $prop = new ilTextAreaInputGUI($lng->txt('description'), 'description');
411 $form->addItem($prop);
412
413 // target link
414 $prop = new ilTextInputGUI($lng->txt('bookmark_target'), 'target');
415 $prop->setValue($_GET['bm_link']);
416 $prop->setRequired(true);
417 $form->addItem($prop);
418
419 // hidden redirect field
420 if($_GET['return_to'])
421 {
422 $prop = new ilHiddenInputGUI('return_to');
423 $prop->setValue($_GET['return_to']);
424 $form->addItem($prop);
425
426 $prop = new ilHiddenInputGUI('return_to_url');
427 if($_GET['return_to_url'])
428 $prop->setValue($_GET['return_to_url']);
429 else
430 $prop->setValue($_GET['bm_link']);
431 $form->addItem($prop);
432 }
433
434 // buttons
435 $form->addCommandButton($action, $lng->txt('save'));
436 $form->addCommandButton('cancel', $lng->txt('cancel'));
437
438 // keep imports?
439 /*
440 $this->tpl->setCurrentBlock('bkm_import');
441 $this->tpl->setVariable("TXT_IMPORT_BKM", $this->lng->txt("bkm_import"));
442 $this->tpl->setVariable("TXT_FILE", $this->lng->txt("file_add"));
443 $this->tpl->setVariable("TXT_IMPORT", $this->lng->txt("import"));
444 $this->tpl->parseCurrentBlock();
445 //vd($_POST);
446 */
447
448 return $form;
449 }
This class represents a hidden form property in a property form.
This class represents a property form user interface.
This class represents a text area property in a property form.
This class represents a text property in a property form.

References $_GET, $ilCtrl, $ilUser, and $lng.

Referenced by editFormBookmark(), and newFormBookmark().

+ Here is the caller graph for this function:

◆ initFormBookmarkFolder()

ilBookmarkAdministrationGUI::initFormBookmarkFolder (   $action = 'createBookmarkFolder')
private

init bookmark folder create/edit form

Parameters
stringform action type; valid values: createBookmark, updateBookmark

Definition at line 304 of file class.ilBookmarkAdministrationGUI.php.

305 {
306 global $lng, $ilCtrl, $ilUser;
307
308 if(!$this->tree->isInTree($this->id))
309 {
310 $this->ctrl->setParameter($this, 'bmf_id', '');
311 $this->ctrl->redirect($this);
312 }
313
314 include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
315 $form = new ilPropertyFormGUI();
316 $form->setTopAnchor("bookmark_top");
317
318 $form->setTitle($lng->txt("bookmark_folder_new"));
319
320 if($action == 'updateBookmarkFolder')
321 {
322 $ilCtrl->setParameter($this, 'bmf_id', $this->id);
323 $ilCtrl->setParameter($this, 'obj_id', $_GET["obj_id"]);
324 }
325
326 $hash = ($ilUser->prefs["screen_reader_optimization"])
327 ? "bookmark_top"
328 : "";
329
330 $form->setFormAction($ilCtrl->getFormAction($this, $action, $hash));
331
332 $ilCtrl->clearParameters($this);
333
334 // title
335 $prop = new ilTextInputGUI($lng->txt("title"), "title");
336 $prop->setRequired(true);
337 $form->addItem($prop);
338
339 // buttons
340 $form->addCommandButton($action, $lng->txt('save'));
341 $form->addCommandButton('cancel', $lng->txt('cancel'));
342 return $form;
343 }

References $_GET, $ilCtrl, $ilUser, and $lng.

Referenced by editFormBookmarkFolder(), and newFormBookmarkFolder().

+ Here is the caller graph for this function:

◆ initImportBookmarksForm()

ilBookmarkAdministrationGUI::initImportBookmarksForm ( )
private

Init import bookmark form.

Definition at line 455 of file class.ilBookmarkAdministrationGUI.php.

456 {
457 global $lng, $ilCtrl, $ilUser;
458
459 if(!$this->tree->isInTree($this->id))
460 {
461 $this->ctrl->setParameter($this, 'bmf_id', '');
462 $this->ctrl->redirect($this);
463 }
464
465 include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
466 $form = new ilPropertyFormGUI();
467 $form->setFormAction($ilCtrl->getFormAction($this, "importFile")); // #16133
468 $form->setTopAnchor("bookmark_top");
469 $form->setTitle($lng->txt("bkm_import"));
470
471 $fi = new ilFileInputGUI($lng->txt("file_add"), "bkmfile");
472 $fi->setRequired(true);
473 $form->addItem($fi);
474
475 $form->addCommandButton("importFile", $lng->txt('import'));
476 $form->addCommandButton('cancel', $lng->txt('cancel'));
477
478 return $form;
479 }
This class represents a file property in a property form.

References $ilCtrl, $ilUser, and $lng.

Referenced by newFormBookmark().

+ Here is the caller graph for this function:

◆ move()

ilBookmarkAdministrationGUI::move ( )

Definition at line 1014 of file class.ilBookmarkAdministrationGUI.php.

1015 {
1016 global $ilUser, $ilTabs, $tpl;
1017
1018 $bm_ids = $_REQUEST['bm_id'];
1019 if(!$bm_ids && $_GET["bm_id_tgt"] == "")
1020 {
1021 ilUtil::sendFailure($this->lng->txt("no_checkbox"));
1022 return $this->view();
1023 }
1024
1025 $ilTabs->setBackTarget($this->lng->txt("back"), $this->ctrl->getLinkTarget($this));
1026
1027 $this->ctrl->setParameter($this, "bm_id_tgt", $_GET["bm_id_tgt"] ? $_GET["bm_id_tgt"] : implode(";", $bm_ids));
1028 ilUtil::sendInfo($this->lng->txt("bookmark_select_target"));
1029 include_once("./Services/Bookmarks/classes/class.ilBookmarkMoveExplorerGUI.php");
1030 $exp = new ilBookmarkMoveExplorerGUI($this, "move");
1031 if (!$exp->handleCommand())
1032 {
1033 $this->mode = "flat";
1034 $this->tpl->setContent($exp->getHTML());
1035 }
1036 }

References $_GET, $_REQUEST, $ilUser, $tpl, ilUtil\sendFailure(), ilUtil\sendInfo(), and view().

+ Here is the call graph for this function:

◆ newForm()

ilBookmarkAdministrationGUI::newForm (   $type)

new form

Definition at line 269 of file class.ilBookmarkAdministrationGUI.php.

270 {
271 if(!$type)
272 $type = $_POST["type"];
273 switch($type)
274 {
275 case "bmf":
276 $this->newFormBookmarkFolder();
277 break;
278
279 case "bm":
280 $this->newFormBookmark();
281 break;
282 }
283 }

References $_POST, newFormBookmark(), and newFormBookmarkFolder().

+ Here is the call graph for this function:

◆ newFormBookmark()

ilBookmarkAdministrationGUI::newFormBookmark ( )

display new bookmark form

Definition at line 484 of file class.ilBookmarkAdministrationGUI.php.

485 {
486 $form = $this->initFormBookmark();
487 $html1 = $form->getHTML();
488 $html2 = '';
489 if(!$_REQUEST["bm_link"])
490 {
491 $form2 = $this->initImportBookmarksForm();
492 $html2 = "<br />" . $form2->getHTML();
493 }
494 $this->tpl->setVariable("ADM_CONTENT", $html1 . $html2);
495 }
initImportBookmarksForm()
Init import bookmark form.

References $_REQUEST, initFormBookmark(), and initImportBookmarksForm().

Referenced by createBookmark(), importFile(), and newForm().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ newFormBookmarkFolder()

ilBookmarkAdministrationGUI::newFormBookmarkFolder ( )

display new bookmark folder form

Definition at line 288 of file class.ilBookmarkAdministrationGUI.php.

289 {
290 if(!$this->tree->isInTree($this->id))
291 {
292 $this->ctrl->setParameter($this, 'bmf_id', '');
293 $this->ctrl->redirect($this);
294 }
295
296 $form = $this->initFormBookmarkFolder();
297 $this->tpl->setVariable("ADM_CONTENT", $form->getHTML());
298 }

References initFormBookmarkFolder().

Referenced by createBookmarkFolder(), and newForm().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sendmail()

ilBookmarkAdministrationGUI::sendmail ( )

send bookmarks as attachment

Definition at line 722 of file class.ilBookmarkAdministrationGUI.php.

723 {
724 global $ilUser;
725 include_once './Services/Mail/classes/class.ilFileDataMail.php';
726 require_once "Services/Mail/classes/class.ilFormatMail.php";
727 $mfile = new ilFileDataMail($ilUser->getId());
728 $umail = new ilFormatMail($ilUser->getId());
729
730 $html_content = $this->export(false);
731 $tempfile = ilUtil::ilTempnam();
732 $fp = fopen($tempfile, 'w');
733 fwrite($fp, $html_content);
734 fclose($fp);
735 $filename = 'bookmarks.html';
736 $mfile->copyAttachmentFile($tempfile, $filename);
737 $umail->savePostData($ilUser->getId(), array($filename),
738 '', '', '', '', '',
739 '',
740 '', 0);
741
742 require_once 'Services/Mail/classes/class.ilMailFormCall.php';
743 ilUtil::redirect(ilMailFormCall::getRedirectTarget($this, '', array(), array('type' => 'attach')));
744 }
$filename
Definition: buildRTE.php:89
This class handles all operations on files (attachments) in directory ilias_data/mail.
Class UserMail this class handles user mails.
static getRedirectTarget($gui, $cmd, Array $gui_params=array(), Array $mail_params=array())
static ilTempnam()
Create a temporary file in an ILIAS writable directory.

References $filename, $ilUser, export(), ilMailFormCall\getRedirectTarget(), ilUtil\ilTempnam(), and ilUtil\redirect().

Referenced by executeAction().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showPossibleSubObjects()

ilBookmarkAdministrationGUI::showPossibleSubObjects ( )

display subobject addition selection

Definition at line 876 of file class.ilBookmarkAdministrationGUI.php.

877 {
878 $actions = array(
879 "delete" => $this->lng->txt("delete"),
880 "export" => $this->lng->txt("export"),
881 "sendmail"=> $this->lng->txt("bkm_sendmail"),
882 );
883
884 $subobj = array("bm", "bmf");
885
886 if(is_array($subobj))
887 {
888 //build form
889 $opts = ilUtil::formSelect("", "type", $subobj);
890
891 $this->tpl->setCurrentBlock("add_object");
892 $this->tpl->setVariable("COLUMN_COUNTS", 7);
893 $this->tpl->setVariable("SELECT_OBJTYPE", $opts);
894 $this->tpl->setVariable("BTN_NAME", "newForm");
895 $this->tpl->setVariable("TXT_ADD", $this->lng->txt("add"));
896 $this->tpl->parseCurrentBlock();
897 }
898
899 $this->tpl->setVariable("TPLPATH", $this->tpl->tplPath);
900
901 $this->tpl->setCurrentBlock("tbl_action_select");
902 $this->tpl->setVariable("SELECT_ACTION", ilUtil::formSelect($_SESSION["error_post_vars"]['action'], "action", $actions, false, true));
903 $this->tpl->setVariable("BTN_NAME", "executeAction");
904 $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("execute"));
905
906 /*
907 $this->tpl->setVariable("BTN_NAME","delete");
908 $this->tpl->setVariable("BTN_VALUE",$this->lng->txt("delete"));
909 $this->tpl->parseCurrentBlock();
910
911 $this->tpl->setVariable("BTN_NAME","export");
912 $this->tpl->setVariable("BTN_VALUE",$this->lng->txt("export"));
913 $this->tpl->parseCurrentBlock();
914 */
915 $this->tpl->parseCurrentBlock();
916
917 }
static formSelect($selected, $varname, $options, $multiple=false, $direct_text=false, $size="0", $style_class="", $attribs="", $disabled=false)
Builds a select form field with options and shows the selected option first.
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']

References $_SESSION, and ilUtil\formSelect().

+ Here is the call graph for this function:

◆ updateBookmark()

ilBookmarkAdministrationGUI::updateBookmark ( )

update bookmark in db

Definition at line 651 of file class.ilBookmarkAdministrationGUI.php.

652 {
653 if(!$this->tree->isInTree($_GET["obj_id"]))
654 {
655 $this->ctrl->setParameter($this, 'obj_id', '');
656 $this->ctrl->setParameter($this, 'bmf_id', '');
657 $this->ctrl->redirect($this);
658 }
659
660 // check title and target
661 if(empty($_POST["title"]))
662 {
663 ilUtil::sendFailure($this->lng->txt("please_enter_title"));
664 $this->editFormBookmark();
665 }
666 else if(empty($_POST["target"]))
667 {
668 ilUtil::sendFailure($this->lng->txt("please_enter_target"));
669 $this->editFormBookmark();
670 }
671 else
672 {
673 // update bookmark
674 $bm = new ilBookmark($_GET["obj_id"]);
675 $bm->setTitle(ilUtil::stripSlashes($_POST["title"]));
676 $bm->setTarget(ilUtil::stripSlashes($_POST["target"]));
677 $bm->setDescription(ilUtil::stripSlashes($_POST["description"]));
678 $bm->update();
679
680 $this->view();
681 }
682 }

References $_GET, $_POST, editFormBookmark(), ilUtil\sendFailure(), ilUtil\stripSlashes(), and view().

+ Here is the call graph for this function:

◆ updateBookmarkFolder()

ilBookmarkAdministrationGUI::updateBookmarkFolder ( )

update bookmark folder

Definition at line 573 of file class.ilBookmarkAdministrationGUI.php.

574 {
575 if(!$this->tree->isInTree($_GET["obj_id"]))
576 {
577 $this->ctrl->setParameter($this, 'obj_id', '');
578 $this->ctrl->setParameter($this, 'bmf_id', '');
579 $this->ctrl->redirect($this);
580 }
581
582 // check title
583 if(empty($_POST["title"]))
584 {
585 ilUtil::sendFailure($this->lng->txt("please_enter_title"));
586 $this->editFormBookmarkFolder();
587 }
588 else
589 {
590 // update bookmark folder
591 $bmf = new ilBookmarkFolder($_GET["obj_id"]);
592 $bmf->setTitle(ilUtil::stripSlashes($_POST["title"]));
593 $bmf->update();
594
595 global $ilCtrl;
596 $ilCtrl->saveParameter($this, 'bmf_id');
597 $ilCtrl->redirect($this, 'view');
598 }
599 }
editFormBookmarkFolder()
display edit bookmark folder form

References $_GET, $_POST, $ilCtrl, editFormBookmarkFolder(), ilUtil\sendFailure(), and ilUtil\stripSlashes().

+ Here is the call graph for this function:

◆ view()

ilBookmarkAdministrationGUI::view ( )

Definition at line 165 of file class.ilBookmarkAdministrationGUI.php.

166 {
167 global $ilToolbar;
168
169 if($this->id > 0 && !$this->tree->isInTree($this->id))
170 {
171 $this->ctrl->setParameter($this, 'bmf_id', '');
172 $this->ctrl->redirect($this);
173 }
174
175 $ilToolbar->addButton($this->lng->txt("bookmark_new"),
176 $this->ctrl->getLinkTarget($this, "newFormBookmark"));
177 $ilToolbar->addButton($this->lng->txt("bookmark_folder_new"),
178 $this->ctrl->getLinkTarget($this, "newFormBookmarkFolder"));
179
180 $objects = ilBookmarkFolder::getObjects($this->id);
181
182 include_once 'Services/Bookmarks/classes/class.ilBookmarkAdministrationTableGUI.php';
183 $table = new ilBookmarkAdministrationTableGUI($this);
184 $table->setId('bookmark_adm_table');
185 $table->setData($objects);
186 $this->tpl->setVariable("ADM_CONTENT", $table->getHTML());
187 }

References ilBookmarkFolder\getObjects().

Referenced by cancel(), confirm(), confirmedMove(), executeAction(), importFile(), move(), and updateBookmark().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $data

ilBookmarkAdministrationGUI::$data

Definition at line 39 of file class.ilBookmarkAdministrationGUI.php.

◆ $id

ilBookmarkAdministrationGUI::$id

Definition at line 38 of file class.ilBookmarkAdministrationGUI.php.

Referenced by confirm(), and export().

◆ $ilias

ilBookmarkAdministrationGUI::$ilias

Definition at line 33 of file class.ilBookmarkAdministrationGUI.php.

Referenced by ilBookmarkAdministrationGUI().

◆ $lng

◆ $textwidth

ilBookmarkAdministrationGUI::$textwidth = 100

Definition at line 40 of file class.ilBookmarkAdministrationGUI.php.

◆ $tpl

ilBookmarkAdministrationGUI::$tpl

◆ $tree

ilBookmarkAdministrationGUI::$tree

Definition at line 37 of file class.ilBookmarkAdministrationGUI.php.

Referenced by confirm(), and confirmedMove().

◆ $user_id

ilBookmarkAdministrationGUI::$user_id

Definition at line 26 of file class.ilBookmarkAdministrationGUI.php.


The documentation for this class was generated from the following file: