function GetExceldownload()
 {
     return URLEncrypter::Encrypt(serialize($this));
 }
Example #2
0
            require_once "Elements/{$file}/{$file}.php";
        }
    }
}
if (isset($_POST["printbutton"])) {
}
// Find out how many updates should be performed (one per value)
//$updateCount =  $_POST["toUpdateCount"];
// Find out the type for the update (datatable)
$varchar = isset($_POST["varcharID"]);
$UpdateArr = array();
$i = 0;
foreach ($_POST as $post => $value) {
    if (substr($post, 0, 3) == "b64") {
        $base64String = substr($post, 3);
        $Arr = URLEncrypter::Decrypt($base64String);
        $pass = unserialize($Arr);
        $gridElement = $pass->GridElement;
        $value = $gridElement->preUpdate($value);
        //  echo $pass->dbname.":".$value.":".$pass->currentValue."<br>";
        if ($value != "" && $value != $pass->currentValue) {
            // This if makes only update statements for adjusted values
            $UpdateArr[$pass->tableType][$pass->ID][$pass->dbname] = array($value, $gridElement);
        }
    }
}
//var_dump($UpdateArr);
/* * ******* EXTRACT METHOD ************ */
$statements = array();
$string = "";
$i = 0;
Example #3
0
 protected function BuildDataRows($tpl, $numberOfFields, $uid)
 {
     $start = 0;
     $stop = 0;
     $this->processSelectorValues($start, $stop);
     $dataRows = "";
     for ($i = $start; $i < $stop; $i++) {
         $dataRow = "";
         for ($j = 0; $j < $numberOfFields; $j++) {
             $dbname = $this->fields[$j]->dbname;
             $field = $this->fields[$j];
             $field->UID = $uid;
             $currentvalue = "";
             $value = "";
             // echo $this->processedValues[$i];
             if (isset($this->processedValues)) {
                 $currentvalue = $this->processedValues[$i][$j]->currentvalue;
                 $value = $this->processedValues[$i][$j]->value;
             } else {
                 $currentvalue = $this->values[$i];
                 $value = $this->FindValue($dbname, $currentvalue);
             }
             $element = $this->elements[$field->type];
             $element->PreBuild($field, $tpl);
             $ID = isset($currentvalue->ID) ? $currentvalue->ID : "";
             // A hiddenfieldpass is created and serialized. This becomes the name of the input. Contains all data to insert in table.
             $name = new HiddenFieldPass($ID, $dbname, $field->type, $value, $currentvalue->entityType, $element, $field->validator);
             //  $value = $currentvalue->$dbname; @todo include validation for grid, in method not here
             //                if (isset($_SESSION["griderror"])){
             //                    echo $UpdateArr[$currentvalue->entityType][$currentvalue->ID][$dbname][0];
             //VALIDATION:
             if (isset($field->validator)) {
                 $tpl->DefineBlock("VALIDATION");
                 $tpl->setVars("VALIDATION", "FORMNAME", "StandardForm");
                 $tpl->setVars("VALIDATION", "CONTROLNAME", $name);
                 $tpl->setVars("VALIDATION", "REGEX", $field->validator);
                 $tpl->setVars("GRIDBLOCK", "SCRIPT", $tpl->ParseBlock("VALIDATION"));
             }
             $ser = serialize($name);
             $base = URLEncrypter::Encrypt($ser);
             $text = $element->Build($tpl, "b64" . $base, $value, $field, $currentvalue, $this->values[$i]);
             $tpl->setVars("COLUMNBLOCK", "CONTENT", $text);
             if (isset($this->fields[$j]->class)) {
                 $tpl->setVars("COLUMNBLOCK", "CLASS", $this->fields[$j]->class);
             } else {
                 $tpl->setVars("COLUMNBLOCK", "CLASS", "default");
             }
             $text = $tpl->ParseBlock("COLUMNBLOCK", "CONTENT");
             $dataRow .= $text;
             // $hiddenFieldsCount++;
         }
         $subRow = "";
         if ($i % 2 == 1) {
             $tpl->setVars("SUBGRID", "SUBCLASS", "odd");
             $tpl->setVars("ROWBLOCK", "ROWCLASS", "odd");
         } else {
             $tpl->setVars("SUBGRID", "SUBCLASS", "even");
             $tpl->setVars("ROWBLOCK", "ROWCLASS", "even");
         }
         if (isset($currentvalue->ID) && $currentvalue->ID === $this->subGridRow) {
             $tpl->setVars("SUBGRID", "FIELDS", $numberOfFields);
             $tpl->setVars("SUBGRID", "CONTENT", $this->subGridHTM);
             $subRow = $tpl->ParseBlock("SUBGRID");
             $dataRow .= $subRow;
         }
         $tpl->setVars("ROWBLOCK", "CONTENT", $dataRow);
         $dataRows = $dataRows . $tpl->ParseBlock("ROWBLOCK");
     }
     return $dataRows;
 }
