__COMPONENT();
}
private function _createSection($projectDOM,$projectXpath,$p_ID,$p_parentID,$p_username,$p_sectionName,$p_showHauptampel){
$MISConfig = new MISConfig();
if($projectXpath->query('/Configuration/Publishes/Publish[./@ID = "'.$p_ID.'"]')->length > 0
|| in_array($p_ID,self::$generatedSectionIDs)) {
$ID = null;
while($ID == null) {
$temp = mt_rand(0,99999);
if($projectXpath->query('/Configuration/Publishes/Publish[./@ID = "'.$temp.'"]')->length == 0
&& !in_array($temp,self::$generatedSectionIDs)) {
self::$generatedSectionIDs[] = $temp;
$ID = $temp;
}
}
$p_ID = $ID;
}
if(empty($p_ID))
$newID = $this->_generateSectionID();
else
$newID = $p_ID;
$PP = $projectDOM->createElement('Publish');
$PP->setAttribute('ID',$newID);
$PP->setAttribute('parentID',$p_parentID);
$PP->setAttribute('User',utf8_encode($p_username));
$PP->setAttribute('Name',utf8_encode("_".str_replace(" ","_",trim($p_sectionName,"_ "))."_"));
$PP->setAttribute('Alert',utf8_encode($p_showHauptampel));
$PP->appendChild($projectDOM->createElement('Images'));
$projectDOM->getElementsByTagName("Publishes")->item(0)->appendChild($PP);
$SS = $projectDOM->createElement("Scorecard");
$SS->setAttribute("ID",$newID);
$SS->setAttribute("Directory",utf8_encode($p_username)."\\");
$SS->setAttribute("Name",utf8_encode("_".str_replace(" ","_",trim($p_sectionName,"_ "))."_"));
$SS->appendChild($projectDOM->createElement("Reports"));
$projectDOM->getElementsByTagname("Scorecards")->item(0)->appendChild($SS);
$SS = $projectDOM->createElement("Dashboard");
$SS->setAttribute("ID",$newID);
$SS->setAttribute("Directory",utf8_encode($p_username)."\\");
$SS->setAttribute("Name",utf8_encode("_".str_replace(" ","_",trim($p_sectionName,"_ "))."_"));
$SS->appendChild($projectDOM->createElement("Reviews"));
$projectDOM->getElementsByTagname("Dashboards")->item(0)->appendChild($SS);
$projectDOM->save($MISConfig->getConfigFile());
return $newID;
}
private function _registerEmails($p_emailStr) {
$MISConfig = new MISConfig();
$ProjectDOM = new DOMDocument('1.0', 'iso-8859-1');
$ProjectDOM->load($MISConfig->getConfigFile());
$ProjectXpath = new DOMXpath($ProjectDOM);
$emailArr = explode(";",$p_emailStr);
foreach($emailArr as $i => $email) {
$emailExists = $ProjectXpath->query("/Configuration/Emails/Email[. = '".trim($email)."']")->length > 0 ? true : false;
if(!$emailExists && $email != "") $MISConfig->setNodeValue("Email",trim($email),$ProjectDOM,$ProjectXpath->query("/Configuration/Emails")->item(0),$ProjectXpath->query("/Configuration/Emails/Email")->length);
}
$ProjectDOM->save($MISConfig->getConfigFile());
}
public function _getAllDashboards() {
$MISConfig = new MISConfig();
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load($MISConfig->getConfigFile());
$projectXpath = new DOMXpath($projectDOM);
$PPRPath = $projectXpath->query("/Configuration/General/DashboardPath")->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);
}
}
}
if(!$this->isRole("admin")) return array();
return $PPRArr;
}
public function getMain($p_section = null) {
if($this->getAuth()) {
if($this->isRole("admin")) {
$p_args = func_get_args();
$p_section = array_shift($p_args);
if(!$this->isRole("admin") && $p_section == "configSettings")$p_section="general";
$eval = array();
//if($p_section=="configSettings") {
$menu = new Tree("configuratorMenu");
$this->getConfiguratorMenu($menu);
array_push($eval,'CMgr.getMODEL().setNavContainer(\''.addslashes(''.$menu.'').'\')');
array_push($eval,'Tree.setToUserView(Browser.getElementById("configuratorMenu"))');
if($this->isRole("master"))
array_push($eval,'if(DEBUG_LEVEL != 0){Browser.getElementById("debug").getElementsByTagName("td")[0].style.color="#ff0000";}else{Browser.getElementById("debug").getElementsByTagName("td")[0].style.color="#000053";};');
//}
$ret = '
';
$arr = call_user_func_array(array($this, $p_section), $p_args);
$ret.= $arr[0];
array_push($eval,$arr[1]);
array_push($eval,';CMgr.getMODEL().setLocationName(\''.addslashes(new Label($this->_getI18N("administration"))).'\')');
$ret.= '
';
$sectionLabel = new Label(new Icon("img/arrow_back.png"),$this->_getI18N("back"));
array_push($eval,';CMgr.getMODEL().setLeftToolbar(\''.$sectionLabel.'
\')');
array_push($eval,'CMgr.getMODEL().setMainToolbar("");CMgr.getMODEL().setMainHead(\''.addslashes(new Label($this->_getI18N($p_section))).'\')');
$sectionLabel = new Label(new Icon("img/Configurator.png"),$this->_getI18N("configurator"));
array_push($eval,'CMgr.getMODEL().setLeftFootbar(\''.$sectionLabel.'
\')');
return array($ret,implode(";",$eval));
} else {
return array('','');
}
} else {
return array('','CMgr.getMODEL().__construct();');
}
}
private function getConfiguratorMenu($p_node) {
if($this->isRole("admin")) {
$adminNode = new TreeNode(new Label($this->_getI18N("info")),"info");
$p_node->appendChild($adminNode);
$eventListener = new EventListener("onclick",'CMgr.getMODEL().getMain("MISConfigurator","info");');
$adminNode->addEventListener($eventListener);
if($this->getUsername() == "master") {
$infoNode = $adminNode;
$adminNode = new TreeNode(new Label($this->_getI18N("version")),"version");
$infoNode->appendChild($adminNode);
$eventListener = new EventListener("onclick",'CMgr.getMODEL().getMain("MISConfigurator","version");');
$adminNode->addEventListener($eventListener);
}
$c_node = new TreeNode(new Label($this->_getI18N("configSettings")),"configSettings");
$p_node->appendChild($c_node);
$eventListener = new EventListener("onclick",'CMgr.getMODEL().getMain("MISConfigurator","configSettings");');
$c_node->addEventListener($eventListener);
$adminNode = new TreeNode(new Label($this->_getI18N("general")),"general");
$c_node->appendChild($adminNode);
$eventListener = new EventListener("onclick",'CMgr.getMODEL().getMain("MISConfigurator","general");');
$adminNode->addEventListener($eventListener);
$adminSubNode = new TreeNode(new Label($this->_getI18N("alarmConfig")),"alarmConfig");
$adminNode->appendChild($adminSubNode);
$eventListener = new EventListener("onclick",'CMgr.getMODEL().getMain("MISConfigurator","alarmConfig");');
$adminSubNode->addEventListener($eventListener);
$adminSubNode = new TreeNode(new Label($this->_getI18N("imageConfig")),"imageConfig");
$adminNode->appendChild($adminSubNode);
$eventListener = new EventListener("onclick",'CMgr.getMODEL().getMain("MISConfigurator","imageConfig");');
$adminSubNode->addEventListener($eventListener);
$adminSubNode = new TreeNode(new Label($this->_getI18N("versionConfig")),"versionConfig");
$adminNode->appendChild($adminSubNode);
$eventListener = new EventListener("onclick",'CMgr.getMODEL().getMain("MISConfigurator","versionConfig");');
$adminSubNode->addEventListener($eventListener);
$adminNode = new TreeNode(new Label($this->_getI18N("publishes")),"publishes");
$c_node->appendChild($adminNode);
$eventListener = new EventListener("onclick",'CMgr.getMODEL().getMain("MISConfigurator","publishes");');
$adminNode->addEventListener($eventListener);
$adminNode = new TreeNode(new Label($this->_getI18N("emailSetup")),"emailSetup");
$c_node->appendChild($adminNode);
$eventListener = new EventListener("onclick",'CMgr.getMODEL().getMain("MISConfigurator","emailSetup");');
$adminNode->addEventListener($eventListener);
$emailNode = new TreeNode(new Label($this->_getI18N("export")),"emailExport");
$adminNode->appendChild($emailNode);
$eventListener = new EventListener("onclick",'CMgr.getMODEL().getMain("MISConfigurator","emailExport");');
$emailNode->addEventListener($eventListener);
$adminNode = new TreeNode(new Label($this->_getI18N("languages")),"languages");
$p_node->appendChild($adminNode);
$eventListener = new EventListener("onclick",'CMgr.getMODEL().getMain("MISConfigurator","languages");');
$adminNode->addEventListener($eventListener);
$adminNode = new TreeNode(new Label($this->_getI18N("debug")),"debug");
$p_node->appendChild($adminNode);
$eventListener = new EventListener("onclick",'if(DEBUG_LEVEL == 0){this.parentNode.getElementsByTagName("td")[0].style.color="#ff0000";DEBUG_LEVEL=3;} else {this.parentNode.getElementsByTagName("td")[0].style.color="#000053";DEBUG_LEVEL=0;}');
$adminNode->addEventListener($eventListener);
}
}
public function saveMain(){
if($this->getAuth()) {
if($this->isRole("admin")) {
global $Core;
$p_args = func_get_args();
$p_method = array_shift($p_args);
//ATTENTION CLIENT CAN CALL PRIVATE FUNCTIONS! MUST VERIFY THAT USER IS MASTER
$ret = call_user_func_array(array($this, $p_method), $p_args);
$MISConfig = new MISConfig();
$ProjectDOM = new DOMDocument('1.0', 'iso-8859-1');
$ProjectDOM->load($MISConfig->getConfigFile());
$ProjectXpath = new DOMXpath($ProjectDOM);
$creatorPath = $ProjectXpath->query('/Configuration/General/WebCreatorPath')->item(0)->nodeValue;
if(is_dir($creatorPath)) {
copy($MISConfig->getConfigFile(),$creatorPath.basename($MISConfig->getConfigFile()));
$ProjectDOM = new DOMDocument('1.0', 'iso-8859-1');
$ProjectDOM->load($creatorPath.basename($MISConfig->getConfigFile()));
$ProjectXpath = new DOMXpath($ProjectDOM);
$ProjectXpath->query("/Configuration")->item(0)->removeChild($ProjectXpath->query("/Configuration/Dashboards")->item(0));
$ProjectXpath->query("/Configuration")->item(0)->removeChild($ProjectXpath->query("/Configuration/Version")->item(0));
$ProjectXpath->query("/Configuration")->item(0)->removeChild($ProjectXpath->query("/Configuration/Emails")->item(0));
$ProjectDOM->save($creatorPath.basename($MISConfig->getConfigFile()));
}
return $ret;
}
return array('CMgr.getMODEL().__construct();');
}
return array('CMgr.getMODEL().__construct();');
}
private function configSettings() {
$ret = "";
if($this->isRole("admin")) {
$MISConfig = new MISConfig();
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$temp_projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load($MISConfig->getConfigFile());
$xpath = new DOMXpath($projectDOM);
$currentConfigFile = basename($MISConfig->getConfigFile());
$Tree = new Tree("administrationMenu5");
$ret .= '
';
if($this->isRole("master")){
$Tree = new Tree("administrationMenu6");
$ret .= '
';
}
}
return array($ret,'');
}
private function saveConfigFile($p_currentConfigFile) {
if($this->isRole("admin") && $p_currentConfigFile != "" && $p_currentConfigFile!= null) {
$MISConfig = new MISConfig();
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$MISConfig->setConfigFile($p_currentConfigFile);
$projectDOM->load($MISConfig->getConfigFile());
$projectXpath = new DOMXpath($projectDOM);
return array('CMgr.getMODEL().__construct();CMgr.getMODEL().setConfig("'.$projectXpath->query("/Configuration")->item(0)->getAttribute("Name").'")');
}else{
return array('CMgr.getMODEL().__construct();');
}
}
private function saveDefaultConfigFile($p_defaultConfigFile) {
$MISConfig = new MISConfig();
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load($MISConfig->getConfigFile());
$projectXpath = new DOMXpath($projectDOM);
$this->deleteDir($projectXpath->query("/Configuration/General/PublishImagePath")->item(0)->nodeValue);
if($this->isRole("master") && $p_defaultConfigFile != "" && $p_defaultConfigFile!= null) $MISConfig->setDefaultConfigFile($p_defaultConfigFile);
return array('CMgr.getMODEL().__construct();');
}
private function info(){
$ret = '
';
$ret.= '';
return array($ret,'');
}
private function version(){
$ret="";
if($this->isRole("master")) {
$buffer = "";
if (fsockopen("www.global-cube.de", 80, $errno, $errstr, 5)) {
$filestream = fopen("http://www.global-cube.de/GAPS/version.txt", "r");
while(!feof($filestream)) {
$buffer .= fgets($filestream, 4096);
}
fclose($filestream);
}
if($buffer==""){
$versionLabel2 = new Label($this->_getI18N("offline"));
}else{
$versionLabel2 = new Label($buffer);
}
if(is_numeric(self::$version) && $buffer > self::$version) {
$versionLabel1 = new Label("".self::$version.""); ;
}elseif(is_numeric(self::$version) && $buffer < self::$version) {
$versionLabel1 = new Label("".self::$version." (Pre Build)"); ;
}elseif(is_numeric(self::$version) && $buffer == self::$version){
$versionLabel1 = new Label(self::$version); ;
}else{
$versionLabel1 = new Label("".self::$version." (Customer Build)"); ;
}
$ret.= '
';
$ret.= '';
$ret.= '';
}
return array($ret,'');
}
private function general() {
$MISConfig = new MISConfig();
$structureDOM = new DOMDocument('1.0', 'iso-8859-1');
$structureDOM->load($MISConfig->getConfigFile());
$xpath = new DOMXpath($structureDOM);
$general['DashboardPath'] = $xpath->query('/Configuration/General/DashboardPath')->item(0)->nodeValue;
$general['WebCreatorPath'] = $xpath->query('/Configuration/General/WebCreatorPath')->item(0)->nodeValue;
$general['CubePath'] = $xpath->query('/Configuration/General/CubePath')->item(0)->nodeValue;
$general['ReportPath'] = $xpath->query('/Configuration/General/ReportPath')->item(0)->nodeValue;
$general['WebReportPath'] = $xpath->query('/Configuration/General/WebReportPath')->item(0)->nodeValue;
$general['PublishPath'] = $xpath->query('/Configuration/General/PublishPath')->item(0)->nodeValue;
$_SESSION["Config"]["General"]["PublishImagePath"] = $general['PublishImagePath'] = $xpath->query('/Configuration/General/PublishImagePath')->item(0)->nodeValue;
$general['PublishAlarmPath'] = $xpath->query('/Configuration/General/PublishAlarmPath')->item(0)->nodeValue;
$general['WebServerName'] = $xpath->query('/Configuration/General/WebServerName')->item(0)->nodeValue;
$general['PortalStartPage'] = $xpath->query('/Configuration/General/PortalStartPage')->item(0)->nodeValue;
$general['PDFURL'] = $xpath->query('/Configuration/General/PDFURL')->item(0)->nodeValue;
$general['ReportURL'] = $xpath->query('/Configuration/General/ReportURL')->item(0)->nodeValue;
$general['CubeURL'] = $xpath->query('/Configuration/General/CubeURL')->item(0)->nodeValue;
$general['GatewayURL'] = $xpath->query('/Configuration/General/GatewayURL')->item(0)->nodeValue;
$general['SecURL'] = $xpath->query('/Configuration/General/SecURL')->item(0)->nodeValue;
$general['SMTPHost'] = $xpath->query('/Configuration/General/SMTPHost')->item(0)->nodeValue;
$general['SMTPUser'] = $xpath->query('/Configuration/General/SMTPUser')->item(0)->nodeValue;
$general['SMTPPassword'] = $xpath->query('/Configuration/General/SMTPPassword')->item(0)->nodeValue;
$general['SenderMail'] = $xpath->query('/Configuration/General/SenderMail')->item(0)->nodeValue;
$general['GenerateImage'] = $xpath->query('/Configuration/General/GenerateImage')->item(0)->nodeValue;
$general['GeneratePPX'] = $xpath->query('/Configuration/General/GeneratePPX')->item(0)->nodeValue;
$general['GenerateAlert'] = $xpath->query('/Configuration/General/GenerateAlert')->item(0)->nodeValue;
$general['GenerateWeb'] = $xpath->query('/Configuration/General/GenerateWeb')->item(0)->nodeValue;
$ret = '';
return array($ret,'');
}
private function saveGeneral() {
$args = func_get_args();
$MISConfig = new MISConfig();
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load($MISConfig->getConfigFile());
$projectXpath = new DOMXpath($projectDOM);
$selectedGeneralNodeChilds = $projectXpath->query('/Configuration/General')->item(0)->childNodes;
$k=0;
for($i=0;$i<(count($args)+$k);$i++) {
if($selectedGeneralNodeChilds->item($i)->nodeType != XML_ELEMENT_NODE){
$k++;continue;
}
$oldNode = $selectedGeneralNodeChilds->item($i);
$newNode = $oldNode->cloneNode(false);
$newTextNode = $projectDOM->createTextNode(utf8_encode($args[($i-$k)]));
$newNode->appendChild($newTextNode);
$oldNode->parentNode->replaceChild($newNode,$oldNode);
}
$projectDOM->save($MISConfig->getConfigFile());
return array('CMgr.getMODEL().__construct();');
}
private function alarmConfig() {
$MISConfig = new MISConfig();
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load($MISConfig->getConfigFile());
$projectXpath = new DOMXpath($projectDOM);
$alarm['EmailCreation'] = $projectXpath->query('/Configuration/General/AlarmConfig/EmailCreation')->item(0)->nodeValue;
$alarm['GIFCreation'] = $projectXpath->query('/Configuration/General/AlarmConfig/GIFCreation')->item(0)->nodeValue;
$alarm['JPGCreation'] = $projectXpath->query('/Configuration/General/AlarmConfig/JPGCreation')->item(0)->nodeValue;
$ret = '
';
return array($ret,'');
}
private function saveAlarmConfig() {
$args = func_get_args();
$MISConfig = new MISConfig();
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load($MISConfig->getConfigFile());
$projectXpath = new DOMXpath($projectDOM);
$selectedGeneralNodeChilds = $projectXpath->query('/Configuration/General/AlarmConfig')->item(0)->childNodes;
$k=0;
for($i=0;$i<(count($args)+$k);$i++) {
if($selectedGeneralNodeChilds->item($i)->nodeType != XML_ELEMENT_NODE){
$k++;continue;
}
$oldTextNode = $selectedGeneralNodeChilds->item($i)->firstChild;
$newTextNode = $projectDOM->createTextNode(utf8_encode($args[($i-$k)]));
$selectedGeneralNodeChilds->item($i)->replaceChild($newTextNode,$oldTextNode);
}
$projectDOM->save($MISConfig->getConfigFile());
return array('CMgr.getMODEL().__construct();');
}
private function imageConfig() {
$MISConfig = new MISConfig();
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load($MISConfig->getConfigFile());
$xpath = new DOMXpath($projectDOM);
$image['GIFCreation'] = $xpath->query('/Configuration/General/ImageConfig/GIFCreation')->item(0)->nodeValue;
$image['JPGCreation'] = $xpath->query('/Configuration/General/ImageConfig/JPGCreation')->item(0)->nodeValue;
$ret = '';
return array($ret,'');
}
private function saveImageConfig() {
$args = func_get_args();
$MISConfig = new MISConfig();
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load($MISConfig->getConfigFile());
$projectXpath = new DOMXpath($projectDOM);
$selectedGeneralNodeChilds = $projectXpath->query('/Configuration/General/ImageConfig')->item(0)->childNodes;
$k=0;
for($i=0;$i<(count($args)+$k);$i++) {
if($selectedGeneralNodeChilds->item($i)->nodeType != XML_ELEMENT_NODE){
$k++;continue;
}
$oldTextNode = $selectedGeneralNodeChilds->item($i)->firstChild;
$newTextNode = $projectDOM->createTextNode(utf8_encode($args[($i-$k)]));
$selectedGeneralNodeChilds->item($i)->replaceChild($newTextNode,$oldTextNode);
}
$projectDOM->save($MISConfig->getConfigFile());
return array('CMgr.getMODEL().getMain();');
}
private function versionConfig($selectedSection=null) {
$MISConfig = new MISConfig();
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load($MISConfig->getConfigFile());
$projectXpath = new DOMXpath($projectDOM);
$Version = $projectXpath->query('/Configuration/Version')->item(0);
$alarm['show'] = $projectXpath->query('./@show',$Version)->item(0)->nodeValue;
$alarm['odbc'] = $projectXpath->query('./@odbc',$Version)->item(0)->nodeValue;
$alarm['user'] = $projectXpath->query('./@user',$Version)->item(0)->nodeValue;
$alarm['pw'] = $projectXpath->query('./@pw',$Version)->item(0)->nodeValue;
$alarm['fp_feld'] = $projectXpath->query('./Views/@fp_feld',$Version)->item(0)->nodeValue;
$alarm['fp_description'] = $projectXpath->query('./Views/@fp_description',$Version)->item(0)->nodeValue;
$alarm['view_feld'] = $projectXpath->query('./Views/@view_feld',$Version)->item(0)->nodeValue;
$alarm['view_description'] = $projectXpath->query('./Views/@view_description',$Version)->item(0)->nodeValue;
$ret = '
';
$Tree = new Tree("administrationMenu");
$ret .= '
';
return array($ret,'Tree.setToUserView(Browser.getElementById("administrationMenu"));');
}
private function saveVersionConfig($p_show,$p_odbc,$p_user,$p_pw,$p_fp_feld,$p_fp_description,$p_view_feld,$p_view_description) {
$MISConfig = new MISConfig();
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load($MISConfig->getConfigFile());
$projectXpath = new DOMXpath($projectDOM);
$Version = $projectXpath->query('/Configuration/Version')->item(0);
$Version->setAttribute("show",$p_show);
$Version->setAttribute("odbc",utf8_encode($p_odbc));
$Version->setAttribute("user",utf8_encode($p_user));
if($p_pw != " ") $Version->setAttribute("pw",utf8_encode($p_pw));
$Views = $projectXpath->query("./Views",$Version)->item(0);
$Views->setAttribute("fp_feld",utf8_encode($p_fp_feld));
$Views->setAttribute("fp_description",utf8_encode($p_fp_description));
$Views->setAttribute("view_feld",utf8_encode($p_view_feld));
$Views->setAttribute("view_description",utf8_encode($p_view_description));
$projectDOM->save($MISConfig->getConfigFile());
return array('CMgr.getMODEL().__construct();');
}
private function publishes($selectedSection="") {
$eval = "";
if($selectedSection!="") {
$_SESSION["configurator"]["publishes"]["section"] = $selectedSection;
}else if(isset($_SESSION["configurator"]) && isset($_SESSION["configurator"]["publishes"]) && isset($_SESSION["configurator"]["publishes"]["section"])){
$selectedSection = $_SESSION["configurator"]["publishes"]["section"];
}
$selectedSectionArr = explode("_",$selectedSection);
$MISConfig = new MISConfig();
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load($MISConfig->getConfigFile());
$projectXpath = new DOMXpath($projectDOM);
if($projectXpath->query("/Configuration/Publishes/Publish[./@ID='".$selectedSectionArr[0]."']")->length == 0) {
$selectedSection="";
$selectedSectionArr = array();
}
$ret = '';
if($selectedSection!="")$eval = 'Tree.setToUserView(Browser.getElementById("administrationMenu2"));Tree.setToUserView(Browser.getElementById("administrationMenu3"));Tree.setToUserView(Browser.getElementById("administrationMenu4"));';
$ret .= '';
$ret .= '';
$ret .= '';
return array($ret,$eval.'Tree.setToUserView(Browser.getElementById("administrationMenu1"));');
}
private function versionViewMenu($p_node) {
$MISConfig = new MISConfig();
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load($MISConfig->getConfigFile());
$projectXpath = new DOMXpath($projectDOM);
$childsHaveValue = $sectionHasValue = false;
$PPList = $projectXpath->query('/Configuration/Version/Views/View');
for($k=0;$k < $PPList->length;$k++) {
$PP = $PPList->item($k);
if($PP->nodeType != XML_ELEMENT_NODE) continue;
$sectionID = $PP->getAttribute("ID");
$sectionName = $PP->getElementsByTagName("Name")->item(0)->nodeValue;
$sectionDesc = $PP->getElementsByTagName("Description")->item(0)->nodeValue;
$newIcon = new Icon("img/view.png");
$newLabel = new Label($newIcon,$sectionName);
$newTreeNode = new TreeNode($newLabel,$sectionID);
$newContextMenu = new ContextMenu();
$newLabel = new Label(new Icon("img/edit.png"),$this->_getI18N("edit"));
$newContextMenuNode = new ContextMenuNode($newLabel);
$newEventListener = new EventListener("onclick",'MISConfigurator.selectReport(event,Browser.getElementById("'.$sectionID.'"));CMgr.getMODEL().getRetrieveInput("MISConfigurator","editView","'.$sectionID.'");');
$newContextMenuNode->addEventListener($newEventListener);
$newContextMenu->appendChild($newContextMenuNode);
$newLabel = new Label(new Icon("img/delete.png"),$this->_getI18N("delete"));
$newContextMenuNode = new ContextMenuNode($newLabel);
$newEventListener = new EventListener("onclick",'CMgr.getMODEL().getRetrieveInput("MISConfigurator","deleteView","'.$sectionID.'");');
$newContextMenuNode->addEventListener($newEventListener);
$newContextMenu->appendChild($newContextMenuNode);
$newTreeNode->addContextMenu($newContextMenu);
$p_node->appendChild($newTreeNode);
}
}
public function configUsersForm($selectedSection) {
$Tree = new Tree("administrationMenu1");
$ret='';
return $ret;
}
private function usersSectionMenu($p_node,$p_parentID="",$p_username,$projectDOM = null, $projectXpath = null) {
$MISConfig = new MISConfig();
if($projectDOM == null) {
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load($MISConfig->getConfigFile());
}
if($projectXpath == null) {
$projectXpath = new DOMXpath($projectDOM);
}
$childsHaveValue = $sectionHasValue = false;
$PPList = $projectXpath->query('/Configuration/Publishes/Publish[./@parentID = "'.$p_parentID.'" and ./@User = "'.$p_username.'"]');
for($k=0;$k < $PPList->length;$k++) {
$PP = $PPList->item($k);
if($PP->nodeType != XML_ELEMENT_NODE) continue;
$sectionID = $PP->getAttribute("ID");
$sectionName = $PP->getAttribute("Name");
$sectionHasValue = false;//($projectXpath->query('/Configuration/Publishes/Publish/Images/Image[./../../@ID="'.$sectionID.'" and ./../../@User = "'.$p_username.'"]')->length > 0) ? true : false;
//if(!$sectionHasValue)$sectionHasValue = ($projectXpath->query('/Configuration/Scorecards/Scorecard/Reports/Report[./../../@ID="'.$sectionID.'" and ./../../@Directory = "'.$p_username.'\\"]')->length > 0) ? true : false;
//if(!$sectionHasValue)$sectionHasValue = ($projectXpath->query('/Configuration/Dashboards/Dashboard/Reviews/Review[./../../@ID="'.$sectionID.'" and ./../../@Directory = "'.$p_username.'\\"]')->length > 0) ? true : false;
$subPublishNodeList = $projectXpath->query('/Configuration/Publishes/Publish[./@parentID = "'.$sectionID.'"]');
$PIList = $projectXpath->query('/Configuration/Publishes/Publish/Images/Image[./../../@ID="'.$sectionID.'" and ./Directory="'.utf8_encode($p_username).'\\" and ./Active="J"]');
$newIcon = new Icon("img/package.png");
$newIcon->addEventListener(new EventListener("onclick",'ContextMenu.leftClick();ContextMenu.show(this.parentNode.parentNode.parentNode.parentNode.parentNode,event);'));
if($sectionHasValue) $newLabel = new Label($newIcon,"".str_replace("_", " ",$sectionName)."");
else $newLabel = new Label($newIcon,str_replace("_", " ", $sectionName));
$newTreeNode = new TreeNode($newLabel,$sectionID."_".$p_username);
$newEventListener = new EventListener("onmousedown",'MISConfigurator.selectSection(event,this.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode);');
$newLabel->addEventListener($newEventListener);
$newEventListener = new EventListener("ronmousedown",'MISConfigurator.selectSection(event,this.parentNode.parentNode)');
$newTreeNode->addEventListener($newEventListener);
$newContextMenu = new ContextMenu();
$newLabel = new Label(new Icon("img/edit.png"),$this->_getI18N("edit"));
$newContextMenuNode = new ContextMenuNode($newLabel);
$newEventListener = new EventListener("onclick",'CMgr.getMODEL().getRetrieveInput("MISConfigurator","editSection",Cookie.read("Tree_administrationMenu1_selected"));');
$newContextMenuNode->addEventListener($newEventListener);
$newContextMenu->appendChild($newContextMenuNode);
$newLabel = new Label(new Icon("img/delete.png"),$this->_getI18N("delete"));
$newContextMenuNode = new ContextMenuNode($newLabel);
$newEventListener = new EventListener("onclick",'CMgr.getMODEL().getRetrieveInput("MISConfigurator","deleteSection",Cookie.read("Tree_administrationMenu1_selected"));');
$newContextMenuNode->addEventListener($newEventListener);
$newContextMenu->appendChild($newContextMenuNode);
$newLabel = new Label(new Icon("img/package.png"),$this->_getI18N("createSection"));
$newContextMenuNode = new ContextMenuNode($newLabel);
$newEventListener = new EventListener("onclick",'CMgr.getMODEL().getRetrieveInput("MISConfigurator","createSection","'.$sectionID.'","'.$p_username.'");');
$newContextMenuNode->addEventListener($newEventListener);
$newContextMenu->appendChild($newContextMenuNode);
/* $newLabel = new Label(new Icon("img/empty.png"),$this->_getI18N("emptySection"));
$newContextMenuNode = new ContextMenuNode($newLabel);
$newEventListener = new EventListener("onclick",'CMgr.getMODEL().getRetrieveInput("MISConfigurator","emptySection","'.$sectionID.'","'.$p_username.'");');
$newContextMenuNode->addEventListener($newEventListener);
$newContextMenu->appendChild($newContextMenuNode);
$newLabel = new Label(new Icon("img/report.png"),$this->_getI18N("createReport"));
$newContextMenuNode = new ContextMenuNode($newLabel);
$newEventListener = new EventListener("onclick",'CMgr.getMODEL().getRetrieveInput("MISConfigurator","createReport","'.$sectionID.'","'.$p_username.'");');
$newContextMenuNode->addEventListener($newEventListener);
$newContextMenu->appendChild($newContextMenuNode);
$newLabel = new Label(new Icon("img/scorecard.png"),$this->_getI18N("createScorecard"));
$newContextMenuNode = new ContextMenuNode($newLabel);
$newEventListener = new EventListener("onclick",'CMgr.getMODEL().getRetrieveInput("MISConfigurator","createScorecard","'.$sectionID.'","'.$p_username.'");');
$newContextMenuNode->addEventListener($newEventListener);
$newContextMenu->appendChild($newContextMenuNode);
$newLabel = new Label(new Icon("img/dashboard.png"),$this->_getI18N("createDashboard"));
$newContextMenuNode = new ContextMenuNode($newLabel);
$newEventListener = new EventListener("onclick",'CMgr.getMODEL().getRetrieveInput("MISConfigurator","createDashboard","'.$sectionID.'","'.$p_username.'");');
$newContextMenuNode->addEventListener($newEventListener);
$newContextMenu->appendChild($newContextMenuNode);
*/
$newTreeNode->addContextMenu($newContextMenu);
$newEventListener = new EventListener("onmousedown",'DragAndDrop.startDrag(event,this,"section","'.$sectionID.'_'.$p_username.'");MISConfigurator.selectSection(event,this.parentNode.parentNode);');
$newTreeNode->addEventListener($newEventListener);
$newEventListener = new EventListener("onmousemove",'DragAndDrop.setDrop(event,this,"section","section,report,scorecard,dashboard","MISConfigurator","'.$sectionID.'_'.$p_username.'");');
$newTreeNode->addEventListener($newEventListener);
$newEventListener = new EventListener("onmouseout","DragAndDrop.clearDrop();");
$newTreeNode->addEventListener($newEventListener);
if($subPublishNodeList->length > 0) {
$childsHaveValue = $this->usersSectionMenu($newTreeNode,$sectionID,$p_username,$projectDOM,$projectXpath);
}
$p_node->appendChild($newTreeNode);
}
if($childsHaveValue || $sectionHasValue) {
return true;
} else {
return false;
}
}
public function configReportsForm($selectedSection) {
$MISConfig = new MISConfig();
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load($MISConfig->getConfigFile());
$projectXpath = new DOMXpath($projectDOM);
if($selectedSection!="") {
$_SESSION["configurator"]["publishes"]["section"] = $selectedSection;
}else if(isset($_SESSION["configurator"]) && isset($_SESSION["configurator"]["publishes"]) && isset($_SESSION["configurator"]["publishes"]["section"])){
$selectedSection = $_SESSION["configurator"]["publishes"]["section"];
}
$selectedSectionArr = explode("_",$selectedSection);
$sectionID = $selectedSectionArr[0];
$p_username = utf8_encode($selectedSectionArr[1]);
$PIList = $projectXpath->query('/Configuration/Publishes/Publish/Images/Image[./../../@ID="'.$sectionID.'" and ./Directory="'.$p_username.'\\" and ./Active="J"]');
$Tree = new Tree("administrationMenu2");
for($i=0;$i<$PIList->length;$i++){
if($PIList->item($i)->getElementsByTagname("Ansicht")->item(0)->nodeValue == "Client")
$newIcon = new Icon("img/report.png");
else
$newIcon = new Icon("img/pdficon_small.gif");
$newIcon->addEventListener(new EventListener("onclick",'ContextMenu.leftClick();ContextMenu.show(this.parentNode.parentNode.parentNode.parentNode.parentNode,event);'));
$newLabel = new Label($newIcon,''.$PIList->item($i)->getElementsByTagName("Name")->item(0)->nodeValue.'');
$newReportTreeNode = new TreeNode($newLabel,$PIList->item($i)->getAttribute("ID")."_".$p_username);
$Tree->appendChild($newReportTreeNode);
$newEventListener = new EventListener("onclick",'');
//$newLabel->addEventListener($newEventListener);
$newEventListener = new EventListener("ondblclick",'window.location.href = "?&rc=MISConfigurator&rm=getReport&ras[]='.$PIList->item($i)->getAttribute("ID").'";');
$newLabel->addEventListener($newEventListener);
$newEventListener = new EventListener("onmousedown",'DragAndDrop.startDrag(event,this,"report","'.$PIList->item($i)->getAttribute("ID").'_'.$p_username.'");');
$newReportTreeNode->addEventListener($newEventListener);
$newEventListener = new EventListener("onmousemove",'DragAndDrop.setDrop(event,this,"report","","MISConfigurator","'.$PIList->item($i)->getAttribute("ID").'_'.$p_username.'");');
$newReportTreeNode->addEventListener($newEventListener);
$newEventListener = new EventListener("onmouseout","DragAndDrop.clearDrop();");
$newReportTreeNode->addEventListener($newEventListener);
$newContextMenu = new ContextMenu();
$newLabel = new Label(new Icon("img/edit.png"),$this->_getI18N("edit"));
$newContextMenuNode = new ContextMenuNode($newLabel);
$newEventListener = new EventListener("onclick",'CMgr.getMODEL().getRetrieveInput("MISConfigurator","editReport",Cookie.read("Tree_administrationMenu2_selected"));');
$newContextMenuNode->addEventListener($newEventListener);
$newContextMenu->appendChild($newContextMenuNode);
$newLabel = new Label(new Icon("img/delete.png"),$this->_getI18N("delete"));
$newContextMenuNode = new ContextMenuNode($newLabel);
$newEventListener = new EventListener("onclick",'CMgr.getMODEL().getRetrieveInput("MISConfigurator","deleteReport",Cookie.read("Tree_administrationMenu2_selected"));');
$newContextMenuNode->addEventListener($newEventListener);
$newContextMenu->appendChild($newContextMenuNode);
$newReportTreeNode->addContextMenu($newContextMenu);
}
return '';
}
public function configScorecardsForm($selectedSection) {
$MISConfig = new MISConfig();
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load($MISConfig->getConfigFile());
$projectXpath = new DOMXpath($projectDOM);
if($selectedSection!="") {
$_SESSION["configurator"]["publishes"]["section"] = $selectedSection;
}else if(isset($_SESSION["configurator"]) && isset($_SESSION["configurator"]["publishes"]) && isset($_SESSION["configurator"]["publishes"]["section"])){
$selectedSection = $_SESSION["configurator"]["publishes"]["section"];
}
$selectedSectionArr = explode("_",$selectedSection);
$sectionID = $selectedSectionArr[0];
$p_username = utf8_encode($selectedSectionArr[1]);
$PSList = $projectXpath->query('/Configuration/Scorecards/Scorecard/Reports/Report[./../../@ID="'.$sectionID.'" and ./../../@Directory="'.$p_username.'\\"]');
$Tree = new Tree("administrationMenu3");
for($i=0;$i<$PSList->length;$i++){
$newIcon = new Icon("img/scorecard.png");
$newIcon->addEventListener(new EventListener("onclick",'ContextMenu.leftClick();ContextMenu.show(this.parentNode.parentNode.parentNode.parentNode.parentNode,event);'));
$newLabel = new Label($newIcon,''.$PSList->item($i)->getElementsByTagName("Name")->item(0)->nodeValue.'');
$newReportTreeNode = new TreeNode($newLabel,$PSList->item($i)->getAttribute("ID")."_".$p_username);
$Tree->appendChild($newReportTreeNode);
$newEventListener = new EventListener("onclick",'');
$newLabel->addEventListener($newEventListener);
$newEventListener = new EventListener("ondblclick",'window.location.href = "?&rc=MISConfigurator&rm=getScorecard&ras[]='.$PSList->item($i)->getAttribute("ID").'";');
$newLabel->addEventListener($newEventListener);
$newEventListener = new EventListener("onmousedown",'DragAndDrop.startDrag(event,this,"scorecard","'.$PSList->item($i)->getAttribute("ID").'_'.$p_username.'");');
$newReportTreeNode->addEventListener($newEventListener);
$newEventListener = new EventListener("onmousemove",'DragAndDrop.setDrop(event,this,"scorecard","","MISConfigurator","'.$PSList->item($i)->getAttribute("ID").'_'.$p_username.'");');
$newReportTreeNode->addEventListener($newEventListener);
$newEventListener = new EventListener("onmouseout","DragAndDrop.clearDrop();");
$newReportTreeNode->addEventListener($newEventListener);
$newContextMenu = new ContextMenu();
$newLabel = new Label(new Icon("img/edit.png"),$this->_getI18N("edit"));
$newContextMenuNode = new ContextMenuNode($newLabel);
$newEventListener = new EventListener("onclick",'CMgr.getMODEL().getRetrieveInput("MISConfigurator","editScorecard",Cookie.read("Tree_administrationMenu3_selected"));');
$newContextMenuNode->addEventListener($newEventListener);
$newContextMenu->appendChild($newContextMenuNode);
$newLabel = new Label(new Icon("img/delete.png"),$this->_getI18N("delete"));
$newContextMenuNode = new ContextMenuNode($newLabel);
$newEventListener = new EventListener("onclick",'CMgr.getMODEL().getRetrieveInput("MISConfigurator","deleteScorecard",Cookie.read("Tree_administrationMenu3_selected"));');
$newContextMenuNode->addEventListener($newEventListener);
$newContextMenu->appendChild($newContextMenuNode);
$newReportTreeNode->addContextMenu($newContextMenu);
}
return '';
}
public function configDashboardsForm($selectedSection) {
$MISConfig = new MISConfig();
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load($MISConfig->getConfigFile());
$projectXpath = new DOMXpath($projectDOM);
if($selectedSection!="") {
$_SESSION["configurator"]["publishes"]["section"] = $selectedSection;
}else if(isset($_SESSION["configurator"]) && isset($_SESSION["configurator"]["publishes"]) && isset($_SESSION["configurator"]["publishes"]["section"])){
$selectedSection = $_SESSION["configurator"]["publishes"]["section"];
}
$selectedSectionArr = explode("_",$selectedSection);
$sectionID = $selectedSectionArr[0];
$p_username = utf8_encode($selectedSectionArr[1]);
$PSList = $projectXpath->query('/Configuration/Dashboards/Dashboard/Reviews/Review[./../../@ID="'.$sectionID.'" and ./../../@Directory="'.$p_username.'\\"]');
$Tree = new Tree("administrationMenu4");
for($i=0;$i<$PSList->length;$i++){
$newIcon = new Icon("img/dashboard.png");
$newIcon->addEventListener(new EventListener("onclick",'ContextMenu.leftClick();ContextMenu.show(this.parentNode.parentNode.parentNode.parentNode.parentNode,event);'));
$newLabel = new Label($newIcon,''.$PSList->item($i)->getElementsByTagName("Name")->item(0)->nodeValue.'');
$newReportTreeNode = new TreeNode($newLabel,$PSList->item($i)->getAttribute("ID")."_".$p_username);
$Tree->appendChild($newReportTreeNode);
$newEventListener = new EventListener("onclick",'');
$newLabel->addEventListener($newEventListener);
$newEventListener = new EventListener("ondblclick",'window.location.href = "?&rc=MISConfigurator&rm=getDashboard&ras[]='.$PSList->item($i)->getAttribute("ID").'";');
$newLabel->addEventListener($newEventListener);
$newEventListener = new EventListener("onmousedown",'DragAndDrop.startDrag(event,this,"dashboard","'.$PSList->item($i)->getAttribute("ID").'_'.$p_username.'");');
$newReportTreeNode->addEventListener($newEventListener);
$newEventListener = new EventListener("onmousemove",'DragAndDrop.setDrop(event,this,"dashboard","","MISConfigurator","'.$PSList->item($i)->getAttribute("ID").'_'.$p_username.'");');
$newReportTreeNode->addEventListener($newEventListener);
$newEventListener = new EventListener("onmouseout","DragAndDrop.clearDrop();");
$newReportTreeNode->addEventListener($newEventListener);
$newContextMenu = new ContextMenu();
$newLabel = new Label(new Icon("img/edit.png"),$this->_getI18N("edit"));
$newContextMenuNode = new ContextMenuNode($newLabel);
$newEventListener = new EventListener("onclick",'CMgr.getMODEL().getRetrieveInput("MISConfigurator","editDashboard",Cookie.read("Tree_administrationMenu4_selected"));');
$newContextMenuNode->addEventListener($newEventListener);
$newContextMenu->appendChild($newContextMenuNode);
$newLabel = new Label(new Icon("img/delete.png"),$this->_getI18N("delete"));
$newContextMenuNode = new ContextMenuNode($newLabel);
$newEventListener = new EventListener("onclick",'CMgr.getMODEL().getRetrieveInput("MISConfigurator","deleteDashboard",Cookie.read("Tree_administrationMenu4_selected"));');
$newContextMenuNode->addEventListener($newEventListener);
$newContextMenu->appendChild($newContextMenuNode);
$newReportTreeNode->addContextMenu($newContextMenu);
}
return '
';
}
private function emailSetup($selectedSection="") {
if($selectedSection!="") {
$_SESSION["configurator"]["emailSetup"]["section"] = $selectedSection;
}else if(isset($_SESSION["configurator"]) && isset($_SESSION["configurator"]["emailSetup"]) && isset($_SESSION["configurator"]["emailSetup"]["section"])){
$selectedSection = $_SESSION["configurator"]["emailSetup"]["section"];
}
$ret = '';
$eval ="";
$ret .= '';
return array($ret,'Tree.setToUserView(Browser.getElementById("administrationMenu8"));'.$eval);
}
public function configEmailUsersForm($selectedSection) {
$MISConfig = new MISConfig();
$ProjectDOM = new DOMDocument('1.0', 'iso-8859-1');
$ProjectDOM->load($MISConfig->getConfigFile());
$ProjectXpath = new DOMXpath($ProjectDOM);
$ret='';
return $ret;
}
public function configEmailReportsForm($selectedSection) {
$MISConfig = new MISConfig();
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load($MISConfig->getConfigFile());
$projectXpath = new DOMXpath($projectDOM);
$ImageList = $projectXpath->query("/Configuration/Publishes/Publish/Images/Image[./Active='J' and ./SendEmail='J' and ./Email!='']");
$Tree = new Tree("administrationMenu9");
$emailArr = array();
for($i=0;$i < $ImageList->length;$i++) {
$Image = $ImageList->item($i);
$ImageEmailArr = explode(";",$Image->getElementsByTagName("Email")->item(0)->nodeValue);
foreach($ImageEmailArr as $email) {
if(!array_key_exists(trim($email), $emailArr)) {
$emailArr[trim($email)] = array();
}
$emailArr[trim($email)][trim($Image->getElementsByTagName("Name")->item(0)->nodeValue)] = $Image->getAttribute("ID");
}
}
if($projectXpath->query("/Configuration/Emails/Email[.='".$selectedSection."']")->length == 0)return;
$ret='';
return $ret;
}
private function createEmailUser(){
$MISConfig = new MISConfig();
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load($MISConfig->getConfigFile());
$projectXpath = new DOMXpath($projectDOM);
$ret = '';
return array($ret,'');
}
private function saveCreateEmailUser($p_email) {
if($this->isRole("master")) {
$MISConfig = new MISConfig();
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load($MISConfig->getConfigFile());
$ProjectXpath = new DOMXpath($projectDOM);
$emailExists = $ProjectXpath->query("/Configuration/Emails/Email[. = '".$p_email."']")->length > 0 ? true : false;
if($emailExists) return array('alert("'.$this->_getI18N("emailAlreadyExists").'")');
$Emails = $ProjectXpath->query("/Configuration/Emails")->item(0);
$EmailList = $ProjectXpath->query("/Configuration/Emails/Email");
$MISConfig->setNodeValue("Email", trim($p_email), $projectDOM, $Emails, $EmailList->length);
$projectDOM->save($MISConfig->getConfigFile());
}
return array('CMgr.getMODEL().__construct();');
}
private function editEmailUser($ID){
$MISConfig = new MISConfig();
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load($MISConfig->getConfigFile());
$projectXpath = new DOMXpath($projectDOM);
$ret = '';
return array($ret,'');
}
private function saveEditEmailUser($ID,$p_email) {
if($this->isRole("master")) {
$MISConfig = new MISConfig();
$ProjectDOM = new DOMDocument('1.0', 'iso-8859-1');
$ProjectDOM->load($MISConfig->getConfigFile());
$ProjectXpath = new DOMXpath($ProjectDOM);
$emailExists = $ProjectXpath->query("/Configuration/Emails/Email[. = '".$p_email."']")->length > 0 ? true : false;
if($emailExists) return array('alert("'.$this->_getI18N("emailAlreadyExists").'")');
$Email = $ProjectXpath->query("/Configuration/Emails/Email[. = '".$ID."']")->item(0)->nodeValue =trim($p_email);
$ImageList = $ProjectXpath->query("/Configuration/Publishes/Publish/Images/Image[./Active='J' and ./SendEmail='J' and ./Email!='']");
$emailArr = array();
for($i=0;$i < $ImageList->length;$i++) {
$Image = $ImageList->item($i);
$ImageEmailArr = explode(";",$Image->getElementsByTagName("Email")->item(0)->nodeValue);
for($j=0;$jgetElementsByTagName("Email")->item(0)->nodeValue = implode(";", $ImageEmailArr);
}
$ProjectDOM->save($MISConfig->getConfigFile());
}
return array('CMgr.getMODEL().__construct();');
}
private function deleteEmailUser($ID){
$MISConfig = new MISConfig();
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load($MISConfig->getConfigFile());
$projectXpath = new DOMXpath($projectDOM);
$ret = '';
return array($ret,'');
}
private function saveDeleteEmailUser($ID) {
if($this->isRole("master")) {
$MISConfig = new MISConfig();
$ProjectDOM = new DOMDocument('1.0', 'iso-8859-1');
$ProjectDOM->load($MISConfig->getConfigFile());
$ProjectXpath = new DOMXpath($ProjectDOM);
$Emails = $ProjectXpath->query("/Configuration/Emails")->item(0);
$Email = $ProjectXpath->query("/Configuration/Emails/Email[. = '".$ID."']")->item(0);
$ImageList = $ProjectXpath->query("/Configuration/Publishes/Publish/Images/Image[./Active='J' and ./Email!='']");
for($i=0;$i < $ImageList->length;$i++) {
$Image = $ImageList->item($i);
$ImageEmailArr = explode(";",$Image->getElementsByTagName("Email")->item(0)->nodeValue);
$NewImageEmailArr = array();
for($j=0;$jgetElementsByTagName("Email")->item(0)->nodeValue = implode(";", $NewImageEmailArr);
if(count($NewImageEmailArr)==0)$Image->getElementsByTagName("SendEmail")->item(0)->nodeValue = "N";
}
$Emails->removeChild($Email);
$ProjectDOM->save($MISConfig->getConfigFile());
}
return array('CMgr.getMODEL().__construct();');
}
private function createEmailReport($ID){
$eval = "";
if(isset($_SESSION["configurator"]) && isset($_SESSION["configurator"]["createEmailReport"]) && isset($_SESSION["configurator"]["createEmailReport"]["section"])){
$selectedSection = $_SESSION["configurator"]["createEmailReport"]["section"];
}else{
$selectedSection = "";
}
$MISConfig = new MISConfig();
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load($MISConfig->getConfigFile());
$projectXpath = new DOMXpath($projectDOM);
$ret = '';
return array($ret,$eval.'Tree.setToUserView(Browser.getElementById("administrationMenu10"));');
}
private function saveCreateEmailReport($p_email) {
if($this->isRole("master")) {
$MISConfig = new MISConfig();
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load($MISConfig->getConfigFile());
$ProjectXpath = new DOMXpath($projectDOM);
$Emails = $ProjectXpath->query("/Configuration/Emails")->item(0);
$EmailList = $ProjectXpath->query("/Configuration/Emails/Email");
$MISConfig->setNodeValue("Email", trim($p_email), $projectDOM, $Emails, $EmailList->length);
$projectDOM->save($MISConfig->getConfigFile());
}
return array('CMgr.getMODEL().__construct();');
}
public function createEmailReportUsersForm() {
$Tree = new Tree("administrationMenu10");
$ret='';
return $ret;
}
private function emailUsersSectionMenu($p_node,$p_parentID="",$p_username,$projectDOM = null, $projectXpath = null) {
$MISConfig = new MISConfig();
if($projectDOM == null) {
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load($MISConfig->getConfigFile());
}
if($projectXpath == null) {
$projectXpath = new DOMXpath($projectDOM);
}
$childsHaveValue = $sectionHasValue = false;
$PPList = $projectXpath->query('/Configuration/Publishes/Publish[./@parentID = "'.$p_parentID.'" and ./@User = "'.$p_username.'"]');
for($k=0;$k < $PPList->length;$k++) {
$PP = $PPList->item($k);
if($PP->nodeType != XML_ELEMENT_NODE) continue;
$sectionID = $PP->getAttribute("ID");
$sectionName = $PP->getAttribute("Name");
$sectionHasValue = false;//($projectXpath->query('/Configuration/Publishes/Publish/Images/Image[./../../@ID="'.$sectionID.'" and ./../../@User = "'.$p_username.'"]')->length > 0) ? true : false;
//if(!$sectionHasValue)$sectionHasValue = ($projectXpath->query('/Configuration/Scorecards/Scorecard/Reports/Report[./../../@ID="'.$sectionID.'" and ./../../@Directory = "'.$p_username.'\\"]')->length > 0) ? true : false;
//if(!$sectionHasValue)$sectionHasValue = ($projectXpath->query('/Configuration/Dashboards/Dashboard/Reviews/Review[./../../@ID="'.$sectionID.'" and ./../../@Directory = "'.$p_username.'\\"]')->length > 0) ? true : false;
$subPublishNodeList = $projectXpath->query('/Configuration/Publishes/Publish[./@parentID = "'.$sectionID.'"]');
$PIList = $projectXpath->query('/Configuration/Publishes/Publish/Images/Image[./../../@ID="'.$sectionID.'" and ./Directory="'.utf8_encode($p_username).'\\" and ./Active="J"]');
$newIcon = new Icon("img/package.png");
//$newIcon->addEventListener(new EventListener("onclick",'ContextMenu.leftClick();ContextMenu.show(this.parentNode.parentNode.parentNode.parentNode.parentNode,event);'));
if($sectionHasValue) $newLabel = new Label($newIcon,"".str_replace("_", " ",$sectionName)."");
else $newLabel = new Label($newIcon,str_replace("_", " ", $sectionName));
$newTreeNode = new TreeNode($newLabel,$sectionID."_".$p_username);
$newEventListener = new EventListener("onmousedown",'MISConfigurator.selectEmailSection(event,this.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode);');
$newLabel->addEventListener($newEventListener);
if($subPublishNodeList->length > 0) {
$childsHaveValue = $this->emailUsersSectionMenu($newTreeNode,$sectionID,$p_username,$projectDOM,$projectXpath);
}
$p_node->appendChild($newTreeNode);
}
if($childsHaveValue || $sectionHasValue) {
return true;
} else {
return false;
}
}
public function createEmailReportsForm($selectedSection) {
$MISConfig = new MISConfig();
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load($MISConfig->getConfigFile());
$projectXpath = new DOMXpath($projectDOM);
if($selectedSection!="") {
$_SESSION["configurator"]["createEmailReport"]["section"] = $selectedSection;
}else if(isset($_SESSION["configurator"]) && isset($_SESSION["configurator"]["createEmailReport"]) && isset($_SESSION["configurator"]["createEmailReport"]["section"])){
$selectedSection = $_SESSION["configurator"]["createEmailReport"]["section"];
}
$selectedSectionArr = explode("_",$selectedSection);
$sectionID = $selectedSectionArr[0];
$p_username = utf8_encode($selectedSectionArr[1]);
$PIList = $projectXpath->query('/Configuration/Publishes/Publish/Images/Image[./../../@ID="'.$sectionID.'" and ./Directory="'.$p_username.'\\" and ./Active="J"]');
$Tree = new Tree("administrationMenu11");
for($i=0;$i<$PIList->length;$i++){
if($PIList->item($i)->getElementsByTagname("Ansicht")->item(0)->nodeValue == "Client")
$newIcon = new Icon("img/report.png");
else
$newIcon = new Icon("img/pdficon_small.gif");
$newIcon->addEventListener(new EventListener("onclick",'ContextMenu.leftClick();ContextMenu.show(this.parentNode.parentNode.parentNode.parentNode.parentNode,event);'));
$newLabel = new Label($newIcon,''.$PIList->item($i)->getElementsByTagName("Name")->item(0)->nodeValue.'');
$newReportTreeNode = new TreeNode($newLabel,$PIList->item($i)->getAttribute("ID")."_".$p_username);
$Tree->appendChild($newReportTreeNode);
$newEventListener = new EventListener("onclick",'');
//$newLabel->addEventListener($newEventListener);
$newEventListener = new EventListener("ondblclick",'window.location.href = "?&rc=MISConfigurator&rm=getReport&ras[]='.$PIList->item($i)->getAttribute("ID").'";');
$newLabel->addEventListener($newEventListener);
$newEventListener = new EventListener("onmousedown",'DragAndDrop.startDrag(event,this,"report","'.$PIList->item($i)->getAttribute("ID").'_'.$p_username.'");');
$newReportTreeNode->addEventListener($newEventListener);
$newEventListener = new EventListener("onmousemove",'DragAndDrop.setDrop(event,this,"report","","MISConfigurator","'.$PIList->item($i)->getAttribute("ID").'_'.$p_username.'");');
$newReportTreeNode->addEventListener($newEventListener);
$newEventListener = new EventListener("onmouseout","DragAndDrop.clearDrop();");
$newReportTreeNode->addEventListener($newEventListener);
$newContextMenu = new ContextMenu();
$newLabel = new Label(new Icon("img/edit.png"),$this->_getI18N("edit"));
$newContextMenuNode = new ContextMenuNode($newLabel);
$newEventListener = new EventListener("onclick",'CMgr.getMODEL().getRetrieveInput("MISConfigurator","editReport",Cookie.read("Tree_administrationMenu11_selected"));');
$newContextMenuNode->addEventListener($newEventListener);
$newContextMenu->appendChild($newContextMenuNode);
$newLabel = new Label(new Icon("img/delete.png"),$this->_getI18N("delete"));
$newContextMenuNode = new ContextMenuNode($newLabel);
$newEventListener = new EventListener("onclick",'CMgr.getMODEL().getRetrieveInput("MISConfigurator","deleteReport",Cookie.read("Tree_administrationMenu11_selected"));');
$newContextMenuNode->addEventListener($newEventListener);
$newContextMenu->appendChild($newContextMenuNode);
$newReportTreeNode->addContextMenu($newContextMenu);
}
return '';
}
private function saveCreateEmailReportForm($ID,$IDs) {
return array('CMgr.getMODEL().getRetrieveInput("MISConfigurator","createEmailReportForm2","'.$ID.'","'.$IDs.'");');
}
private function createEmailReportForm2($p_email,$p_ID) {
$MISConfig = new MISConfig();
$IDArr = explode("|",$p_ID);
$ID = explode("_",$IDArr[0]);
$ID = $ID[0];
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load($MISConfig->getConfigFile());
$projectXpath = new DOMXpath($projectDOM);
//$PIs = $projectXpath->query('/Configuration/Publishes/Publish/Images/Image[./@ID="'.$ID.'"]');
$PI = $projectXpath->query('/Configuration/Publishes/Publish/Images/Image[./@ID="'.$ID.'" and ./Active="J"]')->item(0);
if($PI->getElementsByTagName("Email")->item(0)->nodeValue != "" && $PI->getElementsByTagName("SendEmail")->item(0)->nodeValue == "J"){
$emailArr = explode(";",$PI->getElementsByTagName("Email")->item(0)->nodeValue);
}else{
$emailArr = array();
}
$ret = '';
return array($ret,'');
}
private function saveCreateEmailReportForm2($p_ID,$p_emailID,$p_gifGenerate,$p_jpgGenerate,$p_imageType1,$p_imageLayer1,$p_pdfGenerate1,$p_pdfType1,$p_pdfLayer1,$p_xlsGenerate1,$p_sendEmail,$p_email) {
$MISConfig = new MISConfig();
$IDArr = explode("|",$p_ID);
$ID = explode("_",array_shift($IDArr));
$ID = $ID[0];
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load($MISConfig->getConfigFile());
$projectXpath = new DOMXpath($projectDOM);
$PIList = $projectXpath->query('/Configuration/Publishes/Publish/Images/Image[./@ID="'.$ID.'"]');
$PI = $projectXpath->query('/Configuration/Publishes/Publish/Images/Image[./@ID="'.$ID.'" and ./Active="J"]')->item(0);
$p_gifGenerate = ($p_gifGenerate == "true") ? "J" : "N";
$p_jpgGenerate = ($p_jpgGenerate == "true") ? "J" : "N";
$MISConfig->setNodeValue("GIFGenerate",$p_gifGenerate,$projectDOM,$PI);
$MISConfig->setNodeValue("JPGGenerate",$p_jpgGenerate,$projectDOM,$PI);
$MISConfig->setNodeValue("PDFGenerate",$p_pdfGenerate1,$projectDOM,$PI);
$MISConfig->setNodeValue("XLSGenerate",$p_xlsGenerate1,$projectDOM,$PI);
$MISConfig->setNodeValue("SendEmail",$p_sendEmail,$projectDOM,$PI);
$MISConfig->setNodeValue("ImageType",$p_imageType1,$projectDOM,$PI);
$MISConfig->setNodeValue("ImageLayer",$p_imageLayer1,$projectDOM,$PI);
$MISConfig->setNodeValue("PDFImageType",$p_pdfType1,$projectDOM,$PI);
$MISConfig->setNodeValue("PDFImageLayer",$p_pdfLayer1,$projectDOM,$PI);
$MISConfig->setNodeValue("Email",$p_email,$projectDOM,$PI);
$projectDOM->save($MISConfig->getConfigFile());
$this->_registerEmails($p_email);
if(count($IDArr)>0){
$eval = 'CMgr.getMODEL().getRetrieveInput("MISConfigurator","createEmailReportForm2","'.$p_emailID.'","'.implode("|",$IDArr).'");';
}else{
$eval = 'CMgr.getMODEL().__construct();';
}
return array($eval);
}
private function deleteEmailReport($p_ID) {
$MISConfig = new MISConfig();
$IDArr = explode("|",$p_ID);
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load($MISConfig->getConfigFile());
$projectXpath = new DOMXpath($projectDOM);
$emailNames = array();
foreach($IDArr as $ID) {
$emailNames[] = $projectXpath->query('/Configuration/Publishes/Publish/Images/Image/Name[./../@ID="'.$ID.'"]')->item(0)->nodeValue;
}
$ret = '';
return array($ret,'');
}
private function saveDeleteEmailReport($p_ID) {
$MISConfig = new MISConfig();
$IDArr = explode("|",$p_ID);
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load($MISConfig->getConfigFile());
$projectXpath = new DOMXpath($projectDOM);
foreach($IDArr as $ID) {
$Image = $projectXpath->query('/Configuration/Publishes/Publish/Images/Image[./@ID="'.$ID.'" and ./Active="J"]')->item(0);
$newEmailArr = array();
$emailArr = explode(";",$Image->getElementsByTagName("Email")->item(0)->nodeValue);
foreach($emailArr as $email) {
if(trim($email) == $_SESSION["configurator"]["emailSetup"]["section"]) continue;
$newEmailArr[] = trim($email);
}
$Image->getElementsByTagName("Email")->item(0)->nodeValue = implode(";",$newEmailArr);
}
$projectDOM->save($MISConfig->getConfigFile());
return array('CMgr.getMODEL().abortRetrieveInput();CMgr.getMODEL().getMain("MISConfigurator","emailSetup","'.utf8_encode($_SESSION["configurator"]["emailSetup"]["section"]).'");');
}
private function emailExport() {
$ret = "";
if($this->isRole("admin")){
$ret = '';
}
return array($ret,'');
}
private function saveEmailExport() {
$MISConfig = new MISConfig();
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load($MISConfig->getConfigFile());
$projectXpath = new DOMXpath($projectDOM);
$configName = $projectXpath->query("/Configuration")->item(0)->getAttribute("Name");
if($this->getAuth()) {
if($this->isRole("admin")) {
$filepath = $MISConfig->getTempFilesPath().'email.csv';
$list[] = array($configName,basename($MISConfig->getConfigFile()),gmdate("d.m.Y H:i:s") );
$list[] = array();
$list[] = array();
$list[] = array("E-Mail", "Bericht", "Benutzer", "PDF Layer");
$list[] = array();
$ImageList = $projectXpath->query("/Configuration/Publishes/Publish/Images/Image[./Active='J' and ./SendEmail='J' and ./Email!='']");
$emailArr = array();
for($i=0;$i < $ImageList->length;$i++) {
$Image = $ImageList->item($i);
$ImageEmailArr = explode(";",$Image->getElementsByTagName("Email")->item(0)->nodeValue);
foreach($ImageEmailArr as $email) {
if(!array_key_exists(trim($email), $emailArr)) {
$emailArr[trim($email)] = array();
}
$emailArr[trim($email)][trim($Image->getElementsByTagName("Name")->item(0)->nodeValue)] = array($Image->getElementsByTagName("Directory")->item(0)->nodeValue,$Image->getElementsByTagName("PDFImageLayer")->item(0)->nodeValue);
}
}
$currentEmail="";
foreach($emailArr as $email => $Images){
foreach($Images as $imageName => $ID){
if($currentEmail != $email){
$list[] = array($email,$imageName,$ID[0],$ID[1]);
}else{
$list[] = array("",$imageName,$ID[0],$ID[1]);
}
$currentEmail = $email;
}
}
$fp = fopen($filepath, 'w');
foreach ($list as $fields) {
fputcsv($fp, $fields,";");
}
fclose($fp);
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private",false);
header("Content-Type: application/csv");
header("Content-Disposition: attachment; filename=\"".basename($filepath)."\";");
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".@filesize($filepath));
readfile($filepath);
}
}
}
private function languages() {
$Tree = new Tree("administrationMenu7");
$ret = '
';
return array($ret,'Tree.setToUserView(Browser.getElementById("administrationMenu"));');
}
public function getRetrieveInput() {
$ret = "";
if($this->getAuth()) {
if($this->isRole("admin")) {
global $Core;
$p_args = func_get_args();
$p_section = array_shift($p_args);
$eval = "";
$arr = call_user_func_array(array($this, $p_section), $p_args);
$ret.= $arr[0];$eval.=$arr[1];
return array($ret,$eval);
} else {
return array('','CMgr.getMODEL().__construct();');
}
} else {
return array('','CMgr.getMODEL().__construct();');
}
}
public function exportConfig($p_configFile) {
$MISConfig = new MISConfig();
if($this->getAuth()) {
if($this->isRole("master")) {
$filepath = $MISConfig->getConfigFilesPath().$p_configFile;
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private",false);
header("Content-Type: application/xml");
header("Content-Disposition: attachment; filename=\"".basename($filepath)."\";");
header("Content-Transfer-Encoding: binary");
/*header("Content-Length: ".@filesize($filepath));*/
//$fn = fopen($filepath,"r");
$content = file_get_contents($filepath);
print mb_convert_encoding($content, 'ISO-8859-1', mb_detect_encoding($content, 'UTF-8, ISO-8859-1', true));
}
}
}
public function saveRetrieveInput() {
if($this->getAuth()) {
if($this->isRole("admin")) {
global $Core;
$p_args = func_get_args();
$p_method = array_shift($p_args);
//ATTENTION CLIENT CAN CALL PRIVATE FUNCTIONS! MUST VERIFY THAT USER IS MASTER
$ret = call_user_func_array(array($this, $p_method), $p_args);
$MISConfig = new MISConfig();
$ProjectDOM = new DOMDocument('1.0', 'iso-8859-1');
$ProjectDOM->load($MISConfig->getConfigFile());
$ProjectXpath = new DOMXpath($ProjectDOM);
$creatorPath = $ProjectXpath->query('/Configuration/General/WebCreatorPath')->item(0)->nodeValue;
if(is_dir($creatorPath)) {
copy($MISConfig->getConfigFile(),$creatorPath.basename($MISConfig->getConfigFile()));
$ProjectDOM = new DOMDocument('1.0', 'iso-8859-1');
$ProjectDOM->load($creatorPath.basename($MISConfig->getConfigFile()));
$ProjectXpath = new DOMXpath($ProjectDOM);
$ProjectXpath->query("/Configuration")->item(0)->removeChild($ProjectXpath->query("/Configuration/Dashboards")->item(0));
$ProjectXpath->query("/Configuration")->item(0)->removeChild($ProjectXpath->query("/Configuration/Version")->item(0));
$ProjectXpath->query("/Configuration")->item(0)->removeChild($ProjectXpath->query("/Configuration/Emails")->item(0));
$ProjectDOM->save($creatorPath.basename($MISConfig->getConfigFile()));
}
return $ret;
}
}
return array('CMgr.getMODEL().__construct();');
}
private function loadCompanyImage() {
$MISConfig = new MISConfig();
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load($MISConfig->getConfigFile());
$projectXpath = new DOMXpath($projectDOM);
$ret = '';
$ret.= '';
return array($ret,'');
}
private function saveLoadCompanyImage() {
$MISConfig = new MISConfig();
$filename = basename( $_FILES['file']['name']);
move_uploaded_file($_FILES['file']['tmp_name'], ROOT_DIR."htdocs/img/MISView/company.png");
print '';
}
private function loadConfig() {
$ret ="";
if($this->isRole("master")) {
$MISConfig = new MISConfig();
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load($MISConfig->getConfigFile());
$projectXpath = new DOMXpath($projectDOM);
$ret = '';
$ret.= '';
}
return array($ret,'');
}
private function saveLoadConfig() {
if($this->isRole("master")){
$MISConfig = new MISConfig();
$target_path = $MISConfig->getConfigFilesPath();
$filename = basename( $_FILES['file']['name']);
$target_path .= $filename;
$infoMsg = "";
$ProjectDOM = new DOMDocument('1.0', 'iso-8859-1');
$ProjectDOM->load($_FILES['file']['tmp_name']);
$ProjectXpath = new DOMXpath($ProjectDOM);
if($ProjectXpath->query("/Configuration")->item(0)->getAttribute("Version") != "" && $ProjectXpath->query("/Configuration")->item(0)->getAttribute("Version") > self::$version){
$ret = '';
print '';
return;
}
if(file_exists($target_path)){
$filename = basename($filename,".xml").".".date("YmdHis").".xml";
$target_path = $MISConfig->getConfigFilesPath().$filename;
move_uploaded_file($_FILES['file']['tmp_name'], $target_path);
if(is_file($target_path)) {
$infoMsg = $this->_getI18N("configFileAlreadyExists");
}else{
$infoMsg = $this->_getI18N("fileNotFound");
}
}else{
move_uploaded_file($_FILES['file']['tmp_name'], $target_path);
}
$MISConfig->setConfigFile($filename);
$ProjectDOM = new DOMDocument('1.0', 'iso-8859-1');
$ProjectDOM->load($MISConfig->getConfigFile());
$ProjectXpath = new DOMXpath($ProjectDOM);
$Project = $ProjectXpath->query("/Configuration")->item(0);
/* UPDATE PROJECT FILE VERSION */
if($ProjectXpath->query("./General/WebCreatorPath",$Project)->length==0){
$ProjectXpath->query("./General",$Project)->item(0)->insertBefore($ProjectDOM->createElement("WebCreatorPath"),$ProjectXpath->query("./General",$Project)->item(0)->firstChild);
$MISConfig->setNodeValue("WebCreatorPath","",$ProjectDOM,$ProjectXpath->query("/Configuration/General")->item(0));
}
if($ProjectXpath->query("./General/DashboardPath",$Project)->length==0){
$ProjectXpath->query("./General",$Project)->item(0)->insertBefore($ProjectDOM->createElement("DashboardPath"),$ProjectXpath->query("./General",$Project)->item(0)->firstChild);
$MISConfig->setNodeValue("DashboardPath","",$ProjectDOM,$ProjectXpath->query("/Configuration/General")->item(0));
}
if($ProjectXpath->query("./General/Language",$Project)->length==0){
$ProjectXpath->query("./General",$Project)->item(0)->appendChild($ProjectDOM->createElement("Language"));
$MISConfig->setNodeValue("Language","de",$ProjectDOM,$ProjectXpath->query("/Configuration/General")->item(0));
}
if($ProjectXpath->query("./Dashboards",$Project)->length==0){
$Project->appendChild($ProjectDOM->createElement("Dashboards"));
}
if($ProjectXpath->query("./Emails",$Project)->length==0){
$Project->appendChild($ProjectDOM->createElement("Emails"));
}
if($ProjectXpath->query("./Version",$Project)->length==0){
$Version = $ProjectDOM->createElement("Version");
$Views = $ProjectDOM->createElement("Views");
$Views->setAttribute("fp_feld","");
$Views->setAttribute("fp_description","");
$Views->setAttribute("view_feld","");
$Views->setAttribute("view_description","");
$Version->appendChild($Views);
$Project->appendChild($Version);
$Version->setAttribute("show","false");
$Version->setAttribute("odbc","");
$Version->setAttribute("user","");
$Version->setAttribute("pw","");
}
$ProjectDOM->save($MISConfig->getConfigFile());
$users = array();
$SectionIDs = array();
$ImageIDs = array();
$ReportIDs = array();
/* GENERATE ID ARRAY FOR IMAGES AND REPORTS */
$iPublishes = $Project->removeChild($ProjectXpath->query("./Publishes",$Project)->item(0));
$iPublishesList = $ProjectXpath->query("./Publish",$iPublishes);
$iImageList = $ProjectXpath->query("./Publish/Images/Image",$iPublishes);
$Publishes = $iPublishes->cloneNode(false);
$Project->appendChild($Publishes);
$iScorecards = $Project->removeChild($ProjectXpath->query("./Scorecards",$Project)->item(0));
$iReportList = $ProjectXpath->query("./Scorecard/Reports/Report",$iScorecards);
$Scorecards = $iScorecards->cloneNode(false);
$Project->appendChild($Scorecards);
$iDashboards = $Project->removeChild($ProjectXpath->query("./Dashboards",$Project)->item(0));
$iDashboardList = $ProjectXpath->query("./Dashboard/Reviews/Review",$iDashboards);
$Dashboards = $iDashboards->cloneNode(false);
$Project->appendChild($Dashboards);
$iEmails = $Project->removeChild($ProjectXpath->query("./Emails",$Project)->item(0));
$iEmailList = $ProjectXpath->query("./Email",$iEmails);
$Emails = $iEmails->cloneNode(false);
$Project->appendChild($Emails);
foreach($iPublishesList as $iPublish) {
$SectionIDs[str_replace("|"," ",str_replace("_"," ",$iPublish->getAttribute("User")))][$iPublish->getAttribute("ID")] = $this->_createSection($ProjectDOM,$ProjectXpath,$iPublish->getAttribute("ID"), $iPublish->getAttribute("parentID"), utf8_decode(str_replace("|"," ",str_replace("_"," ",$iPublish->getAttribute("User")))), utf8_decode($iPublish->getAttribute("Name")),$iPublish->getAttribute("Alert"));
}
$emailArr = array();
foreach($iImageList as $iImage) {
$MISConfig->setNodeValue("Directory",utf8_decode(str_replace("|"," ",str_replace("_"," ",$iImage->getElementsByTagName("Directory")->item(0)->nodeValue))),$ProjectDOM,$iImage);
$Image = $iImage->cloneNode(true);
$ImageName = $iImage->getElementsByTagname("Name")->item(0)->nodeValue;
$ImageDirectory = $iImage->getElementsByTagName("Directory")->item(0)->nodeValue;
$ImageUser = substr($ImageDirectory,0,(strlen($ImageDirectory)-1));
$PublishID = $iImage->parentNode->parentNode->getAttribute("ID");
$PublishName = $iImage->parentNode->parentNode->getAttribute("Name");
$PublishParentID = $iImage->parentNode->parentNode->getAttribute("parentID");
$PublishAlert = $iImage->parentNode->parentNode->getAttribute("Alert");
if(!array_key_exists($ImageUser,$SectionIDs) || !array_key_exists($PublishID,$SectionIDs[$ImageUser])) {
$SectionIDs[$ImageUser][$PublishID] = $this->_createSection($ProjectDOM,$ProjectXpath,$PublishID,$PublishParentID,utf8_decode($ImageUser),utf8_decode($PublishName),$PublishAlert);
$Publish = $ProjectXpath->query("./Publish[./@ID='".$SectionIDs[$ImageUser][$PublishID]."']",$Publishes)->item(0);
}else{
$Publish = $ProjectXpath->query("./Publish[./@ID='".$SectionIDs[$ImageUser][$PublishID]."']",$Publishes)->item(0);
}
$Publish->getElementsByTagname("Images")->item(0)->appendChild($Image);
if($Image->getAttribute("ID") == "") {
if(array_key_exists($ImageName,$ImageIDs) && array_key_exists($ImageUser,$ImageIDs[$ImageName])){
$newID = $ImageIDs[$ImageName][$ImageUser];
}else{
$newID = $this->_generateReportID();
$ImageIDs[$ImageName][$ImageUser] = $newID;
}
$Image->setAttribute("ID",$newID);
}
if($Image->getElementsByTagName("ppx")->length != 1) {
$MISConfig->setNodeValue("ppx","N",$ProjectDOM,$Image);
}
$users[$ImageUser] = $Image->getElementsByTagName("Ansicht")->item(0)->nodeValue;
$ImageEmailArr = explode(";",$Image->getElementsByTagName("Email")->item(0)->nodeValue);
foreach($ImageEmailArr as $email) {
if($email != "") {
array_push($emailArr,trim($email));
}
}
if($Image->getElementsByTagName("SendEmail")->item(0)->nodeValue != "J") {
$MISConfig->setNodeValue("Email", "", $ProjectDOM, $Image);
}
}
for($i=0;$iEmailList->length>$i;$i++){
$ImageEmailArr = explode(";",$iEmailList->item($i)->nodeValue);
foreach($ImageEmailArr as $email) {
if($email != "") {
array_push($emailArr,trim($email));
}
}
}
$xPublishes = $ProjectXpath->query("./Publish",$Publishes);
foreach($xPublishes as $xPublish) {
$xPublish->setAttribute("parentID",$SectionIDs[str_replace("|"," ",str_replace("_"," ",$xPublish->getAttribute("User")))][$xPublish->getAttribute("parentID")]);
}
foreach($iReportList as $iReport) {
$iReport->parentNode->parentNode->setAttribute("Directory",str_replace("|"," ",str_replace("_"," ",$iReport->parentNode->parentNode->getAttribute("Directory"))));
$Report = $iReport->cloneNode(true);
$ReportDirectory = $iReport->parentNode->parentNode->getAttribute("Directory");
$ReportUser = substr($ReportDirectory,0,(strlen($ReportDirectory)-1));
$PublishID = $iReport->parentNode->parentNode->getAttribute("ID");
$PublishParentID = $iReport->parentNode->parentNode->getAttribute("parentID");
$PublishName = $iReport->parentNode->parentNode->getAttribute("Name");
if(!array_key_exists($ReportUser,$SectionIDs) || !array_key_exists($PublishID,$SectionIDs[$ReportUser])) {
$SectionIDs[$ReportUser][$PublishID] = $this->_createSection($ProjectDOM,$ProjectXpath,$PublishID,$PublishParentID,utf8_decode($ReportUser),utf8_decode($PublishName),false);
$Scorecard = $ProjectXpath->query("./Scorecard[./@ID='".$SectionIDs[$ReportUser][$PublishID]."']",$Scorecards)->item(0);
}else{
$Scorecard = $ProjectXpath->query("./Scorecard[./@ID='".$SectionIDs[$ReportUser][$PublishID]."']",$Scorecards)->item(0);
}
$Scorecard->getElementsByTagname("Reports")->item(0)->appendChild($Report);
$Report->getAttribute("ID") == "" ? $Report->setAttribute("ID",$this->_generateReportID()) : false;
if(!array_key_exists($ReportUser,$users)) $users[$ReportUser] = "Info-User";
}
foreach($iDashboardList as $iReport) {
$iReport->parentNode->parentNode->setAttribute("Directory",str_replace("|"," ",str_replace("_"," ",$iReport->parentNode->parentNode->getAttribute("Directory"))));
$Report = $iReport->cloneNode(true);
$ReportDirectory = $iReport->parentNode->parentNode->getAttribute("Directory");
$ReportUser = substr($ReportDirectory,0,(strlen($ReportDirectory)-1));
$PublishID = $iReport->parentNode->parentNode->getAttribute("ID");
$PublishParentID = $iReport->parentNode->parentNode->getAttribute("parentID");
$PublishName = $iReport->parentNode->parentNode->getAttribute("Name");
if(!array_key_exists($ReportUser,$SectionIDs) || !array_key_exists($PublishID,$SectionIDs[$ReportUser])) {
$SectionIDs[$ReportUser][$PublishID] = $this->_createSection($ProjectDOM,$ProjectXpath,$PublishID,$PublishParentID,utf8_decode($ReportUser),utf8_decode($PublishName),false);
$Dashboard = $ProjectXpath->query("./Dashboard[./@ID='".$SectionIDs[$ImageUser][$PublishID]."']",$Dashboards)->item(0);
}else{
$Dashboard = $ProjectXpath->query("./Dashboard[./@ID='".$SectionIDs[$ReportUser][$PublishID]."']",$Dashboards)->item(0);
}
$Dashboard->getElementsByTagname("Reviews")->item(0)->appendChild($Report);
$Report->getAttribute("ID") == "" ? $Report->setAttribute("ID",$this->_generateReportID()) : false;
if(!array_key_exists($ReportUser,$users)) $users[$ReportUser] = "Info-User";
}
$ProjectXpath->query("/Configuration")->item(0)->setAttribute("Version",self::$version);
$ProjectDOM->save($MISConfig->getConfigFile());
$this->_registerEmails(implode(";",$emailArr));
$allUsersArr = $MISConfig->getAllUsernames();
foreach($users as $username => $ansicht) {
if(!in_array($username,$allUsersArr)) {
$this->saveRetrieveInput("saveCreateUser",utf8_decode($username),"asdf","asdf","de",$ansicht);
}
}
$configName = $ProjectXpath->query("/Configuration")->item(0)->getAttribute("Name");
if($infoMsg != ""){
$ret = '';
print '';
}else{
print '';
}
}else{
print '';
}
}
private function editConfig($p_ID) {
$ret = "";
if($this->isRole("master")){
$MISConfig = new MISConfig();
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load($MISConfig->getConfigFilesPath().utf8_encode($p_ID));
$projectXpath = new DOMXpath($projectDOM);
$configName = $projectXpath->query("/Configuration")->item(0)->getAttribute("Name");
$configLang = $projectXpath->query("/Configuration/General/Language")->item(0)->nodeValue;
$ret = '';
}
return array($ret,'');
}
private function saveEditConfig($p_configFile,$p_name,$p_lang) {
if($this->isRole("master")){
$MISConfig = new MISConfig();
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load($MISConfig->getConfigFilesPath().utf8_encode($p_configFile));
$projectXpath = new DOMXpath($projectDOM);
$PP = $projectXpath->query('/Configuration')->item(0);
$PP->setAttribute("Name",utf8_encode($p_name));
$PX = $projectXpath->query('/Configuration/General')->item(0);
$MISConfig->setNodeValue("Language",$p_lang,$projectDOM,$PX);
$projectDOM->save($MISConfig->getConfigFilesPath().utf8_encode($p_configFile));
}
return array('CMgr.getMODEL().__construct();');
}
private function deleteConfig($p_configFile) {
$MISConfig = new MISConfig();
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load($MISConfig->getConfigFile());
$projectXpath = new DOMXpath($projectDOM);
$PPName = $p_configFile;
$ret = '';
return array($ret,'');
}
private function saveDeleteConfig($p_configFile,$p_deleteUserConfig) {
$MISConfig = new MISConfig();
$authDOM = new DOMDocument('1.0', 'iso-8859-1');
$authDOM->load($MISConfig->authFile);
$authXpath = new DOMXpath($authDOM);
if($p_deleteUserConfig == "true") {
$AUList = $authXpath->query("/auth/users/user[@setting='".utf8_encode(basename($p_configFile,".xml"))."']");
for($i=0;$i<$AUList->length;$i++) {
$AU = $AUList->item($i);
$AU->parentNode->removeChild($AU);
}
$authDOM->save($MISConfig->authFile);
}
unlink(ROOT_DIR."apps/MISConfig/data/".utf8_encode($p_configFile));
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load($MISConfig->getConfigFile());
$projectXpath = new DOMXpath($projectDOM);
$configName = $projectXpath->query("/Configuration")->item(0)->getAttribute("Name");
return array('CMgr.getMODEL().__construct();CMgr.getMODEL().setConfig("'.$configName.'");');
}
private function editSection($p_ID){
$MISConfig = new MISConfig();
$IDsArr = explode("|",$p_ID);
$IDArr = explode("_",$IDsArr[0]);
$ret="";
$eval="";
if(count($IDArr)>1){
$ID = $IDArr[0];
$username = $IDArr[1];
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load($MISConfig->getConfigFile());
$projectXpath = new DOMXpath($projectDOM);
$PPName = $projectXpath->query('/Configuration/Publishes/Publish/@Name[./../@ID="'.$ID.'"]')->item(0)->nodeValue;
$PPHauptampel = $projectXpath->query('/Configuration/Publishes/Publish/@Alert[./../@ID="'.$ID.'"]')->item(0)->nodeValue;
$ret.= '';
}else{
$eval = 'CMgr.getMODEL().getRetrieveInput("MISConfigurator","editUser","'.$p_ID.'");';
}
return array($ret,$eval);
}
private function saveEditSection($p_ID,$p_name,$p_showHauptampel){
$MISConfig = new MISConfig();
$IDsArr = explode("|",$p_ID);
$IDArr = explode("_",array_shift($IDsArr));
$ID = $IDArr[0];
$username = $IDArr[1];
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load($MISConfig->getConfigFile());
$projectXpath = new DOMXpath($projectDOM);
$dataDir = $projectXpath->query('/Configuration/General/PublishImagePath')->item(0)->nodeValue;
$PP = $projectXpath->query('/Configuration/Publishes/Publish[./@ID = "'.$ID.'" and ./@User = "'.utf8_encode($username).'"]')->item(0);
@rename(utf8_decode($dataDir.$PP->getAttribute("User")."\\"
.$PP->getAttribute("Name"))."\\",
utf8_decode($dataDir.$PP->getAttribute("User"))."\\".
"_".str_replace(" ","_",$p_name)."_\\");
$PP->setAttribute("Name",utf8_encode("_".str_replace(" ","_",trim($p_name,"_ "))."_"));
$PP->setAttribute("Alert",utf8_encode($p_showHauptampel));
$PSList = $projectXpath->query('/Configuration/Scorecards/Scorecard[./@ID = "'.$ID.'" and ./@Directory = "'.utf8_encode($username).'\\"]');
for($i=0;$i<$PSList->length;$i++) {
$PS = $PSList->item($i);
$PS->setAttribute("Name",utf8_encode("_".str_replace(" ","_",trim($p_name,"_ "))."_"));
}
$PSList = $projectXpath->query('/Configuration/Dashboards/Dashboard[./@ID = "'.$ID.'" and ./@Directory = "'.utf8_encode($username).'\\"]');
for($i=0;$i<$PSList->length;$i++) {
$PS = $PSList->item($i);
$PS->setAttribute("Name",utf8_encode("_".str_replace(" ","_",trim($p_name,"_ "))."_"));
}
$projectDOM->save($MISConfig->getConfigFile());
if(count($IDsArr)>0){
$eval = 'CMgr.getMODEL().getRetrieveInput("MISConfigurator","editSection","'.implode("|",$IDsArr).'");';
}else{
$eval = 'CMgr.getMODEL().__construct();';
}
return array($eval);
}
private function deleteSection($p_ID){
$MISConfig = new MISConfig();
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load($MISConfig->getConfigFile());
$projectXpath = new DOMXpath($projectDOM);
$PPNames = Array();
$IDsArr = explode("|",$p_ID);
$deleteUsers = false;
$newIDsArr = array();
foreach($IDsArr as $IDStr){
$IDArr = explode("_",$IDStr);
if(count($IDArr)>1) {
$ID = $IDArr[0];
$username = $IDArr[1];
array_push($PPNames, str_replace("_"," ",trim($projectXpath->query('/Configuration/Publishes/Publish/@Name[./../@ID="'.$ID.'"]')->item(0)->nodeValue))." (".utf8_encode($username).")");
}else{
$deleteUsers = true;
array_push($newIDsArr,$IDArr[0]);
}
}
$ret = '';
return array($ret,'');
}
private function saveDeleteSection($p_ID){
$MISConfig = new MISConfig();
$IDsArr = explode("|",$p_ID);
$newIDsArr = Array();
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load($MISConfig->getConfigFile());
$projectXpath = new DOMXpath($projectDOM);
foreach($IDsArr as $IDStr) {
$IDArr = explode("_",$IDStr);
if(count($IDArr)>1){
$ID = $IDArr[0];
$username = $IDArr[1];
$PPList = $projectXpath->query('/Configuration/Publishes/Publish[./@parentID="'.$ID.'" and ./@User = "'.utf8_encode($username).'"]');
for($i=0;$i<$PPList->length;$i++) {
$PP = $PPList->item($i);
$currentID = $PP->getAttribute('ID');
$this->saveDeleteSection($currentID."_".$username);
}
$this->saveDeleteSubSection($ID,$username);
}else{
array_push($newIDsArr,$IDStr);
}
}
if(count($newIDsArr)>0){
$eval='CMgr.getMODEL().__construct();CMgr.getMODEL().getRetrieveInput("MISConfigurator","deleteUser","'.implode("|",$newIDsArr).'");';
}else{
$eval='CMgr.getMODEL().__construct();';
}
return array($eval);
}
private function saveDeleteSubSection($p_ID,$p_username) {
$MISConfig = new MISConfig();
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load($MISConfig->getConfigFile());
$projectXpath = new DOMXpath($projectDOM);
$PP = $projectXpath->query('/Configuration/Publishes/Publish[./@ID="'.$p_ID.'" and ./@User = "'.utf8_encode($p_username).'"]');
if($PP->length>0) {
$dataDir = $projectXpath->query('/Configuration/General/PublishImagePath')->item(0)->nodeValue;
$PP = $PP->item(0);
$this->deleteDir(utf8_decode($dataDir.$PP->getAttribute("User")."\\"
.$PP->getAttribute("Name"))."\\");
$PP->parentNode->removeChild($PP);
$PS = $projectXpath->query('/Configuration/Scorecards/Scorecard[./@ID="'.$p_ID.'" and ./@Directory = "'.utf8_encode($p_username).'\\"]');
for($i=0;$i<$PS->length;$i++){
$PS->item($i)->parentNode->removeChild($PS->item($i));
}
$PS = $projectXpath->query('/Configuration/Dashboards/Dashboard[./@ID="'.$p_ID.'" and ./@Directory = "'.utf8_encode($p_username).'\\"]');
for($i=0;$i<$PS->length;$i++){
$PS->item($i)->parentNode->removeChild($PS->item($i));
}
$projectDOM->save($MISConfig->getConfigFile());
}
}
private function createSection($p_parentID="",$p_username){
$MISConfig = new MISConfig();
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load($MISConfig->getConfigFile());
$projectXpath = new DOMXpath($projectDOM);
$ret = '';
return array($ret,'');
}
private function saveCreateSection($p_parentID,$p_username,$p_sectionName,$p_showHauptampel){
$MISConfig = new MISConfig();
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load($MISConfig->getConfigFile());
$ProjectXpath = new DOMXpath($projectDOM);
$this->_createSection($projectDOM,$ProjectXpath,"",$p_parentID,$p_username,$p_sectionName,$p_showHauptampel);
$projectDOM->save($MISConfig->getConfigFile());
return array('CMgr.getMODEL().__construct();');
}
private function emptySection($p_ID,$p_username){
$MISConfig = new MISConfig();
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load($MISConfig->getConfigFile());
$projectXpath = new DOMXpath($projectDOM);
$PPName = $projectXpath->query('/Configuration/Publishes/Publish/@Name[./../@ID="'.$p_ID.'"]')->item(0)->nodeValue;
$ret = '';
return array($ret,'');
}
private function saveEmptySection($p_ID,$p_username){
$MISConfig = new MISConfig();
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load($MISConfig->getConfigFile());
$projectXpath = new DOMXpath($projectDOM);
$PIList = $projectXpath->query('/Configuration/Publishes/Publish/Images/Image[./../../@ID="'.$p_ID.'" and ./Directory="'.$p_username.'\\"]');
for($i=0;$i<$PIList->length;$i++) {
$PI = $PIList->item($i);
$PI->parentNode->removeChild($PI);
}
$SRList = $projectXpath->query('/Configuration/Scorecards/Scorecard/Reports/Report[./../../@ID="'.$p_ID.'" and ./../../@Directory="'.$p_username.'\\"]');
for($i=0;$i<$SRList->length;$i++) {
$SR = $SRList->item($i);
$SR->parentNode->removeChild($SR);
}
$SRList = $projectXpath->query('/Configuration/Dashboards/Dashboard/Reviews/Review[./../../@ID="'.$p_ID.'" and ./../../@Directory="'.$p_username.'\\"]');
for($i=0;$i<$SRList->length;$i++) {
$SR = $SRList->item($i);
$SR->parentNode->removeChild($SR);
}
$projectDOM->save($MISConfig->getConfigFile());
return array('CMgr.getMODEL().__construct();');
}
private function createReport($p_sectionID,$p_username) {
$MISConfig = new MISConfig();
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load($MISConfig->getConfigFile());
$projectXpath = new DOMXpath($projectDOM);
$ret = '';
return array($ret,'');
}
private function saveCreateReport($p_sectionID,$p_username,$p_reportName,$p_reportDescription,$p_pprReport,$p_ppxFile,$p_gifGenerate,$p_jpgGenerate,$p_imageType1,$p_imageLayer1,$p_pdfGenerate1,$p_pdfType1,$p_pdfLayer1,$p_xlsGenerate1,$p_sendEmail,$p_email,$p_view,$p_previewReport,$p_imageGenerate,$p_imageType2,$p_imageLayer2,$p_pdfGenerate2,$p_pdfType2,$p_pdfLayer2,$p_xlsGenerate2) {
$MISConfig = new MISConfig();
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load($MISConfig->getConfigFile());
$projectXpath = new DOMXpath($projectDOM);
$newID = $this->_generateReportID();
$p_gifGenerate = ($p_gifGenerate == "true") ? "J" : "N";
$p_jpgGenerate = ($p_jpgGenerate == "true") ? "J" : "N";
$p_ppxFile = ($p_ppxFile == "true") ? "J" : "N";
$PI = $projectDOM->createElement("Image");
$PI->setAttribute("ID",$newID);
$temp = $projectDOM->createElement("Name");
$temp->appendChild($projectDOM->createTextNode(utf8_encode($p_reportName)));
$PI->appendChild($temp);
$temp = $projectDOM->createElement("Description");
$temp->appendChild($projectDOM->createTextNode(utf8_encode($p_reportDescription)));
$PI->appendChild($temp);
$PI->appendChild($projectDOM->createElement("Directory",utf8_encode($p_username)."\\"));
$PI->appendChild($projectDOM->createElement("Report",utf8_encode($p_pprReport)));
$PI->appendChild($projectDOM->createElement("GIFGenerate",$p_gifGenerate));
$PI->appendChild($projectDOM->createElement("JPGGenerate",$p_jpgGenerate));
$PI->appendChild($projectDOM->createElement("PDFGenerate",$p_pdfGenerate1));
$PI->appendChild($projectDOM->createElement("XLSGenerate",$p_xlsGenerate1));
$PI->appendChild($projectDOM->createElement("Active","J"));
$PI->appendChild($projectDOM->createElement("SendEmail",$p_sendEmail));
$PI->appendChild($projectDOM->createElement("ImageType",$p_imageType1));
$PI->appendChild($projectDOM->createElement("ImageLayer",$p_imageLayer1));
$PI->appendChild($projectDOM->createElement("PDFImageType",$p_pdfType1));
$PI->appendChild($projectDOM->createElement("PDFImageLayer",$p_pdfLayer1));
if($this->isRole("master")) {
$PI->appendChild($projectDOM->createElement("Ansicht",$p_view));
}else{
$PI->appendChild($projectDOM->createElement("Ansicht",$this->_getView($p_username)));
}
$PI->appendChild($projectDOM->createElement("Email",utf8_encode($p_email)));
$PI->appendChild($projectDOM->createElement("ppx",utf8_encode($p_ppxFile)));
$PIs = $projectXpath->query("/Configuration/Publishes/Publish/Images[./../@ID='".$p_sectionID."']")->item(0);
$PIs->appendChild($PI);
if($p_previewReport == "J") {
$PI = $projectDOM->createElement("Image");
$PI->setAttribute("ID",$newID);
$temp = $projectDOM->createElement("Name");
$temp->appendChild($projectDOM->createTextNode(utf8_encode($p_reportName)));
$PI->appendChild($temp);
$temp = $projectDOM->createElement("Description");
$temp->appendChild($projectDOM->createTextNode(utf8_encode($p_reportDescription)));
$PI->appendChild($temp);
$PI->appendChild($projectDOM->createElement("Directory",utf8_encode($p_username)."\\"));
$PI->appendChild($projectDOM->createElement("Report",utf8_encode($p_pprReport)."_Graf"));
if($p_imageGenerate == "GIF") {
$PI->appendChild($projectDOM->createElement("GIFGenerate","J"));
$PI->appendChild($projectDOM->createElement("JPGGenerate","N"));
}else{
$PI->appendChild($projectDOM->createElement("GIFGenerate","N"));
$PI->appendChild($projectDOM->createElement("JPGGenerate","J"));
}
$PI->appendChild($projectDOM->createElement("PDFGenerate",$p_pdfGenerate2));
$PI->appendChild($projectDOM->createElement("XLSGenerate",$p_xlsGenerate2));
$PI->appendChild($projectDOM->createElement("Active","N"));
$PI->appendChild($projectDOM->createElement("SendEmail","N"));
$PI->appendChild($projectDOM->createElement("ImageType",$p_imageType2));
$PI->appendChild($projectDOM->createElement("ImageLayer",$p_imageLayer2));
$PI->appendChild($projectDOM->createElement("PDFImageType",$p_pdfType2));
$PI->appendChild($projectDOM->createElement("PDFImageLayer",$p_pdfLayer2));
$PI->appendChild($projectDOM->createElement("Ansicht",$p_view));
$PI->appendChild($projectDOM->createElement("Email",$p_email));
$PI->appendChild($projectDOM->createElement("ppx",utf8_encode($p_ppxFile)));
$PIs = $projectXpath->query("/Configuration/Publishes/Publish/Images[./../@ID='".$p_sectionID."']")->item(0);
$PIs->appendChild($PI);
}
$projectDOM->save($MISConfig->getConfigFile());
$this->_registerEmails($p_email);
return array('CMgr.getMODEL().abortRetrieveInput();Ajax.request(MISConfigurator.__toString(),"configReportsForm","'.utf8_encode($_SESSION["configurator"]["publishes"]["section"]).'",MISConfigurator.configReportsFormCb);');
}
private function editReport($p_ID) {
$MISConfig = new MISConfig();
$IDArr = explode("|",$p_ID);
$ID = explode("_",$IDArr[0]);
$ID = $ID[0];
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load($MISConfig->getConfigFile());
$projectXpath = new DOMXpath($projectDOM);
$PIs = $projectXpath->query('/Configuration/Publishes/Publish/Images/Image[./@ID="'.$ID.'"]');
$PI = $projectXpath->query('/Configuration/Publishes/Publish/Images/Image[./@ID="'.$ID.'" and ./Active="J"]')->item(0);
if($PIs->length == 2) {
$previewImage = true;
$PIpreview = $projectXpath->query('/Configuration/Publishes/Publish/Images/Image[./@ID="'.$ID.'" and ./Active="N"]')->item(0);
}else{
$previewImage = false;
$PIpreview = null;
}
$ret = '';
return array($ret,'');
}
private function saveEditReport($p_ID,$p_reportName,$p_reportDescription,$p_pprReport,$p_ppxFile,$p_gifGenerate,$p_jpgGenerate,$p_imageType1,$p_imageLayer1,$p_pdfGenerate1,$p_pdfType1,$p_pdfLayer1,$p_xlsGenerate1,$p_sendEmail,$p_email,$p_view,$p_previewReport,$p_imageGenerate,$p_imageType2,$p_imageLayer2,$p_pdfGenerate2,$p_pdfType2,$p_pdfLayer2,$p_xlsGenerate2) {
$MISConfig = new MISConfig();
$IDArr = explode("|",$p_ID);
$ID = explode("_",array_shift($IDArr));
$ID = $ID[0];
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load($MISConfig->getConfigFile());
$projectXpath = new DOMXpath($projectDOM);
$PIList = $projectXpath->query('/Configuration/Publishes/Publish/Images/Image[./@ID="'.$ID.'"]');
$PI = $projectXpath->query('/Configuration/Publishes/Publish/Images/Image[./@ID="'.$ID.'" and ./Active="J"]')->item(0);
$PP = $PI->parentNode->parentNode;
if($PIList->length == 2) {
$previewImage = true;
$PIpreview = $projectXpath->query('/Configuration/Publishes/Publish/Images/Image[./@ID="'.$ID.'" and ./Active="N"]')->item(0);
}else{
$previewImage = false;
$PIpreview = null;
}
$dataDir = $projectXpath->query('/Configuration/General/PublishImagePath')->item(0)->nodeValue;
$p_gifGenerate = ($p_gifGenerate == "true") ? "J" : "N";
$p_jpgGenerate = ($p_jpgGenerate == "true") ? "J" : "N";
$p_ppxFile = ($p_ppxFile == "true") ? "J" : "N";
$MISConfig->setNodeValue("Name",$p_reportName,$projectDOM,$PI);
$MISConfig->setNodeValue("Description",$p_reportDescription,$projectDOM,$PI);
$MISConfig->setNodeValue("Report",$p_pprReport,$projectDOM,$PI);
$MISConfig->setNodeValue("GIFGenerate",$p_gifGenerate,$projectDOM,$PI);
$MISConfig->setNodeValue("JPGGenerate",$p_jpgGenerate,$projectDOM,$PI);
$MISConfig->setNodeValue("PDFGenerate",$p_pdfGenerate1,$projectDOM,$PI);
$MISConfig->setNodeValue("XLSGenerate",$p_xlsGenerate1,$projectDOM,$PI);
$MISConfig->setNodeValue("SendEmail",$p_sendEmail,$projectDOM,$PI);
$MISConfig->setNodeValue("ImageType",$p_imageType1,$projectDOM,$PI);
$MISConfig->setNodeValue("ImageLayer",$p_imageLayer1,$projectDOM,$PI);
$MISConfig->setNodeValue("PDFImageType",$p_pdfType1,$projectDOM,$PI);
$MISConfig->setNodeValue("PDFImageLayer",$p_pdfLayer1,$projectDOM,$PI);
if($this->isRole("master")){
$MISConfig->setNodeValue("Ansicht",$p_view,$projectDOM,$PI);
}
$MISConfig->setNodeValue("Email",$p_email,$projectDOM,$PI);
$MISConfig->setNodeValue("ppx",$p_ppxFile,$projectDOM,$PI);
if($previewImage && $p_previewReport == "N") {
@unlink(utf8_decode($dataDir.$PP->getAttribute("User")."\\"
.$PP->getAttribute("Name")."\\".$PIpreview->getElementsByTagName("Name")->item(0)->nodeValue.".gif"));
@unlink(utf8_decode($dataDir.$PP->getAttribute("User")."\\"
.$PP->getAttribute("Name")."\\".$PIpreview->getElementsByTagName("Name")->item(0)->nodeValue.".jpg"));
@unlink(utf8_decode($dataDir.$PP->getAttribute("User")."\\"
.$PP->getAttribute("Name")."\\".$PIpreview->getElementsByTagName("Name")->item(0)->nodeValue.".pdf"));
@unlink(utf8_decode($dataDir.$PP->getAttribute("User")."\\"
.$PP->getAttribute("Name")."\\".$PIpreview->getElementsByTagName("Name")->item(0)->nodeValue.".xls"));
$PIpreview->parentNode->removeChild($PIpreview);
} else if($previewImage && $p_previewReport == "J") {
@rename(utf8_decode($dataDir.$PP->getAttribute("User")."\\"
.$PP->getAttribute("Name")."\\".$PIpreview->getElementsByTagName("Name")->item(0)->nodeValue.".gif"),
utf8_decode($dataDir.$PP->getAttribute("User")."\\"
.$PP->getAttribute("Name"))."\\".$p_reportName.".gif");
@rename(utf8_decode($dataDir.$PP->getAttribute("User")."\\"
.$PP->getAttribute("Name")."\\".$PIpreview->getElementsByTagName("Name")->item(0)->nodeValue.".jpg"),
utf8_decode($dataDir.$PP->getAttribute("User")."\\"
.$PP->getAttribute("Name"))."\\".$p_reportName.".jpg");
@rename(utf8_decode($dataDir.$PP->getAttribute("User")."\\"
.$PP->getAttribute("Name")."\\".$PIpreview->getElementsByTagName("Name")->item(0)->nodeValue.".pdf"),
utf8_decode($dataDir.$PP->getAttribute("User")."\\"
.$PP->getAttribute("Name"))."\\".$p_reportName.".pdf");
@rename(utf8_decode($dataDir.$PP->getAttribute("User")."\\"
.$PP->getAttribute("Name")."\\".$PIpreview->getElementsByTagName("Name")->item(0)->nodeValue.".xls"),
utf8_decode($dataDir.$PP->getAttribute("User")."\\"
.$PP->getAttribute("Name"))."\\".$p_reportName.".xls");
$MISConfig->setNodeValue("Name",$p_reportName,$projectDOM,$PIpreview);
$MISConfig->setNodeValue("Description",$p_reportDescription,$projectDOM,$PIpreview);
$MISConfig->setNodeValue("Report",$p_pprReport."_Graf",$projectDOM,$PIpreview);
if($p_imageGenerate == "GIF") {
$MISConfig->setNodeValue("GIFGenerate","J",$projectDOM,$PIpreview);
$MISConfig->setNodeValue("JPGGenerate","N",$projectDOM,$PIpreview);
}else{
$MISConfig->setNodeValue("GIFGenerate","N",$projectDOM,$PIpreview);
$MISConfig->setNodeValue("JPGGenerate","J",$projectDOM,$PIpreview);
}
$MISConfig->setNodeValue("PDFGenerate",$p_pdfGenerate2,$projectDOM,$PIpreview);
$MISConfig->setNodeValue("XLSGenerate",$p_xlsGenerate2,$projectDOM,$PIpreview);
$MISConfig->setNodeValue("ImageType",$p_imageType2,$projectDOM,$PIpreview);
$MISConfig->setNodeValue("ImageLayer",$p_imageLayer2,$projectDOM,$PIpreview);
$MISConfig->setNodeValue("PDFImageType",$p_pdfType2,$projectDOM,$PIpreview);
$MISConfig->setNodeValue("PDFImageLayer",$p_pdfLayer2,$projectDOM,$PIpreview);
$MISConfig->setNodeValue("Email",$p_email,$projectDOM,$PIpreview);
$MISConfig->setNodeValue("Ansicht",$p_view,$projectDOM,$PIpreview);
$MISConfig->setNodeValue("ppx",$p_ppxFile,$projectDOM,$PIpreview);
} else if(!$previewImage && $p_previewReport == "J") {
$PIpreview = $projectDOM->createElement("Image");
$PIpreview->setAttribute("ID",$ID);
$PIpreview->appendChild($projectDOM->createElement("Name"));
$MISConfig->setNodeValue("Name",$p_reportName,$projectDOM,$PIpreview);
$PIpreview->appendChild($projectDOM->createElement("Description"));
$MISConfig->setNodeValue("Description",$p_reportDescription,$projectDOM,$PIpreview);
$PIpreview->appendChild($projectDOM->createElement("Directory"));
$MISConfig->setNodeValue("Directory",utf8_decode($PI->getElementsByTagName("Directory")->item(0)->nodeValue),$projectDOM,$PIpreview);
$PIpreview->appendChild($projectDOM->createElement("Report"));
$MISConfig->setNodeValue("Report",$p_pprReport."_Graf",$projectDOM,$PIpreview);
$PIpreview->appendChild($projectDOM->createElement("GIFGenerate"));
$PIpreview->appendChild($projectDOM->createElement("JPGGenerate"));
if($p_imageGenerate == "GIF") {
$MISConfig->setNodeValue("GIFGenerate","J",$projectDOM,$PIpreview);
$MISConfig->setNodeValue("JPGGenerate","N",$projectDOM,$PIpreview);
}else{
$MISConfig->setNodeValue("GIFGenerate","N",$projectDOM,$PIpreview);
$MISConfig->setNodeValue("JPGGenerate","J",$projectDOM,$PIpreview);
}
$PIpreview->appendChild($projectDOM->createElement("PDFGenerate"));
$MISConfig->setNodeValue("PDFGenerate",$p_pdfGenerate2,$projectDOM,$PIpreview);
$PIpreview->appendChild($projectDOM->createElement("XLSGenerate"));
$MISConfig->setNodeValue("XLSGenerate",$p_xlsGenerate2,$projectDOM,$PIpreview);
$PIpreview->appendChild($projectDOM->createElement("Active"));
$MISConfig->setNodeValue("Active","N",$projectDOM,$PIpreview);
$PIpreview->appendChild($projectDOM->createElement("SendEmail"));
$MISConfig->setNodeValue("SendEmail","N",$projectDOM,$PIpreview);
$PIpreview->appendChild($projectDOM->createElement("ImageType"));
$MISConfig->setNodeValue("ImageType",$p_imageType2,$projectDOM,$PIpreview);
$PIpreview->appendChild($projectDOM->createElement("ImageLayer"));
$MISConfig->setNodeValue("ImageLayer",$p_imageLayer2,$projectDOM,$PIpreview);
$PIpreview->appendChild($projectDOM->createElement("PDFImageType"));
$MISConfig->setNodeValue("PDFImageType",$p_pdfType2,$projectDOM,$PIpreview);
$PIpreview->appendChild($projectDOM->createElement("PDFImageLayer"));
$MISConfig->setNodeValue("PDFImageLayer",$p_pdfLayer2,$projectDOM,$PIpreview);
$PIpreview->appendChild($projectDOM->createElement("Ansicht"));
$MISConfig->setNodeValue("Ansicht",$p_view,$projectDOM,$PIpreview);
$PIpreview->appendChild($projectDOM->createElement("Email"));
$MISConfig->setNodeValue("Email",$p_email,$projectDOM,$PIpreview);
$MISConfig->setNodeValue("ppx",$p_ppxFile,$projectDOM,$PIpreview);
$PIs = $PI->parentNode;
$PIs->appendChild($PIpreview);
}
$projectDOM->save($MISConfig->getConfigFile());
$this->_registerEmails($p_email);
if(count($IDArr)>0){
$eval = 'CMgr.getMODEL().getRetrieveInput("MISConfigurator","editReport","'.implode("|",$IDArr).'");';
}else{
$eval = 'CMgr.getMODEL().abortRetrieveInput();Ajax.request(MISConfigurator.__toString(),"configReportsForm","'.utf8_encode($_SESSION["configurator"]["publishes"]["section"]).'",MISConfigurator.configReportsFormCb);';
}
return array($eval);
}
private function deleteReport($p_ID) {
$MISConfig = new MISConfig();
$IDArr = explode("|",$p_ID);
$ID = explode("_",$IDArr[0]);
$ID = $ID[0];
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load($MISConfig->getConfigFile());
$projectXpath = new DOMXpath($projectDOM);
$PPName = $projectXpath->query('/Configuration/Publishes/Publish/Images/Image/Description[./../@ID="'.$ID.'"]')->item(0)->nodeValue;
$ret = '';
return array($ret,'');
}
private function saveDeleteReport($p_ID) {
$MISConfig = new MISConfig();
$IDArr = explode("|",$p_ID);
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load($MISConfig->getConfigFile());
$projectXpath = new DOMXpath($projectDOM);
$dataDir = $projectXpath->query('/Configuration/General/PublishImagePath')->item(0)->nodeValue;
foreach($IDArr as $ID) {
$ID = explode("_",$ID);
$ID = $ID[0];
$PIList = $projectXpath->query('/Configuration/Publishes/Publish/Images/Image[./@ID="'.$ID.'"]');
for($i=0;$i<$PIList->length;$i++) {
@unlink(utf8_decode($dataDir.$PIList->item($i)->getElementsByTagName("Directory")->item(0)->nodeValue
.$PIList->item($i)->parentNode->parentNode->getAttribute("Name")."\\"
.$PIList->item($i)->getElementsByTagName("Name")->item(0)->nodeValue.".pdf"));
@unlink(utf8_decode($dataDir.$PIList->item($i)->getElementsByTagName("Directory")->item(0)->nodeValue
.$PIList->item($i)->parentNode->parentNode->getAttribute("Name")."\\"
.$PIList->item($i)->getElementsByTagName("Name")->item(0)->nodeValue.".xls"));
@unlink(utf8_decode($dataDir.$PIList->item($i)->getElementsByTagName("Directory")->item(0)->nodeValue
.$PIList->item($i)->parentNode->parentNode->getAttribute("Name")."\\"
.$PIList->item($i)->getElementsByTagName("Name")->item(0)->nodeValue.".gif"));
@unlink(utf8_decode($dataDir.$PIList->item($i)->getElementsByTagName("Directory")->item(0)->nodeValue
.$PIList->item($i)->parentNode->parentNode->getAttribute("Name")."\\"
.$PIList->item($i)->getElementsByTagName("Name")->item(0)->nodeValue.".jpg"));
$PIList->item($i)->parentNode->removeChild($PIList->item($i));
}
}
$projectDOM->save($MISConfig->getConfigFile());
return array('CMgr.getMODEL().abortRetrieveInput();Ajax.request(MISConfigurator.__toString(),"configReportsForm","'.utf8_encode($_SESSION["configurator"]["publishes"]["section"]).'",MISConfigurator.configReportsFormCb);');
}
private function createScorecard($p_sectionID,$p_username) {
$MISConfig = new MISConfig();
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load($MISConfig->getConfigFile());
$projectXpath = new DOMXpath($projectDOM);
$ret = '';
return array($ret,'');
}
private function saveCreateScorecard($p_sectionID,$p_username,$p_name,$p_description,$p_active,$p_pprReport,$p_rowData,$p_colData,$p_hoherZielwert,$p_lowValue,$p_highValue,$p_tolerance,$p_format,$p_weight,$p_monthlyAccumulate,$p_email,$p_infoURL) {
$MISConfig = new MISConfig();
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load($MISConfig->getConfigFile());
$projectXpath = new DOMXpath($projectDOM);
$newID = $this->_generateReportID();
$PRsList = $projectXpath->query("/Configuration/Scorecards/Scorecard/Reports[./../@ID='".$p_sectionID."' and ./../@Directory='".utf8_encode($p_username)."\\']");
$PPName = $projectXpath->query("/Configuration/Publishes/Publish[./@ID='".$p_sectionID."']")->item(0)->getAttribute("Name");
if($PRsList->length > 0) {
$PRs = $PRsList->item(0);
}else{
$PS = $projectDOM->createElement("Scorecard");
$PS->setAttribute("Directory",utf8_encode($p_username)."\\");
$PS->setAttribute("ID",$p_sectionID);
$PS->setAttribute("Name",utf8_encode($PPName));
$PRs = $projectDOM->createElement("Reports");
$PS->appendChild($PRs);
$PSs = $projectXpath->query("/Configuration/Scorecards")->item(0);
$PSs->appendChild($PS);
}
switch($p_format) {
case 0: $format = "Ganzzahlig";
break;
case 1: $format = "Zahl mit Trennz";
break;
case 2: $format = "Zahl ohne Trennz";
break;
case 3: $format = utf8_decode("Währung");
break;
case 4: $format = "Prozent";
break;
}
$PR = $projectDOM->createElement("Report");
$PR->setAttribute("ID",$newID);
$MISConfig->setNodeValue("Name",$p_name,$projectDOM,$PR);
$MISConfig->setNodeValue("Description",$p_description,$projectDOM,$PR);
$MISConfig->setNodeValue("Active",$p_active,$projectDOM,$PR);
$MISConfig->setNodeValue("ReportFile",$p_pprReport,$projectDOM,$PR);
$MISConfig->setNodeValue("RowData",$p_rowData,$projectDOM,$PR);
$MISConfig->setNodeValue("ColData",$p_colData,$projectDOM,$PR);
$MISConfig->setNodeValue("HoherZielwert",$p_hoherZielwert,$projectDOM,$PR);
$MISConfig->setNodeValue("LowValue",$p_lowValue,$projectDOM,$PR);
$MISConfig->setNodeValue("HighValue",$p_highValue,$projectDOM,$PR);
$MISConfig->setNodeValue("Tolerance",$p_tolerance,$projectDOM,$PR);
$MISConfig->setNodeValue("Format",$format,$projectDOM,$PR);
$MISConfig->setNodeValue("Weight",$p_weight,$projectDOM,$PR);
$MISConfig->setNodeValue("MonthlyAccumulate",$p_monthlyAccumulate,$projectDOM,$PR);
$MISConfig->setNodeValue("Email",$p_email,$projectDOM,$PR);
$MISConfig->setNodeValue("InfoURL",$p_infoURL,$projectDOM,$PR);
$PRs->appendChild($PR);
$projectDOM->save($MISConfig->getConfigFile());
return array('CMgr.getMODEL().abortRetrieveInput();Ajax.request(MISConfigurator.__toString(),"configScorecardsForm","'.utf8_encode($_SESSION["configurator"]["publishes"]["section"]).'",MISConfigurator.configScorecardsFormCb);');
}
private function editScorecard($p_ID) {
$MISConfig = new MISConfig();
$IDsArr = explode("|",$p_ID);
$IDArr = explode("_",$IDsArr[0]);
$ID = $IDArr[0];
$username = $IDArr[1];
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load($MISConfig->getConfigFile());
$projectXpath = new DOMXpath($projectDOM);
$PR = $projectXpath->query('/Configuration/Scorecards/Scorecard/Reports/Report[./@ID="'.$ID.'"]')->item(0);
$ret = '';
return array($ret,'');
}
private function saveEditScorecard($p_ID,$p_name,$p_description,$p_active,$p_pprReport,$p_rowData,$p_colData,$p_hoherZielwert,$p_lowValue,$p_highValue,$p_tolerance,$p_format,$p_weight,$p_monthlyAccumulate,$p_email,$p_infoURL) {
$MISConfig = new MISConfig();
$IDsArr = explode("|",$p_ID);
$IDArr = explode("_",array_shift($IDsArr));
$ID = $IDArr[0];
$username = $IDArr[1];
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load($MISConfig->getConfigFile());
$projectXpath = new DOMXpath($projectDOM);
$PR = $projectXpath->query('/Configuration/Scorecards/Scorecard/Reports/Report[./@ID = "'.$ID.'"]')->item(0);
switch($p_format) {
case 0: $format = "Ganzzahlig";
break;
case 1: $format = "Zahl mit Trennz";
break;
case 2: $format = "Zahl ohne Trennz";
break;
case 3: $format = utf8_decode("Währung");
break;
case 4: $format = "Prozent";
break;
}
$MISConfig->setNodeValue("Name",$p_name,$projectDOM,$PR);
$MISConfig->setNodeValue("Description",$p_description,$projectDOM,$PR);
$MISConfig->setNodeValue("Active",$p_active,$projectDOM,$PR);
$MISConfig->setNodeValue("ReportFile",$p_pprReport,$projectDOM,$PR);
$MISConfig->setNodeValue("RowData",$p_rowData,$projectDOM,$PR);
$MISConfig->setNodeValue("ColData",$p_colData,$projectDOM,$PR);
$MISConfig->setNodeValue("HoherZielwert",$p_hoherZielwert,$projectDOM,$PR);
$MISConfig->setNodeValue("LowValue",$p_lowValue,$projectDOM,$PR);
$MISConfig->setNodeValue("HighValue",$p_highValue,$projectDOM,$PR);
$MISConfig->setNodeValue("Tolerance",$p_tolerance,$projectDOM,$PR);
$MISConfig->setNodeValue("Format",$format,$projectDOM,$PR);
$MISConfig->setNodeValue("Weight",$p_weight,$projectDOM,$PR);
$MISConfig->setNodeValue("MonthlyAccumulate",$p_monthlyAccumulate,$projectDOM,$PR);
$MISConfig->setNodeValue("Email",$p_email,$projectDOM,$PR);
$MISConfig->setNodeValue("InfoURL",$p_infoURL,$projectDOM,$PR);
$projectDOM->save($MISConfig->getConfigFile());
if(count($IDsArr)>0){
$eval = 'CMgr.getMODEL().getRetrieveInput("MISConfigurator","editScorecard","'.implode("|",$IDsArr).'");';
}else{
$eval = 'CMgr.getMODEL().abortRetrieveInput();Ajax.request(MISConfigurator.__toString(),"configScorecardsForm","'.utf8_encode($_SESSION["configurator"]["publishes"]["section"]).'",MISConfigurator.configScorecardsFormCb);';
}
return array($eval);
}
private function deleteScorecard($p_ID) {
$MISConfig = new MISConfig();
$IDsArr = explode("|",$p_ID);
$IDArr = explode("_",$IDsArr[0]);
$ID = $IDArr[0];
$username = $IDArr[1];
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load($MISConfig->getConfigFile());
$projectXpath = new DOMXpath($projectDOM);
$PPName = $projectXpath->query('/Configuration/Scorecards/Scorecard/Reports/Report/Name[./../@ID="'.$ID.'"]')->item(0)->nodeValue;
$ret = '';
return array($ret,'');
}
private function saveDeleteScorecard($p_ID) {
$MISConfig = new MISConfig();
$IDsArr = explode("|",$p_ID);
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load($MISConfig->getConfigFile());
$projectXpath = new DOMXpath($projectDOM);
foreach($IDsArr as $IDStr) {
$IDArr = explode("_",$IDStr);
$ID = $IDArr[0];
$PIList = $projectXpath->query('/Configuration/Scorecards/Scorecard/Reports/Report[./@ID="'.$ID.'"]');
for($i=0;$i<$PIList->length;$i++) {
$PIList->item($i)->parentNode->removeChild($PIList->item($i));
}
}
$projectDOM->save($MISConfig->getConfigFile());
return array('CMgr.getMODEL().abortRetrieveInput();Ajax.request(MISConfigurator.__toString(),"configScorecardsForm","'.utf8_encode($_SESSION["configurator"]["publishes"]["section"]).'",MISConfigurator.configScorecardsFormCb);');
}
private function editLanguage($p_app,$p_key="") {
$MISConfig = new MISConfig();
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load(Filesystem::standardDirFormat(Core::getAppsDir().$p_app).$p_app.".i18n.xml");
$projectXpath = new DOMXpath($projectDOM);
$ret = '';
return array($ret,'');
}
public function loadTranslation($p_app,$p_key) {
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load(Filesystem::standardDirFormat(Core::getAppsDir().$p_app).$p_app.".i18n.xml");
$projectXpath = new DOMXpath($projectDOM);
$translation = $projectXpath->query("/i18n/".$p_key);
$translation = $translation->item(0);
$childs = $translation->childNodes;
$langs = I18N::getLanguages();
foreach($langs as $lang) {
$ret[] = $lang;
$ret[] = "";
}
foreach($childs as $node) {
if($node->nodeName != "#text") {
$ret[] = $node->nodeName;
$ret[] = $node->nodeValue;
}
}
return $ret;
}
private function saveEditLanguage($p_save,$p_app,$p_key,$p_value_de,$p_value_en,$p_value_fr,$p_value_it) {
$MISConfig = new MISConfig();
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load(Filesystem::standardDirFormat(Core::getAppsDir().$p_app).$p_app.".i18n.xml");
$projectXpath = new DOMXpath($projectDOM);
$translation = $projectXpath->query("/i18n/".$p_key)->item(0);
$MISConfig->setNodeValue("de",$p_value_de,$projectDOM,$translation);
$MISConfig->setNodeValue("en",$p_value_en,$projectDOM,$translation);
$MISConfig->setNodeValue("fr",$p_value_fr,$projectDOM,$translation);
$MISConfig->setNodeValue("it",$p_value_it,$projectDOM,$translation);
$projectDOM->save(Filesystem::standardDirFormat(Core::getAppsDir().$p_app).$p_app.".i18n.xml");
if($p_save == "save") {
return array('CMgr.getMODEL().__construct();');
}else{
return "";
}
}
private function createUser(){
$MISConfig = new MISConfig();
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load($MISConfig->getConfigFile());
$projectXpath = new DOMXpath($projectDOM);
$ret = '';
return array($ret,'');
}
private function saveCreateUser($p_username,$p_password,$p_passwordRepeat,$p_lang,$p_view,$p_global="false") {
if($this->isRole("master")) {
$MISConfig = new MISConfig();
$authDOM = new DOMDocument('1.0', 'iso-8859-1');
$authDOM->load($MISConfig->authFile);
$authXpath = new DOMXpath($authDOM);
$userUnique = $authXpath->query("/auth/users/user[./@username='".utf8_encode($p_username)."' and (@setting='".basename($MISConfig->getConfigFile(),".xml")."' or @setting='')]");
if($p_password != $p_passwordRepeat)
return array('alert("'.$this->_getI18N("pw_not_equal").'");');
if($userUnique->length > 0)
return array('alert("'.$this->_getI18N("user_not_unique").'");');
if(!strpbrk($p_username, "_") === false)
return array('alert("'.$this->_getI18N("no_underscore_allowed").'");');
if(!strpbrk($p_username, "|") === false)
return array('alert("'.$this->_getI18N("no_vert_dash_allowed").'");');
$UU = $authDOM->createElement('user');
$UU->setAttribute('username',utf8_encode($p_username));
$UU->setAttribute('password',md5($p_password));
$UU->setAttribute('global',$p_global);
$UU->setAttribute('lang',$p_lang);
$UU->setAttribute('view',$p_view);
$UU->setAttribute('setting',basename($MISConfig->getConfigFile(),".xml"));
$users = $authXpath->query("/auth/users")->item(0);
$users->appendChild($UU);
$authDOM->save($MISConfig->authFile);
}
return array('CMgr.getMODEL().__construct();');
}
private function editUser($p_ID) {
$MISConfig = new MISConfig();
$IDsArr = explode("|",$p_ID);
$IDArr = explode("_",$IDsArr[0]);
$username = $IDsArr[0];
$ret="";
$eval="";
if(count($IDArr)==1) {
$authDOM = new DOMDocument('1.0', 'iso-8859-1');
$authDOM->load($MISConfig->authFile);
$authXpath = new DOMXpath($authDOM);
$AU = $authXpath->query("/auth/users/user[@username='".utf8_encode($username)."']")->item(0);
$ret.= '';
}else{
$eval = 'CMgr.getMODEL().getRetrieveInput("MISConfigurator","editSection","'.$p_ID.'");';
}
return array($ret,$eval);
}
private function saveEditUser($p_ID,$p_newUsername,$p_password,$p_passwordRepeat,$p_lang,$p_view="Info-User",$p_global="false") {
$MISConfig = new MISConfig();
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load($MISConfig->getConfigFile());
$projectXpath = new DOMXpath($projectDOM);
$IDsArr = explode("|",$p_ID);
$dataDir = $projectXpath->query('/Configuration/General/PublishImagePath')->item(0)->nodeValue;
$username = utf8_encode(array_shift($IDsArr));
$newUsername = utf8_encode($p_newUsername);
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load($MISConfig->getConfigFile());
$projectXpath = new DOMXpath($projectDOM);
$authDOM = new DOMDocument('1.0', 'iso-8859-1');
$authDOM->load($MISConfig->authFile);
$authXpath = new DOMXpath($authDOM);
$userUnique = $authXpath->query("/auth/users/user[./@username='".$newUsername."' and (@setting='".basename($MISConfig->getConfigFile(),".xml")."' or @setting='')]");
if($p_password != $p_passwordRepeat)
return array('alert("'.$this->_getI18N("pw_not_equal").'");');
if($newUsername != $username && $userUnique->length > 0)
return array('alert("'.$this->_getI18N("user_not_unique").'");');
if(!strpbrk($p_newUsername, "_") === false)
return array('alert("'.$this->_getI18N("no_underscore_allowed").'");');
if(!strpbrk($p_newUsername, "|") === false)
return array('alert("'.$this->_getI18N("no_vert_dash_allowed").'");');
$UU = $authXpath->query("/auth/users/user[@username='".$username."' and (@setting='".basename($MISConfig->getConfigFile(),".xml")."' or @setting='')]")->item(0);
$UU->setAttribute("username",$newUsername);
$UU->setAttribute('lang',$p_lang);
if($this->isRole("master")) {
$UU->setAttribute('view',$p_view);
$UU->setAttribute('global',$p_global);
}
if($p_password != " ") $UU->setAttribute('password',md5($p_password));
$PIList = $projectXpath->query("/Configuration/Publishes/Publish/Images/Image[./Directory='".$username."\\']");
for($i=0;$i<$PIList->length;$i++) {
$PI = $PIList->item($i);
$MISConfig->setNodeValue("Directory",utf8_decode($newUsername)."\\",$projectDOM,$PI);
}
$PIList = $projectXpath->query("/Configuration/Publishes/Publish[./@User='".$username."']");
for($i=0;$i<$PIList->length;$i++) {
$PI = $PIList->item($i);
$PI->setAttribute("User",$newUsername);
}
$PSList = $projectXpath->query("/Configuration/Scorecards/Scorecard[./@Directory='".$username."\\']");
for($i=0;$i<$PSList->length;$i++){
$PS = $PSList->item($i);
$PS->setAttribute("Directory",$newUsername."\\");
}
$PSList = $projectXpath->query("/Configuration/Dashboards/Dashboard[./@Directory='".$username."\\']");
for($i=0;$i<$PSList->length;$i++){
$PS = $PSList->item($i);
$PS->setAttribute("Directory",$newUsername."\\");
}
$projectDOM->save($MISConfig->getConfigFile());
$authDOM->save($MISConfig->authFile);
@rename(utf8_decode($dataDir.$username)."\\",
utf8_decode($dataDir.$newUsername)."\\");
if(count($IDsArr)>0){
$eval = 'CMgr.getMODEL().getRetrieveInput("MISConfigurator","editUser","'.implode("|",$IDsArr).'");';
}else{
$eval = 'CMgr.getMODEL().__construct();';
}
return array($eval);
}
private function deleteUser($p_ID) {
$usernames = array();
$IDsArr = explode("|",$p_ID);
$deleteSections = false;
$newIDsArr = array();
foreach($IDsArr as $IDStr){
$IDArr = explode("_",$IDStr);
if(count($IDArr)==1) {
$username = $IDArr[0];
array_push($usernames, utf8_encode($username));
}else{
$deleteSections = true;
array_push($newIDsArr,$IDStr);
}
}
$ret = '';
return array($ret,'');
}
private function saveDeleteUser($p_ID) {
$MISConfig = new MISConfig();
$IDsArr = explode("|",$p_ID);
$newIDsArr = Array();
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load($MISConfig->getConfigFile());
$projectXpath = new DOMXpath($projectDOM);
$authDOM = new DOMDocument('1.0', 'iso-8859-1');
$authDOM->load($MISConfig->authFile);
$authXpath = new DOMXpath($authDOM);
foreach($IDsArr as $IDStr) {
$IDArr = explode("_",$IDStr);
if(count($IDArr)==1){
$username = utf8_encode($IDArr[0]);
$AU = $authXpath->query("/auth/users/user[@username='".$username."' and @setting='".basename($MISConfig->getConfigFile(),".xml")."']")->item(0);
$AU->parentNode->removeChild($AU);
$PIList = $projectXpath->query("/Configuration/Publishes/Publish[./@User='".$username."']");
for($i=0;$i<$PIList->length;$i++) {
$PI = $PIList->item($i);
$PI->parentNode->removeChild($PI);
}
$PSList = $projectXpath->query("/Configuration/Scorecards/Scorecard[./@Directory='".$username."\\']");
for($i=0;$i<$PSList->length;$i++){
$PS = $PSList->item($i);
$PS->parentNode->removeChild($PS);
}
$PSList = $projectXpath->query("/Configuration/Dashboards/Dashboard[./@Directory='".$username."\\']");
for($i=0;$i<$PSList->length;$i++){
$PS = $PSList->item($i);
$PS->parentNode->removeChild($PS);
}
}else{
array_push($newIDsArr,$IDStr);
}
}
$success = $this->deleteDir($projectXpath->query("/Configuration/General/PublishImagePath")->item(0)->nodeValue.$username."\\");
$projectDOM->save($MISConfig->getConfigFile());
$authDOM->save($MISConfig->authFile);
$eval = "";
if($success != 0 && $success != -1) {
$eval.='alert("'.$this->_getI18N("deleteDataFolderManually").'");';
}
if(count($newIDsArr)>0){
$eval.='CMgr.getMODEL().__construct();CMgr.getMODEL().getRetrieveInput("MISConfigurator","deleteSection","'.implode("|",$newIDsArr).'");';
}else{
$eval.='CMgr.getMODEL().__construct();';
}
return array($eval);
}
private function createDashboard($p_sectionID,$p_username) {
$MISConfig = new MISConfig();
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load($MISConfig->getConfigFile());
$projectXpath = new DOMXpath($projectDOM);
$ret = '';
return array($ret,'');
}
private function saveCreateDashboard($p_sectionID,$p_username,$p_name,$p_description,$p_xlsReport) {
$MISConfig = new MISConfig();
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load($MISConfig->getConfigFile());
$projectXpath = new DOMXpath($projectDOM);
$newID = $this->_generateReportID();
$PRsList = $projectXpath->query("/Configuration/Dashboards/Dashboard[./@ID='".$p_sectionID."' and ./@Directory='".utf8_encode($p_username)."\\']");
$PPName = $projectXpath->query("/Configuration/Publishes/Publish[./@ID='".$p_sectionID."']")->item(0)->getAttribute("Name");
if($PRsList->length > 0) {
$PRs = $PRsList->item(0);
}else{
return array('CMgr.getMODEL().abortRetrieveInput();Ajax.request(MISConfigurator.__toString(),"configDashboardsForm","'.utf8_encode($_SESSION["configurator"]["publishes"]["section"]).'",MISConfigurator.configDashboardsFormCb);');
}
$PR = $projectDOM->createElement("Review");
$PR->setAttribute("ID",$newID);
$MISConfig->setNodeValue("Name",$p_name,$projectDOM,$PR);
$MISConfig->setNodeValue("Description",$p_description,$projectDOM,$PR);
$MISConfig->setNodeValue("ReportFile",$p_xlsReport,$projectDOM,$PR);
$PRs->getElementsByTagname("Reviews")->item(0)->appendChild($PR);
$projectDOM->save($MISConfig->getConfigFile());
return array('CMgr.getMODEL().abortRetrieveInput();Ajax.request(MISConfigurator.__toString(),"configDashboardsForm","'.utf8_encode($_SESSION["configurator"]["publishes"]["section"]).'",MISConfigurator.configDashboardsFormCb);');
}
private function deleteDashboard($p_ID) {
$MISConfig = new MISConfig();
$IDsArr = explode("|",$p_ID);
$IDArr = explode("_",$IDsArr[0]);
$ID = $IDArr[0];
$username = $IDArr[1];
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load($MISConfig->getConfigFile());
$projectXpath = new DOMXpath($projectDOM);
$PPName = $projectXpath->query('/Configuration/Dashboards/Dashboard/Reviews/Review/Name[./../@ID="'.$ID.'"]')->item(0)->nodeValue;
$ret = '';
return array($ret,'');
}
private function saveDeleteDashboard($p_ID) {
$MISConfig = new MISConfig();
$IDsArr = explode("|",$p_ID);
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load($MISConfig->getConfigFile());
$projectXpath = new DOMXpath($projectDOM);
foreach($IDsArr as $IDStr) {
$IDArr = explode("_",$IDStr);
$ID = $IDArr[0];
$PIList = $projectXpath->query('/Configuration/Dashboards/Dashboard/Reviews/Review[./@ID="'.$ID.'"]');
for($i=0;$i<$PIList->length;$i++) {
$PIList->item($i)->parentNode->removeChild($PIList->item($i));
}
}
$projectDOM->save($MISConfig->getConfigFile());
return array('CMgr.getMODEL().abortRetrieveInput();Ajax.request(MISConfigurator.__toString(),"configDashboardsForm","'.utf8_encode($_SESSION["configurator"]["publishes"]["section"]).'",MISConfigurator.configDashboardsFormCb);');
}
private function editDashboard($p_ID) {
$MISConfig = new MISConfig();
$IDsArr = explode("|",$p_ID);
$IDArr = explode("_",$IDsArr[0]);
$ID = $IDArr[0];
$username = $IDArr[1];
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load($MISConfig->getConfigFile());
$projectXpath = new DOMXpath($projectDOM);
$PR = $projectXpath->query('/Configuration/Dashboards/Dashboard/Reviews/Review[./@ID="'.$ID.'"]')->item(0);
$ret = '';
return array($ret,'');
}
private function saveEditDashboard($p_ID,$p_name,$p_description,$p_pprReport) {
$MISConfig = new MISConfig();
$IDsArr = explode("|",$p_ID);
$IDArr = explode("_",array_shift($IDsArr));
$ID = $IDArr[0];
$username = $IDArr[1];
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load($MISConfig->getConfigFile());
$projectXpath = new DOMXpath($projectDOM);
$PR = $projectXpath->query('/Configuration/Dashboards/Dashboard/Reviews/Review[./@ID = "'.$ID.'"]')->item(0);
$MISConfig->setNodeValue("Name",$p_name,$projectDOM,$PR);
$MISConfig->setNodeValue("Description",$p_description,$projectDOM,$PR);
$MISConfig->setNodeValue("ReportFile",$p_pprReport,$projectDOM,$PR);
$projectDOM->save($MISConfig->getConfigFile());
if(count($IDsArr)>0){
$eval = 'CMgr.getMODEL().getRetrieveInput("MISConfigurator","editDashboard","'.implode("|",$IDsArr).'");';
}else{
$eval = 'CMgr.getMODEL().abortRetrieveInput();Ajax.request(MISConfigurator.__toString(),"configDashboardsForm","'.utf8_encode($_SESSION["configurator"]["publishes"]["section"]).'",MISConfigurator.configDashboardsFormCb);';
}
return array($eval);
}
private function createView() {
$MISConfig = new MISConfig();
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load($MISConfig->getConfigFile());
$projectXpath = new DOMXpath($projectDOM);
$ret = '';
return array($ret,'');
}
private function saveCreateView($p_name,$p_description) {
$MISConfig = new MISConfig();
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load($MISConfig->getConfigFile());
$projectXpath = new DOMXpath($projectDOM);
$newID = $this->_generateReportID();
$Version = $projectXpath->query("/Configuration/Version")->item(0);
$PR = $projectDOM->createElement("View");
$PR->setAttribute("ID",$newID);
$MISConfig->setNodeValue("Name",$p_name,$projectDOM,$PR);
$MISConfig->setNodeValue("Description",$p_description,$projectDOM,$PR);
$Version->getElementsByTagname("Views")->item(0)->appendChild($PR);
$projectDOM->save($MISConfig->getConfigFile());
return array('CMgr.getMODEL().__construct();');
}
private function editView($p_ID){
$MISConfig = new MISConfig();
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load($MISConfig->getConfigFile());
$projectXpath = new DOMXpath($projectDOM);
$PR = $projectXpath->query('/Configuration/Version/Views/View[./@ID="'.$p_ID.'"]')->item(0);
$ret = '';
return array($ret,'');
}
private function saveEditView($p_ID,$p_name,$p_description) {
$MISConfig = new MISConfig();
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load($MISConfig->getConfigFile());
$projectXpath = new DOMXpath($projectDOM);
$Version = $projectXpath->query("/Configuration/Version/Views/View[./@ID='".$p_ID."']")->item(0);
$MISConfig->setNodeValue("Name",$p_name,$projectDOM,$Version);
$MISConfig->setNodeValue("Description",$p_description,$projectDOM,$Version);
$projectDOM->save($MISConfig->getConfigFile());
return array('CMgr.getMODEL().__construct();');
}
private function deleteView($p_ID) {
$MISConfig = new MISConfig();
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load($MISConfig->getConfigFile());
$projectXpath = new DOMXpath($projectDOM);
$PPName = $projectXpath->query('/Configuration/Version/Views/View[./@ID="'.$p_ID.'"]/Name')->item(0)->nodeValue;
$ret = '';
return array($ret,'');
}
private function saveDeleteView($p_ID){
$MISConfig = new MISConfig();
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load($MISConfig->getConfigFile());
$projectXpath = new DOMXpath($projectDOM);
$PIList = $projectXpath->query('/Configuration/Version/Views/View[./@ID="'.$p_ID.'"]');
for($i=0;$i<$PIList->length;$i++) {
$PIList->item($i)->parentNode->removeChild($PIList->item($i));
}
$projectDOM->save($MISConfig->getConfigFile());
return array('CMgr.getMODEL().__construct();');
}
private function dragAndDrop($p_dragType,$p_dragID,$p_dropType,$p_dropID,$p_dropOrder) {
$MISConfig = new MISConfig();
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load($MISConfig->getConfigFile());
$projectXpath = new DOMXpath($projectDOM);
if($p_dragType == "emailReport" && ($p_dropType == "emailUser")) {
return $this->createEmailReportForm2($p_dropID,$p_dragID);
}
if($p_dragType == "emailUser" && ($p_dropType == "emailUser")) {
$ImageList = $projectXpath->query("/Configuration/Publishes/Publish/Images/Image[./Active='J' and ./SendEmail='J' and ./Email!='']");
$emailArr = array();
for($i=0;$i < $ImageList->length;$i++) {
$Image = $ImageList->item($i);
$ImageEmailArr = explode(";",$Image->getElementsByTagName("Email")->item(0)->nodeValue);
foreach($ImageEmailArr as $email) {
if(!array_key_exists(trim($email), $emailArr)) {
$emailArr[trim($email)] = array();
}
$emailArr[trim($email)][trim($Image->getElementsByTagName("Name")->item(0)->nodeValue)] = $Image->getAttribute("ID");
}
}
$ImageIDs = implode("|",$emailArr[$p_dragID]);
return $this->createEmailReportForm2($p_dropID,$ImageIDs);
}
$ret = '';
return array($ret,'');
}
private function saveDADSectionToSection($p_dragType,$p_dragID,$p_dropType,$p_dropID,$p_dropOrder,$p_action,$ProjectDOM=null,$ProjectXpath=null) {
$MISConfig = new MISConfig();
if($ProjectDOM == null) {
$ProjectDOM = new DOMDocument('1.0', 'iso-8859-1');
$ProjectDOM->load($MISConfig->getConfigFile());
}
if($ProjectXpath == null) {
$ProjectXpath = new DOMXpath($ProjectDOM);
}
$Project = $ProjectXpath->query("/Configuration")->item(0);
$p_dragIDArr = explode("_",$p_dragID);
$p_dropIDArr = explode("_",$p_dropID);
$dropPublish = $ProjectXpath->query('./Publishes/Publish[./@ID = "'.$p_dropIDArr[0].'" and ./@User="'.utf8_encode($p_dropIDArr[1]).'"]',$Project)->item(0);
$dropScorecard = $ProjectXpath->query('./Scorecards/Scorecard[./@ID = "'.$p_dropIDArr[0].'" and ./@Directory="'.utf8_encode($p_dropIDArr[1]).'\\"]',$Project)->item(0);
$dropDashboard = $ProjectXpath->query('./Dashboards/Dashboard[./@ID = "'.$p_dropIDArr[0].'" and ./@Directory="'.utf8_encode($p_dropIDArr[1]).'\\"]',$Project)->item(0);
if($p_action == "replace") {
$dragPublish = $ProjectXpath->query('./Publishes/Publish[./@ID = "'.$p_dragIDArr[0].'" and ./@User="'.utf8_encode($p_dragIDArr[1]).'"]',$Project)->item(0);
$dragPublish = $dragPublish->parentNode->removeChild($dragPublish);
$dragPublish->setAttribute("User",utf8_encode($p_dropIDArr[1]));
$ImageList = $dragPublish->getElementsByTagname("Image");
for($i=0;$ImageList->length>$i;$i++) {
$Image = $ImageList->item($i);
$MISConfig->setNodeValue("Directory",$p_dropIDArr[1]."\\",$ProjectDOM,$Image);
if($this->_getView($p_dropIDArr[1]) == "Info-User") {
$MISConfig->setNodeValue("Ansicht",$this->_getView($p_dropIDArr[1]),$ProjectDOM,$Image);
if($Image->getElementsByTagname("Active")->item(0)->nodeValue == "J"){
$MISConfig->setNodeValue("PDFGenerate","J",$ProjectDOM,$Image);
}
}
}
$dragScorecard = $ProjectXpath->query('./Scorecards/Scorecard[./@ID = "'.$p_dragIDArr[0].'" and ./@Directory="'.utf8_encode($p_dragIDArr[1]).'\\"]',$Project)->item(0);
$dragScorecard = $dragScorecard->parentNode->removeChild($dragScorecard);
$dragScorecard->setAttribute("Directory",utf8_encode($p_dropIDArr[1])."\\");
$dragDashboard = $ProjectXpath->query('./Dashboards/Dashboard[./@ID = "'.$p_dragIDArr[0].'" and ./@Directory="'.utf8_encode($p_dragIDArr[1]).'\\"]',$Project)->item(0);
$dragDashboard = $dragDashboard->parentNode->removeChild($dragDashboard);
$dragDashboard->setAttribute("Directory",utf8_encode($p_dropIDArr[1])."\\");
} elseif($p_action == "copy") {
$newID = $this->_generateSectionID();
$iDragPublish = $ProjectXpath->query('/Configuration/Publishes/Publish[./@ID = "'.$p_dragIDArr[0].'" and ./@User="'.utf8_encode($p_dragIDArr[1]).'"]')->item(0);
$dragPublish = $iDragPublish->cloneNode(false);
$dragPublish->appendChild($ProjectDOM->createElement("Images"));
$dragPublish->setAttribute("ID",$newID);
$dragPublish->setAttribute("User",utf8_encode($p_dropIDArr[1]));
$iDragScorecard = $ProjectXpath->query('/Configuration/Scorecards/Scorecard[./@ID = "'.$p_dragIDArr[0].'" and ./@Directory="'.utf8_encode($p_dragIDArr[1]).'\\"]')->item(0);
$dragScorecard = $iDragScorecard->cloneNode(false);
$dragScorecard->appendChild($ProjectDOM->createElement("Reports"));
$dragScorecard->setAttribute("ID",$newID);
$dragScorecard->setAttribute("Directory",utf8_encode($p_dropIDArr[1])."\\");
$iDragDashboard = $ProjectXpath->query('/Configuration/Dashboards/Dashboard[./@ID = "'.$p_dragIDArr[0].'" and ./@Directory="'.utf8_encode($p_dragIDArr[1]).'\\"]')->item(0);
$dragDashboard = $iDragDashboard->cloneNode(false);
$dragDashboard->appendChild($ProjectDOM->createElement("Reviews"));
$dragDashboard->setAttribute("ID",$newID);
$dragDashboard->setAttribute("Directory",utf8_encode($p_dropIDArr[1])."\\");
$ImageIDs = array();
$iImageList = $iDragPublish->getElementsByTagname("Image");
foreach($iImageList as $iImage) {
$Image = $iImage->cloneNode(true);
$currentID = $Image->getAttribute("ID");
if(!array_key_exists($currentID,$ImageIDs)) {
$newID = $this->_generateReportID();
$ImageIDs[$currentID] = $newID;
}else{
$newID = $ImageIDs[$currentID];
}
$Image->setAttribute("ID",$newID);
$MISConfig->setNodeValue("Directory",$p_dropIDArr[1]."\\",$ProjectDOM,$Image);
if($this->_getView($p_dropIDArr[1]) == "Info-User") {
$MISConfig->setNodeValue("Ansicht",$this->_getView($p_dropIDArr[1]),$ProjectDOM,$Image);
if($Image->getElementsByTagname("Active")->item(0)->nodeValue == "J"){
$MISConfig->setNodeValue("PDFGenerate","J",$ProjectDOM,$Image);
}
}
$dragPublish->getElementsByTagName("Images")->item(0)->appendChild($Image);
}
//COPY SCORECARDS
$iReportList = $iDragScorecard->getElementsByTagname("Report");
foreach($iReportList as $iReport) {
$Report = $iReport->cloneNode(true);
$Report->setAttribute("ID",$this->_generateReportID());
$dragScorecard->getElementsByTagName("Reports")->item(0)->appendChild($Report);
}
$iReportList = $iDragDashboard->getElementsByTagname("Review");
foreach($iReportList as $iReport) {
$Report = $iReport->cloneNode(true);
$Report->setAttribute("ID",$this->_generateReportID());
$dragDashboard->getElementsByTagName("Reviews")->item(0)->appendChild($Report);
}
}
switch($p_dropOrder) {
case "before": $dropPublish->parentNode->insertBefore($dragPublish,$dropPublish);
$dragPublish->setAttribute("parentID",$dropPublish->getAttribute("parentID"));
$dropScorecard->parentNode->insertBefore($dragScorecard,$dropScorecard);
$dragScorecard->setAttribute("parentID",$dropScorecard->getAttribute("parentID"));
$dropDashboard->parentNode->insertBefore($dragDashboard,$dropDashboard);
$dragDashboard->setAttribute("parentID",$dropDashboard->getAttribute("parentID"));
break;
case "under": $dropPublish->parentNode->appendChild($dragPublish);
$dragPublish->setAttribute("parentID",$dropPublish->getAttribute("ID"));
$dropScorecard->parentNode->appendChild($dragScorecard);
$dragScorecard->setAttribute("parentID",$dropScorecard->getAttribute("ID"));
$dropDashboard->parentNode->appendChild($dragDashboard);
$dragDashboard->setAttribute("parentID",$dropDashboard->getAttribute("ID"));
break;
case "after": if($dropPublish->nextSibling != null && !$dropPublish->nextSibling->isSameNode($dragPublish)) {
$dropPublish->parentNode->insertBefore($dragPublish,$dropPublish->nextSibling);
} else {
$dropPublish->parentNode->appendChild($dragPublish);
}
$dragPublish->setAttribute("parentID",$dropPublish->getAttribute("parentID"));
if($dropScorecard->nextSibling != null && !$dropScorecard->nextSibling->isSameNode($dragScorecard)) {
$dropScorecard->parentNode->insertBefore($dragScorecard,$dropScorecard->nextSibling);
} else {
$dropScorecard->parentNode->appendChild($dragScorecard);
}
$dragScorecard->setAttribute("parentID",$dropScorecard->getAttribute("parentID"));
if($dropDashboard->nextSibling != null && !$dropDashboard->nextSibling->isSameNode($dragDashboard)) {
$dropDashboard->parentNode->insertBefore($dragDashboard,$dropDashboard->nextSibling);
} else {
$dropDashboard->parentNode->appendChild($dragDashboard);
}
$dragDashboard->setAttribute("parentID",$dropDashboard->getAttribute("parentID"));
break;
}
$subDragPublishes = $ProjectXpath->query("./Publishes/Publish[./@parentID = '".$p_dragIDArr[0]."' and ./@User='".utf8_encode($p_dragIDArr[1])."']");
if($subDragPublishes->length>0) {
for($i=0;$i<$subDragPublishes->length;$i++) {
$this->saveDADSectionToSection($p_dragType,$subDragPublishes->item($i)->getAttribute("ID")."_".$p_dragIDArr[1],"section",$dragPublish->getAttribute("ID")."_".$p_dropIDArr[1],"under",$p_action,$ProjectDOM,$ProjectXpath);
}
}
$ProjectDOM->save($MISConfig->getConfigFile());
$this->saveRetrieveInput("dummy");
return array('CMgr.getMODEL().__construct();');
}
private function saveDADSectionToUser($p_dragType,$p_dragID,$p_dropType,$p_dropID,$p_dropOrder,$p_action,$ProjectDOM=null,$ProjectXpath=null) {
$MISConfig = new MISConfig();
if($ProjectDOM == null) {
$ProjectDOM = new DOMDocument('1.0', 'iso-8859-1');
$ProjectDOM->load($MISConfig->getConfigFile());
}
if($ProjectXpath == null) {
$ProjectXpath = new DOMXpath($ProjectDOM);
}
$Project = $ProjectXpath->query("/Configuration")->item(0);
$p_dragIDArr = explode("_",$p_dragID);
if($p_action == "replace") {
$dragPublish = $ProjectXpath->query('./Publishes/Publish[./@ID = "'.$p_dragIDArr[0].'" and ./@User="'.utf8_encode($p_dragIDArr[1]).'"]',$Project)->item(0);
$dragPublish = $dragPublish->parentNode->removeChild($dragPublish);
$dragPublish->setAttribute("User",utf8_encode($p_dropID));
$dragPublish->setAttribute("parentID","");
$ImageList = $dragPublish->getElementsByTagname("Image");
for($i=0;$ImageList->length>$i;$i++) {
$Image = $ImageList->item($i);
$MISConfig->setNodeValue("Directory",$p_dropID."\\",$ProjectDOM,$Image);
if($this->_getView($p_dropID) == "Info-User") {
$MISConfig->setNodeValue("Ansicht",$this->_getView($p_dropID),$ProjectDOM,$Image);
if($Image->getElementsByTagname("Active")->item(0)->nodeValue == "J"){
$MISConfig->setNodeValue("PDFGenerate","J",$ProjectDOM,$Image);
}
}
}
$dragScorecard = $ProjectXpath->query('./Scorecards/Scorecard[./@ID = "'.$p_dragIDArr[0].'" and ./@Directory="'.utf8_encode($p_dragIDArr[1]).'\\"]',$Project)->item(0);
$dragScorecard = $dragScorecard->parentNode->removeChild($dragScorecard);
$dragScorecard->setAttribute("Directory",utf8_encode($p_dropID)."\\");
$dragDashboard = $ProjectXpath->query('./Dashboards/Dashboard[./@ID = "'.$p_dragIDArr[0].'" and ./@Directory="'.utf8_encode($p_dragIDArr[1]).'\\"]',$Project)->item(0);
$dragDashboard = $dragDashboard->parentNode->removeChild($dragDashboard);
$dragDashboard->setAttribute("Directory",utf8_encode($p_dropID)."\\");
} elseif($p_action == "copy") {
$newID = $this->_generateSectionID();
$iDragPublish = $ProjectXpath->query('/Configuration/Publishes/Publish[./@ID = "'.$p_dragIDArr[0].'" and ./@User="'.utf8_encode($p_dragIDArr[1]).'"]')->item(0);
$dragPublish = $iDragPublish->cloneNode(false);
$dragPublish->appendChild($ProjectDOM->createElement("Images"));
$dragPublish->setAttribute("ID",$newID);
$dragPublish->setAttribute("parentID","");
$dragPublish->setAttribute("User",utf8_encode($p_dropID));
$iDragScorecard = $ProjectXpath->query('/Configuration/Scorecards/Scorecard[./@ID = "'.$p_dragIDArr[0].'" and ./@Directory="'.utf8_encode($p_dragIDArr[1]).'\\"]')->item(0);
$dragScorecard = $iDragScorecard->cloneNode(false);
$dragScorecard->appendChild($ProjectDOM->createElement("Reports"));
$dragScorecard->setAttribute("ID",$newID);
$dragScorecard->setAttribute("Directory",utf8_encode($p_dropID)."\\");
$iDragDashboard = $ProjectXpath->query('/Configuration/Dashboards/Dashboard[./@ID = "'.$p_dragIDArr[0].'" and ./@Directory="'.utf8_encode($p_dragIDArr[1]).'\\"]')->item(0);
$dragDashboard = $iDragDashboard->cloneNode(false);
$dragDashboard->appendChild($ProjectDOM->createElement("Reviews"));
$dragDashboard->setAttribute("ID",$newID);
$dragDashboard->setAttribute("Directory",utf8_encode($p_dropID)."\\");
$ImageIDs = array();
$iImageList = $iDragPublish->getElementsByTagname("Image");
foreach($iImageList as $iImage) {
$Image = $iImage->cloneNode(true);
$currentID = $Image->getAttribute("ID");
if(!array_key_exists($currentID,$ImageIDs)) {
$newID = $this->_generateReportID();
$ImageIDs[$currentID] = $newID;
}else{
$newID = $ImageIDs[$currentID];
}
$Image->setAttribute("ID",$newID);
$MISConfig->setNodeValue("Directory",$p_dropID."\\",$ProjectDOM,$Image);
if($this->_getView($p_dropID) == "Info-User") {
$MISConfig->setNodeValue("Ansicht",$this->_getView($p_dropID),$ProjectDOM,$Image);
if($Image->getElementsByTagname("Active")->item(0)->nodeValue == "J"){
$MISConfig->setNodeValue("PDFGenerate","J",$ProjectDOM,$Image);
}
}
$dragPublish->getElementsByTagName("Images")->item(0)->appendChild($Image);
}
//COPY SCORECARDS
$iReportList = $iDragScorecard->getElementsByTagname("Report");
foreach($iReportList as $iReport) {
$Report = $iReport->cloneNode(true);
$Report->setAttribute("ID",$this->_generateReportID());
$dragScorecard->getElementsByTagName("Reports")->item(0)->appendChild($Report);
}
$iReportList = $iDragDashboard->getElementsByTagname("Review");
foreach($iReportList as $iReport) {
$Report = $iReport->cloneNode(true);
$Report->setAttribute("ID",$this->_generateReportID());
$dragDashboard->getElementsByTagName("Reviews")->item(0)->appendChild($Report);
}
}
$dropPublishes = $ProjectXpath->query("./Publishes",$Project)->item(0);
$dropScorecards = $ProjectXpath->query("./Scorecards",$Project)->item(0);
$dropDashboards = $ProjectXpath->query("./Dashboards",$Project)->item(0);
$dropPublishes->appendChild($dragPublish);
$dropScorecards->appendChild($dragScorecard);
$dropDashboards->appendChild($dragDashboard);
$subDragPublishes = $ProjectXpath->query("./Publishes/Publish[./@parentID = '".$p_dragIDArr[0]."' and ./@User='".utf8_encode($p_dragIDArr[1])."']");
if($subDragPublishes->length>0) {
for($i=0;$i<$subDragPublishes->length;$i++) {
$this->saveDADSectionToSection($p_dragType,$subDragPublishes->item($i)->getAttribute("ID")."_".$p_dragIDArr[1],"section",$dragPublish->getAttribute("ID")."_".$p_dropID,"under",$p_action,$ProjectDOM,$ProjectXpath);
}
}
$ProjectDOM->save($MISConfig->getConfigFile());
$this->saveRetrieveInput("dummy");
return array('CMgr.getMODEL().__construct();');
}
private function saveDADUserToUser($p_dragType,$p_dragID,$p_dropType,$p_dropID,$p_dropOrder) {
$MISConfig = new MISConfig();
if($p_dropOrder == "under") {
$ProjectDOM = new DOMDocument('1.0', 'iso-8859-1');
$ProjectDOM->load($MISConfig->getConfigFile());
$ProjectXpath = new DOMXpath($ProjectDOM);
$Project = $ProjectXpath->query('/Configuration')->item(0);
$iDragPublishList = $ProjectXpath->query('./Publishes/Publish[./@User = "'.utf8_encode($p_dragID).'" and ./@parentID = ""]',$Project);
$temp=$iDragPublishList->length;
for($i=0;$temp>$i;$i=$i+1) {
$dragID = $iDragPublishList->item($i)->getAttribute("ID");
$this->saveDADSectionToUser("section",$dragID."_".$p_dragID,"user",$p_dropID,"","copy",$ProjectDOM,$ProjectXpath);
}
$ProjectDOM->save($MISConfig->getConfigFile());
$this->saveRetrieveInput("dummy");
}else {
$UserDOM = new DOMDocument('1.0', 'iso-8859-1');
$UserDOM->load($this->authFile);
$UserXpath = new DOMXpath($UserDOM);
$dragUser = $UserXpath->query("/auth/users/user[@username='".utf8_encode($p_dragID)."' and @setting='".basename($MISConfig->getConfigFile(),".xml")."']")->item(0);
$dropUser = $UserXpath->query("/auth/users/user[@username='".utf8_encode($p_dropID)."' and @setting='".basename($MISConfig->getConfigFile(),".xml")."']")->item(0);
switch($p_dropOrder) {
case "before": $dropUser->parentNode->insertBefore($dragUser,$dropUser);
break;
case "after": if($dropUser->nextSibling != null && !$dropUser->nextSibling->isSameNode($dragUser)) {
$dropUser->parentNode->insertBefore($dragUser,$dropUser->nextSibling);
} else {
$dropUser->parentNode->appendChild($dragUser);
}
break;
}
$UserDOM->save($MISConfig->authFile);
}
return array('CMgr.getMODEL().__construct();');
}
private function saveDADReportToSection($p_dragType,$p_dragID,$p_dropType,$p_dropID,$p_dropOrder,$p_action) {
$MISConfig = new MISConfig();
$ProjectDOM = new DOMDocument('1.0', 'iso-8859-1');
$ProjectDOM->load($MISConfig->getConfigFile());
$projectXpath = new DOMXpath($ProjectDOM);
$p_dragIDArr = explode("_",$p_dragID);
$p_dropIDArr = explode("_",$p_dropID);
$dragPIList = $projectXpath->query("/Configuration/Publishes/Publish/Images/Image[./@ID='".$p_dragIDArr[0]."']");
if($p_dropType == "section") {
$dropPP = $projectXpath->query("/Configuration/Publishes/Publish/Images[./../@ID='".$p_dropIDArr[0]."']")->item(0);
$newID = $this->_generateReportID();
for($i=0;$i<$dragPIList->length;$i++) {
if($p_action == "replace") {
$Image = $dragPIList->item($i);
$MISConfig->setNodeValue("Directory",$p_dropIDArr[1]."\\",$ProjectDOM,$Image);
if($this->_getView($p_dropIDArr[1]) == "Info-User") {
$MISConfig->setNodeValue("Ansicht",$this->_getView($p_dropIDArr[1]),$ProjectDOM,$Image);
if($Image->getElementsByTagname("Active")->item(0)->nodeValue == "J"){
$MISConfig->setNodeValue("PDFGenerate","J",$ProjectDOM,$Image);
}
}
$dropPP->appendChild($Image);
} else if($p_action == "copy") {
$Image = $dragPIList->item($i)->cloneNode(true);
$Image->setAttribute("ID",$newID);
$MISConfig->setNodeValue("Directory",$p_dropIDArr[1]."\\",$ProjectDOM,$Image);
if($this->_getView($p_dropIDArr[1]) == "Info-User") {
$MISConfig->setNodeValue("Ansicht",$this->_getView($p_dropIDArr[1]),$ProjectDOM,$Image);
if($Image->getElementsByTagname("Active")->item(0)->nodeValue == "J"){
$MISConfig->setNodeValue("PDFGenerate","J",$ProjectDOM,$Image);
}
}
$dropPP->appendChild($Image);
}
}
}else if($p_dropType == "report") {
$dropPI = $projectXpath->query("/Configuration/Publishes/Publish/Images/Image[./@ID='".$p_dropIDArr[0]."' and Active='J']")->item(0);
$newID = $this->_generateReportID();
for($i=0;$i<$dragPIList->length;$i++) {
if($p_action == "replace") {
$Image = $dragPIList->item($i);
// $MISConfig->setNodeValue("Directory",$p_dropIDArr[1]."\\",$ProjectDOM,$Image);
/* if($this->_getView($p_dropIDArr[1]) == "Info-User") {
$MISConfig->setNodeValue("Ansicht",$this->_getView($p_dropIDArr[1]),$ProjectDOM,$Image);
if($Image->getElementsByTagname("Active")->item(0)->nodeValue == "J"){
$MISConfig->setNodeValue("PDFGenerate","J",$ProjectDOM,$Image);
}
}
*/ $dragPIArr[] = $Image;
} else if($p_action == "copy") {
$Image = $dragPIList->item($i)->cloneNode(true);
$newPI->setAttribute("ID",$newID);
// $MISConfig->setNodeValue("Directory",$p_dropIDArr[1]."\\",$ProjectDOM,$Image);
/* if($this->_getView($p_dropIDArr[1]) == "Info-User") {
$MISConfig->setNodeValue("Ansicht",$this->_getView($p_dropIDArr[1]),$ProjectDOM,$Image);
if($Image->getElementsByTagname("Active")->item(0)->nodeValue == "J"){
$MISConfig->setNodeValue("PDFGenerate","J",$ProjectDOM,$Image);
}
}
*/ $dragPIArr[] = $Image;
}
}
foreach($dragPIArr as $key => $PI) {
switch($p_dropOrder) {
case "before": $dropPI->parentNode->insertBefore($PI,$dropPI);
break;
case "after": if($dropPI->nextSibling != null && !$dropPI->nextSibling->isSameNode($PI)) {
$dropPI->parentNode->insertBefore($PI,$dropPI->nextSibling);
} else {
$dropPI->parentNode->appendChild($PI);
}
break;
}
}
}
$ProjectDOM->save($MISConfig->getConfigFile());
$this->saveRetrieveInput("dummy");
return array('CMgr.getMODEL().abortRetrieveInput();Ajax.request(MISConfigurator.__toString(),"configReportsForm","'.utf8_encode($_SESSION["configurator"]["publishes"]["section"]).'",MISConfigurator.configReportsFormCb);');
}
private function saveDADScorecardToSection($p_dragType,$p_dragID,$p_dropType,$p_dropID,$p_dropOrder,$p_action) {
$MISConfig = new MISConfig();
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load($MISConfig->getConfigFile());
$projectXpath = new DOMXpath($projectDOM);
$p_dragIDArr = explode("_",$p_dragID);
$p_dropIDArr = explode("_",$p_dropID);
$dragPR = $projectXpath->query("/Configuration/Scorecards/Scorecard/Reports/Report[./@ID='".$p_dragIDArr[0]."']")->item(0);
if($p_dropType == "section") {
$PRsList = $projectXpath->query("/Configuration/Scorecards/Scorecard/Reports[./../@ID='".$p_dropIDArr[0]."' and ./../@Directory='".utf8_encode($p_dropIDArr[1])."\\']");
$PPName = $projectXpath->query("/Configuration/Publishes/Publish[./@ID='".$p_dropIDArr[0]."']")->item(0)->getAttribute("Name");
if($PRsList->length > 0) {
$dropPRs = $PRsList->item(0);
}else{
$PS = $projectDOM->createElement("Scorecard");
$PS->setAttribute("Directory",utf8_encode($p_dropIDArr[1])."\\");
$PS->setAttribute("ID",$p_dropIDArr[0]);
$PS->setAttribute("Name",$PPName);
$dropPRs = $projectDOM->createElement("Reports");
$PS->appendChild($dropPRs);
$PSs = $projectXpath->query("/Configuration/Scorecards")->item(0);
$PSs->appendChild($PS);
}
$newID = $this->_generateReportID();
if($p_action == "replace") {
$dropPRs->appendChild($dragPR);
} else if($p_action == "copy") {
$newPR = $dragPR->cloneNode(true);
$newPR->setAttribute("ID",$newID);
//$MISConfig->setNodeValue("Directory",$p_dropIDArr[1]."\\",$projectDOM,$newPR);
$dropPRs->appendChild($newPR);
}
}else if($p_dropType == "scorecard") {
$dropPR = $projectXpath->query("/Configuration/Scorecards/Scorecard/Reports/Report[./@ID='".$p_dropIDArr[0]."']")->item(0);
$newID = $this->_generateReportID();
if($p_action == "replace") {
$newPR = $dragPR;
} else if($p_action == "copy") {
$newPR = $dragPR->cloneNode(true);
$newPR->setAttribute("ID",$newID);
}
switch($p_dropOrder) {
case "before": $dropPR->parentNode->insertBefore($newPR,$dropPR);
break;
case "after": if($dropPR->nextSibling != null && !$dropPR->nextSibling->isSameNode($newPR)) {
$dropPR->parentNode->insertBefore($newPR,$dropPR->nextSibling);
} else {
$dropPR->parentNode->appendChild($newPR);
}
break;
}
}
$projectDOM->save($MISConfig->getConfigFile());
$this->saveRetrieveInput("dummy");
return array('CMgr.getMODEL().abortRetrieveInput();Ajax.request(MISConfigurator.__toString(),"configScorecardsForm","'.utf8_encode($_SESSION["configurator"]["publishes"]["section"]).'",MISConfigurator.configScorecardsFormCb);');
}
private function saveDADDashboardToSection($p_dragType,$p_dragID,$p_dropType,$p_dropID,$p_dropOrder,$p_action) {
$MISConfig = new MISConfig();
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load($MISConfig->getConfigFile());
$projectXpath = new DOMXpath($projectDOM);
$p_dragIDArr = explode("_",$p_dragID);
$p_dropIDArr = explode("_",$p_dropID);
$dragPR = $projectXpath->query("/Configuration/Dashboards/Dashboard/Reviews/Review[./@ID='".$p_dragIDArr[0]."']")->item(0);
if($p_dropType == "section") {
$PRsList = $projectXpath->query("/Configuration/Dashboards/Dashboard/Reviews[./../@ID='".$p_dropIDArr[0]."' and ./../@Directory='".utf8_encode($p_dropIDArr[1])."\\']");
$PPName = $projectXpath->query("/Configuration/Publishes/Publish[./@ID='".$p_dropIDArr[0]."']")->item(0)->getAttribute("Name");
if($PRsList->length > 0) {
$dropPRs = $PRsList->item(0);
}else{
$PS = $projectDOM->createElement("Dashboard");
$PS->setAttribute("Directory",utf8_encode($p_dropIDArr[1])."\\");
$PS->setAttribute("ID",$p_dropIDArr[0]);
$PS->setAttribute("Name",$PPName);
$dropPRs = $projectDOM->createElement("Reviews");
$PS->appendChild($dropPRs);
$PSs = $projectXpath->query("/Configuration/Dashboards")->item(0);
$PSs->appendChild($PS);
}
$newID = $this->_generateReportID();
if($p_action == "replace") {
$dropPRs->appendChild($dragPR);
} else if($p_action == "copy") {
$newPR = $dragPR->cloneNode(true);
$newPR->setAttribute("ID",$newID);
$MISConfig->setNodeValue("Directory",$p_dropIDArr[1]."\\",$projectDOM,$newPR);
$dropPRs->appendChild($newPR);
}
}else if($p_dropType == "dashboard") {
$dropPR = $projectXpath->query("/Configuration/Dashboards/Dashboard/Reviews/Review[./@ID='".$p_dropIDArr[0]."']")->item(0);
$newID = $this->_generateReportID();
if($p_action == "replace") {
$newPR = $dragPR;
} else if($p_action == "copy") {
$newPR = $dragPR->cloneNode(true);
$newPR->setAttribute("ID",$newID);
}
switch($p_dropOrder) {
case "before": $dropPR->parentNode->insertBefore($newPR,$dropPR);
break;
case "after": if($dropPR->nextSibling != null && !$dropPR->nextSibling->isSameNode($newPR)) {
$dropPR->parentNode->insertBefore($newPR,$dropPR->nextSibling);
} else {
$dropPR->parentNode->appendChild($newPR);
}
break;
}
}
$projectDOM->save($MISConfig->getConfigFile());
$this->saveRetrieveInput("dummy");
return array('CMgr.getMODEL().abortRetrieveInput();Ajax.request(MISConfigurator.__toString(),"configDashboardsForm","'.utf8_encode($_SESSION["configurator"]["publishes"]["section"]).'",MISConfigurator.configDashboardsFormCb);');
}
private function dummy(){}
private function _generateSectionID() {
$MISConfig = new MISConfig();
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load($MISConfig->getConfigFile());
$projectXpath = new DOMXpath($projectDOM);
$ID = null;
while($ID == null) {
$temp = mt_rand(0,99999);
if($projectXpath->query('/Configuration/Publishes/Publish[./@ID = "'.$temp.'"]')->length == 0
&& !in_array($temp,self::$generatedSectionIDs)) {
self::$generatedSectionIDs[] = $temp;
$ID = $temp;
}
}
return $ID;
}
private function _generateReportID() {
$MISConfig = new MISConfig();
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load($MISConfig->getConfigFile());
$projectXpath = new DOMXpath($projectDOM);
$ID = null;
while($ID == null) {
$temp = mt_rand(0,99999);
if($projectXpath->query('/Configuration/Publishes/Publish/Images/Image[./@ID = "'.$temp.'"]')->length == 0
&& $projectXpath->query('/Configuration/Scorecards/Scorecard/Reports/Report[./@ID = "'.$temp.'"]')->length == 0
&& $projectXpath->query('/Configuration/General/Dashboards/Dashboard/Review[./@ID = "'.$temp.'"]')->length == 0
&& !in_array($temp,self::$generatedReportIDs)) {
self::$generatedReportIDs[] = $temp;
$ID = $temp;
}
}
return $ID;
}
public function getReport($p_reportID) {
if($this->getAuth() && $this->isRole("admin")) {
$p_args = func_get_args();
$MISConfig = new MISConfig();
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load($MISConfig->getConfigFile());
$projectXpath = new DOMXpath($projectDOM);
$report = $projectXpath->query("/Configuration/Publishes/Publish/Images/Image[./Active = 'J' and ./@ID = '".$p_reportID."']")->item(0);
$name = $report->getElementsByTagName("Report")->item(0)->nodeValue;
$reportPath = $projectXpath->query("/Configuration/General/ReportPath")->item(0)->nodeValue;
$ppx = $report->getElementsByTagName("ppx")->item(0)->nodeValue;
if($ppx == "J" && file_exists($reportPath.$name.".ppx")) $filename = utf8_decode($reportPath.$name.".ppx");
else $filename = utf8_decode($reportPath.$name.".ppr");
$file_extension = strtolower(substr(strrchr($filename,"."),1));
switch ($file_extension) {
case "pdf": $ctype="application/pdf"; break;
case "exe": $ctype="application/octet-stream"; break;
case "zip": $ctype="application/zip"; break;
case "doc": $ctype="application/msword"; break;
case "xls": $ctype="application/vnd.ms-excel"; break;
case "ppt": $ctype="application/vnd.ms-powerpoint"; break;
case "gif": $ctype="image/gif"; break;
case "png": $ctype="image/png"; break;
case "jpe": case "jpeg":
case "jpg": $ctype="image/jpeg"; break;
case "ppr": $ctype="application/powerplay"; break;
case "ppx": $ctype="application/powerplay"; break;
default: $ctype="text";
}
if (!file_exists($filename)) {
die("");
}
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private",false);
header("Content-Type: $ctype");
header("Content-Disposition: attachment; filename=\"".basename($filename)."\";");
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".@filesize($filename));
set_time_limit(0);
readfile($filename) or die("File not found.");
}else{
print "";
}
}
public function getScorecard($p_reportID) {
if($this->getAuth()) {
$p_args = func_get_args();
$MISConfig = new MISConfig();
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load($MISConfig->getConfigFile());
$projectXpath = new DOMXpath($projectDOM);
$report = $projectXpath->query("/Configuration/Scorecards/Scorecard/Reports/Report[@ID = '".$p_reportID."']")->item(0);
//$ansicht = $report->getElementsByTagName("Ansicht")->item(0)->nodeValue;
$ansicht = $this->_getView();
$name = $report->getElementsByTagName("ReportFile")->item(0)->nodeValue;
$reportPath = $projectXpath->query("/Configuration/General/ReportPath")->item(0)->nodeValue;
$filename = $reportPath.$name.".ppr";
$file_extension = strtolower(substr(strrchr($filename,"."),1));
switch ($file_extension) {
case "pdf": $ctype="application/pdf"; break;
case "exe": $ctype="application/octet-stream"; break;
case "zip": $ctype="application/zip"; break;
case "doc": $ctype="application/msword"; break;
case "xls": $ctype="application/vnd.ms-excel"; break;
case "ppt": $ctype="application/vnd.ms-powerpoint"; break;
case "gif": $ctype="image/gif"; break;
case "png": $ctype="image/png"; break;
case "jpe": case "jpeg":
case "jpg": $ctype="image/jpeg"; break;
case "ppr": $ctype="application/powerplay"; break;
default: $ctype="text";
}
if (!file_exists($filename)) {
die("");
}
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private",false);
header("Content-Type: $ctype");
header("Content-Disposition: attachment; filename=\"".basename($filename)."\";");
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".@filesize($filename));
set_time_limit(0);
readfile($filename) or die("File not found.");
}else{
print "";
}
}
public function getDashboard($p_reportID) {
if($this->getAuth()) {
$p_args = func_get_args();
$MISConfig = new MISConfig();
$projectDOM = new DOMDocument('1.0', 'iso-8859-1');
$projectDOM->load($MISConfig->getConfigFile());
$projectXpath = new DOMXpath($projectDOM);
$report = $projectXpath->query("/Configuration/Dashboards/Dashboard/Reviews/Review[@ID = '".$p_reportID."']")->item(0);
//$ansicht = $report->getElementsByTagName("Ansicht")->item(0)->nodeValue;
$ansicht = $this->_getView();
$name = $report->getElementsByTagName("ReportFile")->item(0)->nodeValue;
$reportPath = $projectXpath->query("/Configuration/General/DashboardPath")->item(0)->nodeValue;
$filename = $reportPath.$name.".xls";
$file_extension = strtolower(substr(strrchr($filename,"."),1));
switch ($file_extension) {
case "pdf": $ctype="application/pdf"; break;
case "exe": $ctype="application/octet-stream"; break;
case "zip": $ctype="application/zip"; break;
case "doc": $ctype="application/msword"; break;
case "xls": $ctype="application/vnd.ms-excel"; break;
case "ppt": $ctype="application/vnd.ms-powerpoint"; break;
case "gif": $ctype="image/gif"; break;
case "png": $ctype="image/png"; break;
case "jpe": case "jpeg":
case "jpg": $ctype="image/jpeg"; break;
case "ppr": $ctype="application/powerplay"; break;
default: $ctype="text";
}
if (!file_exists($filename)) {
die("");
}
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private",false);
header("Content-Type: $ctype");
header("Content-Disposition: attachment; filename=\"".basename($filename)."\";");
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".@filesize($filename));
set_time_limit(0);
readfile($filename) or die("File not found.");
}else{
print "";
}
}
}
?>