function create_calendar($pre = '«', $next = '»') { global $wp_locale; $calendar = '<div class="course-calendar" data-courseid="' . $this->course_id . '">'; $calendar .= !empty($this->previous_month) ? '<a class="pre-month" data-date="' . $this->previous_month . '">' . $pre . '</a>' : '<a class="pre-month" data-date="empty">' . $pre . '</a>'; $calendar .= !empty($this->next_month) ? '<a class="next-month" data-date="' . $this->next_month . '">' . $next . '</a>' : '<a class="next-month" data-date="empty">' . $next . '</a>'; $calendar .= "<table class='course-calendar-body " . $this->date_indicator . "'>"; $calendar .= "<caption>"; $calendar .= "{$this->month_name} {$this->year}"; $calendar .= "</caption>"; $calendar .= "<tr>"; // Headers $week_day_names = array_keys($wp_locale->weekday_initial); foreach ($this->days_of_week as $day) { $calendar .= "<th class='week-days'>" . $wp_locale->weekday_initial[$week_day_names[$day]] . "</th>"; } $current_day = 1; $calendar .= '</tr><tr>'; if ($this->day_of_week > 0) { $calendar .= '<td colspan="' . $this->day_of_week . '"> </td>'; } $month = str_pad($this->month, 2, "0", STR_PAD_LEFT); $day_of_week = $this->day_of_week; while ($current_day <= $this->number_of_days) { // If last day, start again if ($day_of_week == 7) { $day_of_week = 0; $calendar .= "</tr><tr>"; } $rel_day = str_pad($current_day, 2, "0", STR_PAD_LEFT); $date = "{$this->year}-{$month}-{$rel_day}"; $class = ''; if ($this->course_id) { if (strtotime(str_replace('-', '/', $date)) == strtotime(str_replace('-', '/', $this->course_start_day))) { $class = 'course-start-date'; } if ($this->course_no_end && strtotime(str_replace('-', '/', $date)) > strtotime(str_replace('-', '/', $this->course_start_day))) { $class = 'course-open-date'; } if (strtotime(str_replace('-', '/', $date)) < strtotime(str_replace('-', '/', $this->course_end_day)) && strtotime(str_replace('-', '/', $date)) > strtotime(str_replace('-', '/', $this->course_start_day))) { $class = 'course-active-date'; } if (strtotime(str_replace('-', '/', $date)) == strtotime(str_replace('-', '/', $this->course_end_day)) && !$this->course_no_end) { $class = 'course-end-date'; } } $today_date = getdate(); if ($this->month == $today_date['mon'] && $current_day == $today_date['mday']) { $class .= ' today'; } $calendar .= "<td class='day {$class}' rel='{$date}'>{$current_day}</td>"; $current_day++; $day_of_week++; } // Pad the last week if any days remain. if ($day_of_week != 7) { $remaining = 7 - $day_of_week; $calendar .= "<td colspan='{$remaining}'> </td>"; } $calendar .= "</tr>"; $calendar .= "</table>"; $calendar .= "</div>"; $calendar .= '<script type="text/javascript">var wpajaxurl = "' . cp_admin_ajax_url() . '";</script>'; return $calendar; }
function admin_coursepress_page_course_details() { wp_enqueue_script('courses-units', $this->plugin_url . 'js/coursepress-courses.js', array(), $this->version); wp_enqueue_script('units-slimscroll', $this->plugin_url . 'js/jquery.slimscroll.min.js', array('jquery'), $this->version); $unit_pagination = false; if (isset($_GET['unit_id'])) { $unit_pagination = cp_unit_uses_new_pagination((int) $_GET['unit_id']); } add_action('admin_footer', array(&$this, 'add_cp2_editor')); wp_localize_script('courses-units', 'coursepress_units', array('admin_ajax_url' => admin_url('admin-ajax.php'), 'withdraw_class_alert' => __('Please confirm that you want to withdraw all students from this class?', 'cp'), 'delete_class' => __('Please confirm that you want to permanently delete the class? All students form this class will be moved to the Default class automatically.', 'cp'), 'setup_gateway' => __("You have selected 'This is a Paid Course'.\n In order to continue you must first setup a payment gateway by clicking on 'Setup Payment Gateways'", 'cp'), 'unit_setup_prompt' => __('<div>You have successfully completed your Basic Course Setup.</div><div>This can be changed anytime by clicking on "Course Overview".</div><div>Add and create <strong>Units</strong> for your course and add <strong>Students</strong>.</div><div>You must have at least <strong>one</strong> unit created to publish the course.</div>', 'cp'), 'mp_activated_prompt' => __('<div>Marketpress has been activated successfully.</div>', 'cp'), 'required_course_name' => __('<strong>Course Name</strong> is a required field.', 'cp'), 'required_course_excerpt' => __('<strong>Course Excerpt</strong> is a required field.', 'cp'), 'required_course_description' => __('<strong>Course Description</strong> is a required field.', 'cp'), 'required_course_start' => __('<strong>Course Start Date</strong> is a required field.', 'cp'), 'required_course_end' => __('<strong>Course Start Date</strong> is a required field when "This course has no end date" is <strong>not</strong> selected.', 'cp'), 'required_enrollment_start' => __('<strong>Enrollment Start Date</strong> is a required field when "Users can enroll anytime" is <strong>not</strong> selected.', 'cp'), 'required_enrollment_end' => __('<strong>Enrollment End Date</strong> is a required field when "Users can enroll anytime" is <strong>not</strong> selected.', 'cp'), 'required_course_class_size' => __('Value can not be 0 if "Limit class size" is selected.', 'cp'), 'required_course_passcode' => __('<strong>Pass Code</strong> required when "Anyone with a pass code" is selected', 'cp'), 'required_gateway' => __('<strong>Payment Gateway</strong> needs to be setup before you can sell this course.', 'cp'), 'required_price' => __('<strong>Price</strong> is a required field when "This is a Paid Course" is selected.', 'cp'), 'required_sale_price' => __('<strong>Sale Price</strong> is a required field when "Enable Sale Price" is selected.', 'cp'), 'section_error' => __('There is some information missing or incorrect. Please check your input and try again.', 'cp'), 'cp_editor_style' => $this->plugin_url . 'css/editor_style_fix.css', 'unit_pagination' => $unit_pagination ? 1 : 0, 'admin_ajax_url' => cp_admin_ajax_url())); wp_enqueue_style('jquery-ui-admin', $this->plugin_url . 'css/jquery-ui.css'); wp_enqueue_style('admin_coursepress_page_course_details', $this->plugin_url . 'css/admin_coursepress_page_course_details.css', array(), $this->version); wp_enqueue_style('admin_coursepress_page_course_details_responsive', $this->plugin_url . 'css/admin_coursepress_page_course_details_responsive.css', array(), $this->version); }