public static function PrepareModulesPanelsMenuItems()
{
$sub_menu_is_modules = false;
if (empty($_REQUEST['mf_action'])) {
$currentAction = "";
} else {
$currentAction = $_REQUEST['mf_action'];
}
switch ($currentAction) {
// ------------ Custom Fields
case 'create-custom-field':
$page_group = 'RCCWP_CreateCustomFieldPage';
$page_type = 'Main';
break;
case 'continue-create-custom-field':
if (isset($_REQUEST['custom-group-id']) && !empty($_REQUEST['custom-group-id'])) {
$customGroupId = (int) $_REQUEST['custom-group-id'];
}
$customGroup = RCCWP_CustomGroup::Get($customGroupId);
$current_field = RCCWP_CustomField::GetCustomFieldTypes((int) $_REQUEST['custom-field-type']);
if ($current_field->has_options == "true" || $current_field->has_properties == "true") {
$page_group = 'RCCWP_CreateCustomFieldPage';
$page_type = 'SetOptions';
} else {
if ($current_field->has_options == "false") {
$default = array('custom-group-id' => '', 'custom-field-name' => '', 'custom-field-description' => '', 'custom-field-order' => '', 'custom-field-required' => '', 'custom-field-type' => '', 'custom-field-options' => '', 'custom-field-duplicate' => '', 'custom-field-helptext' => '');
$save = array_merge($default, $_POST);
RCCWP_CustomField::Create($save['custom-group-id'], $save['custom-field-name'], $save['custom-field-description'], $save['custom-field-order'], $save['custom-field-required'], $save['custom-field-type'], $save['custom-field-options'], null, null, $save['custom-field-duplicate'], $save['custom-field-helptext']);
$page_group = 'RCCWP_CustomWritePanelPage';
$page_type = 'View';
}
}
break;
case 'delete-custom-field':
$page_group = 'RCCWP_CustomWritePanelPage';
$page_type = 'View';
break;
case 'finish-create-custom-field':
case 'cancel-edit-custom-field':
case 'cancel-create-custom-field':
case 'submit-edit-custom-field':
case 'copy-custom-field':
/*
* Adding JS for sorting the order of the fields
* using a drag and drop feature
*/
wp_enqueue_script('magic_set_categories', MF_URI . 'js/sorting_fields.js', array('jquery', 'jquery-ui-sortable'));
$page_group = 'RCCWP_CustomWritePanelPage';
$page_type = 'View';
break;
case 'edit-custom-field':
$page_group = 'RCCWP_CustomFieldPage';
$page_type = 'Edit';
break;
// ------------ Groups
// ------------ Groups
case 'create-custom-group':
$page_group = 'RCCWP_CreateCustomGroupPage';
$page_type = 'Main';
break;
case 'view-custom-group':
$page_group = 'RCCWP_CustomGroupPage';
$page_type = 'View';
break;
case 'cancel-edit-custom-group':
case 'cancel-create-custom-group':
case 'delete-custom-group':
case 'submit-edit-custom-group':
case 'finish-create-custom-group':
$page_group = 'RCCWP_CustomWritePanelPage';
$page_type = 'View';
break;
case 'edit-custom-group':
$page_group = 'RCCWP_CustomGroupPage';
$page_type = 'Edit';
break;
// ------------ Custom Write Panels
// ------------ Custom Write Panels
case 'view-custom-write-panel':
$page_group = 'RCCWP_CustomWritePanelPage';
$page_type = 'View';
/*
* Adding JS for sorting the order of the fields
* using a drag and drop feature
*/
wp_enqueue_script('magic_set_categories', MF_URI . 'js/sorting_fields.js', array('jquery', 'jquery-ui-sortable'));
break;
case 'create-custom-write-panel':
$page_group = 'RCCWP_CreateCustomWritePanelPage';
$page_type = 'Main';
break;
case 'finish-create-custom-write-panel':
$page_group = 'RCCWP_CustomWritePanelPage';
$page_type = 'View';
break;
case 'edit-custom-write-panel':
$page_group = 'RCCWP_CustomWritePanelPage';
$page_type = 'Edit';
break;
case 'cancel-edit-custom-write-panel':
$page_group = 'RCCWP_CustomWritePanelPage';
$page_type = 'View';
break;
case 'submit-edit-custom-write-panel':
$page_group = 'RCCWP_CustomWritePanelPage';
$page_type = 'View';
break;
case 'import-write-panel':
$page_group = 'RCCWP_CustomWritePanelPage';
$page_type = 'Import';
break;
default:
if (isset($_REQUEST['assign-custom-write-panel'])) {
$page_group = 'RCCWP_ManagementPage';
$page_type = 'AssignCustomWritePanel';
$sub_menu_is_modules = false;
} else {
if (isset($_REQUEST['cancel-edit-custom-group'])) {
$page_group = 'RCCWP_CustomGroupPage';
$page_type = 'View';
} else {
if (isset($_REQUEST['view-groups'])) {
$page_group = 'RCCWP_ManagementPage';
$page_type = 'ViewGroups';
} else {
$page_group = 'RCCWP_CustomWritePanelPage';
$page_type = 'ViewWritePanels';
$sub_menu_is_modules = false;
}
}
}
}
$result = null;
if (!is_object($result)) {
$result = new StdClass();
}
if ($sub_menu_is_modules) {
$result->panelsMenuFunction = array('RCCWP_CustomWritePanelPage', 'ViewWritePanels');
$result->modulesMenuFunction = array($page_group, $page_type);
} else {
$result->panelsMenuFunction = array($page_group, $page_type);
$result->modulesMenuFunction = array('RCCWP_ManagementPage', 'ViewModules');
}
return $result;
}