add_system_message(_("At least one of the parameters is empty."), 'error'); if ($folder && $folder != 0) { forward("course/resources/{$course}/folder/{$folder}/resource/add"); } else { forward("course/resources/{$course}/resource/add"); } } else if (empty($course)) { $Dippler->add_system_message(_("Course not found"), 'error'); if ($folder && $folder != 0) { forward("course/resources/{$course}/folder/{$folder}/resource/add"); } else { forward("course/resources/{$course}/resource/add"); } } else { $lre = new LearningResource(); $lre->url = $url; $lre->title = $title; $lre->author = $author; $lre->description = $description; if (strtotime($published)) { $published = strtotime($published); } else { $published = null; } $lre->published = $published; $lre->tags = $tags; $lre->folder = $folder; $lre->course = $course; $lre->subtype = $subtype; if (isset($tags)) { $lre->tags = explode(",", $tags); } foreach ($categories as $cat_id) { $lre->categories[$cat_id] = new Category($cat_id); } $lre_id = $lre->create(); if (!$lre_id) { $Dippler->add_system_message(_("Resource could not be created."), 'error'); if ($folder && $folder != 0) { forward("course/resources/{$course}/folder/{$folder}/resource/add"); } else { forward("course/resources/{$course}/resource/add"); } } $Dippler->add_system_message(_("Resource added.")); // Clear cache $Dippler->clearSessionInputValues(); forward($lre->getURL()); } forward('courses/my'); ?>