Ejemplo n.º 1
0
 /**
  *
  */
 public function display($cachable = false, $urlparams = false)
 {
     $document = JFactory::getDocument();
     $viewType = $document->getType();
     $viewName = JRequest::getCmd('view', 'todo');
     $view = StreamFactory::getView($viewName, '', $viewType);
     echo $view->display();
 }
Ejemplo n.º 2
0
 public function display()
 {
     $document = JFactory::getDocument();
     $viewType = $document->getType();
     $viewName = JRequest::getCmd('view', 'direct');
     $view = StreamFactory::getView($viewName, '', $viewType);
     echo $view->display();
 }
Ejemplo n.º 3
0
 public function edit()
 {
     $mainframe = JFactory::getApplication();
     $view = StreamFactory::getView('blog', '', 'html');
     $message_id = JRequest::getVar('message_id');
     // @todo: make sure message id and message type is valid
     $stream = JTable::getInstance('Stream', 'StreamTable');
     $stream->load($message_id);
     $my = JXFactory::getUser();
     if (!$my->authorise('stream.message.edit', $stream)) {
         $mainframe->redirect($stream->getUri(), JText::_('You do not have permission to edit this message'), 'error');
         return;
     }
     // Save blog post
     // @todo: validation
     if (JRequest::getVar('action') == 'save') {
         //	Update attachement there might be addition and removals
         $oldFiles = $stream->getFiles();
         //@todo: validate content
         $errors = array();
         $stream->bind(JRequest::get('POST', JREQUEST_ALLOWRAW));
         $stream->raw = json_encode(JRequest::get('POST', JREQUEST_ALLOWRAW));
         if (empty($_POST['title'])) {
             $errors[] = JText::_('COM_STREAM_BLOG_POST_NO_TITLE');
         }
         if (empty($_POST['message'])) {
             $errors[] = JText::_('COM_STREAM_BLOG_POST_EMPTY');
         }
         if (empty($errors)) {
             $stream->store();
             $mainframe->enqueueMessage(JText::_('COM_STREAM_BLOG_POST_UPDATED'));
             // Delete file attachment that are no longer used
             foreach ($oldFiles as $file) {
                 if (!in_array($file->id, JRequest::getVar('attachment', array()))) {
                     $file->delete();
                 }
             }
             // For all new attachment, we need to set their owner
             $fileModel = StreamFactory::getModel('files');
             $fileModel->updateOwner($stream);
         } else {
             foreach ($errors as $err) {
                 $mainframe->enqueueMessage($err, 'error');
             }
         }
     }
     echo $view->edit($stream);
 }
Ejemplo n.º 4
0
 function display($tpl = null)
 {
     // Reset the stream view count every time we visit this page
     $doc = JFactory::getDocument();
     $my = JXFactory::getUser();
     $lastMessageId = StreamMessage::lastMessageId();
     $groupView = StreamFactory::getView('groups');
     $eventView = StreamFactory::getView('events');
     // Side bar modules
     JXModule::addBuffer('right', $this->modTagsTrendingHTML());
     if (!$my->isExtranetMember()) {
         JXModule::addBuffer('right', $groupView->getNewGroupsHTML($my->getMergedGroupIDs()));
     }
     JXModule::addBuffer('right', $eventView->getUpcomingHTML());
     echo $this->getStreamPostHTML();
     // Post box
     echo $this->getStreamDataHTML();
     // Stream items
 }
Ejemplo n.º 5
0
 public function show()
 {
     $view = StreamFactory::getView('events', '', 'html');
     echo $view->show();
 }
Ejemplo n.º 6
0
 /**
  * Show individual group
  */
 public function show()
 {
     $my = JXFactory::getUser();
     $group_id = JRequest::getVar('group_id');
     $group = JTable::getInstance('Group', 'StreamTable');
     $group->load($group_id);
     // People need to be able to read the group
     // allow also siteadmin and superuser to view the private group content
     if (!$my->isAdmin() && !$my->authorise('stream.group.read', $group)) {
         $app = JFactory::getApplication();
         $app->enqueueMessage(JText::_('COM_STREAM_ERROR_NO_ACCESS'), 'error');
         return;
     }
     $view = StreamFactory::getView('groups', '', 'html');
     echo $view->show($group);
     // Update view stats
     $lastReadId = $my->getParam('group_' . $group->id . '_read', -1);
     $lastCommentId = $my->getParam('group_' . $group->id . '_comment', -1);
     $groupLastMsg = $group->getParam('last_message');
     $groupLastComment = $group->getParam('last_comment');
     if ($lastReadId != $groupLastMsg || $lastCommentId != $groupLastComment) {
         $my->setParam('group_' . $group->id . '_read', $groupLastMsg);
         //$my->setParam('group_'. $group->id.'_comment', $groupLastComment);
         $my->save();
     }
 }
