ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
All Data Structures Namespaces Files Functions Variables Modules Pages
ilObjLinkResourceGUI Class Reference

Class ilObjLinkResourceGUI. More...

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

Public Member Functions

 getType ()
 
 executeCommand ()
 
 save ()
 Save new object public. More...
 
 editLink ()
 Edit a single link. More...
 
 updateLink ()
 Save after editing. More...
 
 addLink ()
 Add an additional link. More...
 
 saveAddLink ()
 Save form data. More...
 
 view ()
 View object. More...
 
 infoScreen ()
 this one is called from the info button in the repository not very nice to set cmdClass/Cmd manually, if everything works through ilCtrl in the future this may be changed More...
 
 infoScreenForward ()
 show information screen More...
 
 history ()
 
 formatInvalidLinkArray (Array $row)
 
 saveLinkCheck ()
 
 refreshLinkCheck ()
 
 __initLinkChecker ()
 
 setTabs ()
 get tabs public More...
 
 __prepareOutput ()
 
 addLocatorItems ()
 
 callDirectLink ()
 
 callLink ()
 
- Public Member Functions inherited from ilObject2GUI
 __construct ($a_id=0, $a_id_type=self::REPOSITORY_NODE_ID, $a_parent_node_id=0)
 Constructor. More...
 
executeCommand ()
 execute command More...
 
 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 ($a_mode=true)
 
 getCreationMode ()
 
 isVisible ()
 
 trash ()
 
 undelete ()
 
 cancelDelete ()
 
 removeFromSystem ()
 
 cloneAll ()
 
 view ()
 view object content (repository/workspace switch) More...
 
 getType ()
 Functions that must be overwritten. More...
 
 create ()
 Deleted in ilObject. More...
 
 save ()
 
 edit ()
 
 update ()
 
 cancel ()
 
 importFile ()
 Import. More...
 
