* _ The data requested on success
* _ false on failure
*/
- public function get_template_data($cmnt_tpl) {
+ public function get_template_data($cmnt_tpl, $alike, $dlike) {
$result = array();
foreach($this->threads as $item) {
if($item->get_network() === NETWORK_MAIL && local_user() != $item->get_uid())
continue;
- $item_data = $item->get_template_data($cmnt_tpl, $this->mode);
+ $item_data = $item->get_template_data($cmnt_tpl, $this->mode, $alike, $dlike);
if(!$item_data) {
logger('[ERROR] Conversation::get_template_data : Failed to get item template data ('. $item->get_id() .').', LOGGER_DEBUG);
return false;
require_once('object/BaseObject.php');
require_once('include/text.php');
+require_once('boot.php');
/**
* An item
public function __construct($data) {
$this->data = $data;
- $this->template = $this->available_templates['wall'];
+ $this->set_template('wall');
}
/**
* _ The data requested on success
* _ false on failure
*/
- public function get_template_data($cmnt_tpl, $mode) {
+ public function get_template_data($cmnt_tpl, $mode, $alike, $dlike) {
$result = array();
$a = $this->get_app();
$item = $this->get_data();
- $alike = array();
- $dlike = array();
- $template = $this->available_templates['wall'];
$comment = '';
$commentww = '';
$sparkle = '';
$owner_url = zrl($a->page_contact['url']);
$owner_photo = $a->page_contact['thumb'];
$owner_name = $a->page_contact['name'];
- $template = $this->available_templates['wall2wall'];
+ $this->set_template('wall2wall');
$commentww = 'ww';
}
}
$owner_url = $item['owner-link'];
$owner_photo = $item['owner-avatar'];
$owner_name = $item['owner-name'];
- $template = $this->available_templates['wall2wall'];
+ $this->set_template('wall2wall');
$commentww = 'ww';
// If it is our contact, use a friendly redirect link
if((link_compare($item['owner-link'],$item['url']))
'comment_firstcollapsed' => $firstcollapsed,
'comment_lastcollapsed' => $lastcollapsed,
// template to use to render item (wall, walltowall, search)
- 'template' => $template,
+ 'template' => $this->get_template(),
'type' => implode("",array_slice(explode("/",$item['verb']),-1)),
'tags' => $tags,
$item_result['children'] = array();
if(count($item['children'])) {
- $item_result['children'] = prepare_threads_body($a, $item['children'], $cmnt_tpl, $this->is_page_writeable(), $this->get_mode(), $this->get_profile_owner(), ($thread_level + 1));
+ $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' : '');
private function is_page_writeable() {
return $this->page_writeable;
}
+
+ /**
+ * Set template
+ */
+ private function set_template($name) {
+ if(!x($this->available_templates, $name))
+ return false;
+ $this->template = $this->available_templates[$name];
+ }
+
+ /**
+ * Get template
+ */
+ private function get_template() {
+ return $this->template;
+ }
}
?>