ILIAS  Release_4_0_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
 __importBookmarks (&$objects, &$num_create, $folder_id, $start_key=0)
 creates the bookmarks and folders

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 23016 2010-02-21 15:00:57Z akill

ilBookmarkAdministrationGUI:

Definition at line 23 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 1047 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 266 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 879 of file class.ilBookmarkAdministrationGUI.php.

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

{
session_unregister("saved_post");
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 891 of file class.ilBookmarkAdministrationGUI.php.

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

{
global $tree, $rbacsystem, $rbacadmin;
// AT LEAST ONE OBJECT HAS TO BE CHOSEN.
if (!isset($_SESSION["saved_post"]))
{
$this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
}
// FOR ALL SELECTED OBJECTS
foreach ($_SESSION["saved_post"] 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::createBookmark ( )

create new bookmark in db

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

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

{
global $lng;
if (!$this->tree->isInTree($this->id))
{
return;
}
// 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
$this->view();
}
}

+ Here is the call graph for this function:

ilBookmarkAdministrationGUI::createBookmarkFolder ( )

create new bookmark folder in db

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

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

{
if (!$this->tree->isInTree($this->id))
{
return;
}
// 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();
$this->view();
}
}

+ Here is the call graph for this function:

ilBookmarkAdministrationGUI::delete ( )

display deletion conformation screen

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

References $_GET, $_POST, $_SESSION, $key, $name, $title, $type, ilBookmark\_getTypeOfId(), ilUtil\getImagePath(), ilUtil\getImageTagByType(), ilUtil\prepareFormOutput(), ilUtil\sendQuestion(), ilUtil\shortenText(), and ilUtil\switchColor().

{
$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->tpl->addBlockFile("ADM_CONTENT", "objects", "tpl.obj_confirm.html");
ilUtil::sendQuestion($this->lng->txt("info_delete_sure"));
$this->ctrl->setParameter($this, "bmf_id", $this->id);
$this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
// output table header
$cols = array("type", "title");
foreach ($cols as $key)
{
$this->tpl->setCurrentBlock("table_header");
$this->tpl->setVariable("TEXT",$this->lng->txt($key));
$this->tpl->parseCurrentBlock();
}
$_SESSION["saved_post"] = $bm_ids;
foreach($bm_ids as $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;
}
// output type icon
$this->tpl->setCurrentBlock("table_cell");
$this->tpl->setVariable("TEXT_CONTENT",ilUtil::getImageTagByType($type, $this->tpl->tplPath));
$this->tpl->parseCurrentBlock();
// output title
$this->tpl->setCurrentBlock("table_cell");
$this->tpl->setVariable("TEXT_CONTENT",ilUtil::prepareFormOutput($title));
// output target
if ($target)
{
$this->tpl->setVariable("DESC",ilUtil::prepareFormOutput(ilUtil::shortenText(
$target,$this->textwidth, true)));
}
$this->tpl->parseCurrentBlock();
// output table row
$this->tpl->setCurrentBlock("table_row");
$this->tpl->setVariable("CSS_ROW",ilUtil::switchColor(++$counter,"tblrow1","tblrow2"));
$this->tpl->parseCurrentBlock();
}
// cancel and confirm button
$buttons = array( "cancel" => $this->lng->txt("cancel"),
"confirm" => $this->lng->txt("confirm"));
$this->tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.gif"));
foreach($buttons as $name => $value)
{
$this->tpl->setCurrentBlock("operation_btn");
$this->tpl->setVariable("BTN_NAME",$name);
$this->tpl->setVariable("BTN_VALUE",$value);
$this->tpl->parseCurrentBlock();
}
}

+ Here is the call graph for this function:

ilBookmarkAdministrationGUI::displayHeader ( )

display header and locator

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

References displayLocator(), ilUtil\getImagePath(), 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.gif"),
// $this->lng->txt("personal_desktop"));
$this->tpl->setTitleIcon(ilUtil::getImagePath("icon_pd_b.gif"),
"");
$this->tpl->setTitle($this->lng->txt("personal_desktop"));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilBookmarkAdministrationGUI::displayLocator ( )

