ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilBookmarkAdministrationGUI Class Reference

GUI class for personal bookmark administration. More...

+ Collaboration diagram for ilBookmarkAdministrationGUI:

Public Member Functions

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

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:
class.ilBookmarkAdministrationGUI.php 59684 2015-06-30 13:41:14Z gitmgr

ilBookmarkAdministrationGUI:

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

Member Function Documentation

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 private

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

Referenced by importFile().

{
if(is_array($objects[$start_key]))
{
foreach($objects[$start_key] as $obj_key=> $object)
{
switch($object['type'])
{
case 'bm':
if(!$object["title"]) continue;
if(!$object["target"]) continue;
$bm = new ilBookmark();
$bm->setTitle($object["title"]);
$bm->setDescription($object["description"]);
$bm->setTarget($object["target"]);
$bm->setParent($folder_id);
$bm->create();
$num_create['bm']++;
break;
case 'bmf':
if(!$object["title"]) continue;
$bmf = new ilBookmarkFolder();
$bmf->setTitle($object["title"]);
$bmf->setParent($folder_id);
$bmf->create();
$num_create['bmf']++;
if(is_array($objects[$obj_key]))
{
$this->__importBookmarks($objects, $num_create,
$bmf->getId(), $obj_key);
}
break;
}
}
}
}

+ Here is the caller graph for this function:

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

output a cell in object list

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

{
if(!empty($link))
{
$this->tpl->setCurrentBlock("begin_link");
$this->tpl->setVariable("LINK_TARGET", $link);
$this->tpl->parseCurrentBlock();
$this->tpl->touchBlock("end_link");
}
$this->tpl->setCurrentBlock("text");
$this->tpl->setVariable("TEXT_CONTENT", $val);
$this->tpl->parseCurrentBlock();
$this->tpl->setCurrentBlock("table_cell");
$this->tpl->parseCurrentBlock();
}
ilBookmarkAdministrationGUI::cancel ( )

cancel deletion,insert, update

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

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

{
if($_POST['return_to'])
ilUtil::redirect($_POST['return_to_url']);
else
$this->view();
}

+ Here is the call graph for this function:

ilBookmarkAdministrationGUI::confirm ( )

deletion confirmed -> delete folders / bookmarks

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

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

{
global $tree, $rbacsystem, $rbacadmin;
// AT LEAST ONE OBJECT HAS TO BE CHOSEN.
if(!$_POST["id"])
{
$this->ilias->raiseError($this->lng->txt("no_checkbox"), $this->ilias->error_obj->MESSAGE);
}
// FOR ALL SELECTED OBJECTS
foreach($_POST["id"] as $id)
{
// get node data and subtree nodes
if($this->tree->isInTree($id))
{
$node_data = $this->tree->getNodeData($id);
$subtree_nodes = $this->tree->getSubTree($node_data);
}
else
{
continue;
}
// delete tree
$this->tree->deleteTree($node_data);
// delete objects of subtree nodes
foreach($subtree_nodes as $node)
{
switch($node["type"])
{
case "bmf":
$BookmarkFolder = new ilBookmarkFolder($node["obj_id"]);
$BookmarkFolder->delete();
break;
case "bm":
$Bookmark = new ilBookmark($node["obj_id"]);
$Bookmark->delete();
break;
}
}
}
// Feedback
ilUtil::sendSuccess($this->lng->txt("info_deleted"), true);
$this->view();
}

+ Here is the call graph for this function:

ilBookmarkAdministrationGUI::confirmedMove ( )

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

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

