changed git call from https to git readonly
[atutor.git] / mods / atutor_opencaps / opencaps / include / classes / captionCollection_class.php
1 <?php\r
2 /*\r
3  * OpenCaps\r
4  * http://opencaps.atrc.utoronto.ca\r
5  * \r
6  * Copyright 2009 Antonio Gamba Bari\r
7  * Adaptive Technology Resource Centre, University of Toronto\r
8  * \r
9  * Licensed under the Educational Community License (ECL), Version 2.0. \r
10  * You may not use this file except in compliance with this License.\r
11  * http://www.opensource.org/licenses/ecl2.php\r
12  * \r
13  */\r
14 \r
15 /**\r
16  * This class represents a collection of captions \r
17  * 1. Create an instance\r
18  * 2. load captions\r
19  */\r
20 class CaptionCollection\r
21 {\r
22         public $collectionName = ''; // the name that holds the entiry collection.. this particularly important for JSON export\r
23         public $txtStylesGlobal = array(); // holds any global text style. (e.g. $txtStylesGlobal['text-align'] = 'center', $txtStylesGlobal['text-font'] = 'Arial', $txtStylesGlobal['text-size'] = '14', etc...)\r
24         public $captionCollection = array(); // a collection of Caption objects\r
25         \r
26         /**\r
27         * Class Constructor \r
28         */\r
29         public function __construct()\r
30         {\r
31                 /*\r
32                  * empty for now... (we don't know what the caption will contain...)\r
33                  * It seems logical and much more practical \r
34                  * to create first an empty CaptionCollection  \r
35                  * and then add to it as needed, \r
36                  * finally, get the collection object\r
37                  */\r
38         }\r
39         \r
40         /**\r
41          * Adds a Caption Object to the $captionCollection array \r
42          * @param Object $theCcObject a Caption Object\r
43          * @return void\r
44          */     \r
45         public function addCaption($theCcObject)\r
46         {\r
47                 // add Caption to the Caption Collection \r
48                 $this->captionCollection[] = $theCcObject; // this a php-based approach... java will need a push/count solution \r
49                 \r
50         } // end addCaptions()\r
51 \r
52         /**\r
53          * Sets all the Global text style attributes\r
54          * @param Array $theGlobalStyles Array containing all the global text styles  \r
55          */\r
56         public function setTxtStylesGlobal($theGlobalStyles)\r
57         {\r
58                 $this->txtStylesGlobal = $theGlobalStyles;\r
59         }       \r
60         \r
61         /**\r
62          * Sets the value a single Global text style attribute\r
63          * @param String $theAtt Attribute name\r
64          * @param String $theValue Attribute Value \r
65          */\r
66         public function setTxtStylesGlobalAtt($theAtt,$theValue)\r
67         {\r
68                 $this->txtStylesGlobal[$theAtt]=$theValue;\r
69         } // end setTxtStylesGlobalAtt()\r
70         \r
71         /**\r
72          * Return this object\r
73          *\r
74          * @return CaptionCollection \r
75          */\r
76         public function getCollection()\r
77         {\r
78                 return $this->captionCollection;\r
79         }  \r
80 \r
81         public function toString()\r
82         {\r
83                 $ccCount=0;\r
84                 echo '<br/><h3>Printing a Rosetta Collection</h3>';\r
85                 echo 'Total Captions Found: '.count($this->captionCollection);\r
86 \r
87                 echo '<br/><br/><b>[Global]  Styles</b>';\r
88                 if (count($this->txtStylesGlobal)==0)\r
89                 {\r
90                         echo ' (NO text styles found)';\r
91                 }\r
92                 \r
93                 foreach ($this->txtStylesGlobal as $txtStyleName => $txtStyleValue)\r
94                 {\r
95                         echo '<br/> -----'.$txtStyleName.' = '.$txtStyleValue;\r
96                 }\r
97                 \r
98                 echo '<br/><br/><b>Printing Captions in the collection... </b>';\r
99                 foreach ($this->captionCollection as $captionObj)\r
100                 {\r
101                         $ccCount++;\r
102                         // building a new to string\r
103                         /* \r
104                         \r
105                         echo "<br><b>In Time: </b>". $captionObj->getInTime()."";\r
106                         echo "<br><b>Out Time: </b>". $captionObj->getOutTime()."";\r
107                         echo "<br><b>Caption: </b>". $captionObj->getCaption()."";\r
108                         \r
109             // display text styles\r
110             foreach ($captionStylesFound as $txtStyle)\r
111             {\r
112                 $captionObj->\r
113                 //$textStyles[] = $txtStyle;\r
114             }\r
115                         */\r
116                         // call Caption's toString();\r
117                         echo '<br/><br/>'.$ccCount;\r
118                         $captionObj->toString();\r
119 \r
120                 } // foreach end \r
121 \r
122         } //toString() end\r
123 \r
124 } // end CaptionCollection Class  \r
125 ?>