示例#1
0
 private function ListWhere($filter = false)
 {
     $sql = "1";
     $sql .= " AND t.email1 != '' ";
     if (!$filter) {
         return $sql;
     }
     $text = $this->input->post('filter-text') ? $this->input->post('filter-text') : false;
     if (!$text) {
         $text = $this->input->post('sSearch') ? $this->input->post('sSearch') : false;
     }
     if ($text) {
         $sql .= " AND ( t.cod_cliente like '%{$text}%'  OR  t.ididentificacion like '%{$text}%'  OR t.nombre = '{$text}' OR t.apellido1 = '{$text}' OR t.email1 = '{$text}') ";
     }
     if (!$this->input->post('filter-allclients')) {
         $sql .= " AND t.tipos_cliente like '%04%'";
     }
     if ($this->input->post('filter-date')) {
         $date = human_to_mysql($this->input->post('filter-date'));
         $sql .= " AND t.date >= '{$date}' ";
     } else {
         $date = date('Y-m-d', time() - 60 * 60 * 24);
         $sql .= " AND t.date >= '{$date}' ";
     }
     if ($this->input->post('filter-id')) {
         $sql .= " AND t.id_client = '" . $this->input->post('filter-id') . "'";
     }
     return $sql;
 }
示例#2
0
 private function ListWhere($filter = false)
 {
     $sql = "1";
     if (!$filter) {
         return $sql;
     }
     $text = $this->input->post('filter-text') ? $this->input->post('filter-text') : false;
     if (!$text) {
         $text = $this->input->post('sSearch') ? $this->input->post('sSearch') : false;
     }
     if ($this->input->post('filter-id_state')) {
         $sql .= " AND t.id_state = '" . $this->input->post('filter-id_state') . "'";
     }
     if ($this->input->post('filter-id_treatment')) {
         $sql .= " AND t.id_treatment = '" . $this->input->post('filter-id_treatment') . "'";
     }
     if ($this->input->post('filter-id_country')) {
         $sql .= " AND t.id_country = '" . $this->input->post('filter-id_country') . "'";
     }
     if ($this->input->post('filter-id_treatment_2')) {
         $sql .= " AND t.id_treatment_2 = '" . $this->input->post('filter-id_treatment_2') . "'";
     }
     if ($this->input->post('filter-id_country_2')) {
         $sql .= " AND t.id_country_2 = '" . $this->input->post('filter-id_country_2') . "'";
     }
     if ($this->input->post('filter-date1')) {
         $sql .= " AND date(t.registro) >= '" . human_to_mysql($this->input->post('filter-date1')) . "'";
     }
     if ($this->input->post('filter-date2')) {
         $sql .= " AND date(t.registro) <= '" . human_to_mysql($this->input->post('filter-date2')) . "'";
     }
     if ($text) {
         $sql .= " AND ( t.name like '%{$text}%'  OR  t.lastname like '%{$text}%'  OR  t.dir1 like '%{$text}%'  OR  t.dir2 like '%{$text}%'  OR  t.city like '%{$text}%'  OR  t.cp like '%{$text}%'  OR  t.mail like '%{$text}%'  OR  t.password like '%{$text}%'  OR  t.name_2 like '%{$text}%'  OR  t.lastname_2 like '%{$text}%'  OR  t.dir1_2 like '%{$text}%'  OR  t.dir2_2 like '%{$text}%'  OR  t.city_2 like '%{$text}%'  OR  t.cp_2 like '%{$text}%'  OR  t.mail_2 like '%{$text}%'  OR t.id_user = '******') ";
     }
     if ($this->input->post('filter-id')) {
         $sql .= " AND t.id_user = '******'filter-id') . "'";
     }
     return $sql;
 }
示例#3
0
 private function ListWhere($filter = false)
 {
     $sql = "1";
     $sql .= " AND t.id_state > 1 ";
     if (!$filter) {
         return $sql;
     }
     $text = $this->input->post('filter-text') ? $this->input->post('filter-text') : false;
     if (!$text) {
         $text = $this->input->post('sSearch') ? $this->input->post('sSearch') : false;
     }
     if ($this->input->post('filter-id_shipping')) {
         $sql .= " AND t.id_shipping = '" . $this->input->post('filter-id_shipping') . "'";
     }
     if ($this->input->post('filter-id_store')) {
         $sql .= " AND t.id_store = '" . $this->input->post('filter-id_store') . "'";
     }
     if ($this->input->post('filter-id_payment')) {
         $sql .= " AND t.id_payment = '" . $this->input->post('filter-id_payment') . "'";
     }
     if ($this->input->post('filter-id_state')) {
         $sql .= " AND t.id_state = '" . $this->input->post('filter-id_state') . "'";
     }
     if ($this->input->post('filter-date1')) {
         $sql .= " AND date(t.modified) >= '" . human_to_mysql($this->input->post('filter-date1')) . "'";
     }
     if ($this->input->post('filter-date2')) {
         $sql .= " AND date(t.modified) <= '" . human_to_mysql($this->input->post('filter-date2')) . "'";
     }
     if ($text) {
         $sql .= " AND ( t.comments like '%{$text}%'  OR  t.mail like '%{$text}%' OR  t.lastname like '%{$text}%' OR  t.name like '%{$text}%'  OR \n       t.id_cart = '{$text}') ";
     }
     if ($this->input->post('filter-id')) {
         $sql .= " AND t.id_cart = '" . $this->input->post('filter-id') . "'";
     }
     return $sql;
 }
