// Query the database to get EVENTS which have atleast one upcoming // SHOWING and order them by TotalSold tickets and ShowingStartDate // Change trending_Showing.RushStatus = 0 to trending_Showing.Available > 0 by Leon 2014/09/23 $query = "SELECT * FROM trending_Event, trending_Showing\n\t\t\t\t\tWHERE trending_Event.EventID = trending_Showing.EventID\n\t\t\t\t\tAND trending_Event.trendingStatus = 1\n\t\t\t\t\tAND trending_Showing.Available > 0\n\t\t\t\t\tORDER BY trending_Event.TotalSold DESC, trending_Showing.ShowingStartDate"; $result = mysql_query($query, $con); $phpResponseTrending = array(); // this variable updates the latest EVENT Name $temp = ""; // this variable keeps a count on the number of EVENTS stored in array // we need to limit this count to 5 $count = 0; while ($count < 5 && ($row = mysql_fetch_assoc($result))) { $Name = $row['Name']; // convert $ShowingDateTime to array by Leon 2014/09/23 $ShowingStartDate = $row['ShowingStartDate']; $showingDateTime = dateTimeToArray($ShowingStartDate, 1); // If the EVENT is not already stored, save the required details // Event's $showingDateTime don't pass current Date. by Leon 2014/09/23 if (isLess($currDateTime, $showingDateTime) == -1 && $temp != $Name) { $count++; $temp = $Name; $TabletLink = $row['TabletLink']; $TotalSold = $row['TotalSold']; $ShowingVenueName = $row['ShowingVenueName']; $phpResponseTrending[] = array("Name" => $Name, "TabletLink" => $TabletLink, "TotalSold" => $TotalSold, "StartDate" => $ShowingStartDate, "VenueName" => $ShowingVenueName); } } // Print the data along with the generation of XMLFiles file, if needed echo "<pre>"; print_r($phpResponseTrending); echo "</pre>";
<?php // --------------------------------------------------------------------- // // This script will send e-mail to required people with log file // as attachment, once everyday. // --------------------------------------------------------------------- // // Set the time-zone so the system takes in the correct current date and time date_default_timezone_set('America/Los_Angeles'); $dateTime = date('Y-m-d H:i:s'); $currDateTime = dateTimeToArray($dateTime, 0); // Set various email fields: to, from, subject, and so on $filename = "logFiles/logFile" . $currDateTime[0] . $currDateTime[1] . $currDateTime[2] . ".txt"; $to = "*****@*****.**"; $from = "*****@*****.**"; $from_name = "Sharvari Kapadia"; $replyto = "*****@*****.**"; $subject = "Trending Films Log File for " . $currDateTime[1] . "/" . $currDateTime[2]; $message = "Please find the Trending films Log File for " . $currDateTime[1] . "/" . $currDateTime[2] . "." . "If you have any questions, please speak with Matt or Lou."; // Updated contacts list $to = "*****@*****.**"; $from = "*****@*****.**"; $from_name = "CQuest at Bravo"; $replyto = "*****@*****.**"; mail_attachment($filename, $to, $from, $from_name, $replyto, $subject, $message); // --------------------------------------------------------------------- // // Function definition for mail_attachment() // --------------------------------------------------------------------- // function mail_attachment($filename, $to, $from, $from_name, $replyto, $subject, $message) { $file = $filename; $file_size = filesize($file);
</div> <!-- header End --> <?php // Load XMLFiles in PHP variables $xml = simplexml_load_file("XMLFiles/Trending_Top5Events.xml"); // Start a new list to print the EVENTS echo "<ul>"; foreach ($xml->Show as $show) { // Save the SELECTED attributes for each EVENT, in PHP variables $Name = $show->Name; $TabletLink = $show->TabletLink; $StartDate = $show->StartDate; $VenueName = $show->VenueName; // Separate date and time $dateTime = dateTimeToArray($StartDate, 1); // Convert the date and time in MM/DD HH:MM (12-hour) format $month = $dateTime[1]; $day = $dateTime[2]; $hour = $dateTime[3]; if ($hour < 12) { $ampm = "AM"; } else { if ($hour > 12) { $ampm = "PM"; $hour = $hour - 12; } else { if ($hour == 12) { $ampm = "PM"; } }