예제 #1
0
    /**
     * Удаляет альбом
     * @param int $album_id
     * @param str $differ
     * @param obj $inUploadPhoto
     * @return bool
     */
    public function deleteAlbum($album_id, $differ = '', $inUploadPhoto) {
        $album = cmsCore::c('db')->getNsCategory('cms_photo_albums', $album_id, $differ);
        if(!$album) { return false; }

        cmsCore::callEvent('DELETE_ALBUM', $album_id);

        //устанавливаем нужный альбом и все вложенные
        $this->whereThisAndNestedCats($album['NSLeft'], $album['NSRight']);

        cmsCore::c('db')->addJoin("INNER JOIN cms_photo_albums a ON a.id = f.album_id AND a.NSDiffer = '{$differ}'");

        $photos = $this->getPhotos(true);

        if ($photos){
            foreach($photos as $photo){
                $this->deletePhoto($photo, $inUploadPhoto);
            }
        }

        cmsCore::deleteComments($this->getTarget('comments_album'), $album_id);

        cmsActions::removeTargetLog($this->getTarget('actions_photo'), $album_id);

        return cmsCore::c('db')->deleteNS('cms_photo_albums', $album_id, $differ);
    }
예제 #2
0
파일: model.php 프로젝트: Acsac/CMS-RuDi
    public function deletePhotoAlbum($user_id, $album_id) {

        $photos = $this->getAlbumPhotos($user_id, 'private', $album_id);

        if ($photos){
            foreach($photos as $photo){
                $this->deletePhoto($photo['id']);
            }
        }

		cmsActions::removeTargetLog('add_user_photo_multi', $album_id);

        $this->inDB->query("DELETE FROM cms_user_albums WHERE id = '$album_id'") ;

        return true;

    }