ILIAS  release_4-4 Revision
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 ()
 
 __setLocator ()
 
 callDirectLink ()
 
 callLink ()
 
 _goto ($a_target, $a_additional=null)
 
- 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...
 

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

- 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...
 
- 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 1296 of file class.ilObjLinkResourceGUI.php.

Referenced by linkChecker(), and refreshLinkCheck().

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

◆ __prepareOutput()

ilObjLinkResourceGUI::__prepareOutput ( )

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

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

Referenced by executeCommand().

1434  {
1435  // output objects
1436  $this->tpl->addBlockFile("CONTENT", "content", "tpl.adm_content.html");
1437  $this->tpl->addBlockFile("STATUSLINE", "statusline", "tpl.statusline.html");
1438 
1439  // output locator
1440  $this->__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:

◆ __setLocator()

ilObjLinkResourceGUI::__setLocator ( )

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

References $_GET, $ilCtrl, ilObjectGUI\$lng, $row, ilObject2GUI\$tree, and ilUtil\getImagePath().

Referenced by __prepareOutput().

1453  {
1454  global $tree;
1455  global $lng, $ilCtrl;
1456 
1457  $this->tpl->addBlockFile("LOCATOR", "locator", "tpl.locator.html", "Services/Locator");
1458 
1459  $counter = 0;
1460 
1461  //$this->tpl->touchBlock('locator_separator');
1462  //$this->tpl->touchBlock('locator_item');
1463 
1464  foreach ($tree->getPathFull($this->object->getRefId()) as $key => $row)
1465  {
1466 
1467  //if ($row["child"] == $tree->getRootId())
1468  //{
1469  // continue;
1470  //}
1471 
1472  if($counter++)
1473  {
1474  $this->tpl->touchBlock('locator_separator_prefix');
1475  }
1476 
1477  if ($row["child"] > 0)
1478  {
1479  $this->tpl->setCurrentBlock("locator_img");
1480  $this->tpl->setVariable("IMG_SRC",
1481  ilUtil::getImagePath("icon_".$row["type"]."_s.png"));
1482  $this->tpl->setVariable("IMG_ALT",
1483  $lng->txt("obj_".$type));
1484  $this->tpl->parseCurrentBlock();
1485  }
1486 
1487  $this->tpl->setCurrentBlock("locator_item");
1488 
1489  if($row["type"] == 'webr')
1490  {
1491  $this->tpl->setVariable("ITEM",$this->object->getTitle());
1492  $this->tpl->setVariable("LINK_ITEM",$this->ctrl->getLinkTarget($this));
1493  }
1494  elseif ($row["child"] != $tree->getRootId())
1495  {
1496  $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $row["child"]);
1497  $this->tpl->setVariable("ITEM", $row["title"]);
1498  $this->tpl->setVariable("LINK_ITEM",
1499  $ilCtrl->getLinkTargetByClass("ilrepositorygui", ""));
1500  }
1501  else
1502  {
1503  $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $row["child"]);
1504  $this->tpl->setVariable("ITEM", $this->lng->txt("repository"));
1505  $this->tpl->setVariable("LINK_ITEM",
1506  $ilCtrl->getLinkTargetByClass("ilrepositorygui", ""));
1507  }
1508  $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $_GET["ref_id"]);
1509 
1510  $this->tpl->parseCurrentBlock();
1511  }
1512 
1513  $this->tpl->setVariable("TXT_LOCATOR",$this->lng->txt("locator"));
1514  $this->tpl->parseCurrentBlock();
1515  }
$_GET["client_id"]
global $ilCtrl
Definition: ilias.php:18
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _goto()

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

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

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

1615  {
1616  global $ilAccess, $ilErr, $lng;
1617 
1618  if($a_additional && substr($a_additional, -3) == "wsp")
1619  {
1620  $_GET["baseClass"] = "ilsharedresourceGUI";
1621  $_GET["wsp_id"] = $a_target;
1622  include("ilias.php");
1623  exit;
1624  }
1625 
1626  // Will be replaced in future releases by ilAccess::checkAccess()
1627  if ($ilAccess->checkAccess("read", "", $a_target))
1628  {
1629  ilUtil::redirect("ilias.php?baseClass=ilLinkResourceHandlerGUI&ref_id=$a_target");
1630  }
1631  else
1632  {
1633  // to do: force flat view
1634  if ($ilAccess->checkAccess("visible", "", $a_target))
1635  {
1636  ilUtil::redirect("ilias.php?baseClass=ilLinkResourceHandlerGUI&ref_id=".$a_target."&cmd=infoScreen");
1637  }
1638  else
1639  {
1640  if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID))
1641  {
1642  ilUtil::sendFailure(sprintf($lng->txt("msg_no_perm_read_item"),
1643  ilObject::_lookupTitle(ilObject::_lookupObjId($a_target))), true);
1645  }
1646  }
1647  }
1648 
1649  $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);
1650  }
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 1315 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().

