mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-18 23:08:46 +02:00
Internal: PHPDoc and warning suppression
This commit is contained in:
@@ -1,27 +1,20 @@
|
|||||||
<?php
|
<?php
|
||||||
// Copyright (C) 2010-2018 Combodo SARL
|
|
||||||
//
|
|
||||||
// This file is part of iTop.
|
|
||||||
//
|
|
||||||
// iTop is free software; you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU Affero General Public License as published by
|
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
|
||||||
// (at your option) any later version.
|
|
||||||
//
|
|
||||||
// iTop is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU Affero General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU Affero General Public License
|
|
||||||
// along with iTop. If not, see <http://www.gnu.org/licenses/>
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class iTopWebPage
|
* Copyright (C) 2013-2019 Combodo SARL
|
||||||
*
|
*
|
||||||
* @copyright Copyright (C) 2010-2018 Combodo SARL
|
* This file is part of iTop.
|
||||||
* @license http://opensource.org/licenses/AGPL-3.0
|
*
|
||||||
|
* iTop is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* iTop is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once(APPROOT."/application/nicewebpage.class.inc.php");
|
require_once(APPROOT."/application/nicewebpage.class.inc.php");
|
||||||
@@ -46,6 +39,14 @@ class iTopWebPage extends NiceWebPage implements iTabbedPage
|
|||||||
protected $sBreadCrumbEntryIcon;
|
protected $sBreadCrumbEntryIcon;
|
||||||
protected $oCtx;
|
protected $oCtx;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* iTopWebPage constructor.
|
||||||
|
*
|
||||||
|
* @param string $sTitle
|
||||||
|
* @param bool $bPrintable
|
||||||
|
*
|
||||||
|
* @throws \Exception
|
||||||
|
*/
|
||||||
public function __construct($sTitle, $bPrintable = false)
|
public function __construct($sTitle, $bPrintable = false)
|
||||||
{
|
{
|
||||||
parent::__construct($sTitle, $bPrintable);
|
parent::__construct($sTitle, $bPrintable);
|
||||||
@@ -150,6 +151,9 @@ EOF
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
protected function IsMenuPaneVisible()
|
protected function IsMenuPaneVisible()
|
||||||
{
|
{
|
||||||
$bLeftPaneOpen = true;
|
$bLeftPaneOpen = true;
|
||||||
@@ -172,6 +176,9 @@ EOF
|
|||||||
return $bLeftPaneOpen;
|
return $bLeftPaneOpen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
protected function PrepareLayout()
|
protected function PrepareLayout()
|
||||||
{
|
{
|
||||||
if (MetaModel::GetConfig()->Get('demo_mode'))
|
if (MetaModel::GetConfig()->Get('demo_mode'))
|
||||||
@@ -736,11 +743,22 @@ JS
|
|||||||
$this->sBreadCrumbEntryIcon = null;
|
$this->sBreadCrumbEntryIcon = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $sHtml
|
||||||
|
*/
|
||||||
public function AddToMenu($sHtml)
|
public function AddToMenu($sHtml)
|
||||||
{
|
{
|
||||||
$this->m_sMenu .= $sHtml;
|
$this->m_sMenu .= $sHtml;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
* @throws \CoreException
|
||||||
|
* @throws \MissingQueryArgument
|
||||||
|
* @throws \MySQLException
|
||||||
|
* @throws \MySQLHasGoneAwayException
|
||||||
|
* @throws \OQLException
|
||||||
|
*/
|
||||||
public function GetSiloSelectionForm()
|
public function GetSiloSelectionForm()
|
||||||
{
|
{
|
||||||
// List of visible Organizations
|
// List of visible Organizations
|
||||||
@@ -801,6 +819,9 @@ JS
|
|||||||
return $sHtml;
|
return $sHtml;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws \DictExceptionMissingString
|
||||||
|
*/
|
||||||
public function DisplayMenu()
|
public function DisplayMenu()
|
||||||
{
|
{
|
||||||
// Display the menu
|
// Display the menu
|
||||||
@@ -839,43 +860,43 @@ JS
|
|||||||
'ttl' => $oProvider->GetTTL(),
|
'ttl' => $oProvider->GetTTL(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (count($aProviderParams) > 0)
|
|
||||||
{
|
// Show newsroom only if there are some providers
|
||||||
$sImageUrl= '../images/newsroom_menu.png';
|
if (count($aProviderParams) > 0)
|
||||||
$sPlaceholderImageUrl= '../images/newsroom-message.svg';
|
{
|
||||||
$aParams = array(
|
$sImageUrl= '../images/newsroom_menu.png';
|
||||||
'image_url' => $sImageUrl,
|
$sPlaceholderImageUrl= '../images/newsroom-message.svg';
|
||||||
'placeholder_image_url' => $sPlaceholderImageUrl,
|
$aParams = array(
|
||||||
'cache_uuid' => 'itop-newsroom-'.UserRights::GetUserId().'-'.md5(APPROOT),
|
'image_url' => $sImageUrl,
|
||||||
'providers' => $aProviderParams,
|
'placeholder_image_url' => $sPlaceholderImageUrl,
|
||||||
'display_limit' => (int)appUserPreferences::GetPref('newsroom_display_size', 7),
|
'cache_uuid' => 'itop-newsroom-'.UserRights::GetUserId().'-'.md5(APPROOT),
|
||||||
'labels' => array(
|
'providers' => $aProviderParams,
|
||||||
'no_message' => Dict::S('UI:Newsroom:NoNewMessage'),
|
'display_limit' => (int)appUserPreferences::GetPref('newsroom_display_size', 7),
|
||||||
'mark_all_as_read' => Dict::S('UI:Newsroom:MarkAllAsRead'),
|
'labels' => array(
|
||||||
'view_all' => Dict::S('UI:Newsroom:ViewAllMessages'),
|
'no_message' => Dict::S('UI:Newsroom:NoNewMessage'),
|
||||||
),
|
'mark_all_as_read' => Dict::S('UI:Newsroom:MarkAllAsRead'),
|
||||||
);
|
'view_all' => Dict::S('UI:Newsroom:ViewAllMessages'),
|
||||||
$sParams = json_encode($aParams);
|
),
|
||||||
$this->add_ready_script(
|
);
|
||||||
<<<EOF
|
$sParams = json_encode($aParams);
|
||||||
$('#top-left-newsroom-cell').newsroom_menu($sParams);
|
$this->add_ready_script(
|
||||||
|
<<<EOF
|
||||||
|
$('#top-left-newsroom-cell').newsroom_menu($sParams);
|
||||||
EOF
|
EOF
|
||||||
);
|
);
|
||||||
$sNewsroomInitialImage = '<img style="opacity:0.4" src="../images/newsroom_menu.png">';
|
$sNewsroomInitialImage = '<img style="opacity:0.4" src="../images/newsroom_menu.png">';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
// else no newsroom menu
|
||||||
{
|
return $sNewsroomInitialImage;
|
||||||
// No newsroom menu at all
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// else no newsroom menu
|
|
||||||
return $sNewsroomInitialImage;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Outputs (via some echo) the complete HTML page by assembling all its elements
|
* Outputs (via some echo) the complete HTML page by assembling all its elements
|
||||||
|
*
|
||||||
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
public function output()
|
public function output()
|
||||||
{
|
{
|
||||||
@@ -1442,21 +1463,46 @@ EOF;
|
|||||||
ExecutionKPI::ReportStats();
|
ExecutionKPI::ReportStats();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $sTabContainer
|
||||||
|
* @param string $sPrefix
|
||||||
|
*
|
||||||
|
* @return mixed|void
|
||||||
|
* @throws \Exception
|
||||||
|
*/
|
||||||
public function AddTabContainer($sTabContainer, $sPrefix = '')
|
public function AddTabContainer($sTabContainer, $sPrefix = '')
|
||||||
{
|
{
|
||||||
$this->add($this->m_oTabs->AddTabContainer($sTabContainer, $sPrefix));
|
$this->add($this->m_oTabs->AddTabContainer($sTabContainer, $sPrefix));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $sTabContainer
|
||||||
|
* @param string $sTabLabel
|
||||||
|
* @param string $sHtml
|
||||||
|
*
|
||||||
|
* @return mixed|void
|
||||||
|
* @throws \Exception
|
||||||
|
*/
|
||||||
public function AddToTab($sTabContainer, $sTabLabel, $sHtml)
|
public function AddToTab($sTabContainer, $sTabLabel, $sHtml)
|
||||||
{
|
{
|
||||||
$this->add($this->m_oTabs->AddToTab($sTabContainer, $sTabLabel, $sHtml));
|
$this->add($this->m_oTabs->AddToTab($sTabContainer, $sTabLabel, $sHtml));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $sTabContainer
|
||||||
|
*
|
||||||
|
* @return mixed|string
|
||||||
|
*/
|
||||||
public function SetCurrentTabContainer($sTabContainer = '')
|
public function SetCurrentTabContainer($sTabContainer = '')
|
||||||
{
|
{
|
||||||
return $this->m_oTabs->SetCurrentTabContainer($sTabContainer);
|
return $this->m_oTabs->SetCurrentTabContainer($sTabContainer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $sTabLabel
|
||||||
|
*
|
||||||
|
* @return mixed|string
|
||||||
|
*/
|
||||||
public function SetCurrentTab($sTabLabel = '')
|
public function SetCurrentTab($sTabLabel = '')
|
||||||
{
|
{
|
||||||
return $this->m_oTabs->SetCurrentTab($sTabLabel);
|
return $this->m_oTabs->SetCurrentTab($sTabLabel);
|
||||||
@@ -1481,11 +1527,20 @@ EOF;
|
|||||||
$this->add($this->m_oTabs->AddAjaxTab($sTabLabel, $sUrl, $bCache));
|
$this->add($this->m_oTabs->AddAjaxTab($sTabLabel, $sUrl, $bCache));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
public function GetCurrentTab()
|
public function GetCurrentTab()
|
||||||
{
|
{
|
||||||
return $this->m_oTabs->GetCurrentTab();
|
return $this->m_oTabs->GetCurrentTab();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $sTabLabel
|
||||||
|
* @param string|null $sTabContainer
|
||||||
|
*
|
||||||
|
* @return mixed|void
|
||||||
|
*/
|
||||||
public function RemoveTab($sTabLabel, $sTabContainer = null)
|
public function RemoveTab($sTabLabel, $sTabContainer = null)
|
||||||
{
|
{
|
||||||
$this->m_oTabs->RemoveTab($sTabLabel, $sTabContainer);
|
$this->m_oTabs->RemoveTab($sTabLabel, $sTabContainer);
|
||||||
@@ -1494,6 +1549,9 @@ EOF;
|
|||||||
/**
|
/**
|
||||||
* Finds the tab whose title matches a given pattern
|
* Finds the tab whose title matches a given pattern
|
||||||
*
|
*
|
||||||
|
* @param string $sPattern
|
||||||
|
* @param string|null $sTabContainer
|
||||||
|
*
|
||||||
* @return mixed The name of the tab as a string or false if not found
|
* @return mixed The name of the tab as a string or false if not found
|
||||||
*/
|
*/
|
||||||
public function FindTab($sPattern, $sTabContainer = null)
|
public function FindTab($sPattern, $sTabContainer = null)
|
||||||
@@ -1506,12 +1564,21 @@ EOF;
|
|||||||
* DOES NOT WORK: apparently in the *old* version of jquery
|
* DOES NOT WORK: apparently in the *old* version of jquery
|
||||||
* that we are using this is not supported... TO DO upgrade
|
* that we are using this is not supported... TO DO upgrade
|
||||||
* the whole jquery bundle...
|
* the whole jquery bundle...
|
||||||
|
*
|
||||||
|
* @param string $sTabContainer
|
||||||
|
* @param string $sTabLabel
|
||||||
*/
|
*/
|
||||||
public function SelectTab($sTabContainer, $sTabLabel)
|
public function SelectTab($sTabContainer, $sTabLabel)
|
||||||
{
|
{
|
||||||
$this->add_ready_script($this->m_oTabs->SelectTab($sTabContainer, $sTabLabel));
|
$this->add_ready_script($this->m_oTabs->SelectTab($sTabContainer, $sTabLabel));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $sHtml
|
||||||
|
*
|
||||||
|
* @return mixed|void
|
||||||
|
* @throws \Exception
|
||||||
|
*/
|
||||||
public function add($sHtml)
|
public function add($sHtml)
|
||||||
{
|
{
|
||||||
if (($this->m_oTabs->GetCurrentTabContainer() != '') && ($this->m_oTabs->GetCurrentTab() != ''))
|
if (($this->m_oTabs->GetCurrentTabContainer() != '') && ($this->m_oTabs->GetCurrentTab() != ''))
|
||||||
@@ -1577,6 +1644,8 @@ EOF;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the message to be displayed in the 'app-banner' section at the top of the page
|
* Set the message to be displayed in the 'app-banner' section at the top of the page
|
||||||
|
*
|
||||||
|
* @param string $sHtmlMessage
|
||||||
*/
|
*/
|
||||||
public function SetMessage($sHtmlMessage)
|
public function SetMessage($sHtmlMessage)
|
||||||
{
|
{
|
||||||
@@ -1586,6 +1655,10 @@ EOF;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Add message to be displayed in the 'app-banner' section at the top of the page
|
* Add message to be displayed in the 'app-banner' section at the top of the page
|
||||||
|
*
|
||||||
|
* @param string $sHtmlMessage
|
||||||
|
* @param string|null $sHtmlIcon
|
||||||
|
* @param string|null $sTip
|
||||||
*/
|
*/
|
||||||
public function AddApplicationMessage($sHtmlMessage, $sHtmlIcon = null, $sTip = null)
|
public function AddApplicationMessage($sHtmlMessage, $sHtmlIcon = null, $sTip = null)
|
||||||
{
|
{
|
||||||
@@ -1606,6 +1679,7 @@ EOF;
|
|||||||
* @param string $sContent
|
* @param string $sContent
|
||||||
* @param string $sCssClasses CSS classes to add to the container
|
* @param string $sCssClasses CSS classes to add to the container
|
||||||
*
|
*
|
||||||
|
* @throws \Exception
|
||||||
* @since 2.6
|
* @since 2.6
|
||||||
*/
|
*/
|
||||||
public function AddHeaderMessage($sContent, $sCssClasses = 'message_info')
|
public function AddHeaderMessage($sContent, $sCssClasses = 'message_info')
|
||||||
@@ -1619,6 +1693,8 @@ EOF
|
|||||||
/**
|
/**
|
||||||
* Adds a script to be executed when the DOM is ready (typical JQuery use), right before add_ready_script
|
* Adds a script to be executed when the DOM is ready (typical JQuery use), right before add_ready_script
|
||||||
*
|
*
|
||||||
|
* @param string $sScript
|
||||||
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function add_init_script($sScript)
|
public function add_init_script($sScript)
|
||||||
|
|||||||
@@ -1198,11 +1198,9 @@ class TabManager
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $sHtml
|
|
||||||
*
|
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function GetCurrentTabLength($sHtml)
|
public function GetCurrentTabLength()
|
||||||
{
|
{
|
||||||
$iLength = isset($this->m_aTabs[$this->m_sCurrentTabContainer]['tabs'][$this->m_sCurrentTab]['html']) ? strlen($this->m_aTabs[$this->m_sCurrentTabContainer]['tabs'][$this->m_sCurrentTab]['html']) : 0;
|
$iLength = isset($this->m_aTabs[$this->m_sCurrentTabContainer]['tabs'][$this->m_sCurrentTab]['html']) ? strlen($this->m_aTabs[$this->m_sCurrentTabContainer]['tabs'][$this->m_sCurrentTab]['html']) : 0;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user