Esempio n. 1
0
function table_cal($y, $m)
{
    list($ny, $nm, $nd) = explode(',', date('Y,m,d'));
    ?>
<table>
    <caption><?php 
    echo "{$y}年 {$m}月";
    ?>
</caption>
    <thead>
        <th>日</th><th>月</th><th>火</th><th>水</th><th>木</th><th>金</th><th>土</th>
    </thead>
    <tbody>
<?php 
    foreach (get_days($y, $m) as $days) {
        ?>
        <tr>
<?php 
        foreach ($days as $d) {
            $checked = $ny < $y || $ny == $y && $nm < $m || $ny == $y && $nm == $m && $nd <= $d ? 'checked' : '';
            ?>
            <td>
<?php 
            if (!empty($d)) {
                ?>
                <?php 
                echo $d;
                ?>
                <div class="switch tiny day">
                    <input id="d<?php 
                echo $d;
                ?>
" type="checkbox" value="<?php 
                echo $d;
                ?>
" name="day[]" <?php 
                echo $checked;
                ?>
>
                    <label for="d<?php 
                echo $d;
                ?>
"></label>
                </div> 
<?php 
            }
            ?>
            </td>
<?php 
        }
        ?>
        </tr>
<?php 
    }
    ?>
    <tbody>
</table>
<?php 
}
Esempio n. 2
0
 function _get_common_report_data()
 {
     $data = array();
     $data['report_date_range_simple'] = get_simple_date_ranges();
     $data['months'] = get_months();
     $data['days'] = get_days();
     $data['years'] = get_years();
     $data['selected_month'] = date('n');
     $data['selected_day'] = date('d');
     $data['selected_year'] = date('Y');
     return $data;
 }
Esempio n. 3
0
 function _get_common_report_data($time = false)
 {
     $data = array();
     $data['report_date_range_simple'] = get_simple_date_ranges($time);
     $data['months'] = get_months();
     $data['days'] = get_days();
     $data['years'] = get_years();
     $data['hours'] = get_hours($this->config->item('time_format'));
     $data['minutes'] = get_minutes();
     $data['selected_month'] = date('m');
     $data['selected_day'] = date('d');
     $data['selected_year'] = date('Y');
     return $data;
 }
Esempio n. 4
0
     $docs = explode(',', $_POST['DOCS']);
     foreach ($docs as $doc) {
         $doc = mysql_real_escape_string($doc);
         $query = "UPDATE `employee_docs` " . "SET `scanned` = 1,`status` = 1, `date_scanned` = CURRENT_DATE " . "WHERE `document` = 8850 AND `uniq_id` = {$doc} AND `scanned` = 0 AND `status` = 0";
         $result = mysql_query($query);
         if (mysql_affected_rows() > 0) {
             $_SESSION['verified'][$doc] = get_days($doc);
         } else {
             $check_id = mysql_query("SELECT `doh` FROM `employee_info` WHERE `unique_id` = {$doc}");
             if (mysql_num_rows($check_id) == 1) {
                 while ($hiredate = mysql_fetch_assoc($check_id)) {
                     $doh = $hiredate['doh'];
                 }
                 $doinsert = "INSERT INTO `employee_docs` (uniq_id,document,scanned,status,date_set,date_scanned) VALUES ({$doc},8850,1,1,'{$doh}',CURRENT_DATE)";
                 mysql_query($doinsert);
                 $_SESSION['verified'][$doc] = get_days($doc);
             }
         }
         unset($result, $doc, $query);
     }
     foreach ($_SESSION['verified'] as $key => $val) {
         echo "<TR><TD ALIGN=\"CENTER\">{$key}</TD></TR>";
     }
 } else {
     echo "<TR><TD ALIGN=\"CENTER\">None</TD></TR>";
 }
 echo "</TABLE><BR />";
 echo "<TABLE BORDER=\"1\">";
 $pend = "SELECT `employee_docs`.`uniq_id`,DATEDIFF(CURRENT_DATE,`date_set`) AS `date_set`,`store` FROM `employee_docs` LEFT JOIN `employees` ON `employees`.`uniq_id` = `employee_docs`.`uniq_id` WHERE `scanned` = 0 AND `status` = 0 AND `document` = 8850 AND `date_set` >= '2010-03-15' ORDER BY `date_set` DESC";
 $pending = mysql_query($pend);
 echo "<TR><TD COLSPAN=\"100\" ALIGN=\"CENTER\">Documents Pending</TD></TR>";
