add_system_message(_("At least one of the parameters is empty."), 'error'); forward("course/resources/{$course}/resource/{$id}/edit"); } else if (empty($course)) { $Dippler->add_system_message(_("Course not found"), 'error'); forward('courses/my'); } else if (empty($id)) { $Dippler->add_system_message(_("Resource not found"), 'error'); forward("course/resources/{$course}"); } else { $lre = new LearningResource($id); $lre->load(); $lre->title = $title; $lre->author = $author; $lre->description = $description; if (strtotime($published)) { $published = strtotime($published); } else { $published = null; } $lre->published = $published; if (isset($tags)) { $lre->tags = explode(",", $tags); } $lre->folder = $folder; $new_cats = array(); $data_categories = $Dippler->listCourseCategoriesFull($course); foreach ($categories as $cat_id) { $new_cats[$cat_id] = $data_categories[$cat_id]; } $lre->categories = $new_cats; if (!$lre->save()) { $Dippler->add_system_message(_("Resource could not be saved."), 'error'); forward("course/resources/{$course}/resource/{$id}/edit"); } $Dippler->add_system_message(_("Resource saved.")); // Clear cache $Dippler->clearSessionInputValues(); forward($lre->getURL()); } forward('courses/my'); ?>