Ejemplo n.º 1
0
/**
 * Renders a custom menu
 * @param string $menu
 */
function render_menu($menu = null)
{
    if (is_null($menu)) {
        $menu = load_menu('menu.php');
    }
    $nav = '<ul class="navbar menu">';
    foreach ($menu as $child) {
        if (sfContext::getInstance()->getUser()->hasCredential($child->getCredentials())) {
            $nav .= '<li class="menu-item ' . ($child->hasChildren() ? 'has-sub-menu' : '') . '" id="' . Scss::slugify($child->getName()) . '-menu-item">' . $child->renderLink();
            //link_to($child->getName(),$child->getRoute(),$child->getLinkOptions());
            if ($child->hasChildren()) {
                $nav .= '<ul class="sub-menu">';
                foreach ($child as $baby) {
                    if ($baby->checkUserAccess()) {
                        $nav .= '<li class="menu-item" id="' . Scss::slugify($baby->getName()) . '">' . link_to($baby->getName(), $baby->getRoute(), $baby->getLinkOptions()) . '</li>';
                    }
                }
                $nav .= '</ul>';
            }
            $nav .= '</li>';
        }
    }
    $nav .= '</ul>';
    print_r($nav);
}
Ejemplo n.º 2
0
/**
 * Loads all Mobile.Nav components
 */
function sdrn_init()
{
    if (load_menu()) {
        add_action('wp_enqueue_scripts', 'sdrn_frontend_scripts_and_styles');
        add_filter('body_class', 'sdrn_body_classes');
        add_action('wp_footer', 'sdrn_menu', 100);
        add_filter('nav_menu_link_attributes', 'sdrn_item_attributes', 10, 3);
        add_action('wp_head', 'sdrn_header_styles');
    }
}
Ejemplo n.º 3
0
				function load_menu($parent_id, $items) {
					echo '<ul>';
					foreach ($items as $item) {
						if ($item->parent_id == $parent_id) {
							if ($item->parent_id == 0) {
								echo "<li class='catalog-cat-item' tab='".$item->id."'>";
							}
							else {
								echo "<li>";
							}		
							echo "<a href='/products/show/".$item->id."'>", $item->name, "<br><span>", $item->description, "</span></a>";
							// echo "<a href='/products/show/".$item->id."'>", $item->name, "</a>";
							load_menu($item->id, $items);
							echo "</li>";
							
						}
					};
					echo "</ul>";
				};
Ejemplo n.º 4
0
 ********************************************************************************/
require_once 'XTemplate/xtpl.php';
require_once "include/utils/mvc_utils.php";
global $currentModule;
global $moduleList;
global $theme, $action;
$theme_path = "themes/" . $theme . "/";
////SNIPPET REMOVED FOR TEMPLATING
//$image_path=$theme_path."images/";
/////END SNIPPET REMOVED FOR TEMPLATING
require_once $theme_path . 'layout_utils.php';
require_once "include/globalControlLinks.php";
require $theme_path . 'config.php';
global $app_strings;
$module_path = "modules/" . $currentModule . "/";
load_menu($module_path);
$default_charset = $sugar_config['default_charset'];
$xtpl = new XTemplate($theme_path . "header.html");
$xtpl->assign("APP", $app_strings);
if (isset($app_strings['LBL_CHARSET'])) {
    $xtpl->assign("LBL_CHARSET", $app_strings['LBL_CHARSET']);
} else {
    $xtpl->assign("LBL_CHARSET", $default_charset);
}
//////SNIPPET ADDED FOR TEMPLATING
$image_server = '';
if (defined('TEMPLATE_URL')) {
    $image_server = TEMPLATE_URL . '/';
}
$xtpl->assign("IMAGE_SERVER", $image_server);
///////END SNIPPET FOR TEMPLATING
Ejemplo n.º 5
0
 * this program; if not, see http://www.gnu.org/licenses or write to the Free
 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 * 02110-1301 USA.
 * 
 * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
 * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
 * 
 * The interactive user interfaces in modified source and object code versions
 * of this program must display Appropriate Legal Notices, as required under
 * Section 5 of the GNU General Public License version 3.
 * 
 * In accordance with Section 7(b) of the GNU General Public License version 3,
 * these Appropriate Legal Notices must retain the display of the "Powered by
 * SugarCRM" logo. If the display of the logo is not reasonably feasible for
 * technical reasons, the Appropriate Legal Notices must display the words
 * "Powered by SugarCRM".
 ********************************************************************************/
/*********************************************************************************
 * Description: Menu for the Import module. Just inherits the menu used in 
 * whatever module is being imported into.
 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
 * All Rights Reserved.
 ********************************************************************************/
global $sugar_config, $mod_strings;
// hide current module strings since we'll be overwriting them
$old_mod_strings = $mod_strings;
// grab the current module's mod_strings and process it's menu
$mod_strings = return_module_language($GLOBALS['current_language'], $_REQUEST['import_module']);
$module_menu = load_menu("modules/{$_REQUEST['import_module']}/");
// reset current mod_strings
$mod_strings = $old_mod_strings;
Ejemplo n.º 6
0
        print $output['content'];
    } elseif ($route->controller == 'input' && $route->action == 'post') {
        print $output['content'];
    } elseif ($route->controller == 'input' && $route->action == 'bulk') {
        print $output['content'];
    } else {
        print json_encode($output['content']);
    }
} else {
    if ($route->format == 'html') {
        // Select the theme
        $themeDir = "Theme/" . $theme . "/";
        if ($embed == 1) {
            print view($themeDir . "embed.php", $output);
        } else {
            $menu = load_menu();
            $output['mainmenu'] = view($themeDir . "menu_view.php", array());
            print view($themeDir . "theme.php", $output);
        }
    } else {
        if ($route->format == 'text' || $route->format == 'text/plain') {
            header('Content-Type: text');
            print $output['content'];
        } else {
            header($_SERVER["SERVER_PROTOCOL"] . " 406 Not Acceptable");
            print "URI not acceptable. Unknown format '" . $route->format . "'.";
        }
    }
}
$ltime = microtime(true) - $ltime;
// if ($session['userid']>0) {
Ejemplo n.º 7
0
echo link_to('Settings', '/settings/account');
?>
</li>
        <li><?php 
