Exemplo n.º 1
0
 protected function format_values($tab, $record_id)
 {
     $rb_obj = new RBO_RecordsetAccessor($tab);
     $record = $rb_obj->get_record($record_id);
     if (!$record) {
         return array();
     }
     $access = Utils_RecordBrowserCommon::get_access($tab, 'view', $record);
     if (!$access) {
         return array();
     }
     // use RB object instance for better display callback compatibility
     // some of them uses Utils_RecordBrowser::$rb_obj instance
     $rb = ModuleManager::new_instance('Utils_RecordBrowser', null, 'rb');
     $rb->construct($tab);
     $rb->init($tab);
     $fields = Utils_RecordBrowserCommon::init($tab);
     $printable_data = array();
     foreach ($fields as $f) {
         if ($access[$f['id']]) {
             $printable_data[] = array('label' => _V($f['name']), 'value' => $record->get_val($f['id'], true));
         }
     }
     // fill rows - it's easier here than in template
     if ($this->fill_empty_rows()) {
         while (count($printable_data) % $this->cols() != 0) {
             $printable_data[] = array('label' => '', 'value' => '');
         }
     }
     return $printable_data;
 }