Example #1
0
 public static function used_diskspace()
 {
     global $user;
     $user_data = new DataUserData($user->get_user_id());
     $user_filesize = $user_data->get_filesize();
     $user_quota = $user_data->get_quota();
     if ($user_quota != 0) {
         $diskspace_per = $user_filesize / $user_quota * 100;
         if ($diskspace_per == 0) {
             $diskspace_per_display = "(0%)";
         } else {
             $diskspace_per = floor($diskspace_per);
             if ($diskspace_per == 0) {
                 $diskspace_per_display = "(> 1%)";
             } else {
                 $diskspace_per_display = "(" . $diskspace_per . "%)";
             }
         }
         if (round($user_filesize / $user_quota * 100, 0) >= (int) Registry::get_value("data_quota_warning")) {
             $quotaWarn = " <img src='images/icons/notice.png' alt='W' />";
         } else {
             $quotaWarn = "";
         }
     } else {
         $quotaWarn = "";
         $diskspace_per_display = "";
     }
     $act_filesize = Convert::convert_byte_1024($user_filesize);
     $template = new HTMLTemplate("data/home/summary/used_diskspace.html");
     $template->set_var("used_diskspace", $act_filesize . " " . $diskspace_per_display . "" . $quotaWarn);
     return $template->get_string();
 }
Example #2
0
 /**
  * @see FolderInterface::get_quota_access()
  * @param integer $user_id
  * @param integer $filesize
  * @return bool
  */
 public function get_quota_access($user_id, $filesize)
 {
     $user_data = new DataUserData($user_id);
     $user_quota = $user_data->get_quota();
     $user_filesize = $user_data->get_filesize();
     $new_user_filesize = $user_filesize + $filesize;
     if ($user_quota > $new_user_filesize or $user_quota == 0) {
         return true;
     } else {
         return false;
     }
 }
Example #3
0
 /**
  * @param integer $user_id
  * @return array
  */
 public static function get_user_module_detail_setting($user_id)
 {
     if ($user_id) {
         $data_user_data = new DataUserData($user_id);
         $paramquery = $_GET;
         $paramquery['run'] = "module_value_change";
         $paramquery['dialog'] = "user_quota";
         $paramquery['retrace'] = Retrace::create_retrace_string();
         $params = http_build_query($paramquery, '', '&#38;');
         $return_array = array();
         $return_array['value'] = Convert::convert_byte_1024($data_user_data->get_quota());
         $return_array['params'] = $params;
         return $return_array;
     } else {
         return null;
     }
 }