private $mode = null;
private $page_writeable = false;
private $profile_owner = 0;
+ private $toplevel = false;
public function __construct($data) {
$this->data = $data;
$this->set_template('wall');
+ $this->toplevel = ($this->get_id() == $this->get_parent());
}
/**
$firstcollapsed = false;
$total_children += count_descendants($item);
- $toplevelpost = (($item['id'] == $item['parent']) ? true : false);
$item_writeable = (($item['writable'] || $item['self']) ? true : false);
$show_comment_box = ((($this->is_page_writeable()) && ($item_writeable)) ? true : false);
$lock = ((($item['private'] == 1) || (($item['uid'] == local_user()) && (strlen($item['allow_cid']) || strlen($item['allow_gid'])
$like = ((x($alike,$item['uri'])) ? format_like($alike[$item['uri']],$alike[$item['uri'] . '-l'],'like',$item['uri']) : '');
$dislike = ((x($dlike,$item['uri'])) ? format_like($dlike[$item['uri']],$dlike[$item['uri'] . '-l'],'dislike',$item['uri']) : '');
- if($toplevelpost) {
+ if($this->is_toplevel()) {
if((! $item['self']) && ($this->get_mode() !== 'profile')) {
if($item['wall']) {
$item_result['children'] = prepare_threads_body($a, $item['children'], $cmnt_tpl, $this->is_page_writeable(), $this->get_mode(), $this->get_profile_owner(), $alike, $dlike, ($thread_level + 1));
}
$item_result['private'] = $item['private'];
- $item_result['toplevel'] = ($toplevelpost ? 'toplevel_item' : '');
+ $item_result['toplevel'] = ($this->is_toplevel() ? 'toplevel_item' : '');
if(get_config('system','thread_allow')) {
$item_result['flatten'] = false;
else {
$item_result['flatten'] = true;
$item_result['threaded'] = false;
- if(!$toplevelpost) {
+ if(!$htis->is_toplevel()) {
$item_result['comment'] = false;
}
}
public function get_thumb() {
return $this->get_data_value('thumb');
}
+
+ public function get_parent() {
+ return $this->get_data_value('parent');
+ }
/**
* Get raw data
private function get_template() {
return $this->template;
}
+
+ /**
+ * Check if this is a toplevel post
+ */
+ private function is_toplevel() {
+ return $this->toplevel;
+ }
}
?>