<?php
/**
 * 其他杂项模块
 * @copyright reginx.com
 * $Id$
 */
class others_mod extends admin_mod {

    /**
     * 首页轮播
     *
     */
    public function sliderAct(){
        $obj = OBJ('misc_tab');
        if($this->has('slider' , 'P')){
            $plist  = $this->get('list' , 'P');
            $plist  = empty($plist) ? array() : $plist;
            $slider = $this->get('slider' , 'P');
            if($slider['url'] != '' && $slider['name'] != '' && $slider['cover'] != ''){
                array_unshift($plist , $slider);
            }
            foreach ($plist as $k => $v){
                $v = array_map(array('filter' , 'text') , $v);
                if($v['url'] == '' || $v['name'] == '' || $v['cover'] == ''){
                    unset($plist[$k]);
                }
            }
            $obj->set("k" , 'slider')->set("c" , 1)->set("v" , base64_encode(serialize($plist)))->replace();
            $this->showmsg('操作成功' , null , 1 , 1);
        }
        $row = $obj->where("k = 'slider' and c = 1")->get();
        if(!empty($row)){
            $row['v'] = unserialize(base64_decode($row['v']));
        }
        $this->assign('atitle' , '首页轮播');
        $this->assign('list' , is_array($row['v']) ? $row['v'] : array());
        $this->display('misc/slider.html');
    }
    
    
}// End Class
?>