core =& $core; $this->rs =& $rs; $this->rs_count = $rs_count; $this->html_prev = __('«prev.'); $this->html_next = __('next»'); } } class adminPostList extends adminGenericList { public function display($page,$nb_per_page,$enclose_block='') { if ($this->rs->isEmpty()) { echo '

'.__('No entry').'

'; } else { $pager = new pager($page,$this->rs_count,$nb_per_page,10); $pager->html_prev = $this->html_prev; $pager->html_next = $this->html_next; $pager->var_page = 'page'; $html_block = ''. ''. ''. ''. ''. ''. '%s
'.__('Title').''.__('Date').''.__('Category').''.__('Author').''.__('Status').'
'; if ($enclose_block) { $html_block = sprintf($enclose_block,$html_block); } echo '

'.__('Page(s)').' : '.$pager->getLinks().'

'; $blocks = explode('%s',$html_block); echo $blocks[0]; while ($this->rs->fetch()) { echo $this->postLine(); } echo $blocks[1]; echo '

'.__('Page(s)').' : '.$pager->getLinks().'

'; } } private function postLine() { if ($this->core->auth->check('categories',$this->core->blog->id)) { $cat_link = '%s'; } else { $cat_link = '%2$s'; } if ($this->rs->cat_title) { $cat_title = sprintf($cat_link,$this->rs->cat_id, html::escapeHTML($this->rs->cat_title)); } else { $cat_title = __('None'); } $img = '%1$s'; switch ($this->rs->post_status) { case 1: $img_status = sprintf($img,__('published'),'check-on.png'); break; case 0: $img_status = sprintf($img,__('unpublished'),'check-off.png'); break; case -1: $img_status = sprintf($img,__('scheduled'),'scheduled.png'); break; case -2: $img_status = sprintf($img,__('pending'),'check-wrn.png'); break; } $protected = ''; if ($this->rs->post_password) { $protected = sprintf($img,__('protected'),'locker.png'); } $selected = ''; if ($this->rs->post_selected) { $selected = sprintf($img,__('selected'),'selected.png'); } $attach = ''; $nb_media = $this->rs->countMedia(); if ($nb_media > 0) { $attach_str = $nb_media == 1 ? __('%d attachment') : __('%d attachments'); $attach = sprintf($img,sprintf($attach_str,$nb_media),'attach.png'); } $res = ''; $res .= ''. form::checkbox(array('entries[]'),$this->rs->post_id,'','','',!$this->rs->isEditable()).''. ''. html::escapeHTML($this->rs->post_title).''. ''.dt::dt2str(__('%Y-%m-%d %H:%M'),$this->rs->post_dt).''. ''.$cat_title.''. ''.$this->rs->user_id.''. ''.$img_status.' '.$selected.' '.$protected.' '.$attach.''. ''; return $res; } } class adminPostMiniList extends adminGenericList { public function display($page,$nb_per_page,$enclose_block='') { if ($this->rs->isEmpty()) { echo '

'.__('No entry').'

'; } else { $pager = new pager($page,$this->rs_count,$nb_per_page,10); $pager->html_prev = $this->html_prev; $pager->html_next = $this->html_next; $pager->var_page = 'page'; $html_block = ''. ''. ''. ''. ''. '%s
'.__('Title').''.__('Date').''.__('Author').''.__('Status').'
'; if ($enclose_block) { $html_block = sprintf($enclose_block,$html_block); } echo '

'.__('Page(s)').' : '.$pager->getLinks().'

'; $blocks = explode('%s',$html_block); echo $blocks[0]; while ($this->rs->fetch()) { echo $this->postLine(); } echo $blocks[1]; echo '

'.__('Page(s)').' : '.$pager->getLinks().'

'; } } private function postLine() { $img = '%1$s'; switch ($this->rs->post_status) { case 1: $img_status = sprintf($img,__('published'),'check-on.png'); break; case 0: $img_status = sprintf($img,__('unpublished'),'check-off.png'); break; case -1: $img_status = sprintf($img,__('scheduled'),'scheduled.png'); break; case -2: $img_status = sprintf($img,__('pending'),'check-wrn.png'); break; } $protected = ''; if ($this->rs->post_password) { $protected = sprintf($img,__('protected'),'locker.png'); } $selected = ''; if ($this->rs->post_selected) { $selected = sprintf($img,__('selected'),'selected.png'); } $attach = ''; $nb_media = $this->rs->countMedia(); if ($nb_media > 0) { $attach_str = $nb_media == 1 ? __('%d attachment') : __('%d attachments'); $attach = sprintf($img,sprintf($attach_str,$nb_media),'attach.png'); } $res = ''; $res .= ''. html::escapeHTML($this->rs->post_title).''. ''.dt::dt2str(__('%Y-%m-%d %H:%M'),$this->rs->post_dt).''. ''.$this->rs->user_id.''. ''.$img_status.' '.$selected.' '.$protected.' '.$attach.''. ''; return $res; } } class adminUserList extends adminGenericList { public function display($page,$nb_per_page,$enclose_block='') { if ($this->rs->isEmpty()) { echo '

'.__('No user').'

'; } else { $pager = new pager($page,$this->rs_count,$nb_per_page,10); $pager->html_prev = $this->html_prev; $pager->html_next = $this->html_next; $pager->var_page = 'page'; $html_block = ''. ''. ''. ''. ''. ''. '%s
'.__('Username').''.__('First Name').''.__('Last Name').''.__('Display name').''.__('Entries').'
'; if ($enclose_block) { $html_block = sprintf($enclose_block,$html_block); } echo '

'.__('Page(s)').' : '.$pager->getLinks().'

'; $blocks = explode('%s',$html_block); echo $blocks[0]; while ($this->rs->fetch()) { echo $this->userLine(); } echo $blocks[1]; echo '

'.__('Page(s)').' : '.$pager->getLinks().'

'; } } private function userLine() { $img = '%1$s'; $img_status = ''; $p = $this->core->getUserPermissions($this->rs->user_id); if (isset($p[$this->core->blog->id]['p']['admin'])) { $img_status = sprintf($img,__('admin'),'admin.png'); } if ($this->rs->user_super) { $img_status = sprintf($img,__('superadmin'),'superadmin.png'); } return ''. ''.form::hidden(array('nb_post[]'),(integer) $this->rs->nb_post). form::checkbox(array('user_id[]'),$this->rs->user_id).''. ''. $this->rs->user_id.' '.$img_status.''. ''.$this->rs->user_firstname.''. ''.$this->rs->user_name.''. ''.$this->rs->user_displayname.''. ''. $this->rs->nb_post.''. ''; } } ?>