fgColors() public static method

Returns the foreground color for each of the user's categories.
public static fgColors ( ) : array
return array A list of colors, key is the category name, value is the HTML color code.
示例#1
0
文件: Category.php 项目: horde/horde
 /**
  */
 public function display(Horde_Core_Prefs_Ui $ui)
 {
     global $page_output, $prefs;
     $page_output->addScriptFile('categoryprefs.js', 'horde');
     $page_output->addScriptFile('colorpicker.js', 'horde');
     $page_output->addInlineJsVars(array('HordeCategoryPrefs.category_text' => _("Enter a name for the new category:")));
     $cManager = new Horde_Prefs_CategoryManager();
     $categories = $cManager->get();
     $colors = $cManager->colors();
     $fgcolors = $cManager->fgColors();
     $view = new Horde_View(array('templatePath' => HORDE_TEMPLATES . '/prefs'));
     $view->addHelper('Horde_Core_View_Helper_Image');
     $view->addHelper('Horde_Core_View_Helper_Label');
     $view->addHelper('Text');
     $view->picker_img = !$prefs->isLocked('category_colors');
     // Default Color
     $color = isset($colors['_default_']) ? $colors['_default_'] : '#FFFFFF';
     $fgcolor = isset($fgcolors['_default_']) ? $fgcolors['_default_'] : '#000000';
     $color_b = 'color_' . hash('md5', '_default_');
     $view->default_color = $color;
     $view->default_fgcolor = $fgcolor;
     $view->default_id = $color_b;
     // Unfiled Color
     $color = isset($colors['_unfiled_']) ? $colors['_unfiled_'] : '#FFFFFF';
     $fgcolor = isset($fgcolors['_unfiled_']) ? $fgcolors['_unfiled_'] : '#000000';
     $color_b = 'color_' . hash('md5', '_unfiled_');
     $view->unfiled_color = $color;
     $view->unfiled_fgcolor = $fgcolor;
     $view->unfiled_id = $color_b;
     $entries = array();
     foreach ($categories as $name) {
         $color = isset($colors[$name]) ? $colors[$name] : '#FFFFFF';
         $fgcolor = isset($fgcolors[$name]) ? $fgcolors[$name] : '#000000';
         $color_b = 'color_' . hash('md5', $name);
         $entries[] = array('color' => $color, 'fgcolor' => $fgcolor, 'id' => $color_b, 'name' => $name);
     }
     $view->categories = $entries;
     return $view->render('category');
 }
示例#2
0
 * Copyright 2005-2014 Horde LLC (http://www.horde.org/)
 *
 * See the enclosed file COPYING for license information (GPL). If you
 * did not receive this file, see http://www.horde.org/licenses/gpl.
 *
 * @author Ben Klang <*****@*****.**>
 */
require_once __DIR__ . '/lib/Application.php';
$beatnik = Horde_Registry::appInit('beatnik');
// Unset the current domain since we are generating a zone list
$_SESSION['beatnik']['curdomain'] = null;
// Set up categories
$cManager = new Horde_Prefs_CategoryManager();
$categories = $cManager->get();
$colors = $cManager->colors();
$fgcolors = $cManager->fgColors();
// Page results
// Check for and store the current page in the session
$page = Horde_Util::getGet('page', $_SESSION['beatnik']['curpage']);
$_SESSION['beatnik']['curpage'] = $page;
// Create the Pager UI
$pager_vars = Horde_Variables::getDefaultVariables();
$pager_vars->set('page', $page);
$perpage = $prefs->getValue('domains_perpage');
$pager = new Horde_Core_Ui_Pager('page', $pager_vars, array('num' => count($beatnik->domains), 'url' => 'listzones.php', 'page_count' => 10, 'perpage' => $perpage));
// Limit the domain list to the current page
$domains = array_slice($beatnik->domains, $page * $perpage, $perpage);
// Hide fields that the user does not want to see
$fields = Beatnik::getRecFields('soa');
foreach ($fields as $field_id => $field) {
    if ($field['type'] == 'hidden' || $field['infoset'] != 'basic' && !$_SESSION['beatnik']['expertmode']) {