<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo CHtml::encode($this->pageTitle); ?></title>
<link type='text/css' href='<?php echo Yii::app()->baseUrl; ?>/admin_css/layout.css' rel='stylesheet' media='screen' />
<link href="<?php echo Yii::app()->baseUrl; ?>/admin_css/formcss.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<?php echo Yii::app()->baseUrl; ?>/js/admin/basiccalendar.js"></script>
<?php
Yii::app()->clientScript->registerScript('doChangeStatus', "
$('.doChangeStatus').live('click',function(){
	var id = $(this).attr('id')
	var p	=	this;
	$(this).html('".CHtml::image("images/admin/loading.gif","")."')
	$.ajax({ 
          url: '".Yii::app()->createUrl(Yii::app()->controller->id.'/ajaxupdate',array('act'=>'doChangeStatus'))."',
		  success: function(str){
		  $(p).html(str)
		  },
			  type: 'POST',
			  cache: false,
			  data: {autoId : id}, 
			  dataType: 'html' 
        });
	return false;
});");
?>
</head>
<body>
<!-- modal content -->
<div id="wrapper">
  <div id="header">
    <div id="logout_box">Welcome, <?php echo Yii::app()->user->fullname; ?> <br />
      <a href="<?php echo Yii::app()->createUrl('site/logout'); ?>">Log out</a> | 
      <a href="<?php echo Yii::app()->createUrl('user/changepassword',array('id'=>Yii::app()->user->id)); ?>">Profile Update</a> |
      <!--<a href="<?php //echo Yii::app()->createUrl('user/settings'); ?>">Settings</a>--> 
      </div>
    <div id="header_top"><img src="<?php echo Yii::app()->baseUrl; ?>/images/admin/logo.png" width="162" height="60" style="margin-top:13px; margin-left:25px;" /></div>
    <div id="header_menu" align="right"> 
    
      <a href="<?php echo Yii::app()->createUrl('menuItem/index'); ?>" class="buttons">
      <div id="buttons">Content</div>
      </a> 
      <?php //if(trim($_SERVER['HTTP_REFERER'])==""): ?>
      <a href="<?php echo Yii::app()->createUrl('newsletter/index'); ?>" class="buttons">
      <div id="buttons">News Letter</div>
      </a> 
      <a href="<?php echo Yii::app()->createUrl('reward/claims'); ?>" class="buttons" >
      <div id="buttons">Rewards</div>
      </a>
      <a href="<?php echo Yii::app()->createUrl('caseStudy/index'); ?>" class="buttons">
      <div id="buttons">Resources</div>
      </a> 
     <?php if ((UserType::model()->findByPk( User::model()->findByPK(Yii::app()->user->id)->user_type_id )->type) == 'administrator' || (UserType::model()->findByPk( User::model()->findByPK(Yii::app()->user->id)->user_type_id )->type)=='superadmin'): ?>
      <a href="<?php echo Yii::app()->createUrl('user/index'); ?>" class="buttons">
      <div id="buttons">Users</div>
      <?php endif; ?>
      </a> <a href="<?php echo Yii::app()->createUrl('product/index'); ?>" class="buttons">
      <div id="buttons">Products</div>
      </a> <a href="<?php echo (trim($_SERVER['HTTP_REFERER'])=="")?Yii::app()->createUrl('site/index'):Yii::app()->createUrl('product/index'); ?>" class="buttons">
      <div id="buttons">Dashboard</div>
      </a> </div>
  </div>
  <div id="contentarea" style="overflow-x: hidden;">
    <div id="c_1">
      <div id="calendar_box">
        <div id="headlines"><img src="<?php echo Yii::app()->baseUrl; ?>/images/admin/bg.png" width="12" height="7" class="right5"/>Calendar</div>
        <div id="calendar"> 
          <script type="text/javascript">

			var todaydate=new Date()

			var curmonth=todaydate.getMonth()+1 //get current month (1-12)

			var curyear=todaydate.getFullYear() //get current year

			document.write(buildCal(curmonth ,curyear, "main", "month", "daysofweek", "days", 1));

        </script> 
        </div>
      </div>
      <div id="calendar_box">
        
        <div id="onestaff"></div>
      </div>
    </div>
    <div id="c_2"> <?php echo $content; ?> </div>
    <div id="footer">D-Link Partner Portal Management | Developed by Bluesky Technologies</div>
  </div>
</div>
</body>
<script src="<?php echo Yii::app()->baseUrl; ?>/js/ckeditor/ckeditor.js"></script>
</html>