Exemplo n.º 1
0
 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);
     if (isset($entity)) {
         if ($entity->getCountryid()) {
             $state = new Select('stateid', State::find(array("columns" => array("id,state"), "conditions" => "countryid =:countryid:", "bind" => array("countryid" => $entity->countryid))), array("useEmpty" => true, "emptyText" => $this->di->get('translate')->_('Seleccione un Estado'), 'using' => array('id', 'state')));
             $state->setLabel('Estado');
             $this->add($state);
             $city = new Select('cityid', City::find(array("columns" => array("id,city"), "conditions" => "countryid =:countryid: AND stateid =:stateid: ", "bind" => array("countryid" => $entity->countryid, "stateid" => $entity->stateid))), array("useEmpty" => true, "emptyText" => $this->di->get('translate')->_('Seleccione una ciudad'), 'using' => array('id', 'city')));
             $city->setLabel('Ciudad');
             $this->add($city);
             $township = new Select('townshipid', Township::find(array("columns" => array("id,township"), "conditions" => "cityid =:cityid:", "bind" => array("cityid" => $entity->cityid))), array("useEmpty" => true, "emptyText" => $this->di->get('translate')->_('Seleccione un Sector'), 'using' => array('id', 'township')));
             $township->setLabel('Sector');
             $this->add($township);
             $neighborhood = new Select('neighborhoodid', Neighborhood::find(array("columns" => array("id,neighborhood"), "conditions" => "cityid =:cityid:", "bind" => array("cityid" => $entity->cityid))), array("useEmpty" => true, "emptyText" => $this->di->get('translate')->_('Seleccione un Barrio'), 'using' => array('id', 'neighborhood')));
             $neighborhood->setLabel('Barrio');
             $this->add($neighborhood);
         } else {
             $this->set_empty_values();
         }
     } else {
         $this->set_empty_values();
     }
     $address = new Textarea('address', array("maxlength" => "400"));
     $address->setLabel('Dirección');
     $this->add($address);
     $description = new Textarea('description', array("maxlength" => "100"));
     $description->setLabel('Descripción');
     $this->add($description);
 }
Exemplo n.º 2
0
 public function initialize()
 {
     $this->add(new Text('name', array('maxlength' => 100, 'type' => 'text', 'placeholder' => 'Nombre de la cuenta', 'required' => 'required', 'class' => 'form-control', 'id' => 'name')));
     $this->add(new Text('nit', array('maxlength' => 20, 'type' => 'text', 'placeholder' => 'NIT', 'class' => 'form-control', 'id' => 'nit')));
     $this->add(new Email('email', array('maxlength' => 100, 'type' => 'email', 'placeholder' => 'Dirección de correo eléctronico', 'required' => 'required', 'class' => 'form-control', 'id' => 'email')));
     $this->add(new Text('phone', array('maxlength' => 30, 'type' => 'text', 'placeholder' => 'Número de télefono o celular', 'required' => 'required', 'class' => 'form-control', 'id' => 'phone')));
     $this->add(new Text('address', array('maxlength' => 100, 'type' => 'text', 'placeholder' => 'Dirección', 'required' => 'required', 'class' => 'form-control', 'id' => 'phone')));
     $countries = array("" => "Seleccione una opción");
     foreach (Country::find() as $country) {
         $countries[$country->idCountry] = $country->name;
     }
     $this->add(new Select('idCountry', $countries, array('class' => 'form-control', 'required' => 'required')));
     $this->add(new Select('state', array(), array('class' => 'form-control', 'required' => 'required')));
     $this->add(new Select('city', array(), array('class' => 'form-control', 'required' => 'required')));
     $this->add(new Text('accountName', array('maxlength' => 100, 'type' => 'text', 'placeholder' => 'Nombre de la cuenta', 'required' => 'required', 'class' => 'form-control', 'id' => 'name')));
     $this->add(new Email('accountEmail', array('maxlength' => 100, 'type' => 'email', 'placeholder' => 'Dirección de correo eléctronico', 'required' => 'required', 'class' => 'form-control', 'id' => 'email')));
     $this->add(new Text('accountPhone', array('maxlength' => 30, 'type' => 'text', 'placeholder' => 'Número de télefono o celular', 'required' => 'required', 'class' => 'form-control', 'id' => 'phone')));
     $this->add(new Text('accountAddress', array('maxlength' => 100, 'type' => 'text', 'placeholder' => 'Dirección', 'required' => 'required', 'class' => 'form-control', 'id' => 'phone')));
     $this->add(new Select('idAccountplan', array()));
     $accounttypes = array("" => "Seleccione una opción");
     foreach (Accounttype::find() as $accounttype) {
         $accounttypes[$accounttype->idAccounttype] = $accounttype->name;
     }
     $this->add(new Select('idAccounttype', $accounttypes, array('class' => 'select2 form-control', 'required' => 'required')));
     $this->add(new Check('status', array('value' => 1, 'id' => 'status', 'class' => 'onoffswitch-checkbox', 'id' => 'status')));
 }
