<?php
include_once("misc.php");
class class_column
{
public $title;
public $field;
public $format_;
public function __construct($title, $field, $format_ = null)
{
if ($format_ == null) $format_ = function ($x) {return $x;};
$this->title = $title;
$this->field = $field;
$this->format_ = $format_;
}
public function extract($row)
{
// return call_user_func($this->extract_, $row);
return $row[$this->field];
// return $this->extract_($row);
}
public function format($value)
{
return call_user_func($this->format_, $value);
// return $this->format_($value);
}
}
class class_table
{
private $columns;
private $rows;
public function __construct($columns, $rows = [])
{
$this->columns = $columns;
$this->rows = [];
$this->fill($rows);
}
public function columns_get()
{
return $this->columns;
}