function ViewDatabaseImageField($field, $container, $pageobject)
 {
     parent::ViewControl($field, $container, $pageobject);
     $this->showThumbnails = $container->pSet->showThumbnail($this->field);
     if ($this->showThumbnails) {
         $this->thumbWidth = $container->pSet->getThumbnailWidth($this->field);
         $this->thumbHeight = $container->pSet->getThumbnailHeight($this->field);
     }
 }
 public function ViewLookupWizardField($field, $container, $pageObject)
 {
     parent::ViewControl($field, $container, $pageObject);
     $this->lookupPSet = null;
     $this->cipherer = null;
     $this->lookupQueryObj = null;
     $this->displayFieldIndex = 0;
     $this->linkFieldIndex = 1;
     $this->LookupSQL = "";
     if ($this->container->pSet->getEditFormat($field) != EDIT_FORMAT_LOOKUP_WIZARD) {
         $this->pSet = new ProjectSettings($this->container->pSet->_table);
         //	set view page
         $this->pSet->setPage($this->container->pageType);
         //	set edit page
         $this->pSet->setPage($this->container->pSet->getPageTypeByFieldEditFormat($field, EDIT_FORMAT_LOOKUP_WIZARD));
     } else {
         $this->pSet = $this->container->pSet;
     }
     $this->nLookupType = $this->pSet->getLookupType($this->field);
     $this->lookupTable = $this->pSet->getLookupTable($this->field);
     $this->setLookupConnection();
     $this->displayFieldName = $this->pSet->getDisplayField($this->field);
     $this->linkFieldName = $this->pSet->getLinkField($this->field);
     $this->linkAndDisplaySame = $this->displayFieldName == $this->linkFieldName;
     if ($this->nLookupType == LT_QUERY) {
         $this->lookupPSet = new ProjectSettings($this->lookupTable, $this->container->pageType);
         $this->cipherer = new RunnerCipherer($this->lookupTable);
         $this->lookupQueryObj = $this->lookupPSet->getSQLQuery()->CloneObject();
         if ($this->pSet->getCustomDisplay($this->field)) {
             $this->lookupQueryObj->AddCustomExpression($this->displayFieldName, $this->lookupPSet, $this->pSet->_table, $this->field);
         }
         $this->lookupQueryObj->ReplaceFieldsWithDummies($this->lookupPSet->getBinaryFieldsIndices());
         $lookupIndexes = GetLookupFieldsIndexes($this->pSet, $this->field);
         $this->displayFieldIndex = $lookupIndexes["displayFieldIndex"];
         $this->linkFieldIndex = $lookupIndexes["linkFieldIndex"];
     } else {
         $this->cipherer = new RunnerCipherer($this->pSet->_table);
         $this->LookupSQL = "SELECT ";
         $this->LookupSQL .= RunnerPage::sqlFormattedDisplayField($this->field, $this->lookupConnection, $this->pSet);
         $this->LookupSQL .= ", " . $this->lookupConnection->addFieldWrappers($this->pSet->getLinkField($this->field));
         $this->LookupSQL .= " FROM " . $this->lookupConnection->addTableWrappers($this->lookupTable) . " WHERE ";
     }
     $this->localControlsContainer = new ViewControlsContainer($this->pSet, $this->container->pageType, $pageObject);
     $this->localControlsContainer->isLocal = true;
 }
Exemple #3
0
 function ViewFileField($field, $container, $pageobject)
 {
     parent::ViewControl($field, $container, $pageobject);
     $this->initUploadHandler();
 }
Exemple #4
0
	/**
	 * Add a control into the page template.
	 *
	 * Useful for embedding functions and administrative utilities inline without having to adjust the
	 * application template.
	 *
	 * @param string|array $title       The title to set for this control
	 * @param string $link        The link to set for this control
	 * @param string|array $class The class name or array of attributes to set on this control
	 *                            If this is an array, it should be an associative array for the advanced parameters
	 */
	public function addControl($title, $link = null, $class = 'edit') {
		$control = new \ViewControl();

		// Completely associative-array based version!
		if(func_num_args() == 1 && is_array($title)){
			foreach($title as $k => $v){
				$control->set($k, $v);
			}
		}
		else{
			// Advanced method, allow for associative arrays.
			if(is_array($class)){
				foreach($class as $k => $v){
					$control->set($k, $v);
				}
			}
			// Default method; just a string for the class name.
			else{
				$control->class = $class;
			}

			$control->title = $title;
			$control->link = \Core\resolve_link($link);
		}

		$this->getControls()->addLink($control);
	}
	/**
	 * (PHP 5 &gt;= 5.0.0)<br/>
	 * Offset to set
	 * @link http://php.net/manual/en/arrayaccess.offsetset.php
	 * @param mixed $offset <p>
	 * The offset to assign the value to.
	 * </p>
	 * @param mixed $value <p>
	 * The value to set.
	 * </p>
	 * @return void
	 *
	 * @throws Exception
	 */
	public function offsetSet($offset, $value) {
		if($offset === null){
			// The user just wants the next available one.

			if($this->valid()){
				$this->next();

			}
			$offset = $this->key();
		}

		if($value instanceof ViewControl){
			$this->_links[$offset] = $value;
		}
		elseif(is_array($value)){
			$control = new ViewControl();

			// Completely associative-array based version!
			foreach($value as $k => $v){
				$control->set($k, $v);
			}

			// Some legacy updates for the icon.
			if(!$control->icon){
				switch($control->class){
					case 'add':
					case 'edit':
					case 'directory':
						$control->icon = $control->class;
						break;
					case 'delete':
						$control->icon = 'remove';
						break;
					case 'view':
						$control->icon = 'eye-open';
						break;
				}
			}

			$this->_links[] = $control;
		}
		else{
			throw new Exception('Invalid offset type for ViewControls::offsetSet, please only set a ViewControl or an associative array');
		}
	}
Exemple #6
0
	/**
	 * Add a control into the page template.
	 *
	 * Useful for embedding functions and administrative utilities inline without having to adjust the
	 * application template.
	 *
	 * @param string|array|Model $title  The title to set for this control
	 * @param string             $link   The link to set for this control
	 * @param string|array       $class  The class name or array of attributes to set on this control
	 *                            If this is an array, it should be an associative array for the advanced parameters
	 */
	public function addControl($title, $link = null, $class = 'edit') {

		if($title instanceof Model){
			// Allow a raw Model to be sent in as the control subject.
			// This is a shortcut for Controllers much like the {controls} smarty function has.
			$this->controls = ViewControls::DispatchModel($title);
			return;
		}

		$control = new ViewControl();

		// Completely associative-array based version!
		if(func_num_args() == 1 && is_array($title)){
			foreach($title as $k => $v){
				$control->set($k, $v);
			}
		}
		else{
			// Advanced method, allow for associative arrays.
			if(is_array($class)){
				foreach($class as $k => $v){
					$control->set($k, $v);
				}
			}
			// Default method; just a string for the class name.
			else{
				$control->class = $class;
			}

			$control->title = $title;
			$control->link = \Core\resolve_link($link);
		}

		// Is this control the current page?  If so don't display it.
		if($control->link != \Core\resolve_link($this->baseurl)){
			$this->controls[] = $control;
		}
	}