Your IP : 216.73.216.55


Current Path : /home/g/i/t/giteleslfp/www/administrator/components/com_templateck/controllers/
Upload File :
Current File : /home/g/i/t/giteleslfp/www/administrator/components/com_templateck/controllers/templates.php

<?php

/**
 * @name		Template Creator CK
 * @copyright	Copyright (C) since 2011. All rights reserved.
 * @license		GNU General Public License version 2 or later; see LICENSE.txt
 * @author		Cedric Keiflin - http://www.template-creator.com - http://www.joomlack.fr
 */
// No direct access.
defined('TCK_LOADED') or die;
require_once TEMPLATECREATORCK_PATH . '/controller.php';

/**
 * Templates list controller class.
 */
class TemplateckControllerTemplates extends TemplateckController {

	/**
	 * Proxy for getModel.
	 * @since	1.6
	 */
	public function getModel($name = 'template', $prefix = 'TemplateckModel', $config = Array()) {
		$model = parent::getModel($name, $prefix, array('ignore_request' => true));
		return $model;
	}

	/**
	 * copy an existing template
	 * @return void
	 */
	function copy() {
		$model = $this->getModel('templates');
		$input = new TCK_Input();
		$input = $input->get('cid', '', 'array');
		$this->input->set('id', (int) $input[0]);
		if (!$model->copy()) {
			$msg = JText::_('CK_TEMPLATE_COPY_ERROR');
			$type = 'error';
		} else {
			$msg = JText::_('CK_TEMPLATE_COPIED');
			$type = 'message';
		}

		$this->setRedirect('index.php?option=com_templateck', $msg, $type);
	}

	/**
	 * copy an existing template
	 * @return void
	 */
	function delete() {
		$model = $this->getModel('templates');
		$input = new TCK_Input();
//		$input = $input->get('cid', '', 'array');
//		$this->input->set('id', (int) $input[0]);
		if (!$model->delete()) {
			$msg = JText::_('CK_TEMPLATE_DELETE_ERROR');
			$type = 'error';
		} else {
			$msg = JText::_('CK_TEMPLATE_DELETED');
			$type = 'message';
		}

		$this->setRedirect('index.php?option=com_templateck', $msg, $type);
	}
}