本文整理汇总了PHP中categories::save方法的典型用法代码示例。如果您正苦于以下问题:PHP categories::save方法的具体用法?PHP categories::save怎么用?PHP categories::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类categories
的用法示例。
在下文中一共展示了categories::save方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create_categ
function create_categ($th, $num_parent, $libelle, $index, $num_aut = '')
{
//global $thes;
$n = new noeuds();
$n->num_thesaurus = $th->id_thesaurus;
$n->num_parent = $num_parent;
$n->autorite = $num_aut;
$n->save();
$c = new categories($n->id_noeud, 'fr_FR');
$c->libelle_categorie = $libelle;
$c->index_categorie = $index;
$c->save();
return $n->id_noeud;
}
示例2: actionCreate
/**
* Creates a new category in the database
*
* If no data has been posted, a form with the needed fields will be rendered. If the data has
* been posted, an attempt will be made to save. If successful, the user will be redirected to the
* 'view' page for the new record, otherwise they will be notified of the failure.
*/
public function actionCreate()
{
if (isset($_POST['model'])) {
//check if data has been posted
$model = new categories($_POST['model']);
if ($model->save()) {
//redirect to category details page if successful
testProject::setAlert('The category ' . $model->name . ' was successfully created.', 'success');
$this->redirect('categories/view/' . $model->id);
} else {
//create the alert message to notify of failure
testProject::setAlert('We\'re sorry, but your changes could not be saved. Please try again.', 'danger');
}
} else {
$this->render('create');
}
}
示例3: actionCreateCategory
public function actionCreateCategory()
{
$errors = array();
$apiAttributes = array('name' => '', 'description' => '');
$attributes = array_intersect_key($_GET, $apiAttributes);
$category = new categories($attributes);
if (!$category->validate()) {
$errors = $category->getValidationErrors();
}
if (!$errors) {
if (!$category->save()) {
$errors[] = 'The category could not be saved';
} else {
$attributes = array('id', 'name', 'created', 'modified', 'description');
$data = array($this->returnValues($category, $attributes));
}
}
if ($errors) {
$this->renderApi(false, null, $errors);
} else {
$this->renderApi(true, $data);
}
}
示例4: noeuds
static function build_categ($tab_categ, $id_thes, $id_parent, $do_lien = true, $do_create = true)
{
global $incr_categ, $notice_id, $lang;
if (trim($tab_categ)) {
$resultat = categories::searchLibelle(addslashes($tab_categ), $id_thes, $lang, $id_parent);
if (!$resultat && $id_parent && $do_create) {
// création de la catégorie
$n = new noeuds();
$n->num_parent = $id_parent;
$n->num_thesaurus = $id_thes;
$n->save();
$resultat = $id_n = $n->id_noeud;
$c = new categories($id_n, $lang);
$c->libelle_categorie = $tab_categ;
$c->save();
}
// ajout de l'indexation à la notice dans la table notices_categories
if ($do_lien && $resultat && $notice_id) {
$incr_categ++;
$rqt_ajout = "insert IGNORE into notices_categories set notcateg_notice='" . $notice_id . "', num_noeud='" . $resultat . "', ordre_categorie='" . $incr_categ . "' ";
pmb_mysql_query($rqt_ajout);
}
return $resultat;
}
return 0;
}
示例5: create_categ
function create_categ($tab_categ, $id_thes, $id_parent, $create_node = true)
{
global $lang;
if (trim($tab_categ)) {
$resultat = categories::searchLibelle(addslashes($tab_categ), $id_thes, $lang, $id_parent);
if (!$resultat && $id_parent && $create_node) {
// création de la catégorie
$n = new noeuds();
$n->num_parent = $id_parent;
$n->num_thesaurus = $id_thes;
$n->save();
$resultat = $id_n = $n->id_noeud;
$c = new categories($id_n, $lang);
$c->libelle_categorie = $tab_categ;
$c->save();
}
return $resultat;
}
return 0;
}
示例6: add_categ
function add_categ($term, $id_thesaurus, $non_classes, $lang)
{
$n = new noeuds();
$n->num_thesaurus = $id_thesaurus;
$n->num_parent = $non_classes;
$n->save();
$c = new categories($n->id_noeud, $lang);
$c->libelle_categorie = $term;
$c->index_categorie = ' ' . strip_empty_words($term) . ' ';
$c->save();
return $n->id_noeud;
}
示例7: import_new_notice_suite
//.........这里部分代码省略.........
$bulletin_id = $bulletin->update($info);
}
//Passage de la notice en article
$requete = "UPDATE notices SET niveau_biblio='a', niveau_hierar='2', npages='" . addslashes($info_464[0]['p']) . "' WHERE notice_id={$notice_id}";
mysql_query($requete);
$requete = "INSERT INTO analysis (analysis_bulletin,analysis_notice) VALUES({$bulletin_id},{$notice_id})";
mysql_query($requete);
$bulletin_ex = $bulletin_id;
} else {
$bulletin_ex = 0;
}
//Traitement du thésaurus
if ($m_thess > 1) {
//on est en multi-thesaurus
for ($i = 0; $i < count($info_606_a); $i++) {
for ($j = 0; $j < count($info_606_a[$i]); $j++) {
$descripteur_tete = $info_606_a[$i][$j];
$descripteur_fils = $info_606_x[$i][$j];
//Recherche du thésaurus
$thes_id = trouve_thesaurus($descripteur_tete);
//Recherche du terme fils
if ($thes_id > 0) {
$categ_id_fils = categories::searchLibelle(addslashes(trim($descripteur_fils)), $thes_id, "fr_FR");
if (!$categ_id_fils) {
//Création
$new_thes = $thes_id == 1 ? 4 : $thes_id;
//Choix du thesaurus Candidats descripteurs si descripteur inexistant
$categ_id_fils = categories::searchLibelle(addslashes(trim($descripteur_fils)), $new_thes, "fr_FR");
if (!$categ_id_fils) {
$noeud = new noeuds();
$noeud->num_thesaurus = $new_thes;
$thesau = new thesaurus($new_thes);
$noeud->num_parent = $thesau->num_noeud_racine;
$noeud->save();
$categ_id_fils = $noeud->id_noeud;
//Création du libellé
$categ = new categories($noeud->id_noeud, 'fr_FR');
$categ->libelle_categorie = $descripteur_fils;
$categ->index_categorie = " " . strip_empty_words($descripteur_fils) . " ";
$categ->save();
}
}
$requete = "INSERT INTO notices_categories (notcateg_notice, num_noeud, ordre_categorie) VALUES ({$notice_id},{$categ_id_fils}, " . ($i + 1) . ")";
mysql_query($requete);
}
}
}
//for($i
} else {
//Traitement du thésaurus unique
for ($i = 0; $i < count($info_606_a); $i++) {
for ($j = 0; $j < count($info_606_a[$i]); $j++) {
$descripteur_tete = $info_606_a[$i][$j];
$descripteur_fils = $info_606_x[$i][$j];
//Recherche du terme de tête
//$requete="SELECT num_noeud FROM categories WHERE libelle_categorie='".addslashes($descripteur_tete)."' AND langue='fr_FR'";
$requete = "SELECT id_noeud FROM noeuds WHERE autorite='" . addslashes($descripteur_tete) . "'";
$resultat = mysql_query($requete);
if (@mysql_num_rows($resultat)) {
//la tête existe !
$categ_id_tete = mysql_result($resultat, 0, 0);
} else {
//Création de la tête
//Nouveau Noeud !
$th = new thesaurus(1);
$noeud = new noeuds();
示例8: create_categ_cpt_rameau_first_level
function create_categ_cpt_rameau_first_level($num_parent, $libelle, $index)
{
global $thes;
$n = new noeuds();
$n->num_thesaurus = $thes->id_thesaurus;
$n->num_parent = $num_parent;
$n->save();
$c = new categories($n->id_noeud, 'fr_FR');
$c->libelle_categorie = $libelle;
$c->index_categorie = $index;
$c->save();
return $n->id_noeud;
}
示例9: thesaurus
$thes = new thesaurus($id_thes);
if ($aj == 'add' && SESSrights & THESAURUS_AUTH) {
// on arrive du formulaire d'ajout à la volée
if (!strlen($category_parent)) {
$category_parent_id = $thes->num_noeud_racine;
}
$category_voir_id = 0;
$noeud = new noeuds();
$noeud->num_parent = $category_parent_id;
$noeud->num_thesaurus = $thes->id_thesaurus;
$noeud->save();
$cat = new categories($noeud->id_noeud, $thes->langue_defaut);
$cat->libelle_categorie = stripslashes($category_libelle);
$cat->note_application = stripslashes($category_comment);
$cat->index_categorie = " " . strip_empty_words($cat->libelle_categorie) . " ";
$cat->save();
if ($thesaurus_mode_pmb && $caller == 'notice') {
$nom_tesaurus = '[' . $thes->getLibelle() . '] ';
} else {
$nom_tesaurus = '';
}
$browser_content = "<a href='#' {$java_comment} onclick=\"set_parent('{$caller}', '{$noeud->id_noeud}', '" . htmlentities(addslashes($nom_tesaurus . $cat->libelle_categorie), ENT_QUOTES, $charset) . "','{$callback}','" . $cat->num_thesaurus . "')\">";
$browser_content .= $cat->libelle_categorie;
$browser_content .= "</a>";
}
// nombre de références par pages
if ($nb_per_page_author != "") {
$nb_per_page = $nb_per_page_author;
} else {
$nb_per_page = 10;
}
示例10: import_new_notice_suite
function import_new_notice_suite()
{
global $info_461, $info_463, $info_530;
global $info_900, $info_901, $tit_200a;
global $info_215, $titre_ppal_200, $champ_210, $titre_perio_530a;
global $info_606_a, $info_897;
global $notice_id;
global $bull_id;
global $bl, $hl;
echo "<pre>";
$bull_id = 0;
//cas d'un article
if ($bl == "a" && $hl == "2") {
//on peut pas découper une date, on a pas de date mais une mention
if (decoupe_date($info_463[0]["d"]) == 0 && clean_string($info_463[0]["e"]) == "") {
$info_463[0]["e"] = $info_463[0]["d"];
$info_463[0]["d"] = "";
}
$bulletin = array('titre' => clean_string($info_463[0]["t"]), 'date' => decoupe_date($info_463[0]["d"]), 'mention' => clean_string($info_463[0]["e"]), 'num' => clean_string($info_463[0]["v"]));
$perio = array('titre' => $info_461[0]['t'], 'code' => $info_461[0]['x']);
notice_to_article($perio, $bulletin);
$update = " update notices set typdoc='t' where notice_id = {$notice_id}";
mysql_query($update);
//cas d'un bulletin
} else {
if ($bl == "s" && $hl == "2") {
if (decoupe_date($champ_210[0]['h']) == 0 && clean_string($titre_ppal_200[0]['h']) == "") {
$titre_ppal_200[0]['h'] = $champ_210[0]['h'];
$champ_210[0]['h'] = "";
}
$bulletin = array('titre' => clean_string($titre_ppal_200[0]['i']), 'date' => decoupe_date($champ_210[0]['h']), 'mention' => clean_string($champ_210[0]['d']), 'num' => clean_string($titre_ppal_200[0]['h']));
$perio = array('titre' => $info_461[0]['t'], 'code' => $info_461[0]['x']);
$bull_id = genere_bulletin($perio, $bulletin);
$update = " update notices set typdoc='t' where notice_id = {$notice_id}";
mysql_query($update);
}
}
//on s'occupe des descripteurs;
$id_thesaurus = 1;
$non_classes = 3;
$lang = "fr_FR";
$ordre_categ = 0;
foreach ($info_606_a as $terms) {
foreach ($terms as $term) {
$categ_id = categories::searchLibelle(addslashes($term), $id_thesaurus, $lang);
if ($categ_id) {
//le terme existe
$noeud = new noeuds($categ_id);
if ($noeud->num_renvoi_voir) {
$categ_to_index = $noeud->num_renvoi_voir;
} else {
$categ_to_index = $categ_id;
}
} else {
//le terme est à créé
$n = new noeuds();
$n->num_thesaurus = $id_thesaurus;
$n->num_parent = $non_classes;
$n->save();
$c = new categories($n->id_noeud, $lang);
$c->libelle_categorie = $term;
$c->index_categorie = ' ' . strip_empty_words($term) . ' ';
$c->save();
$categ_to_index = $n->id_noeud;
}
$requete = "INSERT INTO notices_categories (notcateg_notice,num_noeud,ordre_categorie) VALUES({$notice_id},{$categ_to_index},{$ordre_categ})";
mysql_query($requete);
$ordre_categ++;
}
}
//on traite le commentaire de gestion
$up = "update notices set commentaire_gestion = '" . addslashes($info_901[0][0]) . "' where notice_id = {$notice_id}";
mysql_query($up);
//traitement des Champs perso
//classique on commence par cherché l'id
foreach ($info_900 as $champperso) {
$champ = array('libelle' => $champperso['l'], 'nom' => $champperso['n'], 'value' => $champperso['a']);
recup_champ_perso($champ, "notices", $notice_id);
}
//gestion des 897$...
foreach ($info_897 as $docnum) {
//si on a pas d'url, on traite pas
if ($docnum['u']) {
//on reprend pas les site web...
if ($docnum['m'] != "text/html") {
$doc = array('titre' => clean_string($docnum['a']), 'mimetype' => $docnum['m'], 'nom_fic' => clean_string($docnum['f']), 'url' => $docnum['u']);
create_docnum($doc);
}
}
}
echo "</pre>";
}
示例11: do_thesaurus_ascodocpsy
function do_thesaurus_ascodocpsy($id_thesaurus, $nom_categ, $branch_values = array(), $lang = 'fr_FR', $ordre_categ = 0)
{
global $notice_id;
$res = pmb_mysql_query("select id_noeud from noeuds where autorite='TOP' and num_thesaurus='" . $id_thesaurus . "'");
if ($res && pmb_mysql_num_rows($res)) {
$parent_thes = pmb_mysql_result($res, 0, 0);
} else {
return;
}
$rqt = "select id_noeud from noeuds join categories on id_noeud=num_noeud and libelle_categorie='" . $nom_categ . "' and num_parent='" . $parent_thes . "'";
$res = pmb_mysql_query($rqt);
if ($res && pmb_mysql_num_rows($res)) {
$num_parent = pmb_mysql_result($res, 0, 0);
foreach ($branch_values as $terms) {
foreach ($terms as $term) {
$categ_id = categories::searchLibelle(addslashes($term), $id_thesaurus, $lang, $num_parent);
if ($categ_id) {
//le terme existe
$noeud = new noeuds($categ_id);
if ($noeud->num_renvoi_voir) {
$categ_to_index = $noeud->num_renvoi_voir;
} else {
$categ_to_index = $categ_id;
}
} else {
//le terme est à créé
$n = new noeuds();
$n->num_thesaurus = $id_thesaurus;
$n->num_parent = $num_parent;
$n->save();
$c = new categories($n->id_noeud, $lang);
$c->libelle_categorie = $term;
$c->index_categorie = ' ' . strip_empty_words($term) . ' ';
$c->save();
$categ_to_index = $n->id_noeud;
}
$requete = "INSERT INTO notices_categories (notcateg_notice,num_noeud,ordre_categorie) VALUES({$notice_id},{$categ_to_index},{$ordre_categ})";
pmb_mysql_query($requete);
$ordre_categ++;
}
}
}
}
示例12: save
function save()
{
global $dbh;
global $msg;
if ($this->libelle_thesaurus == '') {
die("Erreur de création thésaurus");
}
if ($this->langue_defaut == '') {
$this->langue_defaut = 'fr_FR';
}
if ($this->id_thesaurus) {
//mise à jour thesaurus
$q = "update thesaurus set libelle_thesaurus = '" . $this->libelle_thesaurus . "' ";
$q .= ", active = '" . $this->active . "' ";
$q .= ", opac_active = '" . $this->opac_active . "' ";
$q .= ", langue_defaut = '" . $this->langue_defaut . "' ";
$q .= "where id_thesaurus = '" . $this->id_thesaurus . "' ";
$r = pmb_mysql_query($q, $dbh);
} else {
//création thesaurus
$q = "insert into thesaurus set libelle_thesaurus = '" . $this->libelle_thesaurus . "', active = '1', opac_active = '1', langue_defaut = '" . $this->langue_defaut . "' ";
$r = pmb_mysql_query($q, $dbh);
$this->id_thesaurus = pmb_mysql_insert_id($dbh);
//creation noeud racine
$noeud = new noeuds();
$noeud->autorite = 'TOP';
$noeud->num_parent = 0;
$noeud->num_renvoi_voir = 0;
$noeud->visible = '0';
$noeud->num_thesaurus = $this->id_thesaurus;
$noeud->save();
$this->num_noeud_racine = $noeud->id_noeud;
//rattachement noeud racine au thesaurus
$q = "update thesaurus set num_noeud_racine = '" . $this->num_noeud_racine . "' ";
$q .= "where id_thesaurus = '" . $this->id_thesaurus . "' ";
$r = pmb_mysql_query($q, $dbh);
//creation noeud orphelins
$noeud = new noeuds();
$noeud->autorite = 'ORPHELINS';
$noeud->num_parent = $this->num_noeud_racine;
$noeud->num_renvoi_voir = 0;
$noeud->visible = '0';
$noeud->num_thesaurus = $this->id_thesaurus;
$noeud->save();
$this->num_noeud_orphelins = $noeud->id_noeud;
//Creation catégorie orphelins langue par défaut
$categ = new categories($this->num_noeud_orphelins, $this->langue_defaut);
$categ->libelle_categorie = $msg["thes_orphelins"];
$categ->save();
//creation noeud non classes;
$noeud = new noeuds();
$noeud->autorite = 'NONCLASSES';
$noeud->num_parent = $this->num_noeud_racine;
$noeud->num_renvoi_voir = 0;
$noeud->visible = '0';
$noeud->num_thesaurus = $this->id_thesaurus;
$noeud->save();
$this->num_noeud_nonclasses = $noeud->id_noeud;
//Creation catégorie non classes langue par défaut
$categ = new categories($this->num_noeud_nonclasses, $this->langue_defaut);
$categ->libelle_categorie = $msg["thes_non_classes"];
$categ->save();
}
}
示例13: update
function update($data, $id_thesaurus, $num_parent, $lang)
{
$lang = strtolower($lang);
switch ($lang) {
case "fr":
case "fre":
case "français":
case "francais":
case "french":
$lang = "fr_FR";
break;
default:
$lang = "fr_FR";
break;
}
if ($data['label'] == "") {
return 0;
}
if ($num_parent) {
//Le noeud parent doit être dans le même thésaurus
$req = "SELECT id_noeud FROM noeuds WHERE id_noeud='" . $num_parent . "' AND num_thesaurus='" . $id_thesaurus . "'";
$res = pmb_mysql_query($req);
if ($res && !pmb_mysql_num_rows($res)) {
return 0;
}
}
if ($this->id == 0) {
$query = "select * from thesaurus where id_thesaurus = " . $id_thesaurus;
$result = pmb_mysql_query($query);
if (pmb_mysql_num_rows($result)) {
$row = pmb_mysql_fetch_object($result);
//création
$n = new noeuds();
$n->num_parent = $num_parent != 0 ? $num_parent : $row->num_noeud_racine;
$n->num_thesaurus = $id_thesaurus;
$n->save();
$id = $n->id_noeud;
$c = new categories($id, $lang);
$c->libelle_categorie = $data['label'];
$c->note_application = $data['note'];
$c->comment_public = $data['comment'];
$c->save();
$this->id = $c->num_noeud;
return 1;
}
} else {
$c = new categories($this->id, $lang);
$c->libelle_categorie = $data['label'];
$c->note_application = $data['note'];
$c->comment_public = $data['comment'];
$c->save();
return 1;
}
}
示例14: import_new_notice_suite
function import_new_notice_suite()
{
global $id_unimarc, $info_100, $notice_id, $info_606_a, $info_606_9, $info_900, $info_950, $info_951;
global $suffix, $isbn_OK, $from_file, $thesaurus_defaut;
global $bibliographic_level, $hierarchic_level;
if (trim($info_100[0])) {
$date = decoupe_date(substr($info_100[0], 0, 8));
$requete = "update notices set create_date = '" . addslashes($date) . "' where notice_id='" . $notice_id . "' ";
mysql_query($requete);
/*if(!mysql_query($requete)){
echo "requete echoué : ".$requete."<br>";
}*/
}
$incr_categ = 0;
if (count($info_606_a)) {
$thes = new thesaurus($thesaurus_defaut);
for ($i = 0; $i < count($info_606_a); $i++) {
if ($libelle = trim($info_606_a[$i][0])) {
//echo "ici : ".$info_606[$i]["a"]."<br>";
$trouve = false;
$id_noeud = 0;
foreach ($info_606_9[$i] as $value) {
if (preg_match("/^id:([0-9]+)\$/", $value, $matches)) {
$id_noeud = $matches[1];
break;
}
}
if ($id_noeud) {
if (categories::exists($id_noeud, "fr_FR")) {
//echo "la : ".$info_606[$i]["a"]."<br>";
$categ = new categories($id_noeud, "fr_FR");
if ($categ->libelle_categorie == $libelle) {
//echo "ou la : ".$info_606[$i]["a"]."<br>";
// ajout de l'indexation à la notice dans la table notices_categories
$rqt_ajout = "insert into notices_categories set notcateg_notice='" . $notice_id . "', num_noeud='" . $categ->num_noeud . "', ordre_categorie='" . $incr_categ . "' ";
$res_ajout = @mysql_query($rqt_ajout);
$incr_categ++;
$trouve = true;
}
}
}
if (!$trouve) {
//Je regarde si il y a une autre catégorie avec ce libellé dans les thésaurus
$q = "SELECT id_noeud from noeuds JOIN categories ON noeuds.id_noeud = categories.num_noeud WHERE categories.libelle_categorie = '" . addslashes($libelle) . "'";
$res = mysql_query($q);
if ($res) {
if (mysql_num_rows($res) == 1) {
$rqt_ajout = "insert into notices_categories set notcateg_notice='" . $notice_id . "', num_noeud='" . mysql_result($res, 0, 0) . "', ordre_categorie='" . $incr_categ . "' ";
$res_ajout = @mysql_query($rqt_ajout);
$incr_categ++;
} elseif (mysql_num_rows($res) > 1) {
$mon_msg = "Catégorie non reprise car elle est présente plusieurs fois dans les thésaurus de PMB: " . $libelle;
affiche_mes_erreurs($mon_msg);
} else {
$n = new noeuds();
$n->num_parent = $thes->num_noeud_racine;
$n->num_thesaurus = $thesaurus_defaut;
$n->save();
$resultat = $id_n = $n->id_noeud;
$c = new categories($id_n, $thes->langue_defaut);
$c->libelle_categorie = $libelle;
$c->save();
$rqt_ajout = "insert into notices_categories set notcateg_notice='" . $notice_id . "', num_noeud='" . $id_n . "', ordre_categorie='" . $incr_categ . "' ";
$res_ajout = @mysql_query($rqt_ajout);
$incr_categ++;
$mon_msg = "Catégorie créée à la racine du thésaurus par défaut: " . $libelle;
affiche_mes_erreurs($mon_msg);
}
}
}
}
}
}
if ($bibliographic_level == "s" && $hierarchic_level == "1" && count($info_950)) {
foreach ($info_950 as $value) {
//Emplacement
if (!$value["c"]) {
$mon_msg = "Etat de collection non importé car pas d'emplacement pour le périodique: " . $id_unimarc;
affiche_mes_erreurs($mon_msg);
continue;
}
$requete = "SELECT archempla_id FROM arch_emplacement WHERE archempla_libelle='" . addslashes($value["c"]) . "'";
$res = mysql_query($requete);
if (mysql_num_rows($res)) {
$id_empl = mysql_result($res, 0, 0);
} else {
$requete = "INSERT INTO arch_emplacement(archempla_libelle) VALUES('" . addslashes($value["c"]) . "')";
if (!mysql_query($requete)) {
$mon_msg = "Etat de collection non importé problème avec la requête: " . $requete;
affiche_mes_erreurs($mon_msg);
continue;
} else {
$id_empl = mysql_insert_id();
}
}
//Statut
if (!$value["h"] && !$value["k"]) {
$mon_msg = "Etat de collection non importé car pas de statut pour le périodique: " . $id_unimarc;
affiche_mes_erreurs($mon_msg);
continue;
//.........这里部分代码省略.........
示例15: header
<?php
if (!isset($_SESSION['admin'])) {
header('location: Login');
die;
}
require 'classes/class_categories.php';
$categories = new categories();
// If there are a request to save the categories
if (isset($_POST['save_categories_submit'])) {
// Saving the categories
if (isset($_POST['categories'])) {
$categories->save($_POST['categories']);
}
// Adding new category, if admin fill one
$checked = isset($_POST['checked']) ? 1 : 0;
if (isset($_POST['name']) && isset($_POST['order']) && !empty($_POST['name']) && !empty($_POST['order'])) {
$categories->add($_POST['name'], $_POST['order'], $checked);
}
}
// If there are a request to delete category
if (isset($_GET['d'])) {
$categories->delete($_GET['d']);
}
// Gets all the categories in array
$categories->get();
require 'design/design_categories.php';