ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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...
 
 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...
 
 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...
 
 redirectAfterCreation ()
 Redirect after creation, see https://docu.ilias.de/goto_docu_wiki_wpage_5035_1357.html. 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
 getObjectService ()
 Get object service. More...
 
 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...
 
 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...
 

Protected Attributes

 $rbacsystem
 
 $access
 
 $toolbar
 
 $tabs
 
- Protected Attributes inherited from ilObjectGUI
 $ilErr
 
 $locator
 
 $user
 
 $access
 
 $settings
 
 $rbacreview
 
 $toolbar
 
 $tmp_import_dir
 
 $tabs_gui = null
 
 $ctrl
 
 $object_service
 

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
 
 $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
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

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

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

References $DIC.

41  {
42  global $DIC;
43 
44  $this->rbacsystem = $DIC->rbac()->system();
45  $this->ctrl = $DIC->ctrl();
46  $this->access = $DIC->access();
47  $this->lng = $DIC->language();
48  $this->toolbar = $DIC->toolbar();
49  $this->tpl = $DIC["tpl"];
50  $this->tabs = $DIC->tabs();
51  $this->type = "bdga";
52  parent::__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
53 
54  $this->lng->loadLanguageModule("badge");
55  }
global $DIC
Definition: saml.php:7

Member Function Documentation

◆ activateObjectBadges()

ilObjBadgeAdministrationGUI::activateObjectBadges ( )
protected

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

References toggleObjectBadges().

697  {
698  $this->toggleObjectBadges(true);
699  }
+ Here is the call graph for this function:

◆ activateTypes()

ilObjBadgeAdministrationGUI::activateTypes ( )
protected

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

References $_POST, $handler, ilObjectGUI\$lng, $type, assertActive(), ilObjectGUI\checkPermissionBool(), and ilBadgeHandler\getInstance().

264  {
265  $lng = $this->lng;
266 
267  $this->assertActive();
268 
269  $ids = $_POST["id"];
270  if ($this->checkPermissionBool("write") && is_array($ids) && count($ids) > 0) {
272  $inactive = array();
273  foreach ($handler->getInactiveTypes() as $type) {
274  if (!in_array($type, $ids)) {
275  $inactive[] = $type;
276  }
277  }
278  $handler->setInactiveTypes($inactive);
279 
280  ilUtil::sendSuccess($lng->txt("settings_saved"), true);
281  }
282  $this->ctrl->redirect($this, "listTypes");
283  }
$type
$handler
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 333 of file class.ilObjBadgeAdministrationGUI.php.

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

Referenced by saveImageTemplate().

334  {
335  $tpl = $this->tpl;
336 
337  $this->checkPermission("write");
338 
339  $this->assertActive();
340  $this->tabs_gui->setTabActive("imgtmpl");
341 
342  if (!$a_form) {
343  $a_form = $this->initImageTemplateForm("create");
344  }
345 
346  $tpl->setContent($a_form->getHTML());
347  }
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 585 of file class.ilObjBadgeAdministrationGUI.php.

References $access, $tbl, and listObjectBadges().

586  {
587  $ilAccess = $this->access;
588 
589  include_once "Services/Badge/classes/class.ilObjectBadgeTableGUI.php";
591  $this,
592  "listObjectBadges",
593  $ilAccess->checkAccess("write", "", $this->object->getRefId())
594  );
595  $tbl->resetOffset();
596  $tbl->writeFilterToSession();
597  $this->listObjectBadges();
598  }
$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 641 of file class.ilObjBadgeAdministrationGUI.php.

References $tbl, and listObjectBadgeUsers().

642  {
643  include_once "Services/Badge/classes/class.ilBadgeUserTableGUI.php";
644  $tbl = new ilBadgeUserTableGUI($this, "listUsers", null, null, $parent_obj_id, (int) $_REQUEST["bid"]);
645  $tbl->resetOffset();
646  $tbl->writeFilterToSession();
647  $this->listObjectBadgeUsers();
648  }
$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 138 of file class.ilObjBadgeAdministrationGUI.php.

References ilBadgeHandler\getInstance().

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

139  {
140  if (!ilBadgeHandler::getInstance()->isActive()) {
141  $this->ctrl->redirect($this, "editSettings");
142  }
143  }
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 506 of file class.ilObjBadgeAdministrationGUI.php.

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

507  {
509  $lng = $this->lng;
510  $tpl = $this->tpl;
511  $ilTabs = $this->tabs;
512 
513  $this->checkPermission("write");
514 
515  $tmpl_ids = $_REQUEST["id"];
516  if (!$tmpl_ids) {
517  $ilCtrl->redirect($this, "listImageTemplates");
518  }
519 
520  $ilTabs->clearTargets();
521  $ilTabs->setBackTarget(
522  $lng->txt("back"),
523  $ilCtrl->getLinkTarget($this, "listImageTemplates")
524  );
525 
526  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
527  $confirmation_gui = new ilConfirmationGUI();
528  $confirmation_gui->setFormAction($ilCtrl->getFormAction($this));
529  $confirmation_gui->setHeaderText($lng->txt("badge_template_deletion_confirmation"));
530  $confirmation_gui->setCancel($lng->txt("cancel"), "listImageTemplates");
531  $confirmation_gui->setConfirm($lng->txt("delete"), "deleteImageTemplates");
532 
533  include_once("./Services/Badge/classes/class.ilBadgeImageTemplate.php");
534  foreach ($tmpl_ids as $tmpl_id) {
535  $tmpl = new ilBadgeImageTemplate($tmpl_id);
536  $confirmation_gui->addItem("id[]", $tmpl_id, $tmpl->getTitle());
537  }
538 
539  $tpl->setContent($confirmation_gui->getHTML());
540  }
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 706 of file class.ilObjBadgeAdministrationGUI.php.

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

707  {
709  $lng = $this->lng;
710  $tpl = $this->tpl;
711  $ilTabs = $this->tabs;
712 
713  $badge_ids = $this->getObjectBadgesFromMultiAction();
714 
715  $ilTabs->clearTargets();
716  $ilTabs->setBackTarget(
717  $lng->txt("back"),
718  $ilCtrl->getLinkTarget($this, "listObjectBadges")
719  );
720 
721  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
722  $confirmation_gui = new ilConfirmationGUI();
723  $confirmation_gui->setFormAction($ilCtrl->getFormAction($this));
724  $confirmation_gui->setHeaderText($lng->txt("badge_deletion_confirmation"));
725  $confirmation_gui->setCancel($lng->txt("cancel"), "listObjectBadges");
726  $confirmation_gui->setConfirm($lng->txt("delete"), "deleteObjectBadges");
727 
728  include_once "Services/Badge/classes/class.ilBadge.php";
729  include_once "Services/Badge/classes/class.ilBadgeAssignment.php";
730  foreach ($badge_ids as $badge_id) {
731  $badge = new ilBadge($badge_id);
732  $parent = $badge->getParentMeta();
733 
734  // :TODO: container presentation
735  $container = "(" . $parent["type"] . "/" .
736  $parent["id"] . ") " .
737  $parent["title"];
738  if ((bool) $parent["deleted"]) {
739  $container .= ' <span class="il_ItemAlertProperty">' . $lng->txt("deleted") . '</span>';
740  }
741 
742  $confirmation_gui->addItem(
743  "id[]",
744  $badge_id,
745  $container . " - " .
746  $badge->getTitle() .
747  " (" . sizeof(ilBadgeAssignment::getInstancesByBadgeId($badge_id)) . ")"
748  );
749  }
750 
751  $tpl->setContent($confirmation_gui->getHTML());
752  }
$container
Definition: wac.php:13
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 701 of file class.ilObjBadgeAdministrationGUI.php.

References toggleObjectBadges().

702  {
703  $this->toggleObjectBadges(false);
704  }
+ Here is the call graph for this function:

◆ deactivateTypes()

ilObjBadgeAdministrationGUI::deactivateTypes ( )
protected

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

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

286  {
287  $lng = $this->lng;
288 
289  $this->assertActive();
290 
291  $ids = $_POST["id"];
292  if ($this->checkPermissionBool("write") && is_array($ids) && count($ids) > 0) {
294  $inactive = array_merge($handler->getInactiveTypes(), $ids);
295  $handler->setInactiveTypes($inactive);
296 
297  ilUtil::sendSuccess($lng->txt("settings_saved"), true);
298  }
299  $this->ctrl->redirect($this, "listTypes");
300  }
$handler
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 542 of file class.ilObjBadgeAdministrationGUI.php.

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

