protected function AddInsertColumns(Grid $grid)
 {
     //
     // Edit column for project_name field
     //
     $editor = new TextEdit('project_name_edit');
     $editColumn = new CustomEditColumn('Project Name', 'project_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 project_date_start field
     //
     $editor = new DateTimeEdit('project_date_start_edit', false, 'Y-m-d H:i:s', GetFirstDayOfWeek());
     $editColumn = new CustomEditColumn('Project Date Start', 'project_date_start', $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 project_date_end field
     //
     $editor = new DateTimeEdit('project_date_end_edit', false, 'Y-m-d H:i:s', GetFirstDayOfWeek());
     $editColumn = new CustomEditColumn('Project Date End', 'project_date_end', $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 lead field
     //
     $editor = new TextEdit('lead_edit');
     $editColumn = new CustomEditColumn('Lead', 'lead', $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 year field
     //
     $editor = new TextEdit('year_edit');
     $editColumn = new CustomEditColumn('Year', 'year', $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 progress field
     //
     $editor = new TextEdit('progress_edit');
     $editColumn = new CustomEditColumn('Progress', 'progress', $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 project_id field
     //
     $editor = new SpinEdit('project_id_edit');
     $editColumn = new CustomEditColumn('Project Id', 'project_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 task_id field
     //
     $editor = new SpinEdit('task_id_edit');
     $editColumn = new CustomEditColumn('Task Id', '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 task_project_id field
     //
     $editor = new SpinEdit('task_project_id_edit');
     $editColumn = new CustomEditColumn('Task Project Id', 'task_project_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 assigned_to field
     //
     $editor = new TextEdit('assigned_to_edit');
     $editColumn = new CustomEditColumn('Assigned To', 'assigned_to', $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 task_date_start field
     //
     $editor = new DateTimeEdit('task_date_start_edit', false, 'Y-m-d ', GetFirstDayOfWeek());
     $editColumn = new CustomEditColumn('Task Date Start', 'task_date_start', $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 task_date_end field
     //
     $editor = new DateTimeEdit('task_date_end_edit', false, 'Y-m-d', GetFirstDayOfWeek());
     $editColumn = new CustomEditColumn('Task Date End', 'task_date_end', $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 task_name field
     //
     $editor = new TextEdit('task_name_edit');
     $editColumn = new CustomEditColumn('Task Name', 'task_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);
     if ($this->GetSecurityInfo()->HasAddGrant()) {
         $grid->SetShowAddButton(false);
         $grid->SetShowInlineAddButton(false);
     } else {
         $grid->SetShowInlineAddButton(false);
         $grid->SetShowAddButton(false);
     }
 }
 protected function AddInsertColumns(Grid $grid)
 {
     //
     // Edit column for project_id field
     //
     $editor = new ComboBox('project_id_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
     $editColumn = new CustomEditColumn('Project', 'project_id', $editor, $this->dataset);
     $editColumn->SetReadOnly(true);
     $editColumn->setEnabled(false);
     $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_name field
     //
     $editor = new AutocomleteComboBox('task_name_edit', $this->CreateLinkBuilder());
     $editor->SetSize('250px');
     $editor->setAllowClear(true);
     $editor->setMinimumInputLength(0);
     $editColumn = new CustomEditColumn('Task Name', 'task_name', $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 hrs field
     //
     $editor = new SpinEdit('hrs_edit');
     $editColumn = new CustomEditColumn('Estimated Hours', 'hrs', $editor, $this->dataset);
     $editColumn->SetInsertDefaultValue($this->RenderText('21'));
     $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 assigned_to field
     //
     $editor = new ComboBox('assigned_to_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
     $editColumn = new CustomEditColumn('Assigned To', 'assigned_to', $editor, $this->dataset);
     $editColumn->SetInsertDefaultValue($this->RenderText('%CURRENT_USER_ID%'));
     $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 date_start field
     //
     $editor = new DateTimeEdit('date_start_edit', false, 'Y-m-d', GetFirstDayOfWeek());
     $editColumn = new CustomEditColumn('Date Start', 'date_start', $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);
     //
     // Edit column for date_end field
     //
     $editor = new DateTimeEdit('date_end_edit', false, 'Y-m-d', GetFirstDayOfWeek());
     $editColumn = new CustomEditColumn('Date End', 'date_end', $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);
     }
 }
Beispiel #3
0
 protected function AddInsertColumns(Grid $grid)
 {
     //
     // Edit column for ivo-codvoc field
     //
     $editor = new SpinEdit('ivo-codvoc_edit');
     $editColumn = new CustomEditColumn('Ivo-codvoc', 'ivo-codvoc', $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(false);
         $grid->SetShowInlineAddButton(false);
     } else {
         $grid->SetShowInlineAddButton(false);
         $grid->SetShowAddButton(false);
     }
 }
 protected function AddInsertColumns(Grid $grid)
 {
     //
     // Edit column for project_name field
     //
     $editor = new TextEdit('project_name_edit');
     $editColumn = new CustomEditColumn('Project Name', 'project_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 date_start field
     //
     $editor = new DateTimeEdit('date_start_edit', false, 'Y-m-d H:i:s', GetFirstDayOfWeek());
     $editColumn = new CustomEditColumn('Date Start', 'date_start', $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 date_end field
     //
     $editor = new DateTimeEdit('date_end_edit', false, 'Y-m-d H:i:s', GetFirstDayOfWeek());
     $editColumn = new CustomEditColumn('Date End', 'date_end', $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 lead field
     //
     $editor = new ComboBox('lead_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
     $lookupDataset = new TableDataset(new MyConnectionFactory(), GetConnectionOptions(), '`staff`');
     $field = new IntegerField('staff_id', null, null, true);
     $field->SetIsNotNull(true);
     $lookupDataset->AddField($field, true);
     $field = new StringField('username');
     $field->SetIsNotNull(true);
     $lookupDataset->AddField($field, false);
     $field = new StringField('email');
     $field->SetIsNotNull(true);
     $lookupDataset->AddField($field, false);
     $field = new StringField('picture');
     $field->SetIsNotNull(true);
     $lookupDataset->AddField($field, false);
     $field = new StringField('password');
     $field->SetIsNotNull(true);
     $lookupDataset->AddField($field, false);
     $field = new IntegerField('dept_id');
     $field->SetIsNotNull(true);
     $lookupDataset->AddField($field, false);
     $field = new StringField('position');
     $field->SetIsNotNull(true);
     $lookupDataset->AddField($field, false);
     $field = new StringField('emp_number');
     $field->SetIsNotNull(true);
     $lookupDataset->AddField($field, false);
     $lookupDataset->SetOrderBy('username', GetOrderTypeAsSQL(otAscending));
     $editColumn = new LookUpEditColumn('Lead', 'lead', $editor, $this->dataset, 'staff_id', 'username', $lookupDataset);
     $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 progress field
     //
     $editor = new SpinEdit('progress_edit');
     $editColumn = new CustomEditColumn('Progress', 'progress', $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(false);
         $grid->SetShowInlineAddButton(false);
     } else {
         $grid->SetShowInlineAddButton(false);
         $grid->SetShowAddButton(false);
     }
 }
 protected function AddInsertColumns(Grid $grid)
 {
     //
     // Edit column for approved_budget field
     //
     $editor = new SpinEdit('approved_budget_edit');
     $editColumn = new CustomEditColumn('Approved Budget', 'approved_budget', $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 project_name field
     //
     $editor = new TextEdit('project_name_edit');
     $editColumn = new CustomEditColumn('Project Name', 'project_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 lead field
     //
     $editor = new TextEdit('lead_edit');
     $editColumn = new CustomEditColumn('Lead', 'lead', $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(false);
         $grid->SetShowInlineAddButton(false);
     } else {
         $grid->SetShowInlineAddButton(false);
         $grid->SetShowAddButton(false);
     }
 }
 protected function AddInsertColumns(Grid $grid)
 {
     //
     // Edit column for project_id field
     //
     $editor = new ComboBox('project_id_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
     $lookupDataset = new TableDataset(new MyConnectionFactory(), GetConnectionOptions(), '`project`');
     $field = new IntegerField('project_id', null, null, true);
     $field->SetIsNotNull(true);
     $lookupDataset->AddField($field, true);
     $field = new IntegerField('programm_id');
     $lookupDataset->AddField($field, false);
     $field = new StringField('project_name');
     $lookupDataset->AddField($field, false);
     $field = new DateField('date_start');
     $lookupDataset->AddField($field, false);
     $field = new DateField('date_end');
     $lookupDataset->AddField($field, false);
     $field = new IntegerField('approved_budget');
     $lookupDataset->AddField($field, false);
     $field = new StringField('notes');
     $field->SetIsNotNull(true);
     $lookupDataset->AddField($field, false);
     $field = new StringField('priority');
     $lookupDataset->AddField($field, false);
     $field = new StringField('lead');
     $lookupDataset->AddField($field, false);
     $field = new StringField('level_of_service');
     $field->SetIsNotNull(true);
     $lookupDataset->AddField($field, false);
     $field = new StringField('multi_year');
     $field->SetIsNotNull(true);
     $lookupDataset->AddField($field, false);
     $field = new StringField('public_engagement');
     $field->SetIsNotNull(true);
     $lookupDataset->AddField($field, false);
     $field = new StringField('year');
     $field->SetIsNotNull(true);
     $lookupDataset->AddField($field, false);
     $field = new StringField('approved');
     $field->SetIsNotNull(true);
     $lookupDataset->AddField($field, false);
     $field = new StringField('progress');
     $field->SetIsNotNull(true);
     $lookupDataset->AddField($field, false);
     $field = new IntegerField('staff_id');
     $field->SetIsNotNull(true);
     $lookupDataset->AddField($field, false);
     $field = new IntegerField('dept_id');
     $field->SetIsNotNull(true);
     $lookupDataset->AddField($field, false);
     $field = new IntegerField('budget_spent');
     $field->SetIsNotNull(true);
     $lookupDataset->AddField($field, false);
     $field = new IntegerField('admin_flag');
     $field->SetIsNotNull(true);
     $lookupDataset->AddField($field, false);
     $lookupDataset->SetOrderBy('project_name', GetOrderTypeAsSQL(otAscending));
     $lookupDataset->AddCustomCondition(EnvVariablesUtils::EvaluateVariableTemplate($this->GetColumnVariableContainer(), '%CURRENT_USER_ID%  = 1  OR project.lead=%CURRENT_USER_ID%'));
     $editColumn = new LookUpEditColumn('Project', 'project_id', $editor, $this->dataset, 'project_id', 'project_name', $lookupDataset);
     $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_name field
     //
     $editor = new AutocomleteComboBox('task_name_edit', $this->CreateLinkBuilder());
     $editor->SetSize('250px');
     $lookupDataset = new TableDataset(new MyConnectionFactory(), GetConnectionOptions(), '`task_names`');
     $field = new IntegerField('id', null, null, true);
     $field->SetIsNotNull(true);
     $lookupDataset->AddField($field, true);
     $field = new StringField('Name');
     $lookupDataset->AddField($field, false);
     $lookupDataset->SetOrderBy('Name', GetOrderTypeAsSQL(otAscending));
     $editColumn = new DynamicLookupEditColumn('Name', 'task_name', 'task_name_Name', 'insert_task_name_Name_search', $editor, $this->dataset, $lookupDataset, 'Name', '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 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 hrs field
     //
     $editor = new SpinEdit('hrs_edit');
     $editColumn = new CustomEditColumn('Allocated Hours', 'hrs', $editor, $this->dataset);
     $editColumn->SetInsertDefaultValue($this->RenderText('21'));
     $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 assigned_to field
     //
     $editor = new ComboBox('assigned_to_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
     $lookupDataset = new TableDataset(new MyConnectionFactory(), GetConnectionOptions(), '`staff`');
     $field = new IntegerField('staff_id', null, null, true);
     $field->SetIsNotNull(true);
     $lookupDataset->AddField($field, true);
     $field = new StringField('username');
     $field->SetIsNotNull(true);
     $lookupDataset->AddField($field, false);
     $field = new StringField('email');
     $field->SetIsNotNull(true);
     $lookupDataset->AddField($field, false);
     $field = new StringField('picture');
     $field->SetIsNotNull(true);
     $lookupDataset->AddField($field, false);
     $field = new StringField('password');
     $field->SetIsNotNull(true);
     $lookupDataset->AddField($field, false);
     $field = new IntegerField('dept_id');
     $field->SetIsNotNull(true);
     $lookupDataset->AddField($field, false);
     $field = new StringField('position');
     $field->SetIsNotNull(true);
     $lookupDataset->AddField($field, false);
     $field = new StringField('emp_number');
     $field->SetIsNotNull(true);
     $lookupDataset->AddField($field, false);
     $lookupDataset->SetOrderBy('username', GetOrderTypeAsSQL(otAscending));
     $editColumn = new LookUpEditColumn('Assigned To', 'assigned_to', $editor, $this->dataset, 'staff_id', 'username', $lookupDataset);
     $editColumn->SetInsertDefaultValue($this->RenderText('%CURRENT_USER_ID%'));
     $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 date_start field
     //
     $editor = new DateTimeEdit('date_start_edit', false, 'Y-m-d', GetFirstDayOfWeek());
     $editColumn = new CustomEditColumn('Date Start', 'date_start', $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);
     //
     // Edit column for date_end field
     //
     $editor = new DateTimeEdit('date_end_edit', true, 'Y-m-d', GetFirstDayOfWeek());
     $editColumn = new CustomEditColumn('Date End', 'date_end', $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);
     }
 }
 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);
     }
 }
 protected function AddInsertColumns(Grid $grid)
 {
     //
     // Edit column for office_id field
     //
     $editor = new SpinEdit('office_id_edit');
     $editColumn = new CustomEditColumn('Office Id', 'office_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 office_title field
     //
     $editor = new TextEdit('office_title_edit');
     $editColumn = new CustomEditColumn('Office Title', 'office_title', $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 election_div_id field
     //
     $editor = new SpinEdit('election_div_id_edit');
     $editColumn = new CustomEditColumn('Election Div Id', 'election_div_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 ed_name field
     //
     $editor = new TextEdit('ed_name_edit');
     $editColumn = new CustomEditColumn('Ed Name', 'ed_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 state field
     //
     $editor = new TextEdit('state_edit');
     $editColumn = new CustomEditColumn('State', 'state', $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 officetitle field
     //
     $editor = new TextEdit('officetitle_edit');
     $editColumn = new CustomEditColumn('Officetitle', 'officetitle', $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(false);
         $grid->SetShowInlineAddButton(false);
     } else {
         $grid->SetShowInlineAddButton(false);
         $grid->SetShowAddButton(false);
     }
 }