<page title="Supporter -- Jobs">
<?
- $limit = '';
+ $dbh = pg_pconnect ("<dbconnstring>")
+ or die("Unable to connect to SQL server");
+
+ pg_exec ($dbh, "SET DateStyle = 'ISO'") or die("Datenbank-Abfrage!");
+
+ $limit_days = '';
+ $count = 0;
reset ($ltdays);
while (list($key,$day) = each ($ltdays)) {
if ($GLOBALS["day_".$key] == 1) {
+ $count++;
$foo = explode (",", $day);
- if (strlen ($limit) == 0) {
- $limit = $foo[0];
+ if (strlen ($limit_days) == 0) {
+ $limit_days = $foo[0];
} else {
- $limit .= ", " . $foo[0];
+ $limit_days .= ", " . $foo[0];
}
}
}
+ # Limitation to all days is no limitation
+ if ($count == count($ltdays)) {
+ $limit_days = '';
+ }
- if (strlen ($limit) > 0) {
- printf ("<p><b>Output limited to</b>: %s</p>", $limit);
+ $limit_sections = '';
+ $where_sections = '';
+ $count = 0;
+ $query = "SELECT DISTINCT section FROM job WHERE section <> '' ORDER BY section";
+ $sth = pg_exec ($dbh, $query) or die ("Datenbank-Abfrage!");
+
+ for ($nr = 0; $nr < pg_NumRows($sth); $nr++)
+ {
+ $row = pg_fetch_array($sth, $nr);
+
+ if ($GLOBALS["section_".$row['section']] == 1) {
+ $count++;
+ if (strlen ($limit_sections) == 0) {
+ $limit_sections = $row['section'];
+ $where_sections = sprintf ("( section = '%s' ", $row['section']);
+ } else {
+ $limit_sections .= ", " . $row['section'];
+ $where_sections .= sprintf ("OR section = '%s' ", $row['section']);
+ }
+ }
+ }
+ # Limitation to all sections is no limitation
+ if ($count == pg_NumRows($sth)) {
+ $limit_sections = '';
+ $where_sections = '';
+ } else {
+ if (strlen ($where_sections) > 0) {
+ $where_sections .= ") ";
+ }
+ }
+
+ if (strlen ($limit_days) > 0 || strlen ($limit_sections) > 0) {
+ printf ("<p><b>Output limited.</b> <a href=\"jobs.php3\">unlimited list</a>");
+
+ if (strlen ($limit_days) > 0) {
+ printf ("<br> Days: %s", $limit_days);
+ }
+ if (strlen ($limit_sections) > 0) {
+ printf ("<br> Sections: %s", $limit_sections);
+ }
+ echo ("</p>\n");
}
?>
}
echo ($f_header_tail);
- $dbh = pg_pconnect ("<dbconnstring>")
- or die("Unable to connect to SQL server");
-
- pg_exec ($dbh, "SET DateStyle = 'ISO'") or die("Datenbank-Abfrage!");
-
- $query = "SELECT id,title FROM job ORDER BY upper(title)";
+ $query = "SELECT id,title FROM job ";
+ if (strlen ($where_sections) > 0) {
+ $query .= "WHERE " . $where_sections;
+ }
+ $query .= "ORDER BY upper(title)";
$sth = pg_exec ($dbh, $query) or die ("Datenbank-Abfrage!");
$job = array ();
<p>
<b>Limit Output</b>. You can limit the output to certain days and
people working on certain tasks.</p>
-<p>Warning: Limiting to sections is not yet implemented.</p>
<form method=get action=jobs.php3>
<input type=hidden name=limitation value=1>
<?
}
}
-?>
-<row_checkbox name="section_<? echo $nr; ?>"
- title="<b>Sections</b>"
- descr="Any section"
- value="any"
- checked="checked"
- >
+ $first = true;
-<?
$query = "SELECT DISTINCT section FROM job WHERE section <> '' ORDER BY section";
$sth = pg_exec ($dbh, $query) or die ("Datenbank-Abfrage!");
for ($nr = 0; $nr < pg_NumRows($sth); $nr++)
{
$row = pg_fetch_array($sth, $nr);
+
+ if ($first) {
+ $first = false;
?>
-<row_checkbox name="section_<? echo $nr; ?>"
+<row_checkbox name="section_<? echo $row['section']; ?>"
+ title="<b>Sections</b>"
+ descr="<? echo $row['section']; ?>"
+ checked="<? echo (!isset ($limitation) || $GLOBALS["section_".$row['section']] == 1)?"checked":''; ?>"
+ >
+<? } else { ?>
+<row_checkbox name="section_<? echo $row['section']; ?>"
title=" "
descr="<? echo $row['section']; ?>"
- value="<? echo $row['section']; ?>"
- checked=""
+ checked="<? echo (!isset ($limitation) || $GLOBALS["section_".$row['section']] == 1)?"checked":''; ?>"
>
<?
- printf ("<input type=\"hidden\" name=\"maxsection\" value=\"%d\">", $nr);
+ }
}
?>
<page title="Supporter -- Open Jobs">
<?
- $limit = '';
+ $dbh = pg_pconnect ("<dbconnstring>")
+ or die("Unable to connect to SQL server");
+
+ pg_exec ($dbh, "SET DateStyle = 'ISO'") or die("Datenbank-Abfrage!");
+
+ $limit_days = '';
+ $count = 0;
reset ($ltdays);
while (list($key,$day) = each ($ltdays)) {
if ($GLOBALS["day_".$key] == 1) {
+ $count++;
$foo = explode (",", $day);
- if (strlen ($limit) == 0) {
- $limit = $foo[0];
+ if (strlen ($limit_days) == 0) {
+ $limit_days = $foo[0];
} else {
- $limit .= ", " . $foo[0];
+ $limit_days .= ", " . $foo[0];
}
}
}
+ # Limitation to all days is no limitation
+ if ($count == count($ltdays)) {
+ $limit_days = '';
+ }
- if (strlen ($limit) > 0) {
- printf ("<p><b>Output limited to</b>: %s</p>", $limit);
+ $limit_sections = '';
+ $where_sections = '';
+ $count = 0;
+ $query = "SELECT DISTINCT section FROM job WHERE section <> '' ORDER BY section";
+ $sth = pg_exec ($dbh, $query) or die ("Datenbank-Abfrage!");
+
+ for ($nr = 0; $nr < pg_NumRows($sth); $nr++)
+ {
+ $row = pg_fetch_array($sth, $nr);
+
+ if ($GLOBALS["section_".$row['section']] == 1) {
+ $count++;
+ if (strlen ($limit_sections) == 0) {
+ $limit_sections = $row['section'];
+ $where_sections = sprintf ("( section = '%s' ", $row['section']);
+ } else {
+ $limit_sections .= ", " . $row['section'];
+ $where_sections .= sprintf ("OR section = '%s' ", $row['section']);
+ }
+ }
+ }
+ # Limitation to all sections is no limitation
+ if ($count == pg_NumRows($sth)) {
+ $limit_sections = '';
+ $where_sections = '';
+ } else {
+ if (strlen ($where_sections) > 0) {
+ $where_sections .= ") ";
+ }
+ }
+
+ if (strlen ($limit_days) > 0 || strlen ($limit_sections) > 0) {
+ printf ("<p><b>Output limited.</b> <a href=\"jobs.php3\">unlimited list</a>");
+
+ if (strlen ($limit_days) > 0) {
+ printf ("<br> Days: %s", $limit_days);
+ }
+ if (strlen ($limit_sections) > 0) {
+ printf ("<br> Sections: %s", $limit_sections);
+ }
+ echo ("</p>\n");
}
?>
}
echo ($f_header_tail);
- $dbh = pg_pconnect ("<dbconnstring>")
- or die("Unable to connect to SQL server");
-
- pg_exec ($dbh, "SET DateStyle = 'ISO'") or die("Datenbank-Abfrage!");
-
$query = "SELECT job.id,title,starttime,endtime,fragment.id as fragment FROM job,fragment "
- ."WHERE job.id = fragment.job ORDER BY title,starttime";
+ ."WHERE job.id = fragment.job ";
+ if (strlen ($where_sections) > 0) {
+ $query .= "AND " . $where_sections;
+ }
+ $query .= "ORDER BY title,starttime";
$sth = pg_exec ($dbh, $query) or die ("Datenbank-Abfrage!");
<p>
<b>Limit Output</b>. You can limit the output to certain days and
people working on certain tasks.</p>
-<p>Warning: Limiting to sections is not yet implemented.</p>
<form method=get action=open.php3>
<input type=hidden name=limitation value=1>
<?
}
}
-?>
-<row_checkbox name="section_<? echo $nr; ?>"
- title="<b>Sections</b>"
- descr="Any section"
- value="any"
- checked="checked"
- >
+ $first = true;
-<?
$query = "SELECT DISTINCT section FROM job WHERE section <> '' ORDER BY section";
$sth = pg_exec ($dbh, $query) or die ("Datenbank-Abfrage!");
for ($nr = 0; $nr < pg_NumRows($sth); $nr++)
{
$row = pg_fetch_array($sth, $nr);
+
+ if ($first) {
+ $first = false;
?>
-<row_checkbox name="section_<? echo $nr; ?>"
+<row_checkbox name="section_<? echo $row['section']; ?>"
+ title="<b>Sections</b>"
+ descr="<? echo $row['section']; ?>"
+ checked="<? echo (!isset ($limitation) || $GLOBALS["section_".$row['section']] == 1)?"checked":''; ?>"
+ >
+<? } else { ?>
+<row_checkbox name="section_<? echo $row['section']; ?>"
title=" "
descr="<? echo $row['section']; ?>"
- value="<? echo $row['section']; ?>"
- checked=""
+ checked="<? echo (!isset ($limitation) || $GLOBALS["section_".$row['section']] == 1)?"checked":''; ?>"
>
<?
- printf ("<input type=\"hidden\" name=\"maxsection\" value=\"%d\">", $nr);
+ }
}
?>