function PrintAll($orderBy = 'name')
 {
     global $g_oSec, $g_oSession;
     commonHeader();
     if (!$g_oSec->HasPerm(DCL_ENTITY_SAVEDSEARCH, DCL_PERM_VIEW)) {
         return PrintPermissionDenied();
     }
     if ($g_oSession->IsInWorkspace()) {
         ShowWarning('You are currently in a workspace.  It is possible for results to be mutually exclusive if a search contains a product filter.  If you do not see the results you expect, switch to "No Workspace" or another workspace that has the products contained in the search.', '', '', array());
     }
     $objDB = CreateObject('dcl.dbViews');
     $objDB->Query('SELECT viewid,whoid,ispublic,name,tablename FROM views WHERE whoid=' . $GLOBALS['DCLID'] . " OR ispublic='Y' ORDER BY {$orderBy}");
     $allRecs = $objDB->FetchAllRows();
     $oTable =& CreateObject('dcl.htmlTable');
     $oTable->setCaption(sprintf(STR_VW_TITLE, $orderBy));
     $oTable->addColumn(STR_VW_ID, 'numeric');
     $oTable->addColumn(STR_VW_OWNER, 'string');
     $oTable->addColumn(STR_VW_PUBLIC, 'string');
     $oTable->addColumn(STR_VW_NAME, 'html');
     $oTable->addColumn(STR_VW_TABLE, 'string');
     $oTable->addColumn(STR_CMMN_OPTIONS, 'html');
     $objDBP = CreateObject('dcl.dbPersonnel');
     for ($i = 0; $i < count($allRecs); $i++) {
         $allRecs[$i][3] = sprintf('<a href="%s">%s</a>', menuLink('', sprintf('menuAction=boViews.exec&viewid=%d', $allRecs[$i][0])), $allRecs[$i][3]);
         $options = '';
         if ($allRecs[$i][4] == 'workorders') {
             $options .= '<a href="' . menuLink('', 'menuAction=htmlWOSearches.ShowView&id=' . $allRecs[$i][0]) . '">' . STR_VW_SETUP . '</a>';
         } else {
             if ($allRecs[$i][4] == 'tickets') {
                 $options .= '<a href="' . menuLink('', 'menuAction=htmlTicketSearches.ShowView&id=' . $allRecs[$i][0]) . '">' . STR_VW_SETUP . '</a>';
             }
         }
         if ($allRecs[$i][1] == $GLOBALS['DCLID'] || $g_oSec->HasPerm(DCL_ENTITY_GLOBAL, DCL_PERM_ADMIN)) {
             if ($options != '') {
                 $options .= '&nbsp;|&nbsp;';
             }
             $options .= '<a href="' . menuLink('', 'menuAction=boViews.delete&id=' . $allRecs[$i][0]) . '">' . STR_CMMN_DELETE . '</a>';
         }
         if ($options == '') {
             $options = '&nbsp;';
         }
         $objDBP->Load($allRecs[$i][1]);
         $allRecs[$i][1] = $objDBP->short;
         $allRecs[$i][] = $options;
     }
     $oTable->setData($allRecs);
     $oTable->setShowRownum(true);
     $oTable->render();
 }
function dcl_error_handler($errno, $errstr, $errfile, $errline)
{
    global $g_oPage, $g_oSec;
    if (!($errno & error_reporting())) {
        return;
    }
    $aBacktrace = array();
    if (function_exists('debug_backtrace')) {
        $aBacktrace = debug_backtrace();
    }
    switch ($errno) {
        case E_COMPILE_ERROR:
        case E_PARSE:
        case E_CORE_ERROR:
        case E_USER_ERROR:
        case E_ERROR:
            ShowError($errstr, $errfile, $errline, $aBacktrace);
            break;
        case E_CORE_WARNING:
        case E_USER_WARNING:
        case E_WARNING:
            ShowWarning($errstr, $errfile, $errline, $aBacktrace);
            break;
        case E_NOTICE:
        case E_USER_NOTICE:
            ShowInfo($errstr, $errfile, $errline, $aBacktrace);
            break;
    }
    if ($errno == E_COMPILE_ERROR || $errno == E_PARSE) {
        $g_oPage->EndPage();
        exit(255);
    }
}