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


PHP FormHelper::checkbox方法代码示例

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


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

示例1: file

 /**
  * ファイルインプットボックス出力
  * 画像の場合は画像タグ、その他の場合はファイルへのリンク
  * そして削除用のチェックボックスを表示する
  * [カスタムオプション]
  * imgsize・・・画像のサイズを指定する
  * 
  * @param string $fieldName
  * @param array $options
  * @return string
  * @access public
  */
 function file($fieldName, $options = array())
 {
     $linkOptions = $_options = array('imgsize' => 'midium', 'rel' => '', 'title' => '');
     $options = $this->_initInputField($fieldName, Set::merge($_options, $options));
     $linkOptions['imgsize'] = $options['imgsize'];
     $linkOptions['rel'] = $options['rel'];
     $linkOptions['title'] = $options['title'];
     unset($options['imgsize']);
     unset($options['rel']);
     unset($options['title']);
     $view =& ClassRegistry::getObject('view');
     $_field = $view->entity();
     $modelName = $_field[0];
     $field = $_field[1];
     if (ClassRegistry::isKeySet($modelName)) {
         $model =& ClassRegistry::getObject($modelName);
     } else {
         return;
     }
     $fileLinkTag = $this->fileLink($fieldName, $linkOptions);
     $fileTag = parent::file($fieldName, $options);
     $delCheckTag = parent::checkbox($modelName . '.' . $field . '_delete') . parent::label($modelName . '.' . $field . '_delete', '削除する');
     $hiddenValue = $this->value($fieldName . '_');
     $fileValue = $this->value($fieldName);
     if (is_array($fileValue) && empty($fileValue['tmp_name']) && $hiddenValue) {
         $hiddenTag = parent::hidden($modelName . '.' . $field . '_', array('value' => $hiddenValue));
     } else {
         $hiddenTag = parent::hidden($modelName . '.' . $field . '_', array('value' => $this->value($fieldName)));
     }
     $out = $fileTag;
     if ($fileLinkTag) {
         $out .= '&nbsp;' . $delCheckTag . $hiddenTag . '<br />' . $fileLinkTag;
     }
     return '<div class="upload-file">' . $out . '</div>';
 }
开发者ID:nojimage,项目名称:basercms,代码行数:47,代码来源:upload.php

示例2: render

 public function render()
 {
     if ($this->getValue()) {
         $file = Toolkit::i()->fileStorage->bucket($this->getBucketName())->getFile($this->getValue());
         echo '<a target="_blank" href="' . $file->getFileUrl() . '">' . $this->getValue() . '</a>';
         echo '<br />';
         echo FormHelper::checkbox($this->getAlias() . '_delete', false, ['id' => $this->getAlias() . '_delete']);
         echo ' ' . FormHelper::labelFor($this->getAlias() . '_delete', 'Удалить');
     }
     echo FormHelper::file($this->getAlias(), $this->getValue(), array('id' => 'field_' . $this->getAlias()));
 }
开发者ID:ruxon,项目名称:module-ruxon,代码行数:11,代码来源:RuxonFormViewFileColumn.class.php

示例3: render

 public function render()
 {
     if ($this->getValue()) {
         $file = Toolkit::i()->fileStorage->bucket($this->getBucketName())->getImage($this->getValue());
         echo '<img src="' . $file->getThumbUrl(100) . '" alt="" />';
         echo '<br />';
         echo FormHelper::checkbox($this->getAlias() . '_delete', false, ['id' => $this->getAlias() . '_delete']);
         echo ' ' . FormHelper::labelFor($this->getAlias() . '_delete', 'Удалить');
     }
     echo FormHelper::file($this->getAlias(), $this->getValue(), array('id' => 'field_' . $this->getAlias()));
 }
开发者ID:ruxon,项目名称:module-ruxon,代码行数:11,代码来源:RuxonFormViewImageColumn.class.php

示例4: checkbox

 public function checkbox($fieldName, $options = array())
 {
     $label = $this->_extractOption('label', $this->_Opts[$fieldName]);
     if (!is_array($label)) {
         $label = array('text' => $label);
     }
     $after = $this->_extractOption('after', $this->_Opts[$fieldName]);
     if ($this->_isHorizontal) {
         $label['text'] = $after;
         $label['class'] = null;
     }
     $label = $this->addClass($label, 'checkbox');
     $text = $label['text'];
     unset($label['text']);
     $out = parent::checkbox($fieldName, $options) . $text;
     return $this->label($fieldName, $out, $label);
 }
