<?php

class DetailPage extends CMSWebPageBase {

    function DetailPage($arg) {
    	$entryId = @$arg[0];
    	$historyId = @$arg[1];

    	if(count($arg) <2){
    		$this->jump("Entry");
    	}

    	$result = $this->run("Entry.History.HistoryDetailAction",array("entryId"=>$entryId, "historyId"=>$historyId));

    	if(!$result->success()){
    		error_log(__LINE__);
    		$this->jump("Entry.Detail.{$entryId}");
    	}

    	WebPage::WebPage();

    	$history = $result->getAttribute("EntryHistory");

		$this->createAdd("date","HTMLLabel",array(
			"text"=> date("Y-m-d H:i:s", $history->getCdate())
		));

		$this->createAdd("title","HTMLLabel",array(
			"text" => $history->getTitle()
		));
		$this->createAdd("content","HTMLLabel",array(
			"text" => $history->getContent()
		));
		$this->createAdd("more","HTMLLabel",array(
			"text" => $history->getMore()
		));

		$this->createAdd("rollback_form","HTMLForm", array(
			"action" => SOY2PageController::createLink("Entry.History.".$entryId)
		));

		$this->createAdd("id","HTMLInput",array(
			"name"  => "id",
			"value" => $historyId
		));

		$this->createAdd("back","HTMLLink",array(
			"link" => SOY2PageController::createLink("Entry.History.".$entryId),
			"text" => "一覧に戻る"
		));
    }
}

