当前位置: 首页>>代码示例>>PHP>>正文


PHP CActivityStream类代码示例

本文整理汇总了PHP中CActivityStream的典型用法代码示例。如果您正苦于以下问题:PHP CActivityStream类的具体用法?PHP CActivityStream怎么用?PHP CActivityStream使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CActivityStream类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: display

 function display($data = null)
 {
     $mainframe = JFactory::getApplication();
     $config = CFactory::getConfig();
     $document =& JFactory::getDocument();
     $document->setTitle(JText::sprintf('CC FRONTPAGE TITLE', $config->get('sitename')));
     $document->setLink(CRoute::_('index.php?option=com_community'));
     $my = CFactory::getUser();
     CFactory::load('libraries', 'activities');
     CFactory::load('helpers', 'string');
     $act = new CActivityStream();
     $rows = $act->getFEED('', '', null, $mainframe->getCfg('feed_limit'));
     if ($config->get('showactivitystream') == COMMUNITY_SHOW || $config->get('showactivitystream') == COMMUNITY_MEMBERS_ONLY && $my->id != 0) {
         foreach ($rows->data as $row) {
             if ($row->type != 'title') {
                 // load individual item creator class
                 $item = new JFeedItem();
                 // cannot escape the title. it's already formated. we should
                 // escape it during CActivityStream::add
                 //$item->title 		= CStringHelper::escape($row->title);
                 $item->title = $row->title;
                 $item->link = CRoute::_('index.php?option=com_community&view=profile&userid=' . $row->actor);
                 $item->description = "<img src=\"{$row->favicon}\" alt=\"\"/>&nbsp;" . $row->title;
                 $item->date = $row->createdDate;
                 $item->category = '';
                 //$row->category;
                 // Make sure url is absolute
                 $item->description = JString::str_ireplace('href="/', 'href="' . JURI::base(), $item->description);
                 // loads item info into rss array
                 $document->addItem($item);
             }
         }
     }
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:34,代码来源:view.feed.php

示例2: profile

 /**
  * Displays the viewing profile page.
  * 	 	
  * @access	public
  * @param	array  An associative array to display the fields
  */
 public function profile(&$data)
 {
     $mainframe = JFactory::getApplication();
     $friendsModel = CFactory::getModel('friends');
     $showfriends = JRequest::getVar('showfriends', false);
     $userid = JRequest::getVar('userid', '');
     $user = CFactory::getUser($userid);
     $linkUrl = CRoute::_('index.php?option=com_community&view=profile&userid=' . $user->id);
     $document = JFactory::getDocument();
     $document->setTitle(JText::sprintf('COM_COMMUNITY_USERS_FEED_TITLE', $user->getDisplayName()));
     $document->setDescription(JText::sprintf('COM_COMMUNITY_USERS_FEED_DESCRIPTION', $user->getDisplayName(), $user->lastvisitDate));
     $document->setLink($linkUrl);
     include_once JPATH_COMPONENT . '/libraries/activities.php';
     $act = new CActivityStream();
     $friendIds = $friendsModel->getFriendIds($user->id);
     $friendIds = $showfriends ? $friendIds : null;
     $rows = $act->getFEED($user->id, $friendIds, null, $mainframe->getCfg('feed_limit'));
     // add the avatar image
     $rssImage = new JFeedImage();
     $rssImage->url = $user->getThumbAvatar();
     $rssImage->link = $linkUrl;
     $rssImage->width = 64;
     $rssImage->height = 64;
     $document->image = $rssImage;
     //CFactory::load( 'helpers' , 'string' );
     //CFactory::load( 'helpers' , 'time' );
     foreach ($rows->data as $row) {
         if ($row->type != 'title') {
             // Get activities link
             $pattern = '/<a href=\\"(.*?)\\"/';
             preg_match_all($pattern, $row->title, $matches);
             // Use activity owner link when activity link is not available
             if (!empty($matches[1][1])) {
                 $linkUrl = $matches[1][1];
             } else {
                 if (!empty($matches[1][0])) {
                     $linkUrl = $matches[1][0];
                 }
             }
             // load individual item creator class
             $item = new JFeedItem();
             $item->title = $row->title;
             $item->link = $linkUrl;
             $item->description = "<img src=\"{$row->favicon}\" alt=\"\" />&nbsp;" . $row->title;
             $item->date = CTimeHelper::getDate($row->createdDateRaw)->toRFC822();
             $item->category = '';
             //$row->category;
             $item->description = CString::str_ireplace('_QQQ_', '"', $item->description);
             // Make sure url is absolute
             $pattern = '/href="(.*?)index.php/';
             $replace = 'href="' . JURI::base() . 'index.php';
             $string = $item->description;
             $item->description = preg_replace($pattern, $replace, $string);
             // loads item info into rss array
             $document->addItem($item);
         }
     }
 }
开发者ID:Jougito,项目名称:DynWeb,代码行数:64,代码来源:view.feed.php

示例3: onAfterVote

 function onAfterVote($poll, $option_id)
 {
     $user =& JFactory::getUser();
     $points = JPATH_ROOT . '/components/com_community/libraries/core.php';
     $activity = JPATH_ROOT . '/components/com_community/libraries/core.php';
     if ($this->params->get('points', '0') == '1' && file_exists($points)) {
         require_once $points;
         CUserPoints::assignPoint('com_acepolls.vote');
     }
     if ($this->params->get('activity', '0') == '1' && file_exists($activity)) {
         require_once $activity;
         $text = JText::_('COM_ACEPOLLS_ACTIVITY_TEXT');
         $link = JRoute::_('index.php?option=com_acepolls&amp;view=poll&amp;id=' . $poll->id . ":" . $poll->alias . self::getItemid($poll->id));
         $act = new stdClass();
         $act->cmd = 'wall.write';
         $act->actor = $user->id;
         $act->target = 0;
         $act->title = JText::_('{actor} ' . $text . ' <a href="' . $link . '">' . $poll->title . '</a>');
         $act->content = '';
         $act->app = 'wall';
         $act->cid = 0;
         CFactory::load('libraries', 'activities');
         CActivityStream::add($act);
     }
 }
开发者ID:vuchannguyen,项目名称:dayhoc,代码行数:25,代码来源:jomsocial.php

示例4: add_stream

 function add_stream($listing_id, $cids, $ctype = '')
 {
     include_once JPATH_BASE . DS . 'components' . DS . 'com_community' . DS . 'libraries' . DS . 'core.php';
     // load language strings for this component so we get translated activity stream messages
     $lang =& JFactory::getLanguage();
     $lang->load('com_relate');
     $sql = "SELECT id, title, catid FROM #__content WHERE id = '{$listing_id}'";
     $this->_db->setQuery($sql);
     $listing = $this->_db->loadObject();
     $listing_title = $listing->title;
     $listing_href = CRoute::_('index.php?option=com_content&view=article&catid=' . $listing->catid . '&id=' . $listing->id);
     $listing_link = '<a href="' . $listing_href . '">' . $listing_title . '</a>';
     if ($ctype != '') {
         $content_type = $ctype;
         $category_id = 1;
         $is_listing = false;
     } else {
         $sql = "SELECT l.id, l.catid, l.title, c.title AS cat_title FROM #__categories c, #__content l " . "WHERE c.id = l.catid AND l.id IN (" . implode(",", $cids) . ")";
         $this->_db->setQuery($sql);
         $content = $this->_db->loadObjectList('id');
         $is_listing = true;
     }
     foreach ($cids as $cid) {
         if ($is_listing) {
             $content_title = $content[$cid]->title;
             $content_type = $content[$cid]->cat_title;
             $category_id = $content[$cid]->catid;
             $content_id = $content[$cid]->id;
             $href = CRoute::_('index.php?option=com_content&view=article&catid=' . $category_id . '&id=' . $content_id);
             $content_link = '<a href="' . $href . '">' . $content_title . '</a>';
             $content_info = $content_link . ' (' . $content_type . ')';
         } else {
             $content_id = $cid;
             $tab = '';
             if ($content_type == "photo") {
                 $tab = '#bilder';
             } else {
                 if ($content_type == "video") {
                     $tab = '#video';
                 }
             }
             $content_link = '<a href="' . $listing_href . $tab . '">' . JText::_("a {$content_type}") . '</a>';
             $content_info = $content_link;
         }
         $act = new stdClass();
         $act->cmd = 'wall.write';
         $act->actor = JFactory::getUser()->id;
         $act->target = 0;
         $act->title = JText::sprintf('RELATION ADDED', $content_info, $listing_link);
         $act->content = '';
         $act->app = 'wall';
         $act->cid = $content_id;
         CFactory::load('libraries', 'activities');
         CActivityStream::add($act);
     }
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:56,代码来源:relate.php

示例5: mapStatus

 /**
  * Maps a user status with JomSocial's user status
  *
  *	@param	Array	User values
  **/
 public function mapStatus($userId)
 {
     $result = $this->facebook->api('/me/statuses');
     $status = isset($result['data'][0]) ? $result['data'][0] : '';
     if (empty($status)) {
         return;
     }
     CFactory::load('helpers', 'linkgenerator');
     $connectModel = CFactory::getModel('Connect');
     $status = $status['message'];
     $rawStatus = $status;
     // @rule: Do not strip html tags but escape them.
     CFactory::load('helpers', 'string');
     $status = CStringHelper::escape($status);
     // @rule: Autolink hyperlinks
     $status = CLinkGeneratorHelper::replaceURL($status);
     // @rule: Autolink to users profile when message contains @username
     $status = CLinkGeneratorHelper::replaceAliasURL($status);
     // Reload $my from CUser so we can use some of the methods there.
     $my = CFactory::getUser($userId);
     $params = $my->getParams();
     // @rule: For existing statuses, do not set them.
     if ($connectModel->statusExists($status, $userId)) {
         return;
     }
     CFactory::load('libraries', 'activities');
     $act = new stdClass();
     $act->cmd = 'profile.status.update';
     $act->actor = $userId;
     $act->target = $userId;
     $act->title = '{actor} ' . $status;
     $act->content = '';
     $act->app = 'profile';
     $act->cid = $userId;
     $act->access = $params->get('privacyProfileView');
     $act->comment_id = CActivities::COMMENT_SELF;
     $act->comment_type = 'profile.status';
     $act->like_id = CActivities::LIKE_SELF;
     $act->like_type = 'profile.status';
     CActivityStream::add($act);
     //add user points
     CFactory::load('libraries', 'userpoints');
     CUserPoints::assignPoint('profile.status.update');
     // Update status from facebook.
     $my->setStatus($rawStatus);
 }
开发者ID:Simarpreet05,项目名称:joomla,代码行数:51,代码来源:facebook.php

示例6: delete

 /**
  * Delete the photo, the original and the actual resized photos and thumbnails
  */
 public function delete($pk = null)
 {
     $storage = CStorage::getStorage($this->storage);
     $storage->delete($this->image);
     $storage->delete($this->thumbnail);
     /* We did store original than now time to remove it */
     if (!empty($this->original)) {
         /* Original do not sync with 3rd storage than we don't need to use $storage->delete; even it would be same */
         if (JFile::exists(JPATH_ROOT . '/' . $this->original)) {
             JFile::delete(JPATH_ROOT . '/' . $this->original);
         }
         $originalDir = dirname(JPATH_ROOT . '/' . $this->original);
         $files = JFolder::files($originalDir);
         /* If the original path is empty, we can delete it too */
         if (empty($files)) {
             JFolder::delete($originalDir);
         }
     }
     // if the photo is the album cover, set the album cover as default 0
     $album = JTable::getInstance('Album', 'CTable');
     $album->load($this->albumid);
     $album->set('photoid', 0);
     $album->store();
     // delete the tags
     CFactory::load('libraries', 'phototagging');
     $phototagging = new CPhotoTagging();
     $phototagging->removeTagByPhoto($this->id);
     // delete the activities
     CActivities::remove('photos', $this->id);
     //Remove photo from activity stream
     CActivityStream::remove('photo.like', $this->id);
     // delete the comments
     $wall = CFactory::getModel('wall');
     $wall->deleteAllChildPosts($this->id, 'photos');
     /* And now finally we do delete this photo in database */
     /* return parent::delete(); */
     /**
      * @since 3.2
      * We do not delete database record for now. Leave it for cron !
      * @todo Considering local files should be deleted this time or not ?
      */
     $this->published = 0;
     $this->status = 'delete';
     $this->store();
 }
开发者ID:SMARTRESPONSOR,项目名称:SMARTRESPONSOR,代码行数:48,代码来源:photo.php

示例7: album


//.........这里部分代码省略.........
     $pagination = $model->getPagination();
     $photo =& JTable::getInstance('Photo', 'CTable');
     $photo->load($album->photoid);
     if ($album->photoid == '0') {
         $album->thumbnail = $photo->getThumbURI();
     } else {
         $album->thumbnail = $photo->getImageURI();
     }
     // Increment album's hit each time this page is loaded.
     $album->hit();
     $otherAlbums = $model->_getOnlyAlbums($user->id, PHOTOS_USER_TYPE, 0, 20);
     $totalAlbums = count($otherAlbums);
     $showOtherAlbum = 6;
     $randomAlbum = array();
     if (count($otherAlbums) > 0) {
         $randomId = $totalAlbums < $showOtherAlbum ? array_rand($otherAlbums, $totalAlbums) : array_rand($otherAlbums, $showOtherAlbum);
         $count = 0;
         for ($i = 0; $i < $totalAlbums; $i++) {
             $num = is_array($randomId) ? $randomId[$i] : $randomId;
             if ($otherAlbums[$num]->id != $album->id) {
                 $count++;
                 $randomAlbum[] = $otherAlbums[$num];
             }
             if (count($randomAlbum) == $showOtherAlbum - 1) {
                 break;
             }
         }
     }
     $js = 'assets/gallery';
     $js .= $config->getBool('usepackedjavascript') ? '.pack.js' : '.js';
     CAssets::attach($js, 'js');
     CFactory::load('helpers', 'string');
     $document->setTitle(JText::sprintf('COM_COMMUNITY_PHOTOS_USER_PHOTOS_TITLE', $handler->getCreatorName()) . ' - ' . $album->name);
     $this->setTitle($album->name);
     $handler->setAlbumPathway(CStringHelper::escape($album->name));
     $handler->setRSSHeader($albumId);
     // Set album thumbnail and description for social bookmarking sites linking
     $document->addHeadLink($album->getCoverThumbURI(), 'image_src', 'rel');
     $document->setDescription(CStringHelper::escape($album->getDescription()));
     CFactory::load('libraries', 'phototagging');
     $tagging = new CPhotoTagging();
     $people = array();
     $maxTime = $album->created;
     // Need to append the absolute path for the captions
     for ($i = 0; $i < count($photos); $i++) {
         $item =& JTable::getInstance('Photo', 'CTable');
         $item->bind($photos[$i]);
         $photos[$i] = $item;
         $photo =& $photos[$i];
         $photo->link = $handler->getPhotoURI($photo->id, $photo->albumid);
         $tags = $tagging->getTaggedList($photo->id);
         //Get last update
         $maxTime = $photo->created > $maxTime ? $photo->created : $maxTime;
         // Get the people in the tags
         foreach ($tags as $tag) {
             $people[] = $tag->userid;
         }
     }
     //Update lastUpdated
     $maxTime = new JDate($maxTime);
     $album->lastUpdated = CActivityStream::_createdLapse($maxTime, false);
     $people = array_unique($people);
     foreach ($people as &$person) {
         $person = CFactory::getUser($person);
     }
     CFactory::load('libraries', 'bookmarks');
     $bookmarks = new CBookmarks($handler->getAlbumExternalURI($album->id));
     // Get the walls
     CFactory::load('libraries', 'wall');
     $wallContent = CWallLibrary::getWallContents('albums', $album->id, COwnerHelper::isCommunityAdmin() || $my->id == $album->creator && $my->id != 0, 10, 0);
     $wallCount = CWallLibrary::getWallCount('albums', $album->id);
     $viewAllLink = false;
     if (JRequest::getVar('task', '', 'REQUEST') != 'app') {
         $viewAllLink = CRoute::_('index.php?option=com_community&view=photos&task=app&albumid=' . $album->id . '&app=walls');
     }
     $wallContent .= CWallLibrary::getViewAllLinkHTML($viewAllLink, $wallCount);
     $wallForm = CWallLibrary::getWallInputForm($album->id, 'photos,ajaxAlbumSaveWall', 'photos,ajaxAlbumRemoveWall', $viewAllLink);
     $redirectUrl = CRoute::getURI(false);
     // Add tagging code
     //		$tagsHTML = '';
     //		if($config->get('tags_photos')){
     //			CFactory::load('libraries', 'tags');
     //			$tags = new CTags();
     //			$tagsHTML = $tags->getHTML('albums', $album->id, $handler->isAlbumOwner( $album->id ) );
     //		}
     $this->showSubmenu();
     $tmpl = new CTemplate();
     if ($album->location != "") {
         CFactory::load('libraries', 'mapping');
         $zoomableMap = CMapping::drawZoomableMap($album->location, 220, 150);
     } else {
         $zoomableMap = "";
     }
     // Get the likes / dislikes item
     CFactory::load('libraries', 'like');
     $like = new CLike();
     $likesHTML = $like->getHTML('album', $album->id, $my->id);
     $owner = CFactory::getUser($album->creator);
     echo $tmpl->set('likesHTML', $likesHTML)->set('photosmapdefault', $photoMapsDefault)->set('my', $my)->set('bookmarksHTML', $bookmarks->getHTML())->set('isOwner', $handler->isAlbumOwner($album->id))->set('isAdmin', COwnerHelper::isCommunityAdmin())->set('owner', $owner)->set('photos', $photos)->set('people', $people)->set('album', $album)->set('otherAlbums', $randomAlbum)->set('likesHTML', $likesHTML)->set('wallForm', $wallForm)->set('wallContent', $wallContent)->set('zoomableMap', $zoomableMap)->set('pagination', $pagination)->fetch('photos.album');
 }
开发者ID:Simarpreet05,项目名称:joomla,代码行数:101,代码来源:view.html.php

示例8: _addToActivityStream

 public function _addToActivityStream($cid = 0)
 {
     // $cid shouldn't be 0
     if ($cid == 0) {
         return;
     }
     // Construct activity stream
     $act = new stdClass();
     $act->cid = $cid;
     $act->target = 0;
     $act->app = $this->type . '.featured';
     $act->cmd = $this->type . '.featured';
     $params = new JRegistry('');
     // Process each type of featured content
     switch ($this->type) {
         case FEATURED_EVENTS:
             //
             $table = JTable::getInstance('Event', 'CTable');
             $table->load($cid);
             $act->actor = $table->creator;
             $eventUrl = 'index.php?option=com_community&view=events&task=viewevent&eventid=' . $table->id;
             $act->title = JText::sprintf('COM_COMMUNITY_ACTIVITIES_FEATURED_EVENT', $eventUrl, $table->title);
             $act->content = '<img src=\\"' . $table->getAvatar() . '\\" style=\\"border: 1px solid #eee;margin-right: 3px;\\" />';
             $act->comment_type = $act->app;
             $act->like_id = CActivities::LIKE_SELF;
             $act->like_type = $act->app;
             break;
         case FEATURED_GROUPS:
             //
             $table = JTable::getInstance('Group', 'CTable');
             $table->load($cid);
             $act->actor = $table->ownerid;
             $groupUrl = 'index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $table->id;
             $act->title = JText::sprintf('COM_COMMUNITY_ACTIVITIES_FEATURED_GROUP', $groupUrl, $table->name);
             $act->content = '<img src=\\"' . $table->getAvatar() . '\\" style=\\"border: 1px solid #eee;margin-right: 3px;\\" />';
             $act->comment_type = $act->app;
             $act->like_id = CActivities::LIKE_SELF;
             $act->like_type = $act->app;
             break;
         case FEATURED_USERS:
             $user = CFactory::getUser($cid);
             $ownerUrl = 'index.php?option=com_community&view=profile&userid=' . $user->id;
             $act->actor = $user->id;
             $act->title = '';
             //JText::sprintf('COM_COMMUNITY_ACTIVITIES_FEATURED_USER', '{owner_url}', $user->getDisplayName());
             $act->content = '';
             $act->comment_type = $act->app;
             $act->like_id = CActivities::LIKE_SELF;
             $act->like_type = $act->app;
             $params->set('userid', $user->id);
             $params->set('owner_url', $ownerUrl);
             break;
         case FEATURED_VIDEOS:
             $table = JTable::getInstance('Video', 'CTable');
             $table->load($cid);
             $videoUrl = $table->getViewURI();
             $ownerUrl = 'index.php?option=com_community&view=profile&userid=' . $table->creator;
             $user = CFactory::getUser($table->creator);
             $ownerName = $user->getDisplayName();
             $act->actor = $table->creator;
             $act->title = '';
             //JText::sprintf('COM_COMMUNITY_ACTIVITIES_FEATURED_VIDEO', '{owner_url}', $ownerName, '{video_url}');
             $config = CFactory::getConfig();
             $act->comment_type = $act->app;
             $act->like_id = CActivities::LIKE_SELF;
             $act->like_type = $act->app;
             $params->set('owner_url', $ownerUrl);
             $params->set('video_url', $videoUrl);
             // embed the video when click show more
             // now only applies to external video provider
             break;
         case FEATURED_ALBUMS:
             $table = JTable::getInstance('Album', 'CTable');
             $table->load($cid);
             $albumUrl = 'index.php?option=com_community&view=photos&task=album&albumid=' . $table->id;
             $ownerUrl = 'index.php?option=com_community&view=profile&userid=' . $table->creator;
             $user = CFactory::getUser($table->creator);
             $ownerName = $user->getDisplayName();
             $act->actor = $table->creator;
             $act->title = '';
             //JText::sprintf('COM_COMMUNITY_ACTIVITIES_FEATURED_ALBUM', '{owner_url}', $ownerName, '{album_url}');
             //$table->thumbnail= $table->getCoverThumbPath();
             //$table->thumbnail= ($table->thumbnail) ? JURI::root() . $table->thumbnail : JURI::root() . 'components/com_community/assets/album_thumb.jpg';
             $act->content = '';
             //<img src="' . $table->thumbnail . '" style="border: 1px solid #eee;margin-right: 3px;" />';
             $params->set('owner_url', $ownerUrl);
             $params->set('album_url', $albumUrl);
             $act->comment_type = $act->app;
             $act->like_id = CActivities::LIKE_SELF;
             $act->like_type = $act->app;
             break;
         default:
             // If featured type is unknown, we'll skip it
             return;
     }
     // Add activity logging with 0 points
     CActivityStream::add($act, $params->toString(), 0);
 }
开发者ID:Jougito,项目名称:DynWeb,代码行数:98,代码来源:featured.php

示例9: onAfterThankyou

	public function onAfterThankyou($thankyoutargetid, $username , $message) {
		CFactory::load ( 'libraries', 'userpoints' );
		CUserPoints::assignPoint ( 'com_kunena.thread.thankyou', $thankyoutargetid );

		// Check for permisions of the current category - activity only if public or registered
		if ($message->getCategory()->pub_access <= 0) {
			//activity stream - reply post
			require_once KPATH_SITE.'/lib/kunena.link.class.php';
			$JSPostLink = CKunenaLink::GetThreadPageURL ( 'view', $message->catid, $message->thread, 0 );

			$act = new stdClass ();
			$act->cmd = 'wall.write';
			$act->actor = JFactory::getUser()->id;
			$act->target = $thankyoutargetid;
			$act->title = JText::_ ( '{single}{actor}{/single}{multiple}{actors}{/multiple} ' . JText::_( 'COM_KUNENA_JS_ACTIVITYSTREAM_THANKYOU' ).' <a href="' . $JSPostLink . '">' . $message->subject . '</a> ' . JText::_ ( 'COM_KUNENA_JS_ACTIVITYSTREAM_REPLY_MSG2' ) );
			$act->content = NULL;
			$act->app = 'kunena.thankyou';
			$act->cid = $message->id;

			// jomsocial 0 = public, 20 = registered members
			if ($message->getCategory()->pub_access == 0) {
				$act->access = 0;
			} else {
				$act->access = 20;
			}

			CFactory::load ( 'libraries', 'activities' );
			CActivityStream::add ( $act );
		}
	}
开发者ID:rich20,项目名称:Kunena,代码行数:30,代码来源:activity.php

示例10: ajaxRemoveWall

 /**
  * Delete post message
  *
  * @param	response	An ajax Response object
  * @param	id			A unique identifier for the wall row
  *
  * returns	response
  */
 function ajaxRemoveWall($response, $id, $cache_id = "")
 {
     $my = CFactory::getUser();
     $wallModel = CFactory::getModel('wall');
     $wall = $wallModel->get($id);
     CError::assert($id, '', '!empty', __FILE__, __LINE__);
     CFactory::load('helpers', 'owner');
     // Make sure the current user actually has the correct permission
     // Only the original writer and the person the wall is meant for (and admin of course)
     // can delete the wall
     if ($my->id == $wall->post_by || $my->id == $wall->contentid || COwnerHelper::isCommunityAdmin()) {
         if ($wallModel->deletePost($id)) {
             // @rule: Remove the wall activity from the database as well
             CFactory::load('libraries', 'activities');
             CActivityStream::remove('walls', $id);
             //add user points
             if ($wall->post_by != 0) {
                 CFactory::load('libraries', 'userpoints');
                 CUserPoints::assignPoint('wall.remove', $wall->post_by);
             }
         } else {
             $html = JText::_('Error while removing wall. Line:' . __LINE__);
             $response->addAlert($html);
         }
         $cache =& JFactory::getCache('plgCommunityWalls');
         $cache->remove($cache_id);
         $cache =& JFactory::getCache('plgCommunityWalls_fullview');
         $cache->remove($cache_id);
     } else {
         $html = JText::_('COM_COMMUNITY_PERMISSION_DENIED_WARNING');
         $response->addAlert($html);
     }
     return $response;
 }
开发者ID:Simarpreet05,项目名称:joomla,代码行数:42,代码来源:walls.php

示例11: upload


//.........这里部分代码省略.........
             //echo $orientation; exit;
             // A newly uplaoded image might not be resized yet, do it now
             $displayWidth = $config->getInt('photodisplaysize');
             JRequest::setVar('imgid', $photoTable->id, 'GET');
             JRequest::setVar('maxW', $displayWidth, 'GET');
             JRequest::setVar('maxH', $displayWidth, 'GET');
             $this->showimage(false);
             // Rotata resized files ince it is smaller
             switch ($orientation) {
                 case 1:
                     // nothing
                     break;
                 case 2:
                     // horizontal flip
                     // $image->flipImage($public,1);
                     break;
                 case 3:
                     // 180 rotate left
                     //  $image->rotateImage($public,180);
                     CImageHelper::rotate($storedPath, $storedPath, 180);
                     CImageHelper::rotate($thumbPath, $thumbPath, 180);
                     break;
                 case 4:
                     // vertical flip
                     //  $image->flipImage($public,2);
                     break;
                 case 5:
                     // vertical flip + 90 rotate right
                     //$image->flipImage($public, 2);
                     //$image->rotateImage($public, -90);
                     break;
                 case 6:
                     // 90 rotate right
                     // $image->rotateImage($public, -90);
                     CImageHelper::rotate($storedPath, $storedPath, -90);
                     CImageHelper::rotate($thumbPath, $thumbPath, -90);
                     break;
                 case 7:
                     // horizontal flip + 90 rotate right
                     // 			            $image->flipImage($public,1);
                     // 			            $image->rotateImage($public, -90);
                     break;
                 case 8:
                     // 90 rotate left
                     // 			            $image->rotateImage($public, 90);
                     CImageHelper::rotate($storedPath, $storedPath, 90);
                     CImageHelper::rotate($thumbPath, $thumbPath, 90);
                     break;
             }
         }
         // Trigger for onPhotoCreate
         CFactory::load('libraries', 'apps');
         $apps =& CAppPlugins::getInstance();
         $apps->loadApplications();
         $params = array();
         $params[] =& $photoTable;
         $apps->triggerEvent('onPhotoCreate', $params);
         // Set image as default if necessary
         // Load photo album table
         if ($isDefaultPhoto) {
             // Set the photo id
             $album->photoid = $photoTable->id;
             $album->store();
         }
         // @rule: Set first photo as default album cover if enabled
         if (!$isDefaultPhoto && $config->get('autoalbumcover')) {
             $photosModel = CFactory::getModel('Photos');
             $totalPhotos = $photosModel->getTotalPhotos($album->id);
             if ($totalPhotos <= 1) {
                 $album->photoid = $photoTable->id;
                 $album->store();
             }
         }
         $act = new stdClass();
         $act->cmd = 'photo.upload';
         $act->actor = $my->id;
         $act->access = $my->getParam('privacyPhotoView');
         $act->target = 0;
         $act->title = JText::sprintf($handler->getUploadActivityTitle(), '{photo_url}', $album->name);
         $act->content = '<img src="' . rtrim(JURI::root(), '/') . '/' . $photoTable->thumbnail . '" style=\\"border: 1px solid #eee;margin-right: 3px;" />';
         $act->app = 'photos';
         $act->cid = $albumId;
         $params = new JParameter('');
         $params->set('multiUrl', $handler->getAlbumURI($albumId, false));
         $params->set('photoid', $photoTable->id);
         $params->set('action', 'upload');
         $params->set('photo_url', $handler->getPhotoURI($albumId, $photoTable->id, false));
         // Add activity logging
         CFactory::load('libraries', 'activities');
         CActivityStream::add($act, $params->toString());
         //add user points
         CFactory::load('libraries', 'userpoints');
         CUserPoints::assignPoint('photo.upload');
         // Photo upload was successfull, display a proper message
         //$this->_showUploadError( false , JText::sprintf('CC PHOTO UPLOADED SUCCESSFULLY', $photoTable->caption ) , $photoTable->getThumbURI(), $albumId );
         $returns[] = array('album_id' => $albumId, 'image_id' => $photoTable->id, 'caption' => $photoTable->caption, 'created' => $photoTable->created, 'storage' => $photoTable->storage, 'thumbnail' => $photoTable->getThumbURI(), 'image' => $photoTable->getImageURI());
     }
     return $returns;
     exit;
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:101,代码来源:photos.php