Example #4
0
 private function BuildDataRow($tpl, $numberOfFields, $numberOfValues, $uid)
 {
     $start = $this->page * $this->pageSize;
     $stop = $numberOfValues > $start + $this->pageSize ? $start + $this->pageSize : $numberOfValues;
     // If there are more values than the pagesize, add as many as the pagesize. Otherwise just show all values
     $dataRows = "";
     $validators = "";
     $this->processSelectorValues($start, $stop);
     for ($i = $start; $i < $stop; $i++) {
         $unitdataRows = "";
         for ($j = 0; $j < $numberOfFields; $j++) {
             $dataRow = "";
             $dbname = $this->fields[$j]->dbname;
             $field = $this->fields[$j];
             $field->UID = $uid;
             $currentvalue = $this->values[$i];
             $element = $this->elements[$field->type];
             $element->PreBuild($field, $tpl);
             $value = $this->FindValue($dbname, $currentvalue);
             if (isset($field->datatype)) {
                 $type = $field->datatype;
             } else {
                 if ($currentvalue->entityType == "") {
                     $type = $this->type;
                 } else {
                     $type = $currentvalue->entityType;
                 }
             }
             $name = new HiddenFieldPass($currentvalue->ID, $dbname, $type, $value, $type, $element, $field->validator);
             $ser = serialize($name);
             $base = URLEncrypter::Encrypt($ser);
             //VALIDATION
             if ($field->validator != "") {
                 $tpl->setVars("VALIDATION", "FORMNAME", "StandardForm");
                 $tpl->setVars("VALIDATION", "CONTROLNAME", $base);
                 $tpl->setVars("VALIDATION", "REGEX", $field->validator);
                 $tpl->setVars("VALIDATION", "FIELDNAME", $field->showname);
                 $validators = $tpl->ParseBlock("VALIDATION");
             }
             $text = $element->Build($tpl, "b64" . $base, $value, $field, $currentvalue, $this->values);
             $dataRow .= $text;
             $dbname = $this->fields[$j]->dbname;
             $tpl->setVars("FIELDS", "FIELDNAME", $this->fields[$j]->showname);
             $fields = $tpl->ParseBlock("FIELDS");
             $tpl->setVars("ROWBLOCK", "CONTENT", $fields . $dataRow);
             if (isset($this->fields[$j]->class)) {
                 $tpl->setVars("ROWBLOCK", "CLASS", $this->fields[$j]->class);
             }
             $unitdataRows .= $tpl->ParseBlock("ROWBLOCK");
         }
         $tpl->setVars("UNITBLOCK", "CONTENT", $unitdataRows);
         //    $unitdataRows = "";
         $dataRows = $dataRows . $tpl->ParseBlock("UNITBLOCK");
     }
     return $dataRows;
 }
Example #5
0
 public static function curPageURLEnc()
 {
     return URLEncrypter::Encrypt(Tools::curPageURL());
 }
Example #6
0
<?php

$debug = 1;
require_once '../JPFLibs.php';
libadd("lib.JPF");
$redirect = URLEncrypter::Decrypt($_GET['redirect']);
$tpl = new Template("lib/JPF/templates/AreYouSure.tpl");
$tpl->DefineBlock("SUREBLOCK");
$tpl->SetVars("SUREBLOCK", "REDIRECT", $redirect);
$htm = $tpl->ParseBlock("SUREBLOCK");
$tpl->Show($htm);