示例#4
0
 public function DataElement($id = 0, $null = false)
 {
     $ret = array();
     if ($id) {
         $sql = "SELECT t.id_procedure as id, t.*      \n      FROM {$this->table} as t      \n      WHERE t.id_procedure = '{$id}' \n      LIMIT 0, 1";
         $ret = $this->db->query($sql)->row_array();
         if ($ret) {
             return $ret;
         }
         if ($null) {
             return false;
         }
     }
     $ret['code'] = $this->input->post() ? $this->input->post('code') : '';
     $ret['procedure'] = $this->input->post() ? $this->input->post('procedure') : '';
     $ret['obs'] = $this->input->post() ? $this->input->post('obs') : '';
     $ret['date_revision'] = $this->input->post() ? human_to_mysql($this->input->post('date_revision')) : date('Y-m-d');
     $ret['id_frequency'] = $this->input->post() ? $this->input->post('id_frequency') : '';
     $ret['active'] = $this->input->post('active') ? 1 : 0;
     return $ret;
 }
示例#5
0
 public function DataElement($id = 0, $null = false)
 {
     $ret = array();
     if ($id) {
         $sql = "SELECT t.id_calibration as id, t.*,\n      lj0.state as state,\n      lj1.client as clientX,\n      lj1.code as client_code,\n      CONCAT(lj2.name, ' ', lj2.lastname) as userX,\n      CONCAT(lj8.code, ' ', lj8.procedure) as procedureX, lj8.obs as procedureXObs,\n      lj3.instrument as instrumentX,\n      lj4.unit as unit, lj4.symbol as unit_symbol,\n      lj5.measurement as measurement,\n      lj6.exactness as exactnessX,\n      lj7.frequency as frequency,      \n      lj7.value as frequency_val      \n      FROM {$this->table} as t      \n      LEFT JOIN calibration_state lj0 on t.id_state = lj0.id_state       \n      LEFT JOIN client lj1 on t.id_client = lj1.id_client       \n      LEFT JOIN {$this->dbglobal}user lj2 on t.id_user = lj2.id_user       \n      LEFT JOIN instrument lj3 on t.id_instrument = lj3.id_instrument       \n      LEFT JOIN unit lj4 on t.id_unit = lj4.id_unit       \n      LEFT JOIN measurement lj5 on t.id_measurement = lj5.id_measurement       \n      LEFT JOIN exactness lj6 on t.id_exactness = lj6.id_exactness       \n      LEFT JOIN frequency lj7 on t.id_frequency = lj7.id_frequency       \n      LEFT JOIN `procedure` lj8 on t.id_procedure = lj8.id_procedure       \n      WHERE t.id_calibration = '{$id}' \n      LIMIT 0, 1";
         $ret = $this->db->query($sql)->row_array();
         if ($ret) {
             if (!$ret['client_code']) {
                 $ret['client_code'] = substr(strtoupper($ret['client']), 0, 3);
             }
             return $ret;
         }
         if ($null) {
             return false;
         }
     }
     $ret['id_type'] = $this->input->post() ? $this->input->post('id_type') : '';
     $ret['id_state'] = $this->input->post() ? $this->input->post('id_state') : '';
     $ret['id_client'] = $this->input->post() ? $this->input->post('id_client') : $this->session->userdata('calibration-index-id_client');
     $ret['client'] = $this->input->post() ? $this->input->post('client') : $this->session->userdata('calibration-index-client');
     $ret['id_user'] = $this->input->post() ? $this->input->post('id_user') : $this->MApp->user->id;
     $ret['date'] = $this->input->post() ? human_to_mysql($this->input->post('date')) : date('Y-m-d');
     $ret['plant'] = $this->input->post() ? $this->input->post('plant') : $this->session->userdata('calibration-index-plant');
     $ret['place'] = $this->input->post() ? $this->input->post('place') : $this->session->userdata('calibration-index-place');
     $ret['sector'] = $this->input->post() ? $this->input->post('sector') : $this->session->userdata('calibration-index-sector');
     $ret['id_instrument'] = $this->input->post() ? $this->input->post('id_instrument') : '';
     $ret['instrument'] = $this->input->post() ? $this->input->post('instrument') : '';
     $ret['id_unit'] = $this->input->post() ? $this->input->post('id_unit') : '';
     $ret['id_measurement'] = $this->input->post() ? $this->input->post('id_measurement') : '';
     $ret['location'] = $this->input->post() ? $this->input->post('location') : '';
     $ret['brand'] = $this->input->post() ? $this->input->post('brand') : '';
     $ret['model'] = $this->input->post() ? $this->input->post('model') : '';
     $ret['instrument_id'] = $this->input->post() ? $this->input->post('instrument_id') : '';
     $ret['serial'] = $this->input->post() ? $this->input->post('serial') : '';
     $ret['range1'] = $this->input->post() ? $this->input->post('range1') : '';
     $ret['range2'] = $this->input->post() ? $this->input->post('range2') : '';
     $ret['dmin'] = $this->input->post() ? $this->input->post('dmin') : '';
     $ret['id_exactness'] = $this->input->post() ? $this->input->post('id_exactness') : '';
     $ret['exactness'] = $this->input->post() ? $this->input->post('exactness') : '';
     $ret['id_frequency'] = $this->input->post() ? $this->input->post('id_frequency') : '';
     $ret['humidity'] = $this->input->post() ? $this->input->post('humidity') : ($this->session->userdata('calibration-index-humidity') ? $this->session->userdata('calibration-index-humidity') : "65");
     $ret['temperature'] = $this->input->post() ? $this->input->post('temperature') : ($this->session->userdata('calibration-index-temperature') ? $this->session->userdata('calibration-index-temperature') : "24");
     $ret['temperature_liquid'] = $this->input->post() ? $this->input->post('temperature_liquid') : '';
     $ret['temperature_adjust'] = $this->input->post() ? $this->input->post('temperature_adjust') : 0;
     $ret['outofuse'] = $this->input->post() ? $this->input->post('outofuse') : 0;
     $ret['id_procedure'] = $this->input->post() ? $this->input->post('id_procedure') : '';
     return $ret;
 }
