ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilBaseViewGUI Class Reference

Base class for all ILIAS Views More...

+ Collaboration diagram for ilBaseViewGUI:

Public Member Functions

 __construct ()
 
 allowDesktop ()
 
 showViewNav ()
 
 spacerClass ()
 spacer_class More...
 
 addCss ()
 css files are added to the header More...
 
 appendInlineCss ()
 content of css files are appended to the main page html just before </body> end tag More...
 
 redirectToHome ($_msg_type=self::MSG_INFO, $_msg='')
 
 getHomeTitle ()
 
 findEffectiveRefId ()
 Find effective ref_id for request. More...
 
 getHttpPath ()
 
 isContainer ($obj_type)
 
 getSessionValue ($sess_key)
 get session value != '' More...
 

Data Fields

const TOP_SPACER = "ilFixedTopSpacer"
 
const TOP_SPACER_BAR_ONLY = "ilFixedTopSpacerBarOnly"
 
const ROOT_CONTAINER = "container"
 
const ROOT_CRS = "crs"
 
const ROOT_GRP = "grp"
 
 $tree_root_id = ROOT_FOLDER_ID
 dynamic tree_root_folder_id show tree from tree_root_id More...
 

Protected Member Functions

 getHomeLink ()
 helper function for home link creation More...
 
 getCmdLink ($cmd)
 helper function for cmd link creation More...
 
 log ($txt)
 

Protected Attributes

 $allow_desktop = true
 override these switches in the view constructor More...
 
 $view_nav = true
 
 $use_top_bar_url = false
 
 $root_type = ROOT_CONTAINER
 
 $dic = null
 
 $ctrl = null
 
 $ilias = null
 
 $link_dir = ""
 
 $home_id = ''
 home id (ref_id) The view maybe support a view home link in the topbar (static or dynamically, see topbar_back_url in Member- and LTIView) More...
 
 $home_obj_id = ''
 home obj_id More...
 
 $home_type = ''
 home type (obj_type of ref_id) The view maybe support a view home link in the topbar (static or dynamically, see topbar_back_url in Member- and LTIView) More...
 
 $home_title = ''
 home title (title of ref_id) More...
 
 $home_url = ''
 home Link (see topbar_back_url concept in MainMenuGUI) More...
 
 $home_items = []
 cache ref_ids of home subtree items if request is in home context $show_home_link = false else $show_home_link = true More...
 
 $show_home_link = false
 show home link in topbar (similar to topbar_back_url = '' in MainMenu) More...
 
 $root_folder_id = ROOT_FOLDER_ID
 root folder id Don't allow any access to higher level objects in this view More...
 
 $root_folder_items = []
 all allowed items More...
 
 $tree_root_types = []
 tree root types show tree from ref_id with obj_types if requested obj_type of ref_id is in array of $root_tree_types show this id as tree_root_id, else lookup if a parent obj_type of the ref_id matches the array and set tree_root_id to the first match More...
 
 $fix_tree_id = ''
 Fix tree_id Show always tree from id. More...
 
 $current_ref_id = ""
 ref_id from current request More...
 
 $current_type = ""
 obj_type of current ref_id More...
 

Detailed Description

Base class for all ILIAS Views

Author
Stefan Schneider <schne.nosp@m.ider.nosp@m.@hrz..nosp@m.uni-.nosp@m.marbu.nosp@m.rg.d.nosp@m.e
Version
$id$

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

Constructor & Destructor Documentation

◆ __construct()

ilBaseViewGUI::__construct ( )

Definition at line 151 of file class.ilBaseViewGUI.php.

References $DIC, $ilCtrl, $ilias, $lng, and defined.

152  {
153  global $DIC, $ilCtrl, $ilias, $lng;
154  $this->dic = $DIC;
155  $this->ctrl = $ilCtrl;
156  $this->ilias = $ilias;
157  $this->link_dir = (defined("ILIAS_MODULE"))
158  ? "../"
159  : "";
160  }
global $DIC
Definition: saml.php:7
global $ilCtrl
Definition: ilias.php:18
redirection script todo: (a better solution should control the processing via a xml file) ...
global $lng
Definition: privfeed.php:17
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
Definition: bootstrap.php:27

