Esempio n. 1
0
 public function initWithEntityFields(coreBaseEntity $entity)
 {
     parent::initWithEntityFields($entity);
     if ($entity->id) {
         $type_field = coreFormElementsLibrary::get('fixed_value', 'type');
         $type_field->setFixedValue($entity->getTypeName());
         $this->replaceField($type_field);
         $this->makeFieldOptional('type');
         $status_select = coreFormElementsLibrary::get('select', 'new_status');
         $new_status_options = array(null => $entity->getStatusName());
         foreach (ocsPkgOcsOrderStatusHelperLibrary::getNextStatusOptions($entity) as $k => $v) {
             $new_status_options[$k] = $v;
         }
         $this->addField($status_select);
         $status_select->setOptions($new_status_options);
         $this->setFieldCaption('new_status', 'Статус');
         $comment_field = coreFormElementsLibrary::get('textarea', 'new_status_comment');
         $this->addField($comment_field);
         $this->setFieldCaption('new_status_comment', 'Комментарий к изменению статуса');
         $created_str = coreFormattingLibrary::formatDate($entity->created);
         $this->addField(coreFormElementsLibrary::get('fixed_value', 'created_str')->setFixedValue($created_str));
         $this->setFieldCaption('created_str', 'Создана');
         $this->setFieldsOrder(array('created_str', 'type', 'new_status', 'new_status_comment'));
     }
 }
Esempio n. 2
0
 function add_fields()
 {
     $user = Application::getEntityInstance('user');
     $this->addField(coreFormElementsLibrary::get('checkbox_collection', 'search_role_id')->setOptions($user->getRoleSelect()));
     $this->addField(coreFormElementsLibrary::get('text', 'search_keyword'));
     $limit_options = array(20 => '20', 50 => '50', 100 => '100', 'all' => 'all');
     $this->addField(coreFormElementsLibrary::get('select', 'search_limit')->setOptions($limit_options));
 }
Esempio n. 3
0
 public function make_form(&$form)
 {
     $form = parent::make_form($form);
     $form->addField(coreFormElementsLibrary::get('text', 'title'));
     $form->addField(coreFormElementsLibrary::get('rich_editor', 'text'));
     $form->addField(coreFormElementsLibrary::get('date', 'published')->addClass('form-control'));
     $form->addField(coreFormElementsLibrary::get('checkbox', 'active'));
     $image_field = coreFormElementsLibrary::get('image', 'image');
     $image_field->setEntityName($this->getName());
     $image_field->setEntityId($this->id);
     $image_field->setWidth('100%');
     $form->addField($image_field);
     return $form;
 }
Esempio n. 4
0
 protected function createForm($object)
 {
     $form_class = coreResourceLibrary::getEffectiveClass('form', 'ocs_order_edit');
     $this->form = new $form_class();
     $this->form->initWithEntityFields($object);
     $this->form->setHeading($this->action == 'add' ? 'Добавление заявки' : 'Редактирование заявки');
     $action_field = coreFormElementsLibrary::get('hidden', 'action');
     $action_field->setValue($this->action);
     $this->form->addField($action_field);
     $form_action = "/{$this->getName()}";
     if ($this->page > 1) {
         $form_action .= "?page={$this->page}";
     }
     $form_action = Application::getSeoUrl($form_action);
     $this->form->setAction($form_action);
     $this->form->setMethod('post');
 }
Esempio n. 5
0
 protected function initFieldSet()
 {
     parent::initFieldSet();
     $client_options = $this->entity->getClientOptions('-- Любой --');
     $client_field = coreFormElementsLibrary::get('select', 'client_id');
     $client_field->setOptions($client_options);
     $this->addField($client_field);
     $this->setFieldCaption('client_id', 'Клиент');
     $type_options = $this->entity->getTypeOptions('-- Любой --');
     $type_field = coreFormElementsLibrary::get('select', 'type');
     $type_field->setOptions($type_options);
     $this->addField($type_field);
     $this->setFieldCaption('type', 'Тип');
     $status_options = ocsPkgOcsOrderStatusHelperLibrary::getAllStatusOptions();
     $status_field = coreFormElementsLibrary::get('checkbox_collection', 'status');
     $status_field->setOptions($status_options);
     $status_field->setMaxColumns(2);
     $this->addField($status_field);
     $this->setFieldCaption('status', 'Статус');
     $date_field = coreFormElementsLibrary::get('date_range', 'date_range');
     $this->addField($date_field);
     $this->setFieldCaption('date_range', 'Дата создания');
 }
Esempio n. 6
0
 protected function createForm($object)
 {
     parent::createForm($object);
     $this->form->addField(coreFormElementsLibrary::get('text', 'new_pass'));
     $this->form->setValue('roles', array_keys($object->roles));
 }