Webylon 3.2 API Docs
  • Package
  • Class
  • Tree
  • Deprecated
  • Download
Version: current
  • 3.2
  • 3.1

Packages

  • 1c
    • exchange
      • catalog
  • auth
  • Booking
  • building
    • company
  • cart
    • shipping
    • steppedcheckout
  • Catalog
    • monument
  • cms
    • assets
    • batchaction
    • batchactions
    • bulkloading
    • comments
    • content
    • core
    • export
    • newsletter
    • publishers
    • reports
    • security
    • tasks
  • Dashboard
  • DataObjectManager
  • event
  • faq
  • forms
    • actions
    • core
    • fields-basic
    • fields-dataless
    • fields-datetime
    • fields-files
    • fields-formatted
    • fields-formattedinput
    • fields-relational
    • fields-structural
    • transformations
    • validators
  • googlesitemaps
  • guestbook
  • installer
  • newsletter
  • None
  • photo
    • gallery
  • PHP
  • polls
  • recaptcha
  • sapphire
    • api
    • bulkloading
    • control
    • core
    • cron
    • dev
    • email
    • fields-formattedinput
    • filesystem
    • formatters
    • forms
    • i18n
    • integration
    • misc
    • model
    • parsers
    • search
    • security
    • tasks
    • testing
    • tools
    • validation
    • view
    • widgets
  • seo
    • open
      • graph
  • sfDateTimePlugin
  • spamprotection
  • stealth
    • captha
  • subsites
  • userform
    • pagetypes
  • userforms
  • webylon
  • widgets

Classes

  • Akismet
  • CommentAdmin
  • CommentTableField
  • CommentTableField_Item
  • MathSpamProtection
  • PageComment
  • PageComment_Controller
  • PageCommentInterface
  • PageCommentInterface_Controller
  • PageCommentInterface_Form
  • SocketWriteRead
  • SSAkismet
  1 <?php
  2 /**
  3  * Special kind of ComplexTableField for managing comments.
  4  * @package cms
  5  * @subpackage comments
  6  */
  7 class CommentTableField extends ComplexTableField {
  8     protected $template = "CommentTableField";
  9     protected $mode;
 10     
 11     function    __construct($controller, $name, $sourceClass, $mode, $fieldList, $detailFormFields = null, $sourceFilter = "", $sourceSort = "Created", $sourceJoin = "") {
 12         $this->mode = $mode;
 13         
 14         Session::set('CommentsSection', $mode);
 15         
 16         parent::__construct($controller, $name, $sourceClass, $fieldList, $detailFormFields, $sourceFilter, $sourceSort, $sourceJoin);
 17         
 18         $this->Markable = true;
 19         $this->setPageSize(15);
 20         
 21         // search
 22         $search = isset($_REQUEST['CommentSearch']) ? Convert::raw2sql($_REQUEST['CommentSearch']) : null;
 23         if(!empty($_REQUEST['CommentSearch'])) {
 24             $this->sourceFilter[] = "( \"Name\" LIKE '%$search%' OR \"Comment\" LIKE '%$search%')";
 25         }
 26     }
 27     
 28     function FieldHolder() {
 29         $ret = parent::FieldHolder();
 30         
 31         Requirements::javascript(CMS_DIR . '/javascript/CommentTableField.js');
 32         
 33         return $ret;
 34     }
 35     
 36     function Items() {
 37         $this->sourceItems = $this->sourceItems();
 38         
 39         if(!$this->sourceItems) {
 40             return null;
 41         }
 42         
 43         $pageStart = (isset($_REQUEST['ctf'][$this->Name()]['start']) && is_numeric($_REQUEST['ctf'][$this->Name()]['start'])) ? $_REQUEST['ctf'][$this->Name()]['start'] : 0;
 44         $this->sourceItems->setPageLimits($pageStart, $this->pageSize, $this->totalCount);
 45         
 46         $output = new DataObjectSet();
 47         foreach($this->sourceItems as $pageIndex=>$item) {
 48             $output->push(SS_Object::create('CommentTableField_Item',$item, $this, $pageStart+$pageIndex));
 49         }
 50         return $output;
 51     }
 52     
 53     function HasSpamButton() {
 54         return $this->mode == 'approved' || $this->mode == 'unmoderated';
 55     }
 56     
 57     function HasApproveButton() {
 58         return $this->mode == 'unmoderated';
 59     }
 60     
 61     function HasHamButton() {
 62         return $this->mode == 'spam';
 63     }
 64 
 65     function SearchForm() {
 66         $query = isset($_GET['CommentSearch']) ? $_GET['CommentSearch'] : null;
 67         
 68         $searchFields = new FieldGroup(
 69             new TextField('CommentSearch', _t('CommentTableField.SEARCH', 'Search'), $query),
 70             new HiddenField("ctf[ID]",'',$this->mode),
 71             new HiddenField('CommentFieldName','',$this->name)
 72         );
 73         
 74         $actionFields = new LiteralField('CommentFilterButton','<input type="submit" name="CommentFilterButton" value="'. _t('CommentTableField.FILTER', 'Filter') .'" id="CommentFilterButton"/>');
 75         
 76         $fieldContainer = new FieldGroup(
 77             $searchFields,
 78             $actionFields
 79         );
 80         
 81         return $fieldContainer->FieldHolder();
 82     }
 83 }
 84 
 85 /**
 86  * Single row of a {@link CommentTableField}
 87  * @package cms
 88  * @subpackage comments
 89  */
 90 class CommentTableField_Item extends ComplexTableField_Item {
 91 
 92     function HasSpamButton() {
 93         return $this->parent()->HasSpamButton();
 94     }
 95     
 96     function HasApproveButton() {
 97         return $this->parent()->HasApproveButton();
 98     }
 99     
100     function HasHamButton() {
101         return $this->parent()->HasHamButton();
102     }
103 }
104 
105 ?>
[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. -
Webylon 3.2 API Docs API documentation generated by ApiGen 2.8.0