/** * Function for adding a new activity to the database. Updates the activity object. * * @param activitycalendar_activity $activity the party to be added * @return bool true if successful, false otherwise */ function add(&$activity) { // Insert a new activity $ts_now = strtotime('now'); $secret = $this->generate_secret(); $q = "INSERT INTO activity_activity (title, create_date,secret) VALUES ('tmptitle', {$ts_now}, '{$secret}')"; $result = $this->db->query($q, __LINE__, __FILE__); if (isset($result)) { // Set the new party ID $activity->set_id($this->db->get_last_insert_id('activity_activity', 'id')); // Forward this request to the update method return $this->update($activity); } else { return false; } }