ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
ilObjLinkResourceGUI Class Reference

Class ilObjLinkResourceGUI. More...

+ Inheritance diagram for ilObjLinkResourceGUI:
+ Collaboration diagram for ilObjLinkResourceGUI:

Public Member Functions

 getType ()
 
 executeCommand ()
 
 save ()
 
 saveObject ()
 
 editLink ()
 
 updateLink ()
 
 getLinkToListModal ()
 Get form to transform a single weblink to a weblink list. More...
 
 saveLinkList ()
 
 addLink ()
 
 saveAddLink ()
 
 view ()
 
 infoScreen ()
 instead of redirecting here, links to the info screen should directly lead to the right place, but it looks like this needs some restructuring. More...
 
 infoScreenForward ()
 show information screen More...
 
 callDirectLink ()
 
 callLink ()
 
 exportHTML ()
 
- Public Member Functions inherited from ilObject2GUI
 __construct (int $id=0, int $id_type=self::REPOSITORY_NODE_ID, int $parent_node_id=0)
 
 executeCommand ()
 execute command More...
 
 getIdType ()
 
 delete ()
 Display delete confirmation form (repository/workspace switch) More...
 
 confirmedDelete ()
 Delete objects (repository/workspace switch) More...
 
 getHTML ()
 
 withReferences ()
 Final/Private declaration of unchanged parent methods. More...
 
 setCreationMode (bool $mode=true)
 
 getCreationMode ()
 
 prepareOutput (bool $show_sub_objects=true)
 
 isVisible (int $ref_id, string $type)
 
 setColumnSettings (ilColumnGUI $column_gui)
 
 view ()
 view object content (repository/workspace switch) More...
 
 getType ()
 Functions that must be overwritten. More...
 
 create ()
 CRUD. More...
 
 save ()
 
 edit ()
 
 update ()
 
 cancel ()
 
 putObjectInTree (ilObject $obj, ?int $parent_node_id=null)
 Add object to tree at given position. More...
 
- Public Member Functions inherited from ilObjectGUI
 getRefId ()
 
 setAdminMode (string $mode)
 
 getAdminMode ()
 
 getObject ()
 
 executeCommand ()
 
 withReferences ()
 determines whether objects are referenced or not (got ref ids or not) More...
 
 setCreationMode (bool $mode=true)
 If true, a creation screen is displayed the current [ref_id] does belong to the parent class The mode is determined in ilRepositoryGUI. More...
 
 getCreationMode ()
 
 prepareOutput (bool $show_sub_objects=true)
 
 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...
 
 cancelObject ()
 cancel action and go back to previous page More...
 
 createObject ()
 create new object form More...
 
 editAvailabilityPeriodObject ()
 
 saveAvailabilityPeriodObject ()
 
 cancelCreation ()
 cancel create action and go back to repository parent More...
 
 saveObject ()
 
 getDidacticTemplateVar (string $type)
 Get didactic template setting from creation screen. More...
 
 putObjectInTree (ilObject $obj, ?int $parent_node_id=null)
 Add object to tree at given position. More...
 
 editObject ()
 
 addExternalEditFormCustom (ilPropertyFormGUI $form)
 
 updateObject ()
 updates object entry in object_data More...
 
 getFormAction (string $cmd, string $default_form_action="")
 Get form action for command (command is method name without "Object", e.g. More...
 
 isVisible (int $ref_id, string $type)
 
 viewObject ()
 viewObject container presentation for "administration -> repository, trash, permissions" More...
 
 deleteObject (bool $error=false)
 Display deletion confirmation screen. More...
 
 setColumnSettings (ilColumnGUI $column_gui)
 
 addToDeskObject ()
 
 removeFromDeskObject ()
 
- Public Member Functions inherited from ILIAS\Object\ImplementsCreationCallback
 callCreationCallback (\ilObject $object, \ilObjectDefinition $obj_definition, int $requested_crtcb)
 

Static Public Member Functions

static _goto (string $a_target, $a_additional=null)
 
- Static Public Member Functions inherited from ilObject2GUI
static handleAfterSaveCallback (ilObject $obj, ?int $callback_ref_id)
 After creation callback. More...
 
- Static Public Member Functions inherited from ilObjectGUI
static _gotoRepositoryRoot (bool $raise_error=false)
 Goto repository root. More...
 
static _gotoRepositoryNode (int $ref_id, string $cmd="")
 
static _gotoSharedWorkspaceNode (int $wsp_id)
 

Protected Member Functions

 getWebLinkRepo ()
 
 initViewMode (?int $new_view_mode=null)
 
 initCreateForm (string $new_type)
 
 afterSave (ilObject $new_object)
 
 settings ()
 
 initFormSettings ()
 
 deleteParameter ()
 
 deleteParameterForm ()
 
 updateLinks ()
 
 setValuesFromLink (int $a_link_id)
 
 initList (int $a_mode)
 
 checkLinkInput (int $a_mode, bool $a_valid, ?int $a_link_id=null)
 
 initFormLink (int $a_mode)
 
 addLinkInputToForm (int $mode)
 
 switchViewMode (?int $force_view_mode=null)
 Switch between "View" "Manage" and "Sort". More...
 
 editLinks ()
 Start with manage mode. More...
 
 manage ()
 
 showLinks ()
 
 sort ()
 
 saveSorting ()
 
 showToolbar (string $a_tpl_var)
 
 confirmDeleteLink ()
 
 deleteLinks ()
 
 deactivateLink ()
 
 activateTabs (string $a_active_tab, string $a_active_subtab='')
 Activate tab and subtabs. More...
 
 setTabs ()
 
 addLocatorItems ()
 
 redirectToLink (int $a_ref_id, int $a_obj_id, string $a_url)
 
- Protected Member Functions inherited from ilObject2GUI
 afterConstructor ()
 Do anything that should be done after constructor in here. More...
 
 assignObject ()
 create object instance as internal property (repository/workspace switch) More...
 
 getAccessHandler ()
 
 setLocator ()
 set Locator More...
 
 deleteConfirmedObjects ()
 Delete objects (workspace specific) This should probably be moved elsewhere as done with RepUtil. More...
 
 setTitleAndDescription ()
 
 omitLocator (bool $omit=true)
 
 getTargetFrame (string $cmd, string $target_frame="")
 
 setTargetFrame (string $cmd, string $target_frame)
 
 getCenterColumnHTML ()
 
 getRightColumnHTML ()
 
 checkPermission (string $perm, string $cmd="", string $type="", ?int $ref_id=null)
 
 showPossibleSubObjects ()
 
 redirectToRefId (int $ref_id, string $cmd="")
 
 addAdminLocatorItems (bool $do_not_add_object=false)
 
 setTabs ()
 create tabs (repository/workspace switch) More...
 
 getReturnLocation (string $cmd, string $location="")
 Deprecated functions. More...
 
 setReturnLocation (string $cmd, string $location)
 
 showActions ()
 
 getTabs ()
 
 addLocatorItems ()
 Functions to be overwritten. More...
 
 checkPermissionBool (string $perm, string $cmd="", string $type="", ?int $node_id=null)
 
 initHeaderAction (?string $sub_type=null, ?int $sub_id=null)
 Add header action menu. More...
 
 redrawHeaderAction ()
 Updating icons after ajax call. More...
 
- Protected Member Functions inherited from ilObjectGUI
 getObjectService ()
 
 assignObject ()
 
 setTitleAndDescription ()
 
 createActionDispatcherGUI ()
 
 initHeaderAction (?string $sub_type=null, ?int $sub_id=null)
 Add header action menu. More...
 
 insertHeaderAction (?ilObjectListGUI $list_gui=null)
 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 More...
 
 setAdminTabs ()
 set admin tabs More...
 
 setLocator ()
 
 addLocatorItems ()
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 omitLocator (bool $omit=true)
 
 addAdminLocatorItems (bool $do_not_add_object=false)
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 getCreationFormsHTML (StandardForm|ilPropertyFormGUI|array $form)
 
 getTitleForCreationFormPage ()
 
 getCreationFormTitle ()
 
 initCreateForm (string $new_type)
 
 didacticTemplatesToForm ()
 
 initDidacticTemplate (ilPropertyFormGUI $form)
 
 retrieveAdditionalDidacticTemplateOptions ()
 
 addAdoptContentLinkToToolbar ()
 
 addImportButtonToToolbar ()
 
 addAvailabilityPeriodButtonToToolbar (ilToolbarGUI $toolbar)
 
 parseDidacticTemplateVar (string $var, string $type)
 
 afterSave (ilObject $new_object)
 Post (successful) object creation hook. More...
 
 initEditForm ()
 
 initEditCustomForm (ilPropertyFormGUI $a_form)
 Add custom fields to update form. More...
 
 getEditFormValues ()
 
 getEditFormCustomValues (array &$a_values)
 Add values to custom edit fields. More...
 
 validateCustom (ilPropertyFormGUI $form)
 Validate custom values (if not possible with checkInput()) More...
 
 updateCustom (ilPropertyFormGUI $form)
 Insert custom update form values into object. More...
 
 afterUpdate ()
 Post (successful) object update hook. More...
 
 routeImportCmdObject ()
 
 importFile (string $file_to_import, string $path_to_uploaded_file_in_temp_dir)
 
 deleteUploadedImportFile (string $path_to_uploaded_file_in_temp_dir)
 
 afterImport (ilObject $new_object)
 Post (successful) object import hook. More...
 
 setFormAction (string $cmd, string $form_action)
 
 getReturnLocation (string $cmd, string $default_location="")
 Get return location for command (command is method name without "Object", e.g. More...
 
 setReturnLocation (string $cmd, string $location)
 set specific return location for command More...
 
 getTargetFrame (string $cmd, string $default_target_frame="")
 get target frame for command (command is method name without "Object", e.g. More...
 
 setTargetFrame (string $cmd, string $target_frame)
 Set specific target frame for command. More...
 
 showPossibleSubObjects ()
 show possible sub objects (pull down menu) More...
 
 getTabs ()
 overwrite in derived GUI class of your object type More...
 
 redirectToRefId (int $ref_id, string $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 ["ref_id"] value of the request More...
 
 getCenterColumnHTML ()
 Get center column. More...
 
 getRightColumnHTML ()
 Display right column. More...
 
 checkPermission (string $perm, string $cmd="", string $type="", ?int $ref_id=null)
 
 checkPermissionBool (string $perm, string $cmd="", string $type="", ?int $ref_id=null)
 
 enableDragDropFileUpload ()
 Enables the file upload into this object by dropping files. More...
 
 getCreatableObjectTypes ()
 
 buildAddNewItemElements (array $subtypes, string $create_target_class=ilRepositoryGUI::class, ?int $redirect_target_ref_id=null,)
 
 buildGroup (string $create_target_class, array $obj_types_in_group, string $title, array $subtypes)
 

Protected Attributes

const int VIEW_MODE_VIEW = 1
 
const int VIEW_MODE_MANAGE = 2
 
const int VIEW_MODE_SORT = 3
 
const int LINK_MOD_CREATE = 1
 
const int LINK_MOD_EDIT = 2
 
const int LINK_MOD_ADD = 3
 
const int LINK_MOD_SET_LIST = 4
 
const int LINK_MOD_ASYNC = 6
 
- Protected Attributes inherited from ilObject2GUI
ilObjectDefinition $obj_definition
 
ilGlobalTemplateInterface $tpl
 
ilCtrl $ctrl
 
ilLanguage $lng
 
ilTabsGUI $tabs_gui
 
ilFavouritesManager $favourites
 
ilErrorHandling $error
 
ilLocatorGUI $locator
 
ilObjUser $user
 
ilAccessHandler $access
 
ilToolbarGUI $toolbar
 
Factory $refinery
 
ilRbacAdmin $rbac_admin
 
ilRbacSystem $rbac_system
 
ilRbacReview $rbac_review
 
int $request_ref_id
 
int $id_type
 
int $parent_id
 
string $type
 
string $html
 
int $object_id
 
int $node_id = null
 
array $creation_forms = []
 
 $access_handler
 
- Protected Attributes inherited from ilObjectGUI
ILIAS Notes Service $notes_service
 
GlobalHttpState $http
 
ServerRequestInterface $request
 
ilLocatorGUI $locator
 
ilObjUser $user
 
ilAccessHandler $access
 
ilSetting $settings
 
ilToolbarGUI $toolbar
 
ilRbacAdmin $rbac_admin
 
ilRbacSystem $rbac_system
 
ilRbacReview $rbac_review
 
ilObjectService $object_service
 
ilObjectDefinition $obj_definition
 
ilGlobalTemplateInterface $tpl
 
ilTree $tree
 
ilCtrl $ctrl
 
ilErrorHandling $error
 
ilLanguage $lng
 
ilTabsGUI $tabs_gui
 
ILIAS $ilias
 
ArrayBasedRequestWrapper $post_wrapper
 
RequestWrapper $request_wrapper
 
Refinery $refinery
 
ilFavouritesManager $favourites
 
CustomIconFactory $custom_icon_factory
 
UIFactory $ui_factory
 
UIRenderer $ui_renderer
 
Filesystem $temp_file_system
 
ilObject $object = null
 
bool $creation_mode = false
 
 $data
 
int $id
 
bool $call_by_reference = false
 
bool $prepare_output
 
int $ref_id
 
int $obj_id
 
int $maxcount
 
array $form_action = []
 
array $return_location = []
 
array $target_frame = []
 
string $tmp_import_dir
 
string $sub_objects = ""
 
bool $omit_locator = false
 
string $type = ""
 
string $admin_mode = self::ADMIN_MODE_NONE
 
int $requested_ref_id = 0
 
int $requested_crtptrefid = 0
 
int $requested_crtcb = 0
 
string $requested_new_type = ""
 
string $link_params
 
string $html = ""
 

Private Member Functions

 __prepareOutput ()
 

Private Attributes

int $view_mode = self::VIEW_MODE_VIEW
 
ilPropertyFormGUI $form = null
 
ilWebLinkDraftItem $draft_item = null
 
ilWebLinkDraftParameter $draft_parameter = null
 
ilWebLinkDraftList $draft_list = null
 

Additional Inherited Members

- Data Fields inherited from ilObject2GUI
const OBJECT_ID = 0
 
const REPOSITORY_NODE_ID = 1
 
const WORKSPACE_NODE_ID = 2
 
const REPOSITORY_OBJECT_ID = 3
 
const WORKSPACE_OBJECT_ID = 4
 
const PORTFOLIO_OBJECT_ID = 5
 
- Data Fields inherited from ilObjectGUI
const ADMIN_MODE_NONE = ""
 
const ADMIN_MODE_SETTINGS = "settings"
 
const ADMIN_MODE_REPOSITORY = "repository"
 
const UPLOAD_TYPE_LOCAL = 1
 
const UPLOAD_TYPE_UPLOAD_DIRECTORY = 2
 
const CFORM_NEW = 1
 
const CFORM_IMPORT = 2
 
const CFORM_CLONE = 3
 
const SUPPORTED_IMPORT_MIME_TYPES = [MimeType::APPLICATION__ZIP, MimeType::APPLICATION__X_ZIP_COMPRESSED]
 

Detailed Description

Member Function Documentation

◆ __prepareOutput()

ilObjLinkResourceGUI::__prepareOutput ( )
private

Definition at line 1586 of file class.ilObjLinkResourceGUI.php.

Referenced by executeCommand().

1586  : void
1587  {
1588  $this->tpl->setLocator();
1589  }
+ Here is the caller graph for this function:

◆ _goto()

static ilObjLinkResourceGUI::_goto ( string  $a_target,
  $a_additional = null 
)
static

Definition at line 1697 of file class.ilObjLinkResourceGUI.php.

References ilObject2GUI\$ctrl, $DIC, $ilErr, ilObject2GUI\$lng, ilObjectGUI\_gotoRepositoryRoot(), ilObject\_lookupObjId(), ilObject\_lookupTitle(), ilUtil\redirect(), ilCtrl\redirectByClass(), ROOT_FOLDER_ID, ilCtrl\setParameterByClass(), ilCtrl\setTargetScript(), and ilLanguage\txt().

Referenced by ILIAS\StaticURL\Handler\LegacyGotoHandler\handle().

1697  : void
1698  {
1699  global $DIC;
1700 
1701  $main_tpl = $DIC->ui()->mainTemplate();
1702  $ilAccess = $DIC->access();
1703  $lng = $DIC->language();
1704  $ctrl = $DIC->ctrl();
1705  $ilErr = $DIC['ilErr'];
1706 
1707  if ($a_additional && substr($a_additional, -3) == "wsp") {
1708  $ctrl->setTargetScript('ilias.php');
1710  ilSharedResourceGUI::class,
1711  'wsp_id',
1712  $a_target
1713  );
1715  [
1716  ilSharedResourceGUI::class
1717  ],
1718  'edit'
1719  );
1720  return;
1721  }
1722 
1723  // Will be replaced in future releases by ilAccess::checkAccess()
1724  if ($ilAccess->checkAccess("read", "", (int) $a_target)) {
1726  "ilias.php?baseClass=ilLinkResourceHandlerGUI&ref_id=" . $a_target
1727  );
1728  } elseif ($ilAccess->checkAccess("visible", "", (int) $a_target)) {
1730  "ilias.php?baseClass=ilLinkResourceHandlerGUI&ref_id=" . $a_target . "&cmd=infoScreen"
1731  );
1732  } elseif ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID)) {
1733  $main_tpl->setOnScreenMessage(
1734  'failure',
1735  sprintf(
1736  $lng->txt("msg_no_perm_read_item"),
1739  (int) $a_target
1740  )
1741  )
1742  ),
1743  true
1744  );
1746  }
1747 
1748  $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);
1749  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
const ROOT_FOLDER_ID
Definition: constants.php:32
setParameterByClass(string $a_class, string $a_parameter, $a_value)
redirectByClass( $a_class, ?string $a_cmd=null, ?string $a_anchor=null, bool $is_async=false)
$ilErr
Definition: raiseError.php:33
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_id)
global $DIC
Definition: shib_login.php:26
static redirect(string $a_script)
setTargetScript(string $a_target_script)
static _gotoRepositoryRoot(bool $raise_error=false)
Goto repository root.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ activateTabs()

