ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
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 ()
 viewObject container presentation for "administration -> repository, trash, permissions" 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...
 
 addToDeskObject ()
 
 removeFromDeskObject ()
 
- Public Member Functions inherited from ILIAS\Object\ImplementsCreationCallback
 callCreationCallback (\ilObject $object, \ilObjectDefinition $obj_definition, int $requested_crtcb)
 

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...
 
 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
const UPLOAD_TYPE_LOCAL = 1
 
const UPLOAD_TYPE_UPLOAD_DIRECTORY = 2
 
 $ilErr
 
 $locator
 
 $user
 
 $access
 
 $rbacsystem
 
 $settings
 
 $rbacreview
 
 $toolbar
 
 $tmp_import_dir
 
 $tabs_gui = null
 
 $ctrl
 
 $object_service
 
 $favourites
 
 $request
 

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 ALLOWED_TAGS_IN_TITLE_AND_DESCRIPTION
 
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 35 of file class.ilObjBadgeAdministrationGUI.php.

References $DIC, and ILIAS\GlobalScreen\Provider\__construct().

36  {
37  global $DIC;
38 
39  $this->rbacsystem = $DIC->rbac()->system();
40  $this->ctrl = $DIC->ctrl();
41  $this->access = $DIC->access();
42  $this->lng = $DIC->language();
43  $this->toolbar = $DIC->toolbar();
44  $this->tpl = $DIC["tpl"];
45  $this->tabs = $DIC->tabs();
46  $this->type = "bdga";
47  parent::__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
48 
49  $this->lng->loadLanguageModule("badge");
50  }
global $DIC
Definition: goto.php:24
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ activateObjectBadges()

ilObjBadgeAdministrationGUI::activateObjectBadges ( )
protected

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

References toggleObjectBadges().

674  {
675  $this->toggleObjectBadges(true);
676  }
+ Here is the call graph for this function:

◆ activateTypes()

ilObjBadgeAdministrationGUI::activateTypes ( )
protected

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

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

255  {
256  $lng = $this->lng;
257 
258  $this->assertActive();
259 
260  $ids = $_POST["id"];
261  if ($this->checkPermissionBool("write") && is_array($ids) && count($ids) > 0) {
262  $handler = ilBadgeHandler::getInstance();
263  $inactive = array();
264  foreach ($handler->getInactiveTypes() as $type) {
265  if (!in_array($type, $ids)) {
266  $inactive[] = $type;
267  }
268  }
269  $handler->setInactiveTypes($inactive);
270 
271  ilUtil::sendSuccess($lng->txt("settings_saved"), true);
272  }
273  $this->ctrl->redirect($this, "listTypes");
274  }
$type
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 323 of file class.ilObjBadgeAdministrationGUI.php.

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

Referenced by saveImageTemplate().

324  {
325  $tpl = $this->tpl;
326 
327  $this->checkPermission("write");
328 
329  $this->assertActive();
330  $this->tabs_gui->setTabActive("imgtmpl");
331 
332  if (!$a_form) {
333  $a_form = $this->initImageTemplateForm("create");
334  }
335 
336  $tpl->setContent($a_form->getHTML());
337  }
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 568 of file class.ilObjBadgeAdministrationGUI.php.

References $access, and listObjectBadges().

569  {
570  $ilAccess = $this->access;
571 
572  $tbl = new ilObjectBadgeTableGUI(
573  $this,
574  "listObjectBadges",
575  $ilAccess->checkAccess("write", "", $this->object->getRefId())
576  );
577  $tbl->resetOffset();
578  $tbl->writeFilterToSession();
579  $this->listObjectBadges();
580  }
TableGUI class for badge listing.
+ Here is the call graph for this function:

◆ applyUserFilter()

ilObjBadgeAdministrationGUI::applyUserFilter ( )
protected

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

References listObjectBadgeUsers().

622  {
623  $tbl = new ilBadgeUserTableGUI($this, "listUsers", null, null, $parent_obj_id, (int) $_REQUEST["bid"]);
624  $tbl->resetOffset();
625  $tbl->writeFilterToSession();
626  $this->listObjectBadgeUsers();
627  }
TableGUI class for badge user listing.
+ Here is the call graph for this function:

◆ assertActive()

ilObjBadgeAdministrationGUI::assertActive ( )
protected

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

References ilBadgeHandler\getInstance().

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

