public function initialize()
 {
     $this->_action = 'menuitem_add';
     $name = new Text('name');
     $name->setFilters(array('striptags', 'string'));
     $name->setAttributes(array('class' => 'form-control', 'autocomplete' => 'off', 'id' => 'menuitem_name'));
     $name->setLabel('Name');
     $url = new Text('url');
     $url->setFilters(array('striptags', 'string'));
     $url->setAttributes(array('class' => 'form-control', 'autocomplete' => 'off'));
     $url->setLabel('URL');
     $icon = new Text('icon');
     $icon->setFilters(array('striptags', 'string'));
     $icon->setAttributes(array('class' => 'form-control', 'autocomplete' => 'off'));
     $icon->setLabel('Icon');
     $device = new Select('device_id', Devices::find(), array('using' => array('id', 'name'), 'useEmpty' => true, 'emptyText' => 'None', 'emptyValue' => 0));
     $device->setLabel('Device');
     $menuId = new Hidden('menu_id');
     $menuId->setDefault(1);
     $this->add($name);
     $this->add($url);
     $this->add($icon);
     $this->add($device);
     $this->add($menuId);
 }
Exemple #2
0
 public function initialize()
 {
     $name = new Text("name");
     $name->setLabel('Name');
     $name->addValidator(new PresenceOf(['message' => '<strong>Name</strong> is required.']));
     $this->add($name);
     $adapter = new Select("adapter", ['Mysql' => 'MySQL']);
     $adapter->setLabel('DB type');
     $this->add($adapter);
     $host = new Text("host");
     $host->setLabel('DB host');
     $host->addValidator(new PresenceOf(['message' => '<strong>DB host</strong> is required.']));
     $this->add($host);
     $user = new Text("username");
     $user->setLabel('DB user');
     $user->addValidator(new PresenceOf(array('message' => '<strong>DB user</strong> is required.')));
     $this->add($user);
     $pass = new Text("password");
     $pass->setLabel('DB pass');
     $this->add($pass);
     $dbname = new Text("dbname");
     $dbname->setLabel('DB name');
     $dbname->addValidator(new PresenceOf(array('message' => '<strong>DB name</strong> is required.')));
     $this->add($dbname);
     //$this->setCsrf();
 }
 public function initialize($model = null)
 {
     $system = new \Modules\Library\System();
     // Main tab
     $title = new Text("title");
     $title->addValidator(new PresenceOf());
     $this->add($title);
     $this->add(new Text("code"));
     $status = new Select('status', array('0' => 'Không', '1' => 'Có'));
     $status->setDefault('1');
     $this->add($status);
     // $this->add(new Select('status', array('0'=>'Không', '1'=>'Có')));
     $this->add(new Select('featured', array('0' => 'Không', '1' => 'Có')));
     $this->add(new Text("image"));
     $this->add(new TextArea("description"));
     $this->add(new TextArea("content"));
     // Config tab
     $this->add(new Text("link"));
     $this->add(new Select('url_target', array('normal' => 'Bình thường', '_blank' => 'Mở trang mới')));
     $this->add(new Text("published", array('data-format' => 'yyyy-MM-dd hh:mm:ss', 'value' => date('d-m-Y H:i:s'))));
     $this->add(new Text("position"));
     // SEO tab
     $this->add(new Text("seo_title"));
     $this->add(new TextArea("metadata"));
     $this->add(new TextArea("keyword"));
     $result = \Modules\Backend\Models\News_category::find();
     $system = new \Modules\Library\System();
     $result = $system->convert_object_to_array($result);
     $data = null;
     $system->recursive($result, 0, 1, $data);
     $record = $system->getListTreeCategory($data, "title");
     $category_id = new Select('category_id', $record);
     $this->add($category_id);
 }
 public function initialize()
 {
     $this->_action = 'devices_add';
     $name = new Text('name');
     $name->setLabel('Devicename');
     $name->setFilters(array('striptags', 'string'));
     $name->setAttributes(array('class' => 'form-control', 'autocomplete' => 'off'));
     $ip = new Text('ip');
     $ip->setLabel('IP');
     $ip->setFilters(array('striptags', 'string'));
     $ip->setAttributes(array('class' => 'form-control', 'autocomplete' => 'off'));
     $mac = new Text('mac');
     $mac->setLabel('MAC');
     $mac->setFilters(array('striptags', 'string'));
     $mac->setAttributes(array('class' => 'form-control', 'autocomplete' => 'off'));
     $webtemp = new Text('webtemp');
     $webtemp->setLabel('Webtemp path');
     $webtemp->setFilters(array('striptags', 'string'));
     $webtemp->setAttributes(array('class' => 'form-control', 'autocomplete' => 'off'));
     $shutdownMethod = new Select('shutdown_method', array('none' => 'None', 'rpc' => 'RPC'), array('useEmpty' => false));
     $shutdownMethod->setLabel('Shutdown method');
     $showDasboard = new Check('show_on_dashboard');
     $showDasboard->setLabel('Show on dashboard');
     $showDasboard->setAttributes(array('class' => 'form-control'));
     $this->add($name);
     $this->add($ip);
     $this->add($mac);
     $this->add($webtemp);
     $this->add($shutdownMethod);
     $this->add($showDasboard);
 }
 function initialize($entity = null, $options = null)
 {
     $date = new Date('date');
     $date->setLabel('Input Date');
     $date->setFilters(array('striptags', 'string'));
     $date->setDefault(date('Y-m-d'));
     $date->addValidators(array(new PresenceOf(array('message' => 'Date is required'))));
     $this->add($date);
     $start_time = new Text('start_hour');
     $start_time->setLabel('Input Start Hour');
     $start_time->setFilters(array('striptags', 'string'));
     $start_time->addValidators(array(new PresenceOf(array('message' => 'Start Time is required'))));
     $this->add($start_time);
     $finish_time = new Text('finish_hour');
     $finish_time->setLabel('Input Finish Hour');
     $finish_time->setFilters(array('striptags', 'string'));
     $finish_time->addValidators(array(new PresenceOf(array('message' => 'Finish Time is required'))));
     $this->add($finish_time);
     $systemId = new Select('system_id', Systems::find(), array('using' => array('id', 'name'), 'useEmpty' => true));
     $systemId->setLabel('Select System');
     $systemId->addValidators(array(new PresenceOf(array('message' => 'System is required'))));
     if ($entity) {
         $systemId->setDefault(array($entity->system_id));
     }
     $this->add($systemId);
     $description = new TextArea('description');
     $description->setLabel('Input Description');
     $description->addValidators(array(new PresenceOf(array('message' => 'Description is required'))));
     $this->add($description);
     $hidden = new Hidden('id');
     if ($entity) {
         $hidden->setDefault(array($entity->id));
     }
     $this->add($hidden);
 }
 public function initialize()
 {
     $type = new Select('type', Publication::$types, array());
     $type->setLabel('Тип пубикации');
     $this->add($type);
     $title = new Text('title', array('required' => true));
     $title->setLabel('Название');
     $this->add($title);
     $slug = new Text('slug');
     $slug->setLabel('Транслитерация');
     $this->add($slug);
     $date = new Text('date');
     $date->setLabel('Дата публикации');
     $this->add($date);
     $text = new TextArea('text');
     $text->setLabel('Текст');
     $this->add($text);
     $meta_title = new Text('meta_title', array('required' => true));
     $meta_title->setLabel('meta-title');
     $this->add($meta_title);
     $meta_description = new TextArea('meta_description');
     $meta_description->setLabel('meta-description');
     $this->add($meta_description);
     $meta_keywords = new TextArea('meta_keywords');
     $meta_keywords->setLabel('meta-keywords');
     $this->add($meta_keywords);
     $preview_inner = new Check('preview_inner');
     $preview_inner->setLabel('Превью внутри публикации');
     $preview_inner->setDefault(1);
     $this->add($preview_inner);
     $image = new File('image');
     $image->setLabel('Загрузить превью');
     $this->add($image);
 }
