public function saveFollowUpType() { $this->log->showLog(2, "Access saveFollowUpType()"); // die; global $xoopsDB, $saveHandler, $createdby, $timestamp, $defaultorganization_id; $tablename = "sim_followuptype"; $pkey = "followuptype_id"; $keyword = "FollowUpType"; $controlfieldname = "followuptype_name"; $insertCount = $saveHandler->ReturnInsertCount(); $this->log->showLog(3, "Start Insert({$insertCount} records)"); if ($insertCount > 0) { $arrfield = array($controlfieldname, "description", "isactive", "defaultlevel", "created", "createdby", "updated", "updatedby", "organization_id"); $arrfieldtype = array('%s', '%s', '%d', '%d', '%s', '%d', '%s', '%d', '%d'); // Yes there are INSERTs to perform... for ($currentRecord = 0; $currentRecord < $insertCount; $currentRecord++) { $arrvalue = array($saveHandler->ReturnInsertField($currentRecord, $controlfieldname), $saveHandler->ReturnInsertField($currentRecord, "description"), $saveHandler->ReturnInsertField($currentRecord, "isactive"), $saveHandler->ReturnInsertField($currentRecord, "defaultlevel"), $timestamp, $createdby, $timestamp, $createdby, $defaultorganization_id); $controlvalue = $saveHandler->ReturnInsertField($currentRecord, $controlfieldname); $this->InsertRecord($tablename, $arrfield, $arrvalue, $arrfieldtype, $controlvalue, $pkey); // Now we execute this query } } $updateCount = $saveHandler->ReturnUpdateCount(); $this->log->showLog(3, "Start update({$updateCount} records)"); if ($updateCount > 0) { $arrfield = array($controlfieldname, "description", "isactive", "defaultlevel", "updated", "updatedby", "isdeleted"); $arrfieldtype = array('%s', '%s', '%d', '%d', '%s', '%d', '%d'); // Yes there are UPDATEs to perform... for ($currentRecord = 0; $currentRecord < $updateCount; $currentRecord++) { $arrvalue = array($saveHandler->ReturnUpdateField($currentRecord, $controlfieldname), $saveHandler->ReturnUpdateField($currentRecord, "description"), $saveHandler->ReturnUpdateField($currentRecord, "isactive"), $saveHandler->ReturnUpdateField($currentRecord, "defaultlevel"), $timestamp, $createdby, $saveHandler->ReturnUpdateField($currentRecord, "isdeleted")); $controlvalue = $saveHandler->ReturnUpdateField($currentRecord, $controlfieldname); $this->UpdateRecord($tablename, $pkey, $saveHandler->ReturnUpdateField($currentRecord), $arrfield, $arrvalue, $arrfieldtype, $controlvalue); } } $ispurge = 0; $deleteCount = $saveHandler->ReturnDeleteCount(); $this->log->showLog(3, "Start delete/purge({$deleteCount} records)"); $classname = "class/{$keyword}.inc.php"; include $classname; $this->log->showLog(3, "Include {$classname} successfully"); $o = new FollowUpType(); $this->log->showLog(3, "Inilialize {$keyword}()"); if ($deleteCount > 0) { for ($currentRecord = 0; $currentRecord < $deleteCount; $currentRecord++) { $record_id = $saveHandler->ReturnDeleteField($currentRecord); $o->fetchFollowUpType($record_id); $controlvalue = $o->followuptype_name; $isdeleted = $o->isdeleted; if ($o->allowDelete($record_id)) { $this->DeleteRecord($tablename, $pkey, $record_id, $controlvalue, $isdeleted); } else { $this->failfeedback .= "Cannot delete {$keyword}: {$o->followuptype_name} <br/>"; } } } //$this->failfeedback.="asdasdpasd<br/>\n"; //$this->failfeedback.="123 3443<br/>\n"; //$this->failfeedback.="234 45656523 234<br/>\n"; if ($this->failfeedback != "") { $this->failfeedback .= "Warning!<br/>\n" . $this->failfeedback; } $saveHandler->setErrorMessage($this->failfeedback); $saveHandler->CompleteSave(); }
<?php // include_once ('../../mainfile.php'); // include_once (XOOPS_ROOT_PATH.'/header.php'); include "system.php"; include "menu.php"; include "class/nitobi.xml.php"; include "class/FollowUpType.inc.php"; $followuptype = new FollowUpType(); $xoTheme->addScript('browse.php?Frameworks/jquery/jquery.js'); $followuptype->showSearchForm(); if ($havewriteperm == 1) { $permctrl = " rowinsertenabled=\"true\" rowdeleteenabled=\"true\" toolbarenabled=\"true\" "; } else { $permctrl = " rowinsertenabled=\"false\" autosaveenabled=\"false\" rowdeleteenabled=\"false\" toolbarenabled=\"false\" "; } echo <<<EOF <link rel="stylesheet" href="include/nitobi/nitobi.grid/nitobi.grid.css" type="text/css" /> <script type="text/javascript" src="include/nitobi/nitobi.toolkit.js"></script> <script type="text/javascript" src="include/nitobi/nitobi.grid/nitobi.grid.js"></script> <script type="text/javascript" src="include/firefox3_6fix.js"></script> <script language="javascript" type="text/javascript"> jQuery(document).ready((function (){nitobi.loadComponent('DataboundGrid');})); function init(){} function search(){ var grid = nitobi.getGrid("DataboundGrid"); var searchfollowuptype_name=document.getElementById("searchfollowuptype_name").value;