132  {
133  if (!ilBadgeHandler::getInstance()->isActive()) {
134  $this->ctrl->redirect($this, "editSettings");
135  }
136  }
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 493 of file class.ilObjBadgeAdministrationGUI.php.

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

494  {
495  $ilCtrl = $this->ctrl;
496  $lng = $this->lng;
497  $tpl = $this->tpl;
498  $ilTabs = $this->tabs;
499 
500  $this->checkPermission("write");
501 
502  $tmpl_ids = $_REQUEST["id"];
503  if (!$tmpl_ids) {
504  $ilCtrl->redirect($this, "listImageTemplates");
505  }
506 
507  $ilTabs->clearTargets();
508  $ilTabs->setBackTarget(
509  $lng->txt("back"),
510  $ilCtrl->getLinkTarget($this, "listImageTemplates")
511  );
512 
513  $confirmation_gui = new ilConfirmationGUI();
514  $confirmation_gui->setFormAction($ilCtrl->getFormAction($this));
515  $confirmation_gui->setHeaderText($lng->txt("badge_template_deletion_confirmation"));
516  $confirmation_gui->setCancel($lng->txt("cancel"), "listImageTemplates");
517  $confirmation_gui->setConfirm($lng->txt("delete"), "deleteImageTemplates");
518 
519  foreach ($tmpl_ids as $tmpl_id) {
520  $tmpl = new ilBadgeImageTemplate($tmpl_id);
521  $confirmation_gui->addItem("id[]", $tmpl_id, $tmpl->getTitle());
522  }
523 
524  $tpl->setContent($confirmation_gui->getHTML());
525  }
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 683 of file class.ilObjBadgeAdministrationGUI.php.

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

684  {
685  $ilCtrl = $this->ctrl;
686  $lng = $this->lng;
687  $tpl = $this->tpl;
688  $ilTabs = $this->tabs;
689 
690  $badge_ids = $this->getObjectBadgesFromMultiAction();
691 
692  $ilTabs->clearTargets();
693  $ilTabs->setBackTarget(
694  $lng->txt("back"),
695  $ilCtrl->getLinkTarget($this, "listObjectBadges")
696  );
697 
698  $confirmation_gui = new ilConfirmationGUI();
699  $confirmation_gui->setFormAction($ilCtrl->getFormAction($this));
700  $confirmation_gui->setHeaderText($lng->txt("badge_deletion_confirmation"));
701  $confirmation_gui->setCancel($lng->txt("cancel"), "listObjectBadges");
702  $confirmation_gui->setConfirm($lng->txt("delete"), "deleteObjectBadges");
703 
704  foreach ($badge_ids as $badge_id) {
705  $badge = new ilBadge($badge_id);
706  $parent = $badge->getParentMeta();
707 
708  // :TODO: container presentation
709  $container = "(" . $parent["type"] . "/" .
710  $parent["id"] . ") " .
711  $parent["title"];
712  if ((bool) $parent["deleted"]) {
713  $container .= ' <span class="il_ItemAlertProperty">' . $lng->txt("deleted") . '</span>';
714  }
715 
716  $confirmation_gui->addItem(
717  "id[]",
718  $badge_id,
719  $container . " - " .
720  $badge->getTitle() .
721  " (" . sizeof(ilBadgeAssignment::getInstancesByBadgeId($badge_id)) . ")"
722  );
723  }
724 
725  $tpl->setContent($confirmation_gui->getHTML());
726  }
$container
Definition: wac.php:13
Class ilBadge.
static getInstancesByBadgeId($a_badge_id)
Confirmation screen class.
+ Here is the call graph for this function:

◆ deactivateObjectBadges()

ilObjBadgeAdministrationGUI::deactivateObjectBadges ( )
protected

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

References toggleObjectBadges().

679  {
680  $this->toggleObjectBadges(false);
681  }
+ Here is the call graph for this function:

◆ deactivateTypes()

ilObjBadgeAdministrationGUI::deactivateTypes ( )
protected

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

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

277  {
278  $lng = $this->lng;
279 
280  $this->assertActive();
281 
282  $ids = $_POST["id"];
283  if ($this->checkPermissionBool("write") && is_array($ids) && count($ids) > 0) {
284  $handler = ilBadgeHandler::getInstance();
285  $inactive = array_merge($handler->getInactiveTypes(), $ids);
286  $handler->setInactiveTypes($inactive);
287 
288  ilUtil::sendSuccess($lng->txt("settings_saved"), true);
289  }
290  $this->ctrl->redirect($this, "listTypes");
291  }
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 527 of file class.ilObjBadgeAdministrationGUI.php.

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

