recordid); } } if (!$data = get_record('data','id',$record->dataid)) { error ('this database does not exist'); } switch ($mode) { case 'add': $newcomment = new object; $newcomment->userid = $USER->id; if (($newcomment->content = $commentcontent) && ($newcomment->recordid = $recordid)) { insert_record('data_comments',$newcomment); } redirect('view.php?d='.s($d).'&search='.s($search).'&sort='.s($sort).'&order='.s($order).'&group='.s($group).'&page='.s($page).'&rid='.s($rid), get_string("commentsaved", "data")); break; case 'edit': //print edit form print_header(); $comment = get_record('data_comments','id',$commentid); print_heading('Edit'); echo '
'; echo '
'; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'; echo ''; echo '
'; print_footer(); break; case 'editcommit': //update db $newcomment = new object; $newcomment->id = $commentid; $newcomment->content = $commentcontent; update_record('data_comments',$newcomment); redirect('view.php?d='.s($d).'&search='.s($search).'&sort='.s($sort).'&order='.s($order).'&group='.s($group).'&page='.s($page).'&rid='.s($rid), get_string("commentsaved", "data")); break; case 'delete': //deletes single comment from db if ($confirm and confirm_sesskey()) { delete_records('data_comments','id',$commentid); redirect('view.php?d='.s($d).'&search='.s($search).'&sort='.s($sort).'&order='.s($order).'&group='.s($group).'&page='.s($page).'&rid='.s($rid), get_string("commentsaved", "data")); } else { //print confirm delete form print_header(); print_heading('Delete Confirm'); data_print_comment($d, $commentid); echo '
'; echo '
'; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
'; echo ''; echo '
'; print_footer(); } break; default: //print all listing, and add comment form print_header(); data_print_comments($data, $record, $search, $template, $sort, $page, $rid, $order, $group); print_footer(); break; } ?>