Exemplo n.º 1
0
 static function item_deleted($item)
 {
     access::delete_item($item);
     // Find any other albums that had the deleted item as the album cover and null it out.
     // In some cases this may leave us with a missing album cover up in this item's parent
     // hierarchy, but in most cases it'll work out fine.
     foreach (ORM::factory("item")->where("album_cover_item_id", "=", $item->id)->find_all() as $parent) {
         item::remove_album_cover($parent);
     }
     $parent = $item->parent();
     if (!$parent->album_cover_item_id) {
         // Assume that we deleted the album cover
         if (batch::in_progress()) {
             // Remember that this parent is missing an album cover, for later.
             $batch_missing_album_cover = Session::instance()->get("batch_missing_album_cover", array());
             $batch_missing_album_cover[$parent->id] = 1;
             Session::instance()->set("batch_missing_album_cover", $batch_missing_album_cover);
         } else {
             // Choose the first viewable child as the new cover.
             if ($child = $parent->viewable()->children(1)->current()) {
                 item::make_album_cover($child);
             }
         }
     }
 }
Exemplo n.º 2
0
 static function item_before_delete($item)
 {
     access::delete_item($item);
 }
Exemplo n.º 3
0
 static function item_deleted($item)
 {
     access::delete_item($item);
 }