function render_item_status($activity, $data)
 {
     $has_url = property_exists($data, 'url');
     $has_title = property_exists($data, 'title');
     $has_new = property_exists($data, 'new');
     $has_status = property_exists($data, 'status');
     // Status
     if ($activity->type == 'status') {
         return item_linkify($this->get_content($activity->content_id)->content);
     }
     // Has Status
     if ($has_status) {
         return $object->status;
     } else {
         $verb = item_verb($this->ci->lang->line('verbs'), $activity->verb);
         $article = item_type($this->ci->lang->line('object_articles'), $activity->type);
         $type = item_type($this->ci->lang->line('object_types'), $activity->type);
         // Has Title
         if ($has_title && $data->title) {
             if ($has_url) {
                 $title_link = $type . ' <a href="' . $data->url . '">' . character_limiter($data->title, 22) . '</a>';
             } else {
                 $title_link = $data->title;
             }
         } else {
             if ($has_url) {
                 $title_link = ' <a href="' . $data->url . '">' . $type . '</a>';
             } else {
                 $title_link = $type;
             }
         }
         return '<span class="item_verb">' . $verb . ' ' . $article . ' ' . $title_link . '</span>';
     }
 }
 /**
  * Generate Item
  *
  * @param	object	$activity	The activity to render
  * @return	string	The $activity, rendered as html
  */
 function render_item($activity)
 {
     // Data
     $data = json_decode($activity->data);
     // Person
     $person = '<a href="' . $activity->username . '">' . $activity->name . '</a>';
     $has_url = property_exists($data, 'url');
     $has_title = property_exists($data, 'title');
     $has_new = property_exists($data, 'new');
     $has_status = property_exists($data, 'status');
     // Has Status
     $verb = item_verb($this->ci->lang->line('verbs'), $activity->verb);
     $article = item_type($this->ci->lang->line('object_articles'), $activity->type);
     $type = item_type($this->ci->lang->line('object_types'), $activity->type);
     // Has Title
     if ($activity->type == 'status') {
         $title_link = '<a href="' . base_url() . $activity->module . '/view/' . $activity->content_id . '">' . real_character_limiter($activity->content, 15) . '</a>';
     } elseif ($has_title && $data->title) {
         if ($has_url) {
             $title_link = $type . ' <a href="' . $data->url . '">' . real_character_limiter($data->title, 15) . '</a>';
         } else {
             $title_link = real_character_limiter($data->title, 15);
         }
     } else {
         if ($has_url) {
             $title_link = ' <a href="' . $data->url . '">' . $type . '</a>';
         } else {
             $title_link = $type;
         }
     }
     return $person . ' <span class="item_verb">' . $verb . ' ' . $article . ' ' . $title_link . '</span>';
 }
示例#3
0
 function load($item_id)
 {
     $this->begin_basic_items_query(1);
     $this->db->where('items.id', $item_id);
     $result = $this->db->get()->result();
     $item = $result[0];
     $item->num_stories = $this->db->from('items_stories')->where('item_id', $item->id)->count_all_results();
     $this->load->helper('attachment');
     $item->type = item_type($item->mimetype);
     return $item;
 }
示例#4
0
 function comments()
 {
     $this->data['page_title'] = "Comments";
     $this->data['sub_title'] = "Recent";
     $this->data['navigation'] = $this->load->view(config_item('dashboard_theme') . '/partials/navigation_comments.php', $this->data, true);
     $comments = $this->social_tools->get_comments(config_item('site_id'), $this->session->userdata('user_id'), $this->uri->segment(3));
     $comments_view = NULL;
     $this->data['feed_type'] = 'comments';
     $this->data['item_verb'] = item_type($this->lang->line('object_types'), 'comment');
     if (empty($comments)) {
         $comments_view = '<li>No comments to show!</li>';
     } else {
         foreach ($comments as $comment) {
             // Item
             $this->data['item_id'] = $comment->comment_id;
             $this->data['item_type'] = item_type_class($comment->type);
             $this->data['item_viewed'] = item_viewed('item', $comment->viewed);
             // Contributor
             $this->data['item_avatar'] = $this->social_igniter->profile_image($comment->user_id, $comment->image, $comment->gravatar);
             $this->data['item_contributor'] = $comment->name;
             $this->data['item_profile'] = base_url() . 'profile/' . $comment->username;
             // Activity
             if ($comment->title) {
                 $this->data['item_article'] = '';
                 $this->data['item_object'] = $comment->title;
             } else {
                 $this->data['item_article'] = item_type($this->lang->line('object_articles'), $comment->type);
                 $this->data['item_object'] = $comment->type;
             }
             $this->data['item_text'] = item_linkify($comment->comment);
             $this->data['item_date'] = format_datetime(config_item('comments_date_style'), $comment->created_at);
             $this->data['item_approval'] = $comment->approval;
             // Alerts
             $this->data['item_alerts'] = item_alerts_comment($comment);
             // Actions
             $this->data['item_view'] = base_url() . $comment->module . '/view/' . $comment->content_id . '/' . $comment->comment_id;
             $this->data['item_reply'] = base_url() . $comment->module . '/reply/id/' . $comment->content_id . '/' . $comment->comment_id;
             $this->data['item_approve'] = base_url() . 'api/comments/approve/id/' . $comment->comment_id;
             $this->data['item_delete'] = base_url() . 'api/comments/destroy/id/' . $comment->comment_id;
             // Load Partial For Items
             $comments_view .= $this->load->view(config_item('dashboard_theme') . '/partials/item_comments.php', $this->data, true);
         }
     }
     $this->data['comments_view'] = $comments_view;
     $this->render();
 }