function linksManager() { $OBJ =& get_instance(); $rs = $OBJ->db->fetchArray("SELECT title,url,sec_desc \n FROM " . PX . "objects \n INNER JOIN " . PX . "sections ON " . PX . "objects.section_id = secid \n WHERE status = '1' AND url != '' \n ORDER BY section_id ASC"); // rewrite the array based on section name $i = 0; $x = ''; if (is_array($rs)) { foreach ($rs as $ar) { $newarr[$ar['sec_desc']][$i] = array($ar['url'], $ar['title']); $i++; } } foreach ($newarr as $key => $out) { $p = ''; foreach ($out as $go) { $p .= "<option value=\"<a href='" . BASEURL . ndxz_rewriter($go[0]) . "' alt='' title='" . htmlspecialchars($go[1]) . "'>{$go['1']}\">{$go['1']}</option>\n"; // hackery //$p .= "<option value=\"<a href='".BASEURL.ndxz_rewriter($go[0])."' alt='' title='".htmlspecialchars($go[1])."'>$go[1]</a>\">$go[1]</option>\n"; } $x .= "<optgroup label='" . ucwords($key) . "'>\n{$p}\n</optgroup>\n"; } if (is_array($rs)) { $s = select('sysLink', "style='width:225px;'", $x); } else { $s = p($OBJ->lang->word('none found')); } return $s; }
function nextlink() { $OBJ = get_instance(); global $rs; $pages = $OBJ->db->fetchArray("SELECT id, url\nFROM " . PX . "objects, " . PX . "sections\nWHERE status = '1'\nAND hidden != '1'\nAND section_id = secid\nORDER BY sec_ord ASC, ord ASC"); if (!$pages) { return 'Error with pages query'; } foreach ($pages as $reord) { $order[$reord['sec_desc']][] = array('id' => $reord['id'], 'url' => $reord['url']); } $active = false; foreach ($order as $key => $out) { foreach ($out as $page) { if ($active == true) { $nextlink = $page['url']; $active = false; } $active = $rs['id'] == $page['id'] ? true : false; } $next .= "<a style='color:#fff' href='" . BASEURL . ndxz_rewriter($nextlink) . "'>» next</a>"; } return $next; }
function section_list($order) { global $rs; $s = ''; foreach ($order as $key => $out) { $count = count($out); $s .= "<ul>\n"; if ($out[0]['disp'] == 1) { $s .= "<li class='section-title'><span class='h-main'><span class='title'>{$key}</span> <sup>({$count})</sup></span></li>\n"; } foreach ($out as $page) { $active = $rs['id'] == $page['id'] ? " class='active'" : ''; $s .= "<li{$active}><a href=\"" . BASEURL . ndxz_rewriter($page['url']) . "\" title=\"{$page['preview']}\"" . " onclick=\"do_click();\">" . $page['title'] . "</a></li>\n"; } $s .= "</ul>\n\n"; } return $s; }
function _makePagesIntoMenuListItems($out, $s) { global $rs; foreach ($out as $page) { $active = $rs['id'] == $page['id'] ? " \nclass='active'" : ''; if (isset($page['status']) && $page['status'] == 0) { $s .= "<li class='unpublished'>" . $page['title'] . "</li>\n"; } else { $s .= "<li{$active}><a href='" . BASEURL . ndxz_rewriter($page['url']) . "' >" . $page['title'] . "</a></li>\n"; } } return $s; }