public static function remove($name) { $sectionManager = new Section(); $sectionManager->load(array('label' => $name)); $rightManager = new Right(); $rightManager->delete(array('section' => $sectionManager->getId())); $sectionManager->delete(array('id' => $sectionManager->getId())); }
public function __actionDelete(array $sections, $redirect) { $success = true; $callback = Administration::instance()->getPageCallback(); $current_page = $callback['pageroot'] . (isset($callback['context'][0]) && $callback['context'][0] != 'index' ? $callback['context'][0] . '/' : NULL); foreach ($sections as $handle) { try { Section::delete(Section::loadFromHandle($handle)); ### # Delegate: SectionPostDelete Extension::notify('SectionPostDelete', $current_page, array('handle' => $handle)); } catch (SectionException $e) { $success = false; $this->alerts()->append($e->getMessage(), AlertStack::ERROR, $e); } catch (Exception $e) { $success = false; $this->alerts()->append(__('An unknown error has occurred. <a class="more">Show trace information.</a>'), AlertStack::ERROR, $e); } } if ($success) { redirect($redirect); } }
/** * delete section from system * * @return void */ public function delete($id) { $s = new Section($id); $s->delete(); redirect('section_editor'); }
$f_issue_number = Input::Get('f_issue_number', 'int', 0); $f_language_id = Input::Get('f_language_id', 'int', 0); $f_section_number = Input::Get('f_section_number', 'int', 0); $f_delete_all_section_translations = Input::Get('f_delete_all_section_translations', 'string', '', true); $f_delete_all_articles_translations = Input::Get('f_delete_all_articles_translations', 'string', '', true); $publicationObj = new Publication($f_publication_id); $issueObj = new Issue($f_publication_id, $f_language_id, $f_issue_number); $sectionObj = new Section($f_publication_id, $f_issue_number, $f_language_id, $f_section_number); $sectionName = $sectionObj->getName(); $articles = Article::GetArticles($f_publication_id, $f_issue_number, $f_section_number, $f_language_id); $numArticles = count($articles); $numArticlesDeleted = 0; $f_delete_all_section_translations = $f_delete_all_section_translations == 'Y' ? true : false; $f_delete_all_articles_translations = $f_delete_all_articles_translations == 'Y' ? true : false; if ($f_delete_all_section_translations == false) { $numArticlesDeleted = $sectionObj->delete(true, $f_delete_all_articles_translations); $cacheService = \Zend_Registry::get('container')->getService('newscoop.cache'); $cacheService->clearNamespace('section'); } else { $sectionTranslations = Section::GetSections($f_publication_id, $f_issue_number, null, null, $sectionObj->getName(), null); foreach ($sectionTranslations as $key => $sectionTranslation) { $numArticlesDeleted += $sectionTranslation->delete(true, $f_delete_all_articles_translations); } } $offsetVarName = 'SectOffs_' . $f_publication_id . '_' . $f_issue_number . '_' . $f_language_id; $SectOffs = camp_session_get($offsetVarName, 0); $totalSections = Section::GetTotalSections($f_publication_id, $f_issue_number, $f_language_id); if ($SectOffs >= $totalSections) { camp_session_set($offsetVarName, 0); } $topArray = array('Pub' => $publicationObj, 'Issue' => $issueObj, 'Section' => $sectionObj);
<?php require_once 'Widget.class.php'; $table = new Widget(); $table->drop(); $table_section = new Section(); $id_section = $table_section->load(array("label" => "dashboard"))->getId(); $table_section->delete(array('label' => 'dashboard')); $table_right = new Right(); $table_right->delete(array('section' => $id_section));
<?php require_once 'KodiCmd.class.php'; // Suppression de la table du plugin $table = new KodiCmd(); //$table->drop(); $execQuery = $table->query('DROP TABLE yana_plugin_kodi'); $table_configuration = new configuration(); $table_configuration->getAll(); $table_configuration->remove('plugin_kodiCmd_api_url_kodi'); $table_configuration->remove('plugin_kodiCmd_api_timeout_kodi'); $table_configuration->remove('plugin_kodiCmd_api_recognition_status'); // suppression de la piece KODI $table_room = new Room(); $table_room->delete(array('name' => 'KODI')); // Recuperation de l'id et Suppression de la section $table_section = new Section(); $id_section = $table_section->load(array("label" => "kodi"))->getId(); $table_section->delete(array('label' => 'kodi')); // suppression des droits correspondant à la section $table_right = new Right(); $table_right->delete(array('section' => $id_section));
<?php /* Le code contenu dans cette page ne sera éxecuté qu'à la désactivation du plugin Vous pouvez donc l'utiliser pour supprimer des tables SQLite, des dossiers, ou executer une action */ require_once 'Sensor.class.php'; require_once 'SensorType.class.php'; $table = new Sensor(); $table2 = new SensorType(); $table->drop(); $table2->drop(); $conf = new Configuration(); $conf->delete(array('key' => 'plugin_sensor_receptor_pin')); $table_section = new Section(); $id_section = $table_section->load(array("label" => "sensor"))->getId(); $id_section2 = $table_section->load(array("label" => "sensortypes"))->getId(); $table_section->delete(array('label' => 'sensor')); $table_section2->delete(array('label' => 'sensortypes')); $table_right = new Right(); $table_right->delete(array('section' => $id_section)); $table_right->delete(array('section' => $id_section2));