Exemplo n.º 3
0
 /**
  * For listing the Country
  * @author        Praveen Singh
  * @method        getCountry
  * @param         $module_id,$group_id
  * @return        one row of Module Role table 
  * @since         version 0.0.1
  * @version       0.2.9
  */
 function getCountry($cntId)
 {
     App::import("Model", "Country");
     $model = new Country();
     $datas = $model->find("first", array('conditions' => array('Country.id' => $cntId)));
     return $datas;
 }
Exemplo n.º 4
0
 /**
  * Verify if exist
  */
 private function dataExist($id)
 {
     $data = Country::find($id);
     if (!$data) {
         return Redirect::route('country_list')->with('mError', 'Ce pays est introuvable !');
     } else {
         return $data;
     }
 }
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     Log::info('LLega el id: ' . $id);
     $country = Country::find($id);
     Log::info($country);
     if (!$country) {
         return $this->errorNotFound('Country not found');
     }
     return $this->respondWithItem($country, new CountryTransformer());
 }
Exemplo n.º 6
0
 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')));
 }
 public function show($id)
 {
     // get country
     $country = Country::find($id);
     if ($country == null) {
         return App::abort('404');
     }
     // init
     $data = array('menu' => $this->_menu, 'title' => 'Negara - ' . $country->name, 'description' => '', 'breadcrumb' => array('Negara' => route('admin.country'), $country->name => route('admin.country.show', $country->id)));
     // Set country
     $data['country'] = $country;
     return View::make('admin.pages.country.show')->with($data);
 }
Exemplo n.º 8
0
 private function generate_countries($_selected, $_name = 'country')
 {
     $criteria = array('columns' => "country_code, country", 'order' => "country");
     $countries = Country::find($criteria);
     echo '<select class="field" id="' . $_name . '" name="' . $_name . '">' . "\n";
     foreach ($countries as $country) {
         if ($country['country_code'] != $_selected) {
             echo '<option value="' . $country['country_code'] . '">' . $country['country'] . '</option>' . "\n";
         } else {
             echo '<option value="' . $country['country_code'] . '" selected>' . $country['country'] . '</option>' . "\n";
         }
     }
     echo '</select>' . "\n";
 }
Exemplo n.º 9
0
 protected function saveModel($country = false)
 {
     if (Input::get('id')) {
         $country = Country::find(Input::get('id'));
     }
     if (!$country) {
         $country = new Country();
     }
     $country->name = Input::get('name');
     $country->abbreviation = Input::get('abbreviation');
     $country->visa_work_permit_required = Input::get('visa_work_permit_required');
     $country->visa_work_permit_procedure = Input::get('visa_work_permit_procedure');
     $country->notes = Input::get('notes');
     return $country;
 }
