Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 1441
Línea 69... Línea 69...
69
     * @param string $field
69
     * @param string $field
70
     * @param int $columntype
70
     * @param int $columntype
71
     * @return string
71
     * @return string
72
     */
72
     */
73
    public static function get_field_sql(string $field, int $columntype): string {
73
    public static function get_field_sql(string $field, int $columntype): string {
74
        global $DB;
-
 
75
 
-
 
76
        if ($columntype === column::TYPE_LONGTEXT && $DB->get_dbfamily() === 'oracle') {
-
 
77
            $field = $DB->sql_compare_text($field, 255);
-
 
78
        }
-
 
79
 
-
 
80
        return "COUNT(DISTINCT {$field})";
74
        return "COUNT(DISTINCT {$field})";
81
    }
75
    }
Línea 82... Línea 76...
82
 
76
 
-
 
77
    /**
-
 
78
     * Returns aggregated column type
-
 
79
     *
-
 
80
     * @param int $columntype
-
 
81
     * @return int
-
 
82
     */
-
 
83
    public static function get_column_type(int $columntype): int {
-
 
84
        return column::TYPE_INTEGER;
-
 
85
    }
-
 
86
 
83
    /**
87
    /**
84
     * Return formatted value for column when applying aggregation
88
     * Return formatted value for column when applying aggregation
85
     *
89
     *
86
     * @param mixed $value
90
     * @param mixed $value
87
     * @param array $values
91
     * @param array $values
88
     * @param array $callbacks
92
     * @param array $callbacks
89
     * @param int $columntype
93
     * @param int $columntype
90
     * @return int
94
     * @return int
91
     */
95
     */
92
    public static function format_value($value, array $values, array $callbacks, int $columntype): int {
96
    public function format_value($value, array $values, array $callbacks, int $columntype): int {
93
        return (int) reset($values);
97
        return (int) reset($values);
94
    }
98
    }