View of /branches/mambo5/app/controllers/content_template_controller.php
Parent Directory
|
Revision Log
Revision 2 -
(download)
(annotate)
Fri Dec 3 04:30:31 2010 UTC (2 years, 6 months ago) by enjoyman
File size: 3328 byte(s)
Fri Dec 3 04:30:31 2010 UTC (2 years, 6 months ago) by enjoyman
File size: 3328 byte(s)
first commit mambo5 with cakephp1.3.6.
<?php /** * @package Mambo * @author Mambo Foundation Inc see README.php * @copyright (C) 2000 - 2009 Mambo Foundation Inc. * See COPYRIGHT.php for copyright notices and details. * @license GNU/GPL Version 2, see http://www.opensource.org/licenses/gpl-2.0.php * * Redistributions of files must retain the above copyright notice. * * Mambo is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; version 2 of the License. */ /** * Handles requests for editor html template code * */ class ContentTemplateController extends AppController { public $name = 'ContentTemplate'; public $uses = array('ContentTemplate'); public $components = array('Mostlyce'); public $helpers = array('Html', 'Form', 'Javascript', 'MamboHtml'); public $paginate = array('limit' => 15, 'page' => 1, 'order'=>array('title'=>'ASC')); /** * If an html template was selected in the TinyMCE html template plugin this function is used * to dynamically retrieve the templates html code. * * @param int $id */ public function HtmlTemplatePlugin($id = null) { if(!$id) { $this->Session->setFlash('Invalid id for content template'); $this->redirect('/content/index/'); } $this->layout='html_template_plugin'; $selectedTemplate = $this->params['pass'][0]; $this->set('template_code', $this->ContentTemplate->find("id = {$id}", array('html_template_code'), null, 0)); } /** * Displays a list of content items that can be edited or removed * */ public function administrator_index() { $this->set('content_templates', $this->paginate('ContentTemplate')); $this->pageTitle = 'List of Content Templates'; } /** * Used to added new html templates for use in the editor * */ public function administrator_add() { //Build a like of html templates for MOStlyCE $this->set('tinymce_template_code', $this->Mostlyce->setContentTemplates()); if(!empty($this->data)){ //Include the data sanitation code uses('Sanitize'); $mrClean = new Sanitize(); $mrClean->clean($this->data); if($this->ContentTemplate->validates() && $this->ContentTemplate->save($this->data)) { $this->Session->setFlash("The new Content Template has been added"); $this->redirect('/administrator/content_template/index'); } else { $this->Session->setFlash('Please correct errors below.'); } } } /** * Used to edit existing html templates created for use with the editor * * @param int $id */ public function administrator_edit($id = null) { if(!$id) { $this->Session->setFlash('Invalid id for content template'); $this->redirect('/administrator/content_template/index'); } $this->set('template', $this->ContentTemplate->find("id = {$id}", null, null, 0)); } /** * Used to edit existing html templates created for use with the editor * * @param int $id */ public function administrator_delete($id = null) { if(!$id) { $this->Session->setFlash('Invalid content template selected!'); $this->redirect('/administrator/content_template/index'); } if($this->ContentTemplate->del($id)) { $this->Session->setFlash('The content template deleted: id '.$id.''); $this->redirect('/administrator/content_template/index'); } } } ?>
| ViewVC Help | |
| Powered by ViewVC 1.0.0 |

