private function listSchedules(\Request $request) { $db = \Database::getDB(); $schedule_table = $db->addTable('pulse_schedule'); $pager = new \DatabasePager($db); $pager->setId('schedule-list'); $headers = array('status' => 'Status', 'id' => 'ID', 'name' => 'Name', 'interim' => 'Interim', 'execute_after' => 'Execute after', 'start_time' => 'Start time', 'end_time' => 'End time'); $pager->setHeaders($headers); $table_headers['status'] = $schedule_table->getField('status'); $table_headers['id'] = $schedule_table->getField('id'); $table_headers['name'] = $schedule_table->getField('name'); $table_headers['interim'] = $schedule_table->getField('interim'); $table_headers['execute_after'] = $schedule_table->getField('execute_after'); $table_headers['start_time'] = $schedule_table->getField('start_time'); $table_headers['end_time'] = $schedule_table->getField('end_time'); $pager->setTableHeaders($table_headers); $pager->setRowIdColumn('id'); $pager->setCallback(array('pulse\\PulseFactory', 'pagerRows')); $data = $pager->getJson(); return parent::getJsonView($data, $request); }
protected function getJsonView($data, \Request $request) { $db = \Database::newDB(); $sd = $db->addTable('systems_device'); $conditional = $this->createSearchConditional($db); if (!empty($conditional)) { $db->addConditional($conditional); } $dbpager = new \DatabasePager($db); $dbpager->setHeaders(array('physical_id' => 'Physical ID', 'department_id' => 'Department', 'location_id' => 'Location', 'model' => 'Model', 'room_number' => 'Room Number', 'username' => 'Username', 'purchase_date' => 'Purchase Date')); $tbl_headers['physical_id'] = $sd->getField('physical_id'); $tbl_headers['department_id'] = $sd->getField('department_id'); $tbl_headers['location_id'] = $sd->getField('location_id'); $tbl_headers['model'] = $sd->getField('model'); $tbl_headers['room_number'] = $sd->getField('room_number'); $tbl_headers['username'] = $sd->getField('username'); $tbl_headers['purchase_date'] = $sd->getField('purchase_date'); $dbpager->setTableHeaders($tbl_headers); $dbpager->setId('device-list'); $dbpager->setRowIdColumn('id'); $dbpager->setCallback(array('\\systemsinventory\\Controller\\Search', 'alterSearchRow')); $data = $dbpager->getJson(); return parent::getJsonView($data, $request); }
public static function departmentsList($data, $request) { $rows = array(); $no_department = 1; $db = \Database::getDB(); $tbl = $db->addTable('systems_department'); $tbl->addField('display_name'); $tbl->addField('parent_department'); $tbl->addField('description'); $tbl->addField('active'); $tbl->addField('id'); $tbl->addFieldConditional('id', '1', '!='); $tbl->addOrderBy('display_name'); $pager = new \DatabasePager($db); $pager->setCallback(array('\\systemsinventory\\Controller\\Settings', 'formatDepartmentList')); $pager->setId('department-list'); $pager->setRowIdColumn('id'); $pager->setHeaders(array('display_name' => 'Name', 'description' => 'Description', 'parent_department' => 'Parent Department', 'dept_active' => 'Is Active')); $data = $pager->getJson(); return $data; }
private function purgeListing() { $db = \Database::newDB(); $pages = $db->addTable('ps_page'); $pages->addFieldConditional('deleted', 1); $pager = new \DatabasePager($db); $pager->setId('purge-list'); $pager->setHeaders(array('title' => 'Title', 'last_updated' => 'Deleted')); $tbl_headers['title'] = $pages->getField('title'); $tbl_headers['last_updated'] = $pages->getField('last_updated'); $pager->setTableHeaders($tbl_headers); $pager->setCallBack(array('PS_Page', 'purgeRows')); $data = $pager->getJson(); echo json_encode($data); }