543  {
545  $lng = $this->lng;
546 
547  $this->checkPermission("write");
548 
549  $tmpl_ids = $_REQUEST["id"];
550  if ($tmpl_ids) {
551  include_once("./Services/Badge/classes/class.ilBadgeImageTemplate.php");
552  foreach ($tmpl_ids as $tmpl_id) {
553  $tmpl = new ilBadgeImageTemplate($tmpl_id);
554  $tmpl->delete();
555  }
556 
557  ilUtil::sendSuccess($lng->txt("settings_saved"), true);
558  }
559 
560  $ilCtrl->redirect($this, "listImageTemplates");
561  }
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 754 of file class.ilObjBadgeAdministrationGUI.php.

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

755  {
757  $lng = $this->lng;
758 
759  $badge_ids = $this->getObjectBadgesFromMultiAction();
760 
761  include_once "Services/Badge/classes/class.ilBadge.php";
762  foreach ($badge_ids as $badge_id) {
763  $badge = new ilBadge($badge_id);
764  $badge->delete();
765  }
766 
767  ilUtil::sendSuccess($lng->txt("settings_saved"), true);
768  $ilCtrl->redirect($this, "listObjectBadges");
769  }
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 424 of file class.ilObjBadgeAdministrationGUI.php.

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

Referenced by updateImageTemplate().

425  {
427  $tpl = $this->tpl;
428 
429  $this->checkPermission("write");
430 
431  $this->assertActive();
432  $this->tabs_gui->setTabActive("imgtmpl");
433 
434  $tmpl_id = $_REQUEST["tid"];
435  if (!$tmpl_id) {
436  $ilCtrl->redirect($this, "listImageTemplates");
437  }
438 
439  $ilCtrl->setParameter($this, "tid", $tmpl_id);
440 
441  include_once "Services/Badge/classes/class.ilBadgeImageTemplate.php";
442  $tmpl = new ilBadgeImageTemplate($tmpl_id);
443 
444  if (!$a_form) {
445  $a_form = $this->initImageTemplateForm("edit");
446  $this->setImageTemplateFormValues($a_form, $tmpl);
447  }
448 
449  $tpl->setContent($a_form->getHTML());
450  }
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 150 of file class.ilObjBadgeAdministrationGUI.php.

References initFormSettings().

Referenced by saveSettings().