示例12: onAfterDeleteTopic

 public function onAfterDeleteTopic($target)
 {
     CFactory::load('libraries', 'activities');
     CActivityStream::remove('kunena.thread.post', $target->id);
     // TODO: Need get replied id
     CActivityStream::remove('kunena.thread.replied', $target->id);
 }
开发者ID:anawu2006,项目名称:PeerLearning,代码行数:7,代码来源:activity.php

示例13: _addAvatarUploadActivity

 private function _addAvatarUploadActivity($userid, $thumbnail)
 {
     if (CUserPoints::assignPoint('profile.avatar.upload')) {
         // Generate activity stream.
         $act = new stdClass();
         $act->cmd = 'profile.avatar.upload';
         $act->actor = $userid;
         $act->target = 0;
         $act->title = '';
         $act->content = '';
         $act->app = 'profile.avatar.upload';
         $act->cid = 0;
         $act->comment_id = CActivities::COMMENT_SELF;
         $act->comment_type = 'profile.avatar.upload';
         $act->like_id = CActivities::LIKE_SELF;
         $act->like_type = 'profile.avatar.upload';
         // We need to make a copy of current avatar and set it as stream 'attachement'
         // which will only gets deleted once teh stream is deleted
         $params = new JRegistry();
         // store a copy of the avatar
         $imageAttachment = str_replace('thumb_', 'stream_', $thumbnail);
         $thumbnail = str_replace('thumb_', '', $thumbnail);
         JFile::copy($thumbnail, $imageAttachment);
         $params->set('attachment', $imageAttachment);
         // Add activity logging
         CActivityStream::add($act, $params->toString());
     }
 }
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:28,代码来源:profile.php

