本文整理汇总了PHP中FormHelper::postLink方法的典型用法代码示例。如果您正苦于以下问题:PHP FormHelper::postLink方法的具体用法?PHP FormHelper::postLink怎么用?PHP FormHelper::postLink使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FormHelper
的用法示例。
在下文中一共展示了FormHelper::postLink方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postLink
public function postLink($title, $url = null, $options = array(), $confirmMessage = false)
{
if (!isset($options['class'])) {
$options['class'] = 'postLink';
}
return parent::postLink($title, $url, $options, $confirmMessage);
}
示例2: postLink
public function postLink($title, $url = null, $options = array(), $confirmMessage = false)
{
if ($this->_aclCheck($url)) {
return parent::postLink($title, $url, $options, $confirmMessage);
}
return '';
}
示例3: postLink
/**
* Creates an HTML link, but access the url using the method you specify (defaults to POST).
* Requires javascript to be enabled in browser.
*
* This method creates a `<form>` element. So do not use this method inside an existing form.
* Instead you should add a submit button using FormHelper::submit()
*
* ### Options:
*
* - `data` - Array with key/value to pass in input hidden
* - `method` - Request method to use. Set to 'delete' to simulate HTTP/1.1 DELETE request. Defaults to 'post'.
* - `confirm` - Can be used instead of $confirmMessage.
* - Other options is the same of HtmlHelper::link() method.
* - The option `onclick` will be replaced.
* - `block` - For nested form. use View::fetch() output form.
*
* @param string $title The content to be wrapped by <a> tags.
* @param string|array $url Cake-relative URL or array of URL parameters, or external URL (starts with http://)
* @param array $options Array of HTML attributes.
* @param bool|string $confirmMessage JavaScript confirmation message.
* @return string An `<a />` element.
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/form.html#FormHelper::postLink
*/
public function postLink($title, $url = null, $options = array(), $confirmMessage = false)
{
$block = false;
if (!empty($options['block'])) {
$block = $options['block'];
unset($options['block']);
}
$fields = $this->fields;
$this->fields = array();
$out = parent::postLink($title, $url, $options, $confirmMessage);
$this->fields = $fields;
if ($block) {
$regex = '/<form.*?>.*?<\\/form>/';
if (preg_match($regex, $out, $match)) {
$this->_View->append($block, $match[0]);
$out = preg_replace($regex, '', $out);
}
}
return $out;
}
示例4: gridPostAction
public function gridPostAction($icon, $url = null, $item = false, $confirmMessage = false, $option = array())
{
$title = '';
$options = $option;
$options['escape'] = false;
/*if($confirmMessage){
$options['onclick'] = 'confirmDialog(this.href, \''. str_replace("'","\'", $confirmMessage). '\'); return false;';
$confirmMessage = false;
}*/
if ($icon) {
$title = '<i class="glyphicon glyphicon-' . $icon . '"></i>';
}
if (is_array($url)) {
if (!isset($url['action'])) {
$url['action'] = 'index';
}
//if(isset($url['action'])){
$module = isset($url['plugin']) ? $url['plugin'] : $this->plugin;
$controller = isset($url['controller']) ? $url['controller'] : $this->params['controller'];
$user_module = Access::__getPermissionCurrentModule($module);
$action = $url['action'];
switch ($action) {
case "add":
if (!Access::checkPermissionCreateModule($module)) {
return '';
}
return parent::postLink($title, $url, $options, $confirmMessage);
default:
if (!Access::checkRow($module, $controller, $action, $item)) {
return '';
}
return parent::postLink($title, $url, $options, $confirmMessage);
}
//}
} else {
die('not support');
}
return parent::postLink($title, $url, $options, $confirmMessage);
}