[TASK] Move t3lib/stddb files to ext:core
[Packages/TYPO3.CMS.git] / typo3 / sysext / backend / Classes / View / LogoView.php
1 <?php
2 namespace TYPO3\CMS\Backend\View;
3
4 /***************************************************************
5 * Copyright notice
6 *
7 * (c) 2007-2011 Ingo Renner <ingo@typo3.org>
8 * All rights reserved
9 *
10 * This script is part of the TYPO3 project. The TYPO3 project is
11 * free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * The GNU General Public License can be found at
17 * http://www.gnu.org/copyleft/gpl.html.
18 * A copy is found in the textfile GPL.txt and important notices to the license
19 * from the author is found in LICENSE.txt distributed with these scripts.
20 *
21 *
22 * This script is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
26 *
27 * This copyright notice MUST APPEAR in all copies of the script!
28 ***************************************************************/
29 /**
30 * class to render the TYPO3 logo in the backend
31 *
32 * @author Ingo Renner <ingo@typo3.org>
33 */
34 class LogoView {
35
36 protected $logo;
37
38 /**
39 * constructor
40 */
41 public function __construct() {
42 $this->logo = NULL;
43 }
44
45 /**
46 * renders the actual logo code
47 *
48 * @return string Logo html code snippet to use in the backend
49 */
50 public function render() {
51 // Default
52 $logoFile = 'gfx/alt_backend_logo.gif';
53 if (is_string($this->logo)) {
54 // Overwrite
55 $logoFile = $this->logo;
56 }
57 $imgInfo = getimagesize(PATH_site . TYPO3_mainDir . $logoFile);
58 $logo = '<a href="' . TYPO3_URL_GENERAL . '" target="_blank">' . '<img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg('', $logoFile, $imgInfo[3]) . ' title="TYPO3 Content Management System" alt="" />' . '</a>';
59 // Overwrite with custom logo
60 if ($GLOBALS['TBE_STYLES']['logo']) {
61 $imgInfo = @getimagesize(\TYPO3\CMS\Core\Utility\GeneralUtility::resolveBackPath((PATH_typo3 . $GLOBALS['TBE_STYLES']['logo']), 3));
62 $logo = '<a href="' . TYPO3_URL_GENERAL . '" target="_blank">' . '<img src="' . $GLOBALS['TBE_STYLES']['logo'] . '" ' . $imgInfo[3] . ' title="TYPO3 Content Management System" alt="" />' . '</a>';
63 }
64 return $logo;
65 }
66
67 /**
68 * Sets the logo
69 *
70 * @param string $logo Path to logo file as seen from typo3/
71 * @throws \InvalidArgumentException
72 */
73 public function setLogo($logo) {
74 if (!is_string($logo)) {
75 throw new \InvalidArgumentException('parameter $logo must be of type string', 1194041104);
76 }
77 $this->logo = $logo;
78 }
79
80 }
81
82
83 ?>