public function getTitle() { $title = trim(parent::getTitle()); if (!$title) { $view = Zend_Registry::get('Zend_View'); $settings = Engine_Api::_()->getApi('settings', 'core'); $default_photo_title = $settings->getSetting('album_default_photo_title', $view->translate('[Untitled]')); $title = $default_photo_title; } return $title; }
protected function _postDelete() { // This is dangerous, what if something throws an exception in postDelete // after the files are deleted? try { $file = $this->api()->getApi('storage', 'storage')->get($this->file_id, null); //$file->remove(); $file = $this->api()->getApi('storage', 'storage')->get($this->file_id, 'thumb.normal'); //$file->remove(); //$file = $this->api()->getApi('storage', 'storage')->get($this->file_id, 'croppable'); //$file->remove(); $album = $this->getCollection(); $nextPhoto = $this->getNextCollectible(); if ($album instanceof Core_Model_Item_Collection && $nextPhoto instanceof Core_Model_Item_Collectible && (int) $album->photo_id == (int) $this->getIdentity()) { $album->photo_id = $nextPhoto->getIdentity(); $album->save(); } } catch (Exception $e) { // @todo should we completely silence the errors? //throw $e; } parent::_postDelete(); }
protected function _delete() { // Decrement parent forum count $category = $this->getParent(); $category->forum_count = new Zend_Db_Expr('forum_count - 1'); $category->save(); // Delete all child topics $table = Engine_Api::_()->getItemTable('forum_topic'); $select = $table->select()->where('forum_id = ?', $this->getIdentity()); foreach ($table->fetchAll($select) as $topic) { $topic->delete(); } parent::_delete(); }