本文整理汇总了PHP中OOCategory类的典型用法代码示例。如果您正苦于以下问题:PHP OOCategory类的具体用法?PHP OOCategory怎么用?PHP OOCategory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了OOCategory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: matchCategory
/**
* Wert für die Ausgabe
*/
function matchCategory($content, $replaceInTemplate = false)
{
global $REX;
$var = 'REX_CATEGORY';
$matches = $this->getVarParams($content, $var);
foreach ($matches as $match) {
list($param_str, $args) = $match;
list($category_id, $args) = $this->extractArg('id', $args, 0);
list($clang, $args) = $this->extractArg('clang', $args, '$REX[\'CUR_CLANG\']');
list($field, $args) = $this->extractArg('field', $args, '');
$tpl = '';
if ($category_id == 0) {
// REX_CATEGORY[field=name] feld von aktueller kategorie verwenden
if (OOCategory::hasValue($field)) {
// bezeichner wählen, der keine variablen
// aus modulen/templates überschreibt
// beachte: root-artikel haben keine kategorie
$varname_art = '$__rex_art';
$varname_cat = '$__rex_cat';
$tpl = '<?php
' . $varname_art . ' = OOArticle::getArticleById($REX[\'ARTICLE_ID\'], ' . $clang . ');
' . $varname_cat . ' = ' . $varname_art . '->getCategory();
if(' . $varname_cat . ') echo htmlspecialchars(' . $this->handleGlobalVarParamsSerialized($var, $args, $varname_cat . '->getValue(\'' . addslashes($field) . '\')') . ');
?>';
}
} else {
if ($category_id > 0) {
// REX_CATEGORY[field=name id=5] feld von gegebene category_id verwenden
if ($field) {
if (OOCategory::hasValue($field)) {
// bezeichner wählen, der keine variablen
// aus modulen/templates überschreibt
$varname = '$__rex_cat';
$tpl = '<?php
' . $varname . ' = OOCategory::getCategoryById(' . $category_id . ', ' . $clang . ');
if(' . $varname . ') echo htmlspecialchars(' . $this->handleGlobalVarParamsSerialized($var, $args, $varname . '->getValue(\'' . addslashes($field) . '\')') . ');
?>';
}
}
}
}
if ($tpl != '') {
$content = str_replace($var . '[' . $param_str . ']', $tpl, $content);
}
}
return $content;
}
示例2: navi
function navi()
{
echo "<ul>";
// start HTML-List
$max_depth = 3;
// max nesting-depth root is depth=0
$inc_art = true;
// include articles
$inc_root_art = false;
// include root articles
$inc_start_art = false;
// include start article
$config = array($max_depth, $inc_art, $inc_start_art, $inc_root_art);
// config array
$items = [];
// wrapper for subitem sizes
$count = 0;
// items per nesting level
foreach (OOCategory::getRootCategories() as $item) {
if (!$item->isOnline()) {
continue;
}
$count++;
// initalize each root-item
// print root-item
echo '<li><a href="' . $item->getUrl() . '" title="' . $item->getName() . '">' . $item->getName() . '</a></li>';
$d = 0;
// set nesting-depth for root-item
getSubItems($item, $d, $config);
$d = 0;
// REset nesting-depth for root-item
}
// get Root Articles
if (sizeof(OOArticle::getRootArticles()) >= 1 && $config[3]) {
foreach (OOArticle::getRootArticles() as $art) {
if (!$art->isOnline()) {
continue;
}
echo '<li><a href="' . $art->getUrl() . '" title="' . $art->getName() . '">' . $art->getName() . '</a></li>';
}
}
echo "</ul>";
}
示例3: rex_a62_metainfo_button
function rex_a62_metainfo_button($params)
{
global $REX, $I18N;
$s = '';
$restrictionsCondition = '';
if (isset($params['id']) && $params['id'] != '') {
$OOCat = OOCategory::getCategoryById($params['id']);
// Alle Metafelder des Pfades sind erlaubt
foreach (explode('|', $OOCat->getPath()) as $pathElement) {
if ($pathElement != '') {
$s .= ' OR `p`.`restrictions` LIKE "%|' . $pathElement . '|%"';
}
}
// Auch die Kategorie selbst kann Metafelder haben
$s .= ' OR `p`.`restrictions` LIKE "%|' . $params['id'] . '|%"';
}
$restrictionsCondition = 'AND (`p`.`restrictions` = ""' . $s . ')';
$fields = _rex_a62_metainfo_sqlfields('cat_', $restrictionsCondition);
if ($fields->getRows() >= 1) {
$return = '<p class="rex-button-add"><script type="text/javascript"><!--
function rex_metainfo_toggle()
{
jQuery("#rex-form-structure-category .rex-metainfo-cat").toggle();
metacat = jQuery("#rex-i-meta-category");
if(metacat.hasClass("rex-i-generic-open"))
{
metacat.removeClass("rex-i-generic-open");
metacat.addClass("rex-i-generic-close");
}
else
{
metacat.removeClass("rex-i-generic-close");
metacat.addClass("rex-i-generic-open");
}
}
//--></script><a id="rex-i-meta-category" class="rex-i-generic-open" href="javascript:rex_metainfo_toggle();">' . $I18N->msg('minfo_edit_metadata') . '</a></p>';
return $params['subject'] . $return;
}
return $params['subject'];
}
示例4: hasCategoryPerm
function hasCategoryPerm($category_id, $depricatedSecondParam = null)
{
// 1. Volle Rechte auf direkte Kategorie, csw
// 2. Leserechte, bei Kategorien "zwischen" main und eigener navi, aber nicht sichtbar, csr
// 3. Volle Rechte, wenn Kategorie unterhalb eine vollen Rechte Kat
if ($this->isAdmin() || $this->hasPerm('csw[0]') || $this->hasPerm('csw[' . $category_id . ']')) {
return true;
}
if ($c = OOCategory::getCategoryById($category_id)) {
foreach ($c->getPathAsArray() as $k) {
if ($this->hasPerm('csw[' . $k . ']')) {
return true;
}
}
}
/*if(!$rw)
{
if( $this->hasPerm('csr[' . $category_id . ']') )
return TRUE;
} */
return false;
}
示例5: array
<div id="rex-linkmap">
<div class="rex-area-col-2">
<div class="rex-area-col-a">
<h3 class="rex-hl2"><?php
echo $I18N->msg('lmap_categories');
?>
</h3>
<div class="rex-area-content">
<?php
$roots = OOCategory::getRootCategories();
$mountpoints = $REX['USER']->getMountpoints();
if (count($mountpoints) > 0) {
$roots = array();
foreach ($mountpoints as $mp) {
if (OOCategory::getCategoryById($mp)) {
$roots[] = OOCategory::getCategoryById($mp);
}
}
}
echo rex_linkmap_tree($tree, $category_id, $roots, $GlobalParams);
?>
</div>
</div>
<div class="rex-area-col-b">
<h3 class="rex-hl2"><?php
echo $I18N->msg('lmap_articles');
?>
</h3>
<div class="rex-area-content">
<ul>
示例6: getListValue
static function getListValue($params)
{
$return = array();
foreach (explode(',', $params['value']) as $id) {
if ($cat = OOCategory::getCategoryById($id, (int) $params['params']['field']['clang'])) {
$return[] = $cat->getName();
}
}
return implode('<br />', $return);
}
示例7: elseif
function &_getCategoryObject($category, $clang = false)
{
if (is_object($category)) {
return $category;
} elseif (is_int($category)) {
return OOCategory::getCategoryById($category, $clang);
} elseif (is_array($category)) {
$catlist = array();
foreach ($category as $cat) {
$catobj = OOCategory::_getCategoryObject($cat, $clang);
if (is_object($catobj)) {
$catlist[] = $catobj;
} else {
return null;
}
}
return $catlist;
}
return null;
}
示例8: getURL
/**
* Gibt die URL der Terminkategorie zurück.
* @global mixed[] $REX Redaxo Variable
* @var boolean $path_only Gibt an, ob die URL mit Domain oder ohne erstellt
* werden soll.
* @return String URL für das Objekt
*/
function getURL($path_only = FALSE)
{
if ($this->url == "") {
global $REX;
$pathname = '';
if (OOAddon::isActivated('seo42')) {
// Mit SEO42
require_once dirname(__FILE__) . "/../../seo42/classes/class.seo42_rewrite.inc.php";
// Dann Redaxo Artikelfolge
if ($REX['ADDON']['d2u_kurse']['settings']['kurse_artikel'] > 0 && $REX['ADDON']['d2u_kurse']['settings']['kurse_artikel'] != $REX['START_ARTICLE_ID']) {
$kategorie = OOCategory::getCategoryById($REX['ADDON']['d2u_kurse']['settings']['kurse_artikel'], $REX['CUR_CLANG']);
$hauptkategorien = $kategorie->getPathAsArray();
for ($i = 0; $i < count($hauptkategorien); $i++) {
$hauptkategorie = OOCategory::getCategoryById($hauptkategorien[$i], $REX['CUR_CLANG']);
if ($hauptkategorie instanceof OOCategory) {
$pathname = seo42_appendToPath($pathname, $hauptkategorie->getName(), $hauptkategorie->getId(), $REX['CUR_CLANG']);
}
}
if ($kategorie->getName() != "") {
$pathname = seo42_appendToPath($pathname, $kategorie->getName(), $kategorie->getId(), $REX['CUR_CLANG']);
} else {
// Wenn angegebener Artikel keine Kategorie ist, sondern nur Artikelname hat
$pathname = seo42_appendToPath($pathname, $kategorie->getValue("name"), $kategorie->getId(), $REX['CUR_CLANG']);
}
}
// Art der Startkachel
$pathname = seo42_appendToPath($pathname, $REX['ADDON']['d2u_kurse']['settings']['termin_titel'], $REX['ADDON']['d2u_kurse']['settings']['kurse_artikel'], $REX['CUR_CLANG']);
// Die Elternkategorie
if ($this->eltern_terminkategorie !== FALSE) {
$pathname = seo42_appendToPath($pathname, $this->eltern_terminkategorie->name, $REX['ADDON']['d2u_kurse']['settings']['kurse_artikel'], $REX['CUR_CLANG']);
}
// Die Terminkategorie
$pathname = seo42_appendToPath($pathname, $this->name, $REX['ADDON']['d2u_kurse']['settings']['kurse_artikel'], $REX['CUR_CLANG']);
$pathname = substr($pathname, 0, -1) . $REX['ADDON']['seo42']['settings']['url_ending'];
} else {
// Ohne SEO42
$parameterArray = array();
$parameterArray['terminkategorie_id'] = $this->terminkategorie_id;
$pathname = rex_getUrl($REX['ADDON']['d2u_kurse']['settings']['kurse_artikel'], $REX['CUR_CLANG'], $parameterArray, "&");
}
$this->url = $pathname;
}
if ($path_only) {
return $this->url;
} else {
return $REX['SERVER'] . $this->url;
}
}
示例9: getCategory
function getCategory()
{
return OOCategory::getCategoryById($this->getCategoryId(), $this->getClang());
}
示例10: getTemplates
function getTemplates($category_id, $ignore_inactive = true)
{
global $REX;
$ignore_inactive = $ignore_inactive ? 1 : 0;
$templates = array();
$t_sql = rex_sql::factory();
$t_sql->setQuery('select id,name,attributes from ' . $REX['TABLE_PREFIX'] . 'template where active=' . $ignore_inactive . ' order by name');
if ($category_id < 1) {
// Alle globalen Templates
foreach ($t_sql->getArray() as $t) {
$categories = rex_getAttributes("categories", $t["attributes"]);
if (!is_array($categories) || $categories["all"] == 1) {
$templates[$t["id"]] = $t['name'];
}
}
} else {
if ($c = OOCategory::getCategoryById($category_id)) {
$path = $c->getPathAsArray();
$path[] = $category_id;
foreach ($t_sql->getArray() as $t) {
$categories = rex_getAttributes("categories", $t["attributes"]);
// template ist nicht kategoriespezifisch -> includen
if (!is_array($categories) || $categories["all"] == 1) {
$templates[$t["id"]] = $t['name'];
} else {
// template ist auf kategorien beschraenkt..
// nachschauen ob eine davon im pfad der aktuellen kategorie liegt
foreach ($path as $p) {
if (in_array($p, $categories)) {
$templates[$t["id"]] = $t['name'];
break;
}
}
}
}
}
}
return $templates;
}
示例11: stripslashes
// Zuweisungen für Wiederanzeige
$REX['MOD_REWRITE'] = $neu_modrewrite === 'TRUE';
// FŸr die Wiederanzeige Slashes strippen
$REX['ERROR_EMAIL'] = stripslashes($neu_error_emailaddress);
$REX['SERVER'] = stripslashes($neu_SERVER);
$REX['SERVERNAME'] = stripslashes($neu_SERVERNAME);
}
}
}
$sel_template = new rex_select();
$sel_template->setStyle('class="rex-form-select"');
$sel_template->setName('neu_defaulttemplateid');
$sel_template->setId('rex-form-default-template-id');
$sel_template->setSize(1);
$sel_template->setSelected($REX['DEFAULT_TEMPLATE_ID']);
$templates = OOCategory::getTemplates(0);
if (empty($templates)) {
$sel_template->addOption($I18N->msg('option_no_template'), 0);
} else {
$sel_template->addArrayOptions($templates);
}
$sel_lang = new rex_select();
$sel_lang->setStyle('class="rex-form-select"');
$sel_lang->setName('neu_lang');
$sel_lang->setId('rex-form-lang');
$sel_lang->setSize(1);
$sel_lang->setSelected($REX['LANG']);
foreach ($REX['LOCALES'] as $l) {
$sel_lang->addOption($l, $l);
}
$sel_mod_rewrite = new rex_select();
示例12: rex_editArticle
/**
* Bearbeitet einen Artikel
*
* @param int $article_id Id des Artikels der verändert werden soll
* @param int $clang Id der Sprache
* @param array $data Array mit den Daten des Artikels
*
* @return array Ein Array welches den status sowie eine Fehlermeldung beinhaltet
*/
function rex_editArticle($article_id, $clang, $data)
{
global $REX, $I18N;
$success = false;
$message = '';
if (!is_array($data)) {
trigger_error('Expecting $data to be an array!', E_USER_ERROR);
}
$templates = OOCategory::getTemplates($data['category_id']);
// Wenn Template nicht vorhanden, dann entweder erlaubtes nehmen
// oder leer setzen.
if (!isset($templates[$data['template_id']])) {
$data['template_id'] = 0;
if (count($templates) > 0) {
$data['template_id'] = key($templates);
}
}
// Artikel mit alten Daten selektieren
$thisArt = rex_sql::factory();
$thisArt->setQuery('select * from ' . $REX['TABLE_PREFIX'] . 'article where id=' . $article_id . ' and clang=' . $clang);
if (isset($data['prior'])) {
if ($data['prior'] <= 0) {
$data['prior'] = 1;
}
}
$EA = rex_sql::factory();
$EA->setTable($REX['TABLE_PREFIX'] . 'article');
$EA->setWhere("id='{$article_id}' and clang={$clang}");
$EA->setValue('name', $data['name']);
$EA->setValue('template_id', $data['template_id']);
$EA->setValue('prior', $data['prior']);
$EA->addGlobalUpdateFields();
if ($EA->update()) {
$message = $I18N->msg('article_updated');
// ----- PRIOR
rex_newArtPrio($data['category_id'], $clang, $data['prior'], $thisArt->getValue('prior'));
rex_deleteCacheArticle($article_id, $clang);
// ----- EXTENSION POINT
$message = rex_register_extension_point('ART_UPDATED', $message, array('id' => $article_id, 'article' => clone $EA, 'article_old' => clone $thisArt, 'status' => $thisArt->getValue('status'), 'name' => $data['name'], 'clang' => $clang, 're_id' => $data['category_id'], 'prior' => $data['prior'], 'path' => $data['path'], 'template_id' => $data['template_id'], 'data' => $data));
$success = true;
} else {
$message = $EA->getError();
}
return array($success, $message);
}
示例13: _getNavigation
function _getNavigation($category_id, $depth = 1)
{
if ($category_id < 1) {
$nav_obj = OOCategory::getRootCategories();
} else {
$nav_obj = OOCategory::getChildrenById($category_id);
}
$lis = array();
foreach ($nav_obj as $nav) {
$li = array();
$a = array();
$li['class'] = array();
$a['class'] = array();
$a['href'] = array($nav->getUrl());
if ($this->_checkFilter($nav, $depth) && $this->_checkCallbacks($nav, $depth, $li, $a)) {
$li['class'][] = 'rex-article-' . $nav->getId();
// classes abhaengig vom pfad
if ($nav->getId() == $this->current_category_id) {
$li['class'][] = 'rex-current';
$a['class'][] = 'rex-current';
} elseif (in_array($nav->getId(), $this->path)) {
$li['class'][] = 'rex-active';
$a['class'][] = 'rex-active';
} else {
$li['class'][] = 'rex-normal';
}
if (isset($this->linkclasses[$depth - 1])) {
$a['class'][] = $this->linkclasses[$depth - 1];
}
if (isset($this->classes[$depth - 1])) {
$li['class'][] = $this->classes[$depth - 1];
}
$li_attr = array();
foreach ($li as $attr => $v) {
$li_attr[] = $attr . '="' . implode(' ', $v) . '"';
}
$a_attr = array();
foreach ($a as $attr => $v) {
$a_attr[] = $attr . '="' . implode(' ', $v) . '"';
}
$l = '<li ' . implode(' ', $li_attr) . '>';
$l .= '<a ' . implode(' ', $a_attr) . '>' . htmlspecialchars($nav->getName()) . '</a>';
$depth++;
if (($this->open || $nav->getId() == $this->current_category_id || in_array($nav->getId(), $this->path)) && ($this->max_depth >= $depth || $this->max_depth < 0)) {
$l .= $this->_getNavigation($nav->getId(), $depth);
}
$depth--;
$l .= '</li>';
$lis[] = $l;
}
}
if (count($lis) > 0) {
return '<ul class="rex-navi' . $depth . ' rex-navi-depth-' . $depth . ' rex-navi-has-' . count($lis) . '-elements">' . implode('', $lis) . '</ul>';
}
return '';
}
示例14: _getNavigation
function _getNavigation($category_id, $ignore_offlines = TRUE)
{
static $depth = 0;
if ($category_id < 1) {
$nav_obj = OOCategory::getRootCategories($ignore_offlines);
} else {
$nav_obj = OOCategory::getChildrenById($category_id, $ignore_offlines);
}
$nav_real = array();
foreach ($nav_obj as $nav) {
// Filter und Rechte prüfen
if ($this->_check($nav, $depth)) {
$nav_real[] = $nav;
}
}
$counter = 0;
$count = count($nav_real);
// $count = 4;
$return = "";
if (count($nav_real) > 0) {
$return .= '<ul class="navi-lev-' . ($depth + 1) . '">';
}
foreach ($nav_real as $nav) {
$counter++;
$liClass = '';
$linkClass = '';
if ($counter == 1) {
$liClass .= ' first';
}
if ($counter == $count) {
$liClass .= ' last';
}
// classes abhaengig vom pfad
if ($nav->getId() == $this->current_category_id) {
$liClass .= ' current';
$linkClass .= ' current';
} elseif (in_array($nav->getId(), $this->path)) {
$liClass .= ' active';
$linkClass .= ' active';
} else {
$liClass .= ' normal';
}
// classes abhaengig vom level
if (isset($this->classes[$depth])) {
$liClass .= ' ' . $this->classes[$depth];
}
if (isset($this->linkclasses[$depth])) {
$linkClass .= ' ' . $this->linkclasses[$depth];
}
$name = str_replace(' ## ', '<br />', htmlspecialchars($nav->getName()), $str_count);
if ($str_count >= 1) {
$linkClass .= ' manbreak';
}
$linkClass = $linkClass == '' ? '' : ' class="' . ltrim($linkClass) . '"';
if (isset($this->wrap_names[$depth]) && $this->wrap_names[$depth] != "") {
$wrap = explode('|', $this->wrap_names[$depth]);
$name = $wrap[0] . $name . $wrap[1];
}
$link = '<a' . $linkClass . ' href="' . $nav->getUrl() . '">' . $name . '</a>';
if (isset($this->wrap_links[$depth]) && $this->wrap_links[$depth] != "") {
$wrap = explode('|', $this->wrap_links[$depth]);
$link = $wrap[0] . $link . $wrap[1];
}
$return .= '<li class="navi-id-' . $nav->getId() . $liClass . '">' . $link;
$depth++;
if (($this->open || $nav->getId() == $this->current_category_id || in_array($nav->getId(), $this->path)) && ($this->depth > $depth || $this->depth < 0)) {
$return .= $this->_getNavigation($nav->getId(), $ignore_offlines);
}
$depth--;
$return .= '</li>';
}
if (count($nav_real) > 0) {
$return .= '</ul>';
}
return $return;
}
示例15: getParent
function getParent()
{
return $this->_re_category_id > 0 ? OOCategory::getCategoryById($this->_re_category_id) : null;
}