开发者ID:rolandschuetz,项目名称:AIC_SentimentAnalysis,代码行数:17,代码来源:BootstrapFormHelper.php

示例5: checkbox

 public function checkbox($fieldName, $options, $before = false)
 {
     if ($before) {
         if ('checkbox' === $options['type']) {
             if (!$this->_extractOption('div', $options)) {
                 $options['label'] = false;
             } else {
                 $options['after'] = null;
             }
         }
         return $options;
     } else {
         $label = $this->_extractOption('label', $this->_Opts[$fieldName]);
         if (!is_array($label)) {
             $label = array('text' => $label);
         }
         $after = $this->_extractOption('after', $this->_Opts[$fieldName]);
         if ($this->_extractOption('div', $this->_Opts[$fieldName])) {
             $label['text'] = $after;
             $label['class'] = null;
         }
         $label = $this->addClass($label, 'checkbox');
         $text = $label['text'];
         unset($label['text']);
         $out = parent::checkbox($fieldName, $options) . $text;
         return $this->label($fieldName, $out, $label);
     }
 }
开发者ID:racklin,项目名称:TwitterBootstrap,代码行数:28,代码来源:BootstrapFormHelper.php

示例6: checkbox

 public function checkbox($fieldName, $options = array())
 {
     if ($options['class'] == 'form-control') {
         $options['class'] = false;
     }
     return parent::checkbox($fieldName, $options);
 }
开发者ID:piotr0beschel,项目名称:CakeUI,代码行数:7,代码来源:BootstrapFormHelper.php

示例7:

echo $this->getModel()->fieldTitle('Password');
?>
</label>
        <div class="col-sm-10">
            <?php 
echo FormHelper::password('Password');
?>
        </div>
    </div>

    <div class="form-group">
        <div class="controls">
            <div class="col-sm-offset-2 col-sm-10 checkbox-group">
                <label class="col-sm-10" for="field_RememberMe">
                    <?php 
echo FormHelper::checkbox('RememberMe');
?>
                    <?php 
echo $this->getModel()->fieldTitle('RememberMe');
?>
                </label>
            </div>
        </div>
    </div>

    <div class="form-group">
        <div class="col-sm-offset-2 col-sm-10">
            <button class="btn btn-primary" type="submit"><?php 
echo $this->t('Basic', 'Enter');
?>
</button>
开发者ID:ruxon,项目名称:app,代码行数:31,代码来源:Login.tpl.php

示例8: array

echo FormHelper::radios('alignment', array('' => 'Aucun', 'right' => 'Droite', 'center' => 'Centrer', 'left' => 'Gauche'), '');
?>
 
				</div>
	
				<div class="<?php 
echo ++$i % 2 ? 'odd' : 'even';
?>
">
					<label for="link">Lien</label>
					<?php 
echo FormHelper::text('href', '', array('size' => '100'));
?>
<br />
					<?php 
echo FormHelper::checkbox('target', '_blank', '_blank');
?>
 Ouvrir dans une nouvelle fenêtre
				</div>
				</fieldset>	
				
				<div>
					<input class="button" type="submit" value="Insérer dans l'éditeur"> 
					ou
					<a class="cancel" href="<?php 
echo UrlComponent::path(array('action' => 'insertionIndex'));
?>
">Annuler</a> 
				</div>
			</form>
		
开发者ID:nicolasmartin,项目名称:framework,代码行数:30,代码来源:insertion-edit.tpl.php

示例9: testCheckbox

 public function testCheckbox()
 {
     $this->assertEqual(FormHelper::checkbox('name', 'value', null, array('class' => 'myClass')), '<input type="checkbox" name="name" class="myClass" value="value" id="name">');
     $this->assertEqual(FormHelper::checkbox('name', 'value', 'value', array('class' => 'myClass')), '<input type="checkbox" name="name" class="myClass" value="value" id="name" checked="checked">');
     $this->assertEqual(FormHelper::checkbox('name', $this->Model, 'obj', array('class' => 'myClass')), '<input type="checkbox" name="name" class="myClass" value="obj" id="name" checked="checked">');
 }
开发者ID:nicolasmartin,项目名称:framework,代码行数:6,代码来源:helper.form.php

