/** * Load the item data */ protected function loadData() { $this->id = $this->getParameter('id', 'int', null); if ($this->id == null || !BackendInstagramModel::exists($this->id)) { $this->redirect(Model::createURLForAction('Index') . '&error=non-existing'); } $this->record = BackendInstagramModel::get($this->id); if ($this->record['locked'] == 'Y') { $this->redirect(Model::createURLForAction('Index') . '&error=is-locked'); } }
/** * Execute the action */ public function execute() { $this->id = $this->getParameter('id', 'int'); // Does the item exist? if ($this->id !== null && BackendInstagramModel::exists($this->id)) { parent::execute(); $this->record = (array) BackendInstagramModel::get($this->id); if ($this->record['locked'] == 'Y') { $this->redirect(Model::createURLForAction('Index') . '&error=is-locked'); } // Delete the file BackendInstagramModel::delete($this->id); Model::triggerEvent($this->getModule(), 'after_delete', array('id' => $this->id)); $this->redirect(Model::createURLForAction('Index') . '&report=deleted&var=' . urlencode($this->record['title'])); } else { $this->redirect(Model::createURLForAction('Index') . '&error=non-existing'); } }