commit
d3f01026df
@ -0,0 +1,23 @@ |
|||||||
|
<?php //$id$
|
||||||
|
/** |
||||||
|
* This script contains the data to fill (or empty) the database with using |
||||||
|
* the fillers in this directory. |
||||||
|
* @author Yannick Warnier <yannick.warnier@dokeos.com> |
||||||
|
* |
||||||
|
*/ |
||||||
|
/** |
||||||
|
* Initialisation section |
||||||
|
*/ |
||||||
|
global $_configuration; |
||||||
|
$courses = array(); |
||||||
|
$courses[] = array( |
||||||
|
'code' => 'ENGLISH101', |
||||||
|
'title' => 'English for beginners', |
||||||
|
'tutor' => '', |
||||||
|
'category' => 'PROJ', |
||||||
|
'language' => 'english', |
||||||
|
'admin_id' => 1, |
||||||
|
'db_prefix' => $_configuration['db_prefix'], |
||||||
|
'expires' => '2020-09-01 00:00:00', |
||||||
|
'fill' => true, |
||||||
|
); |
@ -0,0 +1,31 @@ |
|||||||
|
<?php //$id$
|
||||||
|
/** |
||||||
|
* This script contains a data filling procedure for users |
||||||
|
* @author Yannick Warnier <yannick.warnier@beeznest.com> |
||||||
|
* |
||||||
|
*/ |
||||||
|
/** |
||||||
|
* Initialisation section |
||||||
|
*/ |
||||||
|
//require_once '../../main/inc/global.inc.php'; |
||||||
|
require_once api_get_path(LIBRARY_PATH).'add_course.lib.inc.php'; |
||||||
|
/** |
||||||
|
* Loads the data and injects it into the Chamilo database, using the Chamilo |
||||||
|
* internal functions. |
||||||
|
* @return array List of user IDs for the users that have just been inserted |
||||||
|
*/ |
||||||
|
function fill_courses() { |
||||||
|
$eol = PHP_EOL; |
||||||
|
$courses = array(); //declare only to avoid parsing notice |
||||||
|
require_once 'data_courses.php'; //fill the $users array |
||||||
|
$output = array(); |
||||||
|
$output[] = array('title'=>'Courses Filling Report:'); |
||||||
|
$i = 1; |
||||||
|
foreach ($courses as $i => $course) { |
||||||
|
//first check that the first item doesn't exist already |
||||||
|
$output[$i]['line-init'] = $course['title']; |
||||||
|
$output[$i]['line-info'] = (create_course($course[)?$res:get_lang('NotInserted')); |
||||||
|
$i++; |
||||||
|
} |
||||||
|
return $output; |
||||||
|
} |
Loading…
Reference in new issue