示例14: ajaxAdd

 /**
  * Add an application for the user
  *
  * @param    $name    string Application name / element
  */
 public function ajaxAdd($name)
 {
     // Check permissions
     $my = CFactory::getUser();
     $filter = JFilterInput::getInstance();
     $name = $filter->clean($name, 'string');
     if ($my->id == 0) {
         return $this->ajaxBlockUnregister();
     }
     $objResponse = new JAXResponse();
     $appModel = CFactory::getModel('apps');
     // Get List of added apps
     $apps = $appModel->getAvailableApps();
     $addedApps = array();
     for ($i = 0; $i < count($apps); $i++) {
         $app = $apps[$i];
         if ($appModel->isAppUsed($my->id, $app->name)) {
             $addedApps[] = $app;
         }
     }
     $appModel->addApp($my->id, $name);
     $theApp = $appModel->getAppInfo($name);
     $appId = $appModel->getUserApplicationId($name, $my->id);
     $act = new stdClass();
     $act->cmd = 'application.add';
     $act->actor = $my->id;
     $act->target = 0;
     $act->title = '';
     //JText::_('COM_COMMUNITY_ACTIVITIES_APPLICATIONS_ADDED');
     $act->content = '';
     $act->app = 'app.install.' . $name;
     $act->cid = 0;
     $params = new JRegistry('');
     $params->set('app', $name);
     CActivityStream::addActor($act, $params->toString());
     //CFactory::load( 'libraries' , 'userpoints' );
     CUserPoints::assignPoint('application.add');
     // Change cWindow title
     $objResponse->addAssign('cwin_logo', 'innerHTML', JText::_('COM_COMMUNITY_ADD_APPLICATION_TITLE'));
     $formAction = CRoute::_('index.php?option=com_community&view=friends&task=deleteSent', false);
     $action = '<form name="cancelRequest" action="" method="POST">';
     $action .= '<input type="button" class="input button" name="save" onclick="joms.apps.showSettingsWindow(\'' . $appId . '\',\'' . $name . '\');" value="' . JText::_('COM_COMMUNITY_VIDEOS_SETTINGS_BUTTON') . '" />&nbsp;';
     $action .= '<input type="button" class="input button" onclick="cWindowHide();return false;" name="cancel" value="' . JText::_('COM_COMMUNITY_BUTTON_CLOSE_BUTTON') . '" />';
     $action .= '</form>';
     $html = '<div class="ajax-notice-apps-added">' . JText::_('COM_COMMUNITY_APPS_AJAX_ADDED') . '</div>';
     $objResponse->addScriptCall('cWindowAddContent', $html, $action);
     $objResponse->addScriptCall("joms.jQuery('." . $name . " .added-button').remove();");
     $objResponse->addScriptCall("joms.jQuery('." . $name . "').append('<span class=\"added-ribbon\">" . JText::_('COM_COMMUNITY_APPS_LIST_ADDED') . "</span>');");
     return $objResponse->sendResponse();
 }
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:55,代码来源:apps.php

