コード例 #1
0
 function admin_header_actions()
 {
     global $pagenow;
     if (is_admin() && !CoursePress_Capabilities::is_campus()) {
         if (isset($_GET['cp_admin_ref']) && $_GET['cp_admin_ref'] == 'cp_course_creation_page' || isset($_POST['cp_admin_ref']) && $_POST['cp_admin_ref'] == 'cp_course_creation_page') {
             wp_enqueue_style('admin_coursepress_marketpress_popup', $this->plugin_url . 'css/admin_marketpress_popup.css', array(), $this->version);
         }
     }
     wp_enqueue_style('font_awesome', $this->plugin_url . 'css/font-awesome.css');
     wp_enqueue_style('admin_general', $this->plugin_url . 'css/admin_general.css', array(), $this->version);
     wp_enqueue_style('admin_general_responsive', $this->plugin_url . 'css/admin_general_responsive.css', array(), $this->version);
     /* wp_enqueue_script( 'jquery-ui-datepicker' );
     	  wp_enqueue_script( 'jquery-ui-accordion' );
     	  wp_enqueue_script( 'jquery-ui-sortable' );
     	  wp_enqueue_script( 'jquery-ui-resizable' );
     	  wp_enqueue_script( 'jquery-ui-draggable' );
     	  wp_enqueue_script( 'jquery-ui-droppable' ); */
     //add_action( 'wp_enqueue_scripts', array( &$this, 'add_jquery_ui' ) );
     //wp_enqueue_script( 'jquery' );
     //wp_enqueue_script( 'jquery-ui-core' );
     //wp_enqueue_script( 'jquery-ui', '//code.jquery.com/ui/1.10.3/jquery-ui.js', array( 'jquery' ), '1.10.3' ); //need to change this to built-in
     wp_enqueue_script('jquery-ui-spinner');
     // CryptoJS.MD5
     wp_enqueue_script('cryptojs-md5', $this->plugin_url . 'js/md5.js');
     $page = isset($_GET['page']) ? $_GET['page'] : '';
     $this->add_jquery_ui();
     if ($page == 'course_details' || $page == $this->screen_base . '_settings') {
         wp_enqueue_style('cp_settings', $this->plugin_url . 'css/settings.css', array(), $this->version);
         wp_enqueue_style('cp_settings_responsive', $this->plugin_url . 'css/settings_responsive.css', array(), $this->version);
         wp_enqueue_style('cp_tooltips', $this->plugin_url . 'css/tooltips.css', array(), $this->version);
         wp_enqueue_script('cp-plugins', $this->plugin_url . 'js/plugins.js', array('jquery'), $this->version);
         wp_enqueue_script('cp-tooltips', $this->plugin_url . 'js/tooltips.js', array('jquery'), $this->version);
         wp_enqueue_script('cp-settings', $this->plugin_url . 'js/settings.js', array('jquery', 'jquery-ui', 'jquery-ui-spinner'), $this->version);
         wp_enqueue_script('cp-chosen-config', $this->plugin_url . 'js/chosen-config.js', array('cp-settings'), $this->version, true);
     }
     $page = isset($_GET['page']) ? $_GET['page'] : '';
     $included_pages = apply_filters('cp_settings_localize_pages', array('course', 'courses', 'course_details', 'instructors', 'students', 'assessment', 'reports', $this->screen_base . '_settings'));
     if (in_array($page, $included_pages) || isset($_GET['taxonomy']) && $_GET['taxonomy'] == 'course_category') {
         $unit_pagination = false;
         if (isset($_GET['unit_id'])) {
             $unit_pagination = cp_unit_uses_new_pagination((int) $_GET['unit_id']);
         }
         wp_enqueue_script('courses_bulk', $this->plugin_url . 'js/coursepress-admin.js', array('jquery-ui-tabs'), $this->version);
         //wp_enqueue_script( 'courses_bulk', $this->plugin_url . 'js/coursepress-admin.js', array(), $this->version );
         wp_enqueue_script('wplink');
         wp_localize_script('courses_bulk', 'coursepress', array('delete_instructor_alert' => __('Please confirm that you want to remove the instructor from this course?', 'cp'), 'delete_pending_instructor_alert' => __('Please confirm that you want to cancel the invite. Instuctor will receive a warning when trying to activate.', 'cp'), 'delete_course_alert' => __('Please confirm that you want to permanently delete the course, its units, unit elements and responses?', 'cp'), 'delete_student_response_alert' => __('Please confirm that you want to permanently delete this student answer / reponse?', 'cp'), 'delete_notification_alert' => __('Please confirm that you want to permanently delete the notification?', 'cp'), 'delete_discussion_alert' => __('Please confirm that you want to permanently delete the discussion?', 'cp'), 'withdraw_student_alert' => __('Please confirm that you want to withdraw student from this course. If you withdraw, you will no longer be able to see student\'s records for this course.', 'cp'), 'delete_unit_alert' => __('Please confirm that you want to permanently delete the unit, its elements and responses?', 'cp'), 'active_student_tab' => isset($_REQUEST['active_student_tab']) ? $_REQUEST['active_student_tab'] : 0, 'delete_module_alert' => __('Please confirm that you want to permanently delete selected element and its responses?', 'cp'), 'delete_unit_page_and_elements_alert' => __('Please confirm that you want to permanently delete this unit page, all its elements and student responses?', 'cp'), 'remove_unit_page_and_elements_alert' => __('Please confirm that you want to remove this unit page and all its elements?', 'cp'), 'remove_module_alert' => __('Please confirm that you want to remove selected element?', 'cp'), 'delete_unit_page_label' => __('Delete unit page and all elements', 'cp'), 'remove_row' => __('Remove', 'cp'), 'empty_class_name' => __('Class name cannot be empty', 'cp'), 'duplicated_class_name' => __('Class name already exists', 'cp'), 'course_taxonomy_screen' => isset($_GET['taxonomy']) && $_GET['taxonomy'] == 'course_category' ? true : false, 'unit_page_num' => isset($_GET['unit_page_num']) && $_GET['unit_page_num'] !== '' ? $_GET['unit_page_num'] : 1, 'allowed_video_extensions' => wp_get_video_extensions(), 'allowed_audio_extensions' => wp_get_audio_extensions(), 'allowed_image_extensions' => cp_wp_get_image_extensions(), 'start_of_week' => get_option('start_of_week', 0), 'unit_pagination' => $unit_pagination ? 1 : 0, 'admin_ajax_url' => cp_admin_ajax_url()));
         do_action('coursepress_editor_options');
     }
 }