示例#6
0
 public function DataElement($id = 0, $null = false)
 {
     $ret = array();
     if ($id) {
         $sql = "SELECT t.id_blog as id, t.*,\n      lj0.file as fm1file, lj0.id_type as fm1type, lj0.name as fm1name      \n      FROM {$this->table} as t      \n      LEFT JOIN nz_file lj0 on t.id_file = lj0.id_file      \n      WHERE t.id_blog = '{$id}' \n      LIMIT 0, 1";
         $ret = $this->db->query($sql)->row_array();
         if ($ret) {
             return $ret;
         }
         if ($null) {
             return false;
         }
     }
     $ret['id_file'] = $this->input->post() ? $this->input->post('id_file') : '';
     $ret['date'] = $this->input->post() ? human_to_mysql($this->input->post('date')) : date('Y-m-d');
     $ret['title_es'] = $this->input->post() ? $this->input->post('title_es') : '';
     $ret['title_ca'] = $this->input->post() ? $this->input->post('title_ca') : '';
     $ret['text_es'] = $this->input->post() ? $this->input->post('text_es') : '';
     $ret['text_ca'] = $this->input->post() ? $this->input->post('text_ca') : '';
     $ret['id_gallery'] = $this->input->post() ? $this->input->post('id_gallery') : '';
     $ret['active'] = $this->input->post('active') ? 1 : 0;
     return $ret;
 }
示例#7
0
 public function DataElement($id = 0, $null = false)
 {
     $ret = array();
     if ($id) {
         $sql = "SELECT t.id_newsletter as id, t.*      \n      FROM {$this->table} as t      \n      WHERE t.id_newsletter = '{$id}' \n      LIMIT 0, 1";
         $ret = $this->db->query($sql)->row_array();
         if ($ret) {
             return $ret;
         }
         if ($null) {
             return false;
         }
     }
     $ret['mail'] = $this->input->post() ? $this->input->post('mail') : '';
     $ret['date'] = $this->input->post() ? human_to_mysql($this->input->post('date')) : date('Y-m-d');
     $ret['active'] = $this->input->post('active') ? 1 : 0;
     return $ret;
 }
示例#8
0
 public function SavePost()
 {
     if (!$this->MApp->secure->edit) {
         return;
     }
     $data = array('id_type' => $this->input->post('id_type'), 'solution' => $this->input->post('solution'), 'value' => $this->input->post('value'), 'uncertainty' => $this->input->post('uncertainty'), 'id_unit' => $this->input->post('id_unit'), 'active' => $this->input->post('active') ? 1 : 0);
     if ($this->id) {
         $sql = $this->db->update_string($this->table, $data, "id_solution = '{$this->id}'");
     } else {
         $sql = $this->db->insert_string($this->table, $data);
     }
     $this->db->query($sql);
     $id = $this->id ? $this->id : $this->db->insert_id();
     if ($this->id) {
         $sql = "DELETE FROM solution_batch WHERE id_solution = '{$this->id}'";
         $this->db->query($sql);
     }
     $data = $this->input->post('data');
     $num = 0;
     foreach ($data as $key => $item) {
         $item['expiration'] = human_to_mysql($item['expiration']);
         $item['id_solution'] = $id;
         $item['num'] = $num++;
         $sql = $this->db->insert_string('solution_batch', $item);
         $this->db->query($sql);
     }
     return $id;
 }
