本文整理汇总了PHP中AdminHelper::controllerRedirect方法的典型用法代码示例。如果您正苦于以下问题:PHP AdminHelper::controllerRedirect方法的具体用法?PHP AdminHelper::controllerRedirect怎么用?PHP AdminHelper::controllerRedirect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AdminHelper
的用法示例。
在下文中一共展示了AdminHelper::controllerRedirect方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
// trim temp array to no more than 5
$locations_array = array();
// let's rebuild the locations array
foreach ($tmp_locations_array as $location => $total) {
$locations_array[] = array('access_location' => $location, 'total' => $total);
}
$cash_admin->page_data['location_analytics'] = new ArrayIterator($locations_array);
$cash_admin->page_data['method_analytics'] = new ArrayIterator($methods_array);
}
// Detects if element add has happened and deals with POST data if it has
AdminHelper::handleElementFormPOST($_POST, $cash_admin);
// Set basic id/name stuff for the element
AdminHelper::setBasicElementFormData($cash_admin);
// pull stored element data
$cash_admin->page_data = array_merge($cash_admin->page_data, AdminHelper::getElementValues($current_element));
$cash_admin->page_data['ui_title'] = '' . $current_element['name'] . '';
$cash_admin->page_data['element_button_text'] = 'Save changes';
$cash_admin->page_data['element_rendered_content'] = $cash_admin->mustache_groomer->render(AdminHelper::getElementTemplate($current_element), $cash_admin->page_data);
$campaign_response = $cash_admin->requestAndStore(array('cash_request_type' => 'element', 'cash_action' => 'getcampaignforelement', 'id' => $current_element['id']));
if ($campaign_response['payload']) {
$cash_admin->page_data['campaign_id'] = $campaign_response['payload']['id'];
$cash_admin->page_data['campaign_title'] = $campaign_response['payload']['title'];
}
} else {
AdminHelper::controllerRedirect('/elements/');
}
} else {
AdminHelper::controllerRedirect('/elements/');
}
$cash_admin->page_data['platform_path'] = CASH_PLATFORM_PATH;
$cash_admin->setPageContentTemplate('elements_details');
示例2:
<?php
AdminHelper::controllerRedirect('/');
示例3:
<?php
if (!$request_parameters) {
AdminHelper::controllerRedirect('/commerce/items/');
}
if (isset($_POST['dodelete']) || isset($_REQUEST['modalconfirm'])) {
$item_delete_response = $cash_admin->requestAndStore(array('cash_request_type' => 'commerce', 'cash_action' => 'deleteitem', 'id' => $request_parameters[0]));
if ($item_delete_response['status_uid'] == 'commerce_deleteitem_200') {
AdminHelper::formSuccess('Success. Deleted.', '/commerce/items/');
}
}
$cash_admin->page_data['title'] = 'Commerce: Delete item';
$cash_admin->setPageContentTemplate('delete_confirm');
示例4:
<?php
if (!$request_parameters) {
AdminHelper::controllerRedirect('/assets/');
}
if (isset($_POST['dodelete']) || isset($_REQUEST['modalconfirm'])) {
$delete_response = $cash_admin->requestAndStore(array('cash_request_type' => 'asset', 'cash_action' => 'deleteasset', 'id' => $request_parameters[0]));
if ($delete_response['status_uid'] == 'asset_deleteasset_200') {
AdminHelper::formSuccess('Success. Deleted.', '/assets/');
}
}
$cash_admin->page_data['title'] = 'Assets: Delete asset';
$cash_admin->setPageContentTemplate('delete_confirm');
示例5:
<?php
if (!$request_parameters) {
AdminHelper::controllerRedirect('/people/lists/');
}
if (isset($_POST['dodelete']) || isset($_REQUEST['modalconfirm'])) {
$delete_response = $cash_admin->requestAndStore(array('cash_request_type' => 'people', 'cash_action' => 'deletelist', 'list_id' => $request_parameters[0]));
if ($delete_response['status_uid'] == 'people_deletelist_200') {
if (isset($_REQUEST['redirectto'])) {
AdminHelper::formSuccess('Success. Deleted.', $_REQUEST['redirectto']);
} else {
AdminHelper::formSuccess('Success. Deleted.', '/people/lists/');
}
}
}
$cash_admin->page_data['title'] = 'People: Delete list';
$cash_admin->setPageContentTemplate('delete_confirm');
示例6: file_put_contents
<?php
if (isset($_POST['doupgrade'])) {
$upgrade_file_contents = CASHSystem::getURLContents('https://raw.github.com/cashmusic/platform/latest_stable/installers/php/update/update.php');
if ($upgrade_file_contents) {
$success = file_put_contents(ADMIN_BASE_PATH . '/../update.php', $upgrade_file_contents);
if ($success) {
AdminHelper::controllerRedirect('/../update.php');
} else {
$cash_admin->page_data['error_message'] = 'Trouble copying update tool. Please make sure you have write permissions and try again.';
}
} else {
$cash_admin->page_data['error_message'] = 'Failed to get the update tool. Please try again.';
}
}
$cash_admin->page_data['platform_version'] = CASHRequest::$version;
$cash_admin->page_data['upgrade_available'] = false;
$current_profile_url = 'https://raw.github.com/cashmusic/platform/latest_stable/installers/php/update/releaseprofiles/release_' . $cash_admin->page_data['platform_version'] . '.json';
if (CASHSystem::getURLContents($current_profile_url)) {
// found stable upgrade path...neat! let's check for a proper upgrade script:
$upgrade_script_url = 'https://raw.github.com/cashmusic/platform/latest_stable/installers/php/update/updatescripts/' . $cash_admin->page_data['platform_version'] . '.php';
$upgrade_script_contents = CASHSystem::getURLContents($upgrade_script_url);
if ($upgrade_script_contents) {
// okay rad, got an upgrade script too.
$cash_admin->page_data['upgrade_available'] = true;
}
} else {
$cash_admin->page_data['is_edge'] = true;
}
$cash_admin->setPageContentTemplate('settings_update');
示例7: foreach
<?php
$types_response = $cash_admin->requestAndStore(array('cash_request_type' => 'element', 'cash_action' => 'getsupportedtypes'));
$supported_elements = $types_response['payload'];
if ($request_parameters) {
$element_addtype = $request_parameters[0];
$cash_admin->page_data['form_state_action'] = 'doelementadd';
$cash_admin->page_data['element_type'] = $element_addtype;
if (array_search($element_addtype, $supported_elements) !== false) {
// Detects if element add has happened and deals with POST data if it has
AdminHelper::handleElementFormPOST($_POST, $cash_admin);
// Detects state of element add and routes to /elements/edit if successful
if ($cash_admin->getCurrentElementState() == 'add' && !$cash_admin->getErrorState()) {
$current_element = $cash_admin->getCurrentElement();
AdminHelper::controllerRedirect('/elements/edit/' . $current_element['id']);
}
// Not a completed add, so let's show the form
// first check for requirements
$requirements_response = $cash_admin->requestAndStore(array('cash_request_type' => 'element', 'cash_action' => 'checkuserrequirements', 'user_id' => $cash_admin->effective_user_id, 'element_type' => $element_addtype));
$app_json = AdminHelper::getElementAppJSON($element_addtype);
if ($requirements_response['payload'] === true) {
if ($app_json) {
// set page title/tip
$cash_admin->page_data['ui_title'] = 'Add ' . $app_json['details']['en']['name'] . ' Element';
$cash_admin->page_data['ui_page_tip'] = $app_json['details']['en']['instructions'];
$element_defaults = AdminHelper::getElementDefaults($app_json['options']);
$cash_admin->page_data = array_merge($cash_admin->page_data, $element_defaults);
if (isset($app_json['copy'])) {
if (is_array($app_json['copy']['en'])) {
foreach ($app_json['copy']['en'] as $key => $val) {
$cash_admin->page_data['copy_' . $key] = $val;
示例8: str_replace
$template_default = str_replace('{{{element_n}}}', $replacement, $template_default);
$template_response = $cash_admin->requestAndStore(array('cash_request_type' => 'system', 'cash_action' => 'settemplate', 'name' => '', 'type' => 'page', 'template' => $template_default, 'user_id' => $cash_admin->effective_user_id));
$template_id = $template_response['payload'];
$edit_response = $cash_admin->requestAndStore(array('cash_request_type' => 'element', 'cash_action' => 'editcampaign', 'id' => $requested_campaign_id, 'template_id' => $template_id));
if ($edit_response['payload']) {
AdminHelper::formSuccess('Success. Page theme created. You can edit it at any time.', '/');
} else {
AdminHelper::formFailure('Error. Something just didn\'t work right.', '/');
}
}
} else {
// you're a wizard now, harry!
$new_template = 0;
$requested_campaign_id = $request_parameters[0];
$current_response = $cash_admin->requestAndStore(array('cash_request_type' => 'element', 'cash_action' => 'getcampaign', 'id' => $requested_campaign_id));
$campaign = $current_response['payload'];
if ($campaign['template_id'] != 0) {
// no points for gryffindor
AdminHelper::controllerRedirect('/elements/templates/edit/' . $campaign['template_id'] . '/page/parent/' . $requested_campaign_id);
}
$elements_response = $cash_admin->requestAndStore(array('cash_request_type' => 'element', 'cash_action' => 'getelementsforcampaign', 'id' => $requested_campaign_id));
if (is_array($elements_response['payload'])) {
$campaign_elements = new ArrayIterator($elements_response['payload']);
} else {
$campaign_elements = false;
}
$cash_admin->page_data['campaign_elements'] = $campaign_elements;
$cash_admin->page_data['campaign_id'] = $requested_campaign_id;
$cash_admin->page_data['ui_title'] = 'Create a page theme';
$cash_admin->setPageContentTemplate('campaigns_theme');
}
示例9: CASHRequest
<?php
if (!$request_parameters) {
AdminHelper::controllerRedirect('/calendar/venues/');
}
if (isset($_POST['dodelete']) || isset($_REQUEST['modalconfirm'])) {
$venue_delete_request = new CASHRequest(array('cash_request_type' => 'calendar', 'cash_action' => 'deletevenue', 'venue_id' => $request_parameters[0]));
if ($venue_delete_request->response['status_uid'] == 'calendar_deletevenue_200') {
if (isset($_REQUEST['redirectto'])) {
AdminHelper::formSuccess('Success. Deleted.', $_REQUEST['redirectto']);
} else {
AdminHelper::formSuccess('Success. Deleted.', '/calendar/venues/');
}
}
}
$cash_admin->setPageContentTemplate('delete_confirm');