ここの情報は古いです。ご理解頂いた上でお取り扱いください。

Changeset 4375


Ignore:
Timestamp:
Oct 12, 2007, 11:50:39 PM (12 years ago)
Author:
ogawa
Message:

#1049:ダッシュボード機能を追加する

Location:
OpenPNE/branches/stable-2.10.x
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • OpenPNE/branches/stable-2.10.x/public_html/modules/admin/default.css

    r4263 r4375  
    10831083#admin_page_top p.actionMsg { margin-top: 10px; margin-bottom: 0;}
    10841084#admin_page_top div.contents { padding: 10px 0 0 0;}
    1085 #admin_page_top div.info { margin: 0 17px;}
    1086 #admin_page_top div.info { padding-bottom: 10px;}
    1087 #admin_page_top div.topics { border: 1px #A3A3A6 solid;}
    1088 #admin_page_top div.topics { float: left; margin-top: 10px; padding-bottom: 3px; margin: 0 17px;}
    1089 #admin_page_top div.topics h2 { padding: 0 0 0 10px; margin-top: 0; border-bottom: 1px #A3A3A6 solid; background: #58585C; background-image: none; line-height: 150%; font-size: medium; color: #ffffff;}
    1090 #admin_page_top div.topics dl { padding: 3px 15px 0 15px;}
    1091 #admin_page_top div.topics dt { float: left; padding: 4px 0;}
    1092 #admin_page_top div.topics dd { padding: 4px 0; padding-left: 7em;}
    1093 #admin_page_top div.topics dd span { padding-right: 5px; font-size: x-small; font-weight: bold; color: #ff0000;}
     1085
     1086#admin_page_top div.noticeTypeA,
     1087#admin_page_top div.noticeTypeB { float:left; margin-left: 10px; width: 300px;}
     1088#admin_page_top div.box { margin-bottom:10px; border: 1px #a5a2a5 solid;}
     1089#admin_page_top div.box h2 { margin-top: 0px; padding: 0 0 0 18px; background: #5a595a; line-height: 150%; font-size: 105%; color: #fff;}
     1090#admin_page_top div.box div.innerBox { width: 298px; overflow: hidden; line-height:1.1em;}
     1091
     1092#admin_page_top div#topics dl,
     1093#admin_page_top div#counter dl { padding: 1px 10px 0 10px;}
     1094#admin_page_top div#topics dt,
     1095#admin_page_top div#counter dt { float: left; padding: 4px 0;}
     1096#admin_page_top div#topics dd,
     1097#admin_page_top div#counter dd { padding: 4px 0; padding-left: 6.3em;}
     1098#admin_page_top div.box dd span.origin { padding-left:8px; font-size: x-small;}
     1099#admin_page_top div.box dd span.origin a { margin:0 2px;}
     1100
     1101#admin_page_top div#topics dd { padding-left: 3.7em;}
     1102#admin_page_top div#topics dd span { padding-right: 5px; font-size: x-small; font-weight: bold; color: #c00;}
     1103#admin_page_top div#counter dd { padding-left: 8em;}
    10941104
    10951105/** admin_page_login **/
  • OpenPNE/branches/stable-2.10.x/webapp/modules/admin/page/top.php

    r1856 r4375  
    1616        $v['SNS_NAME'] = SNS_NAME;
    1717        $v['OPENPNE_VERSION'] = OPENPNE_VERSION;
     18       
     19        $this->set($v);
    1820
    19         if (DISPLAY_OPENPNE_INFO) {
    20             $rss_url = OPENPNE_INFO_URL;
    21             $rss = new OpenPNE_RSS();
    22             if (!$items = $rss->fetch($rss_url)) {
    23                 $v['admin_info'] = array();
    24             } else {
    25                 $v['admin_info'] = $items;
    26             }
    27         }
     21        // ダッシュボード用(暫定)
     22        $member_count = $this->_getMemberCount();
     23        $member_count_active = $this->_getMemberCountActive();
     24        $member_rate_active = ($member_count_active / $member_count) * 100;
     25        $friend_count = $this->_getFriendCount();
     26        $friend_count_avg = $friend_count / $member_count;
     27        $this->set('info_member_count', $member_count);
     28        $this->set('info_member_count_yesterday', $this->_getMemberCountYesterday());
     29        $this->set('info_commu_count', $this->_getCommuCount());
     30        $this->set('info_member_rate_active', $member_rate_active);
     31        $this->set('info_friend_count_avg', $friend_count_avg);
     32        $this->set('info_diary_count_today', $this->_getDiaryCountToday());
     33        $this->set('info_diary_count_yesterday', $this->_getDiaryCountYesterday());
    2834
    29         $this->set($v);
    3035        return 'success';
     36    }
     37
     38    /**
     39     * 総メンバー数
     40     */
     41    function _getMemberCount()
     42    {
     43        $sql = 'SELECT COUNT(*) FROM c_member';
     44        return db_get_one($sql);
     45    }
     46   
     47    /**
     48     * 前日登録メンバー数
     49     */
     50    function _getMemberCountYesterday()
     51    {
     52        $yesterday = date('Y-m-d H:i:s', mktime(0, 0, 0, date('m'), date('d') - 1, date('Y')));
     53        $today = date('Y-m-d H:i:s', mktime(0, 0, 0, date('m'), date('d'), date('Y')));
     54       
     55        $sql = 'SELECT COUNT(*) FROM c_member WHERE r_date >= ? AND r_date < ?';
     56        $params = array($yesterday, $today);
     57        return db_get_one($sql, $params);
     58    }
     59   
     60    /**
     61     * 総コミュニティ数
     62     */
     63    function _getCommuCount()
     64    {
     65        $sql = 'SELECT COUNT(*) FROM c_commu';
     66        return db_get_one($sql);
     67    }
     68   
     69    /**
     70     * アクティブメンバー数
     71     */
     72    function _getMemberCountActive()
     73    {
     74        $threedaysago = date('Y-m-d H:i:s', strtotime('-3 days'));
     75
     76        $sql = 'SELECT COUNT(*) FROM c_member WHERE access_date > ?';
     77        $params = array($threedaysago);
     78        return db_get_one($sql, $params);
     79    }
     80   
     81    /**
     82     * 総フレンド数
     83     */
     84    function _getFriendCount()
     85    {
     86        $sql = 'SELECT COUNT(*) FROM c_friend';
     87        return db_get_one($sql);
     88    }
     89   
     90    /**
     91     * 今日の日記件数
     92     */
     93    function _getDiaryCountToday()
     94    {
     95        $today = date('Y-m-d H:i:s', mktime(0, 0, 0, date('m'), date('d'), date('Y')));
     96       
     97        $sql = 'SELECT COUNT(*) FROM c_diary WHERE r_datetime >= ?';
     98        $params = array($today);
     99        return db_get_one($sql, $params);
     100    }
     101   
     102    /**
     103     * 前日の日記件数
     104     */
     105    function _getDiaryCountYesterday()
     106    {
     107        $yesterday = date('Y-m-d H:i:s', mktime(0, 0, 0, date('m'), date('d') - 1, date('Y')));
     108        $today = date('Y-m-d H:i:s', mktime(0, 0, 0, date('m'), date('d'), date('Y')));
     109       
     110        $sql = 'SELECT COUNT(*) FROM c_diary WHERE r_datetime >= ? AND r_datetime < ?';
     111        $params = array($yesterday, $today);
     112        return db_get_one($sql, $params);
    31113    }
    32114}
  • OpenPNE/branches/stable-2.10.x/webapp/modules/admin/templates/top.tpl

    r2525 r4375  
    88({if $msg})
    99<p class="actionMsg">({$msg})</p>
    10 ({else})
    1110({/if})
    1211
    1312<div class="contents">
    1413
    15 ({if $msg})
    16 ({else})
    17 <div class="info">
    18 <p>上部メニューから設定したい項目を選択してください。</p>
    19 </div>({*/div class="info"*})
    20 ({/if})
    21 
    22 ({if $smarty.const.DISPLAY_OPENPNE_INFO})
    23 ({if $admin_info})
    24 <div class="topics">
    25 <h2>トピックス</h2>
    26 <dl>
    27 ({foreach from=$admin_info item=item})
    28 <dt>({$item.date|date_format:"%m/%d"})</dt>
    29 <dd><a href="({$item.link})" target="_blank">({$item.title})</a></dd>
    30 ({/foreach})
    31 </dl>
    32 </div>({*/div class="topics"*})
    33 ({/if})
    34 ({/if})
    35 
    36 <br class="clear" />
     14({ext_include file="inc_dashboard.tpl"})
    3715
    3816({$inc_footer|smarty:nodefaults})
Note: See TracChangeset for help on using the changeset viewer.