示例#1
0
/**
 * Output the generic six buckets. Really, this is all determined for onlyl
 * six buckets with the last two buckets, Case Studies and CC Store being
 * static. The Ratings in the bookmarks/links sectin of wordpress determines
 * the position of the boxes.
 */
function output_buckets()
{
    $buckets = get_buckets();
    // Need at least four buckets, before the 2 custom buckets
    if (count($buckets) < 4) {
        $static_bucket = 'home-buckets.php';
        include $static_bucket;
        return;
    }
    // classes for the four first buckets, five and six are hardcoded
    $top_columns = array('five columns alpha', 'six columns', 'five columns omega', 'five columns alpha');
    ?>
					<div class="short row">
<?php 
    $ct = 0;
    // print_r($buckets);
    foreach ($buckets as $bucket) {
        ?>
						<div class="<?php 
        echo $top_columns[$ct];
        ?>
">

						<div class="bucket">
						<div class="inner">
							<h3 class="title"><?php 
        echo $bucket->link_name;
        ?>
</h3>
							<div class="content"> 
								<h6><?php 
        echo $bucket->link_description;
        ?>
</h6>
                                <?php 
        if (!empty($bucket->link_image)) {
            ?>
													<div class="slide">
														<a href="<?php 
            echo $bucket->link_rss;
            ?>
">
														<img src="<?php 
            echo $bucket->link_image;
            ?>
" alt="<?php 
            echo $bucket->link_name;
            ?>
" />
														</a>
													</div>
                                <?php 
        }
        ?>
                                <?php 
        echo nl2br($bucket->link_notes);
        ?>


                                                <?php 
        echo get_button($bucket, $bucket->link_url);
        ?>

							</div> <!--! end of "content" --> 
						</div> <!--! end of "inner" -->
						</div> <!--! end of "bucket" -->

						</div> <!--! end of top_columns[$ct] -->

<?php 
        if ($ct == 2) {
            ?>
					</div> <!--! end of "short row" -->

					<div class="tall row">
<?php 
        }
        if ($ct == 3) {
            output_case_studies();
            output_store();
            break;
        }
        $ct++;
    }
    ?>
					</div> <!--! end of "tall row" -->

<?php 
}
    $res_type = $res->resource_type;
    $res_id = $res->resource_id;
    echo "<tr>";
    echo "<td>" . $count++ . "</td>";
    echo "<td>" . $res->module_name . "</td>";
    // echo "<td>".$res->group_name."</td>";
    echo "<td>" . $res->subject_name . "</td>";
    echo "<td>" . $res->syllabus_type . "</td>";
    echo "<td>" . $res->resource_name . "</td>";
    echo "<td>" . $res->schedule . "</td>";
    // echo "<td>
    //         <button type='button' class='btn-sm btn-info resource_btn'  onClick='view_pdf_modal(\"$syllabus_type\",\"$res_type\",\"$res_id\");'>View ".$res->resource_type."</button>
    //      </td>";
    echo "<td>" . set_view_button($syllabus_type, $res_type, $res_id) . "</td>";
    //echo "<td>".$res->res_order."</td>";
    echo "<td>" . get_button($res->map_id, $res->course_id, $res->resource_status, $user_details['user_role']) . "</td>";
    //echo "<td>
    //        <button type='button' class='btn-sm btn-info' onClick='edit_cres_map_modal(".$res->map_id.");'><i class='glyphicon glyphicon-edit text-white'></i></button>
    //        <button type='button' class='btn-sm btn-danger' onClick='delete_syllabus(".$res->map_id.",".$res->course_id.");'><i class='glyphicon glyphicon-trash text-white'></i></button>
    //      </td>";
    echo "</tr>";
}
function set_view_button($syllabus_type, $res_type, $res_id)
{
    switch ($res_type) {
        case 'PDF':
            return "<button type='button' class='btn-sm btn-info resource_btn'  onClick='view_pdf_modal(\"{$syllabus_type}\",\"{$res_type}\",\"{$res_id}\");'>View " . $res_type . "</button>";
            break;
        case 'VIDEO':
            return "<button type='button' class='btn-sm btn-info resource_btn'  onClick='view_pdf_modal(\"{$syllabus_type}\",\"{$res_type}\",\"{$res_id}\");'>View " . $res_type . "</button>";
            break;
                                        <?php 
$count = 1;
foreach ($syllabus_list as $res) {
    $syllabus_type = $res->syllabus_type;
    $test_id = $res->test_id;
    echo "<tr>";
    echo "<td>" . $count++ . "</td>";
    echo "<td>" . $res->module_name . "</td>";
    // echo "<td>".$res->group_name."</td>";
    echo "<td>" . $res->subject_name . "</td>";
    echo "<td>" . $res->syllabus_type . "</td>";
    echo "<td>" . $res->test_name . "</td>";
    echo "<td>" . $res->test_type . "</td>";
    echo "<td>" . $res->schedule . "</td>";
    //echo "<td>".$res->res_order."</td>";
    echo "<td>" . "<button type='button' class='btn-sm btn-info' onClick='view_assessment_pdf(\"{$syllabus_type}\",\"{$test_id}\");'>Open Pdf</button>" . " " . get_button($res->map_id, $res->course_id, $res->resource_status, $user_details['user_role']) . "</td>";
    // echo "<td>
    //         <button type='button' class='btn-sm btn-info' onClick='edit_ctest_map_modal(".$res->map_id.");'><i class='glyphicon glyphicon-edit text-white'></i></button>
    //         <button type='button' class='btn-sm btn-danger' onClick='delete_syllabus(".$res->map_id.",".$res->course_id.");'><i class='glyphicon glyphicon-trash text-white'></i></button>
    //       </td>";
    echo "</tr>";
}
// Set Type of button
function get_button($map_id, $course_id, $resource_status, $user_role)
{
    log_message('debug', 'what i get is ' . $resource_status);
    // Content Admin
    if ($user_role == '6') {
        switch ($resource_status) {
            case 'UnPublished':
                return "<button type='button' class='btn-sm btn-info' onClick='edit_ctest_map_modal(" . $map_id . ");'><i class='glyphicon glyphicon-edit text-white'></i></button>\n                                                                    <button type='button' class='btn-sm btn-danger' onClick='delete_syllabus(" . $map_id . "," . $course_id . ");'><i class='glyphicon glyphicon-trash text-white'></i></button>\n                                                                    ";
	 */
    public function render()
    {
        global $skip_javascripts;
        $skip_javascripts[] = '$("#' . $this->params['id'] . '").button();';