ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilBookmarkAdministrationGUI Class Reference

GUI class for personal bookmark administration. More...

+ Collaboration diagram for ilBookmarkAdministrationGUI:

Public Member Functions

 __construct ()
 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
 
 $tpl
 
 $lng
 
 $tree
 
 $id
 
 $data
 
 $textwidth = 100
 

Protected Attributes

 $ctrl
 
 $user
 
 $toolbar
 
 $error
 
 $tabs
 

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.

Constructor & Destructor Documentation

◆ __construct()

ilBookmarkAdministrationGUI::__construct ( )

Constructor @access public.

Parameters
integeruser_id (optional)

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

72 {
73 global $DIC;
74
75 $this->user = $DIC->user();
76 $this->toolbar = $DIC->toolbar();
77 $this->error = $DIC["ilErr"];
78 $this->tabs = $DIC->tabs();
79 $tpl = $DIC["tpl"];
80 $lng = $DIC->language();
81 $ilCtrl = $DIC->ctrl();
82 $ilUser = $DIC->user();
83
84 // $tpl->enableAdvancedColumnLayout(true, false);
85
86 $tpl->getStandardTemplate();
87
88 //print_r($_SESSION["error_post_vars"]);
89 // if no bookmark folder id is given, take dummy root node id (that is 1)
90 $this->id = (empty($_GET["bmf_id"]))
91 ? 1
92 : $_GET["bmf_id"];
93
94 // initiate variables
95 $this->tpl = $tpl;
96 $this->lng = $lng;
97 $this->ctrl = $ilCtrl;
98 $this->ctrl->setParameter($this, "bmf_id", $this->id);
99 $this->user_id = $ilUser->getId();
100
101 $this->tree = new ilTree($this->user_id);
102 $this->tree->setTableNames('bookmark_tree', 'bookmark_data');
103 $this->root_id = $this->tree->readRootId();
104
105 $this->lng->loadLanguageModule("bkm");
106
107 $this->mode = "tree";
108 }
user()
Definition: user.php:4
$_GET["client_id"]
error($a_errmsg)
set error message @access public
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
global $ilCtrl
Definition: ilias.php:18
global $DIC
Definition: saml.php:7
$ilUser
Definition: imgupload.php:18

References $_GET, $DIC, $ilCtrl, $ilUser, $lng, $tpl, error(), and user().

+ Here is the call graph for this function:

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 970 of file class.ilBookmarkAdministrationGUI.php.

971 {
972 if (is_array($objects[$start_key])) {
973 foreach ($objects[$start_key] as $obj_key=> $object) {
974 switch ($object['type']) {
975 case 'bm':
976 if (!$object["title"]) {
977 continue;
978 }
979 if (!$object["target"]) {
980 continue;
981 }
982 $bm = new ilBookmark();
983 $bm->setTitle($object["title"]);
984 $bm->setDescription($object["description"]);
985 $bm->setTarget($object["target"]);
986 $bm->setParent($folder_id);
987 $bm->create();
988 $num_create['bm']++;
989 break;
990 case 'bmf':
991 if (!$object["title"]) {
992 continue;
993 }
994 $bmf = new ilBookmarkFolder();
995 $bmf->setTitle($object["title"]);
996 $bmf->setParent($folder_id);
997 $bmf->create();
998 $num_create['bmf']++;
999 if (is_array($objects[$obj_key])) {
1000 $this->__importBookmarks(
1001 $objects,
1002 $num_create,
1003 $bmf->getId(),
1004 $obj_key
1005 );
1006 }
1007 break;
1008 }
1009 }
1010 }
1011 }
__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 224 of file class.ilBookmarkAdministrationGUI.php.

225 {
226 if (!empty($link)) {
227 $this->tpl->setCurrentBlock("begin_link");
228 $this->tpl->setVariable("LINK_TARGET", $link);
229 $this->tpl->parseCurrentBlock();
230 $this->tpl->touchBlock("end_link");
231 }
232
233 $this->tpl->setCurrentBlock("text");
234 $this->tpl->setVariable("TEXT_CONTENT", $val);
235 $this->tpl->parseCurrentBlock();
236 $this->tpl->setCurrentBlock("table_cell");
237 $this->tpl->parseCurrentBlock();
238 }

