Main Page | Directories | File List | File Members

items.php

Go to the documentation of this file.
00001 <?php
00002 # This file is part of the Savane project
00003 # <http://gna.org/projects/savane/>
00004 #
00005 # $Id: items.php 5381 2006-02-15 14:40:03Z yeupou $
00006 #
00007 #  Copyright 1999-2000 (c) The SourceForge Crew
00008 #  Copyright 2001-2002 (c) Laurent Julliard, CodeX Team, Xerox
00009 #
00010 #  Copyright 2002-2006 (c) Mathieu Roy <yeupou--gnu.org>
00011 #
00012 # The Savane project is free software; you can redistribute it and/or
00013 # modify it under the terms of the GNU General Public License
00014 # as published by the Free Software Foundation; either version 2
00015 # of the License, or (at your option) any later version.
00016 #
00017 # The Savane project is distributed in the hope that it will be useful,
00018 # but WITHOUT ANY WARRANTY; without even the implied warranty of
00019 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020 # GNU General Public License for more details.
00021 #
00022 # You should have received a copy of the GNU General Public License
00023 # along with the Savane project; if not, write to the Free Software
00024 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00025 
00026 
00027 require '../include/pre.php';
00028 require_directory("trackers");
00029 
00030 register_globals_off();
00031 
00032 if (user_isloggedin())
00033 {
00034   $form_threshold = sane_all("form_threshold");
00035   $form_open = sane_all("form_open");
00036   unset($threshold);
00037   unset($open);
00038 
00039   # Extract arguments
00040   if ($form_threshold)
00041     {
00042       # Check if the argument is valid: numeric > 0 and < 10 
00043       if (preg_match('/^[1-9]*$/i', $form_threshold))
00044         { 
00045           $threshold = $form_threshold;
00046           user_set_preference("my_items_threshold", $threshold);
00047         }
00048     }
00049   if ($form_open)
00050     {
00051       # Check if the argument is valid: open or closed
00052       if ($form_open == 'open' || $form_open == 'closed')
00053         { 
00054           $open = $form_open;
00055           user_set_preference("my_items_open", $open);
00056         }
00057     }
00058 
00059   # Extract configuration if needed
00060   if (!$threshold) 
00061     { $threshold = user_get_preference("my_items_threshold"); }
00062   if (!$open) 
00063     { $open = user_get_preference("my_items_open"); }
00064   
00065   # Still nothing? Set the default settings
00066   if (!$threshold) 
00067     { $threshold = 5; }
00068   if (!$open) 
00069     { $open = "open"; }
00070 
00071   site_user_header(array('context'=>'myitems'));
00072 
00073   print '<p>'._("This page contains lists of items assigned to or submitted by you.").'</p>';
00074 
00075   # we get site-specific content
00076   utils_get_content("my/items");
00077 
00078   $fopen = '<select name="form_open"><option value="open" '.($open == "open" ? 'selected="selected"':'').'>'._("Open").'</option><option value="closed" '.($open == "closed" ? 'selected="selected"':'').'>'._("Closed").'</option></select> ';
00079   $fthreshold = '<select name="form_threshold"><option value="1" '.($threshold == 1 ? 'selected="selected"':'').'>'._("Lowest").'</option><option value="3" '.($threshold == 3 ? 'selected="selected"':'').'>'._("Low").'</option><option value="5" '.($threshold == 5 ? 'selected="selected"':'').'>'._("Normal").'</option><option value="7" '.($threshold == 7 ? 'selected="selected"':'').'>'._("High").'</option><option value="9" '.($threshold == 9 ? 'selected="selected"':'').'>'._("Immediate").'</option></select> ';
00080 
00081   $form_opening = '<form action="'.$PHP_SELF.'#options" method="get">';
00082   $form_submit = '<input class="bold"  type="submit" value="'._("Apply").'" />';
00083   print html_show_displayoptions(sprintf(_("Show %s new items or of %s priority at least."), $fopen, $fthreshold),
00084                                  $form_opening,
00085                                  $form_submit);
00086 
00087 
00088  ################ RIGHT PART ############################
00089 
00090   print html_splitpage(1);
00091 
00092   print '<br /><div class="box"><div class="boxtitle">'._("Assigned to me").'</div>';
00093   print my_item_list("assignee", $threshold, $open);
00094   print '</div>';
00095 
00096 
00097 //   # Forums that are actively monitored
00098 //   print $HTML->box1_top(_("Monitored Forums"));
00099 
00100 //   $sql="SELECT groups.group_id, groups.group_name ".
00101 //      "FROM groups,forum_group_list,forum_monitored_forums ".
00102 //      "WHERE groups.group_id=forum_group_list.group_id ".
00103 //      "AND forum_group_list.group_forum_id=forum_monitored_forums.forum_id ".
00104 //      "AND forum_monitored_forums.user_id='".user_getid()."' GROUP BY group_id ORDER BY group_id ASC LIMIT 100";
00105 
00106 //   $result=db_query($sql);
00107 //   $rows=db_numrows($result);
00108 //   if (!$result || $rows < 1)
00109 //     {
00110 //       print '<p>'._("I am not monitoring any forums.").'</p>';
00111 //       print '<p>'._("If I monitor forums, I will be sent new posts in the form of an email, with a link to the new message.");
00112 //       print '<p>'._("I can monitor forums by clicking 'Monitor Forum' in any given discussion forum.");
00113 //       print '<br />&nbsp;';
00114 //       print db_error();
00115 //     }
00116 //   else
00117 //     {
00118 
00119 //       for ($j=0; $j<$rows; $j++)
00120 //      {
00121 
00122 //        $group_id = db_result($result,$j,'group_id');
00123 
00124 //        $sql2="SELECT forum_group_list.group_forum_id,forum_group_list.forum_name ".
00125 //           "FROM groups,forum_group_list,forum_monitored_forums ".
00126 //           "WHERE groups.group_id=forum_group_list.group_id ".
00127 //           "AND groups.group_id=$group_id ".
00128 //           "AND forum_group_list.group_forum_id=forum_monitored_forums.forum_id ".
00129 //           "AND forum_monitored_forums.user_id='".user_getid()."' LIMIT 100";
00130 
00131 //        $result2 = db_query($sql2);
00132 //        $rows2 = db_numrows($result2);
00133 
00134 //        list($hide_now,$count_diff,$hide_url) =
00135 //          my_hide_url('forum',$group_id,$hide_item_id,$rows2,$hide_forum);
00136 
00137 //        $html_hdr = ($j ? '<td colspan="2">' : '').
00138 //           $hide_url.'<A HREF="'.$GLOBALS['sys_home'].'forum/?group_id='.$group_id.'"><strong>'.
00139 //           db_result($result,$j,'group_name').'</strong></A>&nbsp;&nbsp;&nbsp;&nbsp;';
00140 
00141 //        $html = '';
00142 //        $count_new = max(0, $count_diff);
00143 //        for ($i=0; $i<$rows2; $i++)
00144 //          {
00145 
00146 //            if (!$hide_now)
00147 //              {
00148 //                $group_forum_id = db_result($result2,$i,'group_forum_id');
00149 //                $html .= '
00150 //                      <tr class="'. utils_get_alt_row_color($i) .'"><td width="99%">'.
00151 //                   '&nbsp;&nbsp;&nbsp;-&nbsp;<a href="'.$GLOBALS['sys_home'].'forum/forum.php?forum_id='.$group_forum_id.'">'.
00152 //                   stripslashes(db_result($result2,$i,'forum_name')).'</a></td>'.
00153 //                   '<td align="middle"><a href="'.$GLOBALS['sys_home'].'forum/monitor.php?forum_id='.$group_forum_id.
00154 //                   '" onClick="return confirm(\''._("Stop monitoring this Forum?").'\')">'.
00155 //                   '<img src="'.$GLOBALS['sys_home'].'images/'.SV_THEME.'.theme/trash.png" '.
00156 //                   'border="0" alt="'._("Stop monitoring this Forum?").'" /></a></td></tr>';
00157 //              }
00158 //          }
00159 
00160 //        $html_hdr .= my_item_count($rows2,$count_new).'</td></tr>';
00161 //        print $html_hdr.$html;
00162 //      }
00163 
00164 //       print '<TR><TD COLSPAN="2">&nbsp;</TD></TR>';
00165 //     }
00166 //   print $HTML->box1_bottom();
00167 //   print '<br /><br />';
00168 
00169  ################ LEFT PART ############################
00170 
00171                                     
00172   print html_splitpage(2);
00173 
00174   print '<br /><div class="box"><div class="boxtitle">'._("Submitted by me").'</div>';
00175   print my_item_list("submitter", $threshold, $open);
00176   print '</div>';
00177 
00178   print html_splitpage(3);
00179 
00180   # End
00181 
00182   print "\n\n".show_priority_colors_key();
00183 
00184 
00185   $HTML->footer(array());
00186 
00187 }
00188 else
00189 {
00190 
00191   exit_not_logged_in();
00192 
00193 }
00194 
00195 ?>

Generated on Sun Feb 26 13:23:04 2006 for Savane PHP Frontend Developer Reference by  doxygen 1.4.4