ilObjLinkResourceGUI::activateTabs ( string  $a_active_tab,
string  $a_active_subtab = '' 
)
protected

Activate tab and subtabs.

Definition at line 1475 of file class.ilObjLinkResourceGUI.php.

References ilContainerSortingSettings\_lookupSortMode(), ilObject2GUI\checkPermissionBool(), ILIAS\Repository\ctrl(), getWebLinkRepo(), ILIAS\Repository\lng(), ILIAS\Repository\object(), and ilContainer\SORT_MANUAL.

Referenced by addLink(), confirmDeleteLink(), editLink(), manage(), saveAddLink(), showLinks(), sort(), and updateLinks().

1478  : void {
1479  switch ($a_active_tab) {
1480  case 'content':
1481  if ($this->checkPermissionBool('write')) {
1482  $this->lng->loadLanguageModule('cntr');
1483 
1484  $this->ctrl->setParameter(
1485  $this,
1486  'switch_mode',
1487  self::VIEW_MODE_VIEW
1488  );
1489  $this->tabs_gui->addSubTab(
1490  'id_content_view',
1491  $this->lng->txt('view'),
1492  $this->ctrl->getLinkTarget($this, 'switchViewMode')
1493  );
1494  $this->ctrl->setParameter(
1495  $this,
1496  'switch_mode',
1497  self::VIEW_MODE_MANAGE
1498  );
1499  $this->tabs_gui->addSubTab(
1500  'id_content_manage',
1501  $this->lng->txt('cntr_manage'),
1502  $this->ctrl->getLinkTarget($this, 'switchViewMode')
1503  );
1504  if (!$this->getWebLinkRepo()->doesOnlyOneItemExist() and
1506  $this->object->getId()
1507  ) == ilContainer::SORT_MANUAL) {
1508  $this->ctrl->setParameter(
1509  $this,
1510  'switch_mode',
1511  self::VIEW_MODE_SORT
1512  );
1513  $this->tabs_gui->addSubTab(
1514  'id_content_ordering',
1515  $this->lng->txt('cntr_ordering'),
1516  $this->ctrl->getLinkTarget($this, 'switchViewMode')
1517  );
1518  }
1519 
1520  $this->ctrl->clearParameters($this);
1521  $this->tabs_gui->activateSubTab($a_active_subtab);
1522  }
1523  }
1524 
1525  $this->tabs_gui->activateTab('id_content');
1526  }
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $node_id=null)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addLink()

ilObjLinkResourceGUI::addLink ( )

Definition at line 546 of file class.ilObjLinkResourceGUI.php.

References activateTabs(), ilObject2GUI\checkPermission(), ilPropertyFormGUI\getHTML(), and initFormLink().

546  : void
547  {
548  $this->checkPermission('write');
549  $this->activateTabs('content', 'id_content_view');
550 
551  $form = $this->initFormLink(self::LINK_MOD_ADD);
552  $this->tpl->setContent($form->getHTML());
553  }
activateTabs(string $a_active_tab, string $a_active_subtab='')
Activate tab and subtabs.
checkPermission(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
+ Here is the call graph for this function:

◆ addLinkInputToForm()

ilObjLinkResourceGUI::addLinkInputToForm ( int  $mode)
protected

Definition at line 1108 of file class.ilObjLinkResourceGUI.php.

References ILIAS\Repository\form(), ilLinkInputGUI\LIST, ILIAS\Repository\lng(), and ilLinkInputGUI\setAllowedLinkTypes().

Referenced by initFormLink().

1108  : void
1109  {
1110  $tar = new ilLinkInputGUI(
1111  $this->lng->txt('type'),
1112  'tar'
1113  ); // lng var
1114  if ($mode == self::LINK_MOD_CREATE) {
1116  }
1117  $tar->setInternalLinkFilterTypes(
1118  [
1119  "PageObject",
1120  "GlossaryItem",
1121  "RepositoryItem",
1122  'WikiPage'
1123  ]
1124  );
1125  $tar->setExternalLinkMaxLength(1000);
1126  $tar->setInternalLinkFilterTypes(
1127  ["PageObject", "GlossaryItem", "RepositoryItem"]
1128  );
1129  $tar->setRequired(true);
1130  $this->form->addItem($tar);
1131  }
setAllowedLinkTypes(string $a_val)
Set allowed link types (LIST, BOTH, INT, EXT)
form( $class_path, string $cmd, string $submit_caption="")
This class represents a external and/or internal link in a property form.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addLocatorItems()

ilObjLinkResourceGUI::addLocatorItems ( )
protected
Todo:
is this required?

Definition at line 1594 of file class.ilObjLinkResourceGUI.php.

References $DIC, ILIAS\Repository\ctrl(), and ILIAS\Repository\object().

1594  : void
1595  {
1596  global $DIC;
1597 
1598  $ilLocator = $DIC['ilLocator'];
1599  if (is_object($this->object)) {
1600  $ilLocator->addItem(
1601  $this->object->getTitle(),
1602  $this->ctrl->getLinkTarget($this),
1603  "",
1604  $this->object->getRefId(),
1605  "webr"
1606  );
1607  }
1608  }
global $DIC
Definition: shib_login.php:26
+ Here is the call graph for this function:

◆ afterSave()

ilObjLinkResourceGUI::afterSave ( ilObject  $new_object)
protected

Definition at line 244 of file class.ilObjLinkResourceGUI.php.

References ilWebLinkDatabaseRepository\createItem(), ILIAS\Repository\ctrl(), ILIAS\Repository\form(), ilObject\getId(), ilObject\getRefId(), ILIAS\Repository\lng(), and ilUtil\redirect().

Referenced by saveObject().

244  : void
245  {
246  $new_web_link_repo = new ilWebLinkDatabaseRepository($new_object->getId());
247 
248  if ($this->form->getInput('tar_mode_type') === 'single') {
249  // Save link
250  $new_web_link_repo->createItem($this->draft_item);
251  $this->tpl->setOnScreenMessage(
252  'success',
253  $this->lng->txt('webr_link_added')
254  );
255  }
256 
257  if ($this->form->getInput('tar_mode_type') === 'list') {
258  // Save list
259  $new_web_link_repo->createList($this->draft_list);
260  $this->tpl->setOnScreenMessage(
261  'success',
262  $this->lng->txt('webr_list_added')
263  );
264  }
265 
266  // personal workspace
267  if ($this->id_type == self::WORKSPACE_NODE_ID) {
268  $this->ctrl->redirect($this, "editLinks");
269  } // repository
270  else {
272  "ilias.php?baseClass=ilLinkResourceHandlerGUI&ref_id=" .
273  $new_object->getRefId() . "&cmd=switchViewMode&switch_mode=2"
274  );
275  }
276  }
createItem(ilWebLinkDraftItem $item)
Creates a new item, complete with parameters.
static redirect(string $a_script)
form( $class_path, string $cmd, string $submit_caption="")
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ callDirectLink()

