<?php

function get_system_setting_categories() {
	include(LANGUAGEFILE);

	$returndata = array();
	
	$returndata['users'] = array('name' => $l_users, 'icon' => 'images/users.png', 'onClick' => "getSystemSettingsPage(\"users\")", 'main_function' => 'system_settings_users_main_page');
	$returndata['system_test'] = array('name' => $l_system.' '.$l_test, 'icon' => 'images/system.test.png', 'onClick' => "getSystemSettingsPage(\"system_test\")", 'main_function' => 'system_settings_system_test_page');
	
	return $returndata;
}

function get_system_settings_page($variables) {
	/*
		$variables['page']
	*/
	
	$system_setting_categories = get_system_setting_categories();
	
	if($variables['page'] == 'system_settings_main_page') {
		return system_settings_main_page();
	} elseif(!isset($system_setting_categories[$variables['page']])) {
		$GLOBALS['errors'][] = __FUNCTION__.' required parameter not provided';
		return false;
	}
	
	$callFn = $system_setting_categories[$variables['page']]['main_function'];
	
	if(!function_exists($callFn)) {
		$GLOBALS['errors'][] = __FUNCTION__.' could not find desired function';
		return false;
	}
	
	return  $callFn();
}

function get_system_functions() {
	$system_functions = [];
	
	$system_functions['fyrk_project'] = ['name' => 'Project'];
	
	return $system_functions;
}