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


PHP form::checkbox方法代码示例

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


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

示例1: display_category_checkbox

 /**
  * Displays a single category checkbox.
  */
 public static function display_category_checkbox($category, $selected_categories, $form_field, $enable_parents = FALSE)
 {
     $html = '';
     $cid = $category->id;
     // Get locale
     $l = Kohana::config('locale.language.0');
     $category_title = Category_Lang_Model::category_title($cid, $l);
     //$category_title = $category->category_title;
     $category_color = $category->category_color;
     // Category is selected.
     $category_checked = in_array($cid, $selected_categories);
     // Visible Child Count
     $vis_child_count = 0;
     foreach ($category->children as $child) {
         $child_visible = $child->category_visible;
         if ($child_visible) {
             // Increment Visible Child count
             ++$vis_child_count;
         }
     }
     $disabled = "";
     if (!$enable_parents and $category->children->count() > 0 and $vis_child_count > 0) {
         $disabled = " disabled=\"disabled\"";
     }
     $html .= form::checkbox($form_field . '[]', $cid, $category_checked, ' class="check-box"' . $disabled);
     $html .= $category_title;
     return $html;
 }
开发者ID:neumicro,项目名称:Ushahidi_Web_Dev,代码行数:31,代码来源:category.php

示例2: postLine

 private function postLine()
 {
     $img = '<img alt="%1$s" title="%1$s" src="images/%2$s" />';
     switch ($this->rs->post_status) {
         case 1:
             $img_status = sprintf($img, __('published'), 'check-on.png');
             break;
         case 0:
             $img_status = sprintf($img, __('unpublished'), 'check-off.png');
             break;
         case -1:
             $img_status = sprintf($img, __('scheduled'), 'scheduled.png');
             break;
         case -2:
             $img_status = sprintf($img, __('pending'), 'check-wrn.png');
             break;
     }
     $protected = '';
     if ($this->rs->post_password) {
         $protected = sprintf($img, __('protected'), 'locker.png');
     }
     $selected = '';
     if ($this->rs->post_selected) {
         $selected = sprintf($img, __('selected'), 'selected.png');
     }
     $attach = '';
     $nb_media = $this->rs->countMedia();
     if ($nb_media > 0) {
         $attach_str = $nb_media == 1 ? __('%d attachment') : __('%d attachments');
         $attach = sprintf($img, sprintf($attach_str, $nb_media), 'attach.png');
     }
     $res = '<tr class="line' . ($this->rs->post_status != 1 ? ' offline' : '') . '"' . ' id="p' . $this->rs->post_id . '">';
     $res .= '<td class="nowrap">' . form::checkbox(array('entries[]'), $this->rs->post_id, '', '', '', !$this->rs->isEditable()) . '</td>' . '<td class="maximal"><a href="' . $this->core->getPostAdminURL($this->rs->post_type, $this->rs->post_id) . '">' . html::escapeHTML($this->rs->post_title) . '</a></td>' . '<td class="nowrap">' . dt::dt2str(__('%Y-%m-%d %H:%M'), $this->rs->post_dt) . '</td>' . '<td class="nowrap">' . $this->rs->user_id . '</td>' . '<td class="nowrap">' . $this->rs->nb_comment . '</td>' . '<td class="nowrap">' . $this->rs->nb_trackback . '</td>' . '<td class="nowrap status">' . $img_status . ' ' . $selected . ' ' . $protected . ' ' . $attach . '</td>' . '</tr>';
     return $res;
 }
开发者ID:HackerMajor,项目名称:root,代码行数:35,代码来源:list.php

示例3: 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

示例4: input

 public function input($name, array $attr = NULL)
 {
     $inputs = array();
     foreach ($this->choices as $value => $label) {
         $inputs[] = form::checkbox("{$name}[]", $value, in_array($value, $this->value)) . ' ' . $label;
     }
     return $inputs;
 }
开发者ID:vitch,项目名称:sprig,代码行数:8,代码来源:manytomany.php

示例5: CheckboxGroup

 public static function CheckboxGroup($name, $checks, $check_checked = null, $styles = null)
 {
     $ret = null;
     foreach ($checks as $value => $label) {
         $ret .= "<p>" . form::checkbox("{$name}[{$value}]", TRUE, @$check_checked[$value]) . "{$label}</p>";
     }
     return $ret;
 }
