This topic is locked

Different Colors

10/13/2007 12:27:41 PM
PHPRunner General questions
B
barbary author

I'm making an outage system

One of the fields shows estimated time to solve the problem

In the list page, I want all records to be normal except if estimated time is exceeded which should be red

how can I do this?
field ... EstimatedTime
BR,

Mahmoud

Alexey admin 10/15/2007

Mahmoud,
Use After record processed event for this.

Here is the sample code:

if($data["FieldName"]<now())

{

$row["rowstyle"]="style=\"background:red\"";

}

B
barbary author 10/23/2007

Mahmoud,

Use After record processed event for this.

Here is the sample code:


I want this to do te check each time thelist page refreshes

to see if the EstimatedTime is > now() or not

this will do it ?

Alexey admin 10/25/2007

Yes

B
barbary author 10/26/2007

Yes


Really Thanks

Worked just fine
Mahmoud

hfg 10/26/2007

I'm working with an Oracle DB, is there something I have to do differant? I have not been able to get this to work, it just seems to ignor the event.
if($data["CAR_TITLE_LOC"]='ER ')

{

$row["rowstyle"]="style=\"background:red\"";

}
Am I missing something else.
I have alsot tried
$row["rowstyle"]='style="background:blue"';
and
$row[$col."CAR_TITLE_LOC_style"]='style="background:red"';
Both with no luck.

J
Jane 10/30/2007

Hi,
try to use this code:

if($data["CAR_TITLE_LOC"]=="ER")

{

$row["rowstyle"]="style=\"background:red\"";

}

hfg 10/30/2007

Still no luck.
Could it have anything to do with the theme or layout I am using?
I am using the default layout with the Rome theme.
Thanks

J
Jane 10/30/2007

Please publish your project on Demo Account and post a URL to your pages here or send it to [email=support@xlinesoft.com]support@xlinesoft.com[/email] along with instructions on reproducing this error.

I'll find what's wrong with your project inspecting it at Demo account site.

M
Max68 10/30/2007

Please publish your project on Demo Account and post a URL to your pages here or send it to [email=support@xlinesoft.com]support@xlinesoft.com[/email] along with instructions on reproducing this error.

I'll find what's wrong with your project inspecting it at Demo account site.


Jane, after you solve this problem, can you publish the solution, because I've the same problem.
thank you

Massimiliano

M
morpheus 10/30/2007

I've just tried this and everything is RED?
what am I doing wrong???
[codebox]if($data["Status"]="Rejected")

{

$row["rowstyle"]="style=\"background:red\"";

return false;

}

else if($data["Status"]="Accepted")

{

$row["rowstyle"]="style=\"background:green\"";

return false;

}

else if($data["Status"]="Requested")

{

$row["rowstyle"]="style=\"background:yellow\"";

return false;

}

else {

return true;

}

[/codebox]
regards
Morpheus

Sergey Kornilov admin 10/30/2007

Comparisson operator in PHP is double equals sign (==):

$data["Status"]=="Rejected"

M
Max68 10/31/2007

Comparisson operator in PHP is double equals sign (==):


I've tried all the layout ( Color schema: London).
the script work only with the following layouts: Amsterdam, Madrid, Paris, Rome.
I don't Know if this can help you to solve the problem.
Massimiliano

J
Jane 10/31/2007

Massimiliano,
thank you for pointing me to this bug.

We'll fix it in the next PHPRunner update.
To make your pages working open C:/Program Files/PHPRunner4.1/templates/layouts/London/list.htm file, find this code:

<tr valign="top"

{$row.shadeclass}

if @TABLE.bRowHighlite##

onmouseover="this.className = 'rowselected';" onmouseout="this.className = '{$row.shadeclassname}';"

endif##

>

and replace it with this one:

<tr valign="top"

{$row.shadeclass}

if @TABLE.bRowHighlite##

onmouseover="this.className = 'rowselected';" onmouseout="this.className = '{$row.shadeclassname}';"

endif##

{$row.rowstyle}

>


Then rebuild your project.

M
Max68 10/31/2007

Thank you
now works fine!
Massimiliano

hfg 10/31/2007

I was using the "Default" layout. The posted fix work for it as well.
Thanks much

