Exemplo n.º 1
0
 public function render($tpl = null)
 {
     //authenticate the current user to make sure they are an admin
     UsersHelper::authenticateAdmin();
     $document = JFactory::getDocument();
     $document->addScript(JURI::base() . "/src/Cobalt/media/js/cobalt-admin.js");
     /** Menu Links **/
     $side_menu = MenuHelper::getMenuModules();
     $this->side_menu = $side_menu;
     // Create toolbar
     $this->toolbar = new Toolbar();
     $this->toolbar->save();
     $model = new MenuModel();
     $menu = $model->getMenu();
     $menu_template = $model->getMenuTemplate();
     $this->menu = $menu;
     $this->menu_template = $menu_template;
     //display
     return parent::render();
 }
Exemplo n.º 2
0
 public static function loadToolbar()
 {
     $app = \Cobalt\Container::fetch('app');
     //load menu
     $menu_model = new MenuModel();
     $list = $menu_model->getMenu();
     //Get controller to select active menu item
     $controller = $app->input->get('controller');
     $view = $app->input->get('view');
     $class = "";
     //generate html
     $list_html = '<div class="navbar navbar-default navbar-fixed-top" role="navigation">';
     $list_html .= '<div class="container">';
     $list_html .= '<div class="navbar-header">';
     if (StylesHelper::getSiteLogo()) {
         $list_html .= '<div class="site-logo pull-left">';
         $list_html .= '<img id="site-logo-img" src="' . StylesHelper::getSiteLogo() . '" />';
         $list_html .= '</div>';
     }
     $list_html .= '<a id="site-name-link" class="navbar-brand" href="' . JUri::base() . '">';
     $list_html .= StylesHelper::getSiteName();
     $list_html .= '</a>';
     $list_html .= '</div>';
     // navbar-header end
     $list_html .= '<ul class="nav navbar-nav">';
     foreach ($list->menu_items as $name) {
         $class = $name == $controller || $name == $view ? "active" : "";
         $list_html .= '<li><a class="' . $class . '" href="' . RouteHelper::_('index.php?view=' . $name) . '">' . ucwords(TextHelper::_('COBALT_MENU_' . strtoupper($name))) . '</a></li>';
     }
     $list_html .= '</ul>';
     $list_html .= '<ul class="nav navbar-nav navbar-right">';
     $list_html .= '<li data-toggle="tooltip" title="' . TextHelper::_('COBALT_CREATE_ITEM') . '" data-placement="right" class="dropdown">';
     $list_html .= '<a class="feature-btn dropdown-toggle" data-toggle="dropdown" href="#" id="create_button">';
     $list_html .= '<i class="glyphicon glyphicon-plus-sign icon-white"></i>';
     $list_html .= '</a>';
     $list_html .= '<ul class="dropdown-menu">';
     $list_html .= '<li>';
     $list_html .= '<a href="' . RouteHelper::_('index.php?view=companies&layout=edit&format=raw&tmpl=component') . '" data-target="#CobaltAjaxModal" data-toggle="modal">';
     $list_html .= '<i class="glyphicon glyphicon-plus-sign"></i> ' . ucwords(TextHelper::_('COBALT_NEW_COMPANY'));
     $list_html .= '</a>';
     $list_html .= '</li>';
     $list_html .= '<li><a href="' . RouteHelper::_('index.php?view=people&layout=edit&format=raw&tmpl=component') . '" data-target="#CobaltAjaxModal" data-toggle="modal">';
     $list_html .= '<i class="glyphicon glyphicon-plus-sign"></i> ' . ucwords(TextHelper::_('COBALT_NEW_PERSON'));
     $list_html .= '</a></li>';
     $list_html .= '<li><a href="' . RouteHelper::_('index.php?view=deals&layout=edit&format=raw&tmpl=component') . '" data-target="#CobaltAjaxModal" data-toggle="modal">';
     $list_html .= '<i class="glyphicon glyphicon-plus-sign"></i> ' . ucwords(TextHelper::_('COBALT_NEW_DEAL'));
     $list_html .= '</a></li>';
     $list_html .= '<li><a href="' . RouteHelper::_('index.php?view=goals&layout=add') . '">';
     $list_html .= '<i class="glyphicon glyphicon-plus-sign"></i> ' . ucwords(TextHelper::_('COBALT_NEW_GOAL'));
     $list_html .= '</a></li>';
     $list_html .= '</ul></li>';
     $list_html .= '<li data-toggle="tooltip" title="' . TextHelper::_('COBALT_VIEW_PROFILE') . '" data-placement="bottom">';
     $list_html .= '<a class="block-btn" href="' . RouteHelper::_('index.php?view=profile') . '" >';
     $list_html .= '<i class="glyphicon glyphicon-user icon-white"></i>';
     $list_html .= '</a>';
     $list_html .= '</li>';
     $list_html .= '<li data-toggle="tooltip" title="' . TextHelper::_('COBALT_SUPPORT') . '" data-placement="bottom">';
     $list_html .= '<a class="block-btn" href="http://www.cobaltcrm.org/" target="_blank">';
     $list_html .= '<i class="glyphicon glyphicon-question-sign icon-white"></i>';
     $list_html .= '</a>';
     $list_html .= '</li>';
     $list_html .= '<li data-toggle="tooltip" title="' . TextHelper::_('COBALT_SEARCH') . '" data-placement="bottom">';
     $list_html .= '<a class="block-btn" href="#" onclick="Cobalt.showSiteSearch(); return false;">';
     $list_html .= '<i class="glyphicon glyphicon-search icon-white"></i>';
     $list_html .= '</a>';
     $list_html .= '</li>';
     if (UsersHelper::isAdmin()) {
         $list_html .= '<li data-toggle="tooltip" title="' . TextHelper::_('COBALT_ADMINISTRATOR_CONFIGURATION') . '" data-placement="bottom">';
         $list_html .= '<a class="block-btn" href="' . RouteHelper::_('index.php?view=cobalt') . '" >';
         $list_html .= '<i class="glyphicon glyphicon-cog icon-white"></i>';
         $list_html .= '</a>';
         $list_html .= '</li>';
     }
     if (UsersHelper::getLoggedInUser() && !(JFactory::getApplication()->input->get('view') == "print")) {
         $returnURL = base64_encode(RouteHelper::_('index.php?view=dashboard'));
         $list_html .= '<li data-toggle="tooltip" title="' . TextHelper::_('COBALT_LOGOUT') . '" data-placement="bottom">';
         $list_html .= '<a class="block-btn" data-toggle="modal" href="#logoutModal">';
         $list_html .= '<i class="glyphicon glyphicon-off icon-white"></i>';
         $list_html .= '</a>';
         $list_html .= '</li>';
     }
     $list_html .= '</ul>';
     $list_html .= '</div>';
     $list_html .= '<div class="container">';
     $list_html .= '<div style="display:none;" class="pull-right col-xs-3" id="site_search">';
     $list_html .= '<form action="index.php" id="site_search_form">';
     $list_html .= '<input type="text" class="form-control site_search" name="site_search_input" id="site_search_input" placeholder="' . TextHelper::_('COBALT_SEARCH_SITE') . '" value="" />';
     $list_html .= '<input type="hidden" name="view" />';
     $list_html .= '<input type="hidden" name="id" />';
     $list_html .= '<input type="hidden" name="layout" />';
     $list_html .= '</form>';
     $list_html .= '</div>';
     $list_html .= '</div>';
     $list_html .= '</div>';
     //return html
     echo $list_html;
 }