You are here

class QuizController in Quiz 8.4

Same name and namespace in other branches
  1. 8.6 src/Controller/QuizController.php \Drupal\quiz\Controller\QuizController
  2. 8.5 src/Controller/QuizController.php \Drupal\quiz\Controller\QuizController
  3. 6.x src/Controller/QuizController.php \Drupal\quiz\Controller\QuizController

Hierarchy

Expanded class hierarchy of QuizController

File

lib/Drupal/quiz/Controller/QuizController.php, line 10

Namespace

Drupal\quiz\Controller
View source
class QuizController implements ContainerInjectionInterface {
  public static function create(ContainerInterface $container) {
    return new static($container
      ->get('module_handler'));
  }

  /**
   * Primary quiz-taking view on 'Take' tab.
   */
  public function quizTake(NodeInterface $node) {

    //\Drupal::moduleHandler()->alter('quiz_take', $node);
    if (isset($node->rendered_content)) {
      return $node->rendered_content;
    }
    $to_be_rendered = quiz_take_quiz($node);

    // Manage redirection.
    if ($to_be_rendered instanceof RedirectResponse) {
      return $to_be_rendered;
    }
    return drupal_render($to_be_rendered);
  }
  public function quizOptions(NodeInterface $node) {
    module_load_include('pages.inc', 'quiz');
    $form = drupal_get_form('quiz_options_form', $node);
    return drupal_render($form);
  }
  public function quizQuestions(NodeInterface $node) {
    $path = drupal_get_path('module', 'quiz');
    drupal_add_css($path . '/quiz.css');
    module_load_include('admin.inc', 'quiz');
    $form = drupal_get_form('quiz_questions_form', $node);
    return drupal_render($form);
  }
  public function quizResults(NodeInterface $node) {
    module_load_include('admin.inc', 'quiz');
    $form = drupal_get_form('quiz_results_manage_results_form', $node);
    return drupal_render($form);
  }
  public function quizUserResults($result_id) {
    module_load_include('pages.inc', 'quiz');
    return quiz_user_results($result_id);
  }
  public function quizSettingsConfig() {
    module_load_include('admin.inc', 'quiz');
    return drupal_get_form('Drupal\\quiz\\Form\\QuizAdminSettings');
  }
  public function quizSettingsQuizForm() {
    module_load_include('admin.inc', 'quiz');
    return drupal_get_form('quiz_admin_node_form');
  }
  public function quizSettingsQuizResults() {
    module_load_include('admin.inc', 'quiz');
    return quiz_admin_quizzes();
  }
  public function quizResultsPage(NodeInterface $node, $quiz_rid) {
    module_load_include('admin.inc', 'quiz');
    return quiz_admin_results($node, $quiz_rid);
  }
  public function quizMyResults(NodeInterface $node) {
    module_load_include('pages.inc', 'quiz');
    return quiz_my_results($node);
  }
  public function quizMyResultsPage(NodeInterface $node, $quiz_rid) {
    module_load_include('pages.inc', 'quiz');
    return quiz_user_results($quiz_rid);
  }
  public function quizUserMyResults($user_id) {
    module_load_include('pages.inc', 'quiz');
    return quiz_get_user_results($user_id);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
QuizController::create public static function Instantiates a new instance of this class. Overrides ContainerInjectionInterface::create
QuizController::quizMyResults public function
QuizController::quizMyResultsPage public function
QuizController::quizOptions public function
QuizController::quizQuestions public function
QuizController::quizResults public function
QuizController::quizResultsPage public function
QuizController::quizSettingsConfig public function
QuizController::quizSettingsQuizForm public function
QuizController::quizSettingsQuizResults public function
QuizController::quizTake public function Primary quiz-taking view on 'Take' tab.
QuizController::quizUserMyResults public function
QuizController::quizUserResults public function