本文整理汇总了PHP中Action::dispatch方法的典型用法代码示例。如果您正苦于以下问题:PHP Action::dispatch方法的具体用法?PHP Action::dispatch怎么用?PHP Action::dispatch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Action
的用法示例。
在下文中一共展示了Action::dispatch方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action_index
/**
* This is the dispatcher of smileys administration.
*
* @uses ManageSmileys language
* @uses ManageSmileys template
* @see Action_Controller::action_index()
*/
public function action_index()
{
global $context, $txt, $modSettings;
loadLanguage('ManageSmileys');
loadTemplate('ManageSmileys');
$subActions = array('addsmiley' => array($this, 'action_addsmiley', 'enabled' => !empty($modSettings['smiley_enable']), 'permission' => 'manage_smileys'), 'editicon' => array($this, 'action_editicon', 'enabled' => !empty($modSettings['messageIcons_enable']), 'permission' => 'manage_smileys'), 'editicons' => array($this, 'action_editicon', 'enabled' => !empty($modSettings['messageIcons_enable']), 'permission' => 'manage_smileys'), 'editsets' => array($this, 'action_edit', 'permission' => 'admin_forum'), 'editsmileys' => array($this, 'action_editsmiley', 'enabled' => !empty($modSettings['smiley_enable']), 'permission' => 'manage_smileys'), 'import' => array($this, 'action_edit', 'permission' => 'manage_smileys'), 'modifyset' => array($this, 'action_edit', 'permission' => 'manage_smileys'), 'modifysmiley' => array($this, 'action_editsmiley', 'enabled' => !empty($modSettings['smiley_enable']), 'permission' => 'manage_smileys'), 'setorder' => array($this, 'action_setorder', 'enabled' => !empty($modSettings['smiley_enable']), 'permission' => 'manage_smileys'), 'settings' => array($this, 'action_smileySettings_display', 'permission' => 'manage_smileys'), 'install' => array($this, 'action_install', 'permission' => 'manage_smileys'));
// Action controller
$action = new Action('manage_smileys');
// Set the smiley context.
$this->_initSmileyContext();
// Load up all the tabs...
$context[$context['admin_menu_name']]['tab_data'] = array('title' => $txt['smileys_manage'], 'help' => 'smileys', 'description' => $txt['smiley_settings_explain'], 'tabs' => array('editsets' => array('description' => $txt['smiley_editsets_explain']), 'addsmiley' => array('description' => $txt['smiley_addsmiley_explain']), 'editsmileys' => array('description' => $txt['smiley_editsmileys_explain']), 'setorder' => array('description' => $txt['smiley_setorder_explain']), 'editicons' => array('description' => $txt['icons_edit_icons_explain']), 'settings' => array('description' => $txt['smiley_settings_explain'])));
// Default the sub-action to 'edit smiley settings'. call integrate_sa_manage_smileys
$subAction = $action->initialize($subActions, 'editsets');
// Set up the template
$context['page_title'] = $txt['smileys_manage'];
$context['sub_action'] = $subAction;
// Some settings may not be enabled, disallow these from the tabs as appropriate.
if (empty($modSettings['messageIcons_enable'])) {
$context[$context['admin_menu_name']]['tab_data']['tabs']['editicons']['disabled'] = true;
}
if (empty($modSettings['smiley_enable'])) {
$context[$context['admin_menu_name']]['tab_data']['tabs']['addsmiley']['disabled'] = true;
$context[$context['admin_menu_name']]['tab_data']['tabs']['editsmileys']['disabled'] = true;
$context[$context['admin_menu_name']]['tab_data']['tabs']['setorder']['disabled'] = true;
}
// Call the right function for this sub-action.
$action->dispatch($subAction);
}
示例2: action_index
/**
* Entry point in ExtAuth controller
*/
public function action_index()
{
require_once SUBSDIR . '/Action.class.php';
// Where to go
$subActions = array('login' => array($this, 'action_extlogin'), 'deauth' => array($this, 'action_deauth'), 'register' => array($this, 'action_register'));
$action = new Action();
// Default action is to login
$subAction = $action->initialize($subActions, 'login');
// Do the action
$action->dispatch($subAction);
}
示例3: action_index
/**
* The default action is to download an attachment.
* This allows ?action=attachment to be forwarded to action_dlattach()
*/
public function action_index()
{
require_once SUBSDIR . '/Action.class.php';
// add an subaction array to act accordingly
$subActions = array('dlattach' => array($this, 'action_dlattach'), 'ulattach' => array($this, 'action_ulattach'), 'rmattach' => array($this, 'action_rmattach'));
// Setup the action handler
$action = new Action();
$subAction = $action->initialize($subActions, 'dlattach');
// Call the action
$action->dispatch($subAction);
}
示例4: action_index
/**
* Forwards to an action method.
*
* @see Action_Controller::action_index()
*/
public function action_index()
{
global $context;
require_once SUBSDIR . '/Action.class.php';
// Little short on the list here
$subActions = array('add' => array($this, 'action_addbuddy', 'permission' => 'profile_identity_own'), 'remove' => array($this, 'action_removebuddy', 'permission' => 'profile_identity_own'));
// I don't think we know what to do... throw dies?
$action = new Action();
$subAction = $action->initialize($subActions, 'none');
$context['sub_action'] = $subAction;
$action->dispatch($subAction);
}
示例5: action_index
/**
* Entry point to groups.
* It allows moderators and users to access the group showing functions.
*
* @see Action_Controller::action_index()
*/
public function action_index()
{
global $context;
require_once SUBSDIR . '/Action.class.php';
// Little short on the list here
$subActions = array('list' => array($this, 'action_list', 'permission' => 'view_mlist'), 'members' => array($this, 'action_members', 'permission' => 'view_mlist'), 'requests' => array($this, 'action_requests'));
// I don't think we know what to do... throw dies?
$action = new Action();
$subAction = $action->initialize($subActions, 'list');
$context['sub_action'] = $subAction;
$action->dispatch($subAction);
}
示例6: action_index
/**
* Default method, just forwards
*/
public function action_index()
{
require_once SUBSDIR . '/Action.class.php';
// Where do you want to go today?
$subActions = array('index' => array($this, 'action_sportal_index'), 'credits' => array($this, 'action_sportal_credits'), 'resetlayout' => array($this, 'action_sportal_resetLayout'), 'userorder' => array($this, 'action_userblockorder'));
// We like action, so lets get ready for some
$action = new Action('');
// Get the subAction, or just go to action_sportal_index
$subAction = $action->initialize($subActions, 'index');
// Finally go to where we want to go
$action->dispatch($subAction);
}
示例7: action_index
/**
* This is the entry point for all things post moderation.
*
* @uses ModerationCenter template
* @uses ModerationCenter language file
* @see Action_Controller::action_index()
*/
public function action_index()
{
// @todo We'll shift these later bud.
loadLanguage('ModerationCenter');
loadTemplate('ModerationCenter');
require_once SUBSDIR . '/Action.class.php';
// Allowed sub-actions, you know the drill by now!
$subActions = array('approve' => array($this, 'action_approve'), 'attachments' => array($this, 'action_unapproved_attachments'), 'replies' => array($this, 'action_unapproved'), 'topics' => array($this, 'action_unapproved'));
// Pick something valid...
$action = new Action();
$subAction = $action->initialize($subActions, 'replies');
$action->dispatch($subAction);
}
示例8: action_index
/**
* Check permissions and forward to the right method.
*
* @see Action_Controller::action_index()
*/
public function action_index()
{
global $context, $txt;
$subActions = array('display' => array('controller' => $this, 'function' => 'action_topicSettings_display', 'permission' => 'admin_forum'));
// Control for an action, why not!
$action = new Action('manage_topics');
// Only one option I'm afraid, but integrate_sa_manage_topics may add more
$subAction = $action->initialize($subActions, 'display');
// Page items for the template
$context['sub_action'] = $subAction;
$context['page_title'] = $txt['manageposts_topic_settings'];
// Set up action/subaction stuff.
$action->dispatch($subAction);
}
示例9: action_index
/**
* The BBC admin area
*
* What it does:
* - This method is the entry point for index.php?action=admin;area=postsettings;sa=bbc
* and it calls a function based on the sub-action, here only display.
* - requires admin_forum permissions
*
* @see Action_Controller::action_index()
*/
public function action_index()
{
global $context, $txt;
// We're working with them settings here.
require_once SUBSDIR . '/SettingsForm.class.php';
$subActions = array('display' => array('controller' => $this, 'function' => 'action_bbcSettings_display', 'permission' => 'admin_forum'));
// Set up
$action = new Action('manage_bbc');
// Only one option I'm afraid, but integrate_sa_manage_bbc can add more
$subAction = $action->initialize($subActions, 'display');
$context['sub_action'] = $subAction;
$context['page_title'] = $txt['manageposts_bbc_settings_title'];
// Make the call
$action->dispatch($subAction);
}
示例10: action_index
/**
* Main dispatcher for action=xmlhttp.
*
* @see Action_Controller::action_index()
*/
public function action_index()
{
loadTemplate('Xml');
require_once SUBSDIR . '/Action.class.php';
$subActions = array('jumpto' => array('controller' => $this, 'function' => 'action_jumpto'), 'messageicons' => array('controller' => $this, 'function' => 'action_messageicons'), 'groupicons' => array('controller' => $this, 'function' => 'action_groupicons'), 'corefeatures' => array('controller' => $this, 'function' => 'action_corefeatures', 'permission' => 'admin_forum'), 'profileorder' => array('controller' => $this, 'function' => 'action_profileorder', 'permission' => 'admin_forum'), 'messageiconorder' => array('controller' => $this, 'function' => 'action_messageiconorder', 'permission' => 'admin_forum'), 'smileyorder' => array('controller' => $this, 'function' => 'action_smileyorder', 'permission' => 'admin_forum'), 'boardorder' => array('controller' => $this, 'function' => 'action_boardorder', 'permission' => 'manage_boards'), 'parserorder' => array('controller' => $this, 'function' => 'action_parserorder', 'permission' => 'admin_forum'));
// Easy adding of xml sub actions with integrate_xmlhttp
$action = new Action('xmlhttp');
$subAction = $action->initialize($subActions);
// Act a bit special for XML, probably never see it anyway :P
if (empty($subAction)) {
fatal_lang_error('no_access', false);
}
// Off we go then, (it will check permissions)
$action->dispatch($subAction);
}
示例11: action_index
/**
* The main dispatcher; delegates.
*
* What it does:
* - This is the main entry point for all the manageboards admin screens.
* - Called by ?action=admin;area=manageboards.
* - It checks the permissions, based on the sub-action, and calls a function based on the sub-action.
*
* @uses ManageBoards language file.
*/
public function action_index()
{
global $context, $txt;
// Everything's gonna need this.
loadLanguage('ManageBoards');
// We're working with them settings here.
require_once SUBSDIR . '/SettingsForm.class.php';
// Format: 'sub-action' => array('controller', 'function', 'permission'=>'need')
$subActions = array('board' => array('controller' => $this, 'function' => 'action_board', 'permission' => 'manage_boards'), 'board2' => array('controller' => $this, 'function' => 'action_board2', 'permission' => 'manage_boards'), 'cat' => array('controller' => $this, 'function' => 'action_cat', 'permission' => 'manage_boards'), 'cat2' => array('controller' => $this, 'function' => 'action_cat2', 'permission' => 'manage_boards'), 'main' => array('controller' => $this, 'function' => 'action_main', 'permission' => 'manage_boards'), 'move' => array('controller' => $this, 'function' => 'action_main', 'permission' => 'manage_boards'), 'newcat' => array('controller' => $this, 'function' => 'action_cat', 'permission' => 'manage_boards'), 'newboard' => array('controller' => $this, 'function' => 'action_board', 'permission' => 'manage_boards'), 'settings' => array('controller' => $this, 'function' => 'action_boardSettings_display', 'permission' => 'admin_forum'));
// Create the tabs for the template.
$context[$context['admin_menu_name']]['tab_data'] = array('title' => $txt['boards_and_cats'], 'help' => 'manage_boards', 'description' => $txt['boards_and_cats_desc'], 'tabs' => array('main' => array(), 'newcat' => array(), 'settings' => array('description' => $txt['mboards_settings_desc'])));
// You way will end here if you don't have permission.
$action = new Action('manage_boards');
// Default to sub-action 'main' or 'settings' depending on permissions.
$subAction = $action->initialize($subActions, allowedTo('manage_boards') ? 'main' : 'settings');
$context['sub_action'] = $subAction;
$action->dispatch($subAction);
}
示例12: action_index
/**
* Scheduled tasks management dispatcher.
*
* - This function checks permissions and delegates to the appropriate function
* based on the sub-action.
* - Everything here requires admin_forum permission.
*
* @uses ManageScheduledTasks template file
* @uses ManageScheduledTasks language file
*
* @see Action_Controller::action_index()
*/
public function action_index()
{
global $context, $txt;
loadLanguage('ManageScheduledTasks');
loadTemplate('ManageScheduledTasks');
$subActions = array('taskedit' => array($this, 'action_edit', 'permission' => 'admin_forum'), 'tasklog' => array($this, 'action_log', 'permission' => 'admin_forum'), 'tasks' => array($this, 'action_tasks', 'permission' => 'admin_forum'));
// Control those actions
$action = new Action('manage_scheduled_tasks');
// Now for the lovely tabs. That we all love.
$context[$context['admin_menu_name']]['tab_data'] = array('title' => $txt['scheduled_tasks_title'], 'help' => '', 'description' => $txt['maintain_info'], 'tabs' => array('tasks' => array('description' => $txt['maintain_tasks_desc']), 'tasklog' => array('description' => $txt['scheduled_log_desc'])));
// We need to find what's the action. call integrate_sa_manage_scheduled_tasks
$subAction = $action->initialize($subActions, 'tasks');
// Page details
$context['page_title'] = $txt['maintain_info'];
$context['sub_action'] = $subAction;
// Call the right function for this sub-action.
$action->dispatch($subAction);
}
示例13: action_index
/**
* Main dispatcher.
* This function checks permissions and passes control through.
*/
public function action_index()
{
global $context, $txt;
// You must have admin or shoutbox privileges to be here
if (!allowedTo('sp_admin')) {
isAllowedTo('sp_manage_shoutbox');
}
loadTemplate('PortalAdminShoutbox');
$subActions = array('list' => array($this, 'action_sportal_admin_shoutbox_list'), 'add' => array($this, 'action_sportal_admin_shoutbox_edit'), 'edit' => array($this, 'action_sportal_admin_shoutbox_edit'), 'prune' => array($this, 'action_sportal_admin_shoutbox_prune'), 'delete' => array($this, 'action_sportal_admin_shoutbox_delete'), 'status' => array($this, 'action_sportal_admin_shoutbox_status'), 'blockredirect' => array($this, 'action_sportal_admin_shoutbox_block_redirect'));
// Start up the controller, provide a hook since we can
$action = new Action('portal_shoutbox');
$context[$context['admin_menu_name']]['tab_data'] = array('title' => $txt['sp_admin_shoutbox_title'], 'help' => 'sp_ShoutboxArea', 'description' => $txt['sp_admin_shoutbox_desc'], 'tabs' => array('list' => array(), 'add' => array()));
// Default the action to list if none or no valid option is given
$subAction = $action->initialize($subActions, 'list');
$context['sub_action'] = $subAction;
// Shout it on out
$action->dispatch($subAction);
}
示例14: action_index
/**
* The Avatars admin area
*
* What it does:
* - This method is the entry point for index.php?action=admin;area=manageattachments;sa=avatars
* - It calls a function based on the sub-action.
* - Is called from ManageAttachments.controller.php
* - requires manage_attachments permissions
*
* @see Action_Controller::action_index()
*/
public function action_index()
{
global $context, $txt;
// You have to be able to moderate the forum to do this.
isAllowedTo('manage_attachments');
// We're working with them settings here.
require_once SUBSDIR . '/SettingsForm.class.php';
$subActions = array('display' => array($this, 'action_avatarSettings_display'));
// Set up for some action
$action = new Action('manage_avatars');
// Get the sub action or set a default, call integrate_sa_avatar_settings
$subAction = $action->initialize($subActions, 'display');
// Final page details
$context['sub_action'] = $subAction;
$context['page_title'] = $txt['avatar_settings'];
// Now go!
$action->dispatch($subAction);
}
示例15: action_index
/**
* The main entrance point for the 'Posts and topics' screen.
*
* What it does:
* - Like all others, it checks permissions, then forwards to the right function
* based on the given sub-action.
* - Defaults to sub-action 'posts'.
* - Accessed from ?action=admin;area=postsettings.
* - Requires (and checks for) the admin_forum permission.
*
* @see Action_Controller::action_index()
*/
public function action_index()
{
global $context, $txt;
// We're working with them settings here.
require_once SUBSDIR . '/SettingsForm.class.php';
$subActions = array('posts' => array($this, 'action_postSettings_display', 'permission' => 'admin_forum'), 'bbc' => array('function' => 'action_index', 'file' => 'ManageBBC.controller.php', 'controller' => 'ManageBBC_Controller', 'permission' => 'admin_forum'), 'censor' => array($this, 'action_censor', 'permission' => 'admin_forum'), 'topics' => array('function' => 'action_index', 'file' => 'ManageTopics.controller.php', 'controller' => 'ManageTopics_Controller', 'permission' => 'admin_forum'));
// Good old action handle
$action = new Action('manage_posts');
// Tabs for browsing the different post functions.
$context[$context['admin_menu_name']]['tab_data'] = array('title' => $txt['manageposts_title'], 'help' => 'posts_and_topics', 'description' => $txt['manageposts_description'], 'tabs' => array('posts' => array('description' => $txt['manageposts_settings_description']), 'bbc' => array('description' => $txt['manageposts_bbc_settings_description']), 'censor' => array('description' => $txt['admin_censored_desc']), 'topics' => array('description' => $txt['manageposts_topic_settings_description'])));
// Default the sub-action to 'posts'. call integrate_sa_manage_posts
$subAction = $action->initialize($subActions, 'posts');
// Just for the template
$context['page_title'] = $txt['manageposts_title'];
$context['sub_action'] = $subAction;
// Call the right function for this sub-action.
$action->dispatch($subAction);
}