/**
  * Delete a template
  *
  * Current and main template will raise an error
  *
  * @access	private
  */
 private function delete()
 {
     if (VPost::delete(false) && VPost::tpl_id() && $this->_user['delete_content']) {
         try {
             $tpl = new Setting(VPost::tpl_id());
             $tpl->_data = json_decode($tpl->_data, true);
             if ($tpl->_data['namespace'] == $this->_setting->_data) {
                 throw new Exception('Template currently used, action aborted');
             }
             if ($tpl->_data['namespace'] == 'main' || $tpl->_data['namespace'] == 'bobcat') {
                 throw new Exception('Default template can\'t be deleted, action aborted');
             }
             foreach ($tpl->_data['files'] as $file) {
                 File::delete(PATH . 'includes/templates/' . $tpl->_data['namespace'] . '/' . $file);
             }
             $tpl->delete();
             $result = true;
         } catch (Exception $e) {
             $result = $e->getMessage();
         }
         $this->_action_msg = ActionMessages::template_deleted($result);
     } elseif (VPost::delete(false) && !$this->_user['delete_content']) {
         $this->_action_msg = ActionMessages::action_no_perm();
     }
 }