Esempio n. 1
0
 /**
  * @todo: change this to a simple $my->authorise
  * @param type $processFunc
  * @param type $wallId
  * @return type
  */
 public static function isEditable($processFunc, $wallId)
 {
     $func = explode(',', $processFunc);
     if (count($func) < 2) {
         return false;
     }
     $controller = $func[0];
     $method = 'edit' . $func[1] . 'Wall';
     if (count($func) > 2) {
         //@todo: plugins
     }
     return CWall::_callFunction($controller, $method, array($wallId));
 }
Esempio n. 2
0
 /**
  * Fill up the 'all comment fields with.. all comments
  *
  */
 public function ajaxStreamShowComments($actid, $type = false)
 {
     if ($type) {
         $this->ajaxWallShowComments($actid, $type);
         return;
     }
     $filter = JFilterInput::getInstance();
     $actid = $filter->clean($actid, 'int');
     $wallModel = CFactory::getModel('wall');
     // Pull the activity record and find out the actor
     // only allow comment if the actor is a friend of current user
     $act = JTable::getInstance('Activity', 'CTable');
     $act->load($actid);
     $params = new CParameter($act->params);
     if ($act->comment_type == 'photos' && $params->get('batchcount', 0) > 1) {
         $act->comment_type = 'albums';
         $act->comment_id = $act->cid;
     } else {
         if ($act->comment_type == 'videos.linking') {
             $act->comment_type = 'videos';
             $act->comment_id = $act->cid;
         }
     }
     $comments = $wallModel->getAllPost($act->comment_type, $act->comment_id);
     $commentsHTML = '';
     CWall::triggerWallComments($comments, false);
     foreach ($comments as $row) {
         $row->params = new CParameter($row->get('params', '{}'));
         if ($row->type == 'albums' && $row->params->get('activityId', NULL) != $actid && $params->get('batchcount', 0) > 1) {
             continue;
         }
         $commentsHTML .= CWall::formatComment($row);
     }
     $json = array();
     $json['success'] = true;
     $json['html'] = $commentsHTML;
     die(json_encode($json));
 }
