1 | <?php |
---|
2 | # -- BEGIN LICENSE BLOCK --------------------------------------- |
---|
3 | # |
---|
4 | # This file is part of Dotclear 2. |
---|
5 | # |
---|
6 | # Copyright (c) 2003-2010 Olivier Meunier & Association Dotclear |
---|
7 | # Licensed under the GPL version 2.0 license. |
---|
8 | # See LICENSE file or |
---|
9 | # http://www.gnu.org/licenses/old-licenses/gpl-2.0.html |
---|
10 | # |
---|
11 | # -- END LICENSE BLOCK ----------------------------------------- |
---|
12 | |
---|
13 | require dirname(__FILE__).'/../inc/admin/prepend.php'; |
---|
14 | |
---|
15 | dcPage::check('usage,contentadmin'); |
---|
16 | |
---|
17 | $q = !empty($_GET['q']) ? $_GET['q'] : ''; |
---|
18 | |
---|
19 | $blogs_list = new adminBlogList($core); |
---|
20 | |
---|
21 | $params = new ArrayObject(); |
---|
22 | |
---|
23 | # - Limit, sortby and order filter |
---|
24 | $params = $blogs_list->applyFilters($params); |
---|
25 | |
---|
26 | $show_filters = false; |
---|
27 | |
---|
28 | # - Search filter |
---|
29 | if ($q) { |
---|
30 | $params['q'] = $q; |
---|
31 | $show_filters = true; |
---|
32 | } |
---|
33 | |
---|
34 | try { |
---|
35 | $counter = $core->getBlogs($params,1); |
---|
36 | $rs = $core->getBlogs($params); |
---|
37 | $blogs_list->setItems($rs,$counter->f(0)); |
---|
38 | } catch (Exception $e) { |
---|
39 | $core->error->add($e->getMessage()); |
---|
40 | } |
---|
41 | |
---|
42 | /* DISPLAY |
---|
43 | -------------------------------------------------------- */ |
---|
44 | $starting_script = ''; |
---|
45 | if (!$show_filters) { |
---|
46 | $starting_script .= dcPage::jsLoad('js/filter-controls.js'); |
---|
47 | } |
---|
48 | dcPage::open(__('List of blogs'),$starting_script); |
---|
49 | |
---|
50 | if (!empty($_GET['del'])) { |
---|
51 | echo '<p class="message">'.__('Blog has been successfully deleted.').'</p>'; |
---|
52 | } |
---|
53 | |
---|
54 | echo '<h2>'.__('List of blogs').'</h2>'; |
---|
55 | |
---|
56 | if (!$core->error->flag()) |
---|
57 | { |
---|
58 | if ($core->auth->isSuperAdmin()) { |
---|
59 | echo '<p class="top-add"><a class="button add" href="blog.php">'.__('Create a new blog').'</a></p>'; |
---|
60 | } |
---|
61 | |
---|
62 | if (!$show_filters) { |
---|
63 | echo '<p><a id="filter-control" class="form-control" href="#">'.__('Filters').'</a></p>'; |
---|
64 | } |
---|
65 | |
---|
66 | echo |
---|
67 | '<form action="blogs.php" method="get" id="filters-form">'. |
---|
68 | '<fieldset><legend>'.__('Filters').'</legend>'. |
---|
69 | |
---|
70 | '<p><label for="q">'.__('Search:').' '. |
---|
71 | form::field('q',20,255,html::escapeHTML($q)). |
---|
72 | '</label></p>'. |
---|
73 | '<p><input type="submit" value="'.__('Apply filters').'" /></p>'. |
---|
74 | |
---|
75 | '<br class="clear" />'. //Opera sucks |
---|
76 | '</fieldset>'. |
---|
77 | '</form>'; |
---|
78 | |
---|
79 | # Show blogs |
---|
80 | $blogs_list->display(); |
---|
81 | } |
---|
82 | |
---|
83 | dcPage::close(); |
---|
84 | |
---|
85 | ?> |
---|