changed git call from https to git readonly
[atutor.git] / mods / atutor_opencaps / opencaps / conversion_service / include / classes / ccformats / cc_SubViewer_format.php
1 <?php\r
2 /**\r
3  * SubViewer Class\r
4  */\r
5 class SubViewer extends CaptionFormat\r
6 {\r
7         /**\r
8          * Imports a caption string into a CaptionCollection \r
9          *\r
10          * @param String $theCCString the caption file as string\r
11          * @return CaptionCollection $myCcCollection A CaptionCollection Object\r
12          */\r
13         public function importCC($theCCString)\r
14         {\r
15                 \r
16         } // end importCC()\r
17         \r
18         /**\r
19          * Exports a CaptionCollection object into a string\r
20          *\r
21          * @param CaptionCollection $theCollection A CaptionCollection Object\r
22          * @return String $captionString The caption as a String\r
23          */\r
24         public function exportCC($theCollection)\r
25         {\r
26                 \r
27                 $ccExport = '';\r
28                 \r
29                 $myCollection = $theCollection->getCollection();\r
30 \r
31                 foreach ($myCollection as $captionObj)\r
32                 {\r
33                         // add in time\r
34                         $ccExport.= chr(10).$captionObj->getInTime();\r
35                         \r
36                         $ccExport.= ',';\r
37                         \r
38                         // add out time\r
39                         $ccExport.= $captionObj->getOutTime();\r
40                         \r
41                         // fix caption to subViewer v. 1\r
42                         $fixCaption = str_replace(chr(10),'',$captionObj->getCaption());\r
43                         $fixCaption = str_replace('<BR/>','',$fixCaption);\r
44                         \r
45                         // add caption\r
46                         $ccExport.= chr(10).$fixCaption.chr(10);\r
47 \r
48                 } // end foreach\r
49                 \r
50                 return $ccExport;\r
51                 \r
52         } // end  exportCC()\r
53         \r
54         /**\r
55          * Verify if the caption file is a srt caption file \r
56         */\r
57         public function checkFormat($theCCString)\r
58         {\r
59                 \r
60         } // end checkFormat()\r
61 \r
62         /*\r
63          * Here functions to re-define\r
64          */\r
65         public function getName()\r
66         {\r
67                 return 'SubViewer - Sub';\r
68         }\r
69         \r
70         public function getAbout()\r
71         {\r
72                 return '????';\r
73         }\r
74         \r
75         public function getVersion()\r
76         {\r
77                 return '???';\r
78         }\r
79                 \r
80         public function getFileExtension()\r
81         {\r
82                 return 'sub';\r
83         }\r
84         \r
85         public function getIdPattern()\r
86         {\r
87                 $idPattern = '/([0-9]{2}:[0-9]{2}:[0-9]{2},[0-9]{2})(,)([0-9]{2}:[0-9]{2}:[0-9]{2},[0-9]{2})/';\r
88 \r
89                 return $idPattern;\r
90         }\r
91         \r
92         public function allowsTextStyles()\r
93         {\r
94                 return '0';\r
95         }\r
96         \r
97         public function template()\r
98         {\r
99                 $ccTemplate = '\r
100 00:04:35.03,00:04:38.82\r
101 Hello guys... please seat down...\r
102 \r
103 00:05:00.19,00:05:03.47\r
104 M. Franklin,[br]are you crazy?\r
105 \r
106 ????\r
107 [00:00:00]\r
108 caption 1 - using Bold style?\r
109 [00:00:02]\r
110 \r
111 ';\r
112                 \r
113                 return $ccTemplate;\r
114         }\r
115         \r
116 } // end SubViewer Class\r
117 ?>