示例10: testCheckbox

 public function testCheckbox()
 {
     $html = $this->object->checkbox('element', 'value', true, array('arbitrary' => 'arbitrary', 'class' => 'test-class'));
     $this->assertAttributes($html, array('class' => array('test-class', 'ccm-input-checkbox'), 'arbitrary' => 'arbitrary'));
 }
开发者ID:notzen,项目名称:concrete5-tests,代码行数:5,代码来源:FormHelperTest.php

示例11: _checkbox

 /**
  * displays a single checkbox - called for each
  */
 public function _checkbox($id, $group = null, $options = array())
 {
     $defaults = array('class' => 'checkboxToggle');
     $options = am($defaults, $options);
     return $script . parent::checkbox($fieldName, $options);
 }
开发者ID:robksawyer,项目名称:grabitdown,代码行数:9,代码来源:FormExtHelper.php

示例12: checkbox

 /**
  * Creates a checkbox input widget.
  *
  * Extends of FormHelper::checkbox() so get same options and params
  *
  * Prefer use this function and not BsFormHelper::input() to create checkbox - better results and automatically adapted to Twitter Bootstrap v3
  *
  * ### New Options:
  *
  * - `inline` - choose if you want inline checkbox - 'false' by default, can take 2 values : 'inline' or 'true'
  * - `help` - Add a message under the checkbox to give more informations
  *			  Use this option in an array with the label
  *			  Example : input('foo', array(
  *											'label' => 'name',
  *											'help' => 'informations'
  *										)
  *							);
  *
  * ### Options by default for Twitter Bootstrap v3
  *
  * - 'div' - Set to 'false'
  * - 'label' - Set to 'false'
  * - 'label' - Add a 'control-label' class and if the form is horizontal, put the label into the left column of it
  *
  * ### Options can be extends with no conflicts when the input is being created
  *
  * - 'class'
  * - 'label' - string and array
  *
  * ### In case of multiple checkboxes -> use the Bs3FormHelper::select()
  *
  * Some options are added
  * - 'help' - can be for each, always with an array in parameter
  * - 'hiddenField' - 'false' by default
  *
  * @param string $fieldName Name of a field, like this "Modelname.fieldname"
  * @param array $options Array of HTML attributes.
  *
  * @return string An HTML text input element.
  */
 public function checkbox($fieldName, $options = array())
 {
     $basicOptions = array('help' => false, 'state' => false, 'label' => Inflector::camelize($fieldName), 'label-class' => '');
     $options = $this->__errorBootstrap($fieldName, $options);
     foreach ($basicOptions as $opt => $valueOpt) {
         if (isset($options[$opt])) {
             $basicOptions[$opt] = $options[$opt];
             unset($options[$opt]);
         }
     }
     $checkbox = parent::checkbox($fieldName, $options);
     $checkbox .= $basicOptions['label'] !== false ? ' ' . $basicOptions['label'] : '';
     $checkbox .= $basicOptions['help'] ? '<span class="help-block">' . $basicOptions['help'] . '</span>' : '';
     $options['type'] = 'checkbox';
     $label = array('text' => $checkbox);
     if (!empty($basicOptions['label-class'])) {
         $label['class'] = $basicOptions['label-class'];
     }
     return $this->__buildCheckboxBefore($basicOptions['state']) . $this->_inputLabel($fieldName, $label, $options) . $this->__buildCheckboxAfter($basicOptions['state']);
 }
开发者ID:xhs345,项目名称:CakePHP-BsHelpers,代码行数:60,代码来源:BsFormHelper.php

示例13: array

    }
