This topic is locked

Remove 'edit' from list page

1/29/2009 11:18:54 AM
PHPRunner General questions
U
Urnso author

I have searched and searched and tried about every variation on the forum. For some reason I can't get the edit link removed from the list page based on certain criteria.
Trying this code now:

[codebox]global $noedit;
$noedit = "0";
if ($noedit == "0")

{

$xt->assign("edit_link",false);

}

else

{

$xt->assign("edit_link",true);[/codebox]
unless I am thinking wrong but this should remove the code between {Begin edit_link} {End edit_link} that is shown in the Visual Editor/html output.
I read through the manual and still can't get a grasp on this one. Please help! Thx!

U
Urnso author 1/29/2009

Ok I did some testing with the add_link by using

$xt->assign("add_link",false);

If I do this it will remove the add link just like a want. But if I use edit_link they will not remove from the page. Any ideas?

U
Urnso author 1/29/2009

Ok I figured out how to remove the "edit" tag. But it does it on everyline listed.
I have a field "Date" that is recorded when the user enters data.
What I want to do is disable the edit link where date > now().

I don't want the users to be able to edit records they entered yesterday but I would still want them to edit the records for today. Is this possible?
Something like:
[codebox]

//Entered today Ok to Edit

If if ($values["Date"] == now())

//show the edit link

$xt->assign("no_edit",true);
if ($values["Date"] < now()){

//hide the edit link

$xt->assign("no_edit",false);

} else {

//show the edit link

$xt->assign("no_edit",true);

}

[/codebox]
I hope I'm on the right track for this.

J
Jane 1/30/2009

Hi,
I suppose you need to he List page: After record processed event for this purpose.

Here is a sample code:

global $record;

$noedit = "0";

if ($noedit == "0")

$record["edit_link"]=false;

else

$record["edit_link"]=true;

U
Urnso author 1/30/2009

Hi,

I suppose you need to he List page: After record processed event for this purpose.

Here is a sample code:


Jane,
I tried what you posted and it wouldn't do anything. even tried a few variations.
I am using this now and it works but only when one record is entered. If you enter another record it will change the outcome.
[codebox]global $xt;

$entrytime = $data["Date"];

$now = now();
$timeduration = strtotime($now) - strtotime($entrytime);

$timeminutes = $timeduration/60;

$timehrs = $timeminutes/60;
If ($timehrs < "24")

$xt->assign("no_edit",true);
//I want to see hrs on the top of page, will delete when working

echo $timehrs;

echo "
";
return true;[/codebox]
Works fine like I said until you have more than one record.

As the users makes entries and those entries reach 24hrs of age when they view the list page I want the "Edit" link to be removed. I want it to show the "edit" link for entries that are under 24hrs in age.
Hope this helps. And thx for you support.

J
Jane 2/2/2009

Hi,

$xt->assign("no_edit",true);

won't work in the List page: After record processed event.
You need to declare $record array and use it:

global $record;

$record["edit_link"]=false;

U
Urnso author 2/2/2009

Hi,

won't work in the List page: After record processed event.
You need to declare $record array and use it:


Jane,
once again Awesome!
Works perfectly!