◆ cancel()

ilBookmarkAdministrationGUI::cancel ( )

cancel deletion,insert, update

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

References view().

+ Here is the call graph for this function:

◆ confirm()

ilBookmarkAdministrationGUI::confirm ( )

deletion confirmed -> delete folders / bookmarks

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

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

References $_POST, $error, $id, $ilErr, $type, ilBookmark\_getTypeOfId(), ilUtil\sendSuccess(), and view().

+ Here is the call graph for this function:

◆ confirmedMove()

ilBookmarkAdministrationGUI::confirmedMove ( )

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

1038 {
1040
1041 $tgt = (int) $_REQUEST["bmfmv_id"];
1042 $bm_ids = explode(";", $_REQUEST['bm_id_tgt']);
1043 if (!$bm_ids || !$tgt) {
1044 ilUtil::sendFailure($this->lng->txt("no_checkbox"));
1045 return $this->view();
1046 }
1047
1048 $tree = new ilTree($ilUser->getId());
1049 $tree->setTableNames('bookmark_tree', 'bookmark_data');
1050
1051 $tgt_node = $tree->getNodeData($tgt);
1052
1053 // sanity check
1054 foreach ($bm_ids as $node_id) {
1055 if ($tree->isGrandChild($node_id, $tgt)) {
1056 ilUtil::sendFailure($this->lng->txt("error"), true);
1057 $this->ctrl->redirect($this, "view");
1058 }
1059
1060 $node = $tree->getNodeData($node_id);
1061
1062 // already at correct position
1063 if ($node["parent"] == $tgt) {
1064 continue;
1065 }
1066
1067 $tree->moveTree($node_id, $tgt);
1068 }
1069
1070 ilUtil::sendSuccess($this->lng->txt("bookmark_moved_ok"), true);
1071 $this->ctrl->setParameter($this, "bmf_id", $tgt);
1072 $this->ctrl->redirect($this, "view");
1073 }
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.

References $ilUser, $tree, $user, 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 622 of file class.ilBookmarkAdministrationGUI.php.

623 {
626
627 if (!$this->tree->isInTree($this->id)) {
628 $this->ctrl->setParameter($this, 'bmf_id', '');
629 $this->ctrl->redirect($this);
630 }
631
632 // check title and target
633 if (empty($_POST["title"])) {
634 ilUtil::sendFailure($this->lng->txt("please_enter_title"));
635 $this->newFormBookmark();
636 } elseif (empty($_POST["target"])) {
637 ilUtil::sendFailure($this->lng->txt("please_enter_target"));
638 $this->newFormBookmark();
639 } else {
640 // create bookmark
641 $bm = new ilBookmark();
642 $bm->setTitle(ilUtil::stripSlashes($_POST["title"]));
643 $bm->setDescription(ilUtil::stripSlashes($_POST["description"]));
644 $bm->setTarget(ilUtil::stripSlashes($_POST["target"]));
645 $bm->setParent($this->id);
646 $bm->create();
647
648 ilUtil::sendInfo($lng->txt('bookmark_added'), true);
649
650 $ilCtrl->saveParameter($this, 'bmf_id');
651 $ilCtrl->redirect($this, 'view');
652 }
653 }
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.

References $_POST, $ctrl, $ilCtrl, $lng, newFormBookmark(), 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 564 of file class.ilBookmarkAdministrationGUI.php.

565 {
566 if (!$this->tree->isInTree($this->id)) {
567 $this->ctrl->setParameter($this, 'bmf_id', '');
568 $this->ctrl->redirect($this);
569 }
570
571 // check title
572 if (empty($_POST["title"])) {
573 ilUtil::sendFailure($this->lng->txt("please_enter_title"));
574 $this->newFormBookmarkFolder();
575 } else {
576 // create bookmark folder
577 $bmf = new ilBookmarkFolder();
578 $bmf->setTitle(ilUtil::stripSlashes($_POST["title"]));
579 $bmf->setParent($this->id);
580 $bmf->create();
581
582 ilUtil::sendSuccess($this->lng->txt("bkm_fold_created"), true);
583
585 $ilCtrl->saveParameter($this, 'bmf_id');
586 $ilCtrl->redirect($this, 'view');
587 }
588 }
newFormBookmarkFolder()
display new bookmark folder form

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