コード例 #2
0
    function admin_main($data)
    {
        wp_enqueue_style('thickbox');
        wp_enqueue_script('thickbox');
        wp_enqueue_media();
        wp_enqueue_script('media-upload');
        $supported_image_extensions = implode(", ", cp_wp_get_image_extensions());
        ?>

		<div class="<?php 
        if (empty($data)) {
            ?>
draggable-<?php 
        }
        ?>
module-holder-<?php 
        echo $this->name;
        ?>
 module-holder-title" <?php 
        if (empty($data)) {
            ?>
style="display:none;"<?php 
        }
        ?>
>

			<h3 class="module-title sidebar-name <?php 
        echo !empty($data->active_module) ? 'is_active_module' : '';
        ?>
" data-panel="<?php 
        echo !empty($data->panel) ? $data->panel : '';
        ?>
" data-id="<?php 
        echo !empty($data->ID) ? $data->ID : '';
        ?>
">
				<span class="h3-label">
					<span class="h3-label-left"><?php 
        echo isset($data->post_title) && $data->post_title !== '' ? $data->post_title : __('Untitled', 'cp');
        ?>
</span>
					<span class="h3-label-right"><?php 
        echo $this->label;
        ?>
</span>
					<?php 
        parent::get_module_move_link();
        ?>
				</span>
			</h3>

			<div class="module-content">
				<input type="hidden" name="<?php 
        echo $this->name;
        ?>
_module_page[]" class="module_page" value="<?php 
        echo isset($data->module_page) ? $data->module_page : '';
        ?>
"/>
				<input type="hidden" name="<?php 
        echo $this->name;
        ?>
_module_order[]" class="module_order" value="<?php 
        echo isset($data->module_order) ? $data->module_order : 999;
        ?>
"/>
				<input type="hidden" name="module_type[]" value="<?php 
        echo $this->name;
        ?>
"/>
				<input type="hidden" name="<?php 
        echo $this->name;
        ?>
_id[]" class="unit_element_id" value="<?php 
        echo esc_attr(isset($data->ID) ? $data->ID : '');
        ?>
"/>

				<input type="hidden" class="element_id" value="<?php 
        echo esc_attr(isset($data->ID) ? $data->ID : '');
        ?>
"/>

				<label class="bold-label"><?php 
        _e('Element Title', 'cp');
        $this->time_estimation($data);
        ?>
</label>
				<?php 
        echo $this->element_title_description();
        ?>
				<input type="text" class="element_title" name="<?php 
        echo $this->name;
        ?>
_title[]" value="<?php 
        echo esc_attr(isset($data->post_title) ? $data->post_title : '');
        ?>
"/>

				<?php 
        echo $this->show_title_on_front_element($data);
        ?>

				<div class="editor_in_place" style="display:none;">

					<?php 
        $editor_name = $this->name . "_content[]";
        $editor_id = esc_attr(isset($data->ID) ? 'editor_' . $data->ID : rand(1, 9999));
        $editor_content = htmlspecialchars_decode(isset($data->post_content) ? $data->post_content : '');
        $editor = '<textarea id="' . $editor_id . '" name="' . $editor_name . '" class="coursepress-editor">' . $editor_content . '</textarea>';
        echo trim($editor);
        ?>
				</div>

				<div class="file_url_holder">
					<label><?php 
        _e('Enter a URL or Browse for an image.', 'cp');
        ?>
						<input class="image_url" type="text" size="36" name="<?php 
        echo $this->name;
        ?>
_image_url[]" value="<?php 
        echo esc_attr(isset($data->image_url) ? $data->image_url : '');
        ?>
"/>
						<input class="attachment_id" type="hidden" size="36" name="<?php 
        echo $this->name;
        ?>
_attachment_id[]" value="<?php 
        echo esc_attr(isset($data->attachment_id) ? $data->attachment_id : '0');
        ?>
"/>
						<input class="image_url_button" type="button" value="<?php 
        _e('Browse', 'cp');
        ?>
"/>

						<div class="invalid_extension_message"><?php 
        echo sprintf(__('Extension of the file is not valid. Please use one of the following: %s', 'cp'), $supported_image_extensions);
        ?>
</div>
					</label>
				</div>

				<?php 
        echo $this->show_media_caption($data);
        ?>

				<?php 
        parent::get_module_delete_link();
        ?>
			</div>

		</div>

	<?php 
    }