</style>
<div class="content">
<div class="panel-default">
<?php 
global $db;
$id = Request::get('ident');
if ($id) {
    $u = $db->getResult('user', '*', 'id=' . $id, true);
} else {
    $u = array("name" => "", "email" => "", "active" => "", "id" => 0);
}
FormHelper::create('formUsuario');
FormHelper::input('name', "Nome", $u['name'], array('placeholder' => 'Digite o nome', 'style' => 'max-width:400px', 'validation' => array('regex' => FormHelper::NOT_EMPTY, 'message' => 'Preencha o <strong>Nome</strong>.')));
FormHelper::input('email', "E-mail", $u['email'], array('placeholder' => 'Digite o e-mail', 'style' => 'max-width:400px', 'validation' => array('regex' => FormHelper::EMAIL, 'message' => 'Digite um <strong>E-mail</strong> válido.')));
FormHelper::checkbox('active', "Ativo", $u['active']);
// ligação many to many para user_module
$options = array('Nenhum', 'Visualizar', 'Incluir', 'Editar', 'Excluir');
if ($id) {
    ?>
<h4>Permissões</h4>
    <div class="form-group <?php 
    echo $m['permission'];
    ?>
_group">
        <?php 
    $modules = $db->query('select id,name,permission from module');
    $levels = $db->query("select level from user_module where user_id=" . $u['id']);
    if (count($levels) == 0) {
        $levels = array();
        foreach ($modules as $m) {
开发者ID:neurosoftbrasil,项目名称:adminns,代码行数:31,代码来源:editar.php

示例14: checkbox

 /**
  * Creates a checkbox input widget.
  *
  * Extends of FormHelper::checkbox() so get same options and params
  *
  * Prefer use this function and not BsFormHelper::input() to create checkbox - better results and automatically adapted to Twitter Bootstrap v3
  *
  * ### New Options:
  *
  * - `inline` - choose if you want inline checkbox - 'false' by default, can take 2 values : 'inline' or 'true'
  * - `help` - Add a message under the checkbox to give more informations
  *			  Use this option in an array with the label
  *			  Example : input('foo', array(
  *											'label' => 'name', 
  *											'help' => 'informations'
  *										)
  *							);
  *
  * ### Options by default for Twitter Bootstrap v3
  *
  * - 'div' - Set to 'false'
  * - 'label' - Set to 'false'
  * - 'label' - Add a 'control-label' class and if the form is horizontal, put the label into the left column of it
  *
  * ### Options can be extends with no conflicts when the input is being created
  *
  * - 'class'
  * - 'label' - string and array
  *
  * ### In case of multiple checkboxes -> use the Bs3FormHelper::select()
  *
  * Some options are added
  * - 'help' - can be for each, always with an array in parameter
  * - 'hiddenField' - 'false' by default
  *
  * @param string $fieldName Name of a field, like this "Modelname.fieldname"
  * @param array $options Array of HTML attributes.
  * @return string An HTML text input element.
  */
 public function checkbox($fieldName, $options = array())
 {
     //----- [div] option
     if (!isset($options['div'])) {
         $options['div'] = false;
     }
     //----- [label] option
     if (!isset($options['label'])) {
         $options['label'] = false;
     }
     $out = '';
     if ($this->_getFormType() == 'horizontal') {
         $out .= '<div class="form-group">';
         $out .= '<div class="col-md-offset-' . $this->left . ' col-md-' . $this->right . '">';
     }
     //----- [inline] option
     if (!(isset($options['inline']) && ($options['inline'] == 'inline' || $options['inline'] == true))) {
         $out .= '<div class="checkbox">';
         $out .= '<label>';
     } else {
         $out .= '<label class="checkbox-inline">';
     }
     $out .= parent::checkbox($fieldName, $options);
     //----- [label] option
     if ($options['label'] != false) {
         // If options are array('label' => 'text')
         if (is_array($options['label'])) {
             $out .= ' ' . $options['label']['label'];
         } else {
             $out .= ' ' . $options['label'];
         }
     } else {
         $out .= ' ' . Inflector::camelize($fieldName);
     }
     $out .= '</label>';
     //----- [help] option for multiple checkboxes ([label] is an array)
     if (is_array($options['label']) && isset($options['label']['help']) && !empty($options['label']['help'])) {
         $out .= '<span class="help-block">' . $options['label']['help'] . '</span>';
     }
     //----- [inline] option
     if (!(isset($options['inline']) && ($options['inline'] == 'inline' || $options['inline'] == true))) {
         $out .= '</div>';
     }
     $out .= SP;
     //----- [help] option for single checkbox
     if ($this->_getFormType() == 'horizontal') {
         if (isset($options['help']) && !empty($options['help'])) {
             $out .= '<span class="help-block">' . $options['help'] . '</span>';
         }
         $out .= '</div></div>';
     }
     return $out;
 }
开发者ID:bramas,项目名称:cakephp2-admin,代码行数:92,代码来源:AdminFormHelper.php

示例15: _checkbox

 /**
  * Displays a single checkbox - called for each
  * //FIXME
  *
  * @return string
  */
 protected function _checkbox($id, $group = null, $options = array())
 {
     $defaults = array('class' => 'checkbox-toggle checkboxToggle');
     $options += $defaults;
     return $script . parent::checkbox($fieldName, $options);
 }
开发者ID:miznokruge,项目名称:base-cake,代码行数:12,代码来源:FormExtHelper.php


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