public function saveWindow()
 {
     $this->log->showLog(2, "Access saveWindow");
     global $xoopsDB, $saveHandler, $createdby, $timestamp;
     $tablename = "sim_window";
     $insertCount = $saveHandler->ReturnInsertCount();
     $this->log->showLog(3, "Start Insert({$insertCount} records)");
     if ($insertCount > 0) {
         $arrfield = array("window_name", "mid", "parentwindows_id", "description", "windowsetting", "filename", "isactive", "seqno", "created", "createdby", "updated", "updatedby");
         $arrfieldtype = array('%s', '%d', '%d', '%s', '%s', '%s', '%d', '%d', '%s', '%d', '%s', '%d');
         // Yes there are INSERTs to perform...
         for ($currentRecord = 0; $currentRecord < $insertCount; $currentRecord++) {
             $arrvalue = array($saveHandler->ReturnInsertField($currentRecord, "window_name"), $saveHandler->ReturnInsertField($currentRecord, "mid"), $saveHandler->ReturnInsertField($currentRecord, "parentwindows_id"), $saveHandler->ReturnInsertField($currentRecord, "description"), $saveHandler->ReturnInsertField($currentRecord, "windowsetting"), $saveHandler->ReturnInsertField($currentRecord, "filename"), $saveHandler->ReturnInsertField($currentRecord, "isactive"), $saveHandler->ReturnInsertField($currentRecord, "seqno"), $timestamp, $createdby, $timestamp, $createdby);
             $controlvalue = $saveHandler->ReturnInsertField($currentRecord, "window_name");
             $this->InsertRecord($tablename, $arrfield, $arrvalue, $arrfieldtype, $controlvalue, "window_id");
             // Now we execute this query
         }
     }
     $updateCount = $saveHandler->ReturnUpdateCount();
     $this->log->showLog(3, "Start update({$updateCount} records)");
     if ($updateCount > 0) {
         $arrfield = array("window_name", "mid", "parentwindows_id", "description", "windowsetting", "filename", "isactive", "seqno", "updated", "updatedby", "isdeleted");
         $arrfieldtype = array('%s', '%d', '%d', '%s', '%s', '%s', '%d', '%d', '%s', '%d', '%d');
         // Yes there are UPDATEs to perform...
         for ($currentRecord = 0; $currentRecord < $updateCount; $currentRecord++) {
             $arrvalue = array($saveHandler->ReturnUpdateField($currentRecord, "window_name"), $saveHandler->ReturnUpdateField($currentRecord, "mid"), $saveHandler->ReturnUpdateField($currentRecord, "parentwindows_id"), $saveHandler->ReturnUpdateField($currentRecord, "description"), $saveHandler->ReturnUpdateField($currentRecord, "windowsetting"), $saveHandler->ReturnUpdateField($currentRecord, "filename"), $saveHandler->ReturnUpdateField($currentRecord, "isactive"), $saveHandler->ReturnUpdateField($currentRecord, "seqno"), $timestamp, $createdby, $saveHandler->ReturnUpdateField($currentRecord, "isdeleted"));
             $controlvalue = $saveHandler->ReturnUpdateField($currentRecord, "window_name");
             $this->UpdateRecord($tablename, "window_id", $saveHandler->ReturnUpdateField($currentRecord), $arrfield, $arrvalue, $arrfieldtype, $controlvalue);
         }
     }
     $ispurge = 0;
     $deleteCount = $saveHandler->ReturnDeleteCount();
     $this->log->showLog(3, "Start delete/purge({$deleteCount} records)");
     include "../class/Window.inc.php";
     $window = new Window();
     if ($deleteCount > 0) {
         for ($currentRecord = 0; $currentRecord < $deleteCount; $currentRecord++) {
             $record_id = $saveHandler->ReturnDeleteField($currentRecord);
             $window->fetchWindow($record_id);
             $controlvalue = $window->window_name;
             $isdeleted = $window->isdeleted;
             $this->DeleteRecord("sim_window", "window_id", $record_id, $controlvalue, $isdeleted);
         }
     }
     //$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();
 }
Beispiel #2
0
<?php

include_once "system.php";
include_once XOOPS_ROOT_PATH . '/modules/simantz/class/Window.inc.php';
$window = new Window();
$action = $_REQUEST['action'];
$window->updated = date("Y-m-d H:i:s", time());
$window->updatedby = $xoopsUser->getVar("uid");
switch ($action) {
    case "ajaxfetch":
        if ($window->fetchWindow($_REQUEST['window_id'])) {
            $window->returnWindowXML();
        } else {
            echo "<xml><errortext>Cannot retrieve window_id:" . $_REQUEST['window_id'] . "</errortext></xml>";
        }
        break;
    case "ajaxgetmodulewindows":
        $window->mid = $_REQUEST['mid'];
        echo $window->showParentWindowsTree($window->mid);
        break;
    case "ajaxdelete":
        $window->window_id = $_REQUEST['window_id'];
        if (!$window->deleteWindow($window->window_id)) {
            echo "Warning! Cannot delete this window due to unknown reason.";
        }
        break;
    case "ajaxsave":
        //print_r($_POST);
        $window->window_id = $_POST['window_id'];
        $window->window_name = $_POST['window_name'];
        if ($_POST['isactive'] == 'on') {
Beispiel #3
0
         } else {
             $token = $s->createToken($tokenlife, "CREATE_WDW");
             $o->getInputForm("new", -1, $token);
             $o->showWindowTable();
         }
     } else {
         // if the token is not valid or the token is expired, it back to previous form with previous inputed data
         $token = $s->createToken($tokenlife, "CREATE_WDW");
         $o->getInputForm("new", -1, $token);
         $o->showWindowTable();
     }
     break;
     //when user request to edit particular organization
 //when user request to edit particular organization
 case "edit":
     if ($o->fetchWindow($o->window_id)) {
         //create a new token for editing a form
         $token = $s->createToken($tokenlife, "CREATE_WDW");
         $o->getInputForm("edit", $o->window, $token);
         $o->showWindowTable("WHERE window_id>0", "ORDER BY functiontype,seqno,window_name");
     } else {
         //if can't find particular organization from database, return error message
         redirect_header("window.php", 3, "Some error on viewing your window data, probably database corrupted");
     }
     break;
     //when user press save for change existing organization data
 //when user press save for change existing organization data
 case "update":
     if ($s->check(false, $token, "CREATE_WDW")) {
         $o->updatedby = $xoopsUser->getVar('uid');
         //get current uid