"; } else { echo "
No photo
"; } ?>
Status:
Status message:
Appointed date/time:
Posted By: '.$sPostedBy.'' ?>
Place:
Description:
= $navigationStep ) { $prevFrom = (0 < ($fromEvent - $navigationStep)) ? ($fromEvent - $navigationStep) : 0; $ret .= "Prev "; } // show page links $currentEvent = 0; $currentPage = 1; while ( $currentEvent < $totalEvents ) { if ( $currentEvent == $fromEvent ) $ret .= "[{$currentPage}] "; else $ret .= "{$currentPage} "; $currentEvent += $navigationStep; $currentPage++; } // if it's not last page then show 'Next' link if ( $totalEvents > $fromEvent + $navigationStep ) { $nextFrom = $fromEvent + $navigationStep; $ret .= "Next"; } // put navigation elements into the div $divMargin = $topNavigation ? 'margin-bottom: 4px;' : 'margin-top: 4px;'; return "
{$ret}
"; } /** * Prints edit form for event editing * * @param bool $newEvent - if event already exists - then edit, create new otherwise * @param array $eventArr - if event exists then this parameter should contain all event data * * */ function SDShowEditForm( $newEvent, $eventArr = array() ) { global $aPreValues; global $dir; global $site; if ( $newEvent ) { $eventTitle = ''; $eventDesc = ''; $eventStatusActiveSel = ''; $eventStatusInactiveSel = ''; $eventStatusCanceledSel = ''; $eventStatusMsg = ''; $eventCity = ''; $eventPlace = ''; $eventStart = ''; $eventEnd = ''; $eventSaleStart = ''; $eventSaleEnd = ''; $eventRespName = ''; $eventRespEmail = ''; $eventRespPhone = ''; $eventSexFemale = 'checked="checked"'; $eventSexMale = 'checked="checked"'; $eventCountFemale = ''; $eventCountMale = ''; $eventPriceFemale = ''; $eventPriceMale = ''; $eventPriceFree = ''; $eventPriceFemaleDisabled = ''; $eventPriceMaleDisabled = ''; $eventChoosePeriod = ''; $eventAllowView = ''; } else { $eventTitle = htmlspecialchars($eventArr['Title']); $eventDesc = htmlspecialchars($eventArr['Description']); $eventStatusActiveSel = ''; $eventStatusInactiveSel = ''; $eventStatusCanceledSel = ''; switch ( $eventArr['Status'] ) { case 'Active': $eventStatusActiveSel = 'selected="selected"'; break; case 'Inactive': $eventStatusInactiveSel = 'selected="selected"'; break; case 'Canceled': $eventStatusCanceledSel = 'selected="selected"'; break; } $eventStatusMsg = htmlspecialchars($eventArr['StatusMessage']); $eventCity = htmlspecialchars($eventArr['City']); $eventPlace = htmlspecialchars($eventArr['Place']); $eventStart = $eventArr['EventStart']; $eventEnd = $eventArr['EventEnd']; $eventSaleStart = $eventArr['TicketSaleStart']; $eventSaleEnd = $eventArr['TicketSaleEnd']; $eventRespName = htmlspecialchars($eventArr['ResponsibleName']); $eventRespEmail = htmlspecialchars($eventArr['ResponsibleEmail']); $eventRespPhone = htmlspecialchars($eventArr['ResponsiblePhone']); $eventSexFemale = strstr($eventArr['EventSexFilter'], 'female') ? 'checked="checked"' : ''; $eventSexMale = strstr($eventArr['EventSexFilter'], 'male') ? 'checked="checked"' : ''; $eventCountFemale = $eventArr['TicketCountFemale']; $eventCountMale = $eventArr['TicketCountMale']; $eventPriceFemale = sprintf("%.2f", (float)$eventArr['TicketPriceFemale']); $eventPriceMale = sprintf("%.2f", (float)$eventArr['TicketPriceMale']); $eventPriceFree = ( $eventPriceFemale == '0.00' && $eventPriceMale == '0.00' ? 'checked="checked"' : '' ); $eventPriceFemaleDisabled = ( strlen($eventPriceFree) ? 'disabled="disabled"' : '' ); $eventPriceMaleDisabled = ( strlen($eventPriceFree) ? 'disabled="disabled"' : '' ); $eventChoosePeriod = $eventArr['ChoosePeriod']; $eventAllowView = $eventArr['AllowViewParticipants'] == 1 ? 'checked="checked"' : ''; } ?>
Common
Title *
Description *
Status
Status message *
Event place
Country *
City *
Place *
Venue photo Event photo
upload new photo
Venue photo
resize photo to  x  pixels
Event date
Event start *    
Event end *    
Ticket sale start *    
Ticket sale end *    
Responsible person or company
Name
E-mail
Phone
Event participants
Sex />     />  
Age from  to 
Membership
Female ticket count *
Male ticket count *
Ticket prices
Event is free />
Female ticket price * />
Male ticket price * />
Member side options
Choose period *
(in days)
Allow members to view participants list />
   
