当前位置: 首页>>代码示例>>PHP>>正文


PHP form::dropdown方法代码示例

本文整理汇总了PHP中form::dropdown方法的典型用法代码示例。如果您正苦于以下问题:PHP form::dropdown方法的具体用法?PHP form::dropdown怎么用?PHP form::dropdown使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在form的用法示例。


在下文中一共展示了form::dropdown方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: dropdownUserType

 public static function dropdownUserType($data, $selected = NULL, $extra = '')
 {
     // standardize the $data as an array, strings default to the class_type
     if (!is_array($data)) {
         $data = array('name' => $data);
     }
     // add in all the defaults if they are not provided
     $data += array('nullOption' => FALSE);
     // append or insert the class
     $data = arr::update($data, 'class', 'user_type_dropdown');
     // render a null option if its been set in data
     if (!empty($data['nullOption'])) {
         $options = array(0 => $data['nullOption']);
     } else {
         $options = array();
     }
     unset($data['nullOption']);
     $userTypes = self::getUserTypes();
     foreach ($userTypes as $userType => $displayName) {
         if ($userType <= users::getAttr('user_type')) {
             $options[$userType] = $displayName;
         }
     }
     // use kohana helper to generate the markup
     return form::dropdown($data, $options, $selected, $extra);
 }
开发者ID:swk,项目名称:bluebox,代码行数:26,代码来源:usermanager.php

示例2: __toString

 public function __toString()
 {
     $field = $this->field_name;
     $choices = $this->args->choices;
     $select = $this->field_value;
     return form::dropdown($field, $choices, $select);
 }
开发者ID:brojasmeneses,项目名称:floreriarosabel,代码行数:7,代码来源:DropdownField.php

示例3: html_element

 public function html_element()
 {
     // Import base data
     $data = $this->data;
     // Get the options and default selection
     $time = $this->time_array(arr::remove('value', $data));
     // No labels or values
     unset($data['label']);
     $input = '';
     foreach ($this->parts as $type => $val) {
         if (is_int($type)) {
             // Just add the separators
             $input .= $val;
             continue;
         }
         // Set this input name
         $data['name'] = $this->data['name'] . '[' . $type . ']';
         // Set the selected option
         $selected = $time[$type];
         if ($type == 'am_pm') {
             // Options are static
             $options = array('AM' => 'AM', 'PM' => 'PM');
         } else {
             // minute(s), hour(s), etc
             $type .= 's';
             // Use the date helper to generate the options
             $options = empty($val) ? date::$type() : call_user_func_array(array('date', $type), $val);
         }
         $input .= form::dropdown($data, $options, $selected);
     }
     return $input;
 }
开发者ID:JasonWiki,项目名称:docs,代码行数:32,代码来源:Form_Dateselect.php

示例4: __technorati

 public function __technorati()
 {
     $html = "";
     $html .= '<p><a href="http://technorati.com/" target="_BLANK">What is technorati?</a></p>';
     if (isset($_POST['technorati'])) {
         $technorati_ping = ORM::factory('setting', 'technorati_ping');
         $technorati_ping->variable = 'technorati_ping';
         $technorati_ping->value = $_POST['technorati_ping'];
         $technorati_ping->save();
     }
     if (isset($_POST['technorati_ping_now'])) {
         zest::ping();
     }
     $html .= form::open(NULL);
     $html .= form::hidden('technorati', 'true');
     $html .= form::label('technorati_ping', 'Ping Technorati on feed update?');
     $options = array('yes' => 'yes', 'no' => 'no');
     $html .= form::dropdown('technorati_ping', $options, ORM::factory('setting', 'technorati_ping')->value, 'class="fullWidth"');
     $html .= form::submit('submit', 'Save', 'class="submit"') . '';
     $html .= form::close();
     $html .= form::open(NULL);
     $html .= form::hidden('technorati_ping_now', 'true');
     $html .= form::submit('submit', 'Ping Now', 'class="button"');
     $html .= form::close();
     return $html;
 }
