diff options
author | Jayaram Pai | 2014-04-18 10:17:58 +0530 |
---|---|---|
committer | Jayaram Pai | 2014-04-18 10:17:58 +0530 |
commit | cfdb7e9bd5742cafafec0dd2fb7bfb4995b772ee (patch) | |
tree | 9b197c4bfd781d82f882ee6de42811764eb8ca07 | |
parent | 67f9fb1724d3d40d3d1a59d82fb6af9bd58b015d (diff) | |
download | tbc-external-review-cfdb7e9bd5742cafafec0dd2fb7bfb4995b772ee.tar.gz tbc-external-review-cfdb7e9bd5742cafafec0dd2fb7bfb4995b772ee.tar.bz2 tbc-external-review-cfdb7e9bd5742cafafec0dd2fb7bfb4995b772ee.zip |
added active state for the reviewer, redirection for compulsary profile form before test
-rwxr-xr-x | tbc_external_review.module | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/tbc_external_review.module b/tbc_external_review.module index 9bceeec..3666eac 100755 --- a/tbc_external_review.module +++ b/tbc_external_review.module @@ -272,7 +272,10 @@ global $user; $form = array(); /* populating the form with previous entry details if exists */ - $query = "select * from {external_review_profile} where uid = %d"; + $query = " + SELECT * FROM {external_review_profile} + WHERE uid = %d + "; $result = db_query($query, $user->uid); $row = db_fetch_array($result); @@ -414,7 +417,10 @@ function tbc_external_review_view_reviewers_all() { $page_content = ""; - $query = "select * from {external_review_profile}"; + $query = " + SELECT * FROM {external_review_profile} + WHERE active = 1 + "; $result = db_query($query); $page_content .= "<ul>"; @@ -1750,6 +1756,7 @@ $minutes_remaining = 25; $seconds_remaining = 0; + /* checking if a valid question */ if ($question_id > 5 || $question_id < 0) { drupal_set_message("Wrong question number.", "error"); drupal_goto("tbc_external_review/eligibility_test/question/1"); @@ -1823,6 +1830,19 @@ $result = db_query($query); drupal_set_message("Eligibility Test completed successfully. We will get back to you soon.", "status"); } else { + /* checking if the user has filled the profile form */ + $query = " + SELECT uid FROM external_review_profile + WHERE uid = %d + "; + $result = db_query($query, $user->uid); + $num_rows = mysql_num_rows($result); + if(!$num_rows) { + drupal_set_message("Please fill the profile form before you can attend the test.", "error"); + drupal_goto("tbc_external_review/profile"); + } + + /* showing the test details before starting the test */ $page_content .= "<p>You are about to give a test based on which you will be selected as a reviewer for the Scilab Textbook Companions.</p>"; $page_content .= "<ul>"; $page_content .= "<li>The test consists of 5 code review questions that are mandatory.</li>"; |