/ Published in: PHP
Block - install as normal
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php //*code from http://moodle.org/blocks/HOWTO.html--> class block_livestats extends block_list { // The init() method does not need to change at all function init() { $this->title = "Live Statistik"; // $this->title = "Live Stats"; $this->version = 2006150300; } function preferred_width() { // The preferred value is in pixels return 120; } function get_content() { if ($this->content !== NULL) { return $this->content;} //echo $date.'<br>'; global $CFG; //echo $datum.'<br>'; //echo $timestamp.'<br>'; $query='SELECT COUNT( * ) FROM `mdl_log` WHERE `time` > '.$timestamp.' AND `action` = "login"'; $Users = count_records('user','deleted',0,'confirmed',1); $Courses = count_records('course','visible',1); $this->content->items[] = '<br><table border="0" align="center"> <tr> <td width="133"> <div align="left">Gesamtzahl Benutzer: </div></td> <td width="42"><div align="left">' .$Users. '</div></td> </tr> <tr> <td width="133"> <div align="left">Gesamtzahl Kurse: </div></td> <td><div align="left">'.$Courses.'</div></td> </tr> <tr> <td width="133"> <div align="left">Logins heute: </div></td> <td><div align="left">'.$count.'</div></td> </tr> </table>'; return $this->content; } } ?>