public function CourseObject::getOptionsSummary in Course 7.2
Same name and namespace in other branches
- 6 includes/course_object.core.inc \CourseObject::getOptionsSummary()
- 7 includes/CourseObject.inc \CourseObject::getOptionsSummary()
Get core options summary.
Return value
array An associative array of summary keys and values.
Overrides CourseHandler::getOptionsSummary
2 calls to CourseObject::getOptionsSummary()
- CourseObject::renderOptionsSummary in includes/
CourseObject.inc - Get all course object implementations of getOptionsSummary().
- CourseObjectNode::getOptionsSummary in includes/
CourseObjectNode.inc - Get core options summary.
1 method overrides CourseObject::getOptionsSummary()
- CourseObjectNode::getOptionsSummary in includes/
CourseObjectNode.inc - Get core options summary.
File
- includes/
CourseObject.inc, line 460
Class
- CourseObject
- Parent abstract base class of all course objects.
Code
public function getOptionsSummary() {
$summary = parent::getOptionsSummary();
// Get options.
$options = $this
->getOptions();
// 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'] = t('Enabled');
}
else {
$summary['enabled'] = '<span class="warning">' . t('Not enabled') . '</span>';
}
// Hidden.
if (!$options['hidden']) {
$summary['hidden'] = t('Visible in outline');
}
else {
$summary['hidden'] = '<span class="warning">' . t('Not visible in outline') . '</span>';
}
// Required.
if ($options['required']) {
$summary['required'] = t('Completion required');
if ($options['skippable']) {
$summary['skippable'] = '<span class="warning">' . t('Skippable') . '</span>';
}
}
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>';
}
// Instance view link.
$viewUrl = $this
->getViewUrl();
if (!empty($viewUrl)) {
$text = t('View instance');
$summary['instance_view'] = l($text, $viewUrl, array(
'external' => TRUE,
'query' => drupal_get_destination(),
));
}
// Required.
if (!empty($options['delete'])) {
$dest = "node/{$options['nid']}/course-object/nojs/{$this->getId()}/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;
}