public function create() { // make sure user has rights to create self::__checkPermission('facts_new'); // get the validated input $input = $this->__validate($_POST); // set the created date $input['created'] = date('Y-m-d H:i:s'); $input['updated'] = date('Y-m-d H:i:s'); // save the new record $fact = new Fact($input); if (!$fact->save()) { $this->__log(__('error encountered creating new fact'),self::LOG_ERROR); Flash::set('error',__('Could not save record in database!')); redirect(get_url('plugin/facts/new')); } // pat on the back and send back to the list $this->__log(__('created new fact').' "'.$fact->name.'"'); Flash::set('success',__('Record saved!')); redirect(get_url('plugin/facts')); }//*/