This topic is locked

Data Driven Entry

9/2/2008 12:27:37 AM
PHPRunner General questions
J
jaflores author

Hi,
I have a a data field say File1.Data1 String. My user table have an Employee Type: 'Supervisor','Regular'.
during edit of File1, if the usertype (i can setup a $_SESSION["f_usertype"] to carry the value around) is Supervisor, the File1.Data1 should be editable, otherwise, it's readonly with the value displayed.
please help, don't know how to do it...

J
Jepsen 9/2/2008

The way I go around this one is to:
Make a view for each catagory of personnel who needs access

Use permissions to make sure that the right view is accessed by the users
To make the same view for alle and then limit their edit rights based on their catagory is probably possible, but would require a lot of costum programming. And if you are capable of doing that, you probably don't need PHPR in the first place.
I always start with defining the administrator view. The administrator have all rights. All subsequent views are a variation of the administrator, but with fewer rights. When you create a view based on a previous made view, it inherits most of the settings, and the editing is minimal.
Hope that helps

Morten

J
Jane 9/2/2008

Hi,
to restrict user access edit your edit page in HTML mode on the Visual Editor tab.

See my changes in Bold:

{if $f_usertype}

{build_edit_control field="Data1" value=$value_Data1 mode="edit"}

{else}

{$value_Data1}

{/if}


Then define $f_usertype variable in the Edit page: Before display event on the Events tab:

if ($_SESSION["f_usertype"]=="Supervisor")

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

else

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

J
jaflores author 9/4/2008

Thanks to both of you!