Beispiel #1
0
function get_organisation_list($current = "", $maxwidth = 50)
{
    global $session;
    $sql = "SELECT organisation.org_code, organisation.abbreviation || ' - ' || organisation.org_name FROM organisation ";
    if (!($session->AllowedTo("Admin") || $session->AllowedTo("Support"))) {
        $sql .= "JOIN org_system USING (org_code) ";
        $sql .= "JOIN work_system USING (system_id) ";
        $sql .= "JOIN system_usr ON (work_system.system_id = system_usr.system_id ";
        $sql .= "AND system_usr.user_no = {$session->user_no} ";
        $sql .= "AND system_usr.role = 'S') ";
    }
    $sql .= "WHERE organisation.active ORDER BY LOWER(org_name)";
    $q = new PgQuery($sql);
    $org_code_list = $q->BuildOptionList($current, 'GetOrgList');
    return $org_code_list;
}
Beispiel #2
0
    if (isset($choose_columns) && $choose_columns) {
        array_push($form_url_parameters, "choose_columns=1");
    }
    $form_url = "{$PHP_SELF}";
    for ($i = 0; $i < count($form_url_parameters) && $i < 20; $i++) {
        $form_url .= ($i == 0 ? '?' : '&') . $form_url_parameters[$i];
    }
    echo "<form name=\"search\" action=\"{$form_url}\" Method=\"POST\">";
    $systems = new PgQuery(SqlSelectSystems($org_code));
    $system_list = $systems->BuildOptionList($system_id, "requestlist");
    echo "<table border=0 cellspacing=2 cellpadding=0 align=center class=row0 width=100% style=\"border: 1px dashed #aaaaaa;\">\n<tr>\n";
    echo "<td width=100%><table border=0 cellspacing=0 cellpadding=0 width=100%><tr valign=middle>\n";
    echo "<td class=smb>&nbsp;System:</td><td class=\"sml\"><select class=\"sml\" name=system_id><option value=\".\">--- All Systems ---</option>{$system_list}</select></td>\n";
    if (is_member_of('Admin', 'Support', 'Contractor')) {
        $organisations = new PgQuery(SqlSelectOrganisations($org_code));
        $orglist = "<option value=\"\">--- All Organisations ---</option>\n" . $organisations->BuildOptionList("{$org_code}", "requestlist");
        echo "<td class=\"smb\">&nbsp;Organisation:</td><td class=\"sml\"><select class=\"sml\" name=\"org_code\">\n{$orglist}</select></td>\n";
    }
    echo "<td valign=middle class=smb align=center><input type=submit value=\"RUN\" alt=\"Run\" title=\"Run a query with these settings\" name=submit class=\"submit\">";
    echo "</tr></table></td></tr>\n";
    echo "</table></form>\n";
}
// if  not plain  or stripped style
/**
 * Now we build the statement that will find those requests...
 */
$query = "";
$maxresults = isset($maxresults) && intval($maxresults) > 0 ? intval($maxresults) : 100;
$flipped_columns = array_flip($columns);
$query .= "SELECT request.request_id, brief, usr.fullname, usr.email, request_on, status.lookup_desc AS status_desc, last_activity, detailed ";
$query .= ", request_type.lookup_desc AS request_type_desc, lower(usr.fullname) AS lfull, lower(brief) AS lbrief ";
Beispiel #3
0
 /**
  * Function to output a page header
  */
 function PageHeader($style = "normal")
 {
     global $c, $session, $tmnu;
     if (!$this->panel_top) {
         return;
     }
     echo '<div id="topbar">';
     echo $this->ImgLink('pwl-logo.png', '/', 252, 60);
     echo '</div>' . "\n";
     if ($session->logged_in) {
         echo '<div id="searchbar">';
         echo '<form action="/wrsearch.php" method="post" name="search">';
         echo '<span class="prompt" style="vertical-align: 0%;">Find:</span>';
         echo '<span class="entry"><input class="search_for" type="text" name="search_for" value="' . $GLOBALS['search_for'] . '"/></span>';
         $systems = new PgQuery(SqlSelectSystems($GLOBALS['org_code']));
         $system_list = $systems->BuildOptionList($GLOBALS['system_id'], 'Config::LocPgHdr');
         echo '<span class="prompt" style="vertical-align: 0%;">Systems:</span>';
         echo '<span class="entry"><select name="system_id" class="search_for"><option value="">-- select --</option>' . $system_list;
         echo '</select></span>';
         echo '<span class="entry""><input type="submit" alt="go" class="fsubmit" value="Search" /></span>';
         echo '</form>';
         echo '</div>' . "\n";
     }
     echo '<div id="top_menu">';
     if ($session->logged_in) {
         echo '<span style="float:right; margin-right:3px; margin-top:3px;">';
         echo $session->fullname;
         echo '</span>';
     }
     if (isset($tmnu) && is_object($tmnu) && $tmnu->Size() > 0) {
         echo $tmnu->Render();
     }
     echo '</div>' . "\n";
 }