1316  {
1317  global $ilCtrl, $ilTabs, $lng;
1318 
1319  switch($a_active_tab)
1320  {
1321  case 'content':
1322  if($this->checkPermissionBool('write'))
1323  {
1324  $this->lng->loadLanguageModule('cntr');
1325 
1326  $this->ctrl->setParameter($this,'switch_mode',self::VIEW_MODE_VIEW);
1327  $ilTabs->addSubTab('id_content_view',
1328  $lng->txt('view'),
1329  $this->ctrl->getLinkTarget($this,'switchViewMode')
1330  );
1331  $this->ctrl->setParameter($this,'switch_mode',self::VIEW_MODE_MANAGE);
1332  $ilTabs->addSubTab('id_content_manage',
1333  $lng->txt('cntr_manage'),
1334  $this->ctrl->getLinkTarget($this,'switchViewMode')
1335  );
1336  include_once './Modules/WebResource/classes/class.ilLinkResourceItems.php';
1337  include_once './Services/Container/classes/class.ilContainerSortingSettings.php';
1338  include_once './Services/Container/classes/class.ilContainer.php';
1339  if((ilLinkResourceItems::lookupNumberOfLinks($this->object->getId()) > 1)
1341  {
1342  $this->ctrl->setParameter($this,'switch_mode',self::VIEW_MODE_SORT);
1343  $ilTabs->addSubTab('id_content_ordering',
1344  $this->lng->txt('cntr_ordering'),
1345  $this->ctrl->getLinkTarget($this,'switchViewMode')
1346  );
1347  }
1348 
1349  $ilCtrl->clearParameters($this);
1350  $ilTabs->activateSubTab($a_active_subtab);
1351  }
1352  }
1353 
1354  $ilTabs->activateTab('id_content');
1355  }
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 357 of file class.ilObjLinkResourceGUI.php.

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

358  {
359  $this->checkPermission('write');
360  $this->activateTabs('content','id_content_view');
361 
362  $this->initFormLink(self::LINK_MOD_ADD);
363  $this->tpl->setContent($this->form->getHTML());
364  }
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:

◆ afterSave()

ilObjLinkResourceGUI::afterSave ( ilObject  $a_new_object)
protected

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

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

175  {
176  // Save link
177  $this->link->setLinkResourceId($a_new_object->getId());
178  $link_id = $this->link->add();
179  $this->link->updateValid(true);
180 
181  ilUtil::sendSuccess($this->lng->txt('webr_link_added'));
182 
183  // personal workspace
184  if($this->id_type == self::WORKSPACE_NODE_ID)
185  {
186  $this->ctrl->redirect($this, "editLinks");
187  }
188  // repository
189  else
190  {
191  ilUtil::redirect("ilias.php?baseClass=ilLinkResourceHandlerGUI&ref_id=".
192  $a_new_object->getRefId()."&cmd=switchViewMode&switch_mode=2");
193  }
194  }
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 ( )

#15647 - handle internal links

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

References ilObjectGUI\$obj_id, ilParameterAppender\_append(), ilLinkResourceItems\_getFirstLink(), ilLink\_getStaticLink(), ilParameterAppender\_isEnabled(), ilLinkResourceItems\_isSingular(), ilLinkInputGUI\isInternalLink(), and redirectToLink().

1518  {
1519  $obj_id = $this->object->getId();
1520 
1521 
1522  include_once("./Services/Link/classes/class.ilLink.php");
1523  include_once './Modules/WebResource/classes/class.ilLinkResourceItems.php';
1525  {
1527 
1529  include_once "Services/Form/classes/class.ilFormPropertyGUI.php";
1530  include_once "Services/Form/classes/class.ilLinkInputGUI.php";
1531  if(ilLinkInputGUI::isInternalLink($url["target"]))
1532  {
1533  // #10612
1534  $parts = explode("|", $url["target"]);
1535  if ($parts[0] == "page")
1536  {
1537  $parts[0] = "pg";
1538  }
1539  if ($parts[0] == "term")
1540  {
1541  $parts[0] = "git";
1542  }
1543  $url["target"] = ilLink::_getStaticLink($parts[1], $parts[0]);
1544  }
1545 
1546  include_once './Modules/WebResource/classes/class.ilParameterAppender.php';
1548  {
1549  $url = ilParameterAppender::_append($url);
1550  }
1551 
1552  $this->redirectToLink($this->ref_id, $obj_id, $url["target"]);
1553  }
1554  }
static _isSingular($a_webr_id)
Check whether there is only one active link in the web resource.
static _append($a_link_data)
static isInternalLink($a_value)
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 1556 of file class.ilObjLinkResourceGUI.php.

References $_REQUEST, ilObjectGUI\$obj_id, ilParameterAppender\_append(), ilLink\_getStaticLink(), ilParameterAppender\_isEnabled(), ilLinkInputGUI\isInternalLink(), and redirectToLink().

1557  {
1558  if($_REQUEST["link_id"])
1559  {
1560  $obj_id = $this->object->getId();
1561 
1562  include_once './Modules/WebResource/classes/class.ilLinkResourceItems.php';
1563  $items = new ilLinkResourceItems($obj_id);
1564  $item = $items->getItem($_REQUEST["link_id"]);
1565  if($item["target"])
1566  {
1567  // #15647 - handle internal links
1568  include_once "Services/Form/classes/class.ilFormPropertyGUI.php";
1569  include_once "Services/Form/classes/class.ilLinkInputGUI.php";
1570  if(ilLinkInputGUI::isInternalLink($item["target"]))
1571  {
1572  $parts = explode("|", $item["target"]);
1573  if ($parts[0] == "page")
1574  {
1575  $parts[0] = "pg";
1576  }
1577  include_once("./Services/Link/classes/class.ilLink.php");
1578  $item["target"] = ilLink::_getStaticLink($parts[1], $parts[0]);
1579  if ($parts[0] == "term")
1580  {
1581  $parts[0] = "git";
1582  $item["target"] =
1584  $parts[0],
1585  true,
1586  "&target=git_".$parts[1]);
1587  }
1588  }
1589  include_once './Modules/WebResource/classes/class.ilParameterAppender.php';
1591  {
1592  $item = ilParameterAppender::_append($item);
1593  }
1594 //var_dump($item); exit;
1595  $this->redirectToLink($this->ref_id, $obj_id, $item["target"]);
1596  }
1597  }
1598  }
static _append($a_link_data)
static isInternalLink($a_value)
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 602 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().

