/**
  * Creates an Categorie object based on a DB row.
  *
  * @param array $row The DB row containing Categorie data.
  * @return \BuyOrgans\Domain\Categorie
  */
 protected function buildDomainObject($row)
 {
     $categorie = new categorie();
     $categorie->setId($row['cat_id']);
     $categorie->setTitle($row['cat_title']);
     $categorie->setImage($row['cat_img']);
     return $categorie;
 }
Example #2
0
        if ($HTTP_POST_VARS['cat_delete'][$i] == 'on') {
            $error = $child_cats[$i]->delete('CDM_REMOVE_CONTENT');
            if ($error != OP_SUCCESSFUL) {
                error_report(GENERAL_ERROR, 'del_cat', __LINE__, __FILE__, $error);
            }
        } else {
            $error = $child_cats[$i]->commit();
            if ($error != OP_SUCCESSFUL) {
                error_report(GENERAL_ERROR, 'cat_commit', __LINE__, __FILE__, $error);
            }
        }
    }
    $child_cats = get_cats_of_cat($HTTP_GET_VARS['cat_id']);
}
//Get the contents of the actual cat and their thumbnails plus information like
$category = new categorie();
$category->generate_from_id($HTTP_GET_VARS['cat_id']);
if (isset($child_cats)) {
    for ($i = 0; $i < sizeof($child_cats); $i++) {
        $child_cat_infos[$i]['id'] = $child_cats[$i]->get_id();
        $child_cat_infos[$i]['parent_id'] = $child_cats[$i]->get_parent_id();
        $child_cat_infos[$i]['name'] = htmlspecialchars($child_cats[$i]->get_name());
        $child_cat_infos[$i]['description'] = htmlspecialchars($child_cats[$i]->get_description());
        $child_cat_infos[$i]['content_amount'] = $child_cats[$i]->get_content_amount();
        $child_cat_infos[$i]['content_child_amount'] = $child_cats[$i]->get_child_content_amount() - $child_cat_infos[$i]['content_amount'];
        $child_cat_infos[$i]['current_rating'] = $child_cats[$i]->get_current_rating();
        $child_cat_infos[$i]['remove_from_group'] = $child_cats[$i]->check_perm('remove_from_group');
        $child_cat_infos[$i]['delete'] = $child_cats[$i]->check_perm('delete');
        $child_cat_infos[$i]['edit'] = $child_cats[$i]->check_perm('edit');
        $child_cat_infos[$i]['catgroup_id'] = $child_cats[$i]->get_catgroup_id();
        $child_cat_infos[$i]['comments_amount'] = $child_cats[$i]->get_child_comments_amount();
Example #3
0
 /**
  * Returns all products
  *
  *
  * @return \Babydressing\Domain\categorie|throws an exception if no matching categorie is found
  */
 public function getAll()
 {
     $categorie = new categorie();
     $categorie->setnom('Toutes');
     return $categorie;
 }
 function generate_filename()
 {
     global $config_vars;
     //check if content is already in a cat
     if (!isset($this->cat_ids)) {
         $this->generate_content_in_cat_data();
     }
     if (sizeof($this->cat_ids) > 0) {
         $cat_obj = new categorie();
         $cat_obj->generate_from_id($this->cat_ids[0]);
         $path = $cat_obj->get_name();
         while ($cat_obj->get_parent_id() != $config_vars['root_categorie']) {
             $old_cat_id = $cat_obj->get_parent_id();
             $cat_obj = new categorie();
             $cat_obj->generate_from_id($old_cat_id);
             $path = $cat_obj->get_name() . '/' . $path;
         }
         // make $path is it doesnt exists
         if (!is_dir($config_vars['content_path_prefix'] . '/' . $path)) {
             makedir($config_vars['content_path_prefix'] . '/' . $path);
         }
         $path = $path . '/' . basename($this->name) . '.' . getext($this->file);
         $filename = $config_vars['content_path_prefix'] . '/' . $path;
         // if filename has changed check if such a file does not already exists is so add a number behind till its a new file
         if ($this->file != $filename) {
             $newfilename = $filename;
             $i = 0;
             while (is_file($newfilename)) {
                 $newfilename = getfile($filename) . "-{$i}." . getext($filename);
                 $i++;
             }
             $filename = $newfilename;
         }
         return $filename;
     } else {
         return OP_CONTENT_NOT_IN_CAT;
     }
 }
 function fetch_categories()
 {
     global $opac_thesaurus, $opac_categories_categ_in_line, $pmb_keyword_sep, $opac_categories_affichage_ordre;
     global $dbh, $opac_thesaurus_defaut;
     global $lang, $opac_categories_show_only_last;
     global $categories_memo, $libelle_thesaurus_memo;
     global $categories_top;
     $categ_repetables = array();
     if (!count($categories_top)) {
         $q = "select num_thesaurus,id_noeud from noeuds where num_parent in(select id_noeud from noeuds where autorite='TOP') ";
         $r = mysql_query($q, $dbh);
         while ($res = mysql_fetch_object($r)) {
             $categories_top[] = $res->id_noeud;
         }
     }
     $requete = "select * from (\n\t\t\tselect libelle_thesaurus, if (catlg.num_noeud is null, catdef.libelle_categorie, catlg.libelle_categorie ) as categ_libelle, if (catlg.num_noeud is null, catdef.comment_public, catlg.comment_public ) as comment_public, noeuds.id_noeud , noeuds.num_parent, langue_defaut,id_thesaurus, if(catdef.langue = '" . $lang . "',2, if(catdef.langue= thesaurus.langue_defaut ,1,0)) as p, ordre_vedette, ordre_categorie\n\t\t\tFROM ((noeuds\n\t\t\tjoin thesaurus ON thesaurus.id_thesaurus = noeuds.num_thesaurus\n\t\t\tleft join categories as catdef on noeuds.id_noeud=catdef.num_noeud and catdef.langue = thesaurus.langue_defaut\n\t\t\tleft join categories as catlg on catdef.num_noeud = catlg.num_noeud and catlg.langue = '" . $lang . "'))\n\t\t\t,notices_categories\n\t\t\twhere ";
     if (!$opac_thesaurus && $opac_thesaurus_defaut) {
         $requete .= " thesaurus.id_thesaurus='" . $opac_thesaurus_defaut . "' AND ";
     }
     $requete .= " notices_categories.num_noeud=noeuds.id_noeud and\n\t\t\tnotices_categories.notcateg_notice=" . $this->notice_id . "\torder by id_thesaurus, noeuds.id_noeud, p desc\n\t\t\t) as list_categ group by id_noeud";
     if ($opac_categories_affichage_ordre == 1) {
         $requete .= " order by ordre_vedette, ordre_categorie";
     }
     $result_categ = @mysql_query($requete);
     if (mysql_num_rows($result_categ)) {
         while ($res_categ = mysql_fetch_object($result_categ)) {
             $libelle_thesaurus = $res_categ->libelle_thesaurus;
             $categ_id = $res_categ->id_noeud;
             $libelle_categ = $res_categ->categ_libelle;
             $comment_public = $res_categ->comment_public;
             $num_parent = $res_categ->num_parent;
             $langue_defaut = $res_categ->langue_defaut;
             $categ_head = 0;
             if (in_array($categ_id, $categories_top)) {
                 $categ_head = 1;
             }
             if ($opac_categories_show_only_last || $categ_head) {
                 if ($opac_thesaurus) {
                     $catalog_form = "[" . $libelle_thesaurus . "] " . $libelle_categ;
                 }
                 // Si il y a présence d'un commentaire affichage du layer
                 $result_com = categorie::zoom_categ($categ_id, $comment_public);
                 $libelle_aff_complet = inslink($libelle_categ, str_replace("!!id!!", $categ_id, $this->lien_rech_categ), $result_com['java_com']);
                 $libelle_aff_complet .= $result_com['zoom'];
                 if ($opac_thesaurus) {
                     $categ_repetables[$libelle_thesaurus][] = $libelle_aff_complet;
                 } else {
                     $categ_repetables['MONOTHESAURUS'][] = $libelle_aff_complet;
                 }
             } else {
                 if (!$categories_memo[$categ_id]) {
                     $anti_recurse[$categ_id] = 1;
                     $path_table = '';
                     $requete = "\n\t\t\t\t\t\tselect id_noeud as categ_id, \n\t\t\t\t\t\tnum_noeud, num_parent as categ_parent, libelle_categorie as categ_libelle,\n\t\t\t\t\t\tnum_renvoi_voir as categ_see, \n\t\t\t\t\t\tnote_application as categ_comment,\n\t\t\t\t\t\tif(langue = '" . $lang . "',2, if(langue= '" . $langue_defaut . "' ,1,0)) as p\n\t\t\t\t\t\tFROM noeuds, categories where id_noeud ='" . $num_parent . "' \n\t\t\t\t\t\tAND noeuds.id_noeud = categories.num_noeud \n\t\t\t\t\t\torder by p desc limit 1";
                     $result = @mysql_query($requete);
                     if (mysql_num_rows($result)) {
                         $parent = mysql_fetch_object($result);
                         $anti_recurse[$parent->categ_id] = 1;
                         $path_table[] = array('id' => $parent->categ_id, 'libelle' => $parent->categ_libelle);
                         // on remonte les ascendants
                         while ($parent->categ_parent && !$anti_recurse[$parent->categ_parent]) {
                             $requete = "select id_noeud as categ_id, num_noeud, num_parent as categ_parent, libelle_categorie as categ_libelle,\tnum_renvoi_voir as categ_see, note_application as categ_comment, if(langue = '" . $lang . "',2, if(langue= '" . $langue_defaut . "' ,1,0)) as p\n\t\t\t\t\t\t\t\t\tFROM noeuds, categories where id_noeud ='" . $parent->categ_parent . "' \n\t\t\t\t\t\t\t\t\tAND noeuds.id_noeud = categories.num_noeud \n\t\t\t\t\t\t\t\t\torder by p desc limit 1";
                             $result = @mysql_query($requete);
                             if (mysql_num_rows($result)) {
                                 $parent = mysql_fetch_object($result);
                                 $anti_recurse[$parent->categ_id] = 1;
                                 $path_table[] = array('id' => $parent->categ_id, 'libelle' => $parent->categ_libelle);
                             } else {
                                 break;
                             }
                         }
                         $anti_recurse = array();
                     } else {
                         $path_table = array();
                     }
                     // ceci remet le tableau dans l'ordre général->particulier
                     $path_table = array_reverse($path_table);
                     if (sizeof($path_table)) {
                         $temp_table = '';
                         while (list($xi, $l) = each($path_table)) {
                             $temp_table[] = $l['libelle'];
                         }
                         $parent_libelle = join(':', $temp_table);
                         $catalog_form = $parent_libelle . ':' . $libelle_categ;
                     } else {
                         $catalog_form = $libelle_categ;
                     }
                     // pour libellé complet mais sans le nom du thésaurus
                     $libelle_aff_complet = $catalog_form;
                     if ($opac_thesaurus) {
                         $catalog_form = "[" . $libelle_thesaurus . "] " . $catalog_form;
                     }
                     //$categ = new category($categ_id);
                     // Si il y a présence d'un commentaire affichage du layer
                     $result_com = categorie::zoom_categ($categ_id, $comment_public);
                     $libelle_aff_complet = inslink($libelle_aff_complet, str_replace("!!id!!", $categ_id, $this->lien_rech_categ), $result_com['java_com']);
                     $libelle_aff_complet .= $result_com['zoom'];
                     if ($opac_thesaurus) {
                         $categ_repetables[$libelle_thesaurus][] = $libelle_aff_complet;
                     } else {
                         $categ_repetables['MONOTHESAURUS'][] = $libelle_aff_complet;
                     }
                     $categories_memo[$categ_id] = $libelle_aff_complet;
                     $libelle_thesaurus_memo[$categ_id] = $libelle_thesaurus;
                 } else {
                     if ($opac_thesaurus) {
                         $categ_repetables[$libelle_thesaurus_memo[$categ_id]][] = $categories_memo[$categ_id];
                     } else {
                         $categ_repetables['MONOTHESAURUS'][] = $categories_memo[$categ_id];
                     }
                 }
             }
         }
     }
     while (list($nom_tesaurus, $val_lib) = each($categ_repetables)) {
         //c'est un tri par libellé qui est demandé
         if ($opac_categories_affichage_ordre == 0) {
             $tmp = array();
             foreach ($val_lib as $key => $value) {
                 $tmp[$key] = strip_tags($value);
             }
             $tmp = array_map("convert_diacrit", $tmp);
             //On enlève les accents
             $tmp = array_map("strtoupper", $tmp);
             //On met en majuscule
             asort($tmp);
             //Tri sur les valeurs en majuscule sans accent
             foreach ($tmp as $key => $value) {
                 $tmp[$key] = $val_lib[$key];
                 //On reprend les bons couples clé / libellé
             }
             $val_lib = $tmp;
         }
         if ($opac_thesaurus) {
             if (!$opac_categories_categ_in_line) {
                 $categ_repetables_aff = "[" . $nom_tesaurus . "]" . implode("<br />[" . $nom_tesaurus . "]", $val_lib);
             } else {
                 $categ_repetables_aff = "<b>" . $nom_tesaurus . "</b><br />" . implode(" {$pmb_keyword_sep} ", $val_lib);
             }
         } elseif (!$opac_categories_categ_in_line) {
             $categ_repetables_aff = implode("<br />", $val_lib);
         } else {
             $categ_repetables_aff = implode(" {$pmb_keyword_sep} ", $val_lib);
         }
         if ($categ_repetables_aff) {
             $tmpcateg_aff .= "{$categ_repetables_aff}<br />";
         }
     }
     $this->categories_toutes = $tmpcateg_aff;
 }
 function fetch_categories()
 {
     $this->categories = get_notice_categories($this->notice_id);
     // catégories
     $categ_repetables = array();
     $max_categ = sizeof($this->categories);
     for ($i = 0; $i < $max_categ; $i++) {
         $categ_id = $this->categories[$i]["categ_id"];
         $categ = new category($categ_id);
         $categ_repetables[$categ->path_table[0]["libelle"]][$categ_id]["libelle"] = $categ->libelle;
         $categ_repetables[$categ->path_table[0]["libelle"]][$categ_id]["commentaire_public"] = $categ->commentaire_public;
     }
     $categ_final_table = array();
     while (list($key, $val) = each($categ_repetables)) {
         $categ_final_table[$key] = $key;
         asort($val);
         reset($val);
         $categ_r = array();
         while (list($categ_id, $libelle) = each($val)) {
             // Si il y a présence d'un commentaire affichage du layer
             $result_com = categorie::zoom_categ($categ_id, $libelle["commentaire_public"]);
             $categ_r[$categ_id] = inslink($libelle["libelle"], str_replace("!!id!!", $categ_id, $this->lien_rech_categ), $result_com['java_com']) . $result_com['zoom'];
         }
         $categ_final_table[$key] .= "<br />&nbsp;" . implode(", ", $categ_r);
     }
     $this->categories_toutes = implode("<br />", $categ_final_table);
 }
        $smarty->assign('allow_link', true);
        $smarty->assign('add_to_cats', $add_to_cats);
    }
    // Check if the user has remove_from_group right for this content
    if ($content->check_perm('remove_from_group')) {
        // get the groups where the user has add_to_group rights
        $add_to_contentgroups = get_contentgroups_data_where_perm('id,name', 'add_to_group');
        if (is_array($add_to_contentgroups)) {
            $smarty->assign('add_to_contentgroups', $add_to_contentgroups);
            $smarty->assign('contentgroup', $content->get_contentgroup_id());
        }
    }
}
$smarty->assign('edit_info', $edit_info);
// Check if user has content_remove rights on this categorie
$cat_obj = new categorie();
$cat_obj->generate_from_id($HTTP_GET_VARS['cat_id']);
if (check_cat_action_allowed($cat_obj->get_catgroup_id(), $userdata['user_id'], 'content_remove')) {
    $smarty->assign('allow_content_remove', 1);
}
if ($redirect_to_cat) {
    $header_location = @preg_match("/Microsoft|WebSTAR|Xitami/", getenv("SERVER_SOFTWARE")) ? "Refresh: 0; URL=" : "Location: ";
    header($header_location . append_sid("view_cat.php?cat_id={$HTTP_GET_VARS['cat_id']}", true));
}
//Show comments
$root_comments = get_comments_of_content($HTTP_GET_VARS['content_id']);
for ($i = 0; $i < sizeof($root_comments); $i++) {
    make_comments($root_comments[$i], 0, $content->check_perm('comment_edit'));
}
$smarty->assign('comments', $comments);
if (check_content_action_allowed($content->get_contentgroup_id(), $userdata['user_id'], 'comment_edit')) {
Example #8
0
     if ($mesCategories->num_parent) {
         $bar = categories::listAncestors($mesCategories->num_noeud, $lang);
         $bar = array_reverse($bar);
         if ($bar[3]) {
             print pmb_bidi("<a href=./index.php?lvl=categ_see&id=" . $bar[3]['num_noeud'] . "><img src='./images/folder.gif' border='0' align='middle'>...</a> > ");
         }
         if ($bar[2]) {
             print pmb_bidi("<a href=./index.php?lvl=categ_see&id=" . $bar[2]['num_noeud'] . "><img src='./images/folder.gif' border='0' align='middle'>" . $bar[2]['libelle_categorie'] . '</a> > ');
         }
         if ($bar[1]) {
             print pmb_bidi("<a href=./index.php?lvl=categ_see&id=" . $bar[1]['num_noeud'] . "><img src='./images/folder.gif' border='0' align='middle'>" . $bar[1]['libelle_categorie'] . '</a> > ');
         }
     }
     print "<a href=./index.php?lvl=categ_see&id=" . $mesCategories->num_noeud . ">";
     // Si il y a présence d'un commentaire affichage du layer
     $result_com = categorie::zoom_categ($mesCategories_trouvees->num_noeud, $mesCategories_trouvees->note_application);
     if (category::has_notices($mesCategories_trouvees->num_noeud)) {
         print " <img src='{$base_path}/images/folder_search.gif' border=0 align='middle' />";
     } else {
         print "<img src='./images/folder.gif' border='0' align='middle'>";
     }
     print pmb_bidi("</a><a href=./index.php?lvl=categ_see&id=" . $mesCategories->num_noeud . $result_com['java_com'] . ">" . $mesCategories->libelle_categorie . '</a>' . $result_com['zoom']);
     print "</li>";
 }
 print "</ul>";
 print "\n\t</div></div>";
 if ($opac_allow_affiliate_search) {
     print $catal_navbar;
 } else {
     print "</div>";
 }
