function theme_course_outline_overview_form in Course 6
Same name and namespace in other branches
- 7.2 includes/course.outline.inc \theme_course_outline_overview_form()
- 7 includes/course.outline.inc \theme_course_outline_overview_form()
Theme the course outline overview form as a table.
See also
course_outline_overview_form()
File
- includes/
course.outline.inc, line 283 - course_outline.inc
Code
function theme_course_outline_overview_form($form) {
$objects =& $form['course_outline']['objects'];
drupal_add_tabledrag('course-objects', 'order', 'sibling', 'course-object-weight');
drupal_add_css(drupal_get_path('module', 'course') . '/css/admin.css');
$rows = array();
foreach (element_children($objects) as $key) {
$object =& $objects[$key];
unset($objects[$key]['title']['#title']);
unset($objects[$key]['object_type']['#title']);
$rows[$key]['data'][] = array(
'data' => NULL,
'width' => 1,
);
$rows[$key]['data'][] = drupal_render($objects[$key]['title']) . drupal_render($objects[$key]['summary']);
$rows[$key]['data'][] = drupal_render($objects[$key]['object_type']) . drupal_render($objects[$key]['object_type_show']);
$rows[$key]['data'][] = drupal_render($objects[$key]['options']);
// Add draggable settings to row.
$rows[$key]['class'] = 'draggable';
$rows[$key]['data'][] = drupal_render($objects[$key]['weight']);
// Add id to row for per-row ajax handling.
$rows[$key]['id'] = "row-{$key}";
// Deletion handling.
$nid = $object['nid']['#value'];
// @todo should we unify this, so we always use $courseObject->getOptions()
// instead of pulling from the session?
if (!empty($_SESSION['course'][$nid]['editing'][$key]['delete'])) {
$rows[$key]['class'] = 'deleted';
}
// Mark everything else as printed.
drupal_render($objects[$key]);
}
$table = theme('table', array(), $rows, array(
'id' => 'course-objects',
));
$table .= drupal_render($form);
return $table;
}