Member Function Documentation

◆ addCss()

ilBaseViewGUI::addCss ( )

css files are added to the header

Returns
array

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

191  {
192  return [];
193  }

◆ allowDesktop()

ilBaseViewGUI::allowDesktop ( )
Returns
bool

Definition at line 165 of file class.ilBaseViewGUI.php.

References $allow_desktop.

166  {
167  return $this->allow_desktop;
168  }
$allow_desktop
override these switches in the view constructor

◆ appendInlineCss()

ilBaseViewGUI::appendInlineCss ( )

content of css files are appended to the main page html just before </body> end tag

Returns
array

Definition at line 199 of file class.ilBaseViewGUI.php.

200  {
201  return [];
202  }

◆ findEffectiveRefId()

ilBaseViewGUI::findEffectiveRefId ( )

Find effective ref_id for request.

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

References $_GET, $target_arr, ilObject\_lookupObjectId(), ilObject\_lookupTitle(), and ilObject\_lookupType().

245  {
246  if ((int) $_GET['ref_id']) {
247  $this->current_type = ilObject::_lookupType($_GET['ref_id'], true);
248  return $this->current_ref_id = (int) $_GET['ref_id'];
249  }
250 
251  $target_arr = explode('_', (string) $_GET['target']);
252  if (isset($target_arr[1]) and (int) $target_arr[1]) {
253  $this->current_type = ilObject::_lookupType($target_arr[1], true);
254  $this->home_title = ilObject::_lookupTitle(ilObject::_lookupObjectId($target_arr[1]));
255  return $this->current_ref_id = (int) $target_arr[1];
256  }
257  }
$target_arr
Definition: goto.php:47
$_GET["client_id"]
static _lookupTitle($a_id)
lookup object title
static _lookupObjectId($a_ref_id)
lookup object id
static _lookupType($a_id, $a_reference=false)
lookup object type
+ Here is the call graph for this function:

◆ getCmdLink()

ilBaseViewGUI::getCmdLink (   $cmd)
protected

helper function for cmd link creation

Definition at line 215 of file class.ilBaseViewGUI.php.

References $ilCtrl, and array.

216  {
217  global $ilCtrl;
218  $targetScript = ($ilCtrl->getTargetScript() !== 'ilias.php') ? "ilias.php" : "";
219  return $this->link_dir . $targetScript . $ilCtrl->getLinkTargetByClass(array('illtiroutergui',strtolower(get_class($this))), $cmd) . "&baseClass=illtiroutergui";
220  }
global $ilCtrl
Definition: ilias.php:18
Create styles array
The data for the language used.

◆ getHomeLink()

ilBaseViewGUI::getHomeLink ( )
protected

helper function for home link creation

Definition at line 207 of file class.ilBaseViewGUI.php.

References $home_id.

Referenced by redirectToHome().

