Object::getTransferHistory PHP Method

getTransferHistory() public static method

Get the history workflow of the Object
public static getTransferHistory ( $model )
    public static function getTransferHistory($model)
    {
        $trans = Transfer::model()->with('from_user')->findAll(array('condition' => ' object_id=:obj ', 'params' => array(':obj' => $model->object_id), 'order' => 'transfer_id ASC'));
        $trans_list = "<ul>";
        $trans_list .= "<li>- <b>" . $model->author->display_name . "</b> " . t("created on") . " <b>" . date('m/d/Y H:i:s', $model->object_modified) . "</b></li>";
        //Start to Translate all the Transition
        foreach ($trans as $tr) {
            if ($tr->type == ConstantDefine::TRANS_STATUS) {
                $temp = "<li>- <b>" . $tr->from_user->display_name . "</b> " . t("changed status to") . " <b>" . self::convertObjectStatus($tr->after_status) . "</b> " . t("on") . " <b>" . date('m/d/Y H:i:s', $tr->time) . "</b></li>";
            }
            if ($tr->type == ConstantDefine::TRANS_ROLE) {
                $temp = "<li>- <b>" . $tr->from_user->display_name . "</b> " . t("modified and sent to") . " <b>" . ucfirst($tr->note) . "</b> " . t("on") . " <b>" . date('m/d/Y H:i:s', $tr->time) . "</b></li>";
            }
            if ($tr->type == ConstantDefine::TRANS_PERSON) {
                $to_user = User::model()->findbyPk($tr->to_user_id);
                $name = "";
                if ($to_user != null) {
                    $name = $to_user->display_name;
                }
                $temp = "<li>- <b>" . $tr->from_user->display_name . "</b> " . t("modified and sent to") . " <b>" . ucfirst($name) . "</b> " . t("on") . " <b>" . date('m/d/Y H:i:s', $tr->time) . "</b></li>";
            }
            $trans_list .= $temp;
        }
        $trans_list .= '</ul>';
        return $trans_list;
    }

Usage Example

<?php

$this->widget('zii.widgets.CDetailView', array('data' => $model, 'attributes' => array(array('name' => 'object_id', 'type' => 'raw', 'value' => $model->object_id), array('name' => 'object_name', 'type' => 'raw', 'value' => CHtml::link($model->object_name, array("update", "id" => $model->object_id))), 'object_author_name', array('name' => 'comment_status', 'value' => Object::convertObjectCommentType($model->comment_status)), array('name' => 'object_date', 'value' => date("Y-m-d H:i:s", $model->object_date)), array('name' => 'object_type', 'type' => 'raw', 'value' => Object::convertObjectType($model->object_type)), array('name' => 'object_status', 'type' => 'raw', 'value' => Object::convertObjectStatus($model->object_status)), 'object_view', array('label' => t('cms', 'History'), 'type' => 'raw', 'value' => Object::getTransferHistory($model)), array('name' => 'object_content', 'type' => 'raw', 'value' => $model->object_content))));