public function update(C3op_Projects_Action $a) { if (!isset($this->identityMap[$a])) { throw new C3op_Projects_ActionMapperException('Object has no ID, cannot update.'); } $sql = sprintf('UPDATE projects_actions SET title = \'%s\', project = %d, done = %d, status = %d, description = \'%s\', subordinated_to = %d, responsible = %d, milestone = %d, requirement_for_receiving = %d WHERE id = %d;', $a->GetTitle(), $a->GetProject(), $a->GetDone(), $a->GetStatus(), $a->GetDescription(), $a->GetSubordinatedTo(), $a->GetResponsible(), $a->GetMilestone(), $a->GetRequirementForReceiving(), $this->identityMap[$a]); try { $this->db->exec($sql); } catch (Exception $e) { throw new C3op_Projects_ActionException("{$sql} failed"); } $this->UpdateDates($a); }
public function GetAllActionsSubordinatedTo(C3op_Projects_Action $action, C3op_Projects_ActionMapper $actionMapper, C3op_Projects_Project $project, C3op_Projects_ProjectMapper $projectMapper) { echo "<hr>entering getallactionssubordinatedto<br>"; echo "action " . $action->GetId() . " - " . $action->GetTitle() . "<br>"; echo "project " . $project->GetId() . "<br>"; $allActionsBelowMe = array(); $actionsIdJustBelowMe = $actionMapper->getActionsSubordinatedTo($action); while (list(, $actionId) = each($actionsIdJustBelowMe)) { $thisAction = $actionMapper->findById($actionId); $actionsJustBelowMe = $this->GetAllActionsSubordinatedTo($thisAction, $actionMapper, $project, $projectMapper); $allActionsBelowMe[] = array("action" => $thisAction, "actionsBelow" => $actionsJustBelowMe); } echo "returning from getallactionssubordinatedto<br>"; echo "action " . $action->GetId() . " - " . $action->GetTitle() . "<br>"; echo "project " . $project->GetId() . "<br>"; print_r($allActionsBelowMe); echo "count allactionsbelowme " . count($allActionsBelowMe) . "<br><hr><br>"; return $allActionsBelowMe; }