ad3217144e995df98bc8d78e2906c4be34919154
[acontent.git] / docs / home / imscc / include / ims_template.inc.php
1 <?php
2 /************************************************************************/
3 /* AContent                                                             */
4 /************************************************************************/
5 /* Copyright (c) 2010                                                   */
6 /* Inclusive Design Institute                                           */
7 /*                                                                      */
8 /* This program is free software. You can redistribute it and/or        */
9 /* modify it under the terms of the GNU General Public License          */
10 /* as published by the Free Software Foundation.                        */
11 /************************************************************************/
12
13 if (!defined('TR_INCLUDE_PATH')) { exit; }
14
15 // This function gets files from html tag @import
16 function get_import_files($text)
17 {
18         $text = strtolower($text);
19         $tag = '@import';
20         $files = array();
21         
22         while (strpos(strtolower($text), strtolower($tag)) > 0)
23         {
24                 $start_pos      = strpos($text, $tag);
25                 if ($start_pos !== false) 
26                 {
27                         $text = substr($text, $start_pos);
28                         $start_pos = strlen($tag);
29                         $len = strpos($text, ';') - strlen($tag);
30                         
31                         $file = substr(trim($text), $start_pos, $len);
32                         
33                         // remove these characters from file name: url, (, ), ", '
34                         $file = trim(preg_replace('/(\'|\"|url|\(|\))/', '', $file));
35                         
36                         // strip processed tag
37                         $text = substr($text, $start_pos);
38                         array_push($files, $file);
39                 }
40         
41         }
42         
43         return $files;
44 }
45         
46 function print_organizations($parent_id,
47                                                          &$_menu, 
48                                                          $depth, 
49                                                          $path='',
50                                                          $children,
51                                                          &$string) {
52         
53         global $html_content_template, $default_html_style, $zipfile, $resources, $ims_template_xml, $parser, $my_files;
54         global $used_glossary_terms, $course_id, $course_language_charset, $course_language_code;
55         static $paths, $zipped_files;
56 //      global $glossary;
57         global $test_list, $test_zipped_files, $test_files, $test_xml_items, $use_a4a;
58         global $contentManager;
59         /* added by bologna*///TODO***********BOLOGNA**************REMOVE ME*****************/
60         global $db,$forum_list;//forum_list contiene tutti i forum distinti associati ai contenuti. poich� la funzione in questione � ricorsiva deve essere globale in modo che in fase di creazione dell'archivio zip i file descrittori dei forum non vengano ripetuti
61
62         require_once(TR_INCLUDE_PATH.'../home/classes/ContentUtility.class.php');
63         require_once(TR_INCLUDE_PATH.'classes/DAO/ContentForumsAssocDAO.class.php');
64         
65         $space  = '    ';
66         $prefix = '                    ';
67
68         if ($depth == 0) {
69                 $string .= '<ul>';
70         }
71         $top_level = $_menu[$parent_id];
72         if (!is_array($paths)) {
73                 $paths = array();
74         }
75         if (!is_array($zipped_files)) {
76                 $zipped_files = array();
77         }
78         if ( is_array($top_level) ) {
79                 
80                 $counter = 1;
81                 $num_items = count($top_level);
82                 
83                 foreach ($top_level as $garbage => $content) {
84                         $link = '';
85                         //XSL characters handling
86                         $content['title'] = str_replace('&', '&amp;', $content['title']);
87                                 
88                         if ($content['content_path'] && (substr($content['content_path'],-1)!='/')) {
89                                 $content['content_path'] .= '/';
90                         }
91
92                         /* 
93                          * generate weblinks 
94                          * Reason to put it here is cause we don't want the content to be overwrittened.
95                          */
96                         if ($content['content_type']==CONTENT_TYPE_WEBLINK){
97                                 $wl = new Weblinks($content['title'], $content['text']);
98                                 $wlexport = new WeblinksExport($wl);
99                                 $wl_xml = $wlexport->export();
100                                 $wl_filename = 'weblinks_'.$content['content_id'].'.xml';
101                                 $zipfile->add_file($wl_xml , 'Weblinks/'.$wl_filename, $content['u_ts']);
102                                 $resources .= str_replace(      array('{PATH}', '{CONTENT_ID}'), 
103                                                                                         array($wl_filename, $content['content_id']), 
104                                                                                         $ims_template_xml['resource_weblink']);
105                                 //Done.
106 //                              continue;
107                         }
108
109                         if ($content['content_type']==CONTENT_TYPE_FOLDER){
110                                 $link .= $prefix.'<item identifier="MANIFEST01_FOLDER'.$content['content_id'].'">'."\n";
111                                 $link .= $prefix.$space.'<title>'.$content['title'].'</title>'."\n";
112                         } else {
113                                 $link .= '<item identifier="MANIFEST01_ITEM'.$content['content_id'].'" identifierref="MANIFEST01_RESOURCE'.$content['content_id'].'">'."\n";
114                                 $link .= $prefix.$space.'<title>'.$content['title'].'</title>'."\n$prefix$space";
115                         }
116                         $html_link = '<a href="resources/'.$content['content_path'].$content['content_id'].'.html" target="body">'.$content['title'].'</a>';
117                         
118                         /* save the content as HTML files */
119                         /* @See: include/lib/format_content.inc.php */
120                         $content['text'] = str_replace('CONTENT_DIR/', '', $content['text']);
121                         /* Commented by Cindy Qi Li on Jan 12, 2010
122                          * AContent does not support glossary
123                         // get all the glossary terms used
124                         $terms = find_terms($content['text']);
125                         if (is_array($terms)) {
126                                 foreach ($terms[2] as $term) {
127                                         $used_glossary_terms[] = $term;
128                                 }
129                         }
130 */
131                         $f_count = count($forum_list); //count all distinct forum_id associated to a content page
132                                                 //la funzione è ricorsiva quindi lo devo ricavare attraverso la variabile globale forum_list
133
134                         $contentForumsAssocDAO = new ContentForumsAssocDAO();
135                         $forums = $contentForumsAssocDAO->getByContent($content[content_id]);
136 //                    $sql = "SELECT cf.forum_id, f.title, f.description FROM (SELECT * FROM ".TABLE_PREFIX."content_forums_assoc WHERE content_id=$content[content_id]) AS cf LEFT JOIN ".TABLE_PREFIX."forums f ON cf.forum_id=f.forum_id";
137 //                    $result_cf = mysql_query($sql,$db);
138    
139                         $find=false;
140                         $forums_dependency='';  //template for associate Discussion Topic to the current content into the manifest
141                         if (is_array($forums)) {
142                                 foreach($forums as $current_forum) {
143                                         for($j=0;$j<$f_count;$j++) {
144                                                 if($forum_list[$j]['id'] == $current_forum['forum_id']) $find= true;
145                                         }
146                                         if(!$find) {
147                                                 $forum_list[$f_count]['id']=$current_forum['forum_id'];
148                                                 $forum_list[$f_count]['title']=$current_forum['title'];
149                                                 $forum_list[$f_count]['description']=$current_forum['description'];
150                                                 $find=false;
151                                                 $f_count++;
152                                         }
153                                 }
154                                 $forums_dependency .= $prefix.$space.'<dependency identifierref="Forum'.$current_forum['forum_id'].'_R" />';
155             }
156
157                          /** Test dependency **/
158                         require_once(TR_INCLUDE_PATH.'classes/DAO/ContentTestsAssocDAO.class.php');
159                         $contentTestsAssocDAO = new ContentTestsAssocDAO();
160                         
161 //                      $sql = 'SELECT * FROM '.TABLE_PREFIX.'content_tests_assoc WHERE content_id='.$content['content_id'];
162 //                      $result = mysql_query($sql, $db);
163 //                      while ($row = mysql_fetch_assoc($result)){
164                         $rows = $contentTestsAssocDAO->getByContent($content['content_id']);
165                         if (is_array($rows)) {
166                                 //add test dependency on top of forum dependency
167                                 foreach ($rows as $row)
168                                         $forums_dependency .= $prefix.$space.'<dependency identifierref="MANIFEST01_RESOURCE_QTI'.$row['test_id'].'" />';
169                         }
170
171
172                         /* calculate how deep this page is: */
173                         $path = '../';
174                         if ($content['content_path']) {
175                                 $depth = substr_count($content['content_path'], '/');
176
177                                 $path .= str_repeat('../', $depth);
178                         }
179
180                         $content['text'] = ContentUtility::formatContent($content['text'], $content['formatting']);
181                         // add HTML header and footers to the files
182                         // use default style if <style> is not in imported html head
183                         $head = '';
184                         if ($content['use_customized_head'])
185                         {
186                                 if (strpos(strtolower($content['head']), '<style') > 0)
187                                 {
188                                         $head = $content['head'];
189                                 }
190                                 else
191                                 {
192                                         if (strlen($content['head']) > 0)  
193                                                 $head = $content['head'] . $default_html_style;
194                                         else 
195                                                 $head = $default_html_style;
196                                 }
197                         }
198
199                         $content['text'] = str_replace( array('{TITLE}',        '{CONTENT}', '{KEYWORDS}', '{COURSE_PRIMARY_LANGUAGE_CHARSET}', '{COURSE_PRIMARY_LANGUAGE_CODE}', '{HEAD}'),
200                                                                         array($content['title'],        $content['text'], $content['keywords'], $course_language_charset, $course_language_code, $head),
201                                                                         $html_content_template);
202                                                                 
203                         /* duplicate the paths in the content_path field in the zip file */
204                         if ($content['content_path']) {
205                                 if (!in_array($content['content_path'], $paths)) {
206                                         $zipfile->create_dir('resources/'.$content['content_path'], time());
207                                         $paths[] = $content['content_path'];
208                                 }
209                         }
210                         //add the file iff it's a content file
211                         if($content['content_type']==CONTENT_TYPE_CONTENT){
212                                 $zipfile->add_file($content['text'], 'resources/'.$content['content_path'].$content['content_id'].'.html', $content['u_ts']);
213                         }
214                         $content['title'] = htmlspecialchars($content['title']);
215
216                         /* add the resource dependancies */                     
217                         if ($my_files == null) $my_files = array();
218                         $content_files = "\n";
219                         $parser->parse($content['text']);
220
221                         /* generate the IMS QTI resource and files */
222                         //check if test export is allowed.
223                         $content_test_rs = $contentManager->getContentTestsAssoc($content['content_id']);       
224                         $test_ids = array();            //reset test ids
225                         //$my_files = array();          //reset myfiles.
226                         if (is_array($content_test_rs)) {
227                                 foreach ($content_test_rs as $content_test_row){
228                                         //export
229                                         $test_ids[] = $content_test_row['test_id'];
230                                         //the 'added_files' is for adding into the manifest file in this zip
231                                         $added_files = test_qti_export($content_test_row['test_id'], '', $zipfile);
232                                         foreach($added_files as $xml_file=>$chunk){
233                                                 foreach ($chunk as $xml_filename){
234                                                         $added_files_xml .= str_replace('{FILE}', 'resources/'.$xml_filename, $ims_template_xml['xml']);
235                                                 }
236                                         }
237                                         //Save all the xml files in this array, and then print_organizations will add it to the manifest file.
238                                         $resources .= str_replace(      array('{TEST_ID}', '{PATH}', '{FILES}'),
239                                                                                                 array($content_test_row['test_id'], 'tests_'.$content_test_row['test_id'].'.xml', $added_files_xml),
240                                                                                                 $ims_template_xml['resource_test']); 
241 /*      Taken out since we are gonna use dependency instead
242                                         $test_xml_items .= str_replace( array('{TEST_ID}'),
243                                                                                                 array($content_test_row['test_id']),
244                                                                                                 $ims_template_xml['test']); 
245 */
246                                         foreach($test_files as $filename=>$realfilepath){
247                                                 $zipfile->add_file(@file_get_contents($realfilepath), 'resources/'.$filename, filemtime($realfilepath));
248                                         }
249                                 }
250                         }
251
252                         /* generate the a4a files */
253                         $a4a_xml_array = array();
254                         if ($use_a4a == true){
255                                 $a4aExport = new A4aExport($content['content_id']);
256 //                              $a4aExport->setRelativePath('resources/'.$content['content_path']);
257                                 $secondary_files = $a4aExport->getAllSecondaryFiles();
258                                 $a4a_xml_array = $a4aExport->exportA4a();
259                                 $my_files = array_merge($my_files, $a4aExport->getAllSecondaryFiles());
260                         }
261
262                         /* handle @import */
263                         $import_files = get_import_files($content['text']);
264
265                         if (count($import_files) > 0) $my_files = array_merge($my_files, $import_files);
266
267                         foreach ($my_files as $file) {
268                                 /* filter out full urls */
269                                 $url_parts = @parse_url($file);
270 //                              if (isset($url_parts['scheme'])) {
271 //                                      continue;
272 //                              }
273
274                                 /* file should be relative to content. let's double check */
275                                 if ((substr($file, 0, 1) == '/')) {
276                                         continue;
277                                 }
278
279
280                                 if (substr($file, 0, 7) != 'http://' && substr($file, 0, 8) != 'https://') {
281                                         $file_path = realpath(TR_CONTENT_DIR . $course_id . '/' . $content['content_path'] . $file);
282         
283                                         /* check if the path contains TR_CONTENT_DIR in it, if not, skip it, it's trying to scan through 
284                                          * the file system */
285                                         if (strpos($file_path, TR_CONTENT_DIR)!==0){
286                                                 continue; //skip
287                                         }
288                      
289                                         /* check if this file exists in the content dir, if not don't include it */
290                                         if (file_exists($file_path) &&  is_file($file_path) && !in_array($file_path, $zipped_files)) {
291                                                 $zipped_files[] = $file_path;
292                                                 $dir = substr(dirname($file_path), strlen(TR_CONTENT_DIR . $course_id));
293         
294                                                 if (!in_array($dir, $paths) && $dir) {
295                                                         $dir = str_replace('\\', '/', substr($dir, 1));
296                                                         $zipfile->create_dir('resources/' . $dir, time());
297                                                         
298                                                         $paths[] = $dir;
299                                                 }
300         
301                                                 $file_info = stat( $file_path );
302         
303                                                 //remove relative path in the content_path.     
304                                                 $filepath_array = explode('/', 'resources/' . $content['content_path'] . $file);
305                                                 $new_filepath_array = array();
306                                                 if (in_array('..', $filepath_array)){
307                                                         while (!empty($filepath_array)){
308                                                                 $temp = array_shift($filepath_array);
309                                                                 if ($temp == '..'){
310                                                                         array_pop($new_filepath_array);
311                                                                 } else {
312                                                                         array_push($new_filepath_array, $temp);
313                                                                 }
314                                                         }
315                                                         $zip_path = implode('/', $new_filepath_array);
316                                                 } else {
317                                                         $zip_path = 'resources/' . $content['content_path'] . $file;
318                                                 }
319         
320                                                 $zipfile->add_file(@file_get_contents($file_path), $zip_path, $file_info['mtime']);
321                                         }
322                                 }
323                                 //a4a secondary files have mapping, save the ones that we want in order to add the tag in
324                                 $a4a_secondary_files = array();
325                                 foreach ($a4a_xml_array as $a4a_filename=>$a4a_filearray){
326                                         if (preg_match('/(.*)\sto\s(.*)/', $a4a_filename, $matches)){
327                                                 //save the actual file name
328                                                 $a4a_secondary_files[$matches[1]][] = $a4a_filename;    //values are holders
329                                         }
330                                 }
331
332                                 // If this file has a4a alternatives, link it.
333                                 if (isset($a4a_xml_array[$file]) || isset($a4a_secondary_files[$file])){
334                                         //if this is an array, meaning that it has more than 1 alternatives, print all
335                                         if (substr($file, 0, 7) == 'http://' || substr($file, 0, 8) == 'https://') {
336                                                 $name_in_file_meta = $file;
337                                         } else {
338                                                 $name_in_file_meta = 'resources/'.$content['content_path'] . $file;
339                                         }
340                                         if (is_array($a4a_secondary_files[$file])){
341                                                 $all_secondary_files_md = '';   //reinitialize string to null
342                                                 foreach ($a4a_secondary_files[$file] as $v){
343                                                         foreach($a4a_xml_array[$v] as $v2){
344                                                                 $all_secondary_files_md .= $v2; //all the meta data             
345                                                         }                                                               
346                                                 }
347                                                 $content_files .= str_replace(  array('{FILE}', '{FILE_META_DATA}'), 
348                                                 array($name_in_file_meta, $all_secondary_files_md), 
349                                                 $ims_template_xml['file_meta']);
350                                         } else {
351                                                 $content_files .= str_replace(  array('{FILE}', '{FILE_META_DATA}'), 
352                                                 array($name_in_file_meta, $a4a_xml_array[$file]), 
353                                                 $ims_template_xml['file_meta']);
354                                         }
355                                 } else {
356                                         //if this file is in the test array, add an extra link to the direct file, 
357                                         if (!empty($test_zipped_files) && in_array($file_path, $test_zipped_files)){
358                                                 $content_files .= str_replace('{FILE}', $file, $ims_template_xml['file']);
359                                         } else {
360                                                 if (preg_match('/^http[s]?\:/', $file) == 1){
361                                                         $content_files .= str_replace('{FILE}', $file, $ims_template_xml['xml']);
362                                                 } elseif (file_exists($file_path) && is_file($file_path)) {
363                                                         //http://www.atutor.ca/atutor/mantis/view.php?id=4313
364                                                         //relative link that goes beyond get.php shouldn't be added
365                                                         //relative link that does not exist shouldn't be added.
366                                                         $content_files .= str_replace('{FILE}', $content['content_path'] . $file, $ims_template_xml['file']);
367                                                 }
368                                         }
369                                 }
370                                 /* check if this file is one of the test xml file, if so, we need to add the dependency
371                                  * Note:  The file has already been added to the archieve before this is called.
372                                  */
373                                 if (preg_match('/tests\_[0-9]+\.xml$/', $file) && !in_array($file, $test_zipped_files)){
374                                         $content_files .= str_replace('{FILE}', 'QTI/'.$file, $ims_template_xml['xml']);
375                                         $test_zipped_files[] = $file;
376                                 }
377                         }
378                         
379                         /******************************
380                          * http://www.atutor.ca/atutor/mantis/view.php?id=4383 
381                      */
382                         $my_files = array();
383                         
384                         /******************************/
385                         //add it to the resources section if it hasn't been added.  
386                         //Weblinks have been added.
387                         //Folders aren't resourecs, they shouldn't be added
388                         if($content['content_type']==CONTENT_TYPE_CONTENT){
389                                 $resources .= str_replace(      array('{CONTENT_ID}', '{PATH}', '{FILES}','{DEPENDENCY}'),
390                                                                                         array($content['content_id'], $content['content_path'], $content_files, $forums_dependency),
391                                                                                         $ims_template_xml['resource']); 
392                         }
393                         
394
395                         for ($i=0; $i<$depth; $i++) {
396                                 $link .= $space;
397                         }
398
399                         if ( is_array($_menu[$content['content_id']]) ) {
400                                 /* has children */
401
402                                 $html_link = '<li>'.$html_link.'<ul>';
403                                 for ($i=0; $i<$depth; $i++) {
404                                         if ($children[$i] == 1) {
405                                                 echo $space;
406                                                 //$html_link = $space.$html_link;
407                                         } else {
408                                                 echo $space;
409                                                 //$html_link = $space.$html_link;
410                                         }
411                                 }
412
413                         } else {
414                                 /* doesn't have children */
415
416                                 $html_link = '<li>'.$html_link.'</li>';
417                                 if ($counter == $num_items) {
418                                         for ($i=0; $i<$depth; $i++) {
419                                                 if ($children[$i] == 1) {
420                                                         echo $space;
421                                                         //$html_link = $space.$html_link;
422                                                 } else {
423                                                         echo $space;
424                                                         //$html_link = $space.$html_link;
425                                                 }
426                                         }
427                                 } else {
428                                         for ($i=0; $i<$depth; $i++) {
429                                                 echo $space;
430                                                 //$html_link = $space.$html_link;
431                                         }
432                                 }
433                                 $title = $space.$title;
434                         }
435
436                         echo $prefix.$link;
437 //                      echo $title;
438                         echo "\n";
439
440                         $string .= $html_link."\n";
441
442                         $depth ++;
443                         print_organizations($content['content_id'],
444                                                                 $_menu, 
445                                                                 $depth, 
446                                                                 $path.$counter.'.', 
447                                                                 $children,
448                                                                 $string);
449                         $depth--;
450
451                         $counter++;
452                         for ($i=0; $i<$depth; $i++) {
453                                 echo $space;
454                         }
455
456 //                      if (!empty($_menu[$content['content_id']])){
457                         echo $prefix.'</item>';
458 //                      }
459                         echo "\n";
460                 }  
461
462                 $string .= '</ul>';
463                 if ($depth > 0) {
464                         $string .= '</li>';
465                 }
466
467         }
468 }
469
470
471 //TODO***************BOLOGNA******************REMOVE ME***************/
472 /* Export Forum */
473 function print_resources_forum() {
474
475     global $forum_list, $zipfile, $resources;           //$forum_list contiene tutti i forum DISTINTI associati ai contenuti. caricato in print_organizations()
476
477     $ims_template_xml['resource_forum'] =
478
479         '<resource identifier="Forum{FORUMID}_R" type="imsdt_xmlv1p0">
480             <metadata/>
481             <file href="Forum{FORUMID}/FileDescriptorForum{FORUMID}.xml"/>
482         </resource>
483         '."\n";
484
485     if (is_array($forum_list)) {
486             foreach ($forum_list as $f){
487             // per ogni forum associato ad uno o pi� contenuti del corso viene aggiunto un elemento resource in imsmanifest.xml
488                 $resources .= str_replace("{FORUMID}", $f['id'], $ims_template_xml['resource_forum']);
489         
490                 //viene generato il file descrittore
491                 //file Descrittore con la descrzione del forum
492                 $fileDesDT_D = '<?xml version="1.0" encoding="UTF-8"?>
493         
494                             <dt:topic
495         
496                                 xmlns:dt="http://www.imsglobal.org/xsd/imsdt_v1p0"
497         
498                                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
499         
500                                 <title>{TitleDiscussionTopic}</title>
501         
502                                 <text texttype="text/plain">{DescriptionDiscussionTopic}</text>
503         
504                             </dt:topic>';
505         
506                 //file Descrittore senza la descrizione del forum
507                 $fileDesDT = '<?xml version="1.0" encoding="UTF-8"?>
508         
509                             <dt:topic
510         
511                                 xmlns:dt="http://www.imsglobal.org/xsd/imsdt_v1p0"
512         
513                                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
514         
515                                 <title>{TitleDiscussionTopic}</title>
516         
517                                 <text/>
518         
519                             </dt:topic>';
520         
521                         $f['title'] = htmlspecialchars($f['title']);
522                         $f['description'] = htmlspecialchars($f['description']);
523                 if (empty($f['description']))
524                     $text_file_des_xml = str_replace (array('{TitleDiscussionTopic}', '{DescriptionDiscussionTopic}'), array($f['title'], $f['description']), $fileDesDT);
525                 else
526                     $text_file_des_xml = str_replace (array('{TitleDiscussionTopic}', '{DescriptionDiscussionTopic}'), array($f['title'], $f['description']), $fileDesDT_D);
527         
528                 $zipfile->add_file($text_file_des_xml,  'Forum'.$f['id'].'/'.'FileDescriptorForum'.$f['id'].'.xml');
529             }
530     }
531     //$zipfile->add_file(file_get_contents('../../images/home-forums_sm.png'),  'resources/home-forums_sm.png');
532 }
533
534
535 $ims_template_xml['header'] = '<?xml version="1.0" encoding="{COURSE_PRIMARY_LANGUAGE_CHARSET}"?>
536 <!--This is an ATutor 1.0 Common Cartridge document-->
537 <!--Created from the ATutor Content Package Generator - http://www.atutor.ca-->
538 <manifest identifier="MANIFEST-2415ad93fc44817acbe40edfd1ffb1ee" xmlns="http://www.imsglobal.org/xsd/imscc/imscp_v1p1" xmlns:imsmd="http://www.imsglobal.org/xsd/imsmd_rootv1p2p1" xmlns:lomimscc="http://ltsc.ieee.org/xsd/imscc/LOM" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:adlcp="http://www.adlnet.org/xsd/adlcp_rootv1p2" xsi:schemaLocation="http://www.imsglobal.org/xsd/imscc/imscp_v1p1 imscp_v1p2_localised.xsd http://ltsc.ieee.org/xsd/imscc/LOM domainProfile_1/lomLoose_localised.xsd">
539         <metadata>
540                 <schema>IMS Common Cartridge</schema>
541             <schemaversion>1.0.0</schemaversion>
542                 <lomimscc:lom>
543       <lomimscc:general>
544         <lomimscc:identifier>          
545                         <lomimscc:catalog>ATutor</lomimscc:catalog>
546                         <lomimscc:entry></lomimscc:entry>
547         </lomimscc:identifier>
548         <lomimscc:title>
549                         <lomimscc:string language="{COURSE_PRIMARY_LANGUAGE_CODE}">{COURSE_TITLE}</lomimscc:string>
550         </lomimscc:title>
551         <lomimscc:language>en</lomimscc:language>
552         <lomimscc:description> 
553                         <lomimscc:string language="{COURSE_PRIMARY_LANGUAGE_CODE}">{COURSE_DESCRIPTION}</lomimscc:string>
554         </lomimscc:description>
555         <lomimscc:keyword>
556                         <lomimscc:string language="{COURSE_PRIMARY_LANGUAGE_CODE}">{KEYWORDS}</lomimscc:string>
557         </lomimscc:keyword>
558       </lomimscc:general>
559     </lomimscc:lom>
560         </metadata>'
561 ;
562
563 $ims_template_xml['resource'] = '               <resource identifier="MANIFEST01_RESOURCE{CONTENT_ID}" type="webcontent" href="resources/{PATH}{CONTENT_ID}.html">
564                         <metadata/>
565                         <file href="resources/{PATH}{CONTENT_ID}.html"/>{FILES}
566                         {DEPENDENCY}
567                 </resource>
568 '."\n";
569 $ims_template_xml['resource_glossary'] = '              <resource identifier="MANIFEST01_RESOURCE_GLOSSARY" type="associatedcontent/imscc_xmlv1p0/learning-application-resource" href="resources/GlossaryItem/glossary.xml">
570                         <metadata/>
571                         <file href="resources/GlossaryItem/glossary.xml"/>
572                 </resource>
573 '."\n";
574 $ims_template_xml['resource_test'] = '          <resource identifier="MANIFEST01_RESOURCE_QTI{TEST_ID}" type="imsqti_xmlv1p2/imscc_xmlv1p0/assessment">
575                         <metadata/>
576                         <file href="QTI/{PATH}"/>{FILES}
577                 </resource>
578 '."\n";
579 $ims_template_xml['resource_weblink'] = '               <resource identifier="MANIFEST01_RESOURCE{CONTENT_ID}" type="imswl_xmlv1p0">
580                         <metadata/>
581                         <file href="Weblinks/{PATH}"/>
582                 </resource>
583 '."\n";
584 $ims_template_xml['file'] = '                   <file href="resources/{FILE}"/>'."\n";
585 $ims_template_xml['xml'] = '                    <file href="{FILE}"/>'."\n";
586 $ims_template_xml['glossary'] = '                       <item identifier="GlossaryItem" identifierref="MANIFEST01_RESOURCE_GLOSSARY">
587                                 <title>Glossary</title>
588                         </item>';
589 $ims_template_xml['test'] = '                   <item identifier="QTI{TEST_ID}" identifierref="MANIFEST01_RESOURCE_QTI{TEST_ID}">
590                                 <title>Test {TEST_ID}</title>
591                         </item>';
592 $ims_template_xml['file_meta'] = '                      <file href="{FILE}">
593                                 <metadata>
594                                 {FILE_META_DATA}
595                                 </metadata>
596                         </file>'."\n";
597
598 $ims_template_xml['final'] = '
599         <organizations>
600                 <organization identifier="MANIFEST01_ORG1" structure="rooted-hierarchy">
601                         <item identifier="resources">           
602                 {ORGANIZATIONS}
603                     </item>
604                 </organization>
605         </organizations>
606         <resources>
607 {RESOURCES}
608         </resources>
609 </manifest>';
610
611 $html_template = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
612     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
613 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="{COURSE_PRIMARY_LANGUAGE_CODE}" lang="{COURSE_PRIMARY_LANGUAGE_CODE}">
614 <head>
615         <meta http-equiv="Content-Type" content="text/html; charset={COURSE_PRIMARY_LANGUAGE_CHARSET}" />
616         <title>{TITLE}</title>
617         <meta name="Generator" content="ATutor">
618         <meta name="Keywords" content="{KEYWORDS}">
619 </head>
620 <body>{CONTENT}</body>
621 </html>';
622
623 $html_content_template = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
624     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
625 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="{COURSE_PRIMARY_LANGUAGE_CODE}" lang="{COURSE_PRIMARY_LANGUAGE_CODE}">
626 <head>
627         <meta http-equiv="Content-Type" content="text/html; charset={COURSE_PRIMARY_LANGUAGE_CHARSET}" />
628         {HEAD}
629         <title>{TITLE}</title>
630         <meta name="Generator" content="ATutor">
631         <meta name="Keywords" content="{KEYWORDS}">
632 </head>
633 <body>{CONTENT}</body>
634 </html>';
635
636 $default_html_style = ' <style type="text/css">
637         body { font-family: Verdana, Arial, Helvetica, sans-serif;}
638         a.at-term {     font-style: italic; }
639         </style>';
640         
641 //output this as header.html
642 $html_mainheader = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
643     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
644 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="{COURSE_PRIMARY_LANGUAGE_CODE}" lang="{COURSE_PRIMARY_LANGUAGE_CODE}">
645 <head>
646         <meta http-equiv="Content-Type" content="text/html; charset={COURSE_PRIMARY_LANGUAGE_CHARSET}" />
647         <link rel="stylesheet" type="text/css" href="ims.css"/>
648         <title>{COURSE_TITLE}</title>
649 </head>
650 <body class="headerbody"><h3>{COURSE_TITLE}</h3></body></html>';
651
652
653 $html_toc = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
654     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
655 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="{COURSE_PRIMARY_LANGUAGE_CODE}" lang="{COURSE_PRIMARY_LANGUAGE_CODE}">
656 <head>
657         <meta http-equiv="Content-Type" content="text/html; charset={COURSE_PRIMARY_LANGUAGE_CHARSET}" />
658         <link rel="stylesheet" type="text/css" href="ims.css" />
659         <title></title>
660 </head>
661 <body>{TOC}</body></html>';
662
663 // index.html
664 $html_frame = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
665    "http://www.w3.org/TR/html4/frameset.dtd">
666 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="{COURSE_PRIMARY_LANGUAGE_CODE}" lang="{COURSE_PRIMARY_LANGUAGE_CODE}">
667         <meta http-equiv="Content-Type" content="text/html; charset={COURSE_PRIMARY_LANGUAGE_CHARSET}" />
668         <title>{COURSE_TITLE}</title>
669 </head>
670 <frameset rows="50,*,50">
671 <frame src="header.html" name="header" title="header" scrolling="no">
672         <frameset cols="25%, *" frameborder="1" framespacing="3">
673                 <frame frameborder="2" marginwidth="0" marginheight="0" src="toc.html" name="frame" title="TOC">
674                 <frame frameborder="2" src="resources/{PATH}{FIRST_ID}.html" name="body" title="{COURSE_TITLE}">
675         </frameset>
676 <frame src="footer.html" name="footer" title="footer" scrolling="no">
677         <noframes>
678                 <h1>{COURSE_TITLE}</h1>
679       <p><a href="toc.html">Table of Contents</a> | <a href="footer.html">About</a><br />
680           </p>
681   </noframes>
682 </frameset>
683 </html>';
684
685
686
687 $glossary_xml = '<?xml version="1.0" encoding="{COURSE_PRIMARY_LANGUAGE_CHARSET}"?>
688 <!--This is an ATutor Glossary terms document-->
689 <!--Created from the ATutor Content Package Generator - http://www.atutor.ca-->
690 <glossary:glossary xmlns:glossary="http://www.atutor.ca/xsd/glossary" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
691       {GLOSSARY_TERMS}
692 </glossary:glossary>
693 ';
694
695 $glossary_term_xml = '  <item>
696                 <term>{TERM}</term>
697                 <definition>{DEFINITION}</definition>
698         </item>';
699
700 $glossary_body_html = '<h2>Glossary</h2>
701         <ul>
702 {BODY}
703 </ul>';
704
705 $glossary_term_html = ' <li><a name="{ENCODED_TERM}"></a><strong>{TERM}</strong><br />
706                 {DEFINITION}<br /><br /></li>';
707
708 ?>