Class ilTagging.
More...
|
static | writeTagsForUserAndObject ($a_obj_id, $a_obj_type, $a_sub_obj_id, $a_sub_obj_type, $a_user_id, $a_tags) |
| Write tags for a user and an object. More...
|
|
static | getTagsForUserAndObject ($a_obj_id, $a_obj_type, $a_sub_obj_id, $a_sub_obj_type, $a_user_id) |
| Get tags for a user and an object. More...
|
|
static | getTagsForObject ($a_obj_id, $a_obj_type, $a_sub_obj_id, $a_sub_obj_type, $a_only_online=true) |
| Get tags for an object. More...
|
|
static | getTagsForUser ($a_user_id, $a_max=0, $a_only_online=true) |
| Get tags for a user. More...
|
|
static | getObjectsForTagAndUser ($a_user_id, $a_tag) |
| Get objects for tag and user. More...
|
|
static | calculateFontSize ($cnt, $max) |
| Returns 100(%) for 1 and 150(%) for $max y = a + mx 100 = a + m (1) 150 = a + m * max (2) (1): a = 100 - m (3) (2): a = 150 - max*m (4) (3)&(4): m - 100 = max*m - 150 (5) (5) 50 = (max-1)*m => m = 50/(max -1) => a = 100 - 50/(max -1) More...
|
|
static | setTagsOfObjectOffline ($a_obj_id, $a_obj_type, $a_sub_obj_id, $a_sub_obj_type, $a_offline=true) |
| Set offline. More...
|
|
static | deleteTagsOfObject ($a_obj_id, $a_obj_type, $a_sub_obj_id, $a_sub_obj_type) |
| Deletes tags of an object. More...
|
|
static | _countTags ($a_obj_ids) |
| Count all tags for repository objects. More...
|
|
◆ _countTags()
static ilTagging::_countTags |
( |
|
$a_obj_ids | ) |
|
|
static |
Count all tags for repository objects.
- Parameters
-
array | $a_obj_ids | repository object IDs array |
Definition at line 310 of file class.ilTagging.php.
References $ilUser.
Referenced by ilObjectListGUI\preloadCommonProperties().
314 $q =
"SELECT count(*) c, obj_id FROM il_tag WHERE ".
315 $ilDB->in(
"obj_id", $a_obj_ids,
false,
"integer").
" AND ".
316 " user_id = ".$ilDB->quote($ilUser->getId(),
"integer").
320 $set = $ilDB->query($q);
321 while ($rec = $ilDB->fetchAssoc($set))
323 $cnt[$rec[
"obj_id"]] = $rec[
"c"];
◆ calculateFontSize()
static ilTagging::calculateFontSize |
( |
|
$cnt, |
|
|
|
$max |
|
) |
| |
|
static |
◆ deleteTagsOfObject()
static ilTagging::deleteTagsOfObject |
( |
|
$a_obj_id, |
|
|
|
$a_obj_type, |
|
|
|
$a_sub_obj_id, |
|
|
|
$a_sub_obj_type |
|
) |
| |
|
static |
Deletes tags of an object.
- Parameters
-
int | $a_obj_id | Object ID |
string | $a_obj_type | Object Type |
int | $a_sub_obj_id | Subobject ID |
string | $a_sub_obj_type | Subobject Type |
Definition at line 267 of file class.ilTagging.php.
Referenced by getObjectsForTagAndUser(), and ilTaggingAppEventListener\handleEvent().
271 if ($a_sub_obj_type ==
"")
273 $a_sub_obj_type =
"-";
276 $ilDB->manipulateF(
"DELETE FROM il_tag ".
279 "obj_type = %s AND ".
280 "sub_obj_id = %s AND ".
281 $ilDB->equals(
"sub_obj_type", $a_sub_obj_type,
"text",
true),
282 array(
"integer",
"text",
"integer"),
283 array($a_obj_id, $a_obj_type, $a_sub_obj_id));
◆ getObjectsForTagAndUser()
static ilTagging::getObjectsForTagAndUser |
( |
|
$a_user_id, |
|
|
|
$a_tag |
|
) |
| |
|
static |
Get objects for tag and user.
- Parameters
-
Definition at line 178 of file class.ilTagging.php.
References ilObject\_exists(), and deleteTagsOfObject().
Referenced by ilPDTaggingBlockGUI\showResourcesForTag().
182 $q =
"SELECT * FROM il_tag WHERE ".
183 "user_id = ".$ilDB->quote($a_user_id,
"integer").
184 " AND tag = ".$ilDB->quote($a_tag,
"text");
186 $set = $ilDB->query($q);
188 while($rec = $ilDB->fetchAssoc($set))
192 if ($rec[
"sub_obj_type"] ==
"-")
194 $rec[
"sub_obj_type"] =
"";
201 $rec[
"sub_obj_id"], $rec[
"sub_obj_type"]);
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data
static deleteTagsOfObject($a_obj_id, $a_obj_type, $a_sub_obj_id, $a_sub_obj_type)
Deletes tags of an object.
◆ getTagsForObject()
static ilTagging::getTagsForObject |
( |
|
$a_obj_id, |
|
|
|
$a_obj_type, |
|
|
|
$a_sub_obj_id, |
|
|
|
$a_sub_obj_type, |
|
|
|
$a_only_online = true |
|
) |
| |
|
static |
Get tags for an object.
- Parameters
-
int | $a_obj_id | Object ID |
string | $a_obj_type | Object Type |
int | $a_sub_obj_id | Subobject ID |
string | $a_sub_obj_type | Subobject Type |
Definition at line 112 of file class.ilTagging.php.
Referenced by ilTaggingGUI\getAllUserTagsForObjectHTML().
117 $online_str = ($a_only_online)
118 ? $online_str =
" AND is_offline = ".$ilDB->quote(0,
"integer").
" " 121 if ($a_sub_obj_type ==
"")
123 $a_sub_obj_type =
"-";
126 $q =
"SELECT count(user_id) as cnt, tag FROM il_tag WHERE ".
127 "obj_id = ".$ilDB->quote($a_obj_id,
"integer").
" AND ".
128 "obj_type = ".$ilDB->quote($a_obj_type,
"text").
" AND ".
129 "sub_obj_id = ".$ilDB->quote($a_sub_obj_id,
"integer").
" AND ".
130 $ilDB->equals(
"sub_obj_type", $a_sub_obj_type,
"text",
true).
132 "GROUP BY tag ORDER BY tag ASC";
133 $set = $ilDB->query($q);
135 while($rec = $ilDB->fetchAssoc($set))
◆ getTagsForUser()
static ilTagging::getTagsForUser |
( |
|
$a_user_id, |
|
|
|
$a_max = 0 , |
|
|
|
$a_only_online = true |
|
) |
| |
|
static |
Get tags for a user.
- Parameters
-
Definition at line 148 of file class.ilTagging.php.
References ilUtil\sortArray().
Referenced by ilPDTaggingBlockGUI\fillDataSection().
152 $online_str = ($a_only_online)
153 ? $online_str =
" AND is_offline = ".$ilDB->quote(0,
"integer").
" " 156 $set = $ilDB->query(
"SELECT count(*) as cnt, tag FROM il_tag WHERE ".
157 "user_id = ".$ilDB->quote($a_user_id,
"integer").
" ".
159 " GROUP BY tag ORDER BY cnt DESC");
162 while(($rec = $ilDB->fetchAssoc($set)) &&
163 ($a_max == 0 || $cnt <= $a_max))
static sortArray($array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
◆ getTagsForUserAndObject()
static ilTagging::getTagsForUserAndObject |
( |
|
$a_obj_id, |
|
|
|
$a_obj_type, |
|
|
|
$a_sub_obj_id, |
|
|
|
$a_sub_obj_type, |
|
|
|
$a_user_id |
|
) |
| |
|
static |
Get tags for a user and an object.
- Parameters
-
int | $a_obj_id | Object ID |
string | $a_obj_type | Object Type |
int | $a_sub_obj_id | Subobject ID |
string | $a_sub_obj_type | Subobject Type |
int | $a_user_id | User ID |
Definition at line 77 of file class.ilTagging.php.
Referenced by ilObjectListGUI\getHeaderAction(), ilTaggingGUI\getHTML(), and ilTaggingGUI\getTaggingInputHTML().
82 if ($a_sub_obj_type ==
"")
84 $a_sub_obj_type =
"-";
87 $q =
"SELECT * FROM il_tag WHERE ".
88 "user_id = ".$ilDB->quote($a_user_id,
"integer").
" AND ".
89 "obj_id = ".$ilDB->quote($a_obj_id,
"integer").
" AND ".
90 "obj_type = ".$ilDB->quote($a_obj_type,
"text").
" AND ".
91 "sub_obj_id = ".$ilDB->quote((
int) $a_sub_obj_id,
"integer").
" AND ".
92 $ilDB->equals(
"sub_obj_type", $a_sub_obj_type,
"text",
true).
94 $set = $ilDB->query($q);
96 while($rec = $ilDB->fetchAssoc($set))
98 $tags[] = $rec[
"tag"];
◆ getUsersForTag()
ilTagging::getUsersForTag |
( |
|
$a_tag | ) |
|
Get users for tag.
Definition at line 289 of file class.ilTagging.php.
Referenced by ilUserForTagTableGUI\__construct().
293 $set = $ilDB->query(
"SELECT DISTINCT user_id, firstname, lastname FROM il_tag JOIN usr_data ON (user_id = usr_id) ".
294 " WHERE LOWER(tag) = LOWER(".$ilDB->quote($a_tag,
"text").
")".
295 " ORDER BY lastname, firstname" 298 while ($rec = $ilDB->fetchAssoc($set))
300 $users[] = array(
"id" => $rec[
"user_id"]);
◆ setTagsOfObjectOffline()
static ilTagging::setTagsOfObjectOffline |
( |
|
$a_obj_id, |
|
|
|
$a_obj_type, |
|
|
|
$a_sub_obj_id, |
|
|
|
$a_sub_obj_type, |
|
|
|
$a_offline = true |
|
) |
| |
|
static |
Set offline.
- Parameters
-
int | $a_obj_id | Object ID |
string | $a_obj_type | Object Type |
int | $a_sub_obj_id | Subobject ID |
string | $a_sub_obj_type | Subobject Type |
boolean | $a_offline | Offline (true/false, true means offline!) |
Definition at line 239 of file class.ilTagging.php.
Referenced by ilTaggingAppEventListener\handleEvent().
244 if ($a_sub_obj_type ==
"")
246 $a_sub_obj_type =
"-";
249 $ilDB->manipulateF(
"UPDATE il_tag SET is_offline = %s ".
252 "obj_type = %s AND ".
253 "sub_obj_id = %s AND ".
254 $ilDB->equals(
"sub_obj_type", $a_sub_obj_type,
"text",
true),
255 array(
"boolean",
"integer",
"text",
"integer"),
256 array($a_offline, $a_obj_id, $a_obj_type, $a_sub_obj_id));
◆ writeTagsForUserAndObject()
static ilTagging::writeTagsForUserAndObject |
( |
|
$a_obj_id, |
|
|
|
$a_obj_type, |
|
|
|
$a_sub_obj_id, |
|
|
|
$a_sub_obj_type, |
|
|
|
$a_user_id, |
|
|
|
$a_tags |
|
) |
| |
|
static |
Write tags for a user and an object.
- Parameters
-
int | $a_obj_id | Object ID |
string | $a_obj_type | Object Type |
int | $a_sub_obj_id | Subobject ID |
string | $a_sub_obj_type | Subobject Type |
int | $a_user_id | User ID |
array | $a_tags | Tags |
Definition at line 27 of file class.ilTagging.php.
Referenced by ilTaggingGUI\saveInput(), and ilTaggingGUI\saveJS().
32 if ($a_sub_obj_type ==
"")
34 $a_sub_obj_type =
"-";
37 $ilDB->manipulate(
"DELETE FROM il_tag WHERE ".
38 "user_id = ".$ilDB->quote($a_user_id,
"integer").
" AND ".
39 "obj_id = ".$ilDB->quote($a_obj_id,
"integer").
" AND ".
40 "obj_type = ".$ilDB->quote($a_obj_type,
"text").
" AND ".
41 "sub_obj_id = ".$ilDB->quote((
int) $a_sub_obj_id,
"integer").
" AND ".
42 $ilDB->equals(
"sub_obj_type", $a_sub_obj_type,
"text",
true));
45 if (is_array($a_tags))
48 foreach($a_tags as $tag)
50 if (!in_array(strtolower($tag), $inserted))
52 $tag = str_replace(
" ",
"_", trim($tag));
53 $ilDB->manipulate(
"INSERT INTO il_tag (user_id, obj_id, obj_type,".
54 "sub_obj_id, sub_obj_type, tag) VALUES (".
55 $ilDB->quote($a_user_id,
"integer").
",".
56 $ilDB->quote($a_obj_id,
"integer").
",".
57 $ilDB->quote($a_obj_type,
"text").
",".
58 $ilDB->quote((
int) $a_sub_obj_id,
"integer").
",".
59 $ilDB->quote($a_sub_obj_type,
"text").
",".
60 $ilDB->quote($tag,
"text").
")");
62 $inserted[] = strtolower($tag);
The documentation for this class was generated from the following file: