Jaxel
Well-known member
I created a content type field:
Then I created my ApprovalQueue class:
I don't know what to do at this point to get items to actually show up in the moderation queue.
- ewr_rio_queue
- approval_queue_handler_class
- EWR\Rio\ApprovalQueue\Queue
Code:
public function canApproveUnapprove(&$error = null)
{
$visitor = \XF::visitor();
return ($visitor->user_id && $visitor->hasPermission('EWRrio', 'modChannels'));
}
protected function _postSave()
{
$approvalQueue = $this->getRelationOrDefault('ApprovalQueue', false);
$approvalQueue->content_date = $this->queue_date;
$approvalQueue->save();
}
protected function _postDelete()
{
if ($this->ApprovalQueue)
{
$this->ApprovalQueue->delete();
}
}
public static function getStructure(Structure $structure)
{
$structure->table = 'ewr_rio_queue';
$structure->shortName = 'EWR\Rio:Queue';
$structure->primaryKey = 'queue_id';
$structure->columns = [
'user_id' => ['type' => self::UINT, 'required' => true],
'queue_id' => ['type' => self::UINT, 'autoIncrement' => true],
'queue_url' => ['type' => self::STR, 'required' => true],
'queue_date' => ['type' => self::UINT, 'required' => true],
];
$structure->getters = [];
$structure->relations = [
'ApprovalQueue' => [
'entity' => 'XF:ApprovalQueue',
'type' => self::TO_ONE,
'conditions' => [
['content_type', '=', 'ewr_rio_queue'],
['content_id', '=', '$queue_id']
],
'primary' => true
]
];
return $structure;
}
Then I created my ApprovalQueue class:
Code:
<?php
namespace EWR\Rio\ApprovalQueue;
use XF\Mvc\Entity\Entity;
class Queue extends \XF\ApprovalQueue\AbstractHandler
{
protected function canActionContent(Entity $content, &$error = null)
{
return $content->canApproveUnapprove($error);
}
public function actionApprove(\EWR\Rio\Entity\Queue $queue)
{
$channelRepo = \XF::repository('EWR\Rio:Channel');
$channelRepo->fetchChannel($queue->queue_url, true, $queue->user_id);
$queue->delete();
}
public function actionDelete(\EWR\Rio\Entity\Queue $queue)
{
$queue->delete();
}
}
I don't know what to do at this point to get items to actually show up in the moderation queue.
Last edited: