本文整理汇总了PHP中CourseManager::delete_course方法的典型用法代码示例。如果您正苦于以下问题:PHP CourseManager::delete_course方法的具体用法?PHP CourseManager::delete_course怎么用?PHP CourseManager::delete_course使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CourseManager
的用法示例。
在下文中一共展示了CourseManager::delete_course方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: deleteCourseHelper
/**
* Deletes a course (helper method)
*
* @param string Course id field name
* @param string Course id value
* @return mixed True if the course was successfully deleted, WSError otherwise
*/
protected function deleteCourseHelper($course_id_field_name, $course_id_value) {
$course_id = $this->getCourseId($course_id_field_name, $course_id_value);
if($course_id instanceof WSError) {
return $course_id;
} else {
$course_code = CourseManager::get_course_code_from_course_id($course_id);
CourseManager::delete_course($course_code);
return true;
}
}
示例2: array
// Language files that need to be included
$language_file = array('admin', 'course_info');
require_once api_get_path(SYS_CODE_PATH) . 'gradebook/lib/be/gradebookitem.class.php';
require_once api_get_path(SYS_CODE_PATH) . 'gradebook/lib/be/category.class.php';
$this_section = SECTION_COURSES;
$current_course_tool = TOOL_COURSE_MAINTENANCE;
api_protect_course_script(true);
$_course = api_get_course_info();
$current_course_code = $_course['official_code'];
$current_course_name = $_course['name'];
if (!api_is_allowed_to_edit()) {
api_not_allowed(true);
}
$tool_name = get_lang('DelCourse');
if (isset($_GET['delete']) && $_GET['delete'] == 'yes') {
CourseManager::delete_course($_course['sysCode']);
$obj_cat = new Category();
$obj_cat->update_category_delete($_course['sysCode']);
// DELETE CONFIRMATION MESSAGE
Session::erase('_cid');
Session::erase('_real_cid');
$noPHP_SELF = true;
$message = '<h2>' . get_lang('Course') . ' : ' . $current_course_name . ' (' . $current_course_code . ') </h2>';
$message .= get_lang('HasDel');
$message .= '<br /><br /><a href="../../index.php">' . get_lang('BackHome') . ' ' . api_get_setting('platform.site_name') . '</a>';
} else {
$message = '<h3>' . get_lang('Course') . ' : ' . $current_course_name . ' (' . $current_course_code . ') </h3>';
$message .= '<p>' . get_lang('ByDel') . '</p>';
$message .= '<p><a class="btn btn-primary" href="' . api_get_path(WEB_CODE_PATH) . 'course_info/maintenance.php?' . api_get_cidreq() . '">' . get_lang('No') . '</a> <a class="btn" href="' . api_get_self() . '?delete=yes&' . api_get_cidreq() . '">' . get_lang('Yes') . '</a></p>';
$interbreadcrumb[] = array('url' => 'maintenance.php', 'name' => get_lang('Maintenance'));
}
示例3: switch
if (isset($_GET['action'])) {
switch ($_GET['action']) {
case 'show_msg':
if (!empty($_GET['warn'])) {
$message = Display::return_message(urldecode($_GET['warn']), 'warning');
}
if (!empty($_GET['msg'])) {
$message = Display::return_message(urldecode($_GET['msg']));
}
break;
default:
break;
}
}
if (isset($_GET['delete_course'])) {
CourseManager::delete_course($_GET['delete_course']);
$obj_cat = new Category();
$obj_cat->update_category_delete($_GET['delete_course']);
}
// Create a search-box
$form = new FormValidator('search_simple', 'get', '', '', array('class' => 'form-search'), false);
$form->addElement('text', 'keyword', null);
$form->addElement('style_submit_button', 'submit', get_lang('SearchCourse'), 'class="btn"');
$form->addElement('static', 'search_advanced_link', null, '<a href="course_list.php?search=advanced">' . get_lang('AdvancedSearch') . '</a>');
// Create a filter by session
$sessionFilter = new FormValidator('course_filter', 'get', '', '', array('class' => 'form-search'), false);
$url = api_get_path(WEB_AJAX_PATH) . 'session.ajax.php?a=search_session';
$sessionList = array();
if (!empty($sessionId)) {
$sessionList = array();
$sessionInfo = SessionManager::fetch($sessionId);
示例4: transaction_6
static function transaction_6($data)
{
global $data_list;
$course_code = self::get_real_course_code($data['item_id']);
if (!empty($course_code)) {
$course_info_before = api_get_course_info($course_code, true);
CourseManager::delete_course($course_code);
$course_info = api_get_course_info($course_code, true);
$data_list['courses'][$data['item_id']] = null;
return array('entity' => 'course', 'before' => $course_info_before, 'after' => $course_info, 'message' => "Course was deleted {$course_code} ", 'status_id' => self::TRANSACTION_STATUS_SUCCESSFUL);
} else {
return array('message' => "Coursecode does not exists in DB {$course_code} ", 'status_id' => self::TRANSACTION_STATUS_FAILED);
}
}
示例5: delete_test_course
/**
* This function delete the test course from the database and destroy the sessions.
* @param string the course code than will be delete.
* @return void
*/
function delete_test_course($course_code = 'TESTCOURSE')
{
$res = CourseManager::delete_course($course_code);
$path = api_get_path(SYS_PATH) . 'archive';
if ($handle = opendir($path)) {
while (false !== ($file = readdir($handle))) {
if (strpos($file, $course_code) !== false) {
if (is_dir($path . '/' . $file)) {
api_rmdirr($path . '/' . $file);
}
}
}
closedir($handle);
}
// Check api session destroy
if (!headers_sent() && session_id() != "") {
$res = Session::destroy();
}
}