+ //
+ // Setter for table editors with inactive cell control.
+ //
+ function set_inactive_ctrl($table, $key) {
+ $this->inactive_ctrl = array('table'=>$table, 'key'=>$key);
+ }
+ //
+ // Helper for display inactive control cells
+ //
+ function inactive_control_cell(&$row)
+ {
+ if ($this->inactive_ctrl) {
+
+ global $Ajax;
+
+ $key = $this->key ?
+ $this->key : $this->columns[0]['name']; // TODO - support for complex keys
+ $id = $row[$key];
+ $table = $this->main_tbl;
+ $name = "Inactive". $id;
+ $value = $row['inactive'] ? 1:0;
+
+ if (check_value('show_inactive')) {
+ if (isset($_POST['LInact'][$id]) && (get_post('_Inactive'.$id.'_update') ||
+ get_post('Update')) && (check_value('Inactive'.$id) != $value)) {
+ update_record_status($id, !$value, $table, $key);
+ $value = !$value;
+ }
+ echo '<td align="center">'. checkbox(null, $name, $value, true, '')
+ . hidden("LInact[$id]", $value, false) . '</td>';
+ }
+ } else
+ return '';
+ }
+