6 use Friendica\Content\Nav;
7 use Friendica\Core\L10n;
8 use Friendica\Database\DBM;
9 use Friendica\Model\Profile;
10 use Friendica\Model\Item;
12 function notes_init(App $a)
20 $which = $a->user['nickname'];
22 Nav::setSelected('home');
24 //Profile::load($a, $which, $profile);
28 function notes_content(App $a, $update = false)
31 notice(L10n::t('Permission denied.') . EOL);
35 require_once 'include/security.php';
36 require_once 'include/conversation.php';
38 $o = Profile::getTabs($a, true);
41 $o .= '<h3>' . L10n::t('Personal Notes') . '</h3>';
45 'allow_location' => (($a->user['allow_location']) ? true : false),
46 'default_location' => $a->user['default-location'],
47 'nickname' => $a->user['nickname'],
48 'lockstate' => 'lock',
52 'profile_uid' => local_user(),
53 'button' => L10n::t('Save'),
57 $o .= status_editor($a, $x, $a->contact['id']);
60 $condition = ["`uid` = ? AND `type` = 'note' AND `id` = `parent` AND NOT `wall`
61 AND `allow_cid` = ? AND `contact-id` = ?",
62 local_user(), '<' . $a->contact['id'] . '>', $a->contact['id']];
64 $notes = dba::count('item', $condition);
66 $a->set_pager_total($notes);
67 $a->set_pager_itemspage(40);
69 $params = ['order' => ['created' => true],
70 'limit' => [$a->pager['start'], $a->pager['itemspage']]];
71 $r = Item::selectForUser(local_user(), ['item_id'], $condition, $params);
73 if (DBM::is_result($r)) {
76 while ($rr = Item::fetch($r)) {
77 $parents_arr[] = $rr['item_id'];
81 $condition = ['uid' => local_user(), 'parent' => $parents_arr];
82 $result = Item::selectForUser(local_user(), [], $condition);
83 if (DBM::is_result($result)) {
84 $items = conv_sort(Item::inArray($result), 'commented');
85 $o .= conversation($a, $items, 'notes', $update);