Calc stopped working

Not sure at this point what has changed, but this calc was working, showing an image in a list but is no longer doing so:

Code:
$date = '{stratplanprojects___lastupdated_raw}';
$june = date('Y-06-24 00:00:00');
$july = date('Y-07-25 00:00:00');
$august = date('Y-08-25 00:00:00');
$september = date('Y-09-24 00:00:00');
$october = date('Y-10-25 00:00:00');
$november = date('Y-11-24 00:00:00');
$december = date('Y-12-25 00:00:00');
$january = date('Y-01-25 00:00:00');
$february = date('Y-02-21 00:00:00');
$march = date('Y-03-25 00:00:00');
$april = date('Y-04-24 00:00:00');
$may = date('Y-05-25 00:00:00');
 
if ($date >= $june AND $date < $july)
return '<img src="http://myURL/images/checkjune.png" width="80" height="98"/>';
 
if ($date >= $july AND $date < $august)
return '<img src="http://myURL/images/checkjuly.png" width="80" height="98"/>';
 
if ($date >= $august AND $date < $september)
return '<img src="http://myURL/images/checkaugust.png" width="80" height="98"/>';
 
if ($date >= $september AND $date < $october)
return '<img src="http://myURL/images/checkseptember.png" width="80" height="98"/>';
 
if ($date >= $october AND $date < $november)
return '<img src="http://myURL/images/checkoctober.png" width="80" height="98"/>';
 
if ($date >= $november AND $date < $december)
return '<img src="http://myURL/images/checknovember.png" width="80" height="98"/>';
 
if ($date >= $december AND $date < $january)
return '<img src="http://myURL/images/checkdecember.png" width="80" height="98"/>';
 
if ($date >= $january AND $date < $february)
return '<img src="http://myURL/images/checkjanuary.png" width="80" height="98"/>';
 
if ($date >= $february AND $date < $march)
return '<img src="http://myURL/images/checkfebruary.png" width="80" height="98"/>';
 
if ($date >= $march AND $date < $april)
return '<img src="http://myURL/images/checkmarch.png" width="80" height="98"/>';
 
if ($date >= $april AND $date < $may)
return '<img src="http://myURL/images/checkapril.png" width="80" height="98"/>';
 
if ($date >= $may AND $date < $june)
return '<img src="http://xxx/images/checkmay.png" width="80" height="98"/>';

Need help diagnosing this issue. FYI: Simple calcs calling images in other lists work fine.

Joomla 3.3.6
F 3.2
 
When you say it stopped working ... did you do any kind of update, or make any other changes prior to it ceasing to work?

Try putting in ...

var_dump($date);exit;

... as tbe second line (right after you set up $date) and make sure $date is set to something sane.

You may need to load the form, then put that var_dump() in prior to submitting the form, so it doesn't prevent you loading the form.

-- hugh
 
I updated Joomla and Fabrik from Git. The only server changes I am aware of of the following php settings changes:

register_globals=Off
safe_mode=Off
allow_url_include=Off
disable_functions=show_source, system, shell_exec, passthru, exec, phpinfo, popen, proc_open

Following your suggestion, I used this:

$date = '{stratplanprojects___lastupdated_raw}';
var_dump($date);exit;

and correctly outputed the date:

string(19) "2015-01-13 19:30:00"


I am able to return image calls on other calc elements.

If I were to try to simplify my approach and use just one if statement that would return an image if the date value stored in {stratplanprojects___lastupdated_raw} was one month earlier than today, what code could I use?

Thanks.
 
I got this to work (simplified):

Code:
$freshdate = date("Y-m-d 00:00:00", strtotime("-1 month"));
$updated = '{stratplanprojects___lastupdated_raw}';
 
if ($updated < $freshdate)
return "Stale";
 
else
return "Fresh";

Haven't tried returning an image yet.
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top