Exemplo n.º 1
0
 /**
  * Delete a rule
  *
  * @param int $rule_id The rule identifier to delete
  * @return null
  * @access public
  */
 public function delete_rule($rule_id)
 {
     // Initiate and load the rule entity
     /* @var $entity \phpbb\boardrules\entity\rule */
     $entity = $this->container->get('phpbb.boardrules.entity')->load($rule_id);
     // Use a confirmation box routine when deleting a rule
     if (confirm_box(true)) {
         // Delete the rule on confirmation
         $this->rule_operator->delete_rule($rule_id);
         // Show user confirmation of the deleted rule and provide link back to the previous page
         trigger_error($this->user->lang('ACP_RULE_DELETED') . adm_back_link("{$this->u_action}&language={$entity->get_language()}&parent_id={$entity->get_parent_id()}"));
     } else {
         // Request confirmation from the user to delete the rule
         confirm_box(false, $this->user->lang('ACP_DELETE_RULE_CONFIRM'), build_hidden_fields(array('mode' => 'manage', 'action' => 'delete', 'rule_id' => $rule_id)));
         // Use a redirect to take the user back to the previous page
         // if the user chose not delete the rule from the confirmation page.
         redirect("{$this->u_action}&language={$entity->get_language()}&parent_id={$entity->get_parent_id()}");
     }
 }