AnsweredAssumed Answered

How to display a non-cached version of the detailveiwdefs.php in v6.5 with custom code?

Question asked by Rodolfo Tuble on Nov 8, 2016

I have a custom code that changes the value of the Date Created field to a formatted string:

 

function humanTiming ($time)
{

    $time = time() - $time; // to get the time since that moment
    $time = ($time<1)? 1 : $time;
    $tokens = array (
        31536000 => 'year',
        2592000 => 'month',
        604800 => 'week',
        86400 => 'day',
        3600 => 'hour',
        60 => 'minute',
        1 => 'second'
    );

    foreach ($tokens as $unit => $text) {
        if ($time < $unit) continue;
        $numberOfUnits = floor($time / $unit);
        return $numberOfUnits.' '.$text.(($numberOfUnits>1)?'s':'');
    }
}

 

$supportTicketBean = BeanFactory::getBean('CB_SupportTickets');
$supportbeanList = $supportTicketBean->retrieve_by_string_fields(
    array(
        'id' => $_GET['record'],
    )
);
$new_format = explode(" ",$supportbeanList->date_entered);

$time_temp = strtotime($supportbeanList->date_entered);
$human_time = humanTiming($time_temp).' ago ('.date("m/d/Y", strtotime($new_format[0])).' '.date("g:i a", strtotime($new_format[1])).')';

 

3 =>
    array (
        0 => array (
            'name' => 'date_entered',
            'label' => 'LBL_DATE_ENTERED',
            'customCode' => $human_time,
        ),
        1 =>
            array (
                'name' => 'created_by_name',
                'label' => 'LBL_CREATED',
            ),
    ),

So what I would like to happen here is that for every record in my module I will display the different time lapsed when that record was created. Though what is happening now is that the value for the time lapsed is cached based on the first record view, so for every other records you view you will get the same value for the Date Created with that what you get for the first record, or in simple terms they all have the same Date Created because the value is cached.

 

So I would like to ask if how can I get the uncached version or how do I make this happen without using the cached?

Outcomes