break; case "edit": $macroObj = $schedObjs[$_GET['line']]; $tpl_edit = new Template(TPL_FILE_LOCATION . 'macro_edit.tpl'); $tpl_edit->set('lang', $lang); $tpl_edit->set('theMacro', $macroObj); $tpl_body->set('form', $tpl_edit); break; case "add": // if macro exist then don't add the macro else create macro lines, // add them to file $sm = get_specific_macro($macros, label_parse($_POST["macro_name"], true)); if (!$sm) { $aMacro = new Macro(); $aMacro->setLabel(label_parse($_POST["macro_name"], true)); $aMacro->setCommand($_POST["macro_command"]); if ($_POST["status"] == COMMENT_SIGN_D) { $aMacro->setEnabled(false); } else { $aMacro->setEnabled(true); } $aMacro->rebuildElementLine(); $heyusched->addElement($aMacro); $mustSave = true; } break; case "save": //build macro line with POST results $schedObjs[$_POST["line"]]->setLabel(label_parse($_POST["macro_name"], true)); $schedObjs[$_POST["line"]]->setCommand($_POST["macro_command"]); if ($_POST["status"] == COMMENT_SIGN_D) {
$sm = get_specific_macros($macros, $aTimer->getStartMacro(), $aTimer->getStopMacro()); if ($sm) { change_macro_states($sm, "enable"); } else { if ($aTimer->getStartMacro() != "null") { $onMacroObj = new Macro(); $onMacroObj->setLabel($aTimer->getStartMacro()); $onMacroObj->setCommand("on " . $_POST["module"]); $onMacroObj->rebuildElementLine(); $heyusched->addElement($onMacroObj); $i++; } if ($aTimer->getStopMacro() != "null") { $offMacroObj = new Macro(); $offMacroObj->setLabel($aTimer->getStopMacro()); $offMacroObj->setCommand("off " . $_POST["module"]); $offMacroObj->rebuildElementLine(); $heyusched->addElement($offMacroObj); $i++; } } $heyusched->addElement($aTimer); $mustSave = true; break; case "save": //build timer line with POST results post_data_to_timer($schedObjs[$_POST["line"]]); $schedObjs[$_POST["line"]]->rebuildElementLine(); $mustSave = true; break; case "del":