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); }
public function __toString() { $field = $this->field_name; $choices = $this->args->choices; $select = $this->field_value; return form::dropdown($field, $choices, $select); }
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; }
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; }
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); }
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); }
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; }
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; }
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); }
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); }
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); }
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); }
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; }
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); }
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>'; }
public function html_element() { // Import base data $base_data = $this->data; unset($base_data['label']); if (isset($base_data['multiple']) && !!$base_data['multiple']) { $base_data['name'] = str_replace('[]', '', $base_data['name']) . '[]'; } // 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); }
public function edit($id) { if ($this->input->post()) { $this->save($id); } $tournament = ORM::factory('tournament', $id); $games = ORM::factory('game'); $games_list = $games->select_list('id', 'name'); $this->theme->content = new View('tournament/edit'); $this->theme->content->id = $tournament->id; $this->theme->content->name = $tournament->name; $this->theme->content->select_game = form::dropdown('tournament_game', $games_list, $tournament->game_id); $this->theme->content->begin_date = date('d-m-Y', strtotime($tournament->begin_date)); $this->theme->content->end_date = date('d-m-Y', strtotime($tournament->end_date)); $this->theme->render(TRUE); }
private function __under_development() { $UNDER_DEVELOPMENT = ORM::factory('setting', 'UNDER_DEVELOPMENT'); if (isset($_POST['UNDER_DEVELOPMENT'])) { $UNDER_DEVELOPMENT->value = $_POST['UNDER_DEVELOPMENT']; $UNDER_DEVELOPMENT->save(); } $data = array("name" => "UNDER_DEVELOPMENT", "class" => "fullWidth"); $options = array(null => "YES", "1" => "NO"); $selected = $UNDER_DEVELOPMENT->value; $html = form::open(); $html .= form::label('UNDER_DEVELOPMENT', 'Under Development'); $html .= form::dropdown($data, $options, $selected); $html .= form::submit('submit', 'Save', 'class="submit"') . '<p> </p><p> </p>'; $html .= form::close(); return $html; }
protected function _generate_body_cell($index, $key) { // variables $body = $this->body_data; $value = $body[$index][$key]; $name = $this->post_id . '[' .$body[$index][$this->data_id]. '][' .$key. ']'; // data $type = $this->default_type; $data = NULL; if(array_key_exists($key, $this->control_types)) { $type = $this->control_types[$key][0]; $data = $this->control_types[$key][1]; } // html $str = ''; switch($type) { case 'text': $str = form::input($name, $value); break; case 'dropdown': $str = form::dropdown($name, $data, $value); break; case 'radio': case 'checkbox': foreach($data as $d) { $str .= form::$type($name, $d, $value == $d, 'style="width:auto"') . ' ' . ucwords($d) . ' '; if($type == 'checkbox') { $str .= '<br />'; } } break; default: $str = $value; } return '<td>' . $str . '</td>'; }
function getbygroup($grp) { $model = new fpp_pay_per_weight_Model(); $orm = $model->db2cls(); $orm->limit = null; $list = $orm->fetch_where(array('type' => $grp)); $dlist = array(); foreach ($list as $row) { $dlist[$row->id_ppw] = __($row->name, false); } $droporigin = array("-- " . __('Seleccione', false) . " --"); $dropdown = $dlist; $dropdown = $droporigin + $dropdown; $dropdown = form::dropdown("ship_weight_{$grp}", $dropdown, @$_POST['ship_weight_' . $grp], ' class="shipw" id="ship_weight_' . $grp . '"'); $string_html = "<div class='shipping_title'>" . __($grp, false) . "</div><div class='shipping_select'>" . $dropdown . '</div><div style="float: left; width: 10px;padding: 5px;"><span class="obligatorio">*</span></div>'; return $string_html; }
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('nullOption' => FALSE); $data = arr::merge($defaults, $data); $options = TTSEngine::catalog(); if ($data['nullOption']) { array_unshift($options, $data['nullOption']); } $data = array_diff($data, $defaults); // use kohana helper to generate the markup return form::dropdown($data, $options, $selected, $extra); }
public function __toString() { /* Construyendo el Query */ $new_array = array(); if (@$this->args->schema == "0k") { $html = 1; $table = new fpp_category_Model(); $orm = $table->db2cls(); $orm->limit = null; $rl1 = $orm->fetch_all(array('cat_id' => 'ASC', 'order_cat' => 'DESC')); foreach ($rl1 as $row) { if ($row->cat_id == $this->args->initlevel) { $new_array[$row->id_category] = $row; $new_array[$row->id_category]->sub = array(); } else { $new_array[$row->cat_id]->sub[] = $row; } } foreach ($new_array as $row) { if (!(@$row->id_category == '')) { $drop[$row->id_category] = $row->name_category; foreach ($row->sub as $sub) { $drop[$sub->id_category] = " " . $sub->name_category; } // $html .= "</ul>"; } else { $row = @$row->sub[0]; $drop[$row->id_category] = $row->name_category; } } } else { $select[] = $this->args->db_value . ' as value '; $select[] = $this->args->db_label . ' as label '; $one_to_one = $this->db->from($this->args->db_table)->select($select)->get(); /* Construyendo el Array del Dropdown */ $drop = array(); foreach ($one_to_one as $row) { $drop[$row->value] = $row->label; } } $html = $this->AjaxConstruct(form::dropdown($this->field_name, @$drop, $this->field_value)); return $html; }
public static function dropdownCIDFormat($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', ' sip_invite_format_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']); $options = Sip_Plugin::getCIDFormats(); // use kohana helper to generate the markup return form::dropdown($data, $options, $selected, $extra); }
public function customize() { $id = $this->uri->segment(3); if (!$id || isset($_POST['cancel'])) { url::redirect('discounts'); } $db = new Database(); if (isset($_POST['submit'])) { $db->delete('discounts_objects', array('discount_id' => $id)); if (isset($_POST['objects'])) { foreach ($_POST['objects'] as $object_id) { $db->insert('discounts_objects', array('discount_id' => $id, 'object_id' => $object_id)); } } url::redirect('discounts'); } $this->discount = ORM::factory('discount')->where('id', $id)->find(); $type = ORM::factory('discounts_type', $this->discount->type_id); if ($type->table == '') { url::redirect('discounts/?msg=' . urlencode('You can not costumize that type of discount')); } $list = $this->getList($type->table, 'id', $type->name_field); $rows = $db->select('object_id')->from('discounts_objects')->where('discount_id=' . $id)->get(); //var_dump($rows); die(); $values = array(); foreach ($rows as $row) { $values[] = $row->object_id; } $this->select = form::dropdown(array('name' => 'objects[]', 'multiple' => 'multiple', 'size' => 20), $list, $values); $view = new View('admin'); $view->header = new View('header'); $view->content = new View('discount_customize'); $view->footer = new View('footer'); $view->header->title = 'Discount >> Manage '; // string for variable $title in view header.php $view->content->heading = 'Manage discount action'; // string for variable $heading in view content.php $view->render(TRUE); }
public static function dropdown($data, $selected = NULL, $extra = '', $nullOption = 'None') { // 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' => 'None'); arr::update($data, 'class', ' voicemail_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']); $voicemails = Doctrine::getTable('Voicemail')->findAll(Doctrine::HYDRATE_ARRAY); foreach ($voicemails as $voicemail) { $options[$voicemail['voicemail_id']] = $voicemail['name']; } return form::dropdown($data, $options, $selected, $extra); }
private function _DropDown() { /* Construyendo el Query */ $Model = "fpp_" . $this->secondM . '_Model'; $Model = new $Model(); $select[] = $Model->_FirstPrimary . ' as value '; $select[] = $this->args->db_label . ' as label '; $this->args->db_table = $this->secondM; //compatibilidad para obtener el Link AJAX fpp_tdp #34 $metaModel = $Model->Get_Meta(); $agroup = FALSE; if ($this->args->set_group != null) { $str_json = explode("choices=", $metaModel[$this->args->set_group]); $str_json = explode("}", $str_json[1]); $str_json = json_decode(str_replace(";", ",", $str_json[0] . '}')); // var_dump($str_json); $order = $this->args->set_group; $select[] = $order . ' as group '; $one_to_one = $this->db->from($this->secondM)->select($select)->orderby(array($order => 'ASC', $this->args->db_label => 'ASC'))->get(); $agroup = TRUE; } else { $one_to_one = $this->db->from($this->secondM)->select($select)->get(); } $drop = $this->OrderCat($one_to_one, $agroup, $str_json); /* Construyendo el Array del Dropdown */ // foreach($one_to_one as $row){ // if($agroup == TRUE){ // $vl = $row->group; // $vl = $str_json->$vl; // $drop[$vl][$row->value] = $row->label; // }else{ // $drop[$row->value] = $row->label; // } // // } $html = $this->AjaxConstruct(form::dropdown($this->field_name . '[]', @$drop, $this->field_value, ' multiple="multiple" class="kfpp_otm"')); return $html; }
public function create() { if ($this->a2->logged_in()) { //cannot create new accounts when a user is logged in $this->index(); } // Create a new user $user = ORM::factory('user'); if ($user->validate($_POST, TRUE)) { // user created, show login form $this->login(); } else { //show form echo form::open(); echo 'username:'******'username') . '<br>'; echo 'password:'******'password') . '<br>'; echo 'password confirm:' . form::password('password_confirm') . '<br>'; echo 'role:' . form::dropdown('role', array('user' => 'user', 'admin' => 'admin')) . '<br>'; echo form::submit(array('value' => 'create')); echo form::close(); } echo Kohana::debug($_POST->as_array(), $user->as_array()); }
<h4><a href="#" class="tooltip" title="<?php echo Kohana::lang("tooltips.settings_configure_map"); ?> "><?php echo Kohana::lang('settings.configure_map'); ?> </a></h4> <div style="width: 279px; float: left; margin-top: 10px;"> <span class="bold_span"><?php echo Kohana::lang('settings.default_zoom_level'); ?> </span> <div class="slider_container"> <?php print form::dropdown('default_zoom', $default_zoom_array, $form['default_zoom']); ?> </div> </div> <div style="width: 279px; height: 90px; float: left; margin-top: 10px;"> <span class="bold_span"><?php echo Kohana::lang('settings.default_map_view'); ?> </span> <span class="my-sel-holder"><select><option><?php echo Kohana::lang('ui_main.map'); ?> </option></select></span> <div class="location-info"> <span><?php echo Kohana::lang('ui_main.latitude');
<?php echo $micro_thumb_grid; ?> </ul> </div> <div id="g-organize-controls" class="ui-widget-header"> <a id="g-organize-close" href="#" ref="done" class="g-button g-right ui-corner-all ui-state-default"><?php echo t("Close"); ?> </a> <form> <?php echo t("Sort order"); ?> <?php echo form::dropdown(array("id" => "g-organize-sort-column"), album::get_sort_order_options(), $album->sort_column); ?> <?php echo form::dropdown(array("id" => "g-organize-sort-order"), array("ASC" => "Ascending", "DESC" => "Descending"), $album->sort_order); ?> </form> </div> </div> </div> </div> <script type="text/javascript"> $("#g-organize").ready($.organize.init); </script>
<?php print form::dropdown('allow_stat_sharing', $yesno_array, $form['allow_stat_sharing']); ?> </span> </div> <div class="row"> <h4><a href="#" class="tooltip" title="<?php echo Kohana::lang("tooltips.settings_allow_clustering"); ?> "><?php echo Kohana::lang('settings.site.allow_clustering'); ?> </a></h4> <span class="sel-holder"> <?php print form::dropdown('allow_clustering', $yesno_array, $form['allow_clustering']); ?> </span> </div> <div class="row"> <h4><a href="#" class="tooltip" title="<?php echo Kohana::lang("tooltips.settings_default_category_colors"); ?> "><?php echo Kohana::lang('settings.site.default_category_colors'); ?> </a></h4> <?php print form::input('default_map_all', $form['default_map_all'], ' class="text"'); ?> <script type="text/javascript" charset="utf-8">