603  {
604  $valid = $this->form->checkInput();
605 
606  include_once './Modules/WebResource/classes/class.ilLinkResourceItems.php';
607  $this->link = new ilLinkResourceItems($a_webr_id);
608  $this->link->setTarget(str_replace('"', '', ilUtil::stripSlashes($this->form->getInput('tar'))));
609  $this->link->setTitle($this->form->getInput('tit'));
610  $this->link->setDescription($this->form->getInput('des'));
611  $this->link->setDisableCheckStatus($this->form->getInput('che'));
612 
613  if($a_mode == self::LINK_MOD_CREATE)
614  {
615  $this->link->setActiveStatus(true);
616  }
617  else
618  {
619  $this->link->setActiveStatus($this->form->getInput('act'));
620  }
621 
622  if($a_mode == self::LINK_MOD_EDIT)
623  {
624  $this->link->setValidStatus($this->form->getInput('vali'));
625  }
626  else
627  {
628  $this->link->setValidStatus(true);
629  }
630 
632  {
633  return $valid;
634  }
635 
636  $this->dynamic = new ilParameterAppender($a_webr_id);
637  $this->dynamic->setName($this->form->getInput('nam'));
638  $this->dynamic->setValue($this->form->getInput('val'));
639  if(!$this->dynamic->validate())
640  {
641  switch($this->dynamic->getErrorCode())
642  {
643  case LINKS_ERR_NO_NAME:
644  $this->form->getItemByPostVar('nam')->setAlert($this->lng->txt('links_no_name_given'));
645  return false;
646 
647  case LINKS_ERR_NO_VALUE:
648  $this->form->getItemByPostVar('val')->setAlert($this->lng->txt('links_no_value_given'));
649  return false;
650 
652  // Nothing entered => no error
653  return $valid;
654  }
655  $this->dynamic = null;
656  }
657  return $valid;
658  }
$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 1015 of file class.ilObjLinkResourceGUI.php.

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

1016  {
1017  $this->checkPermission('write');
1018  $this->activateTabs('content','id_content_view');
1019 
1020  $link_ids = array();
1021 
1022  if(is_array($_POST['link_ids']))
1023  {
1024  $link_ids =$_POST['link_ids'];
1025  }
1026  elseif(isset($_GET['link_id']))
1027  {
1028  $link_ids = array($_GET['link_id']);
1029  }
1030 
1031  if(!count($link_ids) > 0)
1032  {
1033  ilUtil::sendFailure($this->lng->txt('select_one'));
1034  $this->view();
1035  return false;
1036  }
1037 
1038  include_once './Modules/WebResource/classes/class.ilLinkResourceItems.php';
1039  $links = new ilLinkResourceItems($this->object->getId());
1040 
1041  include_once 'Services/Utilities/classes/class.ilConfirmationGUI.php';
1042  $confirm = new ilConfirmationGUI();
1043  $confirm->setFormAction($this->ctrl->getFormAction($this,'view'));
1044  $confirm->setHeaderText($this->lng->txt('webr_sure_delete_items'));
1045  $confirm->setConfirm($this->lng->txt('delete'), 'deleteLinks');
1046  $confirm->setCancel($this->lng->txt('cancel'), 'view');
1047 
1048  foreach($link_ids as $link_id)
1049  {
1050  $link = $links->getItem($link_id);
1051  $confirm->addItem('link_ids[]', $link_id,$link['title']);
1052  }
1053  $this->tpl->setContent($confirm->getHTML());
1054  }
$_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 1081 of file class.ilObjLinkResourceGUI.php.

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

1082  {
1083  global $ilCtrl;
1084 
1085  $this->checkPermission('write');
1086 
1087  include_once './Modules/WebResource/classes/class.ilLinkResourceItems.php';
1088  $links = new ilLinkResourceItems($this->object->getId());
1089 
1090  if(!$_GET['link_id'])
1091  {
1092  ilUtil::sendFailure($this->lng->txt('select_one'),true);
1093  $ilCtrl->redirect($this,'view');
1094  }
1095 
1096  $links->setLinkId((int) $_GET['link_id']);
1097  $links->updateActive(false);
1098 
1099  ilUtil::sendSuccess($this->lng->txt('webr_inactive_success'),true);
1100  $ilCtrl->redirect($this,'view');
1101  }
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 1060 of file class.ilObjLinkResourceGUI.php.

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

1061  {
1062  global $ilCtrl;
1063 
1064  $this->checkPermission('write');
1065 
1066  include_once './Modules/WebResource/classes/class.ilLinkResourceItems.php';
1067  $links = new ilLinkResourceItems($this->object->getId());
1068 
1069  foreach($_POST['link_ids'] as $link_id)
1070  {
1071  $links->delete($link_id);
1072  }
1073  ilUtil::sendSuccess($this->lng->txt('webr_deleted_items'),true);
1074  $ilCtrl->redirect($this,'view');
1075  }
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 411 of file class.ilObjLinkResourceGUI.php.

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

412  {
413  global $ilCtrl;
414 
415  $this->checkPermission('write');
416 
417  $this->ctrl->setParameter($this,'link_id',(int) $_GET['link_id']);
418 
419  if(!isset($_GET['param_id']))
420  {
421  ilUtil::sendFailure($this->lng->txt('select_one'),TRUE);
422  $ilCtrl->redirect($this,'view');
423  }
424 
425  include_once './Modules/WebResource/classes/class.ilParameterAppender.php';
426  $param = new ilParameterAppender($this->object->getId());
427  $param->delete((int) $_GET['param_id']);
428 
429  ilUtil::sendSuccess($this->lng->txt('links_parameter_deleted'),true);
430  $ilCtrl->redirect($this,'editLinks');
431  }
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 433 of file class.ilObjLinkResourceGUI.php.

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

