本文整理汇总了PHP中DCL_Sanitize::ToDate方法的典型用法代码示例。如果您正苦于以下问题:PHP DCL_Sanitize::ToDate方法的具体用法?PHP DCL_Sanitize::ToDate怎么用?PHP DCL_Sanitize::ToDate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DCL_Sanitize
的用法示例。
在下文中一共展示了DCL_Sanitize::ToDate方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show
function show()
{
global $dcl_info, $g_oSec;
if (!$g_oSec->HasPerm(DCL_ENTITY_ADMIN, DCL_PERM_MODIFY)) {
return PrintPermissionDenied();
}
$objPersonnel = CreateObject('dcl.htmlPersonnel');
$oDBPersonnel = CreateObject('dcl.dbPersonnel');
if ($oDBPersonnel->Load($GLOBALS['DCLID']) == -1) {
return;
}
$t =& CreateSmarty();
$oSelect = CreateObject('dcl.htmlSelect');
$t->assign('CMB_USERS', $objPersonnel->GetCombo(0, 'responsible', 'lastfirst', 0, false));
$begindate = @DCL_Sanitize::ToDate($_REQUEST['begindate']);
if ($begindate !== null) {
$t->assign('VAL_BEGINDATE', $begindate);
} else {
$t->assign('VAL_BEGINDATE', '');
}
$enddate = @DCL_Sanitize::ToDate($_REQUEST['enddate']);
if ($enddate !== null) {
$t->assign('VAL_ENDDATE', $enddate);
} else {
$t->assign('VAL_ENDDATE', '');
}
SmartyDisplay($t, 'htmlSecAuditBrowse.tpl');
}
示例2: submitModify
function submitModify()
{
global $g_oSec;
commonHeader();
if (($id = DCL_Sanitize::ToInt($_REQUEST['contact_license_id'])) === null || ($contact_id = DCL_Sanitize::ToInt($_REQUEST['contact_id'])) === null || ($product_id = DCL_Sanitize::ToInt($_REQUEST['product_id'])) === null || ($registered_on = DCL_Sanitize::ToDate($_REQUEST['registered_on'])) === null || ($expires_on = DCL_Sanitize::ToDate($_REQUEST['expires_on'])) === null) {
trigger_error('Data sanitize failed.');
return;
}
if (!$g_oSec->HasPerm(DCL_ENTITY_CONTACT, DCL_PERM_MODIFY)) {
return PrintPermissionDenied();
}
CleanArray($_REQUEST);
$obj =& CreateObject('dcl.boContactLicense');
$obj->modify(array('contact_license_id' => $id, 'contact_id' => $contact_id, 'product_id' => $product_id, 'product_version' => $_REQUEST['product_version'], 'license_id' => $_REQUEST['license_id'], 'registered_on' => $registered_on, 'expires_on' => $expires_on, 'license_notes' => $_REQUEST['license_notes'], 'modified_on' => DCL_NOW, 'modified_by' => $GLOBALS['DCLID']));
$this->ShowContactDetail();
}
示例3: _GetSQL
function _GetSQL()
{
$aItems = $this->_aTypeInfo[$this->group][$this->sub];
$orderby = isset($_REQUEST['order']) && $_REQUEST['order'] == 'count' ? 'count(*)' : $aItems[3];
$sql = sprintf('select count(*), %s, %s, t.dcl_status_type_id, t.dcl_status_type_name from ', $aItems[2], $aItems[3]);
$sql .= sprintf('%s a, %s w, dcl_status_type t, statuses s', $aItems[0], $this->group);
if ($this->group == 'workorders' && $this->sub == 'account') {
$sql .= ', dcl_org ac';
}
$sql .= sprintf(' where %s = %s ', $aItems[4], $aItems[2]);
if ($this->group == 'workorders' && $this->sub == 'account') {
$sql .= ' AND w.jcn = a.wo_id AND w.seq = a.seq ';
}
$sql .= 'and w.status = s.id and s.dcl_status_type = t.dcl_status_type_id and ';
if (isset($_REQUEST['chkLimitByDate']) && $_REQUEST['chkLimitByDate'] == 1) {
$dateFrom = DCL_Sanitize::ToDate($_REQUEST['dateFrom']);
$dateTo = DCL_Sanitize::ToDate($_REQUEST['dateTo']);
$oDB = new dclDB();
// for sql side date formatting
$sql .= '((t.dcl_status_type_id = 1 and w.createdon between ' . $oDB->DisplayToSQL($dateFrom) . ' and ' . $oDB->DisplayToSQL($dateTo) . ') or ';
$sql .= '(t.dcl_status_type_id = 2 and w.closedon between ' . $oDB->DisplayToSQL($dateFrom) . ' and ' . $oDB->DisplayToSQL($dateTo) . ')) ';
} else {
$sql .= 't.dcl_status_type_id != 3 ';
}
if ($aItems[5] != '') {
$sql .= ' and (' . $aItems[5] . ') ';
}
$sql .= sprintf('group by %s, %s, t.dcl_status_type_id, t.dcl_status_type_name order by %s', $aItems[2], $aItems[3], $orderby);
return $sql;
}
示例4: ShowReport
function ShowReport($query, $iGroupColumn)
{
$bExport = isset($_REQUEST['export']) && $_REQUEST['export'] == '1';
$objS = CreateObject('dcl.dbStatuses');
$objPr = CreateObject('dcl.dbPriorities');
$objSe = CreateObject('dcl.dbSeverities');
$objW = CreateObject('dcl.dbWorkorders');
$oPM = CreateObject('dcl.dbProjectmap');
$objDB = new dclDB();
$aGroupOptions = array('1' => 'Project', '2' => 'Action', '3' => 'Date', '4' => 'Product', '5' => 'by');
$groupBy = $_REQUEST['groupby'];
if (!array_key_exists($groupBy, $aGroupOptions)) {
$groupBy = '0';
}
$oMeta =& CreateObject('dcl.DCL_MetadataDisplay');
$responsible = 0;
$department = 0;
if ($_REQUEST['bytype'] == '1') {
if (($responsible = DCL_Sanitize::ToInt($_REQUEST['responsible'])) === null) {
trigger_error('Data sanitize failed.');
return;
}
$sReportFor = $oMeta->GetPersonnel($responsible);
} else {
if (($department = DCL_Sanitize::ToInt($_REQUEST['department'])) === null) {
trigger_error('Data sanitize failed.');
return;
}
$sReportFor = $oMeta->GetDepartment($department);
}
if (($begindate = DCL_Sanitize::ToDate($_REQUEST['begindate'])) === null || ($enddate = DCL_Sanitize::ToDate($_REQUEST['enddate'])) === null) {
trigger_error('Data sanitize failed.');
return;
}
if ($objDB->Query($query) != -1) {
if ($objDB->next_record()) {
$lastJCN = 0;
$lastSeq = 0;
$lastGroup = $thisGroup = '<< undefined >>';
$arrayIndex = -1;
$count = 0;
$subEstHours = 0.0;
$subAppliedHours = 0.0;
$subEtcHours = 0.0;
$subTimeHours = 0.0;
$totalEstHours = 0.0;
$totalAppliedHours = 0.0;
$totalEtcHours = 0.0;
$totalTimeHours = 0.0;
$oDate = new DCLDate();
$aByDate = array();
do {
$thisJCN = $objDB->f('jcn');
$thisSeq = $objDB->f('seq');
if ($groupBy == '3') {
$oDate->SetFromDB($objDB->f('actionon'));
$thisGroup = $oDate->ToDisplay();
} else {
if ($groupBy == '5') {
$thisGroup = $objDB->f('short');
} else {
if ($groupBy != '0') {
if ($objDB->IsFieldNull('name')) {
$thisGroup = ' ';
} else {
$thisGroup = $objDB->f('name');
}
}
}
}
// Skip multiple time cards
if ($thisJCN != $lastJCN || $thisSeq != $lastSeq || $thisGroup != $lastGroup) {
if ($groupBy != '0' && $thisGroup != $lastGroup && $lastGroup != '<< undefined >>') {
// Subtotals
$arrayIndex++;
if ($bExport) {
$reportArray[$arrayIndex][0] = 'Subtotal for ' . $lastGroup;
} else {
$reportArray[$arrayIndex][0] = '<b>Subtotal for ' . $lastGroup . '</b>';
}
if ($groupBy != '1') {
$reportArray[$arrayIndex][] = '';
}
if ($_REQUEST['bytype'] == '2') {
if ($groupBy == '5') {
$reportArray[$arrayIndex][] = $lastGroup;
} else {
$reportArray[$arrayIndex][] = '';
}
}
$reportArray[$arrayIndex][] = '';
$reportArray[$arrayIndex][] = '';
$reportArray[$arrayIndex][] = '';
$reportArray[$arrayIndex][] = $subEstHours;
$reportArray[$arrayIndex][] = $subEtcHours;
$reportArray[$arrayIndex][] = $subAppliedHours;
$reportArray[$arrayIndex][] = '';
$reportArray[$arrayIndex][] = '';
$reportArray[$arrayIndex][] = '';
$reportArray[$arrayIndex][] = '';
//.........这里部分代码省略.........
示例5: executeWorked
function executeWorked()
{
commonHeader();
$sSQL = 'SELECT s.id, s.name, count(*) FROM workorders w, statuses s';
if (count($this->aProjects) > 0) {
$sSQL .= ', projectmap pm';
}
$sSQL .= ' WHERE w.status = s.id ';
if (isset($_REQUEST['products'])) {
$aProducts = DCL_Sanitize::ToIntArray($_REQUEST['products']);
if (count($aProducts) > 0) {
$sSQL .= ' AND w.product IN (' . join(',', $aProducts) . ')';
}
}
if (count($this->aProjects) > 0) {
$sSQL .= ' AND w.jcn = pm.jcn AND pm.seq IN (0, w.seq) AND pm.projectid in (' . implode(',', $this->aProjects) . ')';
}
$oDB = CreateObject('dcl.dbWorkorders');
$beginDate = DCL_Sanitize::ToDate($_REQUEST['begindate']);
$endDate = DCL_Sanitize::ToDate($_REQUEST['enddate']);
if ($beginDate !== null && $endDate !== null) {
$sSQL .= ' AND w.lastactionon BETWEEN ' . $oDB->DisplayToSQL($beginDate . ' 00:00:00') . ' AND ' . $oDB->DisplayToSQL($endDate . ' 23:59:59');
} else {
if ($beginDate !== null) {
$sSQL .= ' AND w.lastactionon >= ' . $oDB->DisplayToSQL($beginDate . ' 00:00:00');
} else {
if ($endDate !== null) {
$sSQL .= ' AND w.lastactionon <= ' . $oDB->DisplayToSQL($endDate . ' 23:59:59');
} else {
$sSQL .= ' AND w.lastactionon IS NOT NULL';
}
}
}
$sSQL .= ' GROUP BY s.id, s.name ORDER BY 2 DESC';
$this->executeItem($sSQL, 'Work Orders Touched', STR_WO_STATUS);
}
示例6: SearchFromStat
function SearchFromStat()
{
global $dcl_domain_info, $dcl_domain, $g_oSec;
commonHeader();
if (!$g_oSec->HasPerm(DCL_ENTITY_WORKORDER, DCL_PERM_VIEW)) {
return PrintPermissionDenied();
}
$responsible = DCL_Sanitize::ToInt($_REQUEST['responsible']);
$product = DCL_Sanitize::ToInt($_REQUEST['product']);
$status = DCL_Sanitize::ToInt($_REQUEST['status']);
$begindate = DCL_Sanitize::ToDate($_REQUEST['begindate']);
$enddate = DCL_Sanitize::ToDate($_REQUEST['enddate']);
$obj = new dclDB();
$objView = CreateObject('dcl.boView');
$objView->style = 'report';
$objView->title = STR_WOST_SEARCHRESULTS;
$objView->AddDef('columns', '', array('jcn', 'seq', 'responsible.short', 'products.name', 'statuses.name', 'eststarton', 'deadlineon', 'etchours', 'totalhours', 'summary'));
$objView->AddDef('columnhdrs', '', array(STR_WO_JCN, STR_WO_SEQ, STR_WO_RESPONSIBLE, STR_WO_PRODUCT, STR_WO_STATUS, STR_WO_ESTSTART, STR_WO_DEADLINE, STR_WO_ETCHOURS, STR_WO_ACTHOURS, STR_WO_SUMMARY));
$objView->AddDef('order', '', array('priorities.weight', 'severities.weight', 'jcn', 'seq'));
if ($begindate !== null || $enddate !== null) {
$objView->AddDef('filter', 'statuses.dcl_status_type', '2');
$objView->AddDef('filterdate', 'closedon', array($obj->DisplayToSQL($begindate), $obj->DisplayToSQL($enddate)));
} else {
if ($status !== null) {
$objView->AddDef('filter', 'status', $status);
} else {
$objView->AddDef('filternot', 'statuses.dcl_status_type', '2');
}
}
if ($responsible !== null) {
$objView->AddDef('filter', 'responsible', $responsible);
}
if ($product !== null) {
$objView->AddDef('filter', 'product', $product);
}
$obj = CreateViewObject($objView->table);
$obj->Render($objView);
}
示例7: dbreassign
function dbreassign()
{
global $dcl_info, $g_oSec;
commonHeader();
if (($iID = @DCL_Sanitize::ToInt($_REQUEST['jcn'])) === null || ($iSeq = @DCL_Sanitize::ToInt($_REQUEST['seq'])) === null || ($iResponsible = @DCL_Sanitize::ToInt($_REQUEST['responsible'])) === null || ($fEstHours = @DCL_Sanitize::ToDecimal($_REQUEST['esthours'])) === null || ($fEtcHours = @DCL_Sanitize::ToDecimal($_REQUEST['etchours'])) === null || ($iSeverity = @DCL_Sanitize::ToInt($_REQUEST['severity'])) === null || ($iPriority = @DCL_Sanitize::ToInt($_REQUEST['priority'])) === null || ($deadlineon = @DCL_Sanitize::ToDate($_REQUEST['deadlineon'])) === null || ($eststarton = @DCL_Sanitize::ToDate($_REQUEST['eststarton'])) === null || ($estendon = @DCL_Sanitize::ToDate($_REQUEST['estendon'])) === null) {
trigger_error('Data sanitize failed.');
return;
}
if (!$g_oSec->HasPerm(DCL_ENTITY_WORKORDER, DCL_PERM_ASSIGN, $iID, $iSeq)) {
return PrintPermissionDenied();
}
$objWO =& CreateObject('dcl.dbWorkorders');
if ($objWO->Load($iID, $iSeq) == -1) {
return;
}
if ($objWO->responsible != $iResponsible || $objWO->deadlineon != $deadlineon || $objWO->eststarton != $eststarton || $objWO->estendon != $estendon || $objWO->esthours != $fEstHours || $objWO->etchours != $fEtcHours || $objWO->priority != $iPriority || $objWO->status == $dcl_info['DCL_DEF_STATUS_UNASSIGN_WO'] || $objWO->severity != $iSeverity) {
$objWO->responsible = $iResponsible;
$objWO->deadlineon = $deadlineon;
$objWO->eststarton = $eststarton;
$objWO->estendon = $estendon;
$objWO->esthours = $fEstHours;
$oStatus =& CreateObject("dcl.dbStatuses");
if ($oStatus->GetStatusType($objWO->status) != 2) {
$objWO->etchours = $fEtcHours;
if ($objWO->status == $dcl_info['DCL_DEF_STATUS_UNASSIGN_WO']) {
$objWO->status = $dcl_info['DCL_DEF_STATUS_ASSIGN_WO'];
$objWO->statuson = $objWO->GetDateSQL();
}
} else {
$objWO->etchours = 0.0;
}
$objWO->priority = $iPriority;
$objWO->severity = $iSeverity;
$objWO->Edit();
$objWtch =& CreateObject('dcl.boWatches');
$objWtch->sendNotification($objWO, '4');
}
$objHTMLWO =& CreateObject('dcl.htmlWorkOrderDetail');
$objHTMLWO->Show($iID, $iSeq);
}
示例8: Render
function Render()
{
commonHeader();
if (($id = DCL_Sanitize::ToInt($_REQUEST['projectid'])) === null) {
return PrintPermissionDenied();
}
if (($days = DCL_Sanitize::ToInt($_REQUEST['days'])) === null) {
return PrintPermissionDenied();
}
if (($endon = DCL_Sanitize::ToDate($_REQUEST['endon'])) === null) {
return PrintPermissionDenied();
}
$oDate = new DCLDate();
$oDate->SetFromDisplay($endon);
$endon = $oDate->ToDB();
$oDate->time = mktime(0, 0, 0, date('m', $oDate->time), date('d', $oDate->time) - $days, date('Y', $oDate->time));
$beginon = $oDate->ToDB();
$sSQL = '';
if (isset($_REQUEST['scope'])) {
$sSQL = $this->GetScopeSQL($id, $beginon, $endon);
}
if (isset($_REQUEST['timecards'])) {
if ($sSQL != '') {
$sSQL .= ' UNION ALL ';
}
$sSQL .= $this->GetTimeCardSQL($id, $beginon, $endon);
}
if (isset($_REQUEST['code'])) {
if ($sSQL != '') {
$sSQL .= ' UNION ALL ';
}
$sSQL .= $this->GetWorkOrderCodeSQL($id, $beginon, $endon);
$sSQL .= ' UNION ALL ';
$sSQL .= $this->GetProjectCodeSQL($id, $beginon, $endon);
}
if ($sSQL == '') {
ShowError('No options selected.', __FILE__, __LINE__, null);
return;
}
$sSQL .= ' ORDER BY 2 DESC';
$oDB = new dclDB();
if ($oDB->Query($sSQL) !== -1) {
$aResults = array();
while ($oDB->next_record()) {
$aRecord = array();
$aRecord[] = $oDB->FormatDateForDisplay($oDB->f(1));
$oDB->objTimestamp->SetFromDB($oDB->f(1));
$aRecord[] = $oDB->objTimestamp->ToTimeOnly();
if ($oDB->f(0) == 4) {
$aRecord[] = '<a href="' . menuLink('', 'menuAction=boProjects.viewproject&project=' . $id) . '">[' . $id . '] ' . htmlspecialchars($oDB->f(5)) . '</a>';
} else {
$aRecord[] = '<a href="' . menuLink('', 'menuAction=boWorkorders.viewjcn&jcn=' . $oDB->f(2) . '&seq=' . $oDB->f(3)) . '">[' . $oDB->f(2) . '-' . $oDB->f(3) . '] ' . htmlspecialchars($oDB->f(6)) . '</a>';
}
$aRecord[] = $oDB->f(7);
$aRecord[] = $oDB->f(8);
$aRecord[] = $oDB->f(9);
$aResults[] = $aRecord;
}
$oTable =& CreateObject('dcl.htmlTable');
$oTable->setCaption('Project Timeline');
$oTable->addColumn('Date', 'string');
$oTable->addColumn('Time', 'string');
$oTable->addColumn('Item', 'html');
$oTable->addColumn('Current Status', 'string');
$oTable->addColumn('Action By', 'string');
$oTable->addColumn('Action Description', 'string');
$oTable->addGroup(0);
$oTable->setData($aResults);
$oTable->setShowRownum(true);
$oTable->render();
}
}
示例9: execute
function execute()
{
commonHeader();
if (($begindate = DCL_Sanitize::ToDate($_REQUEST['begindate'])) === null || ($enddate = DCL_Sanitize::ToDate($_REQUEST['enddate'])) === null || ($responsible = DCL_Sanitize::ToInt($_REQUEST['responsible'])) === null) {
trigger_error('All fields are required.');
$this->GetParameters(false);
return;
}
$oMeta =& CreateObject('dcl.DCL_MetadataDisplay');
$obj = CreateObject('dcl.dbTickets');
$objT = CreateObject('dcl.dbTicketresolutions');
$sColumns = $obj->SelectAllColumns('a.');
$query = 'select ' . $sColumns . ' from tickets a, ticketresolutions b where a.ticketid=b.ticketid and b.loggedby=' . $responsible;
$query .= ' and b.loggedon between ' . $obj->DisplayToSQL($begindate . ' 00:00:00') . ' and ' . $obj->DisplayToSQL($enddate . ' 23:59:59');
$query .= ' order by a.ticketid';
if ($obj->Query($query) != -1) {
if ($obj->next_record()) {
$arrayIndex = -1;
$count = 0;
$prevTicketID = -1;
do {
$obj->GetRow();
if ($obj->ticketid != $prevTicketID) {
$prevTicketID = $obj->ticketid;
$arrayIndex++;
$reportArray[$arrayIndex][0] = $oMeta->GetProduct($obj->product);
$aOrg = $oMeta->GetOrganization($obj->account);
$reportArray[$arrayIndex][1] = $aOrg['name'];
$reportArray[$arrayIndex][2] = $oMeta->GetStatus($obj->status);
$reportArray[$arrayIndex][3] = $oMeta->GetPriority($obj->priority);
$reportArray[$arrayIndex][4] = $oMeta->GetSeverity($obj->type);
$reportArray[$arrayIndex][5] = $obj->createdon;
$reportArray[$arrayIndex][6] = $obj->closedon;
$reportArray[$arrayIndex][7] = 1;
$reportArray[$arrayIndex][8] = '<a href="' . menuLink('', 'menuAction=boTickets.view&ticketid=' . $obj->f('ticketid')) . '">[' . $obj->f('ticketid') . '] ' . htmlentities($obj->summary) . '</a>';
} else {
$reportArray[$arrayIndex][7]++;
}
$count++;
} while ($obj->next_record());
$oTable = CreateObject('dcl.htmlTable');
$oTable->addColumn(STR_TCK_PRODUCT, 'string');
$oTable->addColumn(STR_TCK_ACCOUNT, 'string');
$oTable->addColumn(STR_TCK_STATUS, 'string');
$oTable->addColumn(STR_TCK_PRIORITY, 'string');
$oTable->addColumn(STR_TCK_TYPE, 'string');
$oTable->addColumn(STR_TCK_CREATED, 'string');
$oTable->addColumn(STR_TCK_CLOSED, 'string');
$oTable->addColumn('Calls', 'string');
$oTable->addColumn(STR_TCK_SUMMARY, 'html');
$oTable->setCaption(sprintf(STR_WOST_ACTIVITYTITLE, $oMeta->GetPersonnel($responsible), $begindate, $enddate));
$oTable->setData($reportArray);
$oTable->setShowRownum(true);
$oTable->render();
} else {
trigger_error(STR_WOST_NOACTIVITY, E_USER_NOTICE);
}
} else {
trigger_error(STR_WOST_QUERYERR, E_USER_ERROR);
}
}
示例10: dbsearch
function dbsearch()
{
commonHeader();
$personnel = isset($_REQUEST['personnel']) && is_array($_REQUEST['personnel']) ? $_REQUEST['personnel'] : array();
$type = @DCL_Sanitize::ToIntArray($_REQUEST['type']);
$priority = @DCL_Sanitize::ToIntArray($_REQUEST['priority']);
$status = @$_REQUEST['status'];
$account = @DCL_Sanitize::ToIntArray($_REQUEST['account']);
$is_public = @$_REQUEST['is_public'];
$entity_source_id = @DCL_Sanitize::ToIntArray($_REQUEST['entity_source_id']);
$createdon = @$_REQUEST['createdon'];
$closedon = @$_REQUEST['closedon'];
$statuson = @$_REQUEST['statuson'];
$lastactionon = @$_REQUEST['lastactionon'];
$module_id = isset($_REQUEST['module_id']) && is_array($_REQUEST['module_id']) ? $_REQUEST['module_id'] : array();
$tags = $_REQUEST['tags'];
$searchText = $_REQUEST['searchText'];
$columns = $_REQUEST['columns'];
$groups = $_REQUEST['groups'];
$order = $_REQUEST['order'];
$columnhdrs = $_REQUEST['columnhdrs'];
$dcl_status_type = @DCL_Sanitize::ToIntArray($_REQUEST['dcl_status_type']);
$product = @DCL_Sanitize::ToIntArray($_REQUEST['product']);
$department = @DCL_Sanitize::ToIntArray($_REQUEST['department']);
$dateFrom = DCL_Sanitize::ToDate($_REQUEST['dateFrom']);
$dateTo = DCL_Sanitize::ToDate($_REQUEST['dateTo']);
$oDB = new dclDB();
if (strlen($columnhdrs) > 0) {
$columnhdrs = explode(',', $columnhdrs);
} else {
$columnhdrs = array();
}
if (strlen($columns) > 0) {
$columns = explode(',', $columns);
} else {
$columns = array();
}
if (strlen($groups) > 0) {
$groups = explode(',', $groups);
} else {
$groups = array();
}
if (strlen($order) > 0) {
$order = explode(',', $order);
} else {
$order = array();
}
$objView =& CreateObject('dcl.boView');
$objView->table = 'tickets';
if (count($personnel) > 0 || count($department) > 0) {
$fieldList = array('responsible', 'createdby', 'closedby');
$bStrippedDepartments = false;
$pers_sel = array();
foreach ($fieldList as $field) {
if (!isset($_REQUEST[$field]) || $_REQUEST[$field] != '1') {
continue;
}
if (count($personnel) > 0) {
if (!$bStrippedDepartments) {
$bStrippedDepartments = true;
// Have actual personnel? If so, only set personnel for their associated departments instead of the department
// then unset the department from the array
foreach ($personnel as $encoded_pers) {
list($dpt_id, $pers_id) = explode(',', $encoded_pers);
$pers_sel[count($pers_sel)] = $pers_id;
if (count($department) > 0 && in_array($dpt_id, $department)) {
foreach ($department as $key => $department_id) {
if ($department_id == $dpt_id) {
unset($department[$key]);
break;
}
}
}
}
}
$pers_sel = DCL_Sanitize::ToIntArray($pers_sel);
if (count($pers_sel) > 0) {
$objView->AddDef('filter', $field, $pers_sel);
}
}
if (count($department) > 0) {
$objView->AddDef('filter', $field . '.department', $department);
}
}
}
$fieldList = array('priority', 'type', 'account', 'entity_source_id');
while (list($key, $field) = each($fieldList)) {
${$field} = DCL_Sanitize::ToIntArray(${$field});
if (count(${$field}) > 0) {
$objView->AddDef('filter', $field, ${$field});
}
}
if (trim($tags) != '') {
$objView->AddDef('filter', 'dcl_tag.tag_desc', $tags);
}
if (count($is_public) > 0) {
foreach ($is_public as $publicValue) {
$objView->AddDef('filter', 'is_public', $oDB->Quote(DCL_Sanitize::ToYN($publicValue)));
}
}
//.........这里部分代码省略.........