Exemple #7
0
 /**
  * Initialize the products form
  */
 public function initialize($entity = null, $options = array())
 {
     /*======================= usuario_id ================================*/
     if (!isset($options['edit'])) {
         $element = new Text("usuario_id");
         $this->add($element->setLabel("Id"));
     } else {
         $this->add(new Hidden("usuario_id"));
     }
     /*======================= usuario_nick ================================*/
     $name = new Text("name");
     $name->setLabel("Name");
     $name->setFilters(array('striptags', 'string'));
     $name->addValidators(array(new PresenceOf(array('message' => 'Name is required'))));
     $this->add($name);
     /*======================= usuario_nombreCompleto ================================*/
     $type = new Select('product_types_id', ProductTypes::find(), array('using' => array('id', 'name'), 'useEmpty' => true, 'emptyText' => '...', 'emptyValue' => ''));
     $type->setLabel('Type');
     $this->add($type);
     /*======================= usuario_contrasenia ================================*/
     $price = new Text("price");
     $price->setLabel("Price");
     $price->setFilters(array('float'));
     $price->addValidators(array(new PresenceOf(array('message' => 'Price is required')), new Numericality(array('message' => 'Price is required'))));
     $this->add($price);
     /*======================= usuario_sector ================================*/
     /*======================= usuario_email ================================*/
     /*======================= usuario_activo ================================*/
     /*======================= usuario_fechaCreacion ================================*/
     /*======================= usuario_imagen ================================*/
 }
 public function initialize($menuitems)
 {
     $this->_action = 'menu';
     foreach ($menuitems as $menuItem) {
         $name = new Text('menuitem[' . $menuItem->id . '][name]');
         $name->setFilters(array('striptags', 'string'));
         $name->setAttributes(array('class' => 'form-control'));
         $name->setDefault($menuItem->name);
         $url = new Text('menuitem[' . $menuItem->id . '][url]');
         $url->setFilters(array('striptags', 'string'));
         $url->setAttributes(array('class' => 'form-control'));
         $url->setDefault($menuItem->url);
         $icon = new Text('menuitem[' . $menuItem->id . '][icon]');
         $icon->setFilters(array('striptags', 'string'));
         $icon->setAttributes(array('class' => 'form-control'));
         $icon->setDefault($menuItem->icon);
         $device = new Select('menuitem[' . $menuItem->id . '][device]', Devices::find(), array('using' => array('id', 'name'), 'useEmpty' => true, 'emptyText' => 'None', 'emptyValue' => 0));
         $device->setDefault($menuItem->device_id);
         $id = new Hidden('menuitem[' . $menuItem->id . '][id]');
         $id->setDefault($menuItem->id);
         $this->add($name);
         $this->add($url);
         $this->add($icon);
         $this->add($device);
         $this->add($id);
     }
 }
