function change_publish_status() { $comments_model = new Comments_model(); $comments_service = new Comments_service(); $comments_model->set_id(trim($this->input->post('id', TRUE))); $comments_model->set_is_published(trim($this->input->post('value', TRUE))); echo $comments_service->publish_comment($comments_model); }
function add_website_comments() { $comments_service = new Comments_service(); $comments_model = new Comments_model(); $comments_model->set_description($this->input->post('description', TRUE)); $comments_model->set_title($this->input->post('title', TRUE)); $comments_model->set_added_date(date("Y-m-d H:i:s")); $comments_model->set_added_by($this->session->userdata('USER_ID')); $comments_model->set_is_published('1'); $comments_model->set_is_deleted('0'); $comments_service->add_website_comments($comments_model); $website_comments = $comments_service->get_all_comments_list(); foreach ($website_comments as $value) { ?> <li class="comment"><br> <figure><br><br> <div class="image"> <?php if ($value->profile_pic == '') { ?> <img class="img-responsive img-circle" style="width:100px; height:50px;" src="<?php echo base_url() . 'uploads/user_avatars/avatar.png'; ?> "/> <?php } else { ?> <img class="img-responsive img-circle" style="width:100px; height:50px;" src="<?php echo base_url() . 'uploads/user_avatars/' . $value->profile_pic; ?> "/> <?php } ?> </div> </figure> <div class="comment-wrapper"> <?php if ($value->added_by_user != '') { ?> <div class="name pull-left"><?php echo ucfirst($value->added_by_user); ?> </div> <?php } ?> <span class="date pull-right"><br><br><br><br> <span class="fa fa-calendar"></span> <?php echo date('Y.m.d', strtotime($value->added_date)); ?> </span> <p><header><a href="blog-detail.html"><h2><?php echo $value->title; ?> </h2></a></header> <?php echo $value->description; ?> </p> </div> </li> <?php } }