/**
  * Preprocess the model to add specific options
  */
 protected function preprocessModel()
 {
     parent::preprocessModel();
     $labeledCols = $this->getLabeledColumns();
     foreach ($labeledCols as $columnName) {
         $options = array();
         $type = $this->model->get($columnName, 'type');
         switch ($type) {
             case \MUtil_Model::TYPE_DATE:
                 $options['excelDateFormat'] = 'dd-mm-yyyy';
                 break;
             case \MUtil_Model::TYPE_DATETIME:
                 $options['excelDateFormat'] = 'dd-mm-yyyy hh:mm:ss';
                 $options['excelCellSize'] = 20;
                 break;
             case \MUtil_Model::TYPE_TIME:
                 $options['excelDateFormat'] = 'hh:mm:ss';
                 break;
             case \MUtil_Model::TYPE_NUMERIC:
                 break;
                 //When no type set... assume string
             //When no type set... assume string
             case \MUtil_Model::TYPE_STRING:
             default:
                 //$type                      = \MUtil_Model::TYPE_STRING;
                 //$options['formatFunction'] = 'formatString';
                 break;
         }
         $options['type'] = $type;
         $this->model->set($columnName, $options);
     }
 }
 /**
  * Preprocess the model to add specific options
  */
 protected function preprocessModel()
 {
     parent::preprocessModel();
     $labeledCols = $this->getLabeledColumns();
     $newColNames = array();
     foreach ($labeledCols as $columnName) {
         $options = array();
         $this->model->remove($columnName, 'dateFormat');
         $type = $this->model->get($columnName, 'type');
         switch ($type) {
             case \MUtil_Model::TYPE_DATE:
                 break;
             case \MUtil_Model::TYPE_DATETIME:
                 break;
             case \MUtil_Model::TYPE_TIME:
                 break;
             case \MUtil_Model::TYPE_NUMERIC:
                 break;
             case \MUtil_Model::TYPE_CHILD_MODEL:
                 break;
                 //When no type set... assume string
             //When no type set... assume string
             case \MUtil_Model::TYPE_STRING:
             default:
                 $type = \MUtil_Model::TYPE_STRING;
                 $options['formatFunction'] = 'formatString';
                 break;
         }
         $options['type'] = $type;
         $this->model->set($columnName, $options);
         if ($multiOptions = $this->model->get($columnName, 'multiOptions')) {
             $keys = array_keys($multiOptions);
             if ($keys == array('Y', 'N') || $keys == array('Y', '')) {
                 $multiOptions = array_reverse($multiOptions);
                 $this->model->set($columnName, 'multiOptions', $multiOptions);
             }
         }
         // A variable name in stata has a max of 32 characters. If it's longer, get a unique shorter version.
         $colName = $this->fixName($columnName);
         if (strlen($colName) > 32) {
             $colName = substr($colName, 0, 32);
             $i = 1;
             while (isset($newColNames[$colName])) {
                 $varLength = 32 - strlen($i);
                 $colName = substr($colName, 0, $varLength) . $i;
             }
         }
         $newColNames[$colName] = true;
         $this->model->set($columnName, 'variableName', $colName);
     }
 }