display locator

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

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

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

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

Referenced by updateBookmark().

{
global $lng, $ilCtrl;
if (!$this->tree->isInTree($_GET["obj_id"]))
{
return;
}
$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 420 of file class.ilBookmarkAdministrationGUI.php.

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

Referenced by updateBookmarkFolder().

{
$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 105 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 86 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 136 of file class.ilBookmarkAdministrationGUI.php.

References $_GET, $_SESSION, $tpl, and ilBookmarkExplorer\setAllowedTypes().

Referenced by executeCommand().

{
global $tpl;
$etpl = new ilTemplate("tpl.bookmark_explorer.html", true, true,
"Services/PersonalDesktop");
$exp = new ilBookmarkExplorer($this->ctrl->getLinkTarget($this),$_SESSION["AccountId"]);
$exp->setAllowedTypes(array('dum','bmf'));
$exp->setTargetGet("bmf_id");
$exp->setSessionExpandVariable('mexpand');
$exp->setExpand($this->id);
$this->ctrl->setParameter($this, "bmf_id", $this->id);
$exp->setExpandTarget($this->ctrl->getLinkTarget($this));
if ($_GET["mexpand"] == "")
{
$mtree = new ilTree($_SESSION["AccountId"]);
$mtree->setTableNames('bookmark_tree','bookmark_data');
$expanded = $mtree->readRootId();
}
else
{
$expanded = $_GET["mexpand"];
}
$exp->setExpand($expanded);
$exp->highlightNode($_GET["bmf_id"]);
// build html-output
$exp->setOutput(0);
$exp->highlightNode($this->id);
$output = $exp->getOutput();
$etpl->setCurrentBlock("adm_tree_content");
$etpl->setVariable("TXT_EXPLORER_HEADER", $this->lng->txt("bookmarks"));
$this->ctrl->setParameter($this, "bmf_id", 1);
if ($_REQUEST['bm_link'])
{
$link = $_SERVER['REQUEST_URI'];
$link = ereg_replace('bmf_id=[0-9]*', 'bmf_id=1', $link);
$etpl->setVariable("LINK_EXPLORER_HEADER",$link);
}
else
$etpl->setVariable("LINK_EXPLORER_HEADER",$this->ctrl->getLinkTarget($this));
$etpl->setVariable("EXPLORER",$output);
$tpl->setLeftContent($etpl->get());;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilBookmarkAdministrationGUI::export (   $deliver = true)

export bookmarks

Definition at line 731 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/PersonalDesktop/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 563 of file class.ilBookmarkAdministrationGUI.php.

References $_POST, and ilUtil\prepareFormOutput().

Referenced by editFormBookmarkFolder().

{
return (!empty($_POST[$a_var])) ?
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 993 of file class.ilBookmarkAdministrationGUI.php.

{
include_once("./Services/PersonalDesktop/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 129 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 51 of file class.ilBookmarkAdministrationGUI.php.

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

{
global $ilias, $tpl, $lng, $ilCtrl;
// $tpl->enableAdvancedColumnLayout(true, false);
//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"]))
? $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 = $_SESSION["AccountId"];
$this->tree = new ilTree($_SESSION["AccountId"]);
$this->tree->setTableNames('bookmark_tree','bookmark_data');
$this->root_id = $this->tree->readRootId();
// set current bookmark view mode
//if (!empty($_GET["set_mode"]))
//{
// $this->ilias->account->writePref("il_bkm_mode", $_GET["set_mode"]);
//}
//$this->mode = $this->ilias->account->getPref("il_bkm_mode");
$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 1008 of file class.ilBookmarkAdministrationGUI.php.

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

{
if (!$this->tree->isInTree($this->id))
{
return;
}
if ($_FILES["bkmfile"]["error"] > UPLOAD_ERR_OK)
{
ilUtil::sendFailure($this->lng->txt("import_file_not_valid"));
$this->newFormBookmark();
return;
}
require_once ("./Services/PersonalDesktop/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 440 of file class.ilBookmarkAdministrationGUI.php.

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

Referenced by editFormBookmark(), and newFormBookmark().

{
global $lng, $ilCtrl, $ilUser;
if (!$this->tree->isInTree($this->id))
{
return;
}
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 377 of file class.ilBookmarkAdministrationGUI.php.

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

Referenced by editFormBookmarkFolder(), and newFormBookmarkFolder().

{
global $lng, $ilCtrl, $ilUser;
if (!$this->tree->isInTree($this->id))
{
return;
}
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 519 of file class.ilBookmarkAdministrationGUI.php.

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

Referenced by newFormBookmark().

{
global $lng, $ilCtrl, $ilUser;
if (!$this->tree->isInTree($this->id))
{
return;
}
include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
$form = new ilPropertyFormGUI();
$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::newForm (   $type)

new form

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

References $_POST, $type, 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 546 of file class.ilBookmarkAdministrationGUI.php.

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

References initFormBookmarkFolder().

Referenced by createBookmarkFolder(), and newForm().

{
if (!$this->tree->isInTree($this->id))
{
return;
}
$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 765 of file class.ilBookmarkAdministrationGUI.php.

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

Referenced by executeAction().

{
global $ilUser;
include_once '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);
ilUtil::redirect('ilias.php?baseClass=ilMailGUI&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 947 of file class.ilBookmarkAdministrationGUI.php.

References $_SESSION, formSelect(), 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 697 of file class.ilBookmarkAdministrationGUI.php.

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

{
if (!$this->tree->isInTree($_GET["obj_id"]))
{
return;
}
// 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 628 of file class.ilBookmarkAdministrationGUI.php.

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

{
if (!$this->tree->isInTree($_GET["obj_id"]))
{
return;
}
// 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();
$this->view();
}
}

+ Here is the call graph for this function:

ilBookmarkAdministrationGUI::view ( )

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

References $_SESSION, $ilCtrl, $tree, and ilBookmarkFolder\getObjects().

Referenced by cancel(), confirm(), createBookmark(), createBookmarkFolder(), executeAction(), importFile(), updateBookmark(), and updateBookmarkFolder().

{
global $tree, $ilCtrl;
include_once("classes/class.ilFrameTargetInfo.php");
if ($this->id > 0 && !$this->tree->isInTree($this->id))
{
return;
}
$mtree = new ilTree($_SESSION["AccountId"]);
$mtree->setTableNames('bookmark_tree','bookmark_data');
$objects = ilBookmarkFolder::getObjects($this->id);
$s_mode = ($this->mode == "tree")
? "flat"
: "tree";
// $this->tpl->setTreeFlatIcon($this->ctrl->getLinkTarget($this)."&set_mode=".$s_mode,
// $s_mode);
include_once 'Services/PersonalDesktop/classes/class.ilBookmarkAdministrationTableGUI.php';
$table = new ilBookmarkAdministrationTableGUI($this);
$table->setId('bookmark_adm_table');
/*
// return to parent folder
// disabled
if ($this->id != $mtree->readRootId() || $this->id =="")
{
$ilCtrl->setParameter($this, "bmf_id", $mtree->getParentId($this->id));
$objects = array_merge
(
array
(
array
(
"title" => "..",
"target" => $ilCtrl->getLinkTarget($this),
"type" => 'parent',
"obj_id" => $mtree->getParentId($this->id),
)
),
$objects
);
}
*/
$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 43 of file class.ilBookmarkAdministrationGUI.php.

ilBookmarkAdministrationGUI::$id

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

Referenced by confirm(), and export().

ilBookmarkAdministrationGUI::$ilias

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

Referenced by ilBookmarkAdministrationGUI().

ilBookmarkAdministrationGUI::$textwidth = 100

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

ilBookmarkAdministrationGUI::$tpl

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

Referenced by explorer(), and ilBookmarkAdministrationGUI().

ilBookmarkAdministrationGUI::$tree

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

Referenced by confirm(), and view().

ilBookmarkAdministrationGUI::$user_id

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


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