protected function dimension()
 {
     //grab the dimension values from the systemref table
     $q = Doctrine_Query::create()->select('s.name')->from('SystemRef s')->where("s.refType = 'dimension'");
     $q->execute();
     $result = $q->execute(array(), Doctrine::HYDRATE_ARRAY);
     //Check for existing record
     $q2 = Doctrine_Query::create()->select('d.orgID')->from('DimensionValue d')->where("d.orgID = ?", $this->getOrgID());
     $q2->execute();
     if ($result2 = $q2->execute(array(), Doctrine::HYDRATE_ARRAY)) {
     } else {
         //insert values into the dimension table
         foreach ($result as $key => $value) {
             //return $key."-".$value['name'];
             //insert into dimension value table
             $dimension = new DimensionValue();
             $dimension->orgID = $this->getOrgID();
             $dimension->dimensionName = $value['name'];
             $dimension->isActive = 1;
             $dimension->rTime = $this->getDateFormat();
             $dimension->rUser = $this->getUserID();
             $dimension->save();
         }
     }
 }
 public function defaultDimensionSetup()
 {
     //grab the weather values from the systemref table
     $q = Doctrine_Query::create()->select('s.name')->from('SystemRef s')->where("s.refType = 'dimension'");
     $q->execute();
     $result = $q->execute(array(), Doctrine::HYDRATE_ARRAY);
     //insert values into the activity table
     foreach ($result as $key => $value) {
         //return $key."-".$value['name'];
         //insert into activitiy value table
         $dimension = new DimensionValue();
         $dimension->orgID = 16;
         $dimension->dimensionName = $value['dimensionName'];
         $dimension->colorCode = $value['colorCode'];
         $dimension->isActive = 1;
         $dimension->rTime = date("d/m/y : H:i:s", time());
         $dimension->rUser = $this->getUserID();
         $dimension->save();
     }
 }