Menampilkan member aktif, buku populer pada theme fatin

Discuss more about theme modification, creating new theme, etc for SLiMS.

Moderators: wynerst, buitenzorg812, purwoko, sutriadi, ido, Dicarve, ridorido

Post Reply
User avatar
latif
Posts: 36
Joined: 30 Sep 2011, 06:14
Location: Yogyakarta

Menampilkan member aktif, buku populer pada theme fatin

Post by latif » 02 Dec 2011, 14:04

udah da yang coba theme fatin? untuk menampilkan member paling aktif, buku populer, pengunjung, dlll, di block caranya gimana y? :?:

sutriadi
Posts: 113
Joined: 27 Sep 2011, 06:31
Location: Kotamobagu
Contact:

Re: Menampilkan member aktif, buku populer pada theme fatin

Post by sutriadi » 03 Dec 2011, 04:37

Kayaknya belum banyak yang make atau belum banyak yg oprek. Cara gampangnya, bikin block baru kemudian masukkan kode PHP utk tujuan yg diinginkan. Simpan block dan taruh di area yg diinginkan. :)

User avatar
latif
Posts: 36
Joined: 30 Sep 2011, 06:14
Location: Yogyakarta

Re: Menampilkan member aktif, buku populer pada theme fatin

Post by latif » 03 Dec 2011, 12:23

kemaren dah sy coba pak dan ternyata blm berhasil, padahal script yg sy pasang bisa dipasang di template laen ! dah sy cb pke filter php, filter html dan jg full html ttp blm bisa. kalo buat pasang ShoutMix Chat dah ok pak! :?:

sutriadi
Posts: 113
Joined: 27 Sep 2011, 06:31
Location: Kotamobagu
Contact:

Re: Menampilkan member aktif, buku populer pada theme fatin

Post by sutriadi » 05 Dec 2011, 08:14

boleh ditaruh di sini scriptnya supaya saya coba?

User avatar
latif
Posts: 36
Joined: 30 Sep 2011, 06:14
Location: Yogyakarta

Re: Menampilkan member aktif, buku populer pada theme fatin

Post by latif » 05 Dec 2011, 22:14

sutriadi wrote:boleh ditaruh di sini scriptnya supaya saya coba?
kY gini pak:

