| 1 |
<?php |
<?php |
| 2 |
// $Id: views_handler_field_is_online.inc,v 1.1.2.2 2009/02/12 20:02:26 liammcdermott Exp $ |
// $Id: views_handler_field_is_online.inc,v 1.1.2.3 2009/02/13 03:18:36 liammcdermott Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 12 |
*/ |
*/ |
| 13 |
class views_handler_field_is_online extends views_handler_field_boolean { |
class views_handler_field_is_online extends views_handler_field_boolean { |
| 14 |
function query() { |
function query() { |
| 15 |
$sql = "(". time() ." - users.access) < 900"; |
// We use an IF for MySQL/PostgreSQL compatibility. Otherwise PostgreSQL |
| 16 |
|
// would return 'f' and 't'. |
| 17 |
|
$sql = "IF((". time() ." - users.access) < 900, 1, 0)"; |
| 18 |
// We liberally steal from views_handler_sort_formula here. |
// We liberally steal from views_handler_sort_formula here. |
| 19 |
$this->ensure_my_table(); |
$this->ensure_my_table(); |
| 20 |
$this->field_alias = $this->query->add_field(NULL, $sql, $this->table_alias .'_'. $this->field); |
$this->field_alias = $this->query->add_field(NULL, $sql, $this->table_alias .'_'. $this->field); |