aboutsummaryrefslogtreecommitdiffstats
path: root/include/notify.php
blob: 33ea5843c43f5c5ddf3abb4038d22fec3f9588f0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php


function format_notification($item) {


return;

// convert this logic into a json array just like the system notifications

	switch($item['verb']){
		case ACTIVITY_LIKE:
			

				$notif_content .= replace_macros($tpl_item_likes,array(
							'$itemem_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$item['parent'],
							'$itemem_image' => $item['author-avatar'],
							'$itemem_text' => sprintf( t("%s liked %s's post"), $item['author-name'], $item['pname']),
							'$itemem_when' => relative_date($item['created'])
						));
						break;
						
					case ACTIVITY_DISLIKE:
						$notif_content .= replace_macros($tpl_item_dislikes,array(
							'$itemem_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$item['parent'],
							'$itemem_image' => $item['author-avatar'],
							'$itemem_text' => sprintf( t("%s disliked %s's post"), $item['author-name'], $item['pname']),
							'$itemem_when' => relative_date($item['created'])
						));
						break;
						
					case ACTIVITY_FRIEND:
					
						$xmlhead="<"."?xml version='1.0' encoding='UTF-8' ?".">";
						$obj = parse_xml_string($xmlhead.$item['object']);
						$item['fname'] = $obj->title;
						
						$notif_content .= replace_macros($tpl_item_friends,array(
							'$itemem_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$item['parent'],
							'$itemem_image' => $item['author-avatar'],
							'$itemem_text' => sprintf( t("%s is now friends with %s"), $item['author-name'], $item['fname']),
							'$itemem_when' => relative_date($item['created'])
						));
						break;
						
					default:
						$itemem_text = (($item['id'] == $item['parent'])
							? sprintf( t("%s created a new post"), $item['author-name'])
							: sprintf( t("%s commented on %s's post"), $item['author-name'], $item['pname']));
						$tpl = (($item['id'] == $item['parent']) ? $tpl_item_posts : $tpl_item_comments);

						$notif_content .= replace_macros($tpl,array(
							'$itemem_link' => $a->get_baseurl(true).'/display/'.$a->user['nickname']."/".$item['parent'],
							'$itemem_image' => $item['author-avatar'],
							'$itemem_text' => $itemem_text,
							'$itemem_when' => relative_date($it['created'])
						));
				}
}