예제 #1
0
 /**
  * Gets the back end list label
  *
  * @param array          $row
  * @param string         $label
  * @param \DataContainer $dc
  * @param array          $args
  *
  * @return string
  */
 public function getLabel($row, $label, \DataContainer $dc, $args)
 {
     $targetModel = Gateway::findByPk($row['queue_targetGateway']);
     if ($targetModel === null) {
         return $label;
     }
     $label .= sprintf('<div style="color:#ccc;margin:5px 0 0 10px;">&#8627; %s</div>', $targetModel->title);
     return $label;
 }
 /**
  * Gets the back end list label
  *
  * @param array             $row
  * @param string            $label
  * @param \DataContainer    $dc
  * @param array             $args
  *
  * @return string
  */
 public function executeLabelCallback($row, $label, \DataContainer $dc, $args)
 {
     $model = Gateway::findByPk($row['id']);
     $gateway = $model->getGateway();
     if ($gateway instanceof LabelCallbackInterface) {
         return $gateway->getLabel($row, $label, $dc, $args);
     }
     return $label;
 }
 /**
  * Triggers queues and sends their messages based on poor man cron jobs.
  *
  * @param string $interval
  */
 private function sendMessagesFromQueue($interval)
 {
     $queueGateways = Gateway::findQueuesByInterval($interval);
     if ($queueGateways === null) {
         return;
     }
     /** @var $queueManager \NotificationCenter\Queue\QueueManagerInterface */
     $queueManager = $GLOBALS['NOTIFICATION_CENTER']['QUEUE_MANAGER'];
     foreach ($queueGateways as $queueGateway) {
         $queueManager->sendFromQueue($queueGateway->id, (int) $queueGateway->queue_cronMessages);
     }
 }
 /**
  * Modifies the palette for the queue gateway so it takes the one from the
  * target gateway
  *
  * @param \DataContainer $dc
  */
 public function modifyPalette(\DataContainer $dc)
 {
     if (\Input::get('act') != 'edit') {
         return;
     }
     $message = Message::findByPk($dc->id);
     $gateway = $message->getRelated('gateway');
     if ($gateway !== null && $gateway->type == 'queue') {
         $targetGateway = Gateway::findByPk($gateway->queue_targetGateway);
         $GLOBALS['TL_DCA']['tl_nc_message']['palettes']['queue'] = $GLOBALS['TL_DCA']['tl_nc_message']['palettes'][$targetGateway->type];
     }
 }