Ejemplo n.º 1
0
 function display($tpl = null)
 {
     // Initialise variables.
     $app = JFactory::getApplication();
     $user = JFactory::getUser();
     $userId = $user->get('id');
     $dispatcher = JDispatcher::getInstance();
     $this->print = JRequest::getBool('print');
     $this->state = $this->get('State');
     $this->user = $user;
     $this->user = ideary::getUserInfoById($this->user->id);
     $userextra = Ideary::getExtraUserData($_GET["id"]);
     $this->assignRef('userextra', $userextra);
     $this->userDatafinal = Ideary::getuserData($this->user->id);
     $this->userDatafinal = $this->userDatafinal[0];
     $this->userExtraData = Ideary::getExtraUserData($this->user->id);
     $this->period = isset($_POST['period']) ? $_POST['period'] : 'LAST-WEEK';
     $this->messages = Ideary::getUserMessages($this->user->id);
     $user_followers = Ideary::getUserFollowers($this->user->id);
     $followers = array();
     foreach ($user_followers as $follower) {
         $followers[] = $follower->follower_id;
     }
     $this->user_followers = $followers;
     $this->messages_sent = Ideary::getUserMessagesSent($this->user->id);
     $this->inbox_messages = Ideary::getMessagesOfFollowedUsersByUserId($this->user->id);
     $this->unknown_users_messages = Ideary::getMessagesOfNoFollowedUsersByUserId($this->user->id);
     $this->sent_messages = Ideary::getMessagesSentByUserId($this->user->id);
     Ideary::setAllMailsAsReaded($this->user->id);
     //$this->_prepareDocument();
     parent::display($tpl);
 }
Ejemplo n.º 2
0
 /**
  * Method to display the view.
  *
  * @param	string	$tpl	The template file to include
  * @since	1.6
  */
 public function display($tpl = null)
 {
     // Get the view data.
     $this->data = $this->get('Data');
     $this->form = $this->get('Form');
     $this->state = $this->get('State');
     $this->params = $this->state->get('params');
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode('<br />', $errors));
         return false;
     }
     // Check if a user was found.
     if (!$this->data->id) {
         JError::raiseError(404, JText::_('JERROR_USERS_PROFILE_NOT_FOUND'));
         return false;
     }
     $app = JFactory::getApplication();
     $this->user2 = JFactory::getUser();
     $getUserId = $_GET['user_id'] ? $_GET['user_id'] : $this->user2->id;
     if ($getUserId != $this->user2->id) {
         $app->redirect(JRoute::_('index.php'));
     }
     // Check for layout override
     $active = JFactory::getApplication()->getMenu()->getActive();
     if (isset($active->query['layout'])) {
         $this->setLayout($active->query['layout']);
     }
     $this->user = ideary::getUserInfoById($this->user2->id);
     $this->userData = ideary::getUserById($this->user2->id);
     $resultEN = strpos($this->user->params, 'en-GB');
     $resultES = strpos($this->user->params, 'es-ES');
     $resultPT = strpos($this->user->params, 'pt-BR');
     $userextra = Ideary::getExtraUserData($_GET["id"]);
     if ($resultEN != false && $resultEN != null) {
         $currentlang = 'en-GB';
     } elseif ($resultES != false && $resultES != null) {
         $currentlang = 'es-ES';
     } elseif ($resultPT != false && $resultPT != null) {
         $currentlang = 'pt-BR';
     }
     $this->assignRef('userextra', $userextra);
     $this->assignRef('currentlang', $currentlang);
     $this->userDatafinal = Ideary::getuserData($this->user->id);
     $this->userDatafinal = $this->userDatafinal[0];
     $this->userExtraData = Ideary::getExtraUserData($this->user->id);
     $this->cant_pub = Ideary::getUserCantTexts($this->user->id, 1);
     $this->cant_draft = Ideary::getUserCantTexts($this->user->id, 0);
     if ($_GET["layout"] == "edit") {
         $this->categories = Ideary::getCategories();
         $this->user_interests = Ideary::getUserInterests($this->user->id);
     }
     if ($_GET["layout"] == "userconfiguration") {
         $this->UserNotifSettings = Ideary::getUserNotifSettings($this->user->id);
         if (count($this->UserNotifSettings) > 0) {
             $this->UserNotifSettings = $this->UserNotifSettings[0];
         }
     }
     $pub = $_GET['draft'] == 1 ? 0 : 1;
     $text_type = $pub ? 'published' : 'draft';
     $texts = ideary::getTextsOfUser($this->user->id, $pub, 0, 10);
     $countAlltexts = ideary::getCountTextsByUserId($this->user->id, $pub);
     $this->assignRef('texts', $texts);
     $this->assignRef('countAlltexts', $countAlltexts);
     $this->assignRef('text_type', $text_type);
     //Escape strings for HTML output
     $this->pageclass_sfx = htmlspecialchars($this->params->get('pageclass_sfx'));
     $this->prepareDocument();
     parent::display($tpl);
 }