/**
  * 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) {
             return 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);
     $help_area = $this->help_area($form_state);
     ctools_include('form');
     $form = ctools_build_form('ctools_export_ui_list_form', $form_state);
     $output = $this->list_header($form_state) . $this->list_render($form_state) . $this->list_footer($form_state);
     if (!$js) {
         $this->list_css();
         return $help_area . $form . $output;
     }
     ctools_include('ajax');
     $commands = array();
     $commands[] = ctools_ajax_command_replace('#ctools-export-ui-list-items', $output);
     if (!empty($replace_form)) {
         $commands[] = ctools_ajax_command_replace('#ctools-export-ui-list-form', $form);
     }
     ctools_ajax_render($commands);
 }
Пример #2
0
 /**
  * Create a command array to redraw a pane.
  */
 function command_update_pane($pid)
 {
     if (is_object($pid)) {
         $pane = $pid;
     } else {
         $pane = $this->display->content[$pid];
     }
     $this->commands[] = ctools_ajax_command_replace("#panels-ipe-paneid-{$pane->pid}", $this->render_pane($pane));
     $this->commands[] = ctools_ajax_command_changed("#panels-ipe-display-{$this->clean_key}");
 }
 /**
  * Create a command to update the links on a region after a change was made.
  */
 function command_update_region_links($id)
 {
     $this->commands[] = ctools_ajax_command_replace('.panels-region-links-' . $id, $this->get_region_links($id));
 }