public static function getTaskServiceList($taskId, $userId) { return \CBPTaskService::getList(array(), array("ID" => $taskId, "USER_ID" => $userId), false, false, array("ID", "WORKFLOW_ID", "ACTIVITY", "ACTIVITY_NAME", "MODIFIED", "OVERDUE_DATE", "NAME", "DESCRIPTION", "PARAMETERS")); }
/** * @param array $params Input params. * @param int $n Offset. * @param \CRestServer $server Rest server instance. * @return array * @throws AccessException */ public static function getTaskList($params, $n, $server) { global $USER; self::checkAdminPermissions(); $params = array_change_key_case($params, CASE_UPPER); $fields = array('ID' => 'ID', 'WORKFLOW_ID' => 'WORKFLOW_ID', 'DOCUMENT_NAME' => 'DOCUMENT_NAME', 'DESCRIPTION' => 'DESCRIPTION', 'NAME' => 'NAME', 'MODIFIED' => 'MODIFIED', 'WORKFLOW_STARTED' => 'WORKFLOW_STARTED', 'WORKFLOW_STARTED_BY' => 'WORKFLOW_STARTED_BY', 'OVERDUE_DATE' => 'OVERDUE_DATE', 'WORKFLOW_TEMPLATE_ID' => 'WORKFLOW_TEMPLATE_ID', 'WORKFLOW_TEMPLATE_NAME' => 'WORKFLOW_TEMPLATE_NAME', 'WORKFLOW_STATE' => 'WORKFLOW_STATE', 'STATUS' => 'STATUS', 'USER_ID' => 'USER_ID', 'USER_STATUS' => 'USER_STATUS', 'MODULE_ID' => 'MODULE_ID', 'ENTITY' => 'ENTITY', 'DOCUMENT_ID' => 'DOCUMENT_ID'); $select = static::getSelect($params['SELECT'], $fields, array('ID', 'WORKFLOW_ID', 'DOCUMENT_NAME', 'NAME')); $select = array_merge(array('MODULE', 'ENTITY', 'DOCUMENT_ID'), $select); $filter = static::getFilter($params['FILTER'], $fields); $order = static::getOrder($params['ORDER'], $fields); $currentUserId = (int) $USER->getId(); $targetUserId = isset($filter['USER_ID']) ? (int) $filter['USER_ID'] : 0; if ($targetUserId !== $currentUserId && !\CBPHelper::checkUserSubordination($currentUserId, $targetUserId)) { self::checkAdminPermissions(); } $iterator = \CBPTaskService::getList($order, $filter, false, static::getNavData($n), $select); $result = array(); while ($row = $iterator->fetch()) { if (isset($row['MODIFIED'])) { $row['MODIFIED'] = \CRestUtil::convertDateTime($row['MODIFIED']); } if (isset($row['WORKFLOW_STARTED'])) { $row['WORKFLOW_STARTED'] = \CRestUtil::convertDateTime($row['WORKFLOW_STARTED']); } if (isset($row['OVERDUE_DATE'])) { $row['OVERDUE_DATE'] = \CRestUtil::convertDateTime($row['OVERDUE_DATE']); } $row['DOCUMENT_URL'] = \CBPDocument::getDocumentAdminPage(array($row['MODULE_ID'], $row['ENTITY'], $row['DOCUMENT_ID'])); $result[] = $row; } return $result; }