4 include_once(
"Services/Table/classes/class.ilTable2GUI.php");
16 function __construct($a_parent_obj, $a_parent_cmd, $a_user_id = null)
22 $a_user_id = $ilUser->getId();
25 $this->
setId(
"bdgprs");
27 parent::__construct($a_parent_obj, $a_parent_cmd);
29 $this->
setTitle($lng->txt(
"badge_personal_badges"));
32 $this->
addColumn($lng->txt(
"title"),
"title");
33 $this->
addColumn($lng->txt(
"object"),
"parent_title");
34 $this->
addColumn($lng->txt(
"badge_issued_on"),
"issued_on");
35 $this->
addColumn($lng->txt(
"badge_in_profile"),
"active");
36 $this->
addColumn($lng->txt(
"actions"),
"");
43 $tpl->addJavascript(
"https://backpack.openbadges.org/issuer.js",
false);
45 $tpl->addJavascript(
"Services/Badge/js/ilBadge.js");
46 $tpl->addOnLoadCode(
'il.Badge.setUrl("'.
47 $ilCtrl->getLinkTarget($this->getParentObject(),
"addtoBackpack",
"",
true,
false).
53 $this->
setFormAction($ilCtrl->getFormAction($this->getParentObject()));
57 $this->
addMultiCommand(
"deactivate", $lng->txt(
"badge_remove_from_profile"));
60 $this->
addMultiCommand(
"addToBackpackMulti", $lng->txt(
"badge_add_to_backpack"));
72 $this->filter[
"title"] =
$title->getValue();
74 $lng->loadLanguageModule(
"search");
77 "" => $lng->txt(
"search_any"),
78 "-1" => $lng->txt(
"none")
83 $obj->setOptions(
$options + $a_parents);
84 $this->filter[
"obj"] = $obj->getValue();
93 include_once
"Services/Badge/classes/class.ilBadge.php";
94 include_once
"Services/Badge/classes/class.ilBadgeAssignment.php";
95 include_once
"Services/Badge/classes/class.ilBadgeRenderer.php";
98 $badge =
new ilBadge($ass->getBadgeId());
101 if($badge->getParentId())
104 if($parent[
"type"] ==
"bdga")
110 $filter_parent[$parent[
"id"]] =
111 "(".$lng->txt($parent[
"type"]).
") ".$parent[
"title"];
116 "id" => $badge->getId(),
117 "title" => $badge->getTitle(),
118 "image" => $badge->getImagePath(),
119 "issued_on" => $ass->getTimestamp(),
120 "parent_title" => $parent ? $parent[
"title"] : null,
122 "active" => (bool)$ass->getPosition(),
129 if($this->filter[
"title"])
133 if(!stristr(
$row[
"title"], $this->filter[
"title"]))
140 if($this->filter[
"obj"])
144 if($this->filter[
"obj"] > 0)
146 if(!
$row[
"parent"] ||
$row[
"parent"][
"id"] != $this->filter[
"obj"])
168 $this->tpl->setVariable(
"VAL_ID", $a_set[
"id"]);
169 $this->tpl->setVariable(
"PREVIEW", $a_set[
"renderer"]->
getHTML());
170 $this->tpl->setVariable(
"TXT_TITLE", $a_set[
"title"]);
172 $this->tpl->setVariable(
"TXT_ACTIVE", $a_set[
"active"]
178 $this->tpl->setVariable(
"TXT_PARENT", $a_set[
"parent_title"]);
179 $this->tpl->setVariable(
"SRC_PARENT",
183 include_once
"Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php";
185 $actions->setListTitle(
"");
187 $ilCtrl->setParameter($this->
getParentObject(),
"badge_id", $a_set[
"id"]);
192 $actions->addItem($lng->txt(!$a_set[
"active"]
193 ?
"badge_add_to_profile" 194 :
"badge_remove_from_profile")
199 $actions->addItem($lng->txt(
"badge_add_to_backpack"),
"",
"",
"",
"",
"",
"",
200 false,
"il.Badge.publish(".$a_set[
"id"].
");");
203 $this->tpl->setVariable(
"ACTIONS", $actions->getHTML());
static _getIcon($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
Get icon for repository item.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
addFilterItemByMetaType($id, $type=self::FILTER_TEXT, $a_optional=false, $caption=NULL)
Add filter by standard type.
initFilters(array $a_parents)
getParentObject()
Get parent object.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
__construct($a_parent_obj, $a_parent_cmd, $a_user_id=null)
if(!is_array($argv)) $options
addMultiCommand($a_cmd, $a_text)
Add Command button.
static formatDate(ilDateTime $date)
Format a date public.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
TableGUI class for user badge listing.
Create styles array
The data for the language used.
User interface class for advanced drop-down selection lists.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
setSelectAllCheckbox($a_select_all_checkbox)
Set the name of the checkbox that should be toggled with a select all button.
addColumn($a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="", $a_tooltip_with_html=false)
Add a column to the header.
static getInstancesByUserId($a_user_id)
static getInstance()
Constructor.