Exemplo n.º 10
0
 public function get_country_flags()
 {
     $files = glob('metronic/assets/global/img/flags/*.{png}', GLOB_BRACE);
     $countries = Country::find(array("order" => "country asc"))->toArray();
     foreach ($countries as $country) {
         foreach ($files as $file) {
             if (strtoupper($country['code']) == strtoupper(basename($file, ".png"))) {
                 $flags[strtolower($country['code']) . '.png'] = basename($this->di->get('translate')->_($country['country']));
             }
         }
     }
     // Order Array By Translate Value
     asort($flags);
     return $flags;
 }
Exemplo n.º 11
0
 public function initialize()
 {
     $this->add(new Text('name', array('maxlength' => 100, 'type' => 'text', 'placeholder' => 'Nombre', 'required' => 'required', 'autofocus' => "autofocus", 'class' => 'form-control', 'id' => 'name')));
     $this->add(new Select('idCountry', Country::find(), array('using' => array('idCountry', 'name'), 'class' => 'form-control select2', 'required' => 'required', 'id' => 'idCountry')));
     $this->add(new Numeric('surveyQuantity', array('maxlength' => 11, 'min' => 0, 'placeholder' => 'Cantidad de encuestas', 'required' => 'required', 'class' => 'form-control', 'id' => 'surveyQuantity')));
     $this->add(new Numeric('questionQuantity', array('maxlength' => 11, 'min' => 0, 'placeholder' => 'Cantidad de preguntas por encuesta', 'required' => 'required', 'class' => 'form-control', 'id' => 'questionQuantity')));
     $this->add(new Numeric('userQuantity', array('maxlength' => 11, 'min' => 0, 'placeholder' => 'Cantidad de usuarios permitidos en la cuenta', 'required' => 'required', 'class' => 'form-control', 'id' => 'userQuantity')));
     $this->add(new Numeric('sitesQuantity', array('maxlength' => 11, 'min' => 0, 'placeholder' => 'Cantidad de sitios permitidos en la cuenta', 'required' => 'required', 'class' => 'form-control', 'id' => 'sitesQuantity')));
     $this->add(new Check('advertising', array('value' => 1, 'id' => 'advertising', 'class' => 'onoffswitch-checkbox')));
     $this->add(new Check('sendSMS', array('value' => 1, 'id' => 'sendSMS', 'class' => 'onoffswitch-checkbox')));
     $this->add(new Check('sendSMSAuto', array('value' => 1, 'id' => 'sendSMSAuto', 'class' => 'onoffswitch-checkbox')));
     $this->add(new Check('quickView', array('value' => 1, 'id' => 'quickView', 'class' => 'onoffswitch-checkbox')));
     $this->add(new Check('exportContact', array('value' => 1, 'id' => 'exportContact', 'class' => 'onoffswitch-checkbox')));
     $this->add(new Numeric('price', array('maxlength' => 100, 'type' => 'number', 'min' => 0, 'step' => 'any', 'placeholder' => 'Valor en Colombia', 'required' => 'required', 'class' => 'form-control', 'id' => 'price')));
     $this->add(new Check('status', array('value' => 1, 'id' => 'status', 'class' => 'onoffswitch-checkbox')));
 }
