public function testmakeInvisibleForAll() { $tracker = new Tracker(); //execute the method and test if it works and does not throws an exception. try { $tracker->makeInvisibleForAll(1); $this->assertTrue(true); } catch (Exception $e) { $this->fail(); } }
/** * This function should be overridden in each module. It marks an item as deleted. * * If it is not overridden, then marking this type of item is not allowed */ function mark_deleted($id) { global $current_user; $date_modified = $GLOBALS['timedate']->nowDb(); if (isset($_SESSION['show_deleted'])) { $this->mark_undeleted($id); } else { // call the custom business logic $custom_logic_arguments['id'] = $id; $this->call_custom_logic("before_delete", $custom_logic_arguments); if (isset($this->field_defs['modified_user_id'])) { if (!empty($current_user)) { $this->modified_user_id = $current_user->id; } else { $this->modified_user_id = 1; } $query = "UPDATE {$this->table_name} set deleted=1 , date_modified = '{$date_modified}', modified_user_id = '{$this->modified_user_id}' where id='{$id}'"; } else { $query = "UPDATE {$this->table_name} set deleted=1 , date_modified = '{$date_modified}' where id='{$id}'"; } $this->db->query($query, true, "Error marking record deleted: "); $this->deleted = 1; $this->mark_relationships_deleted($id); // Take the item off the recently viewed lists $tracker = new Tracker(); $tracker->makeInvisibleForAll($id); // call the custom business logic $this->call_custom_logic("after_delete", $custom_logic_arguments); } }
function oqc_mark_deleted($id) { global $current_user; $date_modified = gmdate($GLOBALS['timedate']->get_db_date_time_format()); if (isset($this->field_defs['modified_user_id'])) { if (!empty($current_user)) { $this->modified_user_id = $current_user->id; } else { $this->modified_user_id = 1; } $query = "UPDATE {$this->table_name} set is_latest=0 , date_modified = '{$date_modified}', modified_user_id = '{$this->modified_user_id}' where id='{$id}'"; } else { $query = "UPDATE {$this->table_name} set is_latest=0 , date_modified = '{$date_modified}' where id='{$id}'"; } $this->db->query($query, true, "Error marking record deleted: "); // Take the item off the recently viewed lists $tracker = new Tracker(); $tracker->makeInvisibleForAll($id); }