CoolFace
Apppublic

kenken999/php

sourceHugging Faceupdated 2y agoView on Hugging Face
0likes
printpage_master.php129 linesDownload Raw Back to classes
1<?php2/**3 * Class for list page with mode simple4 *5 */6class PrintPage_Master extends PrintPage 7{8	public $pdfJson = false;	9	/**10	 * Constructor, set initial params11	 *12	 * @param array $params13	 */	14	function __construct(&$params) 15	{16		// call parent constructor17		parent::__construct($params);	18		$this->pageType = "masterprint";19		$this->masterPageType = $params["masterPageType"];20		if( $this->masterPageType == "report")21			$this->pageType = "masterrprint";22	}23	/**24	 * Add common assign for simple mode on list page25	 */	26	function commonAssign() 27	{28		parent::commonAssign();29		30		31	}32 33	34	public function getMasterHeading() 35	{36			37		$this->xt->assign( "masterlist_title", true );38		return $this->xt->fetch_loaded( "masterlist_title" );39 40	}41	public function preparePage() 42	{43		if( !$this->masterRecordData || !$this->masterRecordData )44			return;45		46		$pageTypeTitle = $this->pageType;47		if ( $this->masterPageType == "report" )48		{49			$pageTypeTitle = "masterprint";50		}51		$this->xt->assign("pagetitlelabel", $this->getPageTitle( $pageTypeTitle, GoodFieldName($this->tName), $this->masterRecordData ));	52 53		$tKeys = $this->pSet->getTableKeys();54		$keylink = "";55 56				57		for($i = 0; $i < count($tKeys); $i ++) {58			$keylink.= "&key".($i + 1)."=".runner_htmlspecialchars(rawurlencode(@$this->masterRecordData[$tKeys[$i]]));59		}60		61		$fields = $this->pSet->getPageFields();62		$fields = array_merge( $fields, $tKeys);63		foreach( $fields as $f )64		{65			$this->xt->assign( GoodFieldname( $f ) . "_fieldheader", true );66			$fieldClassStr = $this->fieldClass($f);67			68			$value = $this->showDBValue( $f, $this->masterRecordData, $keylink);69 70			if( $this->pdfJsonMode() )71			{72				$this->xt->assign( GoodFieldName( $f ) . "_pdfvalue", $value );73			}74			else 75			{76				$wrappedValue = "<span class='". $fieldClassStr ."'>".$value."</span>";77				$this->xt->assign( GoodFieldName( $f ) . "_mastervalue", $wrappedValue );78				$this->xt->assign( GoodFieldName( $f ) . "_value", $wrappedValue );79			}80 81			$this->xt->assign( GoodFieldName( $f ) . "_class", $fieldClassStr); // add class for field header as field value82			//	page designer layout83			$this->xt->assign( GoodFieldName( $f ) . "_fieldcolumn", true );84			$this->xt->assign( GoodFieldName( $f ) . "_fieldheadercolumn", true );85			86		}87		$this->xt->assign("grid_header", true );88		$this->xt->assign("grid_row", true );89		$this->xt->assign("grid_record", true );90		$this->xt->assign("grid_vrecord", true );91			92		if( $this->pageLayout )93			$this->xt->assign("pageattrs", 'class="'.$this->pageLayout->style." page-".$this->pageLayout->name.'"');94		95		/*if( !$this->pdfJsonMode() ) 96			$this->xt->load_template( GetTemplateName($this->shortTableName, $this->pageType) );*/97		98		if( !$this->pdfJsonMode() ) 99			$this->xt->load_template( $this->templatefile );		100	}101 102	public function showMaster( $params ) 103	{104		if( !$this->masterRecordData || !($this->masterRecordData) )105			return;106		107		$this->xt->assign( "masterlist_title", false );108		109		if( $this->pdfJsonMode() ) 110		{111			$this->xt->assign("body", true );112			$this->xt->assign("embedded_grid", true );113			$this->xt->assign("embedded_grid_caption", true );114 115			$this->xt->load_templateJSON( $this->templatefile);116			echo  $this->xt->fetch_loadedJSON("body");117		} 118		else119			$this->xt->display_loaded();120	}121 122	function pdfJsonMode() 123	{124		return $this->pdfJson;125	}126}127 128?>129