Exemple #9
0
 public function initialize($model, $menu_id = null)
 {
     $system = new \Modules\Library\System();
     // Main tab
     $name = new Text("name");
     $name->addValidator(new PresenceOf(array('message' => 'name')));
     $this->add($name);
     $this->add(new Text("code"));
     $link = new Text("link");
     $link->addValidator(new PresenceOf(array('message' => 'link')));
     $this->add($link);
     // parents menu item
     $result = \Modules\Backend\Models\Menu_item::findByMenu_id($menu_id);
     $result = $system->convert_object_to_array($result);
     $data = null;
     $system->recursive($result, 0, 1, $data);
     $data = $system->getListTreeCategory($data, 'name');
     $parents = new Select('parents', $data);
     $this->add($parents);
     $tbl_menu = \Modules\Backend\Models\Menu::find();
     $menu = new Select('menu_id', $tbl_menu, array('using' => array('id', 'name')));
     $menu->setDefault($menu_id);
     $this->add($menu);
     $status = new Select('status', array('0' => 'Không', '1' => 'Có'));
     $status->setDefault('1');
     $this->add($status);
     $target = new Select('target', array('0' => 'Bình thường', '1' => 'Mở tab mới'));
     $this->add($target);
     $this->add(new Text("image"));
     $this->add(new Text("position"));
 }
 /**
  * Add all fields to the form and set form specific attributes.
  */
 public function initialize()
 {
     $this->_action = 'general';
     $title = new Text('title');
     $title->setLabel('Title');
     $title->setFilters(array('striptags', 'string'));
     $title->setAttributes(array('class' => 'form-control'));
     $title->setDefault($this->_config->application->title);
     $title->addValidators(array(new PresenceOf(array())));
     $cryptKey = new Text('cryptkey');
     $cryptKey->setLabel('Cryptkey');
     $cryptKey->setFilters(array('striptags', 'string'));
     $cryptKey->setAttributes(array('class' => 'form-control'));
     $cryptKey->setDefault($this->_config->application->phalconCryptKey);
     $cryptKey->addValidators(array(new PresenceOf(array())));
     $bgcolor = new Select('bgcolor', array('blackbg' => 'Black', 'whitebg' => 'White'), array('useEmpty' => false));
     $bgcolor->setLabel('Background color');
     $bgcolor->setDefault($this->_config->application->background);
     $debug = new Check('debug');
     $debug->setLabel('debug');
     $debug->setAttributes(array('checked' => $this->_config->application->debug == '1' ? 'checked' : null));
     $this->add($title);
     $this->add($bgcolor);
     $this->add($cryptKey);
     $this->add($debug);
 }
 public function initialize()
 {
     $type = new Select('type_id', Type::cachedListArray(['key' => 'id']));
     $type->setLabel('Type of Publication');
     $this->add($type);
     $title = new Text('title', ['required' => true]);
     $title->addValidator(new PresenceOf(['message' => 'Title can not be empty']));
     $title->setLabel('Title');
     $this->add($title);
     $slug = new Text('slug');
     $slug->setLabel('Slug');
     $this->add($slug);
     $date = new Text('date');
     $date->setLabel('Publication Date');
     $this->add($date);
     $text = new TextArea('text');
     $text->setLabel('Text');
     $this->add($text);
     $meta_title = new Text('meta_title', ['required' => true]);
     $meta_title->setLabel('meta-title');
     $this->add($meta_title);
     $meta_description = new TextArea('meta_description', ['style' => 'height:4em; min-height: inherit']);
     $meta_description->setLabel('meta-description');
     $this->add($meta_description);
     $meta_keywords = new TextArea('meta_keywords', ['style' => 'height:4em; min-height: inherit']);
     $meta_keywords->setLabel('meta-keywords');
     $this->add($meta_keywords);
     $preview_inner = new Check('preview_inner');
     $preview_inner->setLabel('Show preview image inside publication');
     $this->add($preview_inner);
     $image = new Image('preview_src');
     $image->setLabel('Thumbnail Image');
     $this->add($image);
 }