151  {
152  $this->tabs_gui->setTabActive("settings");
153 
154  if (!$a_form) {
155  $a_form = $this->initFormSettings();
156  }
157 
158  $this->tpl->setContent($a_form->getHTML());
159  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilObjBadgeAdministrationGUI::executeCommand ( )

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

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

58  {
59  $next_class = $this->ctrl->getNextClass($this);
60  $cmd = $this->ctrl->getCmd();
61 
62  $this->prepareOutput();
63 
64  switch ($next_class) {
65  case 'ilpermissiongui':
66  $this->tabs_gui->setTabActive('perm_settings');
67  include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
68  $perm_gui = new ilPermissionGUI($this);
69  $this->ctrl->forwardCommand($perm_gui);
70  break;
71 
72  case 'ilbadgemanagementgui':
73  $this->assertActive();
74  $this->tabs_gui->setTabActive('activity');
75  include_once "Services/Badge/classes/class.ilBadgeManagementGUI.php";
76  $gui = new ilBadgeManagementGUI($this->ref_id, $this->obj_id, $this->type);
77  $this->ctrl->forwardCommand($gui);
78  break;
79 
80  default:
81  if (!$cmd || $cmd == 'view') {
82  $cmd = "editSettings";
83  }
84 
85  $this->$cmd();
86  break;
87  }
88  return true;
89  }
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 91 of file class.ilObjBadgeAdministrationGUI.php.

References $rbacsystem, and ilBadgeHandler\getInstance().

92  {
94 
95  if ($rbacsystem->checkAccess("visible,read", $this->object->getRefId())) {
96  $this->tabs_gui->addTab(
97  "settings",
98  $this->lng->txt("settings"),
99  $this->ctrl->getLinkTarget($this, "editSettings")
100  );
101 
102  if (ilBadgeHandler::getInstance()->isActive()) {
103  $this->tabs_gui->addTab(
104  "types",
105  $this->lng->txt("badge_types"),
106  $this->ctrl->getLinkTarget($this, "listTypes")
107  );
108 
109  $this->tabs_gui->addTab(
110  "imgtmpl",
111  $this->lng->txt("badge_image_templates"),
112  $this->ctrl->getLinkTarget($this, "listImageTemplates")
113  );
114 
115  $this->tabs_gui->addTab(
116  "activity",
117  $this->lng->txt("badge_activity_badges"),
118  $this->ctrl->getLinkTargetByClass("ilbadgemanagementgui", "")
119  );
120 
121  $this->tabs_gui->addTab(
122  "obj_badges",
123  $this->lng->txt("badge_object_badges"),
124  $this->ctrl->getLinkTarget($this, "listObjectBadges")
125  );
126  }
127  }
128 
129  if ($rbacsystem->checkAccess('edit_permission', $this->object->getRefId())) {
130  $this->tabs_gui->addTab(
131  "perm_settings",
132  $this->lng->txt("perm_settings"),
133  $this->ctrl->getLinkTargetByClass('ilpermissiongui', "perm")
134  );
135  }
136  }
static getInstance()
Constructor.
+ Here is the call graph for this function:

◆ getObjectBadgesFromMultiAction()

ilObjBadgeAdministrationGUI::getObjectBadgesFromMultiAction ( )
protected

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

References $access, ilObjectGUI\$ctrl, and $ilCtrl.

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

665  {
666  $ilAccess = $this->access;
668 
669  $badge_ids = $_REQUEST["id"];
670  if (!$badge_ids ||
671  !$ilAccess->checkAccess("write", "", $this->object->getRefId())) {
672  $ilCtrl->redirect($this, "listObjectBadges");
673  }
674 
675  return $badge_ids;
676  }
global $ilCtrl
Definition: ilias.php:18
+ Here is the caller graph for this function:

◆ initFormSettings()

ilObjBadgeAdministrationGUI::initFormSettings ( )
protected

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

References $access, $form, $handler, ilBadgeHandler\getInstance(), and ilFormPropertyGUI\setInfo().

Referenced by editSettings(), and saveSettings().

191  {
192  $ilAccess = $this->access;
193 
194  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
195  $form = new ilPropertyFormGUI();
196  $form->setFormAction($this->ctrl->getFormAction($this));
197  $form->setTitle($this->lng->txt("badge_settings"));
198 
199  if ($ilAccess->checkAccess("write", "", $this->object->getRefId())) {
200  $form->addCommandButton("saveSettings", $this->lng->txt("save"));
201  $form->addCommandButton("editSettings", $this->lng->txt("cancel"));
202  }
203 
204  $act = new ilCheckboxInputGUI($this->lng->txt("badge_service_activate"), "act");
205  $act->setInfo($this->lng->txt("badge_service_activate_info"));
206  $form->addItem($act);
207 
208  /* see bug #0020124
209  $obi = new ilCheckboxInputGUI($this->lng->txt("badge_obi_activate"), "obi");
210  $obi->setInfo($this->lng->txt("badge_obi_activate_info"));
211  $form->addItem($obi);
212 
213  $obi_org = new ilTextInputGUI($this->lng->txt("badge_obi_organisation"), "obi_org");
214  $obi_org->setRequired(true);
215  $obi_org->setInfo($this->lng->txt("badge_obi_organisation_info"));
216  $obi->addSubItem($obi_org);
217 
218  $obi_contact = new ilEmailInputGUI($this->lng->txt("badge_obi_contact"), "obi_cont");
219  $obi_contact->setRequired(true);
220  $obi_contact->setInfo($this->lng->txt("badge_obi_contact_info"));
221  $obi->addSubItem($obi_contact);
222 
223  $obi_salt = new ilTextInputGUI($this->lng->txt("badge_obi_salt"), "obi_salt");
224  $obi_salt->setRequired(true);
225  $obi_salt->setInfo($this->lng->txt("badge_obi_salt_info"));
226  $obi->addSubItem($obi_salt);
227  */
228 
230  $act->setChecked($handler->isActive());
231 
232  /* see bug 0020124
233  $obi->setChecked($handler->isObiActive());
234  $obi_org->setValue($handler->getObiOrganistation());
235  $obi_contact->setValue($handler->getObiContact());
236  $obi_salt->setValue($handler->getObiSalt());
237  */
238 
239  return $form;
240  }
This class represents a property form user interface.
This class represents a checkbox property in a property form.
setInfo($a_info)
Set Information Text.
if(isset($_POST['submit'])) $form
$handler
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 349 of file class.ilObjBadgeAdministrationGUI.php.

References ilObjectGUI\$ctrl, $form, $id, $ilCtrl, $img, ilObjectGUI\$lng, $title, $type, ilBadgeHandler\getInstance(), and ilFormPropertyGUI\setRequired().

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

350  {
351  $lng = $this->lng;
353 
354  include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
355  $form = new ilPropertyFormGUI();
356  $form->setFormAction($ilCtrl->getFormAction($this, "saveBadge"));
357  $form->setTitle($lng->txt("badge_image_template_form"));
358 
359  $title = new ilTextInputGUI($lng->txt("title"), "title");
360  $title->setRequired(true);
361  $form->addItem($title);
362 
363  $img = new ilImageFileInputGUI($lng->txt("image"), "img");
364  $img->setSuffixes(array("png", "svg"));
365  if ($a_mode == "create") {
366  $img->setRequired(true);
367  }
368  $img->setALlowDeletion(false);
369  $form->addItem($img);
370 
371  $types_mode = new ilRadioGroupInputGUI($lng->txt("badge_template_types"), "tmode");
372  $types_mode->setRequired(true);
373  $form->addItem($types_mode);
374 
375  $type_all = new ilRadioOption($lng->txt("badge_template_types_all"), "all");
376  $types_mode->addOption($type_all);
377 
378  $type_spec = new ilRadioOption($lng->txt("badge_template_types_specific"), "spec");
379  $types_mode->addOption($type_spec);
380 
381  $types = new ilCheckboxGroupInputGUI($lng->txt("badge_types"), "type");
382  $types->setRequired(true);
383  $type_spec->addSubItem($types);
384 
385  foreach (ilBadgeHandler::getInstance()->getAvailableTypes() as $id => $type) {
386  $types->addOption(new ilCheckboxOption($type->getCaption(), $id));
387  }
388 
389  if ($a_mode == "create") {
390  $form->addCommandButton("saveImageTemplate", $lng->txt("save"));
391  } else {
392  $form->addCommandButton("updateImageTemplate", $lng->txt("save"));
393  }
394  $form->addCommandButton("listImageTemplates", $lng->txt("cancel"));
395 
396  return $form;
397  }
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.
$type
if(!array_key_exists('StateId', $_REQUEST)) $id
global $ilCtrl
Definition: ilias.php:18
This class represents a property in a property form.
if(isset($_POST['submit'])) $form
This class represents a text property in a property form.
This class represents a property in a property form.
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 307 of file class.ilObjBadgeAdministrationGUI.php.

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

308  {
309  $ilAccess = $this->access;
310  $lng = $this->lng;
311  $ilToolbar = $this->toolbar;
313 
314  $this->assertActive();
315  $this->tabs_gui->setTabActive("imgtmpl");
316 
317  if ($this->checkPermissionBool("write")) {
318  $ilToolbar->addButton(
319  $lng->txt("badge_add_template"),
320  $ilCtrl->getLinkTarget($this, "addImageTemplate")
321  );
322  }
323 
324  include_once "Services/Badge/classes/class.ilBadgeImageTemplateTableGUI.php";
326  $this,
327  "listImageTemplates",
328  $ilAccess->checkAccess("write", "", $this->object->getRefId())
329  );
330  $this->tpl->setContent($tbl->getHTML());
331  }
$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 568 of file class.ilObjBadgeAdministrationGUI.php.

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

