Skip to content

Instantly share code, notes, and snippets.

@trustmaster
Created March 25, 2012 11:59
Show Gist options
  • Save trustmaster/2193137 to your computer and use it in GitHub Desktop.
Save trustmaster/2193137 to your computer and use it in GitHub Desktop.
CotView class interface proto, first take
<?php
defined('COT_CODE') or die('Wrong URL.');
(function_exists('version_compare') && version_compare(PHP_VERSION, '5.3.0', '>=')) or die('PHP version 5.3 or higher is required.');
require_once cot_incfile('forms');
require_once cot_incfile('orm');
/**
* View class for Cotonti. Defines how objects should be displayed.
*
* View classes should extend CotView to inherit its methods
* and must specify $model_class and $columns
*
* @package Cotonti
* @version 1.3
* @author Gert Hengeveld, Vladimir Sibirov
* @copyright (c) Cotonti Team 2012
* @license BSD
*/
abstract class CotView
{
/**
* Name of the associated Model class
* @var string
*/
protected static $model_class = '';
/**
* Custom display properties for columns
* @var array
*/
protected static $columns = array();
/**
* Model object containing data
* @var CotORM
*/
protected $model = null;
/**
* Template object
* @var XTemplate
*/
protected $tpl = null;
/**
* Item permissions, such as R/W/A
* @var type
*/
protected $rights = array();
public function __construct($model, $tpl, $rights = array())
{
$this->model = $model;
$this->tpl = $tpl;
$this->rights = $rights;
}
public function display($tag_prefix = '', $block = '')
{
}
public function displayForm($tag_prefix = '', $block = '', $url = '')
{
}
public function displayFormAuto($tag_prefix = '', $block = '', $url = '')
{
}
public static function displayList($items, $tag_prefix = '', $block = '')
{
}
public static function displayListForm($items, $tag_prefix = '', $block = '', $url = '')
{
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment