Example #1
0
 public function getTotalMatchesStats()
 {
     global $database;
     $months = getAllMonths(strtotime(date('Y', time()) . '- 5 years'));
     $matches = [];
     $count = 1;
     foreach ($months as $month => $timestamp) {
         if ($count < sizeof($months)) {
             $matches[$timestamp] = $database->getTotalNumberOfMatchesInInterval(array_values($months)[$count - 1], array_values($months)[$count]);
         }
         $count++;
     }
     return ['Matches' => $matches];
 }
Example #2
0
 public function getOverallStats()
 {
     $months = getAllMonths($this->db->getMatchDateBorderReferee($this->getId(), true), $this->db->getMatchDateBorderReferee($this->getId(), false));
     $matches = [];
     $cardsDealt = [];
     $count = 1;
     echo "Size: ", sizeof($months);
     foreach ($months as $month => $timestamp) {
         if ($count < sizeof($months)) {
             $matches[$timestamp] = $this->db->getTotalNumberOfMatchesRefereedInterval($this->getId(), array_values($months)[$count - 1], array_values($months)[$count]);
             $cardsDealt[$timestamp] = $this->db->getTotalCardsGivenInterval($this->getId(), array_values($months)[$count - 1], array_values($months)[$count]);
         }
         $count++;
     }
     return ['Matches' => $matches, 'Cards given' => $cardsDealt];
 }
Example #3
0
 public function getOverallStats()
 {
     $months = getAllMonths($this->db->getMatchDateBorderTeam($this->getId(), true), $this->db->getMatchDateBorderTeam($this->getId(), false));
     $matches = [];
     $matches_won = [];
     $count = 1;
     foreach ($months as $month => $timestamp) {
         if ($count < sizeof($months)) {
             $matches[$timestamp] = $this->db->getTotalNumberOfTeamMatchesInterval($this->getId(), array_values($months)[$count - 1], array_values($months)[$count]);
             $matches_won[$timestamp] = $this->db->getTotalMatchesWonByTeamInterval($this->getId(), array_values($months)[$count - 1], array_values($months)[$count]);
             //var_dump(array_slice($months, $count-1, 1));
             //echo '<br>';
         }
         $count++;
     }
     return ['Matches' => $matches, 'Matches won' => $matches_won];
 }
