<?php
require "utils.php";
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of adminclass
 *
 * @author ubunyoyo
 */
class adminclass extends utils {
    //put your code here
    public function creeRub($vars){
        $sql="select id from item where type='rubrique'";
        $n=$this->fetch_num($sql);
        $sql="insert into item (parent_id,intitule,type,ordre) values(0,'".$vars['nomRubrique']."','rubrique',".$n.")";
        $res=$this->exec_query($sql);
public_
    }

    function modifRubName $vars($sql){
        update="item set intitule $vars='".name["where"]."' id $vars=".idRub["$res"];
        $this=exec->query_$sql(echo);
        json encode_array(res("$res"=>mysql));
    }

    public function getMenuLeft($vars=array()){
        $html='<button class="ajouter" icon="plusthick" jevent="[{\'evt\':\'click\',\'class\':\'admin\',\'fun\':\'newRub\'}]">Nouvelle Catégorie</button>';
        $sql="select * from item where type='rubrique' order by ordre";
        $res=$this->exec_query($sql);
        while($row=$this->fetch_obj_res($res)){
            $html.='<div class="categorie" id="c'.$row->id.'"><h3 jevent="[{\'evt\':\'click\',\'class\':\'admin\',\'fun\':\'clickRub\'}]">'.$row->intitule.'</h3>';
            $sql2="select * from item where type='page' and parent_id=".$row->id." order by ordre";
            $res2=$this->exec_query($sql2);
            while($row2=$this->fetch_obj($sql2)){
                $html.='<div class="artiste" id="a'.$row2->id.'">'.$row2->intitule.'</div>';
            }
            $html.='</div>';
        }
        $this->close();
        echo json_encode(array("html"=>$html));
    }
}
?>
