本文整理汇总了PHP中CustomView::resolveDateFilterValue方法的典型用法代码示例。如果您正苦于以下问题:PHP CustomView::resolveDateFilterValue方法的具体用法?PHP CustomView::resolveDateFilterValue怎么用?PHP CustomView::resolveDateFilterValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CustomView
的用法示例。
在下文中一共展示了CustomView::resolveDateFilterValue方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generateAdvFilterSql
//.........这里部分代码省略.........
$selectedfields = explode(":", $fieldcolname);
$moduleFieldLabel = $selectedfields[2];
list($moduleName, $fieldLabel) = explode('__', $moduleFieldLabel, 2);
$fieldInfo = getFieldByReportLabel($moduleName, $fieldLabel);
$concatSql = getSqlForNameInDisplayFormat(array('first_name' => $selectedfields[0] . ".first_name", 'last_name' => $selectedfields[0] . ".last_name"), 'Users');
// Added to handle the crmentity table name for Primary module
if ($selectedfields[0] == "vtiger_crmentity" . $this->primarymodule) {
$selectedfields[0] = "vtiger_crmentity";
}
//Added to handle yes or no for checkbox field in reports advance filters. -shahul
if ($selectedfields[4] == 'C') {
if (strcasecmp(trim($value), "yes") == 0) {
$value = "1";
}
if (strcasecmp(trim($value), "no") == 0) {
$value = "0";
}
}
if (in_array($comparator, $dateSpecificConditions)) {
$customView = new CustomView($moduleName);
$columninfo['stdfilter'] = $columninfo['comparator'];
$valueComponents = explode(',', $columninfo['value']);
if ($comparator == 'custom') {
if ($selectedfields[4] == 'DT') {
$startDateTimeComponents = explode(' ', $valueComponents[0]);
$endDateTimeComponents = explode(' ', $valueComponents[1]);
$columninfo['startdate'] = DateTimeField::convertToDBFormat($startDateTimeComponents[0]);
$columninfo['enddate'] = DateTimeField::convertToDBFormat($endDateTimeComponents[0]);
} else {
$columninfo['startdate'] = DateTimeField::convertToDBFormat($valueComponents[0]);
$columninfo['enddate'] = DateTimeField::convertToDBFormat($valueComponents[1]);
}
}
$dateFilterResolvedList = $customView->resolveDateFilterValue($columninfo);
$startDate = DateTimeField::convertToDBFormat($dateFilterResolvedList['startdate']);
$endDate = DateTimeField::convertToDBFormat($dateFilterResolvedList['enddate']);
$columninfo['value'] = $value = implode(',', array($startDate, $endDate));
$comparator = 'bw';
}
$valuearray = explode(",", trim($value));
$datatype = isset($selectedfields[4]) ? $selectedfields[4] : "";
if (isset($valuearray) && count($valuearray) > 1 && $comparator != 'bw') {
$advcolumnsql = "";
for ($n = 0; $n < count($valuearray); $n++) {
if (($selectedfields[0] == "vtiger_users" . $this->primarymodule || $selectedfields[0] == "vtiger_users" . $this->secondarymodule) && $selectedfields[1] == 'user_name') {
$module_from_tablename = str_replace("vtiger_users", "", $selectedfields[0]);
$advcolsql[] = " (trim({$concatSql})" . $this->getAdvComparator($comparator, trim($valuearray[$n]), $datatype) . " or vtiger_groups" . $module_from_tablename . ".groupname " . $this->getAdvComparator($comparator, trim($valuearray[$n]), $datatype) . ")";
$this->queryPlanner->addTable("vtiger_groups" . $module_from_tablename);
} elseif ($selectedfields[1] == 'status') {
//when you use comma seperated values.
if ($selectedfields[2] == 'Calendar_Status') {
$advcolsql[] = "(case when (vtiger_activity.status not like '') then vtiger_activity.status else vtiger_activity.eventstatus end)" . $this->getAdvComparator($comparator, trim($valuearray[$n]), $datatype);
} else {
if ($selectedfields[2] == 'HelpDesk_Status') {
$advcolsql[] = "vtiger_troubletickets.status" . $this->getAdvComparator($comparator, trim($valuearray[$n]), $datatype);
} else {
if ($selectedfields[2] == 'Faq_Status') {
$advcolsql[] = "vtiger_faq.status" . $this->getAdvComparator($comparator, trim($valuearray[$n]), $datatype);
} else {
$advcolsql[] = $selectedfields[0] . "." . $selectedfields[1] . $this->getAdvComparator($comparator, trim($valuearray[$n]), $datatype);
}
}
}
} elseif ($selectedfields[1] == 'description') {
//when you use comma seperated values.
if ($selectedfields[0] == 'vtiger_crmentity' . $this->primarymodule) {
示例2: parseAdvFilterList
public function parseAdvFilterList($advFilterList, $glue = '')
{
if (!empty($glue)) {
$this->addConditionGlue($glue);
}
$customView = new CustomView($this->module);
$dateSpecificConditions = $customView->getStdFilterConditions();
foreach ($advFilterList as $groupindex => $groupcolumns) {
$filtercolumns = $groupcolumns['columns'];
if (count($filtercolumns) > 0) {
$this->startGroup('');
foreach ($filtercolumns as $index => $filter) {
$nameComponents = explode(':', $filter['columnname']);
// For Events "End Date & Time" field datatype should be DT. But, db will give D for due_date field
if ($nameComponents[2] == 'due_date' && $nameComponents[3] == 'Events_End_Date_&_Time') {
$nameComponents[4] = 'DT';
}
if (empty($nameComponents[2]) && $nameComponents[1] == 'crmid' && $nameComponents[0] == 'vtiger_crmentity') {
$name = $this->getSQLColumn('id');
} else {
$name = $nameComponents[2];
}
if (($nameComponents[4] == 'D' || $nameComponents[4] == 'DT') && in_array($filter['comparator'], $dateSpecificConditions)) {
$filter['stdfilter'] = $filter['comparator'];
$valueComponents = explode(',', $filter['value']);
if ($filter['comparator'] == 'custom') {
if ($nameComponents[4] == 'DT') {
$startDateTimeComponents = explode(' ', $valueComponents[0]);
$endDateTimeComponents = explode(' ', $valueComponents[1]);
$filter['startdate'] = DateTimeField::convertToDBFormat($startDateTimeComponents[0]);
$filter['enddate'] = DateTimeField::convertToDBFormat($endDateTimeComponents[0]);
} else {
$filter['startdate'] = DateTimeField::convertToDBFormat($valueComponents[0]);
$filter['enddate'] = DateTimeField::convertToDBFormat($valueComponents[1]);
}
}
$dateFilterResolvedList = $customView->resolveDateFilterValue($filter);
// If datatype is DT then we should append time also
if ($nameComponents[4] == 'DT') {
$startdate = explode(' ', $dateFilterResolvedList['startdate']);
if ($startdate[1] == '') {
$startdate[1] = '00:00:00';
}
$dateFilterResolvedList['startdate'] = $startdate[0] . ' ' . $startdate[1];
$enddate = explode(' ', $dateFilterResolvedList['enddate']);
if ($enddate[1] == '') {
$enddate[1] = '23:59:59';
}
$dateFilterResolvedList['enddate'] = $enddate[0] . ' ' . $enddate[1];
}
$value = array();
$value[] = $this->fixDateTimeValue($name, $dateFilterResolvedList['startdate']);
$value[] = $this->fixDateTimeValue($name, $dateFilterResolvedList['enddate'], false);
$this->addCondition($name, $value, 'BETWEEN');
} else {
if ($nameComponents[4] == 'DT' && ($filter['comparator'] == 'e' || $filter['comparator'] == 'n')) {
$filter['stdfilter'] = $filter['comparator'];
$dateTimeComponents = explode(' ', $filter['value']);
$filter['startdate'] = DateTimeField::convertToDBFormat($dateTimeComponents[0]);
$filter['enddate'] = DateTimeField::convertToDBFormat($dateTimeComponents[0]);
$startDate = $this->fixDateTimeValue($name, $filter['startdate']);
$endDate = $this->fixDateTimeValue($name, $filter['enddate'], false);
$value = array();
$start = explode(' ', $startDate);
if ($start[1] == "") {
$startDate = $start[0] . ' ' . '00:00:00';
}
$end = explode(' ', $endDate);
if ($end[1] == "") {
$endDate = $end[0] . ' ' . '23:59:59';
}
$value[] = $startDate;
$value[] = $endDate;
if ($filter['comparator'] == 'n') {
$this->addCondition($name, $value, 'NOTEQUAL');
} else {
$this->addCondition($name, $value, 'BETWEEN');
}
} else {
if ($nameComponents[4] == 'DT' && ($filter['comparator'] == 'a' || $filter['comparator'] == 'b')) {
$dateTime = explode(' ', $filter['value']);
$date = DateTimeField::convertToDBFormat($dateTime[0]);
$value = array();
$value[] = $this->fixDateTimeValue($name, $date, false);
// Still fixDateTimeValue returns only date value, we need to append time because it is DT type
for ($i = 0; $i < count($value); $i++) {
$values = explode(' ', $value[$i]);
if ($values[1] == '') {
$values[1] = '00:00:00';
}
$value[$i] = $values[0] . ' ' . $values[1];
}
$this->addCondition($name, $value, $filter['comparator']);
} else {
$this->addCondition($name, $filter['value'], $filter['comparator']);
}
}
}
$columncondition = $filter['column_condition'];
if (!empty($columncondition)) {
//.........这里部分代码省略.........
示例3: showSearchResults
/**
* Function to display the Search Results
* @param Vtiger_Request $request
*/
function showSearchResults(Vtiger_Request $request)
{
$db = PearDatabase::getInstance();
$viewer = $this->getViewer($request);
$moduleName = $request->getModule();
$advFilterList = $request->get('advfilterlist');
//used to show the save modify filter option
$isAdvanceSearch = false;
$matchingRecords = array();
if (is_array($advFilterList) && count($advFilterList) > 0) {
$isAdvanceSearch = true;
$user = Users_Record_Model::getCurrentUserModel();
$queryGenerator = new QueryGenerator($moduleName, $user);
$queryGenerator->setFields(['id']);
vimport('~modules/CustomView/CustomView.php');
$customView = new CustomView($moduleName);
$dateSpecificConditions = $customView->getStdFilterConditions();
foreach ($advFilterList as $groupindex => $groupcolumns) {
$filtercolumns = $groupcolumns['columns'];
if (count($filtercolumns) > 0) {
$queryGenerator->startGroup('');
foreach ($filtercolumns as $index => $filter) {
$nameComponents = explode(':', $filter['columnname']);
if (empty($nameComponents[2]) && $nameComponents[1] == 'crmid' && $nameComponents[0] == 'vtiger_crmentity') {
$name = $queryGenerator->getSQLColumn('id');
} else {
$name = $nameComponents[2];
}
if (($nameComponents[4] == 'D' || $nameComponents[4] == 'DT') && in_array($filter['comparator'], $dateSpecificConditions)) {
$filter['stdfilter'] = $filter['comparator'];
$valueComponents = explode(',', $filter['value']);
if ($filter['comparator'] == 'custom') {
$filter['startdate'] = DateTimeField::convertToDBFormat($valueComponents[0]);
$filter['enddate'] = DateTimeField::convertToDBFormat($valueComponents[1]);
}
$dateFilterResolvedList = $customView->resolveDateFilterValue($filter);
$value[] = $queryGenerator->fixDateTimeValue($name, $dateFilterResolvedList['startdate']);
$value[] = $queryGenerator->fixDateTimeValue($name, $dateFilterResolvedList['enddate'], false);
$queryGenerator->addCondition($name, $value, 'BETWEEN');
} else {
$queryGenerator->addCondition($name, $filter['value'], $filter['comparator']);
}
$columncondition = $filter['column_condition'];
if (!empty($columncondition) && array_key_exists($index + 1, $filtercolumns)) {
$queryGenerator->addConditionGlue($columncondition);
}
}
$queryGenerator->endGroup();
$groupConditionGlue = $groupcolumns['condition'];
if (!empty($groupConditionGlue)) {
$queryGenerator->addConditionGlue($groupConditionGlue);
}
}
}
$query = $queryGenerator->getQuery();
//Remove the ordering for now to improve the speed
//$query .= ' ORDER BY createdtime DESC';
$result = $db->query($query);
while ($row = $db->fetch_array($result)) {
$recordInstance = Vtiger_Record_Model::getInstanceById(current($row));
$moduleName = $recordInstance->getModuleName();
$recordInstance->set('permitted', true);
$matchingRecords[$moduleName][current($row)] = $recordInstance;
}
$viewer->assign('SEARCH_MODULE', $moduleName);
} else {
$searchKey = $request->get('value');
$searchModule = false;
if ($request->get('searchModule')) {
$searchModule = $request->get('searchModule');
}
$viewer->assign('SEARCH_KEY', $searchKey);
$viewer->assign('SEARCH_MODULE', $searchModule);
$matchingRecords = Vtiger_Record_Model::getSearchResult($searchKey, $searchModule, $request->get('limit'));
}
$recordsList = $matchingRecordsList = [];
if ($matchingRecords[$moduleName]) {
$matchingRecordsList[$moduleName] = $matchingRecords[$moduleName];
}
foreach ($matchingRecords as $module => $recordModelsList) {
$matchingRecordsList[$module] = $recordModelsList;
}
if ($request->get('html') == 'true') {
$viewer->assign('MODULE', $moduleName);
$viewer->assign('MATCHING_RECORDS', $matchingRecordsList);
$viewer->assign('IS_ADVANCE_SEARCH', $isAdvanceSearch);
echo $viewer->view('UnifiedSearchResults.tpl', '', true);
} else {
foreach ($matchingRecordsList as $module => $modules) {
foreach ($modules as $recordID => $recordModel) {
$label = decode_html($recordModel->getName());
$label .= ' (' . Vtiger_Functions::getOwnerRecordLabel($recordModel->get('smownerid')) . ')';
if (!$recordModel->get('permitted')) {
$label .= ' <span class="glyphicon glyphicon-warning-sign" aria-hidden="true"></span>';
}
$recordsList[] = ['id' => $recordID, 'module' => $module, 'category' => vtranslate($module, $module), 'label' => $label, 'permitted' => $recordModel->get('permitted')];
//.........这里部分代码省略.........
示例4: showSearchResults
/**
* Function to display the Search Results
* @param Vtiger_Request $request
*/
function showSearchResults(Vtiger_Request $request)
{
$db = PearDatabase::getInstance();
$viewer = $this->getViewer($request);
$moduleName = $request->getModule();
$advFilterList = $request->get('advfilterlist');
//used to show the save modify filter option
$isAdvanceSearch = false;
$matchingRecords = array();
if (is_array($advFilterList) && count($advFilterList) > 0) {
$isAdvanceSearch = true;
$user = Users_Record_Model::getCurrentUserModel();
$queryGenerator = new QueryGenerator($moduleName, $user);
$queryGenerator->setFields(array('id'));
vimport('~~/modules/CustomView/CustomView.php');
$customView = new CustomView($moduleName);
$dateSpecificConditions = $customView->getStdFilterConditions();
foreach ($advFilterList as $groupindex => $groupcolumns) {
$filtercolumns = $groupcolumns['columns'];
if (count($filtercolumns) > 0) {
$queryGenerator->startGroup('');
foreach ($filtercolumns as $index => $filter) {
$nameComponents = explode(':', $filter['columnname']);
if (empty($nameComponents[2]) && $nameComponents[1] == 'crmid' && $nameComponents[0] == 'vtiger_crmentity') {
$name = $queryGenerator->getSQLColumn('id');
} else {
$name = $nameComponents[2];
}
if (($nameComponents[4] == 'D' || $nameComponents[4] == 'DT') && in_array($filter['comparator'], $dateSpecificConditions)) {
$filter['stdfilter'] = $filter['comparator'];
$valueComponents = explode(',', $filter['value']);
if ($filter['comparator'] == 'custom') {
$filter['startdate'] = DateTimeField::convertToDBFormat($valueComponents[0]);
$filter['enddate'] = DateTimeField::convertToDBFormat($valueComponents[1]);
}
$dateFilterResolvedList = $customView->resolveDateFilterValue($filter);
$value[] = $queryGenerator->fixDateTimeValue($name, $dateFilterResolvedList['startdate']);
$value[] = $queryGenerator->fixDateTimeValue($name, $dateFilterResolvedList['enddate'], false);
$queryGenerator->addCondition($name, $value, 'BETWEEN');
} else {
$queryGenerator->addCondition($name, $filter['value'], $filter['comparator']);
}
$columncondition = $filter['column_condition'];
if (!empty($columncondition) && array_key_exists($index + 1, $filtercolumns)) {
$queryGenerator->addConditionGlue($columncondition);
}
}
$queryGenerator->endGroup();
$groupConditionGlue = $groupcolumns['condition'];
if (!empty($groupConditionGlue)) {
$queryGenerator->addConditionGlue($groupConditionGlue);
}
}
}
$query = $queryGenerator->getQuery();
//Remove the ordering for now to improve the speed
//$query .= ' ORDER BY createdtime DESC';
$result = $db->pquery($query, array());
$rows = $db->num_rows($result);
for ($i = 0; $i < $rows; ++$i) {
$row = $db->query_result_rowdata($result, $i);
$recordInstance = Vtiger_Record_Model::getInstanceById($row[0]);
$moduleName = $recordInstance->getModuleName();
$matchingRecords[$moduleName][$row[0]] = $recordInstance;
}
$viewer->assign('SEARCH_MODULE', $moduleName);
} else {
$searchKey = $request->get('value');
$searchModule = false;
if ($request->get('searchModule')) {
$searchModule = $request->get('searchModule');
}
$viewer->assign('SEARCH_KEY', $searchKey);
$viewer->assign('SEARCH_MODULE', $searchModule);
$matchingRecords = Vtiger_Record_Model::getSearchResult($searchKey, $searchModule);
}
$matchingRecordsList = array();
if ($matchingRecords[$moduleName]) {
$matchingRecordsList[$moduleName] = $matchingRecords[$moduleName];
}
foreach ($matchingRecords as $module => $recordModelsList) {
$matchingRecordsList[$module] = $recordModelsList;
}
$viewer->assign('MODULE', $moduleName);
$viewer->assign('MATCHING_RECORDS', $matchingRecordsList);
$viewer->assign('IS_ADVANCE_SEARCH', $isAdvanceSearch);
echo $viewer->view('UnifiedSearchResults.tpl', '', true);
}
示例5: parseAdvFilterList
public function parseAdvFilterList($advFilterList, $glue = '')
{
if (!empty($glue)) {
$this->addConditionGlue($glue);
}
$customView = new CustomView($this->module);
$dateSpecificConditions = $customView->getStdFilterConditions();
foreach ($advFilterList as $groupindex => $groupcolumns) {
$filtercolumns = $groupcolumns['columns'];
if (count($filtercolumns) > 0) {
$this->startGroup('');
foreach ($filtercolumns as $index => $filter) {
$nameComponents = explode(':', $filter['columnname']);
if (empty($nameComponents[2]) && $nameComponents[1] == 'crmid' && $nameComponents[0] == 'vtiger_crmentity') {
$name = $this->getSQLColumn('id');
} else {
$name = $nameComponents[2];
}
if (($nameComponents[4] == 'D' || $nameComponents[4] == 'DT') && in_array($filter['comparator'], $dateSpecificConditions)) {
$filter['stdfilter'] = $filter['comparator'];
$valueComponents = explode(',', $filter['value']);
if ($filter['comparator'] == 'custom') {
if ($nameComponents[4] == 'DT') {
$startDateTimeComponents = explode(' ', $valueComponents[0]);
$endDateTimeComponents = explode(' ', $valueComponents[1]);
$filter['startdate'] = DateTimeField::convertToDBFormat($startDateTimeComponents[0]);
$filter['enddate'] = DateTimeField::convertToDBFormat($endDateTimeComponents[0]);
} else {
$filter['startdate'] = DateTimeField::convertToDBFormat($valueComponents[0]);
$filter['enddate'] = DateTimeField::convertToDBFormat($valueComponents[1]);
}
}
$dateFilterResolvedList = $customView->resolveDateFilterValue($filter);
$value[] = $this->fixDateTimeValue($name, $dateFilterResolvedList['startdate']);
$value[] = $this->fixDateTimeValue($name, $dateFilterResolvedList['enddate'], false);
$this->addCondition($name, $value, 'BETWEEN');
} else {
if ($nameComponents[4] == 'DT' && ($filter['comparator'] == 'e' || $filter['comparator'] == 'n')) {
$filter['stdfilter'] = $filter['comparator'];
$dateTimeComponents = explode(' ', $filter['value']);
$filter['startdate'] = DateTimeField::convertToDBFormat($dateTimeComponents[0]);
$filter['enddate'] = DateTimeField::convertToDBFormat($dateTimeComponents[0]);
$dateTimeFilterResolvedList = $customView->resolveDateFilterValue($filter);
$value[] = $this->fixDateTimeValue($name, $dateTimeFilterResolvedList['startdate']);
$value[] = $this->fixDateTimeValue($name, $dateTimeFilterResolvedList['enddate'], false);
if ($filter['comparator'] == 'n') {
$this->addCondition($name, $value, 'NOTEQUAL');
} else {
$this->addCondition($name, $value, 'BETWEEN');
}
} else {
if ($nameComponents[4] == 'DT' && $filter['comparator'] == 'a') {
$dateTime = explode(' ', $filter['value']);
$value[] = $this->fixDateTimeValue($name, $dateTime[0], false);
$this->addCondition($name, $value, $filter['comparator']);
} else {
$this->addCondition($name, $filter['value'], $filter['comparator']);
}
}
}
$columncondition = $filter['column_condition'];
if (!empty($columncondition)) {
$this->addConditionGlue($columncondition);
}
}
$this->endGroup();
$groupConditionGlue = $groupcolumns['condition'];
if (!empty($groupConditionGlue)) {
$this->addConditionGlue($groupConditionGlue);
}
}
}
}