Referenced by applyObjectFilter(), and resetObjectFilter().

569  {
570  $ilAccess = $this->access;
571  $tpl = $this->tpl;
572 
573  $this->assertActive();
574  $this->tabs_gui->setTabActive("obj_badges");
575 
576  include_once("./Services/Badge/classes/class.ilObjectBadgeTableGUI.php");
578  $this,
579  "listObjectBadges",
580  $ilAccess->checkAccess("write", "", $this->object->getRefId())
581  );
582  $tpl->setContent($tbl->getHTML());
583  }
$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 615 of file class.ilObjBadgeAdministrationGUI.php.

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

Referenced by applyUserFilter(), and resetUserFilter().

616  {
618  $lng = $this->lng;
619  $tpl = $this->tpl;
620 
621  $parent_obj_id = $_REQUEST["pid"];
622  if (!$parent_obj_id) {
623  $ilCtrl->redirect($this, "listObjectBadges");
624  }
625 
626  $this->assertActive();
627 
628  $this->tabs_gui->clearTargets();
629  $this->tabs_gui->setBackTarget(
630  $lng->txt("back"),
631  $ilCtrl->getLinkTarget($this, "listObjectBadges")
632  );
633 
634  $ilCtrl->saveParameter($this, "pid");
635 
636  include_once "Services/Badge/classes/class.ilBadgeUserTableGUI.php";
637  $tbl = new ilBadgeUserTableGUI($this, "listUsers", null, null, $parent_obj_id, (int) $_REQUEST["bid"]);
638  $tpl->setContent($tbl->getHTML());
639  }
$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 247 of file class.ilObjBadgeAdministrationGUI.php.

