Changeset 2493:168bf692d29a
- Timestamp:
- 10/26/13 07:36:50 (10 years ago)
- Branch:
- 2.6
- Location:
- inc/admin/actions
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
inc/admin/actions/class.dcaction.php
r2243 r2493 43 43 /** @var string form field name for "entries" (usually "entries") */ 44 44 protected $field_entries; 45 45 46 46 /** @var string title for checkboxes list, if displayed */ 47 47 protected $cb_title; 48 48 49 49 /** @var string title for caller page title */ 50 50 protected $caller_title; 51 51 52 52 /** @var boolean true if we are acting inside a plugin (different handling of begin/endpage) */ 53 protected $in_plugin; 54 53 protected $in_plugin; 54 55 55 /** @var boolean true if we enable to keep selection when redirecting */ 56 protected $enable_redir_selection; 56 protected $enable_redir_selection; 57 57 58 58 /** 59 59 * Class constructor 60 * 60 * 61 61 * @param mixed $core dotclear core 62 62 * @param mixed $uri form uri … … 89 89 $this->enable_redir_selection = true; 90 90 } 91 91 92 92 /** 93 93 * setEnableRedirSelection - define whether to keep selection when redirecting … … 101 101 $this->enable_redir_selection = $enable; 102 102 } 103 103 104 104 /** 105 105 * addAction - adds an action … … 138 138 return $this; 139 139 } 140 140 141 141 /** 142 142 * getCombo - returns the actions combo, useable through form::combo … … 149 149 return $this->combo; 150 150 } 151 152 151 152 153 153 /** 154 154 * getIDS() - returns the list of selected entries … … 161 161 return array_keys($this->entries); 162 162 } 163 163 164 164 /** 165 165 * getIDS() - returns the list of selected entries as HTML hidden fields string … … 176 176 return $ret; 177 177 } 178 178 179 179 /** 180 180 * getHiddenFields() - returns all redirection parameters as HTML hidden fields … … 185 185 * 186 186 * @return string the HTML code for hidden fields 187 */ 187 */ 188 188 public function getHiddenFields($with_ids = false) { 189 189 $ret = ''; … … 196 196 return $ret; 197 197 } 198 199 198 199 200 200 /** 201 201 * getRS() - get record from DB Query containing requested IDs … … 210 210 return $this->rs; 211 211 } 212 212 213 213 /** 214 214 * setupRedir - setup redirection arguments … … 233 233 * 234 234 * @param array $params extra parameters to append to redirection 235 * must be an array : each key is the name, 235 * must be an array : each key is the name, 236 236 * each value is the wanted value 237 237 * @param boolean $with_selected_entries if true, add selected entries in url … … 246 246 unset($redir_args['redir']); 247 247 } 248 248 249 249 if ($with_selected_entries && $this->enable_redir_selection) { 250 250 $redir_args[$this->field_entries] = array_keys($this->entries); … … 252 252 return $this->uri.'?'.http_build_query($redir_args).$this->redir_anchor; 253 253 } 254 254 255 255 /** 256 256 * redirect - redirects to redirection page … … 263 263 http::redirect($this->getRedirection($with_selected_entries,$params)); 264 264 exit; 265 } 266 265 } 266 267 267 /** 268 268 * getURI - returns current form URI, if any … … 286 286 return $this->caller_title; 287 287 } 288 288 289 289 /** 290 290 * getAction - returns current action, if any … … 309 309 310 310 $this->setupRedir($this->from); 311 $this->fetchEntries($this->from); 311 $this->fetchEntries($this->from); 312 312 if (isset($this->from['action'])) { 313 313 $this->action = $this->from['action']; … … 339 339 */ 340 340 public function getCheckboxes() { 341 $ret = 341 $ret = 342 342 '<table class="posts-list"><tr>'. 343 343 '<th colspan="2">'.$this->cb_title.'</th>'. 344 344 '</tr>'; 345 345 foreach ($this->entries as $id=>$title) { 346 $ret .= 347 '<tr><td >'.346 $ret .= 347 '<tr><td class="minimal">'. 348 348 form::checkbox(array($this->field_entries.'[]'),$id,true,'','').'</td>'. 349 349 '<td>'. $title.'</td></tr>'; … … 352 352 return $ret; 353 353 } 354 354 355 355 /** 356 356 * beginPage, endPage - displays the beginning/ending of a page, if action does not redirects dirtectly -
inc/admin/actions/class.dcactioncomments.php
r2256 r2493 29 29 dcDefaultCommentActions::adminCommentsActionsPage($this->core,$this); 30 30 } 31 31 32 32 public function beginPage($breadcrumb='',$head='') { 33 33 if ($this->in_plugin) { … … 43 43 $head, 44 44 $breadcrumb 45 ); 45 ); 46 46 47 47 } 48 48 echo '<p><a class="back" href="'.$this->getRedirection(true).'">'.__('Back to comments list').'</a></p>'; 49 49 } 50 50 51 51 public function endPage() { 52 52 dcPage::close(); … … 64 64 $this->endPage(); 65 65 } 66 66 67 67 /** 68 68 * getcheckboxes -returns html code for selected entries … … 74 74 */ 75 75 public function getCheckboxes() { 76 $ret = 76 $ret = 77 77 '<table class="posts-list"><tr>'. 78 78 '<th colspan="2">'.__('Author').'</th><th>'.__('Title').'</th>'. 79 79 '</tr>'; 80 80 foreach ($this->entries as $id=>$title) { 81 $ret .= 82 '<tr><td >'.81 $ret .= 82 '<tr><td class="minimal">'. 83 83 form::checkbox(array($this->field_entries.'[]'),$id,true,'','').'</td>'. 84 84 '<td>'. $title['author'].'</td><td>'.$title['title'].'</td></tr>'; … … 91 91 if (!empty($from['comments'])) { 92 92 $comments = $from['comments']; 93 93 94 94 foreach ($comments as $k => $v) { 95 95 $comments[$k] = (integer) $v; 96 96 } 97 97 98 98 $params['sql'] = 'AND C.comment_id IN('.implode(',',$comments).') '; 99 99 100 100 if (!isset($from['full_content']) || empty($from['full_content'])) { 101 101 $params['no_content'] = true; 102 102 } 103 103 104 104 $co = $this->core->blog->getComments($params); 105 105 while ($co->fetch()) { … … 116 116 } 117 117 118 class dcDefaultCommentActions 118 class dcDefaultCommentActions 119 119 { 120 120 public static function adminCommentsActionsPage($core, dcCommentsActionsPage $ap) { … … 127 127 $ap->addAction(array(__('Mark as junk') => 'junk'), $action); 128 128 } 129 129 130 130 if ($core->auth->check('delete,contentadmin',$core->blog->id)) 131 131 { … … 147 147 default : $status = 1; break; 148 148 } 149 149 150 150 $core->blog->updCommentsStatus($co_ids,$status); 151 151 … … 163 163 { 164 164 # --BEHAVIOR-- adminBeforeCommentDelete 165 $core->callBehavior('adminBeforeCommentDelete',$comment_id); 165 $core->callBehavior('adminBeforeCommentDelete',$comment_id); 166 166 } 167 167 168 168 # --BEHAVIOR-- adminBeforeCommentsDelete 169 169 $core->callBehavior('adminBeforeCommentsDelete',$co_ids); 170 170 171 171 $core->blog->delComments($co_ids); 172 172 dcPage::addSuccessNotice(__('Selected comments have been successfully deleted.'));
Note: See TracChangeset
for help on using the changeset viewer.