示例#1
0
 if ($course->allow_license_blocks) {
     $priceblocks = $DB->get_records('course_shopblockprice', array('courseid' => $course->courseid), 'price_bracket_start');
     if (count($priceblocks)) {
         if (iomad::is_company_admin()) {
             foreach ($priceblocks as $priceblock) {
                 $table->data[] = array(get_string('licenseblock_n', 'block_iomad_commerce', $priceblock->price_bracket_start), $priceblock->currency . number_format($priceblock->price, 2), '');
             }
         } else {
             $price = get_lowest_price_text($course);
             if (!isloggedin()) {
                 $table->data[] = array(get_string('loginforlicenseoptions', 'block_iomad_commerce'), $price, "");
             } else {
                 $table->data[] = array(get_string('licenseoptionsavailableforregisteredcompanies', 'block_iomad_commerce'), $price, "");
             }
         }
         if (isloggedin() && iomad::is_company_admin()) {
             $msg = '';
             if ($licenseformempty) {
                 $msg = "<p class='error'>" . get_string('licenseformempty', 'block_iomad_commerce') . "</p>";
             }
             $form = '<form action="buynow.php?courseid=$course->courseid" method="get">
                 <input type="hidden" name="courseid" value="' . $courseid . '" />
                 <input type="hidden" name="licenses" value="1" />
                 ' . $msg . '
                 <label for="id_nlicenses"> How many licenses? </label>
                 <input type="text" name="nlicenses" id="id_nlicenses" value="" />
                 <input type="submit" value="' . get_string('buynow', 'block_iomad_commerce') . '" />
             </form>';
         }
     }
 }