Example #1
0
 public function index()
 {
     $all_categories = Category::get_all();
     echo "<pre>";
     print_r($all_categories);
     echo "</pre>";
     exit;
 }
        $last = Category::create(array('name' => $p_name, 'slug' => $p_slug), $p_parent);
    }
}
if (isset($_POST['category_slug_generate'])) {
    $p_parent = (int) $_POST['parent'];
    $p_name = trim($_POST['name']);
    $success = false;
    $errors = array();
    if ($p_name == '' || $p_name != '' && !preg_match('/^[\\w- ]*$/u', $p_name)) {
        $success = false;
        array_push($errors, "Invalid name!");
    } else {
        $p_slug = slug($p_name);
    }
}
$categories = Category::get_all(array('parent' => 0));
include "page-header.php";
?>

<div id="wrapper">

	<?php 
include "page-left.php";
?>

	<div id="content">
			
		<form name="form_category_create" id="form_category_create" method="post" enctype='application/x-www-form-urlencoded' accept-charset="UTF-8" class="form">

			<h2><?php 
print $current_sub_page['name'] . ' ' . $current_group_page['name'];
if (isset($_GET['o'])) {
    $o = (int) $_GET['o'];
    $r = (int) $_GET['r'];
    if ($r != 0) {
        $r = 1;
    }
    Category::set_order($o, $parent, $r);
}
$tct = Category::count(array('parent' => $parent));
//total count
$rpp = 10;
//row per page
$pager_options = array('mode' => 'Sliding', 'perPage' => $rpp, 'delta' => 2, 'totalItems' => $tct, 'urlVar' => "pageID{$parent}", 'excludeVars' => array('o', 'r', 'd', 't', 'e'));
$pager = @Pager::factory($pager_options);
list($from, $to) = $pager->getOffsetByPageId();
$categories = Category::get_all(array('r.parent' => $parent), '', $from - 1 . ", {$rpp}");
include "page-header.php";
?>

<div id="wrapper">
	
	<?php 
include "page-left.php";
?>

	<div id="content">

		<?php 
if ($tct > $rpp) {
    echo $pager->links . '<br /><br />';
}