528  {
529  $ilCtrl = $this->ctrl;
530  $lng = $this->lng;
531 
532  $this->checkPermission("write");
533 
534  $tmpl_ids = $_REQUEST["id"];
535  if ($tmpl_ids) {
536  foreach ($tmpl_ids as $tmpl_id) {
537  $tmpl = new ilBadgeImageTemplate($tmpl_id);
538  $tmpl->delete();
539  }
540 
541  ilUtil::sendSuccess($lng->txt("settings_saved"), true);
542  }
543 
544  $ilCtrl->redirect($this, "listImageTemplates");
545  }
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 728 of file class.ilObjBadgeAdministrationGUI.php.

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

729  {
730  $ilCtrl = $this->ctrl;
731  $lng = $this->lng;
732 
733  $badge_ids = $this->getObjectBadgesFromMultiAction();
734 
735  foreach ($badge_ids as $badge_id) {
736  $badge = new ilBadge($badge_id);
737  $badge->delete();
738  }
739 
740  ilUtil::sendSuccess($lng->txt("settings_saved"), true);
741  $ilCtrl->redirect($this, "listObjectBadges");
742  }
Class ilBadge.
+ Here is the call graph for this function:

◆ editImageTemplate()

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

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

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

Referenced by updateImageTemplate().

414  {
415  $ilCtrl = $this->ctrl;
416  $tpl = $this->tpl;
417 
418  $this->checkPermission("write");
419 
420  $this->assertActive();
421  $this->tabs_gui->setTabActive("imgtmpl");
422 
423  $tmpl_id = $_REQUEST["tid"];
424  if (!$tmpl_id) {
425  $ilCtrl->redirect($this, "listImageTemplates");
426  }
427 
428  $ilCtrl->setParameter($this, "tid", $tmpl_id);
429 
430  $tmpl = new ilBadgeImageTemplate($tmpl_id);
431 
432  if (!$a_form) {
433  $a_form = $this->initImageTemplateForm("edit");
434  $this->setImageTemplateFormValues($a_form, $tmpl);
435  }
436 
437  $tpl->setContent($a_form->getHTML());
438  }
setImageTemplateFormValues(ilPropertyFormGUI $a_form, ilBadgeImageTemplate $a_tmpl)
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 143 of file class.ilObjBadgeAdministrationGUI.php.

References initFormSettings().

Referenced by saveSettings().

