Pages

Monday, November 22, 2010

Zend Framework - Layout with helpers

application\modules\storefront\layouts\scripts\default\one-coloumn.phtml

-------------------------------------------------------------------------

<?php echo $this->doctype(); ?>

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

    <?php $this->css()->append($this->urls()->css()."/player.css"); ?>

    <?php $this->css()->append($this->urls()->css()."/mygrid.css"); ?>

    <?php $this->css()->append($this->urls()->css()."/gallery.css"); ?>

    <?php if(isset($this->user) && $this->user->theme_name != "")

            $this->css()->append($this->urls()->css().'/themes/player_'.$this->user->theme_name.'.css','screen',true,array('id' => 'layout_css'));  

    ?>

    <?php $this->headScript()->prependScript('var ZAAHDATEFORMAT = "'."yy-mm-dd".'";') ?>

    <?php $this->headScript()->prependScript('var g_site_path = "'.$this->baseUrl().'";') ?>

    <?php $this->headScript()->prependScript('var g_imge_path = "'.$this->urls()->images().'";') ?>

    <?php $this->headScript()->prependScript('var g_skin_path = "'.$this->urls()->skin().'";') ?>

    <?php $header =  $this->render('includes/header.phtml'); ?>

    <?php $widgets    =    $this->widget(); ?>

    <?php $topmenu    =    $this->topmenu(); ?>

    <?php $this->js()->addLibrary(); ?>

    <?php echo $this->headMeta();?>

    <?php echo $this->headTitle();?>

    <?php echo $this->headStyle();?>

    <?php echo $this->headLink();?>

</head>

<body id="playerbody">

    <div class="cornerBG">

        <div class="header">

          <div class="header_main">

            <?php

                    /*** To display Header links and header ***/

                    echo $header;

      

                    /*** To display Main menu bar ***/

                    echo $topmenu;

      

                    /*** To display body content ***/

                    echo $this->render('includes/body_content.phtml');

      

                    /*** To display bottom widgets  ***/

                    echo $widgets;

                          

                    /*** To display footer with bottom links  ***/

                    echo $this->render('includes/footer.phtml');

                ?>

          </div>

        </div>

    </div>

    <?php $this->js()->onload(); ?>

    <?php echo $this->headScript();?>

</body>

</html>

application\modules\storefront\layouts\scripts\default\helpers\topmenu.phtml

-----------------------------------------------------------------------------

<?php

$isLoggedIn = Zend_Auth::getInstance()->hasIdentity();

$this->js()->addOnLoad("jQuery('.calendar_mid_text3').bind('mouseover', jsddm_open)");

$this->js()->addOnLoad("jQuery('.calendar_mid_text3').bind('mouseout', jsddm_timer)");

$this->js()->addOnLoad("jQuery('.calendar_mid_text4').bind('mouseover', jsddm_open)");

$this->js()->addOnLoad("jQuery('.calendar_mid_text4').bind('mouseout', jsddm_timer)");

$this->js()->append($this->urls()->js()."menu/menu.js");

$this->js()->append($this->urls()->js()."menu/testTeamMenuInit.js");

    //For testTeam Tab Display

    //For testTeam Page Display created on 28,Oct 2010

    $otestTeamsiteedit = new testTeamsiteedit();

    $otestTeam = new testTeam();

    $curUrl=Zend_Controller_Front::getInstance()->getRequest()->getRequestUri();

  

    $curUrl=explode("/",$curUrl);

    $testTeamURL=$curUrl[count($curUrl)-2];  

    //testTeam details

    $vtestTeamDet=$otestTeam->getByUrl($testTeamURL,$id=0);

    //testTeam Grid Menu Details  

    if(count($vtestTeamDet)>0)

    {

        $aParam['testTeamid']=$vtestTeamDet->testTeam_id;  

        $vtestTeamTabDet=$otestTeamsiteedit->getTabDet($aParam);

    }

  

     //for calling carosel scripts

     if(count($vtestTeamTabDet)>1)

     $this->js()->append($this->urls()->js()."menu/testTeamMenuInit.js");

  

//--    select user testTeams

