0 Пользователей и 1 Гость просматривают эту тему.
  • 0 Ответов
  • 1574 Просмотров
*

310

  • Новичок
  • 6
  • 0 / 0
Вывожу материалы, созданные конкретным пользователем в его профиле Kunena таким кодом (ниже). Сейчас выбор делается из приложения 1. Мне нужно сделать еще одну подобную вкладку для материалов из приложения 2. Если просто сдублировать код, получаю ошибку 500. Видимо, что-то вызывается дважды. Автор кода недоступен, может, кто подскажет, как модифицировать то, что есть?
Код
<!-----начало галереи-->
    <dt class="closed" title="Галерея"><strong>Галерея</strong></dt>
    <dd style="display: none;">
<div class="kblock kflat">
<?php echo '<h2>Галерея</h2>';
function getConditions($zoo, $user_id, $params) {
$db = $zoo->database;

$conditions = "a.".$zoo->user->getDBAccessString($zoo->user->get());

if(($applications = $params->get('zooapplications')) && !empty($applications)) {
$applicationIds = array();
$applications = explode("|*|", $applications);

foreach($applications as $id) {
if(!empty($id)) {
$applicationIds[] = $db->Quote((int) $id);
}
}
if(!empty($applicationIds)) {
$conditions .= " AND a.application_id".($params->get('zooapplications_selection', 0)? "" : " NOT")." IN (".implode(', ', $applicationIds).")";
}
}

if(($types = $params->get('zootypes')) && !empty($types)) {
$typeIds = array();
$types = explode("|*|", $types);
foreach($types as $id) {
if(!empty($id)) {
$typeIds[] = $db->Quote($db->escape((string) $id));
}
}
if(!empty($typeIds)) {
$conditions .= " AND a.type".($params->get('zootypes_selection', 0)? "" : " NOT")." IN (".implode(', ', $typeIds).")";
}
}

if(($categories = $params->get('zoocategories')) && !empty($categories)) {
$categoryIds = array();
$categories = explode("|*|", $categories);
foreach($categories as $id) {
if(!empty($id)) {
$categoryIds[] = $db->Quote((int) $id);
}
}
if(!empty($categoryIds)) {
$conditions .= " AND c.category_id".($params->get('zoocategories_selection', 0)? "" : " NOT")." IN (".implode(', ', $categoryIds).")";
}
}

$conditions .= " AND a.created_by = ".$db->Quote($db->escape((int) $user_id));

if(!$params->get('expired', 0)) {
$date = $zoo->date->create();
$now  = $db->Quote($date->toSQL());
$null = $db->Quote($db->getNullDate());
$conditions .= " AND (a.publish_up = ".$null." OR a.publish_up <= ".$now.")"
." AND (a.publish_down = ".$null." OR a.publish_down >= ".$now.")";
}

if($params->get('published', 1)) {
$conditions .= " AND a.state = 1";
}

return $conditions;
}

require_once(JPATH_ADMINISTRATOR.'/components/com_zoo/config.php');
$zoo = App::getInstance('zoo');
$zoo->system->language->load('com_zoo');

$user_id = JRequest::getInt('userid');

$par = array(
'zooapplications' => '1',
'zooapplications_selection' => '1',
'zootypes' => '0',
'zootypes_selection' => '0',
'zoocategories' => '0',
'zoocategories_selection' => '0',
'expired' => '0',
'published' => '1'
);

$params = new JRegistry();
$params->loadString(json_encode($par));

$options = array('select' => 'a.*',
'from' => ZOO_TABLE_ITEM.' AS a'
.' LEFT JOIN '.ZOO_TABLE_TAG.' AS b ON a.id = b.item_id'
.' LEFT JOIN '.ZOO_TABLE_CATEGORY_ITEM.' AS c ON a.id = c.item_id',
'conditions' => getConditions($zoo, $user_id, $params),
'order' => 'a.priority DESC');

$items = $zoo->table->item->all($options); ?>

<div id="yoo-zoo">
<?php if (!empty($items)) : ?>
<div class="pos-related">
                    <style>
.myitem img {
width: 100% !important;
height: auto !important;
max-height: none;
}

.myitem .pos-title, .myitem .pos-meta, .myitem .yoo-zoo.rating, .myitem .pos-content, .myitem .pos-links, .myitem p {
display: none !important;
}
</style>
<div id="d5c1c6ad-148e-47d6-a537-871177045ee7-6">
<?php foreach ($items as $item) : ?>
<div class="myitem" style="width: 20%; height: auto; max-height: 200px !important">
<div class="floatbox">
<div class="pos-media media-left">
<div class="element element-image first last">
<?php $item_html = null;
$renderer = $zoo->renderer->create('item')->addPath(array($zoo->path->path('component.site:'), $item->getApplication()->getTemplate()->getPath()));
$path   = 'item';
$prefix = 'item.';
$type = $item->getType()->id;

if ($renderer->pathExists($path.DIRECTORY_SEPARATOR.$type)) {
$path .= DIRECTORY_SEPARATOR.$type;
$prefix .= $type.'.';
}

if (in_array('teaser', $renderer->getLayouts($path))) {
$item_html = $renderer->render($prefix.'teaser', array('view' => $item->getApplication(), 'item' => $item));
} elseif (in_array('related', $renderer->getLayouts($path))) {
$item_html = $renderer->render($prefix.'related', array('view' => $item->getApplication(), 'item' => $item));
}

echo $item_html; ?>
</div>
</div>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
<?php else : ?>
<div class="no-items">
Ничего не найдено
</div>
<?php endif; ?>
</div>
            </div>
</dd>
<!---->

    <dt class="closed" title="Новости"><strong>Новости</strong></dt>
    <dd style="display: none;">
<div class="kblock kflat">
           

            </div>
</dd>           
<!---конец галереи, начало моделей---> 
Чтобы оставить сообщение,
Вам необходимо Войти или Зарегистрироваться
 

Проблема с добавлением материалов в ZOO

Автор tvorec1988

Ответов: 1
Просмотров: 1446
Последний ответ 22.02.2021, 22:21:14
от draff
Где настраивается вывод колиства товара на странице?

Автор Lopes-popes

Ответов: 1
Просмотров: 2029
Последний ответ 09.08.2019, 00:12:54
от Lopes-popes
Вывод материала категории

Автор face2005

Ответов: 0
Просмотров: 2091
Последний ответ 28.09.2018, 18:26:52
от face2005
Вывод в ZOO description материалов по формуле "название+статическое описание"

Автор saschka

Ответов: 0
Просмотров: 2559
Последний ответ 24.04.2017, 14:41:48
от saschka
Вывод полей в ZOO по образцу (помощь или сделать на заказ за вознаграждение)

Автор saschka

Ответов: 2
Просмотров: 1581
Последний ответ 12.01.2017, 17:27:18
от saschka