<div class="col-sm-10 col-sm-offset-3 col-md-12 col-md-offset-2 main">
    <a href="#" data-toggle="modal" data-target="#videoUploadModal">
        <span class="btn btn-success">Upload Video</span>
    </a>
    <?php
    $message = $this->session->userdata('message_for_video');
    $message .= '<br>' . $this->session->userdata('message_for_file');
    if ($message) {
        echo "<p style='color:red;'>" . $message . "</p>";
        $this->session->unset_userdata('message_for_video');
        $this->session->unset_userdata('message_for_file');
    }
    ?>
    <?php if ($selected_video) { ?>
        <div class="col-sm-12 col-md-12" >
            <span style="color: #69C238; font-size: 25px;"><?php echo $selected_video->upload_video_name; ?></span>
        </div>
        <div class="col-sm-6 col-md-5" style="background-color: #F2F2F2;">
            <video width='500px' height= '500px' controls> 
                <source src="<?php echo base_url() . '/' . $selected_video->upload_video_path; ?>" type="video/mp4">
            </video>
        </div>
    <?php } ?>

    <div class="col-sm-6 col-md-6" style="background-color: #F2F2F2;margin: 10px;">
        <?php if ($video_item) { ?>
            <?php foreach ($video_item as $v_video_item) { ?>
                <div class="col-sm-12 col-md-12">
                    <div class="col-sm-5 col-md-5">
                        <a href="<?php echo base_url() ?>super_admin_video/load_video/<?php echo $v_video_item->upload_video_id; ?>"> 
                            <video width='150px' height= '100px'>  
                                <source src="<?php echo base_url() . '/' . $v_video_item->upload_video_path; ?>" type="video/mp4">
                            </video>
                        </a>
                    </div>
                    <div class="col-sm-5 col-md-5" style="font-size: 12px;">
                        <a href="<?php echo base_url() ?>super_admin_video/load_video/<?php echo $v_video_item->upload_video_id; ?>">
                            <label style="color: #69C238"><?php echo $v_video_item->upload_video_name ?></label>
                            <br>
                        </a>
                        <label>Suddam Hossain Rana</label>Talha Corporation
                        <label> Uploaded </label>  12th June, 2012
                        <label> Viewed </label>  12987 Times
                        <label> See Comments(8)</label>
                        <p>..............</p>
                    </div>
                </div>
                <?php
            }
        }
        ?>               
    </div>
</div>




<div class="modal fade" id="videoUploadModal" tabindex="-1" role="dialog" aria-labelledby="videoUploadModal" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h4 class="modal-title" id="myModalLabel">Upload Video</h4>
            </div>
            <form id="formID2" action="<?php echo base_url() ?>super_admin_video/save_upload_video/<?php echo $video_management_id; ?>" method='post' enctype="multipart/form-data">
                <div class="modal-body">
                    <br>
                    Upload Video Folder Name <span style="color: red">(*)</span>
                    <input type='text' data-errormessage-value-missing="Video Folder Name is required!" 
                           class="form-control validate[required] text-input" 
                           name='upload_video_name' value=''><br>

                    Upload Video Section Name <span style="color: red">(*)</span>
                    <select data-errormessage-value-missing="Video Section Name is required!" 
                            class="form-control validate[required] text-input"
                            name='upload_video_section_name'>
                        <option value="">Select Video Section</option>
                        <?php foreach ($video_management_section as $v_section) { ?>
                            <option value="<?php echo $v_section->upload_video_section_name ?>"><?php echo $v_section->upload_video_section_name ?></option>
                        <?php } ?>
                    </select>
                    Upload Video <span style="color: red">(*)</span>
                    <input type='file' 
                           data-errormessage-value-missing="Course Category is required!" 
                           class="form-control validate[required] text-input"
                           name='upload_video_path' value=''><br>

                    <label for="video_work_files">Video Work files</label><span class="required" style="color: red"> (*) </span><br>
                    <input data-errormessage-value-missing="Work files is required!" 
                           class="validate[required] text-input"
                           onclick="uploadFile(this.value)" type="radio" name="video_work_files_status" id="status" value="1"  />Yes
                    <input data-errormessage-value-missing="Work files is required!" 
                           class="validate[required] text-input"
                           onclick="uploadFile(this.value)" type="radio" name="video_work_files_status" id="status" value="0" />No
                    <br><br>
                    <span id="up_file">
                        <script>
                            function uploadFile($value) {
                                if ($value == 1) {
                                    document.getElementById('up_file').innerHTML = "Upload Work File<span class='required' style='color: red'> * </span><input type='file' style='float:left;' class='form-control' id='upload_files' name='work_files_url' required value='' placeholder='Select File'><br><br><br>Work File Name<span class='required' style='color: red'> (*) </span><br><input type='text' name='work_files_name' class='form-control'><br>Work File Destination Folder Name<span class='required' style='color: red'> (*) </span><br><input type='text' name='work_file_folder_name' class='form-control'>";
                                    document.getElementById('message1').innerHTML = "<br><p style='color:red;'>File Select Is required</p>";
                                }
                                if ($value == 0) {
                                    document.getElementById('up_file').innerHTML = "";
                                    document.getElementById('message1').innerHTML = "";
                                }
                            }

                        </script> 
                    </span>

                </div>
                <div class="modal-footer">

                    <input class="btn btn-primary" type='submit' value='Upload Video' name='btn'>

                </div>
            </form>

        </div>
    </div>
</div>

<script>
    // This program plots a point at the edge of a circle that
// is rotating and also moving along a circle
// play with the first four variable values to create
// other patterns
// ** Found out that these curves are called hypotrochoid
    background(0, 0, 0);
    var csize1 = 200;    // radius of the orbit
    var csize2 = 20;    // radius of the circle
    var iinc = 1.0;     // speed 1 - moving iinc deg/iteration
    var jinc = -109.5;    // speed 2 - rotate jinc deg/iteration
    var ccenter = 180; // center of the plot
    var i = 0;
    var j = 0;
    var x = ccenter + csize1 * sin(i) + csize2 * sin(j);
    var y = ccenter + csize1 * cos(i) + csize2 * cos(j);
    var x1 = x;
    var y1 = y;
    var draw = function () {
        x = ccenter + csize1 * sin(i) + csize2 * sin(j);
        y = ccenter + csize1 * cos(i) + csize2 * cos(j) * 2;
        line(x, y, x1, y1);
        x1 = x;
        y1 = y;
        i = i + iinc;
        j = j + jinc;

        if (x > 200) {
            csize1 -= 0.5;
            jinc -= 0.1;
            var red = 25 * sin(jinc + i) + 200;
            var green = 100 * cos(jinc + i) + 22;
            var blue = 1 + 150 * sin(jinc + i);
            strokeWeight(1.5);
            stroke(red, blue, green, 50 + i / 40);

        }

        if (jinc < -145) {
            jinc *= -1.2;
        }

        if (jinc > 100) {
            noLoop();
        }
    };
    frameRate(100);
</script>