mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-30 14:08:46 +02:00
N°4076 - Allow block parameters to change the behaviour of blocks on the page
This commit is contained in:
@@ -72,7 +72,11 @@ class iTopWebPage extends NiceWebPage implements iTabbedPage
|
||||
* @param string $sTitle
|
||||
* @param bool $bPrintable
|
||||
*
|
||||
* @throws \Exception
|
||||
* @throws \ConfigException
|
||||
* @throws \CoreException
|
||||
* @throws \CoreUnexpectedValue
|
||||
* @throws \DictExceptionMissingString
|
||||
* @throws \MySQLException
|
||||
*/
|
||||
public function __construct($sTitle, $bPrintable = false)
|
||||
{
|
||||
@@ -102,10 +106,9 @@ class iTopWebPage extends NiceWebPage implements iTabbedPage
|
||||
$this->add_header("Content-type: text/html; charset=".self::PAGES_CHARSET);
|
||||
$this->no_cache();
|
||||
$this->add_xframe_options();
|
||||
if (!$this->IsPrintableVersion())
|
||||
{
|
||||
if (!$this->IsPrintableVersion()) {
|
||||
$this->PrepareLayout();
|
||||
} else{
|
||||
} else {
|
||||
$oPrintHeader = $this->OutputPrintable();
|
||||
$this->AddUiBlock($oPrintHeader);
|
||||
}
|
||||
@@ -800,16 +803,18 @@ HTML;
|
||||
// Base structure of data to pass to the TWIG template
|
||||
$aData['aPage'] = [
|
||||
'sAbsoluteUrlAppRoot' => $sAbsoluteUrlAppRoot,
|
||||
'sTitle' => $this->s_title,
|
||||
'sFaviconUrl' => $sFaviconUrl,
|
||||
'aMetadata' => [
|
||||
'sTitle' => $this->s_title,
|
||||
'sFaviconUrl' => $sFaviconUrl,
|
||||
'aMetadata' => [
|
||||
'sCharset' => static::PAGES_CHARSET,
|
||||
'sLang' => $sMetadataLanguage,
|
||||
'sLang' => $sMetadataLanguage,
|
||||
],
|
||||
'oPrintHeader' => $oPrintHeader,
|
||||
'isPrintable' => $this->IsPrintableVersion(),
|
||||
'oPrintHeader' => $oPrintHeader,
|
||||
'isPrintable' => $this->IsPrintableVersion(),
|
||||
];
|
||||
|
||||
$aData['aBlockParams'] = $this->GetBlockParams();
|
||||
|
||||
// Base tag
|
||||
// Note: We might consider to put the app_root_url parameter here, but that would need a BIG rework on iTop AND the extensions to replace all the "../images|js|css/xxx.yyy"...
|
||||
if (!empty($this->a_base['href'])) {
|
||||
@@ -1167,4 +1172,17 @@ EOF
|
||||
|
||||
return $oBlock;
|
||||
}
|
||||
|
||||
public function SetBlockParam(string $sKey, $value)
|
||||
{
|
||||
$oGlobalSearch = $this->GetTopBarLayout()->GetGlobalSearch();
|
||||
$sGlobalSearchId = $oGlobalSearch->GetId();
|
||||
switch ($sKey) {
|
||||
case "$sGlobalSearchId.sQuery":
|
||||
$oGlobalSearch->SetQuery($value);
|
||||
break;
|
||||
}
|
||||
|
||||
return parent::SetBlockParam($sKey, $value); // TODO: Change the autogenerated stub
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user