コード例 #1
0
ファイル: lesson.php プロジェクト: hernanimattos/LearnPress
 /**
  * Display content for custom column
  *
  * @param string $name
  * @param int    $post_id
  */
 function columns_content($name, $post_id)
 {
     switch ($name) {
         case LP()->course_post_type:
             $courses = learn_press_get_item_courses($post_id);
             if ($courses) {
                 foreach ($courses as $course) {
                     echo '<div><a href="' . esc_url(add_query_arg(array('filter_course' => $course->ID))) . '">' . get_the_title($course->ID) . '</a>';
                     echo '<div class="row-actions">';
                     printf('<a href="%s">%s</a>', admin_url(sprintf('post.php?post=%d&action=edit', $course->ID)), __('Edit', 'learn_press'));
                     echo "&nbsp;|&nbsp;";
                     printf('<a href="%s">%s</a>', get_the_permalink($course->ID), __('View', 'learn_press'));
                     echo "&nbsp;|&nbsp;";
                     if ($course_id = learn_press_get_request('filter_course')) {
                         printf('<a href="%s">%s</a>', remove_query_arg('filter_course'), __('Remove Filter', 'learn_press'));
                     } else {
                         printf('<a href="%s">%s</a>', add_query_arg('filter_course', $course->ID), __('Filter', 'learn_press'));
                     }
                     echo '</div></div>';
                 }
             } else {
                 _e('Not assigned yet', 'learn_press');
             }
             break;
         case 'is_previewable':
             printf('<input type="checkbox" class="learn-press-checkbox learn-press-toggle-lesson-preview" %s value="%s" data-nonce="%s" />', get_post_meta($post_id, '_lp_is_previewable', true) == 'yes' ? ' checked="checked"' : '', $post_id, wp_create_nonce('learn-press-toggle-lesson-preview'));
             break;
         case 'format':
             learn_press_item_meta_format($post_id, __('Standard', 'learn_press'));
     }
 }
コード例 #2
0
ファイル: quiz.php プロジェクト: hernanimattos/LearnPress
 /**
  * Display content for custom column
  *
  * @param string $name
  * @param int    $post_id
  */
 function columns_content($name, $post_id)
 {
     global $post;
     switch ($name) {
         case LP()->course_post_type:
             $courses = learn_press_get_item_courses($post_id);
             if ($courses) {
                 foreach ($courses as $course) {
                     echo '<div><a href="' . esc_url(add_query_arg(array('filter_course' => $course->ID))) . '">' . get_the_title($course->ID) . '</a>';
                     echo '<div class="row-actions">';
                     printf('<a href="%s">%s</a>', admin_url(sprintf('post.php?post=%d&action=edit', $course->ID)), __('Edit', 'learn_press'));
                     echo "&nbsp;|&nbsp;";
                     printf('<a href="%s">%s</a>', get_the_permalink($course->ID), __('View', 'learn_press'));
                     echo "&nbsp;|&nbsp;";
                     if ($this->_filter_course()) {
                         printf('<a href="%s">%s</a>', remove_query_arg('filter_course'), __('Remove Filter', 'learn_press'));
                     } else {
                         printf('<a href="%s">%s</a>', add_query_arg('filter_course', $course->ID), __('Filter', 'learn_press'));
                     }
                     echo '</div></div>';
                 }
             } else {
                 _e('Not assigned yet', 'learn_press');
             }
             break;
         case 'num_of_question':
             if (property_exists($post, 'question_count')) {
                 $count = $post->question_count;
             } else {
                 $quiz = LP_Quiz::get_quiz($post_id);
                 $questions = $quiz->get_questions();
                 $count = sizeof($questions);
             }
             printf('<span class="lp-label-counter" title="%s">%s</span>', $count ? sprintf(_nx('%d question', '%d questions', $count, 'learn_press'), $count) : __('This quiz has got any questions', 'learn_press'), $count);
     }
 }
コード例 #3
0
ファイル: quiz.php プロジェクト: thonysmith/LearnPress
 /**
  * Display content for custom column
  *
  * @param string $name
  * @param int    $post_id
  */
 function columns_content($name, $post_id)
 {
     switch ($name) {
         case LP()->course_post_type:
             $courses = learn_press_get_item_courses($post_id);
             if ($courses) {
                 foreach ($courses as $course) {
                     echo '<div><a href="' . esc_url(add_query_arg(array('course_id' => $course->ID))) . '">' . get_the_title($course->ID) . '</a>';
                     echo '<div class="row-actions">';
                     printf('<a href="%s">%s</a>', admin_url(sprintf('post.php?post=%d&action=edit', $course->ID)), __('Edit', 'learn_press'));
                     echo "&nbsp;|&nbsp;";
                     printf('<a href="%s">%s</a>', get_the_permalink($course->ID), __('View', 'learn_press'));
                     echo '</div></div>';
                 }
             } else {
                 _e('Not assigned yet', 'learn_press');
             }
             break;
         case 'num_of_question':
             $quiz = LP_Quiz::get_quiz($post_id);
             $questions = $quiz->get_questions();
             echo ($n = sizeof($questions)) ? sprintf(_nx('%d question', '%d questions', $n, 'learn_press'), $n) : '_';
     }
 }