<?php
 class pagesField extends baseField { var $Conf = array( 'xtype' => 'pagesselect', 'height' => 150, 'icon' => 'folder', 'setAutoSize' => true, ); var $sep = ','; function edit($addConf,$R) { $this->addConf = $addConf; if($R['value']) { $value = array(); foreach(explode($this->sep,$R['value']) as $v) { $tmp = $this->Mizu->_DB->getRow('SELECT id FROM %%%pages WHERE deleted = 0 AND  id = '.$v); if(!$tmp['id']) { continue; } $value[] = array( 'value' => $v, 'valueF' => $this->getFormatName($v), ); } $R['valueRaw'] = $R['value']; $R['value'] = $value; } return parent::edit($addConf,$R); } function getSetValue($v) { if($_GET['debug']) { print_rf($v); } if(is_array($v)) { $value = array(); foreach($v as $x) { if(!$x['value']) continue; $value[] = $x['value']; } $v = implode($this->sep,$value); } if($_GET['debug']) { print_rf($v); exit; } return $v; } function getFormatName($v) { $R = $this->Mizu->get('lng/nav',$v); if($this->addConf['attr']['showPath']) { $path = array(); $tmp = $this->Mizu->buildPath($v); unset($tmp[0]); foreach($tmp as $x) { $path[] = $this->Mizu->get('lng/nav',$x); } $R.= ' &nbsp;&nbsp;<span style="font-size:10px;float:right;">'.implode('/',$path).'</span>'; } return $R; } } 