silverstripe-cms/code/FeedbackAdmin.php
Andrew O'Neil 8c9f5900b5 Allowing marking of comment as spam, ham or accepted in cms
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@39738 467b73ca-7a2a-4603-9d3b-597d59a354a9
2007-08-08 06:00:20 +00:00

58 lines
1.3 KiB
PHP

<?php
class FeedbackAdmin extends LeftAndMain {
public function init() {
parent::init();
Requirements::javascript("cms/javascript/FeedbackAdmin_right.js");
}
public function Link($action = null) {
return "admin/feedback/$action";
}
public function showtable($params) {
return $this->getLastFormIn($this->renderWith('FeedbackAdmin_right'));
}
public function EditForm() {
$url = rtrim($_SERVER['REQUEST_URI'], '/');
$section = substr($url, strrpos($url, '/') + 1);
if($section != 'accepted' && $section != 'unmoderated' && $section != 'spam') {
$section = 'accepted';
}
if($section == 'accepted') {
$filter = 'IsSpam=0 AND NeedsModeration=0';
} else if($section == 'unmoderated') {
$filter = 'NeedsModeration=1';
} else {
$filter = 'IsSpam=1';
}
$tableFields = array(
"Name" => "Author",
"Comment" => "Comment",
"PageTitle" => "Page"
);
$popupFields = new FieldSet(
new TextField("Name"),
new TextareaField("Comment", "Comment")
);
$idField = new HiddenField('ID');
$table = new CommentTableField($this, "Comments", "PageComment", $section, $tableFields, $popupFields, $filter);
$table->setParentClass(false);
$fields = new FieldSet($idField, $table);
$actions = new FieldSet();
$form = new Form($this, "EditForm", $fields, $actions);
return $form;
}
}
?>