示例#1
0
 function renderChildren($parent, $level = 1)
 {
     global $forum_parent;
     $children = "";
     $p_res = dbquery("select * from " . DB_PREFIX . "forums f\n\t\t\t\t\tleft join " . DB_PREFIX . "fb_forums f2 on f2.forum_id=f.forum_id\n\t\t\t\t\twhere f2.forum_parent='{$parent}'");
     while ($p_data = dbarray($p_res)) {
         $children .= "<option value='" . $p_data['forum_id'] . "'" . ($p_data['forum_id'] == $forum_parent ? " SELECTED" : "") . ">";
         for ($i = $level; $i--; $i > 0) {
             $children .= "--";
         }
         $children .= $p_data['forum_name'] . "</option>\n";
         $children .= renderChildren($p_data['forum_id'], $level + 1);
     }
     return $children;
 }
function renderChildren($product_id, $arrCategory)
{
    $objCategory = NULL;
    if (!$arrCategory['hasChildren']) {
        return;
    }
    $arrChildren = $arrCategory['children'];
    ?>
		<ul>
<?php 
    foreach ($arrChildren as $_category) {
        ?>
			<li>
				<a class="no-decoration" href="#"><input <?php 
        if (isDefaultAssigned($product_id, $_category['id'])) {
            ?>
disabled ="disabled" <?php 
        }
        ?>
 class="checkbox-tree" <?php 
        if (isAssigned($product_id, $_category['id']) || isDefaultAssigned($product_id, $_category['id'])) {
            ?>
 checked="checked" <?php 
        }
        ?>
 type="checkbox" name="categories[]" value="<?php 
        echo $_category['id'];
        ?>
"/><span><?php 
        echo $_category['label'];
        ?>
</span><?php 
        if (isDefaultAssigned($product_id, $_category['id'])) {
            ?>
<span style="color:#ff0000">(From POS)</span><?php 
        }
        ?>
</a> 
                <?php 
        renderChildren($product_id, $_category);
        ?>
            </li>
<?php 
    }
    ?>
		</ul>
<?php 
}