434  {
435  global $ilCtrl;
436 
437  $this->checkPermission('write');
438 
439  if(!isset($_GET['param_id']))
440  {
441  ilUtil::sendFailure($this->lng->txt('select_one'),TRUE);
442  $ilCtrl->redirect($this,'view');
443  }
444 
445  include_once './Modules/WebResource/classes/class.ilParameterAppender.php';
446  $param = new ilParameterAppender($this->object->getId());
447  $param->delete((int) $_GET['param_id']);
448 
449  ilUtil::sendSuccess($this->lng->txt('links_parameter_deleted'),true);
450  $ilCtrl->redirect($this,'view');
451 
452  }
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 302 of file class.ilObjLinkResourceGUI.php.

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

303  {
304  global $ilCtrl;
305 
306  $this->checkPermission('write');
307  $this->activateTabs('content','id_content_view');
308 
309  if(!(int) $_GET['link_id'])
310  {
311  ilUtil::sendFailure($this->lng->txt('select_one'),true);
312  $ilCtrl->redirect($this,'view');
313  }
314 
315  $this->initFormLink(self::LINK_MOD_EDIT);
316  $this->setValuesFromLink((int) $_GET['link_id']);
317  $this->tpl->setContent($this->form->getHTML());
318  }
$_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 864 of file class.ilObjLinkResourceGUI.php.

References $_GET, and switchViewMode().

865  {
866  $_GET['switch_mode'] = self::VIEW_MODE_MANAGE;
867  $this->switchViewMode();
868  }
$_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->infoScreenForward(); // forwards command
59  break;
60 
61  case 'ilmdeditorgui':
62  if(!$ilAccess->checkAccess('write','',$this->object->getRefId()))
63  {
64  $ilErr->raiseError($this->lng->txt('permission_denied'),$ilErr->WARNING);
65  }
66 
67  $this->prepareOutput();
68  $ilTabs->activateTab('id_meta_data');
69  include_once 'Services/MetaData/classes/class.ilMDEditorGUI.php';
70  $md_gui =& new ilMDEditorGUI($this->object->getId(), 0, $this->object->getType());
71  $md_gui->addObserver($this->object,'MDUpdateListener','General');
72  $this->ctrl->forwardCommand($md_gui);
73  break;
74 
75  case 'ilpermissiongui':
76  $this->prepareOutput();
77  $ilTabs->activateTab('id_permissions');
78  include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
79  $perm_gui =& new ilPermissionGUI($this);
80  $ret =& $this->ctrl->forwardCommand($perm_gui);
81  break;
82 
83  case 'ilobjectcopygui':
84  $this->prepareOutput();
85  include_once './Services/Object/classes/class.ilObjectCopyGUI.php';
86  $cp = new ilObjectCopyGUI($this);
87  $cp->setType('webr');
88  $this->ctrl->forwardCommand($cp);
89  break;
90 
91  case 'ilexportgui':
92  $this->prepareOutput();
93  $this->tabs_gui->setTabActive('export');
94  include_once './Services/Export/classes/class.ilExportGUI.php';
95  $exp = new ilExportGUI($this);
96  $exp->addFormat('xml');
97  $this->ctrl->forwardCommand($exp);
98  break;
99 
100  case "ilcommonactiondispatchergui":
101  include_once("Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
103  $this->ctrl->forwardCommand($gui);
104  break;
105 
106  case "ilpropertyformgui":
107  include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
108  $this->initFormLink(self::LINK_MOD_EDIT);
109  $this->ctrl->forwardCommand($this->form);
110  break;
111 
112  case "ilinternallinkgui":
113  $this->lng->loadLanguageModule("content");
114  require_once("./Modules/LearningModule/classes/class.ilInternalLinkGUI.php");
115  $link_gui = new ilInternalLinkGUI("RepositoryItem", 0);
116  $link_gui->filterLinkType("PageObject");
117  $link_gui->filterLinkType("GlossaryItem");
118  $link_gui->filterLinkType("RepositoryItem");
119  $link_gui->setFilterWhiteList(true);
120  $link_gui->setMode("asynch");
121  $ilCtrl->forwardCommand($link_gui);
122  break;
123 
124  default:
125  if(!$cmd)
126  {
127  $this->ctrl->setCmd("view");
128  }
129  parent::executeCommand();
130  }
131 
132  if(!$this->getCreationMode())
133  {
134  // Fill meta header tags
135  include_once('Services/MetaData/classes/class.ilMDUtils.php');
136  ilMDUtils::_fillHTMLMetaTags($this->object->getId(),$this->object->getId(),'webr');
137 
138  $this->addHeaderAction();
139  }
140  return true;
141  }
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 1171 of file class.ilObjLinkResourceGUI.php.

References ilObjectGUI\$actions, and $row.

1172  {
1173  $this->object->items_obj->readItem($row['page_id']);
1174  $row['title'] = $this->object->items_obj->getTitle();
1175 
1176  require_once 'Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php';
1178  $actions->setSelectionHeaderClass('small');
1179  $actions->setItemLinkClass('xsmall');
1180  $actions->setListTitle($this->lng->txt('actions'));
1181  $actions->setId($row['page_id']);
1182  $this->ctrl->setParameter($this, 'link_id', $row['page_id']);
1183  $actions->addItem(
1184  $this->lng->txt('edit'),
1185  '',
1186  $this->ctrl->getLinkTarget($this, 'editLink')
1187  );
1188  $this->ctrl->clearParameters($this);
1189  $row['action_html'] = $actions->getHTML();
1190 
1191  return $row;
1192  }
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  }

