static function register($fields) { // MAGICALLY put fields into current scope extract($fields); $ngrade = new Grades(); $ngrade->userid = $userid; $ngrade->cdate = common_sql_now(); $ngrade->grade = $grade; $ngrade->noticeid = $noticeid; $result = $ngrade->insert(); if (!$result) { common_log_db_error($user, 'INSERT', __FILE__); return false; } return $ngrade; }