Exemplo n.º 1
0
 /**
  * @param \Difra\Param\AnyInt $id
  * @param \Difra\Param\AjaxInt $confirm
  */
 public function delAjaxAction(\Difra\Param\AnyInt $id, \Difra\Param\AjaxInt $confirm = null)
 {
     if (!($snippet = \Difra\Plugins\CMS\Snippet::getById($id->val()))) {
         \Difra\Ajaxer::redirect('/adm/cms/snippets');
     }
     if (!$confirm) {
         \Difra\Ajaxer::confirm(\Difra\Locales::get('cms/adm/snippet/del-confirm1') . $snippet->getName() . \Difra\Locales::get('cms/adm/snippet/del-confirm2'));
         return;
     }
     $snippet->del();
     \Difra\Ajaxer::close();
     \Difra\Ajaxer::redirect('/adm/content/snippets');
 }
Exemplo n.º 2
0
 /**
  * Add text snippets to output XML
  */
 public static function addSnippetsXML()
 {
     if (View::$instance != 'main') {
         return;
     }
     $controller = Controller::getInstance();
     $snippetNode = $controller->realRoot->appendChild($controller->xml->createElement('snippets'));
     Snippet::getAllXML($snippetNode);
 }