} $q = Database::get()->querySingle("SELECT id, title, public FROM course_units\n WHERE course_id = ?d\n AND id <> ?d\n AND `order` {$op} {$info->order}\n AND `order` >= 0\n {$visibility_check}\n {$access_check}\n ORDER BY `order` {$dir}\n LIMIT 1", $course_id, $id); if ($q) { $q_id = $q->id; $q_title = htmlspecialchars($q->title); $link[$i] = "<div class='{$page_btn}'><a class='btn-default-eclass place-at-toolbox' title='{$q_title}' rel='tooltip' data-toggle='tooltip' data-placement='top' href='{$_SERVER['SCRIPT_NAME']}?course={$course_code}&id={$q_id}'>{$arrow1} {$q_title} {$arrow2}</a></div>"; } else { $link[$i] = ' '; } } if ($link['previous'] != ' ' or $link['next'] != ' ') { $tool_content .= "<div class='row'>\n <div class='col-md-12'><div class='toolbox whole-row'>"; $tool_content .= "\n " . $link['previous'] . "\n " . $link['next'] . ""; $tool_content .= "</div>\n </div>\n </div>"; } $tool_content .= "<div class='row margin-bottom'>\n <div class='col-md-12'>\n <h4 class='text-center'>{$pageName}</h4>\n </div>\n </div>"; if (!empty($comments)) { $tool_content .= "<div class='row'>\n <div class='col-md-12'>\n <div class='panel padding'>\n {$comments}\n </div>\n </div>\n </div>"; } $tool_content .= "<div class='row'>\n <div class='col-md-12'>\n <div class='panel padding'>"; show_resources($id); $tool_content .= "\n </div>\n </div>\n</div>"; $tool_content .= "<div class='form-wrapper'>"; $tool_content .= "<form class='form-horizontal' name='unitselect' action='" . $urlServer . "modules/units/' method='get'>\n <div class='form-group'>\n <label class='col-sm-4 control-label'>{$langCourseUnits}</label>\n <div class='col-sm-8'>\n <select name='id' class='form-control' onChange='document.unitselect.submit();'>"; $q = Database::get()->queryArray("SELECT id, title FROM course_units\n WHERE course_id = ?d AND `order` > 0\n {$visibility_check}\n ORDER BY `order`", $course_id); foreach ($q as $info) { $selected = $info->id == $id ? ' selected ' : ''; $tool_content .= "<option value='{$info->id}'{$selected}>" . htmlspecialchars(ellipsize($info->title, 40)) . '</option>'; } $tool_content .= "</select></div></div>\n </form></div>"; draw($tool_content, 2, null, $head_content);
$limit = 15; $tpages = ceil($num / $limit); $page = $page > $tpages ? $tpages : $page; $start = $num <= 0 ? 0 : ($page - 1) * $limit; $nav = new RMPageNav($num, $limit, $page, 5); $nav->target_url(RDFunctions::make_link('search') . '?keyword=' . $keyword . '&page={PAGE_NUM}'); $sql = "SELECT * FROM " . $db->prefix("rd_resources") . " WHERE (title LIKE '%{$keyword}%' OR description LIKE '%{$keyword}%') AND public=1 AND approved=1 LIMIT {$start}, {$limit}"; $result = $db->query($sql); $resources = array(); while ($row = $db->fetchArray($result)) { $res = new RDResource(); $res->assignVars($row); $resources[] = array('id' => $res->id(), 'title' => $res->getVar('title'), 'desc' => TextCleaner::truncate($res->getVar('description'), 100), 'link' => $res->permalink(), 'created' => $res->getVar('created'), 'owner' => $res->getVar('owner'), 'uname' => $res->getVar('owname'), 'reads' => $res->getVar('reads')); } RDFunctions::breadcrumb(); RMBreadCrumb::get()->add_crumb(__('Browsing recent Documents', 'docs')); RMTemplate::get()->add_style('docs.css', 'docs'); include 'header.php'; $xoopsTpl->assign('xoops_pagetitle', sprintf(__('Search results for "%s"', 'docs'), $keyword)); include RMEvents::get()->run_event('docs.template.search', RMTemplate::get()->get_template('rd_search.php', 'module', 'docs')); include 'footer.php'; } switch ($action) { case 'search': search_resources(); break; case 'explore': default: show_resources($by == 'recent' ? 'created' : 'reads'); break; }
break; case 'delete': rd_delete_resource(); break; case 'recommend': recommend_resource(1); break; case 'norecommend': recommend_resource(0); break; case 'public': public_resources(1); break; case 'private': public_resources(0); break; case 'qindex': quick_resources(1); break; case 'noqindex': quick_resources(0); break; case 'approve': approved_resources(1); break; case 'draft': approved_resources(0); break; default: show_resources(); }