开发者ID:sydlawrence,项目名称:SocialFeed,代码行数:26,代码来源:administrator.php

示例5: dropdown

 public static function dropdown($data, $selected = NULL, $extra = '')
 {
     // standardize the $data as an array, strings default to the class_type
     if (!is_array($data)) {
         $data = array('name' => $data);
     }
     // add in all the defaults if they are not provided
     $data += array('nullOption' => 'Account Default');
     $data = arr::update($data, 'class', ' callid_dropdown');
     // see if the module wants to allow null selections
     if (!empty($data['nullOption'])) {
         $options = array('0' => $data['nullOption']);
     } else {
         $options = array();
     }
     unset($data['nullOption']);
     // build an array of netlists sutable for the dropdown helper
     $numbers = Doctrine_Query::create()->from('Number n')->Where('LENGTH(n.number) >= 10 ')->execute(array(), Doctrine::HYDRATE_ARRAY);
     foreach ($numbers as $number) {
         $matches = array();
         preg_match('/^\\+?1?([2-9][0-8][0-9])([2-9][0-9][0-9])([0-9]{4})$/', $number['number'], $matches);
         if (count($matches) == 4) {
             $options[$number['number_id']] = '( ' . $matches[1] . ' ) ' . $matches[2] . ' - ' . $matches[3];
         } else {
             $options[$number['number_id']] = $number['number'];
         }
     }
     return form::dropdown($data, $options, $selected, $extra);
 }
开发者ID:swk,项目名称:bluebox,代码行数:29,代码来源:callid.php

示例6: dropdown

 public static function dropdown($data, $selected = NULL, $extra = '')
 {
     // standardize the $data as an array, strings default to the class_type
     if (!is_array($data)) {
         $data = array('name' => $data);
     }
     // add in all the defaults if they are not provided
     $defaults = array('null_option' => FALSE, 'default_first' => TRUE, 'unauth_before_auth' => FALSE);
     $data = arr::merge($defaults, $data);
     $options = array();
     $sipinterfaces = Doctrine::getTable('SipInterface')->findAll();
     foreach ($sipinterfaces as $sipinterface) {
         if (!($id = arr::get($sipinterface, 'sipinterface_id')) or !($name = arr::get($sipinterface, 'name'))) {
             continue;
         }
         if ($data['unauth_before_auth'] and !$sipinterface['auth'] or !$data['unauth_before_auth'] and $sipinterface['auth']) {
             arr::unshift_assoc($options, $id, $name);
             continue;
         }
         $options[$id] = $name;
     }
     if ($data['default_first'] and $default_sipinterface = SipInterface::get_default()) {
         unset($options[$default_sipinterface['sipinterface_id']]);
         arr::unshift_assoc($options, $default_sipinterface['sipinterface_id'], $default_sipinterface['name']);
     }
     if ($data['null_option']) {
         arr::unshift_assoc($options, 0, $data['null_option']);
     }
     $data = array_diff($data, $defaults);
     // use kohana helper to generate the markup
     return form::dropdown($data, $options, $selected, $extra);
 }
开发者ID:swk,项目名称:bluebox,代码行数:32,代码来源:sipinterfaces.php

