CoolFace
Apppublic

kenken999/php

sourceHugging Faceupdated 2y agoView on Hugging Face
0likes
listpage_master.php120 linesDownload Raw Back to classes
1<?php2/**3 * Class for list page with mode simple4 *5 */6class ListPage_Master extends ListPage 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->masterPageType = $params["masterPageType"];19	}20	/**21	 * Add common assign for simple mode on list page22	 */	23	function commonAssign() 24	{25		parent::commonAssign();26	}27	28	protected function createOrderByObject() {29		//	don't read order by info from request30		$this->orderClause = OrderClause::createFromPage( $this, false );31	}32	33	public function getMasterHeading() 34	{35		$this->xt->assign( "masterlist_title", true );36		return $this->xt->fetch_loaded( "masterlist_title" );37	}38	39	public function preparePage() 40	{41		if( !$this->masterRecordData || !$this->masterRecordData )42			return;43		44		$this->xt->assign("pagetitlelabel", $this->getPageTitle( $this->pageType, GoodFieldName($this->tName), $this->masterRecordData ));	45 46		$tKeys = $this->pSet->getTableKeys();47		$keylink = "";48 49				50		for($i = 0; $i < count($tKeys); $i ++) {51			$keylink.= "&key".($i + 1)."=".runner_htmlspecialchars(rawurlencode(@$this->masterRecordData[$tKeys[$i]]));52		}53		54		$fields = $this->pSet->getPageFields();55		$fields = array_merge( $fields, $tKeys);56		foreach( $fields as $f )57		{58			$fieldClassStr = $this->fieldClass($f);59			$this->xt->assign( GoodFieldname( $f ) . "_fieldheader", true );60 61			$value = $this->showDBValue( $f, $this->masterRecordData, $keylink);62 63			if( $this->pdfJsonMode() )64				$this->xt->assign( GoodFieldName( $f ) . "_pdfvalue", $value );65			else 66			{67				$wrappedValue = "<span class='". $fieldClassStr ."'>".$value."</span>";68				$this->xt->assign( GoodFieldName( $f ) . "_mastervalue", $wrappedValue );69				$this->xt->assign( GoodFieldName( $f ) . "_value", $wrappedValue );70			}71 72			$this->xt->assign( GoodFieldName( $f ) . "_class", $fieldClassStr); // add class for field header as field value73			//	page designer layout74			$this->xt->assign( GoodFieldName( $f ) . "_fieldcolumn", true );75			$this->xt->assign( GoodFieldName( $f ) . "_fieldheadercolumn", true );76		}77		78		$this->xt->assign("grid_header", true );79		$this->xt->assign("grid_row", true );80		$this->xt->assign("grid_record", true );81		$this->xt->assign("grid_vrecord", true );82			83		if( $this->pageLayout )84			$this->xt->assign("pageattrs", 'class="'.$this->pageLayout->style." page-".$this->pageLayout->name.'"');85		86		/*if( !$this->pdfJsonMode() ) 87			$this->xt->load_template( GetTemplateName($this->shortTableName, "master".$this->masterPageType) );*/				88	}89	90	public function showMaster( $params ) 91	{92		if( !$this->masterRecordData || !$this->masterRecordData )93			return;94		95		$this->xt->assign( "masterlist_title", false );96		97		if( $this->pdfJsonMode() ) 98		{99			$this->xt->assign("body", true );100			$this->xt->assign("embedded_grid", true );101			$this->xt->assign("embedded_grid_caption", true );102 103			$this->xt->load_templateJSON( $this->templatefile);104			echo  $this->xt->fetch_loadedJSON("body");105		}106		else107		{108			$this->xt->load_template( $this->templatefile );109			$this->xt->display_loaded();110		}111	}112 113	function pdfJsonMode() 114	{115		return $this->pdfJson;116	}117}118 119?>120