From 8aabbfef13517779df1061c696d354ba6c5650d7 Mon Sep 17 00:00:00 2001 From: michaelk Date: Wed, 12 Dec 2012 17:00:54 -0800 Subject: [PATCH] Make all question type fields reorderable through the Manage Fields content type page --- question_types/long_answer/long_answer.module | 16 ++++++++++++++++ question_types/matching/matching.module | 16 ++++++++++++++++ question_types/short_answer/short_answer.module | 16 ++++++++++++++++ question_types/truefalse/truefalse.module | 21 +++++++++++++++++++++ 4 files changed, 69 insertions(+), 0 deletions(-) diff --git a/question_types/long_answer/long_answer.module b/question_types/long_answer/long_answer.module index a3d058b..b0f77a6 100644 --- a/question_types/long_answer/long_answer.module +++ b/question_types/long_answer/long_answer.module @@ -291,3 +291,19 @@ function long_answer_report_validate($values, $form_key) { form_set_error($form_key . '][score', t('The score needs to be a number between @min and @max', array('@min' => 0, '@max' => $max))); } } + +/** + * Implements hook_field_extra_fields(). + */ +function long_answer_field_extra_fields() { + $extra['node']['long_answer'] = array( + 'form' => array( + 'rubric' => array( + 'label' => t('Rubric'), + 'description' => t('Specify the criteria for grading the response'), + 'weight' => -4, + ), + ), + ); + return $extra; +} diff --git a/question_types/matching/matching.module b/question_types/matching/matching.module index 1f55f6b..cb1ce76 100644 --- a/question_types/matching/matching.module +++ b/question_types/matching/matching.module @@ -102,3 +102,19 @@ function matching_theme() { ); } + +/** + * Implements hook_field_extra_fields(). + */ +function matching_field_extra_fields() { + $extra['node']['matching'] = array( + 'form' => array( + 'match' => array( + 'label' => t('Answer'), + 'description' => t('The sets of matches for this question.'), + 'weight' => -4, + ), + ), + ); + return $extra; +} diff --git a/question_types/short_answer/short_answer.module b/question_types/short_answer/short_answer.module index c528ad7..4083310 100644 --- a/question_types/short_answer/short_answer.module +++ b/question_types/short_answer/short_answer.module @@ -227,3 +227,19 @@ function short_answer_get_answer($question_nid, $question_vid, $result_id) { WHERE sa.question_nid = :qnid AND sa.question_vid = :qvid AND sa.result_id = :rid', array(':qnid' => $question_nid, ':qvid' => $question_vid, ':rid' => $result_id))->fetchAssoc(); return $results ? $results : FALSE; } + +/** + * Implements hook_field_extra_fields(). + */ +function short_answer_field_extra_fields() { + $extra['node']['short_answer'] = array( + 'form' => array( + 'answer' => array( + 'label' => t('Answer'), + 'description' => t('Provide the answer and the method by which the answer will be evaluated.'), + 'weight' => -4, + ), + ), + ); + return $extra; +} diff --git a/question_types/truefalse/truefalse.module b/question_types/truefalse/truefalse.module index dacacb0..281bcff 100644 --- a/question_types/truefalse/truefalse.module +++ b/question_types/truefalse/truefalse.module @@ -77,3 +77,24 @@ function theme_truefalse_response($variables) { $data = $variables['data']; return theme('table', array('header' => $metadata, 'rows' => $data)); } + +/** + * Implements hook_field_extra_fields(). + */ +function truefalse_field_extra_fields() { + $extra['node']['truefalse'] = array( + 'form' => array( + 'correct_answer' => array( + 'label' => t('Correct answer'), + 'description' => t('The answer for this question.'), + 'weight' => -5, + ), + 'feedback_fields' => array( + 'label' => t('Feedback Settings'), + 'description' => t('Settings pertaining to feedback given along with results.'), + 'weight' => -4, + ), + ), + ); + return $extra; +} -- 1.7.3.1.msysgit.0