Ejemplo n.º 1
0
 public function contactAction()
 {
     $this->view->setRenderLevel(View::LEVEL_ACTION_VIEW);
     if ($this->session->has('auth') && $this->request->hasPost('offer_id')) {
         $offer = Offers::findFirst($this->request->getPost('offer_id'));
         $user = $offer->user;
         $this->view->setVars(array('user_id' => $id = $user->id, 'first_name' => $name = isset($user->first_name) ? $user->first_name : false, 'organization' => $org = isset($user->organization) ? $user->organization : false, 'profession' => $profession = isset($user->profession) ? $user->profession : false, 'phone' => $phone = isset($user->phone) ? $user->phone : false, 'email' => $email = isset($user->email) ? $user->email : false, 'country' => $country = isset($user->country) ? $user->country : false, 'adress' => $adress = isset($user->adress) ? $user->adress : false));
     }
     if ($this->session->has('auth') && $this->request->hasPost('order_id')) {
         $prop = Proposal::findFirst($this->request->getPost('order_id'));
         $user = $prop->user;
         $this->view->setVars(array('user_id' => $id = $user->id, 'first_name' => $name = isset($user->first_name) ? $user->first_name : false, 'organization' => $org = isset($user->organization) ? $user->organization : false, 'profession' => $profession = isset($user->profession) ? $user->profession : false, 'phone' => $phone = isset($user->phone) ? $user->phone : false, 'email' => $email = isset($user->email) ? $user->email : false, 'country' => $country = isset($user->country) ? $user->country : false, 'adress' => $adress = isset($user->adress) ? $user->adress : false));
     }
     if ($this->session->has('auth') && $this->request->hasPost('di_id')) {
         $dial = Dialogs::findFirst($this->request->getPost('di_id'));
         foreach ($dial->user as $users) {
             if ($users->id != $this->session->get('user_id')) {
                 $user = User::findFirst($users->id);
             }
         }
         $this->view->setVars(array('user_id' => $id = $user->id, 'first_name' => $name = isset($user->first_name) ? $user->first_name : false, 'organization' => $org = isset($user->organization) ? $user->organization : false, 'profession' => $profession = isset($user->profession) ? $user->profession : false, 'phone' => $phone = isset($user->phone) ? $user->phone : false, 'email' => $email = isset($user->email) ? $user->email : false, 'country' => $country = isset($user->country) ? $user->country : false, 'adress' => $adress = isset($user->adress) ? $user->adress : false));
     }
     if ($this->session->has('auth') && $this->request->hasPost('user_id')) {
         $user = User::findFirst($this->request->getPost('user_id'));
         $this->view->setVars(array('user_id' => $id = $user->id, 'first_name' => $name = isset($user->first_name) ? $user->first_name : false, 'organization' => $org = isset($user->organization) ? $user->organization : false, 'profession' => $profession = isset($user->profession) ? $user->profession : false, 'phone' => $phone = isset($user->phone) ? $user->phone : false, 'email' => $email = isset($user->email) ? $user->email : false, 'country' => $country = isset($user->country) ? $user->country : false, 'adress' => $adress = isset($user->adress) ? $user->adress : false));
     }
 }
Ejemplo n.º 2
0
 public function commentsAction()
 {
     $this->view->setRenderLevel(View::LEVEL_ACTION_VIEW);
     if ($this->request->hasPost('comm') && $this->request->hasPost('order') && $this->request->isAjax()) {
         $comments = new Comments();
         $comments->proposal_id = $this->request->getPost('order');
         $comments->reciever_id = $this->session->get('user_id');
         $comments->text = $this->request->getPost('comm');
         $comments->creation_date = date("Y-m-d-H-i-s");
         $comments->save();
         $prop = Proposal::findFirst($this->request->getPost('order'));
         foreach ($prop->comments as $comm) {
             $com[$comm->id] = array($comm->user->first_name, $comm->text, $comm->creation_date);
         }
         $this->view->setVars(array('comm' => $com));
     }
 }
Ejemplo n.º 3
0
 public function delorderAction()
 {
     $this->view->disable();
     if ($this->request->hasPost('order') && $this->request->isAjax()) {
         $prop = Proposal::findFirst($this->request->getPost('order'));
         foreach ($prop->dannproposal as $dann) {
             $dann->delete();
         }
         foreach ($prop->favorites as $fav) {
             foreach (ProposalHasFavorites::find(array("proposal_id = {$prop->id}")) as $favs) {
                 $favs->delete();
             }
             $fav->delete();
         }
         foreach ($prop->comments as $comm) {
             $comm->delete();
         }
         $prop->delete();
     }
 }