123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186 |
- <?php
- /*
- * DON'T REMOVE THE FOLLOWING LICENSE
- * INFORMATION!
- * ----------------------------------
- * Copyright by
- * Global Cube Business Solutions
- * Author: Dennis Ritz
- * info@global-cube.de
- * 2007-2008
- * ----------------------------------
- */
- /*
- * DATA Class
- * This class is not callable for clients
- */
- define('CONFIG_SESSION', 'MISConfig');
- require_once(ROOT_DIR."init.inc");
- class MISConfig extends App {
-
- static private $generatedSectionIDs = array();
- static private $generatedReportIDs = array();
- static private $generatedImageIDs = array();
- static private $generatedScorecardIDs = array();
-
- public function __construct() {
- parent::__construct(__file__);
- }
-
- public function getDefaultConfigFile() {
- $settingsDOM = new DOMDocument('1.0', 'iso-8859-1');
- $settingsDOM->load(ROOT_DIR."apps/".__CLASS__."/".__CLASS__.".settings.xml");
- $settingsXpath = new DOMXpath($settingsDOM);
-
- $defaultConfigFile = $settingsXpath->query("/settings/defaultConfigFile")->item(0)->nodeValue;
- if(!file_exists(ROOT_DIR."apps/".__CLASS__."/data/".$defaultConfigFile)) {
- $defaultConfigFile = $settingsXpath->query("/settings/rescueConfigFile")->item(0)->nodeValue;
- $this->setDefaultConfigFile($defaultConfigFile);
- }
- return $defaultConfigFile;
- }
-
- public function setDefaultConfigFile($p_configFile) {
- $settingsDOM = new DOMDocument('1.0', 'iso-8859-1');
- $settingsDOM->load(ROOT_DIR."apps/".__CLASS__."/".__CLASS__.".settings.xml");
- $settingsXpath = new DOMXpath($settingsDOM);
-
- $settingsNode = $settingsXpath->query("/settings")->item(0);
- $this->setNodeValue("defaultConfigFile",$p_configFile,$settingsDOM,$settingsNode);
- $settingsDOM->save(ROOT_DIR."apps/".__CLASS__."/".__CLASS__.".settings.xml");
- }
-
- public function setConfigFile($p_configFile) {
- $_SESSION[CONFIG_SESSION]['configFile'] = utf8_encode($p_configFile);
- }
-
- public function getConfigFile() {
- if(!empty($_SESSION[CONFIG_SESSION]) && !empty($_SESSION[CONFIG_SESSION]['configFile'])
- && file_exists(ROOT_DIR."apps/".__CLASS__."/data/".$_SESSION[CONFIG_SESSION]['configFile']))
- return ROOT_DIR."apps/".__CLASS__."/data/".$_SESSION[CONFIG_SESSION]['configFile'];
- else {
- $this->setConfigFile($this->getDefaultConfigFile());
- return ROOT_DIR."apps/".__CLASS__."/data/".$this->getDefaultConfigFile();
- }
- }
-
- public function getAllConfigFiles(){
- $dataDir = ROOT_DIR."apps/MISConfig/data/";
- $dataDirArr = array();
- $handle = opendir($dataDir);
- while ($file = readdir ($handle)) {
- if($file != "." && $file != "..") {
- if(is_file($dataDir.$file)) {
- $dataDirArr[] = $file;
- }
- }
- }
- return $dataDirArr;
- }
- public function getConfigFilesPath() {
- return $dataDir = ROOT_DIR."apps/".__CLASS__."/data/";
- }
-
- public function getTempFilesPath() {
- return $dataDir = ROOT_DIR."temp/";
- }
-
- public function setNodeValue($p_nodeName,$p_nodeValue,$p_DOM,$p_parentNode,$p_item=0) {
- $p_Xpath = new DOMXpath($p_DOM);
- $temp = $p_DOM->createElement($p_nodeName);
- $temp->appendChild($p_DOM->createTextNode(utf8_encode($p_nodeValue)));
- $nodeList = $p_Xpath->query("./".$p_nodeName,$p_parentNode);
- if($nodeList->length >0 && $nodeList->length > $p_item)
- $p_parentNode->replaceChild($temp,$p_parentNode->getElementsByTagName($p_nodeName)->item($p_item));
- else
- $p_parentNode->appendChild($temp);
- }
-
- public function getAllLangs(){
- return array("de" => "deutsch","en" => "english","fr" => "französisch","it" => "italiano");
- }
-
- public function getAllViews() {
- return array("Client" => "Client","Info-User" => "Info-User");
- }
-
- public function getAllPPR(){
- $projectDOM = new DOMDocument('1.0', 'iso-8859-1');
- $projectDOM->load($this->getConfigFile());
- $projectXpath = new DOMXpath($projectDOM);
-
- $PPRPath = $projectXpath->query("/Configuration/General/ReportPath")->item(0)->nodeValue;
- $PPRArr = array();
- $handle = opendir($PPRPath);
- while ($file = readdir ($handle)) {
- if($file != "." && $file != "..") {
- if(is_file($PPRPath."/".$file)) {
- //$filename = substr($file,0,strripos($file,"."));
- if("ppr" == getFileExtension($file)) {
- $filename = basename($file,".ppr");
- $filename = basename($filename,"_Graf");
- if(!in_array($filename,$PPRArr)) {
- array_push($PPRArr,$filename);
- }
- }
- }
- }
- }
- if(!$this->isRole("admin")) return array();
- return $PPRArr;
- }
-
- public function getAllScorcardFormats() {
- return array($this->_getI18N("Ganzzahlig"),$this->_getI18N("ZahlMitTrennz"),$this->_getI18N("ZahlOhneTrennz"),$this->_getI18N("Waehrung"),$this->_getI18N("Prozent"));
- }
-
- public function getAllPPRprimary() {
- $projectDOM = new DOMDocument('1.0', 'iso-8859-1');
- $projectDOM->load($this->getConfigFile());
- $projectXpath = new DOMXpath($projectDOM);
-
- $PPRPath = $projectXpath->query("/Configuration/General/ReportPath")->item(0)->nodeValue;
- $PPRArr = array();
- $handle = opendir($PPRPath);
- while ($file = readdir ($handle)) {
- if($file != "." && $file != "..") {
- if(is_file($PPRPath."/".$file)) {
- $filename = substr($file,0,strripos($file,"."));
- array_push($PPRArr,$filename);
- }
- }
- }
- return $PPRArr;
- }
-
- public function getAllImageTypes() {
- return array(
- $this->_getI18N("Kreuztabelle"),
- $this->_getI18N("Kreisdiagramm"),
- $this->_getI18N("ThreeD_Kreisdiagramm"),
- $this->_getI18N("Balkendiagramm"),
- $this->_getI18N("Balkengruppendiagramm"),
- $this->_getI18N("Stapelbalkendiagramm"),
- $this->_getI18N("Liniendiagramm"),
- $this->_getI18N("Mehrliniendiagramm"),
- $this->_getI18N("Korrelationsdiagramm"),
- $this->_getI18N("Punktdiagramm"));
- }
-
- public function getDataFile() {
- $projectDOM = new DOMDocument('1.0', 'iso-8859-1');
- $projectDOM->load($MISConfig->getConfigFile());
- $projectXpath = new DOMXpath($projectDOM);
-
- $dataFile = $projectXpath->query("/Configuration/General/PublishImagePath")->item(0)->nodeValue;
- return $dataFile.$this->getUsername()."/data.xml";
- }
-
- }
- ?>
|