Main Page | Directories | File List | File Members

include/trackers_run/export.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: download.php 4969 2005-11-15 10:32:43Z yeupou $
00006 #
00007 #  Copyright 2005 (c) Mathieu Roy <yeupou--gnu.org>
00008 #
00009 #
00010 # The Savane project is free software; you can redistribute it and/or
00011 # modify it under the terms of the GNU General Public License
00012 # as published by the Free Software Foundation; either version 2
00013 # of the License, or (at your option) any later version.
00014 #
00015 # The Savane project is distributed in the hope that it will be useful,
00016 # but WITHOUT ANY WARRANTY; without even the implied warranty of
00017 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018 # GNU General Public License for more details.
00019 #
00020 # You should have received a copy of the GNU General Public License
00021 # along with the Savane project; if not, write to the Free Software
00022 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00023 
00024 register_globals_off();
00025 
00026 # use the wording "export job" to distinguish the job from the task that
00027 # will help users to follow the job.
00028 # Yes, job and task can be considered as synonym. But as long as we havent
00029 # got such jobs completely managed via the task tracker, we need to avoid
00030 # confusions.
00031 
00032 if (!$group_id)
00033 { exit_no_group(); }
00034 
00035 $project=project_get_object($group_id);
00036 
00037 if (!member_check(0, $group_id))
00038 {
00039   exit_error(_("Data Export is currently restricted to projects members"));
00040 }
00041 
00042 trackers_init($group_id);
00043 
00044 # Set $printer that may be used in later pages instead of PRINTER
00045 if (defined('PRINTER'))
00046 { $printer = 1; }
00047 
00048 # Set the limit of possible jobs per user
00049 $max_export = 5;
00050 
00051 # Get the list of current exports
00052 $sql = "SELECT * FROM trackers_export WHERE user_name='".user_getname()."' AND unix_group_name='".$group_name."' AND status<>'I' ORDER BY export_id ASC";
00053 $res_export = db_query($sql);
00054 $export_count = db_numrows($res_export);
00055 
00056 
00057 
00058 ########################################################################
00059 # GET/POST Update
00060 
00061 if (sane_all("update"))
00062 {
00063   # Create new item
00064   if (sane_post("create"))
00065     {
00066       $form_id = sane_all("form_id");
00067       if (!form_check($form_id))
00068         { exit_error(_("Exiting")); }
00069 
00070       if ($export_count >= $max_export)
00071         {
00072           # Already registered 5 exports? Kick out
00073           form_clean($form_id);
00074           exit_error(sprintf(ngettext("You have already registered %s export job for this project, which is the current limit. If more exports are required ask other project members.", "You have already registered %s export jobs for this project, which is the current limit. If more exports are required ask other project members.", $max_export), $max_export));
00075         }
00076 
00077 
00078       ##
00079       # Find out the sql to build up export
00080       $report_id = sane_all("report_id");
00081       if (!$report_id)
00082         { $report_id = 100; }
00083       trackers_report_init($group_id, $report_id);
00084 
00085       $select = 'SELECT bug_id ';
00086       $from = 'FROM '.ARTIFACT.' ';
00087       $where = 'WHERE group_id='.$group_id.' ';
00088 
00089       #################### GRABBED FROM BROWSE
00090       # This should probably included in functions
00091       $url_params = trackers_extract_field_list();
00092       unset($url_params['group_id'], $url_params['history_date']);
00093       $advsrch = sane_get("advsrch");
00094       while (list($field,$value_id) = each($url_params))
00095         {
00096           if (!is_array($value_id))
00097             {
00098               unset($url_params[$field]);
00099               $url_params[$field][] = $value_id;
00100             }
00101           if (trackers_data_is_date_field($field))
00102             {
00103               if ($advsrch)
00104                 {
00105                   $field_end = $field.'_end';
00106                   $url_params[$field_end] = sane_post($field_end);
00107                 }
00108               else
00109                 {
00110                   $field_op = $field.'_op';
00111                   $url_params[$field_op] = sane_post($field_op);
00112                   if (!$url_params[$field_op])
00113                     { $url_params[$field_op] = '='; }
00114                 }
00115             }
00116         }
00117 
00118       while ($field = trackers_list_all_fields())
00119         {
00120           if (trackers_data_is_showed_on_query($field) &&
00121               trackers_data_is_select_box($field) )
00122             {
00123               if (!isset($url_params[$field]))
00124                 { $url_params[$field][] = 0; }
00125             }
00126         }
00127 
00128       reset($url_params);
00129       while (list($field,$value_id) = each($url_params))
00130         {
00131           # This break the sql, I dont now why. Apparently it returns false
00132           # for the date fields.
00133           #if (!trackers_data_is_showed_on_query($field))
00134           #  { continue; }
00135 
00136           if (trackers_data_is_select_box($field) && !trackers_isvarany($url_params[$field]) )
00137             {
00138               $where .= ' AND '.$field.' IN ('.implode(',',$url_params[$field]).') ';
00139             }
00140           else if (trackers_data_is_date_field($field) && $url_params[$field][0])
00141             {
00142               list($time,$ok) = utils_date_to_unixtime($url_params[$field][0]);
00143               preg_match("/\s*(\d+)-(\d+)-(\d+)/", $url_params[$field][0],$match);
00144               list(,$year,$month,$day) = $match;
00145 
00146               if ($advsrch)
00147                 {
00148                   list($time_end,$ok_end) = utils_date_to_unixtime($url_params[$field.'_end'][0]);
00149                   if ($ok)
00150                     { $where .= ' AND '.$field.' >= '. $time; }
00151 
00152                   if ($ok_end)
00153                     { $where .= ' AND '.$field.' <= '. $time_end; }
00154                 }
00155               else
00156                 {
00157                   $operator = $url_params[$field.'_op'][0];
00158           # '=' means that day between 00:00 and 23:59
00159                   if ($operator == '=')
00160                     {
00161                       $time_end = mktime(23, 59, 59, $month, $day, $year);
00162                       $where .= ' AND '.$field.' >= '.$time.' AND '.$field.' <= '.$time_end.' ';
00163                     }
00164                   else
00165                     {
00166                       $time = mktime(0,0,0, $month, ($day+1), $year);
00167                       $where .= ' AND '.$field." $operator= $time ";
00168                     }
00169                 }
00170 
00171       # Always exclude undefined dates (0)
00172               $where .= ' AND '.$field." <> 0 ";
00173 
00174             }
00175           elseif ((trackers_data_is_text_field($field) ||
00176                    trackers_data_is_text_area($field)) &&
00177                   $url_params[$field][0])
00178             {
00179       # Buffer summary and original submission (details) to handle them later
00180       # in case we have an OR to do between the two, instead of the usual
00181       # AND
00182               if ($sumORdet == 1 &&
00183                   ($field == 'summary' || $field == 'details'))
00184                 {
00185                   if ($field == 'summary')
00186                     { $summary_search = 1; }
00187                   if ($field == 'details')
00188                     { $details_search = 1; }
00189                 }
00190               else
00191                 {
00192           # It s a text field accept. Process INT or TEXT,VARCHAR fields differently
00193                   $where .= ' AND '.trackers_build_match_expression($field, $url_params[$field][0]);
00194                 }
00195             }
00196         }
00197 
00198 
00199       # Handle summary and/or original submission now, if a AND is required
00200       if ($sumORdet == 1)
00201         {
00202       # We will process the usual normal AND case: there was something for both
00203       # fields.
00204           if ($details_search == 1 && $summary_search == 1)
00205             {
00206               $where .= ' AND ';
00207               $where .= '( ( ';
00208               $where .= trackers_build_match_expression('details', $url_params['details'][0]);
00209               $where .= ' ) OR ( ';
00210               $where .= trackers_build_match_expression('summary', $url_params['summary'][0]);
00211               $where .= ') ) ';
00212             }
00213           else
00214             {
00215       # Now we take care of the unusual, possible though, case where and
00216       # AND was asked but not both fields set.
00217       # Since the AND was asked, the fields havent been taken care of before
00218       # and we need to do it now.
00219       # We do that in two IF, in case something went very wrong. In such case
00220       # we will proceed with a usual AND.
00221               if ($details_search == 1 && $url_params['details'][0])
00222                 {
00223                   $where .= ' AND ';
00224                   $where .= trackers_build_match_expression('details', $url_params['details'][0]);
00225                 }
00226               if ($summary_search == 1 && $url_params['summary'][0])
00227                 {
00228                   $where .= ' AND ';
00229                   $where .= trackers_build_match_expression('summary', $url_params['summary'][0]);
00230                 }
00231             }
00232         }
00233       #################### GRABBED FROM BROWSE
00234       $export_sql = "$select $from $where";
00235 
00236 
00237       ##
00238       # Find out the time arguments
00239       unset($timestamp, $requested_hour, $requested_day);
00240 
00241       # Use the time as it was while the form was printed to the user
00242       $current_time = sane_post("current_time");
00243 
00244       # Find out the relevant timestamp that will be used by the backend
00245       # to determine which job must be performed
00246       $mainchoice = sane_post("date_mainchoice");
00247 
00248       switch ($mainchoice)
00249         {
00250         case 'asap':
00251           # Basic case where the user wants the export to be done as soon
00252           # as possible: we provide current time as timestamp
00253           $timestamp = mktime();
00254           break;
00255         case 'next':
00256           # Case where the user provide a date for a one time export
00257           # In the form:
00258           #    0 = today
00259           #    1 = tomorrow
00260           #    etc...
00261           $current_day = strftime('%d', $current_time);
00262           $current_month = strftime('%m', $current_time);
00263           $day = ($current_day+sane_post("date_next_day"));
00264           $hour =  sane_post("date_next_hour");
00265           $timestamp = mktime($hour, 0, 0, $current_month, $day);
00266           break;
00267         case 'frequent':
00268           # Data export will be done on a weekly basis
00269           # We store the timestamp of the next time it is expect
00270           # and we save the request, so the backend now that he will have
00271           # to update the timestamp afterwards
00272           $current_day = strftime('%d', $current_time);
00273           $current_month = strftime('%m', $current_time);
00274           $hour =  sane_post("date_frequent_hour");
00275           $requested_hour = $hour;
00276           $requested_day = (sane_post("date_frequent_day")+1);
00277 
00278           for ($day = $current_day; $day <= ($current_day+8); $day++)
00279             {
00280               # Test the next 8 days and find out which one match with
00281               # the requested day
00282               $timestamp = mktime($hour, 0, 0, $current_month, $day);
00283               if (strftime('%u', $timestamp) == $requested_day)
00284                 { break; }
00285             }
00286 
00287 
00288         }
00289 
00290 
00291       ##
00292       # Insert the request into the database
00293 
00294       # First add an entry in trackers_export. Create the export with the
00295       # status invalid (I) so it wont be handled by the backend before
00296       # the next step is done on the frontend side
00297       $sql = "INSERT INTO trackers_export (task_id, artifact, unix_group_name , user_name, sql, status, date, frequency_day, frequency_hour) VALUES ('0', '".ARTIFACT."', '".$group_name."', '".user_getname()."', '".$export_sql."', 'I', '".$timestamp."', '".$requested_day."', '".$requested_hour."')";
00298       $result = db_query($sql);
00299       if (!$result)
00300         {
00301           exit_error(_("SQL insert error"));
00302         }
00303       $insert_id =  db_insertid($result);
00304 
00305 
00306       form_clean($form_id);
00307 
00308       # Second, create a task to make it easy for other project members
00309       # to follow the export and for the user to have the export in my items
00310       # as a task.
00311       # We could have imagined using a simple task to manage the whole
00312       # export stuff, but that would be probably overkill for now.
00313       # Maybe we wil reconsider this later.
00314       session_redirect($GLOBALS['sys_home']."task/export-createtask.php?group=".rawurlencode($group_name)."&export_id=$insert_id&from=".ARTIFACT);
00315 
00316     }
00317 
00318   # Delete item
00319   if (sane_get("delete"))
00320     {
00321       $export_id = sane_get("delete");
00322 
00323       # Obtain the relevant task number
00324       $task_id = db_result(db_query("SELECT task_id FROM trackers_export WHERE export_id='$export_id' LIMIT 1"), 0, 'task_id');
00325 
00326       # Delete the entry
00327       $result = db_query("DELETE FROM trackers_export WHERE export_id='$export_id' AND user_name='".user_getname()."' LIMIT 1");
00328       if (db_affected_rows($result))
00329         {
00330           fb(sprintf(_("Export job #%s successfully removed"), $export_id));
00331 
00332           session_redirect($GLOBALS['sys_home']."task/export-updatetask.php?group=".rawurlencode($group_name)."&export_id=$export_id&task_id=$task_id&from=".ARTIFACT);
00333 
00334         }
00335       else
00336         {
00337           fb(sprintf(_("Unable to remove export job #%s"), $export_id), 1);
00338         }
00339 
00340 
00341 
00342       # Update the list of current exports
00343       $sql = "SELECT * FROM trackers_export WHERE user_name='".user_getname()."' AND unix_group_name='".$group_name."' AND status<>'I' ORDER BY export_id ASC";
00344       $res_export = db_query($sql);
00345       $export_count = db_numrows($res_export);
00346 
00347 
00348 
00349     }
00350 
00351 
00352 }
00353 
00354 
00355 ########################################################################
00356 # Print XHTML page
00357 #
00358 # If we have an export_id : we edit the pending export
00359 # If we have no export_id :
00360 #                        - we provide the list of pending exports
00361 #                        - we provide the form to add a new pending export
00362 #                        if the maximum was of 10 queues was not reached
00363 
00364 
00365 unset($export_id); # Not implemented
00366 if ($export_id)
00367 {
00368   # Not implemented
00369 
00370 }
00371 else
00372 {
00373   # allow additional feedback
00374   if (sane_get("feedback"))
00375     {  $feedback = sane_get("feedback"); }
00376 
00377   trackers_header(array('title'=>_("Data Export Jobs")));
00378 
00379   print '<p>'._("From here, you can select criteria for an XML export of the items of your project of the current tracker. Then your request will be queued and made available on an HTTP accessible URL. This way you can automate exports, using scripts, as you know the file URL in advance.").'</p>';
00380 
00381 
00382   ##
00383   # List of pending exports
00384   print '<h3>'.html_anchor(_("Pending Export Jobs"), "pending").'</h3>';
00385 
00386   if ($export_count > 0)
00387     {
00388       print $HTML->box_top(_("Queued Jobs"));
00389 
00390       for ($i = 0; $i < $export_count; $i++)
00391         {
00392          if ($i > 0)
00393             { print $HTML->box_nextitem(utils_get_alt_row_color($i+1)); }
00394 
00395          print '<span class="trash">';
00396          print utils_link($PHP_SELF.'?update=1&amp;delete='.db_result($res_export, $i, 'export_id').'&amp;group='.$group_name,
00397                           '<img src="'.$GLOBALS['sys_home'].'images/'.SV_THEME.'.theme/trash.png" border="0" alt="'._("Remove this job").'" />');
00398          print '</span>';
00399 
00400          $status = _("Pending");
00401          if (db_result($res_export, $i, 'status') == 'D')
00402            { $status = _("Done"); }
00403 
00404          print utils_link($GLOBALS['sys_home'].'task/?func=detailitem&amp;item_id='.db_result($res_export, $i, 'task_id'),
00405                           # I18N
00406                           # The first two strings are export and task id;
00407                           # the last string is the status (pending, done)
00408                           sprintf(_("Job #%s, bound to task #%s, %s"),
00409                                   db_result($res_export, $i, 'export_id'),
00410                                   db_result($res_export, $i, 'task_id'),
00411                                   $status));
00412 
00413 
00414          $export_url = $GLOBALS['sys_https_url'].$GLOBALS['sys_home']."export/$group_name/".user_getname()."/".db_result($res_export, $i, 'export_id').".xml";
00415          print '<br />'.sprintf(_("URL: %s"), utils_link($export_url, $export_url));
00416 
00417          unset($type);
00418          switch (db_result($res_export, $i, 'artifact'))
00419            {
00420            case 'cookbook': $type = _("recipes"); break;
00421            case 'bugs': $type = _("bugs"); break;
00422            case 'task': $type = _("tasks"); break;
00423            case 'patch': $type = _("patches"); break;
00424            case 'support': $type = _("support requests"); break;
00425            }
00426 
00427          if (db_result($res_export, $i, 'frequency_day'))
00428            {
00429              # I18N
00430              # First string is the weekday, second the time of day
00431              # Example: "every Wednesday at 16:45 hours"
00432              $date = sprintf(_("every %s at %s hours"),
00433                              calendar_day_name(db_result($res_export, $i, 'frequency_day')),
00434                              db_result($res_export, $i, 'frequency_hour'));
00435            }
00436          else
00437            {
00438              $date = format_date('', db_result($res_export, $i, 'date'));
00439            }
00440 
00441          print '<br /><span class="smaller">'.
00442            # I18N
00443            # First string is the type of export (e.g. recipes, bugs, tasks, ...)
00444            # Second string is the date of the export
00445            # Example: Exporting recipes on Fri, 2 Dec 2005
00446            sprintf(_("Exporting %s on %s"),
00447                    $type,
00448                    $date).
00449            '</span>';
00450         }
00451 
00452       print $HTML->box_bottom();
00453 
00454       print '<p>'._("Note that xml files will be removed after 2 weeks or if you remove the job from this list.").'</p>';
00455     }
00456   else
00457     {
00458       print _("You have no export job pending.");
00459     }
00460 
00461   ##
00462   # Query to build an export
00463   print '<br />';
00464   print '<h3>'.html_anchor(_("Creating a new Export Job"), "new").'</h3>';
00465 
00466   if ($export_count < $max_export)
00467     {
00468       ##
00469       # Query Form selection
00470       $report_id = sane_all("report_id");
00471       if (!$report_id)
00472         { $report_id = 100; }
00473       trackers_report_init($group_id, $report_id);
00474 
00475       $multiple_selection = sane_all("advsrch");
00476       if ($multiple_selection)
00477         {
00478           $advsrch_1 = ' selected="selected"';
00479           # Use is_multiple to provide an array to the later display_field
00480           # functions that use that to determine if they need to display
00481           # simple or multiple select boxes
00482           $is_multiple = array();
00483         }
00484       else
00485         { $advsrch_0 = ' selected="selected"'; }
00486 
00487 
00488       $form .= sprintf(' '._("and %s selection."), '<select name="advsrch"><option value="0"'.$advsrch_0.'>'._("Simple").'</option><option value="1"'.$advsrch_1.'>'._("Multiple").'</option></select>');
00489 
00490 
00491       $res_report = trackers_data_get_reports($group_id,user_getid());
00492 
00493       print html_show_displayoptions(sprintf(_("Use the %s Query Form and %s selection for export criteria."),
00494                                              html_build_select_box($res_report,
00495                                                                    'report_id',
00496                                                                    $report_id,
00497                                                                    true,
00498                                                                    'Basic'),
00499                                              '<select name="advsrch"><option value="0"'.$advsrch_0.'>'._("Simple").'</option><option value="1"'.$advsrch_1.'>'._("Multiple").'</option></select>'),
00500                                      form_header($PHP_SELF.'#new', '').form_input("hidden", "group", $group_name),
00501                                      form_submit(_("Apply")));
00502 
00503       ##
00504       # Display criteria
00505       print form_header($PHP_SELF, '');
00506       print form_input("hidden", "group", $group_name);
00507       print form_input("hidden", "create", "1");
00508       $current_time = time();
00509       print form_input("hidden", "current_time", $current_time);
00510 
00511       print '<span class="preinput">'._("Export criteria:").'</span><br />';
00512 
00513       # FIXME: for some reasons, this does not show up on the cookbook
00514 
00515       #################### GRABBED FROM BROWSE
00516       # This should probably included in functions
00517       $ib=0;
00518       $is=0;
00519       $fields_per_line=5;
00520       $load_cal=false;
00521 
00522 # Check if summary and original submission are criteria
00523       $summary_search = 0;
00524       $details_search = 0;
00525 
00526       while ($field = trackers_list_all_fields(cmp_place_query))
00527         {
00528 # Skip unused field
00529           if (!trackers_data_is_used($field))
00530             { continue; }
00531 
00532 # Skip fields not part of this query form
00533           if (!trackers_data_is_showed_on_query($field))
00534             { continue; }
00535 
00536 # beginning of a new row
00537           if ($ib % $fields_per_line == 0)
00538             {
00539               $align = ($printer ? "left" : "center");
00540               $labels .= "\n".'<tr align="'.$align.'" valign="top">';
00541               $boxes .= "\n".'<tr align="'.$align.'" valign="top">';
00542             }
00543 
00544           $labels .= '<td>'.trackers_field_label_display($field,$group_id,false,false).'</td>';
00545           $boxes .= '<td><span class="smaller">';
00546 
00547           if (trackers_data_is_select_box($field))
00548             {
00549               unset($value);
00550               if (isset($is_multiple))
00551                 { $value = array(); }
00552 
00553               # For Open/Closed, automatically select Open
00554               if ($field == 'status_id')
00555                 {
00556                   if (isset($is_multiple))
00557                     { $value = array(1); }
00558                   else
00559                     { $value = 1; }
00560                 }
00561 
00562               $boxes .=
00563                 trackers_field_display($field,$group_id,$value,false,false,($printer?true:false),false,true,'None', true,'Any');
00564 
00565             }
00566           elseif (trackers_data_is_date_field($field))
00567             {
00568 
00569               if ($advsrch)
00570                 {
00571                   $boxes .= trackers_multiple_field_date($field,$is_multiple,
00572                                                          $url_params[$field.'_end'][0],0,0,$printer);
00573                 }
00574               else
00575                 {
00576                   $boxes .= trackers_field_date_operator($field,$is_multiple,$printer).
00577                     trackers_field_date($field,$url_params[$field][0],0,0,$printer);
00578                 }
00579 
00580             }
00581           elseif (trackers_data_is_text_field($field) ||trackers_data_is_text_area($field))
00582             {
00583               if ($field == 'summary')
00584                 { $summary_search = 1; }
00585               if ($field == 'details')
00586                 { $details_search = 1; }
00587 
00588               $boxes .=
00589                 ($printer ? $url_params[$field][0] : trackers_field_text($field,$url_params[$field][0],15,80)) ;
00590             }
00591 
00592           $boxes .= "</span></td>\n";
00593 
00594           $ib++;
00595 
00596 # end of this row
00597           if ($ib % $fields_per_line == 0)
00598             {
00599               $html_select .= $labels.'</tr>'.$boxes.'</tr>';
00600               $labels = $boxes = '';
00601             }
00602 
00603         }
00604 
00605 # Make sure the last few cells are in the table
00606       if ($labels)
00607         {
00608           $html_select .= $labels.'</tr>'.$boxes.'</tr>';
00609         }
00610 
00611       # [...]
00612       print '<table cellpadding="0" cellspacing="5">
00613         <tr><td colspan="'.$fields_per_line.'" nowrap="nowrap">';
00614       print $html_select;
00615       print '</table>';
00616 
00617       #################### GRABBED FROM BROWSE
00618 
00619 
00620       ##
00621       # Time selection
00622       print '<br />';
00623       print '<span class="preinput">'._("The export should be generated:").'</span><br />';
00624 
00625       # ASAP case
00626       print '&nbsp;&nbsp;&nbsp;'.form_input("radio", "date_mainchoice", "asap\" checked=\"checked").' '._("as soon as possible").'<br />';
00627 
00628       # Today at xHour
00629       # (this wont be ready for alternative calendars, but currently the
00630       # priority is to have this working)
00631       $timezone = strftime('%Z', $current_time);
00632       $current_hour = strftime('%H', $current_time);
00633       $current_day = strftime('%d', $current_time);
00634       $current_month = strftime('%m', $current_time);
00635 
00636       $valid_hours = array();
00637       for ($hour = 0; $hour <= 24; $hour++)
00638         { $valid_hours[] = $hour; }
00639 
00640       $valid_days = array();
00641       $valid_days = array(_("Today"), _("Tomorrow"));
00642       unset($count);
00643       for ($day = ($current_day+2); $count <= 31; $day++)
00644         {
00645           $count++;
00646           $day_time = mktime(0, 0, 0, $current_month, $day);
00647           # use format minimal because the hour is meaningless here
00648           $valid_days[] = format_date('minimal', $day_time);
00649         }
00650 
00651       $valid_hours = array();
00652       for ($hour = 0; $hour <= 23; $hour++)
00653         { $valid_hours[] = $hour; }
00654 
00655       print '&nbsp;&nbsp;&nbsp;'.form_input("radio", "date_mainchoice", "next").' '.
00656         # I18N
00657         # First %s: the day (e.g. today, tomorrow, Fri 2. Dec 2005, ...)
00658         # Second %s: the time (e.g. 16:37)
00659         # Third %s: the timezone (e.g. GMT)
00660         # Note that the GMT string may not be set, so dont put it beween 
00661         # parenthesis.
00662         sprintf(_("%s at %s hours %s"),
00663                 html_build_select_box_from_array($valid_days,
00664                                                  "date_next_day"),
00665                 html_build_select_box_from_array($valid_hours,
00666                                                  "date_next_hour",
00667                                                  ($current_hour+1)),
00668                 $timezone).'<br />';
00669 
00670 
00671       # Next/Every xDay at xHour
00672       # (this wont be ready for alternative calendars, but currently the
00673       # priority is to have this working)
00674       $valid_days = array();
00675       for ($day = 1; $day <= 7; $day++)
00676         { $valid_days[] = calendar_day_name($day); }
00677 
00678       print '&nbsp;&nbsp;&nbsp;'.form_input("radio", "date_mainchoice", "frequent").' '.
00679         # I18N
00680         # First string is the weekday, second the time of day,
00681         # third is the timezone
00682         # Example: "every Wednesday at 16:45 hours GMT"
00683         # Note that the GMT string may not be set, so dont put it beween 
00684         # parenthesis.
00685         sprintf(_("every %s at %s hours %s"),
00686                 html_build_select_box_from_array($valid_days,
00687                                                  "date_frequent_day"),
00688                 html_build_select_box_from_array($valid_hours,
00689                                                  "date_frequent_hour",
00690                                                  ($current_hour+1)),
00691                 $timezone
00692         ).'<br />';
00693 
00694 
00695       print '<p align="center">'.form_submit().'</p>';
00696     }
00697   else
00698     {
00699       print sprintf(ngettext("You have already registered %s export job for this project, which is the current limit. If more exports are required ask other project members.", "You have already registered %s export jobs for this project, which is the current limit. If more exports are required ask other project members.", $max_export), $max_export);
00700     }
00701 
00702   trackers_footer(array());
00703 }
00704 
00705 
00706 
00707 ?>

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