ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilPDTaggingBlockGUI Class Reference

ilPDTaggingBlockGUI displays personal tag cloud on personal desktop. More...

+ Inheritance diagram for ilPDTaggingBlockGUI:
+ Collaboration diagram for ilPDTaggingBlockGUI:

Public Member Functions

 __construct ()
 Constructor. More...
 
 getBlockType ()
 
 executeCommand ()
 execute command More...
 
 getHTML ()
 
 fillDataSection ()
 Fill data section. More...
 
 getTagCloud ()
 get tree bookmark list for personal desktop More...
 
 showResourcesForTag ()
 List resources for tag. More...
 
 removeTagsWithoutAccess ()
 Remove tasg without access. More...
 
 fillFooter ()
 block footer More...
 
 getOverview ()
 Get overview. More...
 
- Public Member Functions inherited from ilBlockGUI
 getBlockType ()
 
 __construct ()
 Constructor. More...
 
 addHeaderLink ($a_href, $a_text, $status=true)
 
 getHeaderLinks ()
 
 setData ($a_data)
 Set Data. More...
 
 getData ()
 Get Data. More...
 
 setBigMode ($a_bigmode)
 Set Big Mode. More...
 
 getBigMode ()
 Get Big Mode. More...
 
 setBlockId ($a_block_id=0)
 Set Block Id. More...
 
 getBlockId ()
 Get Block Id. More...
 
 setAvailableDetailLevels ($a_max, $a_min=0)
 Set Available Detail Levels. More...
 
 setCurrentDetailLevel ($a_currentdetaillevel)
 Set Current Detail Level. More...
 
 setGuiObject (&$a_gui_object)
 Set GuiObject. More...
 
 getGuiObject ()
 Get GuiObject. More...
 
 getCurrentDetailLevel ()
 Get Current Detail Level. More...
 
 setTitle ($a_title)
 Set Title. More...
 
 getTitle ()
 Get Title. More...
 
 setImage ($a_image)
 Set Image. More...
 
 getImage ()
 Get Image. More...
 
 setOffset ($a_offset)
 Set Offset. More...
 
 getOffset ()
 Get Offset. More...
 
 correctOffset ()
 
 setLimit ($a_limit)
 Set Limit. More...
 
 getLimit ()
 Get Limit. More...
 
 setEnableEdit ($a_enableedit)
 Set EnableEdit. More...
 
 getEnableEdit ()
 Get EnableEdit. More...
 
 setRepositoryMode ($a_repositorymode)
 Set RepositoryMode. More...
 
 getRepositoryMode ()
 Get RepositoryMode. More...
 
 setFooterInfo ($a_footerinfo, $a_hide_and_icon=false)
 Set Footer Info. More...
 
 getFooterInfo ($a_hide_and_icon=false)
 Get Footer Info. More...
 
 setSubtitle ($a_subtitle)
 Set Subtitle. More...
 
 getSubtitle ()
 Get Subtitle. More...
 
 setRefId ($a_refid)
 Set Ref Id (only used if isRepositoryObject() is true). More...
 
 getRefId ()
 Get Ref Id (only used if isRepositoryObject() is true). More...
 
 setAdminCommands ($a_admincommands)
 Set Administration Commmands. More...
 
 getAdminCommands ()
 Get Administration Commmands. More...
 
 setColSpan ($a_colspan)
 Set Columns Span. More...
 
 getColSpan ()
 Get Columns Span. More...
 
 setEnableDetailRow ($a_enabledetailrow)
 Set EnableDetailRow. More...
 
 getEnableDetailRow ()
 Get EnableDetailRow. More...
 
 setEnableNumInfo ($a_enablenuminfo)
 Set Enable Item Number Info. More...
 
 getEnableNumInfo ()
 Get Enable Item Number Info. More...
 
 setProperties ($a_properties)
 This function is supposed to be used for block type specific properties, that should be inherited through ilColumnGUI->setBlockProperties. More...
 
 getProperty ($a_property)
 
 setProperty ($a_property, $a_value)
 
 setRowTemplate ($a_rowtemplatename, $a_rowtemplatedir="")
 Set Row Template Name. More...
 
 getNavParameter ()
 
 getDetailParameter ()
 
 getConfigParameter ()
 
 getMoveParameter ()
 
 getRowTemplateName ()
 Get Row Template Name. More...
 
 getRowTemplateDir ()
 Get Row Template Directory. More...
 
 addBlockCommand ( $a_href, $a_text, $a_target="", $a_img="", $a_right_aligned=false, $a_checked=false, $a_html="")
 Add Block Command. More...
 
 getBlockCommands ()
 Get Block commands. More...
 
 addHeaderCommand ($a_href, $a_text, $a_as_close=false)
 Add Header Block Command. More...
 
 getHeaderCommands ()
 Get Header Block commands. More...
 
 addFooterLink ( $a_text, $a_href="", $a_onclick="", $a_block_id="", $a_top=false, $a_omit_separator=false, $a_checked=false)
 Add a footer text/link. More...
 
 getFooterLinks ()
 Get footer links. More...
 
 clearFooterLinks ()
 Clear footer links. More...
 
 handleDetailLevel ()
 Handle read/write current detail level. More...
 
 getHTML ()
 Handle config status. More...
 
 fillHeaderCommands ()
 Fill header commands block. More...
 
 fillHeaderTitleBlock ()
 Fill header title block (title and. More...
 
 setDataSection ($a_content)
 Call this from overwritten fillDataSection(), if standard row based data is not used. More...
 
 fillDataSection ()
 Standard implementation for row based data. More...
 
 fillRow ($a_set)
 
 fillFooter ()
 
 fillPreviousNext ()
 Fill previous/next row. More...
 
 setPreviousNextLinks ()
 Get previous/next linkbar. More...
 
 fillFooterLinks ($a_top=false, $a_numinfo="")
 Fill footer links. More...
 
 fillDetailRow ()
 Fill Detail Setting Row. More...
 

Static Public Member Functions

static getScreenMode ()
 Get Screen Mode for current command. More...
 
- Static Public Member Functions inherited from ilBlockGUI
static getScreenMode ()
 Get Screen Mode for current command. More...
 

Static Public Attributes

static $block_type = "pdtag"
 

Protected Member Functions

 isRepositoryObject ()
 
- Protected Member Functions inherited from ilBlockGUI
 isRepositoryObject ()
 Returns whether block has a corresponding repository object. More...
 
 fillRowColor ($a_placeholder="CSS_ROW")
 
 preloadData (array $data)
 Can be overwritten in subclasses. More...
 

Protected Attributes

 $obj_definition
 
- Protected Attributes inherited from ilBlockGUI
 $data = array()
 
 $colspan = 1
 
 $enablenuminfo = true
 
 $detail_min = 0
 
 $detail_max = 0
 
 $bigmode = false
 
 $footer_links = array()
 
 $block_id = 0
 
 $header_commands = array()
 
 $allow_moving = true
 
 $move = array("left" => false, "right" => false, "up" => false, "down" => false)
 
 $enabledetailrow = true
 
 $header_links = array()
 
 $footerinfo = false
 
 $footerinfo_icon = false
 
 $block_commands = array()
 
 $max_count = false
 
 $close_command = false
 
 $image = false
 
 $property = false
 
 $nav_value = ""
 
 $css_row = ""
 
 $dropdown
 
 $tpl
 
 $main_tpl
 
 $user
 
 $ctrl
 
 $access
 
 $lng
 
 $obj_def
 

Detailed Description

ilPDTaggingBlockGUI displays personal tag cloud on personal desktop.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

ilPDTaggingBlockGUI: ilColumnGUI

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

Constructor & Destructor Documentation

◆ __construct()

ilPDTaggingBlockGUI::__construct ( )

Constructor.

Definition at line 46 of file class.ilPDTaggingBlockGUI.php.

References $DIC, ilBlockGUI\$lng, ilBlockGUI\setAvailableDetailLevels(), ilBlockGUI\setEnableNumInfo(), ilBlockGUI\setLimit(), ilBlockGUI\setTitle(), and user().

47  {
48  global $DIC;
49 
50  $this->ctrl = $DIC->ctrl();
51  $this->lng = $DIC->language();
52  $this->user = $DIC->user();
53  $this->obj_definition = $DIC["objDefinition"];
54  $this->access = $DIC->access();
55  $lng = $DIC->language();
56 
57  parent::__construct();
58 
59  $lng->loadLanguageModule("tagging");
60 
61  $this->setTitle($lng->txt("tagging_my_tags"));
62  $this->setEnableNumInfo(false);
63  $this->setLimit(99999);
64  $this->setAvailableDetailLevels(1, 0);
65  }
global $DIC
Definition: saml.php:7
setEnableNumInfo($a_enablenuminfo)
Set Enable Item Number Info.
user()
Definition: user.php:4
setTitle($a_title)
Set Title.
setAvailableDetailLevels($a_max, $a_min=0)
Set Available Detail Levels.
setLimit($a_limit)
Set Limit.
+ Here is the call graph for this function:

Member Function Documentation

◆ executeCommand()

ilPDTaggingBlockGUI::executeCommand ( )

execute command

Definition at line 103 of file class.ilPDTaggingBlockGUI.php.

References ilBlockGUI\$ctrl, and $ilCtrl.

104  {
106 
107  $next_class = $ilCtrl->getNextClass();
108  $cmd = $ilCtrl->getCmd("getHTML");
109 
110  return $this->$cmd();
111  }
global $ilCtrl
Definition: ilias.php:18

◆ fillDataSection()

ilPDTaggingBlockGUI::fillDataSection ( )

Fill data section.

Definition at line 128 of file class.ilPDTaggingBlockGUI.php.

References $ilUser, ilBlockGUI\$user, ilBlockGUI\getCurrentDetailLevel(), getOverview(), getTagCloud(), ilTagging\getTagsForUser(), ilBlockGUI\setDataSection(), and ilBlockGUI\setEnableDetailRow().

129  {
131 
132  include_once("./Services/Tagging/classes/class.ilTagging.php");
133  $this->tags = ilTagging::getTagsForUser($ilUser->getId(), 1000000);
134 
135  if ($this->getCurrentDetailLevel() > 1 && (count($this->tags) > 0)) {
136  $this->setDataSection($this->getTagCloud());
137  } else {
138  if ($this->num_bookmarks == 0 && $this->num_folders == 0) {
139  $this->setEnableDetailRow(false);
140  }
141  $this->setDataSection($this->getOverview());
142  }
143  }
setDataSection($a_content)
Call this from overwritten fillDataSection(), if standard row based data is not used.
static getTagsForUser($a_user_id, $a_max=0, $a_only_online=true)
Get tags for a user.
$ilUser
Definition: imgupload.php:18
setEnableDetailRow($a_enabledetailrow)
Set EnableDetailRow.
getTagCloud()
get tree bookmark list for personal desktop
getCurrentDetailLevel()
Get Current Detail Level.
+ Here is the call graph for this function:

◆ fillFooter()

ilPDTaggingBlockGUI::fillFooter ( )

block footer

Definition at line 328 of file class.ilPDTaggingBlockGUI.php.

References ilBlockGUI\fillFooterLinks(), and ilBlockGUI\getColSpan().

329  {
330  $this->fillFooterLinks();
331  $this->tpl->setVariable("FCOLSPAN", $this->getColSpan());
332  if ($this->tpl->blockExists("block_footer")) {
333  $this->tpl->setCurrentBlock("block_footer");
334  $this->tpl->parseCurrentBlock();
335  }
336  }
fillFooterLinks($a_top=false, $a_numinfo="")
Fill footer links.
getColSpan()
Get Columns Span.
+ Here is the call graph for this function:

◆ getBlockType()

ilPDTaggingBlockGUI::getBlockType ( )

Definition at line 70 of file class.ilPDTaggingBlockGUI.php.

70  : string
71  {
72  return self::$block_type;
73  }

◆ getHTML()

ilPDTaggingBlockGUI::getHTML ( )

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

References ilBlockGUI\getCurrentDetailLevel(), and ilBlockGUI\setData().

114  {
115  // workaround to show details row
116  $this->setData(array("dummy"));
117 
118  if ($this->getCurrentDetailLevel() == 0) {
119  return "";
120  } else {
121  return parent::getHTML();
122  }
123  }
setData($a_data)
Set Data.
getCurrentDetailLevel()
Get Current Detail Level.
+ Here is the call graph for this function:

◆ getOverview()

ilPDTaggingBlockGUI::getOverview ( )

Get overview.

Definition at line 342 of file class.ilPDTaggingBlockGUI.php.

References ilBlockGUI\$lng.

Referenced by fillDataSection().

343  {
344  $lng = $this->lng;
345 
346  return '<div class="small">' . $lng->txt("tagging_tag_info") . "</div>";
347  }
+ Here is the caller graph for this function:

◆ getScreenMode()

static ilPDTaggingBlockGUI::getScreenMode ( )
static

Get Screen Mode for current command.

Definition at line 87 of file class.ilPDTaggingBlockGUI.php.

References $_GET, IL_SCREEN_CENTER, and IL_SCREEN_SIDE.

88  {
89  switch ($_GET["cmd"]) {
90  case "showResourcesForTag":
91  return IL_SCREEN_CENTER;
92  break;
93 
94  default:
95  return IL_SCREEN_SIDE;
96  break;
97  }
98  }
$_GET["client_id"]
const IL_SCREEN_CENTER
const IL_SCREEN_SIDE

◆ getTagCloud()

ilPDTaggingBlockGUI::getTagCloud ( )

get tree bookmark list for personal desktop

Definition at line 148 of file class.ilPDTaggingBlockGUI.php.

References ilBlockGUI\$ctrl, $ilCtrl, $tag, ilBlockGUI\$tpl, ilBlockGUI\getCurrentDetailLevel(), and ilTagging\getRelevanceClass().

Referenced by fillDataSection().

149  {
151 
152  $showdetails = ($this->getCurrentDetailLevel() > 2);
153  $tpl = new ilTemplate(
154  "tpl.tag_cloud.html",
155  true,
156  true,
157  "Services/Tagging"
158  );
159  $max = 1;
160  foreach ($this->tags as $tag) {
161  $max = max($tag["cnt"], $max);
162  }
163  reset($this->tags);
164 
165  foreach ($this->tags as $tag) {
166  $tpl->setCurrentBlock("linked_tag");
167  $ilCtrl->setParameter($this, "tag", rawurlencode($tag["tag"]));
168  $tpl->setVariable(
169  "HREF_TAG",
170  $ilCtrl->getLinkTarget($this, "showResourcesForTag")
171  );
172  $tpl->setVariable("TAG_TITLE", $tag["tag"]);
173  $tpl->setVariable(
174  "REL_CLASS",
175  ilTagging::getRelevanceClass($tag["cnt"], $max)
176  );
177  $tpl->parseCurrentBlock();
178  }
179  return $tpl->get();
180  }
global $ilCtrl
Definition: ilias.php:18
special template class to simplify handling of ITX/PEAR
static getRelevanceClass($cnt, $max)
Get style class for tag relevance.
if(function_exists('posix_getuid') &&posix_getuid()===0) if(!array_key_exists('t', $options)) $tag
Definition: cron.php:35
getCurrentDetailLevel()
Get Current Detail Level.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isRepositoryObject()

ilPDTaggingBlockGUI::isRepositoryObject ( )
protected

Definition at line 78 of file class.ilPDTaggingBlockGUI.php.

78  : bool
79  {
80  return false;
81  }

◆ removeTagsWithoutAccess()

ilPDTaggingBlockGUI::removeTagsWithoutAccess ( )

Remove tasg without access.

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

References $_GET, ilBlockGUI\$access, ilBlockGUI\$ctrl, $ilCtrl, $ilUser, $key, ilBlockGUI\$lng, $type, ilBlockGUI\$user, ilObject\_getAllReferences(), ilTagging\deleteTagOfObjectForUser(), and ilTagging\getObjectsForTagAndUser().

284  {
286  $ilAccess = $this->access;
288  $lng = $this->lng;
289 
290  // get resources
291  include_once("./Services/Tagging/classes/class.ilTagging.php");
292  $objs = ilTagging::getObjectsForTagAndUser($ilUser->getId(), $_GET["tag"]);
293 
294  foreach ($objs as $key => $obj) {
295  $ref_ids = ilObject::_getAllReferences($obj["obj_id"]);
296  if (count($ref_ids) == 0) {
297  $inaccessible = true;
298  } else {
299  $inaccessible = false;
300  }
301  foreach ($ref_ids as $ref_id) {
302  $type = $obj["obj_type"];
303 
304  if ($type == "") {
305  $inaccessible = true;
306  continue;
307  }
308  if (!$ilAccess->checkAccess("visible", "", $ref_id) &&
309  !$ilAccess->checkAccess("read", "", $ref_id) &&
310  !$ilAccess->checkAccess("write", "", $ref_id)) {
311  $inaccessible = true;
312  }
313  if ($inaccessible) {
314  ilTagging::deleteTagOfObjectForUser($ilUser->getId(), $obj["obj_id"], $obj["obj_type"], $obj["sub_obj_id"], $obj["sub_obj_type"], $_GET["tag"]);
315  }
316  }
317  }
318 
319  ilUtil::sendSuccess($lng->txt("tag_tags_deleted"), true);
320 
321  $ilCtrl->returnToParent($this);
322  }
$type
$_GET["client_id"]
static deleteTagOfObjectForUser($a_user_id, $a_obj_id, $a_obj_type, $a_sub_obj_id, $a_sub_obj_type, $a_tag)
Deletes tag of an object.
static _getAllReferences($a_id)
get all reference ids of object
global $ilCtrl
Definition: ilias.php:18
$ilUser
Definition: imgupload.php:18
static getObjectsForTagAndUser($a_user_id, $a_tag)
Get objects for tag and user.
$key
Definition: croninfo.php:18
+ Here is the call graph for this function:

◆ showResourcesForTag()

ilPDTaggingBlockGUI::showResourcesForTag ( )

List resources for tag.

Definition at line 185 of file class.ilPDTaggingBlockGUI.php.

References $_GET, ilBlockGUI\$ctrl, $html, $ilCtrl, $ilUser, $key, ilBlockGUI\$lng, $location, $obj_definition, ilBlockGUI\$tpl, $type, ilBlockGUI\$user, ilObject\_getAllReferences(), ilObject\_lookupDescription(), ilObject\_lookupTitle(), ilUtil\getImagePath(), and ilTagging\getObjectsForTagAndUser().

186  {
187  $lng = $this->lng;
190  $objDefinition = $this->obj_definition;
191 
192  $_GET["tag"] = str_replace("-->", "", $_GET["tag"]);
193 
194  $tpl = new ilTemplate("tpl.resources_for_tag.html", true, true, "Services/Tagging");
195  include_once("./Services/PersonalDesktop/classes/class.ilPDContentBlockGUI.php");
196  $content_block = new ilPDContentBlockGUI();
197  $content_block->setColSpan(2);
198  $content_block->setTitle(sprintf(
199  $lng->txt("tagging_resources_for_tag"),
200  "<i>" . $_GET["tag"] . "</i>"
201  ));
202  $content_block->setImage(ilUtil::getImagePath("icon_tag.svg"));
203  $content_block->addHeaderCommand(
204  $ilCtrl->getParentReturn($this),
205  $lng->txt("selected_items_back")
206  );
207 
208  // get resources
209  include_once("./Services/Tagging/classes/class.ilTagging.php");
210  $objs = ilTagging::getObjectsForTagAndUser($ilUser->getId(), $_GET["tag"]);
211 
212  $unaccessible = false;
213  foreach ($objs as $key => $obj) {
214  $ref_ids = ilObject::_getAllReferences($obj["obj_id"]);
215  foreach ($ref_ids as $ref_id) {
216  $type = $obj["obj_type"];
217 
218  if ($type == "") {
219  $unaccessible = true;
220  continue;
221  }
222 
223  // get list gui class for each object type
224  if (empty($this->item_list_gui[$type])) {
225  $class = $objDefinition->getClassName($type);
226  $location = $objDefinition->getLocation($type);
227 
228  $full_class = "ilObj" . $class . "ListGUI";
229 
230  include_once($location . "/class." . $full_class . ".php");
231  $this->item_list_gui[$type] = new $full_class();
232  $this->item_list_gui[$type]->enableDelete(false);
233  $this->item_list_gui[$type]->enablePath(true);
234  $this->item_list_gui[$type]->enableCut(false);
235  $this->item_list_gui[$type]->enableCopy(false);
236  $this->item_list_gui[$type]->enableSubscribe(false);
237  $this->item_list_gui[$type]->enableLink(false);
238  $this->item_list_gui[$type]->enableIcon(true);
239  }
240  $html = $this->item_list_gui[$type]->getListItemHTML(
241  $ref_id,
242  $obj["obj_id"],
243  ilObject::_lookupTitle($obj["obj_id"]),
244  ilObject::_lookupDescription($obj["obj_id"])
245  );
246 
247  if ($html != "") {
248  $css = ($css != "tblrow1") ? "tblrow1" : "tblrow2";
249 
250  $tpl->setCurrentBlock("res_row");
251  $tpl->setVariable("ROWCLASS", $css);
252  $tpl->setVariable("RESOURCE_HTML", $html);
253  $tpl->setVariable("ALT_TYPE", $lng->txt("obj_" . $type));
254  $tpl->setVariable(
255  "IMG_TYPE",
256  ilUtil::getImagePath("icon_" . $type . ".svg")
257  );
258  $tpl->parseCurrentBlock();
259  } else {
260  $unaccessible = true;
261  }
262  }
263  }
264 
265  if ($unaccessible) {
266  $tpl->setCurrentBlock("no_access");
267  $tpl->setVariable("SOME_OBJ_WITHOUT_ACCESS", $lng->txt("tag_some_obj_tagged_without_access"));
268  $ilCtrl->saveParameter($this, "tag");
269  $tpl->setVariable("HREF_REMOVE_TAGS", $ilCtrl->getLinkTarget($this, "removeTagsWithoutAccess"));
270  $tpl->setVariable("REMOVE_TAGS", $lng->txt("tag_remove_tags_of_obj_without_access"));
271  $tpl->parseCurrentBlock();
272  }
273 
274  $content_block->setContent($tpl->get());
275  //$content_block->setContent("test");
276 
277  return $content_block->getHTML();
278  }
$type
$_GET["client_id"]
$location
Definition: buildRTE.php:44
static _lookupTitle($a_id)
lookup object title
static _getAllReferences($a_id)
get all reference ids of object
global $ilCtrl
Definition: ilias.php:18
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static _lookupDescription($a_id)
lookup object description
special template class to simplify handling of ITX/PEAR
$ilUser
Definition: imgupload.php:18
static getObjectsForTagAndUser($a_user_id, $a_tag)
Get objects for tag and user.
BlockGUI class for (centered) Content on Personal Desktop.
$key
Definition: croninfo.php:18
$html
Definition: example_001.php:87
+ Here is the call graph for this function:

Field Documentation

◆ $block_type

ilPDTaggingBlockGUI::$block_type = "pdtag"
static

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

◆ $obj_definition

ilPDTaggingBlockGUI::$obj_definition
protected

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

Referenced by showResourcesForTag().


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