You are here

function fckeditor_profile_overview in FCKeditor - WYSIWYG HTML editor 5.2

Same name and namespace in other branches
  1. 6.2 fckeditor.admin.inc \fckeditor_profile_overview()
  2. 6 fckeditor.module \fckeditor_profile_overview()

Controller for fckeditor profiles.

1 call to fckeditor_profile_overview()
fckeditor_admin in ./fckeditor.module
Controller for FCKeditor administrative settings.

File

./fckeditor.module, line 709
FCKeditor - The text editor for Internet - http://www.fckeditor.net Copyright (C) 2003-2007 Frederico Caldeira Knabben

Code

function fckeditor_profile_overview() {
  $output = '';
  $profiles = fckeditor_profile_load();
  if ($profiles) {
    $roles = user_roles();
    $access_fckeditor_roles = user_roles(FALSE, 'access fckeditor');
    $header = array(
      t('Profile'),
      t('Roles'),
      t('Operations'),
    );
    foreach ($profiles as $p) {
      $rids = $p->rids;
      if ($p->name !== "FCKeditor Global Profile") {
        foreach ($p->rids as $rid => $name) {
          if (!isset($access_fckeditor_roles[$rid])) {
            unset($rids[$rid]);
          }
        }
        $rows[] = array(
          array(
            'data' => $p->name,
            'valign' => 'top',
          ),
          array(
            'data' => implode("<br />\n", $rids),
          ),
          array(
            'data' => l(t('edit'), 'admin/settings/fckeditor/edit/' . urlencode($p->name)) . ' ' . l(t('delete'), 'admin/settings/fckeditor/delete/' . urlencode($p->name)),
            'valign' => 'top',
          ),
        );
      }
    }
    $output .= "<h3>" . t("Profiles") . "</h3>";
    $output .= theme('table', $header, $rows);
    $output .= '<p>' . l(t('Create new profile'), 'admin/settings/fckeditor/add') . '</p>';
  }
  else {
    drupal_set_message(t('No profiles found. Click here to !create.', array(
      '!create' => l(t("create a new profile"), 'admin/settings/fckeditor/add'),
    )));
  }
  $rows = array();
  if (!isset($profiles['FCKeditor Global Profile'])) {
    drupal_set_message(t('Global Profile not found. Click here to !create.', array(
      '!create' => l(t("create the global profile"), 'admin/settings/fckeditor/addg'),
    )));
  }
  else {
    $output .= "<h3>" . t("Global Settings") . "</h3>";
    $rows[] = array(
      array(
        'data' => t('FCKeditor Global Profile'),
        'valign' => 'top',
      ),
      array(
        'data' => l(t('edit'), 'admin/settings/fckeditor/editg') . " " . l(t('delete'), 'admin/settings/fckeditor/deleteg'),
        'valign' => 'top',
      ),
    );
    $output .= theme('table', array(
      t('Profile'),
      t('Operations'),
    ), $rows);
  }
  return $output;
}