111 lines
2.6 KiB
PHP
111 lines
2.6 KiB
PHP
<?php
|
|
require(ROOT."include/fpdf/fpdf.php");
|
|
|
|
|
|
/** Press Page
|
|
*
|
|
* @version 1.0.0
|
|
* @since 2009-03-19
|
|
* @author martin lenzelbauer
|
|
*
|
|
*/
|
|
class PressPage extends StdPage{
|
|
|
|
|
|
/** C'tor
|
|
*/
|
|
//------------------------------------------------
|
|
function PressPage($id, $parent){
|
|
//------------------------------------------------
|
|
parent::StdPage($id, $parent);
|
|
$this->editable = USER_GROUP;
|
|
$this->visible = 1;
|
|
}
|
|
|
|
|
|
/** @see CmsObject::publish()
|
|
*/
|
|
//---------------------------------------------
|
|
function publish(){
|
|
//---------------------------------------------
|
|
$out = $this->doPublish();
|
|
$query = sprintf("UPDATE bruckm_index SET cache = %s WHERE id = %d OR id = %d",
|
|
sqlstring($out),
|
|
sqlnum($this->id),
|
|
sqlnum($this->parentId));
|
|
dbQuery($query);
|
|
return true;
|
|
}
|
|
|
|
|
|
/** @see CmsObjec::canBePublished()
|
|
*/
|
|
//----------------------------------------------
|
|
function canBePublished(){
|
|
//----------------------------------------------
|
|
return true;
|
|
}
|
|
|
|
|
|
/** @see CmsObject::doPublish()
|
|
*/
|
|
//----------------------------------------------
|
|
function doPublish(){
|
|
//----------------------------------------------
|
|
if(!$this->parentObj){
|
|
$this->parentObj = FlexiconFactory::instanceById($this->parentId);
|
|
}
|
|
if(!$this->parentObj->isLoaded()){
|
|
$this->parentObj->load();
|
|
}
|
|
$menu = $this->parentObj->getMenu();
|
|
if(empty($this->template)){
|
|
$this->template = $this->parentObj->getTemplate();
|
|
}
|
|
|
|
$t = new Template(TEMPLATE_DIR.$this->template);
|
|
$content = "";
|
|
foreach($this->buildingBlocks as $i=>$block){
|
|
$content .= $this->buildingBlocks[$i]->publish();
|
|
}
|
|
$t->setVar("CONTENT", $content);
|
|
$t = $menu->printMenu($t);
|
|
$t->setVar("TITLE", $this->toString());
|
|
return $t->toString();
|
|
}
|
|
|
|
|
|
// === ADDITIONAL METHODS ==================================================== //
|
|
|
|
/** provides a pdf version of the page as download
|
|
*/
|
|
//-------------------------------------------
|
|
function downloadPdf($name){
|
|
//-------------------------------------------
|
|
$pdf = new FPDF();
|
|
$pdf->SetAuthor("Bruckmühle | Kulturhaus Pregarten");
|
|
$pdf->AddPage();
|
|
foreach($this->buildingBlocks as $block){
|
|
$block->publishForPdf($pdf);
|
|
}
|
|
$pdf->Output($name, "I");
|
|
}
|
|
|
|
|
|
/** sets the page title
|
|
* @param name page title
|
|
*/
|
|
//-------------------------------------------
|
|
function setName($name){
|
|
//-------------------------------------------
|
|
$this->name = $name;
|
|
$query = sprintf("UPDATE bruckm_index SET name = %s WHERE id = %d",
|
|
sqlstring($name),
|
|
sqlnum($this->id));
|
|
dbQuery($query);
|
|
}
|
|
|
|
};
|
|
|
|
|
|
?>
|