This topic is locked

if recordset approved do not generate edit link page on list view

8/9/2007 8:21:03 AM
PHPRunner General questions
L
lisa_dmc author

hi...

i am really new on php & mysql... & phpr

i have a table structured as follow:

----------------------------------------------------------------------------------------------

| id (int) | student_id (varchar) | requested_book (varchar) | approval (boolean) |

----------------------------------------------------------------------------------------------

the default generated page by phpr 4.0 is nicely done & work well...

i have 2 user: 1 is admin, the other is staff

here's what i am trying to do:

  • how to modify list view so that edit link on list view is "working" when approval value is 1
  • how to make the approval field is accessible only by admin

    i am not sure where to start...

    can somebody give me an idea?

    thanks

F
frocco 8/9/2007

In your BeforeProcessRowList event
add a condition and dissable the edit like this.
$smarty->assign('allow_edit', false);
HTH
Frank

L
lisa_dmc author 8/9/2007

thanks...

i did it but error happend...

Technical information

Error type 8

Error description Undefined variable: smarty

F
frocco 8/10/2007

Did you declare the variable?
In the event, add:

global $smarty;
then your code
HTH
Frank

L
lisa_dmc author 8/10/2007

error is gone, but nothing happened

i know i have to write for the condition, but don't know how

condition i want is when approval = 1
//** Custom code ****

// put your custom code here

global $smarty;

$smarty->assign('allow_edit', false);

return true;

// return true if you like to display row on in the list

// return false in other case
i can't seem to write the correct condition code... i have tried many things before line $smarty->assign('allow_edit', false);

J
Jane 8/13/2007

Lisa,
try to use this code:

global $smarty;

if ($data["approval"]==1)

$smarty->assign('allow_edit', false);

return true;

L
lisa_dmc author 8/22/2007

Thanks Jane... It worked....

Lisa,

try to use this code:

D
darkmage0 9/14/2007

So I tried to use the code above to remove the edit and inline edit links when a record equals something, and nothingthing happens.
I'm using phprunner 4.0(305)

layout(london)
This is the code that I have tried to use on my List page BeforeProcessRowList
[codebox]global $smarty;

if($data["PayRoll Processed Record:"]==1)

$smarty->assign('allow_edit',false);

return true;[/codebox]
Once again what im trying to do is hide edit and inline edit html links on the list page if $data["PayRoll Processed Record:"] equals 1 which is a check box

has some thing changed or am I doing some thing wrong
Thx you for you help
Travis Wilson

Sergey Kornilov admin 9/15/2007

Try to print field value on the page to see what's in there:

echo $data["PayRoll Processed Record:"];
D
darkmage0 9/15/2007

Hey when i echo echo $data["PayRoll Processed Record:"]; I get 1111111 across the top of the page. and when i use [codebox]global $smarty;

if($data["PayRoll Processed Record:"]==1)

$smarty->assign('allow_edit',false);

echo $data["PayRoll Processed Record:"];

return true;

[/codebox]

but nothing happens

Sergey Kornilov admin 9/16/2007

Post your code to Demo Account and send the URL to support@xlinesoft.com

D
darkmage0 9/16/2007

The URL for the site is http://demo.asprunner.net/darkmage0%5Fhotm..._Panel_list.php
UserName = 99

Password = darkmage
Administrator control panel is the page well the code is the script is on all list pages
Thank you

Travis Wilson

D
darkmage0 9/16/2007

ok so this is how you remove the inline edit link when a record equals x
At first enclose add these expressions before and after the Edit link in Visual Editor:

QUOTE

{if $row.1editable}

...

{/if}
Build the pages.
Open generated ..._list.php file with a text editor

Find this line there:
$rowinfo[]=$row;
and insert this code just before it:
if($data["Fieldname"]==1)

$row["1editable"] = false;

else

$row["1editable"] = true;
use $data["Fieldname"] expressions to access field values there.
Travis Wilson

Alexey admin 9/17/2007

Travis,
this solution would work the best.

You don't need to edit generated files with PHPRunner 4.1

Just insert this code:

if($data["Fieldname"]==1)

$row["1editable"] = false;

else

$row["1editable"] = true;



to After record processed event