Welcome, Guest. Please login or register.
Did you miss your activation email?


Login with username, password and session length

Search

 
Advanced search

8054 Posts in 1860 Topics- by 2099 Members - Latest Member: roi
Calendar Script CommunityCustomizationPlugins (Moderators: scott, DanO, Marty)conditional add event
Pages: [1]   Go Down
Print
Author Topic: conditional add event  (Read 926 times)
0 Members and 1 Guest are viewing this topic.
delicia
New Member
*

Karma: 0
Offline Offline

Posts: 8


WWW
« on: November 04, 2008, 03:21:08 PM »

just installed add event from grid plugin and it works great.  we are using the calendar to sign up for days the business is open.  i have entered events with the title 'CLOSED' for the dates we are not open and that should be the only event entered on those days.  so i would like the add event link NOT to show up on those days.  i tried using code setting a variable $closed if the event title eq 'CLOSED' but it always displayed the add event link.  i would be glad to create a custom event field for closed if that would help.  i just can't figure out any coding that works to suppress the add event link.  please help!
Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 235

Please don't PM me. Post in the open forum.


WWW
« Reply #1 on: November 04, 2008, 04:11:26 PM »

** i tried using code setting a variable $closed if the event title eq 'CLOSED' **

How exactly did you go about that?? (Hint: post the code used)

Dan O.

Logged
delicia
New Member
*

Karma: 0
Offline Offline

Posts: 8


WWW
« Reply #2 on: November 04, 2008, 05:23:39 PM »

i started over and have it working now using a field status = open/closed (added parts in red):

               <%FOREACH GRID ROW%>
               <TR <%=$rowheight%>>
                  <%FOREACH GRID COLUMN%>
                  <% $i=0; %> <% $flag=''; %>
                  <TD CLASS="thinborder" VALIGN="TOP" WIDTH="14%" <%=$rowheight%> BGCOLOR="<%IF

SELECTED%><%=$_GRID_CELL_SELECTED_BGCOLOR%><%ELSE%><%=$_GRID_CELL_BGCOLOR%><%/IF%>">
                     <%IF DISPLAY%>
                        <SPAN BGCOLOR="<%=$_GRID_DATE_BGCOLOR%>"

CLASS="griddatetext">&nbsp;<NOBR><%if($DAY->{'dd'}==1&&$VIEW ne

"Month"){%><%=$DAY->{'monthname'}%>&nbsp;<%}%><%=$DAY->{'dd'}%>&nbsp;</NOBR></SPAN><BR>
                        <%FOREACH EVENT%>
                           <%$i++;%>
                           <SPAN CLASS="gridtext">
                           <FONT SIZE="<%=$_GRID_CELL_TEXT_SIZE%>">
                           <% if ($_SHOW_GRID_EVENT_BULLET) {%>•<%}%>
                           <% if ($_SHOW_EVENT_TIMES eq "ALL" ||

$_SHOW_EVENT_TIMES eq "START") { %>
                              <% if ($EVENT->{'schedule'}->{'start_time'})

{ %><%= SCHEDULE FIELD(start_time) %><% } %>
                           <% } %>
                           <% if ($_SHOW_EVENT_TIMES eq "ALL") { %>
                              <% if ($EVENT->{'schedule'}->{'end_time'}) {

%>-<%= SCHEDULE FIELD(end_time) %><% } %>
                           <% } %>
                           <% if (($_SHOW_EVENT_TIMES eq "ALL" ||

$_SHOW_EVENT_TIMES eq "START") && ($EVENT->{'schedule'}->{'start_time'})) { %> : <% } %>
<!-- show link to event only if delete permission -->
<%if ($User->hasPermission($CALENDAR_KEY,"DELETE_EVENT")) { %>
                           <A

HREF="<%=$CGI_URL_QUERYSTRING%>view=Event&amp;event_id=<%= EVENT FIELD(id) %>&amp;datestring=<%=$DAY->{datestring}%>"

CLASS="gridtext"><%= EVENT FIELD(title) %></A><BR>
<%} else {%><%= EVENT FIELD(title) %><BR>
<%}%>
<% $flag = $EVENT->{'details'}->{'status'}; %>
                           </FONT>
                           </SPAN>
                        <%/FOREACH%>
<!-- Grid Add Event Plug-in -->
<% unless ($flag eq 'closed') { %>
<%if ($User->hasPermission($CALENDAR_KEY,"ADD_EVENT")) { %>
<font size="-2"><b><a

href="<%=$ADMIN_CGI_URL%>?calendar=<%=$CALENDAR_KEY%>&username=<%=$User->{username}%>&template=grid_add_non_recurring. html&ad

d_date=<%= $DAY->{datestring} %>"  title="Click to sign up on this date" class="gridtext">Sign Up</a></b></font><BR>
<%}%>
<%}%>                        <% if ($i==0) { %><BR>&nbsp;<BR>&nbsp;<% } %>
                     <%/IF%>
   
Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 235

Please don't PM me. Post in the open forum.


WWW
« Reply #3 on: November 05, 2008, 02:36:02 AM »

Glad to hear it. Thanks for posting the code, maybe it will help others too.

BTW. You probably could have eliminated the need to add the unless... statement and the closing } bracket by just changing this line:

<%if ($User->hasPermission($CALENDAR_KEY,"ADD_EVENT")) { %>

to

<%if ($User->hasPermission($CALENDAR_KEY,"ADD_EVENT") && $flag ne 'closed' ) { %>

JFYI

Dan O.
« Last Edit: November 05, 2008, 02:40:27 AM by DanO » Logged
Pages: [1]   Go Up
Print
Jump to: