本文整理汇总了PHP中Action类的典型用法代码示例。如果您正苦于以下问题:PHP Action类的具体用法?PHP Action怎么用?PHP Action使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Action类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: addAction
/**
* @param Action $action
*/
public function addAction(Action $action)
{
if ($this->hasAction($name = $action->getName())) {
throw new \InvalidArgumentException(sprintf('Action "%s" already exists.', $name));
}
$this->actions[$name] = $action;
}
开发者ID:loic425,项目名称:Sylius,代码行数:10,代码来源:ActionGroup.php
示例2: getNextStates
/**
* Available paths from current state.
*
* @return array
*/
public function getNextStates()
{
$maxMissionaries = $this->missionariesRight;
if ($this->boatLocation == 'left') {
$maxMissionaries = $this->missionariesLeft;
}
$maxCannibals = $this->cannibalsRight;
if ($this->boatLocation == 'left') {
$maxCannibals = $this->cannibalsLeft;
}
$maxMissionaries = min(BOAT_SIZE, $maxMissionaries);
$maxCannibals = min(BOAT_SIZE, $maxCannibals);
$states = [];
for ($missionaries = 0; $missionaries <= $maxMissionaries; ++$missionaries) {
for ($cannibals = 0; $cannibals <= $maxCannibals; ++$cannibals) {
if ($missionaries == 0 && $cannibals == 0) {
continue;
}
if ($missionaries + $cannibals > BOAT_SIZE) {
continue;
}
$action = new Action($missionaries, $cannibals);
if ($action->isValidAction()) {
$state = clone $this;
$state = $state->transfer($missionaries, $cannibals);
$node = new Node($state, $this, $action, 0, 0);
array_push($states, $node);
}
}
}
return $states;
}
开发者ID:ankitpokhrel,项目名称:MissionariesAndCannibals-PHP,代码行数:37,代码来源:State.php
示例3: index
public function index()
{
// Route
if (isset($this->request->get['route']) && $this->request->get['route'] != 'startup/router') {
$route = $this->request->get['route'];
} else {
$route = $this->config->get('action_default');
}
$data = array();
// Sanitize the call
$route = preg_replace('/[^a-zA-Z0-9_\\/]/', '', (string) $route);
// Trigger the pre events
$result = $this->event->trigger('controller/' . $route . '/before', array(&$route, &$data));
if (!is_null($result)) {
return $result;
}
$action = new Action($route);
// Any output needs to be another Action object.
$output = $action->execute($this->registry, $data);
// Trigger the post events
$result = $this->event->trigger('controller/' . $route . '/after', array(&$route, &$output));
if (!is_null($result)) {
return $result;
}
return $output;
}
开发者ID:brunoxu,项目名称:mycncart,代码行数:26,代码来源:router.php
示例4: onEndShowScripts
function onEndShowScripts(Action $action)
{
$action->inlineScript('var infinite_scroll_on_next_only = ' . ($this->on_next_only ? 'true' : 'false') . ';');
$action->inlineScript('var ajax_loader_url = "' . $this->path('ajax-loader.gif') . '";');
$action->script($this->path('jquery.infinitescroll.js'));
$action->script($this->path('infinitescroll.js'));
}
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:7,代码来源:InfiniteScrollPlugin.php
示例5: init
function init($mySql, $queries, $lang, $module, $idUrl)
{
$HelperOther = new HelperOther();
$Details = new Details();
$Action = new Action();
$entry = $mySql->fetch_row($queries->selectById($mySql, $module, $idUrl));
$getColumn = $queries->selectAll($mySql, $module);
$layout = $Details->debut($lang, $module);
for ($i = 0; $i < $mySql->num_fields($getColumn); $i++) {
$column = $mySql->fetch_field($getColumn);
$column = $column->name;
$details = $entry[$i];
if ($Action->exclusion($module, $column)) {
$field = $HelperOther->findField($column);
@(!(include_once 'controller/fields/' . $field . '.class.php'));
if (class_exists($field)) {
$getValue = new $field($lang, $module, $details, $column, DETAIL);
$details = $getValue->details;
$layout .= $Details->detail($details);
}
}
}
$layout .= $Details->fin();
return $layout;
}
开发者ID:WebPassions,项目名称:2013,代码行数:25,代码来源:action_detail.class.php
示例6: nextAttemptSort
/**
* Sorts the actions based on which is to execute next.
* @param Action $a
* @param Action $b
* @return -1 if $a < $b, 1 if $a > $b, 0 if $a == $b
*/
private function nextAttemptSort($a, $b)
{
if ($a->getNextAttempt() == $b->getNextAttempt()) {
return 0;
}
return $a->getNextAttempt() < $b->getNextAttempt() ? -1 : 1;
}
开发者ID:carriercomm,项目名称:Twitterbot,代码行数:13,代码来源:twitterbot.php
示例7: get
public function get()
{
$action = new Action('common/order_status');
$data = $action->execute($this->registry);
$response['order_status'] = $data['order_status'];
$this->response->setOutput($response);
}
开发者ID:projectwife,项目名称:tesitoo-opencart,代码行数:7,代码来源:order_status.php
示例8: index
public function index()
{
// Route
if (isset($this->request->get['route']) && $this->request->get['route'] != 'startup/router') {
$route = $this->request->get['route'];
} else {
$route = $this->config->get('action_default');
}
// Sanitize the call
$route = str_replace('../', '', (string) $route);
// Trigger the pre events
$result = $this->event->trigger('controller/' . $route . '/before', array(&$route, &$data));
if (!is_null($result)) {
return $result;
}
// We dont want to use the loader class as it would make an controller callable.
$action = new Action($route);
// Any output needs to be another Action object.
$output = $action->execute($this->registry);
// Trigger the post events
$result = $this->event->trigger('controller/' . $route . '/after', array(&$route, &$data, &$output));
if (!is_null($result)) {
return $result;
}
return $output;
}
开发者ID:web3d,项目名称:mincart,代码行数:26,代码来源:router.php
示例9: add
protected function add(Action $action)
{
if (isset($this->actions[$action->getName()])) {
throw new \InvalidArgumentException(sprintf('The action "%s" already exists.', $action->getName()));
}
$this->actions[$action->getName()] = $action;
}
开发者ID:hostingnuggets,项目名称:WhiteOctoberAdminBundle,代码行数:7,代码来源:ActionCollection.php
示例10: index
public function index()
{
// Route
if (isset($this->request->get['route'])) {
$route = $this->request->get['route'];
} else {
$route = 'common/dashboard';
}
$data = array();
// Sanitize the call
$route = str_replace('../', '', (string) $route);
// Trigger the pre events
$result = $this->event->trigger('controller/' . $route . '/before', array(&$route, &$data));
if (!is_null($result)) {
return $result;
}
$action = new Action($route);
// Any output needs to be another Action object.
$output = $action->execute($this->registry, $data);
// Trigger the post events
$result = $this->event->trigger('controller/' . $route . '/after', array(&$route, &$output));
if (!is_null($result)) {
return $result;
}
return $output;
}
开发者ID:mif32,项目名称:opencart,代码行数:26,代码来源:route.php
示例11: get
/**
* Resource methods
*/
public function get()
{
$action = new Action('common/language');
$data = $action->execute($this->registry);
$response['languages'] = $this->processLanguages($data['languages']);
$this->response->setOutput($response);
}
开发者ID:projectwife,项目名称:tesitoo-opencart,代码行数:10,代码来源:language_base.php
示例12: onEndAccountSettingsNav
/**
* Menu item for personal subscriptions/groups area
*
* @param Action $action action being executed
*
* @return boolean hook return
*/
function onEndAccountSettingsNav($action)
{
$action_name = $action->trimmed('action');
common_debug("ACTION NAME = " . $action_name);
$action->menuItem(common_local_url('mirrorsettings'), _m('MENU', 'Mirroring'), _m('Configure mirroring of posts from other feeds'), $action_name === 'mirrorsettings');
return true;
}
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:14,代码来源:SubMirrorPlugin.php
示例13: populateFromOptions
protected function populateFromOptions($options)
{
foreach ($options as $name => $attrs) {
$action = new Action($name);
if (isset($attrs['route_pattern'])) {
$action->setRoute($attrs['route_name'], $attrs['route_pattern'], array());
}
if (isset($attrs['text'])) {
$action->setText($attrs['text']);
}
if (isset($attrs['icon'])) {
$action->setButtonIcon($attrs['icon']);
}
if (isset($attrs['style'])) {
$action->setButtonStyle($attrs['style']);
}
if (isset($attrs['dialog'])) {
$action->setDialog($attrs['dialog']['title'], $attrs['dialog']['message']);
}
if (isset($attrs['trans_domain'])) {
$action->setTransDomain($attrs['trans_domain']);
}
if (isset($attrs['template'])) {
$action->setTemplate($attrs['template']);
}
if (isset($attrs['roles'])) {
$action->setRoles($attrs['roles']);
}
$this->add($action);
}
}
开发者ID:senthilkumar3282,项目名称:LyraAdminBundle,代码行数:31,代码来源:ActionCollection.php
示例14: getValidationProfile
/**
* Will try and find a validation profile for the action provided
*
* @param Action $action
* @return ValidationProfile
* @throws ValidationException
*/
public function getValidationProfile(Action $action)
{
if (!isset($this->profiles[$action->getName()])) {
throw new ValidationException("Could not find a validation profile for action: [{$action->getName()}]");
}
return $this->profiles[$action->getName()];
}
开发者ID:projectstorm,项目名称:php-actions,代码行数:14,代码来源:ValidationProfileBank.php
示例15: get
/**
* Resource methods
*/
public function get()
{
$action = new Action('common/currency');
$data = $action->execute($this->registry);
$response['currencies'] = $this->processCurrencies($data['currencies']);
$this->response->setOutput($response);
}
开发者ID:projectwife,项目名称:tesitoo-opencart,代码行数:10,代码来源:currency_base.php
示例16: action_index
/**
* Subaction handler - manages the action and delegates control to the proper
* sub-action.
*
* What it does:
* - It loads both the Themes and Settings language files.
* - Checks the session by GET or POST to verify the sent data.
* - Requires the user to not be a guest.
* - Accessed via ?action=admin;area=theme.
*
* @see Action_Controller::action_index()
*/
public function action_index()
{
global $txt, $context;
if (isset($_REQUEST['api'])) {
return $this->action_index_api();
}
// Load the important language files...
loadLanguage('ManageThemes');
loadLanguage('Settings');
require_once SUBSDIR . '/Action.class.php';
// No guests in here.
is_not_guest();
// Theme administration, removal, choice, or installation...
$subActions = array('admin' => array($this, 'action_admin', 'permission' => 'admin_forum'), 'list' => array($this, 'action_list', 'permission' => 'admin_forum'), 'reset' => array($this, 'action_options', 'permission' => 'admin_forum'), 'options' => array($this, 'action_options', 'permission' => 'admin_forum'), 'install' => array($this, 'action_install', 'permission' => 'admin_forum'), 'remove' => array($this, 'action_remove', 'permission' => 'admin_forum'), 'pick' => array($this, 'action_pick'), 'edit' => array($this, 'action_edit', 'permission' => 'admin_forum'), 'copy' => array($this, 'action_copy', 'permission' => 'admin_forum'), 'themelist' => array($this, 'action_themelist', 'permission' => 'admin_forum'), 'browse' => array($this, 'action_browse', 'permission' => 'admin_forum'));
// Action controller
$action = new Action('manage_themes');
// @todo Layout Settings?
if (!empty($context['admin_menu_name'])) {
$context[$context['admin_menu_name']]['tab_data'] = array('title' => $txt['themeadmin_title'], 'description' => $txt['themeadmin_description'], 'tabs' => array('admin' => array('description' => $txt['themeadmin_admin_desc']), 'list' => array('description' => $txt['themeadmin_list_desc']), 'reset' => array('description' => $txt['themeadmin_reset_desc']), 'edit' => array('description' => $txt['themeadmin_edit_desc']), 'themelist' => array('description' => $txt['themeadmin_edit_desc']), 'browse' => array('description' => $txt['themeadmin_edit_desc'])));
}
// Follow the sa or just go to administration, call integrate_sa_manage_themes
$subAction = $action->initialize($subActions, 'admin');
// Default the page title to Theme Administration by default.
$context['page_title'] = $txt['themeadmin_title'];
$context['sub_action'] = $subAction;
// Go to the action, if you have permissions
$action->dispatch($subAction);
}
开发者ID:scripple,项目名称:Elkarte,代码行数:40,代码来源:ManageThemes.controller.php
示例17: 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);
}
开发者ID:KeiroD,项目名称:Elkarte,代码行数:36,代码来源:ManageSmileys.controller.php
示例18: init
function init($mySql, $queries, $lang, $module, $module_dispatch, $idUrl, $categorie, $ss_categorie, $search, $sort, $order, $page)
{
$HelperOther = new HelperOther();
$Updates = new Updates();
$Action = new Action();
$entry = $mySql->fetch_row($queries->selectById($mySql, $module_dispatch, $idUrl));
$getColumn = $queries->selectAll($mySql, $module_dispatch);
$layout = $Updates->debut($lang, $module, $module_dispatch, $idUrl, $categorie, $ss_categorie, $search, $sort, $order, $page);
for ($i = 0; $i < $mySql->num_fields($getColumn); $i++) {
// Boucle sur les colonnes
$column = $mySql->fetch_field($getColumn);
$column = $column->name;
$update = $entry[$i];
if ($Action->exclusion($module, $column)) {
$field = $HelperOther->findField($column);
@(!(include_once 'controller/fields/' . $field . '.class.php'));
if (class_exists($field)) {
$getValue = new $field($lang, $module_dispatch, $update, $column, UPDATE);
$update = $getValue->update;
$layout .= $Updates->update($update);
}
}
}
$layout .= $Updates->fin($lang, $module_dispatch);
return $layout;
}
开发者ID:WebPassions,项目名称:2013,代码行数:26,代码来源:action_update.class.php
示例19: controller
public function controller($route, $args = array())
{
$this->trigger->fire('pre.load.controller', array(&$route, &$args));
$action = new Action($route, $args);
$ret = $action->execute($this->registry);
$this->trigger->fire('post.load.controller', array(&$route, &$ret));
return $ret;
}
开发者ID:LinuxJedi,项目名称:arastta,代码行数:8,代码来源:loader.php
示例20: testField
public function testField()
{
$field = new Field('orderNumber');
$action = new Action('add-item', 'http://api.x.io/orders/42/items');
$action->addField($field);
$expectedJson = json_encode(array('name' => 'add-item', 'href' => 'http://api.x.io/orders/42/items', 'method' => 'GET', 'type' => 'application/x-www-form-urlencoded', 'fields' => array(array('name' => 'orderNumber', 'type' => 'text'))));
$this->assertJsonStringEqualsJsonString($expectedJson, json_encode($action));
}
开发者ID:koskelin,项目名称:siren-domain,代码行数:8,代码来源:ActionTest.php
注:本文中的Action类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论