You are here

public function CourseObject::getOptionsSummary in Course 6

Same name and namespace in other branches
  1. 7.2 includes/CourseObject.inc \CourseObject::getOptionsSummary()
  2. 7 includes/CourseObject.inc \CourseObject::getOptionsSummary()

Get core options summary.

Return value

array An associative array of summary keys and values.

Overrides CourseHandler::getOptionsSummary

3 calls to CourseObject::getOptionsSummary()
CourseObject::renderOptionsSummary in includes/course_object.core.inc
Get all course object implementations of getOptionsSummary().
CourseObjectQuiz::getOptionsSummary in modules/course_quiz/course_quiz.classes.inc
Get core options summary.
CourseObjectWebform::getOptionsSummary in modules/course_webform/course_webform.classes.inc
Get core options summary.
2 methods override CourseObject::getOptionsSummary()
CourseObjectQuiz::getOptionsSummary in modules/course_quiz/course_quiz.classes.inc
Get core options summary.
CourseObjectWebform::getOptionsSummary in modules/course_webform/course_webform.classes.inc
Get core options summary.

File

includes/course_object.core.inc, line 422

Class

CourseObject
Parent abstract base class of all course objects.

Code

public function getOptionsSummary() {
  $summary = parent::getOptionsSummary();

  // Get options.
  $options = $this
    ->getOptions();

  // Get form for titles.
  $form = array();
  $this
    ->optionsForm($form, $form_state);

  // Add course object core options to summary individually, because there are
  // options we don't want to display, and others that require special logic.
  $uniqid = $options['uniqid'];

  // Enabled.
  if ($options['enabled']) {
    $summary['enabled'] = $form['enabled']['#title'];
  }
  else {
    $summary['enabled'] = '<span class="warning">' . t('Not enabled') . '</span>';
  }

  // Hidden.
  if (!$options['hidden']) {
    $summary['hidden'] = $form['hidden']['#title'];
  }
  else {
    $summary['hidden'] = '<span class="warning">' . t('Not visible in outline') . '</span>';
  }

  // Required.
  if ($options['required']) {
    $summary['required'] = $form['required']['#title'];
  }
  else {
    $summary['required'] = '<span class="warning">' . t('Completion not required') . '</span>';
  }

  // Instance edit link.
  $editUrl = $this
    ->getEditUrl();
  if (!empty($editUrl)) {
    $text = t('Edit instance');
    $summary['instance'] = l($text, $editUrl, array(
      'external' => TRUE,
      'query' => drupal_get_destination(),
    ));
  }
  elseif ($this
    ->isTemporary()) {
    $summary['instance'] = '<span class="warning">' . t('Save course to edit object') . '</span>';
  }

  // Required.
  if (!empty($options['delete'])) {
    $dest = "node/{$options['nid']}/course-object/nojs/{$uniqid}/restore";
    $text = t('Object will be removed from outline');
    $restore_text = t('Restore this object to the course outline.');
    if ($options['delete_instance']) {
      $text = t('Object will be removed from outline, and related instance(s) will be deleted');
      $restore_text = t('Restore this object and related instance(s) to the course outline.');
    }
    $restore = ctools_ajax_text_button(t('Restore'), $dest, $restore_text);
    $summary['delete'] = '<span class="error">' . $text . '</span>' . ' ' . $restore;
  }
  return $summary;
}