You are here

function course_object_restore in Course 6

Same name and namespace in other branches
  1. 7.2 course.module \course_object_restore()
  2. 7 course.module \course_object_restore()

Callback to restore a course object temporarily removed from outline overview form.

1 string reference to 'course_object_restore'
course_menu in ./course.module
Implements hook_menu().

File

./course.module, line 413
course.module Core functionality for Courses.

Code

function course_object_restore($node, $js, CourseObject $courseObject) {
  $course = course_get_course($node);
  $courseObject
    ->setCourse($course);
  $uniqid = $courseObject
    ->getId();
  $nid = $node->nid;

  // Set the session value.
  $_SESSION['course'][$nid]['editing'][$uniqid]['delete'] = 0;
  $_SESSION['course'][$nid]['editing'][$uniqid]['delete_instance'] = 0;
  if ($js) {
    ctools_include('ajax');

    // Perform ajax operations on the overview form, after restore.
    $commands = array();

    // Reset summary.
    // @todo reload just this row. How?

    //$commands[] = ctools_ajax_command_replace("#row-{$uniqid}", $html);
    $commands[] = ctools_ajax_command_reload();
    ctools_ajax_render($commands);
  }
  else {
    drupal_goto("node/{$nid}/course-outline");
  }
}