source: branches/2.2/mobile/inc/class.common_functions.inc.php @ 3559

Revision 3559, 1.3 KB checked in by eduardoalex, 13 years ago (diff)

Ticket #1405 - Classe utilitaria para criar a pagina home do mobile.

Line 
1<?php
2        /**************************************************************************\
3        * eGroupWare                                                               *
4        * http://www.egroupware.org                                                *
5        * The file written by Mário César Kolling <mario.kolling@serpro.gov.br>    *
6        * --------------------------------------------                             *
7        *  This program is free software; you can redistribute it and/or modify it *
8        *  under the terms of the GNU General Public License as published by the   *
9        *  Free Software Foundation; either version 2 of the License, or (at your  *
10        *  option) any later version.                                              *
11        \**************************************************************************/
12
13        class common_functions
14        {
15            function borkb($size, $enclosed = NULL)
16            {
17                        if (!$size)
18                        $size = 0;
19       
20                        if ($enclosed)
21                        {
22                                $left = '(';
23                                $right = ')';
24                        }
25       
26                        if ($size < 1024)
27                                $rstring = $left . $size . 'B' . $right;
28                        else if ($size < 1048576)
29                                $rstring = $left . round($size/1024) . 'KB' . $right;
30                        else if ($size < 1073741824)
31                                $rstring = $left . round($size/1024/1024) . 'MB' . $right;
32                        else
33                                $rstring = $left . round($size/1024/1024/1024) . 'GB' . $right;
34       
35                        return $rstring;
36                }
37        } //end common class   
38
39?>
Note: See TracBrowser for help on using the repository browser.