2017-10-31 20:31:56 +00:00
|
|
|
<?php
|
|
|
|
|
2019-08-05 14:16:05 -05:00
|
|
|
if (Auth::user()->hasGlobalRead()) {
|
2017-10-31 20:31:56 +00:00
|
|
|
$data['count'] = array('query' => "SELECT COUNT(`toner_id`) FROM toner");
|
|
|
|
} else {
|
2019-12-30 12:11:26 +01:00
|
|
|
$device_ids = Permissions::devicesForUser()->toArray() ?: [0];
|
|
|
|
$perms_sql = "`toner`.`device_id` IN " .dbGenPlaceholders(count($device_ids));
|
|
|
|
|
2017-10-31 20:31:56 +00:00
|
|
|
$data['count'] = array(
|
2019-12-30 12:11:26 +01:00
|
|
|
'query' => "SELECT COUNT(`toner_id`) FROM toner WHERE $perms_sql",
|
|
|
|
'params' => $device_ids
|
2017-10-31 20:31:56 +00:00
|
|
|
);
|
|
|
|
}
|