private function calc_EndDatefromPrevious($Node) { $SQL = "SELECT * FROM ta_activity_activity WHERE idtm_activity = '" . $Node->idtm_activity . "'"; $Result = ActivityActivityRecord::finder()->findAllBySQL($SQL); $myDate = new DateTime("now"); $FEZ = $myDate->format("Y-m-d"); if (count(ActivityActivityRecord::finder()->findAllBySQL($SQL)) > 0) { foreach ($Result as $Record) { $ActRecord = $this->return_ActivityByPK($Record->pre_idtm_activity); if ($ActRecord != 0) { $this->calc_StartDatenEndDate($ActRecord); //this is the code where me make the recursive walk! $compDate = new DateTime($ActRecord->ttact_enddate); $fcompDate = $compDate->format("Y-m-d"); if ($FEZ <= $fcompDate) { $tempDate = new DateTime($ActRecord->ttact_enddate); $FEZ = $tempDate->format("Y-m-d"); //print_r($FEZ); } } } } return $FEZ; }
public function get_PSPChildren($Node) { $SQL = "SELECT * FROM ta_activity_activity WHERE pre_idtm_activity = '" . $Node->idtm_activity . "'"; $Result = count(ActivityActivityRecord::finder()->findAllBySQL($SQL)); $SSQL = "SELECT * FROM tm_activity WHERE "; $counter = 0; if ($Result >= 1) { foreach (ActivityActivityRecord::finder()->findAllBySQL($SQL) as $Results) { $counter == 0 ? $SSQL .= "idtm_activity = '" . $Results->idtm_activity . "'" : ($SSQL .= " OR idtm_activity = '" . $Results->idtm_activity . "'"); $counter++; } } else { $SSQL .= "idtm_activity = '0'"; } return ActivityRecord::finder()->findAllBySQL($SSQL); }
private function return_RelTypeParents($Node, $CurrentID) { $temp = array(); $SQL = "SELECT * FROM ta_activity_activity WHERE pre_idtm_activity = " . $Node->idtm_activity . " AND idtm_activity =" . $CurrentID; $result = ActivityActivityRecord::finder()->findBySQL($SQL); if (count(ActivityActivityRecord::finder()->findAllBySQL($SQL)) == 1) { $temp['RELTYPE'] = $result->actact_type; $temp['MINZ'] = $result->actact_minz; $temp['MAXZ'] = $result->actact_maxz; $temp['PREID'] = $CurrentID; } else { $temp['RELTYPE'] = 0; $temp['MINZ'] = 0; $temp['MAXZ'] = 0; $temp['PREID'] = 0; } return $temp; }
public function addActivityActivity() { $myRecord = new ActivityActivityRecord(); $myRecord->idtm_activity = $this->edidtm_activity->Text; $myRecord->pre_idtm_activity = $this->ttedidtm_activity->Text; $myRecord->actact_minz = $this->edactact_minz->Text; $myRecord->actact_maxz = $this->edactact_maxz->Text; $myRecord->actact_type = $this->edactact_type->Text; $myRecord->save(); $this->edActivityActivitybindList($this->edidtm_activity->Text); }