You are here

function opigno_simple_ui_form_quiz_report_form_alter in Opigno 7

Implements hook_form_quiz_report_form_alter().

File

modules/simple_ui/includes/opigno_simple_ui.quiz.inc, line 52
Quiz specific enhancements.

Code

function opigno_simple_ui_form_quiz_report_form_alter(&$form, $form_state) {
  $no_report = TRUE;
  drupal_set_title(t("Lesson completed."));
  foreach ($form as $key => $value) {
    if (is_numeric($key)) {
      if (empty($form[$key]['#no_report'])) {
        $no_report = FALSE;
      }

      // Add edit question action link.
      $form[$key]['edit_link'] = array(
        '#markup' => l(t('Edit question'), 'node/' . $form[$key]['nid']['#value'] . '/edit', array(
          'query' => array(
            'destination' => $_GET['q'],
          ),
          'attributes' => array(
            'class' => array(
              'handle-changes',
            ),
          ),
        )),
        '#access' => node_access('update', node_load($form[$key]['nid']['#value'], empty($form[$key]['vid']['#value']) ? null : $form[$key]['vid']['#value'])),
      );
    }
  }
  if ($no_report) {
    $form = array(
      '#markup' => t("There are no results to display."),
    );
  }
}