コード例 #3
0
        //);
        //
        //if ( !isset( $course_excerpt->post_excerpt ) ) {
        //	$course_excerpt					 = new StdClass;
        //	$course_excerpt->post_excerpt	 = '';
        //}
        //
        //$desc = '';
        //
        //// Filter $args
        //$args = apply_filters( 'coursepress_element_editor_args', $args, $editor_name, $editor_id );
        //
        //wp_editor( $editor_content, $editor_id, $args );
        $editor = '<textarea id="' . $editor_id . '" name="' . $editor_name . '" class="coursepress-editor">' . $editor_content . '</textarea>';
        echo trim($editor);
        $supported_image_extensions = implode(", ", cp_wp_get_image_extensions());
        ?>
											</div>

											<div class="wide narrow">
												<label for='featured_url'>
													<?php 
        _e('Listing Image', 'cp');
        ?>
<br/>
													<span><?php 
        _e('The image is used on the "Courses" listing ( archive ) page along with the course excerpt.', 'cp');
        ?>
</span>
												</label>
コード例 #4
0
        public static function render_settings()
        {
            if (!CoursePress_Capabilities::is_pro()) {
                return;
            }
            self::process_submit();
            ?>

			<div id="poststuff" class="metabox-holder m-settings email-settings cp-wrap" xmlns="http://www.w3.org/1999/html">
			<form action='' method='post'>

				<input type='hidden' name='action' value='update_basic_certificate'/>

				<?php 
            wp_nonce_field('update_basic_certificate');
            ?>

				<div class="postbox">
					<h3 class="hndle" style='cursor:auto;'><span><?php 
            _e('Certificate Options', 'cp');
            ?>
</span></h3>
					<div class="inside">
						<table class="form-table">
							<tbody>
							<tr valign="top">
								<th scope="row">
									<?php 
            _e('Enable Basic Certificate', 'cp');
            ?>
									<a class="help-icon" href="javascript:;"></a>
										<div class="tooltip">
											<div class="tooltip-before"></div>
											<div class="tooltip-button">&times;</div>
											<div class="tooltip-content">
												<?php 
            _e('Adds a "Certificate" link to completed courses on the student dashboard.', 'cp');
            ?>
											</div>
										</div>
								</th>
								<td>
									<input type='checkbox' value="1" name='cert_field_basic_certificate_enabled' <?php 
            echo checked(self::option('basic_certificate_enabled'));
            ?>
 />
								</td>
							</tr>
							<!--<tr valign="top">-->
								<!--<th scope="row">--><?php 
            //_e( 'Email certificate when course is completed.', 'cp' );
            ?>
<!--</th>-->
								<!--<td>-->
									<!--<input type='checkbox' value="1" name='cert_field_auto_email' --><?php 
            //echo( checked( self::option( 'auto_email' ) ) );
            ?>
<!-- />-->
								<!--</td>-->
							<!--</tr>-->

							</tbody>
						</table>
					</div>
				</div>

				<div class="postbox">
					<h3 class="hndle" style='cursor:auto;'><span><?php 
            _e('Certificate Layout', 'cp');
            ?>
</span></h3>

					<div class="inside">
						<p class="description"><?php 
            _e('Use the editor below to create the layout of your certificate.', 'cp');
            ?>
</p>
						<p class="description"><?php 
            _e('These codes will be replaced with actual data: FIRST_NAME, LAST_NAME, COURSE_NAME, COMPLETION_DATE, CERTIFICATE_NUMBER, UNIT_LIST', 'cp');
            ?>
</p>
						<table class="form-table">
							<tbody id="items">
								<tr>
									<td>
										<?php 
            $editor_name = "cert_field_certificate_content";
            $editor_id = "cert_field_certificate_content";
            $editor_content = stripslashes(self::certificate_content());
            $args = array("textarea_name" => $editor_name, "textarea_rows" => 10, 'wpautop' => true, 'quicktags' => true);
            // Filter $args before showing editor
            //$args = apply_filters( 'coursepress_element_editor_args', $args, $editor_name, $editor_id );
            wp_editor($editor_content, $editor_id, $args);
            ?>
									</td>
								</tr>
								<tr>
									<td>

										<strong><?php 
            esc_html_e('Background Image', 'cp');
            ?>
</strong>
										<a class="help-icon" href="javascript:;"></a>
										<div class="tooltip">
											<div class="tooltip-before"></div>
											<div class="tooltip-button">&times;</div>
											<div class="tooltip-content">
												<?php 
            echo sprintf(__('The image will be resized to fit the full page. For best results use 1:1414 as the ratio for image dimensions.<br /><br /><strong>Examples:</strong><br />595x842px (Portrait 72dpi)<br />1754x1240px (Landscape 150dpi)<br />2480x3508px (Portrait 300dpi).', 'cp'));
            ?>
											</div>
										</div><br />
										<?php 
            $supported_image_extensions = implode(", ", cp_wp_get_image_extensions());
            ?>
										<div class="certificate_background_image_holder">
											<input class="image_url certificate_background_url" type="text" size="36" name="cert_field_background_url" value="<?php 
            echo esc_attr(self::option('background_url'));
            ?>
" placeholder="<?php 
            _e('Add Image URL or Browse for Image', 'cp');
            ?>
"/>
											<input class="certificate_background_button button-secondary" type="button" value="<?php 
            _e('Browse', 'cp');
            ?>
"/>
											<div class="invalid_extension_message"><?php 
            echo sprintf(__('Extension of the file is not valid. Please use one of the following: %s', 'cp'), $supported_image_extensions);
            ?>
</div>
										</div>
									</td>
								</tr>
								<tr>
									<td>
										<p>
											<strong><?php 
            esc_html_e('Content Padding', 'cp');
            ?>
</strong>
											<span class="description"><?php 
            esc_html_e('Can be any CSS units. E.g. "0.2em"', 'cp');
            ?>
</span>
										</p>

										<span><?php 
            esc_html_e('Top', 'cp');
            ?>
</span><input type="text" size="6" style="width: 80px;" class="padding_top" name="cert_field_padding_top" value="<?php 
            echo esc_html(self::option('padding_top'));
            ?>
" />
										<span><?php 
            esc_html_e('Bottom', 'cp');
            ?>
</span><input type="text" size="6" style="width: 80px;" class="padding_bottom" name="cert_field_padding_bottom" value="<?php 
            echo esc_html(self::option('padding_bottom'));
            ?>
" />
										<span><?php 
            esc_html_e('Left', 'cp');
            ?>
</span><input type="text" size="6" style="width: 80px;" class="padding_left" name="cert_field_padding_left" value="<?php 
            echo esc_html(self::option('padding_left'));
            ?>
" />
										<span><?php 
            esc_html_e('Right', 'cp');
            ?>
</span><input type="text" size="6" style="width: 80px;" class="padding_right" name="cert_field_padding_right" value="<?php 
            echo esc_html(self::option('padding_right'));
            ?>
" />
									</td>
								</tr>
								<tr>
									<td>
										<strong><?php 
            esc_html_e('Page Orientation', 'cp');
            ?>
</strong><br />
										<?php 
            $selected_type = self::option('orientation');
            ?>
										<select name="cert_field_orientation" style="width: max-width: 200px;" id="cert_field_orientation">
											<option value="L" <?php 
            selected($selected_type, 'L', true);
            ?>
><?php 
            _e('Landscape', 'cp');
            ?>
</option>
											<option value="P" <?php 
            selected($selected_type, 'P', true);
            ?>
><?php 
            _e('Portrait', 'cp');
            ?>
</option>
										</select>
									</td>
								</tr>
							</tbody>
						</table>
					</div>
					<!--/inside-->

				</div>
				<!--/postbox-->

				<!-- Maybe render CSS, it is limited with TCPDF -->
				<?php 
            // self::render_css_setting();
            ?>

				<p class="save-shanges">
					<?php 
            submit_button(__('Save Changes', 'cp'));
            ?>
				</p>

			</form>
		</div>

		<?php 
        }