本文整理汇总了PHP中Country::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Country::find方法的具体用法?PHP Country::find怎么用?PHP Country::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Country
的用法示例。
在下文中一共展示了Country::find方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initialize
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);
}
示例2: initialize
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')));
}
示例3: getCountry
/**
* 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;
}
示例4: dataExist
/**
* 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;
}
}
示例5: show
/**
* 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());
}
示例6: initialize
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')));
}
示例7: show
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);
}
示例8: generate_countries
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";
}
示例9: saveModel
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;
}
示例10: get_country_flags
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;
}
示例11: initialize
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')));
}
示例12: initialize
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')));
}
示例13: editAction
/**
* 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();
}
示例14: generateCountries
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> </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;
}
示例15: initialize
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);
}