function set_eguide_breadcrumbs($catid = 0, $paths = array()) { global $xoopsModule, $xoopsTpl; $modurl = EGUIDE_URL . '/'; $breadcrumbs = array(array('name' => $xoopsModule->getVar('name'), 'url' => $modurl)); $catlist = get_eguide_category($catid); if ($catid && !empty($catlist[$catid]['name'])) { $pri = $catlist[$catid]['catpri']; if ($pri) { $breadcrumbs[] = array('name' => $catlist[$pri]['name'], 'url' => $modurl . "index.php?cat={$pri}"); } if (basename($_SERVER['SCRIPT_NAME']) != 'index.php') { $url = $modurl . "index.php?cat={$catid}"; } else { $url = ''; } $breadcrumbs[] = array('name' => $catlist[$catid]['name'], 'url' => $url); } foreach ($paths as $lab => $path) { $breadcrumbs[] = array('name' => htmlspecialchars($lab), 'url' => empty($path) ? '' : "{$modurl}{$path}"); } $xoopsTpl->assign('xoops_breadcrumbs', $breadcrumbs); }
$timetable[] = array('label' => $label, 'value' => $value); } } $xoopsTpl->assign('timetable', $timetable); if ($eid && $op == 'delete') { $xoopsOption['template_main'] = EGPREFIX . '_event.html'; edit_eventdata($data); unset($data['eid']); // disable control link $xoopsTpl->assign('event', $data); $xoopsTpl->assign('message', "<div><form action='admin.php' method='post'>\n<input type='hidden' name='op' value='confirm' />\n<input type='hidden' name='eid' value='{$eid}' />\n<input type='submit' value='" . _DELETE . "' />\n</form><b>" . _MD_EVENT_DEL_DESC . "</b></div>\n" . ($adm ? "<div class='evnote'>" . _MD_EVENT_DEL_ADMIN . "</div>\n" : '')); } else { $expire = $data['expire'] > $data['edate'] ? $data['expire'] - $data['edate'] : $data['expire']; $str = isset($expire_set["+{$expire}"]) ? "" : htmlspecialchars(time_to_str($expire)); $input_expire = "<input name='expire_text' size='8' value='{$str}' onchange='document.evform.expire.selectedIndex=0' /> " . select_list('expire', $expire_set, $expire); $cats = get_eguide_category(); if (count($cats) > 1) { $input_category = select_list('topicid', $cats, $data['topicid']); } else { $input_category = ''; } if ($op == 'preview') { $views = array('edate', 'cdate', 'title', 'summary', 'body', 'persons', 'reserved', 'closetime', 'style', 'uid', 'counter', 'catid', 'catimg', 'catname'); $event = array(); if (empty($data['cdate'])) { $data['cdate'] = $now; $data['reserved'] = 0; $data['counter'] = 0; $data['uid'] = $uid; $data['catid'] = 1; }
if (empty($prev)) { // show upcomming event (constant is gurd value) $cond .= " AND ((expire>=edate AND expire>{$now}) OR (expire<edate AND (IF(exdate,exdate,edate)+expire)>{$now}))"; //$cond .= " AND (exdate>$now OR exdate IS NULL)"; $start = (empty($page) ? 0 : $page - 1) * $max; $ord = 'ASC'; $ext = $xoopsModuleConfig['show_extents'] ? '' : 'AND ldate=exdate'; } else { $cond .= " AND edate<{$now}"; // show passed event $cond .= " AND (exdate<{$now} OR exdate IS NULL)"; $start = ($prev - 1) * $max; $ord = 'DESC'; $ext = $xoopsModuleConfig['show_extents'] ? '' : 'AND 0'; } $catlist = get_eguide_category(); $catid = isset($_GET['cat']) && preg_match('/^(\\d+,)*\\d+$/', $_GET['cat']) ? $_GET['cat'] : 0; if (isset($catlist[$catid])) { $vals = array($catid); if ($catlist[$catid]['catpri'] == 0) { // also children categories foreach ($catlist as $data) { if ($data['catpri'] == $catid) { $vals[] = $data['catid']; } } } $opt = ' AND topicid IN (' . join(',', $vals) . ')'; } else { $opt = $catid ? ' AND topicid IN (' . $catid . ')' : ''; }
function edit_category($catid) { global $xoopsDB; $myts =& MyTextSanitizer::getInstance(); if ($catid) { $res = $xoopsDB->query('SELECT * FROM ' . CATBL . " WHERE catid={$catid}"); $data = $xoopsDB->fetchArray($res); } else { $data = array('catid' => 0, 'catname' => '', 'catimg' => '', 'catdesc' => '', 'catpri' => 0, 'weight' => 0); } $form = new XoopsThemeForm($catid ? _AM_CATEGORY_EDIT : _AM_CATEGORY_NEW, 'myform', 'index.php'); $form->addElement(new XoopsFormHidden('catid', $catid)); $form->addElement(new XoopsFormHidden('op', 'catsave')); $form->addElement(new XoopsFormText(_AM_CAT_NAME, 'catname', 40, 40, $data['catname']), true); $form->addElement(new XoopsFormText(_AM_CAT_IMG, 'catimg', 60, 255, $data['catimg'])); $form->addElement(new XoopsFormDhtmlTextArea(_AM_CAT_DESC, 'catdesc', $data['catdesc'])); $catpri = new XoopsFormSelect(_AM_CAT_PRIMARY, 'catpri', $data['catpri']); $catpri->addOption(0, _NONE); foreach (get_eguide_category(false) as $cat) { if ($catid != $cat['catid']) { $catpri->addOption($cat['catid'], $cat['name']); } } $form->addElement($catpri); $form->addElement(new XoopsFormText(_AM_WEIGHT, 'weight', 4, 4, $data['weight'])); $form->addElement(new XoopsFormButton('', 'catsave', _SUBMIT, 'submit')); $form->display(); }