Ejemplo n.º 1
0
Archivo: tabs.php Proyecto: JozefAB/qk
function tab3($program, $config)
{
    $k = 0;
    $prices = guruModelguruProgram::getPrices($program->id);
    $chb_free_courses = $program->chb_free_courses;
    $step_access_courses = $program->step_access_courses;
    $selected_course = $program->selected_course;
    if ($chb_free_courses == 1) {
        if ($step_access_courses == "2") {
            echo JText::_("GURU_FREE_GUESTS");
        } elseif ($step_access_courses == "1") {
            echo JText::_("GURU_FREE_MEMBERS");
        } elseif ($step_access_courses == "0") {
            if (trim($selected_course) == "" || trim($selected_course) == "-1") {
                echo JText::_("GURU_FREE_ALL_STUDENTS");
            } else {
                $courses = explode("|", $selected_course);
                if (isset($courses) && count($courses) > 0) {
                    foreach ($courses as $key => $value) {
                        if (intval($value) == 0) {
                            unset($courses[$key]);
                        }
                    }
                }
                if (count($courses) == 0) {
                    $courses = array("0");
                }
                $db = JFactory::getDBO();
                $sql = "select `name` from #__guru_program where `id` in (" . implode(", ", $courses) . ")";
                $db->setQuery($sql);
                $db->query();
                $names = $db->loadColumn();
                echo JText::_("GURU_FREE_STUDENTS_SOME_COURSES") . ' "' . implode('", "', $names) . '"';
            }
        }
    } elseif (isset($prices) && $prices != NULL) {
        ?>
   <div class="clearfix">
    <div class="g_table_wrap"> 
        <table class="table table-striped">
             <tr class="g_table_header">
                <th class="g_cell_1"><?php 
        echo JText::_("GURU_SUBS_PLAN_NAME");
        ?>
</th>
                <th class="g_cell_2"><?php 
        echo JText::_("GURU_PROGRAM_DETAILS_PRICE");
        ?>
</th>
            </tr>
    <?php 
        foreach ($prices as $key => $value) {
            $class = "odd";
            if ($k % 2 != 0) {
                $class = "even";
            }
            if (trim($value["name"]) != "" || trim($value["price"]) != "") {
                ?>
                    <tr class="<?php 
                echo $class;
                ?>
"> 
                        <td class="g_cell_1"><b><?php 
                echo $value["name"];
                ?>
:</b></td>
                        <td  class="g_cell_2">
                            <?php 
                $currency = $config->currency;
                $currencypos = $config->currencypos;
                if ($currencypos == 0) {
                    echo JText::_("GURU_CURRENCY_" . $currency) . " " . $value["price"];
                } else {
                    echo $value["price"] . " " . JText::_("GURU_CURRENCY_" . $currency);
                }
                ?>
                        </td>
                    </tr>
            <?php 
            }
            $k++;
        }
        ?>
        </table>
      </div>
    </div>    
    <?php 
    }
}