/** * @return array */ protected function getValueTypeDropDownArray() { if ($this->model instanceof TimeTriggerForWorkflowForm) { return MixedDateTimeTypesSearchFormAttributeMappingRules::getTimeOnlyValueTypesAndLabels(); } $valueTypesAndLabels = MixedDateTimeTypesSearchFormAttributeMappingRules::getTimeBasedValueTypesAndLabels(); if ($this->model->getWorkflowType() == Workflow::TYPE_BY_TIME && $this->model->getAttribute() != null) { $valueTypesAndLabels[MixedDateTypesSearchFormAttributeMappingRules::TYPE_DOES_NOT_CHANGE] = Zurmo::t('Core', 'Does Not Change'); } elseif ($this->model->getWorkflowType() == Workflow::TYPE_ON_SAVE && $this->model->getAttribute() != null) { $valueTypesAndLabels[MixedDateTypesSearchFormAttributeMappingRules::TYPE_DOES_NOT_CHANGE] = Zurmo::t('Core', 'Does Not Change'); $valueTypesAndLabels[MixedDateTypesSearchFormAttributeMappingRules::TYPE_CHANGES] = Zurmo::t('Core', 'Changes'); $valueTypesAndLabels[MixedDateTypesSearchFormAttributeMappingRules::TYPE_WAS_ON] = Zurmo::t('Core', 'Was On'); $valueTypesAndLabels[MixedDateTypesSearchFormAttributeMappingRules::TYPE_BECOMES_ON] = Zurmo::t('Core', 'Becomes On'); } elseif ($this->model->getWorkflowType() == Workflow::TYPE_ON_SAVE && $this->model->getAttribute() == null) { $valueTypesAndLabels[MixedDateTypesSearchFormAttributeMappingRules::TYPE_DOES_NOT_CHANGE] = Zurmo::t('Core', 'Does Not Change'); $valueTypesAndLabels[MixedDateTypesSearchFormAttributeMappingRules::TYPE_CHANGES] = Zurmo::t('Core', 'Changes'); } return $valueTypesAndLabels; }
/** * @return array */ protected function getValueTypeDropDownArray() { if ($this->model instanceof TimeTriggerForWorkflowForm) { return MixedDateTimeTypesSearchFormAttributeMappingRules::getTimeOnlyValueTypesAndLabels(); } $valueTypesAndLabels = MixedDateTimeTypesSearchFormAttributeMappingRules::getTimeBasedValueTypesAndLabels(); if ($this->model->getWorkflowType() == Workflow::TYPE_BY_TIME && $this->model->getAttribute() != null) { $valueTypesAndLabels[MixedDateTypesSearchFormAttributeMappingRules::TYPE_DOES_NOT_CHANGE] = Zurmo::t('Core', 'Does Not Change'); } elseif ($this->model->getWorkflowType() == Workflow::TYPE_ON_SAVE && $this->model->getAttribute() != null) { $valueTypesAndLabels[MixedDateTypesTriggerForWorkflowFormAttributeMappingRules::TYPE_AT_LEAST_X_AFTER_TRIGGERED_DATE] = Zurmo::t('Core', 'At Least X After Triggered Date'); $valueTypesAndLabels[MixedDateTypesTriggerForWorkflowFormAttributeMappingRules::TYPE_AT_LEAST_X_BEFORE_TRIGGERED_DATE] = Zurmo::t('Core', 'At Least X Before Triggered Date'); $valueTypesAndLabels[MixedDateTypesTriggerForWorkflowFormAttributeMappingRules::TYPE_LESS_THAN_X_AFTER_TRIGGERED_DATE] = Zurmo::t('Core', 'Less Than X After Triggered Date'); $valueTypesAndLabels[MixedDateTypesSearchFormAttributeMappingRules::TYPE_DOES_NOT_CHANGE] = Zurmo::t('Core', 'Does Not Change'); $valueTypesAndLabels[MixedDateTypesSearchFormAttributeMappingRules::TYPE_CHANGES] = Zurmo::t('Core', 'Changes'); if ($this->model->getAttribute() != 'createdDateTime' && $this->model->getAttribute() != 'modifiedDateTime') { $valueTypesAndLabels[MixedDateTypesSearchFormAttributeMappingRules::TYPE_WAS_ON] = Zurmo::t('Core', 'Was On'); $valueTypesAndLabels[MixedDateTypesSearchFormAttributeMappingRules::TYPE_BECOMES_ON] = Zurmo::t('Core', 'Becomes On'); } } elseif ($this->model->getWorkflowType() == Workflow::TYPE_ON_SAVE && $this->model->getAttribute() == null) { $valueTypesAndLabels[MixedDateTypesSearchFormAttributeMappingRules::TYPE_DOES_NOT_CHANGE] = Zurmo::t('Core', 'Does Not Change'); $valueTypesAndLabels[MixedDateTypesSearchFormAttributeMappingRules::TYPE_CHANGES] = Zurmo::t('Core', 'Changes'); } return $valueTypesAndLabels; }
protected static function resolveLeaderboardWhereClausesByType($type, &$where) { if ($type == static::LEADERBOARD_TYPE_OVERALL) { $where = '(' . $where . ')'; return; } $quote = DatabaseCompatibilityUtil::getQuote(); $today = MixedDateTimeTypesSearchFormAttributeMappingRules::calculateNewDateByDaysFromNow(0); if ($type == static::LEADERBOARD_TYPE_WEEKLY) { $todayMinusSevenDays = MixedDateTimeTypesSearchFormAttributeMappingRules::calculateNewDateByDaysFromNow(-7); $greaterThanValue = DateTimeUtil::convertDateIntoTimeZoneAdjustedDateTimeBeginningOfDay($todayMinusSevenDays); $lessThanValue = DateTimeUtil::convertDateIntoTimeZoneAdjustedDateTimeEndOfDay($today); if ($where != null) { $where = '(' . $where . ') and '; } $where .= "{$quote}gamepointtransaction{$quote}.{$quote}createdDateTime{$quote} >= '" . $greaterThanValue . "'"; $where .= " and "; $where .= "{$quote}gamepointtransaction{$quote}.{$quote}createdDateTime{$quote} <= '" . $lessThanValue . "'"; } elseif ($type == static::LEADERBOARD_TYPE_MONTHLY) { $todayMinusThirtyDays = MixedDateTimeTypesSearchFormAttributeMappingRules::calculateNewDateByDaysFromNow(-30); $greaterThanValue = DateTimeUtil::convertDateIntoTimeZoneAdjustedDateTimeBeginningOfDay($todayMinusThirtyDays); $lessThanValue = DateTimeUtil::convertDateIntoTimeZoneAdjustedDateTimeEndOfDay($today); if ($where != null) { $where = '(' . $where . ') and '; } $where .= "{$quote}gamepointtransaction{$quote}.{$quote}createdDateTime{$quote} >= '" . $greaterThanValue . "'"; $where .= " and "; $where .= "{$quote}gamepointtransaction{$quote}.{$quote}createdDateTime{$quote} <= '" . $lessThanValue . "'"; } else { throw new NotSupportedException(); } }
protected function getValueTypeDropDownArray() { return MixedDateTimeTypesSearchFormAttributeMappingRules::getValueTypesAndLabels(); }