+++ /dev/null
-<?php\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 wraps the collection. \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(); // The 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 of 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
- * Sets the collection Name\r
- *\r
- * @param String $theCollectionName\r
- */\r
- public function setCollectionName($theCollectionName)\r
- {\r
- $this->collectionName = $theCollectionName;\r
- }\r
- \r
- /**\r
- * Gets Collection Name\r
- *\r
- * @return String $collectionName\r
- */\r
- public function getCollectionName()\r
- {\r
- return $this->collectionName;\r
- }\r
- \r
- /**\r
- * Returns this CaptionCollection 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>Collection Name: '.$this->getCollectionName().'</h3>';\r
- echo 'Total Captions Found: '.count($this->captionCollection);\r
-\r
- if (count($this->txtStylesGlobal)!=0)\r
- {\r
- echo '<br/><br/><b>[Global] Styles</b>';\r
- \r
- foreach ($this->txtStylesGlobal as $txtStyleName => $txtStyleValue)\r
- {\r
- echo '<br/> -----'.$txtStyleName.' = '.$txtStyleValue;\r
- }\r
- } \r
- \r
- echo '<br/><br/><b>Printing Captions in the collection... </b>';\r
- \r
- foreach ($this->captionCollection as $captionObj)\r
- {\r
- $ccCount++;\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