Beispiel #4
0
    /**
     * Function to output a page header
     */
    function PageHeader($style = "normal")
    {
        global $c, $session, $tmnu;
        if (!$this->panel_top) {
            return;
        }
        $systems = new PgQuery(SqlSelectSystems($GLOBALS['org_code']));
        $system_list = $systems->BuildOptionList($GLOBALS['system_id'], 'PageHeader');
        echo <<<EOHDR
    <table border="0" cellspacing="0" cellpadding="0" style="height:86px;width:100%;background:url('/images/eduforge/eduforge_paua.jpg');">
      <tr>
       <td width="175" nowrap="nowrap" align="center">
        <a href="/"><img alt="logo" border="0" src="/images/eduforge/eduforge_logo.gif" width="145" height="62" /></a>
      </td>
       <td class="spaced-out">s u p p o r t <span class="spaced-out-grey">. e d u f o r g e . o r g</span></td>
EOHDR;
        if ($session->logged_in) {
            echo '<td valign="bottom" style="background: inherit;"><div id="searchbar" style="background: inherit;">';
            echo '<form action="/requestlist.php" method="post" name="search">';
            echo '<span class="prompt" style="vertical-align: 0%;">Find:</span>';
            echo '<span class="entry"><input class="search_for" type="text" name="search_for" value="' . $GLOBALS['search_for'] . '"/></span>';
            echo '<span class="prompt" style="vertical-align: 0%;">Systems:</span>';
            echo '<span class="entry"><select name="system_code" class="search_for"><option value="">-- select --</option>' . $system_list;
            echo '</select></span>';
            echo '<span class="entry""><input type="submit" alt="go" class="fsubmit" value="Search" /></span>';
            echo '</form>';
            echo '</div></td>' . "\n";
        }
        echo "</tr>\n</table>\n";
        echo '<div id="top_menu">';
        if ($session->logged_in) {
            echo '<span style="float:right; margin-right:3px; margin-top:3px;">';
            echo $session->fullname;
            echo '</span>';
        }
        if (isset($tmnu) && is_object($tmnu) && $tmnu->Size() > 0) {
            echo $tmnu->Render();
        }
        echo '</div>' . "\n";
    }
