00001 <?php
00010 class STransInteractivateLessonHelper extends STransInteractivateHelperBase {
00011 protected $MAPPINGS = array(
00012 'abstract' => 'Abstract',
00013 'teacherPreparations' => 'Teacher Preparation',
00014 'alternateOutline' => 'Alternate Outline',
00015 'objectives' => 'Objectives',
00016 'prerequisites' => 'Student Prerequisites',
00017 'followUp' => 'Suggested Follow-Up'
00018 );
00019
00028 protected function processSectionXML($xml) {
00029 global $STRING;
00030 $this->sectionDepth++;
00031 $mapping = $xml->getAttribute('mapping');
00032 $html = "";
00033 if($mapping == 'textbooks')
00034 $html .= $this->processTextbooks($xml);
00035 else if($mapping == 'standards')
00036 $html .= $this->processStandards($xml);
00037 else if($mapping == 'keyTerms')
00038 $html .= $this->processKeyTerms($xml);
00039 else if($mapping == 'outline') {
00040 $html .= '<div class="StdXML3 coreSection sectionOutline"><h3 class="StdXML3 pageTitle">Lesson Outline</h3><ol class="StdXML3">';
00041 $html .= parent::processSectionXML($xml);
00042 $html .= '</ol></div>';
00043 }
00044 else if($mapping == 'section') {
00045 $sxml = simplexml_import_dom($xml);
00046 $name = (string)$sxml->resourceData->name;
00047 $html .= '<li class="StdXML3 outlineSection"><b>' . $name . '</b><div class="StdXML3 outlineContent">';
00048
00049 foreach($xml->childNodes as $child) {
00050 if($child instanceof domElement) {
00051 if($child->tagName != 'section')
00052 continue;
00053 $html .= parent::processSectionXML($child);
00054 }
00055 }
00056 $html .= '</div></li>';
00057 }
00058 else if($mapping == 'title') {
00059
00060
00061 }
00062 else {
00063 $name = $this->MAPPINGS[$mapping];
00064
00065
00066 $this->sectionDepth--;
00067 $res = parent::processSectionXML($xml);
00068 $this->sectionDepth++;
00069 if($this->sectionDepth == 1) {
00070 if($mapping == 'lessonOutline')
00071 $res = "<ol>$res</ol>";
00072 $html = '<div class="StdXML3 coreSection section' . ucfirst($mapping) . '"><h3 class="StdXML3 pageTitle">'
00073 . $name . '</h3>' . $res . "</div>";
00074 }
00075 else {
00076 $this->curNumber++;
00077 $html = '<li><b>' . $name . '</b>' . $res . '</li>';
00078 $divclass = "outlineSection";
00079 }
00080
00081 }
00082
00083 $this->sectionDepth--;
00084 return $html;
00085 }
00086
00095 private function processKeyTerms($xml) {
00096 $keyTerms = $this->getTranslator()->getInputOption('keyterms');
00097
00098 if(is_array($keyTerms) && count($keyTerms) > 0) {
00099 $html = "<div class=\"StdXML3 coreSection sectionKeyTerms\"><h3 class='StdXML3 pageTitle'>Key Terms</h3>\n<div class=\"listingContent keyTermsDiv\">\n";
00100 $html .= "<table border=\"0\">\n";
00101 foreach($keyTerms as $word => $def) {
00102 $html .= "<tr><td valign=\"top\"><b>$word</b></td><td>$def</td></tr>\n";
00103 }
00104 $html .= "</table></div></div>\n";
00105 }
00106 else if(is_array($keyTerms))
00107 $html = '';
00108 else
00109 $html = '<div class="StdXML3 coreSection sectionKeyTerms"><h3 class="StdXML3 pageTitle">Key Terms</h3><p style="border: 1px solid black; background: #EFEFEF; padding: 4px"><b>Key terms not available</b></p></div>';
00110
00111 return $html;
00112 }
00113 }
00114
00115 ?>