示例#9
0
 public function DataElement($id = 0, $null = false)
 {
     $ret = array();
     if ($id) {
         $sql = "SELECT t.id_project as id, t.*,\n      lj0.file as fm1file, lj0.id_type as fm1type, lj0.name as fm1name,\n      lj1.file as fm2file, lj1.id_type as fm2type, lj1.name as fm2name,\n      lj2.client as client      \n      FROM {$this->table} as t      \n      LEFT JOIN nz_file lj0 on t.id_file_1 = lj0.id_file      \n      LEFT JOIN nz_file lj1 on t.id_file_2 = lj1.id_file      \n      LEFT JOIN client lj2 on t.id_client = lj2.id_client       \n      WHERE t.id_project = '{$id}' \n      LIMIT 0, 1";
         $ret = $this->db->query($sql)->row_array();
         if ($ret) {
             return $ret;
         }
         if ($null) {
             return false;
         }
     }
     $ret['id_file_1'] = $this->input->post() ? $this->input->post('id_file_1') : '';
     $ret['id_file_2'] = $this->input->post() ? $this->input->post('id_file_2') : '';
     $ret['date'] = $this->input->post() ? human_to_mysql($this->input->post('date')) : date('Y-m-d');
     $ret['name_es'] = $this->input->post() ? $this->input->post('name_es') : '';
     $ret['name_en'] = $this->input->post() ? $this->input->post('name_en') : '';
     $ret['id_client'] = $this->input->post() ? $this->input->post('id_client') : '';
     $ret['title_es'] = $this->input->post() ? $this->input->post('title_es') : '';
     $ret['title_en'] = $this->input->post() ? $this->input->post('title_en') : '';
     $ret['text_es'] = $this->input->post() ? $this->input->post('text_es') : '';
     $ret['text_en'] = $this->input->post() ? $this->input->post('text_en') : '';
     $ret['title2_es'] = $this->input->post() ? $this->input->post('title2_es') : 'Info adicional';
     $ret['title2_en'] = $this->input->post() ? $this->input->post('title2_en') : 'Additional info';
     $ret['text2_es'] = $this->input->post() ? $this->input->post('text2_es') : '';
     $ret['text2_en'] = $this->input->post() ? $this->input->post('text2_en') : '';
     $ret['id_gallery_1'] = $this->input->post() ? $this->input->post('id_gallery_1') : '';
     $ret['id_gallery_2'] = $this->input->post() ? $this->input->post('id_gallery_2') : '';
     $ret['id_gallery_3'] = $this->input->post() ? $this->input->post('id_gallery_3') : '';
     $ret['color_1'] = $this->input->post() ? $this->input->post('color_1') : '';
     $ret['color_2'] = $this->input->post() ? $this->input->post('color_2') : '';
     $ret['home'] = $this->input->post('home') ? 1 : 0;
     $ret['title_home_es'] = $this->input->post() ? $this->input->post('title_home_es') : '';
     $ret['subtitle_home_es'] = $this->input->post() ? $this->input->post('subtitle_home_es') : '';
     $ret['title_home_en'] = $this->input->post() ? $this->input->post('title_home_en') : '';
     $ret['subtitle_home_en'] = $this->input->post() ? $this->input->post('subtitle_home_en') : '';
     $ret['seo_title_es'] = $this->input->post() ? $this->input->post('seo_title_es') : '';
     $ret['seo_title_en'] = $this->input->post() ? $this->input->post('seo_title_en') : '';
     $ret['seo_description_es'] = $this->input->post() ? $this->input->post('seo_description_es') : '';
     $ret['seo_description_en'] = $this->input->post() ? $this->input->post('seo_description_en') : '';
     $ret['video'] = $this->input->post() ? $this->input->post('video') : '';
     $ret['active'] = $this->input->post('active') ? 1 : 0;
     return $ret;
 }
