Overview

Packages

  • CONTENIDO
  • Core
    • Authentication
    • Backend
    • Cache
    • CEC
    • Chain
    • ContentType
    • Database
    • Debug
    • Exception
    • Frontend
      • Search
      • URI
      • Util
    • GenericDB
      • Model
    • GUI
      • HTML
    • I18N
    • LayoutHandler
    • Log
    • Security
    • Session
    • Util
    • Validation
    • Versioning
    • XML
  • Module
    • ContentRssCreator
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
    • ScriptCookieDirective
  • mpAutoloaderClassMap
  • None
  • Plugin
    • ContentAllocation
    • CronjobOverview
    • FormAssistant
    • FrontendLogic
    • FrontendUsers
    • Linkchecker
    • ModRewrite
    • Newsletter
    • Repository
      • FrontendNavigation
      • KeywordDensity
    • SearchSolr
    • SmartyWrapper
    • UrlShortener
    • UserForum
    • Workflow
  • PluginManager
  • Setup
    • Form
    • GUI
    • Helper
      • Environment
      • Filesystem
      • MySQL
      • PHP
    • UpgradeJob

Classes

  • cGuiBackendHelpbox
  • cGuiFileOverview
  • cGuiFoldingRow
  • cGuiList
  • cGuiMenu
  • cGuiNavigation
  • cGuiNotification
  • cGuiObjectPager
  • cGuiPage
  • cGuiScrollList
  • cGuiSourceEditor
  • cGuiTableForm
  • cGuiTree
  • cPager
  • cTemplate
  • cTree
  • cTreeItem
  • NoteLink
  • NoteList
  • NoteListItem
  • NoteView
  • TODOLink
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo
  1: <?php
  2: 
  3: /**
  4:  * This file contains the menu GUI class.
  5:  *
  6:  * @package          Core
  7:  * @subpackage       GUI
  8:  *
  9:  * @author           Mischa Holz
 10:  * @copyright        four for business AG <www.4fb.de>
 11:  * @license          http://www.contenido.org/license/LIZENZ.txt
 12:  * @link             http://www.4fb.de
 13:  * @link             http://www.contenido.org
 14:  */
 15: 
 16: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
 17: 
 18: /**
 19:  * Menu GUI class
 20:  *
 21:  * @package    Core
 22:  * @subpackage GUI
 23:  */
 24: class cGuiMenu {
 25: 
 26:     /**
 27:      *
 28:      * @var array
 29:      */
 30:     public $link;
 31: 
 32:     /**
 33:      *
 34:      * @var array
 35:      */
 36:     public $title;
 37: 
 38:     /**
 39:      *
 40:      * @var array
 41:      */
 42:     public $tooltips;
 43: 
 44:     /**
 45:      *
 46:      * @var array
 47:      */
 48:     public $image;
 49: 
 50:     /**
 51:      *
 52:      * @var unknown_type
 53:      */
 54:     public $alt;
 55: 
 56:     /**
 57:      *
 58:      * @var array
 59:      */
 60:     public $actions;
 61: 
 62:     /**
 63:      *
 64:      * @var array
 65:      */
 66:     public $imagewidth;
 67: 
 68:     /**
 69:      *
 70:      * @todo what is this property supposed to be?
 71:      * @var unknown_type
 72:      */
 73:     public $caption;
 74: 
 75:     /**
 76:      *
 77:      * @todo what is this property supposed to be?
 78:      * @var unknown_type
 79:      */
 80:     public $type;
 81: 
 82:     /**
 83:      *
 84:      * @todo what is this property supposed to be?
 85:      * @var unknown_type
 86:      */
 87:     public $show;
 88: 
 89:     /**
 90:      * The marked item.
 91:      *
 92:      * @var mixed
 93:      */
 94:     protected $_marked = false;
 95: 
 96:     /**
 97:      * Constructor to create an instance of this class.
 98:      */
 99:     public function __construct() {
100:         $this->rowmark = true;
101:     }
102: 
103:     /**
104:      *
105:      * @param mixed $item
106:      * @param string $title
107:      */
108:     public function setTitle($item, $title) {
109:         $this->title[$item] = $title;
110:     }
111: 
112:     /**
113:      *
114:      * @param mixed $item
115:      * @param string $tooltip
116:      */
117:     public function setTooltip($item, $tooltip) {
118:         $this->tooltips[$item] = $tooltip;
119:     }
120: 
121:     /**
122:      *
123:      * @param bool $rowmark [optional]
124:      */
125:     public function setRowmark($rowmark = true) {
126:         $this->rowmark = $rowmark;
127:     }
128: 
129:     /**
130:      *
131:      * @param mixed $item
132:      * @param string $image
133:      * @param int $maxwidth [optional]
134:      */
135:     public function setImage($item, $image, $maxwidth = 0) {
136:         $this->image[$item] = $image;
137:         $this->imagewidth[$item] = $maxwidth;
138:         $this->show[$item] = '';
139:     }
140: 
141:     /**
142:      *
143:      * @param mixed $item
144:      * @param cHTMLContentElement $link
145:      */
146:     public function setLink($item, $link) {
147:         $this->link[$item] = $link;
148:     }
149: 
150:     /**
151:      *
152:      * @param mixed $item
153:      * @param mixed $key
154:      * @param string $action
155:      */
156:     public function setActions($item, $key, $action) {
157:         $this->actions[$item][$key] = $action;
158:     }
159: 
160:     /**
161:      *
162:      * @param mixed $item
163:      */
164:     public function setMarked($item) {
165:         $this->_marked = $item;
166:     }
167: 
168:     /**
169:      *
170:      * @param bool $print [optional]
171:      * @return string
172:      */
173:     public function render($print = true) {
174:         global $cfg;
175: 
176:         $tpl = new cTemplate;
177: 
178:         $tpl->reset();
179: 
180:         if (is_array($this->link)) {
181:             foreach ($this->link as $key => $value) {
182:                 if ($value != NULL) {
183:                     if ($this->imagewidth[$key] != 0) {
184:                         $value->setContent('<img border="0" alt="" src="' . $this->image[$key] . '" width="' . $this->imagewidth[$key] . '">');
185:                         $img = $value->render();
186:                     } else {
187:                         $value->setContent('<img border="0" alt="" src="' . $this->image[$key] . '">');
188:                         $img = $value->render();
189:                     }
190:                     $value->setContent($this->title[$key]);
191:                     $link = $value->render();
192:                 } else {
193:                     $link = $this->title[$key];
194: 
195:                     if ($this->image[$key] != "") {
196:                         if ($this->imagewidth[$key] != 0) {
197:                             $img = '<img border="0" alt="" src="' . $this->image[$key] . '" width="' . $this->imagewidth[$key] . '">';
198:                         } else {
199:                             $img = '<img border="0" alt="" src="' . $this->image[$key] . '">';
200:                         }
201:                     } else {
202:                         $img = "&nbsp;";
203:                     }
204:                 }
205: 
206:                 $tpl->set('d', 'NAME', $link);
207: 
208:                 if ($this->image[$key] == "") {
209:                     $tpl->set('d', 'ICON', '');
210:                 } else {
211:                     $tpl->set('d', 'ICON', $img);
212:                 }
213: 
214:                 $extra = "";
215:                 if ($this->rowmark == true) {
216:                     $extra .= 'onmouseover="row.over(this)" onmouseout="row.out(this)" onclick="row.click(this)" ';
217:                 }
218:                 if ($this->_marked === $key) {
219:                     $extra .= "id='marked' ";
220:                 }
221:                 if ($this->tooltips[$key] != "") {
222:                     $extra .= "class='tooltip-north' original-title='" . $this->tooltips[$key] . "' ";
223:                 }
224:                 $tpl->set('d', 'EXTRA', $extra);
225: 
226:                 $fullactions = "";
227:                 if (is_array($this->actions[$key])) {
228: 
229:                     $fullactions = '<table border="0"><tr>';
230: 
231:                     foreach ($this->actions[$key] as $key => $singleaction) {
232:                         $fullactions .= '<td nowrap="nowrap">' . $singleaction . '</td>';
233:                     }
234: 
235:                     $fullactions .= '</tr></table>';
236:                 }
237: 
238:                 $tpl->set('d', 'ACTIONS', $fullactions);
239:                 $tpl->next();
240:             }
241:         }
242:         $rendered = $tpl->generate(cRegistry::getBackendPath() . $cfg['path']['templates'] . $cfg['templates']['generic_menu'], true);
243: 
244:         if ($print == true) {
245:             echo $rendered;
246:         } else {
247:             return $rendered;
248:         }
249:     }
250: 
251: }
252: 
CMS CONTENIDO 4.9.11 API documentation generated by ApiGen 2.8.0