示例#1
0
 public function indexeventBoxDetailAction()
 {
     //		var_dump( htmlspecialchars('⚐') );exit;
     $request = $this->getRequest();
     $page = (int) $request->getRequest('page');
     if ($page < 1) {
         $page = 1;
     }
     $dataEvents = array('start' => JO_Registry::get('config_front_limit') * $page - JO_Registry::get('config_front_limit'), 'limit' => JO_Registry::get('config_front_limit'), 'filter_event_id' => $request->getRequest('event_id'));
     $events = Model_Events::getEvent($dataEvents);
     if (!$events) {
         $this->forward('error', 'error404');
     }
     if ($request->getRequest('comment')) {
         $this->view->comment = true;
     }
     if ($events) {
         $event_id = $events['event_id'];
         $user_id = $events['user_id'];
         $href = "";
         $view = JO_View::getInstance();
         $view->loged = JO_Session::get('user[user_id]');
         $model_images = new Helper_Images();
         $avatar = Helper_Uploadimages::avatar($events, '_D');
         $events['thumb'] = $avatar['image'];
         //$events['avatar'] = $avatar['image'];
         $events['popup'] = $avatar['image'];
         $events['popup_width'] = $avatar['width'];
         $events['popup_height'] = $avatar['height'];
         $events['original_image'] = $avatar['original'];
         $events['date_event'] = Model_Events::cambiafyh_espanol($events['date_event']);
         //$events["sport_category"] = Model_Boards::getCategoryTitle($events["sport_category"]);
         $data = array('start' => JO_Registry::get('config_front_limit') * $page - JO_Registry::get('config_front_limit'), 'limit' => JO_Registry::get('config_front_limit'), 'filter_user_id' => $events["user_id"]);
         $users = Model_Users::getUsers($data);
         if ($users) {
             $events['fullname'] = $users[0]["fullname"];
             $events['descriptionUser'] = $users[0]["description"];
             $avataruser = Helper_Uploadimages::avatar($users[0], '_B');
             $events['avataruser'] = $avataruser['image'];
             $events['href'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $events['user_id']);
             $href = WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $events['user_id']);
         }
         if (JO_Session::get('user[user_id]')) {
             $events['url_like'] = WM_Router::create($request->getBaseUrl() . '?controller=events&action=like&event_id=' . $event_id);
             $events['url_repin'] = WM_Router::create($request->getBaseUrl() . '?controller=events&action=repin&event_id=' . $event_id);
             $events['url_comment'] = WM_Router::create($request->getBaseUrl() . '?controller=events&action=comment&event_id=' . $event_id);
             $events['comment'] = WM_Router::create($request->getBaseUrl() . '?controller=events&action=comment&event_id=' . $event_id);
             $events['edit'] = JO_Session::get('user[user_id]') == $user_id ? WM_Router::create($request->getBaseUrl() . '?controller=events&action=events&event_id=' . $event_id) : false;
         } else {
             $events['url_like'] = $events['url_repin'] = $events['url_comment'] = $events['comment'] = WM_Router::create($request->getBaseUrl() . '?controller=landing');
             $events['edit'] = false;
         }
         $view->event = $events;
         //$this->view->events .= $view->render('boxEventDetail', 'events');
         //$this->view->events .= $view->render('pinboxdetail', 'events');
         $this->view->eventos = $events;
         $this->view->class_contaner = 'persons';
     }
     if ($request->isPost()) {
         $data = $request->getParams();
         $write_comment = $request->getPost('write_comment');
         if (JO_Session::get('user[user_id]') && $request->issetPost('friends') && is_array($request->getPost('friends'))) {
             foreach ($request->getPost('friends') as $user_id => $fullname) {
                 if (Model_Users::isFriendUser($user_id, JO_Session::get('user[user_id]'))) {
                     $profile = WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $user_id);
                     $write_comment = preg_replace('/\\@' . $fullname . '/i', ' <a class="link comment-user-profile" href="' . $profile . '">@' . $fullname . '</a> ', $write_comment);
                 }
             }
         }
         $data['write_comment'] = $write_comment;
         if ($request->isXmlHttpRequest()) {
             if (JO_Session::get('user[user_id]')) {
                 $result = Model_Events::addComment($data, $events['latest_comments'], Model_Users::$allowed_fields);
                 $this->view = JO_View::getInstance()->reset();
                 if ($result) {
                     $avatar = Helper_Uploadimages::avatar($result['user'], '_A');
                     $result['user']['avatar'] = $avatar['image'];
                     $result['user']['profile'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $result['user_id']);
                     $this->view->ok = true;
                     //$result['pin'] = self::getPinStat($event_id);
                     if (JO_Session::get('user[user_id]')) {
                         if (JO_Session::get('user[is_admin]') || JO_Session::get('user[user_id]') == $result['user_id']) {
                             $result['delete_comment'] = WM_Router::create($request->getBaseUrl() . '?controller=events&action=deleteComment&comment_id=' . $result['comment_id']);
                         }
                     }
                     /*
                     if($request) {
                     	Model_History::addHistory($event_info['user_id'], Model_History::COMMENTPIN, $event_id, 0, $request->getPost('write_comment'));
                     
                     	if($event_info['user']['email_interval'] == 1 && $event_info['user']['comments_email']) {
                     		$this->view->user_info = $event_info['user'];
                     		$this->view->text_email = $this->translate('comment your');
                     		$this->view->profile_href = WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . JO_Session::get('user[user_id]'));
                     		$this->view->full_name = JO_Session::get('user[firstname]') . ' ' . JO_Session::get('user[lastname]');
                     		$this->view->event_href = WM_Router::create($request->getBaseUrl() . '?controller=pin&pin_id=' . $event_id );
                     		Model_Email::send(
                     				    	        	$event_info['user']['email'],
                     				    	        	JO_Registry::get('noreply_mail'),
                     				    	        	JO_Session::get('user[firstname]') . ' ' . JO_Session::get('user[lastname]') . ' ' . $this->translate('comment your pin'),
                     				    	        	$this->view->render('comment_pin', 'mail')
                     				    	        );
                     	}
                     	
                     }
                     */
                     $this->view->comment = $result;
                 } else {
                     $this->view->error = $this->translate('There was a problem with the record. Please try again!');
                 }
             } else {
                 $this->view->location = WM_Router::create($request->getBaseUrl() . '?controller=landing');
             }
             echo $this->renderScript('json');
             exit;
         } else {
             if (JO_Session::get('user[user_id]')) {
                 $result = Model_Events::addComment($data, $event_info['latest_comments']);
                 $this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=events&action=indexeventBoxDetail&event_id=' . $event_id));
             } else {
                 $this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=landing'));
             }
         }
     }
     if (!$request->isXmlHttpRequest() && JO_Session::get('user[user_id]')) {
         $history = Model_Events::getTotalFollow(array('sort' => 'ASC', 'order' => 'date_added', 'filter_event_id' => $event_id));
         $model_images = new Helper_Images();
         foreach ($history as $key => $data) {
             if (!isset($data['user']['store'])) {
                 continue;
             }
             $avatar = Helper_Uploadimages::avatar($data['user'], '_A');
             $history[$key]['user']['avatar'] = $avatar['image'];
             $history[$key]['href'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $data['user_id']);
         }
         $this->view->history = $history;
     }
     $this->view->show_buttonswrapper = true;
     $this->view->url_like = WM_Router::create($request->getBaseUrl() . '?controller=events&action=like&event_id=' . $event_id);
     $this->view->url_tweet = WM_Router::create($request->getBaseUrl() . '?controller=events&action=eventboxdetail&event_id=' . $event_id);
     $this->view->url_embed = WM_Router::create($request->getBaseUrl() . '?controller=events&action=embed&event_id=' . $event_id);
     $this->view->url_report = WM_Router::create($request->getBaseUrl() . '?controller=events&action=report&event_id=' . $event_id);
     $this->view->url_email = WM_Router::create($request->getBaseUrl() . '?controller=events&action=email&event_id=' . $event_id);
     $this->view->url_comment = WM_Router::create($request->getBaseUrl() . '?controller=events&action=comment&event_id=' . $event_id);
     //$view->event_url = WM_Router::create( $request->getBaseUrl() . '?controller=events&event_id=' . $event_id );
     $view->event_url = WM_Router::create($request->getBaseUrl() . '?controller=events&action=indexeventBoxDetail?event_id=' . $event_id);
     //$view->login_href = WM_Router::create( $request->getBaseUrl() . '?controller=users&action=login&next=' . urlencode($event['href']) );
     $view->like_event = WM_Router::create($request->getBaseUrl() . '?controller=events&action=like&event_id=' . $event_id . '&userio_id=' . $user_id);
     if (JO_Session::get('user[user_id]')) {
         $view->eventIsLike = Model_Events::isLikeEvent($event_id, JO_Session::get('user[user_id]'));
     }
     $view->editEvent_url = WM_Router::create($request->getBaseUrl() . '?controller=events&action=add?event_id=' . $event_id);
     $view->follow_event = WM_Router::create($request->getBaseUrl() . '?controller=events&action=follow&event_id=' . $event_id . '&userio_id=' . $user_id);
     if (JO_Session::get('user[user_id]')) {
         $view->eventIsFollow = Model_Events::isFollowEvent($event_id, JO_Session::get('user[user_id]'));
     }
     $banners = Model_Banners::getBanners(new JO_Db_Expr("`controller` = '" . $request->getController() . "'"));
     if ($request->isXmlHttpRequest()) {
         $this->view->popup = true;
         echo Helper_Externallinks::fixExternallinks(Helper_Events::returnHtmlDetail($events, $banners));
         $this->noViewRenderer(true);
     } else {
         $this->view->events_details = Helper_Events::returnHtmlDetail($events, $banners);
         JO_Registry::set('events_info', $events);
         $this->view->children = array('header_part' => 'layout/header_part', 'footer_part' => 'layout/footer_part', 'left_part' => 'events/left_part');
     }
 }
