36 $this->errorText=array();
37 $this->coursefiles=array();
45 $suffixes=array_merge($this->requiredFiles,$this->optionalFiles);
48 foreach($suffixes as $suffix) {
49 if (strcasecmp(substr($file, -(strlen($suffix)+1)),
".".$suffix)==0)
50 $this->coursefiles[$suffix] =
$file;
55 $missingFiles = array_diff ($this->requiredFiles, array_keys($this->coursefiles));
56 if (count($missingFiles)==4)
57 $this->errorText[]=
"Missing all required files.<br>You want to check if your learning module is of a different type.";
58 else if (count($missingFiles)>0)
59 $this->errorText[]=
"Missing required file(s): ".implode(
"<bR>", $missingFiles);
65 foreach ($this->coursefiles as $suffix=>
$filename) {
77 foreach ($this->data[
"des"] as
$row) {
78 if (strcasecmp ($row[
"system_id"],$system_id)==0)
90 $requiredKeys=array(
"system_id",
"type",
"command_line",
"file_name",
91 "max_score",
"mastery_score",
"max_time_allowed",
92 "time_limit_action",
"system_vendor",
"core_vendor",
93 "web_launch",
"au_password");
98 $requiredKeys=array(
"system_id",
"title",
"description",
"developer_id");
103 $requiredKeys=array(
"course_creator",
"course_id",
"course_system",
"course_title",
104 "level",
"max_fields_cst",
"total_aus",
"total_blocks",
"version");
105 $this->
checkCourseFile(
"crs", $this->data[
"crs"], $requiredKeys,
"course");
106 $requiredKeys=array(
"max_normal");
107 $this->
checkCourseFile(
"crs", $this->data[
"crs"], $requiredKeys,
"course_behavior");
110 $requiredKeys=array(
"block",
"member");
119 if (count(
$data)>0 && is_array(
$data[$group])) {
121 $keys=array_keys(
$data[$group]);
123 $missingKeys = array_diff ($requiredKeys, $keys);
124 $optionalKeys = array_diff ($keys, $requiredKeys);
126 if (count($missingKeys)>0)
127 $this->errorText[]=
"missing keys in ".strtoupper($fileSuffix).
"-File: ".implode(
",", $missingKeys);
129 }
else if (count(
$data)>0 && !is_array(
$data[$group])) {
130 $this->errorText[]=
"missing Group in ".strtoupper($fileSuffix).
"-File: $group";
132 $this->errorText[]=
"empty ".strtoupper($fileSuffix).
"-File";
138 if (count(
$data)>0) {
140 for ($colnr=0;$colnr<count(
$data);$colnr++) {
142 $colcount=count(
$data[$colnr]);
143 else if ($colcount!=count(
$data[$colnr]))
144 $this->errorText[]=strtoupper($fileSuffix).
"-File: unexpected number of columns in line ".($colnr+2);
152 $max=$this->data[crs][course][max_fields_cst];
154 $value=$this->data[cst][
$row][member];
155 if ((is_array($value) && count($value)>$max) || (!is_array($value) && $max==1)) {
156 $this->errorText[]=
"CRS-File: max_fields_cst does not match number of fields in the CST-File";
174 for($i=0;$i<count($lines);$i++) {
175 if (trim($lines[$i])==
"[Course_Description]") {
176 for ($i++;$i<count($lines);$i++) {
177 if (strlen(trim($lines[$i]))>0) {
178 $data[
"Course_Description"][description]=$lines[$i];
191 while ((
$data = fgetcsv($handle, 1000,
",")) !== FALSE) {
194 }
else if (count(
$data)>1) {
196 for ($col=0; $col<count(
$data); $col++) {
197 if (array_key_exists($header[$col], $data2)) {
198 $value=$data2[$header[$col]];
199 if (!is_array($value))
200 $data2[$header[$col]]=array($value, utf8_encode(
$data[$col]));
202 $data2[$header[$col]][]=utf8_encode(
$data[$col]);
204 $data2[$header[$col]]=utf8_encode(
$data[$col]);
214 if (substr(
$dir, -1)!=
"/")
217 $handle=opendir(
$dir);
218 while (
$file = readdir ($handle)) {
220 if (is_dir(
$dir.$file))
231 $arr=array_change_key_case($arr, CASE_LOWER);
232 foreach ($arr as $k=>$v) {
240 include_once(
"./Modules/ScormAicc/classes/AICC/class.ilAICCTree.php");
241 include_once(
"./Modules/ScormAicc/classes/AICC/class.ilAICCCourse.php");
242 include_once(
"./Modules/ScormAicc/classes/AICC/class.ilAICCUnit.php");
243 include_once(
"./Modules/ScormAicc/classes/AICC/class.ilAICCBlock.php");
247 $course->setALMId($alm_id);
248 $course->setSystemId(
"root");
249 $course->setTitle($this->data[
"crs"][
"course"][
"course_title"]);
250 $course->setDescription($this->data[
"crs"][
"course_description"][
"description"]);
252 $course->setCourseCreator($this->data[
"crs"][
"course"][
"course_creator"]);
253 $course->setCourseId($this->data[
"crs"][
"course"][
"course_id"]);
254 $course->setCourseSystem($this->data[
"crs"][
"course"][
"course_system"]);
255 $course->setCourseTitle($this->data[
"crs"][
"course"][
"course_title"]);
256 $course->setLevel($this->data[
"crs"][
"course"][
"level"]);
257 $course->setMaxFieldsCst($this->data[
"crs"][
"course"][
"max_fields_cst"]);
258 $course->setMaxFieldsOrt($this->data[
"crs"][
"course"][
"max_fields_ort"]);
259 $course->setTotalAUs($this->data[
"crs"][
"course"][
"total_aus"]);
260 $course->setTotalBlocks($this->data[
"crs"][
"course"][
"total_blocks"]);
261 $course->setTotalComplexObj($this->data[
"crs"][
"course"][
"total_complex_obj"]);
262 $course->setTotalObjectives($this->data[
"crs"][
"course"][
"total_objectives"]);
263 $course->setVersion($this->data[
"crs"][
"course"][
"version"]);
264 $course->setMaxNormal($this->data[
"crs"][
"course_behavior"][
"max_normal"]);
265 $course->setDescription($this->data[
"crs"][
"course_description"][
"description"]);
267 $identifier[
"root"]=$course->getId();
270 foreach ($this->data[
"cst"] as
$row) {
271 $system_id=strtolower($row[
"block"]);
272 if ($system_id!=
"root") {
275 $unit->setALMId($alm_id);
276 $unit->setType(
"sbl");
277 $unit->setTitle($description[
"title"]);
278 $unit->setDescription($description[
"description"]);
279 $unit->setDeveloperId($description[
"developer_id"]);
280 $unit->setSystemId($description[
"system_id"]);
282 $identifier[$system_id]=$unit->getId();
287 foreach ($this->data[
"au"] as $row) {
288 $sysid=strtolower($row[
"system_id"]);
291 $unit->setAUType($row[
"c_type"]);
292 $unit->setCommand_line($row[
"command_line"]);
293 $unit->setMaxTimeAllowed($row[
"max_time_allowed"]);
294 $unit->setTimeLimitAction($row[
"time_limit_action"]);
295 $unit->setMaxScore($row[
"max_score"]);
296 $unit->setCoreVendor($row[
"core_vendor"]);
297 $unit->setSystemVendor($row[
"system_vendor"]);
298 $unit->setFilename($row[
"file_name"]);
299 $unit->setMasteryScore($row[
"mastery_score"]);
300 $unit->setWebLaunch($row[
"web_launch"]);
301 $unit->setAUPassword($row[
"au_password"]);
304 $unit->setALMId($alm_id);
305 $unit->setType(
"sau");
306 $unit->setTitle($description[
"title"]);
307 $unit->setDescription($description[
"description"]);
308 $unit->setDeveloperId($description[
"developer_id"]);
309 $unit->setSystemId($description[
"system_id"]);
311 $identifier[$sysid]=$unit->getId();
316 $tree->addTree($alm_id, $identifier[
"root"]);
319 foreach ($this->data[
"cst"] as $row) {
320 $members=$row[
"member"];
321 if (!is_array($members))
322 $members=array($members);
323 $parentid=$identifier[strtolower($row[
"block"])];
325 foreach($members as $member) {
326 $memberid=$identifier[strtolower($member)];
327 $tree->insertNode($memberid, $parentid);