Version: current

     1 <?php
     2 /**
     3  * Full width List items have the following general variables available:
     4  *
     5  * $URL
     6  * $Author
     7  * $Date
     8  * $Title
     9  * $Content
    10  * $EditLink
    11  * $DeleteLink
    12  */
    13 class UnmoderatedComments extends DashboardPlugin {
    14     static $position = "full_width";
    15     static $sort = 1;
    16     static $title = "Unmoderated comments";
    17     static $link = "admin/comments/";
    18     static $limit_count = 10;
    19     static $icon = "dashboard/images/22/chat.png";
    20     static $null_message = 'Нет не отмодерированных комментариев';
    21     static $edit_link = 'admin/comments/EditForm/field/Comments/item';
    22     static $edit_popup = TRUE;
    23
    24
    25     public function GenericFullWidth() {
    26         $output = new DataObjectSet();
    27
    28         $items = DataObject::get("PageComment", "NeedsModeration = '1'", "`Created` DESC", NULL, "0,".self::$limit_count);
    29
    30         if($items) {
    31             foreach($items as $item) {
    32                 $date = new Date('Date');
    33                 $date->setValue($item->Created);
    34
    35                 $output->push(new ArrayData(array(
    36                     'URL'       => $item->CommenterURL,
    37                     'Author'    => $item->Name,
    38                     'Date'      => $date,
    39                     'Content'   => $item->Comment,
    40                     'EditLink'      => self::$edit_link.'/'.$item->ID.'/edit',
    41                     'DeleteLink'    => self::$edit_link.'/'.$item->ID.'/delete'
    42                 )));
    43             }
    44         }
    45         return $output;
    46     }
    47 }

[Raise a SilverStripe Framework issue/bug](https://github.com/silverstripe/silverstripe-framework/issues/new)
- [Raise a SilverStripe CMS issue/bug](https://github.com/silverstripe/silverstripe-cms/issues/new)
- Please use the Silverstripe Forums to ask development related questions. -