示例#2
0
 public function indexAction()
 {
     //		var_dump( htmlspecialchars('⚐') );exit;
     $request = $this->getRequest();
     $pin_id = $request->getRequest('pin_id');
     $pin_info = Model_Pins::getPin($pin_id);
     if (!$pin_info) {
         $this->forward('error', 'error404');
     }
     if ($request->isPost()) {
         $data = $request->getParams();
         $write_comment = $request->getPost('write_comment');
         if (JO_Session::get('user[user_id]') && $request->issetPost('friends') && is_array($request->getPost('friends'))) {
             foreach ($request->getPost('friends') as $user_id => $fullname) {
                 if (Model_Users::isFriendUser($user_id, JO_Session::get('user[user_id]'))) {
                     $profile = WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $user_id);
                     $write_comment = preg_replace('/\\@' . $fullname . '/i', ' <a class="link comment-user-profile" href="' . $profile . '">@' . $fullname . '</a> ', $write_comment);
                 }
             }
         }
         $data['write_comment'] = $write_comment;
         if ($request->isXmlHttpRequest()) {
             if (JO_Session::get('user[user_id]')) {
                 $result = Model_Pins::addComment($data, $pin_info['latest_comments'], Model_Users::$allowed_fields);
                 $this->view = JO_View::getInstance()->reset();
                 if ($result) {
                     $avatar = Helper_Uploadimages::avatar($result['user'], '_A');
                     $result['user']['avatar'] = $avatar['image'];
                     $result['user']['profile'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $result['user_id']);
                     $this->view->ok = true;
                     $result['pin'] = self::getPinStat($pin_id);
                     if (JO_Session::get('user[user_id]')) {
                         if (JO_Session::get('user[is_admin]') || JO_Session::get('user[user_id]') == $result['user_id']) {
                             $result['delete_comment'] = WM_Router::create($request->getBaseUrl() . '?controller=pin&action=deleteComment&comment_id=' . $result['comment_id']);
                         }
                     }
                     if ($request) {
                         Model_History::addHistory($pin_info['user_id'], Model_History::COMMENTPIN, $pin_id, 0, $request->getPost('write_comment'));
                         if ($pin_info['user']['email_interval'] == 1 && $pin_info['user']['comments_email']) {
                             $this->view->user_info = $pin_info['user'];
                             $this->view->text_email = $this->translate('comment your');
                             $this->view->profile_href = WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . JO_Session::get('user[user_id]'));
                             $this->view->full_name = JO_Session::get('user[firstname]') . ' ' . JO_Session::get('user[lastname]');
                             $this->view->pin_href = WM_Router::create($request->getBaseUrl() . '?controller=pin&pin_id=' . $pin_id);
                             Model_Email::send($pin_info['user']['email'], JO_Registry::get('noreply_mail'), JO_Session::get('user[firstname]') . ' ' . JO_Session::get('user[lastname]') . ' ' . $this->translate('comment your pin'), $this->view->render('comment_pin', 'mail'));
                         }
                     }
                     $this->view->comment = $result;
                 } else {
                     $this->view->error = $this->translate('There was a problem with the record. Please try again!');
                 }
             } else {
                 $this->view->location = WM_Router::create($request->getBaseUrl() . '?controller=landing');
             }
             echo $this->renderScript('json');
             exit;
         } else {
             if (JO_Session::get('user[user_id]')) {
                 $result = Model_Pins::addComment($data, $pin_info['latest_comments']);
                 $this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=pin&pin_id=' . $pin_id));
             } else {
                 $this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=landing'));
             }
         }
     }
     $this->view->show_buttonswrapper = true;
     $this->view->url_like = WM_Router::create($request->getBaseUrl() . '?controller=pin&action=like&pin_id=' . $pin_id);
     $this->view->url_tweet = WM_Router::create($request->getBaseUrl() . '?controller=pin&pin_id=' . $pin_id);
     $this->view->url_embed = WM_Router::create($request->getBaseUrl() . '?controller=pin&action=embed&pin_id=' . $pin_id);
     $this->view->url_report = WM_Router::create($request->getBaseUrl() . '?controller=pin&action=report&pin_id=' . $pin_id);
     $this->view->url_email = WM_Router::create($request->getBaseUrl() . '?controller=pin&action=email&pin_id=' . $pin_id);
     $this->view->url_repin = WM_Router::create($request->getBaseUrl() . '?controller=pin&action=repin&pin_id=' . $pin_id);
     $this->view->url_comment = WM_Router::create($request->getBaseUrl() . '?controller=pin&action=comment&pin_id=' . $pin_id);
     $banners = Model_Banners::getBanners(new JO_Db_Expr("`controller` = '" . $request->getController() . "'"));
     if ($request->isXmlHttpRequest()) {
         $this->view->popup = true;
         echo Helper_Externallinks::fixExternallinks(Helper_Pin::returnHtmlDetail($pin_info, $banners));
         $this->noViewRenderer(true);
     } else {
         $this->view->pins_details = Helper_Pin::returnHtmlDetail($pin_info, $banners);
         JO_Registry::set('pin_info', $pin_info);
         $this->view->children = array('header_part' => 'layout/header_part', 'footer_part' => 'layout/footer_part', 'left_part' => 'pin/left_part');
     }
 }
