removed mods directory from the ATutor codebase
[atutor.git] / mods / atutor_opencaps / opencaps / conversion_service / include / classes / ccformats / cc_DFXP_format.php
diff --git a/mods/atutor_opencaps/opencaps/conversion_service/include/classes/ccformats/cc_DFXP_format.php b/mods/atutor_opencaps/opencaps/conversion_service/include/classes/ccformats/cc_DFXP_format.php
deleted file mode 100755 (executable)
index 9962b79..0000000
+++ /dev/null
@@ -1,282 +0,0 @@
-<?php\r
-/**\r
- * DFXP Class\r
- */\r
-class DFXP extends CaptionFormat\r
-{\r
-       private $textStyles = array();  \r
-       \r
-\r
-       /**\r
-        * Imports a caption string into a CaptionCollection \r
-        *\r
-        * @param String $theCCString the caption file as string\r
-        * @return CaptionCollection $myCcCollection A CaptionCollection Object\r
-        */\r
-       public function importCC($theCCString) {\r
-               \r
-               // include classes for XML parser\r
-               include_once('include/classes/core_XmlTag.php');\r
-               include_once('include/classes/core_XmlTagCollection.php');\r
-               include_once('include/classes/core_XmlTagTrace.php');\r
-               \r
-               // create a xml parser \r
-               $myXmlParse = new XmlTagTrace($theCCString,'P',4);\r
-               \r
-               // print xml collection\r
-               //$myXmlParse->toString();\r
-               \r
-               // get xml collection\r
-               $myXmlTagCollection = $myXmlParse->getCollection();\r
-               \r
-        //include_once('CaptionCollection.php');\r
-        $myCcCollection = new CaptionCollection();\r
-\r
-        foreach ($myXmlTagCollection as $xmlTagObj) \r
-        {              \r
-               //echo '<br/>Begin Time: '.$xmlTagObj->getTagAttribute('BEGIN');\r
-               //echo '<br/>End Time: '.$xmlTagObj->getTagAttribute('END'); \r
-               //echo '<br>Caption:'.$xmlTagObj->getTagValue();\r
-               \r
-               $txtStylesArr = Array();\r
-               $newCaption = new Caption($xmlTagObj->getTagAttribute('BEGIN').'0',$xmlTagObj->getTagAttribute('END').'0',$xmlTagObj->getTagValue(),$txtStylesArr);\r
-               \r
-               // add captions to the collection\r
-                       $myCcCollection->addCaption($newCaption);\r
-                       \r
-        } // end for \r
-       \r
-           //$myCcCollection->toString();\r
-               \r
-        return $myCcCollection;\r
-                \r
-       } // end importCC()\r
-       \r
-       /**\r
-        * Exports a CaptionCollection object into a string\r
-        *\r
-        * @param CaptionCollection $theCollection A CaptionCollection Object\r
-        * @return String $captionString The caption as a String\r
-        */\r
-       public function exportCC($theCollection)\r
-       {\r
-               $ttCaption = '';\r
-       \r
-               $myCollection = $theCollection->getCollection();\r
-               \r
-               // add header\r
-               $ttCaption .= $this->getTTHeader();\r
-               \r
-               // Caption counter\r
-               $capCount = 0;\r
-\r
-               foreach ($myCollection as $captionObj)\r
-               {\r
-                       $capCount++;\r
-                       \r
-                       // adding caption number - for debug purpuses \r
-                       //$captionObj->getCaption() = "[CAP no. $capCount]" . " ". $captionObj->getCaption();\r
-                       \r
-                       // adapt \n character to <br/>\r
-                       //$fixCap = "[CAP no. $capCount] : ". CcUtil::ccNewLineToBr($captionObj->getCaption(),' <br/>'); \r
-                       $fixCap = "". TxtFileTools::ccNewLineToBr($captionObj->getCaption(),' <br />');\r
-\r
-                       // convert qt to TT time format\r
-                       $ttTimeIn = $this->timeQtToTT($captionObj->getInTime());\r
-                       $ttTimeOut = $this->timeQtToTT($captionObj->getOutTime());\r
-       \r
-                       // ading TTcaptions\r
-                       $ttCaption .= "".$this->getTTCaption($ttTimeIn,$ttTimeOut,$fixCap,$captionObj->getTextStyles());\r
-\r
-                       // show caption object\r
-                       //$captionObj->toString();\r
-                       \r
-               } // end foreach\r
-               \r
-               //  close TT file\r
-               $ttCaption .= $this->getTTClose();\r
-               \r
-               return $ttCaption;\r
-               \r
-       } // end  exportCC()\r
-       \r
-       /**\r
-        * Verify if the caption file is a QText caption file \r
-       */\r
-       public function checkFormat($theCCString)\r
-       {\r
-               $isValid = false;\r
-               $patternCheck = "/({(QTtext)})/"; // RegExp to look for QText \r
-               preg_match_all($patternCheck,$theCCString,$patternFound);\r
-               \r
-               if(count($patternFound)>0)\r
-               {\r
-                       $isValid = true;\r
-               }\r
-\r
-               return $isValid;\r
-               \r
-       } // end  checkFormat() \r
-\r
-       /*\r
-        * Here functions to re-define\r
-        */\r
-       public function getName()\r
-       {\r
-               return 'Timed Text (TT) Authoring Format 1.0 \96 Distribution Format Exchange Profile (DFXP)';\r
-       }\r
-       \r
-       public function getAbout()\r
-       {\r
-               return 'This is the most comprehensive caption format ever !!\r
-               XML based.\r
-               Additional information at <a href="http://www.w3.org/TR/2006/CR-ttaf1-dfxp-20061116/">W3-dfxp</a>';\r
-       }\r
-       \r
-       public function getVersion()\r
-       {\r
-               return '1.0';\r
-       }\r
-               \r
-       public function getFileExtension()\r
-       {\r
-               return 'dfxp.xml';\r
-       }\r
-       \r
-       public function getIdPattern()\r
-       {\r
-               $idPattern = '/(<tt xmlns="http:\/\/www.w3.org\/2006\/04\/ttaf1)/';\r
-               \r
-               return $idPattern;\r
-       }\r
-       \r
-       public function allowsTextStyles()\r
-       {\r
-               return '1';\r
-       }\r
-       \r
-       public function template()\r
-       {\r
-               \r
-       }\r
-\r
-\r
-/*////////////////////////////////////////////////////////\r
-        Functions for TT - Timed Text Conversion\r
-//////////////////////////////////////////////////////*/\r
-\r
-\r
-/**\r
- * creates a TT Caption \r
- * @return String $ttCaption A TT formatted caption \r
- * @param string $capInTime Caption start time (e.g 0:00:00.80)\r
- * @param string $capOutTime Caption end time (e.g 0:00:00.80)\r
- * @param String $caption caption, with all styles\r
- * @param Array $txtStyles Array with text styles in the caption\r
- */\r
-private function getTTCaption($capInTime,$capOutTime,$caption,$txtStyles)\r
-{\r
-        \r
-// <p begin="0:00:00.00" end="0:00:00.80">1 begining</p>\r
-\r
-        $ttCaption = "";\r
-        \r
-               // Find if text alignment in $txtStyles array\r
-               if (isset($txtStyles['text-align']))\r
-               {\r
-                       if ($txtStyles['text-align']=='right')\r
-                       {\r
-        // Add right alignment style\r
-        $ttCaption = '\r
-        <p begin="'.$capInTime.'" end="'.$capOutTime.'" style="txtRight">'.$caption.'</p>';                            \r
-                       } \r
-                       else if ($txtStyles['text-align']=='left')\r
-                       {\r
-        // Add right alignment style\r
-        $ttCaption = '\r
-        <p begin="'.$capInTime.'" end="'.$capOutTime.'" style="txtLeft">'.$caption.'</p>';\r
-                       }\r
-                       else if ($txtStyles['text-align']=='center')\r
-                       {\r
-        $ttCaption = '\r
-        <p begin="'.$capInTime.'" end="'.$capOutTime.'">'.$caption.'</p>';\r
-\r
-                       }\r
-                       \r
-               } else {\r
-                       // no text style, creates a plain caption   \r
-        $ttCaption = '\r
-        <p begin="'.$capInTime.'" end="'.$capOutTime.'">'.$caption.'</p>';\r
-               \r
-               } // end if\r
-        \r
-\r
-\r
-        return $ttCaption;\r
-        \r
-} // end getTTCaption()\r
-\r
-/**\r
- * Converts QT time to TT Time; drops last right number on the time format\r
- * @return String $ttTime TT time format 00:01:10.28"\r
- * @param String $qtTime QT time Format; "00:01:10.280"\r
- */\r
-private function timeQtToTT($qtTime)\r
-{\r
-        $ttTime = substr($qtTime, 0, 11); // returns "d"   ;\r
-        return $ttTime;\r
-} // end timeQtToTT\r
-\r
-/// TT Header \r
-private function getTTHeader()\r
-{\r
-// common vars\r
-$textFont = "Arial";\r
-$textFontWeight = "normal";\r
-$textFontStyle = "normal";\r
-$textSize = "12";\r
-$textJustify = "center";\r
-\r
-// unique vars \r
-$capTitle = 'This is a sample SAMI 1.0 caption';\r
-$textHtmlColor = "white";\r
-$bgHtmlColor = "black";\r
-$capLangName = "English";\r
-$capLangCode= "EN-US-CC";\r
-\r
-$capTT_header = '<?xml version="1.0" encoding="UTF-8"?>\r
-<tt xmlns="http://www.w3.org/2006/04/ttaf1"\r
-      xmlns:tts="http://www.w3.org/2006/04/ttaf1#styling" xml:lang="en">\r
-  <head>\r
-    <styling>\r
-      <style id="txtRight" tts:textAlign="right" tts:color="cyan"/>\r
-      <style id="txtLeft" tts:textAlign="left" tts:color="#FCCA03"/>\r
-      <style id="defaultSpeaker" tts:fontSize="'.$textSize.'px" tts:fontFamily="'.$textFont.'" tts:fontWeight="'.$textFontWeight.'" tts:fontStyle="'.$textFontStyle.'" tts:textDecoration="none" tts:color="'.$textHtmlColor.'" tts:backgroundColor="'.$bgHtmlColor.'" tts:textAlign="'.$textJustify.'" />\r
-      <style id="defaultCaption" tts:fontSize="14px" tts:fontFamily="SansSerif" tts:fontWeight="normal" tts:fontStyle="normal" tts:textDecoration="none" tts:color="white" tts:backgroundColor="black" tts:textAlign="left" />\r
-    </styling>\r
-  </head>\r
-  <body id="ccbody" style="defaultSpeaker">\r
-    <div xml:lang="en">';\r
-    \r
-        return $capTT_header;\r
-\r
-} // end getTTHeader()\r
-\r
-\r
-// Time Text Close\r
-private function getTTClose()\r
-{\r
-// alternative close   "<div xml:lang="en"/>"\r
-$capTT_close = '\r
-    </div>\r
-  </body>\r
-</tt>'\r
-;\r
-    return $capTT_close;\r
-}\r
-       \r
-}  // end classQText \r
-?>\r
-\r
-\r
-\r