$url .= '/' . implode('/', $args);
      }
      return $url;
  }
  /**
 * AJAX comman to present a dialog with our crazy shtuff
 */
  function ajax_select_cns_content($region = NULL, $category = NULL)
  {
      if (!array_key_exists($region, $this->plugins['layout']['regions'])) {
 function ajax_set_layout($layout)
 {
     ctools_include('context');
     ctools_include('display-layout', 'panels');
     $form_state = array('layout' => $layout, 'display' => $this->display, 'finish' => t('Save'), 'no_redirect' => TRUE);
     // Reset the $_POST['ajax_html_ids'] values to preserve
     // proper IDs on form elements when they are rebuilt
     // by the Panels IPE without refreshing the page
     $_POST['ajax_html_ids'] = array();
     $output = drupal_build_form('panels_change_layout', $form_state);
     $output = drupal_render($output);
     if (!empty($form_state['executed'])) {
         if (isset($form_state['back'])) {
             return $this->ajax_change_layout();
         }
         if (!empty($form_state['clicked_button']['#save-display'])) {
             // Saved. Save the cache.
             panels_edit_cache_save($this->cache);
             $this->display->skip_cache;
             // Since the layout changed, we have to update these things in the
             // renderer in order to get the right settings.
             $layout = panels_get_layout($this->display->layout);
             $this->plugins['layout'] = $layout;
             if (!isset($layout['regions'])) {
                 $this->plugins['layout']['regions'] = panels_get_regions($layout, $this->display);
             }
             $this->meta_location = 'inline';
             $this->commands[] = ajax_command_replace("#panels-ipe-display-{$this->clean_key}", panels_render_display($this->display, $this));
             $this->commands[] = ctools_modal_command_dismiss();
             return;
         }
     }
     $this->commands[] = ctools_modal_command_display(t('Change layout'), $output);
 }
  /**
   * AJAX command to present a dialog with a list of available content.
   */
  function ajax_select_content($region = NULL, $category = NULL) {
    if (!array_key_exists($region, $this->plugins['layout']['regions'])) {
      ctools_modal_render(t('Error'), t('Invalid input'));
    }

    $title = t('Add content to !s', array('!s' => $this->plugins['layout']['regions'][$region]));

    $categories = $this->get_categories($this->cache->content_types);

    if (empty($categories)) {
      $output = t('There are no content types you may add to this display.');
    }
    else {
      $output = '<div class="panels-add-content-modal">';
      $selector = $this->render_category_selector($categories, $category, $region);

      $content = !empty($categories[$category]['content']) ? $categories[$category]['content'] : array();
      $center = $this->render_category($content, $category, $region);

      $output .= '<div class="panels-section-column panels-section-column-categories">'
        . '<div class="inside">' . $selector . '</div></div>';
      $output .= $center;
      $output .= '</div>'; // panels-add-content-modal
    }

    $this->commands[] = ctools_modal_command_display($title, $output);
  }
 /**
  * AJAX command to present a dialog with a list of available content.
  */
 function ajax_select_content($region = NULL, $category = NULL)
 {
     if (!array_key_exists($region, $this->plugins['layout']['regions'])) {
         ctools_modal_render(t('Error'), t('Invalid input'));
     }
     $title = t('Add content to !s', array('!s' => $this->plugins['layout']['regions'][$region]));
     $categories = $this->get_categories($this->cache->content_types);
     if (empty($categories)) {
         $output = t('There are no content types you may add to this display.');
     } else {
         $output = theme('panels_add_content_modal', array('renderer' => $this, 'categories' => $categories, 'category' => $category, 'region' => $region));
     }
     $this->commands[] = ctools_modal_command_display($title, $output);
     // Give keybord focus to the first item in the category we just loaded.
     if (!empty($category)) {
         $this->commands[] = ajax_command_invoke(".panels-add-content-modal .panels-section-columns :focusable:first", 'focus');
     }
 }
 /**
  * AJAX command to present a dialog with a list of available content.
  */
 function ajax_select_content($region = NULL, $category = NULL)
 {
     if (!array_key_exists($region, $this->plugins['layout']['regions'])) {
         ctools_modal_render(t('Error'), t('Invalid input'));
     }
     $title = t('Add content to !s', array('!s' => $this->plugins['layout']['regions'][$region]));
     $categories = $this->get_categories($this->cache->content_types);
     if (empty($categories)) {
         $output = t('There are no content types you may add to this display.');
     } else {
         $output = theme('panels_add_content_modal', array('renderer' => $this, 'categories' => $categories, 'category' => $category, 'region' => $region));
     }
     $this->commands[] = ctools_modal_command_display($title, $output);
 }
Example #6
0
 public function getFormDialog($js, $q)
 {
     $this->useJS = $js;
     $this->questionId = $q;
     if (!$this->useJS()) {
         return drupal_get_form('chgk_db_edit_question_form');
     }
     $modal_style = array('chgkdb_modal' => array('modalOptions' => array('opacity' => 0.5, 'background-color' => '#000'), 'animation' => 'fadeIn', 'modalTheme' => 'CToolsChgkDbModal'));
     drupal_add_js($modal_style, 'setting');
     $form_state = array('title' => 'Редактирование вопроса', 'ajax' => $js, 'question_id' => $this->getQuestionId(), 'question' => &$q);
     $commands = ctools_modal_form_wrapper('chgk_db_edit_question_form', $form_state);
     if (!empty($form_state['executed'])) {
         $commands = array();
         $commands[] = ctools_modal_command_display(t("Sending form"), "Сохраняем...");
         $commands[] = ctools_ajax_command_reload();
     }
     print ctools_ajax_render($commands);
     exit;
 }