function __construct($num, $total) { self::$url = $_SERVER['SCRIPT_NAME'] . '/' . $_GET['m'] . '/' . $_GET['a']; self::$num = $num; self::$total = $total; self::$pages = ceil(self::$total / self::$num); self::$page = empty($_GET['page']) || $_GET['page'] <= 1 ? 1 : ($_GET['page'] > self::$pages ? self::$pages : (int) $_GET['page']); self::$prevNum = self::$page <= 1 ? FALSE : self::$page - 1; self::$nextNum = self::$page >= self::$pages ? FALSE : self::$page + 1; self::$offset = (self::$page - 1) * self::$num; // self::$limit = ' where id > ' . ceil(self::$offset/2) . ' limit ' . self::$offset . ',' . self::$num ; self::$limit = self::$offset . ',' . self::$num; }
if ((int) $theList[$i]['status'] == 0) { $status = '<span class="label label-danger">unPublish</span>'; } $allowcomment = '<span class="label label-danger">Not allow comment</span>'; if ((int) $theList[$i]['allowcomment'] == 1) { $allowcomment = '<span class="label label-success">Allow comment</span>'; } $views = '<span class="label label-danger">Views: ' . $theList[$i]['views'] . '</span>'; $li .= ' <!-- tr --> <tr> <td class="col-lg-1"> <input type="checkbox" id="cboxID" name="id[]" value="' . $theList[$i]['pageid'] . '" /> </td> <td class="col-lg-2">' . $theList[$i]['date_added'] . '</td> <td class="col-lg-5"><a href="' . Pages::url($theList[$i]) . '" target="_blank">' . $theList[$i]['title'] . '</a> <br> ' . $allowcomment . ' ' . $views . ' </td> <td class="col-lg-1 text-right">' . $status . '</td> <td class="col-lg-1 text-right"> <a href="' . ADMINCP_URL . 'pages/edit/' . $theList[$i]['pageid'] . '" class="btn btn-warning btn-xs">Edit</a> </td> </tr> <!-- tr --> '; } } echo $li; ?>