Ejemplo n.º 7
0
 public function tagFilter()
 {
     $view = StreamFactory::getView('company', '', 'html');
     echo $view->tagFilter();
 }
Ejemplo n.º 8
0
 public function filter()
 {
     $view = StreamFactory::getView('company');
     $html = $view->getStreamDataHTML();
     $data = array();
     $data['html'] = $html;
     $data['type'] = JRequest::getVar('type');
     header('Content-Type: text/json');
     echo json_encode($data);
     exit;
 }
Ejemplo n.º 9
0
 function display($tpl = null)
 {
     jimport('joomla.html.pagination');
     $my = JXFactory::getUser();
     $this->_attachScripts();
     $html = '';
     $jconfig = new JConfig();
     $doc = JFactory::getDocument();
     $customlist_id = JRequest::getVar('list_id', '', 'GET');
     $customList = JTable::getInstance('Customlist', 'StreamTable');
     $customList->load($customlist_id);
     $doc->setTitle($customList->title);
     $this->addPathway(JText::_('COM_TEMPLATE_CUSTOMLIST'));
     $buildConditionFilter = array();
     $filterArr = array();
     $preloadedSource = array();
     $group = JTable::getInstance('Group', 'StreamTable');
     if ($customList->filter) {
         $filterArr = json_decode($customList->filter, true);
         // Build the filter conditions
         foreach ($filterArr as $filterEntity => $arrvalue) {
             $buildConditionFilter[$filterEntity] = implode(',', $arrvalue);
             //TODO: Temporary preloaded source - this should be returned from a model
             foreach ($arrvalue as $value) {
                 if ($filterEntity == 'group_ids') {
                     $group->load($value);
                     $preloadedSource[$filterEntity][] = array('id' => $group->id, 'value' => $group->name, 'selected' => '1');
                 } elseif ($filterEntity == 'user_ids') {
                     $user = JXFactory::getUser($value);
                     $preloadedSource[$filterEntity][] = array('id' => $value, 'value' => $user->name, 'thumb' => $user->getThumbAvatarURL(), 'selected' => '1');
                 } elseif ($filterEntity == 'tags') {
                     $preloadedSource[$filterEntity][] = array('value' => $value, 'selected' => '1');
                 }
             }
         }
     }
     $tmpl = new StreamTemplate();
     $tmpl->set('my', $my);
     $tmpl->set('customList', $customList);
     // current list
     $tmpl->set('filterArr', $filterArr);
     // array of list filters
     $tmpl->set('preloadedSource', $preloadedSource);
     // array of preloaded list selections
     $html .= $tmpl->fetch('customlist.header');
     $html .= '<br />';
     $options = array();
     $options['hide_filter'] = 1;
     // Hide filter tabs
     // Side bar
     if (isset($filterArr['group_ids'])) {
         JXModule::addBuffer('right', $this->getFilteredGroupsHTML($filterArr['group_ids']));
     }
     if (isset($filterArr['user_ids'])) {
         JXModule::addBuffer('right', $this->getFilteredUsersHTML($filterArr['user_ids']));
     }
     if (isset($filterArr['tags'])) {
         JXModule::addBuffer('right', $this->getFilteredTagsHTML($filterArr['tags']));
     }
     if (!empty($buildConditionFilter)) {
         $companyView = StreamFactory::getView('company');
         $html .= $companyView->getStreamDataHTML($buildConditionFilter, $options);
     } else {
         $html .= '<div class="alert-message block-message info">' . JText::_('COM_STREAM_LABEL_NOFILTERSAPPLIED_LONG') . '</div>';
     }
     echo $html;
 }
Ejemplo n.º 10
0
 /**
  * Show group events
  */
 public function show_events($group)
 {
     $document = JFactory::getDocument();
     $this->_addPathway($group);
     $this->_attachScripts();
     $document->setTitle($group->name);
     $this->addPathway(JText::_('NAVIGATOR_LABEL_EVENTS'));
     $html = '';
     $tmpl = new StreamTemplate();
     $tmpl->set('group', $group)->set('show_back', true);
     $html .= $tmpl->fetch('group.header');
     $eventView = StreamFactory::getView('events');
     $html .= $eventView->getGroupEventHTML(array('group_id' => $group->id));
     return $html;
 }