开发者ID:brojasmeneses,项目名称:floreriarosabel,代码行数:8,代码来源:fpp.php

示例6: __toString

 public function __toString()
 {
     $field = $this->field_name;
     $choices = $this->args->choices;
     $checks[$this->field_value] = $this->field_value;
     $check = $this->field_value == 1 ? TRUE : FALSE;
     return form::checkbox($field, '1', $check) . '<span>' . $this->args->verbose . '</span>';
 }
开发者ID:brojasmeneses,项目名称:floreriarosabel,代码行数:8,代码来源:CheckField.php

示例7: buildForm

 private function buildForm()
 {
     $options = array('method' => "POST", 'enctype' => "multipart/form-data", 'action' => '/blog/formular/add', 'width' => '400px');
     $form = new \form('testing', $options);
     $form->label('checkbox');
     $form->checkbox('checkbox test', 'testcheckbox', 'check', '');
     $form->checkbox('checkbox test2', 'testcheckbox', 'check2', true);
     $form->label('radio');
     $form->radio('radio test', 'testradio', 'radio', '');
     $form->radio('radio test 2', 'testradio', 'radio2', true);
     $form->label('textarea');
     $form->text('textarea', ' ', ['error' => $this->error['textarea']]);
     $form->select('autos', ['a' => 'audi', 'b' => 'vw', 'c' => 'toyota'], 'b', ['label' => 'auto select']);
     $form->text('username', '', ['placeholder' => 'username', 'label' => 'Username', 'error' => $this->error['username']]);
     $form->password('password', '', ['label' => 'Password', 'error' => $this->error['password']]);
     $form->button('senden', ['type' => 'submit']);
     return $form;
 }
开发者ID:karimo255,项目名称:blog,代码行数:18,代码来源:formular.php

示例8: getCheckboxes

 /**
  * getcheckboxes -returns html code for selected entries
  * 			as a table containing entries checkboxes
  *
  * @access public
  *
  * @return string the html code for checkboxes
  */
 public function getCheckboxes()
 {
     $ret = '<table class="posts-list"><tr>' . '<th colspan="2">' . __('Author') . '</th><th>' . __('Title') . '</th>' . '</tr>';
     foreach ($this->entries as $id => $title) {
         $ret .= '<tr><td class="minimal">' . form::checkbox(array($this->field_entries . '[]'), $id, true, '', '') . '</td>' . '<td>' . $title['author'] . '</td><td>' . $title['title'] . '</td></tr>';
     }
     $ret .= '</table>';
     return $ret;
 }
开发者ID:nikrou,项目名称:dotclear,代码行数:17,代码来源:class.dcactioncomments.php

示例9: display_category_checkbox

 /**
  * Displays a single category checkbox.
  */
 public static function display_category_checkbox($category, $selected_categories, $form_field)
 {
     $html = '';
     $cid = $category->id;
     $category_title = $category->category_title;
     $category_color = $category->category_color;
     // Category is selected.
     $category_checked = in_array($cid, $selected_categories);
     $html .= form::checkbox($form_field . '[]', $cid, $category_checked, ' class="check-box"');
     $html .= $category_title;
     return $html;
 }
开发者ID:surflightroy,项目名称:Ushahidi_Web,代码行数:15,代码来源:category.php

示例10: parse_array

function parse_array($arr)
{
    foreach ($arr as $key => $value) {
        $db = DB::select()->from('categories')->where('id', '=', $key)->execute();
        echo '<ul><li>';
        echo '<b>Название:</b> ' . form::input('name[]', $db[0]['name'], array('onkeyup' => 'translit(\'name[]\', \'url[]\');')) . form::hidden('cid[]', $db[0]['id']) . '&nbsp;';
        echo '<b>URL:</b> ' . form::input('url[]', $db[0]['url']) . '&nbsp;';
        echo '<b>Удалить?</b> ' . form::checkbox('delete[]', $db[0]['id']);
        echo '</li>';
        if (is_array($value)) {
            parse_array($value);
        }
        echo '</ul>';
    }
}
开发者ID:phpdude,项目名称:Purpled-Blog-Engine,代码行数:15,代码来源:categories.php

