category: Order cat list on add/edit form
This commit is contained in:
committed by
Alexander Nicolaysen Sørnes
parent
0473f7bfc3
commit
8060eab22a
@@ -160,11 +160,20 @@ class Category {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Get all category objects, ordered and with category names indented
|
/* Get all category objects, ordered and with category names indented
|
||||||
according to subcategory level */
|
according to subcategory level.
|
||||||
static function getOrderedList()
|
Optionally includes the 'Main' top category. */
|
||||||
|
static function getOrderedList($bIncludeMain = false)
|
||||||
{
|
{
|
||||||
$oCat = new category();
|
$oCat = new category();
|
||||||
return $oCat->getSubCatList(0);
|
|
||||||
|
if(!$bIncludeMain)
|
||||||
|
return $oCat->getSubCatList(0);
|
||||||
|
|
||||||
|
$oCat->sName = 'Main';
|
||||||
|
$aCats = array($oCat);
|
||||||
|
$aCats += $oCat->getSubCatList(1);
|
||||||
|
|
||||||
|
return $aCats;
|
||||||
}
|
}
|
||||||
|
|
||||||
function objectGetMail($sAction, $bMailSubmitter, $bParentAction)
|
function objectGetMail($sAction, $bMailSubmitter, $bParentAction)
|
||||||
@@ -278,18 +287,14 @@ class Category {
|
|||||||
|
|
||||||
function outputEditor()
|
function outputEditor()
|
||||||
{
|
{
|
||||||
$sQuery = "SELECT catId, catName FROM appCategory WHERE catId!='?'";
|
$aCategories = category::getOrderedList(true);
|
||||||
$hResult = query_parameters($sQuery, $this->iCatId);
|
$aCatNames = array();
|
||||||
|
$aCatIds = array();
|
||||||
|
|
||||||
/* Add the virtual 'Main' category */
|
foreach($aCategories as $oCategory)
|
||||||
$aCatIds = array(0);
|
|
||||||
$aCatNames = array('Main');
|
|
||||||
|
|
||||||
/* Add the rest from the database */
|
|
||||||
while($oRow = query_fetch_object($hResult))
|
|
||||||
{
|
{
|
||||||
$aCatIds[] = $oRow->catId;
|
$aCatNames[] = $oCategory->sName;
|
||||||
$aCatNames[] = $oRow->catName;
|
$aCatIds[] = $oCategory->objectGetId();
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "<table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"2\">
|
echo "<table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"2\">
|
||||||
|
|||||||
Reference in New Issue
Block a user