本文整理汇总了PHP中DCL_Sanitize::ToIntArray方法的典型用法代码示例。如果您正苦于以下问题:PHP DCL_Sanitize::ToIntArray方法的具体用法?PHP DCL_Sanitize::ToIntArray怎么用?PHP DCL_Sanitize::ToIntArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DCL_Sanitize
的用法示例。
在下文中一共展示了DCL_Sanitize::ToIntArray方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dbmap
function dbmap()
{
global $g_oSec;
commonHeader();
if (!$g_oSec->HasPerm(DCL_ENTITY_ATTRIBUTESETS, DCL_PERM_MODIFY)) {
return PrintPermissionDenied();
}
if (($iSetID = @DCL_Sanitize::ToInt($_REQUEST['setid'])) === null) {
trigger_error('Data sanitize failed.');
return;
}
if (($iTypeID = @DCL_Sanitize::ToInt($_REQUEST['typeid'])) === null) {
trigger_error('Data sanitize failed.');
return;
}
$obj =& CreateObject('dcl.dbAttributesetsmap');
$obj->setid = $iSetID;
$obj->typeid = $iTypeID;
$obj->BeginTransaction();
$obj->DeleteBySetType($iSetID, $iTypeID);
if (($aKeyID = @DCL_Sanitize::ToIntArray($_REQUEST['keyidset'])) !== null) {
$i = 1;
foreach ($aKeyID as $id) {
$obj->weight = $i;
$obj->keyid = $id;
$obj->Add();
$i++;
}
}
$obj->EndTransaction();
$objA =& CreateObject('dcl.dbAttributesets');
$objA->Load($obj->setid);
$objH =& CreateObject('dcl.htmlAttributesetdetail');
$objH->Show($objA);
}
示例2: ListSelected
function ListSelected($id)
{
if (($id = @DCL_Sanitize::ToIntArray($id)) === null) {
trigger_error('Data sanitize failed.');
return;
}
$sSQL = 'SELECT org_id, name FROM dcl_org WHERE org_id IN (' . join(',', $id) . ') ORDER BY name';
return $this->oDB->Query($sSQL);
}
示例3: updateOrgs
function updateOrgs($contact_id, &$aOrgID)
{
if (($contact_id = DCL_Sanitize::ToInt($contact_id)) === null) {
return PrintPermissionDenied();
}
$aOrgID = DCL_Sanitize::ToIntArray($aOrgID);
if ($aOrgID === null || count($aOrgID) == 0) {
$aOrgID = array("-1");
}
$sOrgID = join(',', $aOrgID);
$this->Execute("DELETE FROM dcl_org_contact WHERE contact_id = {$contact_id} AND org_id NOT IN ({$sOrgID})");
$this->Execute("INSERT INTO dcl_org_contact (org_id, contact_id, created_on, created_by) SELECT org_id, {$contact_id}, " . $this->GetDateSQL() . ", " . $GLOBALS['DCLID'] . " FROM dcl_org WHERE org_id IN ({$sOrgID}) AND org_id NOT IN (SELECT org_id FROM dcl_org_contact WHERE contact_id = {$contact_id})");
}
示例4: updateProducts
function updateProducts($org_id, &$aProductID)
{
if (($org_id = DCL_Sanitize::ToInt($org_id)) === null) {
return PrintPermissionDenied();
}
$aProductID = DCL_Sanitize::ToIntArray($aProductID);
if ($aProductID === null || count($aProductID) == 0) {
$aProductID = array("-1");
}
$sProductID = join(',', $aProductID);
$this->Execute("DELETE FROM dcl_org_product_xref WHERE org_id = {$org_id} AND product_id NOT IN ({$sProductID})");
$this->Execute("INSERT INTO dcl_org_product_xref (org_id, product_id) SELECT {$org_id}, id FROM products WHERE id IN ({$sProductID}) AND id NOT IN (SELECT product_id FROM dcl_org_product_xref WHERE org_id = {$org_id})");
}
示例5: submitModify
function submitModify()
{
global $g_oSec;
commonHeader();
if (($id = DCL_Sanitize::ToInt($_REQUEST['contact_id'])) === null) {
trigger_error('Data sanitize failed.');
return;
}
if (!$g_oSec->HasPerm(DCL_ENTITY_CONTACT, DCL_PERM_MODIFY, $id)) {
return PrintPermissionDenied();
}
CleanArray($_REQUEST);
$aOrgs = @DCL_Sanitize::ToIntArray($_REQUEST['org_id']);
$oDbContact = CreateObject('dcl.dbOrgContact');
$oDbContact->updateOrgs($id, $aOrgs);
$oContact = CreateObject('dcl.htmlContactDetail');
$oContact->show();
}
示例6: GetProductArray
function GetProductArray($aOrgID)
{
if (($aOrgID = DCL_Sanitize::ToIntArray($aOrgID)) === null) {
trigger_error('Data sanitize failed.');
return -1;
}
$aRetVal = array();
$sOrgID = '-1';
if (count($aOrgID) > 0) {
$sOrgID = join(',', $aOrgID);
}
$sSQL = "SELECT DISTINCT product_id FROM dcl_org_product_xref WHERE org_id IN ({$sOrgID})";
if ($this->Query($sSQL) != -1) {
while ($this->next_record()) {
$aRetVal[] = $this->f(0);
}
}
return $aRetVal;
}
示例7: savePriority
function savePriority()
{
global $g_oSec;
commonHeader();
if (!$g_oSec->HasPerm(DCL_ENTITY_HOTLIST, DCL_PERM_MODIFY)) {
return PrintPermissionDenied();
}
$hotlistId = @DCL_Sanitize::ToInt($_POST['hotlist_id']);
if ($hotlistId === null || $hotlistId < 1) {
return PrintPermissionDenied();
}
$dbHotlist = CreateObject('dcl.dbHotlist');
if ($dbHotlist->Load($hotlistId) === -1) {
return PrintPermissionDenied();
}
$aEntities = array();
foreach ($_REQUEST['item'] as $entity) {
$aEntity = @DCL_Sanitize::ToIntArray(split('_', $entity));
if (count($aEntity) === 3) {
$aEntities[] = $aEntity;
}
}
$db = CreateObject('dcl.dbEntityHotlist');
$db->setPriority($hotlistId, $aEntities);
}
示例8: ShowUserVsProductStatus
function ShowUserVsProductStatus()
{
global $dcl_info, $g_oSec;
commonHeader();
if (!$g_oSec->HasPerm(DCL_ENTITY_WORKORDER, DCL_PERM_VIEW)) {
return PrintPermissionDenied();
}
$objProduct = CreateObject('dcl.dbProducts');
$objPersonnel = CreateObject('dcl.dbPersonnel');
$objStatuses = CreateObject('dcl.dbStatuses');
$objWorkorders = CreateObject('dcl.dbWorkorders');
$products = @DCL_Sanitize::ToIntArray($_REQUEST['products']);
$people = @DCL_Sanitize::ToIntArray($_REQUEST['people']);
$begindate = @DCL_Sanitize::ToDate($_REQUEST['begindate']);
$enddate = @DCL_Sanitize::ToDate($_REQUEST['enddate']);
if (count($products) < 1) {
$query = 'SELECT id FROM products ORDER BY name';
$objProduct->Query($query);
$products = array();
while ($objProduct->next_record()) {
$products[count($products)] = $objProduct->f(0);
}
$objProduct->FreeResult();
}
$doingClosed = FALSE;
if ($begindate !== null) {
$doingClosed = TRUE;
}
if ($enddate !== null) {
$doingClosed = TRUE;
}
$query = 'SELECT id FROM statuses WHERE dcl_status_type ';
if ($doingClosed) {
$query .= '= 2';
} else {
$query .= '!= 2';
}
$objStatuses->Query($query);
$statii = array();
while ($objStatuses->next_record()) {
$statii[count($statii)] = $objStatuses->f(0);
}
$objStatuses->FreeResult();
if (count($people) < 1) {
$idWhere = 'id > 1';
} else {
$idWhere = 'id in (';
for ($i = 0; $i < count($people); $i++) {
if ($i > 0) {
$idWhere .= ',';
}
$idWhere .= $people[$i];
}
$idWhere .= ')';
}
$query = 'select distinct p.id, p.short from personnel p join dcl_user_role ur on p.id = ur.personnel_id ';
$query .= 'join dcl_role_perm rp on ur.role_id = rp.role_id where ((entity_id = ';
$query .= DCL_ENTITY_WORKORDER . ' and perm_id = ' . DCL_PERM_ACTION . ') or (entity_id = ';
$query .= DCL_ENTITY_GLOBAL . ' and perm_id = ' . DCL_PERM_ADMIN . ')) ORDER BY short';
$objPersonnel->Query($query);
$person = array();
while ($objPersonnel->next_record()) {
$person[count($person)] = $objPersonnel->f(0);
}
$objPersonnel->FreeResult();
$query = 'SELECT product,status,responsible,';
if ($doingClosed) {
$query .= 'totalhours';
} else {
$query .= 'esthours';
}
$query .= ' FROM workorders, statuses WHERE workorders.status = statuses.id AND statuses.dcl_status_type ';
if ($doingClosed) {
$query .= '= 2';
if ($begindate != '' && $enddate != '') {
$query .= ' AND closedon between ' . $objWorkorders->DisplayToSQL($begindate . ' 00:00:00') . ' AND ' . $objWorkorders->DisplayToSQL($enddate . ' 23:59:59');
} else {
if ($begindate != '') {
$query .= ' AND closedon >=' . $objWorkorders->DisplayToSQL($begindate . ' 00:00:00');
} else {
if ($enddate != '') {
$query .= ' AND closedon <=' . $objWorkorders->DisplayToSQL($enddate . ' 23:59:59');
}
}
}
} else {
$query .= '!= 2';
}
$objWorkorders->Query($query);
for ($i = 0; $i < count($products) * count($statii) + count($statii) + 1; $i++) {
for ($j = 0; $j < count($person) + 2; $j++) {
$myArrayHours[$i][$j] = 0.0;
$myArrayUnits[$i][$j] = 0;
}
}
while ($objWorkorders->next_record()) {
$thisProduct = -1;
$thisStatus = -1;
$thisPerson = -1;
$bFound = false;
//.........这里部分代码省略.........
示例9: dbsearch
function dbsearch()
{
global $g_oSec, $g_oSession;
commonHeader();
$personnel = isset($_REQUEST['personnel']) && is_array($_REQUEST['personnel']) ? $_REQUEST['personnel'] : array();
$status = @$_REQUEST['status'];
$is_public = @$_REQUEST['is_public'];
$createdon = @$_REQUEST['createdon'];
$closedon = @$_REQUEST['closedon'];
$statuson = @$_REQUEST['statuson'];
$lastactionon = @$_REQUEST['lastactionon'];
$deadlineon = @$_REQUEST['deadlineon'];
$eststarton = @$_REQUEST['eststarton'];
$estendon = @$_REQUEST['estendon'];
$starton = @$_REQUEST['starton'];
$module_id = isset($_REQUEST['module_id']) && is_array($_REQUEST['module_id']) ? $_REQUEST['module_id'] : array();
$searchText = $_REQUEST['searchText'];
$tags = $_REQUEST['tags'];
$hotlist = $_REQUEST['hotlist'];
$columns = $_REQUEST['columns'];
$groups = $_REQUEST['groups'];
$order = $_REQUEST['order'];
$columnhdrs = $_REQUEST['columnhdrs'];
$account = @DCL_Sanitize::ToIntArray($_REQUEST['account']);
$entity_source_id = @DCL_Sanitize::ToIntArray($_REQUEST['entity_source_id']);
$severity = @DCL_Sanitize::ToIntArray($_REQUEST['severity']);
$priority = @DCL_Sanitize::ToIntArray($_REQUEST['priority']);
$dcl_status_type = @DCL_Sanitize::ToIntArray($_REQUEST['dcl_status_type']);
$product = @DCL_Sanitize::ToIntArray($_REQUEST['product']);
$department = @DCL_Sanitize::ToIntArray($_REQUEST['department']);
$project = @DCL_Sanitize::ToIntArray($_REQUEST['project']);
$wo_type_id = @DCL_Sanitize::ToIntArray($_REQUEST['wo_type_id']);
$dateFrom = DCL_Sanitize::ToDate($_REQUEST['dateFrom']);
$dateTo = DCL_Sanitize::ToDate($_REQUEST['dateTo']);
if (!$g_oSec->HasPerm(DCL_ENTITY_WORKORDER, DCL_PERM_SEARCH)) {
return PrintPermissionDenied();
}
$objView = CreateObject('dcl.boView');
$objView->table = 'workorders';
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();
}
if (count($personnel) > 0 || count($department) > 0) {
$fieldList = array('responsible', 'createby', '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', 'severity', 'wo_type_id', 'entity_source_id');
foreach ($fieldList as $field) {
if (count(${$field}) > 0) {
$objView->AddDef('filter', $field, ${$field});
}
//.........这里部分代码省略.........
示例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)));
}
}
//.........这里部分代码省略.........
示例11: doMerge
function doMerge()
{
global $g_oSec;
commonHeader();
if (($iContactID = DCL_Sanitize::ToInt($_REQUEST['contact_id'])) === null || ($aMergeContacts = DCL_Sanitize::ToIntArray($_REQUEST['merge_contact_id'])) === null) {
trigger_error('Data sanitize failed.');
return;
}
if (!$g_oSec->HasPerm(DCL_ENTITY_CONTACT, DCL_PERM_MODIFY)) {
return PrintPermissionDenied();
}
foreach ($aMergeContacts as $key => $value) {
$aMergeContacts[$key] = (int) $value;
if ($aMergeContacts[$key] == $iContactID) {
unset($aMergeContacts[$key]);
}
}
if (count($aMergeContacts) > 0) {
$sMergeContacts = join($aMergeContacts, ',');
// Merge orgs
$sSQL = 'SELECT org_id FROM dcl_org_contact WHERE contact_id IN (' . $sMergeContacts . ')';
$oDB =& CreateObject('dcl.dbOrgContact');
$oDB2 =& CreateObject('dcl.dbOrgContact');
$oDB->BeginTransaction();
if ($oDB->Query($sSQL) == -1) {
$oDB->RollbackTransaction();
return;
}
while ($oDB->next_record()) {
$sSQL = 'SELECT 1 FROM dcl_org_contact WHERE contact_id = ' . $iContactID . ' AND org_id = ' . $oDB->f(0);
if ($oDB2->Query($sSQL) == -1) {
$oDB->RollbackTransaction();
return;
}
if (!$oDB2->next_record()) {
$oDB2->contact_id = $iContactID;
$oDB2->org_id = $oDB->f(0);
$oDB2->created_on = DCL_NOW;
$oDB2->created_by = $GLOBALS['DCLID'];
$oDB2->Add();
}
}
if ($oDB2->Execute('DELETE FROM dcl_org_contact WHERE contact_id IN (' . $sMergeContacts . ')') == -1) {
$oDB->RollbackTransaction();
return;
}
// Merge phone numbers
if ($oDB2->Execute("UPDATE dcl_contact_phone SET contact_id = {$iContactID}, preferred = 'N' WHERE contact_id IN ({$sMergeContacts})") == -1) {
$oDB->RollbackTransaction();
return;
}
// Merge email addresses
if ($oDB2->Execute("UPDATE dcl_contact_email SET contact_id = {$iContactID}, preferred = 'N' WHERE contact_id IN ({$sMergeContacts})") == -1) {
$oDB->RollbackTransaction();
return;
}
// Merge addresses
if ($oDB2->Execute("UPDATE dcl_contact_addr SET contact_id = {$iContactID}, preferred = 'N' WHERE contact_id IN ({$sMergeContacts})") == -1) {
$oDB->RollbackTransaction();
return;
}
// Merge URLs
if ($oDB2->Execute("UPDATE dcl_contact_url SET contact_id = {$iContactID}, preferred = 'N' WHERE contact_id IN ({$sMergeContacts})") == -1) {
$oDB->RollbackTransaction();
return;
}
// Merge notes
//$oDB2->Execute('UPDATE dcl_contact_notes SET contact_id = ' . $iContactID . ' WHERE contact_id IN (' . $sMergeContacts . ')');
// Merge work orders
if ($oDB2->Execute('UPDATE workorders SET contact_id = ' . $iContactID . ' WHERE contact_id IN (' . $sMergeContacts . ')') == -1) {
$oDB->RollbackTransaction();
return;
}
// Merge tickets
if ($oDB2->Execute('UPDATE tickets SET contact_id = ' . $iContactID . ' WHERE contact_id IN (' . $sMergeContacts . ')') == -1) {
$oDB->RollbackTransaction();
return;
}
// Merge users
if ($oDB2->Execute('UPDATE personnel SET contact_id = ' . $iContactID . ' WHERE contact_id IN (' . $sMergeContacts . ')') == -1) {
$oDB->RollbackTransaction();
return;
}
if ($oDB2->Execute('DELETE FROM dcl_contact WHERE contact_id IN (' . $sMergeContacts . ')') == -1) {
$oDB->RollbackTransaction();
return;
}
$oDB->EndTransaction();
}
if (isset($_REQUEST['chainMenuAction']) && $_REQUEST['chainMenuAction'] == 'htmlContactBrowse.Page') {
$oCD =& CreateObject('dcl.htmlContactBrowse');
$oCD->Page();
} else {
$oDetail =& CreateObject('dcl.htmlContactDetail');
$oDetail->show();
}
}
示例12: 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();
}
示例13: dbmodify
function dbmodify()
{
global $g_oSec;
commonHeader();
if (!$g_oSec->HasPerm(DCL_ENTITY_PERSONNEL, DCL_PERM_MODIFY)) {
return PrintPermissionDenied();
}
$obj =& CreateObject('dcl.dbPersonnel');
$obj->InitFromGlobals();
if (isset($_REQUEST['active'])) {
$obj->active = 'Y';
} else {
$obj->active = 'N';
}
$obj->Edit();
$oUserRole =& CreateObject('dcl.dbUserRole');
$oUserRole->DeleteGlobalRolesNotIn($obj->id);
$aRoles = @DCL_Sanitize::ToIntArray($_REQUEST['roles']);
if (count($aRoles) > 0) {
// Set up global user roles
$oUserRole->personnel_id = $obj->id;
$oUserRole->entity_type_id = DCL_ENTITY_GLOBAL;
$oUserRole->entity_id1 = 0;
$oUserRole->entity_id2 = 0;
foreach ($aRoles as $oUserRole->role_id) {
$oUserRole->add();
}
}
$oBrowse =& CreateObject('dcl.htmlPersonnelBrowse');
$oBrowse->show();
}
示例14: Render
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();
}
示例15: listById
function listById($sID, $includeClosed = true)
{
global $g_oSec, $g_oSession;
if ($g_oSec->IsPublicUser() || $sID == '-1') {
PrintPermissionDenied();
return -1;
}
$aHotlists = @DCL_Sanitize::ToIntArray($sID);
$iHotlistCount = count($aHotlists);
if ($iHotlistCount === 0) {
return PrintPermissionDenied();
}
$sID = join(',', $aHotlists);
$bMultiHotlist = $iHotlistCount > 1;
$sSQL = '';
$bDoneDidWhere = false;
if ($g_oSec->HasPerm(DCL_ENTITY_WORKORDER, DCL_PERM_SEARCH)) {
$sSQL = 'SELECT ' . DCL_ENTITY_WORKORDER . ' as entity_id, workorders.jcn, workorders.seq, workorders.summary, statuses.name, R.short AS responsible, personnel.short, timecards.summary, dcl_entity_hotlist.sort FROM ';
if ($bMultiHotlist) {
$sSQL .= '(SELECT entity_key_id, entity_key_id2 FROM dcl_entity_hotlist WHERE entity_id = ' . DCL_ENTITY_WORKORDER . " AND hotlist_id IN ({$sID}) GROUP BY entity_key_id, entity_key_id2 HAVING COUNT(*) = {$iHotlistCount}) hotlist_matches ";
$sSQL .= $this->JoinKeyword . ' workorders ON hotlist_matches.entity_key_id = workorders.jcn AND hotlist_matches.entity_key_id2 = workorders.seq ';
$sSQL .= $this->JoinKeyword . ' statuses ON workorders.status = statuses.id ';
$sSQL .= $this->JoinKeyword . ' personnel R ON workorders.responsible = R.id ';
$sSQL .= 'LEFT JOIN timecards ON workorders.jcn = timecards.jcn AND workorders.seq = timecards.seq AND timecards.id = (select max(id) from timecards where jcn = workorders.jcn AND seq = workorders.seq) ';
$sSQL .= 'LEFT JOIN personnel ON timecards.actionby = personnel.id ';
if (!$includeClosed) {
$sSQL .= "WHERE statuses.dcl_status_type != 2";
$bDoneDidWhere = true;
}
if ($g_oSec->IsPublicUser()) {
if ($bDoneDidWhere) {
$sSQL .= ' AND ';
} else {
$sSQL .= ' WHERE ';
$bDoneDidWhere = true;
}
$sSQL .= "workorders.is_public = 'Y'";
}
} else {
$sSQL .= 'dcl_entity_hotlist JOIN workorders ON dcl_entity_hotlist.entity_id = ' . DCL_ENTITY_WORKORDER . ' AND dcl_entity_hotlist.entity_key_id = workorders.jcn AND dcl_entity_hotlist.entity_key_id2 = workorders.seq ';
$sSQL .= $this->JoinKeyword . ' statuses ON workorders.status = statuses.id ';
$sSQL .= $this->JoinKeyword . ' personnel R ON workorders.responsible = R.id ';
$sSQL .= 'LEFT JOIN timecards ON workorders.jcn = timecards.jcn AND workorders.seq = timecards.seq AND timecards.id = (select max(id) from timecards where jcn = workorders.jcn AND seq = workorders.seq) ';
$sSQL .= 'LEFT JOIN personnel ON timecards.actionby = personnel.id ';
$sSQL .= "WHERE dcl_entity_hotlist.hotlist_id = {$sID}";
$bDoneDidWhere = true;
if (!$includeClosed) {
$sSQL .= " AND statuses.dcl_status_type != 2";
$bDoneDidWhere = true;
}
if ($g_oSec->IsPublicUser()) {
$sSQL .= " AND workorders.is_public = 'Y'";
}
}
$sAccountSQL = '';
if ($g_oSec->IsOrgUser()) {
$sOrgs = $g_oSession->Value('member_of_orgs');
if ($sOrgs == '') {
$sOrgs = '-1';
}
$sAccountSQL = "((workorders.jcn in (select wo_id from dcl_wo_account where account_id in ({$sOrgs})))";
$sAccountSQL .= " AND (workorders.seq in (select seq from dcl_wo_account where workorders.jcn = wo_id And account_id in ({$sOrgs}))";
$sAccountSQL .= '))';
}
if ($g_oSec->HasPerm(DCL_ENTITY_WORKORDER, DCL_PERM_VIEWSUBMITTED)) {
if ($bDoneDidWhere == false) {
$bDoneDidWhere = true;
$sSQL .= ' WHERE ';
} else {
$sSQL .= ' AND ';
}
$sSQL .= '(workorders.createby = ' . $GLOBALS['DCLID'];
$sSQL .= ' OR workorders.contact_id = ' . $g_oSession->Value('contact_id');
if ($sAccountSQL != '') {
$sSQL .= ' OR ' . $sAccountSQL;
}
$sSQL .= ')';
} else {
if ($sAccountSQL != '') {
if ($bDoneDidWhere == false) {
$bDoneDidWhere = true;
$sSQL .= ' WHERE ';
} else {
$sSQL .= ' AND ';
}
$sSQL .= $sAccountSQL;
}
}
}
if ($g_oSec->HasPerm(DCL_ENTITY_TICKET, DCL_PERM_SEARCH)) {
if ($sSQL != '') {
$sSQL .= ' UNION ALL ';
}
$sSQL .= 'SELECT ' . DCL_ENTITY_TICKET . ' as entity_id, tickets.ticketid, 0, tickets.summary, R.short AS responsible, NULL, NULL, NULL, dcl_entity_hotlist.sort FROM ';
if ($bMultiHotlist) {
$sSQL .= '(SELECT entity_key_id, entity_key_id2 FROM dcl_entity_hotlist WHERE entity_id = ' . DCL_ENTITY_TICKET . " AND hotlist_id IN ({$sID}) GROUP BY entity_key_id, entity_key_id2 HAVING COUNT(*) = {$iHotlistCount}) hotlist_matches ";
$sSQL .= $this->JoinKeyword . ' tickets ON hotlist_matches.entity_key_id = tickets.ticketid ';
$sSQL .= $this->JoinKeyword . ' statuses ON tickets.status = statuses.id ';
$sSQL .= $this->JoinKeyword . ' personnel R ON tickets.responsible = R.id ';
if (!$includeClosed) {
//.........这里部分代码省略.........