render() public method

public render ( ) : string
return string
 public function beforeRender()
 {
     $userId = $this->session->read('uid');
     $loggedIn = !empty($userId);
     // ak je prihlaseny iba vtedy ma zmysel kreslit menu a vyber semestra
     if ($loggedIn) {
         $menu = new Menu();
         $periods = new Periods();
         $menuHelper = new MenuHelper();
         $selSemester = $this->session->read('semester');
         $semesterHtml = $menuHelper->renderSemester($periods->getShortAll(), $selSemester, $this->url);
         $menuItems = $menu->getForUser($userId);
         $admin = $this->session->read("admin");
         $adminActing = isset($admin);
         $menuHtml = $menuHelper->render($menuItems, $adminActing);
     } else {
         $menuHtml = $semesterHtml = "";
     }
     $this->addToTemplate("SEMESTER", $semesterHtml);
     $this->addToTemplate("MENU", $menuHtml);
     $helpHtml = "<a target='_BLANK' href='{$this->helpLink}'>Help</a>";
     $this->addToTemplate('HELP', $helpHtml);
 }
 private function render($viewData)
 {
     //if this is an AJAX request, don't use the template
     if (@$_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') {
         echo $viewData;
     } else {
         $t = new XTemplate("index.tpl");
         $flash_class = $this->session->read('flash_class');
         switch ($flash_class) {
             case "error":
                 $flash_class = "ui-state-error";
                 $icon_class = "ui-icon-alert";
                 break;
             default:
                 $flash_class = "ui-state-highlight";
                 $icon_class = "ui-icon-info";
                 // warning
         }
         $flash_class .= " ui-corner-all";
         $icon_class .= " ui-icon";
         $flash = $this->session->read('flash');
         $flashHTML = "<div class='ui-widget' style='padding-bottom: 5px;'>" . "   <div class='{$flash_class}' style='padding: 5px 5px 5px 5px;'>" . "   <p><span class='{$icon_class}' style='float: left; margin-right: .3em;'></span>" . "   {$flash}" . "   </p>" . "   </div>" . "</div>";
         $default = array('TOP_MENU' => '', 'CONTENT' => $viewData, 'FLASH' => $flash ? $flashHTML : '', 'SVN_VERSION' => SVN_VERSION);
         if ($this->legacy) {
             $menu = new Menu();
             $menuHelper = new MenuHelper();
             $userId = $this->session->read('uid');
             if (!empty($userId)) {
                 $menuItems = $menu->getForUser($userId);
                 $menuHtml = $menuHelper->render($menuItems, true);
                 $default["MENU"] = $menuHtml;
             }
         }
         if (method_exists($this->controller, 'getTemplateParts')) {
             $t->assign(array_merge($default, $this->controller->getTemplateParts()));
         } else {
             $t->assign($default);
         }
         $t->parse('PAGE');
         echo $t->text('PAGE');
         $this->session->clear('flash');
         $this->session->clear('flash_class');
         if (DEBUG) {
             $this->dumpDebugInfo();
         }
     }
 }
示例#3
0
					});
				</script>
				<?php 
            }
        }
    }
    if (empty(Yii::app()->session['user'])) {
        Yii::app()->session['user'] = User::model()->findByPk(Yii::app()->user->id);
    }
    $user = Yii::app()->session['user'];
    $menuHelper = new MenuHelper(Yii::app()->params['menu_bar_items'], Yii::app()->user, $uri);
    ?>

	<div class="panel user">
		<?php 
    echo $menuHelper->render();
    ?>
		<div class="row">
			<div class="large-3 column">
				<div class="user-id">
					You are logged in as:
					<div class="user-name">
						<?php 
    if (Yii::app()->params['profile_user_can_edit']) {
        ?>
							<a href="<?php 
        echo Yii::app()->createUrl('/profile');
        ?>
">
								<span class="icon-user-panel-cog"></span>
								<strong><?php