/**
  * Generate the module
  */
 protected function compile()
 {
     parent::compile();
     // --- create FE template for javascript caller
     $objTemplateJs = new \FrontendTemplate($this->strTemplateJs);
     $objTemplateJs->id = $this->id;
     $objTemplateJs->cssIDonly = $this->cssID[0];
     $objMmenu = new Mmenu();
     $objMmenu->createTemplateData($this->Template, $objTemplateJs);
 }
 /**
  * Display a wildcard in the back end
  * @return string
  */
 public function generate()
 {
     if (TL_MODE == 'BE') {
         $this->Template = new \BackendTemplate('be_wildcard');
         $this->Template->wildcard = '### ONE-PAGE-WEBSITE :: NAVIGATION ###' . "<br>" . $GLOBALS['TL_LANG']['FMD'][$this->type][0];
         $this->Template->title = $this->headline;
         return $this->Template->parse();
     }
     // if no id is given, generate one
     $arrCssID = deserialize($this->cssID);
     if (strlen($arrCssID[0]) < 1) {
         $arrCssID[0] = 'onepagewebsitenavigation_' . $this->id;
         $this->cssID = $arrCssID;
     }
     return parent::generate();
 }
Beispiel #3
0
 /**
  * Creates a new navigation module.
  * @param Controller $controller Controller used to generate this module.
  * @param string     $tpl        Template to use for displaying this module.
  */
 public function __construct($controller)
 {
     parent::__construct($controller, 'navbar');
     $this->addStylesheet(DIAMONDMVC_URL . '/modules/navigation/css/navigation.css');
 }
Beispiel #4
0
 public static function main()
 {
     global $user;
     // Tabs
     $template_header = new HTMLTemplate("base/navigation/main/main_navigation_header.html");
     $module_navigation_array = ModuleNavigation::list_module_navigations_entries();
     if (is_array($module_navigation_array) and count($module_navigation_array) >= 1) {
         $module_tab_string = "";
         $module_tab_active = false;
         foreach ($module_navigation_array as $key => $value) {
             $module_name = SystemHandler::get_module_name_by_module_id($value['module_id']);
             if ($module_name == "base" and $value['alias'] == "admin" and $user->is_admin() or $module_name != "base" or $module_name == "base" and $value['alias'] != "admin") {
                 $paramquery['username'] = $_GET['username'];
                 $paramquery['session_id'] = $_GET['session_id'];
                 if ($value['alias']) {
                     $active_alias = $module_name . "." . $value['alias'];
                     $paramquery['nav'] = $module_name . "." . $value['alias'];
                 } else {
                     $active_alias = $module_name;
                     $paramquery['nav'] = $module_name;
                 }
                 $params = http_build_query($paramquery, '', '&#38;');
                 if (!$_GET['nav'] and $active_alias == "base") {
                     $_GET['nav'] = "base";
                 }
                 switch ($value['colour']) {
                     case "blue":
                         if ($_GET['nav'] == $active_alias) {
                             $background_color_class = "NavigationBackgroundBlue";
                             $template = new HTMLTemplate("base/navigation/main/tabs/blue_tab_active.html");
                             $current_module = $active_alias;
                             $current_color = $value['colour'];
                             $module_tab_active = true;
                         } else {
                             $template = new HTMLTemplate("base/navigation/main/tabs/blue_tab.html");
                         }
                         break;
                     case "green":
                         if ($_GET['nav'] == $active_alias) {
                             $background_color_class = "NavigationBackgroundGreen";
                             $template = new HTMLTemplate("base/navigation/main/tabs/green_tab_active.html");
                             $current_module = $active_alias;
                             $current_color = $value['colour'];
                             $module_tab_active = true;
                         } else {
                             $template = new HTMLTemplate("base/navigation/main/tabs/green_tab.html");
                         }
                         break;
                     case "orange":
                         if ($_GET['nav'] == $active_alias) {
                             $background_color_class = "NavigationBackgroundOrange";
                             $template = new HTMLTemplate("base/navigation/main/tabs/orange_tab_active.html");
                             $current_module = $active_alias;
                             $current_color = $value['colour'];
                             $module_tab_active = true;
                         } else {
                             $template = new HTMLTemplate("base/navigation/main/tabs/orange_tab.html");
                         }
                         break;
                     default:
                         if ($_GET['nav'] == $active_alias) {
                             $background_color_class = "NavigationBackgroundGrey";
                             $template = new HTMLTemplate("base/navigation/main/tabs/grey_tab_active.html");
                             $current_module = $active_alias;
                             $current_color = $value['colour'];
                             $module_tab_active = true;
                         } else {
                             $template = new HTMLTemplate("base/navigation/main/tabs/grey_tab.html");
                         }
                         break;
                 }
                 $template->set_var("params", $params);
                 $template->set_var("title", Language::get_message($value['language_address'], "navigation"));
                 $config_folder = "core/modules/" . SystemHandler::get_module_folder_by_module_name($module_name) . "/config";
                 if (is_dir($config_folder)) {
                     $subnavigation_file = $config_folder . "/module_subnavigation.php";
                     if (is_file($subnavigation_file)) {
                         require_once $subnavigation_file;
                         if (is_array($sub_menu) and count($sub_menu) >= 1) {
                             $template->set_var("down", true);
                             $template->set_var("link", $sub_menu);
                         } else {
                             $template->set_var("down", false);
                         }
                         unset($sub_menu);
                     } else {
                         $template->set_var("down", false);
                     }
                 } else {
                     $template->set_var("down", false);
                 }
                 $module_tab_string .= $template->get_string();
             }
         }
     }
     $template_header->set_var("background_class", $background_color_class);
     $template_header->output();
     echo $module_tab_string;
     $template = new HTMLTemplate("base/navigation/main/main_navigation_footer.html");
     $template->output();
 }
