Dotclear

source: admin/popup_posts.php @ 996:431d4d253490

Revision 996:431d4d253490, 2.4 KB checked in by franck <carnet.franck.paul@…>, 11 years ago (diff)

Remove unnecessary statement

Line 
1<?php
2# -- BEGIN LICENSE BLOCK ---------------------------------------
3#
4# This file is part of Dotclear 2.
5#
6# Copyright (c) 2003-2011 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
13require dirname(__FILE__).'/../inc/admin/prepend.php';
14
15dcPage::check('usage,contentadmin');
16
17$q = !empty($_GET['q']) ? $_GET['q'] : null;
18
19$page = !empty($_GET['page']) ? (integer) $_GET['page'] : 1;
20$nb_per_page =  10;
21
22$post_types = $core->getPostTypes();
23foreach ($post_types as $k => $v) {
24     $type_combo[__($k)] = (string) $k;
25}
26$type = !empty($_POST['type']) ? $_POST['type'] : null;
27if (!$type && $q) {
28     // Cope with search form
29     $type = !empty($_GET['type']) ? $_GET['type'] : null;
30}
31if (!in_array($type, $type_combo)) {
32     $type = null;
33}
34
35$params = array();
36$params['limit'] = array((($page-1)*$nb_per_page),$nb_per_page);
37$params['no_content'] = true;
38$params['order'] = 'post_dt DESC';
39
40if ($q) {
41     $params['search'] = $q;
42}
43
44if ($type) {
45     $params['post_type'] = $type;
46}
47
48dcPage::openPopup(__('Add a link to an entry'),
49     dcPage::jsLoad('js/_posts_list.js').
50     dcPage::jsLoad('js/jsToolBar/popup_posts.js'));
51
52echo '<h2 class="page-title">'.__('Add a link to an entry').'</h2>';
53
54echo '<form action="popup_posts.php" method="post">'.
55     '<p><label for"type" class="classic">'.__('Entry type:').' '.form::combo('type',$type_combo,$type).'</label></p>'.
56     $core->formNonce().
57     '<noscript><div><input type="submit" value="'.__('Ok').'" /></div></noscript>'.
58     '</form>';
59
60echo '<form action="popup_posts.php" method="get">'.
61     '<p><label for="q" class="classic">'.__('Search entry:').' '.form::field('q',30,255,html::escapeHTML($q)).'</label> '.
62     ' <input type="submit" value="'.__('Search').'" /></p>'.
63     form::hidden('type',html::escapeHTML($type)).
64     '</form>';
65
66try {
67     $posts = $core->blog->getPosts($params);
68     $counter = $core->blog->getPosts($params,true);
69     $post_list = new adminPostMiniList($core,$posts,$counter->f(0));
70} catch (Exception $e) {
71     $core->error->add($e->getMessage());
72}
73
74echo '<div id="form-entries">'; # I know it's not a form but we just need the ID
75$post_list->display($page,$nb_per_page);
76echo '</div>';
77
78echo '<p><a class="button" href="#" id="link-insert-cancel">'.__('cancel').'</a></p>';
79
80dcPage::closePopup();
81?>
Note: See TracBrowser for help on using the repository browser.

Sites map