Exemplo n.º 12
0
 public function initialize($entity = null, $options = null)
 {
     $country = new Select('countryid', Country::find(), array('using' => array('id', 'country'), 'useEmpty' => TRUE, 'emptyText' => 'Seleccione un País'));
     $country->setLabel('Pais');
     $this->add($country);
     if (isset($entity)) {
         $state = new Select('stateid', State::find(array("columns" => array("id,state"), "conditions" => "id = :id: OR countryid =:countryid:", "bind" => array("id" => $entity->stateid, "countryid" => $entity->countryid))), array("useEmpty" => true, "emptyText" => 'Seleccione un Estado', 'using' => array('id', 'state')));
         $state->setLabel('Estado');
         $this->add($state);
     } else {
         $state = new Select('stateid', array(), array('useEmpty' => TRUE, 'emptyText' => 'Seleccione un Estado'));
         $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')));
 }
Exemplo n.º 13
0
 /**
  * Shows the view to "edit" an existing product
  */
 public function editAction($id)
 {
     if (!parent::isValidId($id)) {
         return parent::redirect('proxy');
     }
     $proxy = Proxy::findFirst($id);
     if ($proxy) {
         $reflection = new FormReflectionManager($this->flash);
         $proxy->countryId = $reflection->get('countryId') ?: $proxy->countryId;
         $proxy->address = $reflection->get('address') ?: $proxy->address;
         $this->view->proxy = $proxy;
         $this->view->countries = Country::find();
     } else {
         $this->flash->error('Identifier not found.');
         return parent::redirect('proxy');
     }
     #$this->view->disable();
 }
Exemplo n.º 14
0
 private function generateCountries($selected)
 {
     $countries_options_html = '<select class="field" id="country" name="country">' . "\n";
     $criteria = array('columns' => "country_code, country");
     $countries = Country::find($criteria);
     if (empty($selected) || is_null($selected) || $selected == '0') {
         $countries_options_html .= '<option value="0" selected>Please select a country.</option>' . "\n";
     } else {
         $countries_options_html .= '<option value="0">Please select a country.</option>' . "\n";
     }
     $countries_options_html .= '<option value="0" disabled>&nbsp;</option>' . "\n";
     foreach ($countries as $country) {
         if ($country['country_code'] != $selected) {
             $countries_options_html .= '<option value="' . $country['country_code'] . '">' . $country['country'] . '</option>' . "\n";
         } else {
             $countries_options_html .= '<option value="' . $country['country_code'] . '" selected>' . $country['country'] . '</option>' . "\n";
         }
     }
     $countries_options_html .= '</select>' . "\n";
     return $countries_options_html;
 }
Exemplo n.º 15
0
 public function initialize($entity = null, $options = array())
 {
     if (!isset($options['edit'])) {
         $element = new Text("id");
         $this->add($element->setLabel("Id"));
     } else {
         $this->add(new Hidden("id"));
     }
     $name = new Text("name");
     $name->addValidator(new PresenceOf(array('message' => 'The name is required')));
     $name->setLabel("名称");
     $this->add($name);
     $category = new Select('category_id', Category::find("isParent=0 and status=1"), array('using' => array('id', 'name'), 'useEmpty' => true, 'emptyText' => '...', 'emptyValue' => ''));
     $category->setLabel('类型');
     $this->add($category);
     $country = new Select('country_id', Country::find(), array('using' => array('id', 'name'), 'useEmpty' => true, 'emptyText' => '...', 'emptyValue' => ''));
     $country->setLabel('国家');
     $this->add($country);
     $price = new Text("price");
     $price->setLabel("价格");
     $this->add($price);
     $stock = new Text("stock");
     $stock->setLabel("库存");
     $this->add($stock);
     $color = new Text("color");
     $color->addValidator(new PresenceOf(array('message' => 'The color is required')));
     $color->setLabel("颜色");
     $this->add($color);
     $size = new Text("size");
     $size->addValidator(new PresenceOf(array('message' => 'The size is required')));
     $size->setLabel("尺码");
     $this->add($size);
     $covImg = new File("covImg");
     $covImg->setLabel("主图");
     $this->add($covImg);
 }
Exemplo n.º 16
0
 public function updateFromStruct($struct)
 {
     $allowed = array('nickname', 'clan', 'steam_id', 'firstname', 'surname', 'dateofbirth', 'address1', 'address2', 'towncity', 'county', 'postcode', 'phone', 'activation_code', 'activated', 'suspended', 'allow_emails', 'terms', 'forum_id', 'referral_type');
     foreach ($allowed as $name) {
         if (array_key_exists($name, $struct)) {
             switch ($name) {
                 case 'country':
                     $countryName = mysql_real_escape_string($struct['country']);
                     $country = Country::find("countries.name = '{$countryName}'");
                     if ($country) {
                         $this->country_id = $country;
                     }
                     break;
                 default:
                     $this->{$name} = $struct[$name];
                     break;
             }
         }
     }
     return $this->save();
 }
Exemplo n.º 17
0
 function eliminar($id)
 {
     $a = Country::find($id);
     $a->delete();
     $this->session->set_flashdata('msg', '<div class="success">El pais fué eliminado correctamente.</div>');
     redirect('paises');
 }
Exemplo n.º 18
0
 private function generate_countries($_selected, $_name = 'country')
 {
     $country_options_str = '<select class="field" id="' . $_name . '" name="' . $_name . '">' . "\n";
     $criteria = array('columns' => "country_code, country", 'order' => "country");
     $countries = Country::find($criteria);
     if (empty($_selected) || is_null($_selected) || $_selected == '0') {
         $country_options_str .= '<option value="0" selected>Please select a county.</option>' . "\n";
     } else {
         $country_options_str .= '<option value="0">Please select a country.</option>' . "\n";
     }
     $country_options_str .= '<option value="0">&nbsp;</option>';
     foreach ($countries as $country) {
         if ($country['country_code'] != $_selected) {
             $country_options_str .= '<option value="' . $country['country_code'] . '">' . $country['country'] . '</option>' . "\n";
         } else {
             $country_options_str .= '<option value="' . $country['country_code'] . '" selected>' . $country['country'] . '</option>' . "\n";
         }
     }
     $country_options_str .= '</select>' . "\n";
     return $country_options_str;
 }
Exemplo n.º 19
0
 /**
  * The start action, it shows the "search" view
  */
 public function indexAction()
 {
     $countries = Country::find();
     $this->view->countries = $countries;
     #$this->view->disable();
 }
Exemplo n.º 20
0
 public function actionTest()
 {
     $contries = Country::find()->orderBy('name')->all();
     var_dump($contries);
 }
Exemplo n.º 21
0
 function addressMetaData($action)
 {
     //        $optionState = array();
     //        $optionState['order'] = array('state_name' => 'asc', 'active' => '1');
     //        $optionState['conditions'] = array('zone_id' => $address['zone_id'], 'active' => '1');
     if (isset($this->params['named']['copy_address']) || $action == 'edit' || $action == 'copy') {
         App::import('Model', 'Country');
         $objCountry = new Country();
         App::import('Model', 'Zone');
         $objZone = new Zone();
         App::import('Model', 'State');
         $objState = new State();
         App::import('Model', 'District');
         $objDistrict = new District();
         App::import('Model', 'City');
         $objCity = new City();
         $optionZone = array();
         $optionDistrict = array();
         $optionCity = array();
         if (!empty($this->viewVars[lcfirst($this->modelClass)]['Address'])) {
             $address = $this->viewVars[lcfirst($this->modelClass)]['Address'];
             $optionCountry['conditions'] = array('id' => $address['country_id'], 'active' => '1');
             $optionZone['conditions'] = array('id' => $address['zone_id'], 'active' => '1');
             $optionState['conditions'] = array('id' => $address['state_id'], 'active' => '1');
             $optionDistrict['conditions'] = array('id' => $address['district_id'], 'active' => '1');
             $optionCity['conditions'] = array('id' => $address['city_id'], 'active' => '1');
         }
         $countries = $objCountry->find('list', $optionCountry);
         $zones = $objZone->find('list', $optionZone);
         $states = $objState->find('list', $optionState);
         $districts = $objDistrict->find('list', $optionDistrict);
         $cities = $objCity->find('list', $optionCity);
         $this->set(compact('countries', 'zones', 'states', 'districts', 'cities'));
     }
 }
Exemplo n.º 22
0
 public function show($id)
 {
     $author = User::findOrFail($id);
     $country = Country::find($author->country_id);
     return view("user.index")->with('user', $author)->with('country', $country);
 }