i have made a system using phpmaker 2018 where users upload documents online, after a certain period i want the add and edit functionalities to be disabled, is there a way to trigger this automatically or it can only be done manually disabled from the admin panel.
Disabling the add and edit button automatically
-
- User
- Posts: 642
as long as you have a condition that needs to fullfilled to diable the add and edit, you just have to know the right events for the job. You can use that condition to hide the add and edit buttons when you need to.
forexample here I am hiding the add button from the list page
function Page_DataRendering(&$header) {
// Example:
//$header = "your header";
//hide add button, you can add condition beofre this
$this->OtherOptions["addedit"]->Items["add"]->Visible = FALSE;
}
and here I am hiding the edit option form the records in the list page
function ListOptions_Rendered() {
// Example:
//$this->ListOptions->Items["new"]->Body = "xxx";
//or even include record filed values, get the filed value of a record like this $this->field_name->CurrentValue
//remove edit option from a record in the list, you can add condition
$this->ListOptions->Items["edit"]->Visible = FALSE;
}
-
- User
- Posts: 11660
peterpejavi wrote:
after a certain period i want the add and edit functionalities to be
disabled, is there a way to trigger this automatically
Yes, you need to add your logic/condition to make sure the buttons are disabled after that certain period comes. For example, you have already had the information about upload date, and you want the buttons are disabled after 3 days since that date.
$dUpload = '2017-11-12'; // you can also get the date from database using ew_ExecuteScalar() function
$dExpired = date('Y-m-d', strtotime($dUpload . " + 3 days")); // expired should be started on 2017-11-15
$dNow = date('Y-m-d');
if (strtotime($dNow) >= strtotime($dExpired)) {
// your code to disable buttons goes here ...
}
-
- User
- Posts: 2
- Location: Malawi
Thanks for your assistance, i truly appreciate, i am working on the issue, if i face any hiccup i will certainly post it here!