ilObjLinkResourceGUI::callDirectLink ( )

Definition at line 1610 of file class.ilObjLinkResourceGUI.php.

References ilObjectGUI\$obj_id, ilObjLinkResourceAccess\_getFirstLink(), getWebLinkRepo(), and redirectToLink().

1610  : void
1611  {
1612  $obj_id = $this->object->getId();
1613 
1614  if ($this->getWebLinkRepo()->doesOnlyOneItemExist(true)) {
1616 
1617  $this->redirectToLink(
1618  $this->ref_id,
1619  $obj_id,
1620  $item->getResolvedLink((bool) $this->settings->get('links_dynamic'))
1621  );
1622  }
1623  }
redirectToLink(int $a_ref_id, int $a_obj_id, string $a_url)
static _getFirstLink(int $a_webr_id)
Get first link item Check before with _isSingular() if there is more or less than one...
+ Here is the call graph for this function:

◆ callLink()

ilObjLinkResourceGUI::callLink ( )

Definition at line 1625 of file class.ilObjLinkResourceGUI.php.

References getWebLinkRepo(), ILIAS\FileDelivery\http(), ILIAS\Repository\object(), redirectToLink(), ILIAS\Repository\refinery(), and settings().

1625  : void
1626  {
1627  if ($this->http->wrapper()->query()->has('link_id')) {
1628  $link_id = $this->http->wrapper()->query()->retrieve(
1629  'link_id',
1630  $this->refinery->kindlyTo()->int()
1631  );
1632 
1633  $item = $this->getWebLinkRepo()->getItemByLinkId($link_id);
1634 
1635  $this->redirectToLink(
1636  $this->ref_id,
1637  $this->object->getId(),
1638  $item->getResolvedLink((bool) $this->settings->get('links_dynamic'))
1639  );
1640  }
1641  }
redirectToLink(int $a_ref_id, int $a_obj_id, string $a_url)
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:

◆ checkLinkInput()

ilObjLinkResourceGUI::checkLinkInput ( int  $a_mode,
bool  $a_valid,
?int  $a_link_id = null 
)
protected

Definition at line 836 of file class.ilObjLinkResourceGUI.php.

References ilObject2GUI\$error, $valid, ILIAS\Repository\form(), ilLinkInputGUI\isInternalLink(), ilWebLinkDraftParameter\LINKS_ERR_NO_NAME, ilWebLinkDraftParameter\LINKS_ERR_NO_VALUE, ILIAS\Repository\lng(), null, and settings().

Referenced by save(), saveAddLink(), and updateLink().

840  : bool {
841  $valid = $a_valid;
842 
843  $link_input = $this->form->getInput('tar');
844  $active = false;
845 
846  if ($a_mode == self::LINK_MOD_CREATE) {
847  $active = true;
848  } else {
849  $active = (bool) $this->form->getInput('act');
850  }
851 
852  $this->draft_item = new ilWebLinkDraftItem(
853  ilLinkInputGUI::isInternalLink($link_input),
854  $this->form->getInput('title'),
855  $this->form->getInput('desc'),
856  str_replace('"', '', $link_input),
857  $active,
858  []
859  );
860 
861  if (!$this->settings->get('links_dynamic')) {
862  return $valid;
863  }
864 
865  $this->draft_parameter = new ilWebLinkDraftParameter(
866  (int) $this->form->getInput('val'),
867  $this->form->getInput('nam')
868  );
869 
870  $error = $this->draft_parameter->validate();
871  if (!$error) {
872  return $valid;
873  }
874 
875  $this->draft_parameter = null;
876 
877  switch ($error) {
879  $this->form->getItemByPostVar('nam')->setAlert(
880  $this->lng->txt('links_no_name_given')
881  );
882  return false;
883 
885  $this->form->getItemByPostVar('val')->setAlert(
886  $this->lng->txt('links_no_value_given')
887  );
888  return false;
889 
890  default:
891  // Nothing entered => no error
892  return $valid;
893  }
894  }
Draft class for creating and updating a parameter attached to Web Link items.
ilErrorHandling $error
$valid
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
form( $class_path, string $cmd, string $submit_caption="")
static isInternalLink(string $a_value)
Draft class for creating and updating a Web Link item.
const string LINKS_ERR_NO_NAME
TODO: This can be removed when validate is.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ confirmDeleteLink()

ilObjLinkResourceGUI::confirmDeleteLink ( )
protected

Definition at line 1321 of file class.ilObjLinkResourceGUI.php.

References activateTabs(), ilObject2GUI\checkPermission(), ILIAS\Repository\ctrl(), getWebLinkRepo(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), and view().

