示例#1
0
function get_child($id)
{
    global $pro_class_table;
    global $product_table;
    $sql = "select * from `{$pro_class_table}` where upid='{$id}' order by no DESC";
    $res = mysql_query($sql);
    while ($row = mysql_fetch_array($res)) {
        print "<div>";
        $sqln = "select count(*) as total from `{$pro_class_table}` where upid='" . $row['id'] . "'";
        $resn = mysql_query($sqln);
        $rown = mysql_fetch_array($resn);
        $total = $rown['total'];
        //類別
        $sqln = "select count(*) as total from `{$product_table}` where upid='" . $row['id'] . "'";
        $resn = mysql_query($sqln);
        $rown = mysql_fetch_array($resn);
        $p_total = $rown['total'];
        //產品
        print "└&nbsp;";
        print "<a href='#a' onClick='opener.location = \"class_manage.php?id=" . $row['id'] . "\"'>";
        print $row['name'];
        print "(" . $total . ",{$p_total})";
        print "</a>";
        if ($total > 0) {
            get_child($row['id']);
        }
        print "</div>";
    }
}
示例#2
0
function get_child($parent_task_id, $link = true, $print = "", $space = " - ")
{
    global $db, $slave;
    //echo $parent_task_id;
    $child = $slave->select("SELECT Task_ID,Task_Name,Parent_Task_ID,Project_ID FROM Tasks WHERE Parent_Task_ID=" . $parent_task_id);
    if ($child) {
        //if ($print!="") $print=" > $print";
        if ($link == true) {
            $print = "{$print}<br />{$space}<a href=\"tasks.php?task_id=" . $child[0]['Task_ID'] . "\">" . $child[0]['Task_Name'] . "</a>";
        } else {
            $print = "{$print}<br />{$space}" . $child[0]['Task_Name'];
        }
        get_child($child[0]['Task_ID'], $link, $print, " &nbsp; " . $space);
    } else {
        echo "<small class=\"gray\">{$print}</small>";
    }
}
示例#3
0
 /**
  * Forum Listing
  */
 private function display_forum_list()
 {
     global $aidlink;
     $title = !empty($this->level['title']) ? sprintf(self::$locale['forum_000b'], $this->level['title'][0]) : self::$locale['forum_000c'];
     add_to_title(" " . $title);
     $forum_settings = $this->get_forum_settings();
     $threads_per_page = $forum_settings['threads_per_page'];
     $max_rows = dbcount("('forum_id')", DB_FORUMS, (multilang_table("FO") ? "forum_language='" . LANGUAGE . "' AND" : '') . " forum_cat='" . $_GET['parent_id'] . "'");
     // need max rows
     $_GET['rowstart'] = isset($_GET['rowstart']) && isnum($_GET['rowstart']) && $_GET['rowstart'] <= $max_rows ? intval($_GET['rowstart']) : 0;
     opentable($title);
     $result = dbquery("SELECT forum_id, forum_cat, forum_branch, forum_name, forum_description, forum_image, forum_alias, forum_type, forum_threadcount, forum_postcount, forum_order FROM\n\t\t\t" . DB_FORUMS . " " . (multilang_table("FO") ? "WHERE forum_language='" . LANGUAGE . "' AND" : "WHERE") . " forum_cat='" . intval($_GET['parent_id']) . "'\n\t\t\t ORDER BY forum_order ASC LIMIT " . $_GET['rowstart'] . ", {$threads_per_page}\n\t\t\t ");
     $rows = dbrows($result);
     if ($rows > 0) {
         // To support entypo and font-awesome icon switching
         $has_entypo = fusion_get_settings("entypo") ? TRUE : FALSE;
         $has_fa = fusion_get_settings("fontawesome") ? TRUE : FALSE;
         $type_icon = array('1' => $has_entypo ? 'entypo folder' : $has_fa ? 'fa fa-folder fa-fw fa-2x' : "", '2' => $has_entypo ? 'entypo icomment' : $has_fa ? 'fa fa-comment-o fa-fw fa-2x' : "", '3' => $has_entypo ? 'entypo link' : $has_fa ? 'fa fa-external-link fa-fw fa-2x' : "", '4' => $has_entypo ? 'entypo info-circled' : $has_fa ? 'fa fa-lightbulb-o fa-fw fa-2x' : "");
         $ui_label = array("move_up" => $has_entypo ? "<i class='entypo up-bold m-r-10'></i>" : $has_fa ? "<i class='fa fa-arrow-up fa-lg m-r-10'></i>" : self::$locale['forum_046'], "move_down" => $has_entypo ? "<i class='entypo down-bold m-r-10'></i>" : $has_fa ? "<i class='fa fa-arrow-down fa-lg m-r-10'></i>" : self::$locale['forum_045'], "edit_permission" => $has_entypo ? "<i class='entypo key m-r-10'></i>" : $has_fa ? "<i class='fa fa-eye fa-lg m-r-10'></i>" : self::$locale['forum_047'], "edit" => $has_entypo ? "<i class='entypo cog m-r-10'></i>" : $has_fa ? "<i class='fa fa-cog fa-lg m-r-10'></i>" : self::$locale['forum_048'], "delete" => $has_entypo ? "<i class='entypo icancel m-r-10'></i>" : $has_fa ? "<i class='fa fa-trash-o fa-lg m-r-10'></i>" : self::$locale['forum_049']);
         $i = 1;
         while ($data = dbarray($result)) {
             $up = $data['forum_order'] - 1;
             $down = $data['forum_order'] + 1;
             $subforums = get_child($this->forum_index, $data['forum_id']);
             $subforums = !empty($subforums) ? count($subforums) : 0;
             echo "<div class='panel panel-default'>\n";
             echo "<div class='panel-body'>\n";
             echo "<div class='pull-left m-r-10'>\n";
             echo "<i class='display-inline-block text-lighter " . $type_icon[$data['forum_type']] . "'></i>\n";
             echo "</div>\n";
             echo "<div class='overflow-hide'>\n";
             echo "<div class='row'>\n";
             echo "<div class='col-xs-6 col-sm-6 col-md-6 col-lg-6'>\n";
             $html2 = '';
             if ($data['forum_image'] && file_exists(INFUSIONS . "forum/images/" . $data['forum_image'])) {
                 echo "<div class='pull-left m-r-10'>\n" . thumbnail(INFUSIONS . "forum/images/" . $data['forum_image'], '50px') . "</div>\n";
                 echo "<div class='overflow-hide'>\n";
                 $html2 = "</div>\n";
             }
             echo "<span class='strong text-bigger'><a href='" . FUSION_SELF . $aidlink . "&amp;parent_id=" . $data['forum_id'] . "&amp;branch=" . $data['forum_branch'] . "'>" . $data['forum_name'] . "</a></span><br/>" . nl2br(parseubb($data['forum_description'])) . $html2;
             echo "</div>\n<div class='col-xs-6 col-sm-6 col-md-6 col-lg-6'>\n";
             echo "<div class='pull-right'>\n";
             $upLink = FUSION_SELF . $aidlink . $this->ext . "&amp;action=mu&amp;order={$up}&amp;forum_id=" . $data['forum_id'];
             $downLink = FUSION_SELF . $aidlink . $this->ext . "&amp;action=md&amp;order={$down}&amp;forum_id=" . $data['forum_id'];
             echo $i == 1 ? '' : "<a title='" . self::$locale['forum_046'] . "' href='" . $upLink . "'>" . $ui_label['move_up'] . "</a>";
             echo $i == $rows ? '' : "<a title='" . self::$locale['forum_045'] . "' href='" . $downLink . "'>" . $ui_label['move_down'] . "</a>";
             echo "<a title='" . self::$locale['forum_047'] . "' href='" . FUSION_SELF . $aidlink . "&amp;action=p_edit&forum_id=" . $data['forum_id'] . "&amp;parent_id=" . $_GET['parent_id'] . "'>" . $ui_label['edit_permission'] . "</a>";
             // edit
             echo "<a title='" . self::$locale['forum_048'] . "' href='" . FUSION_SELF . $aidlink . "&amp;action=edit&forum_id=" . $data['forum_id'] . "&amp;parent_id=" . $_GET['parent_id'] . "'>" . $ui_label['edit'] . "</a>";
             // edit
             echo "<a title='" . self::$locale['forum_049'] . "' href='" . FUSION_SELF . $aidlink . "&amp;action=delete&amp;forum_id=" . $data['forum_id'] . "&amp;forum_cat=" . $data['forum_cat'] . "&amp;forum_branch=" . $data['forum_branch'] . $this->ext . "' onclick=\"return confirm('" . self::$locale['delete_notice'] . "');\">" . $ui_label['delete'] . "</a>";
             // delete
             echo "</div>\n";
             echo "<span class='text-dark text-smaller strong'>" . self::$locale['forum_057'] . " " . number_format($data['forum_threadcount']) . " / " . self::$locale['forum_059'] . " " . number_format($data['forum_postcount']) . " </span>\n<br/>";
             echo "<span class='text-dark text-smaller strong'>" . self::$locale['forum_058'] . " " . number_format($subforums) . "</span>\n<br/>";
             echo "<span class='text-smaller text-dark strong'>" . self::$locale['forum_051'] . " </span> <span class='text-smaller'>" . $data['forum_alias'] . " </span>\n";
             echo "</div></div>\n";
             // end row
             echo "</div>\n";
             echo "</div>\n</div>\n";
             $i++;
         }
         if ($max_rows > $threads_per_page) {
             $ext = isset($_GET['parent_id']) ? "&amp;parent_id=" . $_GET['parent_id'] . "&amp;" : '';
             echo makepagenav($_GET['rowstart'], $threads_per_page, $max_rows, 3, FUSION_SELF . $aidlink . $ext);
         }
     } else {
         echo "<div class='well text-center'>" . self::$locale['560'] . "</div>\n";
     }
     closetable();
 }