+ Here is the call graph for this function:

◆ delete()

ilBookmarkAdministrationGUI::delete ( )

display deletion conformation screen

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

759 {
761
762 $bm_ids = $_GET['bm_id'] ? array($_GET['bm_id']) : $_POST['bm_id'];
763 if (!$bm_ids) {
764 $ilErr->raiseError($this->lng->txt("no_checkbox"), $ilErr->MESSAGE);
765 }
766
767 $this->ctrl->setParameter($this, "bmf_id", $this->id);
768
769 // display confirmation message
770 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
771 $cgui = new ilConfirmationGUI();
772 $cgui->setFormAction($this->ctrl->getFormAction($this));
773 $cgui->setHeaderText($this->lng->txt("info_delete_sure"));
774 $cgui->setCancel($this->lng->txt("cancel"), "cancel");
775 $cgui->setConfirm($this->lng->txt("confirm"), "confirm");
776
777 foreach ($bm_ids as $obj_id) {
779
780 if (!$this->tree->isInTree($obj_id)) {
781 continue;
782 }
783
784 switch ($type) {
785 case "bmf":
786 $BookmarkFolder = new ilBookmarkFolder($obj_id);
787 $title = $BookmarkFolder->getTitle();
788 $target = "";
789 unset($BookmarkFolder);
790 break;
791
792 case "bm":
793 $Bookmark = new ilBookmark($obj_id);
794 $title = $Bookmark->getTitle();
795 $target = $Bookmark->getTarget();
796 unset($Bookmark);
797 break;
798 }
799
800 $caption = ilUtil::getImageTagByType($type, $this->tpl->tplPath) .
801 " " . $title;
802 if ($target) {
803 $caption .= " (" . ilUtil::shortenText($target, $this->textwidth, true) . ")";
804 }
805
806 $cgui->addItem("id[]", $obj_id, $caption);
807 }
808
809 $this->tpl->setContent($cgui->getHTML());
810 }
Confirmation screen class.
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...
static shortenText( $a_str, $a_len, $a_dots=false, $a_next_blank=false, $a_keep_extension=false)
shorten a string to given length.

References $_GET, $_POST, $error, $ilErr, $target, $title, $type, 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 177 of file class.ilBookmarkAdministrationGUI.php.

178 {
179 // output locator
180 $this->displayLocator();
181
182 // output message
183 if ($this->message) {
184 ilUtil::sendInfo($this->message);
185 }
187
188 $this->tpl->setTitle($this->lng->txt("bookmarks"));
189 }
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 243 of file class.ilBookmarkAdministrationGUI.php.

244 {
246
247 if (empty($this->id)) {
248 return;
249 }
250
251 if (!$this->tree->isInTree($this->id)) {
252 return;
253 }
254
255 $this->tpl->addBlockFile("LOCATOR", "locator", "tpl.locator.html", "Services/Locator");
256
257 $path = $this->tree->getPathFull($this->id);
258 //print_r($path);
259 $modifier = 1;
260
261 return;
262 $this->tpl->setVariable("TXT_LOCATOR", $this->lng->txt("locator"));
263 $this->tpl->touchBlock("locator_separator");
264 $this->tpl->touchBlock("locator_item");
265 //$this->tpl->setCurrentBlock("locator_item");
266 //$this->tpl->setVariable("ITEM", $this->lng->txt("personal_desktop"));
267 //$this->tpl->setVariable("LINK_ITEM", $this->ctrl->getLinkTargetByClass("ilpersonaldesktopgui"));
268 //$this->tpl->setVariable("LINK_TARGET","target=\"".
269 // ilFrameTargetInfo::_getFrame("MainContent")."\"");
270 //$this->tpl->parseCurrentBlock();
271
272 foreach ($path as $key => $row) {
273 if ($key < count($path) - $modifier) {
274 $this->tpl->touchBlock("locator_separator");
275 }
276
277 $this->tpl->setCurrentBlock("locator_item");
278 $title = ($row["child"] == 1) ?
279 $lng->txt("bookmarks") :
280 $row["title"];
281 $this->tpl->setVariable("ITEM", $title);
282 $this->ctrl->setParameter($this, "bmf_id", $row["child"]);
283 $this->tpl->setVariable(
284 "LINK_ITEM",
285 $this->ctrl->getLinkTarget($this)
286 );
287 $this->tpl->parseCurrentBlock();
288 }
289
290 $this->tpl->setCurrentBlock("locator");
291
292 $this->tpl->parseCurrentBlock();
293 }
$key
Definition: croninfo.php:18