echo $sf_user->isAuthenticated(true) ? link_to('Log Out', '@sf_guard_signout') : link_to('Sign Up', '@sf_guard_signup');
?>
</li>
      </ul>
      <div id="logo">
        <?php 
echo link_to('summercamp<span>schedulingsystem</span>', $sf_user->isAuthenticated() ? '@dashboard' : '@homepage');
?>
<sup>BETA</sup>
      </div>
      <?php 
$menu = load_menu('menu.php');
$menu->render();
?>
    </div>
  </div>
  <div id="main-content" class="container">
    <?php 
echo $sf_content;
?>
<br /> <br /> <br /><br /><br /><br />
  </div>
  <div id="footer">
    <div class="copyright">&copy; 2010, 2011 SCSS; all rights reserved</div>
    <div class="footer-links">
      <span class="about-tab">About SCSS</span>&nbsp;|&nbsp;
      <span class="privacy-tab">Privacy Policy</span>&nbsp;|&nbsp;
<!--Start. Top menu and authentication data block-->
<div class="menu-header">
    <div class="container">
        <nav class="left-header f_l">
            <ul class="nav">
                <?php 
echo load_menu('top_menu');
?>
            </ul>
        </nav>
        <div class="right-header f_r">
            <?php 
$this->include_shop_tpl('auth_data', '/home/igor/sites/skidka-shop.com.ua/www/templates/lightVertical');
?>
        </div>
    </div>
</div>
<!--End. Top menu and authentication data block-->
<div class="content-header">
    <div class="container">
        <!--        Logo-->

        <div class="left-content-header">
            <div class="header-left-content-header t-a_j">
                <?php 
