Default.class.php 2.06 KB
<?php
/**
 * 默认控制器
 */
class Controller_Default extends Controller_Abstract
{
    /**
     * 首页
     *
     */
    public function indexAction()
    {
    	$total = Facade_News::getTotal(array(), array('手机视频'));
    	$page = new Lib_Helper_Pagination($total, 24);
    	$page->setOptions(array('afterAppend' => 'setLayout'));
    	list($offset, $limit) = $page->getLimit();
		$this->_view['banners'] = Facade_Index::getIndex(1);
		$rightBanners = array();
		if(empty($offset))
		{
		    $rightBanners = Facade_Index::getIndex(2);
		}
	    $list = Facade_News::getList(array(), $offset, $limit, array('手机视频'));
		$this->_view['partnerList'] = Facade_Partner::getPartner();
		$this->_view['partnerTypes'] = Facade_Partner::$types;
		$this->_view['pagination'] = $page->getPagination();
		$this->_view['rightBanners'] = $rightBanners;
		$this->_view['news'] = $list;
    }
    
    /**
     * 客户端首页模块
     * 
     */
    public function indexMobileAction()
    {
        $this->_view['banners'] = Facade_Index::getIndex(1);
    }
    
    public function otherAction()
    {
    	
    }
    
    public function testAction()
    {
        $link = SITE_MAIN.url('default/test');
        $this->_view['wechat'] = Lib_Wechat_JSSDK::getSignPackage();
    }    
    public function contactusAction()
    {
    	
    }
    
    /**
     * 壁纸
     */
    public function wallpaperAction()
    {
    	$this->_viewname = 'wallpapermobile';
    }
    
    /**
     * 壁纸图片
     * 
     */
    public function wallpaperimageAction()
    {
    	$dir = SITE_IMG.'/yohood/wallpaper';
    	$screenWidth = $this->_request->query('width');
    	$screenHeight = $this->_request->query('height');
    	$val = $this->_request->query('val');
    	if($screenWidth >=1440 && $screenHeight>=1200)
    	{
    		$dir.='/1440x1200/';
    	}
    	else if($screenWidth >=640 && $screenHeight>=1136)
    	{
    		$dir.='/640x1136/';
    	}
    	else
    	{
    		$dir.='/640x960/';
    	}
    	$this->_view['image']  = $dir.$val.'.jpg';
    	$this->_viewname = 'wallpaperimagemobile';
    }
}