예제 #1
0
 function GetExceldownload()
 {
     return URLEncrypter::Encrypt(serialize($this));
 }
예제 #2
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;
 }
예제 #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;
 }
예제 #4
0
 public static function curPageURLEnc()
 {
     return URLEncrypter::Encrypt(Tools::curPageURL());
 }