if ($gperm_handler->checkRight('DebaserCatPerm', $ele['genreid'], $groups, $xoopsModule->getVar('mid'))) { $chtitle = $myts->htmlSpecialChars($ele['genretitle']); if ($space > 0) { $subcategories .= "<br />"; } $ele['prefix'] = str_replace(".", "-", $ele['prefix']); $subcategories .= $ele['prefix'] . " <a href='" . XOOPS_URL . "/modules/debaser/genre.php?genreid=" . $ele['genreid'] . "'>" . $chtitle . "</a> [" . countDebaserFiles($chtitle) . "]"; $space++; } } } } else { $title = $myts->htmlSpecialChars($myrow['genretitle']); $arr = array(); $mytree = new debaserTree($xoopsDB->prefix('debaser_genre'), "genreid", "subgenreid"); $arr = $mytree->getdebaserChildTreeArray($myrow['genreid'], "genretitle"); $space = 0; $subcategories = ""; foreach ($arr as $ele) { $chtitle = $myts->htmlSpecialChars($ele['genretitle']); if ($space > 0) { $subcategories .= "<br />"; } $ele['prefix'] = str_replace(".", "-", $ele['prefix']); $subcategories .= $ele['prefix'] . " <a href='" . XOOPS_URL . "/modules/debaser/genre.php?genreid=" . $ele['genreid'] . "'>" . $chtitle . "</a> [" . countDebaserFiles($chtitle) . "]"; $space++; } } if (is_file(XOOPS_ROOT_PATH . "/" . $xoopsModuleConfig['catimage'] . "/" . $myts->htmlSpecialChars($myrow['imgurl'])) && !empty($myrow['imgurl'])) { if ($xoopsModuleConfig['usethumbs'] && function_exists('gd_info')) { $imgurl = down_debasercreatethumb($myts->htmlSpecialChars($myrow['imgurl']), $xoopsModuleConfig['catimage'], "thumbs", $xoopsModuleConfig['shotwidth'], $xoopsModuleConfig['shotheight'], $xoopsModuleConfig['imagequality'], $xoopsModuleConfig['updatethumbs'], $xoopsModuleConfig['keepaspect']);
function genremanager() { require_once XOOPS_ROOT_PATH . '/class/template.php'; if (!isset($xoopsTpl)) { $xoopsTpl = new XoopsTpl(); } global $xoopsDB, $filelist, $genrelist, $genretitle, $xoopsModuleConfig, $xoopsModule, $myts; $myts =& MyTextSanitizer::getInstance(); $mytree = new debaserTree($xoopsDB->prefix('debaser_genre'), "genreid", "subgenreid"); $count = 1; $chcount = 0; $countin = 0; $result = $xoopsDB->query("SELECT * FROM " . $xoopsDB->prefix('debaser_genre') . " WHERE subgenreid = 0 "); while ($myrow = $xoopsDB->fetchArray($result)) { $countin++; $title = $myts->htmlSpecialChars($myrow['genretitle']); $arr = array(); $mytree = new debaserTree($xoopsDB->prefix('debaser_genre'), "genreid", "subgenreid"); $arr = $mytree->getdebaserChildTreeArray($myrow['genreid'], "genretitle"); $space = 0; $chcount = 0; $subcategories = ""; foreach ($arr as $ele) { $chtitle = $myts->htmlSpecialChars($ele['genretitle']); if ($space > 0) { $subcategories .= "<br />"; } $ele['prefix'] = str_replace(".", "-", $ele['prefix']); $subcategories .= $ele['prefix'] . " " . $chtitle . " <a href='category.php?op=editgenre&genreid=" . $ele['genreid'] . "'><img src='../images/edit.gif' align='middle' /></a> <a href='category.php?op=deletegenre&genreid=" . $ele['genreid'] . "&genrecat=" . $ele['genretitle'] . "'><img src='../images/delete.gif' align='middle' /></a><br />"; $space++; $chcount++; } $xoopsTpl->append('categories', array('id' => $myrow['genreid'], 'title' => $title, 'subcategories' => $subcategories, 'count' => $count)); $count++; } $genreid = isset($_POST['genreid']) ? $_POST['genreid'] : 0; $member_handler =& xoops_gethandler('member'); $group_list =& $member_handler->getGroupList(); $gperm_handler =& xoops_gethandler('groupperm'); $groups = $gperm_handler->getGroupIds('DebaserCatPerm', $genreid, $xoopsModule->getVar('mid')); $groups = $groups; $nuform = new XoopsThemeForm(_AM_DEBASER_ADDNEWGENRE, "addnewgenre", "category.php"); if ($xoopsModuleConfig['usecatperm'] == 1) { $nuform->addElement(new XoopsFormSelectGroup(_AM_DEBASER_FCATEGORY_GROUPPROMPT, "groups", true, $groups, 5, true)); } $formgenrename = new XoopsFormText(_AM_DEBASER_GENRE, "genrenew", 50, 50); $graph_array =& XoopsLists::getFileListAsArray(XOOPS_ROOT_PATH . "/" . $xoopsModuleConfig['catimage']); $indeximage_select = new XoopsFormSelect('', 'imgurl'); $indeximage_select->addOption('', '----------'); $indeximage_select->addOptionArray($graph_array); $indeximage_select->setExtra("onchange='showImgSelected(\"image\", \"imgurl\", \"" . $xoopsModuleConfig['catimage'] . "\", \"\", \"" . XOOPS_URL . "\")'"); $indeximage_tray = new XoopsFormElementTray(_AM_DEBASER_FCATEGORY_CIMAGE, ' '); $indeximage_tray->addElement($indeximage_select); if (!empty($imgurl)) { $indeximage_tray->addElement(new XoopsFormLabel('', "<br /><br /><img src='" . XOOPS_URL . "/" . $xoopsModuleConfig['catimage'] . "/" . $imgurl . "' name='image' id='image' alt='' />")); } else { $indeximage_tray->addElement(new XoopsFormLabel('', "<br /><br /><img src='" . XOOPS_URL . "/uploads/blank.gif' name='image' id='image' alt='' />")); } $formgenreweight = new XoopsFormText(_AM_DEBASER_WEIGHT, 'catweight', 4, 4, '0'); $op_hidden = new XoopsFormHidden("op", "newgenresave"); $submit_button = new XoopsFormButton("", "dbsubmit", _SUBMIT, "submit"); $nuform->addElement($formgenrename); $nuform->addElement($indeximage_tray); $nuform->addElement($formgenreweight); $nuform->addElement($op_hidden); $nuform->addElement($submit_button); $xoopsTpl->assign('addnewgenre', $nuform->render()); $subcatform = new XoopsThemeForm(_AM_DEBASER_ADDNEWSUBGENRE, "addnewsubgenre", "category.php"); $subgenre_tray = new XoopsFormElementTray(_AM_DEBASER_SUBGENRE, ''); $subgenre_tray->addElement(new XoopsFormHidden('op', 'newsubgenresave')); $subgenrename = new XoopsFormText('', "subgenrenew", 50, 50); $subgenre_tray->addElement($subgenrename); $mytreechose = new debaserTree($xoopsDB->prefix("debaser_genre"), "genreid", "subgenreid"); ob_start(); $mytreechose->debaserSelBox("genretitle", "genretitle", 0, 1, "subgenrefrom"); $subgenre_tray->addElement(new XoopsFormLabel(_AM_DEBASER_GENREIN, ob_get_contents())); ob_end_clean(); $subgenre_tray->addElement(new XoopsFormButton('', 'subgenresubmit', _SUBMIT, 'submit')); $subcatform->addElement($subgenre_tray); $xoopsTpl->assign('addsubcat', $subcatform->render()); $xoopsTpl->assign('adminmenu', debaseradminMenu(2, _AM_DEBASER_EDITGENRES)); $xoopsTpl->display('db:debaser_amgenremanage.html'); }