References $key, $lng, $path, $row, and $title.

Referenced by displayHeader().

+ Here is the caller graph for this function:

◆ editFormBookmark()

ilBookmarkAdministrationGUI::editFormBookmark ( )

display edit bookmark form

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

537 {
540
541 if (!$this->tree->isInTree($_GET["obj_id"])) {
542 $this->ctrl->setParameter($this, 'obj_id', '');
543 $this->ctrl->setParameter($this, 'bmf_id', '');
544 $this->ctrl->redirect($this);
545 }
546
547 $form = $this->initFormBookmark('updateBookmark');
548 $bookmark = new ilBookmark($_GET["obj_id"]);
549 $form->setValuesByArray(
550 array(
551 "title" => $bookmark->getTitle(),
552 "target" => $bookmark->getTarget(),
553 "description" => $bookmark->getDescription(),
554 "obj_id" => $_GET["obj_id"],
555 )
556 );
557 $this->tpl->setVariable("ADM_CONTENT", $form->getHTML());
558 }
initFormBookmark($action='createBookmark')
init Bookmark create/edit form
if(isset($_POST['submit'])) $form

References $_GET, $ctrl, $form, $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 376 of file class.ilBookmarkAdministrationGUI.php.

377 {
378 if (!$this->tree->isInTree($_GET["obj_id"])) {
379 $this->ctrl->setParameter($this, 'bmf_id', '');
380 $this->ctrl->setParameter($this, 'obj_id', '');
381 $this->ctrl->redirect($this);
382 }
383
384 $bmf = new ilBookmarkFolder($_GET["obj_id"]);
385 $form = $this->initFormBookmarkFolder('updateBookmarkFolder', $this->id);
386 $form->setValuesByArray(
387 array(
388 "title" => $this->get_last("title", $bmf->getTitle()),
389 "obj_id" => $_GET["obj_id"],
390 )
391 );
392 $this->tpl->setVariable("ADM_CONTENT", $form->getHTML());
393 }
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, $form, 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 131 of file class.ilBookmarkAdministrationGUI.php.

132 {
133 switch ($_POST["selected_cmd"]) {
134 case "delete":
135 $this->delete();
136 break;
137 case "export":
138 $this->export();
139 break;
140 case "sendmail":
141 $this->sendmail();
142 break;
143 default:
144 $this->view();
145 break;
146 }
147 return true;
148 }

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

+ Here is the call graph for this function:

◆ executeCommand()

ilBookmarkAdministrationGUI::executeCommand ( )

execute command

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

114 {
115 $next_class = $this->ctrl->getNextClass();
116
117 switch ($next_class) {
118 default:
119 $cmd = $this->ctrl->getCmd("view");
120 $this->displayHeader();
121 $this->$cmd();
122 if ($this->getMode() == 'tree') {
123 $this->explorer();
124 }
125 break;
126 }
127 $this->tpl->show(true);
128 return true;
129 }
explorer()
output explorer tree with bookmark folders
getMode()
return display mode flat or tree

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

+ Here is the call graph for this function:

◆ explorer()

ilBookmarkAdministrationGUI::explorer ( )

output explorer tree with bookmark folders

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

163 {
165
166 include_once("./Services/Bookmarks/classes/class.ilBookmarkExplorerGUI.php");
167 $exp = new ilBookmarkExplorerGUI($this, "explorer");
168 if (!$exp->handleCommand()) {
169 $tpl->setLeftNavContent($exp->getHTML());
170 }
171 }
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 688 of file class.ilBookmarkAdministrationGUI.php.