- Public Member Functions inherited from ilObjectGUI
 ilObjectGUI ($a_data, $a_id=0, $a_call_by_reference=true, $a_prepare_output=true)
 Constructor public. More...
 
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...
 
 getAdminTabs (&$tabs_gui)
 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 ($in_rep=false)
 cancel action and go back to previous page public More...
 
 createObject ()
 create new object form More...
 
 cancelCreation ()
 cancel create action and go back to repository parent More...
 
 saveObject ()
 save object More...
 
 editObject ()
 edit object More...
 
 updateObject ()
 updates object entry in object_data More...
 
 getFormAction ($a_cmd, $a_formaction="")
 get form action for command (command is method name without "Object", e.g. More...
 
 isVisible ($a_ref_id, $a_type)
 
 viewObject ()
 list childs of current object More...
 
 deleteObject ($a_error=false)
 Display deletion confirmation screen. More...
 
 cloneAllObject ()
 Clone single (not container object) Method is overwritten in ilContainerGUI. More...
 

Static Public Member Functions

static _goto ($a_target, $a_additional=null)
 
- Static Public Member Functions inherited from ilObject2GUI
static handleAfterSaveCallback (ilObject $a_obj, $a_callback_ref_id)
 After creation callback. More...
 
- 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

const VIEW_MODE_VIEW = 1
 
const VIEW_MODE_MANAGE = 2
 
const VIEW_MODE_SORT = 3
 
const LINK_MOD_CREATE = 1
 
const LINK_MOD_EDIT = 2
 
const LINK_MOD_ADD = 3
 
- Data Fields inherited from ilObject2GUI
 $tree
 
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 COPY_WIZARD_NEEDS_PAGE = 1
 
 $ilias
 
 $objDefinition
 
 $tpl
 
 $tree
 
 $lng
 
 $data
 
 $object
 
 $ref_id
 
 $obj_id
 
 $maxcount
 
 $formaction
 
 $return_location
 
 $target_frame
 
 $tab_target_script
 
 $actions
 
 $sub_objects
 
 $omit_locator = false
 
const CFORM_NEW = 1
 
const CFORM_IMPORT = 2
 
const CFORM_CLONE = 3
 

Protected Member Functions

 initCreateForm ($a_new_type)
 
 afterSave (ilObject $a_new_object)
 
 settings ()
 Edit settings Title, Description, Sorting. More...
 
 saveSettings ()
 Save container settings. More...
 
 initFormSettings ()
 Show settings form. More...
 
 deleteParameter ()
 Delete a dynamic parameter. More...
 
 deleteParameterForm ()
 
 updateLinks ()
 Update all visible links. More...
 
 setValuesFromLink ($a_link_id)
 Set form values from link. More...
 
 checkLinkInput ($a_mode, $a_webr_id=0, $a_link_id=0)
 Check input after creating a new link. More...
 
 initFormLink ($a_mode)
 Show create/edit single link. More...
 
 isContainerMetaDataRequired ()
 Check if a new container title is required Necessary if there is more than one link. More...
 
 switchViewMode ()
 Switch between "View" "Manage" and "Sort". More...
 
 editLinks ()
 Start with manage mode. More...
 
 manage ()
 Manage links. More...
 
 showLinks ()
 Show all active links. More...
 
 sort ()
 Sort web links. More...
 
 saveSorting ()
 Save nmanual sorting. More...
 
 showToolbar ($a_tpl_var)
 Show toolbar. More...
 
 confirmDeleteLink ()
 Show delete confirmation screen. More...
 
 deleteLinks ()
 Delete links. More...
 
 deactivateLink ()
 Deactivate links. More...
 
 linkChecker ()
 Show link validation. More...
 
 activateTabs ($a_active_tab, $a_active_subtab='')
 Activate tab and subtabs. More...
 
 handleSubItemLinks ($a_target)
 
 redirectToLink ($a_ref_id, $a_obj_id, $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 ()
 Get access handler. More...
 
 setLocator ()
 set Locator More...
 
 deleteConfirmation ()
 Display delete confirmation form (workspace specific) More...
 
 deleteConfirmedObjects ()
 Delete objects (workspace specific) More...
 
 prepareOutput ()
 
 setTitleAndDescription ()
 
 showUpperIcon ()
 
 omitLocator ($a_omit=true)
 
 getTargetFrame ($a_cmd, $a_target_frame="")
 
 setTargetFrame ($a_cmd, $a_target_frame)
 
 getCenterColumnHTML ()
 
 getRightColumnHTML ()
 
 setColumnSettings ($column_gui)
 
 checkPermission ($a_perm, $a_cmd="")
 
 showPossibleSubObjects ()
 
 redirectToRefId ()
 
 fillCloneTemplate ($a_tpl_varname, $a_type)
 
 fillCloneSearchTemplate ($a_tpl_varname, $a_type)
 
 searchCloneSource ()
 
 buildCloneSelect ($existing_objs)
 
 addAdminLocatorItems ()
 
 setTabs ()
 create tabs (repository/workspace switch) More...
 
 getReturnLocation ()
 Deprecated functions. More...
 
 setReturnLocation ()
 
 showActions ()
 
 getTitlesByRefId ()
 
 getTabs ()
 
 __showButton ()
 
 hitsperpageObject ()
 
 __initTableGUI ()
 
 __setTableGUIBasicData ()
 
 addLocatorItems ()
 Functions to be overwritten. More...
 
 initCreationForms ($a_new_type)
 Init creation froms. More...
 
 putObjectInTree (ilObject $a_obj, $a_parent_node_id=null)
 Add object to tree at given position. More...
 
 checkPermissionBool ($a_perm, $a_cmd="", $a_type="", $a_node_id=null)
 Check permission. More...
 
 initHeaderAction ($a_sub_type=null, $a_sub_id=null)
 Add header action menu. More...
 
 redrawHeaderAction ()
 Updating icons after ajax call. More...
 
 getPermanentLinkWidget ($a_append=null, $a_center=false)
 
 handleAutoRating (ilObject $a_new_obj)
 
- Protected Member Functions inherited from ilObjectGUI
 assignObject ()
 
 prepareOutput ()
 prepare output More...
 
 setTitleAndDescription ()
 called by prepare output More...
 
 initHeaderAction ($a_sub_type=null, $a_sub_id=null)
 Add header action menu. More...
 
 insertHeaderAction ($a_list_gui)
 Insert header action into main template. More...
 
 addHeaderAction ()
 Add header action menu. More...
 
 redrawHeaderActionObject ()
 Ajax call: redraw action header only. More...
 
 showMountWebfolderIcon ()
 
 setTabs ()
 set admin tabs public More...
 
 setAdminTabs ()
 set admin tabs public More...
 
 setLocator ()
 set Locator More...
 
 addLocatorItems ()
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 omitLocator ($a_omit=true)
 
 addAdminLocatorItems ($a_do_not_add_object=false)
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 initCreationForms ($a_new_type)
 Init creation froms. More...
 
 getCreationFormsHTML (array $a_forms)
 Get HTML for creation forms (accordion) More...
 
 initCreateForm ($a_new_type)
 Init object creation form. More...
 
 initDidacticTemplate (ilPropertyFormGUI $form)
 Show didactic template types. More...
 
 addDidacticTemplateOptions (array &$a_options)
 Add custom templates. More...
 
 getDidacticTemplateVar ($a_type)
 Get didactic template setting from creation screen. More...
 
 putObjectInTree (ilObject $a_obj, $a_parent_node_id=null)
 Add object to tree at given position. More...
 
 afterSave (ilObject $a_new_object)
 Post (successful) object creation hook. More...
 
 initEditForm ()
 Init object edit form. More...
 
 initEditCustomForm (ilPropertyFormGUI $a_form)
 Add custom fields to update form. More...
 
 getEditFormValues ()
 Get values for edit form. More...
 
 getEditFormCustomValues (array &$a_values)
 Add values to custom edit fields. More...
 
 validateCustom (ilPropertyFormGUI $a_form)
 Validate custom values (if not possible with checkInput()) More...
 
 updateCustom (ilPropertyFormGUI $a_form)
 Insert custom update form values into object. More...
 
 afterUpdate ()
 Post (successful) object update hook. More...
 
 initImportForm ($a_new_type)
 Init object import form. More...
 
 importFileObject ($parent_id=null)
 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...
 
 getTitlesByRefId ($a_ref_ids)
 get Titles of objects this method is used for error messages in methods cut/copy/paste More...
 
 getTabs (&$tabs_gui)
 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 ($column_gui)
 May be overwritten in subclasses. More...
 
 checkPermission ($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
 Check permission and redirect on error. More...
 
 checkPermissionBool ($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
 Check permission. More...
 
 enableDragDropFileUpload ()
 Enables the file upload into this object by dropping files. More...
 
 handleAutoRating (ilObject $a_new_obj)
 Activate rating automatically if parent container setting. More...
 

Additional Inherited Members

- Protected Attributes inherited from ilObject2GUI
 $object_id
 
 $node_id
 
 $creation_forms = array()
 
 $id_type = array()
 
 $parent_id
 
 $access_handler
 

Detailed Description

Member Function Documentation

◆ __initLinkChecker()

ilObjLinkResourceGUI::__initLinkChecker ( )

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

References $ilDB.

Referenced by linkChecker(), and refreshLinkCheck().

1298  {
1299  global $ilDB;
1300 
1301  include_once './Services/LinkChecker/classes/class.ilLinkChecker.php';
1302 
1303  $this->link_checker_obj =& new ilLinkChecker($ilDB,false);
1304  $this->link_checker_obj->setObjId($this->object->getId());
1305 
1306  return true;
1307  }
class for checking external links in page objects Normally used in Cron jobs, but should be extensibl...
global $ilDB
+ Here is the caller graph for this function:

◆ __prepareOutput()

ilObjLinkResourceGUI::__prepareOutput ( )

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

References ilUtil\infoPanel(), and ilUtil\sendInfo().

Referenced by executeCommand().

1435  {
1436  // output objects
1437  $this->tpl->addBlockFile("CONTENT", "content", "tpl.adm_content.html");
1438  $this->tpl->addBlockFile("STATUSLINE", "statusline", "tpl.statusline.html");
1439 
1440  $this->tpl->setLocator();
1441 
1442  // output message
1443  if ($this->message)
1444  {
1445  ilUtil::sendInfo($this->message);
1446  }
1447 
1448  // display infopanel if something happened
1449  ilUtil::infoPanel();;
1450  }
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static infoPanel($a_keep=true)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _goto()

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

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

References $_GET, $ilErr, ilObjectGUI\$lng, ilObjectGUI\_gotoRepositoryRoot(), ilObject\_lookupObjId(), ilObject\_lookupTitle(), exit, ilUtil\redirect(), and ilUtil\sendFailure().

1558  {
1559  global $ilAccess, $ilErr, $lng;
1560 
1561  if($a_additional && substr($a_additional, -3) == "wsp")
1562  {
1563  $_GET["baseClass"] = "ilsharedresourceGUI";
1564  $_GET["wsp_id"] = $a_target;
1565  include("ilias.php");
1566  exit;
1567  }
1568 
1569  // Will be replaced in future releases by ilAccess::checkAccess()
1570  if ($ilAccess->checkAccess("read", "", $a_target))
1571  {
1572  ilUtil::redirect("ilias.php?baseClass=ilLinkResourceHandlerGUI&ref_id=$a_target");
1573  }
1574  else
1575  {
1576  // to do: force flat view
1577  if ($ilAccess->checkAccess("visible", "", $a_target))
1578  {
1579  ilUtil::redirect("ilias.php?baseClass=ilLinkResourceHandlerGUI&ref_id=".$a_target."&cmd=infoScreen");
1580  }
1581  else
1582  {
1583  if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID))
1584  {
1585  ilUtil::sendFailure(sprintf($lng->txt("msg_no_perm_read_item"),
1586  ilObject::_lookupTitle(ilObject::_lookupObjId($a_target))), true);
1588  }
1589  }
1590  }
1591 
1592  $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);
1593  }
exit
Definition: login.php:54
$_GET["client_id"]
static _gotoRepositoryRoot($a_raise_error=false)
Goto repository root.
static _lookupTitle($a_id)
lookup object title
static _lookupObjId($a_id)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static redirect($a_script)
http redirect to other script
+ Here is the call graph for this function:

◆ activateTabs()

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

Activate tab and subtabs.

Parameters
string$a_active_tab
string$a_active_subtab[optional]
Returns

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

References $ilCtrl, ilObjectGUI\$lng, ilContainerSortingSettings\_lookupSortMode(), ilObject2GUI\checkPermissionBool(), ilLinkResourceItems\lookupNumberOfLinks(), and ilContainer\SORT_MANUAL.

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

1317  {
1318  global $ilCtrl, $ilTabs, $lng;
1319 
1320  switch($a_active_tab)
1321  {
1322  case 'content':
1323  if($this->checkPermissionBool('write'))
1324  {
1325  $this->lng->loadLanguageModule('cntr');
1326 
1327  $this->ctrl->setParameter($this,'switch_mode',self::VIEW_MODE_VIEW);
1328  $ilTabs->addSubTab('id_content_view',
1329  $lng->txt('view'),
1330  $this->ctrl->getLinkTarget($this,'switchViewMode')
1331  );
1332  $this->ctrl->setParameter($this,'switch_mode',self::VIEW_MODE_MANAGE);
1333  $ilTabs->addSubTab('id_content_manage',
1334  $lng->txt('cntr_manage'),
1335  $this->ctrl->getLinkTarget($this,'switchViewMode')
1336  );
1337  include_once './Modules/WebResource/classes/class.ilLinkResourceItems.php';
1338  include_once './Services/Container/classes/class.ilContainerSortingSettings.php';
1339  include_once './Services/Container/classes/class.ilContainer.php';
1340  if((ilLinkResourceItems::lookupNumberOfLinks($this->object->getId()) > 1)
1342  {
1343  $this->ctrl->setParameter($this,'switch_mode',self::VIEW_MODE_SORT);
1344  $ilTabs->addSubTab('id_content_ordering',
1345  $this->lng->txt('cntr_ordering'),
1346  $this->ctrl->getLinkTarget($this,'switchViewMode')
1347  );
1348  }
1349 
1350  $ilCtrl->clearParameters($this);
1351  $ilTabs->activateSubTab($a_active_subtab);
1352  }
1353  }
1354 
1355  $ilTabs->activateTab('id_content');
1356  }
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_node_id=null)
Check permission.
static lookupNumberOfLinks($a_webr_id)
Get number of assigned links.
global $ilCtrl
Definition: ilias.php:18
static _lookupSortMode($a_obj_id)
lookup sort mode
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addLink()

ilObjLinkResourceGUI::addLink ( )

Add an additional link.

Returns

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

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

359  {
360  $this->checkPermission('write');
361  $this->activateTabs('content','id_content_view');
362 
363  $this->initFormLink(self::LINK_MOD_ADD);
364  $this->tpl->setContent($this->form->getHTML());
365  }
checkPermission($a_perm, $a_cmd="")
initFormLink($a_mode)
Show create/edit single link.
activateTabs($a_active_tab, $a_active_subtab='')
Activate tab and subtabs.
+ Here is the call graph for this function:

◆ addLocatorItems()

ilObjLinkResourceGUI::addLocatorItems ( )

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

1453  {
1454  global $ilLocator;
1455 
1456  if (is_object($this->object))
1457  {
1458  $ilLocator->addItem($this->object->getTitle(),$this->ctrl->getLinkTarget($this),"",$this->object->getRefId(), "webr");
1459  }
1460  }

◆ afterSave()

ilObjLinkResourceGUI::afterSave ( ilObject  $a_new_object)
protected

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

References ilObject\getId(), ilObject\getRefId(), ilUtil\redirect(), and ilUtil\sendSuccess().

176  {
177  // Save link
178  $this->link->setLinkResourceId($a_new_object->getId());
179  $link_id = $this->link->add();
180  $this->link->updateValid(true);
181 
182  ilUtil::sendSuccess($this->lng->txt('webr_link_added'));
183 
184  // personal workspace
185  if($this->id_type == self::WORKSPACE_NODE_ID)
186  {
187  $this->ctrl->redirect($this, "editLinks");
188  }
189  // repository
190  else
191  {
192  ilUtil::redirect("ilias.php?baseClass=ilLinkResourceHandlerGUI&ref_id=".
193  $a_new_object->getRefId()."&cmd=switchViewMode&switch_mode=2");
194  }
195  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
getId()
get object id public
getRefId()
get reference id public
static redirect($a_script)
http redirect to other script
+ Here is the call graph for this function:

◆ callDirectLink()

ilObjLinkResourceGUI::callDirectLink ( )

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

References ilObjectGUI\$obj_id, ilParameterAppender\_append(), ilLinkResourceItems\_getFirstLink(), ilParameterAppender\_isEnabled(), ilLinkResourceItems\_isSingular(), handleSubItemLinks(), and redirectToLink().

1497  {
1498  $obj_id = $this->object->getId();
1499 
1500  include_once './Modules/WebResource/classes/class.ilLinkResourceItems.php';
1502  {
1504  if($url["target"])
1505  {
1506  $url["target"] = $this->handleSubItemLinks($url["target"]);
1507 
1508  include_once './Modules/WebResource/classes/class.ilParameterAppender.php';
1510  {
1511  $url = ilParameterAppender::_append($url);
1512  }
1513 
1514  $this->redirectToLink($this->ref_id, $obj_id, $url["target"]);
1515  }
1516  }
1517  }
static _isSingular($a_webr_id)
Check whether there is only one active link in the web resource.
static _append($a_link_data)
static _getFirstLink($a_webr_id)
Get first link item Check before with _isSingular() if there is more or less than one...
redirectToLink($a_ref_id, $a_obj_id, $a_url)
static _isEnabled()
Check if dynamic parameters are enabled.
+ Here is the call graph for this function:

◆ callLink()

ilObjLinkResourceGUI::callLink ( )

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

References $_REQUEST, ilObjectGUI\$obj_id, ilParameterAppender\_append(), ilParameterAppender\_isEnabled(), handleSubItemLinks(), and redirectToLink().

1520  {
1521  if($_REQUEST["link_id"])
1522  {
1523  $obj_id = $this->object->getId();
1524 
1525  include_once './Modules/WebResource/classes/class.ilLinkResourceItems.php';
1526  $items = new ilLinkResourceItems($obj_id);
1527  $item = $items->getItem($_REQUEST["link_id"]);
1528  if($item["target"])
1529  {
1530  $item["target"] = $this->handleSubItemLinks($item["target"]);
1531 
1532  include_once './Modules/WebResource/classes/class.ilParameterAppender.php';
1534  {
1535  $item = ilParameterAppender::_append($item);
1536  }
1537 
1538  $this->redirectToLink($this->ref_id, $obj_id, $item["target"]);
1539  }
1540  }
1541  }
static _append($a_link_data)
Class ilObjLinkResourceGUI.
redirectToLink($a_ref_id, $a_obj_id, $a_url)
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
static _isEnabled()
Check if dynamic parameters are enabled.
+ Here is the call graph for this function:

◆ checkLinkInput()

ilObjLinkResourceGUI::checkLinkInput (   $a_mode,
  $a_webr_id = 0,
  $a_link_id = 0 
)
protected

Check input after creating a new link.

Parameters
object$a_mode
object$a_webr_id[optional]
object$a_link_id[optional]
Returns

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

References $valid, ilParameterAppender\_isEnabled(), LINKS_ERR_NO_NAME, LINKS_ERR_NO_NAME_VALUE, LINKS_ERR_NO_VALUE, and ilUtil\stripSlashes().

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

604  {
605  $valid = $this->form->checkInput();
606 
607  include_once './Modules/WebResource/classes/class.ilLinkResourceItems.php';
608  $this->link = new ilLinkResourceItems($a_webr_id);
609  $this->link->setTarget(str_replace('"', '', ilUtil::stripSlashes($this->form->getInput('tar'))));
610  $this->link->setTitle($this->form->getInput('tit'));
611  $this->link->setDescription($this->form->getInput('des'));
612  $this->link->setDisableCheckStatus($this->form->getInput('che'));
613 
614  if($a_mode == self::LINK_MOD_CREATE)
615  {
616  $this->link->setActiveStatus(true);
617  }
618  else
619  {
620  $this->link->setActiveStatus($this->form->getInput('act'));
621  }
622 
623  if($a_mode == self::LINK_MOD_EDIT)
624  {
625  $this->link->setValidStatus($this->form->getInput('vali'));
626  }
627  else
628  {
629  $this->link->setValidStatus(true);
630  }
631 
633  {
634  return $valid;
635  }
636 
637  $this->dynamic = new ilParameterAppender($a_webr_id);
638  $this->dynamic->setName($this->form->getInput('nam'));
639  $this->dynamic->setValue($this->form->getInput('val'));
640  if(!$this->dynamic->validate())
641  {
642  switch($this->dynamic->getErrorCode())
643  {
644  case LINKS_ERR_NO_NAME:
645  $this->form->getItemByPostVar('nam')->setAlert($this->lng->txt('links_no_name_given'));
646  return false;
647 
648  case LINKS_ERR_NO_VALUE:
649  $this->form->getItemByPostVar('val')->setAlert($this->lng->txt('links_no_value_given'));
650  return false;
651 
653  // Nothing entered => no error
654  return $valid;
655  }
656  $this->dynamic = null;
657  }
658  return $valid;
659  }
$valid
const LINKS_ERR_NO_VALUE
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
const LINKS_ERR_NO_NAME
Class ilObjLinkResourceGUI.
Class ilParameterAppender.
const LINKS_ERR_NO_NAME_VALUE
static _isEnabled()
Check if dynamic parameters are enabled.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ confirmDeleteLink()

ilObjLinkResourceGUI::confirmDeleteLink ( )
protected

Show delete confirmation screen.

Returns

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

References $_GET, $_POST, activateTabs(), ilObject2GUI\checkPermission(), ilUtil\sendFailure(), and view().

1023  {
1024  $this->checkPermission('write');
1025  $this->activateTabs('content','id_content_view');
1026 
1027  $link_ids = array();
1028 
1029  if(is_array($_POST['link_ids']))
1030  {
1031  $link_ids =$_POST['link_ids'];
1032  }
1033  elseif(isset($_GET['link_id']))
1034  {
1035  $link_ids = array($_GET['link_id']);
1036  }
1037 
1038  if(!count($link_ids) > 0)
1039  {
1040  ilUtil::sendFailure($this->lng->txt('select_one'));
1041  $this->view();
1042  return false;
1043  }
1044 
1045  include_once './Modules/WebResource/classes/class.ilLinkResourceItems.php';
1046  $links = new ilLinkResourceItems($this->object->getId());
1047 
1048  include_once 'Services/Utilities/classes/class.ilConfirmationGUI.php';
1049  $confirm = new ilConfirmationGUI();
1050  $confirm->setFormAction($this->ctrl->getFormAction($this,'view'));
1051  $confirm->setHeaderText($this->lng->txt('webr_sure_delete_items'));
1052  $confirm->setConfirm($this->lng->txt('delete'), 'deleteLinks');
1053  $confirm->setCancel($this->lng->txt('cancel'), 'view');
1054 
1055  foreach($link_ids as $link_id)
1056  {
1057  $link = $links->getItem($link_id);
1058  $confirm->addItem('link_ids[]', $link_id,$link['title']);
1059  }
1060  $this->tpl->setContent($confirm->getHTML());
1061  }
$_POST['username']
Definition: cron.php:12
$_GET["client_id"]
checkPermission($a_perm, $a_cmd="")
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
Class ilObjLinkResourceGUI.
activateTabs($a_active_tab, $a_active_subtab='')
Activate tab and subtabs.
Confirmation screen class.
+ Here is the call graph for this function:

◆ deactivateLink()

ilObjLinkResourceGUI::deactivateLink ( )
protected

Deactivate links.

Returns

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

References $_GET, $ilCtrl, ilObject2GUI\checkPermission(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

1089  {
1090  global $ilCtrl;
1091 
1092  $this->checkPermission('write');
1093 
1094  include_once './Modules/WebResource/classes/class.ilLinkResourceItems.php';
1095  $links = new ilLinkResourceItems($this->object->getId());
1096 
1097  if(!$_GET['link_id'])
1098  {
1099  ilUtil::sendFailure($this->lng->txt('select_one'),true);
1100  $ilCtrl->redirect($this,'view');
1101  }
1102 
1103  $links->setLinkId((int) $_GET['link_id']);
1104  $links->updateActive(false);
1105 
1106  ilUtil::sendSuccess($this->lng->txt('webr_inactive_success'),true);
1107  $ilCtrl->redirect($this,'view');
1108  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_GET["client_id"]
global $ilCtrl
Definition: ilias.php:18
checkPermission($a_perm, $a_cmd="")
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
Class ilObjLinkResourceGUI.
+ Here is the call graph for this function:

◆ deleteLinks()

ilObjLinkResourceGUI::deleteLinks ( )
protected

Delete links.

Returns

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

References $_POST, $ilCtrl, ilObject2GUI\checkPermission(), ilLinkResourceItems\delete(), and ilUtil\sendSuccess().

1068  {
1069  global $ilCtrl;
1070 
1071  $this->checkPermission('write');
1072 
1073  include_once './Modules/WebResource/classes/class.ilLinkResourceItems.php';
1074  $links = new ilLinkResourceItems($this->object->getId());
1075 
1076  foreach($_POST['link_ids'] as $link_id)
1077  {
1078  $links->delete($link_id);
1079  }
1080  ilUtil::sendSuccess($this->lng->txt('webr_deleted_items'),true);
1081  $ilCtrl->redirect($this,'view');
1082  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_POST['username']
Definition: cron.php:12
global $ilCtrl
Definition: ilias.php:18
checkPermission($a_perm, $a_cmd="")
Class ilObjLinkResourceGUI.
delete($a_item_id, $a_update_history=true)
+ Here is the call graph for this function:

◆ deleteParameter()

ilObjLinkResourceGUI::deleteParameter ( )
protected

Delete a dynamic parameter.

Returns

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

References $_GET, $ilCtrl, ilObject2GUI\checkPermission(), ilParameterAppender\delete(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

413  {
414  global $ilCtrl;
415 
416  $this->checkPermission('write');
417 
418  $this->ctrl->setParameter($this,'link_id',(int) $_GET['link_id']);
419 
420  if(!isset($_GET['param_id']))
421  {
422  ilUtil::sendFailure($this->lng->txt('select_one'),TRUE);
423  $ilCtrl->redirect($this,'view');
424  }
425 
426  include_once './Modules/WebResource/classes/class.ilParameterAppender.php';
427  $param = new ilParameterAppender($this->object->getId());
428  $param->delete((int) $_GET['param_id']);
429 
430  ilUtil::sendSuccess($this->lng->txt('links_parameter_deleted'),true);
431  $ilCtrl->redirect($this,'editLinks');
432  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_GET["client_id"]
global $ilCtrl
Definition: ilias.php:18
checkPermission($a_perm, $a_cmd="")
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
Class ilParameterAppender.
+ Here is the call graph for this function:

◆ deleteParameterForm()

ilObjLinkResourceGUI::deleteParameterForm ( )
protected

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

References $_GET, $ilCtrl, ilObject2GUI\checkPermission(), ilParameterAppender\delete(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

435  {
436  global $ilCtrl;
437 
438  $this->checkPermission('write');
439 
440  if(!isset($_GET['param_id']))
441  {
442  ilUtil::sendFailure($this->lng->txt('select_one'),TRUE);
443  $ilCtrl->redirect($this,'view');
444  }
445 
446  include_once './Modules/WebResource/classes/class.ilParameterAppender.php';
447  $param = new ilParameterAppender($this->object->getId());
448  $param->delete((int) $_GET['param_id']);
449 
450  ilUtil::sendSuccess($this->lng->txt('links_parameter_deleted'),true);
451  $ilCtrl->redirect($this,'view');
452 
453  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_GET["client_id"]
global $ilCtrl
Definition: ilias.php:18
checkPermission($a_perm, $a_cmd="")
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
Class ilParameterAppender.
+ Here is the call graph for this function:

◆ editLink()

ilObjLinkResourceGUI::editLink ( )

Edit a single link.

Returns

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

References $_GET, $ilCtrl, activateTabs(), ilObject2GUI\checkPermission(), initFormLink(), ilUtil\sendFailure(), and setValuesFromLink().

304  {
305  global $ilCtrl;
306 
307  $this->checkPermission('write');
308  $this->activateTabs('content','id_content_view');
309 
310  if(!(int) $_GET['link_id'])
311  {
312  ilUtil::sendFailure($this->lng->txt('select_one'),true);
313  $ilCtrl->redirect($this,'view');
314  }
315 
316  $this->initFormLink(self::LINK_MOD_EDIT);
317  $this->setValuesFromLink((int) $_GET['link_id']);
318  $this->tpl->setContent($this->form->getHTML());
319  }
$_GET["client_id"]
global $ilCtrl
Definition: ilias.php:18
checkPermission($a_perm, $a_cmd="")
setValuesFromLink($a_link_id)
Set form values from link.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
initFormLink($a_mode)
Show create/edit single link.
activateTabs($a_active_tab, $a_active_subtab='')
Activate tab and subtabs.
+ Here is the call graph for this function:

◆ editLinks()

ilObjLinkResourceGUI::editLinks ( )
protected

Start with manage mode.

Returns

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

References $_GET, and switchViewMode().

866  {
867  $_GET['switch_mode'] = self::VIEW_MODE_MANAGE;
868  $this->switchViewMode();
869  }
$_GET["client_id"]
switchViewMode()
Switch between "View" "Manage" and "Sort".
+ Here is the call graph for this function:

◆ executeCommand()

ilObjLinkResourceGUI::executeCommand ( )

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

References $_GET, $cmd, $ilCtrl, $ilErr, $ret, __prepareOutput(), ilMDUtils\_fillHTMLMetaTags(), ilObjectGUI\addHeaderAction(), ilMDEditorGUI\addObserver(), ilObject2GUI\getCreationMode(), ilCommonActionDispatcherGUI\getInstanceFromAjaxCall(), infoScreenForward(), initFormLink(), and ilObject2GUI\prepareOutput().

38  {
39  global $ilCtrl, $ilTabs, $ilErr, $ilAccess;
40 
41 
42  //if($this->ctrl->getTargetScript() == 'link_resources.php')
43  if($_GET["baseClass"] == 'ilLinkResourceHandlerGUI')
44  {
45  $_GET['view_mode'] = isset($_GET['switch_mode']) ? $_GET['switch_mode'] : $_GET['view_mode'];
46  $ilCtrl->saveParameter($this, 'view_mode');
47  $this->__prepareOutput();
48  }
49 
50  $this->lng->loadLanguageModule("webr");
51 
52  $next_class = $this->ctrl->getNextClass($this);
53  $cmd = $this->ctrl->getCmd();
54 
55  switch($next_class)
56  {
57  case "ilinfoscreengui":
58  $this->prepareOutput();
59  $this->infoScreenForward(); // forwards command
60  break;
61 
62  case 'ilmdeditorgui':
63  if(!$ilAccess->checkAccess('write','',$this->object->getRefId()))
64  {
65  $ilErr->raiseError($this->lng->txt('permission_denied'),$ilErr->WARNING);
66  }
67 
68  $this->prepareOutput();
69  $ilTabs->activateTab('id_meta_data');
70  include_once 'Services/MetaData/classes/class.ilMDEditorGUI.php';
71  $md_gui =& new ilMDEditorGUI($this->object->getId(), 0, $this->object->getType());
72  $md_gui->addObserver($this->object,'MDUpdateListener','General');
73  $this->ctrl->forwardCommand($md_gui);
74  break;
75 
76  case 'ilpermissiongui':
77  $this->prepareOutput();
78  $ilTabs->activateTab('id_permissions');
79  include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
80  $perm_gui =& new ilPermissionGUI($this);
81  $ret =& $this->ctrl->forwardCommand($perm_gui);
82  break;
83 
84  case 'ilobjectcopygui':
85  $this->prepareOutput();
86  include_once './Services/Object/classes/class.ilObjectCopyGUI.php';
87  $cp = new ilObjectCopyGUI($this);
88  $cp->setType('webr');
89  $this->ctrl->forwardCommand($cp);
90  break;
91 
92  case 'ilexportgui':
93  $this->prepareOutput();
94  $this->tabs_gui->setTabActive('export');
95  include_once './Services/Export/classes/class.ilExportGUI.php';
96  $exp = new ilExportGUI($this);
97  $exp->addFormat('xml');
98  $this->ctrl->forwardCommand($exp);
99  break;
100 
101  case "ilcommonactiondispatchergui":
102  include_once("Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
104  $this->ctrl->forwardCommand($gui);
105  break;
106 
107  case "ilpropertyformgui":
108  include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
109  $this->initFormLink(self::LINK_MOD_EDIT);
110  $this->ctrl->forwardCommand($this->form);
111  break;
112 
113  case "ilinternallinkgui":
114  $this->lng->loadLanguageModule("content");
115  require_once("./Services/Link/classes/class.ilInternalLinkGUI.php");
116  $link_gui = new ilInternalLinkGUI("RepositoryItem", 0);
117  $link_gui->filterLinkType("PageObject");
118  $link_gui->filterLinkType("GlossaryItem");
119  $link_gui->filterLinkType("RepositoryItem");
120  $link_gui->setFilterWhiteList(true);
121  $link_gui->setMode("asynch");
122  $ilCtrl->forwardCommand($link_gui);
123  break;
124 
125  default:
126  if(!$cmd)
127  {
128  $this->ctrl->setCmd("view");
129  }
130  parent::executeCommand();
131  }
132 
133  if(!$this->getCreationMode())
134  {
135  // Fill meta header tags
136  include_once('Services/MetaData/classes/class.ilMDUtils.php');
137  ilMDUtils::_fillHTMLMetaTags($this->object->getId(),$this->object->getId(),'webr');
138 
139  $this->addHeaderAction();
140  }
141  return true;
142  }
GUI class for the workflow of copying objects.
$_GET["client_id"]
$cmd
Definition: sahs_server.php:35
addObserver(&$a_class, $a_method, $a_element)
Class ilInternalLinkGUI.
infoScreenForward()
show information screen
global $ilCtrl
Definition: ilias.php:18
Export User Interface Class.
static _fillHTMLMetaTags($a_rbac_id, $a_obj_id, $a_type)
Fill html meta tags.
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
initFormLink($a_mode)
Show create/edit single link.
addHeaderAction()
Add header action menu.
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
+ Here is the call graph for this function:

◆ formatInvalidLinkArray()

ilObjLinkResourceGUI::formatInvalidLinkArray ( Array  $row)
See also
ilLinkCheckerGUIRowHandling::formatInvalidLinkArray()
Parameters
arrayUnformatted array
Returns
array Formatted array public

Implements ilLinkCheckerGUIRowHandling.

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

References ilObjectGUI\$actions, and $row.

1173  {
1174  $this->object->items_obj->readItem($row['page_id']);
1175  $row['title'] = $this->object->items_obj->getTitle();
1176 
1177  require_once 'Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php';
1179  $actions->setSelectionHeaderClass('small');
1180  $actions->setItemLinkClass('xsmall');
1181  $actions->setListTitle($this->lng->txt('actions'));
1182  $actions->setId($row['page_id']);
1183  $this->ctrl->setParameter($this, 'link_id', $row['page_id']);
1184  $actions->addItem(
1185  $this->lng->txt('edit'),
1186  '',
1187  $this->ctrl->getLinkTarget($this, 'editLink')
1188  );
1189  $this->ctrl->clearParameters($this);
1190  $row['action_html'] = $actions->getHTML();
1191 
1192  return $row;
1193  }
User interface class for advanced drop-down selection lists.

◆ getType()

ilObjLinkResourceGUI::getType ( )

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

33  {
34  return "webr";
35  }

◆ handleSubItemLinks()

ilObjLinkResourceGUI::handleSubItemLinks (   $a_target)
protected

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

References ilLink\_getStaticLink(), and ilLinkInputGUI\isInternalLink().

Referenced by callDirectLink(), and callLink().

1463  {
1464  // #15647 - handle internal links
1465  include_once "Services/Form/classes/class.ilFormPropertyGUI.php";
1466  include_once "Services/Form/classes/class.ilLinkInputGUI.php";
1467  if(ilLinkInputGUI::isInternalLink($a_target))
1468  {
1469  include_once("./Services/Link/classes/class.ilLink.php");
1470 
1471  // #10612
1472  $parts = explode("|", $a_target);
1473 
1474  if($parts[0] == "term")
1475  {
1476  // #16894
1477  return ilLink::_getStaticLink(
1478  0,
1479  "git",
1480  true,
1481  "&target=git_".$parts[1]
1482  );
1483  }
1484 
1485  if($parts[0] == "page")
1486  {
1487  $parts[0] = "pg";
1488  }
1489 
1490  $a_target = ilLink::_getStaticLink($parts[1], $parts[0]);
1491  }
1492 
1493  return $a_target;
1494  }
static isInternalLink($a_value)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ history()

ilObjLinkResourceGUI::history ( )

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

References ilObject2GUI\checkPermission(), and ilHistoryTableGUI\initTable().

1152  {
1153  global $ilTabs;
1154 
1155  $this->checkPermission('write');
1156  $ilTabs->activateTab('id_history');
1157 
1158  include_once("./Services/History/classes/class.ilHistoryTableGUI.php");
1159  $hist_gui = new ilHistoryTableGUI($this, "history", $this->object->getId(), $this->object->getType);
1160  $hist_gui->initTable();
1161  $this->tpl->setContent($hist_gui->getHTML());
1162  }
checkPermission($a_perm, $a_cmd="")
Copyright (c) 1998-2014 ILIAS open source, Extended GPL, see docs/LICENSE Date: 24.10.14 Time: 10:35.
+ Here is the call graph for this function:

◆ infoScreen()

ilObjLinkResourceGUI::infoScreen ( )

this one is called from the info button in the repository not very nice to set cmdClass/Cmd manually, if everything works through ilCtrl in the future this may be changed

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

References infoScreenForward().

1117  {
1118  $this->ctrl->setCmd("showSummary");
1119  $this->ctrl->setCmdClass("ilinfoscreengui");
1120  $this->infoScreenForward();
1121  }
infoScreenForward()
show information screen
+ Here is the call graph for this function:

◆ infoScreenForward()

ilObjLinkResourceGUI::infoScreenForward ( )

show information screen

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

References ilObject2GUI\checkPermission(), and ilObject2GUI\getPermanentLinkWidget().

Referenced by executeCommand(), and infoScreen().

1127  {
1128  global $ilTabs;
1129 
1130  $this->checkPermission('visible');
1131  $ilTabs->activateTab('id_info');
1132 
1133  include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
1134  $info = new ilInfoScreenGUI($this);
1135 
1136  $info->enablePrivateNotes();
1137 
1138  // standard meta data
1139  $info->addMetaDataSections($this->object->getId(),0, $this->object->getType());
1140 
1141  if($this->id_type == self::WORKSPACE_NODE_ID)
1142  {
1143  $info->addProperty($this->lng->txt("perma_link"), $this->getPermanentLinkWidget());
1144  }
1145 
1146  // forward the command
1147  $this->ctrl->forwardCommand($info);
1148  }
Class ilInfoScreenGUI.
getPermanentLinkWidget($a_append=null, $a_center=false)
checkPermission($a_perm, $a_cmd="")
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initCreateForm()

ilObjLinkResourceGUI::initCreateForm (   $a_new_type)
protected

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

References initFormLink().

145  {
146  $this->initFormLink(self::LINK_MOD_CREATE);
147  return $this->form;
148  }
initFormLink($a_mode)
Show create/edit single link.
+ Here is the call graph for this function:

◆ initFormLink()

ilObjLinkResourceGUI::initFormLink (   $a_mode)
protected

Show create/edit single link.

Parameters
intform mode
Returns

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

References $_GET, $_REQUEST, ilParameterAppender\_getOptionSelect(), ilParameterAppender\_getParams(), ilParameterAppender\_isEnabled(), ilSubEnabledFormPropertyGUI\addSubItem(), isContainerMetaDataRequired(), ilParameterAppender\parameterToInfo(), ilUtil\sendInfo(), ilCheckboxInputGUI\setChecked(), ilNonEditableValueGUI\setInfo(), ilLinkInputGUI\setInternalLinkFilterTypes(), ilSelectInputGUI\setOptions(), ilFormPropertyGUI\setRequired(), ilTextAreaInputGUI\setRows(), ilTextInputGUI\setSize(), and ilCheckboxInputGUI\setValue().

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

668  {
669  global $ilTabs;
670 
671  $ilTabs->activateTab("id_content");
672 
673  include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
674  $this->form = new ilPropertyFormGUI();
675 
676  switch($a_mode)
677  {
678  case self::LINK_MOD_CREATE:
679  // Header
680  $this->ctrl->setParameter($this,'new_type','webr');
681  $this->form->setTitle($this->lng->txt('webr_new_link'));
682  $this->form->setTableWidth('600px');
683 
684  // Buttons
685  $this->form->addCommandButton('save', $this->lng->txt('webr_add'));
686  $this->form->addCommandButton('cancel', $this->lng->txt('cancel'));
687  break;
688 
689  case self::LINK_MOD_ADD:
690  // Header
691  $this->form->setTitle($this->lng->txt('webr_new_link'));
692 
693  // Buttons
694  $this->form->addCommandButton('saveAddLink', $this->lng->txt('webr_add'));
695  $this->form->addCommandButton('view', $this->lng->txt('cancel'));
696  break;
697 
698  case self::LINK_MOD_EDIT:
699  // Header
700  $this->ctrl->setParameter($this,'link_id',(int) $_REQUEST['link_id']);
701  $this->form->setTitle($this->lng->txt('webr_edit'));
702 
703  // Buttons
704  $this->form->addCommandButton('updateLink', $this->lng->txt('save'));
705  $this->form->addCommandButton('view', $this->lng->txt('cancel'));
706  break;
707  }
708 
709 
710  $this->form->setFormAction($this->ctrl->getFormAction($this));
711 
712  if($a_mode == self::LINK_MOD_ADD and $this->isContainerMetaDataRequired())
713  {
714  ilUtil::sendInfo($this->lng->txt('webr_container_info'));
715 
716 
717  $this->form->setTitle($this->lng->txt('webr_edit_list'));
718 
719  // List Title
720  $title = new ilTextInputGUI($this->lng->txt('webr_list_title'),'lti');
721  $title->setRequired(true);
722  $title->setSize(40);
723  $title->setMaxLength(127);
724  $this->form->addItem($title);
725 
726  // List Description
727  $desc = new ilTextAreaInputGUI($this->lng->txt('webr_list_desc'),'tde');
728  $desc->setRows(3);
729  $desc->setCols(40);
730  $this->form->addItem($desc);
731 
732  // Addtional section
733  $sect = new ilFormSectionHeaderGUI();
734  $sect->setTitle($this->lng->txt('webr_add'));
735  $this->form->addItem($sect);
736  }
737 
738  // Target
739  /*
740  $tar = new ilTextInputGUI($this->lng->txt('webr_link_target'),'tar');
741  $tar->setValue("http://");
742 
743  $tar->setSize(40);
744  $tar->setMaxLength(500);
745  */
746  include_once 'Services/Form/classes/class.ilLinkInputGUI.php';
747  $tar = new ilLinkInputGUI($this->lng->txt('webr_link_target'),'tar');
748  $tar->setInternalLinkFilterTypes(array("PageObject", "GlossaryItem", "RepositoryItem"));
749 
750  $tar->setRequired(true);
751  $this->form->addItem($tar);
752 
753  // Title
754  $tit = new ilTextInputGUI($this->lng->txt('webr_link_title'),'tit');
755  $tit->setRequired(true);
756  $tit->setSize(40);
757  $tit->setMaxLength(127);
758  $this->form->addItem($tit);
759 
760  // Description
761  $des = new ilTextAreaInputGUI($this->lng->txt('description'),'des');
762  $des->setRows(3);
763  $des->setCols(40);
764  $this->form->addItem($des);
765 
766 
767  if($a_mode != self::LINK_MOD_CREATE)
768  {
769  // Active
770  $act = new ilCheckboxInputGUI($this->lng->txt('active'),'act');
771  $act->setChecked(true);
772  $act->setValue(1);
773  $this->form->addItem($act);
774 
775  // Check
776  $che = new ilCheckboxInputGUI($this->lng->txt('webr_disable_check'),'che');
777  $che->setValue(1);
778  $this->form->addItem($che);
779  }
780 
781  // Valid
782  if($a_mode == self::LINK_MOD_EDIT)
783  {
784  $val = new ilCheckboxInputGUI($this->lng->txt('valid'),'vali');
785  $this->form->addItem($val);
786  }
787 
788  if(ilParameterAppender::_isEnabled() && $a_mode != self::LINK_MOD_CREATE)
789  {
790  $dyn = new ilNonEditableValueGUI($this->lng->txt('links_dyn_parameter'));
791  $dyn->setInfo($this->lng->txt('links_dynamic_info'));
792 
793 
794  if(count($links = ilParameterAppender::_getParams((int) $_GET['link_id'])))
795  {
796  $ex = new ilCustomInputGUI($this->lng->txt('links_existing_params'),'ex');
797  $dyn->addSubItem($ex);
798 
799  foreach($links as $id => $link)
800  {
801  $p = new ilCustomInputGUI();
802 
803  $ptpl = new ilTemplate('tpl.link_dyn_param_edit.html',true,true,'Modules/WebResource');
804  $ptpl->setVariable('INFO_TXT',ilParameterAppender::parameterToInfo($link['name'], $link['value']));
805  $this->ctrl->setParameter($this,'param_id',$id);
806  $ptpl->setVariable('LINK_DEL',$this->ctrl->getLinkTarget($this,'deleteParameterForm'));
807  $ptpl->setVariable('LINK_TXT',$this->lng->txt('delete'));
808  $p->setHtml($ptpl->get());
809  $dyn->addSubItem($p);
810  }
811  }
812 
813  // Existing parameters
814 
815  // New parameter
816  if($a_mode != self::LINK_MOD_CREATE)
817  {
818  #$new = new ilCustomInputGUI($this->lng->txt('links_add_param'),'');
819  #$dyn->addSubItem($new);
820  }
821 
822  // Dynyamic name
823  $nam = new ilTextInputGUI($this->lng->txt('links_name'),'nam');
824  $nam->setSize(12);
825  $nam->setMaxLength(128);
826  $dyn->addSubItem($nam);
827 
828  // Dynamic value
829  $val = new ilSelectInputGUI($this->lng->txt('links_value'),'val');
831  $val->setValue(0);
832  $dyn->addSubItem($val);
833 
834  $this->form->addItem($dyn);
835  }
836  }
This class represents a selection list property in a property form.
This class represents a property form user interface.
$_GET["client_id"]
This class represents a section header in a property form.
static _getOptionSelect()
Get options as array.
setInfo($a_info)
Set Information Text.
setInternalLinkFilterTypes(array $a_val)
Set internal link filter types.
This class represents a checkbox property in a property form.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
setChecked($a_checked)
Set Checked.
static parameterToInfo($a_name, $a_value)
Get info text describing an existing dynamic link.
setValue($a_value)
Set Value.
special template class to simplify handling of ITX/PEAR
setSize($a_size)
Set Size.
This class represents a text property in a property form.
isContainerMetaDataRequired()
Check if a new container title is required Necessary if there is more than one link.
setOptions($a_options)
Set Options.
This class represents a custom property in a property form.
This class represents a non editable value in a property form.
This class represents a text area property in a property form.
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
static _getParams($a_link_id)
Get dynamic parameter definitions.
static _isEnabled()
Check if dynamic parameters are enabled.
setRequired($a_required)
Set Required.
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:

◆ initFormSettings()

ilObjLinkResourceGUI::initFormSettings ( )
protected

Show settings form.

Returns

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

References ilContainerSortingSettings\_lookupSortMode(), ilFormPropertyGUI\setRequired(), ilTextInputGUI\setValue(), ilTextAreaInputGUI\setValue(), ilContainer\SORT_MANUAL, and ilContainer\SORT_TITLE.

Referenced by saveSettings(), and settings().

251  {
252  include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
253  $this->form = new ilPropertyFormGUI();
254  $this->form->setFormAction($this->ctrl->getFormAction($this,'saveSettings'));
255  $this->form->setTitle($this->lng->txt('webr_edit_settings'));
256 
257  // Title
258  $tit = new ilTextInputGUI($this->lng->txt('webr_list_title'),'tit');
259  $tit->setValue($this->object->getTitle());
260  $tit->setRequired(true);
261  $tit->setSize(40);
262  $tit->setMaxLength(127);
263  $this->form->addItem($tit);
264 
265  // Description
266  $des = new ilTextAreaInputGUI($this->lng->txt('webr_list_desc'),'des');
267  $des->setValue($this->object->getDescription());
268  $des->setCols(40);
269  $des->setRows(3);
270  $this->form->addItem($des);
271 
272  // Sorting
273  include_once './Services/Container/classes/class.ilContainerSortingSettings.php';
274  include_once './Services/Container/classes/class.ilContainer.php';
275 
276  $sor = new ilRadioGroupInputGUI($this->lng->txt('webr_sorting'),'sor');
277  $sor->setRequired(true);
278  include_once './Services/Container/classes/class.ilContainerSortingSettings.php';
279  $sor->setValue(ilContainerSortingSettings::_lookupSortMode($this->object->getId()));
280 
281  $opt = new ilRadioOption(
282  $this->lng->txt('webr_sort_title'),
284  );
285  $sor->addOption($opt);
286 
287  $opm = new ilRadioOption(
288  $this->lng->txt('webr_sort_manual'),
290  );
291  $sor->addOption($opm);
292  $this->form->addItem($sor);
293 
294  $this->form->addCommandButton('saveSettings', $this->lng->txt('save'));
295  $this->form->addCommandButton('view', $this->lng->txt('cancel'));
296  }
This class represents an option in a radio group.
This class represents a property form user interface.
setValue($a_value)
Set Value.
This class represents a property in a property form.
This class represents a text property in a property form.
This class represents a text area property in a property form.
static _lookupSortMode($a_obj_id)
lookup sort mode
setValue($a_value)
Set Value.
setRequired($a_required)
Set Required.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isContainerMetaDataRequired()

ilObjLinkResourceGUI::isContainerMetaDataRequired ( )
protected

Check if a new container title is required Necessary if there is more than one link.

Returns

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

References ilLinkResourceItems\lookupNumberOfLinks().

Referenced by initFormLink(), saveAddLink(), updateLink(), and updateLinks().

844  {
845  include_once './Modules/WebResource/classes/class.ilLinkResourceItems.php';
846  return ilLinkResourceItems::lookupNumberOfLinks($this->object->getId()) == 1;
847  }
static lookupNumberOfLinks($a_webr_id)
Get number of assigned links.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ linkChecker()

ilObjLinkResourceGUI::linkChecker ( )
protected

Show link validation.

Returns

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

References ilObjectGUI\$ilias, $ilUser, ilObjectGUI\$tpl, __initLinkChecker(), ilLinkCheckNotify\_getNotifyStatus(), ilObject2GUI\checkPermission(), and ilCheckboxInputGUI\setValue().

Referenced by refreshLinkCheck(), and saveLinkCheck().

1200  {
1201  global $ilias, $ilUser, $tpl, $ilTabs;
1202 
1203  $this->checkPermission('write');
1204  $ilTabs->activateTab('id_link_check');
1205 
1206  $this->__initLinkChecker();
1207  $this->object->initLinkResourceItemsObject();
1208 
1209  require_once './Services/LinkChecker/classes/class.ilLinkCheckerTableGUI.php';
1210 
1211  $toolbar = new ilToolbarGUI();
1212 
1213  if((bool)$ilias->getSetting('cron_web_resource_check'))
1214  {
1215  include_once './Services/LinkChecker/classes/class.ilLinkCheckNotify.php';
1216  include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
1217 
1218  $chb = new ilCheckboxInputGUI($this->lng->txt('link_check_message_a'), 'link_check_message');
1219  $chb->setValue(1);
1220  $chb->setChecked((bool)ilLinkCheckNotify::_getNotifyStatus($ilUser->getId(), $this->object->getId()));
1221  $chb->setOptionTitle($this->lng->txt('link_check_message_b'));
1222 
1223  $toolbar->addInputItem($chb);
1224  $toolbar->addFormButton($this->lng->txt('save'), 'saveLinkCheck');
1225  $toolbar->setFormAction($this->ctrl->getLinkTarget($this, 'saveLinkCheck'));
1226  }
1227 
1228  $tgui = new ilLinkCheckerTableGUI($this, 'linkChecker');
1229  $tgui->setLinkChecker($this->link_checker_obj)
1230  ->setRowHandler($this)
1231  ->setRefreshButton($this->lng->txt('refresh'), 'refreshLinkCheck');
1232 
1233  return $tpl->setContent($tgui->prepareHTML()->getHTML().$toolbar->getHTML());
1234  }
This class represents a checkbox property in a property form.
class ilLinkCheckerTableGUI
checkPermission($a_perm, $a_cmd="")
setValue($a_value)
Set Value.
global $ilUser
Definition: imgupload.php:15
_getNotifyStatus($a_usr_id, $a_obj_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ manage()

ilObjLinkResourceGUI::manage ( )
protected

Manage links.

Returns

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

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

Referenced by view().

921  {
922  $this->checkPermission('write');
923  $this->activateTabs('content','id_content_manage');
924 
925  $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.webr_manage.html','Modules/WebResource');
926  $this->showToolbar('ACTION_BUTTONS');
927 
928  include_once './Modules/WebResource/classes/class.ilWebResourceEditableLinkTableGUI.php';
929  $table = new ilWebResourceEditableLinkTableGUI($this,'view');
930  $table->parse();
931 
932  include_once './Services/Link/classes/class.ilInternalLinkGUI.php';
934 
935  $this->tpl->addJavaScript("Modules/WebResource/js/intLink.js");
936  $this->tpl->addJavascript("Services/Form/js/Form.js");
937 
938  $this->tpl->setVariable('TABLE_LINKS',$table->getHTML().$js);
939  }
checkPermission($a_perm, $a_cmd="")
activateTabs($a_active_tab, $a_active_subtab='')
Activate tab and subtabs.
getInitHTML($a_url, $a_move_to_body=false)
Get initialisation HTML to use interna link editing.
showToolbar($a_tpl_var)
Show toolbar.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ redirectToLink()

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

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

References $ilUser, ilChangeEvent\_recordReadEvent(), and ilUtil\redirect().

Referenced by callDirectLink(), and callLink().

1544  {
1545  global $ilUser;
1546 
1547  if($a_url)
1548  {
1549  require_once('Services/Tracking/classes/class.ilChangeEvent.php');
1550  ilChangeEvent::_recordReadEvent("webr", $a_ref_id, $a_obj_id,
1551  $ilUser->getId());
1552 
1553  ilUtil::redirect($a_url);
1554  }
1555  }
_recordReadEvent($a_type, $a_ref_id, $obj_id, $usr_id, $isCatchupWriteEvents=true, $a_ext_rc=false, $a_ext_time=false)
Records a read event and catches up with write events.
global $ilUser
Definition: imgupload.php:15
static redirect($a_script)
http redirect to other script
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ refreshLinkCheck()

ilObjLinkResourceGUI::refreshLinkCheck ( )

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

References __initLinkChecker(), linkChecker(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

1264  {
1265  $this->__initLinkChecker();
1266 
1267  if(!$this->link_checker_obj->checkPear())
1268  {
1269  ilUtil::sendFailure($this->lng->txt('missing_pear_library'));
1270  $this->linkChecker();
1271 
1272  return false;
1273  }
1274 
1275 
1276  $this->object->initLinkResourceItemsObject();
1277 
1278  // Set all link to valid. After check invalid links will be set to invalid
1279  $this->object->items_obj->updateValidByCheck();
1280 
1281  foreach($this->link_checker_obj->checkWebResourceLinks() as $invalid)
1282  {
1283  $this->object->items_obj->readItem($invalid['page_id']);
1284  $this->object->items_obj->setActiveStatus(false);
1285  $this->object->items_obj->setValidStatus(false);
1286  $this->object->items_obj->update(false);
1287  }
1288 
1289  $this->object->items_obj->updateLastCheck();
1290  ilUtil::sendSuccess($this->lng->txt('link_checker_refreshed'));
1291 
1292  $this->linkChecker();
1293 
1294  return true;
1295  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
linkChecker()
Show link validation.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ Here is the call graph for this function:

◆ save()

ilObjLinkResourceGUI::save ( )

Save new object public.

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

References $_POST, $ilCtrl, checkLinkInput(), initFormLink(), and ilUtil\sendFailure().

155  {
156  global $ilCtrl;
157 
158  $this->initFormLink(self::LINK_MOD_CREATE);
159  if($this->checkLinkInput(self::LINK_MOD_CREATE,0,0))
160  {
161  // Save new object
162  $_POST['title'] = $_POST['tit'];
163  $_POST['desc'] = $_POST['des'];
164  parent::save();
165  }
166  else
167  {
168  // Data incomplete or invalid
169  ilUtil::sendFailure($this->lng->txt('err_check_input'));
170  $this->form->setValuesByPost();
171  $this->tpl->setContent($this->form->getHTML());
172  }
173  }
$_POST['username']
Definition: cron.php:12
checkLinkInput($a_mode, $a_webr_id=0, $a_link_id=0)
Check input after creating a new link.
global $ilCtrl
Definition: ilias.php:18
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
initFormLink($a_mode)
Show create/edit single link.
+ Here is the call graph for this function:

◆ saveAddLink()

ilObjLinkResourceGUI::saveAddLink ( )

Save form data.

Returns

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

References $ilCtrl, ilParameterAppender\_isEnabled(), activateTabs(), checkLinkInput(), ilObject2GUI\checkPermission(), initFormLink(), isContainerMetaDataRequired(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

372  {
373  global $ilCtrl;
374 
375  $this->checkPermission('write');
376 
377  $this->initFormLink(self::LINK_MOD_ADD);
378  if($this->checkLinkInput(self::LINK_MOD_ADD,$this->object->getId(),0))
379  {
380  if($this->isContainerMetaDataRequired())
381  {
382  // Save list data
383  $this->object->setTitle($this->form->getInput('lti'));
384  $this->object->setDescription($this->form->getInput('tde'));
385  $this->object->update();
386  }
387 
388  // Save Link
389  $link_id = $this->link->add();
390  $this->link->updateValid(true);
391 
392  // Dynamic parameters
393  if(ilParameterAppender::_isEnabled() and is_object($this->dynamic))
394  {
395  $this->dynamic->add($link_id);
396  }
397  ilUtil::sendSuccess($this->lng->txt('webr_link_added'),true);
398  $ilCtrl->redirect($this,'view');
399  }
400  // Error handling
401  ilUtil::sendFailure($this->lng->txt('err_check_input'));
402  $this->form->setValuesByPost();
403 
404  $this->activateTabs('content','id_content_view');
405  $this->tpl->setContent($this->form->getHTML());
406  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
checkLinkInput($a_mode, $a_webr_id=0, $a_link_id=0)
Check input after creating a new link.
global $ilCtrl
Definition: ilias.php:18
checkPermission($a_perm, $a_cmd="")
isContainerMetaDataRequired()
Check if a new container title is required Necessary if there is more than one link.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
initFormLink($a_mode)
Show create/edit single link.
activateTabs($a_active_tab, $a_active_subtab='')
Activate tab and subtabs.
static _isEnabled()
Check if dynamic parameters are enabled.
+ Here is the call graph for this function:

◆ saveLinkCheck()

ilObjLinkResourceGUI::saveLinkCheck ( )

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

References $_POST, $ilDB, $ilUser, linkChecker(), and ilUtil\sendSuccess().

1237  {
1238  global $ilDB,$ilUser;
1239 
1240  include_once './Services/LinkChecker/classes/class.ilLinkCheckNotify.php';
1241 
1242  $link_check_notify =& new ilLinkCheckNotify($ilDB);
1243  $link_check_notify->setUserId($ilUser->getId());
1244  $link_check_notify->setObjId($this->object->getId());
1245 
1246  if($_POST['link_check_message'])
1247  {
1248  ilUtil::sendSuccess($this->lng->txt('link_check_message_enabled'));
1249  $link_check_notify->addNotifier();
1250  }
1251  else
1252  {
1253  ilUtil::sendSuccess($this->lng->txt('link_check_message_disabled'));
1254  $link_check_notify->deleteNotifier();
1255  }
1256  $this->linkChecker();
1257 
1258  return true;
1259  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_POST['username']
Definition: cron.php:12
class for checking external links in page objects.
linkChecker()
Show link validation.
global $ilUser
Definition: imgupload.php:15
global $ilDB
+ Here is the call graph for this function:

◆ saveSettings()

ilObjLinkResourceGUI::saveSettings ( )
protected

Save container settings.

Returns

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

References ilObject2GUI\checkPermission(), initFormSettings(), ilUtil\sendFailure(), ilUtil\sendSuccess(), and ilContainerSortingSettings\setSortMode().

218  {
219  global $ilTabs;
220 
221  $this->checkPermission('write');
222  $ilTabs->activateTab('id_settings');
223 
224  $this->initFormSettings();
225  if($this->form->checkInput())
226  {
227  $this->object->setTitle($this->form->getInput('tit'));
228  $this->object->setDescription($this->form->getInput('des'));
229  $this->object->update();
230 
231  include_once './Services/Container/classes/class.ilContainerSortingSettings.php';
232  $sort = new ilContainerSortingSettings($this->object->getId());
233  $sort->setSortMode($this->form->getInput('sor'));
234  $sort->update();
235 
236  ilUtil::sendSuccess($this->lng->txt('settings_saved'),true);
237  $this->ctrl->redirect($this,'settings');
238  }
239 
240  $this->form->setValuesByPost();
241  ilUtil::sendFailure($this->lng->txt('err_check_input'));
242  $this->tpl->setContent($this->form->getHTML());
243  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
initFormSettings()
Show settings form.
checkPermission($a_perm, $a_cmd="")
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ Here is the call graph for this function:

◆ saveSorting()

ilObjLinkResourceGUI::saveSorting ( )
protected

Save nmanual sorting.

Returns

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

References $_POST, ilContainerSorting\_getInstance(), ilObject2GUI\checkPermission(), ilUtil\sendSuccess(), and view().

982  {
983  $this->checkPermission('write');
984 
985  include_once './Services/Container/classes/class.ilContainerSorting.php';
986  $sort = ilContainerSorting::_getInstance($this->object->getId());
987  $sort->savePost((array) $_POST['position']);
988 
989  ilUtil::sendSuccess($this->lng->txt('settings_saved'),true);
990  $this->view();
991  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_POST['username']
Definition: cron.php:12
checkPermission($a_perm, $a_cmd="")
static _getInstance($a_obj_id)
get instance by obj_id
+ Here is the call graph for this function:

◆ setTabs()

ilObjLinkResourceGUI::setTabs ( )

get tabs public

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

References ilObjectGUI\$lng, ilObject2GUI\checkPermissionBool(), ilObject2GUI\getCreationMode(), and ilLinkResourceItems\lookupNumberOfLinks().

1364  {
1365  global $ilTabs, $lng, $ilHelp;
1366 
1367  $ilHelp->setScreenIdComponent("webr");
1368 
1369  if ($this->checkPermissionBool('read'))
1370  {
1371  $ilTabs->addTab("id_content",
1372  $lng->txt("content"),
1373  $this->ctrl->getLinkTarget($this, "view"));
1374  }
1375 
1376  if ($this->checkPermissionBool('visible'))
1377  {
1378  $ilTabs->addTab("id_info",
1379  $lng->txt("info_short"),
1380  $this->ctrl->getLinkTarget($this, "infoScreen"));
1381  }
1382 
1383  if($this->checkPermissionBool('write') and !$this->getCreationMode())
1384  {
1385  include_once './Modules/WebResource/classes/class.ilLinkResourceItems.php';
1386  if(ilLinkResourceItems::lookupNumberOfLinks($this->object->getId()) > 1)
1387  {
1388  $ilTabs->addTab("id_settings",
1389  $lng->txt("settings"),
1390  $this->ctrl->getLinkTarget($this, "settings"));
1391  }
1392 
1393  }
1394 
1395  if ($this->checkPermissionBool('write'))
1396  {
1397  $ilTabs->addTab("id_history",
1398  $lng->txt("history"),
1399  $this->ctrl->getLinkTarget($this, "history"));
1400  }
1401 
1402  if ($this->checkPermissionBool('write'))
1403  {
1404  // Check if pear library is available
1405  if(@include_once('HTTP/Request.php'))
1406  {
1407  $ilTabs->addTab("id_link_check",
1408  $lng->txt("link_check"),
1409  $this->ctrl->getLinkTarget($this, "linkChecker"));
1410  }
1411  }
1412 
1413  if ($this->checkPermissionBool('write'))
1414  {
1415  $ilTabs->addTab("id_meta_data",
1416  $lng->txt("meta_data"),
1417  $this->ctrl->getLinkTargetByClass('ilmdeditorgui','listSection'));
1418  }
1419 
1420  if($this->checkPermissionBool('write'))
1421  {
1422  $ilTabs->addTab(
1423  'export',
1424  $this->lng->txt('export'),
1425  $this->ctrl->getLinkTargetByClass('ilexportgui','')
1426  );
1427  }
1428 
1429  // will add permission tab if needed
1430  parent::setTabs();
1431  }
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_node_id=null)
Check permission.
static lookupNumberOfLinks($a_webr_id)
Get number of assigned links.
+ Here is the call graph for this function:

◆ settings()

ilObjLinkResourceGUI::settings ( )
protected

Edit settings Title, Description, Sorting.

Returns

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

References ilObject2GUI\checkPermission(), and initFormSettings().

203  {
204  global $ilTabs;
205 
206  $this->checkPermission('write');
207  $ilTabs->activateTab('id_settings');
208 
209  $this->initFormSettings();
210  $this->tpl->setContent($this->form->getHTML());
211  }
initFormSettings()
Show settings form.
checkPermission($a_perm, $a_cmd="")
+ Here is the call graph for this function:

◆ setValuesFromLink()

ilObjLinkResourceGUI::setValuesFromLink (   $a_link_id)
protected

Set form values from link.

Parameters
object$a_link_id
Returns

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

References ilParameterAppender\_isEnabled(), and ilLinkResourceItems\getItem().

Referenced by editLink().

573  {
574  include_once './Modules/WebResource/classes/class.ilLinkResourceItems.php';
575  $link = new ilLinkResourceItems($this->object->getId());
576 
577  $values = $link->getItem($a_link_id);
578 
580  {
581  }
582 
583  $this->form->setValuesByArray(
584  array(
585  'tit' => $values['title'],
586  'tar' => $values['target'],
587  'des' => $values['description'],
588  'act' => (int) $values['active'],
589  'che' => (int) $values['disable_check'],
590  'vali' => (int) $values['valid']
591  )
592  );
593  }
Class ilObjLinkResourceGUI.
static _isEnabled()
Check if dynamic parameters are enabled.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showLinks()

ilObjLinkResourceGUI::showLinks ( )
protected

Show all active links.

Returns

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

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

Referenced by view().

946  {
947  $this->checkPermission('read');
948  $this->activateTabs('content','id_content_view');
949 
950  include_once './Modules/WebResource/classes/class.ilWebResourceLinkTableGUI.php';
951  $table = new ilWebResourceLinkTableGUI($this,'showLinks');
952  $table->parse();
953 
954  $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.webr_view.html','Modules/WebResource');
955  $this->showToolbar('ACTION_BUTTONS');
956  $this->tpl->setVariable('LINK_TABLE',$table->getHTML());
957  }
TableGUI class for search results.
checkPermission($a_perm, $a_cmd="")
activateTabs($a_active_tab, $a_active_subtab='')
Activate tab and subtabs.
showToolbar($a_tpl_var)
Show toolbar.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showToolbar()

ilObjLinkResourceGUI::showToolbar (   $a_tpl_var)
protected

Show toolbar.

Parameters
string$a_tpl_varName of template variable
Returns

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

References ilObject2GUI\checkPermissionBool().

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

1000  {
1001  if(!$this->checkPermissionBool('write'))
1002  {
1003  return;
1004  }
1005 
1006  include_once './Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php';
1007  $tool = new ilToolbarGUI();
1008  $tool->setFormAction($this->ctrl->getFormAction($this));
1009  $tool->addButton(
1010  $this->lng->txt('webr_add'),
1011  $this->ctrl->getLinkTarget($this,'addLink')
1012  );
1013 
1014  $this->tpl->setVariable($a_tpl_var,$tool->getHTML());
1015  return;
1016  }
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_node_id=null)
Check permission.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sort()

ilObjLinkResourceGUI::sort ( )
protected

Sort web links.

Returns

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

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

Referenced by view().

964  {
965  $this->checkPermission('write');
966  $this->activateTabs('content','id_content_ordering');
967 
968  include_once './Modules/WebResource/classes/class.ilWebResourceLinkTableGUI.php';
969  $table = new ilWebResourceLinkTableGUI($this,'sort',true);
970  $table->parse();
971 
972  $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.webr_view.html','Modules/WebResource');
973  $this->showToolbar('ACTION_BUTTONS');
974  $this->tpl->setVariable('LINK_TABLE',$table->getHTML());
975  }
TableGUI class for search results.
checkPermission($a_perm, $a_cmd="")
activateTabs($a_active_tab, $a_active_subtab='')
Activate tab and subtabs.
showToolbar($a_tpl_var)
Show toolbar.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ switchViewMode()

ilObjLinkResourceGUI::switchViewMode ( )
protected

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

Returns

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

References $_GET, $_REQUEST, $ilCtrl, and view().

Referenced by editLinks().

854  {
855  global $ilCtrl;
856 
857  $_REQUEST['view_mode'] = $_GET['view_mode'] = (int) $_GET['switch_mode'];
858  $this->view();
859  }
$_GET["client_id"]
global $ilCtrl
Definition: ilias.php:18
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateLink()

ilObjLinkResourceGUI::updateLink ( )

Save after editing.

Returns

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

References $_REQUEST, $ilCtrl, ilParameterAppender\_isEnabled(), checkLinkInput(), initFormLink(), isContainerMetaDataRequired(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

326  {
327  global $ilCtrl;
328 
329  $this->initFormLink(self::LINK_MOD_EDIT);
330  if($this->checkLinkInput(self::LINK_MOD_EDIT,$this->object->getId(),(int) $_REQUEST['link_id']))
331  {
332  $this->link->setLinkId((int) $_REQUEST['link_id']);
333  $this->link->update();
334  if(ilParameterAppender::_isEnabled() and is_object($this->dynamic))
335  {
336  $this->dynamic->add((int) $_REQUEST['link_id']);
337  }
338 
339  if($this->isContainerMetaDataRequired())
340  {
341  $this->object->setTitle($this->form->getInput('tit'));
342  $this->object->setDescription($this->form->getInput('des'));
343  $this->object->update();
344  }
345 
346  ilUtil::sendSuccess($this->lng->txt('settings_saved'),true);
347  $ilCtrl->redirect($this,'view');
348  }
349  ilUtil::sendFailure($this->lng->txt('err_check_input'));
350  $this->form->setValuesByPost();
351  $this->tpl->setContent($this->form->getHTML());
352  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
checkLinkInput($a_mode, $a_webr_id=0, $a_link_id=0)
Check input after creating a new link.
global $ilCtrl
Definition: ilias.php:18
isContainerMetaDataRequired()
Check if a new container title is required Necessary if there is more than one link.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
initFormLink($a_mode)
Show create/edit single link.
static _isEnabled()
Check if dynamic parameters are enabled.
+ Here is the call graph for this function:

◆ updateLinks()

ilObjLinkResourceGUI::updateLinks ( )
protected

Update all visible links.

Returns

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

References $_POST, ilObjectGUI\$data, $ilCtrl, activateTabs(), ilObject2GUI\checkPermission(), isContainerMetaDataRequired(), ilLinkResourceItems\lookupItem(), ilUtil\sendFailure(), ilUtil\sendSuccess(), ilParameterAppender\setName(), and ilUtil\stripSlashes().

461  {
462  global $ilCtrl;
463 
464  $this->checkPermission('write');
465  $this->activateTabs('content','');
466 
467  if(!is_array($_POST['ids']))
468  {
469  ilUtil::sendFailure($this->lng->txt('select_one'),TRUE);
470  $ilCtrl->redirect($this,'view');
471  }
472 
473  // Validate
474  $invalid = array();
475  foreach($_POST['ids'] as $link_id)
476  {
477  $data = $_POST['links'][$link_id];
478 
479  // handle internal links
480  if($_POST['tar_'.$link_id.'_ajax_type'] &&
481  $_POST['tar_'.$link_id.'_ajax_id'])
482  {
483  $data['tar'] = $_POST['links'][$link_id]['tar'] =
484  $_POST['tar_'.$link_id.'_ajax_type'].'|'.
485  $_POST['tar_'.$link_id.'_ajax_id'];
486  }
487 
488 
489  if(!strlen($data['tit']))
490  {
491  $invalid[] = $link_id;
492  continue;
493  }
494  if(!strlen($data['tar']))
495  {
496  $invalid[] = $link_id;
497  continue;
498  }
499  if($data['nam'] and !$data['val'])
500  {
501  $invalid[] = $link_id;
502  continue;
503  }
504  if(!$data['nam'] and $data['val'])
505  {
506  $invalid[] = $link_id;
507  continue;
508  }
509  }
510 
511  if(count($invalid))
512  {
513  ilUtil::sendFailure($this->lng->txt('err_check_input'));
514  $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.webr_manage.html','Modules/WebResource');
515 
516  include_once './Modules/WebResource/classes/class.ilWebResourceEditableLinkTableGUI.php';
517  $table = new ilWebResourceEditableLinkTableGUI($this,'view');
518  $table->setInvalidLinks($invalid);
519  $table->parseSelectedLinks($_POST['ids']);
520  $table->updateFromPost();
521  $this->tpl->setVariable('TABLE_LINKS',$table->getHTML());
522  return false;
523  }
524 
525  include_once './Modules/WebResource/classes/class.ilLinkResourceItems.php';
526  $links = new ilLinkResourceItems($this->object->getId());
527 
528  // Save Settings
529  foreach($_POST['ids'] as $link_id)
530  {
531  $data = $_POST['links'][$link_id];
532 
533  $orig = ilLinkResourceItems::lookupItem($this->object->getId(),$link_id);
534 
535  $links->setLinkId($link_id);
536  $links->setTitle(ilUtil::stripSlashes($data['tit']));
537  $links->setDescription(ilUtil::stripSlashes($data['des']));
538  $links->setTarget(str_replace('"', '', ilUtil::stripSlashes($data['tar'])));
539  $links->setActiveStatus((int) $data['act']);
540  $links->setDisableCheckStatus((int) $data['che']);
541  $links->setLastCheckDate($orig['last_check']);
542  $links->setValidStatus((int) $data['vali']);
543  $links->update();
544 
545  if(strlen($data['nam']) and $data['val'])
546  {
547  $param = new ilParameterAppender($this->object->getId());
548  $param->setName(ilUtil::stripSlashes($data['nam']));
549  $param->setValue((int) $data['val']);
550  $param->add($link_id);
551  }
552 
553  if($this->isContainerMetaDataRequired())
554  {
555  $this->object->setTitle(ilUtil::stripSlashes($data['tit']));
556  $this->object->setDescription(ilUtil::stripSlashes($data['des']));
557  $this->object->update();
558  }
559 
560  // TODO: Dynamic parameters
561  }
562 
563  ilUtil::sendSuccess($this->lng->txt('settings_saved'),TRUE);
564  $ilCtrl->redirect($this,'view');
565  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_POST['username']
Definition: cron.php:12
global $ilCtrl
Definition: ilias.php:18
checkPermission($a_perm, $a_cmd="")
static lookupItem($a_webr_id, $a_link_id)
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
isContainerMetaDataRequired()
Check if a new container title is required Necessary if there is more than one link.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
Class ilObjLinkResourceGUI.
Class ilParameterAppender.
activateTabs($a_active_tab, $a_active_subtab='')
Activate tab and subtabs.
+ Here is the call graph for this function:

◆ view()

ilObjLinkResourceGUI::view ( )

View object.

Returns

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

References $_GET, $_REQUEST, $GLOBALS, $ilErr, ilContainerSortingSettings\_lookupSortMode(), ilObject2GUI\checkPermission(), manage(), showLinks(), sort(), and ilContainer\SORT_MANUAL.

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

877  {
878  global $ilErr, $ilTabs;
879 
880  $ilTabs->activateTab("id_content");
881 
882  $this->checkPermission('read');
883 
884  if (strtolower($_GET["baseClass"]) == "iladministrationgui")
885  {
886  parent::view();
887  return true;
888  }
889  else
890  {
891  switch((int) $_REQUEST['view_mode'])
892  {
893  case self::VIEW_MODE_MANAGE:
894  $this->manage();
895  break;
896 
897  case self::VIEW_MODE_SORT:
898  // #14638
899  include_once './Services/Container/classes/class.ilContainerSortingSettings.php';
901  {
902  $this->sort();
903  break;
904  }
905  // fallthrough
906 
907  default:
908  $this->showLinks();
909  break;
910  }
911  }
912  $GLOBALS['tpl']->setPermanentLink($this->object->getType(),$this->object->getRefId());
913  return true;
914  }
$_GET["client_id"]
showLinks()
Show all active links.
checkPermission($a_perm, $a_cmd="")
$GLOBALS['ct_recipient']
static _lookupSortMode($a_obj_id)
lookup sort mode
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ LINK_MOD_ADD

const ilObjLinkResourceGUI::LINK_MOD_ADD = 3

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

◆ LINK_MOD_CREATE

const ilObjLinkResourceGUI::LINK_MOD_CREATE = 1

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

◆ LINK_MOD_EDIT

const ilObjLinkResourceGUI::LINK_MOD_EDIT = 2

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

◆ VIEW_MODE_MANAGE

const ilObjLinkResourceGUI::VIEW_MODE_MANAGE = 2

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

◆ VIEW_MODE_SORT

const ilObjLinkResourceGUI::VIEW_MODE_SORT = 3

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

◆ VIEW_MODE_VIEW

const ilObjLinkResourceGUI::VIEW_MODE_VIEW = 1

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


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