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