/// <summary> /// Creates the child controls. /// </summary> /// <returns></returns> public override Control[] CreateChildControls(Type entityType, FilterField filterControl) { var controls = new List <Control>(); ddlStringFilterComparison = ComparisonHelper.ComparisonControl(ComparisonHelper.StringFilterComparisonTypes); ddlStringFilterComparison.ID = string.Format("{0}_{1}", filterControl.ID, controls.Count()); ddlStringFilterComparison.AddCssClass("js-filter-compare"); filterControl.Controls.Add(ddlStringFilterComparison); controls.Add(ddlStringFilterComparison); tbPostalCode = new RockTextBox(); tbPostalCode.ID = filterControl.ID + "_tbPostalCode"; tbPostalCode.AddCssClass("js-filter-control"); filterControl.Controls.Add(tbPostalCode); controls.Add(tbPostalCode); ddlLocationType = new RockDropDownList(); ddlLocationType.ID = filterControl.ID + "_ddlLocationType"; ddlLocationType.Label = "Location Type"; ddlLocationType.DataValueField = "Id"; ddlLocationType.DataTextField = "Value"; DefinedTypeCache locationDefinedType = DefinedTypeCache.Get(SystemGuid.DefinedType.GROUP_LOCATION_TYPE.AsGuid()); ddlLocationType.BindToDefinedType(locationDefinedType); ddlLocationType.Items.Insert(0, new ListItem("(All Location Types)", "")); filterControl.Controls.Add(ddlLocationType); controls.Add(ddlLocationType); return(controls.ToArray()); }
/// <summary> /// Gets the filter value control. /// </summary> /// <param name="configurationValues">The configuration values.</param> /// <param name="id">The identifier.</param> /// <param name="required">if set to <c>true</c> [required].</param> /// <param name="filterMode">The filter mode.</param> /// <returns></returns> public override Control FilterValueControl(Dictionary <string, ConfigurationValue> configurationValues, string id, bool required, FilterMode filterMode) { var tbValue = new RockTextBox(); tbValue.ID = string.Format("{0}_ctlCompareValue", id); tbValue.AddCssClass("js-filter-control"); return(tbValue); }
/// <summary> /// Creates the child controls. /// </summary> /// <returns></returns> public override Control[] CreateChildControls(Type entityType, FilterField filterControl) { var gtpGroupType = new GroupTypePicker(); gtpGroupType.ID = filterControl.ID + "_0"; gtpGroupType.AddCssClass("js-group-type"); filterControl.Controls.Add(gtpGroupType); gtpGroupType.UseGuidAsValue = true; gtpGroupType.IsSortedByName = true; gtpGroupType.GroupTypes = new GroupTypeService(new RockContext()).Queryable().ToList(); var cbChildGroupTypes = new RockCheckBox(); cbChildGroupTypes.ID = filterControl.ID + "_cbChildGroupTypes"; cbChildGroupTypes.AddCssClass("js-child-group-types"); cbChildGroupTypes.Text = "Include Child Group Types(s)"; filterControl.Controls.Add(cbChildGroupTypes); var ddlIntegerCompare = ComparisonHelper.ComparisonControl(ComparisonHelper.NumericFilterComparisonTypes); ddlIntegerCompare.Label = "Attendance Count"; ddlIntegerCompare.ID = filterControl.ID + "_ddlIntegerCompare"; ddlIntegerCompare.AddCssClass("js-filter-compare"); filterControl.Controls.Add(ddlIntegerCompare); var tbAttendedCount = new RockTextBox(); tbAttendedCount.ID = filterControl.ID + "_2"; tbAttendedCount.Label = " "; // give it whitespace label so it lines up nicely tbAttendedCount.AddCssClass("js-attended-count"); filterControl.Controls.Add(tbAttendedCount); var slidingDateRangePicker = new SlidingDateRangePicker(); slidingDateRangePicker.Label = "Date Range"; slidingDateRangePicker.ID = filterControl.ID + "_slidingDateRangePicker"; slidingDateRangePicker.AddCssClass("js-sliding-date-range"); filterControl.Controls.Add(slidingDateRangePicker); var controls = new Control[5] { gtpGroupType, cbChildGroupTypes, ddlIntegerCompare, tbAttendedCount, slidingDateRangePicker }; // convert pipe to comma delimited var defaultDelimitedValues = slidingDateRangePicker.DelimitedValues.Replace("|", ","); var defaultCount = 4; // set the default values in case this is a newly added filter SetSelection( entityType, controls, string.Format("{0}|{1}|{2}|{3}|false", gtpGroupType.Items.Count > 0 ? gtpGroupType.Items[0].Value : "0", ComparisonType.GreaterThanOrEqualTo.ConvertToInt().ToString(), defaultCount, defaultDelimitedValues)); return(controls); }
/// <summary> /// Creates the child controls. /// </summary> /// <returns></returns> public override Control[] CreateChildControls(Type entityType, FilterField filterControl) { var pGroupPicker = new GroupPicker(); pGroupPicker.AllowMultiSelect = true; pGroupPicker.ID = filterControl.ID + "_pGroupPicker"; pGroupPicker.AddCssClass("js-group-picker"); filterControl.Controls.Add(pGroupPicker); var cbChildGroups = new RockCheckBox(); cbChildGroups.ID = filterControl.ID + "_cbChildGroups"; cbChildGroups.AddCssClass("js-child-groups"); cbChildGroups.Text = "Include Child Groups"; filterControl.Controls.Add(cbChildGroups); var ddlIntegerCompare = ComparisonHelper.ComparisonControl(ComparisonHelper.NumericFilterComparisonTypes); ddlIntegerCompare.Label = "Attendance Count"; ddlIntegerCompare.ID = filterControl.ID + "_ddlIntegerCompare"; ddlIntegerCompare.AddCssClass("js-filter-compare"); filterControl.Controls.Add(ddlIntegerCompare); var tbAttendedCount = new RockTextBox(); tbAttendedCount.ID = filterControl.ID + "_2"; tbAttendedCount.Label = " "; // give it whitespace label so it lines up nicely tbAttendedCount.AddCssClass("js-attended-count"); filterControl.Controls.Add(tbAttendedCount); var slidingDateRangePicker = new SlidingDateRangePicker(); slidingDateRangePicker.Label = "Date Range"; slidingDateRangePicker.ID = filterControl.ID + "_slidingDateRangePicker"; slidingDateRangePicker.AddCssClass("js-sliding-date-range"); filterControl.Controls.Add(slidingDateRangePicker); var controls = new Control[5] { pGroupPicker, cbChildGroups, ddlIntegerCompare, tbAttendedCount, slidingDateRangePicker }; // convert pipe to comma delimited var defaultDelimitedValues = slidingDateRangePicker.DelimitedValues.Replace("|", ","); var defaultCount = 4; // set the default values in case this is a newly added filter SetSelection( entityType, controls, string.Format("{0}|{1}|{2}|{3}|false", string.Empty, ComparisonType.GreaterThanOrEqualTo.ConvertToInt().ToString(), defaultCount, defaultDelimitedValues)); return(controls); }
/// <summary> /// Creates the child controls. /// </summary> /// <param name="entityType">The System Type of the entity to which the filter will be applied.</param> /// <param name="filterControl">The control that serves as the container for the filter controls.</param> /// <returns> /// The array of new controls created to implement the filter. /// </returns> public override Control[] CreateChildControls(Type entityType, FilterField filterControl) { var campusesPicker = new CampusesPicker(); campusesPicker.Label = "Campuses"; campusesPicker.ID = filterControl.ID + "_0"; campusesPicker.Label = string.Empty; campusesPicker.CssClass = "js-campuses-picker campuses-picker"; campusesPicker.Campuses = CampusCache.All(); filterControl.Controls.Add(campusesPicker); var ddlIntegerCompare = ComparisonHelper.ComparisonControl(ComparisonHelper.NumericFilterComparisonTypes); ddlIntegerCompare.Label = "Attendance Count"; ddlIntegerCompare.ID = filterControl.ID + "_ddlIntegerCompare"; ddlIntegerCompare.AddCssClass("js-filter-compare"); filterControl.Controls.Add(ddlIntegerCompare); var tbAttendedCount = new RockTextBox(); tbAttendedCount.ID = filterControl.ID + "_2"; tbAttendedCount.Label = " "; // give it whitespace label so it lines up nicely tbAttendedCount.AddCssClass("js-attended-count"); filterControl.Controls.Add(tbAttendedCount); var slidingDateRangePicker = new SlidingDateRangePicker(); slidingDateRangePicker.Label = "Date Range"; slidingDateRangePicker.ID = filterControl.ID + "_slidingDateRangePicker"; slidingDateRangePicker.AddCssClass("js-sliding-date-range"); filterControl.Controls.Add(slidingDateRangePicker); var controls = new Control[4] { campusesPicker, ddlIntegerCompare, tbAttendedCount, slidingDateRangePicker }; // convert pipe to comma delimited var defaultDelimitedValues = slidingDateRangePicker.DelimitedValues.Replace("|", ","); var defaultCount = 4; // set the default values in case this is a newly added filter SetSelection( entityType, controls, string.Format("{0}|{1}|{2}|{3}|false", campusesPicker.Items.Count > 0 ? campusesPicker.Items[0].Value : "0", ComparisonType.GreaterThanOrEqualTo.ConvertToInt().ToString(), defaultCount, defaultDelimitedValues)); return(controls); }
/// <summary> /// Creates the child controls. /// </summary> /// <returns></returns> public override Control[] CreateChildControls(Type entityType, FilterField filterControl) { var pGroupPicker = new GroupPicker(); pGroupPicker.AllowMultiSelect = true; pGroupPicker.ID = $"{filterControl.ID}_{nameof( pGroupPicker )}"; pGroupPicker.AddCssClass("js-group-picker"); filterControl.Controls.Add(pGroupPicker); var cbChildGroups = new RockCheckBox(); cbChildGroups.ID = $"{filterControl.ID}_{nameof( cbChildGroups )}"; cbChildGroups.AddCssClass("js-child-groups"); cbChildGroups.Text = "Include Child Groups"; filterControl.Controls.Add(cbChildGroups); var ddlIntegerCompare = ComparisonHelper.ComparisonControl(ComparisonHelper.NumericFilterComparisonTypes); ddlIntegerCompare.Label = "Attendance Count"; ddlIntegerCompare.ID = $"{filterControl.ID}_{nameof( ddlIntegerCompare )}"; ddlIntegerCompare.AddCssClass("js-filter-compare"); filterControl.Controls.Add(ddlIntegerCompare); var tbAttendedCount = new RockTextBox(); tbAttendedCount.ID = $"{filterControl.ID}_{nameof( tbAttendedCount )}"; tbAttendedCount.Label = " "; // give it whitespace label so it lines up nicely tbAttendedCount.AddCssClass("js-attended-count"); filterControl.Controls.Add(tbAttendedCount); var slidingDateRangePicker = new SlidingDateRangePicker(); slidingDateRangePicker.Label = "Date Range"; slidingDateRangePicker.ID = $"{filterControl.ID}_{nameof( slidingDateRangePicker )}"; slidingDateRangePicker.AddCssClass("js-sliding-date-range"); filterControl.Controls.Add(slidingDateRangePicker); var schedulePicker = new SchedulePicker(); schedulePicker.Label = "Schedules"; schedulePicker.ID = $"{filterControl.ID}_{nameof( schedulePicker )}"; schedulePicker.AddCssClass("js-schedule-picker"); schedulePicker.AllowMultiSelect = true; filterControl.Controls.Add(schedulePicker); var controls = new Control[6] { pGroupPicker, cbChildGroups, ddlIntegerCompare, tbAttendedCount, slidingDateRangePicker, schedulePicker }; var defaultGroupAttendanceFilterSelection = new GroupAttendanceFilterSelection { IntegerCompare = ComparisonType.GreaterThanOrEqualTo.ConvertToInt().ToString(), AttendedCount = 4, SlidingDateRange = slidingDateRangePicker.DelimitedValues, IncludeChildGroups = false, }; // set the default values in case this is a newly added filter SetSelection( entityType, controls, defaultGroupAttendanceFilterSelection.ToJson()); return(controls); }