Esempio n. 1
0
function show_dashboard()
{
    global $xoopsModuleConfig;
    $db = Database::getInstance();
    // Sets count
    $sql = "SELECT COUNT(*) FROM " . $db->prefix("gs_sets");
    list($set_count) = $db->fetchRow($db->query($sql));
    // Pictures count
    $sql = "SELECT COUNT(*) FROM " . $db->prefix("gs_images");
    list($pic_count) = $db->fetchRow($db->query($sql));
    // Users count
    $sql = "SELECT COUNT(*) FROM " . $db->prefix("gs_users");
    list($user_count) = $db->fetchRow($db->query($sql));
    // Tags count
    $sql = "SELECT COUNT(*) FROM " . $db->prefix("gs_tags");
    list($tag_count) = $db->fetchRow($db->query($sql));
    // E-Cards count
    $sql = "SELECT COUNT(*) FROM " . $db->prefix("gs_postcards");
    list($post_count) = $db->fetchRow($db->query($sql));
    // Used space
    $space = RMUtilities::formatBytesSize(GSFunctions::folderSize($xoopsModuleConfig['storedir']));
    // Number of files
    $file_count = count_files(rtrim($xoopsModuleConfig['storedir'], '/'));
    // First picture
    $sql = "SELECT * FROM " . $db->prefix("gs_images") . " ORDER BY `created` ASC LIMIT 0,1";
    $result = $db->query($sql);
    if ($db->getRowsNum($result) > 0) {
        $img = new GSImage();
        $img->assignVars($db->fetchArray($result));
        $user = new GSUser($img->owner(), 1);
        $tf = new RMTimeFormatter(0, '%M% %d%, %Y%');
        $first_pic['date'] = $tf->format($img->created());
        $first_pic['link'] = $user->userURL() . ($xoopsModuleConfig['urlmode'] ? 'img/' . $img->id() . '/set/' : '&img=' . $img->id());
    }
    xoops_cp_header();
    GSFunctions::toolbar();
    RMTemplate::get()->add_style('dashboard.css', 'galleries');
    RMTemplate::get()->add_style('admin.css', 'galleries');
    RMTemplate::get()->add_head('<script type="text/javascript">var xurl = "' . XOOPS_URL . '";</script>');
    RMTemplate::get()->add_local_script('dashboard.js', 'galleries');
    include RMTemplate::get()->get_template('admin/gs_dashboard.php', 'module', 'galleries');
    xoops_cp_footer();
}
 /**
  * @desc Calcula el espacio utilizado en disco por un directorio
  */
 public function folderSize($path)
 {
     if ($path == '') {
         return;
     }
     $size = 0;
     $dir = opendir($path);
     while (($file = readdir($dir)) !== false) {
         if ($file == '.' || $file == '..') {
             continue;
         }
         if (is_dir($path . '/' . $file)) {
             $size += GSFunctions::folderSize($path . '/' . $file);
         } else {
             $size += filesize($path . '/' . $file);
         }
     }
     closedir($dir);
     return $size;
 }
Esempio n. 3
0
 /**
  * @desc Determina el total de espacio usado en disco
  */
 public function usedQuota()
 {
     $path = $this->filesPath();
     return GSFunctions::folderSize($path);
 }