/** * Get printers for serial_number * * @param string $serial serial number **/ public function get_data($serial = '') { $out = array(); if (!$this->authorized()) { $out['error'] = 'Not authorized'; } else { $prm = new Printer_model(); foreach ($prm->retrieve_records($serial) as $printer) { $out[] = $printer->rs; } } $obj = new View(); $obj->view('json', array('msg' => $out)); }