<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html <?php if (Yii::app()->language == 'ar')
    echo "dir='rtl'"; ?> xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>

        <link rel="shortcut icon" href="<?php echo Yii::app()->request->baseUrl; ?>/css/images/favicon.png" type="image/x-icon" />
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <meta name="language" content="en" />

        <!-- blueprint CSS framework -->

        <link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/screen.css" media="screen, projection" />
        <link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/print.css" media="print" />
        <!--[if lt IE 8]>
	<link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/ie.css" media="screen, projection" />
	<![endif]-->

        <link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/main.css" />
        <link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/form.css" />
        <link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->baseUrl . '/css/login/css/'; ?>style.css" />
        <title><?php echo CHtml::encode($this->pageTitle); ?></title>
    </head>

    <body>
        <div class="container" id="page">

            <div id="header" >
                <div class="img_left">
                    <img src='<?php echo Yii::app()->request->baseUrl; ?>/css/images/slb_logo.png'  width="268px" height="130px" />
                </div>
                <div class="img_right">
                    <img src='<?php echo Yii::app()->request->baseUrl; ?>/css/images/header-image.png'  width="268px"  style="float:right; height:100px" />
                </div>
            </div><!-- header -->

            <!-- Main Menu -->
	    <?php
	    Yii::app()->bootstrap->register();

	    if (Yii::app()->user->isGuest) {
		Yii::app()->getRequest()->redirect(Yii::app()->createUrl('/site/login'));
	    }
	    $this->widget('bootstrap.widgets.TbNavbar', array(
		'fixed' => false,
		'brand' => '',
		'brandUrl' => '#',
		'collapse' => true, // requires bootstrap-responsive.css
		'items' => array(
		    array(
			'class' => 'bootstrap.widgets.TbMenu',
			'items' => array(
			    array('label' => Yii::t('default', 'Organization'), 'url' => '#', 'visible' => Yii::app()->user->checkAccess('System Admin') ? true : (Yii::app()->user->checkAccess('Super Admin') ? true : Yii::app()->user->checkAccess('Facility Admin')), 'items' => array(
				    array('label' => Yii::t('default', 'Geomarkets'), 'url' => array('/geomarket/index'), 'visible' => Yii::app()->user->checkAccess('Super Admin')),
				    array('label' => Yii::t('default', 'Locations'), 'url' => array('/location/index'), 'visible' => Yii::app()->user->checkAccess('System Admin') ? true : Yii::app()->user->checkAccess('Super Admin')),
				    array('label' => Yii::t('default', 'Department'), 'url' => array('/department/index'), 'visible' => Yii::app()->user->checkAccess('System Admin') ? true : (Yii::app()->user->checkAccess('Super Admin') ? true : Yii::app()->user->checkAccess('Facility Admin'))),
				),
			    ),
			    array('label' => Yii::t('default', 'POS'), 'url' => '#', 'visible' => Yii::app()->user->checkAccess('System Admin') ? true : (Yii::app()->user->checkAccess('Super Admin') ? true : Yii::app()->user->checkAccess('Facility Admin')), 'items' => array(
				    array('label' => Yii::t('default', 'POSs'), 'url' => array('/pos/index'), 'visible' => Yii::app()->user->checkAccess('System Admin') ? true : (Yii::app()->user->checkAccess('Super Admin') ? true : Yii::app()->user->checkAccess('Facility Admin'))),
				    array('label' => Yii::t('default', 'Schedules'), 'url' => array('/schedule/index'), 'visible' => Yii::app()->user->checkAccess('System Admin') ? true : Yii::app()->user->checkAccess('Super Admin')),
			    )),
			    array(
				'label' => Yii::t('default', 'Configurations'),
				'url' => '#',
				'visible' => Yii::app()->user->checkAccess('System Admin') ? true : (Yii::app()->user->checkAccess('Super Admin') ? true : Yii::app()->user->checkAccess('Facility Admin')),
				'items' => array(
				    array('label' => Yii::t('default', 'Persons Types'), 'url' => array('/personType/index'), 'visible' => Yii::app()->user->checkAccess('System Admin') ? true : (Yii::app()->user->checkAccess('Super Admin') ? true : Yii::app()->user->checkAccess('Facility Admin'))),
				    array('label' => Yii::t('default', 'Badges Types'), 'url' => array('/badgeType/index'), 'visible' => Yii::app()->user->checkAccess('System Admin') ? true : (Yii::app()->user->checkAccess('Super Admin') ? true : Yii::app()->user->checkAccess('Facility Admin'))),
				    array('label' => Yii::t('default', 'Badge Assignment Rules'), 'url' => array('/badgeAssignmentRule/index'), 'visible' => Yii::app()->user->checkAccess('System Admin') ? true : Yii::app()->user->checkAccess('Super Admin')),
				    array('label' => Yii::t('default', 'Issuing Reasons'), 'url' => array('/issuingReason/index'), 'visible' => Yii::app()->user->checkAccess('System Admin') ? true : Yii::app()->user->checkAccess('Super Admin')),
				    array('label' => Yii::t('default', 'Items'), 'url' => array('/item/index'), 'visible' => Yii::app()->user->checkAccess('System Admin') || Yii::app()->user->checkAccess('Super Admin')),
				    array('label' => Yii::t('default', 'Users'), 'url' => array('/user/index'), 'visible' => Yii::app()->user->checkAccess('System Admin') ? true : Yii::app()->user->checkAccess('Super Admin')),
				    array('label' => Yii::t('default', 'Logs'), 'url' => array('/log/index'), 'visible' => Yii::app()->user->checkAccess('System Admin') ? true : Yii::app()->user->checkAccess('Super Admin')),
				    array('label' => Yii::t('default', 'Backups'), 'url' => array('/backup/index'), 'visible' => Yii::app()->user->checkAccess('System Admin') ? true : Yii::app()->user->checkAccess('Super Admin')),
				    array('label' => Yii::t('default', 'Settings'), 'url' => array('/setting/index  '), 'visible' => Yii::app()->user->checkAccess('System Admin') ? true : Yii::app()->user->checkAccess('Super Admin')),
				),
			    ),
			    array('label' => Yii::t('default', 'Persons'), 'url' => array('/person/index'), 'visible' => Yii::app()->user->checkAccess('Facility Admin') ? ( true ) : (Yii::app()->user->checkAccess('System Admin') ? true : Yii::app()->user->checkAccess('Super Admin'))),
			    array('label' => Yii::t('default', 'Badges'), 'url' => array('/badge/index'), 'visible' => Yii::app()->user->checkAccess('Facility Admin') ? true : (Yii::app()->user->checkAccess('System Admin') ? true : Yii::app()->user->checkAccess('Super Admin'))),
			    array(
				'label' => Yii::t('default', 'Requests'),
				'url' => '#',
				'visible' => Yii::app()->user->checkAccess('Facility Admin') || Yii::app()->user->checkAccess('Super Admin') || Yii::app()->user->checkAccess('System Admin') || Yii::app()->user->checkAccess('Finance') || Yii::app()->user->checkAccess('Food Manager'),
				'items' => array(
				    array('label' => Yii::t('default', 'Tickets'), 'url' => array('/ticket/index'), 'visible' => Yii::app()->user->checkAccess('Facility Admin') || Yii::app()->user->checkAccess('Super Admin') || Yii::app()->user->checkAccess('System Admin') || Yii::app()->user->checkAccess('Finance') || Yii::app()->user->checkAccess('Food Manager')),
				    array('label' => Yii::t('default', 'Items'), 'url' => array('/itemRequestHeader/index'), 'visible' => Yii::app()->user->checkAccess('Super Admin') || Yii::app()->user->checkAccess('System Admin') || Yii::app()->user->checkAccess('Food Manager') || Yii::app()->user->checkAccess('Facility Admin')  || Yii::app()->user->checkAccess('Finance')),
				),
			    ),
			    array('label' => Yii::t('default', 'Reports'), 'url' => '#', 'visible' => Yii::app()->user->checkAccess('Facility Admin') ? true : (Yii::app()->user->checkAccess('Super Admin') ? true : (Yii::app()->user->checkAccess('System Admin') ? true : (Yii::app()->user->checkAccess('Finance') ? true : Yii::app()->user->checkAccess('Food Manager')))), 'items' => array(
				    array('label' => Yii::t('default', 'Tickets Summary For Departments'), 'url' => array('/report/ticketsSummaryForDepartments'), 'visible' => Yii::app()->user->checkAccess('Facility Admin') ? true : (Yii::app()->user->checkAccess('System Admin') ? true : ( Yii::app()->user->checkAccess('Super Admin') ? true : (Yii::app()->user->checkAccess('Finance') ? true : Yii::app()->user->checkAccess('Food Manager'))))),
				    array('label' => Yii::t('default', 'Tickets Summary For POS per Schedule'), 'url' => array('/report/ticketsSummaryPosForSchedule'), 'visible' => Yii::app()->user->checkAccess('Facility Admin') ? true : (Yii::app()->user->checkAccess('Super Admin') ? true : ( Yii::app()->user->checkAccess('System Admin') ? true : (Yii::app()->user->checkAccess('Finance') ? true : Yii::app()->user->checkAccess('Food Manager'))))),
				    array('label' => Yii::t('default', 'Details For Person Tickets'), 'url' => array('/report/ticketsDetailsForPerson'), 'visible' => Yii::app()->user->checkAccess('Facility Admin') ? true : (Yii::app()->user->checkAccess('Super Admin') ? true : ( Yii::app()->user->checkAccess('System Admin') ? true : (Yii::app()->user->checkAccess('Finance') ? true : Yii::app()->user->checkAccess('Food Manager'))))),
				    array('label' => Yii::t('default', 'Details For Department Tickets '), 'url' => array('/report/ticketsDetailsForDepartment'), 'visible' => Yii::app()->user->checkAccess('Facility Admin') ? true : (Yii::app()->user->checkAccess('Super Admin') ? true : (Yii::app()->user->checkAccess('System Admin') ? true : (Yii::app()->user->checkAccess('Finance') ? true : Yii::app()->user->checkAccess('Food Manager'))))),
				    array('label' => Yii::t('default', 'Details For Badge Tickets'), 'url' => array('/report/ticketsDetailsForBadge'), 'visible' => Yii::app()->user->checkAccess('Facility Admin') ? true : (Yii::app()->user->checkAccess('Super Admin') ? true : (Yii::app()->user->checkAccess('System Admin') ? true : (Yii::app()->user->checkAccess('Finance') ? true : Yii::app()->user->checkAccess('Food Manager'))))),
				    array('label' => Yii::t('default', 'Expired Badges Within Period'), 'url' => array('/report/expiredBadgesWithinPeriod'), 'visible' => Yii::app()->user->checkAccess('Facility Admin') ? true : (Yii::app()->user->checkAccess('Super Admin') ? true : (Yii::app()->user->checkAccess('System Admin') ? true : (Yii::app()->user->checkAccess('Finance') ? true : Yii::app()->user->checkAccess('Food Manager'))))),
				    array('label' => Yii::t('default', 'Person - POS'), 'url' => array('/report/personPOS'), 'visible' => Yii::app()->user->checkAccess('Facility Admin') ? true : (Yii::app()->user->checkAccess('Super Admin') ? true : (Yii::app()->user->checkAccess('System Admin') ? true : (Yii::app()->user->checkAccess('Finance') ? true : Yii::app()->user->checkAccess('Food Manager'))))),
				    array('label' => Yii::t('default',  'Items Summary For Department'), 'url' => array('/report/ItemsSummaryForDepartment'), 'visible' => !Yii::app()->user->isGuest),
			    )),
			    array('label' => Yii::t('default', 'Change Password'), 'url' => array('/user/changepassword'), 'visible' => User::canChangePassword(Yii::app()->user->id)),
			    array('label' => Yii::t('default', 'Help'), 'url' => array('/dashboard/help'), 'visible' => User::canChangePassword(Yii::app()->user->id),),
//                                'items' => array(
//                                    array('label' => Yii::t('default', 'User Guide'), 'url' => Yii::app()->request->baseUrl."/protected/download/setup/LSMS - User Guide.pdf", 'visible' => User::canChangePassword(Yii::app()->user->id)),
//                                    array('label' => Yii::t('default', 'Installation Guide'), 'url' => Yii::app()->request->baseUrl."/protected/download/setup/LSMS - Installation Guide.pdf", 'visible' => User::canChangePassword(Yii::app()->user->id)),
//                            )),
//            array('label' => Yii::t('default','About'), 'url' => array('/site/page', 'view' => 'about')),
//            array('label' => Yii::t('default','Contact'), 'url' => array('/site/contact')),
			    array('label' => Yii::t('default', 'Login'), 'url' => array('/site/login'), 'visible' => Yii::app()->user->isGuest),
			    array('label' => Yii::t('default', 'Logout') . ' (' . Yii::app()->user->name . ')', 'url' => array('/site/logout'), 'visible' => !Yii::app()->user->isGuest),
//                            array('label' => (Yii::app()->language == "en" ? " (Arabic)" : "(English)"), 'url' => array('/site/Language')),
			),
		    ),
		),
	    ));
	    ?>

<?php if (isset($this->breadcrumbs)): ?>
	    <?php
		$this->widget('bootstrap.widgets.TbBreadcrumbs', array(
		    'links' => $this->breadcrumbs,
		));
	    ?><!-- breadcrumbs -->
	    <?php endif ?>

<?php echo $content; ?>
    	    <br/><br/>
    	    <div id="footer" class="footer" style="height: 35px">
    		<font style="font-weight: 500; font-size: 12px;">
<?php echo Yii::t('default', "LSMS v 1.3 - Copyright Schlumberger 2013 ") ?> 
    		    <br/>
<?php echo Yii::t('default', "Powered By") . ":" ?> <a href="http://www.FlexSolution.biz" style="color: orange;">Flex Solutions</a>
                </font>
            </div><!-- footer -->
        </div><!-- page -->

    </body>
</html>
