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


PHP CActivityStream::remove方法代码示例

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


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

示例1: onAfterDeleteTopic

 public function onAfterDeleteTopic($target)
 {
     CFactory::load('libraries', 'activities');
     CActivityStream::remove('kunena.post', $target->id);
 }
开发者ID:laiello,项目名称:senluonirvana,代码行数:5,代码来源:activity.php

示例2: deleteEvent

 public function deleteEvent()
 {
     CFactory::load('libraries', 'activities');
     require_once JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'defines.community.php';
     $event =& JTable::getInstance('Event', 'CTable');
     $data = JRequest::getVar('cid', '', 'post');
     $error = array();
     if (!is_array($data)) {
         $data[] = $data;
     }
     if (empty($data)) {
         JError::raiseError('500', JText::_('COM_COMMUNITY_INVALID_ID'));
     }
     foreach ($data as $id) {
         $event->load($id);
         $this->triggerEvents('onBeforeEventDelete', $event);
         $event->deleteAllMembers();
         $event->deleteWalls();
         $tmp = $event;
         if ($event->delete()) {
             if ($tmp->avatar != "components/com_community/assets/eventAvatar.png" && !empty($tmp->avatar)) {
                 $path = explode('/', $tmp->avatar);
                 $file = JPATH_ROOT . DS . $path[0] . DS . $path[1] . DS . $path[2] . DS . $path[3];
                 if (JFile::exists($file)) {
                     JFile::delete($file);
                 }
             }
             if ($tmp->thumb != "components/com_community/assets/event_thumb.png" && !empty($tmp->avatar)) {
                 $file = JPATH_ROOT . DS . CString::str_ireplace('/', DS, $tmp->thumb);
                 if (JFile::exists($file)) {
                     JFile::delete($file);
                 }
             }
             $this->triggerEvents('onAfterEventDelete', $tmp);
             CActivityStream::remove('events', $id);
             $error[] = false;
         } else {
             $error[] = true;
         }
     }
     $mainframe =& JFactory::getApplication();
     if (in_array(true, $error)) {
         $mainframe->redirect('index.php?option=com_community&view=events', JText::_('COM_COMMUNITY_EVENTS_REMOVING_ERROR'), 'error');
     } else {
         $mainframe->redirect('index.php?option=com_community&view=events', JText::_('COM_COMMUNITY_EVENTS_DELETED'));
     }
 }
开发者ID:Simarpreet05,项目名称:joomla,代码行数:47,代码来源:events.php

