// header('Location: index.php?id='.$ids); //} $coursesDAO = new CoursesDAO(); $userCoursesDAO = new UserCoursesDAO(); $courseCategoriesDAO = new CourseCategoriesDAO(); //$my_courses = array(); $search_text = trim($_GET['search_text']); $courses = $coursesDAO->getSearchResult($addslashes($search_text), $_GET['catid']); // handle submits if (isset($_GET['action'], $_GET['cid']) && $_SESSION['user_id'] > 0) { $cid = intval($_GET['cid']); if ($_GET['action'] == 'remove') { $userCoursesDAO->Delete($_SESSION['user_id'], $cid); } if ($_GET['action'] == 'add') { $userCoursesDAO->Create($_SESSION['user_id'], $cid, TR_USERROLE_VIEWER, 0); } $msg->addFeedback(ACTION_COMPLETED_SUCCESSFULLY); } // -- display results // no results found //if (!is_array($results)) //{ // $savant->assign('title', _AT("search_results")); // $savant->assign('search_text', $search_text); // $savant->assign('courses', ''); // $savant->display('home/index_course.tmpl.php'); // exit; //} // retrieve data to display //if ($_SESSION['user_id'] > 0) {
$access = 'private'; } else { $access = 'public'; } if (isset($course_primary_lang) && $course_primary_lang != '') { $langcode_and_charset = explode('-', $course_primary_lang); // $course_primary_lang = Utility::get3LetterLangCode($langcode_and_charset[0]); $course_primary_lang = $langcode_and_charset[0]; } else { $course_primary_lang = DEFAULT_LANGUAGE_CODE; } $_course_id = $coursesDAO->Create($_SESSION['user_id'], 'top', $access, $course_title, $course_description, '', '', '', '', $course_primary_lang, '', ''); check_available_size($_course_id); // insert author role into table "user_courses" $userCoursesDAO = new UserCoursesDAO(); $userCoursesDAO->Create($_SESSION['user_id'], $_course_id, TR_USERROLE_AUTHOR, 0); } else { $_course_id = $_POST['_course_id']; } // end of added by Cindy Li on Jan 10, 2010 /* generate a unique new package base path based on the package file name and date as needed. */ /* the package name will be the dir where the content for this package will be put, as a result */ /* the 'content_path' field in the content table will be set to this path. */ /* $package_base_name_url comes from the URL file name (NOT the file name of the actual file we open)*/ if (!$package_base_name && $package_base_name_url) { $package_base_name = substr($package_base_name_url, -6); } else { if (!$package_base_name) { $package_base_name = substr($_FILES['file']['name'], 0, -4); } }