function fetchFormsInCat($thisid, $allowedForms = "") { global $xoopsDB; if (!is_array($allowedForms)) { $allowedForms = allowedForms(); } if ($thisid == 0) { // general category // 1. foreach allowed form, check to see if it's in a cat // 2. record each one in an array // 3. make formsInCat equal the difference between found array and allowed forms foreach ($allowedForms as $thisform) { $found_q = q("SELECT * FROM " . $xoopsDB->prefix("formulize_menu_cats") . " WHERE id_form_array LIKE \"%,{$thisform},%\""); if (count($found_q) > 0) { $foundForms[] = $thisform; } } if (count($foundForms) > 0) { $formsInCat1 = array_diff($allowedForms, $foundForms); } else { $formsInCat1 = $allowedForms; } } else { $flatFormArray = q("SELECT id_form_array FROM " . $xoopsDB->prefix("formulize_menu_cats") . " WHERE cat_id='{$thisid}'"); $formsInCat1 = explode(",", trim($flatFormArray[0]['id_form_array'], ",")); } // exclude inactive forms, and sort foreach ($formsInCat1 as $thisform) { $status_q = q("SELECT menuid, position FROM " . $xoopsDB->prefix("formulize_menu") . " WHERE menuid='{$thisform}' AND status=1"); if (count($status_q) > 0 and in_array($thisform, $allowedForms)) { // only include active forms that the user is allowed to see $formpos[] = $status_q[0]['position']; $formsInCat[] = $thisform; } } array_multisort($formpos, $formsInCat); return $formsInCat; }
## ## ## You should have received a copy of the GNU General Public License ## ## along with this program; if not, write to the Free Software ## ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## ############################################################################### ## Author of this file: Freeform Solutions ## ## Project: Formulize ## ############################################################################### include 'header.php'; $xoopsOption['template_main'] = 'formulize_application.html'; require XOOPS_ROOT_PATH . "/header.php"; global $xoopsDB; $form_handler = xoops_getmodulehandler('forms', 'formulize'); $application_handler = xoops_getmodulehandler('applications', 'formulize'); include_once XOOPS_ROOT_PATH . "/modules/formulize/include/functions.php"; $allowedForms = allowedForms(); if (isset($_GET['id']) and $_GET['id'] === "all") { $applicationsToDraw = $application_handler->getAllApplications(); $applicationsToDraw[] = 0; // add in forms with no app at the end of the list } else { $aid = isset($_GET['id']) ? intval($_GET['id']) : 0; $applicationsToDraw = array($aid); } $allAppData = array(); foreach ($applicationsToDraw as $aid) { if (is_object($aid)) { $aid = $aid->getVar('appid'); // when 'all' is requested, the array will be of objects, not ids } //checkMenuLinks($aid);