Example #9
0
 $admin_group->description = 'This is the Administrator Group, categories like the Root Car or Deleted Content belong to it. You can change the name and description, but never delete it!';
 echo "Admin Group: " . $admin_group->commit() . "<br>";
 //root cat
 $root_cat = new categorie();
 $root_cat->parent_id = 1;
 $root_cat->catgroup_id = $admin_group->get_id();
 $root_cat->name = "root_cat";
 $root_cat->description = "This is your Root Category. You can change the name and description, but never delete it!";
 $root_cat->commit();
 // fill config var root cat to prefent infinite update loop on commit
 $config_vars['root_categorie'] = $root_cat->id;
 // set parent id to given id
 $root_cat->parent_id = $root_cat->id;
 echo "Root Cat: " . $root_cat->commit() . "<br>";
 //deleted content cat
 $deleted_content_cat = new categorie();
 $deleted_content_cat->parent_id = $root_cat->id;
 $deleted_content_cat->catgroup_id = $admin_group->get_id();
 $deleted_content_cat->name = "Deleted Content";
 $deleted_content_cat->description = "This is your Deleted Content Category. Here will be your deleted content stored. You can change the name and description, but never delete it!";
 echo "Delete Content Cat: " . $deleted_content_cat->commit() . "<br>";
 echo '<font color=#00ff00>OK</font><br>';
 // alter phpBB tables
 echo "Add basket_enable to phpbb users: ";
 $sql = "ALTER TABLE `{$table_prefix}users` ADD `{$phreakpic_table_prefix}basket_enable` ENUM('0','1') NOT NULL";
 $check = mysql_db_query($dbname, $sql, $connect);
 if ($check == false) {
     echo "<font color=#ff00ff>" . mysql_errno() . ": " . mysql_error() . "</font> ";
 }
 echo '<font color=#0000ff>done</font><br>';
 echo '</p>';