689 {
692
693 $bm_ids = $_GET['bm_id'] ? array($_GET['bm_id']) : $_POST['bm_id'];
694 if (!$bm_ids) {
695 $ilErr->raiseError($this->lng->txt("no_checkbox"), $ilErr->MESSAGE);
696 }
697 $export_ids = array();
698 foreach ($bm_ids as $id) {
699 if ($this->tree->isInTree($id)) {
700 //list($type, $obj_id) = explode(":", $id);
701 //$export_ids[]=$obj_id;
702 $export_ids[] = $id;
703 }
704 }
705
706 require_once("./Services/Bookmarks/classes/class.ilBookmarkImportExport.php");
708 $export_ids,
709 true,
710 $this->lng->txt("bookmarks_of") . " " . $ilUser->getFullname()
711 );
712
713 if ($deliver) {
714 ilUtil::deliverData($html_content, 'bookmarks.html', "application/save", $charset = "");
715 } else {
716 return $html_content;
717 }
718 }
static _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, $error, $id, $ilErr, $ilUser, $user, 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 526 of file class.ilBookmarkAdministrationGUI.php.

527 {
528 return (!empty($_POST[$a_var])) ?
529 ilUtil::prepareFormOutput(($_POST[$a_var]), true) :
530 ilUtil::prepareFormOutput($a_value);
531 }
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 917 of file class.ilBookmarkAdministrationGUI.php.

918 {
919 include_once("./Services/Bookmarks/classes/class.ilBookmarkBlockGUI.php");
920 $bookmark_block_gui = new ilBookmarkBlockGUI("ilpersonaldesktopgui", "show");
921
922 return $bookmark_block_gui->getHTML();
923 }
BlockGUI class for Bookmarks block.

◆ getMode()

ilBookmarkAdministrationGUI::getMode ( )

return display mode flat or tree

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

155 {
156 return $this->mode;
157 }

Referenced by executeCommand().

+ Here is the caller graph for this function:

◆ 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 931 of file class.ilBookmarkAdministrationGUI.php.

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

References __importBookmarks(), ilBookmarkImportExport\_parseFile(), newFormBookmark(), ilUtil\sendFailure(), ilUtil\sendSuccess(), sprintf, 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 400 of file class.ilBookmarkAdministrationGUI.php.

401 {
405
406 if (!$this->tree->isInTree($this->id)) {
407 $this->ctrl->setParameter($this, 'bmf_id', '');
408 $this->ctrl->redirect($this);
409 }
410
411 include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
412 $form = new ilPropertyFormGUI();
413 $form->setTopAnchor("bookmark_top");
414
415 $form->setTitle($lng->txt("bookmark_new"));
416
417 if ($action == 'updateBookmark') {
418 $ilCtrl->setParameter($this, 'bmf_id', $this->id);
419 $ilCtrl->setParameter($this, 'obj_id', $_GET["obj_id"]);
420 }
421
422 $hash = ($ilUser->prefs["screen_reader_optimization"])
423 ? "bookmark_top"
424 : "";
425
426 $form->setFormAction($ilCtrl->getFormAction($this, $action, $hash));
427 $ilCtrl->clearParameters($this);
428 // title
429 $prop = new ilTextInputGUI($lng->txt("title"), "title");
430 $prop->setValue($_GET['bm_title']);
431 $prop->setRequired(true);
432 $form->addItem($prop);
433
434 // description
435 $prop = new ilTextAreaInputGUI($lng->txt('description'), 'description');
436 $form->addItem($prop);
437
438 // target link
439 $prop = new ilTextInputGUI($lng->txt('bookmark_target'), 'target');
440 $prop->setValue($_GET['bm_link']);
441 $prop->setRequired(true);
442 $form->addItem($prop);
443
444 // hidden redirect field
445 if ($_GET['return_to']) {
446 $prop = new ilHiddenInputGUI('return_to');
447 $prop->setValue($_GET['return_to']);
448 $form->addItem($prop);
449
450 $prop = new ilHiddenInputGUI('return_to_url');
451 if ($_GET['return_to_url']) {
452 $prop->setValue($_GET['return_to_url']);
453 } else {
454 $prop->setValue($_GET['bm_link']);
455 }
456 $form->addItem($prop);
457 }
458
459 // buttons
460 $form->addCommandButton($action, $lng->txt('save'));
461 $form->addCommandButton('cancel', $lng->txt('cancel'));
462
463 // keep imports?
464 /*
465 $this->tpl->setCurrentBlock('bkm_import');
466 $this->tpl->setVariable("TXT_IMPORT_BKM", $this->lng->txt("bkm_import"));
467 $this->tpl->setVariable("TXT_FILE", $this->lng->txt("file_add"));
468 $this->tpl->setVariable("TXT_IMPORT", $this->lng->txt("import"));
469 $this->tpl->parseCurrentBlock();
470 //vd($_POST);
471 */
472
473 return $form;
474 }
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.
$action

