function renderClientHistory($id) { $criteria = new AndStatement(); $field = $this->eventHistoryDao->getQCidName(); $criteria->addStatement($field . "=" . $id); $order = new OrderBys(); $sortField = $this->eventHistoryDao->getQIdName(); $order->addField($sortField, false); $history = $this->eventHistoryDao->find($criteria, $order, 1000); if (is_null($history) || is_string($history)) { echo '<span class="error">Nepavyko nuskaityti kliento istorijos!</span>'; exit; } $stages = array(); $projects = array(); if (!is_null($history)) { $stages = $this->stageDao->find(null, null, 1000); $projects = $this->projectDao->find(null, null, 1000); } $html = ''; $html .= '<table class="list">'; $html .= '<thead>'; $html .= ' <tr>'; $html .= ' <th>Projektas</th>'; $html .= ' <th>Etapas</th>'; $html .= ' <th>Pakeitimas</th>'; $html .= ' <th>Pakeitimo data</th>'; $html .= ' <th>Etapo pabaigos data</th>'; $html .= ' <th>Komentaras</th>'; $html .= ' <th>Apskaita</th>'; $html .= ' </tr>'; $html .= '</thead>'; $html .= '<tbody>'; foreach ($history as $row) { if (isset($projects[$row->getPid()])) { $project = $projects[$row->getPid()]; $projectName = $project->getName(); } else { $projectName = "-"; } $html .= "<tr>"; $html .= "<td>" . htmlspecialchars($projectName) . "</td>"; $html .= "<td>"; if (isset($stages[$row->getSid()])) { $stage = $stages[$row->getSid()]; $html .= htmlspecialchars($stage->getName()); } else { $html .= "-"; } $html .= "</td>"; $html .= "<td>" . $row->getDescription() . "</td>"; $html .= "<td>" . $row->getR_date() . "</td>"; $html .= "<td>" . (!is_null($row->getValid_date()) ? $this->setDateTimeDisplay($row->getValid_date()) : "") . "</td>" . "<td>" . htmlspecialchars($row->getComment()) . "</td>" . "<td nowrap>" . $row->getBalance() . "</td>" . "</tr>"; } $html .= '</tbody>'; $html .= '</table>'; echo $html; }
function moveClientHistory($oldClient, $newClient) { $criteria = new AndStatement(); $field = $this->eventHistoryDao->getQCidName(); $criteria->addStatement($field . "='" . addslashes($oldClient->getId()) . "'"); $order = new OrderBys(); $sortField = $this->eventHistoryDao->getQIdName(); $order->addField($sortField, true); $clientHistorys = $this->eventHistoryDao->find($criteria, $order, 1000); if (is_null($clientHistorys)) { $this->context->setRequestScopeAttr("error", "Nepavyko nuskaityti kliento istorijos"); return false; } else { if (is_string($clientHistorys)) { $this->context->setRequestScopeAttr("error", "error.dberror"); $this->context->setRequestScopeAttr("errortxt", $clientHistorys); $clientHistorys = null; return false; } } foreach ($clientHistorys as $history) { $history->setId(null); $history->setCid($newClient->getId()); $this->eventHistoryDao->insert($history, true); } return true; }
function renderUsersList($currentUser) { $user_id = $currentUser->getId(); $searchU = $this->context->getRequestAttr("searchU"); $order = new OrderBys(); $sortField = $this->userDao->getQUserName(); $order->addField($sortField, true); $criteria = new AndStatement(); if (!is_null($searchU)) { $field = $this->userDao->getQUserName(); $criteria->addStatement($field . " like '%" . addslashes($searchU) . "%'"); } $users = $this->userDao->find($criteria, $order, 10000); if (!is_array($users)) { $this->context->setRequestScopeAttr("error", "error.dberror"); $this->context->setRequestScopeAttr("errortxt", $users); $users = array(); } $this->context->setRequestScopeAttr("users", $users); $this->context->setFlowScopeAttr("currentUser", $currentUser); $rurls = array(); $rurls["refresh"] = new SimpleUrl(); $this->context->setFlowScopeAttr("backUrl", $rurls["refresh"]->getGetUrl()); $aurls = $this->actionUrls; $texts = $this->texts; $model = $this->context->getModel(); include "./view/usersList.php"; }
function renderGetResponseOutReport() { $order = new OrderBys(); $sortField = $this->getResponseDao->getQIdName(); $order->addField($sortField, false); $data = $this->getResponseDao->find(null, $order, 1000); if (is_null($data)) { $data = null; } else { if (!is_array($data)) { $data = null; } } if (is_null($data)) { exit("Nepavyko sugeneruoti ataskaitos."); } include "./view/getResponseReport.php"; }
function renderHistoryList($currentUser) { $user_id = $currentUser->getId(); $userP = $this->context->getRequestAttr("user"); $projectP = $this->context->getRequestAttr("project"); $userProjects = null; $this->context->setFlowScopeAttr("currentUser", $currentUser); $order = new OrderBys(); $sortField = $this->eventHistoryDao->getQR_dateName(); $order->addField($sortField, false); if (!is_null($userP) && $userP != "0") { $criteriaUsr = new AndStatement(); $field = $this->projectDao->getQOwnerName(); $criteriaUsr->addStatement($field . "='" . addslashes($userP) . "'"); $userProjects = $this->projectDao->find($criteriaUsr, null, 1000); if (!is_array($userProjects)) { $this->context->setRequestScopeAttr("error", "error.dberror"); $this->context->setRequestScopeAttr("errortxt", $userProjects); $userProjects = null; } if (!is_null($userProjects)) { $criteriaIn = new InStatement(); $field = $this->eventHistoryDao->getQPidName(); $criteriaIn->setField($field); foreach ($userProjects as $userProject) { $criteriaIn->addValue($userProject->getId()); } } } $criteria = new AndStatement(); if (!empty($criteriaIn)) { $criteria->addStatement($criteriaIn); } if (!is_null($projectP) && $projectP != "0") { $field = $this->eventHistoryDao->getQPidName(); $criteria->addStatement($field . "='" . addslashes($projectP) . "'"); } $history = $this->eventHistoryDao->find($criteria, $order, 1000); //$history = $this->eventHistoryDao->find((empty($criteriaIn) ? null : $criteriaIn), $order, 1000); $users = $this->userDao->find(null, null, 1000); if (!is_array($users)) { $this->context->setRequestScopeAttr("error", "error.dberror"); $this->context->setRequestScopeAttr("errortxt", $users); $users = array(); } if (!is_array($history)) { $this->context->setRequestScopeAttr("error", "error.dberror"); $this->context->setRequestScopeAttr("errortxt", $history); $history = array(); } $this->context->setRequestScopeAttr("history", $history); $projects = $this->projectDao->find(null, null, 1000); if (!is_array($projects)) { $this->context->setRequestScopeAttr("error", "error.dberror"); $this->context->setRequestScopeAttr("errortxt", $projects); $projects = array(); } $this->context->setRequestScopeAttr("projects", $projects); $stages = $this->stageDao->find(null, null, 1000); if (!is_array($stages)) { $this->context->setRequestScopeAttr("error", "error.dberror"); $this->context->setRequestScopeAttr("errortxt", $stages); $stages = array(); } $this->context->setRequestScopeAttr("stages", $stages); $clients = $this->clientDaol->find(null, null, 1000); if (!is_array($clients)) { $this->context->setRequestScopeAttr("error", "error.dberror"); $this->context->setRequestScopeAttr("errortxt", $clients); $clients = array(); } $this->context->setRequestScopeAttr("clients", $clients); $users = $this->userDao->find(null, null, 1000); if (!is_array($users)) { $this->context->setRequestScopeAttr("error", "error.dberror"); $this->context->setRequestScopeAttr("errortxt", $users); $users = array(); } $this->context->setFlowScopeAttr("users", $users); $rurls = array(); $rurls["refresh"] = new SimpleUrl(); $this->context->setFlowScopeAttr("backUrl", $rurls["refresh"]->getGetUrl()); $aurls = $this->actionUrls; $texts = $this->texts; $model = $this->context->getModel(); include "./view/historyList.php"; }
function getStageID($projectID, $stageNr, $getResponse) { $field = $this->stageDao->getQPidName(); $criteria = new AndStatement(); $criteria->addStatement($field . "=" . $projectID . ""); $order = new OrderBys(); $sortField = $this->stageDao->getQOrderisName(); $order->addField($sortField, true); $stages = $this->stageDao->find($criteria, $order, 1000); if (is_null($stages)) { $stages = null; } else { if (is_string($stages)) { $stages = NULL; } else { if (!is_array($stages)) { $stages = null; } else { if (count($stages) == 0) { $stages = null; } else { if (!isset($stages[$stageNr - 1])) { $stages = null; } } } } } if (is_null($stages)) { $this->setParamPoz($getResponse->getId(), 2, "[09] Nepavyko rasti pirminio etapo"); return false; } return $stages[$stageNr - 1]; }
function getLastStage($projectID) { $criteria = new AndStatement(); $field = $this->stageDao->getQPidName(); $criteria->addStatement($field . "='" . addslashes($projectID) . "'"); $order = new OrderBys(); $sortField = $this->stageDao->getQOrderisName(); $order->addField($sortField, false); $stages = $this->stageDao->find($criteria, $order, 1000); if (!is_array($stages)) { $this->context->setRequestScopeAttr("error", "error.dberror"); $this->context->setRequestScopeAttr("errortxt", $stages); $stages = null; } else { if (count($stages) == 0) { $stages = null; } } if (is_null($stages)) { return false; } return reset($stages); }
function generateEventsForView($clients) { $eventsArray = array(); $IDfield = $this->eventDao->getQIdName(); $Pfield = $this->eventDao->getQPidName(); $Cfield = $this->eventDao->getQCidName(); foreach ($clients as $client) { $criteria = new AndStatement(); $criteria->addStatement($Pfield . "=" . addslashes($client->getPid())); $criteria->addStatement($Cfield . "=" . addslashes($client->getId())); $order = new OrderBys(); $order->addField($IDfield, true); $events = $this->eventDao->find($criteria, $order, 1000); if (!is_array($events)) { $events = null; } else { if (count($events) == 0) { $events = null; } } if (!is_null($events)) { foreach ($events as $event) { if (!isset($eventsArray[$client->getId()])) { $eventsArray[$client->getId()] = array(); } array_push($eventsArray[$client->getId()], $event); } } } return $eventsArray; }