-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathview_table.php
84 lines (77 loc) · 2.56 KB
/
view_table.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<?php
/**
* Payir table implementation.
* @author Rabist
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class view_table extends table_sql
{
/**
* Constructor
* @param int $uniqueid all tables have to have a unique id, this is used
* as a key when storing table properties like sort order in the session.
*/
function __construct($uniqueid)
{
parent::__construct($uniqueid);
// Define the list of columns to show.
$columns = array('transid', 'factornumber', 'amount', 'description', 'cardnumber', 'timeupdated');
$this->define_columns($columns);
// Define the titles of columns to show in header.
$headers = array(get_string('buyid', 'enrol_payir'), get_string('factornumber', 'enrol_payir'), get_string('amounttoman', 'enrol_payir'), get_string('description'), get_string('cardnumber', 'enrol_payir'), get_string('date'));
$this->define_headers($headers);
}
/**
* This function is called for each data row to allow processing of the
* username value.
*
* @param object $values Contains object with all the values of record.
*
*/
function col_description($values)
{
if ($this->is_downloading()) {
return $values->description;
} else {
$d = explode('-', $values->description);
return "<a href='$CFG->wwwroot/course/view.php?id=$values->courseid'>$d[0]</a>-<a href='$CFG->wwwroot/user/profile.php?id=$values->userid'>$d[1]</a>";
}
}
/**
* This function is called for each data row to allow processing of the
* username value.
*
* @param object $values Contains object with all the values of record.
*
*/
function col_amount($values)
{
return number_format($values->amount);
}
/**
* This function is called for each data row to allow processing of the
* username value.
*
* @param object $values Contains object with all the values of record.
*
*/
function col_cardnumber($values)
{
if ($this->is_downloading()) {
return $values->cardnumber;
} else {
return "<span dir='ltr'>$values->cardnumber</span>";
}
}
/**
* This function is called for each data row to allow processing of the
* username value.
*
* @param object $values Contains object with all the values of record.
*
*/
function col_timeupdated($values)
{
return userdate($values->timeupdated, '%H:%M - %Y/%m/%d');
}
}