Beispiel #1
0
function displayCategory($categoryObj, $level = 0)
{
    global $xoopsModule, $smartsection_category_handler;
    $description = $categoryObj->description();
    if (!XOOPS_USE_MULTIBYTES) {
        if (strlen($description) >= 100) {
            $description = substr($description, 0, 100 - 1) . "...";
        }
    }
    $modify = "<a href='category.php?op=mod&categoryid=" . $categoryObj->categoryid() . "&parentid=" . $categoryObj->parentid() . "'><img src='" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/images/icon/edit.gif' title='" . _AM_SSECTION_EDITCOL . "' alt='" . _AM_SSECTION_EDITCOL . "' /></a>";
    $delete = "<a href='category.php?op=del&categoryid=" . $categoryObj->categoryid() . "'><img src='" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/images/icon/delete.gif' title='" . _AM_SSECTION_DELETECOL . "' alt='" . _AM_SSECTION_DELETECOL . "' /></a>";
    $spaces = '';
    for ($j = 0; $j < $level; $j++) {
        $spaces .= '&nbsp;&nbsp;&nbsp;';
    }
    echo "<tr>";
    echo "<td class='even' align='lefet'>" . $spaces . "<a href='" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/category.php?categoryid=" . $categoryObj->categoryid() . "'><img src='" . XOOPS_URL . "/modules/smartsection/images/icon/subcat.gif' alt='' />&nbsp;" . $categoryObj->name() . "</a></td>";
    echo "<td class='even' align='center'>" . $categoryObj->weight() . "</td>";
    echo "<td class='even' align='center'> {$modify} {$delete} </td>";
    echo "</tr>";
    $subCategoriesObj = $smartsection_category_handler->getCategories(0, 0, $categoryObj->categoryid());
    if (count($subCategoriesObj) > 0) {
        $level++;
        foreach ($subCategoriesObj as $key => $thiscat) {
            displayCategory($thiscat, $level);
        }
    }
    unset($categoryObj);
}
Beispiel #2
0
if (isset($qs[0]) && substr($qs[0], 0, 5) == "order") {
    $qsorder = TRUE;
}
// Frontpage separated to categories
if ((!isset($qs[0]) || $qsorder) && $linkspage_pref['link_page_categories']) {
    displayCategory();
}
//show all categories added working ordering
if (isset($qs[1]) && substr($qs[1], 0, 5) == "order") {
    $qsorder = TRUE;
}
if (isset($qs[0]) && $qs[0] == "cat" && !isset($qs[1])) {
    displayCategory('cat');
}
if (isset($qs[0]) && $qs[0] == "cat" && (!isset($qs[0]) || $qsorder)) {
    displayCategory('cat');
}
//show all links in all categories  or Frontpage without categories
if ((!isset($qs[0]) || $qsorder) && !$linkspage_pref['link_page_categories'] || isset($qs[0]) && $qs[0] == "all") {
    displayCategoryLinks();
}
//show all links in one category
if (isset($qs[0]) && $qs[0] == "cat" && isset($qs[1]) && is_numeric($qs[1])) {
    displayCategoryLinks($qs[1]);
}
//view top rated
if (isset($qs[0]) && $qs[0] == "rated") {
    displayTopRated();
}
//view top refer
if (isset($qs[0]) && $qs[0] == "top") {
Beispiel #3
0
function displayCategory($categoryObj, $level = 0, $showFolders = false, $foldersCategoriesObj = null)
{
    global $xoopsModule, $smartmedia_category_handler;
    $modify = "<a href='category.php?op=mod&categoryid=" . $categoryObj->categoryid() . "'><img src='" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/images/icon/edit.gif' title='" . _AM_SMEDIA_EDITCOL . "' alt='" . _AM_SMEDIA_EDITCOL . "' /></a>";
    $delete = "<a href='category.php?op=del&categoryid=" . $categoryObj->categoryid() . "'><img src='" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/images/icon/delete.gif' title='" . _AM_SMEDIA_DELETECOL . "' alt='" . _AM_SMEDIA_DELETECOL . "' /></a>";
    $description = $categoryObj->description();
    if (!XOOPS_USE_MULTIBYTES) {
        if (strlen($description) >= 100) {
            $description = substr($description, 0, 100 - 1) . "...";
        }
    }
    $spaces = '';
    for ($j = 0; $j < $level; $j++) {
        $spaces .= '&nbsp;&nbsp;&nbsp;';
    }
    if (!$showFolders) {
        $col_span = " colspan='2' ";
    } else {
        $col_span = "";
    }
    echo "<tr>";
    echo "<td colspan='2' class='even' align='lefet'>" . $spaces . "<a href='" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/category.php?categoryid=" . $categoryObj->categoryid() . "'><img src='" . XOOPS_URL . "/modules/smartmedia/images/icon/subcat.gif' alt='' />&nbsp;" . $categoryObj->title() . "</a></td>";
    echo "<td class='even' align='left'>" . $description . "</td>";
    echo "<td class='even' align='center'>" . $categoryObj->weight() . "</td>";
    echo "<td class='even' align='right'> {$modify} {$delete} </td>";
    echo "</tr>";
    if ($foldersCategoriesObj) {
        foreach ($foldersCategoriesObj[$categoryObj->categoryid()] as $folderObj) {
            displayFolder($folderObj, $categoryObj->categoryid());
        }
    }
    $subCategoriesObj = $smartmedia_category_handler->getCategories(0, 0, $categoryObj->categoryid());
    if (count($subCategoriesObj) > 0) {
        $level++;
        foreach ($subCategoriesObj as $key => $thiscat) {
            displayCategory($thiscat, $level);
        }
    }
    unset($categoryObj);
}
Beispiel #4
0
                        <div class="panel-footer">
                            <p>
                                <i class="fa fa-clock-o"></i>
                                <?php 
    echo strftime('%d %B %Y', $article->publicationDate);
    ?>
 |
                                    <a class="label label-<?php 
    echo $article->category;
    ?>
" href="<?php 
    echo " ./?action=view " . $article->category;
    ?>
">
                                        <?php 
    displayCategory($article->category);
    ?>
                                    </a>
                            </p>
                        </div>
                    </div>
                </div>
                <?php 
}
?>
        </div>

    </div>
    <div class="container">
        <div class="panel panel-default">
            <div class="panel-body">
