Ejemplo n.º 1
0
 private function getGroup()
 {
     if ($this->group != null) {
         return $this->group;
     }
     $group = null;
     $callback = function (Component &$component) use(&$group) {
         $group = $component;
         return Component::VISITOR_STOP_TRAVERSAL;
     };
     $this->visitParents(CheckBoxGroup::getIdentifier(), $callback);
     $this->group = $group;
     if ($group == null) {
         throw new \RuntimeException('A check must be a child of CheckBoxGroup');
     }
     return $group;
 }
 protected function AddInsertColumns(Grid $grid)
 {
     //
     // Edit column for id_paquete field
     //
     $editor = new TextEdit('id_paquete_edit');
     $editor->SetMaxLength(64);
     $editColumn = new CustomEditColumn('CMO', 'id_paquete', $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 nombre field
     //
     $editor = new TextEdit('nombre_edit');
     $editor->SetMaxLength(64);
     $editColumn = new CustomEditColumn('Nombre del Objeto', 'nombre', $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 ruta field
     //
     $editor = new TextEdit('ruta_edit');
     $editColumn = new CustomEditColumn('Ruta', 'ruta', $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 tipo field
     //
     $editor = new ComboBox('tipo_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
     $editor->AddValue('HTML', $this->RenderText('HTML'));
     $editor->AddValue('PHP', $this->RenderText('PHP'));
     $editor->AddValue('JS', $this->RenderText('JS'));
     $editor->AddValue('PL/SQL', $this->RenderText('PL/SQL'));
     $editor->AddValue('SCRIPT', $this->RenderText('SCRIPT ADJUNTO'));
     $editColumn = new CustomEditColumn('Tipo', 'tipo', $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 aplicacion field
     //
     $editor = new ComboBox('aplicacion_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
     $editor->AddValue('CIKLOS', $this->RenderText('CIKLOS'));
     $editor->AddValue('COOEPS', $this->RenderText('COOEPS'));
     $editColumn = new CustomEditColumn('Aplicación', 'aplicacion', $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 nuevo field
     //
     $editor = new CheckBoxGroup('nuevo_edit');
     $editor->SetDisplayMode(CheckBoxGroup::StackedMode);
     $editor->AddValue('N', $this->RenderText('NO'));
     $editor->AddValue('S', $this->RenderText('SI'));
     $editColumn = new CustomEditColumn('Nuevo', 'nuevo', $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);
     }
 }