Example #1
0
 function __construct($filename, array $options = null, array $headermap = null)
 {
     $this->options = arr::defaults((array) $options, array('delimiter' => ',', 'enclosure' => '"', 'escape' => "\\", 'length' => 2048, 'null' => '*NULL*'));
     $this->headermap = $headermap;
     $this->fh = fopen($filename, 'r');
     $this->filesize = filesize($filename);
     $this->timer = new Timer(false);
 }
Example #2
0
    public function __construct($label, $key, Array $items = null, Array $options = null) {
        
        $this->label = $label;
        $this->setKey($key);
        // Here we will do a little check to see if the array we are passed is
        // indexed with a key ( $k => $v ), or if it's simply an array of arrays
        // i.e. a recordset from a database query. If this is the case, we will
        // go over the list and massage it to be indexed with a key.

        if (count($items)>0) {
            if (typeOf($items[0]) == 'array') {
                $newarr = array();
                // Repopulate the list with keys properly assigned
                foreach($items as $item) {
                    $newarr[$item[0]] = $item[1];
                }
                // And update the item list with our newly populated one
                $items = $newarr;
            }
            // Now we update the main list
            $this->items = $items;
        }
        $this->options = arr::defaults($options, array(
            'class' => 'wf-row'
        ));
        
    }
Example #3
0
 /**
  * @brief Add a step to the wizard.
  * 
  * @param IWizardStep $step The step as a IWizardStep instance
  * @param string $key The key of the step (f.ex. 'basic')
  * @param string $name The name of the step (f.ex. 'Basic Information')
  * @param array $options Options for the step
  */
 public function addStep(IWizardStep $step, $key, $name, array $options = null)
 {
     // These are the defaults we will use
     $defaults = array('title' => $name, 'novalidate' => false);
     // Apply the defaults to the options
     $options = arr::defaults($options, $defaults);
     // And add the step with the new options attached
     $this->steps[] = array('step' => $step, 'key' => $key, 'name' => $name, 'options' => $options);
     // Now go over the data for the step to see if it has already been
     // validated and saved. We do this with the initialize method.
     $step->setForm($this);
     $step->initialize($this->getFormToken());
 }