References $access, $tbl, and assertActive().

248  {
249  $ilAccess = $this->access;
250 
251  $this->assertActive();
252  $this->tabs_gui->setTabActive("types");
253 
254  include_once "Services/Badge/classes/class.ilBadgeTypesTableGUI.php";
256  $this,
257  "listTypes",
258  $ilAccess->checkAccess("write", "", $this->object->getRefId())
259  );
260  $this->tpl->setContent($tbl->getHTML());
261  }
$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 600 of file class.ilObjBadgeAdministrationGUI.php.

References $access, $tbl, and listObjectBadges().

601  {
602  $ilAccess = $this->access;
603 
604  include_once "Services/Badge/classes/class.ilObjectBadgeTableGUI.php";
606  $this,
607  "listObjectBadges",
608  $ilAccess->checkAccess("write", "", $this->object->getRefId())
609  );
610  $tbl->resetOffset();
611  $tbl->resetFilter();
612  $this->listObjectBadges();
613  }
$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 650 of file class.ilObjBadgeAdministrationGUI.php.

References $tbl, and listObjectBadgeUsers().

651  {
652  include_once "Services/Badge/classes/class.ilBadgeUserTableGUI.php";
653  $tbl = new ilBadgeUserTableGUI($this, "listUsers", null, null, $parent_obj_id, (int) $_REQUEST["bid"]);
654  $tbl->resetOffset();
655  $tbl->resetFilter();
656  $this->listObjectBadgeUsers();
657  }
$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 399 of file class.ilObjBadgeAdministrationGUI.php.

References ilObjectGUI\$ctrl, $form, $ilCtrl, ilObjectGUI\$lng, addImageTemplate(), ilObjectGUI\checkPermission(), and initImageTemplateForm().

400  {
402  $lng = $this->lng;
403 
404  $this->checkPermission("write");
405 
406  $form = $this->initImageTemplateForm("create");
407  if ($form->checkInput()) {
408  include_once "Services/Badge/classes/class.ilBadgeImageTemplate.php";
409  $tmpl = new ilBadgeImageTemplate();
410  $tmpl->setTitle($form->getInput("title"));
411  $tmpl->setTypes($form->getInput("type"));
412  $tmpl->create();
413 
414  $tmpl->uploadImage($_FILES["img"]);
415 
416  ilUtil::sendSuccess($lng->txt("settings_saved"), true);
417  $ilCtrl->redirect($this, "listImageTemplates");
418  }
419 
420  $form->setValuesByPost();
421  $this->addImageTemplate($form);
422  }
global $ilCtrl
Definition: ilias.php:18
if(isset($_POST['submit'])) $form
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 161 of file class.ilObjBadgeAdministrationGUI.php.

References ilObjectGUI\$ctrl, $form, $handler, $ilCtrl, ilObjectGUI\checkPermission(), editSettings(), ilBadgeHandler\getInstance(), and initFormSettings().

