当前位置:编程学习 > php >>

EE开发参考

1.upd.article_statistics.php

<?php

class Article_statistics_upd {

    var $version        = '1.0';
    var $module_name        = 'Article_statistics'; 
    function __construct()
    {
        $this->EE =& get_instance();
    }
   
    function install()
    {
        $this->EE->load->dbforge();
         $data = array(
            'module_name' => $this->module_name ,
            'module_version' => $this->version,
            'has_cp_backend' => 'y',
            'has_publish_fields' => 'n'
        );
   
        $this->EE->db->insert('modules', $data);
       
        $data = array(
            'class'        => $this->module_name ,
            'method'    => 'add'
        );
        $this->EE->db->insert('actions', $data);
        return TRUE;
    }
   
        
   
    function uninstall()
    {
        $this->EE->load->dbforge();
    
        $this->EE->db->where('module_name', $this->module_name);
        $this->EE->db->delete('modules');
   
        $this->EE->db->where('class', $this->module_name);
        $this->EE->db->delete('actions');
    
        
        return TRUE;
    }

    function update($current = '')
    {
        return FALSE;
    }
}
?>

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

2.mcp.article_statitics.php

<?php
class Article_statistics_mcp {

    var $version        = '1.0';
    var $module_name    = 'Article_statistics';  
    var $cached_vars    = array();
    function __construct()
    {
        $this->EE =& get_instance();
        $this->EE->load->library('table');
        // Some Globals
        $this->base_url = BASE.AMP.'C=addons_modules'.AMP.'M=show_module_cp'.AMP.'module=article_statistics';
         $menu    = array(                                       
            'module_index'            => array(   
                'link'  => $this->base_url,
                'tab_index'  => "",
                'title' => $this->EE->lang->line('module_index')
            ),
        
            'test_list'    => array(
                'link'    => $this->base_url .AMP. 'method=show_list',
                'tab_index'  => "show_list",
                'title' => $this->EE->lang->line('show_list')
            )
        );
       
        $this->cached_vars['module_menu']             = $menu;       

    }
     
    public function index()
    {
        $this->_set_nav_title($this->EE->lang->line("article_statistics_module_name"),$vars);
        return $this->EE->load->view('index', $vars, TRUE);
    }
 
    public function show_list()
    {
        $this->EE->load->library('article_statistics_helper');
       
        $this->_set_nav_title($this->EE->lang->line("article_statistics_module_name"),$data);
       
        $sql="SELECT *
                FROM bv_comments c
               
                WHERE UNIX_TIMESTAMP(DATE_SUB(CURDATE(),INTERVAL 30 DAY)) <=c.comment_date
                ORDER BY c.comment_date DESC";
        $query=$this->EE->db->query($sql);
       
       

补充:Web开发 , php ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,