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