Exemple #12
0
 public function initialize($entity = null, $options = array())
 {
     /*Si el form es de creacion, los campos seran required. Viceversa.*/
     $required['clave'] = "";
     $required['valor'] = "";
     if (isset($options['required'])) {
         $required['clave'] = "required";
         $required['valor'] = "true";
     }
     /*=========================== ID =====================================*/
     if (!isset($options['edit'])) {
         $element = new Text("yacimiento_id");
         $this->add($element->setLabel("ID"));
     } else {
         $this->add(new Hidden("yacimiento_id"));
     }
     /*=========================== Destino =====================================*/
     $elemento = new Text('yacimiento_destino', array('maxlength' => 60, 'class' => 'form-control', $required['clave'] => $required['valor']));
     $elemento->setLabel('Destino');
     $elemento->setFilters(array('striptags', 'string'));
     $elemento->addValidators(array(new PresenceOf(array('message' => 'El destino es requerido'))));
     $this->add($elemento);
     /*=========================== Operadoras =====================================*/
     $elemento = new Select('operadora_yacimientoId', Operadora::find(array('operadora_habilitado=1 AND operadora_yacimientoId=NULL', 'order' => 'operadora_nombre')), array('using' => array('operadora_id', 'operadora_nombre'), 'useEmpty' => true, 'emptyText' => 'SELECCIONE LAS OPERADORAS', 'emptyValue' => '', 'class' => 'form-control autocompletar', 'style' => 'width:100%', 'multiple' => 'multiple', $required['clave'] => $required['valor']));
     $elemento->setLabel('Operadoras');
     $this->add($elemento);
     /*=========================== EquipoPozo =====================================*/
     $elemento = new Select('equipoPozo_yacimientoId', Equipopozo::find(array('equipoPozo_habilitado=1 AND equipoPozo_yacimientoId=NULL', 'order' => 'equipoPozo_nombre')), array('using' => array('equipoPozo_id', 'equipoPozo_nombre'), 'useEmpty' => true, 'emptyText' => 'SELECCIONE LOS EQUIPOS/POZOS', 'emptyValue' => '', 'class' => 'form-control autocompletar', 'style' => 'width:100%', 'multiple' => 'multiple', $required['clave'] => $required['valor']));
     $elemento->setLabel('Equipos/Pozos');
     $this->add($elemento);
 }
 public function initialize($entity = null, $options = null)
 {
     $city = new Select('cityid', City::find(), array('using' => array('id', 'city'), 'useEmpty' => TRUE, 'emptyText' => $this->di->get('translate')->_('Seleccione una Ciudad')));
     $city->setLabel('Ciudad');
     $this->add($city);
     $township = new Text('township');
     $township->setLabel('Sector');
     $this->add($township);
     $countryvalue = "";
     $statevalue = "";
     $city = "";
     if (isset($entity)) {
         if ($entity->getCity()) {
             $countryvalue = $entity->getCity()->getCountry()->getCountry();
             $statevalue = $entity->getCity()->getState()->getState();
         }
     }
     $country = new Text('country');
     $country->setLabel('País');
     $country->setDefault($countryvalue);
     $this->add($country);
     $state = new Text('state');
     $state->setDefault($statevalue);
     $state->setLabel('Estado');
     $this->add($state);
 }
 public function initialize($entity = null, $options = null)
 {
     $role = new Select('roleid', Role::find(), array('using' => array('id', 'role'), 'useEmpty' => TRUE, 'emptyText' => $this->di->get('translate')->_('Seleccione un Rol')));
     $role->setLabel('Rol');
     $this->add($role);
     //añadimos un botón de tipo submit
     $submit = $this->add(new Submit('Guardar', array('class' => 'btn btn-success')));
 }
 /**
  * Initialize the products form
  */
 public function initialize($entity = null, $options = array())
 {
     $produto_detalhes = new Select("produto_detalhes", array('0' => 'Não', '1' => 'Sim'));
     $produto_detalhes->setLabel('produto detalhes ?');
     $this->add($produto_detalhes);
     $produto_cubagem_detalhe = new Select("produto_cubagem_detalhe", array('0' => 'Não', '1' => 'Sim'));
     $produto_cubagem_detalhe->setLabel('Cubagem no detalhe ?');
     $this->add($produto_cubagem_detalhe);
 }
 public function initialize($entity = null, $options = null)
 {
     $sortBy = new Select('sortBy', array('created_at' => 'Creation Date', 'price' => 'Price'), array('placeholder' => 'Sort By'));
     $sortBy->addValidators(array(new PresenceOf(array('message' => 'The Sort By is required')), new InclusionIn(array('message' => 'The sort by must be price or creation date', 'domain' => array('price', 'created_at')))));
     $this->add($sortBy);
     $order = new Select('order', array('ASC' => 'Asc', 'DESC' => 'Desc'), array('placeholder' => 'Order'));
     $order->addValidators(array(new PresenceOf(array('message' => 'The order is required')), new InclusionIn(array('message' => 'The order must be asc or desc', 'domain' => array('ASC', 'DESC')))));
     $this->add($order);
     // Add button
     $this->add(new Submit('sort', array('class' => 'btn btn-success')));
 }
 public function initialize($entity = null, $options = null)
 {
     $country = new Select('countryid', Country::find(), array('using' => array('id', 'country'), 'useEmpty' => TRUE, 'emptyText' => $this->di->get('translate')->_('Seleccione un País')));
     $country->setLabel('País');
     $this->add($country);
     $state = new Text('state');
     $state->setLabel('Estado');
     $this->add($state);
     //añadimos un botón de tipo submit
     $submit = $this->add(new Submit('Guardar', array('class' => 'btn btn-success')));
 }
