Ejemplo n.º 1
0
 /**
  * Delete a Tag
  *
  * @param Gdn_Controller $Sender
  */
 public function Controller_Delete($Sender)
 {
     $Sender->Permission('Garden.Settings.Manage');
     $TagID = GetValue(1, $Sender->RequestArgs);
     $TagModel = new TagModel();
     $Tag = $TagModel->GetID($TagID, DATASET_TYPE_ARRAY);
     if ($Sender->Form->AuthenticatedPostBack()) {
         // Delete tag & tag relations.
         $SQL = Gdn::SQL();
         $SQL->Delete('TagDiscussion', array('TagID' => $TagID));
         $SQL->Delete('Tag', array('TagID' => $TagID));
         $Sender->InformMessage(FormatString(T('<b>{Name}</b> deleted.'), $Tag));
         $Sender->JsonTarget("#Tag_{$Tag['TagID']}", NULL, 'Remove');
     }
     $Sender->SetData('Title', T('Delete Tag'));
     $Sender->Render('delete', '', 'plugins/Tagging');
 }