示例#10
0
 public function DataElement($id = 0, $null = false)
 {
     $ret = array();
     if ($id) {
         $sql = "SELECT t.id_tweet as id, t.*      \n      FROM {$this->table} as t      \n      WHERE t.id_tweet = '{$id}' \n      LIMIT 0, 1";
         $ret = $this->db->query($sql)->row_array();
         if ($ret) {
             return $ret;
         }
         if ($null) {
             return false;
         }
     }
     $ret['date'] = $this->input->post() ? human_to_mysql($this->input->post('date')) : date('Y-m-d');
     $ret['tweet'] = $this->input->post() ? $this->input->post('tweet') : '';
     $ret['tweet2'] = $this->input->post() ? $this->input->post('tweet2') : '';
     $ret['user'] = $this->input->post() ? $this->input->post('user') : '';
     $ret['link'] = $this->input->post() ? $this->input->post('link') : '';
     $ret['highlight'] = $this->input->post('highlight') ? 1 : 0;
     $ret['active'] = $this->input->post('active') ? 1 : 0;
     return $ret;
 }
示例#11
0
 public function DataElement($id = 0, $null = false)
 {
     $ret = array();
     if ($id) {
         $sql = "SELECT t.id_equipment as id, t.*,\n      lj0.unit as unit,\n      lj1.frequency as frequency      \n      FROM {$this->table} as t      \n      LEFT JOIN unit lj0 on t.id_unit = lj0.id_unit       \n      LEFT JOIN frequency lj1 on t.id_frequency = lj1.id_frequency       \n      WHERE t.id_equipment = '{$id}' \n      LIMIT 0, 1";
         $ret = $this->db->query($sql)->row_array();
         if ($ret) {
             return $ret;
         }
         if ($null) {
             return false;
         }
     }
     $ret['code'] = $this->input->post() ? $this->input->post('code') : '';
     $ret['equipment'] = $this->input->post() ? $this->input->post('equipment') : '';
     $ret['obs'] = $this->input->post() ? $this->input->post('obs') : '';
     $ret['id_unit'] = $this->input->post() ? $this->input->post('id_unit') : '';
     $ret['date_calibration'] = $this->input->post() ? human_to_mysql($this->input->post('date_calibration')) : date('Y-m-d');
     $ret['certificate'] = $this->input->post() ? $this->input->post('certificate') : '';
     $ret['id_frequency'] = $this->input->post() ? $this->input->post('id_frequency') : '';
     $ret['active'] = $this->input->post('active') ? 1 : 0;
     return $ret;
 }
示例#12
0
 public function DataElement($id = 0, $null = false)
 {
     $ret = array();
     if ($id) {
         $sql = "SELECT t.id_book as id, t.*,\n      lj0.name as author_1,\n      lj1.name as author_2,\n      lj2.name as author_3,\n      lj3.name as author_4,\n      lj4.category as category,\n      lj5.file as fm1file, lj5.id_type as fm1type, lj5.name as fm1name      \n      FROM {$this->table} as t      \n      LEFT JOIN author lj0 on t.id_author_1 = lj0.id_author       \n      LEFT JOIN author lj1 on t.id_author_2 = lj1.id_author       \n      LEFT JOIN author lj2 on t.id_author_3 = lj2.id_author       \n      LEFT JOIN author lj3 on t.id_author_4 = lj3.id_author       \n      LEFT JOIN category lj4 on t.id_category = lj4.id_category       \n      LEFT JOIN nz_file lj5 on t.id_file = lj5.id_file      \n      WHERE t.id_book = '{$id}' \n      LIMIT 0, 1";
         $ret = $this->db->query($sql)->row_array();
         if ($ret) {
             return $ret;
         }
         if ($null) {
             return false;
         }
     }
     $ret['date'] = $this->input->post() ? human_to_mysql($this->input->post('date')) : date('Y-m-d');
     $ret['title'] = $this->input->post() ? $this->input->post('title') : '';
     $ret['id_author_1'] = $this->input->post() ? $this->input->post('id_author_1') : '';
     $ret['id_author_2'] = $this->input->post() ? $this->input->post('id_author_2') : '';
     $ret['id_author_3'] = $this->input->post() ? $this->input->post('id_author_3') : '';
     $ret['id_author_4'] = $this->input->post() ? $this->input->post('id_author_4') : '';
     $ret['id_category'] = $this->input->post() ? $this->input->post('id_category') : '';
     $ret['stock'] = $this->input->post() ? $this->input->post('stock') : '';
     $ret['cost'] = $this->input->post() ? $this->input->post('cost') : '';
     $ret['cost2'] = $this->input->post() ? $this->input->post('cost2') : '';
     $ret['collection'] = $this->input->post() ? $this->input->post('collection') : '';
     $ret['tematica'] = $this->input->post() ? $this->input->post('tematica') : '';
     $ret['isbn'] = $this->input->post() ? $this->input->post('isbn') : '';
     $ret['edition'] = $this->input->post() ? $this->input->post('edition') : '';
     $ret['bookbinding'] = $this->input->post() ? $this->input->post('bookbinding') : '';
     $ret['format'] = $this->input->post() ? $this->input->post('format') : '';
     $ret['pages'] = $this->input->post() ? $this->input->post('pages') : '';
     $ret['others'] = $this->input->post() ? $this->input->post('others') : '';
     $ret['text'] = $this->input->post() ? $this->input->post('text') : '';
     $ret['press'] = $this->input->post() ? $this->input->post('press') : '';
     $ret['id_file'] = $this->input->post() ? $this->input->post('id_file') : '';
     $ret['id_gallery'] = $this->input->post() ? $this->input->post('id_gallery') : '';
     $ret['highlight'] = $this->input->post('highlight') ? 1 : 0;
     $ret['active'] = $this->input->post('active') ? 1 : 0;
     return $ret;
 }