Beispiel #5
0
<?php

/**
 * @package  DiamondMVC
 * @author   Zyr <*****@*****.**>
 * @version  1.0
 * @license  CC-SA 4.0 (https://creativecommons.org/licenses/by-sa/4.0/)
 * 
 * Backend landing page. This page is to feature a dashboard with the most important
 * overview functions. Ideally I'd like the system to feature methods to allow extensions
 * to add more widgets to the dashboard.
 */
defined('DIAMONDMVC') or die;
$nav = new ModuleNavigation($this->controller, 'long');
$nav->addLink('Users', DIAMONDMVC_URL . '/system/users')->addLink('Permissions', DIAMONDMVC_URL . '/system/permissions')->addLink('Installations', DIAMONDMVC_URL . '/system/installations')->addLink('Plugins', DIAMONDMVC_URL . '/system/plugins');
?>
<div class="view" id="view-system">
	<div class="dashboard">
		<!-- TODO: dashboard showing various interesting things like available updates, registered users, etc. -->
	</div>
	<?php 
echo $nav;
?>
</div>
 protected function renderNavigation($pid, $level = 1, $host = null, $language = null)
 {
     $parentPage = PageModel::findByPk($pid);
     if (!$parentPage->rsmm_enabled || !$parentPage->rsmm_id) {
         return parent::renderNavigation($pid, $level, $host, $language);
     }
     $menu = MenuModel::findByPk($parentPage->rsmm_id);
     if (!$menu || !$menu->id) {
         return '';
     }
     $template = new FrontendTemplate($this->rsmm_template);
     $template->id = $menu->id;
     $template->type = $menu->type;
     $template->cssClass = $menu->cssClass;
     $template->cssId = $menu->cssId;
     $template->level = 'level_' . ($level + 1);
     $template->html = $menu->html;
     $template->backgroundImage = $this->getImageObject($menu->backgroundImage, $menu->backgroundImageSize);
     $template->backgroundStyle = '';
     if ($template->backgroundImage) {
         $template->backgroundStyle .= 'background-image: url(&quot;' . $template->backgroundImage->src . '&quot;);';
     }
     if ($menu->backgroundSize) {
         $template->backgroundStyle .= 'background-size: ' . $menu->backgroundSize . ';';
     }
     if ($menu->backgroundPosition) {
         $template->backgroundStyle .= 'background-position: ' . $menu->backgroundPosition . ';';
     }
     if ($menu->backgroundRepeat) {
         $template->backgroundStyle .= 'background-repeat: ' . $menu->backgroundRepeat . ';';
     }
     $sliderAssetsDir = version_compare(VERSION, '4.0', '>=') ? 'web/bundles/rocksolidslider' : 'system/modules/rocksolid-slider/assets';
     if ($menu->slider && file_exists(TL_ROOT . '/' . $sliderAssetsDir . '/js/rocksolid-slider.min.js')) {
         $template->slider = true;
         $options = array('navType' => $menu->sliderNavType, 'controls' => $menu->sliderControls, 'gapSize' => $menu->sliderGapSize, 'skin' => $menu->sliderSkin ?: 'mega-dropdown', 'loop' => (bool) $menu->sliderLoop, 'keyboard' => false);
         if ($menu->sliderMaxCount) {
             $options['slideMaxCount'] = (int) $menu->sliderMaxCount;
         }
         if ($menu->sliderMinSize) {
             $options['slideMinSize'] = (int) $menu->sliderMinSize;
         }
         if ($menu->sliderPrevNextSteps) {
             $options['prevNextSteps'] = (int) $menu->sliderPrevNextSteps;
         }
         $template->sliderOptions = $options;
         $GLOBALS['TL_JAVASCRIPT'][] = $sliderAssetsDir . '/js/rocksolid-slider.min.js|static';
         $GLOBALS['TL_CSS'][] = $sliderAssetsDir . '/css/rocksolid-slider.min.css||static';
         $template->getColumnClassName = function () {
             return '';
         };
     } else {
         $columnsConfig = ColumnsStart::getColumnsConfiguration($menu->row());
         $template->getColumnClassName = function ($index) use($columnsConfig) {
             $classes = array('rs-column');
             foreach ($columnsConfig as $name => $media) {
                 $classes = array_merge($classes, $media[$index % count($media)]);
                 if ($index < count($media)) {
                     $classes[] = '-' . $name . '-first-row';
                 }
             }
             return implode(' ', $classes);
         };
     }
     if ($menu->type === 'manual') {
         $menuColumns = MenuColumnModel::findPublishedByPid($menu->id);
         if (!$menuColumns) {
             return '';
         }
         $columns = array();
         while ($menuColumns->next()) {
             $column = $menuColumns->row();
             if ($column['page']) {
                 $pageResult = PageModel::findPublishedById($column['page']);
                 if ($pageResult) {
                     $column['page'] = $this->getPageData($pageResult, $column['imageSize']);
                 } else {
                     $column['page'] = null;
                 }
             }
             $column['image'] = $this->getImageObject($column['image'], $column['imageSize']);
             if ($column['type'] === 'manual' || $column['type'] === 'manual_image') {
                 $column['pages'] = $this->buildPagesArray($column['pages'], $column['imageSize'], $column['orderPages']);
             } else {
                 if ($column['type'] === 'auto' || $column['type'] === 'auto_image') {
                     $column['pages'] = $this->buildPagesArray($column['page'], $column['imageSize']);
                 } else {
                     $column['pages'] = null;
                 }
             }
             $columns[] = $column;
         }
         $template->columns = $columns;
     } else {
         if ($menu->type !== 'html') {
             $template->pages = $this->buildPagesArray($pid, $menu->imageSize);
         }
     }
     return $template->parse();
 }
 /**
  * @param string $json_column_array
  * @param string $json_argument_array
  * @param string $get_array
  * @param string $css_page_id
  * @param string $css_row_sort_id
  * @param string $entries_per_page
  * @param string $page
  * @param string $sortvalue
  * @param string $sortmethod
  * @return string
  * @throws BaseUserAccessDeniedException
  */
 public static function list_navigation($json_column_array, $json_argument_array, $get_array, $css_page_id, $css_row_sort_id, $entries_per_page, $page, $sortvalue, $sortmethod)
 {
     global $user;
     if ($user->is_admin()) {
         if ($get_array) {
             $_GET = unserialize($get_array);
         }
         $list_request = new ListRequest_IO();
         $list_request->set_column_array($json_column_array);
         if (!is_numeric($entries_per_page) or $entries_per_page < 1) {
             $entries_per_page = 20;
         }
         $list_array = System_Wrapper::list_base_module_navigation($page * $entries_per_page - $entries_per_page, $page * $entries_per_page);
         if (is_array($list_array) and count($list_array) >= 1) {
             foreach ($list_array as $key => $value) {
                 $paramquery = $_GET;
                 $paramquery['id'] = $list_array[$key]['id'];
                 $paramquery['action'] = "hide";
                 unset($paramquery['sortvalue']);
                 unset($paramquery['sortmethod']);
                 unset($paramquery['nextpage']);
                 $params = http_build_query($paramquery, '', '&#38;');
                 $list_array[$key]['hide']['link'] = $params;
                 $list_array[$key]['name'] = Language::get_message($list_array[$key]['name'], "navigation");
                 if ($list_array[$key]['hidden'] == 't') {
                     $list_array[$key]['hide']['content'] = "<img src='images/icons/grey_point.png' alt='hide' style='border: 0;' />";
                 } else {
                     $list_array[$key]['hide']['content'] = "<img src='images/icons/green_point.png' alt='hide' style='border: 0;' />";
                 }
                 if ($list_array[$key]['position'] != 1) {
                     $paramquery = $_GET;
                     $paramquery['id'] = $list_array[$key]['id'];
                     $paramquery['action'] = "upwards";
                     unset($paramquery['sortvalue']);
                     unset($paramquery['sortmethod']);
                     unset($paramquery['nextpage']);
                     $params = http_build_query($paramquery, '', '&#38;');
                     $list_array[$key]['uw']['link'] = $params;
                     $list_array[$key]['uw']['content'] = "<img src='images/icons/upward.png' alt='uw' style='border: 0;' />";
                 } else {
                     $list_array[$key]['uw'] = "<img src='images/icons/upward_na.png' alt='uw' style='border: 0;' />";
                 }
                 if ($list_array[$key]['position'] != ModuleNavigation::get_highest_position()) {
                     $paramquery = $_GET;
                     $paramquery['id'] = $list_array[$key]['id'];
                     $paramquery['action'] = "downwards";
                     unset($paramquery['sortvalue']);
                     unset($paramquery['sortmethod']);
                     unset($paramquery['nextpage']);
                     $params = http_build_query($paramquery, '', '&#38;');
                     $list_array[$key]['dw']['link'] = $params;
                     $list_array[$key]['dw']['content'] = "<img src='images/icons/downward.png' alt='dw' style='border: 0;' />";
                 } else {
                     $list_array[$key]['dw'] = "<img src='images/icons/downward_na.png' alt='dw' style='border: 0;' />";
                 }
             }
         } else {
             $list_request->empty_message("<span class='italic'>No results found!</span>");
         }
         $list_request->set_array($list_array);
         return $list_request->get_page($page);
     } else {
         throw new BaseUserAccessDeniedException();
     }
 }
 /**
  * @throws BaseModuleNavigationIDMissingException
  */
 public static function downwards()
 {
     if ($_GET['id']) {
         $module_navigation = new ModuleNavigation($_GET['id']);
         $paramquery = $_GET;
         unset($paramquery['action']);
         unset($paramquery['id']);
         $params = http_build_query($paramquery, '', '&#38;');
         if ($module_navigation->downwards()) {
             Common_IO::step_proceed($params, "Downwards", "Operation Successful", null);
         } else {
             Common_IO::step_proceed($params, "Downwards", "Operation Failed", null);
         }
     } else {
         throw new BaseModuleNavigationIDMissingException();
     }
 }