示例15: getGroupChildId

 public static function getGroupChildId($gid)
 {
     $db = JFactory::getDBO();
     //CFactory::load( 'libraries' , 'activities' );
     $sql = "SELECT\n\t\t\t\t\t\t" . $db->quoteName("id") . "\n\t\t\t\tFROM\n\t\t\t\t\t\t" . $db->quoteName("#__community_groups_discuss") . "\n\t\t\t\tWHERE\n\t\t\t\t\t\t" . $db->quoteName("groupid") . " = " . $db->Quote($gid);
     $db->setQuery($sql);
     $row = $db->loadobjectList();
     if ($db->getErrorNum()) {
         JError::raiseError(500, $db->stderr());
     }
     $sql = "SELECT\n\t\t\t\t\t\t" . $db->quoteName("id") . "\n\t\t\t\tFROM\n\t\t\t\t\t\t" . $db->quoteName("#__community_groups_bulletins") . "\n\t\t\t\tWHERE\n\t\t\t\t\t\t" . $db->quoteName("groupid") . " = " . $db->Quote($gid);
     $db->setQuery($sql);
     $bulletin = $db->loadobjectList();
     if ($db->getErrorNum()) {
         JError::raiseError(500, $db->stderr());
     }
     $sql = "SELECT\n\t\t\t\t\t\t" . $db->quoteName("id") . "\n\t\t\t\tFROM\n\t\t\t\t\t\t" . $db->quoteName("#__community_wall") . "\n\t\t\t\tWHERE\n\t\t\t\t\t\t" . $db->quoteName("contentid") . " = " . $db->Quote($gid);
     $db->setQuery($sql);
     $wall = $db->loadobjectList();
     if ($db->getErrorNum()) {
         JError::raiseError(500, $db->stderr());
     }
     $row = array_merge($row, array_merge($bulletin, $wall));
     if (!empty($row)) {
         $ids_array = array();
         foreach ($row as $tempid) {
             array_push($ids_array, $tempid->id);
         }
         $ids = implode(',', $ids_array);
         $ids .= ',' . $gid;
         //Remove All groupActivity stream
         CActivityStream::removeGroup($ids);
     }
 }
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:34,代码来源:groups.php


注:本文中的CActivityStream类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。