162  {
164 
165  $this->checkPermission("write");
166 
167  $form = $this->initFormSettings();
168  if ($form->checkInput()) {
169  $obi = (bool) $form->getInput("act")
170  ? (bool) $form->getInput("obi")
171  : null;
172 
174  $handler->setActive((bool) $form->getInput("act"));
175  $handler->setObiActive($obi);
176  $handler->setObiOrganisation(trim($form->getInput("obi_org")));
177  $handler->setObiContact(trim($form->getInput("obi_cont")));
178  $handler->setObiSalt(trim($form->getInput("obi_salt")));
179 
180  $handler->rebuildIssuerStaticUrl();
181 
182  ilUtil::sendSuccess($this->lng->txt("settings_saved"), true);
183  $ilCtrl->redirect($this, "editSettings");
184  }
185 
186  $form->setValuesByPost();
187  $this->editSettings($form);
188  }
global $ilCtrl
Definition: ilias.php:18
if(isset($_POST['submit'])) $form
checkPermission($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission and redirect on error.
$handler
static getInstance()
Constructor.
+ Here is the call graph for this function:

◆ setImageTemplateFormValues()

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

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

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

Referenced by editImageTemplate(), and updateImageTemplate().

453  {
454  $a_form->getItemByPostVar("title")->setValue($a_tmpl->getTitle());
455  $a_form->getItemByPostVar("img")->setImage($a_tmpl->getImagePath());
456  $a_form->getItemByPostVar("img")->setValue($a_tmpl->getImage());
457 
458  if ($a_tmpl->getTypes()) {
459  $a_form->getItemByPostVar("tmode")->setValue("spec");
460  $a_form->getItemByPostVar("type")->setValue($a_tmpl->getTypes());
461  } else {
462  $a_form->getItemByPostVar("tmode")->setValue("all");
463  }
464  }
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 678 of file class.ilObjBadgeAdministrationGUI.php.

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

Referenced by activateObjectBadges(), and deactivateObjectBadges().

679  {
681  $lng = $this->lng;
682 
683  $badge_ids = $this->getObjectBadgesFromMultiAction();
684 
685  include_once "Services/Badge/classes/class.ilBadge.php";
686  foreach ($badge_ids as $badge_id) {
687  $badge = new ilBadge($badge_id);
688  $badge->setActive($a_status);
689  $badge->update();
690  }
691 
692  ilUtil::sendSuccess($lng->txt("settings_saved"), true);
693  $ilCtrl->redirect($this, "listObjectBadges");
694  }
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 466 of file class.ilObjBadgeAdministrationGUI.php.

References ilObjectGUI\$ctrl, $form, $ilCtrl, ilObjectGUI\$lng, ilObjectGUI\checkPermission(), editImageTemplate(), initImageTemplateForm(), and setImageTemplateFormValues().

467  {
469  $lng = $this->lng;
470 
471  $this->checkPermission("write");
472 
473  $tmpl_id = $_REQUEST["tid"];
474  if (!$tmpl_id) {
475  $ilCtrl->redirect($this, "listImageTemplates");
476  }
477 
478  $ilCtrl->setParameter($this, "tid", $tmpl_id);
479 
480  include_once "Services/Badge/classes/class.ilBadgeImageTemplate.php";
481  $tmpl = new ilBadgeImageTemplate($tmpl_id);
482 
483  $form = $this->initImageTemplateForm("update");
484  if ($form->checkInput()) {
485  $tmpl->setTitle($form->getInput("title"));
486 
487  if ($form->getInput("tmode") != "all") {
488  $tmpl->setTypes($form->getInput("type"));
489  } else {
490  $tmpl->setTypes(null);
491  }
492 
493  $tmpl->update();
494 
495  $tmpl->uploadImage($_FILES["img"]);
496 
497  ilUtil::sendSuccess($lng->txt("settings_saved"), true);
498  $ilCtrl->redirect($this, "listImageTemplates");
499  }
500 
501  $this->setImageTemplateFormValues($form, $tmpl);
502  $form->setValuesByPost();
503  $this->editImageTemplate($form);
504  }
setImageTemplateFormValues(ilPropertyFormGUI $a_form, ilBadgeImageTemplate $a_tmpl)
global $ilCtrl
Definition: ilias.php:18
if(isset($_POST['submit'])) $form
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:

Field Documentation

◆ $access

◆ $rbacsystem

ilObjBadgeAdministrationGUI::$rbacsystem
protected

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

Referenced by getAdminTabs().

◆ $tabs

ilObjBadgeAdministrationGUI::$tabs
protected

◆ $toolbar

ilObjBadgeAdministrationGUI::$toolbar
protected

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

Referenced by listImageTemplates().


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