root/c3crm/sugarcrm/trunk/heading.php

Revision 1232 (by jianting, 05/07/06 23:16:57)

latest frameset layout and messages modules

<?php
$GLOBALS['sugarEntry'] = true;
if(empty($GLOBALS['sugarEntry'])) die('Not A Valid Entry Point');
/*********************************************************************************
 * The contents of this file are subject to the SugarCRM Public License Version
 * 1.1.3 ("License"); You may not use this file except in compliance with the
 * License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
 * Software distributed under the License is distributed on an "AS IS" basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied.  See the License
 * for the specific language governing rights and limitations under the
 * License.
 *
 * All copies of the Covered Code must include on each user interface screen:
 *    (i) the "Powered by SugarCRM" logo and
 *    (ii) the SugarCRM copyright notice
 * in the same form as they appear in the distribution.  See full license for
 * requirements.
 *
 * The Original Code is: SugarCRM Open Source
 * The Initial Developer of the Original Code is SugarCRM, Inc.
 * Portions created by SugarCRM are Copyright (C) 2004-2006 SugarCRM, Inc.;
 * All Rights Reserved.
 * Contributor(s): ______________________________________.
 ********************************************************************************/
/*********************************************************************************
 * $Id: header.php,v 1.8.4.1 2006/01/08 04:36:06 majed Exp $
 * Description:  Contains a variety of utility functions used to display UI
 * components such as form headers and footers.  Intended to be modified on a per
 * theme basis.
 ********************************************************************************/

require_once('XTemplate/xtpl.php');
require_once("data/Tracker.php");
require_once("include/utils.php");
require_once("include/database/PearDatabase.php");
require_once("config.php");
require_once('modules/Tabgroups/Tabgroup.php');
require_once('modules/Users/User.php');
require_once("include/language/zh_cn.lang.php");

global $sugar_config;
global $app_strings;
global $current_user;
$GLOBALS['log'] = LoggerManager::getLogger('Home');

if (!empty($sugar_config['session_dir'])) {
	session_save_path($sugar_config['session_dir']);
}

session_start();

$user_unique_key = (isset($_SESSION['unique_key'])) ? $_SESSION['unique_key'] : "";
$server_unique_key = (isset($sugar_config['unique_key'])) ? $sugar_config['unique_key'] : "";

if ($user_unique_key != $server_unique_key) {
	session_destroy();
	header("Location: login.php");
	exit();
}

if(!isset($_SESSION['authenticated_user_id']))
{
	// TODO change this to a translated string.
	session_destroy();
	die("An active session is required to export content");
}

// load the logger

$current_user = new User();

$result = $current_user->retrieve($_SESSION['authenticated_user_id']);
if($result == null)
{
	session_destroy();
	die("An active session is required to export content");
}


if(isset($_SESSION['authenticated_user_theme']) && $_SESSION['authenticated_user_theme'] != '') {
	$theme = $_SESSION['authenticated_user_theme'];
} else {
	$theme = $sugar_config['default_theme'];
}

/*
if(empty($theme)) {
	$theme = "SugarLite";
}
*/
require_once("include/globalControlLinks.php");
$GLOBALS['log']->debug('Current theme is: '.$theme);
$theme_path="themes/".$theme."/";
$image_path=$theme_path."images/";


$default_charset = $sugar_config['default_charset'];

$xtpl=new XTemplate ($theme_path."heading.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);
}

$xtpl->assign("THEME", $theme);
$xtpl->assign("IMAGE_PATH", $image_path);



$i = 0;

foreach($global_control_links as $key => $value) {
	foreach ($value as $linkattribute => $attributevalue) {
		if($linkattribute == 'linkinfo') {
			foreach ($attributevalue as $label => $url) {
				$xtpl->assign("GCL_LABEL", $label);
				$xtpl->assign("GCL_URL", $url);
				if (isset($sub_menu[$key]) && $sub_menu[$key]) {
					$xtpl->assign("GCL_MENU", "id='".$key."Handle' onmouseover=' tbButtonMouseOver(this.id,20,\"\",0);'");
					$xtpl->assign("MENU_ARROW", "<img src='".$image_path."menuarrow.gif' alt=''  id='".$key."Handle' style='margin-bottom: 1px; margin-left:2px; cursor: pointer; cursor: hand;' valign='absmiddle' onmouseover='tbButtonMouseOver(this.id,21,\"\",0);'>");
				} else {
					$xtpl->assign("GCL_MENU", "");
					$xtpl->assign("MENU_ARROW", "");
				}
				if($i < sizeof($global_control_links)-1) {
					$xtpl->assign("SEPARATOR", "&nbsp;|&nbsp;");
				} else {
					$xtpl->assign("SEPARATOR", "");
				}
			}
		}

		
	}
	$xtpl->parse("main.global_control_links");
	$i++;
}


if (isset($_REQUEST['query_string'])) $xtpl->assign("SEARCH", $_REQUEST['query_string']);

// tabgroup
$tabgroupSeed = new Tabgroup();

$groups = $tabgroupSeed->getUserTabgroups(1);

$tg_id_name = array();
$current_tg = "";
//for the first time. get the default app
if(!empty($groups)){
	if(!isset($_REQUEST["tabgroup"])){  //login for the first time
		if(!isset($_SESSION["tabgroup"])){
			if(is_admin($current_user)){
				$tg = $groups[0];
				$current_tg = $tg->id;				
			}else{
				foreach($groups as $tg){
					$tg_id_name[$tg->id] = $tg->name;
					if($tg->is_default == true){
						$current_tg = $tg->id;
					}
				}
				if($current_tg == ""){
					$tg = $groups[0];
					$current_tg = $tg->id;	//no default application is assigned.
				}
			}
			$_SESSION["tabgroup"] = $current_tg;
		}else{
			$current_tg = $_SESSION["tabgroup"];
		}
	}else{
		$current_tg = $_REQUEST["tabgroup"];
		$_SESSION["tabgroup"] = $current_tg;
	}
	foreach($groups as $tg){
		$tg_id_name[$tg->id] = $tg->name;
	}
	
	
}else{
	$tg_id_name[""] = $app_strings['LBL_NONE'];
	$current_tg = "";
}
//$xtpl->assign("LBL_CHOOSE_APP", $app_strings['LBL_CHOOSE_APP']);
$xtpl->assign("TABGROUP_OPTIONS", get_select_options_with_id($tg_id_name, $current_tg));
//~~~ tabgroup

$xtpl->parse("main");
$xtpl->out("main");

?>
Note: See TracBrowser for help on using the browser.