You are here

function _quiz_question_revision_options in Quiz 7

Same name and namespace in other branches
  1. 8.4 question_types/quiz_question/quiz_question.pages.inc \_quiz_question_revision_options()
  2. 6.4 question_types/quiz_question/quiz_question.pages.inc \_quiz_question_revision_options()
  3. 7.4 question_types/quiz_question/quiz_question.pages.inc \_quiz_question_revision_options()

Get revision options for the revision actions page

Returns revision options and default option depending on the published and answered status for a quiz

Parameters

$published: Publish status for a quiz

$answered: Has the quiz been answered?

Return value

Array with values for the #options and #default_value part of a form item

1 call to _quiz_question_revision_options()
quiz_question_revision_actions in question_types/quiz_question/quiz_question.pages.inc
Create the form for the revision actions page

File

question_types/quiz_question/quiz_question.pages.inc, line 109
User page callbacks for the quiz_question module.

Code

function _quiz_question_revision_options($published, $answered) {

  // We create a data structure holding the different options for the different quiz states
  $struct = array(
    'published' => array(
      'answered' => array(
        'options' => array(
          // The key is in the form [update][revise][publish]
          '110' => t('Update, revise and unpublish'),
          '111' => t('Update and revise'),
          '101' => t('Update'),
          '001' => t('Do nothing'),
        ),
        'default' => '111',
      ),
      'unanswered' => array(
        'options' => array(
          '100' => t('Update and Unpublish'),
          '101' => t('Update'),
          '001' => t('Do nothing'),
        ),
        'default' => '101',
      ),
    ),
    'unpublished' => array(
      'answered' => array(
        'options' => array(
          '111' => t('Update, revise and publish'),
          '110' => t('Update and revise'),
          '101' => t('Update and publish'),
          '100' => t('Update'),
          '000' => t('Do nothing'),
        ),
        'default' => '110',
      ),
      'unanswered' => array(
        'options' => array(
          '101' => t('Update and publish'),
          '100' => t('Update'),
          '000' => t('Do nothing'),
        ),
        'default' => '100',
      ),
    ),
  );
  $published = $published ? 'published' : 'unpublished';
  $answered = $answered ? 'answered' : 'unanswered';
  return $struct[$published][$answered];
}