This topic is locked
[SOLVED]

 Pages view based on date

8/15/2008 5:32:26 AM
PHPRunner General questions
J
johan-v author

Hello,
Newbie here from Belgium.

Is it possible to show and hide the list (and or) view pages based on a date?
What I need is the following.

We have year divided in three time slices and for that I have three databas tables.

What i would like is the following.
At the beginning all tables should be view only.

Then the following should happen.
Date 2009-01-20

database table 1 becomes view and edit

all other remain view only
Date 2009-02-20

database table 1 reset to view only

database table 2 becomes view and edit

all other remain view only
Date 2009-03-20

database table 2 reset to view only

database table 3 becomes view and edit

all other remain view only
Date 2009-04-20

everything is view only
It would be nice if this could happen based on computer date but I would already be very glad

if I could somewhere have a switch to set.
Anybody has some tips where to start?
greetings,
Johan

J
Jane 8/15/2008

Johan,
you can change edit links for all tables in the following way:

{if $allowedit}

<a href="TableName_edit.php?{$row.1editlink}">Edit</a>

{/if}


Then check date in the List page: Before display event and assign correct value to the $allowedit variable:

if (strtotime("now")>strtotime("2009-01-20") && strtotime("now")<strtotime("2009-02-20"))

$smarty->assign("allowedit",true);

else

$smarty->assign("allowedit",false);

J
johan-v author 8/15/2008

Johan,

you can change edit links for all tables in the following way:
Then check date in the List page: Before display event and assign correct value to the $allowedit variable:


Not sure what is allowed with {if $allow_edit}

Users can now only edit or view data according to the advanced security settings.

That is working fine already.

But I'm not sure how to insert the new restriction code.

Below a snippet from the source I have now.
Thanks,

<!-- table data --><!--{foreach from=$rowinfo item=row}-->

<TR onmouseover="this.className = 'rowselected';"

onmouseout="this.className = '{$row.shadeclassname}';" vAlign=top

{$row.rowstyle} {$row.shadeclass}>{if $allow_edit}

<TD align=middle>{if $row.1editable}&nbsp; <A

href="fiches07_08_1ste_trim_edit.php?{$row.1editlink}">Bewerken</A>

{/if}&nbsp; </TD>{/if}

<TD align=middle><A

href="fiches07_08_1ste_trim_view.php?{$row.1editlink}">Bekijken</A> </TD>{if $allow_delete || $allow_export }
J
Jane 8/18/2008

Hi,
$allow_edit and $allowedit are different variables.

$allow_edit is used to restrict used access based on the security settings on the Security tab.

$allowedit is used to restrict used access based on the current date.

J
johan-v author 8/18/2008

Hi,

$allow_edit and $allowedit are different variables.

$allow_edit is used to restrict used access based on the security settings on the Security tab.

$allowedit is used to restrict used access based on the current date.


Great news,
Thank you,