示例#1
0
function showcategory($categorys, $deps = 0, $listtype = 0) 
{

	global $xoopsConfig, $xoopsDB, $xoopsUser, $xoopsModule, $wfsConfig, $myts, $groupid, $listtype;
	
	foreach($categorys as $onecat) {
	
		$num = WfsArticle::countByCategory($onecat->id());
		$link = XOOPS_URL . '/modules/' . $xoopsModule->dirname() . '/index.php?category=' . $onecat->id();
		$title = $myts->makeTboxData4Show($onecat->title());
		if ($wfsConfig['shortcat']) {
					if ( !XOOPS_USE_MULTIBYTES ) {
						if (strlen($title) >= 19) {
							$title = substr($title,0,18)."...";
						}
					}
                }
		$title = '<a href=' . $link . '>' . $title . '</a>';

// bug fix : category description shows </ br> not line feed.
//		$description = $myts->makeTboxData4Show($onecat->description('S'));
		$description = $onecat->description('S');

		$sarray = WfsArticle::getAllArticle(0, 0, $onecat->id(), $dataselect = '4');

		if ($num) { 
			$updated = formatTimestamp(WfsArticle::getLastChangedByCategory($onecat->id()), "$wfsConfig[timestamp]");
		}

		if (file_exists(XOOPS_ROOT_PATH . "/" . $wfsConfig['sgraphicspath'] . "/" . $onecat->imgurl) && !empty($onecat->imgurl)) {
			$image = "<br />".str_repeat("&nbsp;&nbsp;", $deps)."<img src='" . XOOPS_URL . "/" . $wfsConfig['sgraphicspath'] . "/" . $onecat->imgurl("S") . "'>	";
		} else {
			$image = ''; 
		}

	if (checkAccess($onecat->groupid))  {	
		// Start of html code
		echo "<tr>";
		//echo "<td valign = 'top' nowrap='nowrap' class='head' onmouseover='this.style.cursor=\"hand\";' onclick='window.location.href=\"" . $link . "\"'>";
		//echo str_repeat("&nbsp;&nbsp;", $deps) . $title . "";
		//	if ($wfsConfig['showcatpic']) { 
		//		echo $image;
		//	}	 
		//echo "</td>";
		echo "<td class = 'even' align='left' valign = 'top'>";
		echo str_repeat("&nbsp;&nbsp;", $deps) . $title . "";
			if ($wfsConfig['showcatpic']) { 
				echo $image;
			}
		echo "</td>";
		echo "<td class = 'even' align='left' valign = 'top'>".$description."</td>";
						
		if (($wfsConfig['showMarticles']) && !empty($listtype)) {
			echo "<td class='even' valign='top' align='left' nowrap='nowrap'>";
				foreach ($sarray as $article) {
			   		if (checkAccess($article->groupid, 0)) {
						//echo "<a href='" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/article.php?articleid=" . $article->articleid() . "'>" . $article->iconLink() . "</a><br />";
						
						echo "<a href='" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/article.php?articleid=" . $article->articleid() . "'>";
						if ($wfsConfig['picon'] == true) {
						echo "".$article->iconLink() . "</a><br />";
						} else {
						echo "".$article->textLink() . "</a><br />";
						
			}
					
					}
				} 
			echo "</td>";
		} 

		if (($wfsConfig['showMarticles']) && empty($listtype)) {
			echo "<td align='center' valign='top' class='even'>".$num."</td>"; 
		}
		if ($num) $updated = formatTimestamp(WfsArticle::getLastChangedByCategory($onecat->id()), "$wfsConfig[timestamp]");
	
		if ($wfsConfig['showMupdated'])	{

// bug fix : <TD> -- </TD> has not closed
//			echo "<td align='center' valign='top' class='even' width ='12%' >"; if ($num) echo $updated; "</td>"; 
			echo "<td align='center' valign='top' class='even' width ='12%' >";
			if ($num) echo $updated;
			echo "</td>"; 

		}
		echo "</tr>\n";
	
		//Show any sub cats if submenu == true
			$childcat = $onecat->getFirstChild();
				if ($wfsConfig['submenus'] == '1') {
					if ($childcat) {
						showcategory($childcat, $deps + 2, $listtype);
					} 
				} 
			} 
		} 
} 
示例#2
0
function showcategory($categorys, $deps = 0, $listtype = 0) {

	global $xoopsConfig, $xoopsDB, $xoopsModule, $listtype, $orders, $cat, $catid;
			
	foreach($categorys as $onecat) {
		
		$num = WfsArticle::countByCategory($onecat->id());
		$link = XOOPS_URL . '/modules/' . $xoopsModule->dirname() . '/admin/reorder.php?category=' . $onecat->id();
		$sarray = WfsArticle::getAllArticle(0, 0, $onecat->id(), $dataselect = '4');
		
		echo "<tr>";
		if ($deps == 0) {
			$class = 'head';
		}
		if ($deps == 2) {
			$class = 'even';
		}
		if ($deps >= 3) {
			$class = 'odd';
		}
		echo "<td align='left' class = $class>".$onecat->id."</td>";
		echo "<input type='hidden' name='cat[]' value='".$onecat->id."' />";
		echo "<td align='middle' class = $class>".$onecat->pid."</td>";
		echo "<td align='left' nowrap='nowrap' class = $class><a href='" . XOOPS_URL . '/modules/' . $xoopsModule->dirname() . '/admin/reorder.php?category=' . $onecat->id()."'>";
		echo "".str_repeat("&nbsp;&nbsp;", $deps) . $onecat->title . "</td>";
		echo "<td align='left' class = $class>".$onecat->description."</td>";
		echo "<td align='left' class = $class>";
		echo "<input type='text' name='orders[]' value='".$onecat->orders."' size='5' maxlenght='5'></td>";
		echo "</tr>";
		
		//Show any sub cats if submenu == true
		$childcat = $onecat->getFirstChild();
		if ($childcat) {
			showcategory($childcat, $deps + 2, $listtype);
		} 
	} 
} 
示例#3
0
         if (!empty($districtlist[$aid])) {
             foreach ($districtlist[$aid] as $district) {
                 showcategory($district);
                 $lastaid = 0;
                 if (!empty($streetlist[$district['aid']])) {
                     foreach ($streetlist[$district['aid']] as $street) {
                         showcategory($street, 'street');
                         $lastaid = $street['aid'];
                     }
                 }
                 showcategory($district, $lastaid, 'lastchildboard');
             }
         }
         showcategory($city, '', 'lastboard');
     }
     showcategory($city, '', 'last');
     showsubmit('editsubmit');
     showtablefooter();
     showformfooter();
 } else {
     if ($_G['gp_delete']) {
         foreach ($_G['gp_delete'] as $aid) {
             $subaid = DB::result_first("SELECT aid FROM " . DB::table('category_area') . " WHERE aup='{$aid}'");
             if ($subaid) {
                 cpmsg(cplang('delete_tips'), '', 'error');
             } else {
                 DB::query("DELETE FROM " . DB::table('category_area') . " WHERE aid='{$aid}'");
             }
         }
     }
     if ($_G['gp_name']) {