# css-javascript-toolbox/8.0.2/views/templates/template/view.php

CSS &amp; JavaScript Toolbox, version 8.0.2. 104 lines.

- Page: https://pluginprobe.com/plugins/css-javascript-toolbox/8.0.2/code/views/templates/template/view.php
- Raw: https://pluginprobe.com/plugins/css-javascript-toolbox/8.0.2/raw/views/templates/template/view.php
- Modified: 2014-05-06T16:47:26+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/css-javascript-toolbox/8.0.2/code/views/templates/template/view.php#L10-L20`.

```php
<?php
/**
* 
*/

// No direct access.
defined('ABSPATH') or die('Access denied');

/**
* 
*/
class CJTTemplatesTemplateView extends CJTView {
	
	/**
	* put your comment there...
	* 
	* @var mixed
	*/
	protected $isNew;
	
	/**
	* put your comment there...
	* 
	* @var mixed
	*/
	public $item;
	
	/**
	* put your comment there...
	* 
	* @var mixed
	*/
	protected $onprepareitem = array('parameters' => array('item', 'isNew'));
	
	/**
	* put your comment there...
	* 
	* @param mixed $tpl
	*/
	public function display($tpl = null) {
		// Is it a new template or just editing exists one?
		$this->isNew = empty($_REQUEST['id']);
		// If editing exists on read it from database.
		if (!$this->isNew) {
			$this->item = $this->getModel()->getItem();
		}
		else {
			// E_ALL complain/Default values for new record if needed!
			$this->item = (object) array(
				'name' => '',
				'type' => '',
				'state' => '',
				'code' => '',
				'description' => '',
				'keywords' => '',
				'version' => '',
				'developmentState' => '',
				'changeLog' => '',
				'id' => '',
			);
		}
		$this->item = $this->onprepareitem($this->item, $this->isNew);
		echo $this->getTemplate($tpl)	;
	}
	
	/**
	* Output Javascript files requirred to Add-New-Block view to run.
	* 
	* @return void
	*/
	public function enququeScripts() {
		// Use related scripts.
		self::useScripts(__CLASS__, 
			'jquery',
			'thickbox',
			'jquery-serialize-object',
			'jquery-ui-tabs',
			'framework:js:misc:{CJT-}simple-error-dialog',
			'framework:js:ace(loadMethod=Tag, lookFor=ace)',
			'framework:js:ace:{CJT-}pluggable',
			'views:templates:template:public:js:{CJT-}template'
		);
	}
	
	/**
	* Output CSS files required to Add-New-Block view.
	* 
	* @return void
	*/
	public function enququeStyles() {
		// Use related styles.
		self::useStyles(__CLASS__,
			'thickbox',
			'framework:css:jquery-ui-1.8.21.custom',
			'framework:css:{CJT-}forms',
			'framework:css:{CJT-}error-dialog',
			'views:templates:template:public:css:{CJT-}default'
		);
	}
	
} // End class.

// Hookable!!
CJTTemplatesTemplateView::define('CJTTemplatesTemplateView', array('hookType' => CJTWordpressEvents::HOOK_FILTER));
```