References $_GET, $action, $ctrl, $form, $ilCtrl, $ilUser, $lng, and $user.

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 332 of file class.ilBookmarkAdministrationGUI.php.

333 {
337
338 if (!$this->tree->isInTree($this->id)) {
339 $this->ctrl->setParameter($this, 'bmf_id', '');
340 $this->ctrl->redirect($this);
341 }
342
343 include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
344 $form = new ilPropertyFormGUI();
345 $form->setTopAnchor("bookmark_top");
346
347 $form->setTitle($lng->txt("bookmark_folder_new"));
348
349 if ($action == 'updateBookmarkFolder') {
350 $ilCtrl->setParameter($this, 'bmf_id', $this->id);
351 $ilCtrl->setParameter($this, 'obj_id', $_GET["obj_id"]);
352 }
353
354 $hash = ($ilUser->prefs["screen_reader_optimization"])
355 ? "bookmark_top"
356 : "";
357
358 $form->setFormAction($ilCtrl->getFormAction($this, $action, $hash));
359
360 $ilCtrl->clearParameters($this);
361
362 // title
363 $prop = new ilTextInputGUI($lng->txt("title"), "title");
364 $prop->setRequired(true);
365 $form->addItem($prop);
366
367 // buttons
368 $form->addCommandButton($action, $lng->txt('save'));
369 $form->addCommandButton('cancel', $lng->txt('cancel'));
370 return $form;
371 }

References $_GET, $action, $ctrl, $form, $ilCtrl, $ilUser, $lng, and $user.

Referenced by editFormBookmarkFolder(), and newFormBookmarkFolder().

+ Here is the caller graph for this function:

◆ initImportBookmarksForm()

ilBookmarkAdministrationGUI::initImportBookmarksForm ( )
private

Init import bookmark form.

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

481 {
485
486 if (!$this->tree->isInTree($this->id)) {
487 $this->ctrl->setParameter($this, 'bmf_id', '');
488 $this->ctrl->redirect($this);
489 }
490
491 include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
492 $form = new ilPropertyFormGUI();
493 $form->setFormAction($ilCtrl->getFormAction($this, "importFile")); // #16133
494 $form->setTopAnchor("bookmark_top");
495 $form->setTitle($lng->txt("bkm_import"));
496
497 $fi = new ilFileInputGUI($lng->txt("file_add"), "bkmfile");
498 $fi->setRequired(true);
499 $form->addItem($fi);
500
501 $form->addCommandButton("importFile", $lng->txt('import'));
502 $form->addCommandButton('cancel', $lng->txt('cancel'));
503
504 return $form;
505 }
This class represents a file property in a property form.

References $ctrl, $form, $ilCtrl, $ilUser, $lng, and $user.

Referenced by newFormBookmark().

+ Here is the caller graph for this function:

◆ move()

ilBookmarkAdministrationGUI::move ( )

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

1014 {
1016 $ilTabs = $this->tabs;
1017 $tpl = $this->tpl;
1018
1019 $bm_ids = $_REQUEST['bm_id'];
1020 if (!$bm_ids && $_GET["bm_id_tgt"] == "") {
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 $this->mode = "flat";
1033 $this->tpl->setContent($exp->getHTML());
1034 }
1035 }

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

