00001 <?php
00002
00011 class TKSnapInteractivateLessonPreview extends TKSnapPreview {
00019 protected function getTranslators() {
00020 global $prm;
00021 $prm->includeCSS('libs/InteractivateSnap.lib.css', 'DefaultSkin');
00022 return array(
00023 'Interactivate Lesson' => 'STransInteractivateLesson',
00024 'Standard XML 3' => 'STransStdXML3'
00025 );
00026 }
00027
00035 protected function getFormattedSource() {
00036 return SXMLHelper::formatXMLSource($this->version->getContentModule()->getXML());
00037 }
00038
00046 protected function getParameters() {
00047 if(!SAutoLoad::isModuleUsed('tsd'))
00048 return array();
00049
00050 $cm = $this->version->getContentModule();
00051
00052 $keyterms = $cm->getKeyTerms();
00053 $kt = array();
00054 foreach($keyterms as $term) {
00055 $w = new TSDWord($term);
00056 $kt[$term] = $w->definition;
00057 }
00058
00059 $params = array('keyterms' => $kt);
00060
00061 $url = 'http://www.shodor.org/interactivate/lessons/' . $this->version->getResource()->getCanonicalShortName() . '/';
00062 SErrorManager::redirectPush('error', 'devnull');
00063 $id = SDR::getResourceIdForURL($url);
00064 SErrorManager::redirectPop('error');
00065 if($id) {
00066 $standards = TSDStandard::getResourceAlignments($id);
00067 $resultStd = array();
00068 foreach($standards as $std) {
00069 $resultStd[$std->organization_name][$std->grade_name][$std->category_name][$std->objective_description][]
00070 = $std->objective_description;
00071 }
00072 $textbooks = TSDText::getResourceAlignments($id);
00073 $resultTxt = array();
00074 foreach($textbooks as $txt) {
00075 $resultTxt[$txt->book_title]['bookID'][] = $txt->book_id;
00076 $resultTxt[$txt->book_title]['chapter'][] = $txt->chapter_name;
00077 $resultTxt[$txt->book_title]['chapterID'][] = $txt->chapter_id;
00078 $resultTxt[$txt->book_title]['section'][] = $txt->section_name;
00079 $resultTxt[$txt->book_title]['sectionID'][] = $txt->section_id;
00080 $resultTxt[$txt->book_title]['grade'][] = $txt->book_gradeOrCourse;
00081 $resultTxt[$txt->book_title]['textReason'][] = $txt->reason;
00082 }
00083 $params['standards'] = $resultStd;
00084 $params['textbooks'] = $resultTxt;
00085 }
00086
00087 return $params;
00088 }
00089 }
00090
00091 ?>