Ejemplo n.º 11
0
 /**
  *
  */
 public function display($cachable = false, $urlparams = false)
 {
     $view = StreamFactory::getView('files', '', 'html');
     echo $view->display();
 }
Ejemplo n.º 12
0
 function display($tpl = null)
 {
     include_once JPATH_LIBRARIES . DS . 'joomla' . DS . 'html' . DS . 'html' . DS . 'string.php';
     $name = JRequest::getString('user');
     $userId = JUserHelper::getUserId($name);
     $user = JXFactory::getUser($userId);
     $my = JXFactory::getUser();
     $lastStatus = $user->getStatus();
     $task = JRequest::getVar('task', 'activities');
     $this->addPathway(JText::_('NAVIGATOR_LABEL_PEOPLE'), JRoute::_('index.php?option=com_people&view=members'));
     $this->addPathway($user->name);
     $doc = JFactory::getDocument();
     // Add attachment script
     $doc->addScript(JURI::root() . 'media/uploader/fileuploader.js');
     $doc->addStyleSheet(JURI::root() . 'media/uploader/fileuploader.css');
     $groupsView = StreamFactory::getView('groups');
     // $html = $groupsView->getUserGroupsHTML($userId);
     // JXModule::addBuffer('right', $html );
     // this section is to get the group_type to set the twitter button's toggle
     $validGroupType = JAnalytics::getGroupType();
     $analyticsGroupBy = JRequest::getVar('group_type', 'day');
     $analyticIndex = array_search($analyticsGroupBy, $validGroupType);
     $analyticIndex = $analyticIndex === false ? 1 : $analyticIndex;
     $this->assignRef('user', $user);
     $this->assignRef('my', $my);
     $this->assignRef('analyticIndex', $analyticIndex);
     $this->assignRef('analyticType', $validGroupType);
     $this->assign('lastStatus', $lastStatus[0]->message);
     $this->assign('analyticHtml', $this->generateAnalytics($user));
     switch ($task) {
         case 'activities':
             $companyView = StreamFactory::getView('company');
             $filter = array();
             $filter['user_id'] = $user->id;
             // Show only the user's stream
             $options = array();
             $options['filter'] = 'stream.filter.profile';
             $activities = $companyView->getStreamDataHTML($filter, $options);
             $this->assignRef('activities', $activities);
             break;
         case 'bio':
             // Bio
             JForm::addFieldPath(JPATH_COMPONENT . DS . 'models' . DS . 'fields');
             $form = JForm::getInstance('form', JPATH_ROOT . DS . 'components' . DS . 'com_profile' . DS . 'models' . DS . 'forms' . DS . 'details.xml');
             $detailModel = ProfileFactory::getModel('detail');
             $form->bind(array('params' => $detailModel->getDetails($user->id)));
             $this->assignRef('form', $form);
             $this->assignRef('user', $user);
             break;
         case 'content':
             $this->assignRef('user', $user);
             $streamModel = StreamFactory::getModel('stream');
             $blogs = $streamModel->getStream(array('type' => 'page', 'user_id' => $user->id), 10);
             $this->assign('blogs', $blogs);
             $this->assign('blogCount', $streamModel->countStream(array('type' => 'page', 'user_id' => $user->id)));
             $links = $user->getParam('links', '');
             $linkModel = StreamFactory::getModel('links');
             $links = $linkModel->getLinks(array('id' => $links, '!link' => ''), 10);
             $this->assignRef('links', $links);
             $this->assign('linkCount', JXUtility::csvCount($user->getParam('links')));
             $fileModel = StreamFactory::getModel('files');
             $files = $fileModel->getFiles(array('user_id' => $user->id), 10);
             $fileView = StreamFactory::getView('files');
             $this->assignRef('fileView', $fileView);
             $this->assignRef('files', $files);
             $this->assign('fileCount', $fileModel->countFiles(array('user_id' => $user->id)));
             break;
     }
     //$document = JFactory::getDocument();
     // $document->setTitle(JText::_('COM_PROFILE_LABEL_PROFILE_PAGE').': '.$user->name);
     $groupView = StreamFactory::getView('groups');
     JXModule::addBuffer('right', $groupView->getUserActiveGroupsHTML($user->id));
     // development
     $fileView = StreamFactory::getView('files');
     JXModule::addBuffer('right', $fileView->modUserFilesHTML($user));
     parent::display($tpl);
 }