function _content_menu_filter_elements_by_domain($form, &$form_state) { $domain = $form_state['values']['domainselect']; ctools_include('ajax'); $_SESSION['content_menu_domain_filter'] = $domain; $commands[] = ctools_ajax_command_reload(); print ajax_render($commands); exit; }
function _content_menu_filter_elements_by_language($form, &$form_state) { $lang = $form_state['values']['langselect']; ctools_include('ajax'); $_SESSION['content_menu_lang_filter'] = $lang; if ($lang = '') { unset($_SESSION['content_menu_lang_filter']); } $commands[] = ctools_ajax_command_reload(); print ajax_render($commands); exit; }
/** * {@inheritDoc} */ public function sendContent() { // Print the response. $commands = ajax_prepare_response(['#type' => 'ajax', '#commands' => $this->commands]); $output = ajax_render($commands); if ($this->isJSONP()) { echo '<textarea>' . $output . '</textarea>'; } else { echo $output; } ajax_footer(); return $this; }
/** * Master entry point for handling a list. * * It is unlikely that a child object will need to override this method, * unless the listing mechanism is going to be highly specialized. */ function list_page($js, $input) { $this->items = ctools_export_crud_load_all($this->plugin['schema'], $js); // Respond to a reset command by clearing session and doing a drupal goto // back to the base URL. if (isset($input['op']) && $input['op'] == t('Reset')) { unset($_SESSION['ctools_export_ui'][$this->plugin['name']]); if (!$js) { drupal_goto($_GET['q']); } // clear everything but form id, form build id and form token: $keys = array_keys($input); foreach ($keys as $id) { if (!in_array($id, array('form_id', 'form_build_id', 'form_token'))) { unset($input[$id]); } } $replace_form = TRUE; } // If there is no input, check to see if we have stored input in the // session. if (!isset($input['form_id'])) { if (isset($_SESSION['ctools_export_ui'][$this->plugin['name']]) && is_array($_SESSION['ctools_export_ui'][$this->plugin['name']])) { $input = $_SESSION['ctools_export_ui'][$this->plugin['name']]; } } else { $_SESSION['ctools_export_ui'][$this->plugin['name']] = $input; unset($_SESSION['ctools_export_ui'][$this->plugin['name']]['q']); } // This is where the form will put the output. $this->rows = array(); $this->sorts = array(); $form_state = array('plugin' => $this->plugin, 'input' => $input, 'rerender' => TRUE, 'no_redirect' => TRUE, 'object' => &$this); if (!isset($form_state['input']['form_id'])) { $form_state['input']['form_id'] = 'ctools_export_ui_list_form'; } // If we do any form rendering, it's to completely replace a form on the // page, so don't let it force our ids to change. if ($js && isset($_POST['ajax_html_ids'])) { unset($_POST['ajax_html_ids']); } $form = drupal_build_form('ctools_export_ui_list_form', $form_state); $form = drupal_render($form); $output = $this->list_header($form_state) . $this->list_render($form_state) . $this->list_footer($form_state); if (!$js) { $this->list_css(); return $form . $output; } $commands = array(); $commands[] = ajax_command_replace('#ctools-export-ui-list-items', $output); if (!empty($replace_form)) { $commands[] = ajax_command_replace('#ctools-export-ui-list-form', $form); } print ajax_render($commands); ajax_footer(); }
function asf_ajax_login_callback($form, &$form_state) { // if errors, return the form if (form_get_errors()) { $msg = 'Sorry, unrecognized username or password.'; for ($i = 0; $i < count($_SESSION['messages']['error']); $i++) { if (strpos($_SESSION['messages']['error'][$i], $msg) !== false) { $_SESSION['messages']['error'][$i] = $msg; break; } } $form_state['rebuild'] = TRUE; return $form; } // this performs the actual login user_login_submit($form, $form_state); // this performs a redirection $path = $form_state["redirect"] . "/subscriptions"; ctools_include('ajax'); ctools_add_js('ajax-responder'); $commands[] = ctools_ajax_command_redirect($path); print ajax_render($commands); exit; }
if ($item['subtitle']) { $title .= ' - ' . $item['subtitle']; } $title = preg_replace('/(' . $q . ')/Ui', '<em>\\1</em>', $title); $ret .= "<li id='" . $item['id'] . "'>" . $title . "</li>"; } $ret = "<ul>{$ret}</ul>"; echo $ret; exit; } // store query result in session for prev/next navigation session_set('query_result', array_extract($result, 'id')); } // process asynchronous refresh if ($ajax_render) { ajax_render(); } // prepare templates tpl_page('search', $q); tpl_list($result); $smarty->assign('q', $q); $smarty->assign('q_q', formvar($q)); $smarty->assign('search_fields', $search_fields); $smarty->assign('genreselect', out_genres($genres)); $smarty->assign('genres', out_genres2($genres)); //2015-10-6 Alex ADD start $smarty->assign('studioselect', out_studios($studios)); $smarty->assign('studios', out_studios2($studios)); //2015-10-6 Alex ADD end $smarty->assign('engine', $config['engine']); $smarty->assign('actors', prepare_cast($actors));