Changeset 3402:8681798c6491 for admin/blogs.php
- Timestamp:
- 11/11/16 00:10:02 (9 years ago)
- Branch:
- default
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
admin/blogs.php
r3400 r3402 13 13 require dirname(__FILE__).'/../inc/admin/prepend.php'; 14 14 15 dcPage::check ('usage,contentadmin');15 dcPage::checkSuper(); 16 16 17 17 # Filters … … 22 22 23 23 $sortby_combo = array( 24 __('Last update') => 'blog_upddt',25 __('Blog name') => 'UPPER(blog_name)',26 __('Blog ID') => 'B.blog_id',27 __('Status') => 'blog_status'24 __('Last update') => 'blog_upddt', 25 __('Blog name') => 'UPPER(blog_name)', 26 __('Blog ID') => 'B.blog_id', 27 __('Status') => 'blog_status' 28 28 ); 29 29 30 30 $order_combo = array( 31 __('Descending') => 'desc',32 __('Ascending') => 'asc'31 __('Descending') => 'desc', 32 __('Ascending') => 'asc' 33 33 ); 34 34 35 # Actions 36 $blogs_actions_page = new dcBlogsActionsPage($core,$core->adminurl->get("admin.blogs")); 37 38 if ($blogs_actions_page->process()) { 39 return; 40 } 41 42 # Requests 35 43 $q = !empty($_GET['q']) ? $_GET['q'] : ''; 36 44 $status = isset($_GET['status']) ? $_GET['status'] : ''; … … 88 96 $rsStatic->lexicalSort(($sortby == 'UPPER(blog_name)' ? 'blog_name' : 'blog_id'),$order); 89 97 } 98 $blog_list = new adminBlogList($core,$rs,$counter->f(0)); 90 99 } catch (Exception $e) { 91 100 $core->error->add($e->getMessage()); … … 96 105 97 106 dcPage::open(__('List of blogs'), 98 dcPage::js FilterControl($show_filters),107 dcPage::jsLoad('js/_blogs.js').dcPage::jsFilterControl($show_filters), 99 108 dcPage::breadcrumb( 100 109 array( … … 103 112 )) 104 113 ); 105 106 if (!empty($_GET['del'])) {107 dcPage::success(__('Blog has been successfully deleted.'));108 }109 114 110 115 if (!$core->error->flag()) … … 143 148 144 149 # Show blogs 145 if ($nb_blog == 0) 146 { 147 if( $show_filters ) { 148 echo '<p><strong>'.__('No blog matches the filter').'</strong></p>'; 149 } else { 150 echo '<p><strong>'.__('No blog').'</strong></p>'; 151 } 152 } 153 else 154 { 155 $pager = new dcPager($page,$nb_blog,$nb_per_page,10); 150 $blog_list->display($page,$nb_per_page, 151 '<form action="'.$core->adminurl->get("admin.blogs").'" method="post" id="form-blogs">'. 156 152 157 echo $pager->getLinks();153 '%s'. 158 154 159 echo 160 '<div class="table-outer">'. 161 '<table class="clear">'; 155 '<div class="two-cols">'. 156 '<p class="col checkboxes-helpers"></p>'. 162 157 163 if( $show_filters ) { 164 echo '<caption>'.sprintf(__('%d blog matches the filter.','%d blogs match the filter.',$nb_blog),$nb_blog).'</caption>'; 165 } else { 166 echo '<caption class="hidden">'.__('Blogs list').'</caption>'; 167 } 158 '<p class="col right"><label for="action" class="classic">'.__('Selected blogs action:').'</label> '. 159 form::combo('action',$blogs_actions_page->getCombo(),'online','','','','title="'.__('Actions').'"'). 160 $core->formNonce(). 161 '<input id="do-action" type="submit" value="'.__('ok').'" /></p>'. 162 form::hidden(array('sortby'),$sortby). 163 form::hidden(array('order'),$order). 164 form::hidden(array('status'),$status). 165 form::hidden(array('page'),$page). 166 form::hidden(array('nb'),$nb_per_page). 167 '</div>'. 168 168 169 echo 170 '<tr>'. 171 '<th scope="col" class="nowrap">'.__('Blog id').'</th>'. 172 '<th scope="col">'.__('Blog name').'</th>'. 173 '<th scope="col" class="nowrap">'.__('URL').'</th>'. 174 '<th scope="col" class="nowrap">'.__('Entries (all types)').'</th>'. 175 '<th scope="col" class="nowrap">'.__('Last update').'</th>'. 176 '<th scope="col" class="nowrap">'.__('Status').'</th>'. 177 '</tr>'; 169 '<div>'. 170 '<p>'.__('Please give your password to confirm the blog deletion.').'</p>'. 171 '<p><label for="pwd">'.__('Your password:').'</label> '. 172 form::password('pwd',20,255).'</p>'. 173 '</div>'. 178 174 179 while ($rsStatic->fetch()) { 180 echo blogLine($rsStatic); 181 } 175 '</form>', 176 $show_filters 177 ); 178 } 182 179 183 echo '</table></div>';184 185 echo $pager->getLinks();186 }187 }188 180 dcPage::helpBlock('core_blogs'); 189 181 dcPage::close(); 190 191 function blogLine($rs)192 {193 global $core;194 195 $blog_id = html::escapeHTML($rs->blog_id);196 $edit_link = '';197 198 if ($GLOBALS['core']->auth->isSuperAdmin()) {199 $edit_link =200 '<a href="'.$core->adminurl->get("admin.blog",array('id' => $blog_id)).'" title="'.sprintf(__('Edit blog settings for %s'),$blog_id).'">'.201 '<img src="images/edit-mini.png" alt="'.__('Edit blog settings').'" /> '.$blog_id.'</a> ';202 } else {203 $edit_link = $blog_id;204 }205 206 $img_status = $rs->blog_status == 1 ? 'check-on' : ($rs->blog_status == 0 ? 'check-off' : 'check-wrn');207 $txt_status = $GLOBALS['core']->getBlogStatus($rs->blog_status);208 $img_status = sprintf('<img src="images/%1$s.png" alt="%2$s" title="%2$s" />',$img_status,$txt_status);209 $offset = dt::getTimeOffset($core->auth->getInfo('user_tz'));210 $blog_upddt = dt::str(__('%Y-%m-%d %H:%M'),strtotime($rs->blog_upddt) + $offset);211 212 return213 '<tr class="line">'.214 '<td class="nowrap">'.$edit_link.'</td>'.215 '<td class="maximal"><a href="'.$core->adminurl->get("admin.home",array('switchblog' => $rs->blog_id)).'" '.216 'title="'.sprintf(__('Switch to blog %s'),$rs->blog_id).'">'.217 html::escapeHTML($rs->blog_name).'</a></td>'.218 '<td class="nowrap"><a class="outgoing" href="'.html::escapeHTML($rs->blog_url).'">'.html::escapeHTML($rs->blog_url).219 ' <img src="images/outgoing-blue.png" alt="" /></a></td>'.220 '<td class="nowrap count">'.$core->countBlogPosts($rs->blog_id).'</td>'.221 '<td class="nowrap count">'.$blog_upddt.'</td>'.222 '<td class="status">'.$img_status.'</td>'.223 '</tr>';224 }
Note: See TracChangeset
for help on using the changeset viewer.