Example #10
0
<?php

include '../../model/categorie/categorie.php';
?>
<select name="categorie">
		<!-- <option value="0">nom categorie</option> -->
		<!-- <option value='1'>info</option> -->
	    <?php 
$cat = new categorie();
//echo($cat->get_all_categorie()->fetch()[0]);
$list = $cat->get_all_categorie();
while ($donnees = $list->fetch(PDO::FETCH_ASSOC)) {
    echo "<option value='" . $donnees["id_categorie"] . "'>";
    echo $donnees["nom_categorie"];
    echo "</option>";
}
?>
	
</select>
function build_nav_string($cat_id)
{
    global $config_vars, $lang;
    //get the navigation string
    $cat = new categorie();
    $result = $cat->generate_from_id($cat_id);
    if ($result) {
    }
    $parent_cats = $cat->get_parent_cat_array();
    //build the navigation string
    for ($i = 0; $i < sizeof($parent_cats); $i++) {
        $nav_string[$i]['id'] = $parent_cats[$i]['id'];
        $nav_string[$i]['name'] = $parent_cats[$i]['name'];
    }
    return $nav_string;
}
 function delete()
 {
     global $db, $config_vars, $userdata;
     // remove from content table
     // check is user is allowed
     $cat = new categorie();
     $cat->generate_from_id($this->owner_id);
     if ($userdata['user_id'] == $this->user_id or check_cat_action_allowed($cat->get_catgroup_id(), $userdata['user_id'], 'content_edit')) {
         $sql = "DELETE FROM " . $config_vars['table_prefix'] . "cat_comments WHERE id = " . $this->id;
         if (!($result = $db->sql_query($sql))) {
             error_report(SQL_ERROR, 'delete', __LINE__, __FILE__, $sql);
         }
         $cat->dec_child_comments_amount();
         $cat->commit();
         unset($this->id);
     }
 }
