📄 add_course.lib.inc.php
字号:
<?php //$id: $/* ============================================================================== Dokeos - elearning and course management software Copyright (c) 2004-2008 Dokeos SPRL Copyright (c) various contributors For a full list of contributors, see "credits.txt". The full license can be read in "license.txt". This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. See the GNU General Public License for more details. Contact address: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium info@dokeos.com==============================================================================*//**==============================================================================* This is the course creation library for Dokeos.* It contains functions to create a course.* Include/require it in your code to use its functionality.** @package dokeos.library* @todo clean up horrible structure, script is unwieldy, for example easier way to deal with* different tool visibility settings: ALL_TOOLS_INVISIBLE, ALL_TOOLS_VISIBLE, CORE_TOOLS_VISIBLE...==============================================================================*/include_once (api_get_path(LIBRARY_PATH).'database.lib.php');/*============================================================================== FUNCTIONS==============================================================================*//*** Not tested yet.* We need this new function so not every script that creates courses needs* to be changed when the behaviour necessary to create a course changes.* This will reduce bugs.* @param string Course code requested (might be altered to match possible values)* @param string Course title* @param string Tutor name* @param integer Course category code* @param string Course language* @param integer Course admin ID* @param string DB prefix* @param integer Expiration delay in unix timestamp* @return true if the course creation was succesful, false otherwise.*/function create_course($wanted_code, $title, $tutor_name, $category_code, $course_language, $course_admin_id, $db_prefix, $firstExpirationDelay){ $keys = define_course_keys($wanted_code, "", $db_prefix); if(sizeof($keys)) { $visual_code = $keys["currentCourseCode"]; $code = $keys["currentCourseId"]; $db_name = $keys["currentCourseDbName"]; $directory = $keys["currentCourseRepository"]; $expiration_date = time() + $firstExpirationDelay; prepare_course_repository($directory, $code); update_Db_course($db_name); fill_course_repository($directory); fill_Db_course($db_name, $directory, $course_language); add_course_role_right_location_values($code); register_course($code, $visual_code, $directory, $db_name, $tutor_name, $category_code, $title, $course_language, $course_admin_id, $expiration_date); return true; } else return false;}function generate_course_code($course_title){ //$wantedCode = strtr($course_title, "锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -