$per_page = 1; // 3. total record count ($total_count) if ($new->visible == 1) { $total_count = News_Events::count_all(); } else { $total_count = News_Events::count_all_visible(); } // Find all photos // use pagination instead $pagination = new Pagination($page, $per_page, $total_count); // Instead of finding all records, just find the records // for this page $sql = "SELECT * FROM news_events ORDER BY `id` DESC "; $sql .= "LIMIT {$per_page} "; $sql .= "OFFSET {$pagination->offset()}"; $newsEvents = News_Events::find_by_sql($sql); // Need to add ?page=$page to all links we want to // maintain the current page (or store $page in $session) $counter = 1; ?> <ul> <?php foreach ($newsEvents as $item) { switch ($item->iType) { case 1: $icon = '<i class="icon-user"></i>'; break; case 2: $icon = '<i class="icon-user"></i>';
<br> <br> <!-- Content --> <div class="row-fluid"> <?php include_layout_template('admin_menu.php'); ?> <div class="span9"> <h2>News</h2> <hr> <?php $query = "SELECT * FROM news_events ORDER BY id DESC"; $result = News_Events::find_by_sql($query); $pagecounter = 1; $serialno = 1; $max = 10; $number_of_notifications = sizeof($result); echo '<div class="tabbable"> <div class="tab-content">'; foreach ($result as $row) { if ($serialno % $max == 1) { if ($pagecounter == 1) { echo '<div class="tab-pane active" id="' . $pagecounter . '">'; } else { echo '<div class="tab-pane" id="' . $pagecounter . '">'; } echo '<table class="table table-hover"> <thead>
$total_count = News_Events::count_all(); // Find all photos // use pagination instead $pagination = new Pagination($page, $per_page, $total_count); // Instead of finding all records, just find the records if (!empty($newsEvents)) { // for this page $sql = "SELECT * FROM news_events \r\n WHERE id != {$get_id}\r\n AND visible = 1\r\n AND verified_by !='' \r\n ORDER BY id DESC "; $sql .= "LIMIT {$per_page} "; $sql .= "OFFSET {$pagination->offset()}"; $news_query = News_Events::find_by_sql($sql); } else { $sql = "SELECT * FROM news_events \r\n WHERE visible = 1\r\n AND verified_by !='' \r\n ORDER BY id DESC "; $sql .= "LIMIT {$per_page} "; $sql .= "OFFSET {$pagination->offset()}"; $news_query = News_Events::find_by_sql($sql); } // Need to add ?page=$page to all links we want to // maintain the current page (or store $page in $session) $counter = 1; foreach ($news_query as $itemR) { ?> ffff <ul> <li style ="border"> <i class="icon-hand-right"></i> <a href="all_news.php?id=<?php echo customEncrypt($itemR->id); ?> "> <?php
<?php include_layout_template("header.php"); ?> <!-- beginnning of main content--> <div class="container"> <div class="row-fluid"> <div class="span7" > <h4>Welcome to University of Jos Online Form Portal</h4> <hr> <h3><i class="icon-bullhorn"></i> NEWS</h3> <?php $query = "SELECT * FROM news_events\r\n WHERE visible = 1\r\n AND verified_by !='' \r\n \r\n ORDER BY id DESC LIMIT 2"; //int_r($query); $newsEvents = News_Events::find_by_sql($query); foreach ($newsEvents as $item) { switch ($item->iType) { case 1: $icon = '<i class="icon-user"></i>'; break; case 2: $icon = '<i class="icon-user"></i>'; break; default: $icon = '<i class="icon-user"></i>'; break; } ?> <p align="justify" >
$news->created_time = date("H:i:s", $time); $news->last_update = date("Y-m-d H:i:s", $time); if ($news->save()) { echo '<h4 class="alert alert-success">Success</h4>'; echo '<hr>'; echo "<p>You have successfully added a new record into news event table</p>"; echo '<hr>'; } else { echo '<h4 class="alert alert-error">Error</h4>'; echo '<hr>'; echo "Failed to insert into news event table."; echo '<hr>'; } break; case 'update_news': $news = new News_Events(); $news->db_fields = array('title', 'display_line', 'content', 'visible', 'verified_by', 'last_update'); $news->id = customDecrypt($_POST['nid']); $news->title = $_POST['title']; $news->display_line = $_POST['display_line']; $news->content = $_POST['content']; $news->visible = $_POST['status']; $admin = AdminLog::find_by_id($_SESSION['applicant_id']); $news->verified_by = $admin->surname . " " . $admin->othernames; $time = time(); $news->last_update = date("Y-m-d H:i:s", $time); if ($news->save()) { echo '<h4 class="alert alert-success">Success</h4>'; echo '<hr>'; echo "<p>You have successfully updated news event table</p>"; echo '<hr>';
<?php require_once "../inc/initialize.php"; //checks if admin user is logged in if (!$session->is_admin_logged_in()) { redirect_to('index.php'); } if (isset($_POST['nid']) && !empty($_POST['nid'])) { $news = News_Events::find_by_id(customDecrypt($_POST['nid'])); // print_r($news->title); // die(); } ?> <!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>University of Jos, Nigeria</title> <?php require_once LIB_PATH . DS . 'css.php'; ?> </head> <body> <!-- beginnning of main content--> <!-- header --> <?php include_layout_template('admin_header.php'); ?> <!-- //header -->