function theme_course_outline_overview_form in Course 7
Same name and namespace in other branches
- 6 includes/course.outline.inc \theme_course_outline_overview_form()
- 7.2 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 281 - course_outline.inc
Code
function theme_course_outline_overview_form(&$variables) {
$form =& $variables['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'] = array(
'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'];
// @kludge 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'] = array(
'deleted',
);
}
// Mark everything else as printed.
drupal_render($objects[$key]);
}
$table = theme('table', array(
'header' => array(),
'rows' => $rows,
'attributes' => array(
'id' => 'course-objects',
),
));
$table .= drupal_render_children($form);
return $table;
}