You are here

function ckeditor_profile_overview in CKEditor - WYSIWYG HTML editor 7

Same name and namespace in other branches
  1. 6 includes/ckeditor.admin.inc \ckeditor_profile_overview()

Controller for CKEditor profiles.

1 call to ckeditor_profile_overview()
ckeditor_admin_main in includes/ckeditor.admin.inc
Main administrative page

File

includes/ckeditor.admin.inc, line 93
CKEditor - The text editor for the Internet - http://ckeditor.com Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.

Code

function ckeditor_profile_overview() {
  $output = '';
  $skins = ckeditor_load_skin_options();
  $global_profile = ckeditor_profile_load('CKEditor Global Profile');
  if (isset($global_profile->settings['skin']) && !array_key_exists($global_profile->settings['skin'], $skins)) {
    drupal_set_message(t('The <em>CKEditor Global Profile</em> profile is using %skin skin which cannot be found. Please <a href="@profile_settings">update your settings</a>.', array(
      '%skin' => $global_profile->settings['skin'],
      '@profile_settings' => url('admin/config/content/ckeditor/editg'),
    )), 'warning');
  }
  $profiles = ckeditor_profile_load();
  if ($profiles) {

    // @todo The following variable is never used. Remove it?
    $access_ckeditor_roles = user_roles(FALSE, 'access ckeditor');
    $header = array(
      t('Profile'),
      t('Input format'),
      t('Operations'),
    );
    $disabled_plugins = array();
    foreach ($profiles as $p) {
      if ($p->name !== "CKEditor Global Profile") {
        $rows[] = array(
          array(
            'data' => $p->name,
            'valign' => 'top',
          ),
          array(
            'data' => implode("<br />\n", $p->input_formats),
          ),
          array(
            'data' => l(t('edit'), 'admin/config/content/ckeditor/edit/' . urlencode($p->name)) . ' ' . l(t('clone'), 'admin/config/content/ckeditor/clone/' . urlencode($p->name)) . ' ' . l(t('delete'), 'admin/config/content/ckeditor/delete/' . urlencode($p->name)),
            'valign' => 'top',
          ),
        );
      }
    }
    if (count($disabled_plugins) > 0) {
      $msg = t("The following plugins could not be found and were automatically disabled in CKEditor profiles:");
      foreach ($disabled_plugins as $profile_name => $profile_plugins) {
        $msg .= "<br/><br/>";
        $msg .= t("<b>Profile</b>: %profile_name", array(
          "%profile_name" => $profile_name,
        ));
        $msg .= "<br/>";
        $msg .= t("<b>Plugins</b>: %profile_plugins", array(
          "%profile_plugins" => implode(', ', $profile_plugins),
        ));
      }
      drupal_set_message($msg, 'warning');
    }
    $output .= '<h3>' . t('Profiles') . '</h3>';
    $output .= theme('table', array(
      "header" => $header,
      "rows" => $rows,
    ));
    $output .= '<p>' . l(t('Create a new profile'), 'admin/config/content/ckeditor/add') . '</p>';
  }
  else {
    drupal_set_message(t('No profiles found. Click here to !create.', array(
      '!create' => l(t('create a new profile'), 'admin/config/content/ckeditor/add'),
    )), 'warning');
  }
  $rows = array();
  if (!isset($profiles['CKEditor Global Profile'])) {
    drupal_set_message(t('The global profile can not be found. Click here to !create.', array(
      '!create' => l(t('create the global profile'), 'admin/config/content/ckeditor/addg'),
    )), 'warning');
  }
  else {
    $output .= "<h3>" . t("Global settings") . "</h3>";
    $rows[] = array(
      array(
        'data' => t('CKEditor Global Profile'),
      ),
      array(
        'data' => l(t('edit'), 'admin/config/content/ckeditor/editg'),
        'valign' => 'top',
      ),
    );
    $output .= theme('table', array(
      "header" => array(
        t('Profile'),
        t('Operations'),
      ),
      "rows" => $rows,
    ));
  }
  return $output;
}