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>'; }