getDataArray($strSQL,$arrDataLines,$intDataCount); // // Store data to session // ============================ if ($chkMode == "") { $_SESSION['templatedefinition'] = ""; if ($booReturn && ($intDataCount != 0)) { foreach ($arrDataLines AS $elem) { if ($elem['idTable'] == 1) { $strSQL2 = "SELECT `template_name` FROM `tbl_".$chkPreTab."template` WHERE `id` = ".$elem['idSlave']; $strSQL3 = "SELECT `active` FROM `tbl_".$chkPreTab."template` WHERE `id` = ".$elem['idSlave']; } else { $strSQL2 = "SELECT `name` FROM `tbl_".$chkPreTab."` WHERE `id` = ".$elem['idSlave']; $strSQL3 = "SELECT `active` FROM `tbl_".$chkPreTab."` WHERE `id` = ".$elem['idSlave']; } $arrTemp['idSlave'] = $elem['idSlave']; $arrTemp['definition'] = addslashes($myDBClass->getFieldData($strSQL2)); $arrTemp['idTable'] = $elem['idTable']; $arrTemp['idSort'] = $elem['idSort']; $arrTemp['active'] = $myDBClass->getFieldData($strSQL3)+0; $arrTemp['status'] = 0; $_SESSION['templatedefinition'][] = $arrTemp; } } } } // // Add mode // ======== if ($chkMode == "add") { if ($arrDefinition[1] == 1) { $strSQL2 = "SELECT `template_name` FROM `tbl_".$chkPreTab."template` WHERE `id` = ".$arrDefinition[0]; $strSQL3 = "SELECT `active` FROM `tbl_".$chkPreTab."template` WHERE `id` = ".$arrDefinition[0]; } else { $strSQL2 = "SELECT `name` FROM `tbl_".$chkPreTab."` WHERE `id` = ".$arrDefinition[0]; $strSQL3 = "SELECT `active` FROM `tbl_".$chkPreTab."` WHERE `id` = ".$arrDefinition[0]; } if (isset($_SESSION['templatedefinition']) && is_array($_SESSION['templatedefinition'])) { $intCheck = 0; foreach ($_SESSION['templatedefinition'] AS $key => $elem) { if (($elem['idSlave'] == $arrDefinition[0]) && ($elem['idTable'] == $arrDefinition[1]) && ($elem['status'] == 0)) { $intCheck = 1; } } if ($intCheck == 0) { $arrTemp['idSlave'] = $arrDefinition[0]; $arrTemp['definition'] = addslashes($myDBClass->getFieldData($strSQL2)); $arrTemp['idTable'] = $arrDefinition[1]; $arrTemp['idSort'] = 0; $arrTemp['status'] = 0; $arrTemp['active'] = $myDBClass->getFieldData($strSQL3)+0; $_SESSION['templatedefinition'][] = $arrTemp; } } else { $arrTemp['idSlave'] = $arrDefinition[0]; $arrTemp['definition'] = addslashes($myDBClass->getFieldData($strSQL2)); $arrTemp['idTable'] = $arrDefinition[1]; $arrTemp['idSort'] = 0; $arrTemp['status'] = 0; $arrTemp['active'] = $myDBClass->getFieldData($strSQL3)+0; $_SESSION['templatedefinition'][] = $arrTemp; } } // // Deletion mode // ============= if ($chkMode == "del") { if (isset($_SESSION['templatedefinition']) && is_array($_SESSION['templatedefinition'])) { foreach ($_SESSION['templatedefinition'] AS $key => $elem) { if (($elem['idSlave'] == $arrDefinition[0]) && ($elem['idTable'] == $arrDefinition[1]) && ($elem['status'] == 0)) { $_SESSION['templatedefinition'][$key]['status'] = 1; } } } } // // Sort mode // ========= if ($chkMode == "sortup") { if (isset($_SESSION['templatedefinition']) && is_array($_SESSION['templatedefinition'])) { $arrTemp = ""; $arrWait = ""; $intNow = 0; foreach ($_SESSION['templatedefinition'] AS $key => $elem) { if ($key != ($chkKey-1)) { $arrTemp[] = $elem; if ($intNow == 1) { $intNow = 0; $arrTemp[] = $arrWait; } } else { $arrWait = $elem; $intNow = 1; } } $_SESSION['templatedefinition'] = $arrTemp; } } if ($chkMode == "sortdown") { if (isset($_SESSION['templatedefinition']) && is_array($_SESSION['templatedefinition'])) { $arrTemp = ""; $arrWait = ""; $intNow = 0; foreach ($_SESSION['templatedefinition'] AS $key => $elem) { if ($key != $chkKey) { $arrTemp[] = $elem; if ($intNow == 1) { $intNow = 0; $arrTemp[] = $arrWait; } } else { $arrWait = $elem; $intNow = 1; } } $_SESSION['templatedefinition'] = $arrTemp; } } // // Clean up data structure // ======================= if (isset($_SESSION['templatedefinition']) && is_array($_SESSION['templatedefinition'])) { $arrTemp = ""; foreach ($_SESSION['templatedefinition'] AS $key => $elem) { if ($elem['status'] == 0) { $arrTemp[] = $elem; } } $_SESSION['templatedefinition'] = $arrTemp; } ?>
')" style="cursor:pointer"> ')" style="cursor:pointer"> ')" style="cursor:pointer"> | |