Changeset 3702:7f0243dc7876 for admin/popup_posts.php
- Timestamp:
- 02/15/18 13:06:24 (7 years ago)
- Branch:
- default
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
admin/popup_posts.php
r3701 r3702 11 11 # -- END LICENSE BLOCK ----------------------------------------- 12 12 13 require dirname(__FILE__) .'/../inc/admin/prepend.php';13 require dirname(__FILE__) . '/../inc/admin/prepend.php'; 14 14 15 15 dcPage::check('usage,contentadmin'); 16 16 17 $q = !empty($_GET['q']) ? $_GET['q'] : null;17 $q = !empty($_GET['q']) ? $_GET['q'] : null; 18 18 $plugin_id = !empty($_GET['plugin_id']) ? html::sanitizeURL($_GET['plugin_id']) : ''; 19 19 20 $page = !empty($_GET['page']) ? max(1,(integer) $_GET['page']) : 1;21 $nb_per_page = 20 $page = !empty($_GET['page']) ? max(1, (integer) $_GET['page']) : 1; 21 $nb_per_page = 10; 22 22 23 23 $type = !empty($_GET['type']) ? $_GET['type'] : null; … … 25 25 $post_types = $core->getPostTypes(); 26 26 foreach ($post_types as $k => $v) { 27 27 $type_combo[__($k)] = (string) $k; 28 28 } 29 29 if (!in_array($type, $type_combo)) { 30 30 $type = null; 31 31 } 32 32 33 $params = array();34 $params['limit'] = array((($page-1)*$nb_per_page),$nb_per_page);33 $params = array(); 34 $params['limit'] = array((($page - 1) * $nb_per_page), $nb_per_page); 35 35 $params['no_content'] = true; 36 $params['order'] = 'post_dt DESC';36 $params['order'] = 'post_dt DESC'; 37 37 38 38 if ($q) { 39 39 $params['search'] = $q; 40 40 } 41 41 42 42 if ($type) { 43 43 $params['post_type'] = $type; 44 44 } 45 45 46 46 dcPage::openPopup(__('Add a link to an entry'), 47 dcPage::jsLoad('js/_posts_list.js').48 dcPage::jsLoad('js/_popup_posts.js') .49 47 dcPage::jsLoad('js/_posts_list.js') . 48 dcPage::jsLoad('js/_popup_posts.js') . 49 $core->callBehavior('adminPopupPosts', $plugin_id)); 50 50 51 echo '<h2 class="page-title">' .__('Add a link to an entry').'</h2>';51 echo '<h2 class="page-title">' . __('Add a link to an entry') . '</h2>'; 52 52 53 echo '<form action="' .$core->adminurl->get('admin.popup_posts').'" method="get">'.54 '<p><label for="type" class="classic">'.__('Entry type:').'</label> '.form::combo('type',$type_combo,$type).''.55 '<noscript><div><input type="submit" value="'.__('Ok').'" /></div></noscript>'.56 form::hidden('plugin_id',html::escapeHTML($plugin_id)).'</p>'.57 53 echo '<form action="' . $core->adminurl->get('admin.popup_posts') . '" method="get">' . 54 '<p><label for="type" class="classic">' . __('Entry type:') . '</label> ' . form::combo('type', $type_combo, $type) . '' . 55 '<noscript><div><input type="submit" value="' . __('Ok') . '" /></div></noscript>' . 56 form::hidden('plugin_id', html::escapeHTML($plugin_id)) . '</p>' . 57 '</form>'; 58 58 59 echo '<form action="' .$core->adminurl->get('admin.popup_posts').'" method="get">'.60 '<p><label for="q" class="classic">'.__('Search entry:').'</label> '.form::field('q',30,255,html::escapeHTML($q)).61 ' <input type="submit" value="'.__('Search').'" />'.62 form::hidden('plugin_id',html::escapeHTML($plugin_id)).63 form::hidden('type',html::escapeHTML($type)).64 59 echo '<form action="' . $core->adminurl->get('admin.popup_posts') . '" method="get">' . 60 '<p><label for="q" class="classic">' . __('Search entry:') . '</label> ' . form::field('q', 30, 255, html::escapeHTML($q)) . 61 ' <input type="submit" value="' . __('Search') . '" />' . 62 form::hidden('plugin_id', html::escapeHTML($plugin_id)) . 63 form::hidden('type', html::escapeHTML($type)) . 64 '</p></form>'; 65 65 66 66 try { 67 $posts= $core->blog->getPosts($params);68 $counter = $core->blog->getPosts($params,true);69 $post_list = new adminPostMiniList($core,$posts,$counter->f(0));67 $posts = $core->blog->getPosts($params); 68 $counter = $core->blog->getPosts($params, true); 69 $post_list = new adminPostMiniList($core, $posts, $counter->f(0)); 70 70 } catch (Exception $e) { 71 71 $core->error->add($e->getMessage()); 72 72 } 73 73 74 74 echo '<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);75 $post_list->display($page, $nb_per_page); 76 76 echo '</div>'; 77 77 78 echo '<p><button type="button" id="link-insert-cancel">' .__('cancel').'</button></p>';78 echo '<p><button type="button" id="link-insert-cancel">' . __('cancel') . '</button></p>'; 79 79 80 80 dcPage::closePopup();
Note: See TracChangeset
for help on using the changeset viewer.