public function generate_content() { $CI =& get_instance(); $CI->load->model('visits'); $sequence = $CI->visits->populyar_post_by_visits(); $sections_font_color = $this->block->data('sections_font_color'); $sections_font_weight = $this->block->data('sections_font_weight'); $sections_font_size = $this->block->data('sections_font_size'); $sections_background_color = $this->block->data('sections_background_color'); $post_count = $this->block->data('post_count'); $alphabetical_order = $this->block->data('alphabetical_order'); $category = $this->block->data('category'); $sections_animation_type = $this->block->data('sections_animation_type'); $sections_animation_duration = $this->block->data('sections_animation_duration'); $sections_animation_event = $this->block->data('sections_animation_event'); $sections_animation_delay = $this->block->data('sections_animation_delay'); $settings[0][0] = 'category' . $this->block->get_id(); $settings[0][1] = $sections_animation_event; $settings[0][2] = $sections_animation_duration . ' ' . $sections_animation_delay . ' ' . $sections_animation_type; add_action("be_foot", generate_animation_events($settings)); $section_style = 'style=" background-color: ' . $sections_background_color . ' !important; "'; $section_link_style = 'style=" color: ' . $sections_font_color . ' !important; font-weight: ' . $sections_font_weight . ' !important; font-size: ' . $sections_font_size . ' !important; "'; $users = new User(); $all_posts = new Post(); $all_category = new Category(); $BuilderEngine = new BuilderEngine(); $recent_posts = $all_posts->order_by('time_created', 'desc'); if ($category == 'all' || intval($category) == 0) { $recent_posts = $recent_posts->get(); } else { $recent_posts = $recent_posts->get_where(array('category_id' => intval($category))); } $recent_post_limit = $BuilderEngine->get_option('be_blog_posts_per_page'); if ($recent_post_limit == '' || $recent_post_limit == 0) { $recent_post_limit = 5; } if (isset($post_count)) { if ($post_count == 'all') { $recent_post_limit = count($recent_posts->all); } else { $recent_post_limit = $post_count; } } if ($alphabetical_order == 'yes') { ksort($sequence); } $output = '<div class="row"> <div ' . $section_style . ' class="masonry-list">'; $i = 1; foreach ($sequence as $key => $value) { foreach ($recent_posts as $post) { if ($key == $post->slug) { if ($i <= $recent_post_limit) { $user = $users->get_by_id($post->user_id); $output .= ' <link href="' . base_url('blocks/category_posts/style.css') . '" rel="stylesheet"> <link href="' . base_url('builderengine/public/animations/css/animate.min.css') . '" rel="stylesheet" /> <div class="col-md-6" id="blog"> <li class="masonry-item-blog-category-post"> <div class="item" id="category' . $this->block->get_id() . '"> <div class="item-title blog-header-small"> <h2><a ' . $section_link_style . ' href="' . base_url('/blog/post') . '/' . $post->slug . '"> ' . $post->title . '</a></h2> <small class="space14">'; $post_comments = array(); $CI =& get_instance(); $CI->load->model('comment'); $comments = new Comment(); foreach ($comments->where('post_id', $post->id)->get() as $comment) { array_push($post_comments, $comment->id); } $num_comments = count($post_comments); $pluralizer = $num_comments == 1 ? 'Comment' : 'Comments'; $output .= ' <a href="/blog/post/' . $post->slug . '#comments" class="label label-default light"><i class="fa fa-comment-o"></i> ' . $num_comments . '' . $pluralizer . '</a> <span class="label label-default light">' . date('M d, Y', $post->time_created) . '</span> <a class="label label-default light pull-right"><i>Post by: </i> ' . $user->username . ' </a> </div> <figure> <a href="/blog/post/' . $post->slug . '"><img src="' . $post->image . '" class="img-responsive thumbnail" alt="" /></a> </figure>'; $text_without_slashes = ChEditorfix($post->text); if (strlen($post->text) > 300) { $text = substr($text_without_slashes, 0, 300) . '...'; } else { $text = $text_without_slashes; } $output .= '<div style="word-wrap: break-word;">' . $text . '</div> <a href="/blog/post/' . $post->slug . '" class="btn-primary btn-xs pull-right"><i class="fa fa-sign-out"></i> READ MORE..</a> </div> </li></div>'; $i++; } } } } $output .= ' </div></div>'; return $output; }
public function set_page_path($page_path) { self::$page_path = $page_path; $this->versions->load_page_blocks(); }
public function generate_content() { $sections_font_color = $this->block->data('sections_font_color'); $sections_font_weight = $this->block->data('sections_font_weight'); $sections_font_size = $this->block->data('sections_font_size'); $sections_background_color = $this->block->data('sections_background_color'); $post_count = $this->block->data('post_count'); $animation = $this->block->data('animation'); $animation_type = $this->block->data('animation_type'); $animation_duration = $this->block->data('animation_duration'); $animation_event = $this->block->data('animation_event'); $animation_delay = $this->block->data('animation_delay'); $settings[0][0] = 'recentitems' . $this->block->get_id(); $settings[0][1] = $animation_event; $settings[0][2] = $animation_duration . ' ' . $animation_delay . ' ' . $animation_type; add_action("be_foot", generate_animation_events($settings)); $section_style = 'style=" background-color: ' . $sections_background_color . ' !important; "'; $section_link_style = 'style=" color: ' . $sections_font_color . ' !important; font-weight: ' . $sections_font_weight . ' !important; font-size: ' . $sections_font_size . ' !important; "'; $CI =& get_instance(); $CI->load->model('post'); $all_posts = new Post(); $BuilderEngine = new BuilderEngine(); $recent_posts = $all_posts->order_by('time_created', 'desc'); $recent_post_limit = $BuilderEngine->get_option('be_blog_num_recent_posts_displayed'); if ($recent_post_limit == '' || $recent_post_limit == 0) { $recent_post_limit = 5; } if (isset($post_count)) { $recent_post_limit = $post_count; } $j = 1; $output = ' <link href=\\"/builderengine/public/animations/css/animate.min.css\\" rel=\\"stylesheet\\" /> <link href="' . base_url('blocks/recent_posts/style.css') . '" rel="stylesheet"> <div ' . $section_style . ' class="widgetblogrecent" id="blog"> <div id="recentitems' . $this->block->get_id() . '" class="masonry-item-blog-recent"> <h4>RECENT BLOGS</h4> <ul class="nav nav-list">'; foreach ($recent_posts->get() as $recent_post) { if ($j <= $recent_post_limit) { $output .= ' <li> <a ' . $section_link_style . ' href="' . base_url() . 'blog/post/' . $recent_post->slug . '"> <i class="fa fa-sign-out"></i> ' . $recent_post->title . '</a> <small>' . date('d.M.Y / h:i', $recent_post->time_created) . '</small> </li>'; $j++; } } $output .= ' </ul> </div> </div>'; return $output; }
public function generate_content() { $sections_font_color = $this->block->data('sections_font_color'); $sections_font_weight = $this->block->data('sections_font_weight'); $sections_font_size = $this->block->data('sections_font_size'); $sections_background_color = $this->block->data('sections_background_color'); $tags_count = $this->block->data('tags_count'); $alphabetical_order_tags = $this->block->data('alphabetical_order_tags'); $animation_type = $this->block->data('animation_type'); $animation_duration = $this->block->data('animation_duration'); $animation_event = $this->block->data('animation_event'); $animation_delay = $this->block->data('animation_delay'); $settings[0][0] = 'tags' . $this->block->get_id(); $settings[0][1] = $animation_event; $settings[0][2] = $animation_duration . ' ' . $animation_delay . ' ' . $animation_type; add_action("be_foot", generate_animation_events($settings)); $section_style = 'style=" background-color: ' . $sections_background_color . ' !important; "'; $section_link_style = 'style=" color: ' . $sections_font_color . ' !important; font-weight: ' . $sections_font_weight . ' !important; font-size: ' . $sections_font_size . ' !important; "'; $output = ' <link href="' . base_url('builderengine/public/animations/css/animate.min.css') . '" rel="stylesheet" /> <link href="' . base_url('blocks/tags/style.css') . '" rel="stylesheet"> <div ' . $section_style . ' class="widgetblogtags" id="blog"> <div id="tags' . $this->block->get_id() . '" class="masonry-item-blog-tags"> <h4>BLOG TAGS</h4>'; $BuilderEngine = new BuilderEngine(); $CI =& get_instance(); $CI->load->model('post'); $posts = new Post(); $posts = $posts->order_by('time_created', 'desc')->get(); $available_tags = array(); $set_limit = $BuilderEngine->get_option('be_blog_num_tags_displayed'); if ($set_limit == '' || $set_limit == 0) { $set_limit = 12; } foreach ($posts as $post) { $tags = explode(',', $post->tags); foreach ($tags as $tag) { array_push($available_tags, $tag); } } if (isset($tags_count)) { if ($tags_count == 'all') { $set_limit = count($available_tags); } else { $set_limit = $tags_count; } } $available_tags = array_unique($available_tags); $available_tags = array_slice($available_tags, 0, $set_limit); if ($alphabetical_order_tags == 'yes') { asort($available_tags); } foreach ($available_tags as $tag) { $output .= ' <a class="label label-default light tagsblock" href="' . base_url('blog/search/' . $tag) . '"><i class="fa fa-tags"></i> ' . $tag . '</a>'; } $output .= ' <div class="clearfix"></div> </div> </div>'; return $output; }
public function generate_content() { $CI =& get_instance(); $CI->load->model('visits'); $sequence = $CI->visits->populyar_post_by_visits(); $sections_font_color = $this->block->data('sections_font_color'); $sections_font_weight = $this->block->data('sections_font_weight'); $sections_font_size = $this->block->data('sections_font_size'); $sections_background_color = $this->block->data('sections_background_color'); $sections_animation_type = $this->block->data('sections_animation_type'); $sections_animation_duration = $this->block->data('sections_animation_duration'); $sections_animation_event = $this->block->data('sections_animation_event'); $sections_animation_delay = $this->block->data('sections_animation_delay'); $settings[0][0] = 'blog_list'; $settings[0][1] = $sections_animation_event; $settings[0][2] = $sections_animation_duration . ' ' . $sections_animation_delay . ' ' . $sections_animation_type; add_action("be_foot", generate_animation_events($settings)); $post_count = $this->block->data('post_count'); $alphabetical_order = $this->block->data('alphabetical_order'); $category = $this->block->data('category'); $section_style = 'style=" background-color: ' . $sections_background_color . ' !important; "'; $section_link_style = 'style=" color: ' . $sections_font_color . ' !important; font-weight: ' . $sections_font_weight . ' !important; font-size: ' . $sections_font_size . ' !important; "'; $all_posts = new Post(); $all_category = new Category(); $BuilderEngine = new BuilderEngine(); $recent_posts = $all_posts->order_by('time_created', 'desc'); // out(intval($category)); if ($category == 'all' || intval($category) == 0) { $recent_posts = $recent_posts->get(); } else { $recent_posts = $recent_posts->get_where(array('category_id' => intval($category))); } $recent_post_limit = $BuilderEngine->get_option('be_blog_num_recent_posts_displayed'); if ($recent_post_limit == '' || $recent_post_limit == 0) { $recent_post_limit = 5; } if (isset($post_count)) { if ($post_count == 'all') { $recent_post_limit = count($recent_posts->all); } else { $recent_post_limit = $post_count; } } if ($alphabetical_order == 'az') { //ok ksort($sequence); } if ($alphabetical_order == 'za') { //ok krsort($sequence); } if ($alphabetical_order == 'oldest') { $recent_posts = $all_posts->order_by('time_created', 'asc'); } if ($alphabetical_order == 'latest') { //ok rsort($sequence); } if ($alphabetical_order == 'updated') { $recent_posts = $all_posts->order_by('time_created', 'desc'); } if ($alphabetical_order == 'most_visited') { //ok arsort($sequence); } if ($alphabetical_order == 'less_visited') { //ok asort($sequence); } $output = ' <link href="' . base_url('blocks/blog_posts_list/style.css') . '" rel="stylesheet"> <div ' . $section_style . ' class="widgetbloglist" id="blog_list"> <div class="masonry-item-blog-list"> <h4>BLOG POSTS</h4> <ul class="nav nav-list">'; $j = 1; foreach ($sequence as $key => $value) { foreach ($recent_posts as $recent_post) { if ($key == $recent_post->slug) { if ($j <= $recent_post_limit) { $output .= ' <li> <a ' . $section_link_style . ' href="' . base_url() . 'blog/post/' . $recent_post->slug . '"> <i class="fa fa-sign-out"></i> ' . $recent_post->title . '</a> <small>' . date('d.M.Y / h:i', $recent_post->time_created) . '</small> </li>'; $j++; } } } } $output .= ' </ul> </div> </div>'; return $output; }
public function generate_content() { $post_id = $this->block->data('post'); $sections_font_color = $this->block->data('sections_font_color'); $sections_background_color = $this->block->data('sections_background_color'); $sections_animation_type = $this->block->data('sections_animation_type'); $sections_animation_duration = $this->block->data('sections_animation_duration'); $sections_animation_event = $this->block->data('sections_animation_event'); $sections_animation_delay = $this->block->data('sections_animation_delay'); $settings[0][0] = 'blog'; $settings[0][1] = $sections_animation_event; $settings[0][2] = $sections_animation_duration . ' ' . $sections_animation_delay . ' ' . $sections_animation_type; add_action("be_foot", generate_animation_events($settings)); $section_style = 'style=" background-color: ' . $sections_background_color . ' !important; "'; $section_link_style = 'style=" color: ' . $sections_font_color . ' !important; "'; $CI =& get_instance(); $CI->load->library('session'); $CI->load->library('form_validation'); $BuilderEngine = new BuilderEngine(); $user = new User(); $users = new Users(); $CI->load->model('post'); $post = $CI->post; $post = $post->where('id', $post_id)->get(); $CI->load->model('comment'); $comments = $CI->comment; $comments = $comments->where('post_id', $post->id)->get(); $pub_user = $user->get_by_id($post->user_id); $output = ' <link href="' . base_url('blocks/blog_posts/style.css') . '" rel="stylesheet"> <link href="' . base_url('builderengine/public/animations/css/animate.min.css') . '" rel="stylesheet" /> <div ' . $section_style . ' class="left" id="blog"> <li class="masonry-item"> <header class="blog-post"> <a href="' . base_url('blog/post') . '/' . $post->slug . '"> <h1 ' . $section_link_style . '>Blog: ' . $post->title . '</h1></a> <small class="space18">'; $post_comments = array(); foreach ($comments as $comment) { array_push($post_comments, $comment->id); } $count = count($post_comments); $pluralizer = $count == 1 ? 'Comment' : 'Comments'; $output .= ' <a href="' . base_url('blog/post') . '/' . $post->slug . '" class="scrollTo label label-default light"> <i class="fa fa-comment-o"></i> ' . $count . ' ' . $pluralizer . '</a> <span class="label label-default light">' . date('d.M.Y', $post->time_created) . '</span> <span class="label label-default pull-right"><span><i>Post by:</i></span> <span class="light" ><a href="#">' . $pub_user->username . '</a></span></span> </small> </header>'; if (!empty($post->image)) { $output .= ' <div class="item" style="padding-bottom:0px"> <a href="' . base_url('blog/post') . '/' . $post->slug . '"><img src="' . $post->image . '" class="img-responsive blogimage-fullwidth thumbnail" alt="img" /></a> </div>'; } $output .= ' <link href="' . base_url('blocks/blog_posts/style.css') . '" rel="stylesheet"> <article> ' . ChEditorfix($post->text) . ' </article> <hr />'; if ($BuilderEngine->get_option('be_blog_show_tags') != 'no') { $output .= ' <p class="space16"> <b>Blog Tags:</b>'; foreach ($post as $item) { if ($item->tags != '') { $tags = explode(',', $item->tags); foreach ($tags as $tag) { $output .= ' <a class="label label-default light" href="' . base_url('blog/search/' . $tag) . '" ><i class="fa fa-tags"></i> ' . $tag . '</a> '; } } else { $output .= '-'; } } $output .= ' </li> <div class="clearfix"></div> </p>'; } $output .= '<div class="divider"></div>'; $comments_alowed = 'no'; foreach ($post->stored as $key => $val) { if ($key == 'comments_allowed' && $val == 'yes') { $comments_alowed = 'yes'; } } // if($comments_alowed == 'yes' && $BuilderEngine->get_option('be_blog_allow_comments') != 'no'){ // $output .= ' // <div id="comments"> // <h4>'.$count.' '.$pluralizer.'</h4>'; // $i = 1; // foreach($comments as $comment){ // $output .= ' // <div class="comment"> // <span class="user-avatar">'; // if($comment->user_id == 0 || $comment->user_id == ''){ // $output .= '<img class="pull-left media-object" src="'.get_theme_path().'/images/avatars/no_avatar.jpg" width="64" height="64" alt="">'; // }else{ // $commenter = new User($comment->user_id); // $allow_avatar = new Setting(); // if(isset($allow_avatar->get_user_settings($comment->user_id)->all[0]->allow_avatar) && $allow_avatar->get_user_settings($comment->user_id)->all[0]->allow_avatar != 0) // $allow_avatar = 1; // else // $allow_avatar = 0; // if((!isset($commenter->avatar) || $commenter->avatar == '') || !intval($allow_avatar)){ // $output .= '<img class="pull-left media-object" src="'.get_theme_path().'/images/avatars/no_avatar.jpg" width="64" height="64" alt="">'; // }else{ // $output .= '<img class="pull-left media-object" src="'.base_url().''.$commenter->avatar.'" width="64" height="64" alt="">'; // } // } // $output .= ' // </span> // <div class="media-body"> // <h3 class="media-heading bold">'.$comment->name.'</h3> // <small class="block">'.date('d.M.Y - h:i',$comment->time_created).'</small> // <br/> // '.$comment->text.' // </div> // <div class="btn-group pull-right" role="group"> // <a href="#commentForm" data-toggle="modal" data-target="#report'.$i.'" class="btn btn-danger blogPostBtn">Report</a>'; // if($users->is_admin()){ // $output .= '<a href="javascript:;" data-id="'.$comment->id.'" class="btn btn-danger blogPostBtn delete-comment">Delete</a>'; // } // $output .= ' // </div> // <!-- Modal --> // <div class="modal fade" id="report'.$i.'" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> // <div class="modal-dialog" style="z-index:10"> // <div class="modal-content"> // <div class="modal-header"> // <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> // <h4 class="modal-title" id="myModalLabel">Report Comment</h4> // </div> // <form method="get" action="'.base_url('blog/report_comment').'"> // <div class="modal-body"> // <input type="hidden" name="comment_id" value="'.$comment->id.'"> // <p>Please describe what aspect of this comment or it`s author you find inadequate, inappropriate or insulting</p> // <div class="form-group"> // <textarea class="form-control" name="text" placeholder="Describe your reason for reporting this comment"></textarea> // </div> // </div> // <div class="modal-footer"> // <button type="button" class="btn btn-default blogPostBtn" data-dismiss="modal">Close</button> // <button type="submit" class="btn btn-primary blogPostBtn">Report</button> // </div> // </form> // </div> // </div> // </div> // </div>'; // $i++; // } // if($BuilderEngine->get_option('be_blog_comments_private') == 'private'){ // if(!($CI->session->userdata('user_id') == 0)){ // $output .= ' // <br/> // <div class="divider"></div> // <h4>Leave a comment</h4> // <form id="commentForm" action="'.base_url().'blog/post/'.$post->slug.'" class="form-horizontal" method="post"> // <input type="hidden" name="post_id" value="'.$post->id.'"> // <div class="row"> // <div class="col-md-12"> // <textarea required class="form-control input-lg" id="comment" name="text" rows="5" placeholder="Your Comment">'.$CI->form_validation->set_value('text').'</textarea> // '.form_error('text').' // </div> // </div> // <br>'; // $check_captcha = $BuilderEngine->get_option('be_blog_captcha') == 'yes'; // if($check_captcha){ // $output .= ' // <div class="row"> // <div class="col-md-2"> // <label>Captcha *</label> // </div> // <div class="col-md-3"> // <input required class="form-control input-lg" type="text" name="captcha" id="captcha" /> // </div> // <div class="col-md-4"> // '.$this->createCaptcha().' // </div> // <div class="clearfix"></div> // '.form_error('captcha').' // </div>'; // } // $output .= ' // <div class="row"> // <div class="col-md-12"> // <p><button class="btn btn-primary blogPostBtn">Post Comment</button></p> // </div> // </div> // </form>'; // } // }else{ // $output .= ' // <br/> // <div class="divider"></div> // <h4>Leave a comment</h4> // <form id="commentForm" class="form-horizontal" method="post"> // <div class="row"> // <input type="hidden" name="post_id" value="'.$post->id.'">'; // if($CI->session->userdata('user_id') == 0){ // $output .= ' // <div class="col-md-4"> // <label>Name *</label> // <input required class="form-control input-lg" type="text" name="name" id="author" value="'.$CI->form_validation->set_value('name').'" /> // '.form_error('name').' // </div>'; // } // $output .= ' // </div> // <div class="row"> // <div class="col-md-12"> // <textarea required class="form-control input-lg" id="comment" name="text" rows="5" placeholder="Your Comment">'.$CI->form_validation->set_value('text').'</textarea> // '.form_error('text').' // </div> // </div> // <br>'; // $check_captcha = $BuilderEngine->get_option('be_blog_captcha') == 'yes'; // if($check_captcha){ // $output .= ' // <div class="row"> // <div class="col-md-2"> // <label>Captcha *</label> // </div> // <div class="col-md-3"> // <input required class="form-control input-lg" type="text" name="captcha" id="captcha" /> // </div> // <div class="col-md-4"> // '.$this->createCaptcha().' // </div> // <div class="clearfix"></div> // '.form_error('captcha').' // </div>'; // } // $output .= ' // <div class="row"> // <div class="col-md-12"> // <p><button class="btn btn-primary">Post Comment</button></p> // </div> // </div> // </form>'; // } // $output .= '</div>'; // } $output .= '</div>'; if ($users->is_admin()) { $output .= ' <div class="modal fade" id="delete-comment" tabindex="-1" role="dialog" aria-hidden="true"> <div class="modal-dialog" style="z-index:10"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> <h4 class="modal-title">Delete comment</h4> </div> <form method="post" action="' . base_url('blog/deleteComment') . '"> <div class="modal-body"> <p>Are you sure you want to delete this comment?</p> <input type="hidden" name="comment_id"> </div> <div class="modal-footer"> <button type="button" class="btn btn-default blogPostBtn" data-dismiss="modal">Close</button> <button type="submit" class="btn btn-primary blogPostBtn">Delete</button> </div> </form> </div> </div> </div> '; } return $output; }