CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 [How To] Showing Link On Calendar If No Events Are Schedule

Print topic Send  topic

Author Message
mbishop1980

Posts: 31
Posted: 07/03/2008, 4:45 AM

I have a calendar that I need to display a link if no event is scheduled. I already have it set up so that if the EventDescription is equal to a certain value than depending on that value it will determine which link is displayed.

I will try to explain this in more detail. What I'm doing with this calendar is displaying a ordering schedule. It looks to the database to see if an order has been started or completed. If it has been started it will display a link for that day for the user to continue that order. If the order has been completed is will show a link to review the order. What I'm needing to do is if the user hasn't started an order to show a link to start the order. These days are also color coded. Thanks to the help of some very smart people on this forum I have that working.

Below is the code that I have for the started and completed links. I have tried everything I know and have to result to the forum. Any help would be greatly appreciated.

if($shopping_carts->EventDescription->GetValue() == "started") {
$shopping_carts->Attributes->SetValue('backcolor', ' style="background-color: teal;"');
$shopping_carts->update->Visible = true;
$shopping_carts->start->Visible = false;
$shopping_carts->review->Visible = false;
}

if($shopping_carts->EventDescription->GetValue() == "completed") {
$shopping_carts->Attributes->SetValue('backcolor', ' style="background-color: green;"');
$shopping_carts->update->Visible = false;
$shopping_carts->start->Visible = false;
$shopping_carts->review->Visible = true;
}
_________________
Thanks,
Eric
View profile  Send private message
wkempees


Posts: 1679
Posted: 07/04/2008, 3:38 AM

Using the above, why not create a (Thursday) event "Open" or "Unbooked" or "xxxx"
and just write the test for that?

Walter
(one of the ...... people)
_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)

if you liked this info PAYPAL me: http://donate.consultair.eu
View profile  Send private message
mbishop1980

Posts: 31
Posted: 07/04/2008, 10:31 AM

I have tried something similar to that and it didn't work.
I can't get anything to show up in any other days if there are no events. If there is an event I can make it show anything.
I have used the following code:

if($shopping_carts->EventDescription->GetValue() == "") {
$shopping_carts->Attributes->SetValue('backcolor', ' style="background-color: brown;"');
$shopping_carts->update->Visible = false;
$shopping_carts->start->Visible = true
$shopping_carts->review->Visible = false;
}
I'm using this in the BeforeShow EventDescription.
I have to figure out how to tell it if No Event is scheduled to show the $shopping_carts->start->Visible = true;
Thanks for you help

_________________
Thanks,
Eric
View profile  Send private message
wkempees


Posts: 1679
Posted: 07/04/2008, 12:07 PM

What I meant is/was:
Why not create an event "Open" or "Unbooked" or "xxxx"
and test for:
  
if($shopping_carts->EventDescription->GetValue() == "started") {  
$shopping_carts->Attributes->SetValue('backcolor', ' style="background-color: teal;"');  
$shopping_carts->update->Visible = true;  
$shopping_carts->start->Visible = false;  
$shopping_carts->review->Visible = false;  
}  
  
if($shopping_carts->EventDescription->GetValue() == "completed") {  
$shopping_carts->Attributes->SetValue('backcolor', ' style="background-color: green;"');  
$shopping_carts->update->Visible = false;  
$shopping_carts->start->Visible = false;  
$shopping_carts->review->Visible = true;  
}   
  
if($shopping_carts->EventDescription->GetValue() == "unbooked") {  
$shopping_carts->Attributes->SetValue('backcolor', ' style="background-color: brown;"');  
$shopping_carts->update->Visible = false;  
$shopping_carts->start->Visible = true;  
$shopping_carts->review->Visible = false;  
}   

By creating an event I mean that you programatticaly INSERT a record for the (Thurs)day's that you want to be available.

HTH
Walter

_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)

if you liked this info PAYPAL me: http://donate.consultair.eu
View profile  Send private message
mentecky

Posts: 321
Posted: 07/04/2008, 1:15 PM

Eric,

Right after the DayNumber label add a Panel Control. Put whatever links or text you want it to show if there are no events scheduled.

Click the calendar and in BeforeShowDay add something like this:
$events->panel_no_events->Visible = true;

Click the calendar again and in BeforeShowEvent add:
$events->panel_no_events->Visible = false;

This will display the panel for every day. If there is an event the panel will be hidden.

I added this to my calendar so you can see it at:
http://www.grifterrock.com/events.php?eventsDate=2007-05

Rick
_________________
http://www.ccselite.com
View profile  Send private message
mbishop1980

Posts: 31
Posted: 07/04/2008, 4:11 PM

Thank you Rick & Walter
Walter for the code on coloring Thursdays
Rick, you are a genius.
It is all about the positioning of the crazy link (I didn't know that).
When I put the link next to the DayNumber label it started appearing. I then just put in the code below and it worked like a charm. Now the users have the option of Starting an order if one hasn't been started for that particular Thursday.
$day = 5;
if(CCDayOfWeek($shopping_carts->CurrentProcessingDate) == $day) {
$shopping_carts->Attributes->SetValue('backcolor', ' style="background-color:brown;"');
$shopping_carts->start->Visible = true;
}
if(CCDayOfWeek($shopping_carts->CurrentProcessingDate) != $day) {
$shopping_carts->start->Visible = false;
}

The second if statement was needed so that it wouldn't show the link on all the days. Now it just shows on Thursdays with no orders.
_________________
Thanks,
Eric
View profile  Send private message
mentecky

Posts: 321
Posted: 07/04/2008, 4:15 PM

Great Eric! Glad we could help!

BTW... I'm not a genius... I'm just lazy and can find the shortcuts. lol

Rick
_________________
http://www.ccselite.com
View profile  Send private message
mbishop1980

Posts: 31
Posted: 07/04/2008, 4:22 PM

I spent two days trying to figure this out before I can to the forum.
It just about drove me nuts. And to know that it was as simple as putting the link directly after the DayNumber.
Just about makes me sick.

_________________
Thanks,
Eric
View profile  Send private message
mentecky

Posts: 321
Posted: 07/04/2008, 4:27 PM

Eric,

When in doubt look at the HTML code. Like when you see your label inside a BEGIN ROW comment or BEGIN EVENT... It won't be looked at if there is no row or event... So you need to move it outside that block.

Rick
_________________
http://www.ccselite.com
View profile  Send private message
wkempees


Posts: 1679
Posted: 07/05/2008, 3:16 AM

Well done.
There are always more ways to a solution.
Risck's great for this one.
I have (twice) suggested you just create an event for the thursday's that had no event, but htne I knew what you were doing from previous posts.

Both methods ok, as proven by your happy message.

Walter

_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)

if you liked this info PAYPAL me: http://donate.consultair.eu
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.