<?php
 namespace ModStart\Admin\Widget; use ModStart\Widget\AbstractWidget; class DashboardItemA extends AbstractWidget { private $type = 1; private $link; private $title; private $desc; private $icon; private $color; private $number; public static function makeIconTitleDesc($icon, $title, $desc, $link = 'javascript:;', $color = '#999') { $item = new DashboardItemA(); $item->icon = $icon; $item->title = $title; $item->desc = $desc; $item->link = $link; $item->color = $color; $item->type = 1; return $item; } public static function makeIconNumberTitle($icon, $number, $title, $link = 'javascript:;', $color = 'inherit') { $item = new DashboardItemA(); $item->icon = $icon; $item->number = $number; $item->title = $title; $item->link = $link; $item->color = $color; $item->type = 2; return $item; } public function render() { switch ($this->type) { case 1: return <<<HTML
<a href="{$this->link}" class="ub-dashboard-item-a" {$this->formatAttributes()}>
    <div class="icon" style="color:{$this->color}">
        <i class="font {$this->icon}"></i>
    </div>
    <div class="title" style="color:{$this->color}">{$this->text}</div>
    <div class="desc">{$this->desc}</div>
</a>
HTML;
case 2: $number = number_format($this->number); return <<<HTML
<a href="{$this->link}" class="ub-dashboard-item-a" {$this->formatAttributes()}>
    <div class="icon" style="color:{$this->color}">
        <i class="font {$this->icon}"></i>
    </div>
    <div class="number-value">{$number}</div>
    <div class="number-title">{$this->title}</div>
</a>
HTML;
} } }