/** * Returns an instance of class (singleton pattern implementation). * * @return CONTACTUS_BOL_DepartmentDao */ public static function getInstance() { if (self::$classInstance === null) { self::$classInstance = new self(); } return self::$classInstance; }
public function invite_re_arrange($inviterId, $inviteeId) { $ex = new OW_Example(); $ex->andFieldEqual('inviterId', $inviterId)->andFieldEqual('inviteeId', $inviteeId)->andFieldEqual('client_status', HAMMU_BOL_Service::STATUS_ACTIVE); /** * @var HAMMU_BOL_Invites $dto */ $dto = $this->findObjectByExample($ex); if (empty($dto)) { return; } $dto->setClientStatus(HAMMU_BOL_Service::STATUS_PENDING); $this->save($dto); $timestamp = $dto->getTimestamp(); //saving invite log Log HAMMU_BOL_InvitesLogDao::getInstance()->saveInviteLog($dto->getId(), $inviterId, $inviteeId, HAMMU_BOL_InvitesLogDao::VAL_INVITATION_CLIENT_RE_ARRANGE); $rarray = array("timestamp" => $timestamp); return $rarray; }
public function reject($inviterId, $inviteeId, $id, $meeting_date) { $ex = new OW_Example(); $ex->andFieldEqual('inviterId', $inviterId)->andFieldEqual('inviteeId', $inviteeId)->andFieldEqual('client_status', HAMMU_BOL_Service::STATUS_ACCEPT_DATE)->andFieldEqual('escort_status', HAMMU_BOL_Service::STATUS_ACTIVE)->andFieldEqual('escort_decline', HAMMU_BOL_Service::STATUS_PENDING)->andFieldEqual('client_decline', HAMMU_BOL_Service::STATUS_PENDING); $dto = $this->findObjectByExample($ex); // print_r($dto); // exit; if (empty($dto)) { return; } $dto->setEscortStatus(HAMMU_BOL_Service::STATUS_IGNORED); $dto->setClientStatus(HAMMU_BOL_Service::STATUS_IGNORED); $this->save($dto); $timestamp = $dto->getTimestamp(); //saving invite log Log $ex1 = new OW_Example(); $ex1->andFieldEqual('id', $id); $log_dto = HAMMU_BOL_InvitesLogDao::getInstance()->findObjectByExample($ex1); $log_dto->setFlag('1'); $propose_date = strtotime($meeting_date); $final_date = array("date" => $propose_date); $decline_date = json_encode($final_date); HAMMU_BOL_InvitesLogDao::getInstance()->save($log_dto); HAMMU_BOL_InvitesLogDao::getInstance()->saveInviteLog($dto->getId(), $inviterId, $inviteeId, HAMMU_BOL_InvitesLogDao::VAL_INVITATION_REJECTION, $decline_date, HAMMU_BOL_InvitesLogDao::VAL_REJECTION_ESCORT, HAMMU_BOL_InvitesLogDao::VAL_REJECTION_CLIENT); $rarray = array("timestamp" => $timestamp); return $rarray; }
private function __construct() { $this->invitesDao = HAMMU_BOL_InvitesDao::getInstance(); $this->invitesLogDao = HAMMU_BOL_InvitesLogDao::getInstance(); }
public function get_location($inviterId, $inviteeId, $id, $addrr) { $ex = new OW_Example(); $ex->andFieldEqual('inviterId', $inviterId)->andFieldEqual('inviteeId', $inviteeId)->andFieldEqual('client_status', HAMMU_BOL_Service::STATUS_CONFIRM)->andFieldEqual('escort_status', HAMMU_BOL_Service::STATUS_ACTIVE)->andFieldEqual('buy_rose_status', HAMMU_BOL_Service::STATUS_ACTIVE); /** * @var HAMMU_BOL_Invites $dto */ $dto = $this->findObjectByExample($ex); if (empty($dto)) { return; } $timestamp = $dto->getTimestamp(); //saving invite log Log $ex1 = new OW_Example(); $ex1->andFieldEqual('id', $id); $log_dto = HAMMU_BOL_InvitesLogDao::getInstance()->findObjectByExample($ex1); // print_r($log_dto); // exit; //saving invite log Log $log_dto->setFlag('1'); HAMMU_BOL_InvitesLogDao::getInstance()->save($log_dto); HAMMU_BOL_InvitesLogDao::getInstance()->saveInviteLog($dto->getId(), $inviterId, $inviteeId, HAMMU_BOL_InvitesLogDao::VAL_INVITATION_MEET_LOCATION, $addrr, HAMMU_BOL_InvitesLogDao::VAL_MEET_LOCATION_ESCORT, HAMMU_BOL_InvitesLogDao::VAL_MEET_LOCATION_CLIENT); $rarray = array("timestamp" => $timestamp); return $rarray; }
/** * Save new invites request * * @param integer $requesterId * @param integer $userId */ public function inviteRequest($inviterId, $inviteeId) { $ex = new OW_Example(); $ex->andFieldEqual('inviterId', $inviterId)->andFieldEqual('inviteeId', $inviteeId); $dto = $this->findObjectByExample($ex); $itWasIgnoredByRequester = $dto !== null; if ($itWasIgnoredByRequester) { // $this->save( // $dto->setStatus('active') // ); return array(); } $dto = new HAMMU_BOL_Invites(); $dto->setInviterId($inviterId)->setInviteeId($inviteeId)->setStatus(HAMMU_BOL_Service::STATUS_PENDING); $dto->timestamp = time(); $this->save($dto); $timestamp = $dto->getTimestamp(); //saving invite log Log HAMMU_BOL_InvitesLogDao::getInstance()->saveInviteLog($dto->getId(), $inviterId, $inviteeId, HAMMU_BOL_InvitesLogDao::VAL_INVITATION_SENT); $rarray = array("timestamp" => $timestamp); return $rarray; //echo "inserted_id->" . $dto->getId(); }