208  {
209  return $this->link_dir . "goto.php?target=" . $this->home_type . "_" . $this->home_id;
210  }
$home_id
home id (ref_id) The view maybe support a view home link in the topbar (static or dynamically...
+ Here is the caller graph for this function:

◆ getHomeTitle()

ilBaseViewGUI::getHomeTitle ( )

Definition at line 236 of file class.ilBaseViewGUI.php.

References ilObject\_lookupTitle().

237  {
238  return ilObject::_lookupTitle($this->home_obj_id);
239  }
static _lookupTitle($a_id)
lookup object title
+ Here is the call graph for this function:

◆ getHttpPath()

ilBaseViewGUI::getHttpPath ( )

Definition at line 259 of file class.ilBaseViewGUI.php.

References $_SERVER, $https, GuzzleHttp\Psr7\$protocol, and ilUtil\removeTrailingPathSeparators().

260  {
261  include_once './Services/Http/classes/class.ilHTTPS.php';
262  $https = new ilHTTPS();
263 
264  if ($https->isDetected()) {
265  $protocol = 'https://';
266  } else {
267  $protocol = 'http://';
268  }
269  $host = $_SERVER['HTTP_HOST'];
270  $rq_uri = $_SERVER['REQUEST_URI'];
271  return ilUtil::removeTrailingPathSeparators($protocol . $host . $rq_uri);
272  }
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']
HTTPS.
$https
Definition: imgupload.php:19
static removeTrailingPathSeparators($path)
+ Here is the call graph for this function:

◆ getSessionValue()

ilBaseViewGUI::getSessionValue (   $sess_key)

get session value != ''

Parameters
$sess_keystring
Returns
string

Definition at line 294 of file class.ilBaseViewGUI.php.

References $_SESSION.

295  {
296  if (isset($_SESSION[$sess_key]) && $_SESSION[$sess_key] != '') {
297  return $_SESSION[$sess_key];
298  } else {
299  return '';
300  }
301  }
$_SESSION["AccountId"]

◆ isContainer()

ilBaseViewGUI::isContainer (   $obj_type)
Returns
bool

Definition at line 277 of file class.ilBaseViewGUI.php.

278  {
279  //return true;
280  return preg_match("/(crs|grp|cat|root|folder)/", $obj_type);
281  }

◆ log()

ilBaseViewGUI::log (   $txt)
protected

Definition at line 283 of file class.ilBaseViewGUI.php.

References $txt.

284  {
285  $this->dic->logger()->lti()->write($txt);
286  }
$txt
Definition: error.php:11

◆ redirectToHome()

ilBaseViewGUI::redirectToHome (   $_msg_type = self::MSG_INFO,
  $_msg = '' 
)

Definition at line 225 of file class.ilBaseViewGUI.php.

References $_SESSION, exit, getHomeLink(), and ilUtil\redirect().

226  {
227  //$msg = ($_msg !== '') ? '&view_msg='.$_msg.'&view_msg_type='.$_msg_type : '';
228  //$link = $this->getHomeLink().$msg;
229  $_SESSION[$_msg_type] = $_msg;
230  $link = $this->getHomeLink();
231  $this->dic->logger()->lti()->write("redirectLink: " . $link);
232  ilUtil::redirect($link);
233  exit;
234  }
$_SESSION["AccountId"]
getHomeLink()
helper function for home link creation
static redirect($a_script)
+ Here is the call graph for this function:

◆ showViewNav()

ilBaseViewGUI::showViewNav ( )
Returns
bool

Definition at line 173 of file class.ilBaseViewGUI.php.

References $view_nav.

174  {
175  return $this->view_nav;
176  }

◆ spacerClass()

ilBaseViewGUI::spacerClass ( )

spacer_class

Definition at line 181 of file class.ilBaseViewGUI.php.

182  {
183  return ($this->topBarOnly) ? self::TOP_SPACER_BAR_ONLY : self::TOP_SPACER;
184  }

Field Documentation

◆ $allow_desktop

ilBaseViewGUI::$allow_desktop = true
protected

override these switches in the view constructor

Definition at line 50 of file class.ilBaseViewGUI.php.

Referenced by allowDesktop().

◆ $ctrl

ilBaseViewGUI::$ctrl = null
protected

Definition at line 64 of file class.ilBaseViewGUI.php.

◆ $current_ref_id

ilBaseViewGUI::$current_ref_id = ""
protected

ref_id from current request

Definition at line 143 of file class.ilBaseViewGUI.php.

◆ $current_type

ilBaseViewGUI::$current_type = ""
protected

obj_type of current ref_id

Definition at line 148 of file class.ilBaseViewGUI.php.

◆ $dic

ilBaseViewGUI::$dic = null
protected

Definition at line 62 of file class.ilBaseViewGUI.php.

◆ $fix_tree_id

ilBaseViewGUI::$fix_tree_id = ''
protected

Fix tree_id Show always tree from id.

Definition at line 138 of file class.ilBaseViewGUI.php.

◆ $home_id

ilBaseViewGUI::$home_id = ''
protected

home id (ref_id) The view maybe support a view home link in the topbar (static or dynamically, see topbar_back_url in Member- and LTIView)

Definition at line 74 of file class.ilBaseViewGUI.php.

Referenced by getHomeLink().

◆ $home_items

ilBaseViewGUI::$home_items = []
protected

cache ref_ids of home subtree items if request is in home context $show_home_link = false else $show_home_link = true

Definition at line 102 of file class.ilBaseViewGUI.php.

◆ $home_obj_id

ilBaseViewGUI::$home_obj_id = ''
protected

home obj_id

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

◆ $home_title

ilBaseViewGUI::$home_title = ''
protected

home title (title of ref_id)

Definition at line 90 of file class.ilBaseViewGUI.php.

◆ $home_type

ilBaseViewGUI::$home_type = ''
protected

home type (obj_type of ref_id) The view maybe support a view home link in the topbar (static or dynamically, see topbar_back_url in Member- and LTIView)

Definition at line 85 of file class.ilBaseViewGUI.php.

◆ $home_url

ilBaseViewGUI::$home_url = ''
protected

home Link (see topbar_back_url concept in MainMenuGUI)

Definition at line 95 of file class.ilBaseViewGUI.php.

◆ $ilias

ilBaseViewGUI::$ilias = null
protected

Definition at line 66 of file class.ilBaseViewGUI.php.

Referenced by __construct().

◆ $link_dir

ilBaseViewGUI::$link_dir = ""
protected

Definition at line 68 of file class.ilBaseViewGUI.php.

◆ $root_folder_id

ilBaseViewGUI::$root_folder_id = ROOT_FOLDER_ID
protected

root folder id Don't allow any access to higher level objects in this view

Definition at line 113 of file class.ilBaseViewGUI.php.

◆ $root_folder_items

ilBaseViewGUI::$root_folder_items = []
protected

all allowed items

Definition at line 118 of file class.ilBaseViewGUI.php.

◆ $root_type

ilBaseViewGUI::$root_type = ROOT_CONTAINER
protected

Definition at line 56 of file class.ilBaseViewGUI.php.

◆ $show_home_link

ilBaseViewGUI::$show_home_link = false
protected

show home link in topbar (similar to topbar_back_url = '' in MainMenu)

Definition at line 107 of file class.ilBaseViewGUI.php.

◆ $tree_root_id

ilBaseViewGUI::$tree_root_id = ROOT_FOLDER_ID

dynamic tree_root_folder_id show tree from tree_root_id

Definition at line 124 of file class.ilBaseViewGUI.php.

◆ $tree_root_types

ilBaseViewGUI::$tree_root_types = []
protected

tree root types show tree from ref_id with obj_types if requested obj_type of ref_id is in array of $root_tree_types show this id as tree_root_id, else lookup if a parent obj_type of the ref_id matches the array and set tree_root_id to the first match

Definition at line 132 of file class.ilBaseViewGUI.php.

◆ $use_top_bar_url

ilBaseViewGUI::$use_top_bar_url = false
protected

Definition at line 54 of file class.ilBaseViewGUI.php.

◆ $view_nav

ilBaseViewGUI::$view_nav = true
protected

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

Referenced by showViewNav().

◆ ROOT_CONTAINER

const ilBaseViewGUI::ROOT_CONTAINER = "container"

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

◆ ROOT_CRS

const ilBaseViewGUI::ROOT_CRS = "crs"

Definition at line 43 of file class.ilBaseViewGUI.php.

◆ ROOT_GRP

const ilBaseViewGUI::ROOT_GRP = "grp"

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

◆ TOP_SPACER

const ilBaseViewGUI::TOP_SPACER = "ilFixedTopSpacer"

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

◆ TOP_SPACER_BAR_ONLY

const ilBaseViewGUI::TOP_SPACER_BAR_ONLY = "ilFixedTopSpacerBarOnly"

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


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