Your IP : 216.73.216.55


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

<?php
Namespace Templatecreatorck;

defined('TCK_LOADED') or die;

Use \Templatecreatorck\CKFof;

class CKModel {

	var $_item = null;

	private static $instance;

	private $input;

	protected $tableName;

	function __construct() {
		$this->input = CKFof::getInput();
	}

	static function getInstance($name, $prefix, $config) {

		if (is_object(self::$instance))
		{
			return self::$instance;
		}

		$basePath = TEMPLATECREATORCK_PATH;
		// Check for a controller.task command.
		$input = CKFof::getInput();

		// Define the controller filename and path.
		$file       = strtolower($name . '.php');
		$path       = $basePath . '/models/' . $file;

		// Get the controller class name.
		$class = ucfirst($prefix) . 'Model' . ucfirst($name);

		// Include the class if not present.
		if (!class_exists($class))
		{
			// If the controller file path exists, include it.
			if (file_exists($path))
			{
				require_once $path;
			}
			else
			{
				throw new \InvalidArgumentException(\JText::sprintf('ERROR_INVALID_MODEL', $type, $format));
			}
		}

		// Instantiate the class.
		if (!class_exists($class))
		{
			throw new \InvalidArgumentException(\JText::sprintf('ERROR_INVALID_MODEL_CLASS', $class));
		}

		// Instantiate the class, store it to the static container, and return it
		return self::$instance = new $class();
	}

	public function save($data) {

	}

	public function delete($id) {
		return CKFof::dbDelete( $this->tableName, $id );
	}
}