<?php

class FStatusBehavior extends CActiveRecordBehavior {

    public function getStatuses() {
        return array(
            0 => Yii::t('admin', 'Draft'),
            1 => Yii::t('admin', 'Published'),
        );
    }

    public function getStatusLabel($status) {
        $statuses = $this->getStatuses();
        if (isset($statuses[$status])) {
            if ($status == 0) {
                $status = "<span class='label label-sm label-warning'>{$statuses[$status]}</span>";
            } else {
                $status = "<span class='label label-sm label-success'>{$statuses[$status]}</span>";
            }
        }
        return $status;
    }

}
