<?php $this->beginContent('application.views.front.layouts.home'); 
$menuBuilder 	= new Treeview;
?>
<div id="header">
  <div id="logout_box">
    <?php if(Yii::app()->user->isGuest){ ?>
    <br />
    &nbsp;&nbsp;&nbsp; 
    <a href="<?php echo Yii::app()->createUrl('site/login'); ?>">Login</a> &nbsp;&nbsp;|&nbsp;&nbsp; 
    <a href="<?php echo Yii::app()->createUrl('site/registration'); ?>">Register</a> &nbsp;&nbsp;|&nbsp;&nbsp; 
    <a href="<?php echo Yii::app()->createUrl('site/contactus'); ?>">Contact Us&nbsp;&nbsp;</a>
    <?php } else { ?>
    <span style="font-size:14px;">Welcome, <?php echo Yii::app()->user->fullname; ?></span> <br />
    <a href="<?php echo Yii::app()->createUrl('site/logout'); ?>">Logout</a> &nbsp;&nbsp;|&nbsp;&nbsp; 
    <a href="<?php echo Yii::app()->createUrl('site/editprofile'); ?>">Profile Update</a>
    <?php } ?>
  </div>
  <div id="business_solution_logo"><a href="<?php echo Yii::app()->createUrl('site/index'); ?>"><img src="<?php echo Yii::app()->baseUrl; ?>/images/front/1/logo_04.png" width="168" height="62" alt="logo" /></a></div>
  <div id="business_solution_menu">
    <ul id="menu2">
      <li><a href="#">Partner</a>
        <ul>
			<?php echo $menuBuilder->buildmenu(2); ?>
        </ul>
      </li>
      <li> <a href="#">Product & Solution</a>
      <ul>
        <?php $userGroups	=	UserGroup::model()->findAll(array('condition'=>'isActive="Y"')); foreach($userGroups as $eachUserGroup):?>
        <li> <a href="#"><?php echo $eachUserGroup->group_name; ?></a>
          <ul>
          <?php $i=1; $productGroups	=	ProductGroup::model()->findAll(array('condition'=>'user_group_id='.$eachUserGroup->id.' and isActive="Y"'));foreach($productGroups as $key=>$eachProductGroup): ?>
            <li><a href="<?php echo Yii::app()->createUrl('site/productgroup',array('id'=>$eachProductGroup->id,'user_group_id'=>$eachUserGroup->id,'name'=>preg_replace('/[^a-z0-9_]/','',strtolower( str_replace(" ", "_", $eachProductGroup->product_group_name))))); ?>" class="documents"> <?php echo $eachProductGroup->product_group_name; ?></a></li>
            <?php endforeach; ?>
          </ul>
        </li>
        <?php endforeach; ?>
        <?php echo $menuBuilder->buildmenu(3); ?>
      </ul>
    </li>
      <li><a href="#">Marketing </a>
        <ul>
        	<?php $resourceTypes	=	ResourceType::model()->findAll(array('condition'=>'isActive="Y"')); 
		  	foreach($resourceTypes as $eachResourceType):?>
              <li><a href="<?php echo Yii::app()->createUrl('site/resources',array('id'=>$eachResourceType->id,'name'=>preg_replace('/[^a-z0-9_]/','',strtolower( str_replace(" ", "_", $eachResourceType->resource_type))))); ?>" class="documents"><?php echo $eachResourceType->resource_type; ?></a></li>
              <?php endforeach; ?>
          <?php echo $menuBuilder->buildmenu(4); ?>
          <li><a href="<?php echo Yii::app()->createUrl('site/events'); ?>" class="messages">Events</a></li>
        </ul>
       </li>
      <li><a href="#">Resources </a>
        <ul>
              <?php $downloadables	=	ProductDownloadable::model()->findAll(array('condition'=>'isActive="Y"')); 
		  	foreach($downloadables as $eachDownloadable):?>
              <li><a href="<?php echo Yii::app()->createUrl('site/DownloadableResources',array('id'=>$eachDownloadable->id,'name'=>preg_replace('/[^a-z0-9_]/','',strtolower( str_replace(" ", "_", $eachDownloadable->item_name))))); ?>" class="documents"><?php echo $eachDownloadable->item_name; ?></a></li>
              <?php endforeach; ?>
              <?php echo $menuBuilder->buildmenu(5); ?>
              <li><a href="<?php echo Yii::app()->createUrl('site/casestudy'); ?>" class="messages">Case Studies</a></li>
        </ul>
      </li>
      <li><a href="#">Tools </a>
        <ul>
              <?php echo $menuBuilder->buildmenu(6); ?>
        </ul>
      </li>
      <li><a href="#">Academy</a>
        <ul>
             <?php echo $menuBuilder->buildmenu(7); ?>
        </ul>
      </li>
      <li><a href="#">Rewards </a>
        <ul>
              <li><a href="<?php echo Yii::app()->createUrl('site/products',
		array(
		'type'=>'isIntoPromotion',
		)); ?>" class="documents">Promotions</a></li>
              <li><a href="<?php echo Yii::app()->createUrl('site/products',
		array(
		'type'=>'isFeaturedItem',
		)); ?>" class="messages">Featured Items</a></li>
              <?php echo $menuBuilder->buildmenu(8); ?>
        </ul>
      </li>
    </ul>
  </div>
  <?php if(!(Yii::app()->user->isGuest)){ ?>
  <div id="myaccount_button">
    <ul class="menu">
      <li><a href="#">My Account</a>
        <ul>
          <li><a href="<?php echo Yii::app()->createUrl('site/viewprofile'); ?>" class="documents">View Profile</a></li>
          <li><a href="<?php echo Yii::app()->createUrl('site/editprofile'); ?>" class="messages">Edit Profile</a></li>
          <li><a href="<?php echo Yii::app()->createUrl('site/changepassword'); ?>" class="signout">Change Password</a></li>
          <?php if(Yii::app()->user->usertype == 'staff' || Yii::app()->user->usertype == 'administrator'|| Yii::app()->user->usertype == 'superadmin' ): ?>
          <li><a href="<?php echo Yii::app()->createUrl('site/submitpaper'); ?>" class="signout">Submit a paper</a></li>
          <?php else: ?>
          <li><a href="<?php echo Yii::app()->createUrl('site/pointstable'); ?>" class="signout">Points Table</a></li>
          <li><a href="<?php echo Yii::app()->createUrl('site/mywallet'); ?>" class="signout">My Wallet</a></li>
          <li><a href="<?php echo Yii::app()->createUrl('site/earnpoints'); ?>" class="signout">Earn Points</a></li>
          <li><a href="<?php echo Yii::app()->createUrl('site/redeempoints'); ?>" class="signout">Redeem Points</a></li>
          <?php endif; ?>
          <li><a href="<?php echo Yii::app()->createUrl('site/logout'); ?>" class="signout">Logout</a></li>
        </ul>
      </li>
    </ul>
  </div>
  <?php } ?>
</div>
<?php echo $content; ?>
<?php $this->endContent(); ?>
