本文整理汇总了PHP中KRequest::type方法的典型用法代码示例。如果您正苦于以下问题:PHP KRequest::type方法的具体用法?PHP KRequest::type怎么用?PHP KRequest::type使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KRequest
的用法示例。
在下文中一共展示了KRequest::type方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
public function display()
{
// Display the toolbar
$toolbar = $this->_createToolbar()->reset();
$this->toolbar = KFactory::get($this->getToolbar(), array('isGrid' => false))->append(KFactory::get('admin::com.ninja.toolbar.button.apply', array('isGrid' => false)));
KFactory::get('admin::com.ninja.helper.default')->css('/' . $this->getIdentifier()->application . '.' . $this->getName() . '.css');
KFactory::get('admin::com.ninja.helper.default')->js('/raphael.js');
KFactory::get('admin::com.ninja.helper.default')->js('/Mapper.js');
$acl = JFactory::getACL();
//die('<pre>'.print_r(get_class_methods($acl), true).'</pre>');
$acltree = (array) $acl->get_group_children_tree(null, 'USERS', false);
array_unshift($acltree, (object) array('value' => 0, 'text' => 'Unregistered', 'disabled' => false));
$this->acltree = $acltree;
$this->usergroups = KFactory::tmp('admin::com.ninjaboard.model.usergroups')->limit(0)->getList();
$maps = array();
foreach (KFactory::tmp($this->getModel()->getIdentifier())->limit(0)->getList() as $map) {
$maps[$map->id] = $map->ninjaboard_gid;
}
$this->maps = $maps;
$display = parent::display();
if (KRequest::type() == 'AJAX') {
echo '<script type="text/javascript">
' . $this->_document->_script['text/javascript'] . '
</script>';
}
return $display;
}
示例2: _actionRender
/**
* Renders a controller view.
*
* @return string
*/
protected function _actionRender(KCommandContext $context)
{
if ($context->request->getFormat() == 'html' && KRequest::type() == 'HTTP') {
$this->_setPageTitle();
}
return parent::_actionRender($context);
}
示例3: setPermissions
/**
* Generic function for setting the permissions
*
* @return void
*/
public function setPermissions($context)
{
//Temp fix
if (KInflector::isPlural(KRequest::get('get.view', 'cmd')) || KRequest::type() == 'AJAX') {
return;
}
$model = KFactory::get($this->getModel());
$table = KFactory::tmp(KFactory::get(KFactory::get('admin::com.ninja.helper.access')->models->assets)->getTable());
$query = $table->getDatabase()->getQuery();
$item = $model->getItem();
$identifier = $this->getIdentifier();
$id = $identifier->type . '_' . $identifier->package . '.' . $identifier->name . '.' . $item->id . '.';
$permissions = (array) KRequest::get('post.permissions', 'int');
$editable = KRequest::get('post.editpermissions', 'boolean', false);
if (!$permissions && $editable) {
$query->where('tbl.name', 'LIKE', $id . '%');
$table->select($query)->delete();
}
$safe = array();
$query = $table->getDatabase()->getQuery()->where('name', 'like', $id . '%');
foreach ((array) KRequest::get('post.params.permissions', 'raw') as $group => $other) {
$safe[] = $id . $group;
}
if ($safe) {
$query->where('name', 'not in', $safe);
}
$table->select($query, KDatabase::FETCH_ROWSET)->delete();
foreach ($permissions as $usergroup => $rules) {
foreach ($rules as $name => $permission) {
KFactory::tmp(KFactory::get('admin::com.ninja.helper.access')->models->assets)->name($id . $usergroup . '.' . $name)->getItem()->setData(array('name' => $id . $usergroup . '.' . $name, 'level' => $permission))->save();
}
}
}
示例4: __construct
public function __construct(KConfigInterface $config)
{
parent::__construct($config);
if (KRequest::type() == 'AJAX' && KRequest::method() == 'POST') {
$this->unregisterCallback('after.dispatch', array($this, 'forward'));
}
}
示例5: convert
/**
* Import the sample content
*
* @return $this
*/
public function convert()
{
$this->data = json_decode(file_get_contents(JPATH_COMPONENT_ADMINISTRATOR . '/data/demo.json'), true);
parent::convert();
if (KRequest::type() == 'AJAX') {
echo json_encode(array('splittable' => false));
}
return $this;
}
示例6: display
public function display()
{
$name = $this->getName();
//Append enable and disbale button for all the list views
if ($name != 'dashboard' && KInflector::isPlural($name) && KRequest::type() != 'AJAX') {
KFactory::get('admin::com.error.toolbar.' . $name)->append('divider')->append('enable')->append('disable');
}
return parent::display();
}
示例7: _actionForward
/**
* Overloaded to comply with FancyUpload.
* It doesn't let us pass AJAX headers so this is needed.
*/
public function _actionForward(KCommandContext $context)
{
if (KRequest::type() == 'FLASH' || KRequest::format() == 'json') {
$context->result = $this->getController()->execute('display', $context);
} else {
parent::_actionForward($context);
}
return $context->result;
}
示例8: _renderScript
/**
* Render script information
*
* @param string The script information
* @param array Associative array of attributes
* @return string
*/
protected function _renderScript($link, $attribs = array())
{
if (KRequest::type() == 'AJAX') {
return parent::_renderLink($script, $attribs);
}
$relType = 'rel';
$relValue = $attribs['rel'];
unset($attribs['rel']);
JFactory::getDocument()->addHeadLink($link, $relValue, $relType, $attribs);
}
示例9: __construct
public function __construct(KConfig $config)
{
parent::__construct($config);
$this->registerCallback('after.add', array($this, 'notify'));
//Lock the referrer to prevent it from being overridden for read requests
if ($this->isDispatched() && KRequest::type() == 'HTTP') {
if ($this->isEditable()) {
$this->registerCallback('after.logout', array($this, 'lockReferrer'));
}
}
}
示例10: _initialize
/**
* Initializes the default configuration for the object
*
* Called from {@link __construct()} as a first step of object instantiation.
*
* @param object An optional KConfig object with configuration options.
* @return void
*/
protected function _initialize(KConfig $config)
{
/*
* Disable controller persistency on non-HTTP requests, e.g. AJAX, and requests containing
* the tmpl variable set to component, e.g. requests using modal boxes. This avoids
* changing the model state session variable of the requested model, which is often
* undesirable under these circumstances.
*/
$config->append(array('persistable' => KRequest::type() == 'HTTP' && KRequest::get('get.tmpl', 'cmd') != 'component', 'limit' => array('max' => 100, 'default' => JFactory::getApplication()->getCfg('list_limit'))));
parent::_initialize($config);
}
示例11: _renderScript
/**
* Render script information
*
* @param string The script information
* @param boolean True, if the script information is a URL.
* @param array Associative array of attributes
* @return string
*/
protected function _renderScript($script, $link, $attribs = array())
{
if (KRequest::type() == 'AJAX') {
return parent::_renderScript($script, $link, $attribs);
}
$document = JFactory::getDocument();
if ($link) {
$document->addScript($script, 'text/javascript');
} else {
$document->addScriptDeclaration($script);
}
}
示例12: _renderStyle
/**
* Render style information
*
* @param string The style information
* @param boolean True, if the style information is a URL
* @param array Associative array of attributes
* @return string
*/
protected function _renderStyle($style, $link, $attribs = array())
{
if (KRequest::type() == 'AJAX') {
return parent::_renderStyle($style, $link, $attribs);
}
$document = KFactory::get('lib.joomla.document');
if ($link) {
$document->addStyleSheet($style, 'text/css', null, $attribs);
} else {
$document->addStyleDeclaration($style);
}
}
示例13: saveReferrer
/**
* Store the referrer in the session
*
* @param KCommandContext The active command context
* @return void
*/
public function saveReferrer(KCommandContext $context)
{
$referrer = KRequest::referrer();
if (isset($referrer) && KRequest::type() == 'HTTP') {
$request = KRequest::url();
$request->get(KHttpUri::PART_PATH | KHttpUri::PART_QUERY);
$referrer->get(KHttpUri::PART_PATH | KHttpUri::PART_QUERY);
//Compare request url and referrer
if ($request != $referrer) {
KRequest::set('session.com.controller.referrer', (string) $referrer);
}
}
}
示例14: _actionDisplay
protected function _actionDisplay(KCommandContext $context)
{
/*
//This is used for xdebug to profile imports
$this->_request->import = 'kunena';
KRequest::set('post.offset', 'int', 0);
$this->execute('import');
//*/
if (KRequest::type() != 'AJAX') {
$view = $this->getView();
return $view->display();
}
return '';
}
示例15: _actionLogout
protected function _actionLogout(KCommandContext $context)
{
$user = JFactory::getUser();
if ($user->id) {
$app = JFactory::getApplication();
$error = $app->logout();
if (!$error instanceof Exception) {
} else {
$context->status = KHttpResponse::OK;
}
}
if (KRequest::type() != 'AJAX') {
$this->_redirect = KRequest::referrer();
// return $rowset;
}
}