本文整理汇总了PHP中SocialTable::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP SocialTable::delete方法的具体用法?PHP SocialTable::delete怎么用?PHP SocialTable::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SocialTable
的用法示例。
在下文中一共展示了SocialTable::delete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete
/**
* Overrides the delete function
*
* @since 1.0
* @access public
* @return bool
*/
public function delete($pk = null)
{
$state = parent::delete();
// Delete any items that are related to this stream
$stream = FD::stream();
$stream->delete($this->id, 'feeds');
return $state;
}
示例2: delete
public function delete($pk = null)
{
$state = parent::delete($pk);
if (!$state) {
return false;
}
// Delete all the children as well
foreach ($this->getChildren() as $child) {
$child->delete();
}
return true;
}
示例3: delete
/**
* Override
*
* @since 1.0
* @access public
* @param string
* @return
*/
public function delete($pk = null)
{
// Delete the record from the database first.
$state = parent::delete();
// Get the storage path
$path = $this->getStoragePath(true);
$path = $path . '/' . $this->hash;
$storage = FD::storage($this->storage);
$state = $storage->delete($path);
// Delete the stream item related to this file
FD::stream()->delete($this->id, SOCIAL_TYPE_FILES);
if (!$state) {
$this->setError(JText::_('Unable to delete the file from ' . $storage));
return false;
}
return true;
}
示例4: delete
/**
* Override parent's delete method
*
* @since 1.0
* @access public
* @param string
* @return
*/
public function delete($pk = null)
{
// Delete the record from the database first.
$state = parent::delete();
// Now, try to delete the folder that houses this photo.
$config = FD::config();
// Check if this photo is used as a profile cover
if ($this->isProfileCover()) {
$cover = FD::table('Cover');
$cover->load(array('photo_id' => $this->id));
$cover->delete();
}
// Needs to create an instance of image to create
// and instnance of photos
$image = FD::image();
$photoLib = FD::get('Photos', $image);
$basePath = $photoLib->getStoragePath($this->album_id, $this->id);
// Construct the base path to the photos folder
$container = FD::cleanPath($config->get('photos.storage.container'));
$basePath = '/' . $container . '/' . $this->album_id . '/' . $this->id;
// @legacy
// @since 1.2.7
// To fix older version issues where the full path is stored for the photo
$relative = str_ireplace(JPATH_ROOT, '', $basePath);
// below checking is to make sure the computed relative path is not pointing to photos root folder.
$photoContainer = FD::cleanPath($config->get('photos.storage.container'));
$photoContainer = '/' . ltrim($photoContainer, '/');
$photoContainer = rtrim($photoContainer, '/');
$photoContainer = JPath::clean($photoContainer);
$photoRelPath = '/' . ltrim($relative, '/');
$photoRelPath = rtrim($photoRelPath, '/');
$photoRelPath = JPath::clean($photoRelPath);
if ($photoContainer != $photoRelPath) {
$storage = FD::storage($this->storage);
$storage->delete($relative, true);
}
$model = FD::model('Photos');
// Delete the meta's related to this photo
$model->deleteMeta($this->id);
// Delete all tags associated with this photo
$model->deleteTags($this->id);
// Delete all comments associated with this photo
$comments = FD::comments($this->id, SOCIAL_TYPE_PHOTO, 'upload', SOCIAL_APPS_GROUP_USER);
$comments->delete();
// Delete all likes associated with this photo
$likes = FD::get('Likes');
$likes->delete($this->id, SOCIAL_TYPE_PHOTO, 'upload');
// @points: photos.remove
// Deduct points for the author
$points = FD::points();
$points->assign('photos.remove', 'com_easysocial', $this->uid);
// Push the ordering of other photos
$model->pushPhotosOrdering($this->album_id, 0, $this->ordering, '-');
// Need to set cover to another photo
if ($this->isCover()) {
$album = $this->getAlbum();
if ($album->hasPhotos()) {
$result = $album->getPhotos(array('limit' => 1));
$album->cover_id = $result['photos'][0]->id;
} else {
$album->cover_id = 0;
}
$album->store();
}
return $state;
}
示例5: delete
/**
* Overrides parent implementation of delete so that we can delete the mappings.
*
* @since 1.0
* @access public
* @param mixed An optional primary key value to delete. If not set the instance property value is used.
* @return boolean True on success, false otherwise.
*/
public function delete($pk = null)
{
$model = FD::model('Lists');
$state = $model->deleteMapping($this->id);
// When there's some error deleting the mapping, just throw an error.
if (!$state) {
$this->setError(JText::_('COM_EASYSOCIAL_FRIENDS_LIST_ERROR_REMOVING_MAPPING'));
return $state;
}
$state = parent::delete($pk);
// @points: friends.list.delete
// Assign points when the user deletes an existing list
$points = FD::points();
$points->assign('friends.list.delete', 'com_easysocial', $this->user_id);
return $state;
}
示例6: delete
/**
* Override parent's behavior to delete this discussion
*
* @since 1.2
* @access public
* @param int
* @return
*/
public function delete($pk = null)
{
$state = parent::delete($pk);
if ($state) {
// Delete all the replies
$model = FD::model('Discussions');
$model->deleteReplies($this->id);
// Delete all stream items related to this discussion.
FD::stream()->delete($this->id, 'discussions');
// Delete any files associated in #__social_discussions_files
$model->deleteFiles($this->id);
}
return $state;
}
示例7: delete
/**
* Deletes a profile off the system. Any related profiles stuffs should also be deleted here.
*
* @since 1.0
* @access public
* @param mixed An optional primary key value to delete. If not set the instance property value is used.
*/
public function delete($pk = null)
{
// Try to delete this profile item.
$state = parent::delete($pk);
// Delete custom fields created for this profile type
if ($state) {
// Delete all field relations to this profile.
$model = FD::model('Fields');
$model->deleteFields($this->id, SOCIAL_TYPE_PROFILES);
// Delete all stream related items.
$stream = FD::stream();
$stream->delete($this->id, SOCIAL_TYPE_PROFILES);
// Delete profile avatar.
$avatar = FD::table('Avatar');
if ($avatar->load(array('uid' => $this->id, 'type' => SOCIAL_TYPE_PROFILES))) {
$avatar->delete();
}
// Delete default avatars for this profile.
$avatarModel = FD::model("Avatars");
$avatarModel->deleteDefaultAvatars($this->id, SOCIAL_TYPE_PROFILES);
}
return $state;
}
示例8: delete
/**
* Override parent's delete behavior.
*
* @since 1.0
* @access public
* @return boolean True on success false otherwise.
*/
public function delete($pk = null)
{
// Delete the record from the database
$state = parent::delete();
if (!$state) {
return false;
}
// Delete the temporary file.
jimport('joomla.filesystem.file');
$file = JPATH_ROOT . '/' . $this->path;
if (!JFile::exists($file)) {
$this->setError(JText::_('File does not exist on the site'));
return false;
}
$state = JFile::delete(JPATH_ROOT . '/' . $this->path);
if (!$state) {
$this->setError(JText::_('Unable to delete the phsyical file due to permission issues'));
return false;
}
return true;
}
示例9: delete
/**
* Override parent's delete behavior
*
* @since 1.0
* @access public
* @param string
* @return
*/
public function delete($pk = null)
{
$state = parent::delete();
// @points: photos.untag
// Deduct points from the author for untagging an item
$points = FD::points();
$points->assign('photos.untag', 'com_easysocial', $this->created_by);
return $state;
}
示例10: delete
public function delete($pk = null)
{
$state = parent::delete($pk);
if ($state) {
$this->removeStream('createTask');
}
return $state;
}
示例11: delete
/**
* Override parent's delete behavior
*
* @since 1.2
* @access public
* @return boolean
*/
public function delete($pk = null)
{
$state = parent::delete($pk);
if ($state) {
FD::model('Tasks')->deleteTasks($this->id);
$this->removeStream('createMilestone');
}
return $state;
}
示例12: delete
/**
* Override's parent delete implementation since we need to also delete the images and perform some
* cleanup.
*
* @since 1.0
* @access public
* @param int Primary key (Optional)
* @return bool True on success, false otherwise.
*
* @author Mark Lee <mark@stackideas.com>
*/
public function delete($pk = null)
{
$state = parent::delete($pk);
// Remove the avatars physical files.
if (!$this->removeImage(SOCIAL_AVATAR_SMALL)) {
return false;
}
if (!$this->removeImage(SOCIAL_AVATAR_MEDIUM)) {
return false;
}
if (!$this->removeImage(SOCIAL_AVATAR_LARGE)) {
return false;
}
// @TODO: Remove any association of user's profile with the current default avatar.
return $state;
}
示例13: delete
/**
* Override parent's behavior to delete the item.
*
* @since 1.2
* @access public
* @return
*/
public function delete($pk = null)
{
$state = parent::delete($pk);
if ($state) {
// Delete stream items
FD::stream()->delete($this->id, 'news');
// Delete comments
FD::comments($this->id, 'news', 'create')->delete();
// Delete likes
FD::likes()->delete($this->id, 'news', 'create');
}
return $state;
}
示例14: delete
/**
* Override the parent's delete method as we need to update the sequence when a
* workflow is deleted.
*
* Example:
* <code>
* <?php
* $table = FD::table( 'Workflow' );
* $table->delete();
* ?>
* </code>
*
* @since 1.0
* @access public
* @param Mixed An optional primary key value to delete. If not set the instance property value is used.
* @return bool True on success, false otherwise.
*
* @author Mark Lee <mark@stackideas.com>
*/
public function delete($pk = null)
{
$stepid = $this->id;
$result = parent::delete($pk);
if ($result) {
$this->updateSequence($this->sequence, $this->uid, 'substract');
if ($stepid != 0) {
// Get all the fields in this step
$fields = $this->getStepFields();
foreach ($fields as $field) {
// Delete the fields
$field->delete();
}
}
}
return $result;
}
示例15: delete
/**
* Override parent's delete implementation
*
* @since 1.0
* @access public
* @param string
* @return boolean True on success, false otherwise.
*/
public function delete($pk = null)
{
$state = parent::delete();
// Get the model
$model = FD::model('Badges');
// Delete the user's badge associations
$model->deleteAssociations($this->id);
// Delete the user's badge history
$model->deleteHistory($this->id);
// Delete any stream related items for this badge
$stream = FD::stream();
$stream->delete($this->id, SOCIAL_TYPE_BADGES);
return $state;
}