Example #1
0
 /**
  *   Sets the "enabled" field to the specified value.
  *
  *   @param  integer $id ID number of element to modify
  *   @param  integer $value New value to set
  *   @return         New value, or old value upon failure
  */
 public function toggleEnabled($oldvalue, $id = 0)
 {
     $oldvalue = $oldvalue == 0 ? 0 : 1;
     $id = (int) $id;
     if ($id == 0) {
         if (is_object($this)) {
             $id = $this->cat_id;
         } else {
             return $oldvalue;
         }
     }
     return Category::_toggle($oldvalue, 'enabled', $id);
 }