1321  : void
1322  {
1323  $this->checkPermission('write');
1324  $this->activateTabs('content', 'id_content_view');
1325 
1326  $link_ids = [];
1327  if ($this->http->wrapper()->query()->has('link_id')) {
1328  $link_ids = (array) $this->http->wrapper()->query()->retrieve(
1329  'link_id',
1330  $this->refinery->kindlyTo()->int()
1331  );
1332  } elseif ($this->http->wrapper()->post()->has('link_ids')) {
1333  $link_ids = $this->http->wrapper()->post()->retrieve(
1334  'link_ids',
1335  $this->refinery->kindlyTo()->dictOf(
1336  $this->refinery->kindlyTo()->int()
1337  )
1338  );
1339  }
1340  if ($link_ids === []) {
1341  $this->tpl->setOnScreenMessage(
1342  'failure',
1343  $this->lng->txt('select_one')
1344  );
1345  $this->view();
1346  return;
1347  }
1348 
1349  $confirm = new ilConfirmationGUI();
1350  $confirm->setFormAction($this->ctrl->getFormAction($this, 'view'));
1351  $confirm->setHeaderText($this->lng->txt('webr_sure_delete_items'));
1352  $confirm->setConfirm($this->lng->txt('delete'), 'deleteLinks');
1353  $confirm->setCancel($this->lng->txt('cancel'), 'view');
1354 
1355  $items = $this->getWebLinkRepo()->getAllItemsAsContainer()->getItems();
1356 
1357  foreach ($items as $item) {
1358  if (!in_array($item->getLinkId(), $link_ids)) {
1359  continue;
1360  }
1361  $confirm->addItem(
1362  'link_ids[]',
1363  (string) $item->getLinkId(),
1364  $item->getTitle()
1365  );
1366  }
1367  $this->tpl->setContent($confirm->getHTML());
1368  }
activateTabs(string $a_active_tab, string $a_active_subtab='')
Activate tab and subtabs.
static http()
Fetches the global http state from ILIAS.
checkPermission(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
+ Here is the call graph for this function:

◆ deactivateLink()

ilObjLinkResourceGUI::deactivateLink ( )
protected

Definition at line 1396 of file class.ilObjLinkResourceGUI.php.

References ilObject2GUI\checkPermission(), ILIAS\Repository\ctrl(), getWebLinkRepo(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), and ILIAS\Repository\refinery().

1396  : void
1397  {
1398  $this->checkPermission('write');
1399 
1400  $link_id = 0;
1401  if ($this->http->wrapper()->query()->has('link_id')) {
1402  $link_id = $this->http->wrapper()->query()->retrieve(
1403  'link_id',
1404  $this->refinery->kindlyTo()->int()
1405  );
1406  }
1407  if (!$link_id) {
1408  $this->tpl->setOnScreenMessage(
1409  'failure',
1410  $this->lng->txt('select_one'),
1411  true
1412  );
1413  $this->ctrl->redirect($this, 'view');
1414  }
1415 
1416  $item = $this->getWebLinkRepo()->getItemByLinkId($link_id);
1417  $draft = new ilWebLinkDraftItem(
1418  $item->isInternal(),
1419  $item->getTitle(),
1420  $item->getDescription(),
1421  $item->getTarget(),
1422  false,
1423  $item->getParameters()
1424  );
1425 
1426  $this->tpl->setOnScreenMessage(
1427  'success',
1428  $this->lng->txt('webr_inactive_success'),
1429  true
1430  );
1431  $this->ctrl->redirect($this, 'view');
1432  }
static http()
Fetches the global http state from ILIAS.
checkPermission(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
Draft class for creating and updating a Web Link item.
+ Here is the call graph for this function:

◆ deleteLinks()

ilObjLinkResourceGUI::deleteLinks ( )
protected

Definition at line 1370 of file class.ilObjLinkResourceGUI.php.

References ilObject2GUI\checkPermission(), ILIAS\Repository\ctrl(), getWebLinkRepo(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), and ILIAS\Repository\refinery().

1370  : void
1371  {
1372  $this->checkPermission('write');
1373 
1374  $link_ids = [];
1375  if ($this->http->wrapper()->post()->has('link_ids')) {
1376  $link_ids = $this->http->wrapper()->post()->retrieve(
1377  'link_ids',
1378  $this->refinery->kindlyTo()->dictOf(
1379  $this->refinery->kindlyTo()->int()
1380  )
1381  );
1382  }
1383 
1384  foreach ($link_ids as $link_id) {
1385  $this->getWebLinkRepo()->deleteItemByLinkID($link_id);
1386  }
1387 
1388  $this->tpl->setOnScreenMessage(
1389  'success',
1390  $this->lng->txt('webr_deleted_items'),
1391  true
1392  );
1393  $this->ctrl->redirect($this, 'view');
1394  }
static http()
Fetches the global http state from ILIAS.
checkPermission(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
+ Here is the call graph for this function:

◆ deleteParameter()

ilObjLinkResourceGUI::deleteParameter ( )
protected

Definition at line 591 of file class.ilObjLinkResourceGUI.php.

References ilObject2GUI\checkPermission(), ILIAS\Repository\ctrl(), getWebLinkRepo(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), and ILIAS\Repository\refinery().

591  : void
592  {
593  $this->checkPermission('write');
594 
595  $link_id = $this->http->wrapper()->query()->retrieve(
596  'link_id',
597  $this->refinery->kindlyTo()->int()
598  );
599  $this->ctrl->setParameter($this, 'link_id', $link_id);
600 
601  $param_id = $this->http->wrapper()->query()->retrieve(
602  'param_id',
603  $this->refinery->kindlyTo()->int()
604  );
605 
606  if (!$param_id) {
607  $this->tpl->setOnScreenMessage(
608  'failure',
609  $this->lng->txt('select_one'),
610  true
611  );
612  $this->ctrl->redirect($this, 'view');
613  }
614 
615  $this->getWebLinkRepo()->deleteParameterByLinkIdAndParamId($link_id, $param_id);
616 
617  $this->tpl->setOnScreenMessage(
618  'success',
619  $this->lng->txt(
620  'links_parameter_deleted'
621  ),
622  true
623  );
624  $this->ctrl->redirect($this, 'editLinks');
625  }
static http()
Fetches the global http state from ILIAS.
checkPermission(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
+ Here is the call graph for this function:

◆ deleteParameterForm()

ilObjLinkResourceGUI::deleteParameterForm ( )
protected

Definition at line 627 of file class.ilObjLinkResourceGUI.php.

References ilObject2GUI\checkPermission(), ILIAS\Repository\ctrl(), getWebLinkRepo(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), and ILIAS\Repository\refinery().

627  : void
628  {
629  $this->checkPermission('write');
630 
631  $link_id = $this->http->wrapper()->query()->retrieve(
632  'link_id',
633  $this->refinery->kindlyTo()->int()
634  );
635 
636  $param_id = $this->http->wrapper()->query()->retrieve(
637  'param_id',
638  $this->refinery->kindlyTo()->int()
639  );
640  if (!$param_id) {
641  $this->tpl->setOnScreenMessage(
642  'failure',
643  $this->lng->txt('select_one'),
644  true
645  );
646  $this->ctrl->redirect($this, 'view');
647  }
648 
649  $this->getWebLinkRepo()->deleteParameterByLinkIdAndParamId($link_id, $param_id);
650 
651  $this->tpl->setOnScreenMessage(
652  'success',
653  $this->lng->txt(
654  'links_parameter_deleted'
655  ),
656  true
657  );
658  $this->ctrl->redirect($this, 'view');
659  }
static http()
Fetches the global http state from ILIAS.
checkPermission(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
+ Here is the call graph for this function:

◆ editLink()

ilObjLinkResourceGUI::editLink ( )

Definition at line 399 of file class.ilObjLinkResourceGUI.php.

References activateTabs(), ilObject2GUI\checkPermission(), ILIAS\Repository\ctrl(), ilPropertyFormGUI\getHTML(), ILIAS\FileDelivery\http(), initFormLink(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), and setValuesFromLink().

399  : void
400  {
401  $this->checkPermission('write');
402  $this->activateTabs('content', 'id_content_view');
403 
404  $link_id = 0;
405  if ($this->http->wrapper()->query()->has('link_id')) {
406  $link_id = $this->http->wrapper()->query()->retrieve(
407  'link_id',
408  $this->refinery->kindlyTo()->int()
409  );
410  }
411  if (!$link_id) {
412  $this->tpl->setOnScreenMessage(
413  'failure',
414  $this->lng->txt('select_one'),
415  true
416  );
417  $this->ctrl->redirect($this, 'view');
418  }
419  $form = $this->initFormLink(self::LINK_MOD_EDIT);
420  $this->setValuesFromLink($link_id);
421  $this->tpl->setContent($form->getHTML());
422  }
activateTabs(string $a_active_tab, string $a_active_subtab='')
Activate tab and subtabs.
static http()
Fetches the global http state from ILIAS.
checkPermission(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
+ Here is the call graph for this function:

◆ editLinks()

ilObjLinkResourceGUI::editLinks ( )
protected

Start with manage mode.

Definition at line 1154 of file class.ilObjLinkResourceGUI.php.

References switchViewMode().

1154  : void
1155  {
1156  $this->switchViewMode(self::VIEW_MODE_MANAGE);
1157  }
switchViewMode(?int $force_view_mode=null)
Switch between "View" "Manage" and "Sort".
+ Here is the call graph for this function:

◆ executeCommand()

ilObjLinkResourceGUI::executeCommand ( )

Definition at line 89 of file class.ilObjLinkResourceGUI.php.

References __prepareOutput(), ilObjectGUI\addHeaderAction(), ilObject2GUI\checkPermission(), ILIAS\Repository\ctrl(), ILIAS\Repository\form(), ilObject2GUI\getCreationMode(), ilObject2GUI\getIdType(), ilCommonActionDispatcherGUI\getInstanceFromAjaxCall(), ILIAS\FileDelivery\http(), infoScreenForward(), initFormLink(), initViewMode(), ILIAS\Repository\lng(), ilObject2GUI\prepareOutput(), ILIAS\Repository\refinery(), and ilObject2GUI\WORKSPACE_OBJECT_ID.

89  : void
90  {
91  $this->initViewMode();
92 
93  $base_class = $this->http->wrapper()->query()->retrieve(
94  'baseClass',
95  $this->refinery->kindlyTo()->string()
96  );
97  if ($base_class === ilLinkResourceHandlerGUI::class) {
98  $this->__prepareOutput();
99  }
100  $next_class = $this->ctrl->getNextClass($this);
101  $cmd = $this->ctrl->getCmd();
102  switch ($next_class) {
103  case "ilinfoscreengui":
104  $this->prepareOutput();
105  $this->infoScreenForward(); // forwards command
106  break;
107 
108  case 'ilobjectmetadatagui':
109  $this->checkPermission('write'); // #18563
110  $this->prepareOutput();
111  $this->tabs_gui->activateTab('id_meta_data');
112  $md_gui = new ilObjectMetaDataGUI($this->object);
113  $this->ctrl->forwardCommand($md_gui);
114  break;
115 
116  case 'ilpermissiongui':
117  $this->prepareOutput();
118  $this->tabs_gui->activateTab('id_permissions');
119  $perm_gui = new ilPermissionGUI($this);
120  $this->ctrl->forwardCommand($perm_gui);
121  break;
122 
123  case 'ilobjectcopygui':
124  $this->prepareOutput();
125  $cp = new ilObjectCopyGUI($this);
126  $cp->setType('webr');
127  $this->ctrl->forwardCommand($cp);
128  break;
129 
130  case 'ilexportgui':
131  $this->prepareOutput();
132  $this->tabs_gui->setTabActive('export');
133  $exp = new ilExportGUI($this);
134  $this->ctrl->forwardCommand($exp);
135  break;
136 
137  case "ilcommonactiondispatchergui":
138  $this->prepareOutput();
140  $this->ctrl->forwardCommand($gui);
141  break;
142 
143  case "ilpropertyformgui":
144  $mode = $this->ctrl->isAsynch() ?
145  self::LINK_MOD_ASYNC : self::LINK_MOD_EDIT;
146  $this->initFormLink($mode);
147  $this->ctrl->forwardCommand($this->form);
148  break;
149 
150  case "ilinternallinkgui":
151  $this->lng->loadLanguageModule("content");
152  $link_gui = new ilInternalLinkGUI("RepositoryItem", 0);
153  $link_gui->filterLinkType("PageObject");
154  $link_gui->filterLinkType("GlossaryItem");
155  $link_gui->filterLinkType("RepositoryItem");
156  $link_gui->setFilterWhiteList(true);
157  $this->ctrl->forwardCommand($link_gui);
158  break;
159 
160  default:
161  if ($this->getIdType() === ilObject2GUI::WORKSPACE_OBJECT_ID) {
162  parent::executeCommand();
163  break;
164  }
165  if (!$cmd) {
166  $cmd = 'view';
167  }
168  $this->prepareOutput();
169  $this->$cmd();
170  }
171 
172  if (!$this->getCreationMode()) {
173  $this->addHeaderAction();
174  }
175  }
Class ilObjectMetaDataGUI.
GUI class for the workflow of copying objects.
prepareOutput(bool $show_sub_objects=true)
Internal link selector.
infoScreenForward()
show information screen
static http()
Fetches the global http state from ILIAS.
checkPermission(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
form( $class_path, string $cmd, string $submit_caption="")
addHeaderAction()
Add header action menu.
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
initViewMode(?int $new_view_mode=null)
+ Here is the call graph for this function:

◆ exportHTML()

ilObjLinkResourceGUI::exportHTML ( )

Definition at line 1659 of file class.ilObjLinkResourceGUI.php.

References ilObject2GUI\$tpl, ilUtil\deliverData(), ILIAS\UICore\GlobalTemplate\get(), getWebLinkRepo(), ILIAS\Repository\object(), ILIAS\UICore\GlobalTemplate\parseCurrentBlock(), ILIAS\UICore\GlobalTemplate\setCurrentBlock(), settings(), and ILIAS\UICore\GlobalTemplate\setVariable().

1659  : void
1660  {
1661  $tpl = new ilTemplate(
1662  "tpl.export_html.html",
1663  true,
1664  true,
1665  "components/ILIAS/WebResource"
1666  );
1667 
1668  $items = $this->getWebLinkRepo()->getAllItemsAsContainer(true)
1669  ->getItems();
1670  foreach ($items as $item) {
1671  $tpl->setCurrentBlock("link_bl");
1672  $tpl->setVariable("LINK_URL", $item->getResolvedLink(false));
1673  $tpl->setVariable("LINK_TITLE", $item->getTitle());
1674  $tpl->setVariable("LINK_DESC", $item->getDescription() ?? '');
1675  $tpl->setVariable("LINK_CREATE", $item->getCreateDate()
1676  ->format('Y-m-d H-i-s'));
1677  $tpl->setVariable("LINK_UPDATE", $item->getLastUpdate()
1678  ->format('Y-m-d H-i-s'));
1680  }
1681 
1682  $tpl->setVariable("CREATE_DATE", $this->object->getCreateDate());
1683  $tpl->setVariable("LAST_UPDATE", $this->object->getLastUpdateDate());
1684  $tpl->setVariable("TXT_TITLE", $this->object->getTitle());
1685  $tpl->setVariable("TXT_DESC", $this->object->getLongDescription());
1686 
1687  $tpl->setVariable(
1688  "INST_ID",
1689  ($this->settings->get('short_inst_name') != "")
1690  ? $this->settings->get('short_inst_name')
1691  : "ILIAS"
1692  );
1693 
1694  ilUtil::deliverData($tpl->get(), "bookmarks.html");
1695  }
parseCurrentBlock(string $block_name=self::DEFAULT_BLOCK)
Parses the given block.
setCurrentBlock(string $part=self::DEFAULT_BLOCK)
Sets the template to the given block.
static deliverData(string $a_data, string $a_filename, string $mime="application/octet-stream")
setVariable(string $variable, $value='')
Sets the given variable to the given value.
ilGlobalTemplateInterface $tpl
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.
+ Here is the call graph for this function:

◆ getLinkToListModal()

ilObjLinkResourceGUI::getLinkToListModal ( )

Get form to transform a single weblink to a weblink list.

Definition at line 476 of file class.ilObjLinkResourceGUI.php.

References $DIC, Vendor\Package\$f, ilObjectGUI\$id, $info, $r, ILIAS\Repository\form(), ILIAS\FileDelivery\http(), initFormLink(), ILIAS\Repository\lng(), null, ILIAS\Repository\refinery(), and ILIAS\UI\Implementation\Component\withOnLoadCode().

Referenced by showToolbar().

477  {
478  global $DIC;
479 
480  $f = $DIC->ui()->factory();
481  $r = $DIC->ui()->renderer();
482 
483  // check if form was already set
484  if ($this->form == null) {
485  $this->initFormLink(self::LINK_MOD_SET_LIST);
486  }
487 
488  $form_id = 'form_' . $this->form->getId();
489 
490  $submit = $f->button()->primary($this->lng->txt('save'), '#')
491  ->withOnLoadCode(
492  function ($id) use ($form_id) {
493  return "$('#{$id}').click(function() { $('#{$form_id}').submit(); return false; });";
494  }
495  );
496  $info = $f->messageBox()->info($this->lng->txt('webr_new_list_info'));
497 
498  $modal = $f->modal()->roundtrip(
499  $this->lng->txt('webr_new_list'),
500  $f->legacy()->content($r->render($info) . $this->form->getHTML())
501  )
502  ->withActionButtons([$submit]);
503 
504  $submit = '';
505  if ($this->http->wrapper()->post()->has('sbmt')) {
506  $submit = $this->http->wrapper()->post()->retrieve(
507  'sbmt',
508  $this->refinery->kindlyTo()->string()
509  );
510  }
511  // modal triggers its show signal on load if form validation failed
512  if ($submit === 'submit') {
513  $modal = $modal->withOnLoad($modal->getShowSignal());
514  }
515  return $modal;
516  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static http()
Fetches the global http state from ILIAS.
global $DIC
Definition: shib_login.php:26
form( $class_path, string $cmd, string $submit_caption="")
$info
Definition: entry_point.php:21
$r
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getType()

ilObjLinkResourceGUI::getType ( )

Definition at line 71 of file class.ilObjLinkResourceGUI.php.

71  : string
72  {
73  return "webr";
74  }

◆ getWebLinkRepo()

◆ infoScreen()

ilObjLinkResourceGUI::infoScreen ( )

instead of redirecting here, links to the info screen should directly lead to the right place, but it looks like this needs some restructuring.

Definition at line 1439 of file class.ilObjLinkResourceGUI.php.

References ILIAS\Repository\ctrl().

1439  : void
1440  {
1441  $this->ctrl->redirectByClass(
1442  [self::class, ilInfoScreenGUI::class],
1443  'showSummary'
1444  );
1445  }
+ Here is the call graph for this function:

◆ infoScreenForward()

ilObjLinkResourceGUI::infoScreenForward ( )

show information screen

Definition at line 1450 of file class.ilObjLinkResourceGUI.php.

References $info, ilObject2GUI\checkPermission(), ilObject2GUI\checkPermissionBool(), ILIAS\Repository\ctrl(), and ILIAS\Repository\object().

Referenced by executeCommand().

1450  : void
1451  {
1452  if (!$this->checkPermissionBool('visible')) {
1453  $this->checkPermission('read');
1454  }
1455  $this->tabs_gui->activateTab('id_info');
1456 
1457  $info = new ilInfoScreenGUI($this);
1458 
1459  $info->enablePrivateNotes();
1460 
1461  // standard meta data
1462  $info->addMetaDataSections(
1463  $this->object->getId(),
1464  0,
1465  $this->object->getType()
1466  );
1467 
1468  // forward the command
1469  $this->ctrl->forwardCommand($info);
1470  }
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $node_id=null)
checkPermission(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
$info
Definition: entry_point.php:21
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initCreateForm()

ilObjLinkResourceGUI::initCreateForm ( string  $new_type)
protected

Definition at line 177 of file class.ilObjLinkResourceGUI.php.

References $form, and initFormLink().

Referenced by saveObject().

178  {
179  $this->initFormLink(self::LINK_MOD_CREATE);
180  return $this->form;
181  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initFormLink()

ilObjLinkResourceGUI::initFormLink ( int  $a_mode)
protected

Definition at line 896 of file class.ilObjLinkResourceGUI.php.

References $form, $param, $params, addLinkInputToForm(), ILIAS\Repository\ctrl(), ILIAS\Repository\form(), getWebLinkRepo(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), ilTextAreaInputGUI\setRows(), settings(), ilWebLinkBaseParameter\VALUES, and ilWebLinkBaseParameter\VALUES_TEXT.

Referenced by addLink(), editLink(), executeCommand(), getLinkToListModal(), initCreateForm(), save(), saveAddLink(), saveLinkList(), and updateLink().

897  {
898  $this->tabs_gui->activateTab("id_content");
899 
900  $this->form = new ilPropertyFormGUI();
901  switch ($a_mode) {
902  case self::LINK_MOD_CREATE:
903  // Header
904  $this->ctrl->setParameter($this, 'new_type', 'webr');
905  $this->form->setTitle($this->lng->txt('webr_new_link'));
906  $this->form->setTableWidth('600px');
907 
908  // Buttons
909  $this->form->addCommandButton(
910  'save',
911  $this->lng->txt('webr_add')
912  );
913  $this->form->addCommandButton(
914  'cancel',
915  $this->lng->txt('cancel')
916  );
917  break;
918 
919  case self::LINK_MOD_ADD:
920  // Header
921  $this->form->setTitle($this->lng->txt('webr_new_link'));
922 
923  // Buttons
924  $this->form->addCommandButton(
925  'saveAddLink',
926  $this->lng->txt('webr_add')
927  );
928  $this->form->addCommandButton(
929  'view',
930  $this->lng->txt('cancel')
931  );
932  break;
933 
934  case self::LINK_MOD_EDIT:
935  // Header
936  $this->ctrl->setParameter(
937  $this,
938  'link_id',
939  // TODO PHP8 Review: Remove/Replace SuperGlobals
940  (int) $_REQUEST['link_id']
941  );
942  $this->form->setTitle($this->lng->txt('webr_edit'));
943 
944  // Buttons
945  $this->form->addCommandButton(
946  'updateLink',
947  $this->lng->txt('save')
948  );
949  $this->form->addCommandButton(
950  'view',
951  $this->lng->txt('cancel')
952  );
953  break;
954 
955  /*
956  * The async call for displaying the object explorer for
957  * internal links goes through ilPropertyFormGUI to get
958  * to the right ilLinkInputGUI, so we only add that field
959  * to the form here.
960  */
961  case self::LINK_MOD_ASYNC:
962  $this->addLinkInputToForm($a_mode);
963  return $this->form;
964  }
965 
966  if ($a_mode == self::LINK_MOD_SET_LIST) {
967  $this->form->setValuesByPost();
968  $this->form->setFormAction(
969  $this->ctrl->getFormAction($this, 'saveLinkList')
970  );
971  $this->form->setId(uniqid('form'));
972 
973  // List Title
974  $title = new ilTextInputGUI(
975  $this->lng->txt('webr_list_title'),
976  'lti'
977  );
978  $title->setRequired(true);
979  $title->setSize(40);
980  $title->setMaxLength(127);
981  $this->form->addItem($title);
982 
983  // List Description
984  $desc = new ilTextAreaInputGUI(
985  $this->lng->txt('webr_list_desc'),
986  'tde'
987  );
988  $desc->setRows(3);
989  $desc->setCols(40);
990  $this->form->addItem($desc);
991 
992  $item = new ilHiddenInputGUI('sbmt');
993  $item->setValue('submit');
994  $this->form->addItem($item);
995  } else {
996  $this->form->setFormAction($this->ctrl->getFormAction($this));
997 
998  $this->addLinkInputToForm($a_mode);
999 
1000  // Title
1001  $tit = new ilTextInputGUI(
1002  $this->lng->txt('webr_link_title'),
1003  'title'
1004  );
1005  $tit->setRequired(true);
1006  $tit->setSize(40);
1007  $tit->setMaxLength(127);
1008  $this->form->addItem($tit);
1009 
1010  // Description
1011  $des = new ilTextAreaInputGUI(
1012  $this->lng->txt('description'),
1013  'desc'
1014  );
1015  $des->setRows(3);
1016  $des->setCols(40);
1017  $this->form->addItem($des);
1018 
1019  if ($a_mode != self::LINK_MOD_CREATE) {
1020  // Active
1021  $act = new ilCheckboxInputGUI($this->lng->txt('active'), 'act');
1022  $act->setChecked(true);
1023  $act->setValue('1');
1024  $this->form->addItem($act);
1025  }
1026 
1027  if ($this->settings->get('links_dynamic') &&
1028  $a_mode != self::LINK_MOD_CREATE
1029  ) {
1030  $dyn = new ilNonEditableValueGUI(
1031  $this->lng->txt('links_dyn_parameter')
1032  );
1033  $dyn->setInfo($this->lng->txt('links_dynamic_info'));
1034 
1035  if ($this->http->wrapper()->query()->has('link_id')) {
1036  $link_id = $this->http->wrapper()->query()->retrieve(
1037  'link_id',
1038  $this->refinery->kindlyTo()->int()
1039  );
1040  }
1041  if (
1042  isset($link_id) &&
1043  $link_id > 0 &&
1044  ($params = $this->getWebLinkRepo()->getItemByLinkId($link_id)->getParameters()) !== []
1045  ) {
1046  $ex = new ilCustomInputGUI(
1047  $this->lng->txt('links_existing_params'),
1048  'ex'
1049  );
1050  $dyn->addSubItem($ex);
1051 
1052  foreach ($params as $param) {
1053  $p = new ilCustomInputGUI();
1054 
1055  $ptpl = new ilTemplate(
1056  'tpl.link_dyn_param_edit.html',
1057  true,
1058  true,
1059  'components/ILIAS/WebResource'
1060  );
1061  $ptpl->setVariable(
1062  'INFO_TXT',
1063  $param->getInfo()
1064  );
1065  $this->ctrl->setParameter($this, 'param_id', $param->getParamId());
1066  $this->ctrl->setParameter($this, 'link_id', $link_id);
1067  $ptpl->setVariable(
1068  'LINK_DEL',
1069  $this->ctrl->getLinkTarget(
1070  $this,
1071  'deleteParameterForm'
1072  )
1073  );
1074  $ptpl->setVariable(
1075  'LINK_TXT',
1076  $this->lng->txt('delete')
1077  );
1078  $p->setHtml($ptpl->get());
1079  $dyn->addSubItem($p);
1080  }
1081  }
1082 
1083  // Dynyamic name
1084  $nam = new ilTextInputGUI($this->lng->txt('links_name'), 'nam');
1085  $nam->setSize(12);
1086  $nam->setMaxLength(128);
1087  $dyn->addSubItem($nam);
1088 
1089  // Dynamic value
1090  $val = new ilSelectInputGUI(
1091  $this->lng->txt('links_value'),
1092  'val'
1093  );
1094  $options = [];
1095  foreach (ilWebLinkBaseParameter::VALUES as $name => $identifier) {
1096  $options[$identifier] = $this->lng->txt(ilWebLinkBaseParameter::VALUES_TEXT[$identifier]);
1097  }
1098  $val->setOptions($options);
1099  $val->setValue(0);
1100  $dyn->addSubItem($val);
1101 
1102  $this->form->addItem($dyn);
1103  }
1104  }
1105  return $this->form;
1106  }
This class represents a selection list property in a property form.
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
Definition: ltiregstart.php:31
const array VALUES_TEXT
Keys of the language variables to the possible values, e.g.
This class represents a hidden form property in a property form.
static http()
Fetches the global http state from ILIAS.
const array VALUES
TODO Once the GUI is updated, undefined can be dropped.
$param
Definition: xapitoken.php:46
form( $class_path, string $cmd, string $submit_caption="")
This class represents a text area property in a property form.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initFormSettings()

ilObjLinkResourceGUI::initFormSettings ( )
protected

Definition at line 330 of file class.ilObjLinkResourceGUI.php.

References $form, ILIAS\UI\Implementation\Component\Input\$inputs, ilContainerSortingSettings\_lookupSortMode(), ILIAS\Repository\ctrl(), getWebLinkRepo(), ILIAS\Repository\lng(), ILIAS\Repository\object(), ILIAS\Repository\refinery(), ilContainer\SORT_MANUAL, ilContainer\SORT_TITLE, and ILIAS\UI\Implementation\Component\Input\withValue().

Referenced by settings().

330  : StandardForm
331  {
332  $inputs = [];
333  $obj_props = $this->object->getObjectProperties();
334  $field_factory = $this->ui_factory->input()->field();
335 
336  if ($this->getWebLinkRepo()->doesListExist()) {
337  $title_and_description = $obj_props->getPropertyTitleAndDescription()->toForm(
338  $this->lng,
339  $field_factory,
340  $this->refinery
341  );
342  $inputs['general'] = $field_factory->section(
343  ['title_and_description' => $title_and_description],
344  $this->lng->txt('webr_edit_settings')
345  );
346  }
347 
348  // activation
349  $this->lng->loadLanguageModule('rep');
350  $is_online = $obj_props->getPropertyIsOnline()->toForm(
351  $this->lng,
352  $field_factory,
353  $this->refinery
354  );
355  $inputs['activation'] = $field_factory->section(
356  ['is_online' => $is_online],
357  $this->lng->txt('rep_activation_availability')
358  );
359 
360  $presentation_inputs = [];
361 
362  // tile image
363  $tile_input = $obj_props->getPropertyTileImage()->toForm(
364  $this->lng,
365  $field_factory,
366  $this->refinery
367  );
368  $presentation_inputs['tile_image'] = $tile_input;
369 
370  // Sorting
371  if ($this->getWebLinkRepo()->doesListExist()) {
372  $current_mode = (string) ilContainerSortingSettings::_lookupSortMode($this->object->getId());
373  $order_input = $field_factory->radio($this->lng->txt('webr_sorting'))
374  ->withOption(
375  (string) ilContainer::SORT_TITLE,
376  $this->lng->txt('webr_sorting')
377  )
378  ->withOption(
379  (string) ilContainer::SORT_MANUAL,
380  $this->lng->txt('webr_sort_manual')
381  )
382  ->withValue($current_mode)
383  ->withRequired(true);
384  $presentation_inputs['sor'] = $order_input;
385  }
386 
387  $inputs['presentation'] = $field_factory->section(
388  $presentation_inputs,
389  $this->lng->txt('obj_presentation')
390  );
391 
392  $form = $this->ui_factory->input()->container()->form()->standard(
393  $this->ctrl->getFormAction($this, 'saveSettings'),
394  $inputs
395  );
396  return $form;
397  }
withValue($value)
Get an input like this with another value displayed on the client side.
Definition: Group.php:61
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initList()

ilObjLinkResourceGUI::initList ( int  $a_mode)
protected

Definition at line 819 of file class.ilObjLinkResourceGUI.php.

References ILIAS\Repository\form().

Referenced by save(), and saveLinkList().

819  : void
820  {
821  if ($a_mode == self::LINK_MOD_CREATE) {
822  $this->draft_list = new ilWebLinkDraftList(
823  $this->form->getInput('title'),
824  $this->form->getInput('desc')
825  );
826  }
827 
828  if ($a_mode == self::LINK_MOD_SET_LIST) {
829  $this->draft_list = new ilWebLinkDraftList(
830  $this->form->getInput('lti'),
831  $this->form->getInput('tde')
832  );
833  }
834  }
form( $class_path, string $cmd, string $submit_caption="")
Draft class for creating or updating a Web Link list.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initViewMode()

ilObjLinkResourceGUI::initViewMode ( ?int  $new_view_mode = null)
protected
Todo:
no view mode for workspace?

Definition at line 79 of file class.ilObjLinkResourceGUI.php.

References ilSession\get(), ilSession\has(), ILIAS\Repository\int(), null, and ilSession\set().

Referenced by executeCommand(), and switchViewMode().

79  : void
80  {
81  if ($new_view_mode !== null) {
82  ilSession::set('webr_view_mode', $new_view_mode);
83  }
84  if (ilSession::has('webr_view_mode')) {
85  $this->view_mode = (int) ilSession::get('webr_view_mode');
86  }
87  }
static get(string $a_var)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static has($a_var)
static set(string $a_var, $a_val)
Set a value.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ manage()

ilObjLinkResourceGUI::manage ( )
protected

Definition at line 1199 of file class.ilObjLinkResourceGUI.php.

References activateTabs(), ilObject2GUI\checkPermission(), ilInternalLinkGUI\getInitHTML(), and showToolbar().

Referenced by view().

1199  : void
1200  {
1201  $this->checkPermission('write');
1202  $this->activateTabs('content', 'id_content_manage');
1203 
1204  $this->tpl->addBlockFile(
1205  'ADM_CONTENT',
1206  'adm_content',
1207  'tpl.webr_manage.html',
1208  'components/ILIAS/WebResource'
1209  );
1210  $this->showToolbar('ACTION_BUTTONS');
1211 
1212  $table = new ilWebResourceEditableLinkTableGUI($this, 'view');
1213  $table->parse();
1214 
1216 
1217  $this->tpl->addJavaScript("assets/js/intLink.js");
1218  $this->tpl->addJavascript("assets/js/Form.js");
1219 
1220  $this->tpl->setVariable('TABLE_LINKS', $table->getHTML() . $js);
1221  }
static getInitHTML(string $a_url)
Get initialisation HTML to use internal link editing.
activateTabs(string $a_active_tab, string $a_active_subtab='')
Activate tab and subtabs.
checkPermission(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ redirectToLink()

ilObjLinkResourceGUI::redirectToLink ( int  $a_ref_id,
int  $a_obj_id,
string  $a_url 
)
protected

Definition at line 1643 of file class.ilObjLinkResourceGUI.php.

References ilChangeEvent\_recordReadEvent(), ilUtil\redirect(), and ILIAS\Repository\user().

Referenced by callDirectLink(), and callLink().

1647  : void {
1648  if ($a_url) {
1650  "webr",
1651  $a_ref_id,
1652  $a_obj_id,
1653  $this->user->getId()
1654  );
1655  ilUtil::redirect($a_url);
1656  }
1657  }
static _recordReadEvent(string $a_type, int $a_ref_id, int $obj_id, int $usr_id, bool $isCatchupWriteEvents=true, $a_ext_rc=null, $a_ext_time=null)
static redirect(string $a_script)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ save()

ilObjLinkResourceGUI::save ( )

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

References $valid, checkLinkInput(), ILIAS\Repository\form(), initFormLink(), initList(), ILIAS\Repository\lng(), and saveObject().

183  : void
184  {
185  $this->initFormLink(self::LINK_MOD_CREATE);
186  $valid = $this->form->checkInput();
187  if (
188  $this->checkLinkInput(self::LINK_MOD_CREATE, $valid, 0) &&
189  $this->form->getInput('tar_mode_type') === 'single'
190  ) {
191  $this->saveObject();
192  } elseif ($valid && $this->form->getInput('tar_mode_type') == 'list') {
193  $this->initList(self::LINK_MOD_CREATE);
194  $this->saveObject();
195  } else {
196  // Data incomplete or invalid
197  $this->tpl->setOnScreenMessage(
198  'failure',
199  $this->lng->txt('err_check_input')
200  );
201  $this->form->setValuesByPost();
202  $this->tpl->setContent($this->form->getHTML());
203  }
204  }
$valid
checkLinkInput(int $a_mode, bool $a_valid, ?int $a_link_id=null)
form( $class_path, string $cmd, string $submit_caption="")
+ Here is the call graph for this function:

◆ saveAddLink()

ilObjLinkResourceGUI::saveAddLink ( )

Definition at line 555 of file class.ilObjLinkResourceGUI.php.

References $valid, activateTabs(), ilPropertyFormGUI\checkInput(), checkLinkInput(), ilObject2GUI\checkPermission(), ILIAS\Repository\ctrl(), ILIAS\Repository\form(), ilPropertyFormGUI\getHTML(), getWebLinkRepo(), initFormLink(), ILIAS\Repository\lng(), null, and settings().

555  : void
556  {
557  $this->checkPermission('write');
558 
559  $form = $this->initFormLink(self::LINK_MOD_ADD);
560  $valid = $form->checkInput();
561  if ($this->checkLinkInput(
562  self::LINK_MOD_ADD,
563  $valid,
564  0
565  )
566  ) {
567  if (
568  $this->settings->get('links_dynamic') &&
569  $this->draft_parameter !== null
570  ) {
571  $this->draft_item->addParameter($this->draft_parameter);
572  }
573  $this->getWebLinkRepo()->createItem($this->draft_item);
574 
575  $this->tpl->setOnScreenMessage(
576  'success',
577  $this->lng->txt('webr_link_added'),
578  true
579  );
580  $this->ctrl->redirect($this, 'view');
581  }
582  $this->tpl->setOnScreenMessage(
583  'failure',
584  $this->lng->txt('err_check_input')
585  );
586  $this->form->setValuesByPost();
587  $this->activateTabs('content', 'id_content_view');
588  $this->tpl->setContent($form->getHTML());
589  }
$valid
activateTabs(string $a_active_tab, string $a_active_subtab='')
Activate tab and subtabs.
checkLinkInput(int $a_mode, bool $a_valid, ?int $a_link_id=null)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
checkPermission(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
form( $class_path, string $cmd, string $submit_caption="")
+ Here is the call graph for this function:

◆ saveLinkList()

ilObjLinkResourceGUI::saveLinkList ( )

Definition at line 518 of file class.ilObjLinkResourceGUI.php.

References $valid, ilPropertyFormGUI\checkInput(), ilObject2GUI\checkPermission(), ILIAS\Repository\ctrl(), ilPropertyFormGUI\getInput(), getWebLinkRepo(), initFormLink(), initList(), ILIAS\Repository\lng(), ilPropertyFormGUI\setValuesByPost(), and view().

518  : void
519  {
520  $this->checkPermission('write');
521  $form = $this->initFormLink(self::LINK_MOD_SET_LIST);
522  $valid = $form->checkInput();
523  if ($valid) {
524  $this->object->setTitle($form->getInput('lti'));
525  $this->object->setDescription($form->getInput('tde'));
526  $this->object->update();
527 
528  $this->initList(self::LINK_MOD_SET_LIST);
529  $this->getWebLinkRepo()->createList($this->draft_list);
530  $this->tpl->setOnScreenMessage(
531  'success',
532  $this->lng->txt('webr_list_set'),
533  true
534  );
535  $this->ctrl->redirect($this, 'view');
536  }
537  $this->tpl->setOnScreenMessage(
538  'failure',
539  $this->lng->txt('err_check_input'),
540  true
541  );
543  $this->view();
544  }
$valid
getInput(string $a_post_var, bool $ensureValidation=true)
Returns the input of an item, if item provides getInput method and as fallback the value of the HTTP-...
checkPermission(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
+ Here is the call graph for this function:

◆ saveObject()

ilObjLinkResourceGUI::saveObject ( )

Definition at line 206 of file class.ilObjLinkResourceGUI.php.

References afterSave(), ilObject2GUI\checkPermissionBool(), ILIAS\Repository\ctrl(), ILIAS\Repository\form(), ilObjectGUI\getDidacticTemplateVar(), initCreateForm(), ILIAS\Repository\lng(), and ilObject2GUI\putObjectInTree().

Referenced by save().

206  : void
207  {
208  // create permission is already checked in createObject. This check here is done to prevent hacking attempts
209  if (!$this->checkPermissionBool("create", "", $this->requested_new_type)) {
210  $this->error->raiseError($this->lng->txt("no_create_permission"), $this->error->MESSAGE);
211  }
212 
213  $this->lng->loadLanguageModule($this->requested_new_type);
214  $this->ctrl->setParameter($this, "new_type", $this->requested_new_type);
215 
216  $this->form = $this->initCreateForm($this->requested_new_type);
217  if ($this->form->checkInput()) {
218  $this->ctrl->setParameter($this, "new_type", "");
219 
220  $class_name = "ilObj" . $this->obj_definition->getClassName($this->requested_new_type);
221  $newObj = new $class_name();
222  $newObj->setType($this->requested_new_type);
223  $newObj->setTitle($this->form->getInput("title"));
224  $newObj->setDescription($this->form->getInput("desc"));
225  $newObj->processAutoRating();
226  $newObj->create();
227 
228  $this->putObjectInTree($newObj);
229 
230  if ($this->form->getInput('didactic_template')) {
231  $dtpl = $this->getDidacticTemplateVar("dtpl");
232  // Object calls initCreateForm again in getDidacticTemplateVar
233  $this->form->checkInput();
234  $newObj->applyDidacticTemplate($dtpl);
235  }
236 
237  $this->afterSave($newObj);
238  }
239 
240  $this->form->setValuesByPost();
241  $this->tpl->setContent($this->form->getHTML());
242  }
getDidacticTemplateVar(string $type)
Get didactic template setting from creation screen.
afterSave(ilObject $new_object)
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $node_id=null)
putObjectInTree(ilObject $obj, ?int $parent_node_id=null)
Add object to tree at given position.
form( $class_path, string $cmd, string $submit_caption="")
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveSorting()

ilObjLinkResourceGUI::saveSorting ( )
protected

Definition at line 1259 of file class.ilObjLinkResourceGUI.php.

References ilContainerSorting\_getInstance(), ilObject2GUI\checkPermission(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), ILIAS\Repository\object(), ILIAS\Repository\refinery(), and view().

1259  : void
1260  {
1261  $this->checkPermission('write');
1262  $sort = ilContainerSorting::_getInstance($this->object->getId());
1263 
1264  $position = [];
1265  if ($this->http->wrapper()->post()->has('position')) {
1266  $position = $this->http->wrapper()->post()->retrieve(
1267  'position',
1268  $this->refinery->kindlyTo()->dictOf(
1269  $this->refinery->kindlyTo()->string()
1270  )
1271  );
1272  }
1273  $sort->savePost($position);
1274  $this->tpl->setOnScreenMessage(
1275  'success',
1276  $this->lng->txt('settings_saved'),
1277  true
1278  );
1279  $this->view();
1280  }
static http()
Fetches the global http state from ILIAS.
checkPermission(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
static _getInstance(int $a_obj_id)
+ Here is the call graph for this function:

◆ setTabs()

ilObjLinkResourceGUI::setTabs ( )
protected

Definition at line 1528 of file class.ilObjLinkResourceGUI.php.

References $DIC, ilObject2GUI\checkPermissionBool(), ILIAS\Repository\ctrl(), ilObject2GUI\getCreationMode(), and ILIAS\Repository\lng().

1528  : void
1529  {
1530  global $DIC;
1531 
1532  $ilHelp = $DIC['ilHelp'];
1533  $ilHelp->setScreenIdComponent("webr");
1534 
1535  if ($this->checkPermissionBool('read')) {
1536  $this->tabs_gui->addTab(
1537  "id_content",
1538  $this->lng->txt("content"),
1539  $this->ctrl->getLinkTarget($this, "view")
1540  );
1541  }
1542 
1543  if (
1544  $this->checkPermissionBool('visible') ||
1545  $this->checkPermissionBool('read')
1546  ) {
1547  $this->tabs_gui->addTab(
1548  "id_info",
1549  $this->lng->txt("info_short"),
1550  $this->ctrl->getLinkTarget($this, "infoScreen")
1551  );
1552  }
1553 
1554  if ($this->checkPermissionBool('write') and !$this->getCreationMode()) {
1555  $this->tabs_gui->addTab(
1556  "id_settings",
1557  $this->lng->txt("settings"),
1558  $this->ctrl->getLinkTarget($this, "settings")
1559  );
1560  }
1561 
1562  if ($this->checkPermissionBool('write')) {
1563  $mdgui = new ilObjectMetaDataGUI($this->object);
1564  $mdtab = $mdgui->getTab();
1565  if ($mdtab) {
1566  $this->tabs_gui->addTab(
1567  "id_meta_data",
1568  $this->lng->txt("meta_data"),
1569  $mdtab
1570  );
1571  }
1572  }
1573 
1574  if ($this->checkPermissionBool('write')) {
1575  $this->tabs_gui->addTab(
1576  'export',
1577  $this->lng->txt('export'),
1578  $this->ctrl->getLinkTargetByClass('ilexportgui', '')
1579  );
1580  }
1581 
1582  // will add permission tab if needed
1583  parent::setTabs();
1584  }
Class ilObjectMetaDataGUI.
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $node_id=null)
global $DIC
Definition: shib_login.php:26
+ Here is the call graph for this function:

◆ settings()

ilObjLinkResourceGUI::settings ( )
protected

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

References ilObjectGUI\$data, ilObject2GUI\checkPermission(), ILIAS\Repository\ctrl(), getWebLinkRepo(), ILIAS\FileDelivery\http(), initFormSettings(), ILIAS\Repository\lng(), null, ILIAS\Repository\object(), and ilContainerSortingSettings\setSortMode().

Referenced by callLink(), checkLinkInput(), exportHTML(), initFormLink(), saveAddLink(), and updateLink().

278  : void
279  {
280  $this->checkPermission('write');
281  $this->tabs_gui->activateTab('id_settings');
282 
283  $form = $this->initFormSettings();
284  $this->tpl->setContent($this->ui_renderer->render($form));
285  }
checkPermission(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setValuesFromLink()

ilObjLinkResourceGUI::setValuesFromLink ( int  $a_link_id)
protected

Definition at line 806 of file class.ilObjLinkResourceGUI.php.

References ILIAS\Repository\form(), getWebLinkRepo(), and ILIAS\Repository\int().

Referenced by editLink().

806  : void
807  {
808  $item = $this->getWebLinkRepo()->getItemByLinkId($a_link_id);
809  $this->form->setValuesByArray(
810  array(
811  'title' => $item->getTitle(),
812  'tar' => $item->getTarget(),
813  'desc' => $item->getDescription(),
814  'act' => (int) $item->isActive()
815  )
816  );
817  }
form( $class_path, string $cmd, string $submit_caption="")
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showLinks()

ilObjLinkResourceGUI::showLinks ( )
protected

Definition at line 1223 of file class.ilObjLinkResourceGUI.php.

References activateTabs(), ilObject2GUI\checkPermission(), and showToolbar().

Referenced by view().

1223  : void
1224  {
1225  $this->checkPermission('read');
1226  $this->activateTabs('content', 'id_content_view');
1227 
1228  $table = new ilWebResourceLinkTableGUI($this, 'showLinks');
1229  $table->parse();
1230 
1231  $this->tpl->addBlockFile(
1232  'ADM_CONTENT',
1233  'adm_content',
1234  'tpl.webr_view.html',
1235  'components/ILIAS/WebResource'
1236  );
1237  $this->showToolbar('ACTION_BUTTONS');
1238  $this->tpl->setVariable('LINK_TABLE', $table->getHTML());
1239  }
TableGUI class for search results.
activateTabs(string $a_active_tab, string $a_active_subtab='')
Activate tab and subtabs.
checkPermission(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showToolbar()

ilObjLinkResourceGUI::showToolbar ( string  $a_tpl_var)
protected

Definition at line 1282 of file class.ilObjLinkResourceGUI.php.

References $DIC, Vendor\Package\$f, $r, ilObject2GUI\checkPermissionBool(), ILIAS\Repository\ctrl(), getLinkToListModal(), getWebLinkRepo(), and ILIAS\Repository\lng().

Referenced by manage(), showLinks(), and sort().

1282  : void
1283  {
1284  global $DIC;
1285 
1286  $tool = new ilToolbarGUI();
1287  $tool->setFormAction($this->ctrl->getFormAction($this));
1288 
1289  $f = $DIC->ui()->factory();
1290  $r = $DIC->ui()->renderer();
1291 
1292  if (
1293  $this->getWebLinkRepo()->doesListExist() &&
1294  $this->checkPermissionBool('write')
1295  ) {
1296  $tool->addButton(
1297  $this->lng->txt('webr_add'),
1298  $this->ctrl->getLinkTarget($this, 'addLink')
1299  );
1300  } elseif ($this->checkPermissionBool('write')) {
1301  $modal = $this->getLinkToListModal();
1302  $button = $f->button()->standard(
1303  $this->lng->txt('webr_set_to_list'),
1304  '#'
1305  )
1306  ->withOnClick($modal->getShowSignal());
1307 
1308  $this->tpl->setVariable("MODAL", $r->render([$modal]));
1309 
1310  $tool->addComponent($button);
1311  }
1312 
1313  $download_button = $f->button()->standard(
1314  $this->lng->txt('export_html'),
1315  $this->ctrl->getLinkTarget($this, 'exportHTML')
1316  );
1317  $tool->addComponent($download_button);
1318  $this->tpl->setVariable($a_tpl_var, $tool->getHTML());
1319  }
getLinkToListModal()
Get form to transform a single weblink to a weblink list.
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $node_id=null)
global $DIC
Definition: shib_login.php:26
$r
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sort()

ilObjLinkResourceGUI::sort ( )
protected

Definition at line 1241 of file class.ilObjLinkResourceGUI.php.

References activateTabs(), ilObject2GUI\checkPermission(), and showToolbar().

Referenced by view().

1241  : void
1242  {
1243  $this->checkPermission('write');
1244  $this->activateTabs('content', 'id_content_ordering');
1245 
1246  $table = new ilWebResourceLinkTableGUI($this, 'sort', true);
1247  $table->parse();
1248 
1249  $this->tpl->addBlockFile(
1250  'ADM_CONTENT',
1251  'adm_content',
1252  'tpl.webr_view.html',
1253  'components/ILIAS/WebResource'
1254  );
1255  $this->showToolbar('ACTION_BUTTONS');
1256  $this->tpl->setVariable('LINK_TABLE', $table->getHTML());
1257  }
TableGUI class for search results.
activateTabs(string $a_active_tab, string $a_active_subtab='')
Activate tab and subtabs.
checkPermission(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ switchViewMode()

ilObjLinkResourceGUI::switchViewMode ( ?int  $force_view_mode = null)
protected

Switch between "View" "Manage" and "Sort".

Definition at line 1136 of file class.ilObjLinkResourceGUI.php.

References $view_mode, ILIAS\FileDelivery\http(), initViewMode(), null, ILIAS\Repository\refinery(), and view().

Referenced by editLinks().

1136  : void
1137  {
1138  $new_view_mode = $this->view_mode;
1139  if ($force_view_mode !== null) {
1140  $new_view_mode = $force_view_mode;
1141  } elseif ($this->http->wrapper()->query()->has('switch_mode')) {
1142  $new_view_mode = $this->http->wrapper()->query()->retrieve(
1143  'switch_mode',
1144  $this->refinery->kindlyTo()->int()
1145  );
1146  }
1147  $this->initViewMode($new_view_mode);
1148  $this->view();
1149  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static http()
Fetches the global http state from ILIAS.
initViewMode(?int $new_view_mode=null)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateLink()

ilObjLinkResourceGUI::updateLink ( )

Definition at line 424 of file class.ilObjLinkResourceGUI.php.

References $valid, ilPropertyFormGUI\checkInput(), checkLinkInput(), ILIAS\Repository\ctrl(), ilPropertyFormGUI\getHTML(), ilPropertyFormGUI\getInput(), getWebLinkRepo(), ILIAS\FileDelivery\http(), initFormLink(), ILIAS\Repository\lng(), null, ILIAS\Repository\refinery(), settings(), and ilPropertyFormGUI\setValuesByPost().

424  : void
425  {
426  $form = $this->initFormLink(self::LINK_MOD_EDIT);
427  $valid = $form->checkInput();
428  $link_id = 0;
429  if ($this->http->wrapper()->query()->has('link_id')) {
430  $link_id = $this->http->wrapper()->query()->retrieve(
431  'link_id',
432  $this->refinery->kindlyTo()->int()
433  );
434  }
435  if ($this->checkLinkInput(
436  self::LINK_MOD_EDIT,
437  $valid,
438  $link_id
439  )) {
440  $item = $this->getWebLinkRepo()->getItemByLinkId($link_id);
441  foreach ($item->getParameters() as $parameter) {
442  $this->draft_item->addParameter($parameter);
443  }
444 
445  if (
446  $this->settings->get('links_dynamic') &&
447  $this->draft_parameter !== null
448  ) {
449  $this->draft_item->addParameter($this->draft_parameter);
450  }
451  $this->getWebLinkRepo()->updateItem($item, $this->draft_item);
452 
453  if (!$this->getWebLinkRepo()->doesListExist()) {
454  $this->object->setTitle($form->getInput('title'));
455  $this->object->setDescription($form->getInput('desc'));
456  $this->object->update();
457  }
458  $this->tpl->setOnScreenMessage(
459  'success',
460  $this->lng->txt('settings_saved'),
461  true
462  );
463  $this->ctrl->redirect($this, 'view');
464  }
465  $this->tpl->setOnScreenMessage(
466  'failure',
467  $this->lng->txt('err_check_input')
468  );
470  $this->tpl->setContent($form->getHTML());
471  }
$valid
checkLinkInput(int $a_mode, bool $a_valid, ?int $a_link_id=null)
getInput(string $a_post_var, bool $ensureValidation=true)
Returns the input of an item, if item provides getInput method and as fallback the value of the HTTP-...
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:

◆ updateLinks()

ilObjLinkResourceGUI::updateLinks ( )
protected

Definition at line 661 of file class.ilObjLinkResourceGUI.php.

References ilObjectGUI\$data, $param, activateTabs(), ilObject2GUI\checkPermission(), ILIAS\Repository\ctrl(), getWebLinkRepo(), ILIAS\FileDelivery\http(), ilLinkInputGUI\isInternalLink(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), and ilUtil\stripSlashes().

661  : void
662  {
663  $this->checkPermission('write');
664  $this->activateTabs('content', '');
665 
666  $ids = [];
667  if ($this->http->wrapper()->post()->has('ids')) {
668  $ids = $this->http->wrapper()->post()->retrieve(
669  'ids',
670  $this->refinery->kindlyTo()->dictOf(
671  $this->refinery->kindlyTo()->int()
672  )
673  );
674  }
675 
676  if ($ids === []) {
677  $this->tpl->setOnScreenMessage(
678  'failure',
679  $this->lng->txt('select_one'),
680  true
681  );
682  $this->ctrl->redirect($this, 'view');
683  }
684 
685  $link_post = (array) ($this->http->request()->getParsedBody(
686  )['links'] ?? []);
687 
688  // Validate
689  $invalid = [];
690  foreach ($ids as $link_id) {
691  $data = $link_post[$link_id];
692 
693  if (
694  $this->http->wrapper()->post()->has(
695  'tar_' . $link_id . '_ajax_type'
696  ) &&
697  $this->http->wrapper()->post()->has(
698  'tar_' . $link_id . '_ajax_id'
699  )
700  ) {
701  $data['tar'] =
702  $this->http->wrapper()->post()->retrieve(
703  'tar_' . $link_id . '_ajax_type',
704  $this->refinery->kindlyTo()->string()
705  ) . '|' .
706  $this->http->wrapper()->post()->retrieve(
707  'tar_' . $link_id . '_ajax_id',
708  $this->refinery->kindlyTo()->string()
709  );
710  }
711  if (!strlen($data['title'] ?? '')) {
712  $invalid[] = $link_id;
713  continue;
714  }
715  if (!strlen($data['tar'] ?? '')) {
716  $invalid[] = $link_id;
717  continue;
718  }
719  if (($data['nam'] ?? false) && !($data['val'] ?? false)) {
720  $invalid[] = $link_id;
721  continue;
722  }
723  if (!($data['nam'] ?? false) && ($data['val'] ?? false)) {
724  $invalid[] = $link_id;
725  }
726  }
727 
728  if ($invalid !== []) {
729  $this->tpl->setOnScreenMessage(
730  'failure',
731  $this->lng->txt('err_check_input')
732  );
733  $this->tpl->addBlockFile(
734  'ADM_CONTENT',
735  'adm_content',
736  'tpl.webr_manage.html',
737  'components/ILIAS/WebResource'
738  );
739  $table = new ilWebResourceEditableLinkTableGUI($this, 'view');
740  $table->setInvalidLinks($invalid);
741  $table->parseSelectedLinks($ids);
742  $table->updateFromPost();
743  $this->tpl->setVariable('TABLE_LINKS', $table->getHTML());
744  return;
745  }
746 
747  // Save Settings
748  foreach ($ids as $link_id) {
749  $data = $link_post[$link_id];
750 
751  if (
752  $this->http->wrapper()->post()->has(
753  'tar_' . $link_id . '_ajax_type'
754  ) &&
755  $this->http->wrapper()->post()->has(
756  'tar_' . $link_id . '_ajax_id'
757  )
758  ) {
759  $data['tar'] =
760  $this->http->wrapper()->post()->retrieve(
761  'tar_' . $link_id . '_ajax_type',
762  $this->refinery->kindlyTo()->string()
763  ) . '|' .
764  $this->http->wrapper()->post()->retrieve(
765  'tar_' . $link_id . '_ajax_id',
766  $this->refinery->kindlyTo()->string()
767  );
768  }
769 
770  $item = $this->getWebLinkRepo()->getItemByLinkId($link_id);
771  $draft = new ilWebLinkDraftItem(
773  ilUtil::stripSlashes($data['title'] ?? ''),
774  ilUtil::stripSlashes($data['desc'] ?? ''),
775  str_replace('"', '', ilUtil::stripSlashes($data['tar'] ?? '')),
776  (bool) ($data['act'] ?? false),
777  $item->getParameters()
778  );
779 
780  if (strlen($data['nam'] ?? '') && $data['val'] ?? '') {
782  (int) ($data['val'] ?? 0),
783  ilUtil::stripSlashes($data['nam'] ?? '')
784  );
785  $draft->addParameter($param);
786  }
787 
788  $this->getWebLinkRepo()->updateItem($item, $draft);
789 
790  if (!$this->getWebLinkRepo()->doesListExist()) {
791  $this->object->setTitle(ilUtil::stripSlashes($data['title'] ?? ''));
792  $this->object->setDescription(
793  ilUtil::stripSlashes($data['desc'] ?? '')
794  );
795  $this->object->update();
796  }
797  }
798  $this->tpl->setOnScreenMessage(
799  'success',
800  $this->lng->txt('settings_saved'),
801  true
802  );
803  $this->ctrl->redirect($this, 'view');
804  }
Draft class for creating and updating a parameter attached to Web Link items.
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
activateTabs(string $a_active_tab, string $a_active_subtab='')
Activate tab and subtabs.
static http()
Fetches the global http state from ILIAS.
$param
Definition: xapitoken.php:46
checkPermission(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
static isInternalLink(string $a_value)
Draft class for creating and updating a Web Link item.
+ Here is the call graph for this function:

◆ view()

ilObjLinkResourceGUI::view ( )

Definition at line 1159 of file class.ilObjLinkResourceGUI.php.

References ilContainerSortingSettings\_lookupSortMode(), ilObject2GUI\checkPermission(), ILIAS\FileDelivery\http(), manage(), ILIAS\Repository\object(), ILIAS\Repository\refinery(), showLinks(), sort(), and ilContainer\SORT_MANUAL.

Referenced by confirmDeleteLink(), saveLinkList(), saveSorting(), and switchViewMode().

1159  : void
1160  {
1161  $this->tabs_gui->activateTab("id_content");
1162  $this->checkPermission('read');
1163 
1164  $base_class = $this->http->wrapper()->query()->retrieve(
1165  'baseClass',
1166  $this->refinery->kindlyTo()->string()
1167  );
1168  if (strcasecmp($base_class, ilAdministrationGUI::class) === 0) {
1169  parent::view();
1170  return;
1171  } else {
1172  switch ($this->view_mode) {
1173  case self::VIEW_MODE_MANAGE:
1174  $this->manage();
1175  break;
1176 
1177  case self::VIEW_MODE_SORT:
1178  // #14638
1180  $this->object->getId()
1181  ) == ilContainer::SORT_MANUAL) {
1182  $this->sort();
1183  break;
1184  }
1185  $this->showLinks();
1186  break;
1187 
1188  default:
1189  $this->showLinks();
1190  break;
1191  }
1192  }
1193  $this->tpl->setPermanentLink(
1194  $this->object->getType(),
1195  $this->object->getRefId()
1196  );
1197  }
static http()
Fetches the global http state from ILIAS.
checkPermission(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $draft_item

ilWebLinkDraftItem ilObjLinkResourceGUI::$draft_item = null
private

Definition at line 47 of file class.ilObjLinkResourceGUI.php.

◆ $draft_list

ilWebLinkDraftList ilObjLinkResourceGUI::$draft_list = null
private

Definition at line 49 of file class.ilObjLinkResourceGUI.php.

◆ $draft_parameter

ilWebLinkDraftParameter ilObjLinkResourceGUI::$draft_parameter = null
private

Definition at line 48 of file class.ilObjLinkResourceGUI.php.

◆ $form

ilPropertyFormGUI ilObjLinkResourceGUI::$form = null
private

Definition at line 46 of file class.ilObjLinkResourceGUI.php.

Referenced by initCreateForm(), initFormLink(), and initFormSettings().

◆ $view_mode

int ilObjLinkResourceGUI::$view_mode = self::VIEW_MODE_VIEW
private

Definition at line 44 of file class.ilObjLinkResourceGUI.php.

Referenced by switchViewMode().

◆ LINK_MOD_ADD

const int ilObjLinkResourceGUI::LINK_MOD_ADD = 3
protected

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

◆ LINK_MOD_ASYNC

const int ilObjLinkResourceGUI::LINK_MOD_ASYNC = 6
protected

Definition at line 42 of file class.ilObjLinkResourceGUI.php.

◆ LINK_MOD_CREATE

const int ilObjLinkResourceGUI::LINK_MOD_CREATE = 1
protected

Definition at line 38 of file class.ilObjLinkResourceGUI.php.

◆ LINK_MOD_EDIT

const int ilObjLinkResourceGUI::LINK_MOD_EDIT = 2
protected

Definition at line 39 of file class.ilObjLinkResourceGUI.php.

◆ LINK_MOD_SET_LIST

const int ilObjLinkResourceGUI::LINK_MOD_SET_LIST = 4
protected

Definition at line 41 of file class.ilObjLinkResourceGUI.php.

◆ VIEW_MODE_MANAGE

const int ilObjLinkResourceGUI::VIEW_MODE_MANAGE = 2
protected

Definition at line 35 of file class.ilObjLinkResourceGUI.php.

◆ VIEW_MODE_SORT

const int ilObjLinkResourceGUI::VIEW_MODE_SORT = 3
protected

Definition at line 36 of file class.ilObjLinkResourceGUI.php.

◆ VIEW_MODE_VIEW

const int ilObjLinkResourceGUI::VIEW_MODE_VIEW = 1
protected

Definition at line 34 of file class.ilObjLinkResourceGUI.php.


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