public function test_post_action_creates_action() { $this->mySetup(__DIR__ . "/basic_action_table.xml"); $new_data = ["name" => "derp", "description" => "pred"]; $controller = new ActionController([], Response::REQUEST_METHOD_POST, $new_data); $response = $controller->getResponse(); self::assertIsValidResponse($response, Response::STATUS_CODE_CREATED); self::assertIsCorrectResponseData($response->getBody(), $new_data); }
/** * Show the form for creating a new resource. * * @return Response */ public function close_round() { // if (Session::has('admin')) { DB::table('rounds')->where('idgame', '=', Input::get('game'))->where('status', '=', 0)->update(array('status' => 1)); $ActionController = new ActionController(); $ActionController->order_actions(); $ActionController->execute_actions(); return Response::json(array('output' => 'closed')); } else { return Response::json(array('output' => 'not admin')); } }
public function __construct(&$po_request, &$po_response, $pa_view_paths = null) { parent::__construct($po_request, $po_response, $pa_view_paths); if ($this->request->config->get('pawtucket_requires_login') && !$this->request->isLoggedIn() || $this->request->config->get('show_bristol_only') && !$this->request->isLoggedIn()) { $this->response->setRedirect(caNavUrl($this->request, "", "LoginReg", "form")); } }
public function __construct(&$po_request, &$po_response, $pa_view_paths = null) { parent::__construct($po_request, $po_response, $pa_view_paths); $this->opo_datamodel = Datamodel::load(); $this->opo_app_plugin_manager = new ApplicationPluginManager(); $this->opo_result_context = new ResultContext($po_request, $this->ops_table_name, ResultContext::getLastFind($po_request, $this->ops_table_name)); }
public function __construct(&$po_request, &$po_response, $pa_view_paths = null) { $this->ops_theme = __CA_THEME__; // get current theme if (!is_dir(__CA_APP_DIR__ . '/plugins/eastend/themes/' . $this->ops_theme . '/views')) { // if theme is not defined for this plugin, try to use "default" theme $this->ops_theme = 'default'; } parent::__construct($po_request, $po_response, array(__CA_APP_DIR__ . '/plugins/eastend/themes/' . $this->ops_theme . '/views')); MetaTagManager::addLink('stylesheet', $po_request->getBaseUrlPath() . "/app/plugins/eastend/themes/" . $this->ops_theme . "/css/eastend.css", 'text/css'); $this->opo_plugin_config = Configuration::load($this->request->getAppConfig()->get('application_plugins') . '/eastend/conf/eastend.conf'); if (!(bool) $this->opo_plugin_config->get('enabled')) { die(_t('eastend plugin is not enabled')); } // redirect user if not logged in if ($this->request->config->get('pawtucket_requires_login') && !$this->request->isLoggedIn()) { $this->response->setRedirect(caNavUrl($this->request, "", "LoginReg", "form")); } if ($this->request->config->get("dont_enforce_access_settings")) { $this->opa_access_values = array(); } else { $this->opa_access_values = caGetUserAccessValues($this->request); } $this->view->setVar('access_values', $va_access_values); $this->opo_result_context = new ResultContext($po_request, 'ca_objects', ResultContext::getLastFind($po_request, 'ca_objects')); JavascriptLoadManager::register('cycle'); }
/** * Framework entry point * * @return void. */ public function dispatch() { include_once 'action/controller/http/HTTPResponse.php'; include_once 'action/controller/http/HTTPRequest.php'; $request = new HTTPRequest(); $response = new HTTPResponse(); try { $configurator = $this->manager->getConfigurator(); Registry::put($configurator, '__configurator'); Registry::put($logger = new Logger($configurator), '__logger'); $ap = $configurator->getApplicationPath(); // application path $an = $configurator->getApplicationName(); // application name $logger->debug('[Medick] >> version: ' . Medick::getVersion() . ' ready for ' . $an); $logger->debug('[Medick] >> Application path ' . $ap); $routes_path = $ap . DIRECTORY_SEPARATOR . 'conf' . DIRECTORY_SEPARATOR . $an . '.routes.php'; include_once $routes_path; // load routes $logger->debug('[Medick] >> Config File: ' . str_replace($ap, '${' . $an . '}', $configurator->getConfigFile())); $logger->debug('[Medick] >> Routes loaded from: ' . str_replace($ap, '${' . $an . '}', $routes_path)); ActionControllerRouting::recognize($request)->process($request, $response)->dump(); } catch (Exception $ex) { ActionController::process_with_exception($request, $response, $ex)->dump(); $logger->warn($ex->getMessage()); } }
public function __construct(&$po_request, &$po_response, $pa_view_paths = null) { $this->ops_theme = __CA_THEME__; // get current theme if (!is_dir(__CA_APP_DIR__ . '/plugins/MetabolicChronology/themes/' . $this->ops_theme . '/views')) { // if theme is not defined for this plugin, try to use "default" theme $this->ops_theme = 'default'; } parent::__construct($po_request, $po_response, array(__CA_APP_DIR__ . '/plugins/MetabolicChronology/themes/' . $this->ops_theme . '/views')); $this->opo_plugin_config = Configuration::load($this->request->getAppConfig()->get('application_plugins') . '/MetabolicChronology/conf/Chronology.conf'); if (!(bool) $this->opo_plugin_config->get('enabled')) { die(_t('Metabolic Chronology plugin is not enabled')); } $this->_initView($pa_options); $this->opo_result_context = new ResultContext($po_request, 'ca_objects', 'MetabolicChronology'); MetaTagManager::addLink('stylesheet', $po_request->getBaseUrlPath() . "/app/plugins/MetabolicChronology/themes/" . $this->ops_theme . "/css/chronology.css", 'text/css'); JavascriptLoadManager::register('jcarousel'); JavascriptLoadManager::register('maps'); $t_list = new ca_lists(); $this->opn_silo_type_id = $t_list->getItemIDFromList('collection_types', 'silo'); $this->opn_action_type_id = $t_list->getItemIDFromList('occurrence_types', 'action'); $this->opn_context_type_id = $t_list->getItemIDFromList('occurrence_types', 'context'); $this->opn_yes_list_id = $t_list->getItemIDFromList('yes_no', 'yes'); $t_relationship_types = new ca_relationship_types(); $this->opn_rel_type_action_display_image = $t_relationship_types->getRelationshipTypeID("ca_objects_x_occurrences", "display"); $this->opn_rel_type_action_secondary_images = $t_relationship_types->getRelationshipTypeID("ca_objects_x_occurrences", "secondary"); $va_access_values = caGetUserAccessValues($this->request); $this->opa_access_values = $va_access_values; $this->view->setVar('access_values', $va_access_values); }
public function __construct(&$po_request, &$po_response, $pa_view_paths = null) { parent::__construct($po_request, $po_response, $pa_view_paths); // Reload user preferences config to reflect current user locale. Initial load of config file is prior to setting of preferred locale // (which requires loading of user preferences...) and does not reflect user's preferred language. $this->request->user->loadUserPrefDefs(true); }
public function __construct(&$po_request, &$po_response, $pa_view_paths = null) { $this->ops_theme = __CA_THEME__; // get current theme if (!is_dir(__CA_APP_DIR__ . '/plugins/NovaMuse/themes/' . $this->ops_theme . '/views')) { // if theme is not defined for this plugin, try to use "default" theme $this->ops_theme = 'default'; } parent::__construct($po_request, $po_response, array(__CA_APP_DIR__ . '/plugins/NovaMuse/themes/' . $this->ops_theme . '/views')); $this->opo_plugin_config = Configuration::load($this->request->getAppConfig()->get('application_plugins') . '/NovaMuse/conf/NovaMuse.conf'); if (!(bool) $this->opo_plugin_config->get('enabled')) { die(_t('NovaMuse plugin is not enabled')); } MetaTagManager::addLink('stylesheet', $po_request->getBaseUrlPath() . "/app/plugins/NovaMuse/themes/" . $this->ops_theme . "/css/dashboard.css", 'text/css'); $this->opo_result_context = new ResultContext($po_request, 'ca_objects', 'dashboard'); $t_list = new ca_lists(); $this->opn_member_institution_id = $t_list->getItemIDFromList('entity_types', 'member_institution'); $this->opn_individual_id = $t_list->getItemIDFromList('entity_types', 'ind'); $this->opn_family_id = $t_list->getItemIDFromList('entity_types', 'fam'); $this->opn_organization_id = $t_list->getItemIDFromList('entity_types', 'org'); $t_object = new ca_objects(); $this->opn_objectTableNum = $t_object->tableNum(); $va_access_values = caGetUserAccessValues($this->request); $this->opa_access_values = $va_access_values; $this->view->setVar('access_values', $va_access_values); }
public function init() { parent::init(); $tabs = $this->getTabs(); $type = $this->getType(); if (in_array(ucfirst($type), $this->globalTypes)) { $ltype = strtolower($type); $tabs->add('overview', array('url' => 'director', 'label' => $this->translate('Overview'))); foreach ($this->globalTypes as $tabType) { $ltabType = strtolower($tabType); $tabs->add($ltabType, array('label' => $this->translate(ucfirst($ltabType) . 's'), 'url' => sprintf('director/%ss', $ltabType))); } $tabs->activate($ltype); return; } $object = $this->dummyObject(); if ($object->isGroup()) { $type = substr($type, 0, -5); } $tabs = $this->getTabs()->add('objects', array('url' => sprintf('director/%ss', strtolower($type)), 'label' => $this->translate(ucfirst($type) . 's'))); if ($object->supportsGroups() || $object->isGroup()) { $tabs->add('objectgroups', array('url' => sprintf('director/%sgroups', $type), 'label' => $this->translate('Groups'))); } $tabs->add('tree', array('url' => sprintf('director/%ss/templatetree', $type), 'label' => $this->translate('Tree'))); }
public function __construct(&$po_request, &$po_response, $pa_view_paths = null) { parent::__construct($po_request, $po_response, $pa_view_paths); if (!$this->request->isLoggedIn()) { $this->response->setRedirect($this->request->config->get('error_display_url') . '/n/2320?r=' . urlencode($this->request->getFullUrlPath())); return; } }
public function __construct(&$po_request, &$po_response, $pa_view_paths = null) { parent::__construct($po_request, $po_response, $pa_view_paths); //if (!$this->request->isLoggedIn() || !$this->request->user->canDoAction('can_do_search_reindex')) { // $this->response->setRedirect($this->request->config->get('error_display_url').'/n/2320?r='.urlencode($this->request->getFullUrlPath())); // return; //} }
function set_actions() { $actions = array_filter(func_get_args()); if (count($actions) === 1 && is_array($actions[0])) { $actions = $actions[0]; } ActionController::$actions = array_merge(ActionController::$actions, $actions); }
public function __construct(&$po_request, &$po_response, $pa_view_paths = null) { parent::__construct($po_request, $po_response, $pa_view_paths); if ($this->request->config->get('pawtucket_requires_login') && !$this->request->isLoggedIn()) { $this->response->setRedirect(caNavUrl($this->request, "", "LoginReg", "LoginForm")); } caSetPageCSSClasses(array("staticPage")); }
public function __construct(&$po_request, &$po_response, $pa_view_paths = null) { parent::__construct($po_request, $po_response, $pa_view_paths); $this->opo_client_services_config = Configuration::load($this->request->config->get('client_services_config')); $this->view->setVar('client_services_config', $this->opo_client_services_config); JavascriptLoadManager::register("panel"); JavascriptLoadManager::register('cycle'); JavascriptLoadManager::register('bundleableEditor'); }
public function __construct(&$po_request, &$po_response, $pa_view_paths = null) { parent::__construct($po_request, $po_response, $pa_view_paths); JavascriptLoadManager::register('bundleListEditorUI'); JavascriptLoadManager::register('panel'); $this->opo_datamodel = Datamodel::load(); $this->opo_app_plugin_manager = new ApplicationPluginManager(); $this->opo_result_context = new ResultContext($po_request, $this->ops_table_name, ResultContext::getLastFind($po_request, $this->ops_table_name)); }
public function __construct(&$po_request, &$po_response, $pa_view_paths = null) { parent::__construct($po_request, $po_response, $pa_view_paths); if ($this->request->config->get('pawtucket_requires_login') && !$this->request->isLoggedIn()) { $this->response->setRedirect(caNavUrl($this->request, "", "LoginReg", "LoginForm")); } $this->opa_access_values = caGetUserAccessValues($po_request); caSetPageCSSClasses(array("listing")); }
public function __construct(&$po_request, &$po_response, $pa_view_paths = null) { parent::__construct($po_request, $po_response, $pa_view_paths); $this->opo_library_services_config = caGetLibraryServicesConfiguration(); if (!$this->request->isLoggedIn() || !$this->request->user->canDoAction('can_do_library_checkout') || !$this->request->config->get('enable_library_services') || !$this->request->config->get('enable_object_checkout')) { $this->response->setRedirect($this->request->config->get('error_display_url') . '/n/2320?r=' . urlencode($this->request->getFullUrlPath())); return; } }
public function __construct(&$po_request, &$po_response, $pa_view_paths = null) { AssetLoadManager::register('bundleableEditor'); AssetLoadManager::register('panel'); parent::__construct($po_request, $po_response, $pa_view_paths); $this->opo_datamodel = Datamodel::load(); $this->opo_app_plugin_manager = new ApplicationPluginManager(); $this->cleanOldExportFilesFromTmpDir(); }
public function __construct(&$po_request, &$po_response, $pa_view_paths = null) { if ($this->ops_search_class) { require_once __CA_LIB_DIR__ . "/ca/Search/" . $this->ops_search_class . ".php"; } require_once __CA_MODELS_DIR__ . "/" . $this->ops_table_name . ".php"; parent::__construct($po_request, $po_response, $pa_view_paths); $this->opo_item_instance = new $this->ops_table_name(); }
/** * Set up tools manager, check user privs and call parent constructor */ public function __construct(&$po_request, &$po_response, $pa_view_paths = null) { if (!$po_request->isLoggedIn() || !$po_request->user->canDoAction('can_use_plugin_tools')) { $this->response->setRedirect($po_request->config->get('error_display_url') . '/n/3000?r=' . urlencode($po_request->getFullUrlPath())); return; } parent::__construct($po_request, $po_response, $pa_view_paths); $this->opo_datamodel = Datamodel::load(); $this->opo_tools_manager = new ToolsManager(); }
public function __construct(&$po_request, &$po_response, $pa_view_paths = null) { parent::__construct($po_request, $po_response, $pa_view_paths); // we don't want headers or footers output for feeds $app = AppController::getInstance(); $app->removeAllPlugins(); // kills the pageFormat plugin added in /index.php // set http content-type header to XML $this->response->addHeader('Content-type', 'text/xml', true); }
public function __construct(&$po_request, &$po_response, $pa_view_paths = null) { parent::__construct($po_request, $po_response, $pa_view_paths); if (!$this->request->isLoggedIn() || !$this->request->user->canDoAction('can_do_library_checkin') || !$this->request->config->get('enable_library_services') || !$this->request->config->get('enable_object_checkout')) { $this->response->setRedirect($this->request->config->get('error_display_url') . '/n/2320?r=' . urlencode($this->request->getFullUrlPath())); return; } AssetLoadManager::register('objectcheckin'); $this->opo_app_plugin_manager = new ApplicationPluginManager(); }
/** * Dispatch a request from Apache * * Called from file dispatch.php, which is invoked by * {@link http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html Apache mod_rewrite} * whenever a client makes a request. Actions: * <ol> * <li>Remove forbidden tags and attributes from * {@link http://www.php.net/reserved.variables#reserved.variables.get $_GET}, * {@link http://www.php.net/reserved.variables#reserved.variables.post $_POST} and * {@link http://www.php.net/reserved.variables#reserved.variables.request $_REQUEST}. </li> * <li>Start a session to keep track of state between requests from * the client.</li> * <li>Construct an ActionController to process the action.</li> * <li>Process the route</li> * </ol> * @uses ActionController::__construct() * @uses ActionController::process_route() * @uses ActionController::process_with_exception() * @uses InputFilter::process_all() * @uses Session::start() */ function dispatch() { if (TRAX_ENV != 'production') { $start = microtime(true); } try { InputFilter::process_all(); Session::start(); $ac = new ActionController(); $ac->process_route(); } catch (Exception $e) { ActionController::process_with_exception($e); } if (TRAX_ENV != 'production') { $duration = "(" . round((microtime(true) - $start) * 1000, 1) . "ms)"; $url = parse_url($_SERVER['REQUEST_URI']); Trax::log("[1mRendered {$url['path']} {$duration}[0m"); } }
public function __construct(&$po_request, &$po_response, $pa_view_paths = null) { parent::__construct($po_request, $po_response, $pa_view_paths); $this->config = caGetFrontConfig(); caSetPageCSSClasses(array("front")); if ($this->request->config->get('pawtucket_requires_login') && !$this->request->isLoggedIn()) { $this->response->setRedirect(caNavUrl($this->request, "", "LoginReg", "LoginForm")); } MetaTagManager::setWindowTitle($this->request->config->get("app_display_name")); }
public function __construct(&$po_request, &$po_response, $pa_view_paths = null) { $this->opo_datamodel = Datamodel::load(); $vs_browse_table_name = $po_request->config->get('allow_browse_within_detail_for_' . $this->ops_tablename); // create object browse for filtering objects on collection detail page $this->opo_browse = $this->getBrowseInstance($vs_browse_table_name, $po_request->session->getVar($this->ops_tablename . '_' . $this->ops_appname . '_detail_current_browse_id'), $this->ops_appname . '_detail'); $this->opa_sorts = $this->getBrowseSorts($vs_browse_table_name); parent::__construct($po_request, $po_response, $pa_view_paths); JavascriptLoadManager::register('maps'); JavascriptLoadManager::register('jcarousel'); }
static function redirect_to($url, $url_params = array(), $redirect_params = array()) { # Running after-filters! ActionController::run_after_filters(); if ($redirect_params) { self::parse_parameters($redirect_params); } $route = url_for($url, $url_params); header("Location: {$route}"); exit; }
public function __construct(&$po_request, &$po_response, $pa_view_paths = null) { parent::__construct($po_request, $po_response, $pa_view_paths); AssetLoadManager::register('tableList'); AssetLoadManager::register('bundleableEditor'); AssetLoadManager::register("panel"); $this->opo_app_plugin_manager = new ApplicationPluginManager(); $this->view->setVar('client_services_config', $this->opo_client_services_config = Configuration::load($this->request->config->get('client_services_config'))); $this->view->setVar('currency', $this->opo_client_services_config->get('currency')); $this->view->setVar('currency_symbol', $this->opo_client_services_config->get('currency_symbol')); $this->opo_result_context = new ResultContext($this->request, 'ca_commerce_orders', 'basic_search_library'); }
/** * Initialize action */ public function initializeAction() { parent::initializeAction(); $basket = $this->basketRepository->findByFrontendUserAndType($this->frontendUser, self::$mainBasketTypeName); if (!$basket) { $basket = new \Abra\Cadabra\Domain\Model\Basket(); $basket->setFrontendUser($this->frontendUser); $basket->setType(self::$mainBasketTypeName); $this->basketRepository->add($basket); $this->persistenceManager->persistAll(); } $this->basket = $basket; }
public function __construct(&$po_request, &$po_response, $pa_view_paths = null) { parent::__construct($po_request, $po_response, $pa_view_paths); if (!$po_request->user->canDoAction('can_batch_import_metadata')) { $po_response->setRedirect($po_request->config->get('error_display_url') . '/n/3400?r=' . urlencode($po_request->getFullUrlPath())); return; } AssetLoadManager::register('bundleableEditor'); AssetLoadManager::register('panel'); $this->opo_datamodel = Datamodel::load(); $this->opo_app_plugin_manager = new ApplicationPluginManager(); $this->opo_result_context = new ResultContext($po_request, $this->ops_table_name, ResultContext::getLastFind($po_request, $this->ops_table_name)); }