protected function createAdvancedSearchCriteria($arr) { $c = new Criteria(); if (strlen($arr['jobStatus'])) { $c->add(JobPeer::STATUS_ID, $arr["jobStatus"]); } if (!is_null($arr["dueDateStart"])) { $c->add(JobPeer::DUE_DATE, $arr["dueDateStart"], Criteria::GREATER_EQUAL); } if (!is_null($arr["dueDateEnd"])) { $c->addAnd(JobPeer::DUE_DATE, $arr["dueDateEnd"], Criteria::LESS_EQUAL); } if (!is_null($arr["shootDateStart"])) { $c->add(JobPeer::DATE, $arr["shootDateStart"], Criteria::GREATER_EQUAL); } if (!is_null($arr["shootDateEnd"])) { $c->addAnd(JobPeer::DATE, $arr["shootDateEnd"], Criteria::LESS_EQUAL); } if (strlen($arr["clientId"])) { $jobIds = JobClientPeer::getJobsByClientId($arr["clientId"]); $c->add(JobPeer::ID, $jobIds, Criteria::IN); } if (strlen($arr["photographerId"])) { $jobIds = JobPhotographerPeer::getJobsByPhotographerId($arr["photographerId"]); $c->addAnd(JobPeer::ID, $jobIds, Criteria::IN); } if ($arr["sortDirection"] == 1) { $c->addDescendingOrderByColumn($arr["sortOn"]); } else { $c->addAscendingOrderByColumn($arr["sortOn"]); } return $c; }
public function executeViewJobs(sfWebRequest $request) { $this->client = $this->getRoute()->getObject(); $ids = JobClientPeer::getJobsByClientId($this->client->getId()); $c = new Criteria(); $c->add(JobPeer::ID, $ids, Criteria::IN); $this->getPager($c, array("route" => "client_view_jobs", "slugOn" => "slug", "slug" => $this->client->getSlug())); }
private function reloadByClient($clientId) { $c = new Criteria(); $this->routeObject = ClientPeer::retrieveByPK($clientId); $ids = JobClientPeer::getJobsByClientId($this->routeObject->getId()); $c->add(JobPeer::ID, $ids, Criteria::IN); $this->route = "client_view_jobs"; $this->propelType = "slug"; $this->renderStatus = true; $this->viewingCaption = " jobs owned by " . $this->routeObject->getName(); return $c; }