function flag_flag::update in Flag 6
Same name and namespace in other branches
- 5 flag.inc \flag_flag::update()
- 6.2 flag.inc \flag_flag::update()
- 7.3 includes/flag/flag_flag.inc \flag_flag::update()
- 7.2 flag.inc \flag_flag::update()
Saves an existing flag to the database. Better use save().
1 call to flag_flag::update()
- flag_flag::save in ./
flag.inc - Saves a flag to the database. It is a wrapper around update() and insert().
File
- ./
flag.inc, line 701 - Implements various flags. Uses object oriented style inspired by that of Views 2.
Class
- flag_flag
- This abstract class represents a flag, or, in Views 2 terminology, "a handler".
Code
function update() {
db_query("UPDATE {flags} SET name = '%s', title = '%s', roles = '%s', global = %d, options = '%s' WHERE fid = %d", $this->name, $this->title, implode(',', $this->roles), $this->global, $this
->get_serialized_options(), $this->fid);
db_query("DELETE FROM {flag_types} WHERE fid = %d", $this->fid);
foreach ($this->types as $type) {
db_query("INSERT INTO {flag_types} (fid, type) VALUES (%d, '%s')", $this->fid, $type);
}
}