示例3: removealbum

 /**
  * Controller method to remove an album
  **/
 public function removealbum()
 {
     if ($this->blockUnregister()) {
         return;
     }
     // Check for request forgeries
     JRequest::checkToken() or jexit(JText::_('CC INVALID TOKEN'));
     // Get the album id.
     $my = CFactory::getUser();
     $id = JRequest::getInt('albumid', '');
     $task = JRequest::getCmd('currentTask', '');
     $album =& JTable::getInstance('Album', 'CTable');
     $album->load($id);
     if ($album->permanent == 1) {
         return;
     }
     /** HTGMOD **/
     $handler = $this->_getHandler($album);
     // Load libraries
     CFactory::load('models', 'photos');
     CFactory::load('libraries', 'activities');
     $album =& JTable::getInstance('Album', 'CTable');
     $album->load($id);
     CFactory::load('helpers', 'owner');
     if (!$handler->hasPermission($album->id)) {
         $this->blockUserAccess();
         return;
     }
     $model = CFactory::getModel('photos');
     CFactory::load('libraries', 'apps');
     $appsLib =& CAppPlugins::getInstance();
     $appsLib->loadApplications();
     $params = array();
     $params[] = $album;
     $url = $handler->getEditedAlbumURL($album->id);
     if ($album->delete()) {
         $appsLib->triggerEvent('onAfterAlbumDelete', $params);
         // @rule: remove from featured item if item is featured
         CFactory::load('libraries', 'featured');
         $featured = new CFeatured(FEATURED_ALBUMS);
         $featured->delete($album->id);
         //add user points
         CFactory::load('libraries', 'userpoints');
         CUserPoints::assignPoint('album.remove');
         // Remove from activity stream
         CActivityStream::remove('photos', $id);
         $mainframe =& JFactory::getApplication();
         $task = !empty($task) ? '&task=' . $task : '';
         $message = JText::sprintf('CC ALBUM REMOVED', $album->name);
         $mainframe->redirect($url, $message);
     }
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:55,代码来源:photos.php

示例4: ajaxDeleteEvent

 /**
  *  Ajax function to delete a event
  *
  * @param	$eventId	The specific event id to unpublish
  **/
 public function ajaxDeleteEvent($eventId, $step = 1)
 {
     $response = new JAXResponse();
     $filter = JFilterInput::getInstance();
     $eventId = $filter->clean($eventId, 'int');
     $step = $filter->clean($step, 'int');
     CFactory::load('libraries', 'activities');
     CFactory::load('helpers', 'owner');
     CFactory::load('models', 'events');
     $model = CFactory::getModel('events');
     $event =& JTable::getInstance('Event', 'CTable');
     $event->load($eventId);
     $membersCount = $event->getMembersCount('accepted');
     $my = CFactory::getUser();
     $isMine = $my->id == $event->creator;
     CFactory::load('helpers', 'event');
     $handler = CEventHelper::getHandler($event);
     // only check for step 1 as the following steps will remove member, including event creator which will violate permission
     if (!$handler->manageable() && $step == 1) {
         $content = JText::_('COM_COMMUNITY_EVENTS_NOT_ALLOW_DELETE');
         $actions = '<input type="button" class="button" onclick="cWindowHide();" value="' . JText::_('COM_COMMUNITY_CANCEL') . '"/>';
         $response->addScriptCall('cWindowAddContent', $content, $actions);
         return $response->sendResponse();
     }
     $response->addScriptCall('cWindowResize', 160);
     $doneMessage = ' - <span class=\'success\'>' . JText::_('COM_COMMUNITY_DONE') . '</span><br />';
     $failedMessage = ' - <span class=\'failed\'>' . JText::_('COM_COMMUNITY_FAILED') . '</span><br />';
     switch ($step) {
         case 1:
             // Nothing gets deleted yet. Just show a messge to the next step
             if (empty($eventId)) {
                 $content = JText::_('COM_COMMUNITY_EVENTS_INVALID_ID_ERROR');
             } else {
                 $content = '<strong>' . JText::sprintf('COM_COMMUNITY_EVENTS_DELETING', $event->title) . '</strong><br/>';
                 $content .= JText::_('COM_COMMUNITY_EVENTS_DELETE_MEMBERS');
                 $response->addScriptCall('jax.call(\'community\', \'events,ajaxDeleteEvent\', \'' . $eventId . '\', 2 );');
                 $this->triggerEvents('onBeforeEventDelete', $event);
             }
             $response->addScriptCall('cWindowAddContent', $content);
             break;
         case 2:
             // Delete all event members
             if ($event->deleteAllMembers()) {
                 $content = $doneMessage;
             } else {
                 $content = $failedMessage;
             }
             $content .= JText::_('COM_COMMUNITY_EVENTS_DELETE_WALLS');
             $response->addScriptCall('joms.jQuery("#cWindowContent").append("' . $content . '");');
             $response->addScriptCall('jax.call(\'community\', \'events,ajaxDeleteEvent\', \'' . $eventId . '\', 3 );');
             break;
         case 3:
             // Delete all event wall
             if ($event->deleteWalls()) {
                 $content = $doneMessage;
             } else {
                 $content = $failedMessage;
             }
             $response->addScriptCall('joms.jQuery("#cWindowContent").append("' . $content . '");');
             $response->addScriptCall('jax.call(\'community\', \'events,ajaxDeleteEvent\', \'' . $eventId . '\', 4 );');
             break;
         case 4:
             // Delete event master record
             $eventData = $event;
             if ($event->delete()) {
                 // Delete featured event.
                 CFactory::load('libraries', 'featured');
                 $featured = new CFeatured(FEATURED_EVENTS);
                 $featured->delete($eventId);
                 jimport('joomla.filesystem.file');
                 if ($eventData->avatar != "components/com_community/assets/eventAvatar.png" && !empty($eventData->avatar)) {
                     $path = explode('/', $eventData->avatar);
                     $file = JPATH_ROOT . DS . $path[0] . DS . $path[1] . DS . $path[2] . DS . $path[3];
                     if (JFile::exists($file)) {
                         JFile::delete($file);
                     }
                 }
                 if ($eventData->thumb != "components/com_community/assets/event_thumb.png" && !empty($eventData->avatar)) {
                     //$path = explode('/', $eventData->avatar);
                     //$file = JPATH_ROOT . DS . $path[0] . DS . $path[1] . DS . $path[2] .DS . $path[3];
                     $file = JPATH_ROOT . DS . CString::str_ireplace('/', DS, $eventData->thumb);
                     if (JFile::exists($file)) {
                         JFile::delete($file);
                     }
                 }
                 $html = '<div class=\\"info\\" style=\\"display: none;\\">' . JText::_('COM_COMMUNITY_EVENTS_DELETED') . '</div>';
                 $response->addScriptCall('joms.jQuery("' . $html . '").prependTo("#community-wrap").fadeIn();');
                 $response->addScriptCall('joms.jQuery("#community-groups-wrap").fadeOut();');
                 $content = JText::_('COM_COMMUNITY_EVENTS_DELETED');
                 //trigger for onGroupDelete
                 $this->triggerEvents('onAfterEventDelete', $eventData);
                 // Remove from activity stream
                 CActivityStream::remove('events', $eventId);
                 $this->cacheClean(array(COMMUNITY_CACHE_TAG_FRONTPAGE, COMMUNITY_CACHE_TAG_EVENTS, COMMUNITY_CACHE_TAG_EVENTS_CAT, COMMUNITY_CACHE_TAG_ACTIVITIES));
             } else {
//.........这里部分代码省略.........
开发者ID:Simarpreet05,项目名称:joomla,代码行数:101,代码来源:events.php

示例5: 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

示例6: deleteBulletin

 public function deleteBulletin()
 {
     $mainframe =& JFactory::getApplication();
     $my = CFactory::getUser();
     CFactory::load('libraries', 'activities');
     if ($my->id == 0) {
         return $this->blockUnregister();
     }
     $bulletinId = JRequest::getInt('bulletinid', '', 'POST');
     $groupid = JRequest::getInt('groupid', '', 'POST');
     if (empty($bulletinId) || empty($groupid)) {
         echo JText::_('COM_COMMUNITY_INVALID_ID');
         return;
     }
     CFactory::load('helpers', 'owner');
     CFactory::load('models', 'bulletins');
     $groupsModel = CFactory::getModel('groups');
     $bulletin =& JTable::getInstance('Bulletin', 'CTable');
     $group =& JTable::getInstance('Group', 'CTable');
     $group->load($groupid);
     if ($groupsModel->isAdmin($my->id, $group->id) || COwnerHelper::isCommunityAdmin()) {
         $bulletin->load($bulletinId);
         if ($bulletin->delete()) {
             //add user points
             CFactory::load('libraries', 'userpoints');
             CUserPoints::assignPoint('group.news.remove');
             CActivityStream::remove('groups.bulletin', $bulletinId);
             $this->cacheClean(array(COMMUNITY_CACHE_TAG_ACTIVITIES, COMMUNITY_CACHE_TAG_GROUPS_DETAIL));
             $mainframe->redirect(CRoute::_('index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $groupid, false), JText::_('COM_COMMUNITY_BULLETIN_REMOVED'));
         }
     } else {
         $mainframe->redirect(CRoute::_('index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $groupid, false), JText::_('COM_COMMUNITY_GROUPS_DISCUSSION_DELETE_WARNING'));
     }
 }
开发者ID:Simarpreet05,项目名称:joomla,代码行数:34,代码来源:groups.php

示例7: removevideo

 /**
  * Controller method to remove a video
  **/
 public function removevideo()
 {
     $videoId = JRequest::getVar('videoid', '', 'POST');
     $message = $this->deleteVideo($videoId);
     $mainframe = JFactory::getApplication();
     $url = CRoute::_('index.php?option=com_community&view=videos', false);
     if ($message) {
         // Remove from activity stream
         CFactory::load('libraries', 'activities');
         CActivityStream::remove('videos', $videoId);
         $mainframe->redirect($url, $message);
     } else {
         $message = JText::_('CC ERROR DELETING VIDEO');
         $mainframe->redirect($url, $message);
     }
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:19,代码来源:videos.php

示例8: delete

 /**
  * Delete an album
  * Set all photo within the album to have albumid = 0
  * Do not yet delete the photos, this could be very slow on an album that
  * has huge amount of photos
  */
 public function delete($pk = null)
 {
     //lets get all the photo info under the album
     $photoModel = CFactory::getModel('photos');
     $photos = $photoModel->getAllPhotos($this->id, $this->type);
     $db = JFactory::getDBO();
     $strSQL = 'UPDATE ' . $db->quoteName('#__community_photos') . ' SET ' . $db->quoteName('albumid') . '=' . $db->Quote(0) . ', ' . $db->quoteName('status') . ' = ' . $db->quote('temp') . ' WHERE ' . $db->quoteName('albumid') . '=' . $db->Quote($this->id);
     $db->setQuery($strSQL);
     $result = $db->query();
     // The whole local folder should be deleted, regardless of the storage type
     // BUT some old version of JomSocial might store other photo in the same
     // folder, we check in db first
     $strSQL = 'SELECT count(*) FROM ' . $db->quoteName('#__community_photos') . ' WHERE ' . $db->quoteName('image') . ' LIKE ' . $db->Quote('%' . dirname($this->path) . '%');
     $db->setQuery($strSQL);
     $result = $db->loadResult();
     if ($result == 0) {
         if (JFolder::exists(JPATH_ROOT . '/' . rtrim($this->path, '/') . '/' . $this->id)) {
             JFolder::delete(JPATH_ROOT . '/' . rtrim($this->path, '/') . '/' . $this->id);
         }
     }
     // We need to delete all activity stream related to this album
     CActivityStream::remove('photos', $this->id);
     //we need to delete all activity related to the photos inside the album as well
     if (isset($photos) && count($photos) > 0) {
         foreach ($photos as $photo) {
             CActivityStream::remove('photos', $photo->id);
         }
     }
     /* Delete album directory */
     $config = CFactory::getConfig();
     $dirPath = JPATH_ROOT . '/' . $config->getString('imagefolder') . '/photos/' . $this->creator . '/' . $this->id;
     if (JFolder::exists($dirPath)) {
         JFolder::delete($dirPath);
     }
     $appsLib = CAppPlugins::getInstance();
     $appsLib->loadApplications();
     $appsLib->triggerEvent('onAfterAlbumDelete', array($this));
     // @rule: remove from featured item if item is featured
     $featured = new CFeatured(FEATURED_ALBUMS);
     $featured->delete($this->id);
     // if this is an avatar, we have to remove the avatar from the respective user
     if ($this->type == 'profile.avatar') {
         $user = CFactory::getUser($this->creator);
         $userModel = CFactory::getModel('User');
         $userModel->removeProfilePicture($user->id, 'avatar');
         $userModel->removeProfilePicture($user->id, 'thumb');
         $activityModel = CFactory::getModel('activities');
         $activityModel->removeAvatarActivity('profile.avatar.upload', $user->id);
     } elseif ($this->type == 'event.avatar') {
         $eventTable = JTable::getInstance('Event', 'CTable');
         $eventTable->load($this->eventid);
         $eventTable->removeAvatar();
         $activityModel = CFactory::getModel('activities');
         $activityModel->removeAvatarActivity('events.avatar.upload', $this->eventid);
     } elseif ($this->type == 'group.avatar') {
         $eventTable = JTable::getInstance('Group', 'CTable');
         $eventTable->load($this->groupid);
         $eventTable->removeAvatar();
         $activityModel = CFactory::getModel('activities');
         $activityModel->removeAvatarActivity('groups.avatar.upload', $this->groupid);
     }
     //add user points
     CUserPoints::assignPoint('album.remove');
     // Remove from activity stream
     //CActivityStream::remove('photos', $this->id);
     // Remove from activity stream
     CActivityStream::remove('albums', $this->id);
     // Remove likes activity
     $likeModel = CFactory::getModel('like');
     $likeModel->removeLikes('album', $this->id);
     // Remove comment
     $wallModel = CFactory::getModel('wall');
     $wallModel->deletePostByType('albums', $this->id);
     return parent::delete();
 }
开发者ID:Jougito,项目名称:DynWeb,代码行数:81,代码来源:album.php

示例9: ajaxDeleteGroup


//.........这里部分代码省略.........
                 if (CommunityModelGroups::deleteGroupBulletins($groupId)) {
                     $content = $doneMessage;
                 } else {
                     $content = $failedMessage;
                 }
                 $content .= JText::_('CC DELETING GROUP MEMBERS');
                 $response->addScriptCall('joms.jQuery("#cWindowContent").append("' . $content . '");');
                 $response->addScriptCall('jax.call(\'community\', \'groups,ajaxDeleteGroup\', \'' . $groupId . '\', 3);');
                 break;
             case 3:
                 // Delete all group members
                 if (CommunityModelGroups::deleteGroupMembers($groupId)) {
                     $content = $doneMessage;
                 } else {
                     $content = $failedMessage;
                 }
                 $content .= JText::_('CC DELETING GROUP WALLS');
                 $response->addScriptCall('joms.jQuery("#cWindowContent").append("' . $content . '");');
                 $response->addScriptCall('jax.call(\'community\', \'groups,ajaxDeleteGroup\', \'' . $groupId . '\', 4);');
                 break;
             case 4:
                 // Delete all group wall
                 if (CommunityModelGroups::deleteGroupWall($groupId)) {
                     $content = $doneMessage;
                 } else {
                     $content = $failedMessage;
                 }
                 $content .= JText::_('CC DELETING GROUP DISCUSSIONS');
                 $response->addScriptCall('joms.jQuery("#cWindowContent").append("' . $content . '");');
                 $response->addScriptCall('jax.call(\'community\', \'groups,ajaxDeleteGroup\', \'' . $groupId . '\', 5);');
                 break;
             case 5:
                 // Delete all group discussions
                 if (CommunityModelGroups::deleteGroupDiscussions($groupId)) {
                     $content = $doneMessage;
                 } else {
                     $content = $failedMessage;
                 }
                 $content .= JText::_('CC DELETING GROUP MEDIA');
                 $response->addScriptCall('joms.jQuery("#cWindowContent").append("' . $content . '");');
                 $response->addScriptCall('jax.call(\'community\', \'groups,ajaxDeleteGroup\', \'' . $groupId . '\', 6);');
                 break;
             case 6:
                 // Delete all group's media files
                 if (CommunityModelGroups::deleteGroupMedia($groupId)) {
                     $content = $doneMessage;
                 } else {
                     $content = $failedMessage;
                 }
                 $response->addScriptCall('joms.jQuery("#cWindowContent").append("' . $content . '");');
                 $response->addScriptCall('jax.call(\'community\', \'groups,ajaxDeleteGroup\', \'' . $groupId . '\', 7);');
                 break;
             case 7:
                 // Delete group
                 $group =& JTable::getInstance('Group', 'CTable');
                 $group->load($groupId);
                 $groupData = $group;
                 if ($group->delete($groupId)) {
                     CFactory::load('libraries', 'featured');
                     $featured = new CFeatured(FEATURED_GROUPS);
                     $featured->delete($groupId);
                     jimport('joomla.filesystem.file');
                     //@rule: Delete only thumbnail and avatars that exists for the specific group
                     if ($groupData->avatar != "components/com_community/assets/group.jpg" && !empty($groupData->avatar)) {
                         $path = explode('/', $groupData->avatar);
                         $file = JPATH_ROOT . DS . $path[0] . DS . $path[1] . DS . $path[2] . DS . $path[3];
                         if (JFile::exists($file)) {
                             JFile::delete($file);
                         }
                     }
                     if ($groupData->thumb != "components/com_community/assets/group_thumb.jpg" && !empty($groupData->thumb)) {
                         $path = explode('/', $groupData->thumb);
                         $file = JPATH_ROOT . DS . $path[0] . DS . $path[1] . DS . $path[2] . DS . $path[3];
                         if (JFile::exists($file)) {
                             JFile::delete($file);
                         }
                     }
                     $html = '<div class=\\"info\\" style=\\"display: none;\\">' . JText::_('CC GROUP DELETED') . '</div>';
                     $response->addScriptCall('joms.jQuery("' . $html . '").prependTo("#community-wrap").fadeIn();');
                     $response->addScriptCall('joms.jQuery("#community-groups-wrap").fadeOut();');
                     $content = JText::_('CC GROUP DELETED');
                     //trigger for onGroupDelete
                     $this->triggerGroupEvents('onAfterGroupDelete', $groupData);
                     // Remove from activity stream
                     CActivityStream::remove('groups', $groupId);
                 } else {
                     $content = JText::_('CC ERROR WHILE DELETING GROUP');
                 }
                 $redirect = CRoute::_(JURI::root() . 'index.php?option=com_community&view=groups');
                 $buttons = '<input type="button" class="button" id="groupDeleteDone" onclick="cWindowHide(); window.location=\'' . $redirect . '\';" value="' . JText::_('Done') . '"/>';
                 $response->addAssign('cWindowContent', 'innerHTML', $content);
                 $response->addScriptCall('cWindowActions', $buttons);
                 $response->addScriptCall('cWindowResize', 100);
                 break;
             default:
                 break;
         }
     }
     return $response->sendResponse();
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:101,代码来源:groups.php

示例10: delete

 /**
  * Delete an album
  * Set all photo within the album to have albumid = 0
  * Do not yet delete the photos, this could be very slow on an album that 
  * has huge amount of photos	 	 	 
  */
 public function delete()
 {
     $db =& JFactory::getDBO();
     $strSQL = 'UPDATE ' . $db->nameQuote('#__community_photos') . ' SET ' . $db->nameQuote('albumid') . '=' . $db->Quote(0) . ' WHERE ' . $db->nameQuote('albumid') . '=' . $db->Quote($this->id);
     $db->setQuery($strSQL);
     $result = $db->query();
     // The whole local folder should be deleted, regardless of the storage type
     // BUT some old version of JomSocial might store other photo in the same
     // folder, we check in db first
     $strSQL = 'SELECT count(*) FROM ' . $db->nameQuote('#__community_photos') . ' WHERE ' . $db->nameQuote('image') . ' LIKE ' . $db->Quote('%' . dirname($this->path) . '%');
     $db->setQuery($strSQL);
     $result = $db->loadResult();
     if ($result == 0) {
         JFolder::delete(JPATH_ROOT . DS . rtrim($this->path, '/') . DS . $this->id);
     }
     // We need to delete all activity stream related to this album
     CFactory::load('libraries', 'activities');
     CActivityStream::remove('photos', $this->id);
     return parent::delete();
 }
开发者ID:Simarpreet05,项目名称:joomla,代码行数:26,代码来源:album.php

示例11: edit

 /**
  * Controller method responsible to display the edit task.
  *
  * @return    none
  * */
 public function edit()
 {
     $document = JFactory::getDocument();
     $viewType = $document->getType();
     $jinput = JFactory::getApplication()->input;
     $viewName = $jinput->get('view', $this->getName(), 'String');
     $view = $this->getView($viewName, '', $viewType);
     $eventId = $jinput->get('eventid', 0, 'Int');
     $event = JTable::getInstance('Event', 'CTable');
     $event->load($eventId);
     if (empty($event->id)) {
         return JError::raiseWarning(404, JText::_('COM_COMMUNITY_EVENTS_NOT_AVAILABLE_ERROR'));
     }
     $my = CFactory::getUser();
     $handler = CEventHelper::getHandler($event);
     if (!$handler->manageable()) {
         echo JText::_('COM_COMMUNITY_RESTRICTED_ACCESS');
         return;
     }
     if ($jinput->getMethod() == 'POST') {
         $eid = $this->save($event);
         if ($eid !== false) {
             $mainframe = JFactory::getApplication();
             $event->load($eventId);
             //trigger for onGroupCreate
             $this->triggerEvents('onEventUpdate', $event);
             $action_str = 'event.update';
             $act = new stdClass();
             $act->cmd = $action_str;
             $act->actor = $my->id;
             $act->target = 0;
             $act->title = '';
             //JText::sprintf('COM_COMMUNITY_GROUPS_GROUP_UPDATED' , '{group_url}' , $group->name );
             $act->content = '';
             $act->app = 'events.update';
             $act->cid = $event->id;
             $act->eventid = $event->id;
             $act->event_access = $event->permission;
             $act->groupid = $event->type == 'group' ? $event->contentid : 0;
             $params = new CParameter('');
             $params->set('action', $action_str);
             $params->set('event_url', 'index.php?option=com_community&view=events&task=viewevent&eventid=' . $event->id);
             // Add activity logging. Delete old ones
             CActivityStream::remove($act->app, $act->cid);
             CActivityStream::add($act, $params->toString());
             // add user points
             CUserPoints::assignPoint('events.update');
             $mainframe->redirect($handler->getFormattedLink('index.php?option=com_community&view=events&task=viewevent&eventid=' . $event->id, false), JText::sprintf('COM_COMMUNITY_EVENTS_UPDATE_NOTICE', $event->title));
             return;
         }
     }
     $this->cacheClean(array(COMMUNITY_CACHE_TAG_EVENTS_CAT, COMMUNITY_CACHE_TAG_ACTIVITIES));
     echo $view->get(__FUNCTION__, $event);
 }
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:59,代码来源:events.php

示例12: removeProfileCover

 public function removeProfileCover($id)
 {
     $db = $this->getDBO();
     // Test if the record exists.
     $query = 'SELECT ' . $db->quoteName('cover') . ' FROM ' . $db->quoteName('#__community_users') . 'WHERE ' . $db->quoteName('userid') . '=' . $db->Quote($id);
     $db->setQuery($query);
     $oldFile = $db->loadResult();
     if (JFile::exists($oldFile)) {
         $query = "SELECT " . $db->quoteName('id') . " FROM " . $db->quoteName('#__community_photos') . " WHERE " . $db->quoteName('image') . " = " . $db->quote($oldFile);
         $db->setQuery($query);
         $pid = $db->loadResult();
         $photoTable = JTable::getInstance('Photo', 'CTable');
         $photoTable->load($pid);
         $photoTable->delete();
         CActivityStream::remove('cover.upload', $pid);
     }
     $query = 'UPDATE ' . $db->quoteName('#__community_users') . ' ' . 'SET ' . $db->quoteName('cover') . '=' . $db->Quote('') . ' ' . 'WHERE ' . $db->quoteName('userid') . '=' . $db->Quote($id);
     $db->setQuery($query);
     $db->query($query);
     if ($db->getErrorNum()) {
         JError::raiseError(500, $db->stderr());
     }
     return true;
 }
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:24,代码来源:user.php

示例13: delete

 /**
  * Delete an album
  * Set all photo within the album to have albumid = 0
  * Do not yet delete the photos, this could be very slow on an album that
  * has huge amount of photos
  */
 public function delete($pk = null)
 {
     //lets get all the photo info under the album
     $photoModel = CFactory::getModel('photos');
     $photos = $photoModel->getAllPhotos($this->id, $this->type);
     $db = JFactory::getDBO();
     $strSQL = 'UPDATE ' . $db->quoteName('#__community_photos') . ' SET ' . $db->quoteName('albumid') . '=' . $db->Quote(0) . ', ' . $db->quoteName('status') . ' = ' . $db->quote('temp') . ' WHERE ' . $db->quoteName('albumid') . '=' . $db->Quote($this->id);
     $db->setQuery($strSQL);
     $result = $db->query();
     // The whole local folder should be deleted, regardless of the storage type
     // BUT some old version of JomSocial might store other photo in the same
     // folder, we check in db first
     $strSQL = 'SELECT count(*) FROM ' . $db->quoteName('#__community_photos') . ' WHERE ' . $db->quoteName('image') . ' LIKE ' . $db->Quote('%' . dirname($this->path) . '%');
     $db->setQuery($strSQL);
     $result = $db->loadResult();
     if ($result == 0) {
         if (JFolder::exists(JPATH_ROOT . '/' . rtrim($this->path, '/') . '/' . $this->id)) {
             JFolder::delete(JPATH_ROOT . '/' . rtrim($this->path, '/') . '/' . $this->id);
         }
     }
     // We need to delete all activity stream related to this album
     CActivityStream::remove('photos', $this->id);
     //we need to delete all activity related to the photos inside the album as well
     if (isset($photos) && count($photos) > 0) {
         foreach ($photos as $photo) {
             CActivityStream::remove('photos', $photo->id);
         }
     }
     return parent::delete();
 }
开发者ID:SMARTRESPONSOR,项目名称:SMARTRESPONSOR,代码行数:36,代码来源:album.php

示例14: removeJomsocialActivity

 public static function removeJomsocialActivity($blog)
 {
     $config = EasyBlogHelper::getConfig();
     if (!$config->get('integrations_jomsocial_unpublish_remove_activity')) {
         return false;
     }
     $jsCoreFile = JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_community' . DIRECTORY_SEPARATOR . 'libraries' . DIRECTORY_SEPARATOR . 'core.php';
     $lang = JFactory::getLanguage();
     $lang->load('com_easyblog', JPATH_ROOT);
     if (!JFile::exists($jsCoreFile)) {
         return false;
     }
     require_once $jsCoreFile;
     CFactory::load('libraries', 'activities');
     CActivityStream::remove('easyblog', $blog->id);
 }
开发者ID:Tommar,项目名称:vino2,代码行数:16,代码来源:helper.php

示例15: ajaxRemoveVideo

 public function ajaxRemoveVideo($id)
 {
     $filter = JFilterInput::getInstance();
     $id = $filter->clean($id, 'int');
     if (!COwnerHelper::isRegisteredUser()) {
         return $this->ajaxBlockUnregister();
     }
     $my = CFactory::getUser();
     $video = JTable::getInstance('Video', 'CTable');
     $video->load($id);
     $message = $this->deleteVideo($video->id, false);
     $json = array();
     if ($message != false) {
         CActivityStream::remove('videos', $video->id);
         $json['success'] = true;
         $json['message'] = $message;
     } else {
         $message = JText::_('COM_COMMUNITY_VIDEOS_DELETING_VIDEO_ERROR');
         $json['error'] = $message;
     }
     die(json_encode($json));
 }
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:22,代码来源:videos.php


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