4 * This class represents a collection of captions
\r
5 * 1. Create an instance
\r
8 class CaptionCollection
\r
10 public $collectionName = ''; // The name that wraps the collection.
\r
11 public $txtStylesGlobal = array(); // Holds any global text style. (e.g. $txtStylesGlobal['text-align'] = 'center', $txtStylesGlobal['text-font'] = 'Arial', $txtStylesGlobal['text-size'] = '14', etc...)
\r
12 public $captionCollection = array(); // The collection of Caption objects
\r
15 * Class Constructor
\r
17 public function __construct()
\r
20 * empty for now... (we don't know what the caption will contain...)
\r
21 * It seems logical and much more practical
\r
22 * to create first an empty CaptionCollection
\r
23 * and then add to it as needed,
\r
24 * finally, get the collection object
\r
29 * Adds a Caption Object to the $captionCollection array
\r
30 * @param Object $theCcObject a Caption Object
\r
33 public function addCaption($theCcObject)
\r
35 // add Caption to the Caption Collection
\r
36 $this->captionCollection[] = $theCcObject; // this a php-based approach... java will need a push/count solution
\r
38 } // end addCaptions()
\r
41 * Sets all the Global text style attributes
\r
42 * @param Array $theGlobalStyles Array containing all the global text styles
\r
44 public function setTxtStylesGlobal($theGlobalStyles)
\r
46 $this->txtStylesGlobal = $theGlobalStyles;
\r
50 * Sets the value of a single Global text style attribute
\r
51 * @param String $theAtt Attribute name
\r
52 * @param String $theValue Attribute Value
\r
54 public function setTxtStylesGlobalAtt($theAtt,$theValue)
\r
56 $this->txtStylesGlobal[$theAtt]=$theValue;
\r
57 } // end setTxtStylesGlobalAtt()
\r
60 * Sets the collection Name
\r
62 * @param String $theCollectionName
\r
64 public function setCollectionName($theCollectionName)
\r
66 $this->collectionName = $theCollectionName;
\r
70 * Gets Collection Name
\r
72 * @return String $collectionName
\r
74 public function getCollectionName()
\r
76 return $this->collectionName;
\r
80 * Returns this CaptionCollection object
\r
82 * @return CaptionCollection
\r
84 public function getCollection()
\r
86 return $this->captionCollection;
\r
89 public function toString()
\r
92 echo '<br/><h3>Collection Name: '.$this->getCollectionName().'</h3>';
\r
93 echo 'Total Captions Found: '.count($this->captionCollection);
\r
95 if (count($this->txtStylesGlobal)!=0)
\r
97 echo '<br/><br/><b>[Global] Styles</b>';
\r
99 foreach ($this->txtStylesGlobal as $txtStyleName => $txtStyleValue)
\r
101 echo '<br/> -----'.$txtStyleName.' = '.$txtStyleValue;
\r
105 echo '<br/><br/><b>Printing Captions in the collection... </b>';
\r
107 foreach ($this->captionCollection as $captionObj)
\r
111 // call Caption's toString();
\r
112 echo '<br/><br/>'.$ccCount;
\r
113 $captionObj->toString();
\r
119 } // end CaptionCollection Class
\r