Exemple #18
0
 public function initialize($entity = null, $options = null)
 {
     $select = new Select('parentId');
     $category = new Models\Category();
     $categories = $category->find(array("order" => "id DESC", "limit" => 100));
     $categoryArray = array('None');
     foreach ($categories as $key => $item) {
         $categoryArray[$item->id] = $item->categoryName;
     }
     $select->setOptions($categoryArray);
     $this->add($select);
 }
 public function initialize($entity = null, $options = null)
 {
     $language = new Select('languagecode', Language::find(), array('using' => array('code', 'language'), 'useEmpty' => TRUE, 'emptyText' => $this->di->get('translate')->_('Select a Language')));
     $language->setLabel('Idioma');
     $this->add($language);
     $title = new Text('title');
     $title->setLabel('Title');
     $this->add($title);
     $content = new TextArea('content', array('id' => 'summernote', 'name' => 'content', 'class' => 'summernote'));
     $content->setLabel('Content');
     $this->add($content);
 }
Exemple #20
0
 public function initialize()
 {
     $email = new Text("email");
     $email->setLabel('Email');
     $email->addValidator(new PresenceOf(['message' => '<strong>Email</strong> address is required.']));
     $this->add($email);
     $type = new Select('type', ['master' => 'master', 'operator' => 'operator']);
     $type->setLabel('Type');
     $type->setDefault('operator');
     $this->add($type);
     //$this->setCsrf();
 }
 public function initialize($entity = null, $options = null)
 {
     $language = new Select('languagecode', Language::find(), array('using' => array('code', 'language'), 'useEmpty' => TRUE, 'emptyText' => $this->di->get('translate')->_('Select a Language')));
     $language->setLabel('Idioma');
     $this->add($language);
     $name = new Text('name');
     $name->setLabel('Name translation');
     $this->add($name);
     $description = new TextArea('description');
     $description->setLabel('Description translation');
     $this->add($description);
 }
 public function initialize($entity = null, $options = null)
 {
     $language = new Select('languagecode', Language::find(), array('using' => array('code', 'language'), 'useEmpty' => TRUE, 'emptyText' => $this->di->get('translate')->_('Seleccione un idioma')));
     $language->setLabel('Idioma');
     $this->add($language);
     $key = new Text('translatekey');
     $key->setLabel('Llave');
     $this->add($key);
     $value = new Text('translatevalue');
     $value->setLabel('Valor');
     $this->add($value);
 }
