예제 #1
0
 public function delete($id)
 {
     $db =& JFactory::getDBO();
     // Check if any groups are assigned into this category
     $strSQL = 'SELECT COUNT(*) FROM ' . $db->nameQuote('#__community_groups') . ' ' . 'WHERE ' . $db->nameQuote('categoryid') . '=' . $db->Quote($id);
     $db->setQuery($strSQL);
     $count = $db->loadResult();
     if ($count <= 0) {
         // Only delete if no groups are assigned to this category.
         parent::delete($id);
         return true;
     }
     return false;
 }
예제 #2
0
파일: event.php 프로젝트: bizanto/Hooked
 /**
  * Override default delete method so that we can remove necessary data for Events.
  *
  *	@params	null
  *	@return	boolean	True on success false otherwise.	 	 
  **/
 public function delete($id = null)
 {
     $this->deleteAllMembers();
     $this->deleteWalls();
     return parent::delete($id);
 }
예제 #3
0
파일: photo.php 프로젝트: bizanto/Hooked
 /**
  * Delete the photo, the original and the actual resized photos and thumbnails
  */
 public function delete()
 {
     CFactory::load('libraries', 'storage');
     $storage = CStorage::getStorage($this->storage);
     $storage->delete($this->image);
     $storage->delete($this->thumbnail);
     JFile::delete(JPATH_ROOT . DS . $this->original);
     // If the original path is empty, we can delete it too
     $files = JFolder::files(dirname(JPATH_ROOT . DS . $this->original));
     if (empty($files)) {
         JFolder::delete(dirname(JPATH_ROOT . DS . $this->original));
     }
     // 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');
     CPhotoTagging::removeTagByPhoto($this->id);
     // delete the activities
     CFactory::load('libraries', 'activities');
     CActivities::remove('photos', $this->id);
     // delete the comments
     $wall = CFactory::getModel('wall');
     $wall->deleteAllChildPosts($this->id, 'photos');
     return parent::delete();
 }
예제 #4
0
 /**
  * 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();
 }