示例7: __toString

 public function __toString()
 {
     /**
      * poa = product options atributes
      */
     //     echo Kohana::debug(@$_POST);
     $opa = new fpp_product_has_attributes_product_Model();
     $orm = $opa->db2cls();
     $uri = URI::Instance();
     $id = (int) $uri->segment("edit");
     if (request::method() == 'post' and is_array(@$_POST['opt'])) {
         $orm->delete(array('product_id_product' => $id));
         foreach ($_POST['opt'] as $key => $value) {
             $orm = $opa->db2cls();
             $data['product_id_product'] = $id;
             //         $data['ap_id_attributes_product']            = @$_POST['atr'][$key];
             $data['prefix'] = @$_POST['prefix'][$key];
             $data['vap_id_values_atributtes_product'] = @$_POST['opt'][$key];
             $data['value'] = @$_POST['val'][$key];
             $data['extra'] = @$_POST['extra'][$key];
             $orm->set_fields($data);
             $orm->save();
         }
     }
     $results = $this->GetAttr($id);
     //     fetch_where(array('product_id_product'=> ) );
     $atr_p = new fpp_attributes_product_Model();
     $orm_atrp = $atr_p->db2cls();
     $attributes = form::dropdown("poa_id", $orm_atrp->select_list('id_attributes_product', 'name_attributes_product'));
     $string = View::factory("extras/ajaxattributes")->set("attributes", $attributes)->set("results", $results)->render();
     return $string;
 }
开发者ID:brojasmeneses,项目名称:floreriarosabel,代码行数:32,代码来源:MY_OptionsProduct.php

示例8: index

 public function index($page = 1)
 {
     $db = new Database();
     // You can assign anything variable to a view by using standard OOP
     // methods. In my welcome view, the $title variable will be assigned
     // the value I give it here.
     $this->template->title = 'Welcome to YAG demo!';
     $grid = Grid::factory()->set('display_head', true)->set('display_foot', true)->set('display_body', true)->set('table_attributes', array('id' => 'demo_table_1', 'width' => '100%'));
     $grid->CheckboxField('id')->set('title', 'ID')->set('checked', array(2, 3, 4, 6, 9))->set('sortable', true)->set('foot', form::checkbox('checkall', 'yes', false, "onclick=\"check_all('id[]');\"") . form::dropdown('action', array('edit' => 'Edit', 'delete' => 'Delete'), 'edit') . form::submit('submit', 'OK'))->set('extra', array("onclick" => "checkbox_check('id[]')"));
     $grid->TextField('id')->set('title', 'ID')->set('sortable', true);
     $grid->TextField('text')->set('title', 'Text')->set('sortable', true);
     $grid->DateField('date')->set('title', 'Date')->set('format', 'Y-m-d')->set('sortable', true);
     $grid->ActionField()->set('title', 'Action')->add_action('edit', 'id', 'Edit', 'http://www.path.to/my/controller')->add_action('delete', 'id', 'Delete');
     $offset = (int) ($page - 1) * 10;
     $offset = $offset < 0 ? 0 : $offset;
     $order_field = 'id';
     $order_direction = 'asc';
     if ($this->input->get('order_by') and $grid->field_exists($order_field, true)) {
         $order_field = $this->input->get('order_by');
     }
     if ($this->input->get('order_direction') and in_array(strtoupper($this->input->get('order_direction')), array('ASC', 'DESC'))) {
         $order_direction = strtoupper($this->input->get('order_direction'));
     }
     $data = $db->select($grid->get_fields(true))->from('demotable')->limit(10)->offset($offset)->orderby($order_field, $order_direction)->get();
     $count = $db->query('SELECT FOUND_ROWS() AS rows;')->current();
     $this->pagination = new Pagination(array('total_items' => $count->rows, 'items_per_page' => 10));
     $grid->set('extra_row_foot', '<td colspan="' . count($grid->fields) . '">' . $this->pagination->render() . '</td>');
     $grid->set('data', $data);
     $html = $grid->render();
     // Get Javascript for checkbox gimmicks
     $this->template->checkall_js = $grid->render_js('checkall');
     $this->template->content = $html;
 }
开发者ID:ThorstenS,项目名称:YAG,代码行数:33,代码来源:yagdemo.php

示例9: as_you_know_us_select

 public static function as_you_know_us_select($name, $value)
 {
     $orm = new fpp_as_you_know_us_Model();
     $orm = $orm->db2cls();
     $select_list = $orm->select_list('id_as_you_know_us', 'name');
     return form::dropdown($name, $select_list, $value);
 }
