public function addAction(NEWSFEED_CLASS_Action $action) { if ($this->actionList === null) { $this->actionList = array(); } $this->actionList[$action->getId()] = $action; }
protected function getFeatures($data) { $configs = $this->sharedData['configs']; $featuresData = $this->getFeaturesData($data); $out = array('system' => array('comments' => false, 'likes' => false), 'custom' => array()); $out['custom'] = $featuresData["custom"]; $systemFeatures = $featuresData["system"]; if (!empty($systemFeatures["comments"])) { $feature = $systemFeatures["comments"]; $commentsParams = new BASE_CommentsParams($feature["authGroup"], $feature["entityType"]); $commentsParams->setEntityId($feature["entityId"]); $commentsParams->setInitialCommentsCount($configs['comments_count']); $commentsParams->setLoadMoreCount(6); $commentsParams->setBatchData($feature["comments"]); $commentsParams->setOwnerId($this->action->getUserId()); $commentsParams->setDisplayType(BASE_CommentsParams::DISPLAY_TYPE_WITH_LOAD_LIST_MINI); $commentsParams->setWrapInBox(false); $commentsParams->setShowEmptyList(false); if (!empty($feature['error'])) { $commentsParams->setErrorMessage($feature['error']); } if (isset($feature['allow'])) { $commentsParams->setAddComment($feature['allow']); } $commentCmp = new BASE_CMP_Comments($commentsParams); $out['system']['comments']['cmp'] = $commentCmp->render(); $out['system']['comments']['count'] = $feature["count"]; $out['system']['comments']['allow'] = $feature["allow"]; $out['system']['comments']['expanded'] = $feature["expanded"]; } if (!empty($systemFeatures["likes"])) { $feature = $systemFeatures['likes']; $out['system']['likes']['count'] = $feature["count"]; $out['system']['likes']['liked'] = $feature["liked"]; $out['system']['likes']['allow'] = $feature["allow"]; $out['system']['likes']['error'] = $feature["error"]; $likeCmp = new NEWSFEED_CMP_Likes($feature["entityType"], $feature["entityId"], $feature["likes"]); $out['system']['likes']['cmp'] = $likeCmp->render(); } return $out; }
/** * * @param NEWSFEED_BOL_Action $dto * @return NEWSFEED_CLASS_Action */ private function makeAction($actionDto, $activityList) { if (empty($activityList)) { return null; } $action = new NEWSFEED_CLASS_Action(); $action->setId($actionDto->id); $action->setData(json_decode($actionDto->data, true)); $action->setEntity($actionDto->entityType, $actionDto->entityId); $action->setPluginKey($actionDto->pluginKey); $action->setFormat($actionDto->format); $action->setActivityList($activityList); return $action; }