ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilObjBadgeAdministrationGUI Class Reference

Badge Administration Settings. More...

+ Inheritance diagram for ilObjBadgeAdministrationGUI:
+ Collaboration diagram for ilObjBadgeAdministrationGUI:

Public Member Functions

 __construct ($a_data, $a_id, $a_call_by_reference=true, $a_prepare_output=true)
 
 executeCommand ()
 
 getAdminTabs ()
 
- Public Member Functions inherited from ilObjectGUI
 executeCommand ()
 execute command More...
 
 withReferences ()
 determines wether objects are referenced or not (got ref ids or not) More...
 
 setCreationMode ($a_mode=true)
 if true, a creation screen is displayed the current $_GET[ref_id] don't belong to the current class! the mode is determined in ilrepositorygui More...
 
 getCreationMode ()
 get creation mode More...
 
 prepareOutput ($a_show_subobjects=true)
 prepare output More...
 
 getAdminTabs ()
 administration tabs show only permissions and trash folder More...
 
 getHTML ()
 
 confirmedDeleteObject ()
 confirmed deletion of object -> objects are moved to trash or deleted immediately, if trash is disabled More...
 
 cancelDeleteObject ()
 cancel deletion of object More...
 
 cancelObject ()
 cancel action and go back to previous page public More...
 
 createObject ()
 create new object form More...
 
 cancelCreation ()
 cancel create action and go back to repository parent More...
 
 saveObject ()
 save object More...
 
 editObject ()
 edit object More...
 
 addExternalEditFormCustom (ilPropertyFormGUI $a_form)
 
 updateObject ()
 updates object entry in object_data More...
 
 getFormAction ($a_cmd, $a_formaction="")
 get form action for command (command is method name without "Object", e.g. More...
 
 isVisible ($a_ref_id, $a_type)
 
 viewObject ()
 list childs of current object More...
 
 deleteObject ($a_error=false)
 Display deletion confirmation screen. More...
 
 cloneAllObject ()
 Clone single (not container object) Method is overwritten in ilContainerGUI. More...
 

Protected Member Functions

 assertActive ()
 
 editSettings ($a_form=null)
 
 saveSettings ()
 
 initFormSettings ()
 
 listTypes ()
 
 activateTypes ()
 
 deactivateTypes ()
 
 listImageTemplates ()
 
 addImageTemplate (ilPropertyFormGUI $a_form=null)
 
 initImageTemplateForm ($a_mode)
 
 saveImageTemplate ()
 
 editImageTemplate (ilPropertyFormGUI $a_form=null)
 
 setImageTemplateFormValues (ilPropertyFormGUI $a_form, ilBadgeImageTemplate $a_tmpl)
 
 updateImageTemplate ()
 
 confirmDeleteImageTemplates ()
 
 deleteImageTemplates ()
 
 listObjectBadges ()
 
 applyObjectFilter ()
 
 resetObjectFilter ()
 
 listObjectBadgeUsers ()
 
 applyUserFilter ()
 
 resetUserFilter ()
 
 getObjectBadgesFromMultiAction ()
 
 toggleObjectBadges ($a_status)
 
 activateObjectBadges ()
 
 deactivateObjectBadges ()
 
 confirmDeleteObjectBadges ()
 
 deleteObjectBadges ()
 
- Protected Member Functions inherited from ilObjectGUI
 assignObject ()
 
 setTitleAndDescription ()
 called by prepare output More...
 
 initHeaderAction ($a_sub_type=null, $a_sub_id=null)
 Add header action menu. More...
 
 insertHeaderAction ($a_list_gui)
 Insert header action into main template. More...
 
 addHeaderAction ()
 Add header action menu. More...
 
 redrawHeaderActionObject ()
 Ajax call: redraw action header only. More...
 
 showMountWebfolderIcon ()
 
 setTabs ()
 set admin tabs public More...
 
 setAdminTabs ()
 set admin tabs public More...
 
 setLocator ()
 set Locator More...
 
 addLocatorItems ()
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 omitLocator ($a_omit=true)
 
 addAdminLocatorItems ($a_do_not_add_object=false)
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 initCreationForms ($a_new_type)
 Init creation froms. More...
 
 getCreationFormsHTML (array $a_forms)
 Get HTML for creation forms (accordion) More...
 
 initCreateForm ($a_new_type)
 Init object creation form. More...
 
 initDidacticTemplate (ilPropertyFormGUI $form)
 Show didactic template types. More...
 
 addDidacticTemplateOptions (array &$a_options)
 Add custom templates. More...
 
 getDidacticTemplateVar ($a_type)
 Get didactic template setting from creation screen. More...
 
 putObjectInTree (ilObject $a_obj, $a_parent_node_id=null)
 Add object to tree at given position. More...
 
 afterSave (ilObject $a_new_object)
 Post (successful) object creation hook. More...
 
 initEditForm ()
 Init object edit form. More...
 
 initEditCustomForm (ilPropertyFormGUI $a_form)
 Add custom fields to update form. More...
 
 getEditFormValues ()
 Get values for edit form. More...
 
 getEditFormCustomValues (array &$a_values)
 Add values to custom edit fields. More...
 
 validateCustom (ilPropertyFormGUI $a_form)
 Validate custom values (if not possible with checkInput()) More...
 
 updateCustom (ilPropertyFormGUI $a_form)
 Insert custom update form values into object. More...
 
 afterUpdate ()
 Post (successful) object update hook. More...
 
 initImportForm ($a_new_type)
 Init object import form. More...
 
 importFileObject ($parent_id=null, $a_catch_errors=true)
 Import. More...
 
 afterImport (ilObject $a_new_object)
 Post (successful) object import hook. More...
 
 setFormAction ($a_cmd, $a_formaction)
 set specific form action for command More...
 
 getReturnLocation ($a_cmd, $a_location="")
 get return location for command (command is method name without "Object", e.g. More...
 
 setReturnLocation ($a_cmd, $a_location)
 set specific return location for command More...
 
 getTargetFrame ($a_cmd, $a_target_frame="")
 get target frame for command (command is method name without "Object", e.g. More...
 
 setTargetFrame ($a_cmd, $a_target_frame)
 set specific target frame for command More...
 
 showPossibleSubObjects ()
 show possible subobjects (pulldown menu) More...
 
 getTemplateFile ($a_cmd, $a_type="")
 get a template blockfile format: tpl. More...
 
 getTabs ()
 get tabs abstract method. More...
 
 __showButton ($a_cmd, $a_text, $a_target='')
 
 hitsperpageObject ()
 
__initTableGUI ()
 
 __setTableGUIBasicData (&$tbl, &$result_set, $a_from="")
 standard implementation for tables use 'from' variable use different initial setting of table More...
 
 redirectToRefId ($a_ref_id, $a_cmd="")
 redirects to (repository) view per ref id usually to a container and usually used at the end of a save/import method where the object gui type (of the new object) doesn't match with the type of the current $_GET["ref_id"] value More...
 
 fillCloneTemplate ($a_tpl_varname, $a_type)
 Fill object clone template This method can be called from any object GUI class that wants to offer object cloning. More...
 
 getCenterColumnHTML ()
 Get center column. More...
 
 getRightColumnHTML ()
 Display right column. More...
 
 setColumnSettings (ilColumnGUI $column_gui)
 May be overwritten in subclasses. More...
 
 checkPermission ($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
 Check permission and redirect on error. More...
 
 checkPermissionBool ($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
 Check permission. More...
 
 enableDragDropFileUpload ()
 Enables the file upload into this object by dropping files. More...
 
 handleAutoRating (ilObject $a_new_obj)
 Activate rating automatically if parent container setting. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from ilObjectGUI
static _gotoRepositoryRoot ($a_raise_error=false)
 Goto repository root. More...
 
static _gotoRepositoryNode ($a_ref_id, $a_cmd="frameset")
 Goto repository root. More...
 
- Data Fields inherited from ilObjectGUI
const COPY_WIZARD_NEEDS_PAGE = 1
 
 $ilias
 
 $objDefinition
 
 $tpl
 
 $tree
 
 $lng
 
 $data
 
 $object
 
 $ref_id
 
 $obj_id
 
 $maxcount
 
 $formaction
 
 $return_location
 
 $target_frame
 
 $tab_target_script
 
 $actions
 
 $sub_objects
 
 $omit_locator = false
 
const CFORM_NEW = 1
 
const CFORM_IMPORT = 2
 
const CFORM_CLONE = 3
 
- Protected Attributes inherited from ilObjectGUI
 $tmp_import_dir
 
 $tabs_gui = null
 
 $ctrl
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilObjBadgeAdministrationGUI::__construct (   $a_data,
  $a_id,
  $a_call_by_reference = true,
  $a_prepare_output = true 
)

Definition at line 20 of file class.ilObjBadgeAdministrationGUI.php.

21  {
22  $this->type = "bdga";
23  parent::__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
24 
25  $this->lng->loadLanguageModule("badge");
26  }

Member Function Documentation

◆ activateObjectBadges()

ilObjBadgeAdministrationGUI::activateObjectBadges ( )
protected

Definition at line 658 of file class.ilObjBadgeAdministrationGUI.php.

References toggleObjectBadges().

659  {
660  $this->toggleObjectBadges(true);
661  }
+ Here is the call graph for this function:

◆ activateTypes()

ilObjBadgeAdministrationGUI::activateTypes ( )
protected

Definition at line 228 of file class.ilObjBadgeAdministrationGUI.php.

References $_POST, ilObjectGUI\$lng, array, assertActive(), ilObjectGUI\checkPermissionBool(), ilBadgeHandler\getInstance(), and ilUtil\sendSuccess().

229  {
230  global $lng;
231 
232  $this->assertActive();
233 
234  $ids = $_POST["id"];
235  if($this->checkPermissionBool("write") &&
236  sizeof($ids))
237  {
238  $handler = ilBadgeHandler::getInstance();
239  $inactive = array();
240  foreach($handler->getInactiveTypes() as $type)
241  {
242  if(!in_array($type, $ids))
243  {
244  $inactive[] = $type;
245  }
246  }
247  $handler->setInactiveTypes($inactive);
248 
249  ilUtil::sendSuccess($lng->txt("settings_saved"), true);
250  }
251  $this->ctrl->redirect($this, "listTypes");
252  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
Create styles array
The data for the language used.
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission.
$_POST["username"]
static getInstance()
Constructor.
+ Here is the call graph for this function:

◆ addImageTemplate()

ilObjBadgeAdministrationGUI::addImageTemplate ( ilPropertyFormGUI  $a_form = null)
protected

Definition at line 297 of file class.ilObjBadgeAdministrationGUI.php.

References ilObjectGUI\$tpl, assertActive(), ilObjectGUI\checkPermission(), and initImageTemplateForm().

Referenced by saveImageTemplate().

298  {
299  global $tpl;
300 
301  $this->checkPermission("write");
302 
303  $this->assertActive();
304  $this->tabs_gui->setTabActive("imgtmpl");
305 
306  if(!$a_form)
307  {
308  $a_form = $this->initImageTemplateForm("create");
309  }
310 
311  $tpl->setContent($a_form->getHTML());
312  }
checkPermission($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission and redirect on error.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ applyObjectFilter()

ilObjBadgeAdministrationGUI::applyObjectFilter ( )
protected

Definition at line 556 of file class.ilObjBadgeAdministrationGUI.php.

References $tbl, and listObjectBadges().

557  {
558  global $ilAccess;
559 
560  include_once "Services/Badge/classes/class.ilObjectBadgeTableGUI.php";
561  $tbl = new ilObjectBadgeTableGUI($this, "listObjectBadges",
562  $ilAccess->checkAccess("write", "", $this->object->getRefId()));
563  $tbl->resetOffset();
564  $tbl->writeFilterToSession();
565  $this->listObjectBadges();
566  }
$tbl
Definition: example_048.php:81
TableGUI class for badge listing.
+ Here is the call graph for this function:

◆ applyUserFilter()

ilObjBadgeAdministrationGUI::applyUserFilter ( )
protected

Definition at line 603 of file class.ilObjBadgeAdministrationGUI.php.

References $tbl, and listObjectBadgeUsers().

604  {
605  include_once "Services/Badge/classes/class.ilBadgeUserTableGUI.php";
606  $tbl = new ilBadgeUserTableGUI($this, "listUsers", null, null, $parent_obj_id, (int)$_REQUEST["bid"]);
607  $tbl->resetOffset();
608  $tbl->writeFilterToSession();
609  $this->listObjectBadgeUsers();
610  }
$tbl
Definition: example_048.php:81
TableGUI class for badge user listing.
+ Here is the call graph for this function:

◆ assertActive()

ilObjBadgeAdministrationGUI::assertActive ( )
protected

Definition at line 102 of file class.ilObjBadgeAdministrationGUI.php.

References ilBadgeHandler\getInstance().

Referenced by activateTypes(), addImageTemplate(), deactivateTypes(), editImageTemplate(), executeCommand(), listImageTemplates(), listObjectBadges(), listObjectBadgeUsers(), and listTypes().

103  {
104  if(!ilBadgeHandler::getInstance()->isActive())
105  {
106  $this->ctrl->redirect($this, "editSettings");
107  }
108  }
static getInstance()
Constructor.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ confirmDeleteImageTemplates()

ilObjBadgeAdministrationGUI::confirmDeleteImageTemplates ( )
protected

Definition at line 483 of file class.ilObjBadgeAdministrationGUI.php.

References $ilCtrl, ilObjectGUI\$lng, ilObjectGUI\$tpl, and ilObjectGUI\checkPermission().

484  {
485  global $ilCtrl, $lng, $tpl, $ilTabs;
486 
487  $this->checkPermission("write");
488 
489  $tmpl_ids = $_REQUEST["id"];
490  if(!$tmpl_ids)
491  {
492  $ilCtrl->redirect($this, "listImageTemplates");
493  }
494 
495  $ilTabs->clearTargets();
496  $ilTabs->setBackTarget($lng->txt("back"),
497  $ilCtrl->getLinkTarget($this, "listImageTemplates"));
498 
499  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
500  $confirmation_gui = new ilConfirmationGUI();
501  $confirmation_gui->setFormAction($ilCtrl->getFormAction($this));
502  $confirmation_gui->setHeaderText($lng->txt("badge_template_deletion_confirmation"));
503  $confirmation_gui->setCancel($lng->txt("cancel"), "listImageTemplates");
504  $confirmation_gui->setConfirm($lng->txt("delete"), "deleteImageTemplates");
505 
506  include_once("./Services/Badge/classes/class.ilBadgeImageTemplate.php");
507  foreach($tmpl_ids as $tmpl_id)
508  {
509  $tmpl = new ilBadgeImageTemplate($tmpl_id);
510  $confirmation_gui->addItem("id[]", $tmpl_id, $tmpl->getTitle());
511  }
512 
513  $tpl->setContent($confirmation_gui->getHTML());
514  }
global $ilCtrl
Definition: ilias.php:18
checkPermission($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission and redirect on error.
Confirmation screen class.
+ Here is the call graph for this function:

◆ confirmDeleteObjectBadges()

ilObjBadgeAdministrationGUI::confirmDeleteObjectBadges ( )
protected

Definition at line 668 of file class.ilObjBadgeAdministrationGUI.php.

References $ilCtrl, ilObjectGUI\$lng, ilObjectGUI\$tpl, ilBadgeAssignment\getInstancesByBadgeId(), and getObjectBadgesFromMultiAction().

669  {
670  global $ilCtrl, $lng, $tpl, $ilTabs;
671 
672  $badge_ids = $this->getObjectBadgesFromMultiAction();
673 
674  $ilTabs->clearTargets();
675  $ilTabs->setBackTarget($lng->txt("back"),
676  $ilCtrl->getLinkTarget($this, "listObjectBadges"));
677 
678  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
679  $confirmation_gui = new ilConfirmationGUI();
680  $confirmation_gui->setFormAction($ilCtrl->getFormAction($this));
681  $confirmation_gui->setHeaderText($lng->txt("badge_deletion_confirmation"));
682  $confirmation_gui->setCancel($lng->txt("cancel"), "listObjectBadges");
683  $confirmation_gui->setConfirm($lng->txt("delete"), "deleteObjectBadges");
684 
685  include_once "Services/Badge/classes/class.ilBadge.php";
686  include_once "Services/Badge/classes/class.ilBadgeAssignment.php";
687  foreach($badge_ids as $badge_id)
688  {
689  $badge = new ilBadge($badge_id);
690  $parent = $badge->getParentMeta();
691 
692  // :TODO: container presentation
693  $container = "(".$parent["type"]."/".
694  $parent["id"].") ".
695  $parent["title"];
696  if((bool)$parent["deleted"])
697  {
698  $container .= ' <span class="il_ItemAlertProperty">'.$lng->txt("deleted").'</span>';
699  }
700 
701  $confirmation_gui->addItem(
702  "id[]",
703  $badge_id,
704  $container." - ".
705  $badge->getTitle().
706  " (".sizeof(ilBadgeAssignment::getInstancesByBadgeId($badge_id)).")"
707  );
708  }
709 
710  $tpl->setContent($confirmation_gui->getHTML());
711  }
global $ilCtrl
Definition: ilias.php:18
static getInstancesByBadgeId($a_badge_id)
Confirmation screen class.
+ Here is the call graph for this function:

◆ deactivateObjectBadges()

ilObjBadgeAdministrationGUI::deactivateObjectBadges ( )
protected

Definition at line 663 of file class.ilObjBadgeAdministrationGUI.php.

References toggleObjectBadges().

664  {
665  $this->toggleObjectBadges(false);
666  }
+ Here is the call graph for this function:

◆ deactivateTypes()

ilObjBadgeAdministrationGUI::deactivateTypes ( )
protected

Definition at line 254 of file class.ilObjBadgeAdministrationGUI.php.

References $_POST, ilObjectGUI\$lng, assertActive(), ilObjectGUI\checkPermissionBool(), ilBadgeHandler\getInstance(), and ilUtil\sendSuccess().

255  {
256  global $lng;
257 
258  $this->assertActive();
259 
260  $ids = $_POST["id"];
261  if($this->checkPermissionBool("write") &&
262  sizeof($ids))
263  {
264  $handler = ilBadgeHandler::getInstance();
265  $inactive = array_merge($handler->getInactiveTypes(), $ids);
266  $handler->setInactiveTypes($inactive);
267 
268  ilUtil::sendSuccess($lng->txt("settings_saved"), true);
269  }
270  $this->ctrl->redirect($this, "listTypes");
271  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission.
$_POST["username"]
static getInstance()
Constructor.
+ Here is the call graph for this function:

◆ deleteImageTemplates()

ilObjBadgeAdministrationGUI::deleteImageTemplates ( )
protected

Definition at line 516 of file class.ilObjBadgeAdministrationGUI.php.

References $ilCtrl, ilObjectGUI\$lng, ilObjectGUI\checkPermission(), and ilUtil\sendSuccess().

517  {
518  global $ilCtrl, $lng;
519 
520  $this->checkPermission("write");
521 
522  $tmpl_ids = $_REQUEST["id"];
523  if($tmpl_ids)
524  {
525  include_once("./Services/Badge/classes/class.ilBadgeImageTemplate.php");
526  foreach($tmpl_ids as $tmpl_id)
527  {
528  $tmpl = new ilBadgeImageTemplate($tmpl_id);
529  $tmpl->delete();
530  }
531 
532  ilUtil::sendSuccess($lng->txt("settings_saved"), true);
533  }
534 
535  $ilCtrl->redirect($this, "listImageTemplates");
536  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
global $ilCtrl
Definition: ilias.php:18
checkPermission($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission and redirect on error.
+ Here is the call graph for this function:

◆ deleteObjectBadges()

ilObjBadgeAdministrationGUI::deleteObjectBadges ( )
protected

Definition at line 713 of file class.ilObjBadgeAdministrationGUI.php.

References $ilCtrl, ilObjectGUI\$lng, getObjectBadgesFromMultiAction(), and ilUtil\sendSuccess().

714  {
715  global $ilCtrl, $lng;
716 
717  $badge_ids = $this->getObjectBadgesFromMultiAction();
718 
719  include_once "Services/Badge/classes/class.ilBadge.php";
720  foreach($badge_ids as $badge_id)
721  {
722  $badge = new ilBadge($badge_id);
723  $badge->delete();
724  }
725 
726  ilUtil::sendSuccess($lng->txt("settings_saved"), true);
727  $ilCtrl->redirect($this, "listObjectBadges");
728  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
global $ilCtrl
Definition: ilias.php:18
+ Here is the call graph for this function:

◆ editImageTemplate()

ilObjBadgeAdministrationGUI::editImageTemplate ( ilPropertyFormGUI  $a_form = null)
protected

Definition at line 393 of file class.ilObjBadgeAdministrationGUI.php.

References $ilCtrl, ilObjectGUI\$tpl, assertActive(), ilObjectGUI\checkPermission(), initImageTemplateForm(), and setImageTemplateFormValues().

Referenced by updateImageTemplate().

394  {
395  global $ilCtrl, $tpl;
396 
397  $this->checkPermission("write");
398 
399  $this->assertActive();
400  $this->tabs_gui->setTabActive("imgtmpl");
401 
402  $tmpl_id = $_REQUEST["tid"];
403  if(!$tmpl_id)
404  {
405  $ilCtrl->redirect($this, "listImageTemplates");
406  }
407 
408  $ilCtrl->setParameter($this, "tid", $tmpl_id);
409 
410  include_once "Services/Badge/classes/class.ilBadgeImageTemplate.php";
411  $tmpl = new ilBadgeImageTemplate($tmpl_id);
412 
413  if(!$a_form)
414  {
415  $a_form = $this->initImageTemplateForm("edit");
416  $this->setImageTemplateFormValues($a_form, $tmpl);
417  }
418 
419  $tpl->setContent($a_form->getHTML());
420  }
setImageTemplateFormValues(ilPropertyFormGUI $a_form, ilBadgeImageTemplate $a_tmpl)
global $ilCtrl
Definition: ilias.php:18
checkPermission($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission and redirect on error.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ editSettings()

ilObjBadgeAdministrationGUI::editSettings (   $a_form = null)
protected

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

References initFormSettings().

Referenced by saveSettings().

116  {
117  $this->tabs_gui->setTabActive("settings");
118 
119  if(!$a_form)
120  {
121  $a_form = $this->initFormSettings();
122  }
123 
124  $this->tpl->setContent($a_form->getHTML());
125  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilObjBadgeAdministrationGUI::executeCommand ( )

Definition at line 28 of file class.ilObjBadgeAdministrationGUI.php.

References $cmd, assertActive(), and ilObjectGUI\prepareOutput().

29  {
30  $next_class = $this->ctrl->getNextClass($this);
31  $cmd = $this->ctrl->getCmd();
32 
33  $this->prepareOutput();
34 
35  switch($next_class)
36  {
37  case 'ilpermissiongui':
38  $this->tabs_gui->setTabActive('perm_settings');
39  include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
40  $perm_gui = new ilPermissionGUI($this);
41  $this->ctrl->forwardCommand($perm_gui);
42  break;
43 
44  case 'ilbadgemanagementgui':
45  $this->assertActive();
46  $this->tabs_gui->setTabActive('activity');
47  include_once "Services/Badge/classes/class.ilBadgeManagementGUI.php";
48  $gui = new ilBadgeManagementGUI($this->ref_id, $this->obj_id, $this->type);
49  $this->ctrl->forwardCommand($gui);
50  break;
51 
52  default:
53  if(!$cmd || $cmd == 'view')
54  {
55  $cmd = "editSettings";
56  }
57 
58  $this->$cmd();
59  break;
60  }
61  return true;
62  }
$cmd
Definition: sahs_server.php:35
prepareOutput($a_show_subobjects=true)
prepare output
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
+ Here is the call graph for this function:

◆ getAdminTabs()

ilObjBadgeAdministrationGUI::getAdminTabs ( )

Definition at line 64 of file class.ilObjBadgeAdministrationGUI.php.

References ilBadgeHandler\getInstance().

65  {
66  global $rbacsystem;
67 
68  if ($rbacsystem->checkAccess("visible,read",$this->object->getRefId()))
69  {
70  $this->tabs_gui->addTab("settings",
71  $this->lng->txt("settings"),
72  $this->ctrl->getLinkTarget($this, "editSettings"));
73 
74  if(ilBadgeHandler::getInstance()->isActive())
75  {
76  $this->tabs_gui->addTab("types",
77  $this->lng->txt("badge_types"),
78  $this->ctrl->getLinkTarget($this, "listTypes"));
79 
80  $this->tabs_gui->addTab("imgtmpl",
81  $this->lng->txt("badge_image_templates"),
82  $this->ctrl->getLinkTarget($this, "listImageTemplates"));
83 
84  $this->tabs_gui->addTab("activity",
85  $this->lng->txt("badge_activity_badges"),
86  $this->ctrl->getLinkTargetByClass("ilbadgemanagementgui", ""));
87 
88  $this->tabs_gui->addTab("obj_badges",
89  $this->lng->txt("badge_object_badges"),
90  $this->ctrl->getLinkTarget($this, "listObjectBadges"));
91  }
92  }
93 
94  if ($rbacsystem->checkAccess('edit_permission',$this->object->getRefId()))
95  {
96  $this->tabs_gui->addTab("perm_settings",
97  $this->lng->txt("perm_settings"),
98  $this->ctrl->getLinkTargetByClass('ilpermissiongui',"perm"));
99  }
100  }
static getInstance()
Constructor.
+ Here is the call graph for this function:

◆ getObjectBadgesFromMultiAction()

ilObjBadgeAdministrationGUI::getObjectBadgesFromMultiAction ( )
protected

Definition at line 626 of file class.ilObjBadgeAdministrationGUI.php.

References $ilCtrl.

Referenced by confirmDeleteObjectBadges(), deleteObjectBadges(), and toggleObjectBadges().

627  {
628  global $ilAccess, $ilCtrl;
629 
630  $badge_ids = $_REQUEST["id"];
631  if(!$badge_ids ||
632  !$ilAccess->checkAccess("write", "", $this->object->getRefId()))
633  {
634  $ilCtrl->redirect($this, "listObjectBadges");
635  }
636 
637  return $badge_ids;
638  }
global $ilCtrl
Definition: ilias.php:18
+ Here is the caller graph for this function:

◆ initFormSettings()

ilObjBadgeAdministrationGUI::initFormSettings ( )
protected

Definition at line 157 of file class.ilObjBadgeAdministrationGUI.php.

References ilBadgeHandler\getInstance(), and ilFormPropertyGUI\setInfo().

Referenced by editSettings(), and saveSettings().

158  {
159  global $ilAccess;
160 
161  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
162  $form = new ilPropertyFormGUI();
163  $form->setFormAction($this->ctrl->getFormAction($this));
164  $form->setTitle($this->lng->txt("badge_settings"));
165 
166  if ($ilAccess->checkAccess("write", "", $this->object->getRefId()))
167  {
168  $form->addCommandButton("saveSettings", $this->lng->txt("save"));
169  $form->addCommandButton("editSettings", $this->lng->txt("cancel"));
170  }
171 
172  $act = new ilCheckboxInputGUI($this->lng->txt("badge_service_activate"), "act");
173  $act->setInfo($this->lng->txt("badge_service_activate_info"));
174  $form->addItem($act);
175 
176  /* see bug #0020124
177  $obi = new ilCheckboxInputGUI($this->lng->txt("badge_obi_activate"), "obi");
178  $obi->setInfo($this->lng->txt("badge_obi_activate_info"));
179  $form->addItem($obi);
180 
181  $obi_org = new ilTextInputGUI($this->lng->txt("badge_obi_organisation"), "obi_org");
182  $obi_org->setRequired(true);
183  $obi_org->setInfo($this->lng->txt("badge_obi_organisation_info"));
184  $obi->addSubItem($obi_org);
185 
186  $obi_contact = new ilEmailInputGUI($this->lng->txt("badge_obi_contact"), "obi_cont");
187  $obi_contact->setRequired(true);
188  $obi_contact->setInfo($this->lng->txt("badge_obi_contact_info"));
189  $obi->addSubItem($obi_contact);
190 
191  $obi_salt = new ilTextInputGUI($this->lng->txt("badge_obi_salt"), "obi_salt");
192  $obi_salt->setRequired(true);
193  $obi_salt->setInfo($this->lng->txt("badge_obi_salt_info"));
194  $obi->addSubItem($obi_salt);
195  */
196 
197  $handler = ilBadgeHandler::getInstance();
198  $act->setChecked($handler->isActive());
199 
200  /* see bug 0020124
201  $obi->setChecked($handler->isObiActive());
202  $obi_org->setValue($handler->getObiOrganistation());
203  $obi_contact->setValue($handler->getObiContact());
204  $obi_salt->setValue($handler->getObiSalt());
205  */
206 
207  return $form;
208  }
This class represents a property form user interface.
This class represents a checkbox property in a property form.
setInfo($a_info)
Set Information Text.
static getInstance()
Constructor.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initImageTemplateForm()

ilObjBadgeAdministrationGUI::initImageTemplateForm (   $a_mode)
protected

Definition at line 314 of file class.ilObjBadgeAdministrationGUI.php.

References $ilCtrl, $img, ilObjectGUI\$lng, $title, array, ilBadgeHandler\getInstance(), and ilFormPropertyGUI\setRequired().

Referenced by addImageTemplate(), editImageTemplate(), saveImageTemplate(), and updateImageTemplate().

315  {
316  global $lng, $ilCtrl;
317 
318  include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
319  $form = new ilPropertyFormGUI();
320  $form->setFormAction($ilCtrl->getFormAction($this, "saveBadge"));
321  $form->setTitle($lng->txt("badge_image_template_form"));
322 
323  $title = new ilTextInputGUI($lng->txt("title"), "title");
324  $title->setRequired(true);
325  $form->addItem($title);
326 
327  $img = new ilImageFileInputGUI($lng->txt("image"), "img");
328  $img->setSuffixes(array("png", "svg"));
329  if($a_mode == "create")
330  {
331  $img->setRequired(true);
332  }
333  $img->setALlowDeletion(false);
334  $form->addItem($img);
335 
336  $types_mode = new ilRadioGroupInputGUI($lng->txt("badge_template_types"), "tmode");
337  $types_mode->setRequired(true);
338  $form->addItem($types_mode);
339 
340  $type_all = new ilRadioOption($lng->txt("badge_template_types_all"), "all");
341  $types_mode->addOption($type_all);
342 
343  $type_spec = new ilRadioOption($lng->txt("badge_template_types_specific"), "spec");
344  $types_mode->addOption($type_spec);
345 
346  $types = new ilCheckboxGroupInputGUI($lng->txt("badge_types"), "type");
347  $types->setRequired(true);
348  $type_spec->addSubItem($types);
349 
350  foreach(ilBadgeHandler::getInstance()->getAvailableTypes() as $id => $type)
351  {
352  $types->addOption(new ilCheckboxOption($type->getCaption(), $id));
353  }
354 
355  if($a_mode == "create")
356  {
357  $form->addCommandButton("saveImageTemplate", $lng->txt("save"));
358  }
359  else
360  {
361  $form->addCommandButton("updateImageTemplate", $lng->txt("save"));
362  }
363  $form->addCommandButton("listImageTemplates", $lng->txt("cancel"));
364 
365  return $form;
366  }
This class represents an option in a radio group.
This class represents an option in a checkbox group.
This class represents a property form user interface.
global $ilCtrl
Definition: ilias.php:18
This class represents a property in a property form.
This class represents a text property in a property form.
This class represents a property in a property form.
Create styles array
The data for the language used.
This class represents an image file property in a property form.
setRequired($a_required)
Set Required.
static getInstance()
Constructor.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ listImageTemplates()

ilObjBadgeAdministrationGUI::listImageTemplates ( )
protected

Definition at line 278 of file class.ilObjBadgeAdministrationGUI.php.

References $ilCtrl, ilObjectGUI\$lng, $tbl, assertActive(), and ilObjectGUI\checkPermissionBool().

279  {
280  global $ilAccess, $lng, $ilToolbar, $ilCtrl;
281 
282  $this->assertActive();
283  $this->tabs_gui->setTabActive("imgtmpl");
284 
285  if($this->checkPermissionBool("write"))
286  {
287  $ilToolbar->addButton($lng->txt("badge_add_template"),
288  $ilCtrl->getLinkTarget($this, "addImageTemplate"));
289  }
290 
291  include_once "Services/Badge/classes/class.ilBadgeImageTemplateTableGUI.php";
292  $tbl = new ilBadgeImageTemplateTableGUI($this, "listImageTemplates",
293  $ilAccess->checkAccess("write", "", $this->object->getRefId()));
294  $this->tpl->setContent($tbl->getHTML());
295  }
$tbl
Definition: example_048.php:81
global $ilCtrl
Definition: ilias.php:18
TableGUI class for badge template listing.
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission.
+ Here is the call graph for this function:

◆ listObjectBadges()

ilObjBadgeAdministrationGUI::listObjectBadges ( )
protected

Definition at line 543 of file class.ilObjBadgeAdministrationGUI.php.

References $tbl, ilObjectGUI\$tpl, and assertActive().

Referenced by applyObjectFilter(), and resetObjectFilter().

544  {
545  global $ilAccess, $tpl;
546 
547  $this->assertActive();
548  $this->tabs_gui->setTabActive("obj_badges");
549 
550  include_once("./Services/Badge/classes/class.ilObjectBadgeTableGUI.php");
551  $tbl = new ilObjectBadgeTableGUI($this, "listObjectBadges",
552  $ilAccess->checkAccess("write", "", $this->object->getRefId()));
553  $tpl->setContent($tbl->getHTML());
554  }
$tbl
Definition: example_048.php:81
TableGUI class for badge listing.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ listObjectBadgeUsers()

ilObjBadgeAdministrationGUI::listObjectBadgeUsers ( )
protected

Definition at line 580 of file class.ilObjBadgeAdministrationGUI.php.

References $ilCtrl, ilObjectGUI\$lng, $tbl, ilObjectGUI\$tpl, and assertActive().

Referenced by applyUserFilter(), and resetUserFilter().

581  {
582  global $ilCtrl, $lng, $tpl;
583 
584  $parent_obj_id = $_REQUEST["pid"];
585  if(!$parent_obj_id)
586  {
587  $ilCtrl->redirect($this, "listObjectBadges");
588  }
589 
590  $this->assertActive();
591 
592  $this->tabs_gui->clearTargets();
593  $this->tabs_gui->setBackTarget($lng->txt("back"),
594  $ilCtrl->getLinkTarget($this, "listObjectBadges"));
595 
596  $ilCtrl->saveParameter($this, "pid");
597 
598  include_once "Services/Badge/classes/class.ilBadgeUserTableGUI.php";
599  $tbl = new ilBadgeUserTableGUI($this, "listUsers", null, null, $parent_obj_id, (int)$_REQUEST["bid"]);
600  $tpl->setContent($tbl->getHTML());
601  }
$tbl
Definition: example_048.php:81
global $ilCtrl
Definition: ilias.php:18
TableGUI class for badge user listing.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ listTypes()

ilObjBadgeAdministrationGUI::listTypes ( )
protected

Definition at line 215 of file class.ilObjBadgeAdministrationGUI.php.

References $tbl, and assertActive().

216  {
217  global $ilAccess;
218 
219  $this->assertActive();
220  $this->tabs_gui->setTabActive("types");
221 
222  include_once "Services/Badge/classes/class.ilBadgeTypesTableGUI.php";
223  $tbl = new ilBadgeTypesTableGUI($this, "listTypes",
224  $ilAccess->checkAccess("write", "", $this->object->getRefId()));
225  $this->tpl->setContent($tbl->getHTML());
226  }
$tbl
Definition: example_048.php:81
TableGUI class for badge type listing.
+ Here is the call graph for this function:

◆ resetObjectFilter()

ilObjBadgeAdministrationGUI::resetObjectFilter ( )
protected

Definition at line 568 of file class.ilObjBadgeAdministrationGUI.php.

References $tbl, and listObjectBadges().

569  {
570  global $ilAccess;
571 
572  include_once "Services/Badge/classes/class.ilObjectBadgeTableGUI.php";
573  $tbl = new ilObjectBadgeTableGUI($this, "listObjectBadges",
574  $ilAccess->checkAccess("write", "", $this->object->getRefId()));
575  $tbl->resetOffset();
576  $tbl->resetFilter();
577  $this->listObjectBadges();
578  }
$tbl
Definition: example_048.php:81
TableGUI class for badge listing.
+ Here is the call graph for this function:

◆ resetUserFilter()

ilObjBadgeAdministrationGUI::resetUserFilter ( )
protected

Definition at line 612 of file class.ilObjBadgeAdministrationGUI.php.

References $tbl, and listObjectBadgeUsers().

613  {
614  include_once "Services/Badge/classes/class.ilBadgeUserTableGUI.php";
615  $tbl = new ilBadgeUserTableGUI($this, "listUsers", null, null, $parent_obj_id, (int)$_REQUEST["bid"]);
616  $tbl->resetOffset();
617  $tbl->resetFilter();
618  $this->listObjectBadgeUsers();
619  }
$tbl
Definition: example_048.php:81
TableGUI class for badge user listing.
+ Here is the call graph for this function:

◆ saveImageTemplate()

ilObjBadgeAdministrationGUI::saveImageTemplate ( )
protected

Definition at line 368 of file class.ilObjBadgeAdministrationGUI.php.

References $ilCtrl, ilObjectGUI\$lng, addImageTemplate(), ilObjectGUI\checkPermission(), initImageTemplateForm(), and ilUtil\sendSuccess().

369  {
370  global $ilCtrl, $lng;
371 
372  $this->checkPermission("write");
373 
374  $form = $this->initImageTemplateForm("create");
375  if($form->checkInput())
376  {
377  include_once "Services/Badge/classes/class.ilBadgeImageTemplate.php";
378  $tmpl = new ilBadgeImageTemplate();
379  $tmpl->setTitle($form->getInput("title"));
380  $tmpl->setTypes($form->getInput("type"));
381  $tmpl->create();
382 
383  $tmpl->uploadImage($_FILES["img"]);
384 
385  ilUtil::sendSuccess($lng->txt("settings_saved"), true);
386  $ilCtrl->redirect($this, "listImageTemplates");
387  }
388 
389  $form->setValuesByPost();
390  $this->addImageTemplate($form);
391  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
global $ilCtrl
Definition: ilias.php:18
addImageTemplate(ilPropertyFormGUI $a_form=null)
checkPermission($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission and redirect on error.
+ Here is the call graph for this function:

◆ saveSettings()

ilObjBadgeAdministrationGUI::saveSettings ( )
protected

Definition at line 127 of file class.ilObjBadgeAdministrationGUI.php.

References $ilCtrl, ilObjectGUI\checkPermission(), editSettings(), ilBadgeHandler\getInstance(), initFormSettings(), and ilUtil\sendSuccess().

128  {
129  global $ilCtrl;
130 
131  $this->checkPermission("write");
132 
133  $form = $this->initFormSettings();
134  if($form->checkInput())
135  {
136  $obi = (bool)$form->getInput("act")
137  ? (bool)$form->getInput("obi")
138  : null;
139 
140  $handler = ilBadgeHandler::getInstance();
141  $handler->setActive((bool)$form->getInput("act"));
142  $handler->setObiActive($obi);
143  $handler->setObiOrganisation(trim($form->getInput("obi_org")));
144  $handler->setObiContact(trim($form->getInput("obi_cont")));
145  $handler->setObiSalt(trim($form->getInput("obi_salt")));
146 
147  $handler->rebuildIssuerStaticUrl();
148 
149  ilUtil::sendSuccess($this->lng->txt("settings_saved"),true);
150  $ilCtrl->redirect($this, "editSettings");
151  }
152 
153  $form->setValuesByPost();
154  $this->editSettings($form);
155  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
global $ilCtrl
Definition: ilias.php:18
checkPermission($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission and redirect on error.
static getInstance()
Constructor.
+ Here is the call graph for this function:

◆ setImageTemplateFormValues()

ilObjBadgeAdministrationGUI::setImageTemplateFormValues ( ilPropertyFormGUI  $a_form,
ilBadgeImageTemplate  $a_tmpl 
)
protected

Definition at line 422 of file class.ilObjBadgeAdministrationGUI.php.

References ilBadgeImageTemplate\getImage(), ilBadgeImageTemplate\getImagePath(), ilPropertyFormGUI\getItemByPostVar(), ilBadgeImageTemplate\getTitle(), and ilBadgeImageTemplate\getTypes().

Referenced by editImageTemplate(), and updateImageTemplate().

423  {
424  $a_form->getItemByPostVar("title")->setValue($a_tmpl->getTitle());
425  $a_form->getItemByPostVar("img")->setImage($a_tmpl->getImagePath());
426  $a_form->getItemByPostVar("img")->setValue($a_tmpl->getImage());
427 
428  if($a_tmpl->getTypes())
429  {
430  $a_form->getItemByPostVar("tmode")->setValue("spec");
431  $a_form->getItemByPostVar("type")->setValue($a_tmpl->getTypes());
432  }
433  else
434  {
435  $a_form->getItemByPostVar("tmode")->setValue("all");
436  }
437  }
getItemByPostVar($a_post_var)
Get Item by POST variable.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ toggleObjectBadges()

ilObjBadgeAdministrationGUI::toggleObjectBadges (   $a_status)
protected

Definition at line 640 of file class.ilObjBadgeAdministrationGUI.php.

References $ilCtrl, ilObjectGUI\$lng, getObjectBadgesFromMultiAction(), and ilUtil\sendSuccess().

Referenced by activateObjectBadges(), and deactivateObjectBadges().

641  {
642  global $ilCtrl, $lng;
643 
644  $badge_ids = $this->getObjectBadgesFromMultiAction();
645 
646  include_once "Services/Badge/classes/class.ilBadge.php";
647  foreach($badge_ids as $badge_id)
648  {
649  $badge = new ilBadge($badge_id);
650  $badge->setActive($a_status);
651  $badge->update();
652  }
653 
654  ilUtil::sendSuccess($lng->txt("settings_saved"), true);
655  $ilCtrl->redirect($this, "listObjectBadges");
656  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
global $ilCtrl
Definition: ilias.php:18
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateImageTemplate()

ilObjBadgeAdministrationGUI::updateImageTemplate ( )
protected

Definition at line 439 of file class.ilObjBadgeAdministrationGUI.php.

References $ilCtrl, ilObjectGUI\$lng, ilObjectGUI\checkPermission(), editImageTemplate(), initImageTemplateForm(), ilUtil\sendSuccess(), and setImageTemplateFormValues().

440  {
441  global $ilCtrl, $lng;
442 
443  $this->checkPermission("write");
444 
445  $tmpl_id = $_REQUEST["tid"];
446  if(!$tmpl_id)
447  {
448  $ilCtrl->redirect($this, "listImageTemplates");
449  }
450 
451  $ilCtrl->setParameter($this, "tid", $tmpl_id);
452 
453  include_once "Services/Badge/classes/class.ilBadgeImageTemplate.php";
454  $tmpl = new ilBadgeImageTemplate($tmpl_id);
455 
456  $form = $this->initImageTemplateForm("update");
457  if($form->checkInput())
458  {
459  $tmpl->setTitle($form->getInput("title"));
460 
461  if($form->getInput("tmode") != "all")
462  {
463  $tmpl->setTypes($form->getInput("type"));
464  }
465  else
466  {
467  $tmpl->setTypes(null);
468  }
469 
470  $tmpl->update();
471 
472  $tmpl->uploadImage($_FILES["img"]);
473 
474  ilUtil::sendSuccess($lng->txt("settings_saved"), true);
475  $ilCtrl->redirect($this, "listImageTemplates");
476  }
477 
478  $this->setImageTemplateFormValues($form, $tmpl);
479  $form->setValuesByPost();
480  $this->editImageTemplate($form);
481  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
setImageTemplateFormValues(ilPropertyFormGUI $a_form, ilBadgeImageTemplate $a_tmpl)
global $ilCtrl
Definition: ilias.php:18
editImageTemplate(ilPropertyFormGUI $a_form=null)
checkPermission($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission and redirect on error.
+ Here is the call graph for this function:

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