public function remove_from_db()
 {
     return RM_DBManager::remove_row('SUBMISSIONS', $this->submission_id);
 }
 public function remove_from_db()
 {
     return RM_DBManager::remove_row('FIELDS', $this->field_id);
 }
 public function remove_from_db()
 {
     return RM_DBManager::remove_row('SUBMISSION_FIELDS', $this->sub_field_id);
 }
 public function remove_from_db()
 {
     return RM_DBManager::remove_row('NOTES', $this->note_id);
 }
 public function remove_from_db()
 {
     return RM_DBManager::remove_row('FORMS', $this->form_id);
 }
 public function remove_submissions($unique_ids, $where = null)
 {
     $model_identifier = 'SUBMISSIONS';
     if (is_array($unique_ids)) {
         foreach ($unique_ids as $unique_id) {
             RM_DBManager::remove_row($model_identifier, $unique_id, $where);
             RM_DBManager::delete_rows('SUBMISSION_FIELDS', array('submission_id' => $unique_id), array('%d'));
         }
     } elseif ((int) $unique_ids) {
         RM_DBManager::remove_row($model_identifier, $unique_ids, $where);
         RM_DBManager::delete_rows('SUBMISSION_FIELDS', array('submission_id' => $unique_id), array('%d'));
     } else {
         return false;
     }
 }
 public function update_stat_entry($stat_id, $op = 'update')
 {
     switch ($op) {
         case 'update':
             $submitted_on = time();
             $visited_on = RM_DBManager::get_row('STATS', $stat_id);
             if ($visited_on) {
                 $diff_in_secs = $submitted_on - $visited_on->visited_on;
                 return RM_DBManager::update_row('STATS', $stat_id, array('submitted_on' => $submitted_on, 'time_taken' => $diff_in_secs), array('%s', '%d'));
             } else {
                 return false;
             }
             break;
         case 'ban':
             return RM_DBManager::update_row('STATS', $stat_id, array('submitted_on' => 'banned'), array('%s'));
             break;
         case 'delete':
             return RM_DBManager::remove_row('STATS', $stat_id);
             break;
         default:
             return null;
     }
 }