本文整理汇总了PHP中UrlManager::delete_url_rel_course方法的典型用法代码示例。如果您正苦于以下问题:PHP UrlManager::delete_url_rel_course方法的具体用法?PHP UrlManager::delete_url_rel_course怎么用?PHP UrlManager::delete_url_rel_course使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UrlManager
的用法示例。
在下文中一共展示了UrlManager::delete_url_rel_course方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete_course
/**
* Delete a course
* This function deletes a whole course-area from the platform. When the
* given course is a virtual course, the database and directory will not be
* deleted.
* When the given course is a real course, also all virtual courses refering
* to the given course will be deleted.
* Considering the fact that we remove all traces of the course in the main
* database, it makes sense to remove all tracking as well (if stats databases exist)
* so that a new course created with this code would not use the remains of an older
* course.
*
* @param string The code of the course to delete
* @todo When deleting a virtual course: unsubscribe users from that virtual
* course from the groups in the real course if they are not subscribed in
* that real course.
* @todo Remove globals
*/
public static function delete_course($code)
{
$table_course = Database::get_main_table(TABLE_MAIN_COURSE);
$table_course_user = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$table_session_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
$table_session_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
$table_course_survey = Database::get_main_table(TABLE_MAIN_SHARED_SURVEY);
$table_course_survey_question = Database::get_main_table(TABLE_MAIN_SHARED_SURVEY_QUESTION);
$table_course_survey_question_option = Database::get_main_table(TABLE_MAIN_SHARED_SURVEY_QUESTION_OPTION);
$table_course_rel_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
$table_stats_hotpots = Database::get_main_table(TABLE_STATISTIC_TRACK_E_HOTPOTATOES);
$table_stats_attempt = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
$table_stats_exercises = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES);
$table_stats_access = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ACCESS);
$table_stats_lastaccess = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LASTACCESS);
$table_stats_course_access = Database::get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
$table_stats_online = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ONLINE);
$table_stats_default = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DEFAULT);
$table_stats_downloads = Database::get_main_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS);
$table_stats_links = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LINKS);
$table_stats_uploads = Database::get_main_table(TABLE_STATISTIC_TRACK_E_UPLOADS);
$codeFiltered = Database::escape_string($code);
$sql = "SELECT * FROM {$table_course} WHERE code='" . $codeFiltered . "'";
$res = Database::query($sql);
if (Database::num_rows($res) == 0) {
return;
}
$sql = "SELECT * FROM {$table_course}\n WHERE code = '" . $codeFiltered . "'";
$res = Database::query($sql);
$course = Database::fetch_array($res);
$courseId = $course['id'];
$count = 0;
if (api_is_multiple_url_enabled()) {
$url_id = 1;
if (api_get_current_access_url_id() != -1) {
$url_id = api_get_current_access_url_id();
}
UrlManager::delete_url_rel_course($courseId, $url_id);
$count = UrlManager::getCountUrlRelCourse($courseId);
}
if ($count == 0) {
self::create_database_dump($code);
$course_tables = AddCourse::get_course_tables();
// Cleaning c_x tables
if (!empty($courseId)) {
foreach ($course_tables as $table) {
$table = Database::get_course_table($table);
$sql = "DELETE FROM {$table} WHERE c_id = {$courseId} ";
Database::query($sql);
}
}
$course_dir = api_get_path(SYS_COURSE_PATH) . $course['directory'];
$archive_dir = api_get_path(SYS_ARCHIVE_PATH) . $course['directory'] . '_' . time();
if (is_dir($course_dir)) {
rename($course_dir, $archive_dir);
}
// Unsubscribe all users from the course
$sql = "DELETE FROM {$table_course_user} WHERE c_id='" . $courseId . "'";
Database::query($sql);
// Delete the course from the sessions tables
$sql = "DELETE FROM {$table_session_course} WHERE c_id='" . $courseId . "'";
Database::query($sql);
$sql = "DELETE FROM {$table_session_course_user} WHERE c_id='" . $courseId . "'";
Database::query($sql);
// Delete from Course - URL
$sql = "DELETE FROM {$table_course_rel_url} WHERE c_id = '" . $courseId . "'";
Database::query($sql);
$sql = 'SELECT survey_id FROM ' . $table_course_survey . ' WHERE course_code="' . $codeFiltered . '"';
$result_surveys = Database::query($sql);
while ($surveys = Database::fetch_array($result_surveys)) {
$survey_id = $surveys[0];
$sql = 'DELETE FROM ' . $table_course_survey_question . ' WHERE survey_id="' . $survey_id . '"';
Database::query($sql);
$sql = 'DELETE FROM ' . $table_course_survey_question_option . ' WHERE survey_id="' . $survey_id . '"';
Database::query($sql);
$sql = 'DELETE FROM ' . $table_course_survey . ' WHERE survey_id="' . $survey_id . '"';
Database::query($sql);
}
// Cleaning group categories
$groupCategories = GroupManager::get_categories($course['code']);
if (!empty($groupCategories)) {
foreach ($groupCategories as $category) {
//.........这里部分代码省略.........
示例2: WSRemoveCourseFromPortal
function WSRemoveCourseFromPortal($params)
{
if (!WSHelperVerifyKey($params['secret_key'])) {
return return_error(WS_ERROR_SECRET_KEY);
}
$courseInfo = CourseManager::getCourseInfoFromOriginalId($params['original_course_id_value'], $params['original_course_id_name']);
$courseId = $courseInfo['real_id'];
$portalId = $params['portal_id'];
UrlManager::delete_url_rel_course($courseId, $portalId);
$result = UrlManager::relation_url_course_exist($courseId, $portalId);
if (empty($result)) {
return true;
}
return false;
}
示例3: delete_course
//.........这里部分代码省略.........
rename($course_dir, $archive_dir);
}
}
// Unsubscribe all classes from the course
/*$sql = "DELETE FROM $table_course_class WHERE course_code='".$code."'";
Database::query($sql);*/
// Unsubscribe all users from the course
$sql = "DELETE FROM {$table_course_user} WHERE c_id ='" . $courseId . "'";
Database::query($sql);
// Delete the course from the sessions tables
$sql = "DELETE FROM {$table_session_course} WHERE c_id='" . $courseId . "'";
Database::query($sql);
$sql = "DELETE FROM {$table_session_course_user} WHERE c_id='" . $courseId . "'";
Database::query($sql);
// Delete from Course - URL
$sql = "DELETE FROM {$table_course_rel_url} WHERE c_id = '" . $courseId . "'";
Database::query($sql);
$sql = 'SELECT survey_id FROM ' . $table_course_survey . ' WHERE course_code="' . $code . '"';
$result_surveys = Database::query($sql);
while ($surveys = Database::fetch_array($result_surveys)) {
$survey_id = $surveys[0];
$sql = 'DELETE FROM ' . $table_course_survey_question . ' WHERE survey_id="' . $survey_id . '"';
Database::query($sql);
$sql = 'DELETE FROM ' . $table_course_survey_question_option . ' WHERE survey_id="' . $survey_id . '"';
Database::query($sql);
$sql = 'DELETE FROM ' . $table_course_survey . ' WHERE survey_id="' . $survey_id . '"';
Database::query($sql);
}
// Delete the course from the stats tables
$sql = "DELETE FROM {$table_stats_hotpots} WHERE c_id = '" . $courseId . "'";
Database::query($sql);
$sql = "DELETE FROM {$table_stats_attempt} WHERE c_id = '" . $courseId . "'";
Database::query($sql);
$sql = "DELETE FROM {$table_stats_exercises} WHERE c_id = '" . $courseId . "'";
Database::query($sql);
$sql = "DELETE FROM {$table_stats_access} WHERE c_id = '" . $courseId . "'";
Database::query($sql);
$sql = "DELETE FROM {$table_stats_lastaccess} WHERE c_id = '" . $courseId . "'";
Database::query($sql);
$sql = "DELETE FROM {$table_stats_course_access} WHERE c_id = '" . $courseId . "'";
Database::query($sql);
$sql = "DELETE FROM {$table_stats_online} WHERE course = '" . $code . "'";
Database::query($sql);
$sql = "DELETE FROM {$table_stats_default} WHERE default_cours_code = '" . $code . "'";
Database::query($sql);
$sql = "DELETE FROM {$table_stats_downloads} WHERE c_id = '" . $courseId . "'";
Database::query($sql);
$sql = "DELETE FROM {$table_stats_links} WHERE c_id = '" . $courseId . "'";
Database::query($sql);
$sql = "DELETE FROM {$table_stats_uploads} WHERE upload_cours_id = '" . $code . "'";
Database::query($sql);
if (api_is_multiple_url_enabled()) {
$url_id = 1;
if (api_get_current_access_url_id() != -1) {
$url_id = api_get_current_access_url_id();
}
UrlManager::delete_url_rel_course($courseId, $url_id);
}
// delete extra course fields
$t_cf = Database::get_main_table(TABLE_MAIN_COURSE_FIELD);
$t_cfv = Database::get_main_table(TABLE_MAIN_COURSE_FIELD_VALUES);
$sql = "SELECT distinct field_id FROM {$t_cfv} WHERE course_code = '{$code}'";
$res_field_ids = Database::query($sql);
$field_ids = array();
while ($row_field_id = Database::fetch_row($res_field_ids)) {
$field_ids[] = $row_field_id[0];
}
// Delete from table_course_field_value from a given course_code
$sql_course_field_value = "DELETE FROM {$t_cfv} WHERE course_code = '{$code}'";
Database::query($sql_course_field_value);
$sql = "SELECT distinct field_id FROM {$t_cfv}";
$res_field_all_ids = Database::query($sql);
$field_all_ids = array();
while ($row_field_all_id = Database::fetch_row($res_field_all_ids)) {
$field_all_ids[] = $row_field_all_id[0];
}
if (isset($field_ids) && is_array($field_ids) && count($field_ids) > 0) {
foreach ($field_ids as $field_id) {
// check if field id is used into table field value
if (!empty($field_all_ids) && is_array($field_all_ids)) {
if (in_array($field_id, $field_all_ids)) {
continue;
} else {
$sql_course_field = "DELETE FROM {$t_cf} WHERE id = '{$field_id}'";
Database::query($sql_course_field);
}
}
}
}
// Delete the course from the database
/*$sql = "DELETE FROM $table_course WHERE id = '".$courseId."'";
Database::query($sql);*/
$em = self::getEntityManager();
$course = $em->getRepository('ChamiloCoreBundle:Course')->find($courseId);
$em->remove($course);
$em->flush();
// Add event to system log
$user_id = api_get_user_id();
Event::addEvent(LOG_COURSE_DELETE, LOG_COURSE_CODE, $code, api_get_utc_datetime(), $user_id, $code);
}
示例4: update_urls_rel_course
/**
* Updates the access_url_rel_course table with a given user list
* @author Julio Montoya
* @param array $course_list
* @param int access_url_id
* */
public static function update_urls_rel_course($course_list, $access_url_id)
{
$table_url_rel_course = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
$sql = "SELECT c_id FROM {$table_url_rel_course}\n WHERE access_url_id = " . intval($access_url_id);
$result = Database::query($sql);
$existing_courses = array();
while ($row = Database::fetch_array($result)) {
$existing_courses[] = $row['c_id'];
}
// Adding courses
foreach ($course_list as $course_code) {
if (!in_array($course_code, $courseId)) {
UrlManager::add_course_to_url($courseId, $access_url_id);
CourseManager::update_course_ranking($courseId, 0, $access_url_id);
}
}
// Deleting old courses
foreach ($existing_courses as $courseId) {
if (!in_array($courseId, $course_list)) {
UrlManager::delete_url_rel_course($courseId, $access_url_id);
CourseManager::update_course_ranking($courseId, 0, $access_url_id);
}
}
}
示例5: delete_course
/**
* Delete a course
* This function deletes a whole course-area from the platform. When the
* given course is a virtual course, the database and directory will not be
* deleted.
* When the given course is a real course, also all virtual courses refering
* to the given course will be deleted.
* Considering the fact that we remove all traces of the course in the main
* database, it makes sense to remove all tracking as well (if stats databases exist)
* so that a new course created with this code would not use the remains of an older
* course.
*
* @param string The code of the course to delete
* @todo When deleting a virtual course: unsubscribe users from that virtual
* course from the groups in the real course if they are not subscribed in
* that real course.
* @todo Remove globals
*/
public static function delete_course($code)
{
$table_course = Database::get_main_table(TABLE_MAIN_COURSE);
$table_course_user = Database::get_main_table(TABLE_MAIN_COURSE_USER);
//$table_course_class = Database::get_main_table(TABLE_MAIN_COURSE_CLASS);
$table_session_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
$table_session_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
$table_course_survey = Database::get_main_table(TABLE_MAIN_SHARED_SURVEY);
$table_course_survey_question = Database::get_main_table(TABLE_MAIN_SHARED_SURVEY_QUESTION);
$table_course_survey_question_option = Database::get_main_table(TABLE_MAIN_SHARED_SURVEY_QUESTION_OPTION);
$table_course_rel_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
$table_stats_hotpots = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_HOTPOTATOES);
$table_stats_attempt = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
$table_stats_exercises = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
$table_stats_access = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ACCESS);
$table_stats_lastaccess = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_LASTACCESS);
$table_stats_course_access = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
$table_stats_online = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ONLINE);
$table_stats_default = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_DEFAULT);
$table_stats_downloads = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_DOWNLOADS);
$table_stats_links = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_LINKS);
$table_stats_uploads = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_UPLOADS);
$codeFiltered = Database::escape_string($code);
$sql = "SELECT * FROM {$table_course} WHERE code='" . $codeFiltered . "'";
$res = Database::query($sql);
if (Database::num_rows($res) == 0) {
return;
}
$count = 0;
if (api_is_multiple_url_enabled()) {
require_once api_get_path(LIBRARY_PATH) . 'urlmanager.lib.php';
$url_id = 1;
if (api_get_current_access_url_id() != -1) {
$url_id = api_get_current_access_url_id();
}
UrlManager::delete_url_rel_course($code, $url_id);
$count = UrlManager::getcountUrlRelCourse($code);
}
if ($count == 0) {
self::create_database_dump($code);
if (!self::is_virtual_course_from_system_code($code)) {
// If this is not a virtual course, look for virtual courses that depend on this one, if any
$virtual_courses = self::get_virtual_courses_linked_to_real_course($code);
foreach ($virtual_courses as $index => $virtual_course) {
// Unsubscribe all classes from the virtual course
/*$sql = "DELETE FROM $table_course_class WHERE course_code='".$virtual_course['code']."'";
Database::query($sql);*/
// Unsubscribe all users from the virtual course
$sql = "DELETE FROM {$table_course_user} WHERE course_code='" . $virtual_course['code'] . "'";
Database::query($sql);
// Delete the course from the sessions tables
$sql = "DELETE FROM {$table_session_course} WHERE course_code='" . $virtual_course['code'] . "'";
Database::query($sql);
$sql = "DELETE FROM {$table_session_course_user} WHERE course_code='" . $virtual_course['code'] . "'";
Database::query($sql);
// Delete the course from the survey tables
$sql = "DELETE FROM {$table_course_survey} WHERE course_code='" . $virtual_course['code'] . "'";
Database::query($sql);
/*$sql = "DELETE FROM $table_course_survey_user WHERE db_name='".$virtual_course['db_name']."'";
Database::query($sql);
$sql = "DELETE FROM $table_course_survey_reminder WHERE db_name='".$virtual_course['db_name']."'";
Database::query($sql);*/
// Delete the course from the stats tables
$sql = "DELETE FROM {$table_stats_hotpots} WHERE exe_cours_id = '" . $virtual_course['code'] . "'";
Database::query($sql);
$sql = "DELETE FROM {$table_stats_attempt} WHERE course_code = '" . $virtual_course['code'] . "'";
Database::query($sql);
$sql = "DELETE FROM {$table_stats_exercises} WHERE exe_cours_id = '" . $virtual_course['code'] . "'";
Database::query($sql);
$sql = "DELETE FROM {$table_stats_access} WHERE access_cours_code = '" . $virtual_course['code'] . "'";
Database::query($sql);
$sql = "DELETE FROM {$table_stats_lastaccess} WHERE access_cours_code = '" . $virtual_course['code'] . "'";
Database::query($sql);
$sql = "DELETE FROM {$table_stats_course_access} WHERE course_code = '" . $virtual_course['code'] . "'";
Database::query($sql);
$sql = "DELETE FROM {$table_stats_online} WHERE course = '" . $virtual_course['code'] . "'";
Database::query($sql);
$sql = "DELETE FROM {$table_stats_default} WHERE default_cours_code = '" . $virtual_course['code'] . "'";
Database::query($sql);
$sql = "DELETE FROM {$table_stats_downloads} WHERE down_cours_id = '" . $virtual_course['code'] . "'";
Database::query($sql);
$sql = "DELETE FROM {$table_stats_links} WHERE links_cours_id = '" . $virtual_course['code'] . "'";
//.........这里部分代码省略.........