开发者ID:brojasmeneses,项目名称:floreriarosabel,代码行数:7,代码来源:basics.php

示例10: create

 public function create()
 {
     $this->save();
     $games = ORM::factory('game');
     $games_list = $games->select_list('id', 'name');
     $this->theme->content = new View('scenario/create');
     $this->theme->content->select_game = form::dropdown('game_id', $games_list);
     $this->theme->render(TRUE);
 }
开发者ID:roberto722,项目名称:omgt,代码行数:9,代码来源:scenario.php

示例11: html_element

 public function html_element()
 {
     // Import base data
     $base_data = $this->data;
     unset($base_data['label']);
     // Get the options and default selection
     $options = arr::remove('options', $base_data);
     $selected = arr::remove('selected', $base_data);
     return form::dropdown($base_data, $options, $selected);
 }
开发者ID:TODDMAN,项目名称:gallery3-vendor,代码行数:10,代码来源:Form_Dropdown.php

示例12: dbmsSelector

 public function dbmsSelector($name = 'dbType', $default = NULL)
 {
     $availableDrivers = Doctrine_Manager::getInstance()->getCurrentConnection()->getAvailableDrivers();
     $supportedDrivers = Doctrine_Manager::getInstance()->getCurrentConnection()->getSupportedDrivers();
     $drivers = array_uintersect($availableDrivers, $supportedDrivers, 'strcasecmp');
     foreach ($drivers as $driver) {
         $driversPDO[$driver] = $driver;
     }
     $dbTypes = $driversPDO;
     return form::dropdown($name, $dbTypes, $default);
 }
开发者ID:swk,项目名称:bluebox,代码行数:11,代码来源:OdbcManager.php

示例13: html

 function html()
 {
     $model = new fpp_district_Model();
     $orm = $model->db2cls();
     $droporigin = array("-- SELECCIONE --");
     $dropdown = $orm->select_list('id_district', 'name_district');
     $dropdown = $droporigin + $dropdown;
     $dropdown = form::dropdown("ship_district", $dropdown, @$_POST['ship_district'], 'id="ship_district"');
     $string_html = "Seleccione : " . $dropdown;
     return $string_html;
 }
开发者ID:brojasmeneses,项目名称:floreriarosabel,代码行数:11,代码来源:Ship_district.php

示例14: delivery

 public function delivery()
 {
     $model = new fpp_district_Model();
     $orm = $model->db2cls();
     $droporigin = array("-- SELECCIONE --");
     $dropdown = $orm->select_list('name_district', 'name_district');
     $dropdown = $droporigin + $dropdown;
     $dropdown = form::dropdown("distrito", $dropdown, @$_POST['district']);
     $this->content = View::factory("main/pages_delivery")->set("title", "Delivery")->set("select_district", $dropdown)->set("msg", null)->set("content", null);
     $_SESSION['conf']['mailer'] = array('nombre' => true, 'email' => true, 'telefono' => true, 'comentarios' => true);
     $_SESSION['conf']['concat_mailer'] = array(0 => 'cantidad', 'cantidad' => true, 'producto' => true);
 }
开发者ID:brojasmeneses,项目名称:floreriarosabel,代码行数:12,代码来源:Page.php

示例15: footer

 static function footer($theme)
 {
     $base = MODPATH . "highroller/themes/";
     $base_len = strlen($base);
     $options[] = "<none>";
     foreach (glob("{$base}*") as $theme) {
         $name = substr($theme, $base_len);
         $options[$name] = $name;
     }
     $session = Session::instance();
     $highroller_theme = $session->get("highroller_theme");
     print '<div style="float: right"> Theme: ' . form::dropdown("", $options, $highroller_theme, 'style="display: inline" onchange="pick_theme(this.value)"') . '</div>';
 }
开发者ID:webmatter,项目名称:gallery3-contrib,代码行数:13,代码来源:highroller_theme.php


注:本文中的form::dropdown方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。