Esempio n. 1
0
 public function bsalted_payments()
 {
     $db = new db();
     $sessinon = new SessionHelper();
     $stage = new Event();
     $helper = new SiteHelper();
     $order_fields = $this->addition_fields_list();
     $user_fields = User::addition_fields_list();
     $user_id = User::getID();
     $chosen_course = User::getMeta($user_id, $user_fields['course']);
     $course_stages_data = array();
     $user_stages = User::getPaidStages();
     $is_user_has_deposit = User::getMeta($user_id, $user_fields['deposit']);
     $course_id = isset($_GET['course-id']) && !empty($_GET['course-id']) ? $_GET['course-id'] : User::getCourseID($user_id);
     if (isset($course_id) && !empty($course_id)) {
         $course_stages = $stage->getByParentID($course_id);
         foreach ($course_stages as $object) {
             $course_name = $stage->getNameByID($object->post_id);
             $course_stages_data[$course_name] = $object->post_id;
         }
         SessionHelper::set($order_fields['course'], $course_id);
         SessionHelper::set($order_fields['stages'], $course_stages_data);
     } else {
         SessionHelper::set($order_fields['stages'], 'DEPOSIT');
     }
     $helper->enqueue_script('bsalted-front', '/js/main/front.js');
     $helper->localize_js('bsalted-front', 'bsaltedAjax', array('ajaxurl' => admin_url('admin-ajax.php')));
     if (!empty($chosen_course) && count($user_stages) == 5) {
         $course_id = User::getCourseID($user_id);
         //prevent if get isset
         $course = $db->getEntry($course_id);
         echo '<div class="bsalted-payment-message"><h3>You have paid for all the stages of the course ' . $course->post_title . '</h3></div>';
     } elseif (isset($course_id) && !empty($course_id)) {
         include_once dirname(__FILE__) . '/view/bsalted-payments.php';
     } else {
         // echo '<div class="bsalted-payment-message"><h3> You need to choose Course Program first.</h3></div>';
         include_once dirname(__FILE__) . '/view/bsalted-payments.php';
     }
 }
Esempio n. 2
0
 public static function is_confirmed($stage_id)
 {
     $types_fields = self::types_fields_list();
     $stage = db::getEntry($stage_id);
     $stage_price = db::getEntryMeta($stage_id, $types_fields['price'])[0];
     $stage_show = db::getEntryMeta($stage_id, $types_fields['show'])[0];
     if ($stage_price > 0 && $stage_show === 'yes') {
         return true;
     }
     return false;
 }
							<?php 
    }
    ?>
						</select>
					</td>
					<td>
						<select name="bsalted-proposal-second" class="chosen-select bsalted-proposal-second">
							<?php 
    foreach ($courses_id as $course_id) {
        ?>
								<option value="<?php 
        echo $course_id;
        ?>
">
									<?php 
        $course = db::getEntry($course_id);
        echo $course->post_title;
        ?>
								</option>
							<?php 
    }
    ?>
						</select>
					</td>
					<td>
						<form action="." class="bsalted-proposal">
							<input type="hidden" name="user-id" value="<?php 
    echo $user_id;
    ?>
">
							<input type="hidden" class="proposal-first" name="proposal-first">
Esempio n. 4
0
 public static function create_proposal($one, $two)
 {
     $proposal_one = db::getEntry($one);
     $proposal_two = db::getEntry($two);
     $body = '';
     $link = '<a href="' . get_site_url() . '/account/adventures-course-program/">Choose the course</a>';
     $body .= '<h3>' . $proposal_one->post_title . '</h3>' . $proposal_one->post_content . '<br><br><hr> <br><br>' . '<h3>' . $proposal_two->post_title . '</h3>' . $proposal_two->post_content . '<br><br>' . $link;
     return $body;
 }