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' => local_user(), 'post-type' => Item::PT_PERSONAL_NOTE, 'gravity' => GRAVITY_PARENT,
61 'wall' => false, 'allow_cid' => '<' . $a->contact['id'] . '>', 'contact-id'=> $a->contact['id']];
63 $a->set_pager_itemspage(40);
65 $params = ['order' => ['created' => true],
66 'limit' => [$a->pager['start'], $a->pager['itemspage']]];
67 $r = Item::selectForUser(local_user(), ['id'], $condition, $params);
69 if (DBM::is_result($r)) {
72 while ($rr = Item::fetch($r)) {
73 $parents_arr[] = $rr['id'];
77 $condition = ['uid' => local_user(), 'parent' => $parents_arr];
78 $result = Item::selectForUser(local_user(), [], $condition);
79 if (DBM::is_result($result)) {
80 $items = conv_sort(Item::inArray($result), 'commented');
81 $o .= conversation($a, $items, 'notes', $update);
85 $o .= alt_pager($a, count($r));