Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 1441
Línea 40... Línea 40...
40
    public static function userdate(?int $value, stdClass $row, ?string $format = null): string {
40
    public static function userdate(?int $value, stdClass $row, ?string $format = null): string {
41
        return $value ? userdate($value, $format) : '';
41
        return $value ? userdate($value, $format) : '';
42
    }
42
    }
Línea 43... Línea 43...
43
 
43
 
-
 
44
    /**
-
 
45
     * Returns formatted time duration (e.g. "3 days 4 hours")
-
 
46
     *
-
 
47
     * @param float|null $value
-
 
48
     * @param stdClass $row
-
 
49
     * @param int|null $precision
-
 
50
     * @return string
-
 
51
     */
-
 
52
    public static function format_time(?float $value, stdClass $row, ?int $precision = 0): string {
-
 
53
        if ($value === null) {
-
 
54
            return '';
-
 
55
        }
-
 
56
        $value = round($value, (int) $precision);
-
 
57
        if ($value === 0.0) {
-
 
58
            return '0 ' . get_string('secs', 'moodle');
-
 
59
        }
-
 
60
        return format_time($value);
-
 
61
    }
-
 
62
 
44
    /**
63
    /**
45
     * Returns yes/no string depending on the given value
64
     * Returns yes/no string depending on the given value
46
     *
65
     *
47
     * @param bool|null $value
66
     * @param bool|null $value
48
     * @return string
67
     * @return string