File: D:/HostingSpaces/SBogers10/fietsparkeer.komma-mediadesign.nl/wwwroot/mvc/models/m_productBlock.php
<?php
/**
* m_productBlock.php
* Created by Komma Mediadesign.
* Author: mike
* Date: 3/12/13
*/
class ProductBlock
{
/*
* @property string $_title;
* Title of the Project
*/
private $_title = '';
/*
* @property string $_description;
* Description of the Project
*/
private $_description = '';
/*
* @property string $_label;
* Label of the topbutton
*/
private $_url = '';
private $_target = '_self';
/*
* @property string $_label;
* Label of the topbutton
*/
private $_image = '';
/*
* @property
*/
private $_classes = array();
/*
* Constructor
*/
public function __construct($title){
$this->_title = $title;
}
/*
* Sets the subtitle of the project
* @param string
*/
public function setDescription($input)
{
if( ! empty($input))
{
$this->_description = $input;
}
}
/*
* Sets the subtitle of the project
* @param string
*/
public function setUrl($url, $blank = false)
{
if( ! empty($url))
{
$this->_url = $url;
if($blank) $this->_target = '_blank';
}
}
/*
* Sets the subtitle of the project
* @param string
*/
public function setImage($path)
{
if( ! empty($path))
{
$this->_image = $path;
}
}
/*
* Add class
* @param string
*/
public function addClass($className)
{
if($className != NULL)
{
$this->_classes[] = $className;
}
}
public function display($echo = TRUE)
{
$output = '';
$output .= '<a href="'.$this->_url.'" target="' . $this->_target . '" class="pBlock';
foreach($this->_classes as $className)
{
$output .= ' '.$className;
}
$output .= '">';
$output .= '<span class="pBlockImage">
<img src="'.$this->_image.'" alt="'.$this->_title.'" />
<span class="pBlockOverlay"></span>
</span>
<span class="pBlockContent">
<span class="pBlockTitle">'.$this->_title.'</span>
'.$this->_description.'
<span class="pBlockBar"></span>
<span class="pBlockArrow"></span>
<span class="pBlockArrowActive"></span>
</span>';
$output .= '</a>';
if($echo)
{
echo $output;
}
else
{
return $output;
}
}
}