if($isLoggedIn){

    $user = Zend_Auth::getInstance()->getStorage()->read();

    $otestTeam    =    new testTeam();

    $atestTeams    =    $otestTeam->getUsertestTeams($user->user_id);

    $vMenutestTeamselimg    =    "menu_bottom_arrow.gif";

    $vSelController = Zend_Controller_Front::getInstance()->getRequest()->getControllerName();

    if($vSelController == 'mygrid')

        $vMenuGridsel    =    'menuSel';

    else if($vSelController == 'calendar')

        $vMenuCalsel    =    'menuSel';

    else if($vSelController == 'gallery')

    {

        $vMenuGallerysel    =    'menuSel';

        $vMenutestTeamselimg    =    'menusel_bottom_arrow.gif';  

        $vArrowClass        =    'lPadding';

    }

    else

    {

        $vMenutestTeamsel        =    'menuSel';  

        $vMenutestTeamselimg    =    'menusel_bottom_arrow.gif';  

        $vArrowClass        =    'lPadding';

    }  



    ?>

    

            

<div class="calendar">

  <div class="calendar_ll">

    <div class="calendar_left"><img src="<? echo $this->urls()->images(); ?>calender_left.gif"  alt=""/></div>

    <div class="calendar_mid">

      <?php if($isLoggedIn): ?>

      <div id="styleGrid" class="calendar_mid_text1 <? echo $vMenuGridsel?>"> <b><a href="<?php echo $this->url(array('controller'=>'mygrid','action'=>'index')) ?>">Grid</a></b> <span><img src="<? echo $this->urls()->images(); ?>menu_pix.gif" alt=""/></span> </div>

      <div id="styleCalen" class="calendar_mid_text2 <? echo $vMenuCalsel?>"> <b><a href="<?php echo $this->url(array('controller'=>'calendar','action'=>'index')) ?>">Calendar</a></b> <span><img src="<? echo $this->urls()->images(); ?>menu_pix.gif" alt=""/></span> </div>

      <div id="styleMytestTeam" class="calendar_mid_text3 <? echo $vMenutestTeamsel?>">

          <b class="<? echo $vArrowClass ?>"><a href="#">My testTeams</a></b><em><a href="#"><img src="<? echo $this->urls()->images(); ?><? echo $vMenutestTeamselimg; ?>" alt="" border="0"/></a></em> <span><img src="<? echo $this->urls()->images(); ?>menu_pix.gif" alt=""/></span>

        <div id="menu_testTeams" class="testTeam_store">

          <div class="testTeam_store_left">

          <?php if(count($atestTeams) > 0): ?>

              <?php foreach($atestTeams as $atestTeam): ?>

                <p><a href="<?php echo $this->url(array('page'=>$atestTeam->rutr_url),'global_routing'); ?>/summary"><?php echo $this->escape($atestTeam->testTeam_name) ?></a></p>  

            <?php endforeach; ?>

          <?php endif; ?>

          </div>

        </div>

      </div>

      <div id="styleGal" class="calendar_mid_text4 <?=$vMenuGallerysel?>">

          <b class="<? echo $vArrowClass ?>"><a href="#">Gallery</a></b> <em><a href="#"><img src="<? echo $this->urls()->images(); ?><? echo $vMenutestTeamselimg; ?>" alt="" border="0"/></a></em> <span><img src="<? echo $this->urls()->images(); ?>menu_pix.gif" alt=""/></span>

           <div id="gallery_testTeams" class="gallery_store">

            <div class="gallery_store_left">

                <p><a href="<?php echo $this->url(array('page'=>'gallery/index/type/1'),'global_routing'); ?>">Upload Photos</a></p>

                <p><a href="<?php echo $this->url(array('page'=>'gallery/index/type/2'),'global_routing') ?>">Upload Videos</a></p>

            </div>

         </div>

      </div>

      <div id="styleProd" class="calendar_mid_text5"> <b><a href="#">Products</a></b> <span><img src="<? echo $this->urls()->images(); ?>menu_pix.gif" alt=""/></span> </div>

    

      <!--<div class="calendar_mid_text6"> <b><a href="#">My Channels</a></b> <em><a href="#"><img src="<? echo $this->urls()->images(); ?>menu_bottom_arrow.gif" alt="" border="0"/></a></em> <span><img src="<? echo $this->urls()->images(); ?>menu_pix.gif" alt=""/></span> </div>-->

      <!--<div class="calendar_mid_text7"> <b><a href="#">>></a></b> </div>-->

      </div>

   <!-- <div class="calendar_right"><img src="<? echo $this->urls()->images(); ?>calender_right.gif" alt="" /></div>

    <div class="add"> <span><a href="#"><img src="<? echo $this->urls()->images(); ?>add_icon.gif"  alt="" border="0"/></a></span> </div>-->

      <?php else: ?>

      <!--<div class="calendar_mid_text1"> <b><a href="<?php echo $this->url(array('controller'=>'products','action'=>'index')) ?>">Products</a></b> <span><img src="<? echo $this->urls()->images(); ?>menu_pix.gif" alt=""/></span> </div>

      <div class="calendar_mid_text2"> <b><a href="<?php echo $this->url(array('controller'=>'aboutus','action'=>'index')) ?>">About Us</a></b> <span><img src="<? echo $this->urls()->images(); ?>menu_pix.gif" alt=""/></span> </div>

      <div class="calendar_mid_text3"> <b><a href="<?php echo $this->url(array('controller'=>'contactus','action'=>'index')) ?>">Contact Us</a></b> <span><img src="<? echo $this->urls()->images(); ?>menu_pix.gif" alt=""/></span> </div>

      <div class="calendar_mid_text4"> <b><a href="<?php echo $this->url(array('controller'=>'tryouts','action'=>'index')) ?>">Tryouts</a></b> <span><img src="<? echo $this->urls()->images(); ?>menu_pix.gif" alt=""/></span> </div>

        </div>-->

      <?php endif; ?>

  </div>





  <div class="calendar_rr">

      <form name="frmSearch" id="" method="post" action="#">

    <input type="hidden" name="txtSearch" id="txtSearch" value="" />

    </form>

       <input name="txtSrch" id="txtSrch" type="text" value="testTeam search" onkeypress="traceKeySearchtestTeams(event.keyCode)" onblur="showSrhHint('txtSrch')" onfocus="removeSrhHint('txtSrch')" />

    <span><a href="javascript:" onclick="searchtestTeamText()"><img src="<? echo $this->urls()->images(); ?>search_log_icon.gif" alt="" border="0" /></a></span>

    </div>

</div>

<?

}