{
global $ilUser;
$tgt = (int)$_REQUEST["bmfmv_id"];
$bm_ids = explode(";", $_REQUEST['bm_id_tgt']);
if(!$bm_ids || !$tgt)
{
ilUtil::sendFailure($this->lng->txt("no_checkbox"));
return $this->view();
}
$tree = new ilTree($ilUser->getId());
$tree->setTableNames('bookmark_tree', 'bookmark_data');
$tgt_node = $tree->getNodeData($tgt);
// sanity check
foreach($bm_ids as $node_id)
{
if($tree->isGrandChild($node_id, $tgt))
{
ilUtil::sendFailure($this->lng->txt("error"), true);
$this->ctrl->redirect($this, "view");
}
$node = $tree->getNodeData($node_id);
// already at correct position
if($node["parent"] == $tgt)
{
continue;
}
$tree->moveTree($node_id, $tgt);
}
ilUtil::sendSuccess($this->lng->txt("bookmark_moved_ok"), true);
$this->ctrl->setParameter($this, "bmf_id", $tgt);
$this->ctrl->redirect($this, "view");
}

+ Here is the call graph for this function:

ilBookmarkAdministrationGUI::createBookmark ( )

create new bookmark in db

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

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

{
global $lng, $ilCtrl;
if(!$this->tree->isInTree($this->id))
{
$this->ctrl->setParameter($this, 'bmf_id', '');
$this->ctrl->redirect($this);
}
// check title and target
if(empty($_POST["title"]))
{
ilUtil::sendFailure($this->lng->txt("please_enter_title"));
$this->newFormBookmark();
}
else if(empty($_POST["target"]))
{
ilUtil::sendFailure($this->lng->txt("please_enter_target"));
$this->newFormBookmark();
}
else
{
// create bookmark
$bm = new ilBookmark();
$bm->setTitle(ilUtil::stripSlashes($_POST["title"]));
$bm->setDescription(ilUtil::stripSlashes($_POST["description"]));
$bm->setTarget(ilUtil::stripSlashes($_POST["target"]));
$bm->setParent($this->id);
$bm->create();
ilUtil::sendInfo($lng->txt('bookmark_added'), true);
if($_POST['return_to'])
ilUtil::redirect($_POST['return_to_url']);
else
{
$ilCtrl->saveParameter($this, 'bmf_id');
$ilCtrl->redirect($this, 'view');
}
}
}

+ Here is the call graph for this function:

ilBookmarkAdministrationGUI::createBookmarkFolder ( )

create new bookmark folder in db

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

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

{
if(!$this->tree->isInTree($this->id))
{
$this->ctrl->setParameter($this, 'bmf_id', '');
$this->ctrl->redirect($this);
}
// check title
if(empty($_POST["title"]))
{
ilUtil::sendFailure($this->lng->txt("please_enter_title"));
}
else
{
// create bookmark folder
$bmf = new ilBookmarkFolder();
$bmf->setTitle(ilUtil::stripSlashes($_POST["title"]));
$bmf->setParent($this->id);
$bmf->create();
global $ilCtrl;
$ilCtrl->saveParameter($this, 'bmf_id');
$ilCtrl->redirect($this, 'view');
}
}

+ Here is the call graph for this function:

ilBookmarkAdministrationGUI::delete ( )

display deletion conformation screen

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

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

{
$bm_ids = $_GET['bm_id'] ? array($_GET['bm_id']) : $_POST['bm_id'];
if(!$bm_ids)
{
$this->ilias->raiseError($this->lng->txt("no_checkbox"), $this->ilias->error_obj->MESSAGE);
}
$this->ctrl->setParameter($this, "bmf_id", $this->id);
// display confirmation message
include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
$cgui = new ilConfirmationGUI();
$cgui->setFormAction($this->ctrl->getFormAction($this));
$cgui->setHeaderText($this->lng->txt("info_delete_sure"));
$cgui->setCancel($this->lng->txt("cancel"), "cancel");
$cgui->setConfirm($this->lng->txt("confirm"), "confirm");
foreach($bm_ids as $obj_id)
{
$type = ilBookmark::_getTypeOfId($obj_id);
if(!$this->tree->isInTree($obj_id))
{
continue;
}
switch($type)
{
case "bmf":
$BookmarkFolder = new ilBookmarkFolder($obj_id);
$title = $BookmarkFolder->getTitle();
$target = "";
unset($BookmarkFolder);
break;
case "bm":
$Bookmark = new ilBookmark($obj_id);
$title = $Bookmark->getTitle();
$target = $Bookmark->getTarget();
unset($Bookmark);
break;
}
$caption = ilUtil::getImageTagByType($type, $this->tpl->tplPath) .
" " . $title;
if($target)
{
$caption .= " (" . ilUtil::shortenText($target, $this->textwidth, true) . ")";
}
$cgui->addItem("id[]", $obj_id, $caption);
}
$this->tpl->setContent($cgui->getHTML());
}

