/** * Process the form and generate an AJAX response * * @see process_form */ public function process_form_ajax() { // process the form $save_count = $this->process_form(); // any options saved successfuly? if ($save_count == 1) { ICE_Ajax::responseStd(true, sprintf(__('%d option successfully updated.', infinity_text_domain), $save_count)); } elseif ($save_count > 1) { ICE_Ajax::responseStd(true, sprintf(__('%d options successfully updated.', infinity_text_domain), $save_count)); } else { ICE_Ajax::responseStd(false, __('An error has occurred. No options were updated.', infinity_text_domain)); } }
/** * Output cpanel tab content * * @package Infinity * @subpackage dashboard */ function infinity_dashboard_cpanel_tabs_content() { $action = infinity_dashboard_cpanel_action(); $screen = Infinity_Screens_Policy::instance()->registry()->get($action); if ($screen instanceof ICE_Screen) { ICE_Ajax::responseBegin(); $screen->render(); ICE_Ajax::responseEnd(true); } else { ICE_Ajax::responseStd(false, sprintf(__('There was an error while trying to load the %s tab content.', infinity_text_domain), $action)); } }
/** * Render options according to the option name POST var * * @package Infinity-api * @subpackage options */ function infinity_options_render_options_screen() { // section $load_section = null; if (!empty($_POST['load_section'])) { $load_section = $_POST['load_section']; } else { ICE_Ajax::responseStd(false, 'Missing required "load_section" parameter'); } // option $load_option = null; if (!empty($_POST['load_option'])) { $load_option = $_POST['load_option']; } // options to render $options = array(); // look up section $section = Infinity_Sections_Policy::instance()->registry()->get($load_section); // did we get a valid section? if ($section instanceof ICE_Section) { // load specific option? if ($load_option) { // look up the single option $option = Infinity_Options_Policy::instance()->registry()->get($load_option); // did we get a valid option? if ($option instanceof ICE_Option) { // add it to options to array $options[] = $option; } } else { // get all options for the section $options = Infinity_Options_Policy::instance()->registry()->get_menu_options($section); } } // content to return $content = null; // option content $option_content = null; // loop through all options and render each one foreach ($options as $option_to_render) { // enable post override $option_to_render->enable_post_override(); // try to render the option $section->add_component($option_to_render); } // render the section $content = $section->render(false); // respond if (strlen($content)) { ICE_Ajax::responseStd(true, null, $content); } else { ICE_Ajax::responseStd(false, __('Failed to render options', infinity_text_domain)); } }