示例11: display_category_checkbox

 /**
  * Displays a single category checkbox.
  */
 private static function display_category_checkbox($category, $selected_categories, $form_field, $enable_parents = FALSE)
 {
     $html = '';
     $cid = $category['category_id'];
     // Category is selected.
     $category_checked = in_array($cid, $selected_categories);
     $disabled = "";
     if (!$enable_parents and count($category['children']) > 0) {
         $disabled = " disabled=\"disabled\"";
     }
     $html .= "<label>";
     $html .= form::checkbox($form_field . '[]', $cid, $category_checked, ' class="check-box"' . $disabled);
     $html .= $category['category_title'];
     $html .= "</label>";
     return $html;
 }
开发者ID:niiyatii,项目名称:crowdmap,代码行数:19,代码来源:category.php

示例12: display_category_checkbox

 /**
  * Displays a single category checkbox.
  */
 public static function display_category_checkbox($category, $selected_categories, $form_field)
 {
     $html = '';
     $cid = $category->id;
     $category_title = $category->category_title;
     $category_color = $category->category_color;
     // Category is selected.
     $category_checked = in_array($cid, $selected_categories);
     $disabled = "";
     if ($category->children->count() > 0) {
         $disabled = " disabled=\"disabled\"";
     }
     $html .= form::checkbox($form_field . '[]', $cid, $category_checked, ' class="check-box"' . $disabled);
     $html .= $category_title;
     return $html;
 }
开发者ID:CarolNjoroge,项目名称:Ushahidi_Web,代码行数:19,代码来源:category.php

示例13: postLine

 private function postLine($count, $checked)
 {
     $img = '<img alt="%1$s" title="%1$s" src="images/%2$s" />';
     $sts_class = '';
     switch ($this->rs->post_status) {
         case 1:
             $img_status = sprintf($img, __('Published'), 'check-on.png');
             $sts_class = 'sts-online';
             break;
         case 0:
             $img_status = sprintf($img, __('Unpublished'), 'check-off.png');
             $sts_class = 'sts-offline';
             break;
         case -1:
             $img_status = sprintf($img, __('Scheduled'), 'scheduled.png');
             $sts_class = 'sts-scheduled';
             break;
         case -2:
             $img_status = sprintf($img, __('Pending'), 'check-wrn.png');
             $sts_class = 'sts-pending';
             break;
     }
     $protected = '';
     if ($this->rs->post_password) {
         $protected = sprintf($img, __('Protected'), 'locker.png');
     }
     $selected = '';
     if ($this->rs->post_selected) {
         $selected = sprintf($img, __('Hidden'), 'hidden.png');
     }
     $attach = '';
     $nb_media = $this->rs->countMedia();
     if ($nb_media > 0) {
         $attach_str = $nb_media == 1 ? __('%d attachment') : __('%d attachments');
         $attach = sprintf($img, sprintf($attach_str, $nb_media), 'attach.png');
     }
     $res = '<tr class="line ' . ($this->rs->post_status != 1 ? 'offline ' : '') . $sts_class . '"' . ' id="p' . $this->rs->post_id . '">';
     $cols = array('position' => '<td class="nowrap handle minimal">' . form::field(array('order[' . $this->rs->post_id . ']'), 2, 3, $count + 1, 'position', '', false, 'title="' . sprintf(__('position of %s'), html::escapeHTML($this->rs->post_title)) . '"') . '</td>', 'check' => '<td class="nowrap">' . form::checkbox(array('entries[]'), $this->rs->post_id, $checked, '', '', !$this->rs->isEditable(), 'title="' . __('Select this page') . '"') . '</td>', 'title' => '<td class="maximal" scope="row"><a href="' . $this->core->getPostAdminURL($this->rs->post_type, $this->rs->post_id) . '">' . html::escapeHTML($this->rs->post_title) . '</a></td>', 'date' => '<td class="nowrap">' . dt::dt2str(__('%Y-%m-%d %H:%M'), $this->rs->post_dt) . '</td>', 'author' => '<td class="nowrap">' . $this->rs->user_id . '</td>', 'comments' => '<td class="nowrap count">' . $this->rs->nb_comment . '</td>', 'trackbacks' => '<td class="nowrap count">' . $this->rs->nb_trackback . '</td>', 'status' => '<td class="nowrap status">' . $img_status . ' ' . $selected . ' ' . $protected . ' ' . $attach . '</td>');
     $cols = new ArrayObject($cols);
     $this->core->callBehavior('adminPagesListValue', $this->core, $this->rs, $cols);
     $res .= implode(iterator_to_array($cols));
     $res .= '</tr>';
     return $res;
 }