else

{

?>

<div class="calendar">

  <div class="calendar_ll">

    <div class="calendar_left"><img src="<? echo $this->urls()->images(); ?>calender_left.gif"  alt=""/></div>

    <div class="calendar_mid">

        <!--testTeam tab display-->

  

      <?php

      if(count($vtestTeamTabDet)>=1)

      {

       for($tabLoop=0;$tabLoop<count($vtestTeamTabDet);$tabLoop++)

          {

          ?>

        

          <div id="styleGrid" class="calendar_mid_text1"> <b><a href="javascript:;" onclick="viewtestTeamPage('<?=$vtestTeamTabDet[$tabLoop]['cmsc_id']?>','<?=$testTeamURL?>')"><?=$vtestTeamTabDet[$tabLoop]['cmsc_name']?></a></b> <span><img src="<? echo $this->urls()->images(); ?>menu_pix.gif" alt=""/></span> </div>

          

          <?php

          }      

       }

      ?>    

  </div>

  </div>



  <div class="calendar_rr">

      <form name="frmSearch" id="" method="post" action="#">

    <input type="hidden" name="hidTabId" id="hidTabId" value="" />

    <input type="hidden" name="txtSearch" id="txtSearch" value="" />

    </form>

  

    <input name="txtSrch" id="txtSrch" type="text" value="testTeam search" onkeypress="traceKeySearchtestTeams(event.keyCode)" onblur="showSrhHint('txtSrch')" onfocus="removeSrhHint('txtSrch')" />

    <span><a href="javascript:" onclick="searchtestTeamText()"><img src="<? echo $this->urls()->images(); ?>search_log_icon.gif" alt="" border="0" /></a></span>

  

    </div>

</div>

<?php

}

?>

<script>

function traceKeySearchtestTeams( key ){

    if ( key == 13 ){

            searchtestTeamText();

        }

}

              

function searchtestTeamText()

{

    if($('#txtSrch').val()== "" || $('#txtSrch').val()== 'testTeam search')

    {

        alert("Please enter any testTeam name to search")               

        return;

    } else     {    

         var srhval=$('#txtSrch').val()

         $('#txtSearch').val(srhval)

         document.frmSearch.action = g_site_path+'/search';

         document.frmSearch.submit();      

    }

}

function showSrhHint(SrhId)

{

    if($('#txtSrch').val()=="")

    $('#'+SrhId).val('testTeam search')

}

function removeSrhHint(SrhId)

{

    $('#'+SrhId).val('')

}

</script>

application\modules\storefront\views\helpers\topmenu.php

---------------------------------------------------------

<?php

/**

 * Helper class to fetch and view the user menu items

 *

 * @uses       Zend_View_Helper_Menu

 * @copyright   

 * @license     

 * @version     

 * @author     Kamalkannan

 * @created       Oct 06, 2010  

 */

class Zend_View_Helper_Topmenu extends Zend_View_Helper_Abstract{

  

    /**

    * Function fetch and show the user menu

    * Created:    Sep 6, 2010

    * @param Int $type    -    Type of the menu to be shown

    */

    public function topmenu(){

        //--    check the user authendication is exists

        $isLoggedIn = Zend_Auth::getInstance()->hasIdentity();

        if($isLoggedIn){

            //--    fetch the user top menu informations          

            //--    fetch the sports informations

            return $this->view->render('helpers/topmenu.phtml');  

        }

        else

        return $this->view->render('helpers/topmenu.phtml');  

    }

}

No comments:

Post a Comment