Esempio n. 3
0
        <?php 
    if ($act->commentCount > 0) {
        ?>
            <?php 
        #echo $act->commentLast;
        $comments = $act->commentsAll;
        #echo "<pre>";var_dump($comments);die();
        #$comments = $comments[$act->id];
        $commentLimit = $config->get('stream_default_comments');
        $comments = array_reverse($comments);
        if ($act->commentCount > $commentLimit) {
            $comments = array_slice($comments, sizeof($comments) - $commentLimit, $commentLimit);
        }
        foreach ($comments as $comment) {
            $comment->params = new CParameter($comment->params);
            echo CWall::formatComment($comment);
        }
        ?>
        <?php 
    }
    ?>
    </div>

    <?php 
    if ($allowComment) {
        ?>
        <div class="joms-comment__reply joms-js--newcomment joms-js--newcomment-<?php 
        echo $act->id;
        ?>
" data-id="<?php 
        echo $act->id;
Esempio n. 4
0
 /**
  * Return the HTML formatted activity content
  */
 static function getActivityContent($act)
 {
     $cache = CFactory::getFastCache();
     $cacheid = __FILE__ . __LINE__ . serialize(func_get_args());
     if ($data = $cache->get($cacheid)) {
         return $data;
     }
     // Return empty content or content with old, invalid data
     // In some old version, some content might have 'This is the body'
     if ($act->content == 'This is the body') {
         return '';
     }
     $html = $act->content;
     // For known core, apps, we can simply call the content command
     switch ($act->app) {
         case 'videos':
             CFactory::load('libraries', 'videos');
             $html = CVideos::getActivityContentHTML($act);
             break;
         case 'photos':
             CFactory::load('libraries', 'photos');
             $html = CPhotos::getActivityContentHTML($act);
             break;
         case 'events':
             CFactory::load('libraries', 'events');
             $html = CEvents::getActivityContentHTML($act);
             break;
         case 'groups.wall':
         case 'groups':
             CFactory::load('libraries', 'groups');
             $html = CGroups::getActivityContentHTML($act);
             break;
         case 'groups.discussion.reply':
         case 'groups.discussion':
             CFactory::load('libraries', 'groups');
             $html = CGroups::getActivityContentHTML($act);
             break;
         case 'groups.bulletin':
             CFactory::load('libraries', 'groups');
             $html = CGroups::getActivityContentHTML($act);
         case 'system':
             CFactory::load('libraries', 'adminstreams');
             $html = CAdminstreams::getActivityContentHTML($act);
             break;
         case 'walls':
             // If a wall does not have any content, do not
             // display the summary
             if ($act->app == 'walls' && $act->cid == 0) {
                 $html = '';
                 return $html;
             }
             if ($act->cid != 0) {
                 CFactory::load('libraries', 'wall');
                 $html = CWall::getActivityContentHTML($act);
             }
             break;
         default:
             // for other unknown apps, we include the plugin see if it is is callable
             // we call the onActivityContentDisplay();
             CFactory::load('libraries', 'apps');
             $apps =& CAppPlugins::getInstance();
             $plugin =& $apps->get($act->app);
             $method = 'onActivityContentDisplay';
             if (is_callable(array($plugin, $method))) {
                 $args = array();
                 $args[] = $act;
                 $html = call_user_func_array(array($plugin, $method), $args);
             } else {
                 $html = $act->content;
             }
     }
     $cache->store($html, $cacheid, array('activities'));
     return $html;
 }
Esempio n. 5
0
 /**
  *
  */
 public function getLastComment()
 {
     //return $this->_comment_last;
     $wall = new stdClass();
     $wall->id = $this->_comment_last_id;
     $wall->date = $this->_comment_date;
     $wall->post_by = $this->_comment_last_by;
     $wall->comment = $this->_comment_last;
     $wall->contentid = $this->id;
     $wall->type = $this->_comment_type;
     $wall->params = new CParameter($this->_comment_params);
     return CWall::formatComment($wall);
 }
Esempio n. 6
0
 public function ajaxGetOlderWalls($groupId, $discussionId, $limitStart)
 {
     $response = new JAXResponse();
     $my = CFactory::getUser();
     $jconfig = JFactory::getConfig();
     $groupModel = CFactory::getModel('groups');
     $isGroupAdmin = $groupModel->isAdmin($my->id, $groupId);
     CFactory::load('libraries', 'wall');
     $html = CWall::getWallContents('discussions', $discussionId, $isGroupAdmin, $jconfig->get('list_limit'), $limitStart, 'wall.content', 'groups,discussion', $groupId);
     // parse the user avatar
     CFactory::load('helpers', 'string');
     $html = CStringHelper::replaceThumbnails($html);
     $html = JString::str_ireplace(array('{error}', '{warning}', '{info}'), '', $html);
     $config = CFactory::getConfig();
     $order = $config->get('group_discuss_order');
     if ($order == 'ASC') {
         // Append new data at Top.
         $response->addScriptCall('joms.walls.prepend', $html);
     } else {
         // Append new data at bottom.
         $response->addScriptCall('joms.walls.append', $html);
     }
     return $response->sendResponse();
 }
Esempio n. 7
0
 /**
  *
  */
 public function getLastComment()
 {
     //return $this->_comment_last;
     CFactory::load('libraries', 'wall');
     $wall = new stdClass();
     $wall->id = $this->_comment_last_id;
     $wall->date = $this->_comment_date;
     $wall->post_by = $this->_comment_last_by;
     $wall->comment = $this->_comment_last;
     return CWall::formatComment($wall);
 }
Esempio n. 8
0
 /**
  * Fill up the 'all comment fields with.. all comments
  *
  */
 public function ajaxStreamShowComments($actid)
 {
     $filter = JFilterInput::getInstance();
     $actid = $filter->clean($actid, 'int');
     $objResponse = new JAXResponse();
     $wallModel = CFactory::getModel('wall');
     CFactory::load('libraries', 'wall');
     CFactory::load('libraries', 'activities');
     // Pull the activity record and find out the actor
     // only allow comment if the actor is a friend of current user
     $act =& JTable::getInstance('Activity', 'CTable');
     $act->load($actid);
     $comments = $wallModel->getAllPost($act->comment_type, $act->comment_id);
     $commentsHTML = '';
     foreach ($comments as $row) {
         $commentsHTML .= CWall::formatComment($row);
     }
     $objResponse->addScriptCall('joms.miniwall.loadall', $actid, $commentsHTML);
     return $objResponse->sendResponse();
 }