◆ history()

ilObjLinkResourceGUI::history ( )

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

References $_GET, ilObject2GUI\checkPermission(), and ilHistoryGUI\getHistoryTable().

1145  {
1146  global $ilTabs;
1147 
1148  $this->checkPermission('write');
1149  $ilTabs->activateTab('id_history');
1150 
1151  include_once("./Services/History/classes/class.ilHistoryGUI.php");
1152 
1153  $hist_gui =& new ilHistoryGUI($this->object->getId());
1154 
1155  $hist_html = $hist_gui->getHistoryTable(array("ref_id" => $_GET["ref_id"],
1156  "cmd" => "history",
1157  "cmdClass" =>$_GET["cmdClass"],
1158  "cmdNode" =>$_GET["cmdNode"]));
1159 
1160  $this->tpl->setVariable("ADM_CONTENT", $hist_html);
1161  }
$_GET["client_id"]
checkPermission($a_perm, $a_cmd="")
This class provides user interface methods for history entries.
getHistoryTable($a_header_params, $a_user_comment=false)
get history table
+ 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 1109 of file class.ilObjLinkResourceGUI.php.

References infoScreenForward().

1110  {
1111  $this->ctrl->setCmd("showSummary");
1112  $this->ctrl->setCmdClass("ilinfoscreengui");
1113  $this->infoScreenForward();
1114  }
infoScreenForward()
show information screen
+ Here is the call graph for this function:

◆ infoScreenForward()

ilObjLinkResourceGUI::infoScreenForward ( )

show information screen

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

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

Referenced by executeCommand(), and infoScreen().

1120  {
1121  global $ilTabs;
1122 
1123  $this->checkPermission('visible');
1124  $ilTabs->activateTab('id_info');
1125 
1126  include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
1127  $info = new ilInfoScreenGUI($this);
1128 
1129  $info->enablePrivateNotes();
1130 
1131  // standard meta data
1132  $info->addMetaDataSections($this->object->getId(),0, $this->object->getType());
1133 
1134  if($this->id_type == self::WORKSPACE_NODE_ID)
1135  {
1136  $info->addProperty($this->lng->txt("perma_link"), $this->getPermanentLinkWidget());
1137  }
1138 
1139  // forward the command
1140  $this->ctrl->forwardCommand($info);
1141  }
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 143 of file class.ilObjLinkResourceGUI.php.

References initFormLink().

144  {
145  $this->initFormLink(self::LINK_MOD_CREATE);
146  return $this->form;
147  }
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 666 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().

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

250  {
251  include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
252  $this->form = new ilPropertyFormGUI();
253  $this->form->setFormAction($this->ctrl->getFormAction($this,'saveSettings'));
254  $this->form->setTitle($this->lng->txt('webr_edit_settings'));
255 
256  // Title
257  $tit = new ilTextInputGUI($this->lng->txt('webr_list_title'),'tit');
258  $tit->setValue($this->object->getTitle());
259  $tit->setRequired(true);
260  $tit->setSize(40);
261  $tit->setMaxLength(127);
262  $this->form->addItem($tit);
263 
264  // Description
265  $des = new ilTextAreaInputGUI($this->lng->txt('webr_list_desc'),'des');
266  $des->setValue($this->object->getDescription());
267  $des->setCols(40);
268  $des->setRows(3);
269  $this->form->addItem($des);
270 
271  // Sorting
272  include_once './Services/Container/classes/class.ilContainerSortingSettings.php';
273  include_once './Services/Container/classes/class.ilContainer.php';
274 
275  $sor = new ilRadioGroupInputGUI($this->lng->txt('webr_sorting'),'sor');
276  $sor->setRequired(true);
277  include_once './Services/Container/classes/class.ilContainerSortingSettings.php';
278  $sor->setValue(ilContainerSortingSettings::_lookupSortMode($this->object->getId()));
279 
280  $opt = new ilRadioOption(
281  $this->lng->txt('webr_sort_title'),
283  );
284  $sor->addOption($opt);
285 
286  $opm = new ilRadioOption(
287  $this->lng->txt('webr_sort_manual'),
289  );
290  $sor->addOption($opm);
291  $this->form->addItem($sor);
292 
293  $this->form->addCommandButton('saveSettings', $this->lng->txt('save'));
294  $this->form->addCommandButton('view', $this->lng->txt('cancel'));
295  }
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 842 of file class.ilObjLinkResourceGUI.php.

References ilLinkResourceItems\lookupNumberOfLinks().

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

843  {
844  include_once './Modules/WebResource/classes/class.ilLinkResourceItems.php';
845  return ilLinkResourceItems::lookupNumberOfLinks($this->object->getId()) == 1;
846  }
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 1198 of file class.ilObjLinkResourceGUI.php.

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

Referenced by refreshLinkCheck(), and saveLinkCheck().

