<?php
/**
 * コンテンツタイプ
 */
require_once 'Zend/Db.php';
require_once 'Zend/Db/Table.php';
require_once 'Platy/CType.php';
require_once 'Platy/SystemDB.php';
require_once 'Platy/Form.php';

class Platy_CType
{
    public $id;
    public $name;
    public $title;
    public $summary;
    public $description;
    public $startDate;
    public $endDate;
    public $created;
    public $modified;
    public $owner;
    public $status;
    
    /**
     * インストール
     */
    public function install() { return true; }
    
    /**
     * アンインストール
     */
    public function uninstall() { return true; }
    
    function __construct($id = 0)
    {
        global $db;
        
        $this->id = 0;
        $this->name = '';
        $this->title = '';
        $this->summary = '';
        $this->description = '';
        $this->startDate = '';
        $this->endDate = '';
        $this->created = '';
        $this->modified = '';
        $this->owner = 0;
        $this->status = '';
        
        if ($id > 0) {
            $table = new DbContentBase();
            $row = $table->fetchRow('id = ' . $id);
            //var_dump($row);
            $this->id = $id;
            $this->name = $row->name;
            $this->title = $row->title;
            $this->summary = stripslashes($row->summary);
            $this->description = stripslashes($row->description);
            $this->startDate = $row->startDate;
            $this->endDate = $row->endDate;
            $this->created = $row->created;
            $this->modified = $row->modified;
            $this->owner = $row->owner;
            $this->status = $row->status;
        }
    }
    
    /**
     * 新規フォーム
     */
    public function add()
    {
    }
    
    /**
     * 新規保存
     */
    public function saveAdd($parentId)
    {
    }
    
    /**
     * 更新フォーム
     */
    public function edit($nodeId)
    {
    }
    
    /**
     * 更新保存
     */
    public function saveEdit($parentId)
    {
    }
    
    /**
     * 削除
     */
    public function delete($nodeId)
    {
    }
    
    /**
     * 表示
     */
    public function load($mode)
    {
        $a = array('pre'=>'', 'post'=>'', 'title'=> '', 'icons'=>'', 'main'=>'', 'header'=>'', 'footer'=>'');
    }
    
    /**
     * 概要表示
     */
    public function viewSummary()
    {
    }
    
    /**
     * 詳細表示
     */
    public function view()
    {
    }
    
    /**
     * 閲覧(管理画面での表示)
     */
    public function browse()
    {
    }
    
    /**
     * 概要
     */
    public function getSummary()
    {
        return '';
    }
    
    /**
     * バージョン
     */
    public function getVersion()
    {
        return '';
    }
    
    /**
     * 作者
     */
    public function getAuthor()
    {
        return '';
    }
}
?>