Source for file WMultiCollection.class.php

Documentation is available at WMultiCollection.class.php

  1. <?php
  2. /**
  3. * @since 8/15/2006
  4. * @package polyphony.guiwizardcomponents
  5. *
  6. * @copyright Copyright &copy; 2006, Middlebury College
  7. * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
  8. *
  9. * @version $Id: WMultiCollection.class.php,v 1.3 2007/09/19 14:04:45 adamfranco Exp $
  10. */
  11.  
  12.  
  13.  
  14. /**
  15. * This class allows for the modification of the layout of a font.
  16. *
  17. * @since 8/09/2006
  18. * @package polyphony.guiwizardcomponents
  19. *
  20. * @copyright Copyright &copy; 2006, Middlebury College
  21. * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
  22. *
  23. * @version $Id: WMultiCollection.class.php,v 1.3 2007/09/19 14:04:45 adamfranco Exp $
  24. */
  25.  
  26. class WMultiCollection
  27. extends WMoreOptions
  28. {
  29.  
  30.  
  31.  
  32. var $_callBack;
  33. var $_uniqueName;
  34. var $_thingsToApplyCollectionsTo;
  35.  
  36.  
  37. var $_shown;
  38. var $_descriptions;
  39.  
  40.  
  41. /**
  42. * It is important to know that the $thingsToApplyCollectionTo is an array
  43. * of arrays. Each array should have two elements--an index at 'index', and
  44. * a type at 'type.' types might be MENU, BLOCK, HEADING and so forth.
  45. *
  46. * The last three are booleans. False means they are hidden under "More Options."
  47. */
  48. function WMultiCollection ($callBack, $uniqueName, $thingsToApplyCollectionsTo,$font,$bg,$text) {
  49.  
  50. $this->init();
  51.  
  52.  
  53.  
  54.  
  55. $comp = new WFontEditor($callBack, $uniqueName."_font", $thingsToApplyCollectionsTo);
  56. $this->addComponent("font",$comp);
  57. $comp = new WTextLayoutEditor($callBack, $uniqueName."_font", $thingsToApplyCollectionsTo);
  58. $this->addComponent("text",$comp);
  59. $comp = new WBackgroundEditor($callBack, $uniqueName."_font", $thingsToApplyCollectionsTo);
  60. $this->addComponent("bg",$comp);
  61.  
  62.  
  63. if($font){
  64. $arr[] = "font";
  65. }
  66. if($bg){
  67. $arr[] = "bg";
  68. }
  69. if($text){
  70. $arr[] = "text";
  71. }
  72. $this->_shown = $arr;
  73.  
  74.  
  75. $this->_descriptions =array("font"=>"Font Options:","text"=>"Text Options:","bg"=>"Background Options");
  76.  
  77.  
  78. }
  79.  
  80.  
  81.  
  82.  
  83. /**
  84. * Returns a block of XHTML-valid code that contains markup for this specific
  85. * component.
  86. * @param string $fieldName The field name to use when outputting form data or
  87. * similar parameters/information.
  88. * @access public
  89. * @return string
  90. */
  91. function getMarkup ($fieldName) {
  92.  
  93.  
  94. $s="";
  95.  
  96. $s.="\n<table border='0' width='100%'>";
  97. $s.="\n\t<tr><td>";
  98.  
  99.  
  100.  
  101. $s.="\n<table border='0' width='100%' cellpadding='5'>";
  102.  
  103. //do we actually need the MoreOptions functions?
  104. if(count($this->_descriptions) > count($this->_shown)){
  105. $needsMore = true;
  106. }else{
  107. $needsMore = false;
  108. }
  109.  
  110.  
  111. foreach(array_keys($this->_descriptions) as $name){
  112. if(!in_array($name,$this->_shown))
  113. continue;
  114.  
  115. $s.="\n\t<tr>";
  116. $s.="\t\t<td>".$this->_descriptions[$name]."</td>";
  117. $comp =$this->getChild($name);
  118. $s.="\n\t\t<td>".$comp->getMarkup($fieldName."_".$name)."</td>";
  119. $s.="\n\t</tr>";
  120. }
  121.  
  122.  
  123. if($needsMore){
  124. $s.="\n\t\t<tr><td>&nbsp;</td><td>More Options: ".$this->getCheckboxMarkup($fieldName)."</td></tr>";
  125. }
  126.  
  127.  
  128. $s.="\n</table>";
  129.  
  130. $s.="\n\t</td></tr>";
  131. if($needsMore){
  132. $s.= "<tr><td align='right'>";
  133. $s.= $this->getOptionalComponentsMarkup($fieldName);
  134. $s.="\n\t</td></tr>";
  135. }
  136. $s.= "</table>";
  137.  
  138.  
  139.  
  140. return $s;
  141. }
  142.  
  143.  
  144. /**
  145. * Returns a block of XHTML-valid code that contains markup for the "advanced"
  146. * options.
  147. * @param string $fieldName The field name to use when outputting form data or
  148. * similar parameters/information.
  149. * @access public
  150. * @return string
  151. */
  152. function advancedMarkup ($fieldName) {
  153. $s="";
  154.  
  155.  
  156. $s.="\n<table border='0' width='100%' cellpadding='5'>";
  157.  
  158.  
  159. foreach(array_keys($this->_descriptions) as $name){
  160. if(in_array($name,$this->_shown))
  161. continue;
  162.  
  163. $s.="\n\t<tr>";
  164. $s.="\t\t<td>".$this->_descriptions[$name]."</td>";
  165. $comp =$this->getChild($name);
  166. $s.="\n\t\t<td>".$comp->getMarkup($fieldName."_".$name)."</td>";
  167. $s.="\n\t</tr>";
  168. }
  169.  
  170. $s.="\n</table>";
  171.  
  172.  
  173. return $s;
  174. }
  175.  
  176.  
  177. }
  178.  
  179. ?>

Documentation generated on Wed, 19 Sep 2007 10:28:09 -0400 by phpDocumentor 1.3.0RC3