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 getProjectsArray($projects) { $allProjects = array(); $criteria = new InStatement(); $field = $this->projectDao->getQIdName(); $criteria->setField($field); foreach ($projects as $project) { $criteria->addValue($project); } $order = new OrderBys(); $sortField = $this->projectDao->getQNameName(); $order->addField($sortField, true); $projectsList = $this->projectDao->find($criteria, $order); if (!is_array($projectsList)) { return $allProjects; } $allProjects = $projectsList; /*foreach ($projects as $project){ $getProject = $this->projectDao->get($project); if (is_null($getProject) || is_string($getProject)) continue; $allProjects[$getProject->getId()] = $getProject; }*/ return $allProjects; }