1199  {
1200  global $ilias, $ilUser, $tpl, $ilTabs;
1201 
1202  $this->checkPermission('write');
1203  $ilTabs->activateTab('id_link_check');
1204 
1205  $this->__initLinkChecker();
1206  $this->object->initLinkResourceItemsObject();
1207 
1208  require_once './Services/LinkChecker/classes/class.ilLinkCheckerTableGUI.php';
1209 
1210  $toolbar = new ilToolbarGUI();
1211 
1212  if((bool)$ilias->getSetting('cron_web_resource_check'))
1213  {
1214  include_once './Services/LinkChecker/classes/class.ilLinkCheckNotify.php';
1215  include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
1216 
1217  $chb = new ilCheckboxInputGUI($this->lng->txt('link_check_message_a'), 'link_check_message');
1218  $chb->setValue(1);
1219  $chb->setChecked((bool)ilLinkCheckNotify::_getNotifyStatus($ilUser->getId(), $this->object->getId()));
1220  $chb->setOptionTitle($this->lng->txt('link_check_message_b'));
1221 
1222  $toolbar->addInputItem($chb);
1223  $toolbar->addFormButton($this->lng->txt('save'), 'saveLinkCheck');
1224  $toolbar->setFormAction($this->ctrl->getLinkTarget($this, 'saveLinkCheck'));
1225  }
1226 
1227  $tgui = new ilLinkCheckerTableGUI($this, 'linkChecker');
1228  $tgui->setLinkChecker($this->link_checker_obj)
1229  ->setRowHandler($this)
1230  ->setRefreshButton($this->lng->txt('refresh'), 'refreshLinkCheck');
1231 
1232  return $tpl->setContent($tgui->prepareHTML()->getHTML().$toolbar->getHTML());
1233  }
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 913 of file class.ilObjLinkResourceGUI.php.

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

Referenced by view().

914  {
915  $this->checkPermission('write');
916  $this->activateTabs('content','id_content_manage');
917 
918  $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.webr_manage.html','Modules/WebResource');
919  $this->showToolbar('ACTION_BUTTONS');
920 
921  include_once './Modules/WebResource/classes/class.ilWebResourceEditableLinkTableGUI.php';
922  $table = new ilWebResourceEditableLinkTableGUI($this,'view');
923  $table->parse();
924 
925  include_once './Modules/LearningModule/classes/class.ilInternalLinkGUI.php';
927 
928  $this->tpl->addJavaScript("Modules/WebResource/js/intLink.js");
929  $this->tpl->addJavascript("Services/Form/js/Form.js");
930 
931  $this->tpl->setVariable('TABLE_LINKS',$table->getHTML().$js);
932  }
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 1600 of file class.ilObjLinkResourceGUI.php.

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

Referenced by callDirectLink(), and callLink().

1601  {
1602  global $ilUser;
1603 
1604  if($a_url)
1605  {
1606  require_once('Services/Tracking/classes/class.ilChangeEvent.php');
1607  ilChangeEvent::_recordReadEvent("webr", $a_ref_id, $a_obj_id,
1608  $ilUser->getId());
1609 
1610  ilUtil::redirect($a_url);
1611  }
1612  }
_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 1262 of file class.ilObjLinkResourceGUI.php.

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

1263  {
1264  $this->__initLinkChecker();
1265 
1266  if(!$this->link_checker_obj->checkPear())
1267  {
1268  ilUtil::sendFailure($this->lng->txt('missing_pear_library'));
1269  $this->linkChecker();
1270 
1271  return false;
1272  }
1273 
1274 
1275  $this->object->initLinkResourceItemsObject();
1276 
1277  // Set all link to valid. After check invalid links will be set to invalid
1278  $this->object->items_obj->updateValidByCheck();
1279 
1280  foreach($this->link_checker_obj->checkWebResourceLinks() as $invalid)
1281  {
1282  $this->object->items_obj->readItem($invalid['page_id']);
1283  $this->object->items_obj->setActiveStatus(false);
1284  $this->object->items_obj->setValidStatus(false);
1285  $this->object->items_obj->update(false);
1286  }
1287 
1288  $this->object->items_obj->updateLastCheck();
1289  ilUtil::sendSuccess($this->lng->txt('link_checker_refreshed'));
1290 
1291  $this->linkChecker();
1292 
1293  return true;
1294  }
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 153 of file class.ilObjLinkResourceGUI.php.

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

154  {
155  global $ilCtrl;
156 
157  $this->initFormLink(self::LINK_MOD_CREATE);
158  if($this->checkLinkInput(self::LINK_MOD_CREATE,0,0))
159  {
160  // Save new object
161  $_POST['title'] = $_POST['tit'];
162  $_POST['desc'] = $_POST['des'];
163  parent::save();
164  }
165  else
166  {
167  // Data incomplete or invalid
168  ilUtil::sendFailure($this->lng->txt('err_check_input'));
169  $this->form->setValuesByPost();
170  $this->tpl->setContent($this->form->getHTML());
171  }
172  }
$_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 370 of file class.ilObjLinkResourceGUI.php.

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

371  {
372  global $ilCtrl;
373 
374  $this->checkPermission('write');
375 
376  $this->initFormLink(self::LINK_MOD_ADD);
377  if($this->checkLinkInput(self::LINK_MOD_ADD,$this->object->getId(),0))
378  {
379  if($this->isContainerMetaDataRequired())
380  {
381  // Save list data
382  $this->object->setTitle($this->form->getInput('lti'));
383  $this->object->setDescription($this->form->getInput('tde'));
384  $this->object->update();
385  }
386 
387  // Save Link
388  $link_id = $this->link->add();
389  $this->link->updateValid(true);
390 
391  // Dynamic parameters
392  if(ilParameterAppender::_isEnabled() and is_object($this->dynamic))
393  {
394  $this->dynamic->add($link_id);
395  }
396  ilUtil::sendSuccess($this->lng->txt('webr_link_added'),true);
397  $ilCtrl->redirect($this,'view');
398  }
399  // Error handling
400  ilUtil::sendFailure($this->lng->txt('err_check_input'));
401  $this->form->setValuesByPost();
402 
403  $this->activateTabs('content','id_content_view');
404  $this->tpl->setContent($this->form->getHTML());
405  }
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 1235 of file class.ilObjLinkResourceGUI.php.

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

