Exemplo n.º 1
0
function cot_build_structure_folio_tree($parent = '', $selected = array(), $level = 0, $template = '')
{
    global $structure, $cfg, $db, $sys;
    global $i18n_notmain, $i18n_locale, $i18n_write, $i18n_admin, $i18n_read, $db_i18n_pages;
    if (empty($parent)) {
        $i18n_enabled = $i18n_read;
        $children = array();
        foreach ($structure['folio'] as $i => $x) {
            if (mb_substr_count($structure['folio'][$i]['path'], ".") == 0) {
                $children[] = $i;
            }
        }
    } else {
        $i18n_enabled = $i18n_read && cot_i18n_enabled($parent);
        $children = cot_structure_children('folio', $parent, false, false);
    }
    //cot_print($children, $parent);
    $t1 = new XTemplate(cot_tplfile(array('folio', 'tree', $template), 'module'));
    if (count($children) == 0) {
        return false;
    }
    $jj = 0;
    foreach ($children as $row) {
        $jj++;
        $t1->assign(array("ROW_TITLE" => htmlspecialchars($structure['folio'][$row]['title']), "ROW_DESC" => $structure['folio'][$row]['desc'], "ROW_COUNT" => $structure['folio'][$row]['count'], "ROW_ICON" => $structure['folio'][$row]['icon'], "ROW_HREF" => cot_url("folio", "c=" . $row . "&type=" . $type), "ROW_SELECTED" => in_array($row, $selected) ? 1 : 0, "ROW_SUBCAT" => cot_build_structure_folio_tree($row, $selected, $level + 1), "ROW_LEVEL" => $level, "ROW_ODDEVEN" => cot_build_oddeven($jj), "ROW_JJ" => $jj));
        if ($i18n_enabled && $i18n_notmain) {
            $x_i18n = cot_i18n_get_cat($row, $i18n_locale);
            if ($x_i18n) {
                $urlparams = !$cfg['plugin']['i18n']['omitmain'] || $i18n_locale != $cfg['defaultlang'] ? "c={$row}&l={$i18n_locale}" : "c={$row}";
                $t1->assign(array('ROW_URL' => cot_url('folio', $urlparams), 'ROW_TITLE' => $x_i18n['title'], 'ROW_DESC' => $x_i18n['desc']));
            }
        }
        $t1->parse("MAIN.CATS");
        $t1->assign(array("TITLE" => htmlspecialchars($structure['folio'][$parent]['title']), "DESC" => $structure['folio'][$parent]['desc'], "COUNT" => $structure['folio'][$parent]['count'], "ICON" => $structure['folio'][$parent]['icon'], "HREF" => cot_url("folio", "c=" . $parent), "LEVEL" => $level));
    }
    if ($jj == 0) {
        return false;
    }
    $t1->parse("MAIN");
    return $t1->text("MAIN");
}
Exemplo n.º 2
0
foreach (cot_getextplugins('folio.list.query') as $pl) {
    include $pl;
}
/* ===== */
$t = new XTemplate($mskin);
$where = $where ? 'WHERE ' . implode(' AND ', $where) : '';
$order = $order ? 'ORDER BY ' . implode(', ', $order) : '';
$totalitems = $db->query("SELECT COUNT(*) FROM {$db_folio} AS f {$join_condition} \n\tLEFT JOIN {$db_users} AS u ON u.user_id=f.item_userid\n\t" . $where . "")->fetchColumn();
$sqllist = $db->query("SELECT f.*, u.* {$join_columns} \n\tFROM {$db_folio} AS f {$join_condition} \n\tLEFT JOIN {$db_users} AS u ON u.user_id=f.item_userid \n\t" . $where . " \n\t" . $order . "\n\tLIMIT {$d}, " . $maxrowsperpage);
$pagenav = cot_pagenav('folio', $list_url_path, $d, $totalitems, $maxrowsperpage);
$catpatharray[] = array(cot_url('folio'), $L['folio']);
if (!empty($c)) {
    $catpatharray = array_merge($catpatharray, cot_structure_buildpath('folio', $c));
}
$catpath = cot_breadcrumbs($catpatharray, $cfg['homebreadcrumb'], true);
$t->assign(array("SEARCH_ACTION_URL" => cot_url('folio', '', '', true), "SEARCH_SQ" => cot_inputbox('text', 'sq', htmlspecialchars($sq), 'class="schstring"'), "SEARCH_CAT" => cot_folio_selectcat($c, 'c'), "SEARCH_SORTER" => cot_selectbox($sort, "sort", array('', 'costasc', 'costdesc'), array($L['folio_mostrelevant'], $L['folio_costasc'], $L['folio_costdesc']), false), "PAGENAV_PAGES" => $pagenav['main'], "PAGENAV_PREV" => $pagenav['prev'], "PAGENAV_NEXT" => $pagenav['next'], "PAGENAV_COUNT" => $totalitems, "CATALOG" => cot_build_structure_folio_tree('', array($c), 0), "BREADCRUMBS" => $catpath));
foreach ($cot_extrafields[$db_folio] as $exfld) {
    $uname = strtoupper($exfld['field_name']);
    $exfld_val = cot_build_extrafields($exfld['field_name'], $exfld, $shfld[$exfld['field_name']]);
    $exfld_title = isset($L['projects_' . $exfld['field_name'] . '_title']) ? $L['projects_' . $exfld['field_name'] . '_title'] : $exfld['field_description'];
    $t->assign(array('SEARCH_' . $uname => $exfld_val, 'SEARCH_' . $uname . '_TITLE' => $exfld_title));
}
/* === Hook === */
foreach (cot_getextplugins('folio.list.search.tags') as $pl) {
    include $pl;
}
/* ===== */
if (!empty($c) && is_array($structure['folio'][$c])) {
    foreach ($structure['folio'][$c] as $field => $val) {
        $t->assign('CAT' . strtoupper($field), $val);
    }
Exemplo n.º 3
0
function cot_build_structure_folio_tree($parent = '', $selected = '', $level = 0, $template = '')
{
    global $structure, $cfg, $db, $sys;
    global $i18n_notmain, $i18n_locale, $i18n_write, $i18n_admin, $i18n_read, $db_i18n_pages;
    $urlparams = array();
    /* === Hook === */
    foreach (cot_getextplugins('folio.tree.first') as $pl) {
        include $pl;
    }
    /* ===== */
    if (empty($parent)) {
        $i18n_enabled = $i18n_read;
        $children = array();
        foreach ($structure['folio'] as $i => $x) {
            if (mb_substr_count($structure['folio'][$i]['path'], ".") == 0) {
                $children[] = $i;
            }
        }
    } else {
        $i18n_enabled = $i18n_read && cot_i18n_enabled($parent);
        $children = $structure['folio'][$parent]['subcats'];
    }
    $t1 = new XTemplate(cot_tplfile(array('folio', 'tree', $template), 'module'));
    /* === Hook === */
    foreach (cot_getextplugins('folio.tree.main') as $pl) {
        include $pl;
    }
    /* ===== */
    if (count($children) == 0) {
        return false;
    }
    $t1->assign(array("TITLE" => htmlspecialchars($structure['folio'][$parent]['title']), "DESC" => $structure['folio'][$parent]['desc'], "COUNT" => $structure['folio'][$parent]['count'], "ICON" => $structure['folio'][$parent]['icon'], "HREF" => cot_url("folio", $urlparams + array('c' => $parent)), "LEVEL" => $level));
    $jj = 0;
    /* === Hook - Part1 : Set === */
    $extp = cot_getextplugins('folio.tree.loop');
    /* ===== */
    foreach ($children as $row) {
        $jj++;
        $urlparams['c'] = $row;
        $subcats = $structure['folio'][$row]['subcats'];
        $t1->assign(array("ROW_TITLE" => htmlspecialchars($structure['folio'][$row]['title']), "ROW_DESC" => $structure['folio'][$row]['desc'], "ROW_COUNT" => $structure['folio'][$row]['count'], "ROW_ICON" => $structure['folio'][$row]['icon'], "ROW_HREF" => cot_url("folio", $urlparams), "ROW_SELECTED" => is_array($selected) && in_array($row, $selected) || !is_array($selected) && $row == $selected ? 1 : 0, "ROW_SUBCAT" => count($subcats) > 0 ? cot_build_structure_folio_tree($row, $selected, $level + 1) : '', "ROW_LEVEL" => $level, "ROW_ODDEVEN" => cot_build_oddeven($jj), "ROW_JJ" => $jj));
        if ($i18n_enabled && $i18n_notmain) {
            $x_i18n = cot_i18n_get_cat($row, $i18n_locale);
            if ($x_i18n) {
                if (!$cfg['plugin']['i18n']['omitmain'] || $i18n_locale != $cfg['defaultlang']) {
                    $urlparams['l'] = $i18n_locale;
                }
                $t1->assign(array('ROW_URL' => cot_url('folio', $urlparams), 'ROW_TITLE' => $x_i18n['title'], 'ROW_DESC' => $x_i18n['desc']));
            }
        }
        /* === Hook - Part2 : Include === */
        foreach ($extp as $pl) {
            include $pl;
        }
        /* ===== */
        $t1->parse("MAIN.CATS");
    }
    if ($jj == 0) {
        return false;
    }
    $t1->parse("MAIN");
    return $t1->text("MAIN");
}
    $sqlsearch = '%' . implode('%', $words) . '%';
    $where['search'] = "(item_title LIKE '" . $db->prep($sqlsearch) . "' OR item_text LIKE '" . $db->prep($sqlsearch) . "')";
}
$list_url_path = array('m' => 'folio', 'c' => $c, 'sort' => $sort, 'sq' => $sq);
$order['date'] = 'item_date DESC';
/* === Hook === */
foreach (cot_getextplugins('folio.admin.list.query') as $pl) {
    include $pl;
}
/* ===== */
$where = $where ? 'WHERE ' . implode(' AND ', $where) : '';
$order = $order ? 'ORDER BY ' . implode(', ', $order) : '';
$totalitems = $db->query("SELECT COUNT(*) FROM {$db_folio} \n\t" . $where . "")->fetchColumn();
$sqllist = $db->query("SELECT * FROM {$db_folio} AS m LEFT JOIN {$db_users} AS u ON u.user_id=m.item_userid\n\t" . $where . " \n\t" . $order . " \n\tLIMIT {$d}, " . $cfg['maxrowsperpage']);
$pagenav = cot_pagenav('admin', $list_url_path, $d, $totalitems, $cfg['maxrowsperpage']);
$t->assign(array("SEARCH_ACTION_URL" => cot_url('admin', "m=folio&c=" . $c, '', true), "SEARCH_SQ" => cot_inputbox('text', 'sq', $sq, 'class="schstring"'), "SEARCH_STATE" => cot_radiobox($state, 'state', array(0, 1, 2), array('опубликованные', 'скрытые', 'на проверке')), "SEARCH_CAT" => cot_folio_selectcat($c, 'c'), "SEARCH_SORTER" => cot_selectbox($sort, "sort", array('', 'costasc', 'costdesc'), array($L['folio_mostrelevant'], $L['folio_costasc'], $L['folio_costdesc']), false), 'PAGENAV_PAGES' => $pagenav['main'], 'PAGENAV_PREV' => $pagenav['prev'], 'PAGENAV_NEXT' => $pagenav['next'], "PAGENAV_COUNT" => $totalitems, 'CATALOG' => cot_build_structure_folio_tree('', array($c)), 'CATTITLE' => !empty($c) ? ' / ' . !empty($c) ? ' / ' . htmlspecialchars($structure['folio'][$c]['title']) : '' : ''));
$sqllist_rowset = $sqllist->fetchAll();
$sqllist_idset = array();
foreach ($sqllist_rowset as $item) {
    $sqllist_idset[$item['item_id']] = $item['item_alias'];
}
/* === Hook === */
$extp = cot_getextplugins('folio.admin.list.loop');
/* ===== */
foreach ($sqllist_rowset as $item) {
    $jj++;
    $t->assign(cot_generate_usertags($item, 'PRD_ROW_OWNER_'));
    $t->assign(cot_generate_foliotags($item, 'PRD_ROW_', $cfg['folio']['shorttextlen'], $usr['isadmin'], $cfg['homebreadcrumb']));
    $t->assign(array('PRD_ROW_ODDEVEN' => cot_build_oddeven($jj), 'PRD_ROW_EDIT_URL' => cot_url('folio', 'm=edit&id=' . $item['item_id']), 'PRD_ROW_VALIDATE_URL' => cot_url('admin', 'm=folio&p=default&a=validate&id=' . $item['item_id']), 'PRD_ROW_DELETE_URL' => cot_url('admin', 'm=folio&p=default&a=delete&id=' . $item['item_id'])));
    /* === Hook - Part2 : Include === */
    foreach ($extp as $pl) {