<?php
$user_id = $this->session->userdata('user_id');
switch ($type) {
    case 1:
        if ($group_note_post) {
            foreach ($group_note_post as $v_note) {
                ?>
                <div class="col-sm-12 gray text-center" >

                    <div class="col-sm-5" style="padding: 10px 0 0 0  "> 
                        <?php
                        $mess = $v_note->post_details;
                        echo substr($mess, 0, 50) . "...";
                        ?>
                        <a href="<?php echo base_url() . 'view-content-group/' . $this->utility_model->encode_id($v_note->post_id, '/', 'Tt') . '/1'; ?>">view</a>
                    </div>
                    <div class="col-sm-2" style="padding: 10px 0 0 0; cursor: pointer; color: #80c12c;" id="viewGroup<?php echo $v_note->url ?>">
                        <?php echo $v_note->person_first_name . ' ' . $v_note->person_last_name; ?>
                    </div>
                    <div class="col-sm-2" style="padding: 10px 0 0 0  ">
                        <?php echo $v_note->post_date_time; ?>
                    </div>

                    <div class="col-sm-2" style="padding: 10px 0 0 0  ">

                        <?php
                        $post_status = $v_note->post_status;
                        if ($v_note->posted_by == $user_id || $group_details->group_created_by == $user_id) {
                            if ($post_status != 2) {
                                ?>
                                <a href="#" onclick="return checkForDelete('<?php echo $v_note->post_id; ?>', '<?php echo $group_details->group_id; ?>')"><i class="fa fa-trash-o" title="Delete"></i></a>&nbsp;&nbsp;
                                <?php
                            }
                        }
                        ?>

                    </div>
                </div>
                <div class="col-sm-12"><br></div>
                <?php
            }
        }
        break;
    case 2:
        if ($group_alert_post) {
            foreach ($group_alert_post as $v_alert) {
                ?>
                <div class="col-sm-12 gray text-center" >
                    <div class="col-sm-5" style="padding: 10px 0 0 0  ">
                        <?php
                        $mess = $v_alert->post_details;
                        echo substr($mess, 0, 50) . "...";
                        ?>
                        <a href="<?php echo base_url() . 'view-content-group/' . $this->utility_model->encode_id($v_alert->post_id, '/', 'Tt') . '/1'; ?>">view</a>
                    </div>

                    <div class="col-sm-2" style="padding: 10px 0 0 0; cursor: pointer; color: #80c12c;" id="viewGroup<?php echo $v_alert->url ?>">
                        <?php echo $v_alert->person_first_name . ' ' . $v_alert->person_last_name; ?>
                    </div>

                    <div class="col-sm-2" style="padding: 10px 0 0 0  ">
                        <?php echo $v_alert->post_date_time; ?>
                    </div>

                    <div class="col-sm-2" style="padding: 10px 0 0 0  ">
                        <?php
                        $post_status = $v_alert->post_status;
                        if ($v_alert->posted_by == $user_id || $group_details->group_created_by == $user_id) {
                            if ($post_status != 2) {
                                ?>
                                <a href="#" onclick="return checkForDelete('<?php echo $v_alert->post_id; ?>', '<?php echo $group_details->group_id; ?>')">
                                    <i class="fa fa-trash-o" title="Delete"></i>
                                </a>&nbsp;&nbsp;
                                <?php
                            }
                        }
                        ?>
                    </div>
                </div>
                <div class="col-sm-12"><br></div>
                <?php
            }
        }
        break;
    case 3:
        if ($group_assignment_post) {
            foreach ($group_assignment_post as $v_assignment) {
                ?>
                <div class="col-sm-12 gray text-center" >
                    <div class="col-sm-2" style="padding: 10px 0 0 0  "><a href="#">
                            <?php
                            $fileName = $v_assignment->post_file_original_name;
                            $file_explode = explode('.', $fileName);
                            $file_extention = $file_explode[count($file_explode) - 1];

                            if ($file_extention == 'pdf') {
                                ?>
                                <a href="javascript:;" onclick="downloadAssignment('<?php echo $v_assignment->post_id; ?>', '<?php echo $group_details->group_id; ?>')"> <img src="<?php echo base_url() . 'image/assignment/pdf.png' ?>"></a>
                                <!--<i style="color: #80c12c" class="fa fa-file-pdf-o"></i>-->
                            <?php } else if ($file_extention == 'rar' || $file_extention == 'zip') { ?>
                                <a href="javascript:;" onclick="downloadAssignment('<?php echo $v_assignment->post_id; ?>', '<?php echo $group_details->group_id; ?>')"> <img src="<?php echo base_url() . 'image/assignment/rar.png' ?>"></a>
                            <?php } else if ($file_extention == 'doc' || $file_extention == 'docx') { ?>
                                <a href="javascript:;" onclick="downloadAssignment('<?php echo $v_assignment->post_id; ?>', '<?php echo $group_details->group_id; ?>')"><img src="<?php echo base_url() . 'image/assignment/word.png' ?>"></a>

                            <?php } else if ($file_extention == 'xls' || $file_extention == 'xlsx') { ?>
                                <a href="javascript:;" onclick="downloadAssignment('<?php echo $v_assignment->post_id; ?>', '<?php echo $group_details->group_id; ?>')"> <img src="<?php echo base_url() . 'image/assignment/excel.png' ?>"></a>
                            <?php } else if ($file_extention == 'pptx' || $file_extention == 'ppt') { ?>
                                <a href="javascript:;" onclick="downloadAssignment('<?php echo $v_assignment->post_id; ?>', '<?php echo $group_details->group_id; ?>')"> <img src="<?php echo base_url() . 'image/assignment/powerpoint.png' ?>"></a>
                            <?php } else {
                                ?>
                                <a href="javascript:;" onclick="downloadAssignment('<?php echo $v_assignment->post_id; ?>', '<?php echo $group_details->group_id; ?>')"> <img src="<?php echo base_url() . 'image/assignment/unknown.png' ?>"></a>
                            <?php }
                            ?>
                        </a></div>
                    <div class="col-sm-4" style="padding: 10px 0 0 0  ">
                        <a href="<?php echo base_url() . 'view-content-group/' . $this->utility_model->encode_id($v_assignment->post_id, '/', 'Tt') . '/2'; ?>"><?php echo $v_assignment->post_file_original_name; ?></a>
                    </div>
                    <div class="col-sm-2" style="padding: 10px 0 0 0; cursor: pointer;color: #80c12c;" id="viewGroup<?php echo $v_assignment->url ?>">
                        <?php echo $v_assignment->person_first_name . ' ' . $v_assignment->person_last_name; ?>
                    </div>
                    <div class="col-sm-2" style="padding: 10px 0 0 0  ">
                        <?php echo $v_assignment->post_date_time; ?>
                    </div>

                    <div class="col-sm-2" style="padding: 10px 0 0 0  ">
                        <?php
                        $post_status = $v_assignment->post_status;
//                            if ($post_status == 1) {
                        ?>
                            <!--<a href="//<?php // echo base_url() . 'make-inactive-group-post/' . $v_alert->post_id;                           ?>"><i class="fa fa-user-times" title="Inactive"></i></a>&nbsp;&nbsp;-->
                        <?php // } else if ($post_status == 0) {   ?>
                            <!--<a href="//<?php // echo base_url() . 'make-active-group-post/' . $v_alert->post_id;                           ?>" ><i class="fa fa-user-plus " title="Active"></i></a>&nbsp;&nbsp;-->
                        <?php // }   ?>

                        <?php
                        if ($v_assignment->posted_by == $user_id || $group_details->group_created_by == $user_id) {
                            if ($post_status != 2) {
                                ?>
                                <a href="#" onclick="return checkForDelete('<?php echo $v_assignment->post_id; ?>', '<?php echo $group_details->group_id; ?>')"><i class="fa fa-trash-o" title="Archive"></i></a>&nbsp;&nbsp;
                                <?php
                            }
                        }
                        ?>

                    </div>
                </div>
                <div class="col-sm-12"><br></div>
                <?php
            }
        }
        break;
    case 4:
        if ($group_photo_post) {
            foreach ($group_photo_post as $v_photo) {
                $file_path = 'content-library/' . $v_photo->url . '/' . $v_photo->post_details;
                ?>
                <div class="col-sm-12 gray text-center" >
                    <div class="col-sm-2" style="padding: 10px 0 0 0  "><a href="javascript:;" onclick="downloadAssignment('<?php echo $v_photo->post_id; ?>', '<?php echo $group_details->group_id; ?>')"> <img class="img-responsive" style="margin: 0 auto; max-height: 50px; max-width: 50px; cursor: pointer;" 
                                                                                                                                                                                                                 src="<?php echo base_url() . $file_path; ?>" 
                                                                                                                                                                                                                 alt="image File" ></a></div>
                    <div class="col-sm-4" style="padding: 10px 0 0 0  ">
                        <a href="<?php echo base_url() . 'view-content-group/' . $this->utility_model->encode_id($v_photo->post_id, '/', 'Tt') . '/2'; ?>"><?php echo $v_photo->post_file_original_name; ?></a>
                    </div>
                    <div class="col-sm-2" style="padding: 10px 0 0 0; cursor: pointer; color: #80c12c;" id="viewGroup<?php echo $v_photo->url ?>">
                        <?php echo $v_photo->person_first_name . ' ' . $v_photo->person_last_name; ?>
                    </div>
                    <div class="col-sm-2" style="padding: 10px 0 0 0  ">
                        <?php echo $v_photo->post_date_time; ?>
                    </div>

                    <div class="col-sm-2" style="padding: 10px 0 0 0  ">
                        <?php
                        $post_status = $v_photo->post_status;
                        if ($v_photo->posted_by == $user_id || $group_details->group_created_by == $user_id) {
                            if ($post_status != 2) {
                                ?>
                                <a href="#" onclick="return checkForDelete('<?php echo $v_photo->post_id; ?>', '<?php echo $group_details->group_id; ?>')"><i class="fa fa-trash-o" title="Delete"></i></a>&nbsp;&nbsp;
                                <?php
                            }
                        }
                        ?>
                    </div>
                </div>
                <div class="col-sm-12"><br></div>
                <?php
            }
        }
        break;
    case 5:
        if ($group_video_post) {
            foreach ($group_video_post as $v_video) {
                $file_path = 'content-library/' . $v_video->url . '/' . $v_video->post_details;
                ?>
                <div class="col-sm-12 gray text-center" >

                    <div class="col-sm-2" style="padding: 10px 0 0 0  "><a href="javascript:;" onclick="downloadAssignment('<?php echo $v_video->post_id; ?>', '<?php echo $group_details->group_id; ?>')"> 
                            <img src="<?php echo base_url() . 'image/assignment/video.png' ?>">
                        </a></div>
                    <div class="col-sm-4" style="padding: 10px 0 0 0  ">
                        <a href="<?php echo base_url() . 'view-content-group/' . $this->utility_model->encode_id($v_video->post_id, '/', 'Tt') . '/2'; ?>"><?php echo $v_video->post_file_original_name; ?></a>
                    </div>
                    <div class="col-sm-2" style="padding: 10px 0 0 0; cursor: pointer; color: #80c12c;" id="viewGroup<?php echo $v_video->url ?>">
                        <?php echo $v_video->person_first_name . ' ' . $v_video->person_last_name; ?>
                    </div>
                    <div class="col-sm-2" style="padding: 10px 0 0 0  ">
                        <?php echo $v_video->post_date_time; ?>
                    </div>

                    <div class="col-sm-2" style="padding: 10px 0 0 0  ">
                        <?php
                        $post_status = $v_video->post_status;
                        if ($v_video->posted_by == $user_id || $group_details->group_created_by == $user_id) {
                            if ($post_status != 2) {
                                ?>
                                <a href="#" onclick="return checkForDelete('<?php echo $v_video->post_id; ?>', '<?php echo $group_details->group_id; ?>')"><i class="fa fa-trash-o" title="Delete"></i></a>&nbsp;&nbsp;
                                <?php
                            }
                        }
                        ?>

                    </div>
                </div>
                <div class="col-sm-12"><br></div>
                <?php
            }
        }
        break;
}