protected function AddInsertColumns(Grid $grid) { // // Edit column for district_id field // $editor = new MultiLevelComboBoxEditor('district_id_edit', $this->CreateLinkBuilder()); $dataset0 = new TableDataset(new PgConnectionFactory(), GetConnectionOptions(), '"public"."state"'); $field = new StringField('abbr'); $field->SetIsNotNull(true); $dataset0->AddField($field, true); $field = new StringField('name'); $dataset0->AddField($field, false); $editor->AddLevel($dataset0, 'abbr', 'name', $this->RenderText('State'), null); $dataset1 = new TableDataset(new PgConnectionFactory(), GetConnectionOptions(), '"public"."district"'); $field = new IntegerField('id'); $field->SetIsNotNull(true); $dataset1->AddField($field, true); $field = new StringField('state'); $dataset1->AddField($field, false); $field = new StringField('name'); $dataset1->AddField($field, false); $field = new StringField('level_id'); $dataset1->AddField($field, false); $field = new IntegerField('election_div_id'); $dataset1->AddField($field, false); $editor->AddLevel($dataset1, 'id', 'name', $this->RenderText('Political District Name'), new ForeignKeyInfo('abbr', 'state')); $editColumn = new MultiLevelLookupEditColumn('Political District Name', 'district_id', $editor, $this->dataset); $editColumn->SetAllowSetToNull(true); $this->ApplyCommonColumnEditProperties($editColumn); $grid->AddInsertColumn($editColumn); // // Edit column for office_id field // $editor = new MultiLevelComboBoxEditor('office_id_edit', $this->CreateLinkBuilder()); $dataset0 = new TableDataset(new PgConnectionFactory(), GetConnectionOptions(), '"public"."state"'); $field = new StringField('abbr'); $field->SetIsNotNull(true); $dataset0->AddField($field, true); $field = new StringField('name'); $dataset0->AddField($field, false); $editor->AddLevel($dataset0, 'abbr', 'name', $this->RenderText('State'), null); $selectQuery = 'SELECT op.id office_id, o.title office_title, ed.id election_div_id, ed.name ed_name, ed.phys_addr_state state, concat(d.name, \' - \', o.title) officeTitle FROM office_position op JOIN district d ON op.district_id = d.id JOIN election_div ed ON d.election_div_id = ed.id JOIN office o ON op.office_id = o.id'; $insertQuery = array(); $updateQuery = array(); $deleteQuery = array(); $dataset1 = new QueryDataset(new PgConnectionFactory(), GetConnectionOptions(), $selectQuery, $insertQuery, $updateQuery, $deleteQuery, 'office_title_by_election_div'); $field = new IntegerField('office_id'); $dataset1->AddField($field, false); $field = new StringField('office_title'); $dataset1->AddField($field, false); $field = new IntegerField('election_div_id'); $dataset1->AddField($field, true); $field = new StringField('ed_name'); $dataset1->AddField($field, false); $field = new StringField('state'); $dataset1->AddField($field, false); $field = new StringField('officetitle'); $dataset1->AddField($field, false); $editor->AddLevel($dataset1, 'election_div_id', 'election_div_name', $this->RenderText('Election Division'), new ForeignKeyInfo('abbr', 'election_div_state')); $dataset2 = new TableDataset(new PgConnectionFactory(), GetConnectionOptions(), '"public"."office"'); $field = new IntegerField('id'); $field->SetIsNotNull(true); $dataset2->AddField($field, true); $field = new StringField('title'); $field->SetIsNotNull(true); $dataset2->AddField($field, false); $field = new IntegerField('num_positions'); $dataset2->AddField($field, false); $field = new StringField('responsibilities'); $dataset2->AddField($field, false); $field = new IntegerField('term_length_months'); $dataset2->AddField($field, false); $field = new StringField('filing_fee'); $dataset2->AddField($field, false); $field = new BooleanField('partisan'); $dataset2->AddField($field, false); $field = new StringField('age_requirements'); $dataset2->AddField($field, false); $field = new StringField('res_requirements'); $dataset2->AddField($field, false); $field = new StringField('prof_requirements'); $dataset2->AddField($field, false); $field = new IntegerField('salary'); $dataset2->AddField($field, false); $field = new StringField('notes'); $dataset2->AddField($field, false); $field = new IntegerField('office_rank'); $dataset2->AddField($field, false); $dataset2->SetOrderBy('title', GetOrderTypeAsSQL(otAscending)); $editor->AddLevel($dataset2, 'id', 'title', $this->RenderText('Office Title'), new ForeignKeyInfo('election_div_id', 'election_div_id')); $editColumn = new MultiLevelLookupEditColumn('Office Title', 'office_id', $editor, $this->dataset); $editColumn->SetAllowSetToNull(true); $this->ApplyCommonColumnEditProperties($editColumn); $grid->AddInsertColumn($editColumn); // // Edit column for office_holder_id field // $editor = new MultiLevelComboBoxEditor('office_holder_id_edit', $this->CreateLinkBuilder()); $dataset0 = new TableDataset(new PgConnectionFactory(), GetConnectionOptions(), '"public"."state"'); $field = new StringField('abbr'); $field->SetIsNotNull(true); $dataset0->AddField($field, true); $field = new StringField('name'); $dataset0->AddField($field, false); $editor->AddLevel($dataset0, 'abbr', 'name', $this->RenderText('State'), null); $selectQuery = 'SELECT oh.id, oh.state, concat(oh.last_name, \', \', oh.first_name, \' \', oh.middle_name) AS fullName FROM office_holder oh ORDER BY oh.last_name, oh.first_name'; $insertQuery = array(); $updateQuery = array(); $deleteQuery = array(); $dataset1 = new QueryDataset(new PgConnectionFactory(), GetConnectionOptions(), $selectQuery, $insertQuery, $updateQuery, $deleteQuery, 'officeHolderIDs'); $field = new IntegerField('id'); $dataset1->AddField($field, false); $field = new StringField('state'); $dataset1->AddField($field, false); $field = new StringField('fullname'); $dataset1->AddField($field, false); $dataset1->SetOrderBy('fullname', GetOrderTypeAsSQL(otAscending)); $editor->AddLevel($dataset1, 'id', 'fullname', $this->RenderText('Office Holder Id'), new ForeignKeyInfo('abbr', 'state')); $editColumn = new MultiLevelLookupEditColumn('Office Holder Id', 'office_holder_id', $editor, $this->dataset); $editColumn->SetAllowSetToNull(true); $this->ApplyCommonColumnEditProperties($editColumn); $grid->AddInsertColumn($editColumn); // // Edit column for position_name field // $editor = new TextEdit('position_name_edit'); $editor->SetSize(25); $editor->SetMaxLength(25); $editColumn = new CustomEditColumn('Position Name', 'position_name', $editor, $this->dataset); $editColumn->SetAllowSetToNull(true); $this->ApplyCommonColumnEditProperties($editColumn); $grid->AddInsertColumn($editColumn); // // Edit column for term_start field // $editor = new DateTimeEdit('term_start_edit', false, 'Y-m-d H:i:s', GetFirstDayOfWeek()); $editColumn = new CustomEditColumn('Term Start', 'term_start', $editor, $this->dataset); $editColumn->SetAllowSetToNull(true); $this->ApplyCommonColumnEditProperties($editColumn); $grid->AddInsertColumn($editColumn); // // Edit column for term_end field // $editor = new DateTimeEdit('term_end_edit', false, 'Y-m-d H:i:s', GetFirstDayOfWeek()); $editColumn = new CustomEditColumn('Term End', 'term_end', $editor, $this->dataset); $editColumn->SetAllowSetToNull(true); $this->ApplyCommonColumnEditProperties($editColumn); $grid->AddInsertColumn($editColumn); // // Edit column for filing_deadline field // $editor = new DateTimeEdit('filing_deadline_edit', false, 'Y-m-d H:i:s', GetFirstDayOfWeek()); $editColumn = new CustomEditColumn('Filing Deadline', 'filing_deadline', $editor, $this->dataset); $editColumn->SetAllowSetToNull(true); $this->ApplyCommonColumnEditProperties($editColumn); $grid->AddInsertColumn($editColumn); // // Edit column for next_election field // $editor = new DateTimeEdit('next_election_edit', false, 'Y-m-d H:i:s', GetFirstDayOfWeek()); $editColumn = new CustomEditColumn('Next Election', 'next_election', $editor, $this->dataset); $editColumn->SetAllowSetToNull(true); $this->ApplyCommonColumnEditProperties($editColumn); $grid->AddInsertColumn($editColumn); // // Edit column for notes field // $editor = new TextAreaEdit('notes_edit', 50, 8); $editColumn = new CustomEditColumn('Notes', 'notes', $editor, $this->dataset); $editColumn->SetAllowSetToNull(true); $this->ApplyCommonColumnEditProperties($editColumn); $grid->AddInsertColumn($editColumn); // // Edit column for office_rank field // $editor = new TextEdit('office_rank_edit'); $editColumn = new CustomEditColumn('Office Rank', 'office_rank', $editor, $this->dataset); $editColumn->SetAllowSetToNull(true); $this->ApplyCommonColumnEditProperties($editColumn); $grid->AddInsertColumn($editColumn); if ($this->GetSecurityInfo()->HasAddGrant()) { $grid->SetShowAddButton(true); $grid->SetShowInlineAddButton(false); } else { $grid->SetShowInlineAddButton(false); $grid->SetShowAddButton(false); } }
protected function AddInsertColumns(Grid $grid) { // // Edit column for state field // $editor = new ComboBox('state_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect')); $lookupDataset = new TableDataset(new PgConnectionFactory(), GetConnectionOptions(), '"public"."state"'); $field = new StringField('abbr'); $field->SetIsNotNull(true); $lookupDataset->AddField($field, true); $field = new StringField('name'); $lookupDataset->AddField($field, false); $lookupDataset->SetOrderBy('name', GetOrderTypeAsSQL(otAscending)); $editColumn = new LookUpEditColumn('State', 'state', $editor, $this->dataset, 'abbr', 'name', $lookupDataset); $editColumn->SetAllowSetToNull(true); $this->ApplyCommonColumnEditProperties($editColumn); $grid->AddInsertColumn($editColumn); // // Edit column for name field // $editor = new TextEdit('name_edit'); $editor->SetSize(50); $editor->SetMaxLength(50); $editColumn = new CustomEditColumn('District Name', 'name', $editor, $this->dataset); $editColumn->SetAllowSetToNull(true); $this->ApplyCommonColumnEditProperties($editColumn); $grid->AddInsertColumn($editColumn); // // Edit column for level_id field // $editor = new ComboBox('level_id_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect')); $lookupDataset = new TableDataset(new PgConnectionFactory(), GetConnectionOptions(), '"public"."level"'); $field = new StringField('id'); $field->SetIsNotNull(true); $lookupDataset->AddField($field, true); $field = new StringField('name'); $lookupDataset->AddField($field, false); $field = new IntegerField('rank'); $lookupDataset->AddField($field, false); $lookupDataset->SetOrderBy('name', GetOrderTypeAsSQL(otAscending)); $editColumn = new LookUpEditColumn('Level of Government', 'level_id', $editor, $this->dataset, 'id', 'name', $lookupDataset); $editColumn->SetAllowSetToNull(true); $this->ApplyCommonColumnEditProperties($editColumn); $grid->AddInsertColumn($editColumn); // // Edit column for election_div_id field // $editor = new MultiLevelComboBoxEditor('election_div_id_edit', $this->CreateLinkBuilder()); $dataset0 = new TableDataset(new PgConnectionFactory(), GetConnectionOptions(), '"public"."state"'); $field = new StringField('abbr'); $field->SetIsNotNull(true); $dataset0->AddField($field, true); $field = new StringField('name'); $dataset0->AddField($field, false); $editor->AddLevel($dataset0, 'abbr', 'name', $this->RenderText('State'), null); $dataset1 = new TableDataset(new PgConnectionFactory(), GetConnectionOptions(), '"public"."election_div"'); $field = new IntegerField('id'); $field->SetIsNotNull(true); $dataset1->AddField($field, true); $field = new StringField('name'); $field->SetIsNotNull(true); $dataset1->AddField($field, false); $field = new StringField('phys_addr_addr1'); $dataset1->AddField($field, false); $field = new StringField('phys_addr_addr2'); $dataset1->AddField($field, false); $field = new StringField('phys_addr_city'); $dataset1->AddField($field, false); $field = new StringField('phys_addr_state'); $dataset1->AddField($field, false); $field = new StringField('phys_addr_zip'); $dataset1->AddField($field, false); $field = new StringField('mail_addr_addr1'); $dataset1->AddField($field, false); $field = new StringField('mail_addr_addr2'); $dataset1->AddField($field, false); $field = new StringField('mail_addr_city'); $dataset1->AddField($field, false); $field = new StringField('mail_addr_state'); $dataset1->AddField($field, false); $field = new StringField('mail_addr_zip'); $dataset1->AddField($field, false); $field = new StringField('phone'); $dataset1->AddField($field, false); $field = new StringField('fax'); $dataset1->AddField($field, false); $field = new StringField('website'); $dataset1->AddField($field, false); $field = new StringField('notes'); $dataset1->AddField($field, false); $dataset1->SetOrderBy('name', GetOrderTypeAsSQL(otAscending)); $editor->AddLevel($dataset1, 'id', 'name', $this->RenderText('Election Division'), new ForeignKeyInfo('abbr', 'phys_addr_state')); $editColumn = new MultiLevelLookupEditColumn('Election Division', 'election_div_id', $editor, $this->dataset); $editColumn->SetAllowSetToNull(true); $this->ApplyCommonColumnEditProperties($editColumn); $grid->AddInsertColumn($editColumn); if ($this->GetSecurityInfo()->HasAddGrant()) { $grid->SetShowAddButton(true); $grid->SetShowInlineAddButton(false); } else { $grid->SetShowInlineAddButton(false); $grid->SetShowAddButton(false); } }
protected function AddInsertColumns(Grid $grid) { // // Edit column for election_div_id field // $editor = new MultiLevelComboBoxEditor('election_div_id_edit', $this->CreateLinkBuilder()); $dataset0 = new TableDataset(new PgConnectionFactory(), GetConnectionOptions(), '"public"."state"'); $field = new StringField('abbr'); $field->SetIsNotNull(true); $dataset0->AddField($field, true); $field = new StringField('name'); $dataset0->AddField($field, false); $editor->AddLevel($dataset0, 'abbr', 'name', $this->RenderText('State'), null); $dataset1 = new TableDataset(new PgConnectionFactory(), GetConnectionOptions(), '"public"."election_div"'); $field = new IntegerField('id'); $field->SetIsNotNull(true); $dataset1->AddField($field, true); $field = new StringField('name'); $field->SetIsNotNull(true); $dataset1->AddField($field, false); $field = new StringField('phys_addr_addr1'); $dataset1->AddField($field, false); $field = new StringField('phys_addr_addr2'); $dataset1->AddField($field, false); $field = new StringField('phys_addr_city'); $dataset1->AddField($field, false); $field = new StringField('phys_addr_state'); $dataset1->AddField($field, false); $field = new StringField('phys_addr_zip'); $dataset1->AddField($field, false); $field = new StringField('mail_addr_addr1'); $dataset1->AddField($field, false); $field = new StringField('mail_addr_addr2'); $dataset1->AddField($field, false); $field = new StringField('mail_addr_city'); $dataset1->AddField($field, false); $field = new StringField('mail_addr_state'); $dataset1->AddField($field, false); $field = new StringField('mail_addr_zip'); $dataset1->AddField($field, false); $field = new StringField('phone'); $dataset1->AddField($field, false); $field = new StringField('fax'); $dataset1->AddField($field, false); $field = new StringField('website'); $dataset1->AddField($field, false); $field = new StringField('notes'); $dataset1->AddField($field, false); $dataset1->SetOrderBy('name', GetOrderTypeAsSQL(otAscending)); $editor->AddLevel($dataset1, 'id', 'name', $this->RenderText('Election Division'), new ForeignKeyInfo('abbr', 'phys_addr_state')); $editColumn = new MultiLevelLookupEditColumn('Election Division', 'election_div_id', $editor, $this->dataset); $editColumn->SetAllowSetToNull(true); $this->ApplyCommonColumnEditProperties($editColumn); $grid->AddInsertColumn($editColumn); // // Edit column for name field // $editor = new TextEdit('name_edit'); $editor->SetSize(35); $editor->SetMaxLength(35); $editColumn = new CustomEditColumn('Document Name or Description', 'name', $editor, $this->dataset); $validator = new RequiredValidator(StringUtils::Format($this->GetLocalizerCaptions()->GetMessageString('RequiredValidationMessage'), $this->RenderText($editColumn->GetCaption()))); $editor->GetValidatorCollection()->AddValidator($validator); $this->ApplyCommonColumnEditProperties($editColumn); $grid->AddInsertColumn($editColumn); // // Edit column for link field // $editor = new TextAreaEdit('link_edit', 50, 8); $editColumn = new CustomEditColumn('URL to Document', 'link', $editor, $this->dataset); $validator = new RequiredValidator(StringUtils::Format($this->GetLocalizerCaptions()->GetMessageString('RequiredValidationMessage'), $this->RenderText($editColumn->GetCaption()))); $editor->GetValidatorCollection()->AddValidator($validator); $this->ApplyCommonColumnEditProperties($editColumn); $grid->AddInsertColumn($editColumn); if ($this->GetSecurityInfo()->HasAddGrant()) { $grid->SetShowAddButton(true); $grid->SetShowInlineAddButton(false); } else { $grid->SetShowInlineAddButton(false); $grid->SetShowAddButton(false); } }
protected function AddInsertColumns(Grid $grid) { // // Edit column for name field // $editor = new TextEdit('name_edit'); $editor->SetSize(50); $editor->SetMaxLength(100); $editColumn = new CustomEditColumn('Name', 'name', $editor, $this->dataset); $editColumn->SetInsertDefaultValue($this->RenderText('%CURRENT_USER_NAME%')); $validator = new RequiredValidator(StringUtils::Format($this->GetLocalizerCaptions()->GetMessageString('RequiredValidationMessage'), $this->RenderText($editColumn->GetCaption()))); $editor->GetValidatorCollection()->AddValidator($validator); $this->ApplyCommonColumnEditProperties($editColumn); $grid->AddInsertColumn($editColumn); // // Edit column for task_id field // $editor = new MultiLevelComboBoxEditor('task_id_edit', $this->CreateLinkBuilder()); $dataset0 = new TableDataset(new MyConnectionFactory(), GetConnectionOptions(), '`project`'); $field = new IntegerField('project_id', null, null, true); $field->SetIsNotNull(true); $dataset0->AddField($field, true); $field = new IntegerField('programm_id'); $dataset0->AddField($field, false); $field = new StringField('project_name'); $dataset0->AddField($field, false); $field = new DateField('date_start'); $dataset0->AddField($field, false); $field = new DateField('date_end'); $dataset0->AddField($field, false); $field = new IntegerField('approved_budget'); $dataset0->AddField($field, false); $field = new StringField('notes'); $field->SetIsNotNull(true); $dataset0->AddField($field, false); $field = new StringField('priority'); $dataset0->AddField($field, false); $field = new StringField('lead'); $dataset0->AddField($field, false); $field = new StringField('level_of_service'); $field->SetIsNotNull(true); $dataset0->AddField($field, false); $field = new StringField('multi_year'); $field->SetIsNotNull(true); $dataset0->AddField($field, false); $field = new StringField('public_engagement'); $field->SetIsNotNull(true); $dataset0->AddField($field, false); $field = new StringField('year'); $field->SetIsNotNull(true); $dataset0->AddField($field, false); $field = new StringField('approved'); $field->SetIsNotNull(true); $dataset0->AddField($field, false); $field = new StringField('progress'); $field->SetIsNotNull(true); $dataset0->AddField($field, false); $field = new IntegerField('staff_id'); $field->SetIsNotNull(true); $dataset0->AddField($field, false); $field = new IntegerField('dept_id'); $field->SetIsNotNull(true); $dataset0->AddField($field, false); $field = new IntegerField('budget_spent'); $field->SetIsNotNull(true); $dataset0->AddField($field, false); $field = new IntegerField('admin_flag'); $field->SetIsNotNull(true); $dataset0->AddField($field, false); $editor->AddLevel($dataset0, 'project_id', 'project_name', $this->RenderText('Project'), null); $dataset1 = new TableDataset(new MyConnectionFactory(), GetConnectionOptions(), '`task`'); $field = new IntegerField('task_id', null, null, true); $field->SetIsNotNull(true); $dataset1->AddField($field, true); $field = new IntegerField('project_id'); $dataset1->AddField($field, false); $field = new StringField('assigned_to'); $dataset1->AddField($field, false); $field = new DateField('date_start'); $dataset1->AddField($field, false); $field = new DateField('date_end'); $dataset1->AddField($field, false); $field = new StringField('task_name'); $dataset1->AddField($field, false); $field = new StringField('notes'); $field->SetIsNotNull(true); $dataset1->AddField($field, false); $field = new IntegerField('hrs'); $dataset1->AddField($field, false); $field = new StringField('wo'); $dataset1->AddField($field, false); $field = new IntegerField('staff_id'); $dataset1->AddField($field, false); $dataset1->SetOrderBy('task_name', GetOrderTypeAsSQL(otAscending)); $editor->AddLevel($dataset1, 'task_id', 'task_name', $this->RenderText('Task'), new ForeignKeyInfo('project_id', 'project_id')); $editColumn = new MultiLevelLookupEditColumn('Task', 'task_id', $editor, $this->dataset); $validator = new RequiredValidator(StringUtils::Format($this->GetLocalizerCaptions()->GetMessageString('RequiredValidationMessage'), $this->RenderText($editColumn->GetCaption()))); $editor->GetValidatorCollection()->AddValidator($validator); $this->ApplyCommonColumnEditProperties($editColumn); $grid->AddInsertColumn($editColumn); // // Edit column for hours field // $editor = new SpinEdit('hours_edit'); $editColumn = new CustomEditColumn('Hours', 'hours', $editor, $this->dataset); $editColumn->SetInsertDefaultValue($this->RenderText('7')); $validator = new RequiredValidator(StringUtils::Format($this->GetLocalizerCaptions()->GetMessageString('RequiredValidationMessage'), $this->RenderText($editColumn->GetCaption()))); $editor->GetValidatorCollection()->AddValidator($validator); $validator = new NumberValidator(StringUtils::Format($this->GetLocalizerCaptions()->GetMessageString('NumberValidationMessage'), $this->RenderText($editColumn->GetCaption()))); $editor->GetValidatorCollection()->AddValidator($validator); $this->ApplyCommonColumnEditProperties($editColumn); $grid->AddInsertColumn($editColumn); // // Edit column for notes field // $editor = new TextAreaEdit('notes_edit', 50, 8); $editColumn = new CustomEditColumn('Notes', 'notes', $editor, $this->dataset); $editColumn->SetAllowSetToNull(true); $this->ApplyCommonColumnEditProperties($editColumn); $grid->AddInsertColumn($editColumn); // // Edit column for date field // $editor = new DateTimeEdit('date_edit', false, 'Y-m-d', GetFirstDayOfWeek()); $editColumn = new CustomEditColumn('Date', 'date', $editor, $this->dataset); $editColumn->SetInsertDefaultValue($this->RenderText('%CURRENT_DATE%')); $validator = new RequiredValidator(StringUtils::Format($this->GetLocalizerCaptions()->GetMessageString('RequiredValidationMessage'), $this->RenderText($editColumn->GetCaption()))); $editor->GetValidatorCollection()->AddValidator($validator); $this->ApplyCommonColumnEditProperties($editColumn); $grid->AddInsertColumn($editColumn); if ($this->GetSecurityInfo()->HasAddGrant()) { $grid->SetShowAddButton(true); $grid->SetShowInlineAddButton(false); } else { $grid->SetShowInlineAddButton(false); $grid->SetShowAddButton(false); } }