+ Here is the call graph for this function:

◆ newForm()

ilBookmarkAdministrationGUI::newForm (   $type)

new form

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

299 {
300 if (!$type) {
301 $type = $_POST["type"];
302 }
303 switch ($type) {
304 case "bmf":
305 $this->newFormBookmarkFolder();
306 break;
307
308 case "bm":
309 $this->newFormBookmark();
310 break;
311 }
312 }

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

+ Here is the call graph for this function:

◆ newFormBookmark()

ilBookmarkAdministrationGUI::newFormBookmark ( )

display new bookmark form

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

511 {
512 $form = $this->initFormBookmark();
513 $html1 = $form->getHTML();
514 $html2 = '';
515 if (!$_REQUEST["bm_link"]) {
516 $form2 = $this->initImportBookmarksForm();
517 $html2 = "<br />" . $form2->getHTML();
518 }
519 $this->tpl->setVariable("ADM_CONTENT", $html1 . $html2);
520 }
$html1
Definition: 42richText.php:58
$html2
Definition: 42richText.php:71
initImportBookmarksForm()
Init import bookmark form.

References $form, $html1, $html2, 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 317 of file class.ilBookmarkAdministrationGUI.php.

318 {
319 if (!$this->tree->isInTree($this->id)) {
320 $this->ctrl->setParameter($this, 'bmf_id', '');
321 $this->ctrl->redirect($this);
322 }
323
324 $form = $this->initFormBookmarkFolder();
325 $this->tpl->setVariable("ADM_CONTENT", $form->getHTML());
326 }

References $form, and 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 723 of file class.ilBookmarkAdministrationGUI.php.

724 {
726 include_once './Services/Mail/classes/class.ilFileDataMail.php';
727 require_once "Services/Mail/classes/class.ilFormatMail.php";
728 $mfile = new ilFileDataMail($ilUser->getId());
729 $umail = new ilFormatMail($ilUser->getId());
730
731 $html_content = $this->export(false);
732 $tempfile = ilUtil::ilTempnam();
733 $fp = fopen($tempfile, 'w');
734 fwrite($fp, $html_content);
735 fclose($fp);
736 $filename = 'bookmarks.html';
737 $mfile->copyAttachmentFile($tempfile, $filename);
738 $umail->savePostData(
739 $ilUser->getId(),
740 array($filename),
741 '',
742 '',
743 '',
744 '',
745 '',
746 '',
747 '',
748 0
749 );
750
751 require_once 'Services/Mail/classes/class.ilMailFormCall.php';
752 ilUtil::redirect(ilMailFormCall::getRedirectTarget($this, '', array(), array('type' => 'attach')));
753 }
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(), array $context_params=array())
static redirect($a_script)
static ilTempnam($a_temp_path=null)
Create a temporary file in an ILIAS writable directory.

References $filename, $ilUser, $user, 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 873 of file class.ilBookmarkAdministrationGUI.php.

874 {
875 $actions = array(
876 "delete" => $this->lng->txt("delete"),
877 "export" => $this->lng->txt("export"),
878 "sendmail"=> $this->lng->txt("bkm_sendmail"),
879 );
880
881 $subobj = array("bm", "bmf");
882
883 if (is_array($subobj)) {
884 //build form
885 $opts = ilUtil::formSelect("", "type", $subobj);
886
887 $this->tpl->setCurrentBlock("add_object");
888 $this->tpl->setVariable("COLUMN_COUNTS", 7);
889 $this->tpl->setVariable("SELECT_OBJTYPE", $opts);
890 $this->tpl->setVariable("BTN_NAME", "newForm");
891 $this->tpl->setVariable("TXT_ADD", $this->lng->txt("add"));
892 $this->tpl->parseCurrentBlock();
893 }
894
895 $this->tpl->setVariable("TPLPATH", $this->tpl->tplPath);
896
897 $this->tpl->setCurrentBlock("tbl_action_select");
898 $this->tpl->setVariable("SELECT_ACTION", ilUtil::formSelect($_SESSION["error_post_vars"]['action'], "action", $actions, false, true));
899 $this->tpl->setVariable("BTN_NAME", "executeAction");
900 $this->tpl->setVariable("BTN_VALUE", $this->lng->txt("execute"));
901
902 /*
903 $this->tpl->setVariable("BTN_NAME","delete");
904 $this->tpl->setVariable("BTN_VALUE",$this->lng->txt("delete"));
905 $this->tpl->parseCurrentBlock();
906
907 $this->tpl->setVariable("BTN_NAME","export");
908 $this->tpl->setVariable("BTN_VALUE",$this->lng->txt("export"));
909 $this->tpl->parseCurrentBlock();
910 */
911 $this->tpl->parseCurrentBlock();
912 }
$_SESSION["AccountId"]
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.

