Source for file WNewOnlyEditableRepeatableComponentCollection.class.php

Documentation is available at WNewOnlyEditableRepeatableComponentCollection.class.php

  1. <?php
  2. /**
  3. * @since Aug 1, 2005
  4. * @package polyphony.wizard.components
  5. *
  6. * @copyright Copyright &copy; 2005, Middlebury College
  7. * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
  8. *
  9. * @version $Id: WNewOnlyEditableRepeatableComponentCollection.class.php,v 1.5 2007/09/19 14:04:51 adamfranco Exp $
  10. */
  11.  
  12. /**
  13. * This component allows for the creation of repeatable components or groups of
  14. * components. Only the newly added comonents are editable. Existing ones can only
  15. * be removed.
  16. *
  17. * @since Aug 1, 2005
  18. * @package polyphony.wizard.components
  19. *
  20. * @copyright Copyright &copy; 2005, Middlebury College
  21. * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
  22. *
  23. * @version $Id: WNewOnlyEditableRepeatableComponentCollection.class.php,v 1.5 2007/09/19 14:04:51 adamfranco Exp $
  24. */
  25.  
  26. class WNewOnlyEditableRepeatableComponentCollection
  27. extends WRepeatableComponentCollection
  28. {
  29. /**
  30. * Adds a collection of {@link WizardComponent}s indexed by field name to the list of collections.
  31. * This is useful when pre-populating the list with old/previous values.
  32. * @param ref array $collection Indexed by field name.
  33. * @param boolean $removable Can this collection be removed by the user?
  34. * @access public
  35. * @return ref array An array of the components created with the values passed.
  36. */
  37. function addValueCollection ($collection, $removable = true) {
  38. // @todo - make sure that the correct fields/classes are represented
  39. $newCollection =$this->_addElement($removable);
  40. foreach (array_keys($newCollection) as $key) {
  41. if (isset($collection[$key]))
  42. $newCollection[$key]->setValue($collection[$key]);
  43. if (!in_array($key, array("_remove", "_add")))
  44. $newCollection[$key]->setEnabled(false, true);
  45. }
  46. return $newCollection;
  47. }
  48. }
  49. ?>

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