L
laonian 1/9/2008

Need help with row color change. I have been testing the "$row.rowstyle" code described above for a while and it did not work with me. Here is the detail:
I have a table called "test" with three fields: ID, Name and Result. The expected row coloring is: when the value for Result is "passed", row color is green; when the value for Result is "failed", row color is red; Otherwise color is yellow. I put the code in the AfterAdd event:

[codebox]

//** Custom code ****

// put your custom code here
global $conn;

$str = "SELECT * FROM test WHERE test.ID='".$keys["ID"]."'";

$rs = db_query($str,$conn);

$data = db_fetch_array($rs);

if ($data["Result"]=="passed")

{

$row["rowstyle"]="style=\"background:green\"";

}

else if ($data["Result"]=="failed")

{

$row["rowstyle"]='style="background:red"'; //note I tried a different quoting format here from the last one

}

else

{

$row["rowstyle"]='style="background:yellow"';

}

[/codebox]
I have PR version 4.1 Build 320. I used London Color schema and tried all the layouts (I had applied the layout fixes to "London" and "Default" before). But none of them worked for me.

Please tell me what I am doing wrong. Do I need to change settings (codes) elsewhere in addition to writing these codes in the event page? Thanks.

L
laonian 1/9/2008

Need help with row color change. I have been testing the "$row.rowstyle" code described above for a while and it did not work with me. Here is the detail:
I have a table called "test" with three fields: ID, Name and Result. The expected row coloring is: when the value for Result is "passed", row color is green; when the value for Result is "failed", row color is red; Otherwise color is yellow. I put the code in the AfterAdd event:

[codebox]

//** Custom code ****

// put your custom code here
global $conn;

$str = "SELECT * FROM test WHERE test.ID='".$keys["ID"]."'";

$rs = db_query($str,$conn);

$data = db_fetch_array($rs);

if ($data["Result"]=="passed")

{

$row["rowstyle"]="style=\"background:green\"";

}

else if ($data["Result"]=="failed")

{

$row["rowstyle"]='style="background:red"'; //note I tried a different quoting format here from the last one

}

else

{

$row["rowstyle"]='style="background:yellow"';

}

[/codebox]
I have PR version 4.1 Build 320. I used London Color schema and tried all the layouts (I had applied the layout fixes to "London" and "Default" before). But none of them worked for me.

Please tell me what I am doing wrong. Do I need to change settings (codes) elsewhere in addition to writing these codes in the event page? Thanks.

L
laonian 1/9/2008

Need help with row color change. I have been testing the "$row.rowstyle" code described above for a while and it did not work with me. Here is the detail:
I have a table called "test" with three fields: ID, Name and Result. The expected row coloring is: when the value for Result is "passed", row color is green; when the value for Result is "failed", row color is red; Otherwise color is yellow. I put the code in the AfterAdd event:

[codebox]

//** Custom code ****

// put your custom code here
global $conn;

$str = "SELECT * FROM test WHERE test.ID='".$keys["ID"]."'";

$rs = db_query($str,$conn);

$data = db_fetch_array($rs);

if ($data["Result"]=="passed")

{

$row["rowstyle"]="style=\"background:green\"";

}

else if ($data["Result"]=="failed")

{

$row["rowstyle"]='style="background:red"'; //note I tried a different quoting format here from the last one

}

else

{

$row["rowstyle"]='style="background:yellow"';

}

[/codebox]
I have PR version 4.1 Build 320. I used London Color schema and tried all the layouts (I had applied the layout fixes to "London" and "Default" before). But none of them worked for me.

Please tell me what I am doing wrong. Do I need to change settings (codes) elsewhere in addition to writing these codes in the event page? Thanks.

J
Jane 1/11/2008

Hi,
you need to use List page: After record processed event instead of After record added event for this purpose.

Here is the correct code:

if ($data["Result"]=="passed")

{

$row["rowstyle"]="style=\"background:green\"";

}

else if ($data["Result"]=="failed")

{

$row["rowstyle"]="style=\"background:red\"";

}

else

{

$row["rowstyle"]="style=\"background:yellow\"";

}

L
laonian 1/11/2008

It works great. Sorry for my messing up the list page and add page.