本文整理汇总了PHP中CHtml::submitButton方法的典型用法代码示例。如果您正苦于以下问题:PHP CHtml::submitButton方法的具体用法?PHP CHtml::submitButton怎么用?PHP CHtml::submitButton使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CHtml
的用法示例。
在下文中一共展示了CHtml::submitButton方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderButton
protected function renderButton($label, $metaData)
{
//Button can come from 2 system, by pluginSettings>settings>button ot by by pluginSettings>buttons
if (is_string($metaData)) {
$label = $metaData;
$metaData = array('htmlOptions' => array());
}
$metaData['class'][] = 'btn';
if (isset($metaData['type']) && $metaData['type'] == 'link') {
$metaData['class'][] = 'btn-link';
$metaData['class'][] = 'button';
}
$htmlOptions = $this->htmlOptions($metaData);
if (isset($metaData['type']) && $metaData['type'] == 'link') {
return CHtml::link($label, $metaData['href'], $htmlOptions);
// This allow cancel without js
} elseif (isset($metaData['type'])) {
$htmlOptions['type'] = $metaData['type'];
return CHtml::htmlButton($label, $htmlOptions);
} elseif (isset($htmlOptions['type'])) {
return CHtml::htmlButton($label, $htmlOptions);
} else {
return CHtml::submitButton($label, $htmlOptions);
}
}
示例2: renderCheckoutForm
public function renderCheckoutForm(Payment $payment, Order $order, $return = false)
{
$settings = $payment->getPaymentSystemSettings();
$mrhLogin = $settings['login'];
$mrhPass1 = $settings['password1'];
$culture = $settings['language'];
$invId = $order->id;
$invDesc = Yii::t('RobokassaModule.robokassa', 'Payment order #{id} on "{site}" website', ['{id}' => $order->id, '{site}' => Yii::app()->getModule('yupe')->siteName]);
$outSum = Yii::app()->money->convert($order->getTotalPrice(), $payment->currency_id);
$crc = md5("{$mrhLogin}:{$outSum}:{$invId}:{$mrhPass1}");
$form = CHtml::form($settings['testmode'] ? "http://test.robokassa.ru/Index.aspx" : "https://merchant.roboxchange.com/Index.aspx");
$form .= CHtml::hiddenField('MrchLogin', $mrhLogin);
$form .= CHtml::hiddenField('OutSum', $outSum);
$form .= CHtml::hiddenField('InvId', $invId);
$form .= CHtml::hiddenField('Desc', $invDesc);
$form .= CHtml::hiddenField('SignatureValue', $crc);
$form .= CHtml::hiddenField('Culture', $culture);
$form .= CHtml::submitButton(Yii::t('RobokassaModule.robokassa', 'Pay'));
$form .= CHtml::endForm();
if ($return) {
return $form;
} else {
echo $form;
}
}
示例3: form
function form($name, $label, $action, $dis = array())
{
echo CHtml::beginForm('', 'POST');
echo CHtml::submitButton($label, $dis + array('style' => 'float: left'));
echo CHtml::hiddenField('action', $action);
echo CHtml::hiddenField('name', $name);
echo CHtml::endForm();
}
示例4: run
public function run()
{
$placeholder = $this->type ? Yii::t('app', 'Search') . ' ' . ucfirst($this->type) . '...' : Yii::t('app', 'Search') . '...';
echo CHtml::beginForm(array('/search/' . $this->type), 'get', array('class' => 'search-form'));
echo CHtml::textField('q', $this->query, array('placeholder' => $placeholder));
if ($this->query != '') {
echo CHtml::submitButton('Search!', array('name' => ''));
}
echo CHtml::endForm('');
}
示例5: renderCsvButton
public function renderCsvButton()
{
echo CHtml::beginForm(array('//user/csv/select'));
foreach ($this->columns as $column) {
if (isset($column->name)) {
echo CHtml::hiddenField($column->name, $column->value);
}
}
printf('<td>%s</td>', CHtml::submitButton('CSV'));
echo CHtml::endForm();
}
示例6: widget
public function widget($className, $properties = array(), $captureOutput = false)
{
if ($className == 'bootstrap.widgets.TbButton') {
if (isset($properties['htmlOptions'])) {
return CHtml::submitButton($properties['label'], $properties['htmlOptions']);
} else {
return CHtml::submitButton($properties['label']);
}
}
return parent::widget($className, $properties, $captureOutput);
}
示例7: renderButton
protected function renderButton($label, $htmlOptions)
{
if (is_string($htmlOptions)) {
$label = $htmlOptions;
$htmlOptions = array();
}
if (isset($htmlOptions['type']) && $htmlOptions['type'] == 'link') {
$htmlOptions['class'] = 'limebutton';
echo CHtml::linkButton($label, $htmlOptions);
} else {
echo CHtml::submitButton($label, $htmlOptions);
}
}
示例8: SimpleSubmitButton
public static function SimpleSubmitButton($name, $value = '', $action = '')
{
if (!$value) {
$value = $name;
}
$html = '<form method="post"';
if ($action) {
$html .= ' action="' . $action . '"';
}
$html .= '>';
$html .= CHtml::submitButton($name, array('value' => $value));
$html .= '</form>';
return $html;
}
示例9: run
public function run()
{
list($name, $id) = $this->resolveNameID();
if (!isset($this->htmlOptions['name'])) {
$this->htmlOptions['name'] = $name;
}
if (!isset($this->htmlOptions['id'])) {
$this->htmlOptions['id'] = $id;
}
switch ($this->buttonType) {
case 'submit':
echo CHtml::submitButton($this->caption, $this->htmlOptions);
break;
case 'button':
echo CHtml::button($this->caption, $this->htmlOptions);
break;
case 'link':
echo CHtml::link($this->caption, $this->url, $this->htmlOptions);
break;
case 'radio':
if ($this->hasModel()) {
echo CHtml::activeRadioButton($this->model, $this->attribute, $this->htmlOptions);
} else {
echo CHtml::radioButton($name, $this->value, $this->htmlOptions);
}
break;
case 'checkbox':
if ($this->hasModel()) {
echo CHtml::activeCheckbox($this->model, $this->attribute, $this->htmlOptions);
} else {
echo CHtml::checkbox($name, $this->value, $this->htmlOptions);
}
break;
default:
throw new CException(Yii::t('zii', 'The button type "{type}" is not supported.', array('{type}' => $this->buttonType)));
}
$cs = Yii::app()->getClientScript();
$options = empty($this->options) ? '' : CJavaScript::encode($this->options);
if (isset($this->onclick)) {
if (strpos($this->onclick, 'js:') !== 0) {
$this->onclick = 'js:' . $this->onclick;
}
$click = CJavaScript::encode($this->onclick);
$cs->registerScript(__CLASS__ . '#' . $id, "jQuery('#{$id}').button({$options}).click({$click});");
} else {
$cs->registerScript(__CLASS__ . '#' . $id, "jQuery('#{$id}').button({$options});");
}
}
示例10: getAssignButton
/**
* @param ViewTracking $data
* @param string $attribute attribute dari data
* @return string atau tombol
*/
public function getAssignButton($data, $attribute)
{
$return = $data->{$attribute};
switch ($data->shipment_type) {
case 'city':
$return = is_null($data->{$attribute}) ? CHtml::submitButton('Assign Driver', array("rel" => "grid.{$data->primaryKey}", "class" => "assignDriver_button")) : $data->{$attribute};
break;
case 'domestic':
break;
case 'international':
break;
default:
break;
}
return sprintf('<center>%s</center>', $return);
}
示例11: actionIndex
public function actionIndex($path = '/')
{
$fsw = new FilesystemWrapper('/home/rosko/WWW/hosts/test/public_html/test/', array('baseUrl' => 'http://test/test/'));
$fsw->filter = array('excludeHidden' => true);
$fsw->sort = array('directoriesFirst' => true);
if ($fsw) {
echo CHtml::beginForm('', 'post', array('enctype' => 'multipart/form-data'));
echo CHtml::fileField('file');
echo CHtml::submitButton();
echo CHtml::endForm();
if (CUploadedFile::getInstanceByName('file')) {
echo $fsw->uploadFile('/', 'file', true, 'upload.jpg');
}
//echo $fsw->delete('/mydir.txt');
//print_r ($fsw->createFile('/', 'mydir.txt', 'sdfsdfsвавів'));
print_r($fsw->getDirectory($path));
}
}
示例12: actionAdd
public function actionAdd()
{
if (isset($_POST['alias']) && isset($_POST['catPk'])) {
$model = $this->loadModel();
$model->category_id = $_POST['catPk'];
$model->alias = $_POST['alias'];
$model->save();
$this->renderPartial('item', array('model'=>$model));
} else {
echo CHtml::beginForm();
echo CHtml::hiddenField('catPk', $_GET['catPk']);
echo '<p>Название</p>';
echo CHtml::textField('alias');
echo CHtml::submitButton('Готово');
echo CHtml::endForm();
}
}
示例13: renderForm
protected function renderForm()
{
$model = new Leadership();
$model->manager = $this->manager->id;
$supervisors = User::model()->findAll(array('condition' => 'role_id = 2', 'order' => 'username'));
echo CHtml::openTag('div', array('class' => 'form'));
$form = $this->beginWidget('CActiveForm', array('id' => 'supervisors-form'));
echo $form->errorSummary($model);
//Скрытое поле с id менеджера
echo $form->hiddenField($model, 'manager');
//Select с выбором руководителя
echo CHtml::openTag('div', array('class' => 'row'));
echo $form->labelEx($model, 'supervisor');
echo $form->dropDownList($model, 'supervisor', CHtml::listData($supervisors, 'id', 'username'));
echo $form->error($model, 'role_id'), "\n";
echo CHtml::submitButton('Добавить');
echo CHtml::closeTag('div');
$this->endWidget();
echo CHtml::closeTag('div');
}
示例14: renderContent
protected function renderContent()
{
if (Yii::app()->user->getIsGuest()) {
return;
}
// check admin privileges
$isAdmin = (bool) Yii::app()->user->getState('isAdmin');
if (!$isAdmin) {
return;
}
// create you own users list
$users = array('1' => 'admin', '2' => 'demo1', '4' => 'demo2', '5' => 'demo3', '9' => 'demo4');
echo CHtml::beginForm();
echo '<br>';
echo CHtml::dropDownList("currentUser", $this->userId, $users);
echo ' ';
echo CHtml::submitButton(Yii::t('CalModule.fullCal', 'OK'));
echo CHtml::endForm();
echo '<br>';
}
示例15: renderFormLayout
/**
* Renders the bottom panel of the layout. Includes the filteredList selector buttons
* @return A string containing the element's content.
*/
protected function renderFormLayout($form = null)
{
$runFilteredListButton = CHtml::submitButton(Yii::t('Default', 'Load'));
$searchLink = CHtml::link(Yii::t('Default', 'Go to Search'), '#', array('class' => 'search-link'));
$createLink = new FilteredListEditLinkActionElement($this->controllerId, $this->moduleId, null, array('label' => Yii::t('Default', 'Create')));
$editLink = CHtml::link(Yii::t('Default', 'Edit'), '#', array('class' => 'edit-filter-link'));
$editLinkUrl = Yii::app()->createUrl($this->moduleId . '/filteredList/editFilteredList/');
Yii::app()->clientScript->registerScript('filteredList', "\n \$('.search-link').click( function()\n {\n \$('#filteredListId').val('');\n \$('.search-view-0').show();\n \$('.search-view-bottom-panel').show();\n \$('.filtered-list-panel').hide();\n return false;\n }\n );\n \$('.edit-filter-link').click( function()\n {\n \$('.edit-filter-link').attr('href', '{$editLinkUrl}' + '&id=' + \$('#filteredListId').val());\n }\n );\n \$('#filteredListId').change(function()\n {\n if (\$('#filteredListId').val() != '')\n {\n \$('#filtered-list-change-links').show();\n }\n else\n {\n \$('#filtered-list-change-links').hide();\n }\n }\n );\n \$('#filtered-list-form').submit(function()\n {\n \$('#" . $this->gridId . $this->gridIdSuffix . "-selectedIds').val(null);\n \$.fn.yiiGridView.update('" . $this->gridId . $this->gridIdSuffix . "',\n {\n data: \$(this).serialize() + '&" . $this->listModelClassName . "_page=&" . $this->listModelClassName . "_sort=' " . "}\n );\n return false;\n }\n );\n ");
$content = '<table>';
$style = null;
if (empty($this->filteredListId)) {
$style = 'style="display:none;"';
}
$content .= '<tbody class="filtered-list-panel" ' . $style . '>';
$content .= '<tr><th style="width:20%">';
$content .= '' . Yii::t('Default', 'Filtered Lists') . ': ';
$content .= '</th><td>';
if (!empty($this->filteredList)) {
//todo: probably should make an eelement of this and do: (encoding)
//todo: encode ->text the stuff? where should we do this?
$content .= CHtml::dropDownList('filteredListId', $this->filteredListId, $this->filteredList, array('id' => 'filteredListId', 'empty' => Yii::t('Default', '(None)')));
$content .= ' ';
$content .= $runFilteredListButton . ' ';
$startingDivStyle = null;
if (empty($this->filteredListId)) {
$startingDivStyle = "style='display:none;'";
}
$content .= '<span id="filtered-list-change-links" ' . $startingDivStyle . '>';
$content .= $editLink . ' | ';
$content .= '</span>';
}
$content .= $createLink->render() . ' | ';
$content .= $searchLink;
$content .= '</td></tr>';
$content .= '</tbody>';
$content .= '</table>';
return $content;
}