This topic is locked
[SOLVED]

block editing after the deadline ends.

10/19/2022 3:48:33 PM
PHPRunner General questions
Roosevelt author

Hello, for everyone, I have an application where I put two dates, one from the beginning and one from the end. After the end date and time, I want the edit to be blocked. Question, where within PHPrunner i write this code? What is the command to block editing?

Roosevelt author 10/19/2022

Mr. Admin, sending a manual page for reference.

Example 1

Disable editing of data in a certain table on weekends:

$dw = date("w", time());
$isEditable = $dw!=6 && $dw!=0;
return $isEditable;

Example 2

Enable editing of only the records with odd IDs (1,3,5 ...):

if ($values["ID"] & 1)
return false;
else
return true;

Ok, how I put my date? Exemple:

$dw = date("w", time());
$isEditable = $dw!=data_encerramento_pedido && $dw!=12;
return $isEditable;

img alt

img alt

img alt

H
hudster 10/19/2022

Not an expert in this - especially from the PHP perspective, but I have used the MySQL query here - create a new field in the table "date difference" AS the difference between now() and end date.

If the date difference value is >1 then ask the PHP code to return a value (eg: "false"). Then set phpr to make the line in your record not editable for "false".

This link in the forum is helpful - last post https://asprunner.com/forums/topic/23968-date-differences-in-phprunner

or this page https://xlinesoft.com/phprunner/docs/isrecordeditable.htm
if ($values["date_difference"] >0)
return false;
else
return true;

fhumanes 10/20/2022

Hello,

Phprunner has an event to do this type of control.

img alt

(1), is the table in which you want to do control
(2) It is the event where depending on the data you can establish whether the registration is editable or not.

Cheers,
fernando