1236  {
1237  global $ilDB,$ilUser;
1238 
1239  include_once './Services/LinkChecker/classes/class.ilLinkCheckNotify.php';
1240 
1241  $link_check_notify =& new ilLinkCheckNotify($ilDB);
1242  $link_check_notify->setUserId($ilUser->getId());
1243  $link_check_notify->setObjId($this->object->getId());
1244 
1245  if($_POST['link_check_message'])
1246  {
1247  ilUtil::sendSuccess($this->lng->txt('link_check_message_enabled'));
1248  $link_check_notify->addNotifier();
1249  }
1250  else
1251  {
1252  ilUtil::sendSuccess($this->lng->txt('link_check_message_disabled'));
1253  $link_check_notify->deleteNotifier();
1254  }
1255  $this->linkChecker();
1256 
1257  return true;
1258  }
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
+ Here is the call graph for this function:

◆ saveSettings()

ilObjLinkResourceGUI::saveSettings ( )
protected

Save container settings.

Returns

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

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

217  {
218  global $ilTabs;
219 
220  $this->checkPermission('write');
221  $ilTabs->activateTab('id_settings');
222 
223  $this->initFormSettings();
224  if($this->form->checkInput())
225  {
226  $this->object->setTitle($this->form->getInput('tit'));
227  $this->object->setDescription($this->form->getInput('des'));
228  $this->object->update();
229 
230  include_once './Services/Container/classes/class.ilContainerSortingSettings.php';
231  $sort = new ilContainerSortingSettings($this->object->getId());
232  $sort->setSortMode($this->form->getInput('sor'));
233  $sort->update();
234 
235  ilUtil::sendSuccess($this->lng->txt('settings_saved'),true);
236  $this->ctrl->redirect($this,'settings');
237  }
238 
239  $this->form->setValuesByPost();
240  ilUtil::sendFailure($this->lng->txt('err_check_input'));
241  $this->tpl->setContent($this->form->getHTML());
242  }
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 974 of file class.ilObjLinkResourceGUI.php.

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

975  {
976  $this->checkPermission('write');
977 
978  include_once './Services/Container/classes/class.ilContainerSorting.php';
979  $sort = ilContainerSorting::_getInstance($this->object->getId());
980  $sort->savePost((array) $_POST['position']);
981 
982  ilUtil::sendSuccess($this->lng->txt('settings_saved'),true);
983  $this->view();
984  }
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 1362 of file class.ilObjLinkResourceGUI.php.

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

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

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

202  {
203  global $ilTabs;
204 
205  $this->checkPermission('write');
206  $ilTabs->activateTab('id_settings');
207 
208  $this->initFormSettings();
209  $this->tpl->setContent($this->form->getHTML());
210  }
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 571 of file class.ilObjLinkResourceGUI.php.

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

Referenced by editLink().

572  {
573  include_once './Modules/WebResource/classes/class.ilLinkResourceItems.php';
574  $link = new ilLinkResourceItems($this->object->getId());
575 
576  $values = $link->getItem($a_link_id);
577 
579  {
580  }
581 
582  $this->form->setValuesByArray(
583  array(
584  'tit' => $values['title'],
585  'tar' => $values['target'],
586  'des' => $values['description'],
587  'act' => (int) $values['active'],
588  'che' => (int) $values['disable_check'],
589  'vali' => (int) $values['valid']
590  )
591  );
592  }
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 938 of file class.ilObjLinkResourceGUI.php.

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

Referenced by view().

939  {
940  $this->checkPermission('read');
941  $this->activateTabs('content','id_content_view');
942 
943  include_once './Modules/WebResource/classes/class.ilWebResourceLinkTableGUI.php';
944  $table = new ilWebResourceLinkTableGUI($this,'showLinks');
945  $table->parse();
946 
947  $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.webr_view.html','Modules/WebResource');
948  $this->showToolbar('ACTION_BUTTONS');
949  $this->tpl->setVariable('LINK_TABLE',$table->getHTML());
950  }
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 992 of file class.ilObjLinkResourceGUI.php.

References ilObject2GUI\checkPermissionBool().

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

993  {
994  if(!$this->checkPermissionBool('write'))
995  {
996  return;
997  }
998 
999  include_once './Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php';
1000  $tool = new ilToolbarGUI();
1001  $tool->setFormAction($this->ctrl->getFormAction($this));
1002  $tool->addButton(
1003  $this->lng->txt('webr_add'),
1004  $this->ctrl->getLinkTarget($this,'addLink')
1005  );
1006 
1007  $this->tpl->setVariable($a_tpl_var,$tool->getHTML());
1008  return;
1009  }
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 956 of file class.ilObjLinkResourceGUI.php.

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

Referenced by view().

957  {
958  $this->checkPermission('write');
959  $this->activateTabs('content','id_content_ordering');
960 
961  include_once './Modules/WebResource/classes/class.ilWebResourceLinkTableGUI.php';
962  $table = new ilWebResourceLinkTableGUI($this,'sort',true);
963  $table->parse();
964 
965  $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.webr_view.html','Modules/WebResource');
966  $this->showToolbar('ACTION_BUTTONS');
967  $this->tpl->setVariable('LINK_TABLE',$table->getHTML());
968  }
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 852 of file class.ilObjLinkResourceGUI.php.

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

Referenced by editLinks().

853  {
854  global $ilCtrl;
855 
856  $_REQUEST['view_mode'] = $_GET['view_mode'] = (int) $_GET['switch_mode'];
857  $this->view();
858  }
$_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 324 of file class.ilObjLinkResourceGUI.php.

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

