Example #1
0
 public function before_save(Table $table, $data, $pk_value)
 {
     // Don't save changes to the changes tables.
     if (in_array($table->get_name(), $this->table_names())) {
         return false;
     }
     // Open a changeset if required.
     $this->open_changeset($this->current_changeset_comment);
     // Get the current (i.e. soon-to-be-old) data for later use.
     $this->old_record = $table->get_record($pk_value);
 }
 protected function record_format(Table $table, $attrs, $query = null)
 {
     if (!isset($query[$table->get_name()]) || !is_scalar($query[$table->get_name()])) {
         return '';
     }
     $record = $table->get_record($query[$table->get_name()]);
     if ($record === false) {
         return $this->error("No record found.");
     }
     $template = new Template('record/view.html');
     $template->table = $table;
     $template->record = $record;
     return $template->render();
 }