if ($db->forum_group > $acl->group) { throw new Exception("Access denied"); } echo "<span style='float:left; font-weight: normal;'><h2>" . $db->forum_name . "</h2></span>"; $this->setTitle($db->forum_name); $db = new DB("forum_topics"); $db->setColPrefix("topic_"); $db->join("left", "{PREFIX}forum_posts", "post_topic", "topic_id"); $db->setSort("topic_sticky DESC, post_added DESC"); $db->select("topic_forum = '" . $db->escape($id) . "' GROUP BY post_topic"); $perpage = 40; $pager = new Pager(); $pager->perpage = $perpage; $pager->count = $db->numRows(); $pager->href = array("forums", "view-forum", $arg); $pager->build(); echo $pager->pager_top; ?> <br /> <a href="<?php echo page("forums", "create-topic", "", "", "", "forum=" . $id); ?> " style="float:right;"><span class="btn"><?php echo _t("Create new topic"); ?> </span></a> <br /><br /> <table width="100%" cellpadding="5" cellspacing="0" class="forum"> <thead> <tr> <td width="46px" class=""></td>
function search($page = 1, $searchQuery = null, $sort = "id") { $m = $this->model; $temp = new $m(); $searchQueryParsed = Options::parse($searchQuery); $where = array(); $queryData = new stdClass(); foreach ($searchQueryParsed as $key => $value) { if (APP_USE_LANGUAGE) { if ($value != "" && $value != null) { if (isset($m->{$key})) { $where[] = $temp->__table__ . ".{$key} LIKE \"%{$value}%\""; } else { $where[] = $temp->__table__ . ".{$key}_{$this->application->language} LIKE \"%{$value}%\""; } } } else { if ($value != "" && $value != null) { $where[] = $temp->__table__ . ".{$key} LIKE \"%{$value}%\""; } } $queryData->{$key} = $value; } $query = array(); //if($this->order!=null) $query["order"] = $this->order; if ($sort != null) { $query["order"] = "{$temp->__table__}.{$sort}"; } $query["group"] = $temp->__table__ . ".id"; $query["limit"] = ($page - 1) * $this->perPage . "," . $this->perPage; $query["founds"] = true; if (count($where) > 0) { $query["where"] = implode(" AND ", $where); } /* if($condition!=null){ $query["where"] = $condition; } */ $this->data["objects"] = Collection::load($this->model, $query, $total); $order = new stdClass(); foreach ($this->orderFields as $key) { $order->{$key} = $key; $sym = $key . "symbol"; $order->{$sym} = "[asc]"; if ($key == $sort) { $order->{$key} .= " desc"; $order->{$sym} = "[desc]"; } } $this->data["order"] = $order; import("data.Pager"); $page = max($page, 1); unset($this->data["objects"]["founds"]); $pager = new Pager($total, $this->perPage); $pager->to = "{$this->controller}/search/{page}/{$searchQuery}"; $this->data["pager"] = $pager->build($page); $this->data["querydata"] = $queryData; $this->data["uri"] = linkForm("/{$this->controller}/search/{$page}/{$searchQuery}"); $this->setView("{$this->folder}/{$this->subView}", $this->data); }