Beispiel #5
0
function local_page_header()
{
    global $system_name, $sysabbr, $session, $images, $tmnu;
    echo '<div id="topbar"><a href="/"><img src="' . $images . '/logo_main.gif" width="383" height="77" border="0"></a></div>' . "\n";
    if ($session->logged_in) {
        echo '<div id="searchbar">';
        echo '<form action="/wrsearch.php" method="post" name="search">';
        echo '<span class="prompt" style="vertical-align: 0%;">Find:</span>';
        echo '<span class="entry"><input class="search_for" type="text" name="search_for" value="' . $GLOBALS['search_for'] . '"/></span>';
        $systems = new PgQuery(SqlSelectSystems($GLOBALS['org_code']));
        $system_list = $systems->BuildOptionList($GLOBALS['system_id'], 'Config::LocPgHdr');
        echo '<span class="prompt" style="vertical-align: 0%;">Systems:</span>';
        echo '<span class="entry"><select name="system_id" class="search_for"><option value="">-- select --</option>' . $system_list;
        echo '</select></span>';
        echo '<span class="entry""><input type="submit" alt="go" class="fsubmit" value="Search" /></span>';
        echo '</form>';
        echo '</div>' . "\n";
    }
    echo '<div id="top_menu">';
    if ($session->logged_in) {
        echo '<span style="float:right; margin-right:3px; margin-top:3px;">';
        echo $session->fullname;
        echo '</span>';
    }
    if (isset($tmnu) && is_object($tmnu) && $tmnu->Size() > 0) {
        echo $tmnu->Render();
    }
    echo '</div>' . "\n";
}
Beispiel #6
0
 /**
  * Render an EntryField into HTML
  * @see EntryField::EntryField(), EntryForm::DataEntryLine()
  *
  * @return text  An HTML fragment for the data-entry field.
  */
 function Render()
 {
     global $session;
     $r = "<";
     switch ($this->ftype) {
         case "select":
             $r .= "select name=\"{$this->fname}\"%%attributes%%>";
             reset($this->attributes);
             while (list($k, $v) = each($this->attributes)) {
                 if (substr($k, 0, 1) != '_') {
                     continue;
                 }
                 if ($k == '_help') {
                     continue;
                 }
                 $k = substr($k, 1);
                 $r .= "<option value=\"" . htmlentities($k) . "\"";
                 if ("{$this->current}" == "{$k}") {
                     $r .= " selected";
                 }
                 $r .= ">{$v}</option>";
             }
             $r .= "</select>";
             break;
         case "lookup":
             $r .= "select name=\"{$this->fname}\"%%attributes%%>";
             reset($this->attributes);
             while (list($k, $v) = each($this->attributes)) {
                 if (substr($k, 0, 1) != '_') {
                     continue;
                 }
                 $k = substr($k, 1);
                 if ($k == 'help' || $k == "sql" || $k == "type") {
                     continue;
                 }
                 if ($k == "null") {
                     $k = "";
                 }
                 if ($k == "zero") {
                     $k = "0";
                 }
                 $r .= "<option value=\"" . htmlentities($k) . "\"";
                 if ("{$this->current}" == "{$k}") {
                     $r .= " selected";
                 }
                 $r .= ">{$v}</option>";
             }
             if (isset($this->attributes["_sql"])) {
                 $qry = new PgQuery($this->attributes["_sql"]);
             } else {
                 list($tbl, $fld) = explode("|", $this->attributes['_type'], 2);
                 $qry = new PgQuery("SELECT lookup_code, lookup_desc FROM lookup_code WHERE source_table = ? AND source_field = ? ORDER BY lookup_seq, lookup_code", $tbl, $fld);
             }
             $r .= $qry->BuildOptionList($this->current, "rndr:{$this->fname}");
             $r .= "</select>";
             break;
         case "date":
         case "timestamp":
             if (!isset($this->attributes['size']) || $this->attributes['size'] == "") {
                 $size = " size=" . ($this->ftype == 'date' ? "12" : "18");
             }
             $r .= "input type=\"text\" name=\"{$this->fname}\"{$size} value=\"" . $session->FormattedDate(htmlentities($this->current)) . "\"%%attributes%%>";
             break;
         case "checkbox":
             // We send a hidden field with a false value, which will be overridden by the real
             // field with a true value (if true) or not overridden (if false).
             $r .= "input type=\"hidden\" name=\"{$this->fname}\" value=\"off\"><";
         case "radio":
             $checked = "";
             if ($this->current == 't' || intval($this->current) == 1 || $this->current == 'on' || isset($this->attributes['value']) && $this->current == $this->attributes['value']) {
                 $checked = " checked";
             }
             $id = "id_{$this->fname}" . ($this->ftype == "radio" ? "_" . $this->attributes['value'] : "");
             if (isset($this->attributes['_label'])) {
                 $r .= "label for=\"{$id}\"";
                 if (isset($this->attributes['class'])) {
                     $r .= ' class="' . $this->attributes['class'] . '"';
                 }
                 $r .= "><";
             }
             $r .= "input type=\"{$this->ftype}\" name=\"{$this->fname}\" id=\"{$id}\"{$checked}%%attributes%%>";
             if (isset($this->attributes['_label'])) {
                 $r .= " " . $this->attributes['_label'];
                 $r .= "</label>";
             }
             break;
         case "button":
             $r .= "input type=\"button\" name=\"{$this->fname}\"%%attributes%%>";
             break;
         case "submit":
             $r .= "input type=\"submit\" name=\"{$this->fname}\" value=\"" . htmlentities($this->current) . "\"%%attributes%%>";
             break;
         case "textarea":
             $r .= "textarea name=\"{$this->fname}\"%%attributes%%>{$this->current}</textarea>";
             break;
         case "file":
             if (!isset($this->attributes['size']) || $this->attributes['size'] == "") {
                 $size = " size=25";
             }
             $r .= "input type=\"file\" name=\"{$this->fname}\"{$size} value=\"" . htmlentities($this->current) . "\"%%attributes%%>";
             break;
         case "password":
             $r .= "input type=\"password\" name=\"{$this->fname}\" value=\"" . htmlentities($this->current) . "\"%%attributes%%>";
             break;
         default:
             $r .= "input type=\"text\" name=\"{$this->fname}\" value=\"" . htmlentities($this->current) . "\"%%attributes%%>";
             break;
     }
     // Now process the generic attributes
     reset($this->attributes);
     $attribute_values = "";
     while (list($k, $v) = each($this->attributes)) {
         if ($k == '_readonly') {
             $attribute_values .= " readonly";
         } else {
             if ($k == '_disabled') {
                 $attribute_values .= " disabled";
             }
         }
         if (substr($k, 0, 1) == '_') {
             continue;
         }
         $attribute_values .= " {$k}=\"" . htmlentities($v) . "\"";
     }
     $r = str_replace('%%attributes%%', $attribute_values, $r);
     $this->rendered = $r;
     return $r;
 }