Example #1
0
    $group = Hubzero\User\Group::getInstance($group);
    echo $group->description;
    foreach ($posts as $post) {
        $inst = $post;
        ?>


<?php 
        echo User::getInstance($post->created_by)->get('name');
        ?>
 | <?php 
        echo Date::of($post->created)->toLocal('M j, Y g:i:s a');
        ?>

<?php 
        echo Hubzero\Utility\Sanitize::stripAll($inst->get('comment'));
        $base = rtrim(Request::root(), '/');
        $sef = Route::urlForClient('site', $inst->link());
        $link = $base . '/' . trim($sef, '/');
        ?>
View this post on <?php 
        echo Config::get('sitename');
        ?>
: <?php 
        echo $link;
    }
    ?>

-----------------------
<?php 
}
Example #2
0
 /**
  * Called after updating a ticket
  *
  * @param   object  $ticket
  * @param   object  $comment
  * @return  void
  */
 public function onTicketUpdate($ticket, $comment)
 {
     if (!$this->isReady() || !$this->params->get('notify_updated')) {
         return;
     }
     if (!$this->params->get('notify_private') && $comment->isPrivate()) {
         return;
     }
     if ($group = $this->params->get('group_updated')) {
         if ($group != $ticket->get('group')) {
             return;
         }
     }
     $channel = $this->params->get('channel_updated', $this->params->get('channel'));
     $url = rtrim(Request::base(), '/') . '/' . ltrim(Route::url($ticket->link()), '/');
     if (App::isAdmin()) {
         $url = rtrim(Request::root(), '/') . '/support/ticket/' . $ticket->get('id');
     }
     $pretext = Lang::txt('PLG_SUPPORT_SLACK_TICKET_UPDATED', Config::get('sitename'));
     //, $comment->creator()->get('name'));
     $text = preg_replace("/<br\\s?\\/>/i", '', $comment->get('comment'));
     $text = Hubzero\Utility\String::truncate(Hubzero\Utility\Sanitize::stripWhitespace($text), 300);
     $color = 'good';
     if ($comment->isPrivate()) {
         $color = '#ecada2';
         $pretext .= ' *' . Lang::txt('PLG_SUPPORT_SLACK_PRIVATE') . '*';
     }
     $title = Lang::txt('PLG_SUPPORT_SLACK_TICKET_NUMBER', $ticket->get('id'));
     if (Component::params('com_support')->get('email_terse')) {
         $text = Lang::txt('PLG_SUPPORT_SLACK_COMMENT_NEW');
     } else {
         $title .= ': ' . $ticket->get('summary');
     }
     $data = array('fallback' => $pretext . ': ' . $url . ' - ' . $text, 'pretext' => $pretext, 'title' => $title, 'title_link' => $url, 'text' => $text, 'color' => $color, 'author_name' => $comment->creator()->get('name'));
     if (!Component::params('com_support')->get('email_terse')) {
         $fields = array();
         foreach ($comment->changelog()->lists() as $type => $log) {
             if (is_array($log) && count($log) > 0) {
                 if ($type != 'changes') {
                     continue;
                 }
                 foreach ($log as $items) {
                     if ($items->before != $items->after) {
                         $fields[] = array('title' => ucfirst($items->field), 'value' => $items->after, 'short' => true);
                     }
                 }
             }
         }
         if (!empty($fields)) {
             $data['fields'] = $fields;
         }
     }
     $this->send($channel, $data);
 }