References $_SESSION, and ilUtil\formSelect().

+ Here is the call graph for this function:

◆ updateBookmark()

ilBookmarkAdministrationGUI::updateBookmark ( )

update bookmark in db

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

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

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 594 of file class.ilBookmarkAdministrationGUI.php.

595 {
596 if (!$this->tree->isInTree($_GET["obj_id"])) {
597 $this->ctrl->setParameter($this, 'obj_id', '');
598 $this->ctrl->setParameter($this, 'bmf_id', '');
599 $this->ctrl->redirect($this);
600 }
601
602 // check title
603 if (empty($_POST["title"])) {
604 ilUtil::sendFailure($this->lng->txt("please_enter_title"));
605 $this->editFormBookmarkFolder();
606 } else {
607 // update bookmark folder
608 $bmf = new ilBookmarkFolder($_GET["obj_id"]);
609 $bmf->setTitle(ilUtil::stripSlashes($_POST["title"]));
610 $bmf->update();
611
613 $ilCtrl->saveParameter($this, 'bmf_id');
614 $ilCtrl->redirect($this, 'view');
615 }
616 }
editFormBookmarkFolder()
display edit bookmark folder form

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

+ Here is the call graph for this function:

◆ view()

ilBookmarkAdministrationGUI::view ( )

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

195 {
196 $ilToolbar = $this->toolbar;
197
198 if ($this->id > 0 && !$this->tree->isInTree($this->id)) {
199 $this->ctrl->setParameter($this, 'bmf_id', '');
200 $this->ctrl->redirect($this);
201 }
202
203 $ilToolbar->addButton(
204 $this->lng->txt("bookmark_new"),
205 $this->ctrl->getLinkTarget($this, "newFormBookmark")
206 );
207 $ilToolbar->addButton(
208 $this->lng->txt("bookmark_folder_new"),
209 $this->ctrl->getLinkTarget($this, "newFormBookmarkFolder")
210 );
211
212 $objects = ilBookmarkFolder::getObjects($this->id);
213
214 include_once 'Services/Bookmarks/classes/class.ilBookmarkAdministrationTableGUI.php';
216 $table->setId('bookmark_adm_table');
217 $table->setData($objects);
218 $this->tpl->setVariable("ADM_CONTENT", $table->getHTML());
219 }
static getObjects($a_id)
static
if(empty($password)) $table
Definition: pwgen.php:24

References $table, $toolbar, and 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

◆ $ctrl

◆ $data

ilBookmarkAdministrationGUI::$data

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

◆ $error

ilBookmarkAdministrationGUI::$error
protected

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

Referenced by confirm(), delete(), and export().

◆ $id

ilBookmarkAdministrationGUI::$id

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

Referenced by confirm(), and export().

◆ $lng

◆ $tabs

ilBookmarkAdministrationGUI::$tabs
protected

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

Referenced by move().

◆ $textwidth

ilBookmarkAdministrationGUI::$textwidth = 100

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

◆ $toolbar

ilBookmarkAdministrationGUI::$toolbar
protected

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

Referenced by view().

◆ $tpl

ilBookmarkAdministrationGUI::$tpl

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

Referenced by __construct(), explorer(), and move().

◆ $tree

ilBookmarkAdministrationGUI::$tree

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

Referenced by confirmedMove().

◆ $user

ilBookmarkAdministrationGUI::$user
protected

◆ $user_id

ilBookmarkAdministrationGUI::$user_id

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


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