admin_url('admin-ajax.php'))); wp_enqueue_script('jquery'); wp_register_style('datetimepicker-style', plugins_url('js/datetimepicker/jquery.datetimepicker.css', __FILE__)); wp_register_style('aio-tc-site-style', plugins_url('css/aio-site.css', __FILE__)); wp_enqueue_style('datetimepicker-style'); wp_enqueue_script('nert-aio-timepicker', plugins_url('js/datetimepicker/jquery.datetimepicker.js', __FILE__)); wp_enqueue_script('aio_time_clock_js'); wp_enqueue_style('aio-tc-site-style'); } function aio_admin_tc_script_enqueuer_lite() { wp_register_script("aio_time_clock_admin_js", plugins_url('/js/time-clock-lite-admin.js', __FILE__), array('jquery'), aio_lite_get_version()); wp_register_script("aio_time_clock_steps", plugins_url('/js/jquery.steps.min.js', __FILE__), array('jquery')); wp_localize_script('aio_time_clock_admin_js', 'timeClockAdminAjax', array('ajaxurl' => admin_url('admin-ajax.php'))); wp_register_style('aio-tc-admin-style', plugins_url('css/aio-admin.css', __FILE__)); wp_register_style('aio-tc-steps-style', plugins_url('css/jquery.steps.css', __FILE__)); wp_enqueue_script('jquery'); wp_enqueue_script('aio_time_clock_admin_js'); wp_enqueue_script('aio_time_clock_steps'); wp_enqueue_style('aio-tc-admin-style'); wp_enqueue_style('aio-tc-steps-style'); } function aio_time_clock_js() { $clock_action = sanitize_text_field($_POST["clock_action"]); $employee_clock_in_time = null; $employee_clock_out_time = null; $is_clocked_in = false; $open_shift_id = sanitize_key(intval($_POST["open_shift_id"])); $new_shift_created = false; global $current_user; get_currentuserinfo(); $current_user = wp_get_current_user(); $employee = $current_user->ID; $message = null; $time_total = 0; $open_shift_id = sanitize_key(intval($open_shift_id)); if ($clock_action == "check_shifts") { $args = array( 'post_type' => 'shift', 'orderby' => 'ID', 'author' => $employee, ); $query = new WP_Query($args); if ($query->have_posts()) { while ($query->have_posts()) { $query->the_post(); $custom = get_post_custom($query->post->ID); $employee_clock_in_time = $custom["employee_clock_in_time"][0]; $employee_clock_out_time = $custom["employee_clock_out_time"][0]; if ($employee_clock_in_time != null && $employee_clock_out_time == null) { $open_shift_id = $query->post->ID; $is_clocked_in = true; break; } } } echo json_encode( array( "response" => "success", "message" => $message, "employee" => $employee, "clock_action" => $clock_action, "is_clocked_in" => $is_clocked_in, "open_shift_id" => $open_shift_id, "employee_clock_in_time" => $employee_clock_in_time, "employee_clock_out_time" => $employee_clock_out_time, ) ); } elseif ($clock_action == "clock_in") { $device_time = $_POST["device_time"]; $timezone_option = get_option('aio_timeclock_time_zone'); if ($timezone_option != null){ if ($device_time != null && $timezone_option == 'dynamic'){ $device_time = strtotime($device_time); $date = date('Y/m/d h:i:s A',$device_time); $time_type = "device"; } else{ date_default_timezone_set($timezone_option); $date = date('Y/m/d h:i:s A'); $time_type = "timezone option"; } } else{ $timezone = 'America/New_York'; date_default_timezone_set($timezone); $date = date('Y/m/d h:i:s A'); $time_type = "defualt"; } $aio_new_shift = array( 'post_type' => 'shift', 'post_title' => 'Employee Shift', 'post_status' => 'publish', 'post_author' => $employee, ); $new_post_id = wp_insert_post($aio_new_shift); $department = ""; $terms = get_the_terms($current_user->ID, 'department'); if (!empty($terms)) { foreach ($terms as $term) { $department = $term->name; } } add_post_meta($new_post_id, 'employee_clock_in_time', $date, true); if ($department != null) { add_post_meta($new_post_id, 'department', $department, true); } add_post_meta($new_post_id, 'ip_address_in', $_SERVER['REMOTE_ADDR'], true); $open_shift_id = $new_post_id; $is_clocked_in = true; echo json_encode( array( "response" => "success", "message" => $message, "employee" => $employee, "open_shift_id" => $open_shift_id, "clock_action" => $clock_action, "is_clocked_in" => $is_clocked_in, "employee_clock_in_time" => $date, "employee_clock_out_time" => null, ) ); } elseif ($clock_action == "clock_out") { $device_time = $_POST["device_time"]; $timezone_option = get_option('aio_timeclock_time_zone'); if ($timezone_option != null){ if ($device_time != null && $timezone_option == 'dynamic'){ $device_time = strtotime($device_time); $date = date('Y/m/d h:i:s A',$device_time); $time_type = "device"; } else{ date_default_timezone_set($timezone_option); $date = date('Y/m/d h:i:s A'); $time_type = "timezone option"; } } else{ $timezone = 'America/New_York'; date_default_timezone_set($timezone); $date = date('Y/m/d h:i:s A'); $time_type = "defualt"; } $is_clocked_in = false; $employee_clock_in_time = get_post_meta($open_shift_id, 'employee_clock_in_time', true); add_post_meta($open_shift_id, 'employee_clock_out_time', $date, true); add_post_meta($open_shift_id, 'ip_address_out', $_SERVER['REMOTE_ADDR'], true); $time_total = aio_date_difference_lite($employee_clock_out_time, $employee_clock_in_time); echo json_encode( array( "response" => "success", "message" => $message, "employee" => $employee, "clock_action" => $clock_action, "employee_clock_in_time" => $employee_clock_in_time, "employee_clock_out_time" => $date, "time_total" => $time_total, "is_clocked_in" => $is_clocked_in ) ); } else { echo json_encode( array( "response" => "failed", "message" => "action does not exist", "employee" => $employee, "clock_action" => $clock_action, ) ); } wp_reset_postdata(); die(); } function aio_time_clock_admin_js() { $report_type = sanitize_text_field($_POST["report_type"]); $employee = sanitize_key(intval($_POST["employee"])); $date_range_start = date("Y/m/d h:i:s A", strtotime($_POST["aio_pp_start_date"])); $date_range_end = date("Y/m/d h:i:s A", strtotime($_POST["aio_pp_end_date"])); $errors = ""; if ($errors == null) { echo json_encode( array( "response" => "success", "employee" => $employee, "date_range_start" => $date_range_start, "date_range_end" => $date_range_end, "shifts" => aioGetShiftTotalFromRange( $employee, $date_range_start, $date_range_end ), ) ); } else { echo json_encode( array( "response" => "failed", "employee" => $employee, "date_range_start" => $date_range_start, "date_range_end" => $date_range_end, ) ); } die(); } function aio_tc_custom_post_shift_lite() { $labels = array( 'name' => _x('Shifts', 'post type general name'), 'singular_name' => _x('Shift', 'post type singular name'), 'add_new' => _x('Add New', 'book'), 'add_new_item' => __('Clock Out'), 'edit_item' => __('Edit Shift'), 'new_item' => __('Clock In'), 'all_items' => __('All Shifts'), 'view_item' => __('View Shift'), 'search_items' => __('Search Shifts'), 'not_found' => __('No shifts found'), 'not_found_in_trash' => __('No shifts found in the Trash'), 'parent_item_colon' => '', 'menu_name' => 'Employee Shifts', ); $args = array( 'labels' => $labels, 'description' => 'Employee shifts dates and times', 'query_var' => true, 'public' => true, 'show_ui' => true, 'supports' => array('title', 'author'), 'has_archive' => true, 'show_tagcloud' => false, 'rewrite' => array('slug' => 'shifts'), 'show_in_nav_menus' => false, 'supports' => false ); register_post_type('shift', $args); } remove_role('manager'); $result = add_role( 'manager', __('Manager'), array( 'read' => true, 'create_posts' => true, 'edit_posts' => true, 'edit_others_posts' => true, 'publish_posts' => true, 'manage_categories' => true, ) ); remove_role('volunteer'); $result = add_role( 'volunteer', __('Volunteer'), array( 'read' => true, ) ); remove_role('employee'); $result = add_role( 'employee', __('Employee'), array( 'read' => true, ) ); remove_role('time_clock_admin'); $result = add_role( 'time_clock_admin', __('Time Clock Admin'), array( 'read' => true, // Allows a user to read 'create_shifts' => true, // Allows user to create new posts 'edit_posts' => true, // Allows user to edit their own posts 'edit_shifts' => true, // Allows user to edit their own posts 'edit_others_posts' => true, // Allows user to edit others posts too 'edit_others_shifts' => true, // Allows user to edit others posts too 'publish_posts' => true, // Allows the user to publish posts 'publish_shifts' => true, // Allows the user to publish posts 'manage_categories' => true, // Allows user to manage post categories 'edit_private_posts' => true, // Allows user to manage post categories 'edit_private_shifts' => true, // Allows user to manage post categories 'read_private_posts' => true, // Allows user to manage post categories 'read_private_shifts' => true, // Allows user to manage post categories 'edit_published_posts' => true, // Allows user to manage post categories 'edit_published_shifts' => true, // Allows user to manage post categories ) ); function aio_timeclock_admin_init_lite() { add_filter('manage_edit-shift_columns', 'aio_timeclock_shift_columns_filter_lite', 10, 1); add_action('manage_shift_posts_custom_column', 'aio_timeclock_shift_column_lite', 10, 2); } function aio_timeclock_shift_columns_filter_lite($columns) { unset($columns['date']); unset($columns['author']); $columns['employee'] = __('Employee', 'employee'); $columns['department'] = __('Department', 'department'); $columns['employee_clock_in_time'] = __('Clock In Time', 'employee_clock_in_time'); $columns['employee_clock_out_time'] = __('Clock Out Time', 'employee_clock_out_time'); $columns['total_shift_time'] = __('Total Time', 'total_shift_time'); return $columns; } function aio_timeclock_shift_column_lite($column, $post_id) { global $post; $custom = get_post_custom($post_id); switch ($column) { case 'employee': $first_name = get_the_author_meta('first_name'); $last_name = get_the_author_meta('last_name'); echo $last_name . ", " . $first_name; break; case 'department': echo aioLiteDepartmentColumn(get_the_author_meta('ID')); break; case 'employee_clock_in_time': echo get_post_meta($post_id, 'employee_clock_in_time', true); break; case 'employee_clock_out_time': echo get_post_meta($post_id, 'employee_clock_out_time', true); break; case 'total_shift_time': echo aioGetShiftTotal($post_id); break; } } function aioLiteDepartmentColumn($author_id) { $department = ""; global $user; global $wordpress; $tax = get_taxonomy( 'department' ); $terms = get_terms( 'department', array( 'hide_empty' => false ) ); if ( !empty( $terms ) ) { foreach ( $terms as $term ) { if (is_object_in_term( $author_id, 'department', $term )){ $department .= $term->name . " "; } } } return $department; } function aioGetShiftTotal($post_id) { $employee_clock_in_time = get_post_meta($post_id, 'employee_clock_in_time', true); $employee_clock_out_time = get_post_meta($post_id, 'employee_clock_out_time', true); if ($employee_clock_in_time != null && $employee_clock_out_time != null) { $total_shift_time = aio_date_difference_lite($employee_clock_out_time, $employee_clock_in_time); } else { $total_shift_time = '00:00:00'; } return $total_shift_time; } function aio_date_difference_lite($end, $start) { $dteStart = new DateTime($start); $dteEnd = new DateTime($end); $dteDiff = $dteStart->diff($dteEnd); return $dteDiff->format("%H:%I:%S"); } function aio_shift_info_box_meta_lite() { add_meta_box( 'shift_info_box', __('Shift Info', 'aio-timeclock'), 'aio_shift_info_box_content', 'shift', 'normal', 'high' ); } function aio_shift_info_box_content() { include "aio-time-clock-box-content.php"; } function aioGetEmployeeSelect($selected) { $selected = json_decode($selected); $count = 0; $users = get_users('fields=all_with_meta'); usort($users, create_function('$a, $b', 'if($a->last_name == $b->last_name) { return 0;} return ($a->last_name > $b->last_name) ? 1 : -1;')); foreach (array_filter($users, 'aio_filter_roles_lite') as $user) { $active = ""; if ($selected == $user->ID) { $active = "selected"; } echo ''; $count++; } } function aioGetBuildInRolesLite(){ return array('aio_tc_employee', 'aio_tc_manager', 'time_clock_admin', 'aio_tc_volunteer', 'aio_tc_contractor', 'employee', 'manager', 'volunteer', 'contractor', 'administrator'); } function aio_filter_roles_lite($user) { $roles = aioGetBuildInRolesLite(); return array_intersect($user->roles, $roles); } function aio_save_shift_meta_lite($post_id) { if (isset($_REQUEST['clock_in'])) { update_post_meta($post_id, 'employee_clock_in_time', sanitize_text_field($_REQUEST['clock_in'])); $employee_clock_out_time = get_post_meta($post_id, 'employee_clock_out_time', true); } if (isset($_REQUEST['clock_out'])) { update_post_meta($post_id, 'employee_clock_out_time', sanitize_text_field($_REQUEST['clock_out'])); } if (isset($_REQUEST['employee_id'])) { remove_action('save_post', 'aio_save_shift_meta_lite'); $arg = array( 'ID' => $post_id, 'post_author' => sanitize_key(intval($_REQUEST['employee_id'])), ); wp_update_post($arg); add_action('save_post', 'aio_save_shift_meta_lite'); } } function aio_remove_my_post_metaboxes_lite() { remove_meta_box('authordiv', 'shift', 'normal'); } function aio_timeclock_settings_page_lite() { include "aio-settings.php"; } function aio_timeclock_monitoring_page() { include "aio-monitoring.php"; } function aio_timeclock_reports_page_lite() { include "aio-reports.php"; } function register_aio_timeclock_lite_settings() { register_setting('nertworks-timeclock-settings-group', 'aio_company_name'); register_setting('nertworks-timeclock-settings-group', 'aio_pay_schedule'); register_setting('nertworks-timeclock-settings-group', 'aio_wage_manage'); register_setting('nertworks-timeclock-settings-group', 'aio_timeclock_time_zone'); register_setting('nertworks-timeclock-settings-group', 'aio_timeclock_text_align'); register_setting('nertworks-timeclock-settings-group', 'aio_timeclock_redirect_employees'); register_setting('nertworks-timeclock-settings-group', 'aio_timeclock_show_avatar'); } function aio_check_tc_shortcode_lite() { $loop = new WP_Query(array('post_type' => 'page', 'posts_per_page' => -1)); while ($loop->have_posts()): $loop->the_post(); $content = get_the_content(); if (has_shortcode($content, 'show_aio_time_clock_lite')) { return $loop->post->ID; break; } else { //echo "none"; } endwhile; wp_reset_query(); } function check_eprofile_shortcode_lite() { $loop = new WP_Query(array('post_type' => 'page', 'posts_per_page' => -1)); while ($loop->have_posts()) : $loop->the_post(); $content = get_the_content(); if (has_shortcode($content, 'show_aio_employee_profile_lite')) { return $loop->post->ID; } else { //echo "none"; } endwhile; wp_reset_query(); } function aio_member_login_redirect($redirect_to, $request, $user) { $tc_page = aio_check_tc_shortcode_lite(); $role = 'employee'; if (is_array($user->roles) && in_array($role, $user->roles)) { return get_permalink($tc_page); } else { return $redirect_to; } } function aioGetTimeZoneListLite() { $timezones = array( 'Pacific/Midway' => '(GMT-11:00) Midway Island, Samoa', 'America/Adak' => '(GMT-10:00) Hawaii-Aleutian', 'Etc/GMT+10' => '(GMT-10:00) Hawaii', 'Pacific/Marquesas' => '(GMT-09:30) Marquesas Islands', 'Pacific/Gambier' => '(GMT-09:00) Gambier Islands', 'America/Anchorage' => '(GMT-09:00) Alaska', 'America/Ensenada' => '(GMT-08:00) Tijuana, Baja California', 'Etc/GMT+8' => '(GMT-08:00) Pitcairn Islands', 'America/Los_Angeles' => '(GMT-08:00) Pacific Time (US & Canada)', 'America/Denver' => '(GMT-07:00) Mountain Time (US & Canada)', 'America/Chihuahua' => '(GMT-07:00) Chihuahua, La Paz, Mazatlan', 'America/Dawson_Creek' => '(GMT-07:00) Arizona', 'America/Belize' => '(GMT-06:00) Saskatchewan, Central America', 'America/Cancun' => '(GMT-06:00) Guadalajara, Mexico City, Monterrey', 'Chile/EasterIsland' => '(GMT-06:00) Easter Island', 'America/Chicago' => '(GMT-06:00) Central Time (US & Canada)', 'America/New_York' => '(GMT-05:00) Eastern Time (US & Canada)', 'America/Havana' => '(GMT-05:00) Cuba', 'America/Bogota' => '(GMT-05:00) Bogota, Lima, Quito, Rio Branco', 'America/Caracas' => '(GMT-04:30) Caracas', 'America/Santiago' => '(GMT-04:00) Santiago', 'America/La_Paz' => '(GMT-04:00) La Paz', 'Atlantic/Stanley' => '(GMT-04:00) Faukland Islands', 'America/Campo_Grande' => '(GMT-04:00) Brazil', 'America/Goose_Bay' => '(GMT-04:00) Atlantic Time (Goose Bay)', 'America/Glace_Bay' => '(GMT-04:00) Atlantic Time (Canada)', 'America/St_Johns' => '(GMT-03:30) Newfoundland', 'America/Araguaina' => '(GMT-03:00) UTC-3', 'America/Montevideo' => '(GMT-03:00) Montevideo', 'America/Miquelon' => '(GMT-03:00) Miquelon, St. Pierre', 'America/Godthab' => '(GMT-03:00) Greenland', 'America/Argentina/Buenos_Aires' => '(GMT-03:00) Buenos Aires', 'America/Sao_Paulo' => '(GMT-03:00) Brasilia', 'America/Noronha' => '(GMT-02:00) Mid-Atlantic', 'Atlantic/Cape_Verde' => '(GMT-01:00) Cape Verde Is.', 'Atlantic/Azores' => '(GMT-01:00) Azores', 'Europe/Belfast' => '(GMT) Greenwich Mean Time : Belfast', 'Europe/Dublin' => '(GMT) Greenwich Mean Time : Dublin', 'Europe/Lisbon' => '(GMT) Greenwich Mean Time : Lisbon', 'Europe/London' => '(GMT) Greenwich Mean Time : London', 'Africa/Abidjan' => '(GMT) Monrovia, Reykjavik', 'Europe/Amsterdam' => '(GMT+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna', 'Europe/Belgrade' => '(GMT+01:00) Belgrade, Bratislava, Budapest, Ljubljana, Prague', 'Europe/Brussels' => '(GMT+01:00) Brussels, Copenhagen, Madrid, Paris', 'Africa/Algiers' => '(GMT+01:00) West Central Africa', 'Africa/Windhoek' => '(GMT+01:00) Windhoek', 'Asia/Beirut' => '(GMT+02:00) Beirut', 'Africa/Cairo' => '(GMT+02:00) Cairo', 'Asia/Gaza' => '(GMT+02:00) Gaza', 'Africa/Blantyre' => '(GMT+02:00) Harare, Pretoria', 'Asia/Jerusalem' => '(GMT+02:00) Jerusalem', 'Europe/Minsk' => '(GMT+02:00) Minsk', 'Asia/Damascus' => '(GMT+02:00) Syria', 'Europe/Moscow' => '(GMT+03:00) Moscow, St. Petersburg, Volgograd', 'Africa/Addis_Ababa' => '(GMT+03:00) Nairobi', 'Asia/Tehran' => '(GMT+03:30) Tehran', 'Asia/Dubai' => '(GMT+04:00) Abu Dhabi, Muscat', 'Asia/Yerevan' => '(GMT+04:00) Yerevan', 'Asia/Kabul' => '(GMT+04:30) Kabul', 'Asia/Yekaterinburg' => '(GMT+05:00) Ekaterinburg', 'Asia/Tashkent' => '(GMT+05:00) Tashkent', 'Asia/Kolkata' => '(GMT+05:30) Chennai, Kolkata, Mumbai, New Delhi', 'Asia/Katmandu' => '(GMT+05:45) Kathmandu', 'Asia/Dhaka' => '(GMT+06:00) Astana, Dhaka', 'Asia/Novosibirsk' => '(GMT+06:00) Novosibirsk', 'Asia/Rangoon' => '(GMT+06:30) Yangon (Rangoon)', 'Asia/Bangkok' => '(GMT+07:00) Bangkok, Hanoi, Jakarta', 'Asia/Krasnoyarsk' => '(GMT+07:00) Krasnoyarsk', 'Asia/Hong_Kong' => '(GMT+08:00) Beijing, Chongqing, Hong Kong, Urumqi', 'Asia/Irkutsk' => '(GMT+08:00) Irkutsk, Ulaan Bataar', 'Australia/Perth' => '(GMT+08:00) Perth', 'Australia/Eucla' => '(GMT+08:45) Eucla', 'Asia/Tokyo' => '(GMT+09:00) Osaka, Sapporo, Tokyo', 'Asia/Seoul' => '(GMT+09:00) Seoul', 'Asia/Yakutsk' => '(GMT+09:00) Yakutsk', 'Australia/Adelaide' => '(GMT+09:30) Adelaide', 'Australia/Darwin' => '(GMT+09:30) Darwin', 'Australia/Brisbane' => '(GMT+10:00) Brisbane', 'Australia/Hobart' => '(GMT+10:00) Hobart', 'Asia/Vladivostok' => '(GMT+10:00) Vladivostok', 'Australia/Lord_Howe' => '(GMT+10:30) Lord Howe Island', 'Etc/GMT-11' => '(GMT+11:00) Solomon Is., New Caledonia', 'Asia/Magadan' => '(GMT+11:00) Magadan', 'Pacific/Norfolk' => '(GMT+11:30) Norfolk Island', 'Asia/Anadyr' => '(GMT+12:00) Anadyr, Kamchatka', 'Pacific/Auckland' => '(GMT+12:00) Auckland, Wellington', 'Etc/GMT-12' => '(GMT+12:00) Fiji, Kamchatka, Marshall Is.', 'Pacific/Chatham' => '(GMT+12:45) Chatham Islands', 'Pacific/Tongatapu' => '(GMT+13:00) Nukualofa', 'Pacific/Kiritimati' => '(GMT+14:00) Kiritimati' ); return $timezones; } function aio_timeclock_lite_shifts_page() { wp_redirect( admin_url().'/edit.php?post_type=shift' ); echo ''; exit; } function aio_timeclock_lite_employee_page() { include("aio-employees.php"); } function aio_timeclock_department_page() { wp_redirect( admin_url().'/edit-tags.php?taxonomy=department' ); echo ''; exit; } function aioGetShiftTotalFromRange($employee, $date_range_start, $date_range_end) { $shift_total_time = 0; $shift_sum = ''; $shift_array = array(); $count = 0; $loop = new WP_Query(array('post_type' => 'shift', 'author' => $employee, 'posts_per_page' => -1)); while ($loop->have_posts()): $loop->the_post(); $shift_id = $loop->post->ID; $custom = get_post_custom($shift_id); $employee_clock_in_time = $custom["employee_clock_in_time"][0]; $employee_clock_out_time = $custom["employee_clock_out_time"][0]; if ($employee_clock_in_time != null) { $employee_clock_in_time = date('Y/m/d h:i:s A', strtotime($employee_clock_in_time)); } if ($employee_clock_out_time != null) { $employee_clock_out_time = date('Y/m/d h:i:s A', strtotime($employee_clock_out_time)); } $searchDateBegin = date('Y/m/d h:i:s A', strtotime($date_range_start)); $searchDateEnd = date('Y/m/d h:i:s A', strtotime($date_range_end)); if ((strtotime($employee_clock_in_time) >= strtotime($searchDateBegin)) && (strtotime($employee_clock_in_time) <= strtotime($searchDateEnd))) { $author_id = $loop->post->post_author; $last_name = get_the_author_meta('last_name', $author_id); $first_name = get_the_author_meta('first_name', $author_id); if ($employee_clock_in_time != null && $employee_clock_out_time != null) { $shift_sum = aio_date_difference_lite($employee_clock_out_time, $employee_clock_in_time); } else { $shift_sum = '00:00:00'; } $shift_total_time = aio_sum_the_time_lite($shift_total_time, $shift_sum); array_push($shift_array, array( "shift_id" => $shift_id, "employee_clock_in_time" => $employee_clock_in_time, "employee_clock_out_time" => $employee_clock_out_time, "first_name" => $first_name, "last_name" => $last_name, "shift_sum" => $shift_sum, ) ); $count++; } endwhile; wp_reset_query(); return array( "response" => "success", "shift_count" => $count, "shift_total_time" => $shift_total_time, "shift_array" => $shift_array, ); } function aio_sum_the_time_lite($time1, $time2) { $times = array($time1, $time2); $seconds = 0; foreach ($times as $time) { list($hour, $minute, $second) = explode(':', $time); $seconds += $hour * 3600; $seconds += $minute * 60; $seconds += $second; } $hours = floor($seconds / 3600); $seconds -= $hours * 3600; $minutes = floor($seconds / 60); $seconds -= $minutes * 60; return sprintf('%02d:%02d:%02d', $hours, $minutes, $seconds); } function aio_modify_employee_wage_lite($profile_fields) { $profile_fields['employee_wage'] = 'Wage'; return $profile_fields; } function aio_time_clock_lite_admin_notices() { /* if (get_option('aio_time_clock_lite_update_redirect', false)) { ?>