public function postLink($title, $url = null, $options = array(), $confirmMessage = false) { if (!isset($options['class'])) { $options['class'] = 'postLink'; } return parent::postLink($title, $url, $options, $confirmMessage); }
public function postLink($title, $url = null, $options = array(), $confirmMessage = false) { if ($this->_aclCheck($url)) { return parent::postLink($title, $url, $options, $confirmMessage); } return ''; }
/** * 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; }
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); }