+ Here is the call graph for this function:

ilBookmarkAdministrationGUI::displayHeader ( )

display header and locator

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

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

Referenced by executeCommand().

{
// output locator
$this->displayLocator();
// output message
if($this->message)
{
ilUtil::sendInfo($this->message);
}
// $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_pd_b.png"),
// "");
$this->tpl->setTitle($this->lng->txt("bookmarks"));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilBookmarkAdministrationGUI::displayLocator ( )

display locator

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

References $lng, $path, and $row.

Referenced by displayHeader().

{
global $lng;
if(empty($this->id))
{
return;
}
if(!$this->tree->isInTree($this->id))
{
return;
}
$this->tpl->addBlockFile("LOCATOR", "locator", "tpl.locator.html", "Services/Locator");
$path = $this->tree->getPathFull($this->id);
//print_r($path);
$modifier = 1;
return;
$this->tpl->setVariable("TXT_LOCATOR", $this->lng->txt("locator"));
$this->tpl->touchBlock("locator_separator");
$this->tpl->touchBlock("locator_item");
//$this->tpl->setCurrentBlock("locator_item");
//$this->tpl->setVariable("ITEM", $this->lng->txt("personal_desktop"));
//$this->tpl->setVariable("LINK_ITEM", $this->ctrl->getLinkTargetByClass("ilpersonaldesktopgui"));
//$this->tpl->setVariable("LINK_TARGET","target=\"".
// ilFrameTargetInfo::_getFrame("MainContent")."\"");
//$this->tpl->parseCurrentBlock();
foreach($path as $key => $row)
{
if($key < count($path) - $modifier)
{
$this->tpl->touchBlock("locator_separator");
}
$this->tpl->setCurrentBlock("locator_item");
$title = ($row["child"] == 1) ?
$lng->txt("bookmarks") :
$row["title"];
$this->tpl->setVariable("ITEM", $title);
$this->ctrl->setParameter($this, "bmf_id", $row["child"]);
$this->tpl->setVariable("LINK_ITEM",
$this->ctrl->getLinkTarget($this));
$this->tpl->parseCurrentBlock();
}
$this->tpl->setCurrentBlock("locator");
$this->tpl->parseCurrentBlock();
}

+ Here is the caller graph for this function:

ilBookmarkAdministrationGUI::editFormBookmark ( )

display edit bookmark form

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

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

Referenced by updateBookmark().

{
global $lng, $ilCtrl;
if(!$this->tree->isInTree($_GET["obj_id"]))
{
$this->ctrl->setParameter($this, 'obj_id', '');
$this->ctrl->setParameter($this, 'bmf_id', '');
$this->ctrl->redirect($this);
}
$form = $this->initFormBookmark('updateBookmark');
$bookmark = new ilBookmark($_GET["obj_id"]);
$form->setValuesByArray
(
array
(
"title" => $bookmark->getTitle(),
"target" => $bookmark->getTarget(),
"description" => $bookmark->getDescription(),
"obj_id" => $_GET["obj_id"],
)
);
$this->tpl->setVariable("ADM_CONTENT", $form->getHTML());
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilBookmarkAdministrationGUI::editFormBookmarkFolder ( )

display edit bookmark folder form

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

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

Referenced by updateBookmarkFolder().

{
if(!$this->tree->isInTree($_GET["obj_id"]))
{
$this->ctrl->setParameter($this, 'bmf_id', '');
$this->ctrl->setParameter($this, 'obj_id', '');
$this->ctrl->redirect($this);
}
$bmf = new ilBookmarkFolder($_GET["obj_id"]);
$form = $this->initFormBookmarkFolder('updateBookmarkFolder', $this->id);
$form->setValuesByArray
(
array
(
"title" => $this->get_last("title", $bmf->getTitle()),
"obj_id" => $_GET["obj_id"],
)
);
$this->tpl->setVariable("ADM_CONTENT", $form->getHTML());
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilBookmarkAdministrationGUI::executeAction ( )

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

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

{
switch($_POST["selected_cmd"])
{
case "delete":
$this->delete();
break;
case "export":
$this->export();
break;
case "sendmail":
$this->sendmail();
break;
default:
$this->view();
break;
}
return true;
}

+ Here is the call graph for this function:

& ilBookmarkAdministrationGUI::executeCommand ( )

execute command

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

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

{
$next_class = $this->ctrl->getNextClass();
switch($next_class)
{
default:
$cmd = $this->ctrl->getCmd("view");
$this->displayHeader();
$this->$cmd();
if($this->getMode() == 'tree')
{
$this->explorer();
}
break;
}
$this->tpl->show(true);
return true;
}

+ Here is the call graph for this function:

ilBookmarkAdministrationGUI::explorer ( )

output explorer tree with bookmark folders

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

References $tpl.

Referenced by executeCommand().

{
global $tpl;
include_once("./Services/Bookmarks/classes/class.ilBookmarkExplorerGUI.php");
$exp = new ilBookmarkExplorerGUI($this, "explorer");
if (!$exp->handleCommand())
{
$tpl->setLeftNavContent($exp->getHTML());
}
}

+ Here is the caller graph for this function:

ilBookmarkAdministrationGUI::export (   $deliver = true)

export bookmarks

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

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

Referenced by executeAction(), and sendmail().

{
$bm_ids = $_GET['bm_id'] ? array($_GET['bm_id']) : $_POST['bm_id'];
if(!$bm_ids)
{
$this->ilias->raiseError($this->lng->txt("no_checkbox"), $this->ilias->error_obj->MESSAGE);
}
$export_ids = array();
foreach($bm_ids as $id)
{
if($this->tree->isInTree($id))
{
//list($type, $obj_id) = explode(":", $id);
//$export_ids[]=$obj_id;
$export_ids[] = $id;
}
}
require_once ("./Services/Bookmarks/classes/class.ilBookmarkImportExport.php");
$html_content = ilBookmarkImportExport::_exportBookmark($export_ids, true,
$this->lng->txt("bookmarks_of") . " " . $this->ilias->account->getFullname());
if($deliver)
{
ilUtil::deliverData($html_content, 'bookmarks.html', "application/save", $charset = "");
}
else
{
return $html_content;
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilBookmarkAdministrationGUI::get_last (   $a_var,
  $a_value 
)

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

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

References $_POST, and ilUtil\prepareFormOutput().

Referenced by editFormBookmarkFolder().

{
return (!empty($_POST[$a_var])) ?
ilUtil::prepareFormOutput(($_POST[$a_var]), true) :
ilUtil::prepareFormOutput($a_value);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilBookmarkAdministrationGUI::getHTML ( )

Get Bookmark list for personal desktop.

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

{
include_once("./Services/Bookmarks/classes/class.ilBookmarkBlockGUI.php");
$bookmark_block_gui = new ilBookmarkBlockGUI("ilpersonaldesktopgui", "show");
return $bookmark_block_gui->getHTML();
}
ilBookmarkAdministrationGUI::getMode ( )

return display mode flat or tree

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

Referenced by executeCommand().

{
return $this->mode;
}

+ Here is the caller graph for this function:

ilBookmarkAdministrationGUI::ilBookmarkAdministrationGUI ( )

Constructor public.

Parameters
integeruser_id (optional)

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

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

{
// $tpl->enableAdvancedColumnLayout(true, false);
$tpl->getStandardTemplate();
//print_r($_SESSION["error_post_vars"]);
// if no bookmark folder id is given, take dummy root node id (that is 1)
$this->id = (empty($_GET["bmf_id"]))
? 1
: $_GET["bmf_id"];
// initiate variables
$this->ilias =& $ilias;
$this->tpl =& $tpl;
$this->lng =& $lng;
$this->ctrl =& $ilCtrl;
$this->ctrl->setParameter($this, "bmf_id", $this->id);
$this->user_id = $ilUser->getId();
$this->tree = new ilTree($this->user_id);
$this->tree->setTableNames('bookmark_tree', 'bookmark_data');
$this->root_id = $this->tree->readRootId();
$this->mode = "tree";
}
ilBookmarkAdministrationGUI::importFile ( )

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

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

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

{
if(!$this->tree->isInTree($this->id))
{
$this->ctrl->setParameter($this, 'bmf_id', '');
$this->ctrl->redirect($this);
}
if($_FILES["bkmfile"]["error"] > UPLOAD_ERR_OK)
{
ilUtil::sendFailure($this->lng->txt("import_file_not_valid"));
$this->newFormBookmark();
return;
}
require_once ("./Services/Bookmarks/classes/class.ilBookmarkImportExport.php");
$objects = ilBookmarkImportExport::_parseFile($_FILES["bkmfile"]['tmp_name']);
if($objects === false)
{
ilUtil::sendFailure($this->lng->txt("import_file_not_valid"));
$this->newFormBookmark();
return;
}
// holds the number of created objects
$num_create = array('bm'=> 0, 'bmf'=> 0);
$this->__importBookmarks($objects, $num_create, $this->id, 0);
ilUtil::sendSuccess(sprintf($this->lng->txt("bkm_import_ok"), $num_create['bm'],
$num_create['bmf']));
$this->view();
}

+ Here is the call graph for this function:

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

init Bookmark create/edit form

Parameters
stringform action type; valid values: createBookmark, updateBookmark

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

References $_GET, $ilCtrl, $ilUser, $lng, and ilTextInputGUI\setValue().

Referenced by editFormBookmark(), and newFormBookmark().

{
global $lng, $ilCtrl, $ilUser;
if(!$this->tree->isInTree($this->id))
{
$this->ctrl->setParameter($this, 'bmf_id', '');
$this->ctrl->redirect($this);
}
include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
$form = new ilPropertyFormGUI();
$form->setTopAnchor("bookmark_top");
$form->setTitle($lng->txt("bookmark_new"));
if($action == 'updateBookmark')
{
$ilCtrl->setParameter($this, 'bmf_id', $this->id);
$ilCtrl->setParameter($this, 'obj_id', $_GET["obj_id"]);
}
$hash = ($ilUser->prefs["screen_reader_optimization"])
? "bookmark_top"
: "";
$form->setFormAction($ilCtrl->getFormAction($this, $action, $hash));
$ilCtrl->clearParameters($this);
// title
$prop = new ilTextInputGUI($lng->txt("title"), "title");
$prop->setValue($_GET['bm_title']);
$prop->setRequired(true);
$form->addItem($prop);
// description
$prop = new ilTextAreaInputGUI($lng->txt('description'), 'description');
$form->addItem($prop);
// target link
$prop = new ilTextInputGUI($lng->txt('bookmark_target'), 'target');
$prop->setValue($_GET['bm_link']);
$prop->setRequired(true);
$form->addItem($prop);
// hidden redirect field
if($_GET['return_to'])
{
$prop = new ilHiddenInputGUI('return_to');
$prop->setValue($_GET['return_to']);
$form->addItem($prop);
$prop = new ilHiddenInputGUI('return_to_url');
if($_GET['return_to_url'])
$prop->setValue($_GET['return_to_url']);
else
$prop->setValue($_GET['bm_link']);
$form->addItem($prop);
}
// buttons
$form->addCommandButton($action, $lng->txt('save'));
$form->addCommandButton('cancel', $lng->txt('cancel'));
// keep imports?
/*
$this->tpl->setCurrentBlock('bkm_import');
$this->tpl->setVariable("TXT_IMPORT_BKM", $this->lng->txt("bkm_import"));
$this->tpl->setVariable("TXT_FILE", $this->lng->txt("file_add"));
$this->tpl->setVariable("TXT_IMPORT", $this->lng->txt("import"));
$this->tpl->parseCurrentBlock();
//vd($_POST);
*/
return $form;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

init bookmark folder create/edit form

Parameters
stringform action type; valid values: createBookmark, updateBookmark

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

References $_GET, $ilCtrl, $ilUser, $lng, and ilFormPropertyGUI\setRequired().

Referenced by editFormBookmarkFolder(), and newFormBookmarkFolder().

{
global $lng, $ilCtrl, $ilUser;
if(!$this->tree->isInTree($this->id))
{
$this->ctrl->setParameter($this, 'bmf_id', '');
$this->ctrl->redirect($this);
}
include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
$form = new ilPropertyFormGUI();
$form->setTopAnchor("bookmark_top");
$form->setTitle($lng->txt("bookmark_folder_new"));
if($action == 'updateBookmarkFolder')
{
$ilCtrl->setParameter($this, 'bmf_id', $this->id);
$ilCtrl->setParameter($this, 'obj_id', $_GET["obj_id"]);
}
$hash = ($ilUser->prefs["screen_reader_optimization"])
? "bookmark_top"
: "";
$form->setFormAction($ilCtrl->getFormAction($this, $action, $hash));
$ilCtrl->clearParameters($this);
// title
$prop = new ilTextInputGUI($lng->txt("title"), "title");
$prop->setRequired(true);
$form->addItem($prop);
// buttons
$form->addCommandButton($action, $lng->txt('save'));
$form->addCommandButton('cancel', $lng->txt('cancel'));
return $form;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilBookmarkAdministrationGUI::initImportBookmarksForm ( )
private

Init import bookmark form.

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

References $ilCtrl, $ilUser, $lng, and ilFormPropertyGUI\setRequired().

Referenced by newFormBookmark().

{
global $lng, $ilCtrl, $ilUser;
if(!$this->tree->isInTree($this->id))
{
$this->ctrl->setParameter($this, 'bmf_id', '');
$this->ctrl->redirect($this);
}
include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
$form = new ilPropertyFormGUI();
$form->setFormAction($ilCtrl->getFormAction($this, "importFile")); // #16133
$form->setTopAnchor("bookmark_top");
$form->setTitle($lng->txt("bkm_import"));
$fi = new ilFileInputGUI($lng->txt("file_add"), "bkmfile");
$fi->setRequired(true);
$form->addItem($fi);
$form->addCommandButton("importFile", $lng->txt('import'));
$form->addCommandButton('cancel', $lng->txt('cancel'));
return $form;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilBookmarkAdministrationGUI::move ( )

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

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

{
global $ilUser, $ilTabs, $tpl;
$bm_ids = $_REQUEST['bm_id'];
if(!$bm_ids && $_GET["bm_id_tgt"] == "")
{
ilUtil::sendFailure($this->lng->txt("no_checkbox"));
return $this->view();
}
$ilTabs->setBackTarget($this->lng->txt("back"), $this->ctrl->getLinkTarget($this));
$this->ctrl->setParameter($this, "bm_id_tgt", $_GET["bm_id_tgt"] ? $_GET["bm_id_tgt"] : implode(";", $bm_ids));
ilUtil::sendInfo($this->lng->txt("bookmark_select_target"));
include_once("./Services/Bookmarks/classes/class.ilBookmarkMoveExplorerGUI.php");
$exp = new ilBookmarkMoveExplorerGUI($this, "move");
if (!$exp->handleCommand())
{
$this->mode = "flat";
$this->tpl->setContent($exp->getHTML());
}
}

+ Here is the call graph for this function:

ilBookmarkAdministrationGUI::newForm (   $type)

new form

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

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

{
if(!$type)
$type = $_POST["type"];
switch($type)
{
case "bmf":
break;
case "bm":
$this->newFormBookmark();
break;
}
}

+ Here is the call graph for this function:

ilBookmarkAdministrationGUI::newFormBookmark ( )

display new bookmark form

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

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

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

{
$form = $this->initFormBookmark();
$html1 = $form->getHTML();
$html2 = '';
if(!$_REQUEST["bm_link"])
{
$form2 = $this->initImportBookmarksForm();
$html2 = "<br />" . $form2->getHTML();
}
$this->tpl->setVariable("ADM_CONTENT", $html1 . $html2);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilBookmarkAdministrationGUI::newFormBookmarkFolder ( )

display new bookmark folder form

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

References initFormBookmarkFolder().

Referenced by createBookmarkFolder(), and newForm().

{
if(!$this->tree->isInTree($this->id))
{
$this->ctrl->setParameter($this, 'bmf_id', '');
$this->ctrl->redirect($this);
}
$form = $this->initFormBookmarkFolder();
$this->tpl->setVariable("ADM_CONTENT", $form->getHTML());
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilBookmarkAdministrationGUI::sendmail ( )

send bookmarks as attachment

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

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

Referenced by executeAction().

{
global $ilUser;
include_once './Services/Mail/classes/class.ilFileDataMail.php';
require_once "Services/Mail/classes/class.ilFormatMail.php";
$mfile = new ilFileDataMail($ilUser->getId());
$umail = new ilFormatMail($ilUser->getId());
$html_content = $this->export(false);
$tempfile = ilUtil::ilTempnam();
$fp = fopen($tempfile, 'w');
fwrite($fp, $html_content);
fclose($fp);
$filename = 'bookmarks.html';
$mfile->copyAttachmentFile($tempfile, $filename);
$umail->savePostData($ilUser->getId(), array($filename),
'', '', '', '', '',
'',
'', 0);
require_once 'Services/Mail/classes/class.ilMailFormCall.php';
ilUtil::redirect(ilMailFormCall::getRedirectTarget($this, '', array(), array('type' => 'attach')));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilBookmarkAdministrationGUI::showPossibleSubObjects ( )

display subobject addition selection

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

References $_SESSION, and ilUtil\formSelect().

{
$actions = array(
"delete" => $this->lng->txt("delete"),
"export" => $this->lng->txt("export"),
"sendmail"=> $this->lng->txt("bkm_sendmail"),
);
$subobj = array("bm", "bmf");
if(is_array($subobj))
{
//build form
$opts = ilUtil::formSelect("", "type", $subobj);
$this->tpl->setCurrentBlock("add_object");
$this->tpl->setVariable("COLUMN_COUNTS", 7);
$this->tpl->setVariable("SELECT_OBJTYPE", $opts);
$this->tpl->setVariable("BTN_NAME", "newForm");
$this->tpl->setVariable("TXT_ADD", $this->lng->txt("add"));
$this->tpl->parseCurrentBlock();
}
$this->tpl->setVariable("TPLPATH", $this->tpl->tplPath);
$this->tpl->setCurrentBlock("tbl_action_select");
$this->tpl->setVariable("SELECT_ACTION", ilUtil::formSelect($_SESSION["error_post_vars"]['action'], "action", $actions, false, true));
$this->tpl->setVariable("BTN_NAME", "executeAction");
$this->tpl->setVariable("BTN_VALUE", $this->lng->txt("execute"));
/*
$this->tpl->setVariable("BTN_NAME","delete");
$this->tpl->setVariable("BTN_VALUE",$this->lng->txt("delete"));
$this->tpl->parseCurrentBlock();
$this->tpl->setVariable("BTN_NAME","export");
$this->tpl->setVariable("BTN_VALUE",$this->lng->txt("export"));
$this->tpl->parseCurrentBlock();
*/
$this->tpl->parseCurrentBlock();
}

+ Here is the call graph for this function:

ilBookmarkAdministrationGUI::updateBookmark ( )

update bookmark in db

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

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

{
if(!$this->tree->isInTree($_GET["obj_id"]))
{
$this->ctrl->setParameter($this, 'obj_id', '');
$this->ctrl->setParameter($this, 'bmf_id', '');
$this->ctrl->redirect($this);
}
// check title and target
if(empty($_POST["title"]))
{
ilUtil::sendFailure($this->lng->txt("please_enter_title"));
$this->editFormBookmark();
}
else if(empty($_POST["target"]))
{
ilUtil::sendFailure($this->lng->txt("please_enter_target"));
$this->editFormBookmark();
}
else
{
// update bookmark
$bm = new ilBookmark($_GET["obj_id"]);
$bm->setTitle(ilUtil::stripSlashes($_POST["title"]));
$bm->setTarget(ilUtil::stripSlashes($_POST["target"]));
$bm->setDescription(ilUtil::stripSlashes($_POST["description"]));
$bm->update();
$this->view();
}
}

+ Here is the call graph for this function:

ilBookmarkAdministrationGUI::updateBookmarkFolder ( )

update bookmark folder

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

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

{
if(!$this->tree->isInTree($_GET["obj_id"]))
{
$this->ctrl->setParameter($this, 'obj_id', '');
$this->ctrl->setParameter($this, 'bmf_id', '');
$this->ctrl->redirect($this);
}
// check title
if(empty($_POST["title"]))
{
ilUtil::sendFailure($this->lng->txt("please_enter_title"));
}
else
{
// update bookmark folder
$bmf = new ilBookmarkFolder($_GET["obj_id"]);
$bmf->setTitle(ilUtil::stripSlashes($_POST["title"]));
$bmf->update();
global $ilCtrl;
$ilCtrl->saveParameter($this, 'bmf_id');
$ilCtrl->redirect($this, 'view');
}
}

+ Here is the call graph for this function:

ilBookmarkAdministrationGUI::view ( )

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

References ilBookmarkFolder\getObjects().

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

{
if($this->id > 0 && !$this->tree->isInTree($this->id))
{
$this->ctrl->setParameter($this, 'bmf_id', '');
$this->ctrl->redirect($this);
}
$objects = ilBookmarkFolder::getObjects($this->id);
include_once 'Services/Bookmarks/classes/class.ilBookmarkAdministrationTableGUI.php';
$table = new ilBookmarkAdministrationTableGUI($this);
$table->setId('bookmark_adm_table');
$table->setData($objects);
$this->tpl->setVariable("ADM_CONTENT", $table->getHTML());
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

ilBookmarkAdministrationGUI::$data

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

ilBookmarkAdministrationGUI::$id

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

Referenced by confirm(), and export().

ilBookmarkAdministrationGUI::$ilias

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

Referenced by ilBookmarkAdministrationGUI().

ilBookmarkAdministrationGUI::$textwidth = 100

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

ilBookmarkAdministrationGUI::$tpl
ilBookmarkAdministrationGUI::$tree

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

Referenced by confirm(), and confirmedMove().

ilBookmarkAdministrationGUI::$user_id

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


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