示例#13
0
 public function DataElement($id = 0, $null = false)
 {
     $ret = array();
     if ($id) {
         $sql = "SELECT t.id_project as id, t.*,\n      lj0.client as client,\n      lj1.file as fm1file, lj1.id_type as fm1type, lj1.name as fm1name      \n      FROM {$this->table} as t      \n      LEFT JOIN {$this->dbglobal}client lj0 on t.id_client = lj0.id_client       \n      LEFT JOIN {$this->dbglobal}nz_file lj1 on t.id_file = lj1.id_file      \n      WHERE t.id_project = '{$id}' \n      LIMIT 0, 1";
         $ret = $this->db->query($sql)->row_array();
         if ($ret) {
             return $ret;
         }
         if ($null) {
             return false;
         }
     }
     $ret['id_client'] = $this->input->post() ? $this->input->post('id_client') : '';
     $ret['date'] = $this->input->post() ? human_to_mysql($this->input->post('date')) : date('Y-m-d');
     $ret['project'] = $this->input->post() ? $this->input->post('project') : '';
     $ret['url'] = $this->input->post() ? $this->input->post('url') : '';
     $ret['obs'] = $this->input->post() ? $this->input->post('obs') : '';
     $ret['finish'] = $this->input->post('finish') ? 1 : 0;
     $ret['id_file'] = $this->input->post() ? $this->input->post('id_file') : '';
     $ret['data'] = $this->input->post('data') ? json_encode($this->input->post('data')) : '';
     $ret['active'] = $this->input->post('active') ? 1 : 0;
     return $ret;
 }
