/** * Конструктор категорий * @return null */ public function __construct() { if (!self::$c && (self::$c = cache::o()->read('categories')) === false) { self::cats2array(); cache::o()->write(self::$c); } tpl::o()->register_modifier("print_cats", array($this, 'print_selected')); }
function __construct($cat) { parent::__construct(); require_once 'connexio.php'; $bd = new connexio(); $bd->query("INSERT INTO categoria (categoria) VALUES ('" . utf8_decode($cat) . "')"); $bd->close(); }
public function validateIsCategory($attribute, $message = 'attribute is not a valid category') { $category = categories::model()->getByPK($this->attributes[$attribute]); if (!$category) { return str_replace('attribute', $attribute, $message); } else { return false; } }
function import_new_notice_suite() { global $dbh; global $notice_id; global $info_606_a; global $info_900; $ordre_categ = 0; for ($i = 0; $i < count($info_606_a); $i++) { for ($j = 0; $j < count($info_606_a[$i]); $j++) { $descripteur = $info_606_a[$i][$j]; //Recherche du terme //dans le thesaurus par defaut et dans la langue de l'interface $libelle = addslashes($descripteur); $categ_id = categories::searchLibelle($libelle); if ($categ_id) { $requete = "INSERT INTO notices_categories (notcateg_notice,num_noeud,ordre_categorie) values({$notice_id},{$categ_id},{$ordre_categ})"; pmb_mysql_query($requete, $dbh); $ordre_categ++; } } } for ($i = 0; $i < count($info_900); $i++) { $req = " select idchamp, type, datatype from notices_custom where name='" . $info_900[$i]['n'] . "'"; $res = pmb_mysql_query($req, $dbh); if (pmb_mysql_num_rows($res)) { $perso = pmb_mysql_fetch_object($res); if ($perso->idchamp) { if ($perso->type == 'list') { $requete = "select notices_custom_list_value from notices_custom_lists where notices_custom_list_lib='" . addslashes($info_900[$i]['a']) . "' and notices_custom_champ={$perso->idchamp}"; $resultat = pmb_mysql_query($requete); if (pmb_mysql_num_rows($resultat)) { $value = pmb_mysql_result($resultat, 0, 0); } else { $requete = "select max(notices_custom_list_value*1) from notices_custom_lists where notices_custom_champ={$perso->idchamp}"; $resultat = pmb_mysql_query($requete); $max = @pmb_mysql_result($resultat, 0, 0); $n = $max + 1; $requete = "insert into notices_custom_lists (notices_custom_champ,notices_custom_list_value,notices_custom_list_lib) values({$perso->idchamp},{$n},'" . addslashes($info_900[$i]['a']) . "')"; pmb_mysql_query($requete); $value = $n; } $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_" . $perso->datatype . ") values({$perso->idchamp},{$notice_id},'" . $value . "')"; pmb_mysql_query($requete); } else { $requete = "insert into notices_custom_values (notices_custom_champ,notices_custom_origine,notices_custom_" . $perso->datatype . ") values({$perso->idchamp},{$notice_id},'" . addslashes($info_900[$i]['a']) . "')"; pmb_mysql_query($requete); } } } } }
/** * Добавление контента * @param string $cat имя категории * @param int $id ID контента * @return null * @throws EngineException */ public function add($cat, $id = null) { lang::o()->get('content'); $id = (int) $id; if ($id) { $lj = $cols = ""; if ($this->tstate) { $cols = ", t.*"; $lj = " LEFT JOIN content_torrents AS t ON t.cid=c.id"; } $row = db::o()->p($id)->query('SELECT c.* ' . $cols . ' FROM content AS c ' . $lj . ' WHERE c.id=? LIMIT 1'); $row = db::o()->fetch_assoc($row); if ($row) { if ($this->tstate && $row["banned"] == 2) { throw new EngineException("content_torrent_cant_be_edited"); } $this->title .= ' "' . $row["title"] . '"'; $adder = $row['poster_id']; $cat = $row['category_id']; if (users::o()->v('id') == $adder) { users::o()->check_perms('edit_content'); } else { users::o()->check_perms('edit_content', '2'); } if ($this->tstate) { $row["screenshots"] = unserialize($row["screenshots"]); } tpl::o()->assign('nrow', $row); tpl::o()->assign('id', $id); } else { throw new EngineException('content_not_exists'); } } if ($this->tstate && !$row['screenshots']) { $row['screenshots'] = array(array(), array()); tpl::o()->assign('nrow', $row); } try { plugins::o()->pass_data(array('row' => &$row), true)->run_hook('content_add'); } catch (PReturn $e) { return $e->r(); } tpl::o()->assign('categories_selector', $this->cats->ajax_selector($cat)); tpl::o()->assign("num", 0); n('polls'); // для add_polls n('attachments'); // для add_attachments tpl::o()->display('content/add.tpl'); }
function __construct($id = -1) { if (self::$conn == Null) { self::$conn = mysqli_connect('localhost', 'root', 'osama', 'store'); } if ($id != -1) { $query = "select * from categories where id={$id} limit 1"; $result = mysqli_query(self::$conn, $query); $category = mysqli_fetch_assoc($result); $this->id = $id; $this->name = $category['name']; $this->parent = $category['parent']; } }
/** * Prepares a list of products and renders accordingly * * If the request comes from an AJAX request containing pagination data, the resultant table will be * paginated appropriately. Otherwise, a default pagination state (no sorting, no filtering, page 1) * will be created. */ public function actionIndex() { $statuses = statuses::model()->getAll(); $vendors = vendors::model()->getAll(); $tags = tags::model()->getAll(); $showColumns = Auth::User()->getColumns(); if (count($showColumns) == 0) { $showColumns = array(1, 2, 3); } $columnHeaders = headers::model()->getAll(); $allHeaders = array(); foreach ($columnHeaders as $header) { $allHeaders[$header->id] = $header; } $headers = array('show' => $showColumns, 'headers' => $allHeaders); $pagination = array('limit' => array(0, 10), 'filter' => 'All categories', 'sortAttribute' => null, 'sortDirection' => null); if (!empty($_GET['ajax'])) { //handle ajax requests //get the pagination data from the query string if (isset($_GET['headers'])) { $headers['show'] = explode(',', $_GET['headers']); Auth::User()->setColumns($_GET['headers']); } $sortHeader = headers::model()->getbyPK($_GET['sortAttribute']); $pagination['sortAttribute'] = $sortHeader->sortName; $pagination['sortDirection'] = $_GET['sortDirection']; $pagination['limit'] = array($_GET['paginationPageNumber'], $_GET['paginationPerPage']); $pagination['filter'] = $_GET['filter']; $conditions = null; $params = null; //if there is a filter in place, create the conditions and parameters needed if (!empty($pagination['filter']) && $pagination['filter'] != 'All categories') { $conditions = "category = :category"; $category = categories::model()->getByAttribute('name', $pagination['filter']); $params = array('category' => $category->id); } $models = items::model(true)->getAll($conditions, $params, $pagination); $count = items::model()->getCount($conditions, $params); $pagination['count'] = $count; $pagination['sortAttribute'] = $_GET['sortAttribute']; $this->renderPartial('table', array('data' => $models, 'statuses' => $statuses, 'pagination' => $pagination, 'vendors' => $vendors, 'tags' => $tags, 'headers' => $headers)); } else { //handle default requests $models = items::model(true)->getAll(null, null, $pagination); $count = items::model()->getCount(null); $pagination['count'] = $count; $this->render('index', array('models' => $models, 'statuses' => $statuses, 'vendors' => $vendors, 'tags' => $tags, 'pagination' => $pagination, 'headers' => $headers)); } }
function import_new_notice_suite() { global $dbh; global $notice_id; global $info_606; $ordre_categ = 0; foreach ($info_606 as $categorie) { $libelle = $categorie["a"]; $lang = $categorie["z"]; // Recherche du terme // dans le thesaurus par defaut et dans la langue de l'interface $libelle = addslashes($libelle); $categ_id = categories::searchLibelle($libelle, 0, $lang); if ($categ_id) { $requete = "INSERT INTO notices_categories (notcateg_notice,num_noeud,ordre_categorie) values({$notice_id},{$categ_id},{$ordre_categ})"; pmb_mysql_query($requete, $dbh); $ordre_categ++; } } }
$c = new categories($id, $thes->langue_defaut); $libelle_categorie = $c->libelle_categorie; $note_application = $c->note_application; $commentaire = $c->comment_public; } else { $libelle_categorie = ''; $note_application = ''; $comment_public = ''; } $tab_traductions[$thes->langue_defaut][0] = $lg[$thes->langue_defaut]; $tab_traductions[$thes->langue_defaut][1] = $libelle_categorie; $tab_traductions[$thes->langue_defaut][2] = $note_application; $tab_traductions[$thes->langue_defaut][3] = $commentaire; //Ensuite, on regarde si les categories existent pour les langues de traduction des thesaurus foreach ($lg1 as $key => $value) { if (categories::exists($id, $key)) { $c = new categories($id, $key); $libelle_categorie = $c->libelle_categorie; $note_application = $c->note_application; $commentaire = $c->comment_public; } else { $libelle_categorie = ''; $note_application = ''; $commentaire = ''; } $tab_traductions[$key][0] = $value; $tab_traductions[$key][1] = $libelle_categorie; $tab_traductions[$key][2] = $note_application; $tab_traductions[$key][3] = $commentaire; } //categories langue par defaut thesaurus
abr('otherItems', $otherItems); if (!is_array($otherItems)) { abr('otherItemsCount', 0); } else { abr('otherItemsCount', count($otherItems)); } #加载属性 require_once ROOT_PATH . '/apps/attributes/models/attributes.class.php'; $attributesClass = new attributes(); $attributes = $attributesClass->getAll(0, 0, $itemsClass->attributesWhere); abr('attributes', $attributes); $attributeCategories = $attributesClass->getAllCategories(0, 0, $itemsClass->attributeCategoriesWhere); abr('attributeCategories', $attributeCategories); #加载分类 require_once ROOT_PATH . '/apps/categories/models/categories.class.php'; $categoriesClass = new categories(); $categories = $categoriesClass->getAll(); abr('categories', $categories); #面包屑 abr('breadcrumb', '<a href="/' . $languageURL . '" title="">' . $langArray['home'] . '</a> \\ <a href="/' . $languageURL . 'items/' . $item['id'] . '" title="">' . $item['name'] . '</a> \\ <a href="/' . $languageURL . 'items/faq/' . $item['id'] . '" title="">' . $langArray['faqs'] . '</a>'); #FAQ $faqs = $faqClass->CountAll($itemID); abr('faqs', $faqs); $user = $item['user']; require_once ROOT_PATH . '/apps/system/models/badges.class.php'; $badges = new badges(); $badges_data = $badges->getAllFront(); $other_badges = array_map('trim', explode(',', $user['badges'])); $user_badges = array(); if ($user['exclusive_author'] == 'true' && isset($badges_data['system']['is_exclusive_author'])) { if ($badges_data['system']['is_exclusive_author']['photo'] && file_exists(DATA_SERVER_PATH . "/uploads/badges/" . $badges_data['system']['is_exclusive_author']['photo'])) {
function _export_($id, $keep_expl) { global $ty, $charset; global $tab_functions; global $mois, $mois_enrichis; if (!$ty) { $ty = array_flip(array("REVUE" => "v", "LIVRE" => "a", "MEMOIRE" => "b", "DOCUMENT AUDIOVISUEL" => "g", "CDROM" => "m", "DOCUMENT EN LIGNE" => "l")); } if (!$tab_functions) { $tab_functions = new marc_list('function'); } if (!$mois) { $mois = array(0 => "", 1 => "janvier", 2 => "fevrier", 3 => "mars", 4 => "avril", 5 => "mai", 6 => "juin", 7 => "juillet", 8 => "aout", 9 => "septembre", 10 => "octobre", 11 => "novembre", 12 => "decembre"); $mois_enrichis = array(0 => "", 1 => "janvier", 2 => "février", 3 => "mars", 4 => "avril", 5 => "mai", 6 => "juin", 7 => "juillet", 8 => "aout", 9 => "septembre", 10 => "octobre", 11 => "novembre", 12 => "décembre"); } if (!$m_thess) { $rqt = "SELECT count(1) FROM thesaurus WHERE active=1"; $m_thess = mysql_result(mysql_query($rqt), 0, 0); } $notice = "<notice>\n"; $requete = "SELECT * FROM notices WHERE notice_id={$id}"; $resultat = mysql_query($requete); $rn = mysql_fetch_object($resultat); //Référence $notice .= " <REF>" . htmlspecialchars($id, ENT_QUOTES, $charset) . "</REF>\n"; //Organisme (OP) $no_champ = trouve_champ_perso("op"); if ($no_champ > 0) { $requete = "SELECT notices_custom_list_lib " . "FROM notices_custom_lists, notices_custom_values " . "WHERE notices_custom_lists.notices_custom_champ={$no_champ} " . "AND notices_custom_values.notices_custom_champ={$no_champ} " . "AND notices_custom_integer=notices_custom_list_value " . "AND notices_custom_origine={$id}"; $resultat = mysql_query($requete); if (mysql_num_rows($resultat)) { $op = mysql_result($resultat, 0, 0); $notice .= " <OP>" . htmlspecialchars($op, ENT_QUOTES, $charset) . "</OP>\n"; } } //Date saisie (DS) $no_champ = trouve_champ_perso("ds"); if ($no_champ > 0) { $requete = "SELECT notices_custom_date FROM notices_custom_values WHERE notices_custom_champ={$no_champ} AND notices_custom_origine={$id}"; $resultat = mysql_query($requete); if (mysql_num_rows($resultat)) { $date = mysql_result($resultat, 0, 0); } else { $date = date("Y") . "-" . date("m") . "-" . date("d"); } $notice .= "<DS>" . $date . "</DS>\n"; } //Type document (TY) if ($rn->niveau_biblio != 'a' && $rn->niveau_biblio != 's') { $tyd = $ty[$rn->typdoc]; } else { if ($rn->niveau_biblio == 'a') { $tyd = "REVUE"; } else { $tyd = "CHAPEAU"; } } if ($tyd == "") { $tyd = "LIVRE"; } $notice .= "<TY>" . htmlspecialchars($tyd, ENT_QUOTES, $charset) . "</TY>\n"; //Genre (GEN) $no_champ = trouve_champ_perso("gen"); if ($no_champ > 0) { $requete = "SELECT notices_custom_list_lib " . "FROM notices_custom_lists, notices_custom_values " . "WHERE notices_custom_lists.notices_custom_champ={$no_champ} " . "AND notices_custom_values.notices_custom_champ={$no_champ} " . "AND notices_custom_integer=notices_custom_list_value " . "AND notices_custom_origine={$id}"; $resultat = mysql_query($requete); if (mysql_num_rows($resultat)) { $notice .= "<GEN>" . htmlspecialchars(mysql_result($resultat, 0, 0), ENT_QUOTES, $charset) . "</GEN>\n"; } } //Auteurs $requete = "SELECT author_name, author_rejete, author_type, responsability_fonction, responsability_type " . "FROM authors, responsability " . "WHERE responsability_notice={$id} AND responsability_author=author_id " . "ORDER BY author_type, responsability_type, responsability_ordre"; $resultat = mysql_query($requete); if (mysql_num_rows($resultat)) { $au = array(); $auco = array(); $as = array(); while ($ra = mysql_fetch_object($resultat)) { $a = $ra->author_type == '70' ? strtoupper($ra->author_name) : $ra->author_name; if ($ra->author_rejete) { $a .= " (" . $ra->author_rejete . ")"; } if ($ra->author_type == '70') { //C'est une personne, est-ce un auteur principal ou secondaire ? if ($ra->responsability_type == 2) { if ($ra->responsability_fonction >= 900) { $a .= " " . $tab_functions->table[$ra->responsability_fonction]; } $as[] = $a; } else { $au[] = $a; } } else { //C'est un auteur collectif $auco[] = $a; } } //Auteurs / Réalisateurs (AU) $au_ = implode(", ", $au); if ($au_) { $notice .= "<AU>" . htmlspecialchars($au_, ENT_QUOTES, $charset) . "</AU>\n"; } //Auteurs collectifs (AUCO) $auco_ = implode(", ", $auco); if ($auco_) { $notice .= "<AUCO>" . htmlspecialchars($auco_, ENT_QUOTES, $charset) . "</AUCO>\n"; } //Auteurs secondaires (AS) $as_ = implode(", ", $as); if ($as_) { $notice .= "<AS>" . htmlspecialchars($as_, ENT_QUOTES, $charset) . "</AS>\n"; } } //Distributeur (DIST) if ($rn->ed2_id) { $requete = "SELECT ed_ville,ed_name FROM publishers WHERE ed_id=" . $rn->ed2_id; $resultat = mysql_query($requete); if (mysql_num_rows($resultat)) { $re = mysql_fetch_object($resultat); $ed = ""; if ($re->ed_ville) { $ed = $re->ed_ville . ":"; } $ed .= $re->ed_name; $notice .= "<DIST>" . htmlspecialchars($ed, ENT_QUOTES, $charset) . "</DIST>\n"; } } //Titre (TI) $serie = ""; if ($rn->tparent_id) { $requete = "SELECT serie_name FROM series WHERE serie_id=" . $rn->tparent_id; $resultat = mysql_query($requete); if (mysql_num_rows($resultat)) { $serie = mysql_result($resultat, 0, 0); } } if ($rn->tnvol) { $serie .= ($serie ? " " : "") . $rn->tnvol; } if ($serie) { $serie .= ". "; } // ajout GM 15/12/2006 pour export sous-titre dans TI if ($rn->tit4 != "") { $soustitre = " : " . $rn->tit4; } // fin ajout GM // modif GM 15/12/2006 ajout du sous-titre pour l'export // $notice.=" <TI>".htmlspecialchars(strtoupper($serie.$rn->tit1))."</TI>\n"; $notice .= " <TI>" . htmlspecialchars($serie . $rn->tit1 . $soustitre, ENT_QUOTES, $charset) . "</TI>\n"; //Si c'est un article if ($rn->niveau_biblio == 'a') { //Recherche des informations du bulletin $requete = "SELECT * FROM bulletins, analysis WHERE bulletin_id=analysis_bulletin AND analysis_notice={$id}"; $resultat = mysql_query($requete); $rb = mysql_fetch_object($resultat); } //Titre du numéro (TN) if ($rb->bulletin_titre && substr($rb->bulletin_titre, 0, 9) != "Bulletin ") { $notice .= "<TN>" . htmlspecialchars($rb->bulletin_titre, ENT_QUOTES, $charset) . "</TN>\n"; } //Colloques (COL) if ($tyd != "MEMOIRE") { if ($rn->tit3) { $notice .= "<COL>" . htmlspecialchars($rn->tit3, ENT_QUOTES, $charset) . "</COL>\n"; } } //Titre de revue (TP) if ($rb) { $requete = "SELECT tit1 FROM notices WHERE notice_id=" . $rb->bulletin_notice; $resultat = mysql_query($requete); $notice .= "<TP>" . htmlspecialchars(mysql_result($resultat, 0, 0), ENT_QUOTES, $charset) . "</TP>\n"; } //Souces (SO) if ($rb) { $so = ""; if ($rb->bulletin_numero) { $so = $rb->bulletin_numero; } if ($rb->mention_date) { if ($so) { $so .= ", "; } $so .= $rb->mention_date; } } else { $so = $rn->n_gen; } $notice .= "<SO>" . htmlspecialchars($so, ENT_QUOTES, $charset) . "</SO>"; //Editeur / Collection (ED) if ($rn->ed1_id) { $requete = "SELECT ed_ville,ed_name FROM publishers WHERE ed_id=" . $rn->ed1_id; $resultat = mysql_query($requete); if (mysql_num_rows($resultat)) { $red = mysql_fetch_object($resultat); $ed = ""; if ($red->ed_ville) { $ed = $red->ed_ville . ":"; } $ed .= $red->ed_name; } //Collection if ($rn->coll_id) { $requete = "SELECT collection_name FROM collections WHERE collection_id=" . $rn->coll_id; $resultat = mysql_query($requete); if (mysql_num_rows($resultat)) { $coll_name = mysql_result($resultat, 0, 0); $ed .= " (" . $coll_name . ")"; } } $notice .= "<ED>" . htmlspecialchars($ed, ENT_QUOTES, $charset) . "</ED>\n"; } //Date de publication (DP) $annee = ""; if ($rn->year && $rn->niveau_biblio != 'a') { $annee = $rn->year; } else { if ($rn->niveau_biblio == 'a') { $req_mention_date = "SELECT YEAR(date_date) FROM bulletins, analysis WHERE bulletin_id=analysis_bulletin AND analysis_notice={$id}"; $res_mention_date = mysql_query($req_mention_date); if ($res_mention_date) { $annee = mysql_result($res_mention_date, 0, 0); } else { if ($rn->year) { $annee = $rn->year; } } } } if ($annee != "") { //on essaie d'enlever les mois for ($bcl_an = 1; $bcl_an < 13; $bcl_an++) { $annee = str_replace($mois[$bcl_an], "", strtolower($annee)); $annee = str_replace($mois_enrichis[$bcl_an], "", strtolower($annee)); } $annee = str_replace("-", "", $annee); $annee = str_replace(",", "", $annee); $annee = substr($annee, 0, 4); $notice .= "<DP>" . htmlspecialchars(trim($annee), ENT_QUOTES, $charset) . "</DP>\n"; } //Diplome (ND) if ($tyd == "MEMOIRE" && $rn->tit3) { $notice .= "<ND>" . htmlspecialchars($rn->tit3, ENT_QUOTES, $charset) . "</ND>\n"; } //Notes (NO) if ($tyd == "REVUE") { $no = $rn->npages; } else { $no = $rn->n_contenu; } if ($no) { $notice .= "<NO>" . htmlspecialchars($no, ENT_QUOTES, $charset) . "</NO>\n"; } $requete = "SELECT num_noeud FROM notices_categories WHERE notcateg_notice={$id} ORDER BY ordre_categorie"; $resultat = mysql_query($requete); $go = array(); $hi = array(); $denp = array(); $de = array(); $cd = array(); if ($m_thess > 1) { while (list($categ_id) = mysql_fetch_row($resultat)) { $categ = new category($categ_id); if (trouve_thesaurus("GO") == $categ->thes->id_thesaurus) { $go[] = $categ->libelle; } elseif (trouve_thesaurus("HI") == $categ->thes->id_thesaurus) { $hi[] = $categ->libelle; } elseif (trouve_thesaurus("DENP") == $categ->thes->id_thesaurus) { $denp[] = $categ->libelle; } elseif (trouve_thesaurus("DE") == $categ->thes->id_thesaurus) { $de[] = $categ->libelle; } elseif (trouve_thesaurus("CD") == $categ->thes->id_thesaurus) { $cd[] = $categ->libelle; } } } else { while (list($categ_id) = mysql_fetch_row($resultat)) { $categ = new categories($categ_id, 'fr_FR'); $list_categ = categories::listAncestors($categ_id, 'fr_FR'); reset($list_categ); list($id, $libelle) = each($list_categ); switch ($libelle["autorite"]) { case "GO": $go[] = $categ->libelle_categorie; break; case "HI": $hi[] = $categ->libelle_categorie; break; case "DENP": $denp[] = $categ->libelle_categorie; break; case "DE": $de[] = $categ->libelle_categorie; break; case "CD": $cd[] = $categ->libelle_categorie; break; } } } //Zone (GO) if (count($go)) { //sort($go); $notice .= "<GO>" . htmlspecialchars(strtoupper(implode(", ", $go)), ENT_QUOTES, $charset) . "</GO>\n"; } //Période historique (HI) if (count($hi)) { //sort($hi); $notice .= "<HI>" . htmlspecialchars(strtoupper(implode(", ", $hi)), ENT_QUOTES, $charset) . "</HI>\n"; } //Descripteurs noms propres (DENP) if (count($denp)) { //sort($denp); $notice .= "<DENP>" . htmlspecialchars(strtoupper(implode(", ", $denp)), ENT_QUOTES, $charset) . "</DENP>\n"; } //Descripteurs (DE) if (count($de)) { //sort($de); $notice .= "<DE>" . htmlspecialchars(strtoupper(implode(", ", $de)), ENT_QUOTES, $charset) . "</DE>\n"; } //Candidats descripteurs (CD) if (count($cd)) { //sort($cd); $notice .= "<CD>" . htmlspecialchars(strtoupper(implode(", ", $cd)), ENT_QUOTES, $charset) . "</CD>\n"; } //Resumé (RESU) if ($rn->n_resume) { $notice .= "<RESU>" . htmlspecialchars($rn->n_resume, ENT_QUOTES, $charset) . "</RESU>\n"; } //date de tri (DATRI) if ($rb->date_date) { $notice .= "<DATRI>" . htmlspecialchars($rb->date_date, ENT_QUOTES, $charset) . "</DATRI>\n"; } //url (URL) if ($rn->lien) { $notice .= "<URL>" . htmlspecialchars($rn->lien, ENT_QUOTES, $charset) . "</URL>\n"; } //isbn (ISBN) if ($rn->code) { $notice .= "<ISBN>" . htmlspecialchars(str_replace("-", "", $rn->code), ENT_QUOTES, $charset) . "</ISBN>\n"; } $notice .= "</notice>"; return $notice; }
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; }
function import_new_notice_suite() { global $dbh; global $notice_id; global $info_464; global $info_606_a; global $info_900, $info_901, $info_902, $info_903, $info_904, $info_905, $info_906; global $pmb_keyword_sep; global $bulletin_ex; //Cas des périodiques if (is_array($info_464)) { $requete = "select * from notices where notice_id={$notice_id}"; $resultat = pmb_mysql_query($requete); $r = pmb_mysql_fetch_object($resultat); //Notice chapeau existe-t-elle ? $requete = "select notice_id from notices where tit1='" . addslashes($info_464[0]['t']) . "' and niveau_hierar='1' and niveau_biblio='s'"; $resultat = pmb_mysql_query($requete); if (@pmb_mysql_num_rows($resultat)) { //Si oui, récupération id $chapeau_id = pmb_mysql_result($resultat, 0, 0); //Bulletin existe-t-il ? $requete = "select bulletin_id from bulletins where bulletin_numero='" . addslashes($info_464[0]['v']) . "' and mention_date='" . addslashes($info_464[0]['d']) . "' and bulletin_notice={$chapeau_id}"; //$requete="select bulletin_id from bulletins where bulletin_numero='".addslashes($info_464[0]['v'])."' and bulletin_notice=$chapeau_id"; $resultat = pmb_mysql_query($requete); if (@pmb_mysql_num_rows($resultat)) { //Si oui, récupération id bulletin $bulletin_id = pmb_mysql_result($resultat, 0, 0); } else { //Si non, création bulltin $info = array(); $bulletin = new bulletinage("", $chapeau_id); $info['bul_titre'] = addslashes("Bulletin N°" . $info_464[0]['v']); $info['bul_no'] = addslashes($info_464[0]['v']); $info['bul_date'] = addslashes($info_464[0]['d']); if (!$info_464[0]['e']) { $date_date = explode("/", $info_464[0]['d']); if (count($date_date)) { if (count($date_date) == 1) { $info['date_date'] = $date_date[0] . "-01-01"; } if (count($date_date) == 2) { $info['date_date'] = $date_date[1] . "-" . $date_date[0] . "-01"; } if (count($date_date) == 3) { $info['date_date'] = $date_date[2] . "-" . $date_date[1] . "-" . $date_date[0]; } } else { if ($info_904[0]) { $info['date_date'] = $info_904[0]; } } } else { $info['date_date'] = $info_464[0]['e']; } $bulletin_id = $bulletin->update($info); } } else { //Si non, création notice chapeau et bulletin $chapeau = new serial(); $info = array(); $info['tit1'] = addslashes($info_464[0]['t']); $info['niveau_biblio'] = 's'; $info['niveau_hierar'] = '1'; $info['typdoc'] = $r->typdoc; $chapeau->update($info); $chapeau_id = $chapeau->serial_id; $bulletin = new bulletinage("", $chapeau_id); $info = array(); $info['bul_titre'] = addslashes("Bulletin N°" . $info_464[0]['v']); $info['bul_no'] = addslashes($info_464[0]['v']); $info['bul_date'] = addslashes($info_464[0]['d']); if (!$info_464[0]['e']) { $date_date = explode("/", $info_464[0]['d']); if (count($date_date)) { if (count($date_date) == 1) { $info['date_date'] = $date_date[0] . "-01-01"; } if (count($date_date) == 2) { $info['date_date'] = $date_date[1] . "-" . $date_date[0] . "-01"; } if (count($date_date) == 3) { $info['date_date'] = $date_date[2] . "-" . $date_date[1] . "-" . $date_date[0]; } } else { if ($info_904[0]) { $info['date_date'] = $info_904[0]; } } } else { $info['date_date'] = $info_464[0]['e']; } $bulletin_id = $bulletin->update($info); } //Notice objet ? if ($info_464[0]['z'] == 'objet') { //Supression de la notice $requete = "delete from notices where notice_id={$notice_id}"; pmb_mysql_query($requete); $bulletin_ex = $bulletin_id; } else { //Passage de la notice en article $requete = "update notices set niveau_biblio='a', niveau_hierar='2', year='" . addslashes($info_464[0]['d']) . "', npages='" . addslashes($info_464[0]['p']) . "', date_parution='" . $info['date_date'] . "' where notice_id={$notice_id}"; pmb_mysql_query($requete); $requete = "insert into analysis (analysis_bulletin,analysis_notice) values({$bulletin_id},{$notice_id})"; pmb_mysql_query($requete); $bulletin_ex = $bulletin_id; } } else { $bulletin_ex = 0; } //Traitement du thésaurus $unknown_desc = array(); for ($i = 0; $i < count($info_606_a); $i++) { for ($j = 0; $j < count($info_606_a[$i]); $j++) { $descripteur = $info_606_a[$i][$j]; //Recherche du terme //dans le thesaurus par defaut et dans la langue de l'interface $libelle = addslashes($descripteur); $categ_id = categories::searchLibelle($libelle); if ($categ_id) { $requete = "insert into notices_categories (notcateg_notice,num_noeud) values({$notice_id},{$categ_id})"; pmb_mysql_query($requete); } else { $unknown_desc[] = $descripteur; } } if ($unknown_desc) { $mots_cles = implode($pmb_keyword_sep, $unknown_desc); $requete = "update notices set index_l='" . addslashes($mots_cles) . "', index_matieres=' " . addslashes(strip_empty_words($mots_cles)) . " ' where notice_id={$notice_id}"; pmb_mysql_query($requete); } } }
function cleanCategoriesPath() { global $msg, $charset, $PMBusername; if (SESSrights & ADMINISTRATION_AUTH) { // Pour tous les thésaurus, on parcours les childs $list_thesaurus = thesaurus::getThesaurusList(); foreach ($list_thesaurus as $id_thesaurus => $libelle_thesaurus) { $thes = new thesaurus($id_thesaurus); $noeud_rac = $thes->num_noeud_racine; $r = noeuds::listChilds($noeud_rac, 0); while ($row = mysql_fetch_object($r)) { noeuds::process_categ_path($row->id_noeud); } } if ($thesaurus_auto_postage_search) { categories::process_categ_index(); } $result .= htmlentities($msg["clean_categories_path_end"], ENT_QUOTES, $charset); } else { $result .= sprintf($msg["planificateur_rights_bad_user_rights"], $PMBusername); } return $result; }
if (categories::exists($mesCategories_trouvees->num_renvoi_voir, $lang)) { $lg = $lang; } else { $thes = thesaurus::getByEltId($mesCategories_trouvees->num_noeud); $lg = $thes->langue_defaut; } $q = "select * from noeuds, categories where num_noeud='" . $mesCategories_trouvees->num_renvoi_voir . "' and langue = '" . $lg . "' and noeuds.id_noeud = categories.num_noeud limit 1"; $found_see = mysql_query($q, $dbh); $mesCategories = @mysql_fetch_object($found_see); print pmb_bidi("<b>" . $mesCategories_trouvees->libelle_categorie . "</b> " . $msg['term_show_see'] . " "); } else { $mesCategories = $mesCategories_trouvees; } // Affichage de l'arborescence des renvois voir 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)) {
?> </li> <?php } ?> </ul> </div> <div class="clear"></div> </div> <div id="sidebar" class="left"> <div id="categories" class="box"> <h2>Categories</h2> <ul> <?php foreach (categories::all() as $category) { ?> <li><?php echo $category->link(); ?> </li> <?php } ?> </ul> </div> <div id="latest-blog-entry-synopsis" class="box"> <h2>Recent Blog Posts</h2> <div class="padd-me"> <?php
<li><a class="color10" href="brands.php">Brands</a></li> <li class="color10"><a class="color3" href="home.php">Sale</a></li> <li class="color10"><a class="color3" href="contact.php">Contact Us</a></li> <div class="clearfix"> </div> </ul> </div> <div class="clearfix"> </div> </div> </div> </div> <div class="men"> <div class="container"> <div class="col-md-4 sidebar_men"> <h3>Categories</h3> <?php $categs = new categories(); $array = $categs->categories(NULL); foreach ($array as $key => $categories) { @($subs = $categs->categories($categories['id'])); ?> <ul class="product-categories color"> <h3><?php echo $categories['name']; ?> </h3> <?php foreach ($subs as $key => $subs) { ?> <li class="cat-item cat-item-60"><a href="men.php?cat_id=<?php echo $subs['id'];
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; }
function getParent($id) { $cats = new categories(); $cats->id = $id; $cats->find(true); return $cats->parent; }
function cleanCategories() { global $msg, $dbh, $charset, $PMBusername; if ($deleted == "") { $deleted = 0; } if (SESSrights & ADMINISTRATION_AUTH) { $result .= "<h3>" . htmlentities($msg["nettoyage_suppr_categories"], ENT_QUOTES, $charset) . "</h3>"; $list_thesaurus = thesaurus::getThesaurusList(); foreach ($list_thesaurus as $id_thesaurus => $libelle_thesaurus) { $thes = new thesaurus($id_thesaurus); $noeud_rac = $thes->num_noeud_racine; $r = noeuds::listChilds($noeud_rac, 0); while ($row = mysql_fetch_object($r)) { noeuds::process_categ($row->id_noeud); } } //TODO non repris >> Utilité ??? // $delete = mysql_query("delete from categories where categ_libelle='#deleted#'"); $result .= $deleted . " " . htmlentities($msg["nettoyage_res_suppr_categories"], ENT_QUOTES, $charset); $optn = noeuds::optimize(); $optc = categories::optimize(); } else { $result .= sprintf($msg["planificateur_rights_bad_user_rights"], $PMBusername); } return $result; }
// } // $req="update noeuds set path='$path' where id_noeud=$id_noeud"; // pmb_mysql_query($req,$dbh); //} //function process_categ_index() { // global $dbh; // // $q = "select * from categories "; // $r = pmb_mysql_query($q, $dbh); // while ($obj = pmb_mysql_fetch_object($r)) { // $thes = new categories($obj->num_noeud,$obj->langue); // $thes->update_index_path_word(); // } //} // Pour tous les thésaurus, on parcours les childs $list_thesaurus = thesaurus::getThesaurusList(); foreach ($list_thesaurus as $id_thesaurus => $libelle_thesaurus) { $thes = new thesaurus($id_thesaurus); $noeud_rac = $thes->num_noeud_racine; $r = noeuds::listChilds($noeud_rac, 0); while ($row = pmb_mysql_fetch_object($r)) { noeuds::process_categ_path($row->id_noeud); } } if ($thesaurus_auto_postage_search) { categories::process_categ_index(); } $spec = $spec - CLEAN_CATEGORIES_PATH; $v_state = urldecode($v_state); $v_state .= "<br /><img src=../../images/d.gif hspace=3>" . htmlentities($msg["clean_categories_path_end"], ENT_QUOTES, $charset) . "."; print "<form class='form-{$current_module}' name='process_state' action='./clean.php' method='post'>\n\t\t\t<input type='hidden' name='v_state' value=\"" . urlencode($v_state) . "\">\n\t\t\t<input type='hidden' name='spec' value=\"{$spec}\">\n\t\t</form>\n\t\t<script type=\"text/javascript\"><!--\n\t\t\tdocument.forms['process_state'].submit();\n\t\t\t-->\n\t\t</script>";
$display .= ''; } if ($categ->categ_see) { $temp = new categories($categ->categ_see, $categ->langue); $display .= $categ->categ_libelle . " -> <i>"; if ($thesaurus_categories_show_only_last) { $display .= $temp->libelle_categorie; } else { $display .= categories::listAncestorNames($categ->categ_see, $categ->langue); } $display .= "@</i>"; } else { if ($thesaurus_categories_show_only_last) { $display .= $categ->categ_libelle; } else { $display .= categories::listAncestorNames($categ->categ_id, $categ->langue); } } $acateg = new category($categ->categ_id); $notice_count = $acateg->notice_count(false); $categ_entry = $display; $categ_comment = $categ->categ_comment; $link_categ = "./autorites.php?categ=categories&sub=categ_form&parent=0&id=" . $categ->categ_id . "&id_thes=" . $categ->num_thesaurus . "&user_input=" . rawurlencode(stripslashes($user_input)) . "&nbr_lignes=" . $nbr_lignes . "&page=" . $page . "&nb_per_page=" . $nb_per_page; if ($parity % 2) { $pair_impair = "even"; } else { $pair_impair = "odd"; } $parity += 1; $tr_javascript = " onmouseover=\"this.className='surbrillance'\" onmouseout=\"this.className='{$pair_impair}'\" "; $categ_list .= "<tr class='{$pair_impair}' {$tr_javascript} style='cursor: pointer'>\n \t\t\t\t<td valign='top' onmousedown=\"document.location='{$link_categ}';\">\n\t\t\t\t\t\t{$categ_entry}\n\t\t\t\t\t\t</td>\n\t\t\t\t\t\t<td valign='top' onmousedown=\"document.location='{$link_categ}';\">\n\t\t\t\t\t\t{$categ_comment}\n\t\t\t\t\t\t</td>";
<?php echo "hi php"; var_dump($_POST); var_dump($_GET); include 'product.php'; include 'categories.php'; $categs = new categories(); $categories = $categs->searchByName($_GET['catName']); if (empty($categories)) { echo true; } else { echo "duplicated"; } $product = new Products(); $prodct = $product->searchByName($_GET['product']); if (empty($prodct)) { echo true; } else { echo "duplicated"; }
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; }
<?php // +---------------------------------------------------------------------- // | Demila [ Beautiful Digital Content Trading System ] // +---------------------------------------------------------------------- // | Copyright (c) 2015 http://demila.org All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- // | Email author@demila.org // +---------------------------------------------------------------------- _setView(__FILE__); _setTitle($langArray['add']); $cms = new categories(); if (!isset($_GET['sub_of']) || !is_numeric($_GET['sub_of'])) { $_GET['sub_of'] = 0; } if (isset($_POST['add'])) { $status = $cms->add(); if ($status !== true) { abr('error', $status); } else { refresh("?m=" . $_GET['m'] . "&c=list&sub_of=" . $_GET['sub_of'], $langArray['add_complete']); } } else { $_POST['visible'] = 'true'; } if ($_GET['sub_of'] != 0) { $pdata = $cms->get($_GET['sub_of']); abr('pdata', $pdata); }
function make_serialized_human_query($serialized) { //global $search; global $msg; global $charset; global $include_path; $to_unserialize = unserialize($serialized); $search = $to_unserialize["SEARCH"]; for ($i = 0; $i < count($search); $i++) { $op = "op_" . $i . "_" . $search[$i]; $field_ = "field_" . $i . "_" . $search[$i]; $inter = "inter_" . $i . "_" . $search[$i]; $fieldvar = "fieldvar_" . $i . "_" . $search[$i]; if (!isset($GLOBALS[${$op}])) { global ${$op}; } if (!isset($GLOBALS[${$field_}])) { global ${$field_}; } if (!isset($GLOBALS[${$inter}])) { global ${$inter}; } if (!isset($GLOBALS[${$fieldvar}])) { global ${$fieldvar}; } ${$op} = $to_unserialize[$i]["OP"]; ${$field_} = $to_unserialize[$i]["FIELD"]; ${$inter} = $to_unserialize[$i]["INTER"]; ${$fieldvar} = $to_unserialize[$i]["FIELDVAR"]; } $r = ""; for ($i = 0; $i < count($search); $i++) { $s = explode("_", $search[$i]); if ($s[0] == "f") { $title = $this->fixedfields[$s[1]]["TITLE"]; } elseif (array_key_exists($s[0], $this->pp)) { $title = $this->pp[$s[0]]->t_fields[$s[1]]["TITRE"]; } elseif ($s[0] == "s") { $title = $this->specialfields[$s[1]]["TITLE"]; } $op = "op_" . $i . "_" . $search[$i]; $operator = $this->operators[${$op}]; $field_ = "field_" . $i . "_" . $search[$i]; $field = ${$field_}; //Recuperation des variables auxiliaires $fieldvar_ = "fieldvar_" . $i . "_" . $search[$i]; $fieldvar = ${$fieldvar_}; if (!is_array($fieldvar)) { $fieldvar = array(); } $field_aff = array(); if (array_key_exists($s[0], $this->pp)) { $datatype = $this->pp[$s[0]]->t_fields[$s[1]]["DATATYPE"]; $df = $this->dynamicfields[$s[0]]["FIELD"][$this->get_id_from_datatype($datatype, $s[0])]; $q_index = $df["QUERIES_INDEX"]; $q = $df["QUERIES"][$q_index[${$op}]]; if ($q["DEFAULT_OPERATOR"]) { $operator_multi = $q["DEFAULT_OPERATOR"]; } for ($j = 0; $j < count($field); $j++) { $field_aff[$j] = $this->pp[$s[0]]->get_formatted_output(array(0 => $field[$j]), $s[1]); } } elseif ($s[0] == "f") { $ff = $this->fixedfields[$s[1]]; $q_index = $ff["QUERIES_INDEX"]; $q = $ff["QUERIES"][$q_index[${$op}]]; if ($fieldvar["operator_between_multiple_authorities"]) { $operator_multi = $fieldvar["operator_between_multiple_authorities"][0]; } else { if ($q["DEFAULT_OPERATOR"]) { $operator_multi = $q["DEFAULT_OPERATOR"]; } } switch ($this->fixedfields[$s[1]]["INPUT_TYPE"]) { case "list": $options = $this->fixedfields[$s[1]]["INPUT_OPTIONS"]["OPTIONS"][0]; $opt = array(); for ($j = 0; $j < count($options["OPTION"]); $j++) { if (substr($options["OPTION"][$j]["value"], 0, 4) == "msg:") { $opt[$options["OPTION"][$j]["VALUE"]] = $msg[substr($options["OPTION"][$j]["value"], 4, strlen($options["OPTION"][$j]["value"]) - 4)]; } else { $opt[$options["OPTION"][$j]["VALUE"]] = $options["OPTION"][$j]["value"]; } } for ($j = 0; $j < count($field); $j++) { $field_aff[$j] = $opt[$field[$j]]; } break; case "query_list": $requete = $this->fixedfields[$s[1]]["INPUT_OPTIONS"]["QUERY"][0]["value"]; if ($this->fixedfields[$s[1]]["INPUT_OPTIONS"]["FILTERING"] == "yes") { $requete = str_replace("!!acces_j!!", "", $requete); $requete = str_replace("!!statut_j!!", "", $requete); $requete = str_replace("!!statut_r!!", "", $requete); } if ($this->fixedfields[$s[1]]["INPUT_OPTIONS"]["QUERY"][0]["USE_GLOBAL"]) { $use_global = explode(",", $this->fixedfields[$s[1]]["INPUT_OPTIONS"]["QUERY"][0]["USE_GLOBAL"]); for ($j = 0; $j < count($use_global); $j++) { $var_global = $use_global[$j]; global ${$var_global}; $requete = str_replace("!!" . $var_global . "!!", ${$var_global}, $requete); } } $resultat = pmb_mysql_query($requete); $opt = array(); while ($r_ = @pmb_mysql_fetch_row($resultat)) { $opt[$r_[0]] = $r_[1]; } for ($j = 0; $j < count($field); $j++) { $field_aff[$j] = $opt[$field[$j]]; } break; case "marc_list": $opt = new marc_list($this->fixedfields[$s[1]]["INPUT_OPTIONS"]["NAME"][0]["value"]); for ($j = 0; $j < count($field); $j++) { $field_aff[$j] = $opt->table[$field[$j]]; } break; case "date": $field_aff[0] = format_date($field[0]); break; case "authoritie": for ($j = 0; $j < sizeof($field); $j++) { if (is_numeric($field[$j]) && ${$op} == "AUTHORITY") { switch ($ff['INPUT_OPTIONS']['SELECTOR']) { case "categorie": $field[$j] = categories::getlibelle($field[$j], $lang); break; case "auteur": $aut = new auteur($field[$j]); if ($aut->rejete) { $field[$j] = $aut->name . ', ' . $aut->rejete; } else { $field[$j] = $aut->name; } if ($aut->date) { $field[$j] .= " ({$aut->date})"; } break; case "editeur": $ed = new editeur($field[$j]); $field[$j] = $ed->name; if ($ed->ville) { if ($ed->pays) { $field[$j] .= " ({$ed->ville} - {$ed->pays})"; } else { $field[$j] .= " ({$ed->ville})"; } } break; case "collection": $coll = new collection($field[$j]); $field[$j] = $coll->name; break; case "subcollection": $coll = new subcollection($field[$j]); $field[$j] = $coll->name; break; case "serie": $serie = new serie($field[$j]); $field[$j] = $serie->name; break; case "indexint": $indexint = new indexint($field[$j]); if ($indexint->comment) { $field[$j] = $indexint->name . " - " . $indexint->comment; } else { $field[$j] = $indexint->name; } if ($thesaurus_classement_mode_pmb != 0) { $field[$j] = "[" . $indexint->name_pclass . "] " . $field[$j]; } break; case "titre_uniforme": $tu = new titre_uniforme($field[$j]); $field[$j] = $tu->name; break; case "notice": $requete = "select if(serie_name is not null,if(tnvol is not null,concat(serie_name,', ',tnvol,'. ',tit1),concat(serie_name,'. ',tit1)),tit1) AS tit from notices left join series on serie_id=tparent_id where notice_id='" . $field[$j] . "' "; $res = pmb_mysql_query($requete); if ($res && pmb_mysql_num_rows($res)) { $field[$j] = pmb_mysql_result($res, 0, 0); } break; } } } $field_aff = $field; break; default: $field_aff = $field; break; } } elseif ($s[0] == "s") { //appel de la fonction make_human_query de la classe du champ special //Recherche du type $type = $this->specialfields[$s[1]]["TYPE"]; for ($is = 0; $is < count($this->tableau_speciaux["TYPE"]); $is++) { if ($this->tableau_speciaux["TYPE"][$is]["NAME"] == $type) { $sf = $this->specialfields[$s[1]]; require_once $include_path . "/search_queries/specials/" . $this->tableau_speciaux["TYPE"][$is]["PATH"] . "/search.class.php"; $specialclass = new $this->tableau_speciaux["TYPE"][$is]["CLASS"]($s[1], $i, $sf, $this); $field_aff = $specialclass->make_human_query(); $field_aff[0] = html_entity_decode(strip_tags($field_aff[0]), ENT_QUOTES, $charset); break; } } } //Ajout des variables si necessaire reset($fieldvar); $fieldvar_aff = array(); while (list($var_name, $var_value) = each($fieldvar)) { //Recherche de la variable par son nom $vvar = $this->fixedfields[$s[1]]["VAR"]; for ($j = 0; $j < count($vvar); $j++) { if ($vvar[$j]["TYPE"] == "input" && $vvar[$j]["NAME"] == $var_name) { //Calcul de la visibilite $varname = $vvar[$j]["NAME"]; $visibility = 1; $vis = $vvar[$j]["OPTIONS"]["VAR"][0]; if ($vis["NAME"]) { $vis_name = $vis["NAME"]; global ${$vis_name}; if ($vis["VISIBILITY"] == "no") { $visibility = 0; } for ($k = 0; $k < count($vis["VALUE"]); $k++) { if ($vis["VALUE"][$k]["value"] == ${$vis_name}) { if ($vis["VALUE"][$k]["VISIBILITY"] == "no") { $sub_vis = 0; } else { $sub_vis = 1; } if ($vis["VISIBILITY"] == "no") { $visibility |= $sub_vis; } else { $visibility &= $sub_vis; } break; } } } $var_list_aff = array(); $flag_aff = false; if ($visibility) { switch ($vvar[$j]["OPTIONS"]["INPUT"][0]["TYPE"]) { case "query_list": $query_list = $vvar[$j]["OPTIONS"]["INPUT"][0]["QUERY"][0]["value"]; $r_list = pmb_mysql_query($query_list); while ($line = pmb_mysql_fetch_array($r_list)) { $as = array_search($line[0], $var_value); if ($as !== false && $as !== NULL) { $var_list_aff[] = $line[1]; } } if ($vvar[$j]["OPTIONS"]["INPUT"][0]["QUERY"][0]["ALLCHOICE"] == "yes" && count($var_list_aff) == 0) { $var_list_aff[] = $msg[substr($vvar[$j]["OPTIONS"]["INPUT"][0]["QUERY"][0]["TITLEALLCHOICE"], 4, strlen($vvar[$j]["OPTIONS"]["INPUT"][0]["QUERY"][0]["TITLEALLCHOICE"]) - 4)]; } $fieldvar_aff[] = implode(" " . $msg["search_or"] . " ", $var_list_aff); $flag_aff = true; break; case "checkbox": $value = $var_value[0]; $label_list = $vvar[$j]["OPTIONS"]["INPUT"][0]["COMMENTS"][0]["LABEL"]; for ($indice = 0; $indice < count($label_list); $indice++) { if ($value == $label_list[$indice]["VALUE"]) { $libelle = $label_list[$indice]["value"]; break; } } $fieldvar_aff[] = $libelle; $flag_aff = true; break; } if ($flag_aff) { $fieldvar_aff[count($fieldvar_aff) - 1] = $vvar[$j]["COMMENT"] . " : " . $fieldvar_aff[count($fieldvar_aff) - 1]; } } } } } switch ($operator_multi) { case "and": $op_list = $msg["search_and"]; break; case "or": $op_list = $msg["search_or"]; break; default: $op_list = $msg["search_or"]; break; } $texte = implode(" " . $op_list . " ", $field_aff); //$texte=implode(" ".$msg["search_or"]." ",$field_aff); if (count($fieldvar_aff)) { $texte .= " [" . implode(" ; ", $fieldvar_aff) . "]"; } $inter = "inter_" . $i . "_" . $search[$i]; switch (${$inter}) { case "and": $inter_op = $msg["search_and"]; break; case "or": $inter_op = $msg["search_or"]; break; case "ex": $inter_op = $msg["search_exept"]; break; default: $inter_op = ""; break; } if ($inter_op) { $inter_op = "<strong>" . htmlentities($inter_op, ENT_QUOTES, $charset) . "</strong>"; } $r .= $inter_op . " <i><strong>" . htmlentities($title, ENT_QUOTES, $charset) . "</strong> " . htmlentities($operator, ENT_QUOTES, $charset) . " (" . htmlentities($texte, ENT_QUOTES, $charset) . ")</i> "; } return $r; }
/** * Сохранение порядка категорий * @return null * @throws EngineException */ public function save_order($sort) { if (!$sort) { throw new EngineException(); } $i = 0; foreach ($sort as $id => $parent) { $id = (int) $id; if (!$parent || !$this->cats->get($parent)) { $parent = 0; } db::o()->p($id)->update(array('sort' => $i, 'parent_id' => (int) $parent), 'categories', 'WHERE id=? LIMIT 1'); $i++; } db::o()->query('ALTER TABLE `categories` ORDER BY `sort`'); }
function creer_categ_xml($dom, $parent, $niveau, $num_noeud, $libelle_categorie, $note_application, $comment_public, $num_parent) { global $dbh, $aff_langue; global $aff_note_application, $aff_commentaire, $aff_voir, $aff_voir_aussi, $aff_tg, $aff_ts; $noeud_categ = creer_noeud_xml($dom, $parent, "DE"); //ID creer_noeud_xml($dom, $noeud_categ, "ID", $num_noeud); //Libellé creer_noeud_xml($dom, $noeud_categ, "LIB_DE", $libelle_categorie); //Note application if ($note_application && $aff_note_application) { creer_noeud_xml($dom, $noeud_categ, "NA", $note_application); } //Commentaire public if ($comment_public && $aff_commentaire) { creer_noeud_xml($dom, $noeud_categ, "NOTE", $comment_public); } //Voir aussi if ($aff_voir_aussi) { $requete = "SELECT libelle_categorie,num_noeud_dest FROM voir_aussi JOIN categories ON num_noeud_dest=num_noeud AND categories.langue='" . $aff_langue . "' WHERE num_noeud_orig='" . $num_noeud . "' AND voir_aussi.langue='" . $aff_langue . "' ORDER BY libelle_categorie"; $res = pmb_mysql_query($requete); if ($res && pmb_mysql_num_rows($res)) { while ($va = pmb_mysql_fetch_object($res)) { if (trim($va->libelle_categorie)) { creer_noeud_xml($dom, $noeud_categ, "TA", $va->libelle_categorie); } } } } //Employé pour if ($aff_voir) { $requete = "SELECT libelle_categorie,id_noeud FROM noeuds JOIN categories ON id_noeud=num_noeud AND categories.langue='" . $aff_langue . "' WHERE num_renvoi_voir='" . $num_noeud . "' ORDER BY libelle_categorie"; $res = pmb_mysql_query($requete); if ($res && pmb_mysql_num_rows($res)) { while ($ep = pmb_mysql_fetch_object($res)) { if (trim($ep->libelle_categorie)) { creer_noeud_xml($dom, $noeud_categ, "EP", $ep->libelle_categorie); } } } } //Terme générique if ($aff_tg && $num_parent) { $requete = "SELECT libelle_categorie FROM categories WHERE langue='" . $aff_langue . "' AND num_noeud='" . $num_parent . "'"; $res = pmb_mysql_query($requete); if ($res && pmb_mysql_num_rows($res)) { while ($tg = pmb_mysql_fetch_object($res)) { if (trim($tg->libelle_categorie)) { creer_noeud_xml($dom, $noeud_categ, "TG", $tg->libelle_categorie); } } } } //TS if ($aff_ts) { $res = categories::listChilds($num_noeud, $aff_langue, 0, "libelle_categorie"); if ($res && pmb_mysql_num_rows($res)) { $noeud_ts = creer_noeud_xml($dom, $noeud_categ, "TS" . $niveau); while ($categ = pmb_mysql_fetch_object($res)) { if (trim($categ->libelle_categorie)) { creer_categ_xml($dom, $noeud_ts, $niveau + 1, $categ->num_noeud, $categ->libelle_categorie, $categ->note_application, $categ->comment_public, $categ->num_parent); } } } } }
public function actionUpdateCategory() { $errors = array(); if (!isset($_GET['value'])) { $errors[] = 'A category ID must be supplied'; } else { if (!is_numeric($_GET['value'])) { $errors[] = "Provided category ID must be an integer"; } else { if ($category = categories::model()->getbyPK($_GET['value'])) { $updateAttributes = array('name' => null, 'description' => null); foreach ($updateAttributes as $updateAttribute => $value) { if (isset($_GET[$updateAttribute])) { $updateAttributes[$updateAttribute] = $_GET[$updateAttribute]; } else { unset($updateAttributes[$updateAttribute]); } } $category->setAttributes($updateAttributes); if ($category->save()) { $attributes = array('id', 'name', 'created', 'modified', 'description'); $data = array($this->returnValues($category, $attributes)); } else { $errors[] = 'The category could not be updated'; } } else { $errors[] = 'Could not find category with ID of ' . $_GET['value']; } } } if (count($errors) > 0) { $this->renderApi(false, null, $errors); } else { $this->renderApi(true, $data); } }
function create_categ($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; }