本文整理汇总了PHP中categories类的典型用法代码示例。如果您正苦于以下问题:PHP categories类的具体用法?PHP categories怎么用?PHP categories使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了categories类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Конструктор категорий
* @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'));
}
示例2: validateIsCategory
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;
}
}
示例3: import_new_notice_suite
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);
}
}
}
}
}
示例4: add
/**
* Добавление контента
* @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');
}
示例5: __construct
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'];
}
}
示例6: actionIndex
/**
* 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));
}
}
示例7: import_new_notice_suite
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++;
}
}
}
示例8: categories
$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
示例9: abr
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'])) {
示例10: _export_
//.........这里部分代码省略.........
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":
示例11: build_categ
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;
}
示例12: import_new_notice_suite
//.........这里部分代码省略.........
$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);
}
}
}
示例13: cleanCategoriesPath
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;
}
示例14: mysql_query
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)) {
示例15: foreach
?>
</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