开发者ID:nikrou,项目名称:dotclear,代码行数:44,代码来源:class.listpage.php

示例14: getPositionCheckbox

 function getPositionCheckbox($model, $id = NULL, $type = 'house')
 {
     import("ORG.Util.Form");
     // 载入推荐位
     $positions = $this->table(array(C('DB_PREFIX') . "model_type" => "type", C('DB_PREFIX') . "position" => "pos"))->where("type.id = pos.typeid and type.module = '%s'", $model)->order("pos.listorder desc")->field('pos.*')->select();
     $position_array = array_translate($positions);
     if (!empty($id)) {
         // 获取选中推荐位
         $posids = D('PositionData')->where(array('type' => $type, 'module' => $model, 'id' => $id))->group("posid")->field('posid')->select();
     }
     $position_data_ids = array();
     foreach ($posids as $key => $pos) {
         $position_data_ids[] = $pos['posid'];
     }
     $posids = implode(',', $position_data_ids);
     $posidstr = form::checkbox($position_array, $posids, "name='info[posids][]'", '', 125);
     // END 推荐位载入
     return $posidstr;
 }
开发者ID:lxp521125,项目名称:TP-Admin,代码行数:19,代码来源:PositionModel.class.php

示例15: getHtmlField

 public function getHtmlField($aPostedData)
 {
     $return = '';
     switch ($this->type) {
         # Champ texte
         default:
         case 1:
             $return = '<p class="field" id="' . $this->html_id . '-wrapper">' . '<label for="' . $this->html_id . '"' . ($this->status == 2 ? ' class="required" title="' . __('c_c_required_field') . '"' : '') . '>' . html::escapeHTML($this->title) . '</label>' . form::text($this->html_id, 60, 255, $aPostedData[$this->id]) . '</p>';
             break;
             # Zone de texte
         # Zone de texte
         case 2:
             $return = '<p class="field" id="' . $this->html_id . '-wrapper">' . '<label for="' . $this->html_id . '"' . ($this->status == 2 ? ' class="required" title="' . __('c_c_required_field') . '"' : '') . '>' . html::escapeHTML($this->title) . '</label>' . form::textarea($this->html_id, 58, 10, $aPostedData[$this->id]) . '</p>';
             break;
             # Menu déroulant
         # Menu déroulant
         case 3:
             $values = array_filter((array) unserialize($this->value));
             $return = '<p class="field" id="' . $this->html_id . '-wrapper">' . '<label for="' . $this->html_id . '"' . ($this->status == 2 ? ' class="required" title="' . __('c_c_required_field') . '"' : '') . '>' . html::escapeHTML($this->title) . '</label>' . form::select($this->html_id, array_flip($values), $aPostedData[$this->id]) . '</p>';
             break;
             # Boutons radio
         # Boutons radio
         case 4:
             $values = array_filter((array) unserialize($this->value));
             $str = '';
             foreach ($values as $k => $v) {
                 $str .= '<li><label>' . form::radio(array($this->html_id, $this->html_id . '_' . $k), $k, $k == $aPostedData[$this->id]) . html::escapeHTML($v) . '</label></li>';
             }
             $return = '<p class="field" id="' . $this->html_id . '-wrapper">' . '<span class="fake-label">' . html::escapeHTML($this->title) . '</span></p>' . '<ul class="checklist">' . $str . '</ul>';
             break;
             # Cases à cocher
         # Cases à cocher
         case 5:
             $values = array_filter((array) unserialize($this->value));
             $str = '';
             foreach ($values as $k => $v) {
                 $str .= '<li><label>' . form::checkbox(array($this->html_id . '[' . $k . ']', $this->html_id . '_' . $k), $k, in_array($k, $aPostedData[$this->id])) . html::escapeHTML($v) . '</label></li>';
             }
             $return = '<p class="field" id="' . $this->html_id . '-wrapper">' . '<span class="fake-label">' . html::escapeHTML($this->title) . '</span></p>' . '<ul class="checklist">' . $str . '</ul>';
             break;
     }
     return $return;
 }
开发者ID:jewelhuq,项目名称:okatea,代码行数:43,代码来源:class.users.fields.recordset.php


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