Beispiel #5
0
        echo "<div id='toptable'>";
        echo "<span style=\"color: #567; margin: 3px 0 12px 0; font-size: small; display: block; \">" . _AM_SMEDIA_FOLDERS_DSC . "</span>";
        echo "<form><div style=\"margin-top: 0px; margin-bottom: 5px;\">";
        echo "<input type='button' name='button' onclick=\"location='folder.php?op=mod'\" value='" . _AM_SMEDIA_FOLDER_CREATE . "'>&nbsp;&nbsp;";
        echo "</div></form>";
        // Folders
        echo "<table width='100%' cellspacing=1 cellpadding=3 border=0 class = outer>";
        echo "<tr>";
        echo "<td colspan='2' width='300px' class='bg3' align='left'><b>" . _AM_SMEDIA_CATEGORY_FOLDER . "</b></td>";
        echo "<td class='bg3' align='center'><b>" . _AM_SMEDIA_DESCRIPTION . "</b></td>";
        echo "<td class='bg3'width='100' align='center'><b>" . _AM_SMEDIA_WEIGHT . "</b></td>";
        echo "<td width='80px' class='bg3' align='center'><b>" . _AM_SMEDIA_ACTION . "</b></td>";
        echo "</tr>";
        $level = 0;
        $categoriesObj = $smartmedia_category_handler->getObjects($criteria, true);
        if (count($categoriesObj) > 0) {
            foreach ($categoriesObj as $categoryObj) {
                displayCategory($categoryObj, 0, true, $foldersCategoriesObj);
            }
        } else {
            echo "<tr>";
            echo "<td class='head' align='center' colspan= '7'>" . _AM_SMEDIA_NOCAT . "</td>";
            echo "</tr>";
        }
        echo "</table>\n";
        echo "</div>";
        //editfolder(false);
        break;
}
smartmedia_modFooter();
xoops_cp_footer();
 value="1" name="cat_active">
											<span style='margin-left:5px;'>Active category?</span>
									</div>
									
									<div class="form-group">
										<button class="btn btn-primary btn-flat" type="submit" id="submit">Submit</button>
										<button class="btn btn-primary btn-flat" type="cancel" id="cancel" onclick="javascript:location.href='<?php 
echo site_url('/admin/category/');
?>
';">Cancel</button>
									</div>
								</form>
							</div><!-- /.box-body -->
						</div><!-- /.box -->
				</div>
				<div class="col-md-6">
						<div class="box">
							<div class="box-header">
								<h3 class="box-title">Category list</h3>                                    
							</div><!-- /.box-header -->
							<div class="box-body table-responsive">
								<?php 
echo displayCategory($categories, $order);
?>
							</div><!-- /.box-body -->
						</div><!-- /.box -->
				</div>
			</div>
    	</div>
    </div>
