protected function AddInsertColumns(Grid $grid) { // // Edit column for project_id field // $editor = new ComboBox('project_id_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect')); $editColumn = new CustomEditColumn('Parent Project', 'project_id', $editor, $this->dataset); $editColumn->SetReadOnly(true); $editColumn->setEnabled(false); $editColumn->SetAllowSetToNull(true); $editColumn->SetInsertDefaultValue($this->RenderText('%project_name%')); $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); $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); // // Edit column for task_name field // $editor = new ComboBox('task_name_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect')); $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); // // 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('Hrs', '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')); $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); if ($this->GetSecurityInfo()->HasAddGrant()) { $grid->SetShowAddButton(true); $grid->SetShowInlineAddButton(false); } else { $grid->SetShowInlineAddButton(false); $grid->SetShowAddButton(false); } }