+++ /dev/null
-<?php\r
-/*\r
- * OpenCaps\r
- * http://opencaps.atrc.utoronto.ca\r
- * \r
- * Copyright 2009 Antonio Gamba Bari\r
- * Adaptive Technology Resource Centre, University of Toronto\r
- * \r
- * Licensed under the Educational Community License (ECL), Version 2.0. \r
- * You may not use this file except in compliance with this License.\r
- * http://www.opensource.org/licenses/ecl2.php\r
- * \r
- */\r
-\r
-/**\r
- * This class represents a collection of captions \r
- * 1. Create an instance\r
- * 2. load captions\r
- */\r
-class CaptionCollection\r
-{\r
- public $collectionName = ''; // the name that holds the entiry collection.. this particularly important for JSON export\r
- public $txtStylesGlobal = array(); // holds any global text style. (e.g. $txtStylesGlobal['text-align'] = 'center', $txtStylesGlobal['text-font'] = 'Arial', $txtStylesGlobal['text-size'] = '14', etc...)\r
- public $captionCollection = array(); // a collection of Caption objects\r
- \r
- /**\r
- * Class Constructor \r
- */\r
- public function __construct()\r
- {\r
- /*\r
- * empty for now... (we don't know what the caption will contain...)\r
- * It seems logical and much more practical \r
- * to create first an empty CaptionCollection \r
- * and then add to it as needed, \r
- * finally, get the collection object\r
- */\r
- }\r
- \r
- /**\r
- * Adds a Caption Object to the $captionCollection array \r
- * @param Object $theCcObject a Caption Object\r
- * @return void\r
- */ \r
- public function addCaption($theCcObject)\r
- {\r
- // add Caption to the Caption Collection \r
- $this->captionCollection[] = $theCcObject; // this a php-based approach... java will need a push/count solution \r
- \r
- } // end addCaptions()\r
-\r
- /**\r
- * Sets all the Global text style attributes\r
- * @param Array $theGlobalStyles Array containing all the global text styles \r
- */\r
- public function setTxtStylesGlobal($theGlobalStyles)\r
- {\r
- $this->txtStylesGlobal = $theGlobalStyles;\r
- } \r
- \r
- /**\r
- * Sets the value a single Global text style attribute\r
- * @param String $theAtt Attribute name\r
- * @param String $theValue Attribute Value \r
- */\r
- public function setTxtStylesGlobalAtt($theAtt,$theValue)\r
- {\r
- $this->txtStylesGlobal[$theAtt]=$theValue;\r
- } // end setTxtStylesGlobalAtt()\r
- \r
- /**\r
- * Return this object\r
- *\r
- * @return CaptionCollection \r
- */\r
- public function getCollection()\r
- {\r
- return $this->captionCollection;\r
- } \r
-\r
- public function toString()\r
- {\r
- $ccCount=0;\r
- echo '<br/><h3>Printing a Rosetta Collection</h3>';\r
- echo 'Total Captions Found: '.count($this->captionCollection);\r
-\r
- echo '<br/><br/><b>[Global] Styles</b>';\r
- if (count($this->txtStylesGlobal)==0)\r
- {\r
- echo ' (NO text styles found)';\r
- }\r
- \r
- foreach ($this->txtStylesGlobal as $txtStyleName => $txtStyleValue)\r
- {\r
- echo '<br/> -----'.$txtStyleName.' = '.$txtStyleValue;\r
- }\r
- \r
- echo '<br/><br/><b>Printing Captions in the collection... </b>';\r
- foreach ($this->captionCollection as $captionObj)\r
- {\r
- $ccCount++;\r
- // building a new to string\r
- /* \r
- \r
- echo "<br><b>In Time: </b>". $captionObj->getInTime()."";\r
- echo "<br><b>Out Time: </b>". $captionObj->getOutTime()."";\r
- echo "<br><b>Caption: </b>". $captionObj->getCaption()."";\r
- \r
- // display text styles\r
- foreach ($captionStylesFound as $txtStyle)\r
- {\r
- $captionObj->\r
- //$textStyles[] = $txtStyle;\r
- }\r
- */\r
- // call Caption's toString();\r
- echo '<br/><br/>'.$ccCount;\r
- $captionObj->toString();\r
-\r
- } // foreach end \r
-\r
- } //toString() end\r
-\r
-} // end CaptionCollection Class \r
-?>
\ No newline at end of file