Beispiel #1
0
    function del()
    {
        $ids = Tree::getChilds($_GET['id']);
        $ids[] = $_GET['id'];
        foreach ($ids as $id) {
            Tree::saveSearch($id);
            $sql = '
				SELECT * FROM {{data}} 
				WHERE type=\'gallery\' AND tree=\'' . $id . '\'
			';
            $gals = DB::getAll($sql);
            foreach ($gals as $item) {
                if ($item['id']) {
                    $sql = '
						SELECT * FROM {{relations}} 
						WHERE modul1=\'data\' AND modul2=\'files\' AND id1=\'' . $item['id'] . '\'
					';
                    $files = DB::getAll($sql);
                    foreach ($files as $file) {
                        $sql = '
							SELECT id1 FROM {{relations}} 
							WHERE modul1=\'data\' AND modul2=\'files\' AND id1<>\'' . $item['id'] . '\' AND id2=' . $file['id2'] . '
						';
                        $id1 = DB::getOne($sql);
                        if (!$id1) {
                            Fields::removeFile($item['id'], $file['id2']);
                        }
                    }
                }
            }
            $sql = '
				DELETE FROM {{relations}} 
				WHERE modul1=\'tree\' AND id1=\'' . $id . '\'
			';
            DB::exec($sql);
            $sql = '
				DELETE FROM {{data}}  
				WHERE tree=\'' . $id . '\'
			';
            DB::exec($sql);
            $sql = '
				DELETE FROM {{tree}} 
				WHERE id=\'' . $id . '\'
			';
            DB::exec($sql);
            $sql = '
				DELETE FROM {{catalog}} 
				WHERE tree=\'' . $id . '\'
			';
            DB::exec($sql);
        }
    }
Beispiel #2
0
    public function removeGallery($id)
    {
        $sql = '
			SELECT id2 FROM {{relations}}
			WHERE modul1=\'data\' AND modul2=\'files\' AND id1=' . $id . '
		';
        $files = DB::getAll($sql, 'id2');
        foreach ($files as $item) {
            Fields::removeFile($id, $item);
        }
        $sql = '
			DELETE FROM {{data}}
			WHERE id=' . $id . '
		';
        DB::exec($sql);
    }
Beispiel #3
0
 function removefile()
 {
     Fields::removeFile();
 }