325  {
326  global $ilCtrl;
327 
328  $this->initFormLink(self::LINK_MOD_EDIT);
329  if($this->checkLinkInput(self::LINK_MOD_EDIT,$this->object->getId(),(int) $_REQUEST['link_id']))
330  {
331  $this->link->setLinkId((int) $_REQUEST['link_id']);
332  $this->link->update();
333  if(ilParameterAppender::_isEnabled() and is_object($this->dynamic))
334  {
335  $this->dynamic->add((int) $_REQUEST['link_id']);
336  }
337 
338  if($this->isContainerMetaDataRequired())
339  {
340  $this->object->setTitle($this->form->getInput('tit'));
341  $this->object->setDescription($this->form->getInput('des'));
342  $this->object->update();
343  }
344 
345  ilUtil::sendSuccess($this->lng->txt('settings_saved'),true);
346  $ilCtrl->redirect($this,'view');
347  }
348  ilUtil::sendFailure($this->lng->txt('err_check_input'));
349  $this->form->setValuesByPost();
350  $this->tpl->setContent($this->form->getHTML());
351  }
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 459 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().

460  {
461  global $ilCtrl;
462 
463  $this->checkPermission('write');
464  $this->activateTabs('content','');
465 
466  if(!is_array($_POST['ids']))
467  {
468  ilUtil::sendFailure($this->lng->txt('select_one'),TRUE);
469  $ilCtrl->redirect($this,'view');
470  }
471 
472  // Validate
473  $invalid = array();
474  foreach($_POST['ids'] as $link_id)
475  {
476  $data = $_POST['links'][$link_id];
477 
478  // handle internal links
479  if($_POST['tar_'.$link_id.'_ajax_type'] &&
480  $_POST['tar_'.$link_id.'_ajax_id'])
481  {
482  $data['tar'] = $_POST['links'][$link_id]['tar'] =
483  $_POST['tar_'.$link_id.'_ajax_type'].'|'.
484  $_POST['tar_'.$link_id.'_ajax_id'];
485  }
486 
487 
488  if(!strlen($data['tit']))
489  {
490  $invalid[] = $link_id;
491  continue;
492  }
493  if(!strlen($data['tar']))
494  {
495  $invalid[] = $link_id;
496  continue;
497  }
498  if($data['nam'] and !$data['val'])
499  {
500  $invalid[] = $link_id;
501  continue;
502  }
503  if(!$data['nam'] and $data['val'])
504  {
505  $invalid[] = $link_id;
506  continue;
507  }
508  }
509 
510  if(count($invalid))
511  {
512  ilUtil::sendFailure($this->lng->txt('err_check_input'));
513  $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.webr_manage.html','Modules/WebResource');
514 
515  include_once './Modules/WebResource/classes/class.ilWebResourceEditableLinkTableGUI.php';
516  $table = new ilWebResourceEditableLinkTableGUI($this,'view');
517  $table->setInvalidLinks($invalid);
518  $table->parseSelectedLinks($_POST['ids']);
519  $table->updateFromPost();
520  $this->tpl->setVariable('TABLE_LINKS',$table->getHTML());
521  return false;
522  }
523 
524  include_once './Modules/WebResource/classes/class.ilLinkResourceItems.php';
525  $links = new ilLinkResourceItems($this->object->getId());
526 
527  // Save Settings
528  foreach($_POST['ids'] as $link_id)
529  {
530  $data = $_POST['links'][$link_id];
531 
532  $orig = ilLinkResourceItems::lookupItem($this->object->getId(),$link_id);
533 
534  $links->setLinkId($link_id);
535  $links->setTitle(ilUtil::stripSlashes($data['tit']));
536  $links->setDescription(ilUtil::stripSlashes($data['des']));
537  $links->setTarget(str_replace('"', '', ilUtil::stripSlashes($data['tar'])));
538  $links->setActiveStatus((int) $data['act']);
539  $links->setDisableCheckStatus((int) $data['che']);
540  $links->setLastCheckDate($orig['last_check']);
541  $links->setValidStatus((int) $data['vali']);
542  $links->update();
543 
544  if(strlen($data['nam']) and $data['val'])
545  {
546  $param = new ilParameterAppender($this->object->getId());
547  $param->setName(ilUtil::stripSlashes($data['nam']));
548  $param->setValue((int) $data['val']);
549  $param->add($link_id);
550  }
551 
552  if($this->isContainerMetaDataRequired())
553  {
554  $this->object->setTitle(ilUtil::stripSlashes($data['tit']));
555  $this->object->setDescription(ilUtil::stripSlashes($data['des']));
556  $this->object->update();
557  }
558 
559  // TODO: Dynamic parameters
560  }
561 
562  ilUtil::sendSuccess($this->lng->txt('settings_saved'),TRUE);
563  $ilCtrl->redirect($this,'view');
564  }
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 875 of file class.ilObjLinkResourceGUI.php.

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

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

876  {
877  global $ilErr, $ilTabs;
878 
879  $ilTabs->activateTab("id_content");
880 
881  $this->checkPermission('read');
882 
883  if (strtolower($_GET["baseClass"]) == "iladministrationgui")
884  {
885  parent::view();
886  return true;
887  }
888  else
889  {
890  switch((int) $_REQUEST['view_mode'])
891  {
892  case self::VIEW_MODE_MANAGE:
893  $this->manage();
894  break;
895 
896  case self::VIEW_MODE_SORT:
897  $this->sort();
898  break;
899 
900  default:
901  $this->showLinks();
902  break;
903  }
904  }
905  $GLOBALS['tpl']->setPermanentLink($this->object->getType(),$this->object->getRefId());
906  return true;
907  }
$_GET["client_id"]
showLinks()
Show all active links.
checkPermission($a_perm, $a_cmd="")
$GLOBALS['ct_recipient']
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: