3 * Developer's Diary Page
5 * Copyright 1999-2001 (c) VA Linux Systems
6 * Copyright 2010 (c) Franck Villaume
7 * Copyright (C) 2012 Alain Peyrat - Alcatel-Lucent
9 * This file is part of FusionForge. FusionForge is free software;
10 * you can redistribute it and/or modify it under the terms of the
11 * GNU General Public License as published by the Free Software
12 * Foundation; either version 2 of the Licence, or (at your option)
15 * FusionForge is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License along
21 * with FusionForge; if not, write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25 require_once('../env.inc.php');
26 require_once $gfcommon.'include/pre.php';
27 require_once $gfwww.'include/vote_function.php';
29 if (!forge_get_config('use_diary')) {
30 exit_disabled('home');
33 $diary_user = getIntFromRequest('diary_user');
35 $diary_id = getIntFromRequest('diary_id');
37 $user_obj=user_get_object($diary_user);
39 exit_error(_('User could not be found.'),'home');
40 } else if ($user_obj->isError()) {
41 exit_error($user_obj->getErrorMessage(),'home');
44 $title = _('Diary And Notes For').': '. $user_obj->getRealName();
45 echo $HTML->header(array('title'=>$title));
48 $res = db_query_params ('SELECT * FROM user_diary WHERE user_id=$1 AND id=$2 AND is_public=1',
52 if (!$res || db_numrows($res) < 1) {
53 echo '<p>' . _('Entry Not Found For This User') . '</p>';
55 echo $HTML->boxTop(db_result($res,0,'summary'));
56 echo '<p>' . _('Posted on ') . date(_('Y-m-d H:i'), db_result($res,0,'date_posted')).'</p>';
57 echo db_result($res,0,'details');
58 echo $HTML->boxBottom();
62 echo $HTML->boxTop(_('Existing Diary And Note Entries'));
63 echo '<table cellspacing="2" width="100%">';
65 List all diary entries
67 $result = db_query_params ('SELECT * FROM user_diary WHERE user_id=$1 AND is_public=1 ORDER BY id DESC',
69 $rows=db_numrows($result);
70 if (!$result || $rows < 1) {
72 exit_error(db_error(),'home');
75 <tr><td><strong>'._('This User Has No Diary Entries').'</strong></td></tr>';
80 <th>'._('Subject').'</th>
81 <th>'._('Date').'</th>
83 for ($i=0; $i<$rows; $i++) {
85 <tr '. $GLOBALS['HTML']->boxGetAltRowStyle($i) .'><td><a href="'. getStringFromServer('PHP_SELF') .'?diary_id='.
86 db_result($result,$i,'id').'&diary_user='. $diary_user .'">'.db_result($result,$i,'summary').'</a></td>'.
87 '<td>'. date(_('Y-m-d H:i'), db_result($result,$i,'date_posted')).'</td></tr>';
90 <tr><td colspan="2" class="tablecontent"> </td></tr>';
93 echo $HTML->boxBottom();
95 echo $HTML->footer(array());
98 exit_error(_('No User Selected'),'home');