HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/PvdBoogaard/indoorski.nl/backup/oude-site/cms/api/form/class.field.view.php
<?php

/**
 * The file holding the object for fields of type view
 *
 * @author Allan Shone <allan@interspire.com>
 *
 * @package IWP
 * @subpackage IWP_FormFields
 */

/**
 * The field class implementation for view
 *
 * @author Allan Shone <allan@interspire.com>
 *
 * @package IWP
 * @subpackage IWP_FormFields
 */

class iwp_field_view extends iwp_field {
	/**
	 * The type of class this is, in terms of fields for iwp
	 *
	 * @var String
	**/
	public $type = 'view';

	/**
	 * Holds the array of all field possibilities
	 *
	 * @var Array
	**/
	private $fields;

	/**
	 * Will hold the type of view this will be for
	 *
	 * @var String
	**/
	private $viewType;

	/**
	 * Will hold the view options available to select from
	 *
	 * @var Array
	**/
	private $options = array('begins', 'ends', 'doescontain', 'doesnotcontain', 'checked', 'above', 'below', 'equals', 'memberof', 'statususer');

	/**
	 * This variable contains the HTML for each form item
	 *
	 * @var Array
	**/
	private $optionHTML = array(
		'begins'=>array(
			'type'=>'text',
			'length'=>'10',
		),
		'ends'=>array(
			'type'=>'text',
			'length'=>'10',
		),
		'doescontain'=>array(
			'type'=>'text',
			'length'=>'25',
		),
		'doesnotcontain'=>array(
			'type'=>'text',
			'length'=>'25',
		),
		'checked'=>array(
			'type'=>'checkbox',
			'length'=>'',
		),
		'above'=>array(
			'type'=>'int',
			'length'=>'10',
		),
		'below'=>array(
			'type'=>'int',
			'length'=>'10',
		),
		'equals'=>array(
			'type'=>'int',
			'length'=>'10',
		),
		'memberof'=>array(
			'type'=>'groups',
			'length'=>'1',
		),
		'contenttypes'=>array(
			'type'=>'content',
			'length'=>'1',
		),
		'statususer'=>array(
			'type'=>'statususer',
			'length'=>'1',
		)
	);

	/**
	 * Will retrieve the output for this specific field
	 *
	 * @return String
	**/
	public function GetFieldOutput($setOnly=false) {
		parent::GetFieldOutput();

		$this->template->Assign('FieldName', $this->FieldName);
		$this->template->Assign('FieldOptions', $this->fields);
		$this->template->Assign('ViewType', $this->viewType);
		$this->template->Assign('ViewOptions', $this->options);
		$this->template->Assign('OptionInfo', $this->optionHTML);

		if(!$setOnly) {
			return $this->template->ParseTemplate('form.view', true);
		}
		return '';
	}

	/**
	 * To return the value of the index in the passed through array
	 *
	 * @param Array
	 * @return mixed
	**/
	public function Validate($arrData){
		return $arrData[$this->FieldName];
	}

	/**
	 * Will take an array of field types that can be selected
	 *
	 * @param Array $fields The list of field options
	 *
	 * @return iwp_field_view
	**/
	public function AddFields($fields) {
		if(!is_array($fields)) {
			// Error handling!
			throw new iwp_exception_form('Fields are set from an array');
		}

		$this->fields = $fields;

		return $this;
	}

	/**
	 * Will take the provided type and use it as the view type
	 *
	 * @param String $type The type of view
	 *
	 * @return iwp_field_view
	**/
	public function AddViewType($type) {
		$this->viewType = $type;
		return $this;
	}

	/**
	 * Will add the view options available
	 *
	 * @param Array $op The options available
	**/
	public function AddViewOptions($op) {
		$this->options = $op;
	}
}