<?php

include 'admin-config.php';
$pagecategory_id = $pagecategory_name = $pagecategory_url = $pagecategory_status = $error = "";
if (strlen(Request::post("submit"))) {
    $pagecategory_id = Request::post("pagecategory_id");
    $pagecategory_name = Request::post("pagecategory_name");
    $pagecategory_url = Request::post("pagecategory_url");
    $pagecategory_status = Validation::getStautsTinyVal(Request::post("active"));
    $pagecategoryObj = new pagecategory();
    $pagecategoryObj->set("pagecategory_id", $pagecategory_id);
    $pagecategoryObj->set("pagecategory_name", $pagecategory_name);
    $pagecategoryObj->set("pagecategory_url", $pagecategory_url);
    $pagecategoryObj->set("pagecategory_status", $pagecategory_status);
    if ($pagecategoryObj->save()) {
        General::redirectUrl("page_category.php");
    } else {
        $error = "Page Category Name alreday exist !";
    }
}
include 'header.php';
include 'sitebar.php';
?>
<div class="ch-container">
    <div class="row">

        <div id="content" class="col-lg-10 col-sm-10">
            <!-- content starts -->
            <div>
                <ul class="breadcrumb">
                    <li>
    </ul>
</div>

<div class="row">
    <div class="box col-md-12">
        <div class="box-inner">
            <div class="box-header well" data-original-title="">
                <h2><i class="glyphicon glyphicon-edit"></i>Add Menu Category </h2>

                
            </div>
            <div class="box-content">
                 <?php 
$id = Request::get("id");
if (is_numeric($id) && $id > 0) {
    $pagecategoryObj = new pagecategory();
    $pagecategoryObj->set("id", $id);
    $result = $pagecategoryObj->getName();
    if (count($result)) {
        $row = $result[0];
        $id = $row['id'];
        $name = $row['name'];
        $url = $row['url'];
        $pagecategory_status = $row['active'];
    }
}
?>
                <form action="" name="pagecategory" method="POST">
                    <table style="margin-left: 20%;" width="100%" >
                        <tr>
                            <td><label class="control-label" for="selectError"> Category_Name</label></td>