Exemplo n.º 1
0
function portal_incident_table($sql)
{
    global $CONFIG, $showclosed;
    $result = mysql_query($sql);
    if (mysql_error()) {
        trigger_error(mysql_error(), E_USER_WARNING);
    }
    $numincidents = mysql_num_rows($result);
    if ($numincidents >= 1) {
        $shade = 'shade1';
        $html .= "<table align='center' width='70%'>";
        $html .= "<tr>";
        $html .= colheader('id', $GLOBALS['strID']);
        $html .= colheader('title', $GLOBALS['strTitle']);
        $html .= colheader('owner', $GLOBALS['strOwner']);
        $html .= colheader('lastupdated', $GLOBALS['strLastUpdated']);
        $html .= colheader('contact', $GLOBALS['strContact']);
        $html .= colheader('status', $GLOBALS['strStatus']);
        if ($showclosed != "true") {
            $html .= colheader('actions', $GLOBALS['strOperation']);
        }
        $html .= "</tr>\n";
        while ($incident = mysql_fetch_object($result)) {
            $html .= "<tr class='{$shade}'><td align='center'>";
            $html .= "<a href='incident.php?id={$incident->id}'>{$incident->id}</a></td>";
            $html .= "<td>";
            if (!empty($incident->softwareid)) {
                $html .= software_name($incident->softwareid) . "<br />";
            }
            $html .= "<strong><a href='incident.php?id={$incident->id}'>{$incident->title}</a></strong></td>";
            $html .= "<td align='center'>" . user_realname($incident->owner) . "</td>";
            $html .= "<td align='center'>" . ldate($CONFIG['dateformat_datetime'], $incident->lastupdated) . "</td>";
            $html .= "<td align='center'><a href='contactdetails.php?id={$incident->contactid}'>";
            $html .= "{$incident->forenames} {$incident->surname}</a></td>";
            $html .= "<td align='center'>" . incidentstatus_name($incident->status, external) . "</td>";
            if ($showclosed != "true") {
                $html .= "<td align='center'><a href='update.php?id={$incident->id}'>{$GLOBALS['strUpdate']}</a> | ";
                //check if the customer has requested a closure
                $lastupdate = list($update_userid, $update_type, $update_currentowner, $update_currentstatus, $update_body, $update_timestamp, $update_nextaction, $update_id) = incident_lastupdate($incident->id);
                if ($lastupdate[1] == "customerclosurerequest") {
                    $html .= "{$GLOBALS['strClosureRequested']}</td>";
                } else {
                    $html .= "<a href='close.php?id={$incident->id}'>{$GLOBALS['strRequestClosure']}</a></td>";
                }
            }
            $html .= "</tr>";
            if ($shade == 'shade1') {
                $shade = 'shade2';
            } else {
                $shade = 'shade1';
            }
        }
        $html .= "</table>";
    } else {
        $html .= "<p class='info'>{$GLOBALS['strNoIncidents']}</p>";
    }
    return $html;
}
function dashboard_incoming_display($dashletid)
{
    global $sit, $CONFIG, $iconset;
    global $dbUpdates, $dbTempIncoming;
    // extract updates (query copied from review_incoming_email.php)
    $sql = "SELECT u.id AS id, u.bodytext AS bodytext, ti.emailfrom AS emailfrom, ti.subject AS subject, ";
    $sql .= "u.timestamp AS timestamp, ti.incidentid AS incidentid, ti.id AS tempid, ti.locked AS locked, ";
    $sql .= "ti.reason AS reason, ti.contactid AS contactid, ti.`from` AS fromaddr ";
    $sql .= "FROM `{$dbUpdates}` AS u, `{$dbTempIncoming}` AS ti ";
    $sql .= "WHERE u.incidentid = 0 AND ti.updateid = u.id ";
    $sql .= "ORDER BY timestamp ASC, id ASC";
    $result = mysql_query($sql);
    if (mysql_error()) {
        trigger_error(mysql_error(), E_USER_WARNING);
    }
    if (user_permission($sit[2], 42)) {
        //echo "<div class='window'>";
        if (mysql_num_rows($result) >= 1) {
            echo "<table align='center' width='100%'>";
            echo "<tr>";
            #        echo colheader('from', $GLOBALS['strFrom']);
            echo colheader('subject', $GLOBALS['strSubject']);
            echo colheader('message', $GLOBALS['strMessage']);
            echo "</tr>\n";
            $shade = 'shade1';
            while ($incoming = mysql_fetch_object($result)) {
                $date = mysql2date($incoming->date);
                echo "<tr class='{$shade}'>";
                #            echo "<td><a href='holding_queue.php' class='info'>".truncate_string($incoming->emailfrom, 15);
                #            echo "</a></td>";
                echo "<td><a href='holding_queue.php' class='info'>" . truncate_string($incoming->subject, 25);
                echo "</a></td>";
                echo "<td><a href='holding_queue.php' class='info'>" . truncate_string($incoming->reason, 25);
                echo "</a></td>";
                echo "</tr>\n";
                if ($shade == 'shade1') {
                    $shade = 'shade2';
                } else {
                    $shade = 'shade1';
                }
            }
            echo "</table>\n";
        } else {
            echo "<p align='center'>{$GLOBALS['strNoRecords']}</p>";
        }
    } else {
        echo "<p class='error'>{$GLOBALS['strPermissionDenied']}</p>";
    }
}
Exemplo n.º 3
0
     echo colheader('startdate', $strStartDate, $sort, $order, $filter);
     echo colheader('duedate', $strDueDate, $sort, $order, $filter);
     if ($show == 'completed') {
         echo colheader('enddate', $strEndDate, $sort, $order, $filter);
     }
     if ($show == 'incidents') {
         echo colheader('owner', $strOwner, $sort, $order, $filter);
     }
 } else {
     echo colheader('id', $strID);
     echo colheader('startdate', $strStartDate);
     echo colheader('completeddate', $strCompleted);
     echo colheader('duration', $strDuration);
     echo colheader('lastupdated', $strLastUpdated);
     echo colheader('owner', $strOwner);
     echo colheader('action', $strAction);
 }
 echo "</tr>\n";
 $shade = 'shade1';
 while ($task = mysql_fetch_object($result)) {
     $duedate = mysql2date($task->duedate);
     $startdate = mysql2date($task->startdate);
     $enddate = mysql2date($task->enddate);
     $lastupdated = mysql2date($task->lastupdated);
     echo "<tr class='{$shade}'>";
     if ($mode != 'incident' and $show != 'incidents') {
         echo "<td align='center'><input type='checkbox' name='selected[]' ";
         echo "value='{$task->id}' /></td>";
     } else {
         if (empty($incidentid)) {
             $sqlIncident = "SELECT DISTINCT origcolref, linkcolref, incidents.title ";
Exemplo n.º 4
0
if (strtolower($mode) == 'today') {
    $sql .= " WHERE published > '" . date('Y-m-d') . "' ORDER BY published DESC";
}
$result = mysql_query($sql);
if (mysql_error()) {
    trigger_error("MySQL Query Error " . mysql_error(), E_USER_WARNING);
}
if (mysql_num_rows($result) >= 1) {
    echo "<p align='center'><strong>{$strResults}</strong> :</p>";
    echo "<table align='center' width='98%'>";
    echo "<tr>";
    echo colheader('id', $strID, FALSE);
    echo colheader('title', $strTitle, FALSE);
    echo colheader('date', $strDate, FALSE);
    echo colheader('author', $strAuthor, FALSE);
    echo colheader('keywords', $strKeywords, FALSE);
    echo "</tr>\n";
    $shade = 'shade1';
    while ($kbarticle = mysql_fetch_object($result)) {
        if (empty($kbarticle->title)) {
            $kbarticle->title = $strUntitled;
        } else {
            $kbarticle->title = $kbarticle->title;
        }
        if (is_number($kbarticle->author)) {
            $kbarticle->author = user_realname($kbarticle->author);
        } else {
            $kbarticle->author = $kbarticle->author;
        }
        echo "<tr class='{$shade}'>";
        echo "<td>" . icon('kb', 16) . " {$CONFIG['kb_id_prefix']}" . leading_zero(4, $kbarticle->docid) . "</td>";
Exemplo n.º 5
0
     URL = "contact_details.php?contactid=" + contactid;
     window.open(URL, "contact_details_window", "toolbar=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=450,height=240");
 }
 //]]>
 </script>
 <?php 
 echo "<p align='center'>" . sprintf($strResultsNum, mysql_num_rows($result)) . "</p>\n";
 echo "<table align='center' style='width: 95%;'>";
 echo "<tr>";
 $filter = array('search_string' => $search_string, 'productid' => $productid, 'resellerid' => $resellerid);
 echo colheader('id', $strID, $sort, $order, $filter);
 echo colheader('product', $strProduct, $sort, $order, $filter);
 echo colheader('site', $strSite, $sort, $order, $filter);
 echo colheader('reseller', $strReseller, $sort, $order . $filter);
 echo "<th>{$strLicense}</th>";
 echo colheader('expiry', $strExpiryDate, $sort, $order, $filter);
 echo "<th width='200'>{$strNotes}</th>";
 echo "<th>{$strActions}</th>";
 echo "</tr>\n";
 $shade = 'shade1';
 while ($results = mysql_fetch_array($result)) {
     // define class for table row shading
     if (($results['expirydate'] < $now and $results['expirydate'] != '-1') || ($results['term'] == 'yes' and $results['productonly'] == 'no')) {
         $shade = 'expired';
     } elseif ($results['productonly'] == 'yes') {
         $shade = 'notice';
     } else {
         // invert shade
         if ($shade == 'shade1') {
             $shade = 'shade2';
         } else {
Exemplo n.º 6
0
} else {
    $sql .= "ORDER BY realname ASC ";
}
$result = mysql_query($sql);
if (mysql_error()) {
    trigger_error("MySQL Query Error " . mysql_error(), E_USER_WARNING);
}
echo "<table align='center' style='width: 95%;'>";
echo "<tr>";
$filter = array('gid' => $filtergroup);
echo colheader('realname', $strName, $sort, $order, $filter);
echo "<th colspan='5'>{$strIncidentsinQueue}</th>";
echo colheader('phone', $strTelephone, $sort, $order, $filter);
echo colheader('mobile', $strMobile, $sort, $order, $filter);
echo colheader('status', $strStatus, $sort, $order, $filter);
echo colheader('accepting', $strAccepting, $sort, $order, $filter);
echo "<th>{$strJumpTo}</th>";
echo "</tr><tr>";
echo "<th></th>";
echo "<th align='center'>{$strActionNeeded} / {$strWaiting}</th>";
echo "<th align='center'>" . priority_icon(4) . "</th>";
echo "<th align='center'>" . priority_icon(3) . "</th>";
echo "<th align='center'>" . priority_icon(2) . "</th>";
echo "<th align='center'>" . priority_icon(1) . "</th>";
echo "<th colspan='8'></th>";
echo "</tr>\n";
// show results
$shade = 0;
while ($users = mysql_fetch_object($result)) {
    // define class for table row shading
    if ($shade) {
Exemplo n.º 7
0
 }
 $result = mysql_query($sql);
 if (mysql_error()) {
     trigger_error("MySQL Query Error " . mysql_error(), E_USER_WARNING);
 }
 $countresults = mysql_num_rows($result);
 if ($countresults > 0) {
     echo "<form action='{$_SERVER['PHP_SELF']}' id='inboxform' name='inbox'  method='post'>";
     $shade = 'shade1';
     echo "<table align='center' style='width: 95%'>";
     echo "<tr>";
     echo colheader('select', '', FALSE, '', '', '', '1%');
     echo colheader('from', $strFrom, $sort, $order, $filter, '', '25%');
     echo colheader('subject', $strSubject, $sort, $order, $filter);
     echo colheader('date', $strDate, $sort, $order, $filter, '', '15%');
     echo colheader('size', $strSize);
     echo "</tr>";
     while ($incoming = mysql_fetch_object($result)) {
         $num_attachments = 0;
         if (!empty($incoming->updateid)) {
             $usql = "SELECT * FROM `{$dbUpdates}` WHERE id = '{$incoming->updateid}' LIMIT 1";
             $uresult = mysql_query($usql);
             if (mysql_error()) {
                 trigger_error("MySQL Query Error " . mysql_error(), E_USER_WARNING);
             }
             $update = mysql_fetch_object($uresult);
             $asql = "SELECT COUNT(*) FROM `{$dbLinks}` WHERE linktype = 5 AND direction = 'left' AND origcolref = {$incoming->updateid}";
             $aresult = mysql_query($asql);
             if (mysql_error()) {
                 trigger_error("MySQL Query Error " . mysql_error(), E_USER_WARNING);
             }
Exemplo n.º 8
0
require '..' . DIRECTORY_SEPARATOR . 'core.php';
require APPLICATION_LIBPATH . 'functions.inc.php';
$accesslevel = 'any';
include APPLICATION_LIBPATH . 'portalauth.inc.php';
include APPLICATION_INCPATH . 'portalheader.inc.php';
echo "<h2>" . icon('support', 32, $strYourSupportEntitlement);
echo " {$strYourSupportEntitlement}</h2>";
if (sizeof($_SESSION['entitlement']) >= 1) {
    echo "<table align='center'>";
    echo "<tr>";
    echo colheader('id', $strContractID);
    echo colheader('name', $strProduct);
    echo colheader('availableincidents', $strIncidentsAvailable);
    echo colheader('usedincidents', $strIncidentsUsed);
    echo colheader('expirydate', $strExpiryDate);
    echo colheader('actions', $strOperation);
    echo "</tr>";
    $shade = 'shade1';
    foreach ($_SESSION['entitlement'] as $contract) {
        $contract = unserialize($contract);
        echo "<tr class='{$shade}'>";
        echo "<td>";
        // Only show link to contract details if the contract belongs to our site
        // Since we can be supported by contracts that aren't our site
        if ($contract->site == $_SESSION['siteid']) {
            echo "<a href='contracts.php?id={$contract->id}'>{$contract->id}</a>";
        } else {
            echo $contract->id;
        }
        echo "</td>";
        echo "<td>{$contract->name}</td>";
Exemplo n.º 9
0
function dashboard_tasks($dashletid)
{
    global $sit, $CONFIG, $iconset, $dbTasks;
    $user = $sit[2];
    if ($CONFIG['tasks_enabled'] == TRUE) {
        $sql = "SELECT * FROM `{$dbTasks}` WHERE owner='{$user}' AND (completion < 100 OR completion='' OR completion IS NULL) AND ";
        $sql .= "(distribution = 'public' OR distribution = 'private') ";
        if (!empty($sort)) {
            if ($sort == 'id') {
                $sql .= "ORDER BY id ";
            } elseif ($sort == 'name') {
                $sql .= "ORDER BY name ";
            } elseif ($sort == 'priority') {
                $sql .= "ORDER BY priority ";
            } elseif ($sort == 'completion') {
                $sql .= "ORDER BY completion ";
            } elseif ($sort == 'startdate') {
                $sql .= "ORDER BY startdate ";
            } elseif ($sort == 'duedate') {
                $sql .= "ORDER BY duedate ";
            } elseif ($sort == 'distribution') {
                $sql .= "ORDER BY distribution ";
            } else {
                $sql = "ORDER BY id ";
            }
            if ($order == 'a' or $order == 'ASC' or $order = '') {
                $sql .= "ASC";
            } else {
                $sql .= "DESC";
            }
        } else {
            $sql .= "ORDER BY IF(duedate,duedate,99999999) ASC, duedate ASC, startdate DESC, priority DESC, completion ASC";
        }
        $result = mysql_query($sql);
        if (mysql_error()) {
            trigger_error(mysql_error(), E_USER_WARNING);
        }
        if (mysql_num_rows($result) >= 1) {
            $content .= "<table align='center' width='100%'>";
            $content .= "<tr>";
            $content .= colheader('id', $GLOBALS['strID']);
            $content .= colheader('name', $GLOBALS['strTask']);
            $content .= colheader('priority', $GLOBALS['strPriority']);
            $content .= colheader('completion', $GLOBALS['strCompletion']);
            $content .= "</tr>\n";
            $shade = 'shade1';
            while ($task = mysql_fetch_object($result)) {
                $duedate = mysql2date($task->duedate);
                $startdate = mysql2date($task->startdate);
                if (empty($task->name)) {
                    $task->name = $GLOBALS['strUntitled'];
                }
                $content .= "<tr class='{$shade}'>";
                $content .= "<td>{$task->id}</td>";
                $content .= "<td><a href='view_task.php?id={$task->id}' class='info'>" . truncate_string($task->name, 23);
                if (!empty($task->description)) {
                    $content .= "<span>" . nl2br($task->description) . "</span>";
                }
                $content .= "</a></td>";
                $content .= "<td>" . priority_icon($task->priority) . priority_name($task->priority) . "</td>";
                $content .= "<td>" . percent_bar($task->completion) . "</td>";
                $content .= "</tr>\n";
                if ($shade == 'shade1') {
                    $shade = 'shade2';
                } else {
                    $shade = 'shade1';
                }
            }
            $content .= "</table>\n";
        } else {
            $content .= "<p align='center'>{$GLOBALS['strNoRecords']}</p>";
        }
    } else {
        $content .= "<p class='warning'>{$GLOBALS['strDisabled']}</p>";
    }
    echo dashlet('tasks', $dashletid, icon('task', 16), sprintf($GLOBALS['strXsTasks'], user_realname($user, TRUE)), 'tasks.php', $content);
}
Exemplo n.º 10
0
     break;
 default:
     include APPLICATION_INCPATH . 'htmlheader.inc.php';
     $sql = "SELECT * FROM `{$dbDashboard}`";
     $result = mysql_query($sql);
     if (mysql_error()) {
         trigger_error(mysql_error(), E_USER_WARNING);
     }
     echo "<h2>" . icon('dashboard', 32) . " ";
     echo "{$strManageDashboardComponents}</h2>";
     echo "<table class='vertical' align='center'><tr>";
     echo colheader('id', $strID);
     echo colheader('name', $strName);
     echo colheader('enabled', $strEnabled);
     echo colheader('version', $strVersion);
     echo colheader('upgrade', $strUpgrade);
     echo "</tr>";
     while ($dashboardnames = mysql_fetch_object($result)) {
         if ($dashboardnames->enabled == "true") {
             $opposite = "false";
         } else {
             $opposite = "true";
         }
         echo "<tr class='shade2'><td>{$dashboardnames->id}</td>";
         echo "<td>{$dashboardnames->name}</td>";
         echo "<td><a href='" . $_SERVER['PHP_SELF'] . "?action=enable&amp;id={$dashboardnames->id}&amp;enable={$opposite}'>";
         if ($dashboardnames->enabled == 'true') {
             echo $strYes;
         } else {
             echo $strNo;
         }
function dashboard_watch_incidents_display($dashletid)
{
    global $CONFIG, $sit;
    $html = "<script type='text/javascript'>\n    //<![CDATA[\n    function statusform_submit(user)\n    {\n        URL = \"incidents.php?status=\" + window.document.statusform.status.options[window.document.statusform.status.selectedIndex].value + \"&amp;user=\" + user;\n        window.confirm(URL);\n        window.location.href = URL;\n    }\n    //]]>\n    </script>";
    // FIXME, commented out the queue selector, needs recoding to work with one-file dashboards - Ivan 22May08
    //     $html .= "<form action='{$_SERVER['PHP_SELF']}' style='text-align: center;'>";
    //     $html .= "{$GLOBALS['strQueue']}: <select class='dropdown' name='queue' onchange='window.location.href=this.options[this.selectedIndex].value'>\n";
    //     $html .= "<option ";
    //     if ($queue == 5)
    //     {
    //         $html .= "selected='selected' ";
    //     }
    //     $html .= "value=\"javascript:get_and_display('display_watch_incidents.inc.php?queue=5','watch_incidents_windows');\">{$GLOBALS['strAll']}</option>\n";
    //     $html .= "<option ";
    //     if ($queue == 1)
    //     {
    //         $html .= "selected='selected' ";
    //     }
    //     $html .= "value=\"javascript:get_and_display('display_watch_incidents.inc.php?queue=1','watch_incidents_windows');\">{$GLOBALS['strActionNeeded']}</option>\n";
    //     $html .= "<option ";
    //     if ($queue == 3)
    //     {
    //         $html .= "selected='selected' ";
    //     }
    //     $html .= "value=\"javascript:get_and_display('display_watch_incidents.inc.php?queue=3','watch_incidents_windows');\">{$GLOBALS['strAllOpen']}</option>\n";
    //     $html .= "</select>\n";
    //     $html .= "</form>";
    $sql = "SELECT type, id FROM `{$CONFIG['db_tableprefix']}dashboard_watch_incidents` WHERE userid = {$sit[2]} ORDER BY type";
    $result = mysql_query($sql);
    if (mysql_error()) {
        trigger_error(mysql_error() . $sql, E_USER_WARNING);
    }
    if (mysql_num_rows($result) > 0) {
        $header_printed = FALSE;
        $previous = 0;
        while ($obj = mysql_fetch_object($result)) {
            if ($obj->type != 3 and $previous == 3) {
                $html .= "</table>";
            }
            if ($obj->type == 3 and !$header_printed) {
                $html .= "<table>";
            } else {
                if ($obj->type != 3) {
                    $html .= "<table>";
                }
            }
            switch ($obj->type) {
                case '0':
                    //Site
                    $sql = "SELECT i.id, i.title, i.status, i.servicelevel, i.maintenanceid, i.priority, c.forenames, c.surname, c.siteid ";
                    $sql .= "FROM `{$GLOBALS['dbIncidents']}` AS i, `{$GLOBALS['dbContacts']}`  AS c ";
                    $sql .= "WHERE i.contact = c.id AND c.siteid = {$obj->id} ";
                    $sql .= "AND i.status != " . STATUS_CLOSED . " AND i.status != " . STATUS_CLOSING . " ";
                    $lsql = "SELECT name FROM `{$GLOBALS['dbSites']}` WHERE id = {$obj->id}";
                    $lresult = mysql_query($lsql);
                    if (mysql_error()) {
                        trigger_error(mysql_error(), E_USER_WARNING);
                    }
                    $lobj = mysql_fetch_object($lresult);
                    $html .= "<tr><th colspan='3'>{$lobj->name} ({$GLOBALS['strSite']})</th></tr>";
                    break;
                case '1':
                    //contact
                    $sql = "SELECT i.id, i.title, i.status, i.servicelevel, i.maintenanceid, i.priority, c.forenames, c.surname, c.siteid ";
                    $sql .= "FROM `{$GLOBALS['dbIncidents']}` AS i, `{$GLOBALS['dbContacts']}`  AS c ";
                    $sql .= "WHERE i.contact = c.id AND i.contact = {$obj->id} ";
                    $sql .= "AND i.status != " . STATUS_CLOSED . " AND i.status != " . STATUS_CLOSING . " ";
                    $lsql = "SELECT forenames, surname FROM `{$GLOBALS['dbContacts']}` WHERE id = {$obj->id} ";
                    $lresult = mysql_query($lsql);
                    if (mysql_error()) {
                        trigger_error(mysql_error(), E_USER_WARNING);
                    }
                    $lobj = mysql_fetch_object($lresult);
                    $html .= "<tr><th colspan='3'>{$lobj->forenames} {$lobj->surname} ({$GLOBALS['strContact']})</th></tr>";
                    break;
                case '2':
                    //engineer
                    $sql = "SELECT i.id, i.title, i.status, i.servicelevel, i.maintenanceid, i.priority, c.forenames, c.surname, c.siteid ";
                    $sql .= "FROM `{$GLOBALS['dbIncidents']}` AS i, `{$GLOBALS['dbContacts']}`  AS c ";
                    $sql .= "WHERE i.contact = c.id AND (i.owner = {$obj->id} OR i.towner = {$obj->id}) ";
                    $sql .= "AND i.status != " . STATUS_CLOSED . " AND i.status != " . STATUS_CLOSING . " ";
                    $lsql = "SELECT realname FROM `{$GLOBALS['dbUsers']}` WHERE id = {$obj->id}";
                    $lresult = mysql_query($lsql);
                    if (mysql_error()) {
                        trigger_error(mysql_error(), E_USER_WARNING);
                    }
                    $lobj = mysql_fetch_object($lresult);
                    $html .= "<tr><th colspan='3'>";
                    $html .= sprintf($GLOBALS['strIncidentsForEngineer'], $lobj->realname);
                    $html .= "</th></tr>";
                    break;
                case '3':
                    //incident
                    $sql = "SELECT i.id, i.title, i.status, i.servicelevel, i.maintenanceid, i.priority ";
                    $sql .= "FROM `{$GLOBALS['dbIncidents']}` AS i ";
                    $sql .= "WHERE i.id = {$obj->id} ";
                    //$sql .= "AND incidents.status != 2 AND incidents.status != 7";
                    break;
                default:
                    $sql = '';
            }
            if (!empty($sql)) {
                switch ($queue) {
                    case 1:
                        // awaiting action
                        $sql .= "AND ((timeofnextaction > 0 AND timeofnextaction < {$now}) OR ";
                        $sql .= "(IF ((status >= 5 AND status <=8), ({$now} - lastupdated) > ({$CONFIG['regular_contact_days']} * 86400), 1=2 ) ";
                        // awaiting
                        $sql .= "OR IF (status='1' OR status='3' OR status='4', 1=1 , 1=2) ";
                        // active, research, left message - show all
                        $sql .= ") AND timeofnextaction < {$now} ) ";
                        break;
                    case 3:
                        // All Open
                        $sql .= "AND status!='2' ";
                        break;
                    case 5:
                        // ALL
                    // ALL
                    default:
                        break;
                }
                $iresult = mysql_query($sql);
                if (mysql_error()) {
                    trigger_error(mysql_error(), E_USER_WARNING);
                }
                if (mysql_num_rows($iresult) > 0) {
                    if ($obj->type == 3 and !$header_printed) {
                        $html .= "<tr><th colspan='4'>{$GLOBALS['strIncidents']}</th></tr>";
                        $html .= "<tr>";
                        $html .= colheader('id', $GLOBALS['strID']);
                        $html .= colheader('title', $GLOBALS['strTitle']);
                        //$html .= colheader('customer', $GLOBALS['strCustomer']);
                        $html .= colheader('status', $GLOBALS['strStatus']);
                        $html .= "</tr>\n";
                        $header_printed = TRUE;
                    } else {
                        if ($obj->type != 3) {
                            $html .= "<tr>";
                            $html .= colheader('id', $GLOBALS['strID']);
                            $html .= colheader('title', $GLOBALS['strTitle']);
                            //$html .= colheader('customer', $GLOBALS['strCustomer']);
                            $html .= colheader('status', $GLOBALS['strStatus']);
                            $html .= "</tr>\n";
                        }
                    }
                    $shade = 'shade1';
                    while ($incident = mysql_fetch_object($iresult)) {
                        $html .= "<tr class='{$shade}'>";
                        $html .= "<td>{$incident->id}</td>";
                        $html .= "<td><a href='javascript:incident_details_window({$incident->id}) '  class='info'>" . $incident->title;
                        $html .= "<span><strong>{$GLOBALS['strCustomer']}:</strong> " . sprintf($GLOBALS['strXofX'], "{$incident->forenames} {$incident->surname}", site_name($incident->siteid));
                        list($update_userid, $update_type, $update_currentowner, $update_currentstatus, $update_body, $update_timestamp, $update_nextaction, $update_id) = incident_lastupdate($incident->id);
                        $update_body = parse_updatebody($update_body);
                        if (!empty($update_body) and $update_body != '...') {
                            $html .= "<br />{$update_body}";
                        }
                        $html .= "</span></a></td>";
                        $html .= "<td>" . incidentstatus_name($incident->status) . "</td>";
                        $html .= "</tr>\n";
                        if ($shade == 'shade1') {
                            $shade = 'shade2';
                        } else {
                            $shade = 'shade1';
                        }
                    }
                } else {
                    if ($obj->type == 3 and !$header_printed) {
                        $html .= "<tr><th colspan='3'>{$GLOBALS['strIncidents']}</th></tr>";
                        $html .= "<tr><td colspan='3'>{$GLOBALS['strNoIncidents']}</td></tr>\n";
                        $header_printed = TRUE;
                    } else {
                        if ($obj->type != 3) {
                            $html .= "<tr><td colspan='3'>{$GLOBALS['strNoIncidents']}</td></tr>\n";
                        }
                    }
                }
            }
            if ($obj->type == 3 and !$header_printed) {
                $html .= "</table>\n";
            }
            $previous = $obj->type;
        }
    } else {
        $html .= "<p align='center'>{$GLOBALS['strNoRecords']}</p>";
    }
    return $html;
}
Exemplo n.º 12
0
     echo $strPrevious;
 }
 echo " | ";
 if ($end != $numtotal) {
     echo " <a href='{$_SERVER['PHP_SELF']}?start=";
     echo $start + $perpage . "&amp;sort={$sort}&amp;order={$order}&amp;view={$view}'>{$strNext}</a> ";
 } else {
     echo $strNext;
 }
 echo "</p>";
 echo "<table align='center' width='80%'><tr>";
 echo colheader('id', $strID, $sort, $order, $filter, '', '10');
 echo colheader('title', $strTitle, $sort, $order, $filter);
 echo colheader('date', $strDate, $sort, $order, $filter, '', '15');
 echo colheader('author', $strAuthor, $sort, $order, $filter);
 echo colheader('keywords', $strKeywords, $sort, $order, $filter, '', '15');
 echo "</tr>";
 $shade = 'shade1';
 while ($row = mysql_fetch_object($result)) {
     echo "<tr class='{$shade}'>";
     echo "<td><a href='kbarticle.php?id={$row->docid}'>";
     echo icon('kb', 16, $strID);
     echo " {$CONFIG['kb_id_prefix']}{$row->docid}</a></td>";
     echo "<td>{$row->name}<br />";
     echo "<a href='kbarticle.php?id={$row->docid}'>{$row->title}</a></td>";
     echo "<td>";
     echo ldate($CONFIG['dateformat_date'], mysql2date($row->published));
     echo "</td>";
     echo "<td>" . user_realname($row->author) . "</td>";
     echo "<td>{$row->keywords}</td></tr>";
     if ($shade == 'shade1') {
Exemplo n.º 13
0
include APPLICATION_INCPATH . 'htmlheader.inc.php';
echo "<h2>" . icon('escalation', 32, $strEscalationPaths) . " {$title}</h2>";
$sql = "SELECT * FROM `{$dbEscalationPaths}` ORDER BY name";
$result = mysql_query($sql);
if (mysql_error()) {
    trigger_error(mysql_error(), E_USER_WARNING);
}
if (mysql_num_rows($result) >= 1) {
    echo "<table align='center'>";
    echo "<tr>";
    echo colheader('name', $strName);
    echo colheader('track_url', $strTrackURL);
    echo colheader('home_url', $strHomeURL);
    echo colheader('url_title', $strURLTitle);
    echo colheader('email_domain', $strEmailDomain);
    echo colheader('edit', $strOperation);
    echo "</tr>";
    while ($path = mysql_fetch_object($result)) {
        echo "<tr>";
        echo "<td>{$path->name}</td>";
        echo "<td>{$path->track_url}</td>";
        echo "<td>{$path->home_url}</td>";
        echo "<td>{$path->url_title}</td>";
        echo "<td>{$path->email_domain}</td>";
        echo "<td><a href='edit_escalation_path.php?id={$path->id}'>{$strEdit}</a></td>";
        echo "</tr>";
    }
    echo "</table>";
} else {
    echo "<p align='center'>{$strNoRecords}</p>";
}
Exemplo n.º 14
0
/**
 * Outputs a table or csv file based on csv-based array
 * @author Kieran Hogg
 * @param array $data Array of data, see @note for format
 * @param string $ouput Whether to show a table or create a csv file
 * @return string $html The html to produce the output
 * @note format: $array[] = 'Colheader1,Colheader2'; $array[] = 'data1,data2';
 */
function create_report($data, $output = 'table', $filename = 'report.csv')
{
    if ($output == 'table') {
        $html = "\n<table align='center'><tr>\n";
        $data = explode("\n", $data);
        $headers = explode(',', $data[0]);
        $rows = sizeof($headers);
        foreach ($headers as $header) {
            $html .= colheader($header, $header);
        }
        $html .= "</tr>";
        if (sizeof($data) == 1) {
            $html .= "<tr><td rowspan='{$rows}'>{$GLOBALS['strNoRecords']}</td></tr>";
        } else {
            // use 1 -> sizeof as we've already done one row
            for ($i = 1; $i < sizeof($data); $i++) {
                $html .= "<tr>";
                $values = explode(',', $data[$i]);
                foreach ($values as $value) {
                    $html .= "<td>{$value}</td>";
                }
                $html .= "</tr>";
            }
        }
        $html .= "</table>";
    } else {
        $html = header("Content-type: text/csv\r\n");
        $html .= header("Content-disposition-type: attachment\r\n");
        $html .= header("Content-disposition: filename={$filename}");
        foreach ($data as $line) {
            if (!beginsWith($line, "\"")) {
                $line = "\"" . str_replace(",", "\",\"", $line) . "\"\r\n";
            }
            $html .= $line;
        }
    }
    return $html;
}
Exemplo n.º 15
0
 }
 echo "<form name='editholidays' action='{$_SERVER['PHP_SELF']}?action=save' method='post'>";
 echo "<p>{$strResetHolidayEntitlementCarryOverNDaysOfUnusedHoliday}</p>";
 echo "<div align='center'><label>{$strDefaultNewEntitlement}: ";
 echo "<input type='text' name='default_entitlement' value='{$CONFIG['default_entitlement']}' size='4' /></label>, ";
 echo sprintf($strMaxCarryOverXDays, "<input type='text' name='max_carryover' value='5' size='4' />");
 $str = "<input type='text' id='archivedate' name='archivedate' size='10' value='" . date('Y-m-d') . "' />";
 echo "<br />" . sprintf($strArchiveDaysBookedPriorToX, $str) . "\n ";
 echo date_picker('editholidays.archivedate');
 echo "</div>";
 echo "<table align='center'>";
 echo "<tr><th></th>";
 echo colheader('realname', $strName, FALSE);
 echo colheader('entitlement', $strEntitlement, FALSE);
 echo colheader('holidaysused', $strUsed, FALSE);
 echo colheader('holidaysremaining', sprintf($strRemaining, ''), FALSE);
 //echo colheader('resetdate', "Reset Date", FALSE); // FIXME i18n
 //echo colheader('newentitlement', $strNewEntitlement, FALSE);
 echo "</tr>";
 while ($users = mysql_fetch_object($result)) {
     // define class for table row shading
     if ($shade == 'shade1') {
         $shade = "shade2";
     } else {
         $shade = "shade1";
     }
     echo "<tr class='{$shade}'>";
     echo "<td><input type='checkbox' name='user{$users->id}' value='yes' /></td>";
     echo "<td><a href='holidays.php?user={$users->id}'>{$users->realname}</a> ({$users->username})</td>";
     $entitlement = $users->holiday_entitlement;
     $used_holidays = user_count_holidays($users->id, HOL_HOLIDAY, $users->holiday_resetdate);
Exemplo n.º 16
0
 if (!empty($formid)) {
     if ($completed == 'no') {
         echo "<h3>{$strFeedbackRequested}: {$formid}</h3>";
     } else {
         echo "<h3>{$strResponsesToFeedbackForm}: {$formid}</h3>";
     }
     echo "<p align='center'><a href='feedback_form_edit.php?formid={$formid}'>{$strEdit}</a></p>";
 } else {
     echo "<h3>{$strResponsesToAllFeedbackForms}</h3>";
 }
 if ($countrows >= 1) {
     echo "<table summary='feedback forms' width='95%' align='center'>";
     echo "<tr>";
     echo colheader('created', $strDate, $sort, $order, $filter);
     echo colheader('contactid', $strContact, $sort, $order, $filter);
     echo colheader('incidentid', $strIncident, $sort, $order, $filter);
     echo "<th>{$strOperation}</th>";
     echo "</tr>\n";
     $shade = 'shade1';
     while ($resp = mysql_fetch_object($result)) {
         $respondentarr = explode('-', $resp->respondent);
         $responserefarr = explode('-', $resp->responseref);
         $hashtext = urlencode($resp->formid) . "&&" . urlencode($resp->contactid) . "&&" . urlencode($resp->incidentid);
         // $hashcode=urlencode(trim(base64_encode(gzcompress(str_rot13($hashtext)))));
         $hashcode4 = str_rot13($hashtext);
         $hashcode3 = gzcompress($hashcode4);
         $hashcode2 = base64_encode($hashcode3);
         $hashcode1 = trim($hashcode2);
         $hashcode = urlencode($hashcode1);
         echo "<tr class='{$shade}'>";
         echo "<td>" . ldate($CONFIG['dateformat_datetime'], mysqlts2date($resp->created)) . "</td>";
Exemplo n.º 17
0
            echo "<td><a href='contracts.php?id={$row->id}'>{$strViewContract}</a></td></tr>";
        }
        if ($shade == 'shade1') {
            $shade = 'shade2';
        } else {
            $shade = 'shade1';
        }
    }
    echo "</table>";
    echo "<p align='center'><input type='submit' id='submit' name='submit'  value='{$strUpdate}' /></form></p>";
}
echo "<br />";
echo "<h2>" . icon('contact', 32) . " {$strContacts}</h2>";
echo "<table width='30%' align='center'><tr>";
echo colheader('name', $strName);
echo colheader('action', $strAction, FALSE, FALSE, FALSE, FALSE, 10);
echo "</tr>";
$sql = "SELECT * FROM `{$dbContacts}` ";
$sql .= "WHERE siteid='{$_SESSION['siteid']}' ";
$sql .= "AND active = TRUE";
if ($result = mysql_query($sql)) {
    $shade = 'shade1';
    while ($row = mysql_fetch_object($result)) {
        echo "<tr class='{$shade}'><td>{$row->forenames} {$row->surname}</td>";
        echo "<td><a href='contactdetails.php?id={$row->id}'>{$strView}</a> </td></tr>";
        if ($shade == 'shade1') {
            $shade == 'shade2';
        } else {
            $shade = 'shade1';
        }
    }
Exemplo n.º 18
0
     echo " | ";
     if ($end < $results) {
         echo " <a href='{$_SERVER['PHP_SELF']}?domain=kb&q={$q}&start=";
         echo $begin + $resultsperpage . "&amp;sort={$sort}&amp;order={$order}&amp;view={$view}'>{$strNext} ";
         echo icon('rightarrow', 16, $strNext) . "</a> ";
     } else {
         echo "{$strNext}";
     }
     echo "</p>";
     echo "<table align='center' width='80%'>";
     $filter['domain'] = 'kb';
     echo "<tr>" . colheader(id, $strID, $sort, $order, $filter);
     echo colheader(title, $strTitle, $sort, $order, $filter);
     echo colheader(date, $strDate, $sort, $order, $filter);
     echo colheader(author, $strAuthor, $sort, $order, $filter);
     echo colheader(keywords, $strKeywords, $sort, $order, $filter);
     $shade = 'shade1';
     while ($row = mysql_fetch_object($kbresult)) {
         echo "<tr class='{$shade}'>\n                    <td><a href='kb_view_article.php?id={$row->docid}'>\n                        {$CONFIG['kb_id_prefix']}{$row->docid}</a></td>\n                    <td>{$row->title}</td>\n                    <td>{$row->published}</td>\n                    <td>" . user_realname($row->author) . "</td>\n                    <td>{$row->keywords}</td>\n                  </tr>";
         if ($shade == 'shade1') {
             $shade = 'shade2';
         } else {
             $shade = 'shade1';
         }
     }
     echo "</table>";
 }
 $sql = "SELECT * FROM `{$dbTags}` WHERE name LIKE '%{$q}%'";
 $result = mysql_query($sql);
 if (mysql_num_rows($result) > 0) {
     echo "<h3>{$strTags}</h3>";
Exemplo n.º 19
0
$journaltype[CFG_JOURNAL_MAINTENANCE] = 'Maintenance';
$journaltype[CFG_JOURNAL_PRODUCTS] = 'Products';
$journaltype[CFG_JOURNAL_OTHER] = 'Other';
$journaltype[CFG_JOURNAL_TRIGGERS] = 'Triggers';
$journaltype[CFG_JOURNAL_KB] = 'Knowledge Base';
$journaltype[CFG_JOURNAL_TASKS] = 'Tasks';
$journal_count = mysql_num_rows($result);
if ($journal_count >= 1) {
    echo "<table align='center'>";
    echo "<tr>";
    $filter = array('page' => $page);
    echo colheader('userid', $strUser, $sort, $order, $filter);
    echo colheader('timestamp', "{$strTime}/{$strDate}", $sort, $order, $filter);
    echo colheader('event', $strEvent);
    echo colheader('action', $strOperation);
    echo colheader('type', $strType);
    echo "</tr>\n";
    $shade = 0;
    while ($journal = mysql_fetch_object($result)) {
        // define class for table row shading
        if ($shade) {
            $class = "shade1";
        } else {
            $class = "shade2";
        }
        echo "<tr class='{$class}'>";
        echo "<td>" . user_realname($journal->userid, TRUE) . "</td>";
        echo "<td>" . ldate($CONFIG['dateformat_datetime'], mysqlts2date($journal->timestamp)) . "</td>";
        echo "<td>{$journal->event}</td>";
        echo "<td>";
        switch ($journal->journaltype) {
Exemplo n.º 20
0
echo "<col width='5%'></col>";
echo "<col width='7%'></col>";
echo "<col width='15%'></col>";
echo "<col width='17%'></col>";
echo "<col width='10%'></col>";
echo "<col width='8%'></col>";
echo "<tr>";
$filter = array('queue' => $queue, 'user' => $user, 'type' => $type);
echo colheader('id', $strID, $sort, $order, $filter);
echo colheader('title', $strTitle, $sort, $order, $filter);
echo colheader('contact', $strContact, $sort, $order, $filter);
echo colheader('priority', $strPriority, $sort, $order, $filter);
echo colheader('status', $strStatus, $sort, $order, $filter);
echo colheader('lastupdated', $strLastUpdated, $sort, $order, $filter);
echo colheader('nextaction', $strSLATarget, $sort, $order, $filter);
echo colheader('info', $strInfo, $sort, $order, $filter);
echo "</tr>";
// Display the Support Incidents Themselves
$shade = 0;
while ($incidents = mysql_fetch_array($result)) {
    // calculate time to next action string
    if ($incidents["timeofnextaction"] == 0) {
        $timetonextaction_string = "&nbsp;";
        // was 'no time set'
    } else {
        if ($incidents["timeofnextaction"] - $now > 0) {
            $timetonextaction_string = format_seconds($incidents["timeofnextaction"] - $now);
        } else {
            $timetonextaction_string = "<strong>{$strNow}</strong>";
        }
    }