1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166
<?php
/* --------------------------------------------------------------
AdminPageHttpControllerResponse.inc.php 2016-04-18
Gambio GmbH
http://www.gambio.de
Copyright (c) 2016 Gambio GmbH
Released under the GNU General Public License (Version 2)
[http://www.gnu.org/licenses/gpl-2.0.html]
--------------------------------------------------------------
*/
MainFactory::load_class('HttpControllerResponse');
/**
* Class AdminPageHttpControllerResponse
*
* Important:
* This class will load the admin section of the shop, something that cannot be
* integrated into unit tests. That is why it is not unit tested.
*
* @category System
* @package Http
* @subpackage ValueObjects
* @extends HttpControllerResponse
*/
class AdminPageHttpControllerResponse extends HttpControllerResponse
{
/**
* Initializes the admin page http controller response.
*
* @param string $title Page title of admin page.
* @param array|null $mainContent Rendered response body.
* @param AssetCollectionInterface $assets (Optional) Assets collection to add new assets to the markup.
* @param array $jsLanguageSections (Optional) Language section for the js engine modules for the
* rendered admin page.
*/
public function __construct($title,
$mainContent,
AssetCollectionInterface $assets = null,
array $jsLanguageSections = array())
{
$this->httpBody = $this->_getAdminPageBody(array(
'title' => $title,
'main_content' => $mainContent
),
$assets,
$jsLanguageSections);
}
/**
* Returns a predefined markup for gambio admin pages.
*
* @param array $contentArray Associative array with 'title' and 'main_content' keys.
* @param AssetCollectionInterface $assets (Optional) Collection with assets for the markup.
* @param array $jsLanguageSections (Optional) Array with language sections to access them in
* modules of the gx javascript engine.
*
* @return string Rendered markup for the admin page.
*/
protected function _getAdminPageBody(array $contentArray,
AssetCollectionInterface $assets = null,
array $jsLanguageSections = array())
{
$varTitle = '';
$varMainContent = '';
if(isset($contentArray['title']))
{
$varTitle = $contentArray['title'];
}
if(isset($contentArray['main_content']))
{
$varMainContent = $contentArray['main_content'];
}
// Load language translations for JavaScript module engine.
$jsEngineLanguage = array(); // this variable is used in the "header.php" in the EngineConfiguration object
foreach($jsLanguageSections as $section)
{
$languageTextManager = MainFactory::create_object('LanguageTextManager',
array($section, $_SESSION['languages_id']));
$jsEngineLanguage[$section] = $languageTextManager->get_section_array($section);
}
ob_start();
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=<?php echo $_SESSION['language_charset']; ?>">
<title><?php echo $varTitle ?></title>
<link rel="stylesheet" type="text/css" href="html/assets/styles/legacy/stylesheet.css">
<link rel="stylesheet" type="text/css" href="html/assets/styles/legacy/lightbox.css">
<link rel="stylesheet" type="text/css" href="html/assets/styles/legacy/buttons.css">
<link rel="stylesheet" type="text/css" href="html/assets/styles/legacy/export_schemes.css">
<link rel="stylesheet" type="text/css" href="html/assets/styles/legacy/tooltip_plugin.css">
<script type="text/javascript" src="html/assets/javascript/legacy/gm/general.js"></script>
</head>
<body marginwidth="0"
marginheight="0"
topmargin="0"
bottommargin="0"
leftmargin="0"
rightmargin="0"
bgcolor="#FFFFFF">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<script type="text/javascript" src="html/assets/javascript/legacy/gm/lightbox_plugin.js"></script>
<script type="text/javascript" src="html/assets/javascript/legacy/gm/tooltip_plugin.js"></script>
<!-- header_eof //-->
<!-- assets //-->
<?php
if($assets)
{
echo $assets->getHtml();
}
?>
<!-- assets_eof //-->
<!-- body //-->
<table border="0" width="100%">
<tr>
<td class="columnLeft2" width="<?php echo BOX_WIDTH; ?>" valign="top">
<table border="0"
width="<?php echo BOX_WIDTH; ?>"
class="columnLeft">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
</table>
</td>
<!-- body_text //-->
<td class="boxCenter" width="100%" valign="top">
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td>
<!-- gm_module //-->
<div class="pageHeading"
style="background-image:url(html/assets/images/legacy/gm_icons/hilfsprogr1.png)">
<?php echo $varTitle ?>
</div>
<div id="container">
<?php echo $varMainContent ?>
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
</body>
</html>
<?php
$output = ob_get_contents();
ob_end_clean();
return $output;
}
}