<?php
# vim:et:ts=3:sts=3:sw=3:

// RLD Creative base functions
// Copyright (C) 2017 RLD Creative
//

//load configuration settings
include_once( get_approot()."/include/config_inc.php");


/* ======================================================================
 * Function get_docroot()
 * Parameters: 
 * Returns: 
 *
 * Return the registered company name.
 * ====================================================================== */
function get_company() {
  global $config;
	
  echo( $config["company"]);
}

/* ======================================================================
 * Function get_docroot()
 * Parameters: 
 * Returns: 
 *
 * Return the configured page title.
 * ====================================================================== */
function get_title() {
  global $config;
	
  echo( $config["title"]);
}

/* ======================================================================
 * Function get_docroot()
 * Parameters: 
 * Returns: 
 *
 * Return home page url.
 * ====================================================================== */
function get_homepage() {
  
  echo('/');  
}

/* ======================================================================
 * Function get_docroot()
 * Parameters: 
 * Returns: 
 *
 * return the configured page title.
 * ====================================================================== */
function get_page_title() {
  global $page_title;
  
  $page = basename($_SERVER["SCRIPT_FILENAME"], '.php');
  
	if (empty($page_title[$page])) {
    echo( $page_title["index"]);
  } else {
    echo( $page_title[$page]); 
  }
}

/* ======================================================================
 * Function get_docroot()
 * Parameters: 
 * Returns: 
 *
 * set actuele kleurschema.
 * ====================================================================== */
function set_kleurschema( $schema = 0) {
  global $config;
  
  $config["kleurschema"] = $schema;
}

/* ======================================================================
 * Function get_docroot()
 * Parameters: 
 * Returns: 
 *
 * .
 * ====================================================================== */
function get_kleur( $index = 0, $hash = 1) {
 global $kleur_hexa, $config;
 
  $x = $config["kleurschema"];
  
  if ($index < 0) {$index = 0;}
  if ($index > 6) {$index = 6;}
  if ($index > 4) {$x = 0;}
  if ($hash != 0) { 
    echo( '#'.$kleur_hexa[$x][$index]);
  }
  else {
    echo( $kleur_hexa[$x][$index]);
  }
}

/* ======================================================================
 * Function get_docroot()
 * Parameters: 
 * Returns: 
 *
 * .
 * ====================================================================== */
function get_kleur_a( $index = 0) {
 global $kleur_rgba, $config;

  $x = $config["kleurschema"];
  
  if ($index < 0) {$index = 0;}
  if ($index > 6) {$index = 6;}
  if ($index > 4) {$x = 0;}
  
  echo( $kleur_rgba[$x][$index]);
}

?>

  