/**
 * This function will construct days array and assign them to template parser.
 * Days array is called $list_days inside template.
 */
function smarty_inject_days()
{
    $CI =& get_instance();
    $CI->parser->assign('list_days', get_days());
}
 private function inject_course_group_rooms($course_id)
 {
     $rooms = new Room();
     $rooms->where_related('group/course', 'id', (int) $course_id);
     $rooms->include_related('group', '*', TRUE, TRUE);
     $rooms->order_by_related('group', 'id', 'asc');
     $rooms->order_by('time_day', 'asc')->order_by('time_begin', 'asc');
     $rooms->order_by_with_constant('name', 'asc');
     $rooms->get_iterated();
     $days = get_days();
     $data = array();
     foreach ($rooms as $room) {
         if ($room->group->exists()) {
             $data[$room->group->id][] = array('value' => $room->id, 'text' => $this->lang->text($room->name) . ' (' . $days[$room->time_day] . ': ' . is_time($room->time_begin) . ' - ' . is_time($room->time_end) . ')');
         }
     }
     $this->parser->assign('all_rooms', $data);
 }
Esempio n. 7
0
    public function render($args, $instance, $context)
    {
        // The event calendar is the same for any theme, as it is fairly complicated
        // each theme would not want to create the rendering separately.
        // Define class functions here
        function get_days($s_start_date, $s_end_date)
        {
            // Firstly, format the provided dates.
            // This function works best with YYYY-MM-DD
            // but other date formats will work thanks
            // to strtotime().
            $s_start_date = gmdate("Y-m-d", strtotime($s_start_date));
            $s_end_date = gmdate("Y-m-d", strtotime($s_end_date));
            // Start the variable off with the start date
            $a_days[] = $s_start_date;
            // Set a 'temp' variable, sCurrentDate, with
            // the start date - before beginning the loop
            $s_current_date = $s_start_date;
            // While the current date is less than the end date
            while ($s_current_date < $s_end_date) {
                // Add a day to the current date
                $s_current_date = gmdate("Y-m-d", strtotime("+1 day", strtotime($s_current_date)));
                // Add this new day to the aDays array
                $a_days[] = $s_current_date;
            }
            return $a_days;
        }
        // Outputs the content of the widget
        extract($args);
        $title = $instance['title'];
        echo $before_title . $title . $after_title;
        global $wpdb;
        $etouches_event_table_name = $wpdb->prefix . IKIT_EVENT_ETOUCHES_TABLE_NAME;
        $etouches_events = $wpdb->get_results("SELECT * FROM {$etouches_event_table_name} where status = 'Sold Out' or status = 'Live'");
        $eventbrite_event_table_name = $wpdb->prefix . IKIT_EVENT_EVENTBRITE_TABLE_NAME;
        $eventbrite_events = $wpdb->get_results("SELECT * FROM {$eventbrite_event_table_name} where status = 'Live' or status = 'Started'");
        $days_by_event_id = array();
        foreach ($etouches_events as $event) {
            if (!in_array($event->id, $days_by_event_id)) {
                $days_by_event_id['etouches' . $event->id] = get_days($event->start_date, $event->end_date);
            }
        }
        foreach ($eventbrite_events as $event) {
            if (!in_array($event->id, $days_by_event_id)) {
                $days_by_event_id['eventbrite' . $event->id] = get_days($event->start_date, $event->end_date);
            }
        }
        // Figure out how to include using plugin URL
        wp_enqueue_script('js_zebra_datepicker', ikit_get_plugin_url('js/zebra_datepicker.js'));
        wp_enqueue_style('css_zebra_datepicker', ikit_get_plugin_url('css/zebra_datepicker.css'));
        ?>


        <div class="ikit-widget-event-calendar-hook"></div>

        <script type="text/javascript">

        $(document).ready (function() {

            $( ".ikit-widget-event-calendar-hook" ).Zebra_DatePicker({
                always_visible: $('.ikit-widget-event-calendar-hook'),
                show_clear_date: false,
                show_select_today: false,
                onChange: function() {
                    iKitWidgetsEventCalendarSync();
                }
            });
            $(".ikit-widget-event-calendar-hook" ).parent().css('margin','0');
            $(".dp_daypicker>tbody>tr").addClass("week");
            $(".week>td:first-child").css("border-left","none");


        });

        function iKitWidgetsEventCalendarLinkFunction(eventYear, eventMonth, eventDay) {

            window.location.replace("<?php 
        echo get_home_url();
        ?>
"+"/upcoming-events?date="+eventYear+"-"+eventMonth+"-"+eventDay);
        };

        function iKitWidgetsEventCalendarSync() {

            $(".ikit-widget-event-calendar-hook .dp_daypicker tbody").children("tr").children("td").each(function() {

                var day = $(this).html();
                var dayCol = $(this);
                if(day.valueOf()<10) {
                    day="0"+day;
                }
                var year=$(this).attr('data-year');
                var month=$(this).attr('data-month');
                var date = dayCol.data('date');
                dayCol.addClass('date-' + date);

            });

            var event_info;
            event_info = JSON.parse('<?php 
        echo json_encode($days_by_event_id);
        ?>
');
            for(var events in event_info) {
                for(var dates in event_info[events]) {
                    var eventDay=event_info[events][dates].toString().slice(8) ;
                    var eventMonth=event_info[events][dates].toString().slice(5,7)
                    var eventYear=event_info[events][dates].toString().slice(0,4) ;

                    var link = $(".date-" + eventYear+"-"+eventMonth+"-"+eventDay);
                    link.attr("onclick","iKitWidgetsEventCalendarLinkFunction("+eventYear+","+eventMonth+","+ eventDay+")" );
                    link.html("<a>"+ parseInt(eventDay, 10) +"</a>");
                    link.children().parent().addClass('has-events');
                    link.children().attr('href', '<?php 
        echo get_home_url();
        ?>
' + '/upcoming-events?date='+eventYear+"-"+eventMonth+"-"+eventDay);
                }
            }

            $(".dp_daypicker>tbody>tr").addClass("week");
            $(".week>td:first-child").css("border-left","none");
        };

        $(document).ready(function() {
            iKitWidgetsEventCalendarSync();
        });

        </script>

        <?php 
    }
 /**
  * Format office hours into a string and return it.
  * Will be used while saving office hours information to database.
  * @param object $data 		data generated by the form
  * @return string
  */
 private function get_formatted_office_hours($data)
 {
     global $CFG, $DB, $USER;
     //Declare our globals for use
     $officehour = '';
     if ($data->default_officeh != '0') {
         $officehour = $data->default_officeh;
     } else {
         foreach (get_days() as $day) {
             if ($data->{$day} != '0') {
                 $officehour .= $data->{$day} . ' ';
             }
         }
         $officehour .= sprintf("%02d", $data->fromhour);
         $officehour .= ':';
         $officehour .= sprintf("%02d", $data->fromminute);
         $officehour .= $data->fromformat == 0 ? ' AM' : ' PM';
         $officehour .= ' - ';
         $officehour .= sprintf("%02d", $data->tohour);
         $officehour .= ':';
         $officehour .= sprintf("%02d", $data->tominute);
         $officehour .= $data->toformat == 0 ? ' AM' : ' PM';
     }
     return $officehour;
 }