<!-- anggota aktif -->
<div class="heading"><?php echo __('10 most active members'); ?></div>
<div class="content">
<?php
// 10 most active member
$report_query = $dbs->query('SELECT m.member_name, m.member_id, COUNT(loan_id) FROM loan AS l
INNER JOIN member AS m ON m.member_id=l.member_id
WHERE TO_DAYS(expire_date)>TO_DAYS(\''.date('Y-m-d').'\')
GROUP BY l.member_id ORDER BY COUNT(loan_id) DESC LIMIT 10');
$report_data = '<ol>';
while ($data = $report_query->fetch_row()) {
$report_data .= '<li>'.$data[0].' ('.$data[1].')</li>';
}
$report_data .= '</ol>';
?>
<?=$report_data;?>
</div>
<!-- anggota aktif end -->

<!-- buku popular -->
<div class="heading"><?php echo __('10 Most Popular Titles'); ?></div>
<div class="content">
<?php
// popular titles
$stat_query = $dbs->query('SELECT b.title,l.item_code,COUNT(l.loan_id) AS total_loans FROM `loan` AS l
LEFT JOIN item AS i ON l.item_code=i.item_code
LEFT JOIN biblio AS b ON i.biblio_id=b.biblio_id
GROUP BY l.item_code ORDER BY COUNT(l.loan_id) DESC LIMIT 10');
$stat_data = '<ol>';
while ($data = $stat_query->fetch_row()) {
$stat_data .= '<li>'.$data[0].'</li>';
}
$stat_data .= '</ol>';
?>
<?=$stat_data;?></div>
<!-- buku popular end -->

<!-- Pengunjung -->
<div class="heading"><?php echo __('Visitor List'); ?></div>
<div class="content">
Pengunjung hari ini:
<?
$stat_query = $dbs->query("SELECT COUNT(*) AS jumData FROM visitor_count where date(checkin_date) = date(now())");
$hasil = mysql_query($stat_query);
$data = mysql_fetch_array($hasil);

$jumData = $data['jumData'];
?>
<b>
<?=$jumData;?>
</b>


<?php
// visitor list
$stat_query = $dbs->query("SELECT * from visitor_count where date(checkin_date) = date(now()) order by checkin_date DESC limit 10");
$stat_data = '<ol>';
while ($data = $stat_query->fetch_row()) {
$stat_data .= '<li>'.$data[2].' _ '.$data[3].'</li>';
}
$stat_data .= '</ol>';
?>
<?=$stat_data;?></div>
<!-- Pengunjung end -->

User avatar
latif
Posts: 36
Joined: 30 Sep 2011, 06:14
Location: Yogyakarta

Re: Menampilkan member aktif, buku populer pada theme fatin

Post by latif » 06 Dec 2011, 12:53

sutriadi wrote:boleh ditaruh di sini scriptnya supaya saya coba?
begini pak, ini sy ambil dr trik di blog.jogjalib.net:
member aktiv:

Code: Select all

<!-- anggota aktif -->
<div class="heading"><?php echo __('10 most active members'); ?></div>
<div class="content">
<?php
// 10 most active member
$report_query = $dbs->query('SELECT m.member_name, m.member_id, COUNT(loan_id) FROM loan AS l
INNER JOIN member AS m ON m.member_id=l.member_id
WHERE TO_DAYS(expire_date)>TO_DAYS(\''.date('Y-m-d').'\')
GROUP BY l.member_id ORDER BY COUNT(loan_id) DESC LIMIT 10');
$report_data = '<ol>';
while ($data = $report_query->fetch_row()) {
$report_data .= '<li>'.$data[0].' ('.$data[1].')</li>';
}
$report_data .= '</ol>';
?>
<?=$report_data;?>
</div>
<!-- anggota aktif end -->
buku populer:

Code: Select all

<!-- buku popular -->
<div class="heading"><?php echo __('10 Most Popular Titles'); ?></div>
<div class="content">
<?php
// popular titles
$stat_query = $dbs->query('SELECT b.title,l.item_code,COUNT(l.loan_id) AS total_loans FROM `loan` AS l
LEFT JOIN item AS i ON l.item_code=i.item_code
LEFT JOIN biblio AS b ON i.biblio_id=b.biblio_id
GROUP BY l.item_code ORDER BY COUNT(l.loan_id) DESC LIMIT 10');
$stat_data = '<ol>';
while ($data = $stat_query->fetch_row()) {
$stat_data .= '<li>'.$data[0].'</li>';
}
$stat_data .= '</ol>';
?>
<?=$stat_data;?></div>
<!-- buku popular end -->
pengunjung:

Code: Select all

<!-- Pengunjung -->
<div class="heading"><?php echo __('Visitor List'); ?></div>
<div class="content">
Pengunjung hari ini:
<?
$stat_query = $dbs->query("SELECT COUNT(*) AS jumData FROM visitor_count where date(checkin_date) = date(now())");
$hasil = mysql_query($stat_query);
$data = mysql_fetch_array($hasil);

$jumData = $data['jumData'];
?>
<b>
<?=$jumData;?>
</b>


<?php
// visitor list
$stat_query = $dbs->query("SELECT * from visitor_count where date(checkin_date) = date(now()) order by checkin_date DESC limit 10");
$stat_data = '<ol>';
while ($data = $stat_query->fetch_row()) {
$stat_data .= '<li>'.$data[2].' _ '.$data[3].'</li>';
}
$stat_data .= '</ol>';
?>
<?=$stat_data;?></div>
<!-- Pengunjung end -->
ketika saya pasang di xampp bisa berjalan normal pak, tp kalo di psenayan gk jalan, di fatin jg blm bisa, mohon pencerahan nya !

sutriadi
Posts: 113
Joined: 27 Sep 2011, 06:31
Location: Kotamobagu
Contact:

Re: Menampilkan member aktif, buku populer pada theme fatin

Post by sutriadi » 09 Dec 2011, 17:26

Yang perlu diubah hanya cara penulisan kode saja. Kode PHP ditaruh dalam satu baris saja. Nanti pada rilis kandidat berikutnya diusahakan bisa multiple line. Ini untuk contoh 10 buku populer yang sudah dimodifikasi scriptnya. Jangan lupa pilih PHP Code pada pilihan Filter saat membuat block.

Code: Select all

<?php global $dbs; $stat_query = $dbs->query('SELECT b.title,l.item_code,COUNT(l.loan_id) AS total_loans FROM `loan` AS l LEFT JOIN item AS i ON l.item_code=i.item_code LEFT JOIN biblio AS b ON i.biblio_id=b.biblio_id GROUP BY l.item_code ORDER BY COUNT(l.loan_id) DESC LIMIT 10'); $stat_data = '<ol>'; while ($data = $stat_query->fetch_row()) { $stat_data .= '<li>'.$data[0].'</li>'; } $stat_data .= '</ol>'; echo $stat_data; ?>
Silakan mengubah code... :)
Attachments
10_buku_populer.png
10 buku populer
10_buku_populer.png (7.57 KiB) Viewed 6902 times

Post Reply