<?php
/**
* [BEGIN_COT_EXT]
* Hooks=market.index.presearch.tags
* [END_COT_EXT]
*/
defined('COT_CODE') or die('Wrong URL');
if($usr['id'] > 0 && $index_presearch == 'projects') {
require_once cot_incfile('projects', 'module');
$where = array();
$order = array();
$where['state'] = "item_userid=".$usr['id'];
$order['date'] = 'item_date DESC';
$where = ($where) ? 'WHERE ' . implode(' AND ', $where) : '';
$order = ($order) ? 'ORDER BY ' . implode(', ', $order) : '';
$db->update($db_projects, array('item_state' => 1), 'item_state=0 AND ((item_update>0 AND item_update<'.($sys['now'] - 86400).') OR ((item_update=0 AND item_date<'.($sys['now'] - 86400).')))');
$sqllist = $db->query("SELECT p.*, u.* $join_columns
FROM $db_projects AS p $join_condition
LEFT JOIN $db_users AS u ON u.user_id=p.item_userid
" . $where . "
" . $order . "
LIMIT 20");
$sqllist_rowset = $sqllist->fetchAll();
/* === Hook === */
$extp = cot_getextplugins('projects.list.loop');
/* ===== */
$jj=0;
foreach($sqllist_rowset as $item)
{
$jj++;
$t->assign(cot_generate_usertags($item, 'PRJ_ROW_OWNER_'));
$t->assign(cot_generate_projecttags($item, 'PRJ_ROW_', $cfg['projects']['shorttextlen'], $usr['isadmin'], $cfg['homebreadcrumb']));
/* === Hook - Part2 : Include === */
foreach ($extp as $pl)
{
include $pl;
}
/* ===== */
$t->parse("MAIN.PROJECTS_PRESEARCH_LIST");
}
if($jj == 0) $t->parse("MAIN.PROJECTS_PRESEARCH_EMPTY");
}