. */ /** * Simple text column */ require_once(ROOTPATH."include/list/IColumn.php"); class BooleanImageColumn implements IColumn { protected $name; protected $header; protected $trueImage; protected $falseImage; protected $trueValue; protected $trueTitle; protected $falseTitle; protected $imageSize; protected $class; /** * Constructor * * @param string name of the column (as provided in the parameter of getCellValue()) * @param string header value */ public function __construct($name, $header, $trueImage, $falseImage, $trueValue=true, $trueTitle="Yes", $falseTitle="No", $imageSize=NULL) { $this->name = $name; $this->header = $header; $this->trueImage = $trueImage; $this->falseImage = $falseImage; $this->trueValue = $trueValue; $this->trueTitle = $trueTitle; $this->falseTitle = $falseTitle; $this->imageSize = $imageSize; $this->class = "center"; } public function getName() { return $this->name; } public function getHeader() { return $this->header; } public function getCellValue($rowNum, $row) { if( $this->imageSize==NULL ) { $attributes = NULL; }else { $attributes = array('height'=>$this->imageSize, 'width'=>$this->imageSize); } if( $this->isTrue($row) ) { return IconHelper::getIcon($this->trueImage, $this->trueTitle, $attributes); }else { return IconHelper::getIcon($this->falseImage, $this->falseTitle, $attributes); } return $row[$this->name]; } public function isSortable() { return true; } public function getClass() { return $this->class; } public function setClass($class) { $this->class = $class; } protected function isTrue($row) { return $row[$this->name]==$this->trueValue; } } ?>