Example #13
0
    //FACETTES
    //gestion des facette si active
    require_once $base_path . '/classes/facette_search.class.php';
    $records = "";
    if ($nbr_lignes) {
        $facettes_result = pmb_mysql_query("SELECT distinct notices.notice_id {$suite_req}", $dbh);
        while ($row = pmb_mysql_fetch_object($facettes_result)) {
            if ($records) {
                $records .= ",";
            }
            $records .= $row->notice_id;
        }
        if (!$opac_facettes_ajax) {
            $str .= facettes::make_facette($records);
        } else {
            $_SESSION['tab_result'] = $records;
            $str .= facettes::get_facette_wrapper();
            $str .= "<div id='facette_wrapper'><img src='./images/patience.gif'/></div>";
            $str .= "\n\t\t\t<script type='text/javascript'>\n\t\t\t\tvar req = new http_request();\n\t\t\t\treq.request(\"./ajax.php?module=ajax&categ=facette&sub=call_facettes\",false,null,true,function(data){\n\t\t\t\t\tdocument.getElementById('facette_wrapper').innerHTML=data;\n\t\t\t\t});\n\t\t\t</script>";
        }
        //Formulaire "FACTICE" pour l'application du comparateur et du filetre multiple...
        $str .= '
<form name="form_values" style="display:none;" method="post" action="?lvl=more_results&mode=extended">
	<input type="hidden" name="from_see" value="1" />
	' . facette_search_compare::form_write_facette_compare() . '
</form>';
    }
} else {
    $ourCateg = new categorie(0);
    print pmb_bidi($ourCateg->child_list('./images/folder.gif', $css));
}
Example #14
0
            } elseif ($HTTP_POST_VARS['type'][$key] == CONTENT_COMMENTS_AMOUNT) {
                $content = get_content_object_from_id($HTTP_POST_VARS['id'][$key]);
                $content->set_comments_amount($content->calc_comments_amount());
                $content->commit();
            }
        }
    }
}
// check content amount for each cat
// get all categories
$sql = "SELECT id FROM " . $config_vars['table_prefix'] . "cats";
if (!($result = $db->sql_query($sql))) {
    message_die(GENERAL_ERROR, "Coudnt get cats", '', __LINE__, __FILE__, $sql);
}
while ($row = $db->sql_fetchrow($result)) {
    $cat = new categorie();
    $cat->generate_from_id($row['id']);
    $catarray[] = $cat;
}
foreach ($catarray as $cat) {
    // check how many content is in this cat
    $should_be = $cat->calc_content_amount();
    if ($should_be != $cat->get_content_amount()) {
        $missmatch['type'] = CONTENT_IN_CAT_AMOUNT;
        $missmatch['id'] = $cat->id;
        $missmatch['name'] = $cat->get_name();
        $missmatch['value'] = $cat->get_content_amount();
        $missmatch['should_be'] = $should_be;
        $missmatch_array[] = $missmatch;
    }
    // check child_content_amount
Example #15
0
        $requete .= "noeuds.num_parent = '" . $level0->num_noeud . "' ";
        $requete .= "and if (catlg.num_noeud is null, catdef.libelle_categorie not like '~%', catlg.libelle_categorie not like '~%') ";
    }
    $requete .= "order by " . $opac_categories_sub_mode . " limit " . $opac_categories_sub_display;
    $result_bis = pmb_mysql_query($requete, $dbh);
    $child = array();
    while ($sub_categ = pmb_mysql_fetch_object($result_bis)) {
        if (!$sub_categ->num_renvoi_voir) {
            $id = $sub_categ->num_noeud;
            $link = $sub_categ->libelle_categorie;
        } else {
            $id = $sub_categ->num_renvoi_voir;
            $link = '<i>' . $sub_categ->libelle_categorie . '@</i>';
        }
        // Si il y a présence d'un commentaire affichage du layer
        $result_com = categorie::zoom_categ($id, $sub_categ->comment_public);
        $child[] = "<a href='./index.php?lvl=categ_see&id={$id}&main=1&id_thes=" . $sub_categ->num_thesaurus . "'" . $result_com['java_com'] . ">" . $link . "</a>" . $result_com['zoom'];
    }
    $categ_array[] = array(categ => $categ, child => $child);
}
//affichage des liens vers les autres thésaurus
$liste_thesaurus = thesaurus::getThesaurusList($opac_show_categ_browser_home_id_thes);
if ($opac_show_categ_browser_home_id_thes_tab) {
    $liste_thesaurus_tmp = array();
    foreach ($opac_show_categ_browser_home_id_thes_tab as $value) {
        if ($liste_thesaurus[$value]) {
            $liste_thesaurus_tmp[$value] = $liste_thesaurus[$value];
            unset($liste_thesaurus[$value]);
        }
    }
    foreach ($liste_thesaurus as $key => $value) {
 function set_parent_id($new_parent_id)
 {
     global $userdata;
     // get objekt for the parent cat
     $new_parent = new categorie();
     if ($new_parent->generate_from_id($new_parent_id) == OP_SUCCESSFUL) {
         // check if user has cat_add rights in the parent group
         if (check_cat_action_allowed($new_parent->catgroup_id, $userdata['user_id'], 'cat_add')) {
             $parent = new categorie();
             if ($parent->generate_from_id($this->parent_id) == OP_SUCCESSFUL) {
                 // if this categoris is already in the db you also need move rights
                 if (isset($this->id) and !check_cat_action_allowed($parent->catgroup_id, $userdata['user_id'], 'cat_remove')) {
                     return OP_NP_MISSING_CAT_MOVE;
                 }
             }
             $this->parent_id = $new_parent_id;
             return OP_SUCCESSFUL;
         } else {
             return OP_NP_MISSING_CAT_ADD;
         }
     } else {
         return OP_PARENT_ID_INVALID;
     }
 }
Example #17
0
 function child_list($image = './images/folder.gif', $css)
 {
     global $css;
     global $dbh;
     global $opac_categories_nb_col_subcat, $opac_categories_sub_mode;
     global $main;
     global $lang;
     global $charset;
     global $base_path;
     $current_col = 0;
     // récupération des enfants
     if ($this->id == $this->thes->num_noeud_racine) {
         $result = categories::listChilds($this->id, $lang, 0, $opac_categories_sub_mode);
     } else {
         $result = categories::listChilds($this->id, $lang, 1, $opac_categories_sub_mode);
     }
     if (mysql_num_rows($result) < $opac_categories_nb_col_subcat) {
         // nombre de sous-catégories réduit
         while ($child = mysql_fetch_object($result)) {
             $libelle = $child->libelle_categorie;
             $note = $child->comment_public;
             $id = $child->num_noeud;
             //$c2_categ = new category($id);
             if ($child->num_renvoi_voir) {
                 $libelle = "<i>{$libelle}</i>@";
                 $id = $child->num_renvoi_voir;
             }
             // Si il y a présence d'un commentaire affichage du layer
             $result_com = $this->zoom_categ($id, $note);
             $l .= "<a href='./index.php?lvl=categ_see&id={$id}&main={$main}' class='small'>";
             if (category::has_notices($id)) {
                 $l .= " <img src='{$base_path}/images/folder_search.gif' border=0 align='absmiddle' />";
             } else {
                 $l .= "<img src='{$image}' border='0' align='top' />";
             }
             $l .= "<a/>" . $result_com['zoom'];
             $l .= "<a href='./index.php?lvl=categ_see&id={$id}&main={$main}' class='small' " . $result_com['java_com'] . ">" . $libelle . "</a><br />";
         }
         $l = "<br /><div style='margin-left:48px'>{$l}</div>";
     } else {
         $l = "<table border='0' style='margin-left:48px' cellpadding='3'>";
         while ($child = mysql_fetch_object($result)) {
             $libelle = $child->libelle_categorie;
             $note = $child->comment_public;
             $id = $child->num_noeud;
             //$c_categ =  new category($id);
             if ($child->num_renvoi_voir) {
                 $libelle = "<i>{$libelle}</i>@";
                 $id = $child->num_renvoi_voir;
             }
             // Si il y a présence d'un commentaire affichage du layer
             $result_com = categorie::zoom_categ($id, $note);
             if ($current_col == 0) {
                 $l .= "\n<tr>";
             }
             $l .= "<td align='top'><a href='./index.php?lvl=categ_see&id={$id}&main={$main}' class='small'>";
             if (category::has_notices($id)) {
                 $l .= " <img src='{$base_path}/images/folder_search.gif' border=0 align='absmiddle' />";
             } else {
                 $l .= "<img src='{$image}' border='0' align='top' />";
             }
             $l .= "</a>" . $result_com['zoom'];
             $l .= "<a href='./index.php?lvl=categ_see&id={$id}&main={$main}' class='small' " . $result_com['java_com'] . ">" . $libelle . "</a></td>";
             if ($current_col == $opac_categories_nb_col_subcat - 1) {
                 $l .= '</tr>';
                 $current_col = 0;
             } else {
                 $current_col++;
             }
         }
         $l .= '</table>';
     }
     return $l;
 }
function add_dir_parsed($dir, $group_id, $parent_id = -1)
{
    // Add all pictures under the Directory $dir to categories and series depending on the relativ path to $dir
    global $db, $config_vars, $filetypes;
    if ($parent_id == -1) {
        $parent_id = $config_vars['root_categorie'];
    }
    $dir_handle = opendir($dir);
    while ($file = readdir($dir_handle)) {
        if ($file != "." && $file != "..") {
            $dir_and_file = $dir . '/' . $file;
            if (isset($filetypes[getext($file)])) {
                // $file is content
                // generate a new album_content obj
                add_content($file, $dir_and_file, getfile($file), $parent_id, 0, $group_id);
            } elseif (is_dir($dir_and_file)) {
                //file is a sub dir
                $cat = new categorie();
                $cat->set_name($file);
                $cat->set_parent_id($parent_id);
                $cat->fill_up();
                $cat->set_catgroup_id($group_id);
                if (!isset($cat->id)) {
                    $cat->commit();
                }
                add_dir_parsed($dir . '/' . $file, $group_id, $cat->get_id());
            }
        }
    }
    closedir($dir_handle);
}
$smarty->template_dir = ROOT_PATH . 'templates/';
$smarty->compile_dir = ROOT_PATH . 'templates_c/';
$smarty->config_dir = ROOT_PATH . 'templates/';
$smarty->cache_dir = ROOT_PATH . 'smarty_cache/';
$smarty->left_delimiter = '<!--{';
$smarty->right_delimiter = '}-->';
$smarty->force_compile = '0';
$smarty->debugging = false;
//$smarty->debug_tpl = SMARTY_DIR.'debug.tpl';
//this vars are needed on every page
$smarty->assign('title_site', $board_config['sitename']);
//this vars are needed in view_cat AND view_content
$smarty->assign('lang', $lang);
$smarty->assign('phpbb_path', ROOT_PATH . PHPBB_PATH);
$smarty->assign('server_name', SERVER_NAME);
$smarty->assign('template_name', $userdata['photo_user_template']);
$smarty->assign('sid', '&sid=' . $userdata['session_id']);
$smarty->assign('username', $userdata['username']);
$smarty->assign('user_id', $userdata['user_id']);
//set if the actual user is admin or not
if ($userdata['user_level'] == 1) {
    $smarty->assign('user_level', 'admin');
} else {
    $smarty->assign('user_level', 'user');
}
// get statistics data
$root_cat = new categorie();
$root_cat->generate_from_id($config_vars['root_categorie']);
$smarty->assign('total_content', $root_cat->get_child_content_amount());
$smarty->assign('total_comments', $root_cat->get_child_comments_amount());
$smarty->assign('root_path', ROOT_PATH);