Exemple #23
0
 public function initialize($entity = null, $options = null)
 {
     $restaurant = new Select('restaurantid', Restaurant::find(), array('using' => array('id', 'name'), 'useEmpty' => TRUE, 'emptyText' => $this->di->get('translate')->_('Seleccione un Restaurante')));
     $restaurant->setLabel('Pais');
     $this->add($restaurant);
     $name = new Text('name');
     $name->setLabel('Name');
     $this->add($name);
     $active = new Select("active", array('Y' => $this->di->get('translate')->_('Yes'), 'N' => $this->di->get('translate')->_('No')), array('class' => 'form-control'));
     $active->setLabel('active');
     $this->add($active);
 }
Exemple #24
0
 /**
  * Initialize the cliente form
  */
 public function initialize($entity = null, $options = array())
 {
     $required['clave'] = "";
     $required['valor'] = "";
     if (isset($options['required'])) {
         $required['clave'] = "required";
         $required['valor'] = "true";
     }
     /*======================= ID ==============================*/
     if (!isset($options['edit'])) {
         $element = new Text("cliente_id");
         $this->add($element->setLabel("N° de Cliente"));
     } else {
         $this->add(new Text("cliente_id"));
     }
     $this->add(new Select("cliente_nombre", Cliente::find(), array('using' => array('cliente_id', 'cliente_nombre'), 'useEmpty' => true, 'class' => 'form-control ', 'style' => 'width:100%', $required['clave'] => $required['valor'])));
     /*======================= YACIMIENTO ==============================*/
     $elemento = new Select('yacimiento_id', Yacimiento::find(array('yacimiento_habilitado=1', 'order' => 'yacimiento_destino')), array('using' => array('yacimiento_id', 'yacimiento_destino'), 'useEmpty' => false, 'class' => 'form-control autocompletar', 'style' => 'width:100%', $required['clave'] => $required['valor']));
     $elemento->setLabel('Destino');
     $this->add($elemento);
     /*======================= LINEA ==============================*/
     $elemento = new Select('cliente_lineaId', Linea::find(array('linea_habilitado=1', 'order' => 'linea_nombre')), array('using' => array('linea_id', 'linea_nombre'), 'useEmpty' => false, 'class' => 'form-control autocompletar', 'style' => 'width:100%', $required['clave'] => $required['valor']));
     $elemento->setLabel('Linea');
     $this->add($elemento);
     /*======================= CENTRO COSTO ==============================*/
     $elemento = new Select('centroCosto_id', Centrocosto::find(array('centroCosto_habilitado=1', 'order' => 'centroCosto_codigo')), array('using' => array('centroCosto_id', 'centroCosto_codigo'), 'useEmpty' => false, 'class' => 'form-control autocompletar', 'style' => 'width:100%', $required['clave'] => $required['valor']));
     $elemento->setLabel('Centro de Costo');
     $this->add($elemento);
     /*======================= CLIENTE_OPERADORA ==============================*/
     //Todas Las Operadoras Dependientes:
     $listaOperadoras = new Select('cliente_lisneaId', array(array('placeholder' => 'SELECCIONE LA OPERADORA', 'maxlength' => 50, 'class' => 'form-control', $required['clave'] => $required['valor']), Operadora::find(array('operadora_habilitado=1', 'order' => 'operadora_nombre')), array('operadora_id', 'operadora_nombre'), 'operadora_id'));
     $listaOperadoras->setLabel('Operadora');
     $this->add($listaOperadoras);
     /*======================= CLIENTE - EQUIPO/POZO - YACIMIENTO ==============================*/
     //Primero El PRINCIPAL.
     $listaYacimiento = new Select('yacimiento_destino', array(array('placeholder' => 'SELECCIONAR', 'maxlength' => 50, 'class' => 'form-control', $required['clave'] => $required['valor']), Yacimiento::find(array('yacimiento_habilitado=1', 'order' => 'yacimiento_destino')), array('yacimiento_id', 'yacimiento_destino'), 'yacimiento_id'));
     $listaYacimiento->setLabel('Yacimiento');
     $this->add($listaYacimiento);
     /*=================================================*/
     $listaEquipoPozo = new Select('equipoPozo_nombre', array(array('placeholder' => 'SELECCIONE UN YACIMENTO', 'maxlength' => 50, 'class' => 'form-control', $required['clave'] => $required['valor']), Equipopozo::find(array('equipoPozo_habilitado=1', 'order' => 'equipoPozo_nombre')), array('equipoPozo_id', 'equipoPozo_nombre'), 'equipoPozo_id'));
     $listaEquipoPozo->setLabel('Equipo/Pozo');
     $this->add($listaEquipoPozo);
     /*======================== CLIENTE - CENTRO COSTO - LINEA =========================*/
     //DataList Dependientes: Linea
     $listaLinea = new Select('linea_nombre', array(array('placeholder' => 'SELECCIONAR', 'maxlength' => 50, 'class' => 'form-control'), Linea::find(array('linea_habilitado=1', 'order' => 'linea_nombre')), array('linea_id', 'linea_nombre'), 'linea_id'));
     $listaLinea->setLabel('Linea');
     $this->add($listaLinea);
     /*=================================================*/
     $listaCentroCosto = new Select('centroCosto_codigo', array(array('placeholder' => 'SELECCIONE UNA LINEA', 'maxlength' => 50, 'class' => 'form-control', $required['clave'] => $required['valor']), Centrocosto::find(array('centroCosto_habilitado=1', 'order' => 'centroCosto_codigo')), array('centroCosto_id', 'centroCosto_codigo'), 'centroCosto_id'));
     $listaCentroCosto->setLabel('Centro Costo');
     $this->add($listaCentroCosto);
 }
 public function initialize()
 {
     // Company
     $company = new Select('companyid', Company::find(), array('using' => array('id', 'name')));
     $company->setLabel('Empresa');
     $this->add($company);
     $number = new Text('name');
     $number->setLabel('Número de Torre');
     $number->addValidators(array(new PresenceOf(array('message' => 'Debe ingresar un numero de torre'))));
     $this->add($number);
     //añadimos un botón de tipo submit
     $submit = $this->add(new Submit('save', array('class' => 'btn btn-success')));
 }
