<?php $ci =& get_instance(); $id = $ci->uri->segment(5); $c = new Content(); $c->get_by_id($id); if ($c->exists()) { if ($c->type == 'layout') { $c = new Layout(); $c->get_by_id($id); } if ($c->can_delete()) { $c->delete(); $ci->app->add_info('Content deleted'); } else { $ci->app->add_error('permission denied! please check your root adminstrator'); } } else { $ci->app->add_error('Content not found'); }
/** * Deletes multiple content layouts * * @return bool */ public function deleteSection() { $this->setTitle(t('Delete layouts')); $this->setOutputType(self::_OT_CONFIG); if ($this->_input->checkToken()) { try { $delCount = 0; foreach ($this->_input->post('layout_names') as $layoutName) { $layout = new Layout($layoutName); if ($layout->delete()) { $delCount++; } else { $this->_event->error(sprintf(t('Unable to delete layout "%1$s"'), $layoutName)); } } if ($delCount > 0) { $this->_event->success(t('Deleted selected layouts')); } } catch (Input_KeyNoExist $e) { $this->_event->error(t('No layouts selected')); } } else { $this->_event->error(Input::csrfMsg()); } return zula_redirect($this->_router->makeUrl('content_layout')); }