示例#4
0
function get_child($index, $parent_id, &$children = false)
{
    /*
     * Retrieving nodes using variables passed as reference:
     * Get ids of child nodes
     */
    $parent_id = $parent_id === NULL ? "NULL" : $parent_id;
    if (isset($index[$parent_id])) {
        foreach ($index[$parent_id] as $id) {
            $children[] = $id;
            get_child($index, $id, $children);
        }
    }
    return $children;
}
示例#5
0
function echo_str($cate, $tag = "&nbsp;&nbsp;&nbsp;")
{
    $str = get_child($cate, $tag);
    echo $str;
}
示例#6
0
        $smarty->assign('goods', $val);
        $res[]['info'] = $GLOBALS['smarty']->fetch('library/shop_list_ajax.lbi');
    }
    die($json->encode($res));
}
/*------------------------------------------------------ */
//-- PROCESSOR
/*------------------------------------------------------ */
/* 页面的缓存ID */
$cache_id = sprintf('%X', crc32($cat_id . '-' . $display . '-' . $sort . '-' . $order . '-' . $page . '-' . $size . '-' . $_SESSION['user_rank'] . '-' . $_CFG['lang'] . '-' . $brand . '-' . $price_max . '-' . $price_min . '-' . $filter_attr_str));
if (!$smarty->is_cached('v_shop_list.dwt', $cache_id)) {
    /* 如果页面没有被缓存则重新获取页面的内容 */
    if (!isset($cat_id) || $cat_id == '' || $cat_id == 0) {
        $children = " 1 ";
    } else {
        $children = get_child($cat_id);
    }
    $cat = get_cat_info($cat_id);
    // 获得分类的相关信息
    if (!empty($cat)) {
        $smarty->assign('keywords', htmlspecialchars($cat['keywords']));
        $smarty->assign('description', htmlspecialchars($cat['cat_desc']));
        $smarty->assign('cat_style', htmlspecialchars($cat['style']));
        $smarty->assign('catname', htmlspecialchars($cat['cat_name']));
    }
    /* 赋值固定内容 */
    if ($brand > 0) {
        $sql = "SELECT brand_name FROM " . $GLOBALS['ecs']->table('brand') . " WHERE brand_id = '{$brand}'";
        $brand_name = $db->getOne($sql);
    } else {
        $brand_name = '';
示例#7
0
function get_child($item_parent, &$result)
{
    $where['item_parent'] = $item_parent;
    $res = CM('cm_list_item')->where($where)->select();
    if (count($res) > 0) {
        foreach ($res as $row) {
            $result[] = $row;
            get_child($row['list_item_id'], $result);
        }
    }
}
示例#8
0
/**
 * Get Child IDs from dbquery_tree() result
 * @param       $index
 * @param       $parent_id
 * @param array $children
 * @return array
 */
function get_child($index, $parent_id, array &$children = array())
{
    $parent_id = $parent_id === NULL ? null : $parent_id;
    if (isset($index[$parent_id])) {
        foreach ($index[$parent_id] as $id) {
            $children[] = $id;
            get_child($index, $id, $children);
        }
    }
    return $children;
}
 // check if item is a collection set
 if ($data[10] == '3' && $data[11]) {
     if (!set_children($newid, $newsku, $data[11])) {
         fwrite($log, "Failed writing children for collection product {$oldid} - {$newsku}\n");
     }
 } else {
     // set pricing if provided
     $price = array('1' => $data[4] ? number_format($data[4], 2, '.', '') : 0, '2' => $data[4] ? number_format($data[4], 2, '.', '') : 0, '3' => $data[5] ? number_format($data[5], 2, '.', '') : 0, '4' => $data[7] ? number_format($data[7], 2, '.', '') : 0, '5' => $data[6] ? number_format($data[6], 2, '.', '') : 0, '6' => $data[8] ? number_format($data[8], 2, '.', '') : 0, '1001' => $data[4] ? round($data[4] * 10) : 0);
     if (!copy_price($oldid, $newid, $price)) {
         fwrite($log, "FAILED on insert of 'item_prices' {$newid} - {$oldid} :: " . $dbh->error . "\n");
     }
     update_upsell($oldid, $newid);
     if ($item['item_type_id'] == 2 && !$data[9]) {
         // product is a variant master and not set to be skipped
         // check for children
         if ($res = get_child($oldid)) {
             // lookup children
             if ($res->num_rows > 0) {
                 // cycle through all the children
                 $cnt = 1;
                 $itemitem = array('master_item_id' => $newid);
                 $sort = 10;
                 while ($row = $res->fetch_assoc()) {
                     $itemitem['sort_index'] = $sort;
                     $itemitem['qty_required'] = $row['qty_required'];
                     $row['old_id'] = $coldid = $row['id'];
                     // set tracking column
                     $coldsku = $row['sku'];
                     unset($row['id'], $row['qty_required'], $row['sort_index']);
                     $row['sku'] = 'US-' . $item['item_sequence'] . '-' . (strlen($cnt) > 1 ? '' : '0') . $cnt;
                     $row['item_sequence'] = $item['item_sequence'];
示例#10
0
文件: get.php 项目: muqidi/PHP
<?php

define('IN_ECS', true);
require dirname(__FILE__) . '/includes/init.php';
if ((DEBUG_MODE & 2) != 2) {
    $smarty->caching = true;
}
if (isset($_GET['action'])) {
    $action = $_GET['action'];
    if ($action == "Bingcategroychild") {
        $cat_id = stripslashes(trim($_POST['cat_id']));
        $array = get_child($cat_id);
        $json = json_encode($array);
        echo $json;
    }
}
function get_child($cat_id)
{
    $sql = 'SELECT cat_id,cat_name ,parent_id ' . 'FROM ' . $GLOBALS['ecs']->table('category') . "WHERE parent_id = '{$cat_id}' AND is_show = 1 ORDER BY sort_order ASC, cat_id ASC";
    $res = $GLOBALS['db']->getAll($sql);
    foreach ($res as $idx => $row) {
        $array[$idx]['id'] = $row['cat_id'];
        $array[$idx]['name'] = $row['cat_name'];
        $array[$idx]['url'] = build_uri('category', array('cid' => $row['cat_id']), $row['cat_name']);
    }
    return $array;
}