Exemple #26
0
 /**
  * Init form
  *
  * @param string $data
  */
 public function initialize($data = null)
 {
     $description = new TextArea('description', ['rows' => 5, 'required' => 'required']);
     $this->add($description);
     $bugTrackingType = new Select('bug_tracking_type_id', BugTrackingType::find(['order' => 'ordering']), ['using' => ['id', 'name'], 'useEmpty' => true, 'required' => 'required']);
     $bugTrackingType->addValidator(new PresenceOf(['message' => 'Type is required']));
     $this->add($bugTrackingType);
     $bugTrackingPriority = new Select('bug_tracking_priority_id', BugTrackingPriority::find(['order' => 'ordering']), ['using' => ['id', 'name'], 'useEmpty' => true, 'required' => 'required']);
     $bugTrackingPriority->addValidator(new PresenceOf(['message' => 'Priority is required']));
     $this->add($bugTrackingPriority);
     $notify = new Select('role_id', UserRoles::find(['conditions' => 'location = 1']), ['using' => ['id', 'name'], 'useEmpty' => true, 'required' => 'required']);
     $notify->addValidator(new PresenceOf(['message' => 'Notify is required']));
     $this->add($notify);
 }
 public function initialize($model = null)
 {
     $title = new Text("title");
     $title->addValidator(new PresenceOf());
     $this->add($title);
     $this->add(new Text("code"));
     $status = new Select('status', array('0' => 'Không', '1' => 'Có'));
     $status->setDefault('1');
     $this->add($status);
     $this->add(new Text("image"));
     $this->add(new Select('featured', array('0' => 'Không', '1' => 'Có')));
     $this->add(new Text("position"));
     $this->add(new TextArea("content"));
 }
 /**
  * Initialize the products form
  */
 public function initialize($model = null, $options = array())
 {
     $nome = new Text("nome");
     $nome->setLabel("Nome");
     $nome->setFilters(array('striptags', 'string'));
     $nome->setAttribute('class', 'form-control');
     $this->add($nome);
     if (is_null($model)) {
         $categoria = new Select("parent", Categorias::returnArrayForSelect(), array('using' => array('_id', 'nome'), 'useEmpty' => true, 'emptyText' => 'Nenhuma', 'emptyValue' => ''));
         $categoria->setLabel("Selecione a categoria pai*");
         $categoria->setAttribute('class', 'form-control');
         $this->add($categoria);
     }
 }
