Ejemplo n.º 1
0
 function getData($id)
 {
     $json = new JsonData();
     $table = $this->database->getDataRecord($id);
     $fields = $this->database->getFieldsPage($id);
     $ifcampos = false;
     if (is_array($fields)) {
         $ifcampos = true;
     }
     if ($table[0] == '') {
         $parametros = false;
         if ($ifcampos) {
             foreach ($fields as $field) {
                 if (isset($_GET['accion'])) {
                     if ($_GET['accion'] == 'b' or $_GET['accion'] == 's') {
                         if (isset($_GET[$field[0]])) {
                             $parametros = true;
                             break;
                         }
                     } else {
                         if (isset($_GET['_1_' . $field[0]])) {
                             $parametros = true;
                             break;
                         }
                     }
                 }
             }
         }
         if ($parametros) {
             $fieldsData = array();
             $where = "Where ";
             $i = 1;
             $tabla = '';
             $j = 1;
             if (isset($_GET['accion'])) {
                 if ($_GET['accion'] == 'b') {
                     foreach ($fields as $field) {
                         $key = $field[2];
                         $tabla = $field[1];
                         if ($tabla == '' or $tabla == $field[1]) {
                             if ($key == 'Y') {
                                 if (isset($_GET[$field[0]])) {
                                     if ($_GET[$field[0]] != '') {
                                         $value = $this->database->getDataChange($field[0], $_GET[$field[0]]);
                                         if ($value[0] == '') {
                                             $value[0] = $_GET[$field[0]];
                                         }
                                         $crypted = $this->database->ifCrypted($field[1], $field[0]);
                                         if ($crypted[0] == 'Y') {
                                             $value[0] = base64_decode($value[0]) / 444;
                                         }
                                         if ($i == 1) {
                                             $where = $where . $field[0] . "='" . $value[0] . "' ";
                                         } else {
                                             $where = $where . " AND " . $field[0] . "='" . $value[0] . "' ";
                                         }
                                         $fieldsData[$field[0]] = $value[0];
                                         $fieldsData[$field[0] . 'X'] = $value[0];
                                     }
                                 }
                                 $i++;
                             } else {
                                 $value = $this->database->getDatavalueW($field[1], $field[0], $where);
                                 $type = $this->database->getTypes($field[1], $field[0]);
                                 $fieldsData[$field[0]] = $value[0];
                             }
                         } else {
                             $tabla = $field[1];
                         }
                     }
                 } else {
                     if ($_GET['accion'] == 's') {
                         if (isset($_GET[$field[0]])) {
                             if ($_GET[$field[0]] != '') {
                                 $type = $this->database->getTypes($field[1], $field[0]);
                                 if ($type[0] == 'number') {
                                     if (!is_numeric($_GET[$field[0]])) {
                                         $_GET[$field[0]] = 0;
                                     }
                                 }
                                 $fieldsData[$field[0]] = $_GET[$field[0]];
                                 $fieldxs = $this->database->getPromptSelect($id, $field[0], $_GET[$field[0]]);
                                 foreach ($fieldxs as $fieldx) {
                                     $value = $this->database->executeQueryOneRow($fieldx[1]);
                                     $fieldsData[$fieldx[0]] = $value[0];
                                 }
                             }
                         }
                     }
                 }
             }
             if ($_GET['accion'] != 'bd') {
                 $jsonA = $json->getData2($fieldsData);
             }
         } else {
             $fields = $this->database->getData($id);
             $jsonA = $json->getData($fields);
         }
     } else {
         if ($ifcampos) {
             $jsonA = $json->getDataSelect($this->database, $table[0], $fields);
         } else {
             $jsonA = '';
         }
     }
     return $jsonA;
 }
Ejemplo n.º 2
0
 function getData($id)
 {
     $row = $this->database->getPageType($id);
     $json = new JsonData();
     if ($id != 'viewcustomer') {
         $fields = $this->database->getData($id);
         $jsonA = $json->getData($fields);
     } else {
         $table = $this->database->getDataRecord($id);
         $fields = $this->database->getDataFields($table[0]);
         $jsonA = $json->getDataSelect($this->database, $table[0], $fields);
     }
     return $jsonA;
 }