public static function returnHtml($banners) { if (count($banners)) { static $view = null, $request = null; if ($view === null) { $view = JO_View::getInstance(); } if ($request === null) { $request = JO_Request::getInstance(); } foreach ($banners as $banner) { $banner['html'] = html_entity_decode($banner['html']); $view->banner = $banner; return $view->render('box', 'banners'); } } }
/** * @return JO_View|JO_View */ public function initView() { require_once 'JO/View.php'; if (isset($this->view) && $this->view instanceof JO_View) { return $this->view; } $dir = $this->getFrontController()->getDispatchDirectory(); $baseDir = dirname($dir) . DIRECTORY_SEPARATOR . 'views'; if (!file_exists($baseDir) || !is_dir($baseDir)) { require_once 'JO/Exception.php'; throw new JO_Exception('Missing base view directory ("' . $baseDir . '")'); } require_once 'JO/View.php'; // $this->view = new JO_View(array('basePath' => $baseDir)); $this->view = JO_View::getInstance(array('basePath' => $baseDir))->resetInstance(); return $this->view; }
public static function returnViewIndex($item, $rv_button = false) { $view = JO_View::getInstance(); $request = JO_Request::getInstance(); self::getColectionThumb($item); if ($rv_button) { $item['rv_button'] = $rv_button; $item['rate'] = Model_Collections::isRate($item['id']); //if(!$item['rate'] && JO_Session::get('user_id') == $item['user_id']) $item['rate'] = true; } else { $item['rate'] = true; } $item['userhref'] = WM_Router::create($request->getBaseUrl() . '?controller=users&username='******'&', '-', $item['username'])); if (!isset($item['href'])) { $item['href'] = WM_Router::create($request->getBaseUrl() . '?controller=collections&action=view&collection_id=' . $item['id'] . '&name=' . str_replace('&', '-', $item['name'])); } $view->item = $item; return $view->renderByModule('single_items/collection', 'items', 'themes'); }
public function boardsAction() { $this->setViewChange('index'); $request = $this->getRequest(); $page = (int) $request->getRequest('page'); if ($page < 1) { $page = 1; } $query = $request->getRequest('q'); $this->view->query = $query; $this->view->menuSearch = $this->searchMenu($query); $data = array('start' => JO_Registry::get('config_front_limit') * $page - JO_Registry::get('config_front_limit'), 'limit' => JO_Registry::get('config_front_limit'), 'filter_title' => $query); $this->view->pins = ''; $boards = Model_Boards::getBoards($data); if ($boards) { $view = JO_View::getInstance(); $view->loged = JO_Session::get('user[user_id]'); $view->enable_sort = false; $model_images = new Helper_Images(); foreach ($boards as $board) { $board['href'] = WM_Router::create($request->getBaseUrl() . '?controller=boards&action=view&user_id=' . $board['user_id'] . '&board_id=' . $board['board_id']); $board['thumbs'] = array(); $get_big = false; for ($i = 0; $i < 5; $i++) { $image = isset($board['pins_array'][$i]) ? $board['pins_array'][$i]['image'] : false; if ($image) { if ($get_big) { $size = '_A'; } else { $size = '_C'; $get_big = true; } $data_img = Helper_Uploadimages::pin($board['pins_array'][$i], $size); if ($data_img) { $board['thumbs'][] = $data_img['image']; } else { $board['thumbs'][] = false; } } else { $board['thumbs'][] = false; } } $board['boardIsFollow'] = Model_Users::isFollow(array('board_id' => $board['board_id'])); $board['userFollowIgnore'] = $board['user_id'] != JO_Session::get('user[user_id]'); $board['follow'] = WM_Router::create($request->getBaseUrl() . '?controller=boards&action=follow&user_id=' . $board['user_id'] . '&board_id=' . $board['board_id']); $board['edit'] = false; if ($board['user_id'] == JO_Session::get('user[user_id]') || Model_Boards::allowEdit($board['board_id'])) { $board['userFollowIgnore'] = false; $board['edit'] = WM_Router::create($request->getBaseUrl() . '?controller=boards&action=edit&user_id=' . $board['user_id'] . '&board_id=' . $board['board_id']); } $view->board = $board; $this->view->pins .= $view->render('box', 'boards'); } } if ($request->isXmlHttpRequest()) { echo $this->view->pins; $this->noViewRenderer(true); } else { $this->view->children = array('header_part' => 'layout/header_part', 'footer_part' => 'layout/footer_part'); } }
public function sendWeeklyAction() { $request = $this->getRequest(); $this->view->base_href = $request->getBaseUrl(); $this->view->site_name = JO_Registry::get('site_name'); $this->view->on_facebook = JO_Registry::get('config_on_facebook'); $this->view->site_logo = $this->view->base_href . 'data/images/logo.png'; if (JO_Registry::get('site_logo') && file_exists(BASE_PATH . '/uploads' . JO_Registry::get('site_logo'))) { $this->view->site_logo = $this->view->base_href . 'uploads' . JO_Registry::get('site_logo'); } $this->view->settings = WM_Router::create($this->view->base_href . '?controller=prefs'); $goodies = Model_Pages::getPage(JO_Registry::get('page_goodies')); if ($goodies) { //$this->view->pin_it = WM_Router::create($this->view->base_href . '?controller=pages&action=read&page_id=' . JO_Registry::get('page_goodies')); $this->view->pin_it = 'http://amatteur.com/apps'; } $this->view->pages = array(); $page = Model_Pages::getPage(JO_Registry::get('page_privacy_policy')); if ($page) { $this->view->pages[] = array('title' => $page['title'], 'href' => WM_Router::create($this->view->base_href . '?controller=pages&action=read&page_id=' . JO_Registry::get('page_privacy_policy'))); } $page = Model_Pages::getPage(JO_Registry::get('page_terms')); if ($page) { $this->view->pages[] = array('title' => $page['title'], 'href' => WM_Router::create($this->view->base_href . '?controller=pages&action=read&page_id=' . JO_Registry::get('page_privacy_policy'))); } $histories = Model_History::getHistoryToday(array('week_range' => WM_Date::x_week_range($this->now))); $no_avatar = JO_Registry::get('no_avatar'); if ($histories) { $model_images = new Helper_Images(); /* BOARDS */ $this->view->popular_bards = array(); $populars = Model_Boards::getBoards(array('start' => 0, 'limit' => 6, 'sort' => 'DESC', 'order' => 'boards.total_views', 'where' => new JO_Db_Expr('pins > 4'))); if ($populars) { foreach ($populars as $board) { $board['href'] = WM_Router::create($request->getBaseUrl() . '?controller=boards&action=view&user_id=' . $board['user_id'] . '&board_id=' . $board['board_id']); $board['thumbs'] = array(); $get_big = false; for ($i = 0; $i < 5; $i++) { $image = isset($board['pins_array'][$i]) ? $board['pins_array'][$i]['image'] : false; if ($image) { if ($get_big) { $size = '_A'; } else { $size = '_C'; $get_big = true; } $data_img = call_user_func(array(Helper_Pin::formatUploadModule($board['pins_array'][$i]['store']), 'getPinImage'), $board['pins_array'][$i], $size); if ($data_img) { $board['thumbs'][] = $data_img['image']; } else { $board['thumbs'][] = false; } } else { $board['thumbs'][] = false; } } $board['user'] = Model_Users::getUser($board['user_id']); $board['user']['profile'] = WM_Router::create($this->view->base_href . '?controller=users&action=profile&user_id=' . $board['user_id']); $avatar = Helper_Uploadimages::avatar($board['user'], '_A'); $board['user']['avatar'] = $avatar['image']; $this->view->popular_bards[] = $board; } } /* VIDEO */ // $this->view->video = array(); // $video = Model_Pins::getPins(array( // 'start' => 0, // 'limit' => 1, // 'filter_is_video' => 1 // )); // // if($video) { // foreach($video AS $pin) { // $pin['thumb'] = $model_images->resizeWidth($pin['image'], 194); // $pin['thumb_width'] = $model_images->getSizes('width'); // $pin['thumb_height'] = $model_images->getSizes('height'); // $pin['description'] = Helper_Pin::descriptionFix($pin['description']); // $pin['href'] = WM_Router::create( $request->getBaseUrl() . '?controller=pin&pin_id=' . $pin['pin_id'] ); // // } // } /* HISTORY */ foreach ($histories as $history) { if (!isset($history['store'])) { continue; } $avatar = Helper_Uploadimages::avatar($history, '_B'); $history['avatar'] = $avatar['image']; $history['user_followers'] = WM_Router::create($this->view->base_href . '?controller=users&action=followers&user_id=' . $history['user_id']); $history['profile'] = WM_Router::create($this->view->base_href . '?controller=users&action=profile&user_id=' . $history['user_id']); $history['history_comments_total'] = count($history['history_comments']); $history['history_follow_total'] = count($history['history_follow']); $history['history_like_total'] = count($history['history_like']); $history['history_repin_total'] = count($history['history_repin']); $history['history_event_total'] = count($history['history_event']); /////comments if ($history['history_comments_total']) { foreach ($history['history_comments'] as $k => $v) { if (!isset($v['store'])) { continue; } $avatar = Helper_Uploadimages::avatar($v, '_A'); $history['history_comments'][$k]['avatar'] = $avatar['image']; $history['history_comments'][$k]['profile'] = WM_Router::create($this->view->base_href . '?controller=users&action=profile&user_id=' . $v['user_id']); } } /////follow if ($history['history_follow_total']) { foreach ($history['history_follow'] as $k => $v) { if (!isset($v['store'])) { continue; } $avatar = Helper_Uploadimages::avatar($v, '_A'); $history['history_follow'][$k]['avatar'] = $avatar['image']; $history['history_follow'][$k]['profile'] = WM_Router::create($this->view->base_href . '?controller=users&action=profile&user_id=' . $v['user_id']); } } /////like if ($history['history_like_total']) { foreach ($history['history_like'] as $k => $v) { if (!isset($v['store'])) { continue; } $avatar = Helper_Uploadimages::avatar($v, '_A'); $history['history_like'][$k]['avatar'] = $avatar['image']; $history['history_like'][$k]['profile'] = WM_Router::create($this->view->base_href . '?controller=users&action=profile&user_id=' . $v['user_id']); } } /////repin if ($history['history_repin_total']) { foreach ($history['history_repin'] as $k => $v) { if (!isset($v['store'])) { continue; } $avatar = Helper_Uploadimages::avatar($v, '_A'); $history['history_repin'][$k]['avatar'] = $avatar['image']; $history['history_repin'][$k]['profile'] = WM_Router::create($this->view->base_href . '?controller=users&action=profile&user_id=' . $v['user_id']); } } ////events if ($history['history_event_total']) { foreach ($history['history_event'] as $k => $v) { if (!isset($v['store'])) { continue; } $avatar = Helper_Uploadimages::event($v, '_A'); $history['history_event'][$k]['avatar'] = $avatar['image']; $history['history_event'][$k]['profile'] = WM_Router::create($this->view->base_href . '?controller=users&action=profile&user_id=' . $v['user_id']); } } $this->view->events = array(); $this->view->event = array(); $dataEvents = array('filter_cron' => $history['user_id']); $events = Model_Events::getEvents($dataEvents); if ($events) { foreach ($events as $key => $event) { $href = ""; $view = JO_View::getInstance(); $view->loged = JO_Session::get('user[user_id]'); $model_images = new Helper_Images(); $avatar = Helper_Uploadimages::avatar($event, '_B'); $event['avatar'] = $avatar['image']; $event['thumbs'] = $avatar['image']; $event["sport_category"] = Model_Boards::getCategoryTitle($event["sport_category"]); $data = array('filter_user_id' => $event["user_id"]); $users = Model_Users::getUsers($data); if ($users) { $event['fullname'] = $users[0]["fullname"]; $event['href'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $event['user_id']); $href = WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $event['user_id']); } //$view->boxeventdetail = WM_Router::create($request->getBaseUrl() . '?controller=events&action=boxeventdetail&event_id=' . $event['event_id']); $view->boxeventdetail = WM_Router::create($request->getBaseUrl() . '?controller=events&action=indexeventBoxDetail&event_id=' . $event['event_id']); $this->view->event[] = $event; $view->event = $event; $this->view->events[] = $view->render('boxEvent', 'events'); } } /* PINS */ $likes = Model_History::getHistory(array('history_action' => Model_History::LIKEPIN, 'start' => 0, 'limit' => 30), 'from_user_id', $history['user_id']); $history['pins_likes'] = array(); if ($likes) { $temp = array(); foreach ($likes as $like) { $temp[$like['pin_id']] = $like['pin_id']; } if ($temp) { $pins = Model_Pins::getPins(array('start' => 0, 'limit' => 9, 'filter_id_in' => implode(',', $temp))); if ($pins) { foreach ($pins as $pin) { $image = call_user_func(array(Helper_Pin::formatUploadModule($pin['store']), 'getPinImage'), $pin, '_B'); if ($image) { $pin['thumb'] = $image['image']; $pin['thumb_width'] = $image['width']; $pin['thumb_height'] = $image['height']; } else { continue; } $pin['description'] = Helper_Pin::descriptionFix($pin['description']); $pin['href'] = WM_Router::create($request->getBaseUrl() . '?controller=pin&pin_id=' . $pin['pin_id']); $pin['onto_href'] = WM_Router::create($request->getBaseUrl() . '?controller=boards&action=view&user_id=' . $pin['user_id'] . '&board_id=' . $pin['board_id']); $pin['price_formated'] = WM_Currency::format($pin['price']); $avatar = Helper_Uploadimages::avatar($pin['user'], '_A'); $pin['user']['avatar'] = $avatar['image']; $pin['user']['profile'] = WM_Router::create($this->view->base_href . '?controller=users&action=profile&user_id=' . $pin['user_id']); $pin['via_profile'] = array(); if ($pin['via'] && $pin['user_via']) { $pin['via_profile'] = array('profile' => WM_Router::create($this->view->base_href . '?controller=users&action=profile&user_id=' . $pin['via']), 'fullname' => $pin['user_via']['fullname']); } $history['pins_likes'][] = $pin; } } } } $this->view->history = $history; $html = $this->view->render('sendWeekly', 'crons'); Model_Email::send($history['email'], JO_Registry::get('noreply_mail'), sprintf($this->translate('Weekly %s'), $this->view->site_name), $html); } } }
public static function returnViewIndex($item, $view_name = 'index') { if (!isset($item['module']) || !$item['module']) { return; } $view = JO_View::getInstance(); if (!isset($item['no_items'])) { static $results = array(); $model_images = new Helper_Images(); $request = JO_Request::getInstance(); if (mb_strlen($item['name'], 'UTF-8') > 35) { $item['name'] = JO_Utf8::mb_cut_text($item['name'], 0, 35, ' '); } $item['price'] = WM_Currency::format($item['price']); switch ($view_name) { case 'category': $height = JO_Registry::forceGet($item['module'] . '_items_preview_height'); $item['thumbnail'] = $model_images->resizeWidth($item['theme_preview_thumbnail'], JO_Registry::forceGet($item['module'] . '_items_preview_width')); if (!empty($item['thumbnail'])) { $thumb_size = getimagesize($item['thumbnail']); if ($thumb_size[1] > $height) { $image = new JO_GDThumb($item['thumbnail']); $image->crop(0, 0, $thumb_size[0], $height); $image->save($item['thumbnail']); } } /* CATEGORIES */ $cats = array(); $categories = Model_Categories::getCategoriesByIds($item['categories']); foreach ($categories as $v) { $cats[] = array('name' => $v['name'], 'href' => WM_Router::create($request->getBaseUrl() . '?module=' . $item['module'] . '&controller=categories&category_id=' . $v['id'] . '&name=' . WM_Router::clearName($v['name']))); } $item['categories'] = $cats; break; case 'downloads': $height = JO_Registry::forceGet($item['module'] . '_items_preview_height'); $item['thumbnail'] = $model_images->resizeWidth($item['theme_preview_thumbnail'], JO_Registry::forceGet($item['module'] . '_items_preview_width')); if (!empty($item['thumbnail'])) { $thumb_size = getimagesize($item['thumbnail']); if ($thumb_size[1] > $height) { $image = new JO_GDThumb($item['thumbnail']); $image->crop(0, 0, $thumb_size[0], $height); $image->save($item['thumbnail']); } } $item['rate'] = Model_Items::isRate($item['id']); break; default: $height = JO_Registry::forceGet($item['module'] . '_items_thumb_height'); $item['thumbnail'] = $model_images->resizeWidth($item['theme_preview_thumbnail'], JO_Registry::forceGet($item['module'] . '_items_thumb_width'), $height); if (!empty($item['thumbnail'])) { $thumb_size = getimagesize($item['thumbnail']); if ($thumb_size[1] > $height) { $image = new JO_GDThumb($item['thumbnail']); $image->crop(0, 0, $thumb_size[0], $height); $image->save($item['thumbnail']); } } } $item['href'] = WM_Router::create($request->getBaseUrl() . '?controller=items&item_id=' . $item['id'] . '&name=' . WM_Router::clearName($item['name'])); $item['userhref'] = WM_Router::create($request->getBaseUrl() . '?controller=users&username='******'username'])); } $view->item = $item; return $view->renderByModule('single_items/' . $view_name, 'items', $item['module']); }
public static function returnHtmlDetail() { //XPER: función que carga PIN static $view = null, $model_images = null, $request = null; if ($view === null) { $view = JO_View::getInstance(); } if ($model_images === null) { $model_images = new Helper_Images(); } if ($request === null) { $request = JO_Request::getInstance(); } //$request = $this->getRequest(); //////////// Categories //////////// $view->categories = array(); $categories = Model_Categories::getCategories(array('filter_status' => 1)); foreach ($categories as $category) { $category['subcategories'] = Model_Categories::getSubcategories($category['category_id']); $view->categories[] = $category; } //////////// Age //////////// $view->ages = array(); $ages = Model_Users::getAge(); $view->ages = $ages; //////////// Level //////////// $view->levels = array(); $levels = Model_Users::getLevel(); $view->levels = $levels; $user_data = Model_Users::getActivateUser(JO_Session::get('user[user_id]')); $view->user_data = $user_data; if (JO_Registry::get('isMobile')) { $view->urlmensajes = WM_Router::create($request->getBaseUrl() . '?controller=users&action=mensajes&user_id=' . $request->getRequest('board_user')); } //gender if ($request->issetPost('gender')) { $view->gender = $request->getRequest('gender'); } elseif (isset($user_data['gender'])) { $view->gender = $user_data['gender']; } else { $view->gender = ""; } //location if ($request->issetPost('location')) { $view->location = $request->getPost('location'); } elseif (isset($user_data['location'])) { $view->location = $user_data['location']; } else { $view->location = ''; } //sport category if ($request->issetPost('sport_category')) { $view->sport_category = $request->getPost('sport_category'); if ($request->getPost('sport_category') != "") { $view->cat_title = Model_Boards::getCategoryTitle($request->getPost('sport_category')); } } elseif (isset($user_data['sport_category'])) { $view->sport_category = $user_data['sport_category']; $view->cat_title = Model_Boards::getCategoryTitle($user_data['sport_category']); } else { $view->cat_title = ''; $view->sport_category = ''; } //age if ($request->issetPost('age')) { $view->age = $request->getPost('age'); if ($request->getPost('age') != "") { $view->age_title = Model_Users::getAgeTitle($request->getPost('age')); } } elseif (isset($user_data['age'])) { $view->age = $user_data['age']; $view->age_title = Model_Users::getAgeTitle($user_data['age']); } else { $view->age_title = ''; $view->age = ''; } //level if ($request->issetPost('level')) { $view->level = $request->getPost('level'); if ($request->getPost('level') != "") { $view->level_title = Model_Users::getLevelTitle($request->getPost('level')); } } elseif (isset($user_data['level'])) { $view->level = $user_data['level']; $view->level_title = Model_Users::getLevelTitle($user_data['level']); } else { $view->level_title = ''; $view->level = ''; } //comment if ($request->issetPost('comment')) { $view->comment = $request->getPost('comment'); } elseif (isset($user_data['comment'])) { $view->comment = $user_data['comment']; } else { $view->comment = ''; } //$view->form_action = WM_Router::create( $request->getBaseUrl() . '?controller=addpin&action=get_images' ); //$view->from_url = WM_Router::create( $request->getBaseUrl() . '?controller=users&action=activatePopup' ); $view->from_url = WM_Router::create($request->getBaseUrl() . '?controller=users&action=activateDetail'); //$view->popup_main_box = $view->render('activatePopup','users'); $view->popup_main_box = $view->render('activateDetail', 'users'); return $view->render('activateDetail', 'users'); }
public static function returnHtmlDetail($event, $banners = false) { //XPER: función que carga PIN static $view = null, $model_images = null, $request = null; if ($view === null) { $view = JO_View::getInstance(); } if ($model_images === null) { $model_images = new Helper_Images(); } if ($request === null) { $request = JO_Request::getInstance(); } /* $next_pin = Model_Pins::getNextPin($event['event_id']); if($next_pin) { $view->next_navigation_pin = WM_Router::create( $request->getBaseUrl() . '?controller=pin&event_id=' . $next_pin['event_id'] ); } $prev_pin = Model_Pins::getPrevPin($event['event_id']); if($prev_pin) { $view->prev_navigation_pin = WM_Router::create( $request->getBaseUrl() . '?controller=pin&event_id=' . $prev_pin['event_id'] ); } */ $image = call_user_func(array(self::formatUploadModule($event['store']), 'getEventImage'), $event, '_B'); if ($image) { $event['thumb'] = $image['image']; $event['thumb_width'] = $image['width']; $event['thumb_height'] = $image['height']; $event['original_image'] = $image['original']; } else { JO_Action::getInstance()->forward('error', 'error404'); } $image = call_user_func(array(self::formatUploadModule($event['store']), 'getEventImage'), $event, '_D'); if ($image) { $event['popup'] = $image['image']; $event['popup_width'] = $image['width']; $event['popup_height'] = $image['height']; $event['original_image'] = $image['original']; } else { //JO_Action::getInstance()->forward('error', 'error404'); $image = call_user_func(array(self::formatUploadModule($event['store']), 'getEventImage'), $event, '_B'); if ($image) { $event['popup'] = $image['image']; $event['popup_width'] = $image['width']; $event['popup_height'] = $image['height']; $event['original_image'] = $image['original']; } } $event_description = self::descriptionFix($event['description']); $event['real_description'] = self::descriptionFix($event['description']); $event['description'] = self::descriptionFix($event['description']); $event['href'] = WM_Router::create($request->getBaseUrl() . '?controller=events&action=indexeventBoxDetail&event_id=' . $event['event_id']); //$event['date_event'] = Model_Events::cambiafyh_espanol($event['date_event']); $event["sport_category"] = Model_Boards::getCategoryTitle($event["sport_category"]); $page = (int) $request->getRequest('page'); if ($page < 1) { $page = 1; } $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' => $event["user_id"]); $users = Model_Users::getUsers($data); if ($users) { $event['fullname'] = $users[0]["fullname"]; $event['descriptionUser'] = $users[0]["description"]; $avataruser = Helper_Uploadimages::avatar($users[0], '_B'); $event['avataruser'] = $avataruser['image']; $event['userHref'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $event['user_id']); $href = WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $event['user_id']); } $event['pinmarklet_href'] = WM_Router::create($request->getBaseUrl() . '?controller=pages&action=read&page_id=' . JO_Registry::get('page_pinmarklet')); //$event['onto_href'] = WM_Router::create( $request->getBaseUrl() . '?controller=boards&action=view&user_id=' . $event['user_id'] . '&board_id=' . $event['board_id'] ); //$event['price_formated'] = WM_Currency::format($event['price']); // esto es del autor del evento /* $view->author = $event['user_id']; $avatar = Helper_Uploadimages::avatar($event['user_id'], '_A'); $view->author['avatar'] = $avatar['image']; $view->author['profile'] = WM_Router::create( $request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $event['user_id'] ); * * */ //comentarios $view->comments = array(); if ($event['latest_comments']) { foreach ($event['latest_comments'] as $key => $comment) { if (!isset($comment['user']['store'])) { unset($event['latest_comments'][$key]); continue; } $avatar = Helper_Uploadimages::avatar($comment['user'], '_A'); $comment['user']['avatar'] = $avatar['image']; $comment['user']['profile'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $comment['user_id']); $comment['delete'] = ''; if (!Model_Events::commentIsReported($comment['comment_id'])) { $comment['report'] = WM_Router::create($request->getBaseUrl() . '?controller=events&action=reportComment&comment_id=' . $comment['comment_id']); } else { $comment['report'] = ''; } if (JO_Session::get('user[user_id]')) { if (JO_Session::get('user[is_admin]') || JO_Session::get('user[user_id]') == $comment['user_id']) { $comment['delete'] = WM_Router::create($request->getBaseUrl() . '?controller=events&action=deleteComment&comment_id=' . $comment['comment_id']); } } $view->comments[] = $comment; } } $view->get_user_friends = WM_Router::create($request->getBaseUrl() . '?controller=users&action=friends'); $view->totalFollow = WM_Router::create($request->getBaseUrl() . '?controller=events&action=totalFollow'); // no se pa que vale /* $view->via = array(); $view->via_repin = array(); if($event['via'] && $event['user_via']) { $view->via = array( 'profile' => WM_Router::create( $request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $event['via'] ), 'fullname' => $event['user_via']['fullname'] ); } $view->replin_info = false; if($request->isXmlHttpRequest()) { $view->target_repin = false; if($event['repin_from']) { $event_repin = Model_Pins::getPin($event['repin_from']); if($event_repin) { $view->source = array(); $view->source['source'] = $event_repin['board']; $event['from'] = WM_Router::create( $request->getBaseUrl() . '?controller=boards&action=view&user_id=' . $event_repin['user_id'] . '&board_id=' . $event_repin['board_id'] ); $view->target_repin = true; } else { $view->source = Model_Source::getSource($event['source_id']); } } else { $view->source = Model_Source::getSource($event['source_id']); } } else { $view->source = Model_Source::getSource($event['source_id']); if($event['repin_from']) { $repina = Model_Pins::getPin($event['repin_from']); if($repina) { $view->replin_info = array( 'pin_href' => WM_Router::create( $request->getBaseUrl() . '?controller=pin&event_id=' . $event['repin_from'] ), 'profile' => WM_Router::create( $request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $repina['user_id'] ), 'fullname' => $repina['user']['fullname'] ); } } } if($event['from'] && !preg_match('/^https?:\/\//',$event['from'])) { $event['from'] = 'http://' . $event['from']; } if($event['from_repin'] && !preg_match('/^https?:\/\//',$event['from_repin'])) { $event['from_repin'] = 'http://' . $event['from_repin']; } $event['onto_board'] = $event['onto_board2'] = array(); $event['originally_pinned'] = $event['originally_pinned2'] = array(); */ /* if($request->isXmlHttpRequest()) { $event['onto_board'] = self::getBoardPins($event['board_id']); $event['originally_pinned'] = self::getOriginallyPinned( $event['via']?$event['via']:$event['user_id'] ); } else { $event['onto_board2'] = self::getBoardPins($event['board_id']); $event['originally_pinned2'] = self::getOriginallyPinned( $event['via']?$event['via']:$event['user_id'] ); } if($view->source && $request->isXmlHttpRequest()) { $event['source_pins'] = self::getSourcePins($event['source_id']); } else { $event['source_pins'] = array(); } $event['boardIsFollow'] = Model_Users::isFollow(array( 'board_id' => $event['board_id'] )); $event['userIsFollow'] = Model_Users::isFollowUser($event['user_id']); if($event['via']) { $event['userViaIsFollow'] = Model_Users::isFollowUser($event['via']); } else { $event['userViaIsFollow'] = Model_Users::isFollowUser($event['user_id']); } $event['userFollowIgnore'] = $event['user_id'] == JO_Session::get('user[user_id]'); $event['userViaFollowIgnore'] = ($event['via']?$event['via']:$event['user_id']) == JO_Session::get('user[user_id]'); $view->follow = WM_Router::create( $request->getBaseUrl() . '?controller=boards&action=follow&user_id=' . $event['user_id'] . '&board_id=' . $event['board_id'] ); $view->follow_user = WM_Router::create( $request->getBaseUrl() . '?controller=users&action=follow&user_id=' . $event['user_id'] ); if($event['via']) { $view->follow_user_via = WM_Router::create( $request->getBaseUrl() . '?controller=users&action=follow&user_id=' . $event['via'] ); } else { $view->follow_user_via = WM_Router::create( $request->getBaseUrl() . '?controller=users&action=follow&user_id=' . $event['user_id'] ); } $view->get_user_friends = WM_Router::create( $request->getBaseUrl() . '?controller=users&action=friends' ); if(JO_Session::get('user[user_id]')) { $view->enable_follow = $event['user_id'] != JO_Session::get('user[user_id]'); } else { $view->enable_follow = false; } */ if (JO_Session::get('user[user_id]')) { $event['url_like'] = WM_Router::create($request->getBaseUrl() . '?controller=events&action=like&event_id=' . $event['event_id']); $event['url_repin'] = WM_Router::create($request->getBaseUrl() . '?controller=events&action=repin&event_id=' . $event['event_id']); $event['url_comment'] = WM_Router::create($request->getBaseUrl() . '?controller=events&action=comment&event_id=' . $event['event_id']); $event['comment'] = WM_Router::create($request->getBaseUrl() . '?controller=events&action=comment&event_id=' . $event['event_id']); $event['edit'] = JO_Session::get('user[user_id]') == $event['user_id'] ? WM_Router::create($request->getBaseUrl() . '?controller=events&action=events&event_id=' . $event['event_id']) : false; } else { $event['url_like'] = $event['url_repin'] = $event['url_comment'] = $event['comment'] = WM_Router::create($request->getBaseUrl() . '?controller=landing'); $event['edit'] = false; } /* $likes = self::getPinLikes($event['event_id']); $event['likes'] = $likes['data']; $event['likes_total'] = $likes['total']; $event['repins'] = self::getRePins($event['event_id']); $event['pinIsReported'] = Model_Pins::pinIsReported($event['event_id']); $date_dif = array_shift( WM_Date::dateDiff($event['date_added'], time()) ); $event['date_dif'] = $date_dif; */ $view->loged = JO_Session::get('user[user_id]'); $view->owner = JO_Session::get('user[user_id]') == $event["user_id"]; $view->site_name = JO_Registry::get('site_name'); if ($view->loged) { $avatar = Helper_Uploadimages::avatar(JO_Session::get('user'), '_A'); $view->self_avatar = $avatar['image']; $view->self_profile = WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $view->loged); $view->self_fullname = JO_Session::get('user[firstname]') . ' ' . JO_Session::get('user[lastname]'); } /* if($event['is_video']) { $auto = new Helper_AutoEmbed(); if( $event['repin_from'] && $auto->parseUrl($event['from_repin']) ) { $auto->setWidth('100%'); $auto->setHeight('350'); $event['video_code'] = $auto->getEmbedCode(); $attr = $auto->getObjectAttribs(); $event['thumb_width'] = $attr['width']; $event['thumb_height'] = $attr['height']; } else { if( $auto->parseUrl($event['from']) ) { $auto->setWidth('100%'); $auto->setHeight('350'); $event['video_code'] = $auto->getEmbedCode(); $attr = $auto->getObjectAttribs(); $event['thumb_width'] = $attr['width']; $event['thumb_height'] = $attr['height']; } else { $event['is_video'] = false; } } } else { $auto = new Helper_AutoEmbed(); if( $event['repin_from'] && $auto->parseUrl($event['from_repin']) ) { $auto->setWidth('100%'); $auto->setHeight('350'); $event['video_code'] = $auto->getEmbedCode(); $attr = $auto->getObjectAttribs(); $event['thumb_width'] = $attr['width']; $event['thumb_height'] = $attr['height']; $event['is_video'] = true; } else if( $auto->parseUrl($event['from']) ) { $auto->setWidth('100%'); $auto->setHeight('350'); $event['video_code'] = $auto->getEmbedCode(); $attr = $auto->getObjectAttribs(); $event['thumb_width'] = $attr['width']; $event['thumb_height'] = $attr['height']; $event['is_video'] = true; } else { $event['is_video'] = false; } } */ $view->event_url = WM_Router::create($request->getBaseUrl() . '?controller=events&action=indexeventBoxDetail&event_id=' . $event['event_id']); //WM_Router::create( $request->getBaseUrl() . '?controller=events&event_id=' . $event['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['event_id'] . '&userio_id=' . $event['user_id']); $view->eventIsLike = Model_Events::isLikeEvent($event['event_id'], JO_Session::get('user[user_id]')); $view->editEvent_url = WM_Router::create($request->getBaseUrl() . '?controller=events&action=add?event_id=' . $event['event_id']); $view->follow_event = WM_Router::create($request->getBaseUrl() . '?controller=events&action=follow&event_id=' . $event['event_id'] . '&userio_id=' . $event['user_id']); $view->eventIsFollow = Model_Events::isFollowEvent($event['event_id'], JO_Session::get('user[user_id]')); //Model_Pins::updateViewed($event['event_id']); JO_Layout::getInstance()->meta_title = $event['eventname'] . ' - ' . strip_tags(html_entity_decode($event_description)); JO_Layout::getInstance()->placeholder('pin_url', $view->event_url); JO_Layout::getInstance()->placeholder('pin_description', $event_description); $params = array(); $params['content'] = html_entity_decode($event_description . ' ' . $event['eventname'], ENT_QUOTES, 'UTF-8'); //page content $keywords = new WM_Keywords($params); $get_keywords = $keywords->get_keywords(); if ($get_keywords) { JO_Layout::getInstance()->placeholder('keywords', $get_keywords); } JO_Layout::getInstance()->placeholder('pin_image', $event['thumb']); JO_Layout::getInstance()->placeholder('board_title', $event['eventname']); /* $view->banners = array(); if($banners) { foreach($banners AS $banner1) { foreach($banner1 AS $e) { $e['html'] = html_entity_decode($e['html']); $view->banners[] = $e; } } } */ $view->event = $event; return $view->render('eventBoxDetail', 'events'); }
public function __construct(JO_View $view) { $this->data = JO_Json::encode($view->getAll()); }
public function likeAction() { $request = $this->getRequest(); $pin_id = $request->getRequest('pin_id'); $pin = Model_Pins::getPin($pin_id, Model_Users::$allowed_fields); if (!$pin) { $this->forward('error', 'error404'); } if ($request->isXmlHttpRequest()) { if (!(int) JO_Session::get('user[user_id]')) { $this->view->location = WM_Router::create($request->getBaseUrl() . '?controller=landing'); } else { if (Model_Pins::pinIsLiked($pin_id)) { $result = Model_Pins::unlikePin($pin_id); $this->view = JO_View::getInstance()->reset(); if ($result) { Model_History::addHistory($pin['user_id'], Model_History::UNLIKEPIN, $pin_id); $this->view->pin = self::getPinStat($pin_id); $this->view->ok = $this->translate('Like'); $this->view->classs = 'remove'; } else { $this->view->error = true; } } else { $result = Model_Pins::likePin($pin_id); $this->view = JO_View::getInstance()->reset(); if ($result) { Model_History::addHistory($pin['user_id'], Model_History::LIKEPIN, $pin_id); if ($pin['user']['email_interval'] == 1 && $pin['user']['likes_email']) { $this->view->user_info = $pin['user']; $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->text_email = $this->translate('like your'); $this->view->pin_href = WM_Router::create($request->getBaseUrl() . '?controller=pin&pin_id=' . $pin_id); $result = Model_Email::send($pin['user']['email'], JO_Registry::get('noreply_mail'), JO_Session::get('user[firstname]') . ' ' . JO_Session::get('user[lastname]') . ' ' . $this->translate('like your pin'), $this->view->render('like_pin', 'mail')); } $this->view->pin = self::getPinStat($pin_id); $this->view->ok = $this->translate('Unlike'); $this->view->classs = 'add'; } else { $this->view->error = true; } } } echo $this->renderScript('json'); } else { if (!(int) JO_Session::get('user[user_id]')) { $this->redirect(WM_Router::create($request->getBaseUrl() . '?controller=landing')); } } }
/** * @param array $options */ public function __construct($options = array()) { foreach ($options as $name => $value) { $method = 'set' . $name; if (method_exists($this, $method)) { $this->{$method}($value); } } self::$optionsInstance = $options; }
public function indexAction() { /* $request = $this->getRequest(); if($request->isPost()) { if( !$request->getPost('category_id') || count($request->getPost('category_id')) < 1 ) { $this->view->error = true; } else { JO_Session::set('category_id', $request->getPost('category_id')); $this->redirect( WM_Router::create($request->getBaseUrl() . '?controller=welcome&action=second') ); } } $this->helpas(); //////////// Categories //////////// $this->view->categories = array(); $categories = Model_Categories::getCategories(array( 'filter_status' => 1 )); $model_images = new Helper_Images(); foreach($categories AS $category) { if($category['image']) { $category['thumb'] = $model_images->resize($category['image'], 113, 113, true); } else { $category['thumb'] = $model_images->resize(JO_Registry::get('no_avatar'), 113, 113); } $this->view->categories[] = $category; } } function secondAction() { */ $request = $this->getRequest(); $this->helpas(); //$categories = JO_Session::get('category_id'); $userSports = Model_Users::getUserSports(JO_Session::get('user[user_id]')); $categories = array(); foreach ($userSports as $userSport) { $categories[] = $userSport["sport_category"]; } $users = ""; if (!$categories || count($categories) < 1) { $this->view->error = true; Model_Users::edit(JO_Session::get('user[user_id]'), array('first_login' => '0')); } else { JO_Session::set('category_id', $categories); $users = Model_Users::getUsers(array('filter_welcome' => $categories, 'start' => 0, 'limit' => 20)); } /*if(!$users) { JO_Session::clear('category_id'); $this->redirect( WM_Router::create($request->getBaseUrl() . '?controller=welcome') ); } */ $this->view->boards = ''; if ($users) { $view = JO_View::getInstance(); $view->loged = JO_Session::get('user[user_id]'); $model_images = new Helper_Images(); foreach ($users as $key => $user) { $user['thumbs'] = array(); for ($i = 0; $i < min(8, count($user['pins_array'])); $i++) { $image = isset($user['pins_array'][$i]) ? $user['pins_array'][$i]['image'] : false; if (isset($user['pins_array'][$i])) { $image = Helper_Uploadimages::pin($user['pins_array'][$i], '_A'); if ($image) { $user['thumbs'][] = array('thumb' => $image['image'], 'href' => WM_Router::create($request->getBaseUrl() . '?controller=pin&pin_id=' . $user['pins_array'][$i]['pin_id']), 'title' => $user['pins_array'][$i]['title']); } } } $avatar = Helper_Uploadimages::avatar($user, '_B'); $user['avatar'] = $avatar['image']; $user['userLikeIgnore'] = true; if (JO_Session::get('user[user_id]') == $user['user_id']) { $user['userIsFollow'] = 1; $user['userFollowIgnore'] = true; } else { $user['userIsFollow'] = Model_Users::isFollowUser($user['user_id']); if (!$user['userIsFollow']) { $user['userIsFollow'] = Model_Users::FollowUser($user['user_id']); } $user['userFollowIgnore'] = false; } $user['href'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $user['user_id']); $user['pins_href'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=pins&user_id=' . $user['user_id']); $user['follow'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=follow&user_id=' . $user['user_id']); $view->key = $key % 2 == 0; $view->user = $user; $this->view->boards .= $view->render('box', 'users'); } } $this->view->pinmarklet_href = WM_Router::create($request->getBaseUrl() . '?controller=pages&action=read&page_id=' . JO_Registry::get('page_pinmarklet')); //$this->view->direct_path = WM_Router::create( $request->getBaseUrl() . '?direct_path=true' ); if (JO_Registry::get('isMobile')) { $this->view->direct_path = WM_Router::create($request->getBaseUrl()); } else { $this->view->direct_path = WM_Router::create($request->getBaseUrl() . '?controller=guia-rapida'); } }
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'); } }
public function searchAction() { $this->noViewRenderer(true); $request = $this->getRequest(); $response = $this->getResponse(); $page = (int) $request->getRequest('page'); if ($page < 1) { $page = 1; } $callback = $request->getRequest('callback'); if (!preg_match('/^([a-z0-9_.]{1,})$/', $callback)) { $callback = false; } $data = array(); $url = ""; $return = array(); $kind = $request->getRequest('kind'); $query = $request->getRequest('query'); $userId = $request->getRequest('userId'); if ($kind == 0) { // pins $data = array('start' => JO_Registry::get('config_front_limit') * $page - JO_Registry::get('config_front_limit'), 'limit' => JO_Registry::get('config_front_limit'), 'filter_description' => $query, 'filter_marker' => $request->getRequest('marker')); $this->view->pins = ''; $pins = Model_Pins::getPinsAPP($data); if ($pins) { $model_images = new Helper_Images(); foreach ($pins as $pin) { $images = array(); $image = call_user_func(array(Helper_Pin::formatUploadModule($pin['store']), 'getPinImage'), $pin, '_B'); if ($image) { $images['thumb']['src'] = $image['image']; $images['thumb']['width'] = $image['width']; $images['thumb']['height'] = $image['height']; $images['original'] = $image['original']; } $categorias = array(); $categories = Model_Categories::getCategory($pin['category_id']); if ($categories['parent_id'] != 0) { $categorias['category_id'] = $categories['parent_id']; $categorias['subcategory_id'] = $categories['category_id']; } else { $categorias['category_id'] = $categories['category_id']; $categorias['subcategory_id'] = $categories['parent_id']; } $pos = strripos($pin['image'], '.'); $return['data'][] = array('pin_id' => $pin['pin_id'], 'pinFooter' => $pin['description'], 'category_id' => $categorias['category_id'], 'subcategory_id' => $categorias['subcategory_id'], 'pinImage' => substr_replace($pin['image'], '_B.', $pos, 1), 'pinWidth' => $pin['width'], 'pinHeight' => $pin['height'], 'pinUrl' => WM_Router::create($request->getBaseUrl() . '?controller=pin&pin_id=' . $pin['pin_id']), 'userId' => $pin['user_id'], 'username' => $pin['username'], 'avatar' => $pin['avatar'], 'userLike' => $pin['liked'], 'pinVideo' => $pin['from']); } $return['next_page'] = WM_Router::create($request->getBaseUrl() . '?controller=apiv1&action=timeline' . $url); } } else { if ($kind == 1) { //boards $data = array('start' => JO_Registry::get('config_front_limit') * $page - JO_Registry::get('config_front_limit'), 'limit' => JO_Registry::get('config_front_limit'), 'filter_title' => $query); $this->view->pins = ''; $boards = Model_Boards::getBoards($data); if ($boards) { $view = JO_View::getInstance(); $view->loged = JO_Session::get('user[user_id]'); $view->enable_sort = false; $model_images = new Helper_Images(); foreach ($boards as $board) { $board['href'] = WM_Router::create($request->getBaseUrl() . '?controller=boards&action=view&user_id=' . $board['user_id'] . '&board_id=' . $board['board_id']); $board['thumbs'] = array(); $get_big = false; for ($i = 0; $i < 5; $i++) { $image = isset($board['pins_array'][$i]) ? $board['pins_array'][$i]['image'] : false; if ($image) { if ($get_big) { $size = '_A'; } else { $size = '_C'; $get_big = true; } $data_img = Helper_Uploadimages::pin($board['pins_array'][$i], $size); if ($data_img) { $board['thumbs'][] = $data_img['image']; } else { $board['thumbs'][] = false; } } else { $board['thumbs'][] = false; } } $board['boardIsFollow'] = Model_Users::isFollow(array('board_id' => $board['board_id'])); $board['userFollowIgnore'] = $board['user_id'] != JO_Session::get('user[user_id]'); $board['follow'] = WM_Router::create($request->getBaseUrl() . '?controller=boards&action=follow&user_id=' . $board['user_id'] . '&board_id=' . $board['board_id']); $board['edit'] = false; if ($board['user_id'] == JO_Session::get('user[user_id]') || Model_Boards::allowEdit($board['board_id'])) { $board['userFollowIgnore'] = false; $board['edit'] = WM_Router::create($request->getBaseUrl() . '?controller=boards&action=edit&user_id=' . $board['user_id'] . '&board_id=' . $board['board_id']); } $username = Model_Users::getUsername($board["user_id"]); $url_base = WM_Router::create($request->getBaseUrl()); $return['data'][] = array('folderId' => $board['board_id'], 'folderName' => $board['title'], 'folderUrl' => $url_base . $username . "/" . $board['title'], 'folderImage' => $board['image'], 'folderQty' => $board['pins']); //$return[] = $board; } } } else { if ($kind == 2) { //people $data = array('start' => JO_Registry::get('config_front_limit') * $page - JO_Registry::get('config_front_limit'), 'limit' => JO_Registry::get('config_front_limit'), 'filter_username' => $query); $users = Model_Users::getUsers($data); if ($users) { $this->view->follow_user = true; $view = JO_View::getInstance(); $view->loged = JO_Session::get('user[user_id]'); $model_images = new Helper_Images(); foreach ($users as $key => $user) { $avatar = Helper_Uploadimages::avatar($user, '_B'); $user['avatar'] = $avatar['image']; if ($view->loged) { $user['userIsFollow'] = Model_Users::isFollowUser($user['user_id']); $user['userFollowIgnore'] = $user['user_id'] == JO_Session::get('user[user_id]'); } else { $user['userFollowIgnore'] = true; } $user['href'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $user['user_id']); $user['follow'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=follow&user_id=' . $user['user_id']); $return['data'][] = array('userId' => $user['user_id'], 'userName' => $user['username'], 'userDesc' => $user['description'], 'userLocation' => $user['location'], 'avatar' => $user['avatar'], 'follower' => $user['followers'], 'following' => $user['following']); } } } } } if ($callback) { $return = $callback . '(' . JO_Json::encode($return) . ')'; } else { $response->addHeader('Cache-Control: no-cache, must-revalidate'); $response->addHeader('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); $response->addHeader('Content-type: application/json'); $return = JO_Json::encode($return); } $response->appendBody($return); }
public function pinsAction() { $request = $this->getRequest(); $user_data = $this->profileHelp(); $this->setViewChange('profile'); $this->view->active = 'pins'; $page = (int) $request->getRequest('page'); if ($page < 1) { $page = 1; } $this->view->boards = ''; $data = array('start' => JO_Registry::get('config_front_limit') * $page - JO_Registry::get('config_front_limit'), 'limit' => JO_Registry::get('config_front_limit'), 'filter_marker' => $request->getRequest('marker'), 'filter_user_id' => $user_data['user_id']); if ($request->getQuery('filter') == 'likes') { unset($data['filter_user_id']); $data['filter_likes'] = $user_data['user_id']; $this->view->active = 'likes'; } $pins = Model_Pins::getPins($data); if ($pins) { foreach ($pins as $pin) { $this->view->boards .= Helper_Pin::returnHtml($pin); } // JO_Registry::set('marker', Model_Pins::getMaxPin($data)); } if ($request->getQuery('filter') == 'likes') { $events = Model_Events::getEvents($data); if ($events) { $i = 0; foreach ($events as $key => $event) { $this->view->all = false; $href = ""; $view = JO_View::getInstance(); $view->loged = JO_Session::get('user[user_id]'); $model_images = new Helper_Images(); $avatar = Helper_Uploadimages::avatar($event, '_B'); $event['avatar'] = $avatar['image']; $event['original'] = $avatar['original']; $event['width'] = $avatar['width']; $event['height'] = $avatar['height']; $event["sport_category"] = Model_Boards::getCategoryTitle($event["sport_category"]); $event['href'] = WM_Router::create($request->getBaseUrl() . '?controller=events&action=indexeventBoxDetail&event_id=' . $event['event_id']); $href = WM_Router::create($request->getBaseUrl() . '?controller=events&action=indexeventBoxDetail&event_id=' . $event['event_id']); $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' => $event["user_id"]); $users = Model_Users::getUsers($data); if ($users) { $event['fullname'] = $users[0]["fullname"]; $event['hrefuser'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $event['user_id']); //$href = WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $event['user_id']); } //$view->boxeventdetail = WM_Router::create($request->getBaseUrl() . '?controller=events&action=boxeventdetail&event_id=' . $event['event_id']); $view->boxeventdetail = WM_Router::create($request->getBaseUrl() . '?controller=events&action=indexeventBoxDetail&event_id=' . $event['event_id']); $this->view->from_url = WM_Router::create($request->getBaseUrl() . '?controller=addpin&action=fromurl'); $this->view->successfu_edite = false; $view->event = $event; $this->view->boards .= $view->render('boxEventPin', 'events'); $events[$i]["href"] = $href; $eventsTot[] = $events[$i]; $i++; } // JO_Registry::set('marker', Model_Pins::getMaxPin($data)); } } $agendas = Model_Users::getUserAgenda(array('filter_user_id' => $user_data['user_id'])); $this->view->has_agendas = false; $this->view->agendas_users = ""; if ($agendas) { $this->view->has_agendas = true; foreach ($agendas as $agenda) { $agenda['hrefDelete'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=agendaPopupDelete&agenda_id=' . $agenda['agenda_id'] . '&user_id=' . $user_data['user_id']); $this->view->agenda = $agenda; $this->view->agendas_users .= $this->view->render('agenda', 'users'); } } $session_user = JO_Session::get('user[user_id]'); $this->view->popup_agenda = WM_Router::create($request->getBaseUrl() . '?controller=users&action=agendaPopup&user_id=' . $user_data['user_id']); //no mover de esta ubicación $messages = Model_Users::getUserMessages(array('start' => 0, 'limit' => 100, 'filter_user_id' => $user_data['user_id'], 'idPadre' => 0)); $this->view->has_messages = false; $this->view->messages_users = ""; if ($messages) { $this->view->has_messages = true; foreach ($messages as $message) { $avatar = Helper_Uploadimages::avatar($message, '_A'); $message['avatar'] = $avatar['image']; $message['href'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $message['user_id']); $message['hrefDelete'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=messagePopupDelete&message_id=' . $message['message_id'] . '&user_id=' . $user_data['user_id']); $message['hrefResponder'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=messagePopup&user_from=' . $session_user . '&user_to=' . $user_data['user_id'] . '&board_user='******'user_id'] . '&message_from_id=' . $message['message_id']); $this->view->message = $message; $this->view->messages_users .= $this->view->render('message', 'users'); //ahora vamos a consultar las respuestas a este: $messagesHijos = Model_Users::getUserMessages(array('start' => 0, 'limit' => 100, 'filter_user_id' => $user_data['user_id'], 'idPadre' => $message['message_id'])); if ($messagesHijos) { foreach ($messagesHijos as $messageHijo) { $avatar = Helper_Uploadimages::avatar($messageHijo, '_A'); $messageHijo['avatar'] = $avatar['image']; $messageHijo['href'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $messageHijo['user_id']); $messageHijo['hrefDelete'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=messagePopupDelete&message_id=' . $messageHijo['message_id'] . '&user_id=' . $user_data['user_id']); $messageHijo['hrefResponder'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=messagePopup&user_from=' . $session_user . '&user_to=' . $user_data['user_id'] . '&board_user='******'user_id'] . '&message_from_id=' . $messageHijo['message_id']); $this->view->message = $messageHijo; $this->view->messages_users .= $this->view->render('message', 'users'); } } } } $session_user = JO_Session::get('user[user_id]'); $this->view->popup_messages = WM_Router::create($request->getBaseUrl() . '?controller=users&action=messagePopup&user_from=' . $session_user . '&user_to=' . $user_data['user_id'] . '&board_user='******'user_id'] . '&message_from_id=0'); //$this->view->popup_activate = WM_Router::create( $request->getBaseUrl() . '?controller=users&action=activatePopup'); //&user_from=' . $session_user . '&user_to=' . $user_data['user_id'].'&board_user='******'user_id'] .'&message_from_id=0' ); //$this->view->popup_activate = WM_Router::create( $request->getBaseUrl() . '?controller=users&action=activateDetail'); //&user_from=' . $session_user . '&user_to=' . $user_data['user_id'].'&board_user='******'user_id'] .'&message_from_id=0' ); $_SESSION["activate_url"] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . JO_Session::get('user[user_id]')); $this->view->popup_activate = WM_Router::create($request->getBaseUrl() . '?controller=users&action=activate'); $this->view->search_url = WM_Router::create($request->getBaseUrl() . '?controller=search&action=advanced?id=activate'); //$this->view->deportes = WM_Router::create( $request->getBaseUrl() . '?controller=users&action=deportes'); $this->view->addMail = WM_Router::create($request->getBaseUrl() . '?controller=mails&action=create'); $this->view->stateMail = WM_Router::create($request->getBaseUrl() . '?controller=mails&action=state'); $this->view->viewMail = WM_Router::create($request->getBaseUrl() . '?controller=mails&action=view'); $activate = Model_Users::getActivateUser(JO_Session::get('user[user_id]')); if ($activate) { $this->view->userIsActivate = $activate["activate"]; } if ($user_data['type_user']) { $this->view->userCanActivate = Model_Users::getUserTypeNotOthers($user_data['type_user']); } if (JO_Registry::get('isMobile')) { $this->view->urlagenda = WM_Router::create($request->getBaseUrl() . '?controller=users&action=agenda&user_id=' . $user_data['user_id']); $this->view->urlmensajes = WM_Router::create($request->getBaseUrl() . '?controller=users&action=mensajes&user_id=' . $user_data['user_id']); } if ($request->isXmlHttpRequest()) { echo $this->view->boards; $this->noViewRenderer(true); } else { $this->view->children = array('header_part' => 'layout/header_part', 'footer_part' => 'layout/footer_part'); } }
public static function returnFollowing($follower, $owner, $followers = false) { $view = JO_View::getInstance(); $model_images = new Helper_Images(); $request = JO_Request::getInstance(); $list_type = $request->getParam('list_type'); $user = Model_Users::getByUsername($follower['username']); $view->badges = self::userBadges($user); if ($user['avatar']) { $user['avatar'] = $model_images->resize($user['avatar'], JO_Registry::forceGet('user_avatar_width'), JO_Registry::forceGet('user_avatar_height'), true); } else { $user['avatar'] = 'data/themes/images/noavatar.png'; } $user['portfolio_href'] = WM_Router::create($request->getBaseUrl() . '?controller=users&username='******'&', '-', $user['username'])); $log_user = JO_Session::get('user_id'); if ($log_user) { $following = JO_Array::multi_array_search(JO_Session::get('following'), 'follow_id', $user['user_id']); if ($following) { $user['follow_href_name'] = $view->translate('Unfollow'); $user['follow_href'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=unfollow&username='******'&', '-', $user['username'])); } elseif ($log_user != $user['user_id']) { $user['follow_href_name'] = $view->translate('Follow'); $user['follow_href'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=follow&username='******'&', '-', $user['username'])); } } $view->user = $user; $user_items = Model_Items::getByUser($user['user_id'], 0, 3, 'rand()'); if (empty($user_items)) { $user_items = array(array('no_items' => true, 'thumbnail' => 'data/themes/images/missing-item.png', 'module' => 'themes')); } $view->user_items = array(); if ($user_items) { foreach ($user_items as $item) { if (isset($item['demo_url'])) { $item['demo_url'] = WM_Router::create($request->getBaseUrl() . '?controller=demo&href=' . $item['demo_url']); } $view->user_items[] = Helper_Items::returnViewIndex($item); } } return $view->renderByModule('single_user/following', 'users', 'themes'); }