function GetProducts($workspace_id) { $workspace_id = (int) $workspace_id; if ($workspace_id > 0) { $oDB = new dclDB(); $oDB->Query("SELECT w.product_id, p.name FROM dcl_workspace_product w, products p WHERE w.product_id = p.id AND w.workspace_id = {$workspace_id} ORDER BY p.name"); return $oDB->FetchAllRows(); } return array(); }
function Render(&$oView) { global $dcl_info, $g_oSec; if (!is_object($oView)) { trigger_error('[htmlTicketResults::Render] ' . STR_VW_VIEWOBJECTNOTPASSED); return; } if (!$g_oSec->HasPerm(DCL_ENTITY_TICKET, DCL_PERM_SEARCH)) { return PrintPermissionDenied(); } $oTable = CreateObject('dcl.htmlTable'); $oTable->assign('VAL_VIEWSETTINGS', $oView->GetForm()); $aProducts = isset($_REQUEST['product']) ? DCL_Sanitize::ToIntArray($_REQUEST['product']) : array(); if ($aProducts !== null && count($aProducts) > 0) { $oTable->assign('HID_PRODUCT', join(',', $aProducts)); } else { $oTable->assign('HID_PRODUCT', ''); } for ($iColumn = 0; $iColumn < count($oView->groups); $iColumn++) { $oTable->addGroup($iColumn); $oTable->addColumn('', 'string'); } $iColumn = 0; foreach ($oView->columnhdrs as $sColumn) { if ($iColumn++ < count($oView->groups)) { continue; } $oTable->addColumn($sColumn, 'string'); } $aOptions = array(STR_CMMN_SAVE => array('menuAction' => 'boViews.add', 'hasPermission' => $g_oSec->HasPerm(DCL_ENTITY_SAVEDSEARCH, DCL_PERM_ADD)), 'Refine' => array('menuAction' => 'htmlTicketSearches.ShowRequest', 'hasPermission' => $g_oSec->HasPerm(DCL_ENTITY_SAVEDSEARCH, DCL_PERM_VIEW)), 'Export' => array('menuAction' => 'boViews.export', 'hasPermission' => true)); foreach ($aOptions as $sDisplay => $aOption) { if ($aOption['hasPermission']) { $oTable->addToolbar($aOption['menuAction'], $sDisplay); } } $oDB = new dclDB(); $sSQL = $oView->GetSQL(); if ($oDB->Query($sSQL) == -1) { return; } for ($iColumn = count($oView->groups); $iColumn < count($oView->columns) + count($oView->groups); $iColumn++) { if ($oDB->GetFieldName($iColumn) == 'ticketid') { $oTable->assign('ticket_id_ordinal', $iColumn); break; } } $iOffset = 0; for ($iColumn = count($oView->groups); $iColumn < $oDB->NumFields(); $iColumn++) { $sFieldName = $oDB->GetFieldName($iColumn); if ($sFieldName == '_num_tags_') { $iOffset--; $oTable->assign('num_tags_ordinal', $iColumn); } else { if ($sFieldName == 'tag_desc') { $oTable->assign('tag_ordinal', $iColumn); } } } $oTable->assign('VAL_ENDOFFSET', $iOffset); $oTable->setData($oDB->FetchAllRows()); $oDB->FreeResult(); $oTable->assign('VAL_VIEWSETTINGS', $oView->GetForm()); $oTable->setCaption($oView->title); $oTable->setShowChecks(false); $oTable->sTemplate = 'htmlTableTicketResults.tpl'; $oTable->render(); }
function myProjects() { $oView = CreateObject('dcl.boView'); $oView->numrows = 5; $oView->table = 'dcl_projects'; $oView->style = 'report'; $oView->title = STR_PRJ_MYPRJ; $oView->AddDef('columnhdrs', '', array(STR_CMMN_ID, STR_PRJ_LEAD, STR_PRJ_STATUS, STR_PRJ_NAME)); $oView->AddDef('columns', '', array('projectid', 'reportto.short', 'statuses.name', 'dcl_projects.name')); $oView->AddDef('filternot', 'statuses.dcl_status_type', '2'); $oView->AddDef('filter', 'dcl_projects.reportto', $GLOBALS['DCLID']); $oView->AddDef('order', '', array('dcl_projects.name')); $oTable = CreateObject('dcl.htmlTable'); foreach ($oView->columnhdrs as $sColumn) { if ($sColumn == STR_PRJ_NAME) { $oTable->addColumn($sColumn, 'html'); } else { $oTable->addColumn($sColumn, 'string'); } } $oTable->setShowRownum(false); $oTable->setCaption($oView->title); $oTable->setWidth('100%'); $oTable->addToolbar(menuLink('', 'menuAction=htmlProjects.show&filterReportto=' . $GLOBALS['DCLID']), STR_CMMN_VIEWALL); $oDB = new dclDB(); $oDB->LimitQuery($oView->GetSQL(), 0, 5); $aData = $oDB->FetchAllRows(); for ($i = 0; $i < count($aData); $i++) { $aData[$i][3] = '<a href="' . menuLink('', 'menuAction=boProjects.viewproject&project=' . $aData[$i][0]) . '">' . $aData[$i][3] . '</a>'; } $oTable->setData($aData); if (count($oTable->aData) > 0) { if ($this->bHasOutput) { $oTable->setSpacer(true); } else { $this->bHasOutput = true; } $oTable->render(); } }
function Render(&$oView) { global $dcl_info, $g_oSec, $g_oSession; if (!is_object($oView)) { trigger_error('[htmlWorkOrderResults::Render] ' . STR_VW_VIEWOBJECTNOTPASSED); return; } if (!$g_oSec->HasPerm(DCL_ENTITY_WORKORDER, DCL_PERM_SEARCH)) { return PrintPermissionDenied(); } $oTable = CreateObject('dcl.htmlTable'); $bIsExplicitView = is_a($oView, 'boExplicitView'); if (!$bIsExplicitView) { $oTable->assign('VAL_VIEWSETTINGS', $oView->GetForm()); } $aProducts = isset($_REQUEST['product']) ? DCL_Sanitize::ToIntArray($_REQUEST['product']) : array(); if ($aProducts !== null && count($aProducts) > 0) { $oTable->assign('HID_PRODUCT', join(',', $aProducts)); } else { $oTable->assign('HID_PRODUCT', ''); } for ($iColumn = 0; $iColumn < count($oView->groups); $iColumn++) { $oTable->addGroup($iColumn); $oTable->addColumn('', 'string'); } $iColumn = 0; foreach ($oView->columnhdrs as $sColumn) { if ($iColumn++ < count($oView->groups)) { continue; } $oTable->addColumn($sColumn, 'string'); } $aOptions = array(STR_CMMN_SAVE => array('menuAction' => 'boViews.add', 'hasPermission' => !$bIsExplicitView && $g_oSec->HasPerm(DCL_ENTITY_SAVEDSEARCH, DCL_PERM_ADD)), 'Refine' => array('menuAction' => 'htmlWOSearches.ShowRequest', 'hasPermission' => !$bIsExplicitView && $g_oSec->HasPerm(DCL_ENTITY_SAVEDSEARCH, DCL_PERM_VIEW)), 'Export' => array('menuAction' => 'boViews.export', 'hasPermission' => true), 'Detail' => array('menuAction' => 'boWorkorders.batchdetail', 'hasPermission' => $g_oSec->HasPerm(DCL_ENTITY_WORKORDER, DCL_PERM_ADD)), 'Time Card' => array('menuAction' => 'boTimecards.batchadd', 'hasPermission' => $g_oSec->HasPerm(DCL_ENTITY_WORKORDER, DCL_PERM_ACTION)), 'Assign' => array('menuAction' => 'boWorkorders.batchassign', 'hasPermission' => $g_oSec->HasPerm(DCL_ENTITY_WORKORDER, DCL_PERM_ASSIGN)), 'Project' => array('menuAction' => 'htmlProjectmap.batchmove', 'hasPermission' => $g_oSec->HasAllPerm(array(DCL_ENTITY_PROJECT => array($g_oSec->PermArray(DCL_PERM_ADDTASK), $g_oSec->PermArray(DCL_PERM_REMOVETASK)))))); $showBM = $g_oSession->Value('showBM'); if (isset($showBM) && (int) $showBM == 1) { $aOptions_BM = array('Version' => array('menuAction' => 'boBuildManager.SubmitWO', 'hasPermission' => $g_oSec->HasPerm(DCL_ENTITY_WORKORDER, DCL_PERM_ACTION))); $aOptions = array_merge($aOptions, $aOptions_BM); $g_oSession->Unregister('showBM'); $g_oSession->Edit(); } foreach ($aOptions as $sDisplay => $aOption) { if ($aOption['hasPermission']) { $oTable->addToolbar($aOption['menuAction'], $sDisplay); } } $oDB = new dclDB(); $sSQL = $oView->GetSQL(); if ($oDB->Query($sSQL) == -1) { return; } $iOffset = 0; for ($iColumn = count($oView->groups); $iColumn < $oDB->NumFields(); $iColumn++) { $sFieldName = $oDB->GetFieldName($iColumn); if ($sFieldName == 'jcn') { $oTable->assign('wo_id_ordinal', $iColumn); } else { if ($sFieldName == 'seq') { $oTable->assign('seq_ordinal', $iColumn); } else { if ($sFieldName == '_num_accounts_') { $iOffset--; $oTable->assign('num_accounts_ordinal', $iColumn); } else { if ($sFieldName == '_num_tags_') { $iOffset--; $oTable->assign('num_tags_ordinal', $iColumn); } else { if ($sFieldName == 'tag_desc') { $oTable->assign('tag_ordinal', $iColumn); } else { if ($sFieldName == '_num_hotlist_') { $iOffset--; $oTable->assign('num_hotlist_ordinal', $iColumn); } else { if ($sFieldName == 'hotlist_tag') { $oTable->assign('hotlist_ordinal', $iColumn); } else { if ($oView->columns[$iColumn - count($oView->groups)] == 'dcl_org.name') { $oTable->assign('org_ordinal', $iColumn); } } } } } } } } } $oTable->setData($oDB->FetchAllRows()); $oTable->assign('VAL_ENDOFFSET', $iOffset); if (!$bIsExplicitView) { $oTable->assign('VAL_VIEWSETTINGS', $oView->GetForm()); } $oTable->setCaption($oView->title); $oTable->setShowChecks(true); $oDB->FreeResult(); $oTable->sTemplate = 'htmlTableWorkOrderResults.tpl'; $oTable->render(); }