public function executeShowClient(sfWebRequest $request) { $this->client = ClientPeer::retrieveByPK($request->getParameter('id')); $c = new Criteria(); $c->addAscendingOrderByColumn(NoteEntryPeer::SERVICE_DATE); // only show entries for current month $c->add(NoteEntryPeer::SERVICE_DATE, mktime(0, 0, 0, date('n'), 1, date('Y')), Criteria::GREATER_EQUAL); $c->addAnd(NoteEntryPeer::SERVICE_DATE, strtotime('+1 MONTH -1 SECOND', mktime(0, 0, 0, date('n'), 1, date('Y'))), Criteria::LESS_EQUAL); $this->entries = $this->client->getNoteEntrys($c); }
public function executeEdit(sfWebRequest $request) { $client = ClientPeer::retrieveByPK($request->getParameter("client_id")); $updating = $request->getParameter("form"); switch ($updating) { case "info": $form = new InfoClientForm($client); $this->bindAndValidateForm($form, $request); $this->renderPartial("Info", array("client" => $client, "InfoForm" => $form)); break; default: break; } return sfView::NONE; }
public function save($con = null) { sfContext::getInstance()->getConfiguration()->loadHelpers(array('Url', 'Object', 'Tag', 'Text', 'PMRender', 'Asset', 'Helper')); $j = new Job(); $j->setEvent($this->getValue("event")); $j->setStartTime($this->getValue("start_time")); $j->setEndTime($this->getValue("end_time")); $j->setDate($this->getValue("date")); $j->setDueDate($this->getValue("due_date")); $j->setAcctNum($this->getValue("acct_num")); $j->setDeptId($this->getValue("dept_id")); $j->setPublicationId($this->getValue("publication_id")); $j->setStreet($this->getValue("street")); $j->setCity($this->getValue("city")); $j->setState($this->getValue("state")); $j->setZip($this->getValue("zip")); if (is_array($this->getValue("photo_type"))) { $j->setPhotoType(implode(", ", $this->getValue("photo_type"))); } else { $j->setPhotoType($this->getValue("photo_type")); } $j->setOther($this->getValue("other")); $j->setQues1($this->getValue("ques1")); $j->setQues2($this->getValue("ques2")); $j->setQues3($this->getValue("ques3")); $j->setContactName($this->getValue("contact_name")); $j->setContactPhone($this->getValue("contact_phone")); $j->setContactEmail($this->getValue("contact_email")); $j->setStatusId(sfConfig::get("app_job_status_pending", 1)); $j->setProjectId($this->getValue("project_id")); $j->save(); $body = "Dear {$this->getValue("name")},\r\n\r\nYour job, {$this->getValue("event")}, has been entered into our system. \r\nIf you wish to track the progress of your job, you may do so at http://jobs.tuftsphoto.com \r\n\r\nThanks for using University Photography; we look forward to working with you! \r\n\r\nThe Tufts Photo Team \r\nUniversity Photography\r\n80 George St., First Floor\r\nMedford, MA 02155\r\nTel: 617.627.4282\r\nFax: 617.627.3549\r\nphoto@tufts.edu\r\n\r\n\r\n" . getJobDetails($j); mail($this->getValue("email") . ", photo@tufts.edu", "University Photography Job #" . $j->getId() . " - " . $j->getEvent(), $body, "From: photo@tufts.edu"); $user = sfContext::getInstance()->getUser(); if ($this->getValue("clientId") > 0 && ($user->hasCredential("client") || $user->hasCredential("admin"))) { $client = ClientPeer::retrieveByPK($this->getValue("clientId")); $j->addClient($client); } // if they are a user lets make them a client if ($user->getProfile()->getUserType()->getId() == sfConfig::get("app_user_type_user")) { $clientProfile = new Client(); $clientProfile->setUserId($user->getProfile()->getId()); $clientProfile->setName($this->getValue("name")); $clientProfile->setDepartment($this->getValue("department")); $clientProfile->setAddress($this->getValue("address")); $clientProfile->setEmail($this->getValue("email")); $clientProfile->setPhone($this->getValue("phone")); $clientProfile->save(); $user->getProfile()->setUserTypeId(sfConfig::get("app_user_type_client")); $user->getProfile()->save(); $user->clearCredentials(); $user->addCredential("client"); } else { if ($user->getProfile()->getUserType()->getId() == sfConfig::get("app_user_type_client")) { $c = new Criteria(); $c->add(ClientPeer::USER_ID, $user->getProfile()->getId()); $clientProfile = ClientPeer::doSelectOne($c); if (is_null($clientProfile)) { $clientProfile = new Client(); } $clientProfile->setUserId($user->getProfile()->getId()); $clientProfile->setName($this->getValue("name")); $clientProfile->setDepartment($this->getValue("department")); $clientProfile->setAddress($this->getValue("address")); $clientProfile->setEmail($this->getValue("email")); $clientProfile->setPhone($this->getValue("phone")); $clientProfile->save(); } } if (isset($clientProfile) && !is_null($clientProfile)) { $j->addClient($clientProfile); } return $j->getId(); }
public function executeRemoveClient(sfWebRequest $request) { $obj = json_decode($request->getParameter("obj"), true); $client = ClientPeer::retrieveByPK($obj["clientId"]); $job = JobPeer::retrieveByPK($obj["viewingJobId"]); if (!is_null($client) && !is_null($job)) { $job->removeClient($client); } $this->renderPartial("clientList", array("job" => $job)); return sfView::NONE; }
public function executeClientSidebar(sfWebRequest $request) { $this->client = ClientPeer::retrieveByPK($request->getParameter('id')); }
public function executeNewSchoolAge(sfWebRequest $request) { $this->title = 'School Age'; $client = ClientPeer::retrieveByPK($request->getParameter('client_id')); if (!($last_cs = $client->getLastService())) { $last_cs = new SchoolAge(); } $client_service = new SchoolAge(); $client_service->setEmployee($last_cs->getEmployee()); $client_service->setStartDate($last_cs->getStartDate()); $client_service->setEndDate($last_cs->getEndDate()); $client_service->setClientId($request->getParameter('client_id')); $this->form = new SchoolAgeForm($client_service); $this->setTemplate('new'); }