示例#14
0
$dateEnd = date('d-m-Y', mysql_to_unix($dataItem['date2_end'])) . ' ' . substr($dataItem['time2_end'], 0, 5);
$folder = $this->config->item('uploads', 'app');
$file = $folder . 'data/trials/' . $idItem . '.json';
$sensors = json_decode($dataItem['sensors']);
$sensors_adj = json_decode($dataItem['sensors_adj']);
$sensors_adj_mul = json_decode($dataItem['sensors_adj_mul']);
$sensors_adj_add = json_decode($dataItem['sensors_adj_add']);
$temp_min = false;
$temp_max = 0;
$diff_max = 0;
$delta = array();
if (file_exists($file)) {
    $json = json_decode(file_get_contents($file));
    foreach ($json as $key => $value) {
        $date = explode(' ', $key);
        $dateT = human_to_mysql($date[0]) . ' ' . $date[1];
        $time = strtotime($dateT);
        $temp_minR = false;
        $temp_maxR = 0;
        if ($time < $timeInit) {
            continue;
        }
        if ($time > $timeEnd) {
            break;
        }
        foreach ($sensors as $sk => $sv) {
            $val = $value->{$sk};
            if (isset($sensors_adj->{$sk})) {
                $sens = explode(',', $sensors_adj->{$sk});
                $count = 0;
                $sum = 0;
示例#15
0
 public function DataElement($id = 0, $null = false)
 {
     $ret = array();
     if ($id) {
         $sql = "SELECT t.id_blog as id, t.*,\n      lj0.category_es as category,\n      lj1.name_es as team,\n      lj2.name_es as team_2,\n      lj3.file as fm1file, lj3.id_type as fm1type, lj3.name as fm1name,      \n      lj4.file as fm2file, lj4.id_type as fm2type, lj4.name as fm2name      \n      FROM {$this->table} as t      \n      LEFT JOIN blog_category lj0 on t.id_category = lj0.id_category       \n      LEFT JOIN team lj1 on t.id_team = lj1.id_team       \n      LEFT JOIN team lj2 on t.id_team_2 = lj2.id_team       \n      LEFT JOIN nz_file lj3 on t.id_file = lj3.id_file      \n      LEFT JOIN nz_file lj4 on t.id_file_2 = lj4.id_file      \n      WHERE t.id_blog = '{$id}' \n      LIMIT 0, 1";
         $ret = $this->db->query($sql)->row_array();
         if ($ret) {
             return $ret;
         }
         if ($null) {
             return false;
         }
     }
     $ret['id_category'] = $this->input->post() ? $this->input->post('id_category') : '';
     $ret['id_team'] = $this->input->post() ? $this->input->post('id_team') : '';
     $ret['id_team_2'] = $this->input->post() ? $this->input->post('id_team_2') : '';
     $ret['date'] = $this->input->post() ? human_to_mysql($this->input->post('date')) : date('Y-m-d');
     $ret['title_es'] = $this->input->post() ? $this->input->post('title_es') : '';
     $ret['title_en'] = $this->input->post() ? $this->input->post('title_en') : '';
     $ret['text_es'] = $this->input->post() ? $this->input->post('text_es') : '';
     $ret['text_en'] = $this->input->post() ? $this->input->post('text_en') : '';
     $ret['tags_es'] = $this->input->post() ? $this->input->post('tags_es') : '';
     $ret['tags_en'] = $this->input->post() ? $this->input->post('tags_en') : '';
     $ret['id_file'] = $this->input->post() ? $this->input->post('id_file') : '';
     $ret['id_file_2'] = $this->input->post() ? $this->input->post('id_file_2') : '';
     $ret['related'] = $this->input->post() ? $this->input->post('related') : '';
     $ret['id_gallery'] = $this->input->post() ? $this->input->post('id_gallery') : '';
     $ret['seo_title_es'] = $this->input->post() ? $this->input->post('seo_title_es') : '';
     $ret['seo_title_en'] = $this->input->post() ? $this->input->post('seo_title_en') : '';
     $ret['seo_description_es'] = $this->input->post() ? $this->input->post('seo_description_es') : '';
     $ret['seo_description_en'] = $this->input->post() ? $this->input->post('seo_description_en') : '';
     $ret['active'] = $this->input->post('active') ? 1 : 0;
     return $ret;
 }
示例#16
0
 public function DataElement($id = 0, $null = false)
 {
     $ret = array();
     if ($id) {
         $sql = "SELECT t.id_trial as id, t.*,\n      lj0.state as state,\n      lj1.client as client,\n      lj2.file as fm1file, lj2.id_type as fm1type, lj2.name as fm1name      \n      FROM {$this->table} as t      \n      LEFT JOIN trial_state lj0 on t.id_state = lj0.id_state       \n      LEFT JOIN client lj1 on t.id_client = lj1.id_client       \n      LEFT JOIN nz_file lj2 on t.id_file = lj2.id_file      \n      WHERE t.id_trial = '{$id}' \n      LIMIT 0, 1";
         $ret = $this->db->query($sql)->row_array();
         if ($ret) {
             return $ret;
         }
         if ($null) {
             return false;
         }
     }
     $ret['id_state'] = $this->input->post() ? $this->input->post('id_state') : '';
     $ret['title'] = $this->input->post() ? $this->input->post('title') : '';
     $ret['num'] = $this->input->post() ? $this->input->post('num') : '1';
     $ret['id_client'] = $this->input->post() ? $this->input->post('id_client') : '';
     $ret['id_file'] = $this->input->post() ? $this->input->post('id_file') : '';
     $ret['equipment'] = $this->input->post() ? $this->input->post('equipment') : '';
     $ret['brand'] = $this->input->post() ? $this->input->post('brand') : '';
     $ret['model'] = $this->input->post() ? $this->input->post('model') : '';
     $ret['identification'] = $this->input->post() ? $this->input->post('identification') : '';
     $ret['serial'] = $this->input->post() ? $this->input->post('serial') : '';
     $ret['temp'] = $this->input->post() ? $this->input->post('temp') : '';
     $ret['temp_min'] = $this->input->post() ? $this->input->post('temp_min') : '';
     $ret['temp_max'] = $this->input->post() ? $this->input->post('temp_max') : '';
     $ret['size_x'] = $this->input->post() ? $this->input->post('size_x') : '50';
     $ret['size_y'] = $this->input->post() ? $this->input->post('size_y') : '50';
     $ret['size_z'] = $this->input->post() ? $this->input->post('size_z') : '50';
     $ret['plates'] = $this->input->post() ? $this->input->post('plates') : '1';
     $ret['border_1'] = $this->input->post() ? $this->input->post('border_1') : '8';
     $ret['border_2'] = $this->input->post() ? $this->input->post('border_2') : '5';
     $ret['grid'] = $this->input->post() ? $this->input->post('grid') : '10';
     $ret['snap'] = $this->input->post() ? $this->input->post('snap') : '1';
     $ret['differential'] = $this->input->post('differential') ? 1 : 0;
     $ret['differential_max'] = $this->input->post() ? $this->input->post('differential_max') : '';
     $ret['date1_start'] = $this->input->post() ? human_to_mysql($this->input->post('date1_start')) : date('Y-m-d');
     $ret['time1_start'] = $this->input->post() ? $this->input->post('time1_start') : '00:00';
     $ret['date1_end'] = $this->input->post() ? human_to_mysql($this->input->post('date1_end')) : date('Y-m-d');
     $ret['time1_end'] = $this->input->post() ? $this->input->post('time1_end') : '00:00';
     $ret['date2_start'] = $this->input->post() ? human_to_mysql($this->input->post('date2_start')) : date('Y-m-d');
     $ret['time2_start'] = $this->input->post() ? $this->input->post('time2_start') : '00:00';
     $ret['date2_end'] = $this->input->post() ? human_to_mysql($this->input->post('date2_end')) : date('Y-m-d');
     $ret['time2_end'] = $this->input->post() ? $this->input->post('time2_end') : '00:00';
     $ret['info'] = $this->input->post() ? $this->input->post('info') : '[{"title":"Objetivo","details":""},{"title":"Procedimiento","details":""},{"title":"Equipos e instrumentos utilizados","details":""},{"title":"Condiciones de los ensayos","details":""},{"title":"Criterios de aceptaci\\u00f3n de los ensayos","details":""}]';
     $ret['data'] = $this->input->post() ? $this->input->post('info') : '[{"title":"Conclusiones","details":"El equipo CUMPLE con los criterios de aceptaci\\u00f3n de rango t\\u00e9rmico de proceso."},{"title":"Registros entregados por el equipo calificado","details":"Si el equipo posee alg\\u00fan sistema de registro, anexarlo luego de esta planilla"},{"title":"Reportes y gr\\u00e1ficos de los sensores patrones","details":"Anexar las planillas de datos crudos y los gr\\u00e1ficos t\\u00e9rmicos luego de esta planilla"},{"title":"No Conformidades","details":"No aplica"},{"title":"Observaciones","details":"Sin observaciones"}]';
     return $ret;
 }
示例#17
0
 public function DataElement($id = 0, $null = false)
 {
     $ret = array();
     if ($id) {
         $sql = "SELECT t.id_client as id, t.*,\n      lj0.civil_status as civil_status,\n      lj1.gender as gender,\n      lj2.province as province,\n      lj3.canton as canton,\n      lj4.district as district      \n      FROM {$this->table} as t      \n      LEFT JOIN cemaco_clients.civil_status lj0 on t.id_civil_status = lj0.id_civil_status       \n      LEFT JOIN cemaco_clients.gender lj1 on t.id_gender = lj1.id_gender       \n      LEFT JOIN cemaco_clients.geo_province lj2 on t.id_province = lj2.id_province       \n      LEFT JOIN cemaco_clients.geo_canton lj3 on t.id_canton = lj3.id_canton       \n      LEFT JOIN cemaco_clients.geo_district lj4 on t.id_district = lj4.id_district       \n      WHERE t.id_client = '{$id}' \n      LIMIT 0, 1";
         $ret = $this->db->query($sql)->row_array();
         if ($ret) {
             return $ret;
         }
         if ($null) {
             return false;
         }
     }
     $ret['cod_cliente'] = $this->input->post() ? $this->input->post('cod_cliente') : '';
     $ret['ididentificacion'] = $this->input->post() ? $this->input->post('ididentificacion') : '';
     $ret['nombre'] = $this->input->post() ? $this->input->post('nombre') : '';
     $ret['apellido1'] = $this->input->post() ? $this->input->post('apellido1') : '';
     $ret['apellido2'] = $this->input->post() ? $this->input->post('apellido2') : '';
     $ret['email1'] = $this->input->post() ? $this->input->post('email1') : '';
     $ret['telefono'] = $this->input->post() ? $this->input->post('telefono') : '';
     $ret['celular'] = $this->input->post() ? $this->input->post('celular') : '';
     $ret['acumulados'] = $this->input->post() ? $this->input->post('acumulados') : '';
     $ret['redimidos'] = $this->input->post() ? $this->input->post('redimidos') : '';
     $ret['tipos_cliente'] = $this->input->post() ? $this->input->post('tipos_cliente') : '';
     $ret['id_civil_status'] = $this->input->post() ? $this->input->post('id_civil_status') : '';
     $ret['id_gender'] = $this->input->post() ? $this->input->post('id_gender') : '';
     $ret['id_province'] = $this->input->post() ? $this->input->post('id_province') : '';
     $ret['id_canton'] = $this->input->post() ? $this->input->post('id_canton') : '';
     $ret['id_district'] = $this->input->post() ? $this->input->post('id_district') : '';
     $ret['pub_mail'] = $this->input->post('pub_mail') ? 1 : 0;
     $ret['pub_tel'] = $this->input->post('pub_tel') ? 1 : 0;
     $ret['birthday'] = $this->input->post() ? human_to_mysql($this->input->post('birthday')) : date('Y-m-d');
     $ret['date'] = $this->input->post() ? human_to_mysql($this->input->post('date')) : date('Y-m-d');
     return $ret;
 }