Example #4
0
function getCalender($year = '', $month = '')
{
    $dateYear = $year != '' ? $year : date("Y");
    $dateMonth = $month != '' ? $month : date("m");
    $date = $dateYear . '-' . $dateMonth . '-01';
    $currentMonthFirstDay = date("N", strtotime($date));
    $totalDaysOfMonth = cal_days_in_month(CAL_GREGORIAN, $dateMonth, $dateYear);
    $totalDaysOfMonthDisplay = $currentMonthFirstDay == 7 ? $totalDaysOfMonth : $totalDaysOfMonth + $currentMonthFirstDay;
    $boxDisplay = $totalDaysOfMonthDisplay <= 35 ? 35 : 42;
    ?>
	<div id="calender_section">
		<h2>
        	<a href="javascript:void(0);" onclick="getCalendar('calendar_div','<?php 
    echo date("Y", strtotime($date . ' - 1 Month'));
    ?>
','<?php 
    echo date("m", strtotime($date . ' - 1 Month'));
    ?>
');">&lt;&lt;</a>
            <select name="month_dropdown" class="month_dropdown dropdown"><?php 
    echo getAllMonths($dateMonth);
    ?>
</select>
			<select name="year_dropdown" class="year_dropdown dropdown"><?php 
    echo getYearList($dateYear);
    ?>
</select>
            <a href="javascript:void(0);" onclick="getCalendar('calendar_div','<?php 
    echo date("Y", strtotime($date . ' + 1 Month'));
    ?>
','<?php 
    echo date("m", strtotime($date . ' + 1 Month'));
    ?>
');">&gt;&gt;</a>
        </h2>
		<div id="event_list" class="none"></div>
		<div id="calender_section_top">
			<ul>
				<li>Minggu</li>
				<li>Senin</li>
				<li>Selasa</li>
				<li>Rabu</li>
				<li>Kamis</li>
				<li>Jumat</li>
				<li>Sabtu</li>
			</ul>
		</div>
		<div id="calender_section_bot">
			<ul>
			<?php 
    $dayCount = 1;
    for ($cb = 1; $cb <= $boxDisplay; $cb++) {
        if (($cb >= $currentMonthFirstDay + 1 || $currentMonthFirstDay == 7) && $cb <= $totalDaysOfMonthDisplay) {
            //Current date
            $currentDate = $dateYear . '-' . $dateMonth . '-' . $dayCount;
            $eventNum = 0;
            //Include db configuration file
            include 'dbConfigCalendar.php';
            //Get number of events based on the current date
            $result = $db->query("SELECT title FROM events WHERE date = '" . $currentDate . "' AND status = 1");
            $eventNum = $result->num_rows;
            //Define date cell color
            if (strtotime($currentDate) == strtotime(date("Y-m-d"))) {
                echo '<li date="' . $currentDate . '" class="yellow date_cell">';
            } elseif ($eventNum > 0) {
                echo '<li date="' . $currentDate . '" class="yellow date_cell">';
            } else {
                echo '<li date="' . $currentDate . '" class="date_cell">';
            }
            //Date cell
            echo '<span>';
            echo $dayCount;
            echo '</span>';
            //Hover event popup
            echo '<div id="date_popup_' . $currentDate . '" class="date_popup_wrap none">';
            echo '<div class="date_window">';
            echo '<div class="popup_event">Events (' . $eventNum . ')</div>';
            echo $eventNum > 0 ? '<a href="javascript:;" onclick="getEvents(\'' . $currentDate . '\');">Lihat events</a>' : '';
            echo '</div></div>';
            echo '</li>';
            $dayCount++;
            ?>
			<?php 
        } else {
            ?>
				<li><span>&nbsp;</span></li>
			<?php 
        }
    }
    ?>
			</ul>
		</div>
	</div>

	<script type="text/javascript">
		function getCalendar(target_div,year,month){
			$.ajax({
				type:'POST',
				url:'functions.php',
				data:'func=getCalender&year='+year+'&month='+month,
				success:function(html){
					$('#'+target_div).html(html);
				}
			});
		}
		
		function getEvents(date){
			$.ajax({
				type:'POST',
				url:'functions.php',
				data:'func=getEvents&date='+date,
				success:function(html){
					$('#event_list').html(html);
					$('#event_list').slideDown('slow');
				}
			});
		}
		
		function addEvent(date){
			$.ajax({
				type:'POST',
				url:'functions.php',
				data:'func=addEvent&date='+date,
				success:function(html){
					$('#event_list').html(html);
					$('#event_list').slideDown('slow');
				}
			});
		}
		
		$(document).ready(function(){
			$('.date_cell').mouseenter(function(){
				date = $(this).attr('date');
				$(".date_popup_wrap").fadeOut();
				$("#date_popup_"+date).fadeIn();	
			});
			$('.date_cell').mouseleave(function(){
				$(".date_popup_wrap").fadeOut();		
			});
			$('.month_dropdown').on('change',function(){
				getCalendar('calendar_div',$('.year_dropdown').val(),$('.month_dropdown').val());
			});
			$('.year_dropdown').on('change',function(){
				getCalendar('calendar_div',$('.year_dropdown').val(),$('.month_dropdown').val());
			});
			$(document).click(function(){
				$('#event_list').slideUp('slow');
			});
		});
	</script>
<?php 
}
Example #5
0
              <div class="form-section">
                <h1>Project 4</h1> <a href="logout.php">Logout</a>
              </div>
              
              <div class="form-section">
                    <label class="sr-only" for="recipient">Recipient: </label><br>
                    <input type="email" name="recipient" class="form-control" id="recipient" size="35" placeholder="Email">
                  </div>

              <div class="form-section">

                <label>Choose the time to send the email</label><br>
                
                
                   <?php 
    $m = getAllMonths();
    ?>
                
                <select name="month">
                  <?php 
    for ($i = 0; $i < count($m); $i++) {
        ?>
                  
                    <option value="<?php 
        echo $m[$i];
        ?>
" <?php 
        if ($m[$i] == date("F")) {
            echo "selected";
        }
        ?>
?>
	<div id="add_event_link"> 
		<a href="app/addEvent.php">Add event</a>
	</div>
	<div class="calendar_section">
		<div class="section_header">
        	<a href="javascript:void(0);" onclick="getCalendar('calendar_div','<?php 
echo date("Y", strtotime($date . ' - 1 Month'));
?>
','<?php 
echo date("m", strtotime($date . ' - 1 Month'));
?>
');">&lt;&lt;</a>
            <select name="month_dropdown" class="month_dropdown dropdown">
            	<?php 
echo getAllMonths($dateMonth);
?>
            </select>
			<select name="year_dropdown" class="year_dropdown dropdown">
				<?php 
echo getYearList($dateYear);
?>
			</select>
            <a href="javascript:void(0);" onclick="getCalendar('calendar_div','<?php 
echo date("Y", strtotime($date . ' + 1 Month'));
?>
','<?php 
echo date("m", strtotime($date . ' + 1 Month'));
?>
');">&gt;&gt;</a>
        </div>