Exemplo n.º 1
0
 /**
  *  Create the dynamic widgets.
  *
  *  This will be called AFTER the _PageDidLoad method... which is what we need to wait for before creating our widgets. WFPage makes this call.
  *
  *  Module code may need to call this function again, particularly if the content of they arrayController is changed by the current action.
  *
  *  @throws A variety of exceptions that can occur from createWidgets or createSelectionWidgets.
  */
 function createWidgets()
 {
     // check inputs
     if (!$this->arrayController instanceof WFArrayController) {
         throw new Exception("arrayController must be a WFArrayController instance.");
     }
     // only set up the widget config once! if we do this more than once, then we blow away any other widget config (ie from a prototype)
     if (!$this->processedWidgetConfig) {
         // create prototype if one doesn't exist
         if (!$this->getPrototype()) {
             $prototype = new WFCheckbox($this->id . 'Prototype', $this->page);
             $prototype->setValueForKey($this->class, 'class');
             $this->setPrototype($prototype);
         }
         // add checkboxes for selection
         $options = array('groupMode' => array('custom' => array('iterate' => false, 'value' => true)), 'checkedValue' => array('custom' => array('iterate' => true, 'keyPath' => '#identifier#')), 'uncheckedValue' => array('custom' => array('iterate' => false, 'value' => '')));
         if ($this->label) {
             $options['label'] = array('custom' => array('iterate' => false, 'value' => $this->label));
         } else {
             if ($this->labelKeyPath) {
                 $options['label'] = array('custom' => array('iterate' => true, 'keyPath' => $this->labelKeyPath));
             }
         }
         $this->setWidgetConfig($options);
         $this->setWidgetClass('WFCheckbox');
         $this->useUniqueNames = false;
     }
     parent::createWidgets();
 }