7 use Friendica\Content\Nav;
8 use Friendica\Core\L10n;
9 use Friendica\Database\DBA;
10 use Friendica\Database\DBM;
11 use Friendica\Model\Item;
12 use Friendica\Model\Profile;
14 function notes_init(App $a)
22 $which = $a->user['nickname'];
24 Nav::setSelected('home');
26 //Profile::load($a, $which, $profile);
30 function notes_content(App $a, $update = false)
33 notice(L10n::t('Permission denied.') . EOL);
37 require_once 'include/security.php';
38 require_once 'include/conversation.php';
40 $o = Profile::getTabs($a, true);
43 $o .= '<h3>' . L10n::t('Personal Notes') . '</h3>';
47 'allow_location' => (($a->user['allow_location']) ? true : false),
48 'default_location' => $a->user['default-location'],
49 'nickname' => $a->user['nickname'],
50 'lockstate' => 'lock',
54 'profile_uid' => local_user(),
55 'button' => L10n::t('Save'),
59 $o .= status_editor($a, $x, $a->contact['id']);
62 $condition = ['uid' => local_user(), 'post-type' => Item::PT_PERSONAL_NOTE, 'gravity' => GRAVITY_PARENT,
63 'wall' => false, 'allow_cid' => '<' . $a->contact['id'] . '>', 'contact-id'=> $a->contact['id']];
65 $a->set_pager_itemspage(40);
67 $params = ['order' => ['created' => true],
68 'limit' => [$a->pager['start'], $a->pager['itemspage']]];
69 $r = Item::selectForUser(local_user(), ['id'], $condition, $params);
73 if (DBM::is_result($r)) {
77 while ($rr = Item::fetch($r)) {
78 $parents_arr[] = $rr['id'];
82 $condition = ['uid' => local_user(), 'parent' => $parents_arr];
83 $result = Item::selectForUser(local_user(), [], $condition);
85 if (DBM::is_result($result)) {
86 $items = conv_sort(Item::inArray($result), 'commented');
87 $o .= conversation($a, $items, 'notes', $update);
91 $o .= alt_pager($a, $count);