Changeset 773 for trunk

Show
Ignore:
Timestamp:
01/01/08 03:32:42 (11 months ago)
Author:
michiel
Message:

Create seperate menu item for logging
Seperate Admin and Frontend logging
Re #161

Location:
trunk
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/admin/index.php

    r770 r773  
    176176                                        $admin->show_userlog(); 
    177177                                        break; 
     178                                case "show_adminlog" : 
     179                                        $admin->show_adminlog(); 
     180                                        break; 
    178181                                default :  
    179182                                        $admin->show_index(); 
  • trunk/common/mvblog_admin.php

    r770 r773  
    7070                                break; 
    7171                        case "show_userlog": 
    72                                 $this->_selected_menuitem = "users"; 
    73                                 $this->_selected_submenuitem = "log"; 
     72                                $this->_selected_menuitem = "log"; 
     73                                $this->_selected_submenuitem = "users"; 
     74                                break; 
     75                        case "show_adminlog": 
     76                                $this->_selected_menuitem = "log"; 
     77                                $this->_selected_submenuitem = "admin"; 
    7478                                break; 
    7579                        case "show_authors" : 
     
    369373                                <a class="if_menu_item<?php if ($this->_selected_menuitem == "plugins")    { echo "_act"; } ?>" href="./index.php?action=show_plugins"><?php echo gettext("Plugins"); ?></a>&nbsp; 
    370374                                <a class="if_menu_item<?php if ($this->_selected_menuitem == "import")     { echo "_act"; } ?>" href="./index.php?action=show_import"><?php echo gettext("Import"); ?></a>&nbsp; 
     375                                <a class="if_menu_item<?php if ($this->_selected_menuitem == "log")        { echo "_act"; } ?>" href="./index.php?action=show_adminlog"><?php echo gettext("Log"); ?></a>&nbsp; 
    371376                                <a class="if_menu_item" href="./index.php?action=logout"><?php echo gettext("Logout"); ?></a>&nbsp; 
    372377                        </div> 
     
    399404                                        <a class="if_submenu_item<?php if ($this->_selected_submenuitem == "index")      { echo "_act"; } ?>" href="./index.php"><?php echo gettext("Main"); ?></a>&nbsp; 
    400405                                        <a class="if_submenu_item<?php if ($this->_selected_submenuitem == "about")      { echo "_act"; } ?>" href="./index.php?action=show_about"><?php echo gettext("About"); ?></a>&nbsp; 
     406                                        <?php 
     407                                        break; 
     408                                case "log" : 
     409                                        ?> 
     410                                        <a class="if_submenu_item<?php if ($this->_selected_submenuitem == "admin")      { echo "_act"; } ?>" href="./index.php?action=show_adminlog"><?php echo gettext("Backend"); ?></a>&nbsp; 
     411                                        <a class="if_submenu_item<?php if ($this->_selected_submenuitem == "users")      { echo "_act"; } ?>" href="./index.php?action=show_userlog"><?php echo gettext("Frontend"); ?></a>&nbsp; 
    401412                                        <?php 
    402413                                        break; 
     
    20462057         */ 
    20472058        public function show_userlog() { 
    2048                 $this->log->show_log(); 
     2059                $this->log->show_log(2); 
     2060        } 
     2061        /* }}} */ 
     2062        /* show_adminlog {{{ */ 
     2063        /** 
     2064         * Show a log of what happened 
     2065         */ 
     2066        public function show_adminlog() { 
     2067                $this->log->show_log(1); 
    20492068        } 
    20502069        /* }}} */ 
  • trunk/common/mvblog_log.php

    r770 r773  
    6868        public function get_log($user_type = 0, $count = 25, $ts_start = 0, $ts_end = 0) { 
    6969                $logrecords = array(); 
    70                 $sql = "SELECT * FROM log ORDER BY time DESC"; 
     70                switch ($user_type) { 
     71                case 1: 
     72                case 2: 
     73                        $sql = sprintf("SELECT * FROM log WHERE user_type = %d ORDER BY time DESC", $user_type); 
     74                        break; 
     75                default: 
     76                        $sql = "SELECT * FROM log ORDER BY time DESC"; 
     77                        break; 
     78                } 
    7179                $res = $this->db->query($sql); 
    7280                while ($row = $res->fetchRow(MDB2_FETCHMODE_ASSOC)) { 
     
    8391        /** 
    8492         * Show log overview 
     93         * 
     94         * @param int $user_type 1 for admin, 2 for users, 0 for everything 
    8595         */ 
    86         public function show_log() { 
    87                 $logrecords = $this->get_log(); 
     96        public function show_log($user_type = 1) { 
     97                $logrecords = $this->get_log($user_type); 
    8898                echo "<table style=\"border: 1px solid black;\"><tr>\n"; 
    8999                echo "\t<td style=\"border: 1px solid black;\">date</td><td style=\"border: 1px solid black;\">login</td><td style=\"border: 1px solid black;\">fullname</td>\n";