ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilTaggingGUI Class Reference

Class ilTaggingGUI. More...

+ Collaboration diagram for ilTaggingGUI:

Public Member Functions

 setObject ($a_obj_id, $a_obj_type, $a_sub_obj_id=0, $a_sub_obj_type="")
 Set Object.
 setUserId ($a_userid)
 Set User ID.
 getUserId ()
 Get User ID.
 setSaveCmd ($a_savecmd)
 Set Save Command.
 getSaveCmd ()
 Get Save Command.
 setInputFieldName ($a_inputfieldname)
 Set Input Field Name.
 getInputFieldName ()
 Get Input Field Name.
 getTaggingInputHTML ()
 Get Input HTML for Tagging of an object (and a user)
 saveInput ()
 Save Input.
 isForbidden ($a_tag)
 Check whether a tag is forbiddens.
 getAllUserTagsForObjectHTML ()
 Get Input HTML for Tagging of an object (and a user)

Detailed Description

Class ilTaggingGUI.

User interface class for tagging engine.

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

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

Member Function Documentation

ilTaggingGUI::getAllUserTagsForObjectHTML ( )

Get Input HTML for Tagging of an object (and a user)

Definition at line 197 of file class.ilTaggingGUI.php.

References $ilCtrl, $lng, ilTagging\calculateFontSize(), ilTagging\getTagsForObject(), and isForbidden().

{
global $lng, $ilCtrl;
$ttpl = new ilTemplate("tpl.tag_cloud.html", true, true, "Services/Tagging");
$tags = ilTagging::getTagsForObject($this->obj_id, $this->obj_type,
$this->sub_obj_id, $this->sub_obj_type);
$max = 1;
foreach ($tags as $tag)
{
$max = max($max, $tag["cnt"]);
}
reset($tags);
foreach ($tags as $tag)
{
if (!$this->isForbidden($tag["tag"]))
{
$ttpl->setCurrentBlock("unlinked_tag");
$ttpl->setVariable("FONT_SIZE", ilTagging::calculateFontSize($tag["cnt"], $max)."%");
$ttpl->setVariable("TAG_TITLE", $tag["tag"]);
$ttpl->parseCurrentBlock();
}
}
return $ttpl->get();
}

+ Here is the call graph for this function:

ilTaggingGUI::getInputFieldName ( )

Get Input Field Name.

Returns
string Input Field Name

Definition at line 125 of file class.ilTaggingGUI.php.

Referenced by getTaggingInputHTML(), and saveInput().

{
return $this->inputfieldname;
}

+ Here is the caller graph for this function:

ilTaggingGUI::getSaveCmd ( )

Get Save Command.

Returns
string Save Command

Definition at line 105 of file class.ilTaggingGUI.php.

{
return $this->savecmd;
}
ilTaggingGUI::getTaggingInputHTML ( )

Get Input HTML for Tagging of an object (and a user)

Definition at line 133 of file class.ilTaggingGUI.php.

References $ilCtrl, $lng, getInputFieldName(), ilTagging\getTagsForUserAndObject(), getUserId(), and ilUtil\prepareFormOutput().

{
global $lng, $ilCtrl;
$ttpl = new ilTemplate("tpl.tags_input.html", true, true, "Services/Tagging");
$tags = ilTagging::getTagsForUserAndObject($this->obj_id, $this->obj_type,
$this->sub_obj_id, $this->sub_obj_type, $this->getUserId());
$ttpl->setVariable("VAL_TAGS",
ilUtil::prepareFormOutput(implode($tags, " ")));
$ttpl->setVariable("TXT_SAVE", $lng->txt("save"));
$ttpl->setVariable("CMD_SAVE", $this->savecmd);
$ttpl->setVariable("NAME_TAGS", $this->getInputFieldName());
return $ttpl->get();
}

+ Here is the call graph for this function:

ilTaggingGUI::getUserId ( )

Get User ID.

Returns
int User ID

Definition at line 85 of file class.ilTaggingGUI.php.

Referenced by getTaggingInputHTML(), and saveInput().

{
return $this->userid;
}

+ Here is the caller graph for this function:

ilTaggingGUI::isForbidden (   $a_tag)

Check whether a tag is forbiddens.

Definition at line 180 of file class.ilTaggingGUI.php.

References $f.

Referenced by getAllUserTagsForObjectHTML(), and saveInput().

{
foreach ($this->forbidden as $f)
{
if (is_int(strpos(strtolower(
str_replace(array("+", "§", '"', "'", "*", "%", "&", "/", "\\", "(", ")", "=", ":", ";", ":", "-", "_", "\$",
"£". "!". "¨", "^", "`", "@", "<", ">"), "", $a_tag)), $f)))
{
return true;
}
}
return false;
}

+ Here is the caller graph for this function:

ilTaggingGUI::saveInput ( )

Save Input.

Definition at line 152 of file class.ilTaggingGUI.php.

References $_POST, $lng, getInputFieldName(), getUserId(), isForbidden(), ilUtil\sendSuccess(), ilUtil\stripSlashes(), and ilTagging\writeTagsForUserAndObject().

{
global $lng;
$input = str_replace(",", " ", $input);
$itags = explode(" ", $input);
$tags = array();
foreach($itags as $itag)
{
$itag = trim($itag);
if (!in_array($itag, $tags) && $itag != "")
{
if (!$this->isForbidden($itag))
{
$tags[] = $itag;
}
}
}
ilTagging::writeTagsForUserAndObject($this->obj_id, $this->obj_type,
$this->sub_obj_id, $this->sub_obj_type, $this->getUserId(), $tags);
ilUtil::sendSuccess($lng->txt('msg_obj_modified'));
}

+ Here is the call graph for this function:

ilTaggingGUI::setInputFieldName (   $a_inputfieldname)

Set Input Field Name.

Parameters
string$a_inputfieldnameInput Field Name

Definition at line 115 of file class.ilTaggingGUI.php.

Referenced by setObject().

{
$this->inputfieldname = $a_inputfieldname;
}

+ Here is the caller graph for this function:

ilTaggingGUI::setObject (   $a_obj_id,
  $a_obj_type,
  $a_sub_obj_id = 0,
  $a_sub_obj_type = "" 
)

Set Object.

Parameters
int$a_obj_idObject ID
string$a_obj_typeObject Type
int$a_sub_obj_idSubobject ID
string$a_sub_obj_typeSubobject Type

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

References setInputFieldName(), setSaveCmd(), and setUserId().

{
global $ilUser;
$this->obj_id = $a_obj_id;
$this->obj_type = $a_obj_type;
$this->sub_obj_id = $a_sub_obj_id;
$this->sub_obj_type = $a_sub_obj_type;
$this->setSaveCmd("saveTags");
$this->setUserId($ilUser->getId());
$this->setInputFieldName("il_tags");
$tags_set = new ilSetting("tags");
$forbidden = $tags_set->get("forbidden_tags");
if ($forbidden != "")
{
$this->forbidden = unserialize($forbidden);
}
else
{
$this->forbidden = array();
}
}

+ Here is the call graph for this function:

ilTaggingGUI::setSaveCmd (   $a_savecmd)

Set Save Command.

Parameters
string$a_savecmdSave Command

Definition at line 95 of file class.ilTaggingGUI.php.

Referenced by setObject().

{
$this->savecmd = $a_savecmd;
}

+ Here is the caller graph for this function:

ilTaggingGUI::setUserId (   $a_userid)

Set User ID.

Parameters
int$a_useridUser ID

Definition at line 75 of file class.ilTaggingGUI.php.

Referenced by setObject().

{
$this->userid = $a_userid;
}

+ Here is the caller graph for this function:


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