function delete_collection() { $peer = new GalleryCollectionPeer(); $collection = $peer->find_by_id(Params::get("id_gallery_collection")); $all_galleries = call("gallery", "index", array("id_gallery_collection" => Params::get("id_gallery_collection"))); foreach ($all_galleries as $gallery) { call("gallery", "delete_gallery", array("id_gallery" => $gallery->id_gallery)); } $d = new Dir(GalleryCollectionController::GALLERY_COLLECTION_ROOT_DIR . $collection->folder); $d->delete(); $peer->delete($collection); if (is_html()) { return Redirect::success(); } else { return Result::ok(); } }