if ($CI->uri->uri_string() == '') {
    ?>
                <span class="logo">
                    <img src="<?php 
    echo siteinfo('siteinfo_logo_url');
    ?>
Ejemplo n.º 9
0

var texts = new Array(
					  			"<font  color='{COLOR}' ><?php 
echo $header;
?>
</font>"
					  
					  	
					  );
var bgcolor = "#FF0000"; // background color, must be valid browser hex color (not color names)
var fcolor = "#FFFF66";  // foreground or font color
var steps = 60; // number of steps to fade
var show = 500; // milliseconds to display message
var sleep = 600; // milliseconds to pause inbetween messages
var loop = stop; // true = continue to display messages, false = stop at last message
</SCRIPT>
<script language="JavaScript" src="fader.js"></script>
<body class="yui-skin-sam" style="padding:0; margin:0;"  onLoad="animate();progres_bar();fade();">
<?php 
$menus = load_menu();
if (b_logged()) {
    theme_main_page();
} else {
    theme_login_page();
}
include "form_dialog.php";
?>
</body>
</html>
Ejemplo n.º 10
0
    /**
     * Determine whether or not to dispay the header on the page.
     */
    function displayHeader()
    {
        global $theme;
        global $max_tabs;
        global $app_strings;
        global $current_user;
        global $sugar_config;
        global $app_list_strings;
        $GLOBALS['app']->headerDisplayed = true;
        if (!function_exists('get_new_record_form') && (file_exists('modules/' . $this->module . '/metadata/sidecreateviewdefs.php') || file_exists('custom/modules/' . $this->module . '/metadata/sidecreateviewdefs.php'))) {
            require_once 'include/EditView/SideQuickCreate.php';
        }
        if (!$this->_menuExists($this->module) && !empty($GLOBALS['mod_strings']['LNK_NEW_RECORD'])) {
            $GLOBALS['module_menu'][] = array("index.php?module={$this->module}&action=EditView&return_module={$this->module}&return_action=DetailView", $GLOBALS['mod_strings']['LNK_NEW_RECORD'], "{$GLOBALS['app_strings']['LBL_CREATE_BUTTON_LABEL']}{$this->module}", $this->module);
            $GLOBALS['module_menu'][] = array("index.php?module={$this->module}&action=index", $GLOBALS['mod_strings']['LNK_LIST'], $this->module, $this->module);
        }
        $themeObject = SugarThemeRegistry::current();
        $theme = $themeObject->__toString();
        $ss = new Sugar_Smarty();
        $ss->assign("APP", $app_strings);
        $ss->assign("THEME", $theme);
        $ss->assign("MODULE_NAME", $this->module);
        // get css
        $css = $themeObject->getCSS();
        if ($this->_getOption('view_print')) {
            $css .= '\\n<link rel="stylesheet" type="text/css" href="' . $themeObject->getCSSURL('print.css') . '" media="all" />';
        }
        $ss->assign("SUGAR_CSS", $css);
        // get javascript
        ob_start();
        $this->renderJavascript();
        $ss->assign("SUGAR_JS", ob_get_contents() . $themeObject->getJS());
        ob_end_clean();
        // get favicon
        $user_module_favicon = $current_user->getPreference('module_favicon');
        if (!isset($user_module_favicon) && isset($GLOBALS['sugar_config']['default_module_favicon'])) {
            $user_module_favicon = $GLOBALS['sugar_config']['default_module_favicon'];
        } elseif (!isset($user_module_favicon)) {
            $user_module_favicon = false;
        }
        $favicon = $themeObject->getImageURL($this->module . '.gif', false);
        if (!sugar_is_file($favicon) || !$user_module_favicon) {
            $favicon = $themeObject->getImageURL('sugar_icon.ico', false);
        }
        $ss->assign('FAVICON_URL', getJSPath($favicon));
        // get the module menu
        $shortcut_menu = array();
        $module_menu = load_menu("modules/" . $this->module . "/");
        foreach ($module_menu as $key => $menu_item) {
            $shortcut_menu[$key] = array("URL" => $menu_item[0], "LABEL" => $menu_item[1], "MODULE_NAME" => $menu_item[2], "IMAGE" => $themeObject->getImage($menu_item[2], "alt='" . $menu_item[1] . "'  border='0' align='absmiddle'"));
        }
        $ss->assign("SHORTCUT_MENU", $shortcut_menu);
        // handle rtl text direction
        if (isset($_REQUEST['RTL']) && $_REQUEST['RTL'] == 'RTL') {
            $_SESSION['RTL'] = true;
        }
        if (isset($_REQUEST['LTR']) && $_REQUEST['LTR'] == 'LTR') {
            unset($_SESSION['RTL']);
        }
        if (isset($_SESSION['RTL']) && $_SESSION['RTL']) {
            $ss->assign("DIR", 'dir="RTL"');
        }
        // handle resizing of the company logo correctly on the fly
        $companyLogoURL = $themeObject->getImageURL('company_logo.png', false);
        $ss->assign("COMPANY_LOGO_URL", getJSPath($companyLogoURL));
        $company_logo_attributes = sugar_cache_retrieve('company_logo_attributes');
        if (!empty($company_logo_attributes) && md5_file($companyLogoURL) == $company_logo_attributes[0]) {
            $ss->assign("COMPANY_LOGO_WIDTH", $company_logo_attributes[1]);
            $ss->assign("COMPANY_LOGO_HEIGHT", $company_logo_attributes[2]);
        } else {
            list($width, $height) = getimagesize($companyLogoURL);
            if ($width > 212 || $height > 40) {
                $resizePctWidth = ($width - 212) / 212;
                $resizePctHeight = ($height - 40) / 40;
                if ($resizePctWidth > $resizePctHeight) {
                    $resizeAmount = $width / 212;
                } else {
                    $resizeAmount = $height / 40;
                }
                $ss->assign("COMPANY_LOGO_WIDTH", round($width * (1 / $resizeAmount)));
                $ss->assign("COMPANY_LOGO_HEIGHT", round($height * (1 / $resizeAmount)));
                sugar_cache_put('company_logo_attributes', array(md5_file($companyLogoURL), $ss->get_template_vars("COMPANY_LOGO_WIDTH"), $ss->get_template_vars("COMPANY_LOGO_HEIGHT")));
            } else {
                $ss->assign("COMPANY_LOGO_WIDTH", $width);
                $ss->assign("COMPANY_LOGO_HEIGHT", $height);
            }
        }
        // get the global links
        $gcls = array();
        $global_control_links = array();
        require "include/globalControlLinks.php";
        foreach ($global_control_links as $key => $value) {
            if ($key == 'users') {
                //represents logout link.
                $ss->assign("LOGOUT_LINK", $value['linkinfo'][key($value['linkinfo'])]);
                $ss->assign("LOGOUT_LABEL", key($value['linkinfo']));
                //key value for first element.
                continue;
            }
            foreach ($value as $linkattribute => $attributevalue) {
                // get the main link info
                if ($linkattribute == 'linkinfo') {
                    $gcls[$key] = array("LABEL" => key($attributevalue), "URL" => current($attributevalue));
                }
                // and now the sublinks
                if ($linkattribute == 'submenu' && is_array($attributevalue)) {
                    foreach ($attributevalue as $submenulinkkey => $submenulinkinfo) {
                        $gcls[$key]['SUBMENU'][$submenulinkkey] = array("LABEL" => key($submenulinkinfo), "URL" => current($submenulinkinfo));
                    }
                }
            }
        }
        $ss->assign("GCLS", $gcls);
        if (isset($_REQUEST['query_string'])) {
            $ss->assign("SEARCH", $_REQUEST['query_string']);
        }
        if ($this->action == "EditView" || $this->action == "Login") {
            $ss->assign("ONLOAD", 'onload="set_focus()"');
        }
        $ss->assign("AUTHENTICATED", isset($_SESSION["authenticated_user_id"]));
        if (isset($_SESSION["authenticated_user_id"])) {
            $ss->assign('selectThemeOptions', get_select_options_with_id(SugarThemeRegistry::availableThemes(), SugarThemeRegistry::current()->__toString()));
            // build json string of theme properties
            $allThemes = array();
            foreach (SugarThemeRegistry::availableThemes() as $dirName => $themeName) {
                $selectedTheme = SugarThemeRegistry::get($dirName);
                $allThemes[$dirName] = array('name' => $themeName, 'description' => $selectedTheme->description, 'previewImage' => $selectedTheme->getImageURL('themePreview.png'), 'colorSelect' => '', 'fontSelect' => '');
                // foreach color
                if (count($selectedTheme->colors) > 1) {
                    $startingColorName = $selectedTheme->colors[0];
                    if (!empty($_SESSION['authenticated_user_theme_color']) && in_array($_SESSION['authenticated_user_theme_color'], $themeObject->colors)) {
                        $startingColorName = $_SESSION['authenticated_user_theme_color'];
                    }
                    $startingColorIcon = $selectedTheme->getImageURL("colors.{$startingColorName}.icon.gif");
                    $allThemes[$dirName]['colorSelect'] = <<<EOHTML
                    
<script type="text/javascript">

function change_color(color) {
\t\tvar callback = {
            success: function(o){
\t\t\t\tSUGAR.themes.changeColor(color);
            },
            failure: function(o){
            alert("Ajax failure");
            }
        }   
\t\tvar postData = '&usercolor='+color;
        YAHOO.util.Connect.asyncRequest('POST','index.php?module=Home&action=index', callback, postData); 
}

function change_font(font) { 
\tvar callback = {
            success: function(o){
\t\t\t\tSUGAR.themes.changeFont(font);
            },
            failure: function(o){
            alert("Ajax failure");
            }
        }   
\t\tvar postData = '&userfont='+font;
        YAHOO.util.Connect.asyncRequest('POST','index.php?module=Home&action=index', callback, postData);
}
</script>
<input type="hidden" name="usercolor" id="usercolor" value="">
<ul id="color_menu">
EOHTML;
                    foreach ($selectedTheme->colors as $color) {
                        $colorIcon = $selectedTheme->getImageURL("colors.{$color}.icon.gif");
                        $allThemes[$dirName]['colorSelect'] .= <<<EOHTML
<li style="background: url({$colorIcon})  no-repeat center;" onclick="change_color('{$color}');"></li>
EOHTML;
                    }
                    $allThemes[$dirName]['colorSelect'] .= '</ul></span>';
                }
                // foreach font
                if (count($selectedTheme->fonts) > 1) {
                    $startingFontName = $selectedTheme->fonts[0];
                    if (!empty($_SESSION['authenticated_user_theme_font']) && in_array($_SESSION['authenticated_user_theme_font'], $themeObject->fonts)) {
                        $startingFontName = $_SESSION['authenticated_user_theme_font'];
                    }
                    $startingFontIcon = $selectedTheme->getImageURL("fonts.{$startingFontName}.icon.gif");
                    $allThemes[$dirName]['fontSelect'] = <<<EOHTML
<input type="hidden" name="userfont" id="userfont" value="">
<ul id="font_menu">
EOHTML;
                    foreach ($selectedTheme->fonts as $font) {
                        $fontIcon = $selectedTheme->getImageURL("fonts.{$font}.icon.gif");
                        $allThemes[$dirName]['fontSelect'] .= <<<EOHTML
<li style="background: url({$fontIcon}) no-repeat;" onclick="change_font('{$font}');"></li>
EOHTML;
                    }
                    $allThemes[$dirName]['fontSelect'] .= '</ul></span>';
                }
            }
            $json = getJSONobj();
            $ss->assign('allThemes', $json->encode($allThemes));
            $ss->assign("CURRENTTHEME_NAME", $themeObject->name);
            $ss->assign("CURRENTTHEME_DESCRIPTION", $themeObject->description);
            $ss->assign("CURRENTTHEME_FONTSELECT", $allThemes[$themeObject->dirName]['fontSelect']);
            $ss->assign("CURRENTTHEME_COLORSELECT", $allThemes[$themeObject->dirName]['colorSelect']);
            // get the current user name and id
            $ss->assign("CURRENT_USER", $current_user->first_name != '' ? $current_user->first_name : $current_user->user_name);
            $ss->assign("CURRENT_USER_ID", $current_user->id);
            // get the last viewed records
            $tracker = new Tracker();
            $history = $tracker->get_recently_viewed($current_user->id);
            foreach ($history as $key => $row) {
                $history[$key]['item_summary_short'] = getTrackerSubstring($row['item_summary']);
                $history[$key]['image'] = SugarThemeRegistry::current()->getImage($row['module_name'], 'border="0" align="absmiddle" alt="' . $row['item_summary'] . '"');
            }
            $ss->assign("recentRecords", $history);
            // new record
            require_once "modules/" . $this->module . "/Forms.php";
            if ($this->action == "index" && function_exists('get_new_record_form')) {
                $ss->assign("NEW_RECORD", get_new_record_form());
            }
            // Get preference for shortcuts and last_viewed list placement
            $last_view_swap = $current_user->getPreference('swap_last_viewed');
            if (!isset($last_view_swap)) {
                $last_view_swap = $GLOBALS['sugar_config']['default_swap_last_viewed'];
            }
            $ss->assign("LEFT_FORM_LAST_VIEWED", $last_view_swap);
            $shortcuts_swap = $current_user->getPreference('swap_shortcuts');
            if (!isset($shortcuts_swap)) {
                $shortcuts_swap = $GLOBALS['sugar_config']['default_swap_shortcuts'];
            }
            $ss->assign("LEFT_FORM_SHORTCUTS", !$shortcuts_swap);
        }
        if (isset($_SESSION["authenticated_user_id"]) || $sugar_config['login_nav']) {
            // get the module list
            $moduleTopMenu = array();
            $max_tabs = $current_user->getPreference('max_tabs');
            if (!isset($max_tabs) || $max_tabs <= 0) {
                $max_tabs = $GLOBALS['sugar_config']['default_max_tabs'];
            }
            $user_navigation_paradigm = $current_user->getPreference('navigation_paradigm');
            if (!isset($user_navigation_paradigm)) {
                $user_navigation_paradigm = $GLOBALS['sugar_config']['default_navigation_paradigm'];
            }
            if ($user_navigation_paradigm == 'gm') {
                require_once 'include/GroupedTabs/GroupedTabStructure.php';
                $groupedTabsClass = new GroupedTabStructure();
                $modules = query_module_access_list($current_user);
                $ss->assign('groupTabs', $groupedTabsClass->get_tab_structure(get_val_array($modules)));
                $ss->assign('moduleNames', $app_list_strings['moduleList']);
                $ss->assign('defaultFirst', !in_array($this->module, $modules));
                $ss->assign('USE_GROUP_TABS', true);
            } else {
                $moduleExtraMenu = array();
                $i = 1;
                foreach (query_module_access_list($current_user) as $module) {
                    // Bug 25948 - Check for the module being in the moduleList
                    if (isset($app_list_strings['moduleList'][$module])) {
                        if ($i < $max_tabs) {
                            $moduleTopMenu[$module] = $app_list_strings['moduleList'][$module];
                        } else {
                            $moduleExtraMenu[$module] = $app_list_strings['moduleList'][$module];
                        }
                        ++$i;
                    }
                }
                // Now, we'll push the current module into the end of top menu list if it's not
                // already there. In addition, we'll preserve this last entry for this session
                // until a new value is added there.
                if (isset($moduleTopMenu[$this->module])) {
                    if (isset($_SESSION['moreTab']) && isset($app_list_strings['moduleList'][$_SESSION['moreTab']])) {
                        $moduleTopMenu[$_SESSION['moreTab']] = $app_list_strings['moduleList'][$_SESSION['moreTab']];
                        unset($moduleExtraMenu[$_SESSION['moreTab']]);
                    } else {
                        $moduleTopMenu += array_slice($moduleExtraMenu, 0, 1);
                        array_shift($moduleExtraMenu);
                    }
                } elseif (isset($moduleExtraMenu[$this->module])) {
                    $_SESSION['moreTab'] = $this->module;
                    $moduleTopMenu[$_SESSION['moreTab']] = $app_list_strings['moduleList'][$_SESSION['moreTab']];
                    unset($moduleExtraMenu[$_SESSION['moreTab']]);
                } elseif (isset($_SESSION['moreTab']) && isset($app_list_strings['moduleList'][$_SESSION['moreTab']])) {
                    $moduleTopMenu[$_SESSION['moreTab']] = $app_list_strings['moduleList'][$_SESSION['moreTab']];
                    unset($moduleExtraMenu[$_SESSION['moreTab']]);
                }
                $ss->assign("moduleTopMenu", $moduleTopMenu);
                $ss->assign("moduleExtraMenu", $moduleExtraMenu);
            }
        }
        $headerTpl = $themeObject->getTemplate('header.tpl');
        if (isset($GLOBALS['sugar_config']['developerMode']) && $GLOBALS['sugar_config']['developerMode']) {
            $ss->clear_compiled_tpl($headerTpl);
        }
        $ss->display($headerTpl);
        $this->includeClassicFile('modules/Administration/DisplayWarnings.php');
    }
Ejemplo n.º 11
0
<?php

/* @var $_settings PIASettings */
/* @var $_pia PIACommands */
/* @var $_files FilesystemOperations */
/* @var $_services SystemServices */
$disp_body = "<body>\n";
//$disp_body .= "<h1>PIA-Tunnel Management Interface</h1>";
/* always include the menu on top of the page */
$disp_body .= load_menu();
$disp_body .= "<div class=\"content\">\n";
/* check which pages needs to be processed */
$plen = mb_strlen($_REQUEST['page']);
//sanity check
if ($plen > 1 && $plen < 20 && isset($_REQUEST['page'])) {
    switch ($_REQUEST['page']) {
        case 'config':
            require_once $inc_dir . 'logic_config.php';
            break;
        case 'tools':
            require_once $inc_dir . 'logic_tools.php';
            break;
        case 'setup-admin_account':
            require_once $inc_dir . 'logic_admin_account.php';
            break;
        case 'logout':
            require_once $inc_dir . 'logic_logout.php';
            break;
        case 'setup-wizard':
            require_once $inc_dir . 'logic_wizard.php';
            break;
Ejemplo n.º 12
0
 public function load_menu($level, $id = FALSE)
 {
     $query = $this->db->select("A.`" . self::ID_MENU . "` AS ID, A.`level`, B.`name`")->from("`" . self::MENU . "` AS A")->join("`" . self::MENU_DESC . "` AS B", "B.`" . self::ID_MENU . "` = A.`" . self::ID_MENU . "` && B.`" . self::ID_LANGS . "` = " . $this->id_langs, "left")->where("A.`id_users`", $this->id_users)->where("A.`level`", $level);
     if ($id) {
         $query = $query->where("A.`" . self::ID_MENU . "` <>", $id);
     }
     $query = $query->get();
     if ($query->num_rows() > 0) {
         foreach ($query->result_array() as $ms) {
             $data[$ms['ID']] = 'ID: ' . $ms['ID'] . ' - ' . $ms['name'];
         }
     }
     $this->load->helper('menu/menu_helper');
     load_menu($data);
 }
Ejemplo n.º 13
0
 /**
  * Determine whether or not to dispay the header on the page.
  */
 function displayHeader()
 {
     global $theme;
     global $max_tabs;
     global $app_strings;
     global $current_user;
     global $sugar_config;
     global $app_list_strings;
     $GLOBALS['app']->headerDisplayed = true;
     if (!function_exists('get_new_record_form') && (file_exists('modules/' . $this->module . '/metadata/sidecreateviewdefs.php') || file_exists('custom/modules/' . $this->module . '/metadata/sidecreateviewdefs.php'))) {
         require_once 'include/EditView/SideQuickCreate.php';
     }
     if (!$this->_menuExists($this->module) && !empty($GLOBALS['mod_strings']['LNK_NEW_RECORD'])) {
         $GLOBALS['module_menu'][] = array("index.php?module={$this->module}&action=EditView&return_module={$this->module}&return_action=DetailView", $GLOBALS['mod_strings']['LNK_NEW_RECORD'], "{$GLOBALS['app_strings']['LBL_CREATE_BUTTON_LABEL']}{$this->module}", $this->module);
         $GLOBALS['module_menu'][] = array("index.php?module={$this->module}&action=index", $GLOBALS['mod_strings']['LNK_LIST'], $this->module, $this->module);
     }
     $themeObject = SugarThemeRegistry::current();
     $theme = $themeObject->__toString();
     $ss = new Sugar_Smarty();
     $ss->assign("APP", $app_strings);
     $ss->assign("THEME", $theme);
     $ss->assign("THEME_IE6COMPAT", $themeObject->ie6compat ? 'true' : 'false');
     $ss->assign("MODULE_NAME", $this->module);
     // get css
     $css = $themeObject->getCSS();
     if ($this->_getOption('view_print')) {
         $css .= '<link rel="stylesheet" type="text/css" href="' . $themeObject->getCSSURL('print.css') . '" media="all" />';
     }
     $ss->assign("SUGAR_CSS", $css);
     // get javascript
     ob_start();
     $this->renderJavascript();
     $ss->assign("SUGAR_JS", ob_get_contents() . $themeObject->getJS());
     ob_end_clean();
     // get favicon
     if (isset($GLOBALS['sugar_config']['default_module_favicon'])) {
         $module_favicon = $GLOBALS['sugar_config']['default_module_favicon'];
     } else {
         $module_favicon = false;
     }
     $favicon = '';
     if ($module_favicon) {
         $favicon = $themeObject->getImageURL($this->module . '.gif', false);
     }
     if (!sugar_is_file($favicon) || !$module_favicon) {
         $favicon = $themeObject->getImageURL('sugar_icon.ico', false);
     }
     $ss->assign('FAVICON_URL', getJSPath($favicon));
     // get the module menu
     $shortcut_menu = array();
     $module_menu = load_menu("modules/" . $this->module . "/");
     foreach ($module_menu as $key => $menu_item) {
         $shortcut_menu[$key] = array("URL" => $menu_item[0], "LABEL" => $menu_item[1], "MODULE_NAME" => $menu_item[2], "IMAGE" => $themeObject->getImage($menu_item[2], "alt='" . $menu_item[1] . "'  border='0' align='absmiddle'"));
     }
     $ss->assign("SHORTCUT_MENU", $shortcut_menu);
     // handle rtl text direction
     if (isset($_REQUEST['RTL']) && $_REQUEST['RTL'] == 'RTL') {
         $_SESSION['RTL'] = true;
     }
     if (isset($_REQUEST['LTR']) && $_REQUEST['LTR'] == 'LTR') {
         unset($_SESSION['RTL']);
     }
     if (isset($_SESSION['RTL']) && $_SESSION['RTL']) {
         $ss->assign("DIR", 'dir="RTL"');
     }
     // handle resizing of the company logo correctly on the fly
     $companyLogoURL = $themeObject->getImageURL('company_logo.png');
     $companyLogoURL_arr = explode('?', $companyLogoURL);
     $companyLogoURL = $companyLogoURL_arr[0];
     $company_logo_attributes = sugar_cache_retrieve('company_logo_attributes');
     if (!empty($company_logo_attributes)) {
         $ss->assign("COMPANY_LOGO_MD5", $company_logo_attributes[0]);
         $ss->assign("COMPANY_LOGO_WIDTH", $company_logo_attributes[1]);
         $ss->assign("COMPANY_LOGO_HEIGHT", $company_logo_attributes[2]);
     } else {
         // Always need to md5 the file
         $ss->assign("COMPANY_LOGO_MD5", md5_file($companyLogoURL));
         list($width, $height) = getimagesize($companyLogoURL);
         if ($width > 212 || $height > 40) {
             $resizePctWidth = ($width - 212) / 212;
             $resizePctHeight = ($height - 40) / 40;
             if ($resizePctWidth > $resizePctHeight) {
                 $resizeAmount = $width / 212;
             } else {
                 $resizeAmount = $height / 40;
             }
             $ss->assign("COMPANY_LOGO_WIDTH", round($width * (1 / $resizeAmount)));
             $ss->assign("COMPANY_LOGO_HEIGHT", round($height * (1 / $resizeAmount)));
         } else {
             $ss->assign("COMPANY_LOGO_WIDTH", $width);
             $ss->assign("COMPANY_LOGO_HEIGHT", $height);
         }
         // Let's cache the results
         sugar_cache_put('company_logo_attributes', array($ss->get_template_vars("COMPANY_LOGO_MD5"), $ss->get_template_vars("COMPANY_LOGO_WIDTH"), $ss->get_template_vars("COMPANY_LOGO_HEIGHT")));
     }
     $ss->assign("COMPANY_LOGO_URL", getJSPath($companyLogoURL) . "&logo_md5=" . $ss->get_template_vars("COMPANY_LOGO_MD5"));
     // get the global links
     $gcls = array();
     $global_control_links = array();
     require "include/globalControlLinks.php";
     foreach ($global_control_links as $key => $value) {
         if ($key == 'users') {
             //represents logout link.
             $ss->assign("LOGOUT_LINK", $value['linkinfo'][key($value['linkinfo'])]);
             $ss->assign("LOGOUT_LABEL", key($value['linkinfo']));
             //key value for first element.
             continue;
         }
         foreach ($value as $linkattribute => $attributevalue) {
             // get the main link info
             if ($linkattribute == 'linkinfo') {
                 $gcls[$key] = array("LABEL" => key($attributevalue), "URL" => current($attributevalue));
             }
             // and now the sublinks
             if ($linkattribute == 'submenu' && is_array($attributevalue)) {
                 foreach ($attributevalue as $submenulinkkey => $submenulinkinfo) {
                     $gcls[$key]['SUBMENU'][$submenulinkkey] = array("LABEL" => key($submenulinkinfo), "URL" => current($submenulinkinfo));
                 }
             }
         }
     }
     $ss->assign("GCLS", $gcls);
     if (isset($_REQUEST['query_string'])) {
         $ss->assign("SEARCH", $_REQUEST['query_string']);
     }
     if ($this->action == "EditView" || $this->action == "Login") {
         $ss->assign("ONLOAD", 'onload="set_focus()"');
     }
     $ss->assign("AUTHENTICATED", isset($_SESSION["authenticated_user_id"]));
     // awu: moving allThemes json array out of authenticated if block for IE6 check on Login screen
     // build json string of theme properties
     $allThemes = array();
     foreach (SugarThemeRegistry::availableThemes() as $dirName => $themeName) {
         $selectedTheme = SugarThemeRegistry::get($dirName);
         $allThemes[$dirName] = array('name' => $themeName, 'description' => $selectedTheme->description, 'ie6compat' => $selectedTheme->ie6compat);
     }
     // get other things needed for page style popup
     $json = getJSONobj();
     $ss->assign('allThemes', $json->encode($allThemes));
     if (isset($_SESSION["authenticated_user_id"])) {
         $ss->assign('currentTheme_fonts', $themeObject->fonts);
         $ss->assign('currentTheme_colors', $themeObject->colors);
         $ss->assign('currentTheme_groupedTabscompat', $themeObject->group_tabs);
         $ss->assign('selectThemeOptions', get_select_options_with_id(SugarThemeRegistry::availableThemes(), SugarThemeRegistry::current()->__toString()));
         $ss->assign('USERS_MOD', return_module_language($GLOBALS['current_language'], 'Users'));
         $user_navigation_paradigm = $current_user->getPreference('navigation_paradigm');
         if (isset($user_navigation_paradigm)) {
             $ss->assign("NAVADIGMS", get_select_options_with_id($app_list_strings['navigation_paradigms'], $user_navigation_paradigm));
         } else {
             $ss->assign("NAVADIGMS", get_select_options_with_id($app_list_strings['navigation_paradigms'], $GLOBALS['sugar_config']['default_navigation_paradigm']));
         }
         // get the current user name and id
         $ss->assign("CURRENT_USER", $current_user->first_name != '' ? $current_user->first_name : $current_user->user_name);
         $ss->assign("CURRENT_USER_ID", $current_user->id);
         // get the last viewed records
         $tracker = new Tracker();
         $history = $tracker->get_recently_viewed($current_user->id);
         foreach ($history as $key => $row) {
             $history[$key]['item_summary_short'] = getTrackerSubstring($row['item_summary']);
             $history[$key]['image'] = SugarThemeRegistry::current()->getImage($row['module_name'], 'border="0" align="absmiddle" alt="' . $row['item_summary'] . '"');
         }
         $ss->assign("recentRecords", $history);
         // new record
         require_once "modules/" . $this->module . "/Forms.php";
         if ($this->action == "index" && function_exists('get_new_record_form')) {
             $ss->assign("NEW_RECORD", get_new_record_form());
         }
         // Get preference for shortcuts and last_viewed list placement
         $last_view_swap = $current_user->getPreference('swap_last_viewed');
         if (!isset($last_view_swap)) {
             $last_view_swap = $GLOBALS['sugar_config']['default_swap_last_viewed'];
         }
         $ss->assign("LEFT_FORM_LAST_VIEWED", $last_view_swap);
         $shortcuts_swap = $current_user->getPreference('swap_shortcuts');
         if (!isset($shortcuts_swap)) {
             $shortcuts_swap = $GLOBALS['sugar_config']['default_swap_shortcuts'];
         }
         $ss->assign("LEFT_FORM_SHORTCUTS", !$shortcuts_swap);
     }
     if (isset($_SESSION["authenticated_user_id"]) || $sugar_config['login_nav']) {
         // get the module list
         $moduleTopMenu = array();
         $max_tabs = $current_user->getPreference('max_tabs');
         if (!isset($max_tabs) || $max_tabs <= 0) {
             $max_tabs = $GLOBALS['sugar_config']['default_max_tabs'];
         }
         $user_navigation_paradigm = $current_user->getPreference('navigation_paradigm');
         if (!isset($user_navigation_paradigm)) {
             $user_navigation_paradigm = $GLOBALS['sugar_config']['default_navigation_paradigm'];
         }
         // Need to figure out what tab this module belongs to, most modules have their own tabs, but there are exceptions.
         if (!empty($_REQUEST['module_tab'])) {
             $moduleTab = $_REQUEST['module_tab'];
         } elseif (isset($GLOBALS['moduleTabMap'][$this->module])) {
             $moduleTab = $GLOBALS['moduleTabMap'][$this->module];
         } else {
             $moduleTab = $this->module;
         }
         $ss->assign('MODULE_TAB', $moduleTab);
         if ($user_navigation_paradigm == 'gm' && isset($themeObject->group_tabs) && $themeObject->group_tabs) {
             require_once 'include/GroupedTabs/GroupedTabStructure.php';
             $groupedTabsClass = new GroupedTabStructure();
             $modules = query_module_access_list($current_user);
             //handle with submoremodules
             $max_subtabs = $current_user->getPreference('max_subtabs');
             if (!isset($max_subtabs) || $max_subtabs <= 0) {
                 $max_subtabs = $GLOBALS['sugar_config']['default_max_subtabs'];
             }
             $subMoreModules = false;
             $groupTabs = $groupedTabsClass->get_tab_structure(get_val_array($modules));
             foreach ($groupTabs as $key => $groupTab) {
                 $count = count($groupTab['modules']);
                 if ($count > $max_subtabs) {
                     for ($i = $max_subtabs - 1; $i < $count; $i++) {
                         if (!isset($groupTabs[$key]['modules'][$i])) {
                             continue;
                         }
                         $subMoreModules[$key]['modules'][$i] = $groupTabs[$key]['modules'][$i];
                         unset($groupTabs[$key]['modules'][$i]);
                     }
                 }
             }
             $ss->assign('groupTabs', $groupTabs);
             $ss->assign('subMoreModules', $subMoreModules);
             $ss->assign('moduleNames', $app_list_strings['moduleList']);
             $ss->assign('defaultFirst', !in_array($moduleTab, $modules));
             $ss->assign('parentTab', !empty($_REQUEST['parentTab']) ? $_REQUEST['parentTab'] : false);
             $ss->assign('USE_GROUP_TABS', true);
         } else {
             $moduleExtraMenu = array();
             $i = 1;
             foreach (query_module_access_list($current_user) as $module) {
                 // Bug 25948 - Check for the module being in the moduleList
                 if (isset($app_list_strings['moduleList'][$module])) {
                     if ($i < $max_tabs) {
                         $moduleTopMenu[$module] = $app_list_strings['moduleList'][$module];
                     } else {
                         $moduleExtraMenu[$module] = $app_list_strings['moduleList'][$module];
                     }
                     ++$i;
                 }
             }
             $iFrame = new iFrame();
             $frames = $iFrame->lookup_frames('tab');
             foreach ($frames as $key => $values) {
                 if ($i < $max_tabs) {
                     $moduleTopMenu[$key] = $values;
                 } else {
                     $moduleExtraMenu[$key] = $values;
                 }
                 ++$i;
             }
             // Now, we'll push the current module into the end of top menu list if it's not
             // already there. In addition, we'll preserve this last entry for this session
             // until a new value is added there.
             if (isset($moduleTopMenu[$moduleTab])) {
                 if (isset($_SESSION['moreTab']) && isset($app_list_strings['moduleList'][$_SESSION['moreTab']])) {
                     $moduleTopMenu[$_SESSION['moreTab']] = $app_list_strings['moduleList'][$_SESSION['moreTab']];
                     unset($moduleExtraMenu[$_SESSION['moreTab']]);
                 } else {
                     $moduleTopMenu += array_slice($moduleExtraMenu, 0, 1);
                     array_shift($moduleExtraMenu);
                 }
             } elseif (isset($moduleExtraMenu[$moduleTab])) {
                 $_SESSION['moreTab'] = $moduleTab;
                 $moduleTopMenu[$_SESSION['moreTab']] = $app_list_strings['moduleList'][$_SESSION['moreTab']];
                 unset($moduleExtraMenu[$_SESSION['moreTab']]);
             } elseif (isset($_SESSION['moreTab']) && isset($app_list_strings['moduleList'][$_SESSION['moreTab']])) {
                 $moduleTopMenu[$_SESSION['moreTab']] = $app_list_strings['moduleList'][$_SESSION['moreTab']];
                 unset($moduleExtraMenu[$_SESSION['moreTab']]);
             }
             $ss->assign("moduleTopMenu", $moduleTopMenu);
             $ss->assign("moduleExtraMenu", $moduleExtraMenu);
         }
     }
     $headerTpl = $themeObject->getTemplate('header.tpl');
     if (isset($GLOBALS['sugar_config']['developerMode']) && $GLOBALS['sugar_config']['developerMode']) {
         $ss->clear_compiled_tpl($headerTpl);
     }
     $ss->display($headerTpl);
     $this->includeClassicFile('modules/Administration/DisplayWarnings.php');
 }
Ejemplo n.º 14
0
 * of the License, or (at your option) any later version.
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>;.
 *
 * @package OpenEMR
 * @author  Kevin Yeh <*****@*****.**>
 * @link    http://www.open-emr.org
 */
require_once "menu_data.php";
require_once "menu_updates.php";
require_once "menu_db.php";
$menu_parsed = load_menu("default");
if (count($menu_parsed) == 0) {
    $menu_parsed = json_decode($menu_json);
}
menu_update_entries($menu_parsed);
$menu_restrictions = array();
menu_apply_restrictions($menu_parsed, $menu_restrictions);
?>
<script type="text/javascript">
    
    function menu_entry(object)
    {
        var self=this;
        self.label=ko.observable(object.label);

        self.header=false;