Exemple #29
-1
 /**
  * Init user form
  *
  * @param \ZCMS\Core\Models\Users $data
  */
 public function initialize($data = null)
 {
     //Add first name
     $firstName = new Text('first_name', ['maxlength' => '32']);
     $firstName->addValidator(new PresenceOf());
     $this->add($firstName);
     //Add last name
     $lastName = new Text('last_name', ['maxlength' => '32']);
     $lastName->addValidator(new PresenceOf());
     $this->add($lastName);
     //Add email
     if ($data = null) {
         $email = new Email('email', ['maxlength' => '128', 'readonly' => 'readonly']);
     } else {
         $email = new Email('email', ['maxlength' => '128']);
     }
     $this->add($email);
     //Add active
     $is_active = new Select('is_active', ['1' => __('gb_yes'), '0' => __('gb_no')]);
     $this->add($is_active);
     //Add password confirmation
     $password_confirmation = new Password('password_confirmation', ['maxlength' => '32']);
     $password_confirmation->addValidator(new StringLength(['min' => 6]));
     $this->add($password_confirmation);
     //Add password
     $password = new Password('password', ['maxlength' => '32']);
     $password->addValidator(new StringLength(['min' => 6]));
     $password->addValidator(new Confirmation(['message' => 'm_system_user_message_password_does_not_match_confirmation', 'with' => 'password_confirmation']));
     $this->add($password);
     //Add role
     $dbRoles = UserRoles::find(['conditions' => 'is_super_admin = 0', 'order' => 'is_default DESC']);
     $role = new Select('role_id', $dbRoles, ['using' => ['role_id', 'name']]);
     $role->addValidator(new InclusionIn(['message' => 'm_system_user_message_please_choose_role', 'domain' => array_column($dbRoles->toArray(), 'role_id')]));
     $this->add($role);
 }
 function initialize($entity = null, $options = null)
 {
     $date = new Date('date_found');
     $date->setLabel('Input Date Found');
     $date->setFilters(array('striptags', 'string'));
     $this->add($date);
     /*====================== Number =====================*/
     $number = new Text('number');
     $number->setLabel('Input Number');
     $number->setFilters(array('striptags', 'string'));
     $number->addValidators(array(new PresenceOf(array('message' => 'Number is required'))));
     $this->add($number);
     /*====================== Solved =====================*/
     $isSolved = new Radio('is_solved', array('name' => 'is_solved', 'value' => '1'));
     $isSolved->setLabel('Is Solved');
     $isSolved->addValidators(array(new PresenceOf(array('message' => 'Is solved is required'))));
     $this->add($isSolved);
     $isSolved2 = new Radio('is_solved2', array('name' => 'is_solved', 'value' => '0', 'checked' => TRUE));
     $isSolved2->setLabel('Is Solved2');
     $isSolved2->addValidators(array(new PresenceOf(array('message' => 'Is solved is required'))));
     $this->add($isSolved2);
     $systemId = new Select('system_id', Systems::find(), array('using' => array('id', 'name'), 'useEmpty' => true));
     $systemId->setLabel('Select System');
     $systemId->addValidators(array(new PresenceOf(array('message' => 'System is required'))));
     if ($entity) {
         $systemId->setDefault(array($entity->system_id));
     }
     $this->add($systemId);
     $modulesId = new Select('modules_id', Modules::find(), array('using' => array('id', 'name'), 'useEmpty' => true));
     $modulesId->setLabel('Select Modules');
     $modulesId->addValidators(array(new PresenceOf(array('message' => 'Modules is required'))));
     if ($entity) {
         $modulesId->setDefault(array($entity->modules_id));
     }
     $this->add($modulesId);
     /*===== Bug =============*/
     $systemId = new Select('system_id', Systems::find(), array('using' => array('id', 'name'), 'useEmpty' => true));
     $systemId->setLabel('Select System');
     $systemId->addValidators(array(new PresenceOf(array('message' => 'System is required'))));
     if ($entity) {
         $systemId->setDefault(array($entity->system_id));
     }
     $this->add($systemId);
     $description = new TextArea('description');
     $description->setLabel('Input Description');
     $description->addValidators(array(new PresenceOf(array('message' => 'Description is required'))));
     $this->add($description);
     $hidden = new Hidden('id');
     if ($entity) {
         $hidden->setDefault(array($entity->id));
     }
     $this->add($hidden);
 }