示例#3
0
 public function activatePopupAction()
 {
     //public function activateDetailAction() {
     $request = $this->getRequest();
     //////////// Categories ////////////
     $this->view->categories = array();
     $categories = Model_Categories::getCategories(array('filter_status' => 1));
     foreach ($categories as $category) {
         $category['subcategories'] = Model_Categories::getSubcategories($category['category_id']);
         $this->view->categories[] = $category;
     }
     //////////// Age ////////////
     $this->view->ages = array();
     $ages = Model_Users::getAge();
     $this->view->ages = $ages;
     //////////// Level ////////////
     $this->view->levels = array();
     $levels = Model_Users::getLevel();
     $this->view->levels = $levels;
     $user_data = Model_Users::getActivateUser(JO_Session::get('user[user_id]'));
     $this->view->user_data = $user_data;
     if (JO_Registry::get('isMobile')) {
         $this->view->urlmensajes = WM_Router::create($request->getBaseUrl() . '?controller=users&action=mensajes&user_id=' . $request->getRequest('board_user'));
     }
     //gender
     if ($request->issetPost('gender')) {
         $this->view->gender = $request->getRequest('gender');
     } elseif (isset($user_data['gender'])) {
         $this->view->gender = $user_data['gender'];
     } else {
         $this->view->gender = "";
     }
     //location
     if ($request->issetPost('location')) {
         $this->view->location = $request->getPost('location');
     } elseif (isset($user_data['location'])) {
         $this->view->location = $user_data['location'];
     } else {
         $this->view->location = '';
     }
     //sport category
     if ($request->issetPost('sport_category')) {
         $this->view->sport_category = $request->getPost('sport_category');
         if ($request->getPost('sport_category') != "") {
             $this->view->cat_title = Model_Boards::getCategoryTitle($request->getPost('sport_category'));
         }
     } elseif (isset($user_data['sport_category'])) {
         $this->view->sport_category = $user_data['sport_category'];
         $this->view->cat_title = Model_Boards::getCategoryTitle($user_data['sport_category']);
     } else {
         $this->view->cat_title = '';
         $this->view->sport_category = '';
     }
     //age
     if ($request->issetPost('age')) {
         $this->view->age = $request->getPost('age');
         if ($request->getPost('age') != "") {
             $this->view->age_title = Model_Users::getAgeTitle($request->getPost('age'));
         }
     } elseif (isset($user_data['age'])) {
         $this->view->age = $user_data['age'];
         $this->view->age_title = Model_Users::getAgeTitle($user_data['age']);
     } else {
         $this->view->age_title = '';
         $this->view->age = '';
     }
     //level
     if ($request->issetPost('level')) {
         $this->view->level = $request->getPost('level');
         if ($request->getPost('level') != "") {
             $this->view->level_title = Model_Users::getLevelTitle($request->getPost('level'));
         }
     } elseif (isset($user_data['level'])) {
         $this->view->level = $user_data['level'];
         $this->view->level_title = Model_Users::getLevelTitle($user_data['level']);
     } else {
         $this->view->level_title = '';
         $this->view->level = '';
     }
     //comment
     if ($request->issetPost('comment')) {
         $this->view->comment = $request->getPost('comment');
     } elseif (isset($user_data['comment'])) {
         $this->view->comment = $user_data['comment'];
     } else {
         $this->view->comment = '';
     }
     //$this->view->form_action = WM_Router::create( $request->getBaseUrl() . '?controller=addpin&action=get_images' );
     $this->view->from_url = WM_Router::create($request->getBaseUrl() . '?controller=users&action=activatePopup');
     //$this->view->from_url = WM_Router::create( $request->getBaseUrl() . '?controller=users&action=activateDetail' );
     $this->view->popup_main_box = $this->view->render('activatePopup', 'users');
     //$this->view->popup_main_box = $this->view->render('activateDetail','users');
     if ($request->isPost()) {
         $validate = new Helper_Validate();
         $validate->_set_rules($request->getPost('location'), $this->translate('Location'), 'not_empty;min_length[3];max_length[100]');
         $validate->_set_rules($request->getPost('sport_category'), $this->translate('Category_id1'), 'not_empty;min_length[3];max_length[100]');
         $validate->_set_rules($request->getPost('gender'), $this->translate('Gender'), 'not_empty;min_length[3];max_length[100]');
         $validate->_set_rules($request->getPost('level'), $this->translate('Level'), 'not_empty;min_length[1];max_length[100]');
         //$validate->_set_rules($request->getPost('type_user'), $this->translate('User_type_id'), 'not_empty;min_length[1];max_length[100]');
         if ($validate->_valid_form()) {
             $result = Model_Users::createActivate(JO_Session::get('user[user_id]'), array('user_id' => JO_Session::get('user[user_id]'), 'gender' => $request->getPost('gender'), 'age' => $request->getPost('age'), 'location' => $request->getPost('location') != "Introduce una ubicación" ? $request->getPost('location') : "", 'sport_category' => $request->getPost('sport_category'), 'level' => $request->getPost('level'), 'activate' => $request->getPost('activate'), 'option1' => $request->getPost('option1'), 'option2' => $request->getPost('option2'), 'option3' => $request->getPost('option3'), 'option4' => $request->getPost('option4'), 'option5' => $request->getPost('option5'), 'option6' => $request->getPost('option6'), 'option7' => $request->getPost('option7'), 'option8' => $request->getPost('option8'), 'comment' => $request->getPost('comment')));
             $this->view->successfu_edite = true;
             /*
              if($result) {
              //Model_History::addHistory($user["user_id"], Model_History::COMMENTUSER, $request->getPost('agenda'));
              Model_History::addHistory($request->getPost('user_to'), Model_History::MESSAGEUSER, $result, $request->getPost('board_user'), $request->getPost('text_message'));
              }
             */
         } else {
             $this->view->error = $validate->_get_error_messages();
         }
     }
     $this->view->popup = true;
     echo Helper_Externallinks::fixExternallinks(Helper_User::returnHtmlDetail());
     $this->noViewRenderer(true);
     /*
      if ($this->view->successfu_edite || $this->view->error)
      {
      error_log("error o ok");
      $this->noViewRenderer(true);
      echo $this->view->popup_main_box;
      $this->view->is_popup = true;
     
      }
      /*
      if($request->isXmlHttpRequest()) {
      $this->noViewRenderer(true);
      echo $this->view->popup_main_box;
      $this->view->is_popup = true;
      } else {
      $this->view->is_popup = false;
      $this->view->children = array(
      'header_part' 	=> 'layout/header_part',
      'footer_part' 	=> 'layout/footer_part',
      'left_part' 	=> 'layout/left_part'
      );
      }
     *
     */
 }