= `EventStart` ) ORDER BY `EventStart` DESC LIMIT {$show_from}, {$navigationStep}"; $total_query = "SELECT COUNT(*) FROM `SDatingEvents` WHERE ( FROM_UNIXTIME($between_date1) <= `EventStart` AND FROM_UNIXTIME($between_date2) >= `EventStart` )"; } else { $show['error_text'] = "Please specify correct dates"; } $between_disabled = ''; break; // show events in specified country case 'country': $show_query = "SELECT `ID`, `Title`, `Description`, `Status`, `StatusMessage`, `Country`, `City`, `Place`, `PhotoFilename`, `EventStart`, `ResponsibleID` FROM `SDatingEvents` WHERE `Country` = '". process_db_input($_REQUEST['show_events_country']) ."' ORDER BY `EventStart` DESC LIMIT {$show_from}, {$navigationStep}"; $total_query = "SELECT COUNT(*) FROM `SDatingEvents` WHERE `Country` = '". process_db_input($_REQUEST['show_events_country']) ."'"; $show['country'] = process_pass_data($_REQUEST['show_events_country']); $country_disabled = ''; break; // show all events case 'all': default: $show_query = "SELECT `ID`, `Title`, `Description`, `Status`, `StatusMessage`, `Country`, `City`, `Place`, `PhotoFilename`, `EventStart`, `ResponsibleID` FROM `SDatingEvents` ORDER BY `EventStart` DESC LIMIT {$show_from}, {$navigationStep}"; $total_query = "SELECT COUNT(*) FROM `SDatingEvents`"; } break; // update existing event or add new one case 'edit': $event_id = (int)$_REQUEST['event_id']; if ( $event_id ) { if ( $_POST['event_as_new'] == 'on' ) $edit_res = SDAddEvent(); else $edit_res = SDUpdateEvent( $event_id ); switch ( $edit_res ) { case SDATING_ERROR_SUCCESS: if ( $_POST['event_as_new'] == 'on' ) $show['error_text'] = 'Event was successfully added'; else $show['error_text'] = 'Event was successfully updated'; break; case SDATING_ERROR_QUERY_ERROR: if ( $_POST['event_as_new'] == 'on' ) $show['error_text'] = 'Insert query error'; else $show['error_text'] = 'Update query error'; break; case SDATING_ERROR_NOT_AFFECTED: if ( $_POST['event_as_new'] == 'on' ) $show['error_text'] = 'Event wasn\'t added'; else $show['error_text'] = 'Event wasn\'t updated'; break; case SDATING_ERROR_WRONG_DATE_FORMAT: $show['error_text'] = 'Wrong date format or wrong date order'; break; case SDATING_ERROR_PHOTO_PROCESS: $show['error_text'] = 'Error during photo resizing'; break; } } break; // delete event case 'delete': $event_id = (int)$_REQUEST['event_id']; if ( $event_id ) { $delete_res = SDDeleteEvent( $event_id ); if ( $delete_res ) $show['error_text'] = 'Event was successfully deleted'; else $show['error_text'] = 'Delete query error'; } break; // add new event case 'new': $add_res = SDAddEvent(); switch ( $add_res ) { case SDATING_ERROR_SUCCESS: $show['error_text'] = 'Event was successfully added'; break; case SDATING_ERROR_QUERY_ERROR: $show['error_text'] = 'Insert query error'; break; case SDATING_ERROR_NOT_AFFECTED: $show['error_text'] = 'Event wasn\'t added'; break; case SDATING_ERROR_WRONG_DATE_FORMAT: $show['error_text'] = 'Wrong date format or wrong date order'; break; case SDATING_ERROR_PHOTO_PROCESS: $show['error_text'] = 'Error during photo resizing'; break; } break; // show participants of specified event case 'show_part': $event_id = (int)$_REQUEST['event_id']; if ( $event_id ) { // delete members from event if ( $_POST['participant_cancel'] == 'Remove from event' ) { $delete_participants = ''; foreach ( $_POST as $key => $value ) { if ( (int)$key && $value == 'on' ) { $delete_participants .= strlen($delete_participants) ? ','. (int)$key : (int)$key; } } if ( strlen($delete_participants) ) { db_res( "DELETE FROM `SDatingParticipants` WHERE `ID` IN ($delete_participants)" ); db_res( "DELETE FROM `SDatingMatches` WHERE `IDChooser` IN ($delete_participants) OR `IDChosen` IN ($delete_participants)" ); } } // send email to members if ( $_POST['send_message'] == 'Send message' ) { $subject = getParam( 't_SDatingAdminEmail_subject' ); $text = getParam( 't_SDatingAdminEmail' ); $failed_count = 0; foreach ( $_POST as $key => $value ) { if ( (int)$key && $value == 'on' ) { $part_arr = db_arr( "SELECT `Profiles`.`ID`, `Profiles`.`NickName`, `Profiles`.`Email`, `SDatingParticipants`.`ParticipantUID`, `SDatingEvents`.`Title`, `SDatingEvents`.`Place`, `SDatingEvents`.`EventStart` FROM `SDatingParticipants` LEFT JOIN `Profiles` ON `SDatingParticipants`.`IDMember` = `Profiles`.`ID` LEFT JOIN `SDatingEvents` ON `SDatingEvents`.`ID` = `SDatingParticipants`.`IDEvent` WHERE `SDatingParticipants`.`ID` = ". (int)$key ); $aPlus = array(); $aPlus['NameSDating'] = $part_arr['Title']; $aPlus['PlaceSDating'] = $part_arr['Place']; $aPlus['WhenStarSDating'] = $part_arr['EventStart']; $aPlus['PersonalUID'] = $part_arr['ParticipantUID']; $aPlus['LinkSDatingEvent'] = $site['url'] . 'events.php?action=show_info&event_id=' . $event_id; $aPlus['MessageText'] = process_pass_data($_POST['message']); $mail_res = sendMail( $part_arr['Email'], $subject, $text, $part_arr['ID'], $aPlus ); if ( !$mail_res ) $failed_count++; } } if ( $failed_count > 0 ) $show_part['error_text'] = "Failed to send {$failed_count} messages"; else $show_part['error_text'] = 'All messages were successfully sent'; } // list of participants $part_page = isset($_REQUEST['part_page']) ? (int)$_REQUEST['part_page'] : 1; $part_p_per_page = isset($_REQUEST['part_p_per_page']) ? (int)$_REQUEST['part_p_per_page'] : 30; $limit_first = (int)($part_page - 1) * $part_p_per_page; $part_sortby = isset($_REQUEST['sortby']) ? process_db_input($_REQUEST['sortby']) : 'Profiles.ID'; $part_sortorder = isset($_REQUEST['sortorder']) && $_REQUEST['sortorder'] == 'DESC' ? 'DESC' : 'ASC'; $search_filter = ''; // add search filter if needed if ( $_REQUEST['search_email'] ) $search_filter = 'AND `Profiles`.`Email` LIKE \'%'. process_db_input($_REQUEST['search_filter']) .'%\''; elseif ( $_REQUEST['search_nick'] ) $search_filter = 'AND `Profiles`.`NickName` LIKE \'%'. process_db_input($_REQUEST['search_filter']) .'%\''; elseif ( $_REQUEST['search_id'] ) $search_filter = 'AND `Profiles`.`ID` = '. (int)$_REQUEST['search_filter']; $part_profiles_res = db_res( "SELECT `Profiles`.*, `SDatingParticipants`.`ID` AS `PartID`, `SDatingParticipants`.`ParticipantUID` AS `UID` FROM `SDatingParticipants` LEFT JOIN `Profiles` ON `SDatingParticipants`.`IDMember` = `Profiles`.`ID` WHERE `SDatingParticipants`.`IDEvent` = $event_id $search_filter ORDER BY $part_sortby $part_sortorder LIMIT $limit_first, $part_p_per_page" ); $total_arr = db_arr( "SELECT COUNT(*) FROM `SDatingParticipants` LEFT JOIN `Profiles` ON `SDatingParticipants`.`IDMember` = `Profiles`.`ID` WHERE `SDatingParticipants`.`IDEvent` = $event_id $search_filter" ); $part_profiles_total = (int)$total_arr[0]; $pages_num = ceil( $part_profiles_total / $part_p_per_page ); $part_get_url = "{$_SERVER['PHP_SELF']}?action=show_part&event_id={$event_id}". (isset($_REQUEST['part_p_per_page']) ? '&part_p_per_page='. (int)$_REQUEST['part_p_per_page'] : ''); $part_per_page_array = array(10, 15, 20, 30, 50, 100); $part_query = "SELECT `ID`, `Title`, `Description`, `Status`, `StatusMessage`, `Country`, `City`, `Place`, `PhotoFilename`, `EventStart`, `EventEnd`, `TicketSaleStart`, `TicketSaleEnd`, `ResponsibleName`, `ResponsibleEmail`, `ResponsiblePhone`, `EventSexFilter`, `EventAgeLowerFilter`, `EventAgeUpperFilter`, `EventMembershipFilter`, `TicketCountFemale`, `TicketCountMale`, `TicketPriceFemale`, `TicketPriceMale`, `ChoosePeriod`, `AllowViewParticipants` FROM `SDatingEvents` WHERE `ID` = $event_id"; } break; // show matches of specified event case 'show_match': $event_id = (int)$_REQUEST['event_id']; if ( $event_id ) { // delete member from chosen list if ( $_POST['choose_cancel'] == 'Remove from choose list' ) { $delete_chosen = ''; $delete_chooser = (int)$_POST['part_id']; foreach ( $_POST as $key => $value ) { if ( (int)$key && $value == 'on' ) { $delete_chosen .= strlen($delete_chosen) ? ','. (int)$key : (int)$key; } } if ( strlen($delete_chosen) ) { db_res( "DELETE FROM `SDatingMatches` WHERE `IDChooser` = $delete_chooser AND `IDChosen` IN ($delete_chosen)" ); } } // send matchmaking emails if ( $_POST['send_match_emails'] == 'on' ) { $match_email_res = db_res( "SELECT `ParticipantTable1`.`IDMember` AS `ChooserMemberID`, `ParticipantTable2`.`IDMember` AS `ChosenMemberID`, `SDatingEvents`.`ID` AS `EventID`, `SDatingEvents`.`Title`, `SDatingEvents`.`Place`, `SDatingEvents`.`EventStart` FROM `SDatingMatches` AS `MatchTable1` LEFT JOIN `SDatingMatches` AS `MatchTable2` ON `MatchTable2`.`IDChooser` = `MatchTable1`.`IDChosen` AND `MatchTable2`.`IDChosen` = `MatchTable1`.`IDChooser` LEFT JOIN `SDatingParticipants` AS `ParticipantTable1` ON `ParticipantTable1`.`ID` = `MatchTable1`.`IDChooser` LEFT JOIN `SDatingParticipants` AS `ParticipantTable2` ON `ParticipantTable2`.`ID` = `MatchTable1`.`IDChosen` LEFT JOIN `SDatingEvents` ON `SDatingEvents`.`ID` = `ParticipantTable1`.`IDEvent` WHERE `ParticipantTable1`.`IDEvent` = $event_id AND `ParticipantTable2`.`IDEvent` = $event_id AND `MatchTable2`.`IDChooser` IS NOT NULL" ); $subject = getParam( 't_SDatingMatch_subject' ); $text = getParam( 't_SDatingMatch' ); $failed_count = 0; while ( $match_email_arr = mysql_fetch_assoc($match_email_res) ) { $chooser_arr = getProfileInfo( $match_email_arr['ChooserMemberID'] ); $aPlus = array(); $aPlus['NameSDating'] = $match_email_arr['Title']; $aPlus['PlaceSDating'] = $match_email_arr['Place']; $aPlus['WhenStarSDating'] = $match_email_arr['EventStart']; $aPlus['MatchLink'] = $site['url'] . 'profile.php?ID=' . $match_email_arr['ChosenMemberID']; $aPlus['LinkSDatingEvent'] = $site['url'] . 'events.php?action=show_info&event_id=' . $match_email_arr['EventID']; $mail_res = sendMail( $chooser_arr['Email'], $subject, $text, $chooser_arr['ID'], $aPlus ); if ( !$mail_res ) $failed_count++; } if ( $failed_count > 0 ) $show_match['error_text'] = "Failed to send {$failed_count} notifications"; else $show_match['error_text'] = 'All notifications were successfully sent'; } $match_page = isset($_REQUEST['match_page']) ? (int)$_REQUEST['match_page'] : 1; $match_p_per_page = isset($_REQUEST['match_p_per_page']) ? (int)$_REQUEST['match_p_per_page'] : 30; $limit_first = (int)($match_page - 1) * $match_p_per_page; $match_profiles_res = db_res( "SELECT `Profiles`.*, `SDatingParticipants`.`ID` AS `PartID`, `SDatingParticipants`.`ParticipantUID` AS `UID` FROM `SDatingParticipants` LEFT JOIN `Profiles` ON `SDatingParticipants`.`IDMember` = `Profiles`.`ID` WHERE `SDatingParticipants`.`IDEvent` = $event_id ORDER BY `SDatingParticipants`.`ParticipantUID` ASC LIMIT $limit_first, $match_p_per_page" ); $total_arr = db_arr( "SELECT COUNT(*) FROM `SDatingParticipants` WHERE `SDatingParticipants`.`IDEvent` = $event_id" ); $match_count_arr = db_arr( "SELECT COUNT(*) / 2 FROM `SDatingMatches` AS `MatchTable1` LEFT JOIN `SDatingMatches` AS `MatchTable2` ON `MatchTable2`.`IDChooser` = `MatchTable1`.`IDChosen` AND `MatchTable2`.`IDChosen` = `MatchTable1`.`IDChooser` LEFT JOIN `SDatingParticipants` ON `SDatingParticipants`.`ID` = `MatchTable1`.`IDChosen` WHERE `SDatingParticipants`.`IDEvent` = $event_id AND `MatchTable2`.`IDChooser` IS NOT NULL" ); $match_profiles_total = (int)$total_arr[0]; $match_count_total = (int)$match_count_arr[0]; $pages_num = ceil( $match_profiles_total / $match_p_per_page ); $match_get_url = "{$_SERVER['PHP_SELF']}?action=show_match&event_id={$event_id}". (isset($_REQUEST['match_p_per_page']) ? '&match_p_per_page='. (int)$_REQUEST['match_p_per_page'] : ''); $match_per_page_array = array(10, 15, 20, 30, 50, 100); } break; } // if action is 'show' then select events from the database if ( strlen($show_query) ) { $show_result = db_res( $show_query ); $show_num = mysql_num_rows( $show_result ); $total_num_arr = db_arr( $total_query ); $total_num = (int)$total_num_arr[0]; } TopCodeAdmin(); ContentBlockHead("Manage events"); if ( strlen($show['error_text']) ) echo "
{$show['error_text']}
"; ?>
">Add new event
Select events to show
/>  
/>   />   />   />
and />   />   />
/>  

Event participants
{$show_part['error_text']}

"; ?>

Results: - | Total:  | Results per page: 
Pages:  {$i} "; } ?>

No participants for this event
  ID Nickname Sex E-Mail UID
Check all / Uncheck all With selected:
"; if ( isset($_REQUEST['part_p_per_page']) ) echo " "; ?>
Results: - | Total:  | Results per page: 
Pages:  {$i} "; } ?>
Event matches
{$show_match['error_text']}

"; ?>
Total matches:

"; if ( isset($_REQUEST['match_p_per_page']) ) echo " "; ?>

Results: - | Total:  | Results per page: 
Pages:  {$i} "; } ?>

(Nickname: ) 0 ) { ?> Show chosen members

Results: - | Total:  | Results per page: 
Pages:  {$i} "; } ?>
Edit Event