144  {
145  $this->tabs_gui->setTabActive("settings");
146 
147  if (!$a_form) {
148  $a_form = $this->initFormSettings();
149  }
150 
151  $this->tpl->setContent($a_form->getHTML());
152  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilObjBadgeAdministrationGUI::executeCommand ( )

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

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

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

References $rbacsystem, and ilBadgeHandler\getInstance().

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

◆ getObjectBadgesFromMultiAction()

ilObjBadgeAdministrationGUI::getObjectBadgesFromMultiAction ( )
protected

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

References $access, and ilObjectGUI\$ctrl.

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

643  {
644  $ilAccess = $this->access;
645  $ilCtrl = $this->ctrl;
646 
647  $badge_ids = $_REQUEST["id"];
648  if (!$badge_ids ||
649  !$ilAccess->checkAccess("write", "", $this->object->getRefId())) {
650  $ilCtrl->redirect($this, "listObjectBadges");
651  }
652 
653  return $badge_ids;
654  }
+ Here is the caller graph for this function:

◆ initFormSettings()

ilObjBadgeAdministrationGUI::initFormSettings ( )
protected

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

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

Referenced by editSettings(), and saveSettings().

184  {
185  $ilAccess = $this->access;
186 
187  $form = new ilPropertyFormGUI();
188  $form->setFormAction($this->ctrl->getFormAction($this));
189  $form->setTitle($this->lng->txt("badge_settings"));
190 
191  if ($ilAccess->checkAccess("write", "", $this->object->getRefId())) {
192  $form->addCommandButton("saveSettings", $this->lng->txt("save"));
193  $form->addCommandButton("editSettings", $this->lng->txt("cancel"));
194  }
195 
196  $act = new ilCheckboxInputGUI($this->lng->txt("badge_service_activate"), "act");
197  $act->setInfo($this->lng->txt("badge_service_activate_info"));
198  $form->addItem($act);
199 
200  /* see bug #0020124
201  $obi = new ilCheckboxInputGUI($this->lng->txt("badge_obi_activate"), "obi");
202  $obi->setInfo($this->lng->txt("badge_obi_activate_info"));
203  $form->addItem($obi);
204 
205  $obi_org = new ilTextInputGUI($this->lng->txt("badge_obi_organisation"), "obi_org");
206  $obi_org->setRequired(true);
207  $obi_org->setInfo($this->lng->txt("badge_obi_organisation_info"));
208  $obi->addSubItem($obi_org);
209 
210  $obi_contact = new ilEmailInputGUI($this->lng->txt("badge_obi_contact"), "obi_cont");
211  $obi_contact->setRequired(true);
212  $obi_contact->setInfo($this->lng->txt("badge_obi_contact_info"));
213  $obi->addSubItem($obi_contact);
214 
215  $obi_salt = new ilTextInputGUI($this->lng->txt("badge_obi_salt"), "obi_salt");
216  $obi_salt->setRequired(true);
217  $obi_salt->setInfo($this->lng->txt("badge_obi_salt_info"));
218  $obi->addSubItem($obi_salt);
219  */
220 
221  $handler = ilBadgeHandler::getInstance();
222  $act->setChecked($handler->isActive());
223 
224  /* see bug 0020124
225  $obi->setChecked($handler->isObiActive());
226  $obi_org->setValue($handler->getObiOrganistation());
227  $obi_contact->setValue($handler->getObiContact());
228  $obi_salt->setValue($handler->getObiSalt());
229  */
230 
231  return $form;
232  }
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 339 of file class.ilObjBadgeAdministrationGUI.php.

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

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

340  {
341  $lng = $this->lng;
342  $ilCtrl = $this->ctrl;
343 
344  $form = new ilPropertyFormGUI();
345  $form->setFormAction($ilCtrl->getFormAction($this, "saveBadge"));
346  $form->setTitle($lng->txt("badge_image_template_form"));
347 
348  $title = new ilTextInputGUI($lng->txt("title"), "title");
349  $title->setRequired(true);
350  $form->addItem($title);
351 
352  $img = new ilImageFileInputGUI($lng->txt("image"), "img");
353  $img->setSuffixes(array("png", "svg"));
354  if ($a_mode == "create") {
355  $img->setRequired(true);
356  }
357  $img->setUseCache(false);
358  $img->setALlowDeletion(false);
359  $form->addItem($img);
360 
361  $types_mode = new ilRadioGroupInputGUI($lng->txt("badge_template_types"), "tmode");
362  $types_mode->setRequired(true);
363  $form->addItem($types_mode);
364 
365  $type_all = new ilRadioOption($lng->txt("badge_template_types_all"), "all");
366  $types_mode->addOption($type_all);
367 
368  $type_spec = new ilRadioOption($lng->txt("badge_template_types_specific"), "spec");
369  $types_mode->addOption($type_spec);
370 
371  $types = new ilCheckboxGroupInputGUI($lng->txt("badge_types"), "type");
372  $types->setRequired(true);
373  $type_spec->addSubItem($types);
374 
375  foreach (ilBadgeHandler::getInstance()->getAvailableTypes() as $id => $type) {
376  $types->addOption(new ilCheckboxOption($type->getCaption(), $id));
377  }
378 
379  if ($a_mode == "create") {
380  $form->addCommandButton("saveImageTemplate", $lng->txt("save"));
381  } else {
382  $form->addCommandButton("updateImageTemplate", $lng->txt("save"));
383  }
384  $form->addCommandButton("listImageTemplates", $lng->txt("cancel"));
385 
386  return $form;
387  }
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
This class represents a property in a property form.
This class represents a property in a property form.
$img
Definition: imgupload.php:57
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 298 of file class.ilObjBadgeAdministrationGUI.php.

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

299  {
300  $ilAccess = $this->access;
301  $lng = $this->lng;
302  $ilToolbar = $this->toolbar;
303  $ilCtrl = $this->ctrl;
304 
305  $this->assertActive();
306  $this->tabs_gui->setTabActive("imgtmpl");
307 
308  if ($this->checkPermissionBool("write")) {
309  $ilToolbar->addButton(
310  $lng->txt("badge_add_template"),
311  $ilCtrl->getLinkTarget($this, "addImageTemplate")
312  );
313  }
314 
315  $tbl = new ilBadgeImageTemplateTableGUI(
316  $this,
317  "listImageTemplates",
318  $ilAccess->checkAccess("write", "", $this->object->getRefId())
319  );
320  $this->tpl->setContent($tbl->getHTML());
321  }
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 552 of file class.ilObjBadgeAdministrationGUI.php.

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

Referenced by applyObjectFilter(), and resetObjectFilter().

553  {
554  $ilAccess = $this->access;
555  $tpl = $this->tpl;
556 
557  $this->assertActive();
558  $this->tabs_gui->setTabActive("obj_badges");
559 
560  $tbl = new ilObjectBadgeTableGUI(
561  $this,
562  "listObjectBadges",
563  $ilAccess->checkAccess("write", "", $this->object->getRefId())
564  );
565  $tpl->setContent($tbl->getHTML());
566  }
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 596 of file class.ilObjBadgeAdministrationGUI.php.

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

Referenced by applyUserFilter(), and resetUserFilter().

597  {
598  $ilCtrl = $this->ctrl;
599  $lng = $this->lng;
600  $tpl = $this->tpl;
601 
602  $parent_obj_id = $_REQUEST["pid"];
603  if (!$parent_obj_id) {
604  $ilCtrl->redirect($this, "listObjectBadges");
605  }
606 
607  $this->assertActive();
608 
609  $this->tabs_gui->clearTargets();
610  $this->tabs_gui->setBackTarget(
611  $lng->txt("back"),
612  $ilCtrl->getLinkTarget($this, "listObjectBadges")
613  );
614 
615  $ilCtrl->saveParameter($this, "pid");
616 
617  $tbl = new ilBadgeUserTableGUI($this, "listUsers", null, null, $parent_obj_id, (int) $_REQUEST["bid"]);
618  $tpl->setContent($tbl->getHTML());
619  }
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 239 of file class.ilObjBadgeAdministrationGUI.php.

References $access, and assertActive().

240  {
241  $ilAccess = $this->access;
242 
243  $this->assertActive();
244  $this->tabs_gui->setTabActive("types");
245 
246  $tbl = new ilBadgeTypesTableGUI(
247  $this,
248  "listTypes",
249  $ilAccess->checkAccess("write", "", $this->object->getRefId())
250  );
251  $this->tpl->setContent($tbl->getHTML());
252  }
TableGUI class for badge type listing.
+ Here is the call graph for this function:

◆ resetObjectFilter()

ilObjBadgeAdministrationGUI::resetObjectFilter ( )
protected

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

References $access, and listObjectBadges().

583  {
584  $ilAccess = $this->access;
585 
586  $tbl = new ilObjectBadgeTableGUI(
587  $this,
588  "listObjectBadges",
589  $ilAccess->checkAccess("write", "", $this->object->getRefId())
590  );
591  $tbl->resetOffset();
592  $tbl->resetFilter();
593  $this->listObjectBadges();
594  }
TableGUI class for badge listing.
+ Here is the call graph for this function:

◆ resetUserFilter()

ilObjBadgeAdministrationGUI::resetUserFilter ( )
protected

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

References listObjectBadgeUsers().

630  {
631  $tbl = new ilBadgeUserTableGUI($this, "listUsers", null, null, $parent_obj_id, (int) $_REQUEST["bid"]);
632  $tbl->resetOffset();
633  $tbl->resetFilter();
634  $this->listObjectBadgeUsers();
635  }
TableGUI class for badge user listing.
+ Here is the call graph for this function:

◆ saveImageTemplate()

ilObjBadgeAdministrationGUI::saveImageTemplate ( )
protected

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

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

390  {
391  $ilCtrl = $this->ctrl;
392  $lng = $this->lng;
393 
394  $this->checkPermission("write");
395 
396  $form = $this->initImageTemplateForm("create");
397  if ($form->checkInput()) {
398  $tmpl = new ilBadgeImageTemplate();
399  $tmpl->setTitle($form->getInput("title"));
400  $tmpl->setTypes($form->getInput("type"));
401  $tmpl->create();
402 
403  $tmpl->uploadImage($_FILES["img"]);
404 
405  ilUtil::sendSuccess($lng->txt("settings_saved"), true);
406  $ilCtrl->redirect($this, "listImageTemplates");
407  }
408 
409  $form->setValuesByPost();
410  $this->addImageTemplate($form);
411  }
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 154 of file class.ilObjBadgeAdministrationGUI.php.

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

155  {
156  $ilCtrl = $this->ctrl;
157 
158  $this->checkPermission("write");
159 
160  $form = $this->initFormSettings();
161  if ($form->checkInput()) {
162  $obi = (bool) $form->getInput("act")
163  ? (bool) $form->getInput("obi")
164  : null;
165 
166  $handler = ilBadgeHandler::getInstance();
167  $handler->setActive((bool) $form->getInput("act"));
168  $handler->setObiActive($obi);
169  $handler->setObiOrganisation(trim($form->getInput("obi_org")));
170  $handler->setObiContact(trim($form->getInput("obi_cont")));
171  $handler->setObiSalt(trim($form->getInput("obi_salt")));
172 
173  $handler->rebuildIssuerStaticUrl();
174 
175  ilUtil::sendSuccess($this->lng->txt("settings_saved"), true);
176  $ilCtrl->redirect($this, "editSettings");
177  }
178 
179  $form->setValuesByPost();
180  $this->editSettings($form);
181  }
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 440 of file class.ilObjBadgeAdministrationGUI.php.

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

Referenced by editImageTemplate(), and updateImageTemplate().

441  {
442  $a_form->getItemByPostVar("title")->setValue($a_tmpl->getTitle());
443  $a_form->getItemByPostVar("img")->setImage($a_tmpl->getImagePath());
444  $a_form->getItemByPostVar("img")->setValue($a_tmpl->getImage());
445 
446  if ($a_tmpl->getTypes()) {
447  $a_form->getItemByPostVar("tmode")->setValue("spec");
448  $a_form->getItemByPostVar("type")->setValue($a_tmpl->getTypes());
449  } else {
450  $a_form->getItemByPostVar("tmode")->setValue("all");
451  }
452  }
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 656 of file class.ilObjBadgeAdministrationGUI.php.

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

Referenced by activateObjectBadges(), and deactivateObjectBadges().

657  {
658  $ilCtrl = $this->ctrl;
659  $lng = $this->lng;
660 
661  $badge_ids = $this->getObjectBadgesFromMultiAction();
662 
663  foreach ($badge_ids as $badge_id) {
664  $badge = new ilBadge($badge_id);
665  $badge->setActive($a_status);
666  $badge->update();
667  }
668 
669  ilUtil::sendSuccess($lng->txt("settings_saved"), true);
670  $ilCtrl->redirect($this, "listObjectBadges");
671  }
Class ilBadge.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateImageTemplate()

ilObjBadgeAdministrationGUI::updateImageTemplate ( )
protected

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

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

455  {
456  $ilCtrl = $this->ctrl;
457  $lng = $this->lng;
458 
459  $this->checkPermission("write");
460 
461  $tmpl_id = $_REQUEST["tid"];
462  if (!$tmpl_id) {
463  $ilCtrl->redirect($this, "listImageTemplates");
464  }
465 
466  $ilCtrl->setParameter($this, "tid", $tmpl_id);
467 
468  $tmpl = new ilBadgeImageTemplate($tmpl_id);
469 
470  $form = $this->initImageTemplateForm("update");
471  if ($form->checkInput()) {
472  $tmpl->setTitle($form->getInput("title"));
473 
474  if ($form->getInput("tmode") != "all") {
475  $tmpl->setTypes($form->getInput("type"));
476  } else {
477  $tmpl->setTypes(null);
478  }
479 
480  $tmpl->update();
481 
482  $tmpl->uploadImage($_FILES["img"]);
483 
484  ilUtil::sendSuccess($lng->txt("settings_saved"), true);
485  $ilCtrl->redirect($this, "listImageTemplates");
486  }
487 
488  $this->setImageTemplateFormValues($form, $tmpl);
489  $form->setValuesByPost();
490  $this->editImageTemplate($form);
491  }
setImageTemplateFormValues(ilPropertyFormGUI $a_form, ilBadgeImageTemplate $a_tmpl)
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 18 of file class.ilObjBadgeAdministrationGUI.php.

Referenced by getAdminTabs().

◆ $tabs

ilObjBadgeAdministrationGUI::$tabs
protected

◆ $toolbar

ilObjBadgeAdministrationGUI::$toolbar
protected

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

Referenced by listImageTemplates().


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