} /** This is for Check Duplicate Record-------------------------------------------*/ $generalobj->getRequestVars(); $redirect_file = "index.php?file={$file}&view={$view}&iFormatId={$iFormatId}"; $generalobj->checkDuplicate('iFormatId', PRJ_DB_PREFIX . "_email_template", array('vSub' => $Data['vSub']), $redirect_file, SUBJECT_ALREADY_EXISTS, $iFormatId); if ($view == "add") { //prints($Data);exit; $emailTempObj->setAllVar($Data); $result = $emailTempObj->insert(); if ($result) { $var_msg = "Record Added Successfully."; } else { $var_msg = "Eror-in Add."; } } else { if ($view == "edit") { //prints($Data);exit; $arr = $emailTempObj->select($iFormatId); $emailTempObj->setAllVar($arr); $emailTempObj->setAllVar($Data); $where = " iFormatId = '" . $iFormatId . "'"; $result = $emailTempObj->update($where); if ($result) { $var_msg = "Record Updated Successfully."; } else { $var_msg = "Eror-in Update."; } } } header("Location:index.php?file=" . $actionfile . "&view=index&AX=Yes&var_msg={$var_msg}"); exit;
$obj = new EmailTemplate($id); $id_to_show_if_new = 'NEW'; if (isset($_POST['me_action'])) { if ($_POST['me_action'] == 'SAVEDATA') { $template_id = tep_db_prepare_input($_POST['template_id']); $name = tep_db_prepare_input($_POST['template_name']); $info = tep_db_prepare_input($_POST['template_info']); $info_technical = tep_db_prepare_input($_POST['template_info_technical']); $default_languages_id = tep_db_prepare_input($_POST['default_languages_id']); $ajaxResult = array(); if ($template_id == $id_to_show_if_new) { $obj->create($name, $info, $info_technical, $default_languages_id); $ajaxResult['id'] = is_null($obj->id) ? '0' : $obj->id; $ajaxResult['action'] = $id_to_show_if_new; } else { $obj->update($name, $info, $info_technical, $default_languages_id); $ajaxResult['id'] = $template_id; $ajaxResult['action'] = 'UPDATED'; } echo ajaxReturn($ajaxResult); exit; } elseif ($_POST['me_action'] == 'DELETEDATA') { $template_id = tep_db_prepare_input($_POST['template_id']); if ($template_id != $id_to_show_if_new && $template_id == $obj->id) { $obj->delete(); } echo is_null($obj->id) ? '1' : '0'; exit; } elseif ($_POST['me_action'] == 'ADDLANGUAGE') { $languages_id = tep_db_prepare_input($_POST['languages_id']); $obj->addContent($languages_id);
function admindeleteemailAction() { $this->_helper->layout->disableLayout(); $emailTemplate = new EmailTemplate(); $emailTemplate->update(array("delete" => 1), 'id = ' . $this->_request->getParam('id')); }