</section>
Beispiel #7
0
 echo "<input type='button' name='button' onclick=\"location='category.php?op=mod'\" value='" . _AM_SMEDIA_CATEGORY_CREATE . "'>&nbsp;&nbsp;";
 echo "</div></form>";
 // Categories
 echo "<table width='100%' cellspacing=1 cellpadding=3 border=0 class = outer>";
 echo "<tr>";
 echo "<td colspan='2' width='35%' class='bg3' align='left'><b>" . _AM_SMEDIA_ITEMCATEGORYNAME . "</b></td>";
 echo "<td class='bg3' align='left'><b>" . _AM_SMEDIA_DESCRIP . "</b></td>";
 echo "<td class='bg3' width='65' align='center'><b>" . _AM_SMEDIA_WEIGHT . "</b></td>";
 echo "<td width='60' class='bg3' align='center'><b>" . _AM_SMEDIA_ACTION . "</b></td>";
 echo "</tr>";
 $level = 0;
 $totalCategories = $smartmedia_category_handler->getCategoriesCount(0);
 if (count($categoriesObj) > 0) {
     $level++;
     foreach ($categoriesObj as $key => $thiscat) {
         displayCategory($thiscat);
     }
 } else {
     echo "<tr>";
     echo "<td class='head' align='center' colspan= '7'>" . _AM_SMEDIA_NOCAT . "</td>";
     echo "</tr>";
     $categoryid = '0';
 }
 echo "</table>\n";
 /*
 include_once XOOPS_ROOT_PATH . '/class/pagenav.php';
 $pagenav = new XoopsPageNav($totalCategories, $limitsel, $startcategory, 'startcategory');
 echo '<div style="text-align:right;">' . $pagenav->renderNav() . '</div>';
 echo "</div>";
 */
 //editcat(false);
Beispiel #8
0
if (isset($qs[0]) && $qs[0] == "s") {
    $lc->show_message(LAN_LINKS_29, LAN_LINKS_28);
}
$qsorder = FALSE;
if (isset($qs[0]) && substr($qs[0], 0, 5) == "order") {
    $qsorder = TRUE;
}
//show all categories
if ((!isset($qs[0]) || $qsorder) && $linkspage_pref['link_page_categories']) {
    echo displayNavigator('cat');
    displayCategory();
}
//show all categories
if (isset($qs[0]) && $qs[0] == "cat" && !isset($qs[1])) {
    echo displayNavigator('cat');
    displayCategory();
}
//show all links in all categories
if ((!isset($qs[0]) || $qsorder) && !$linkspage_pref['link_page_categories'] || isset($qs[0]) && $qs[0] == "all") {
    //	displayNavigator('');
    displayCategoryLinks();
}
//show all links in one category
if (isset($qs[0]) && $qs[0] == "cat" && isset($qs[1]) && is_numeric($qs[1])) {
    //	echo displayNavigator('');
    displayCategoryLinks($qs[1]);
}
//view top rated
if (isset($qs[0]) && $qs[0] == "rated") {
    echo displayNavigator('');
    displayTopRated();
function displayCategory($categories, $order, $root = true)
{
    if ($root) {
        $html = "<ol id='categoryList' class='products-list product-list-in-box'>";
    } else {
        $html = "<ol>";
    }
    foreach ($order as $o) {
        $category = $categories[$o['id']];
        $html .= '<li class="item" id ="cat-' . $category['cat_id'] . '"><div class="clearfix" >
												<div class="product-img">
													<img alt="Product Image" src="' . image(category_img_path() . $category['cat_image'], 'cat_icon') . '">
												</div>
												<div class="product-info">
													<a class="product-title" href="javascript:void(0);">' . $category['cat_name'] . '</a>
														<span class="pull-right">
															<a href="' . site_url('/admin/category/edit/' . $category['cat_id']) . '" class="fa fa-edit"></a>
															<a href="javascript:void(0);" onclick="delete_category(' . $category['cat_id'] . ')" class="fa fa-trash-o"></a>
														</span>
													<span class="product-description">' . character_limiter($category['cat_title'], 54) . '</span>
												</div>
										  </div>';
        if (isset($o['children'])) {
            $html .= displayCategory($categories, $o['children'], false);
        }
        $html .= '</li>';
    }
    $html .= "</ol>";
    return $html;
}
Beispiel #10
0
/**
 * 从子类开始逐级向上获取其父类
 * @param number $cid
 * @param array $category
 * @return array:
 */
function getCategory($cid, &$category = array())
{
    $sql = 'SELECT * FROM category WHERE id=' . $cid . ' LIMIT 1';
    $result = mysql_query($sql);
    $row = mysql_fetch_assoc($result);
    if ($row) {
        $category[] = $row;
        getCategory($row['pid'], $category);
    }
    krsort($category);
    //逆序,达到从父类到子类的效果
    return $category;
}
function displayCategory($cid)
{
    $result = getCategory($cid);
    $str = "";
    foreach ($result as $item) {
        $str .= '<a href="' . $item['id'] . '">' . $item['catename'] . '</a>>';
    }
    return substr($str, 0, strlen($str) - 1);
}
echo displayLists(0, 3);
echo displayCategory(13);