Exemplo n.º 1
0
 public function update_column_edit_to_no()
 {
     $ObjCUF = new contactsUploadedFileModel();
     $ObjCUFF = new contactsUploadedFileFieldsModel();
     $button_prev = '';
     $result1 = '';
     $cuf_id = Input::get('cuf_id');
     $cuff_id_prev = Input::get('record_cuff_id');
     $column_no_prev = Input::get('record_column_no');
     $status_prev = Input::get('record_status');
     $cuff_id_next = Input::get('cuff_id');
     $column_no_next = Input::get('column_no');
     $status_next = Input::get('status');
     $cuff_id_list = Input::get('cuff_id_list');
     $cuff_id_array = explode(',', $cuff_id_list);
     $cuff_count = count($cuff_id_array);
     $response['reply'] = FALSE;
     if ($cuff_id_prev && $cuff_id_next) {
         $colprev = $ObjCUFF->get_record(array('`cuf_id`=' => $cuf_id, '`cuff_edit`=' => 'yes'));
         if ($colprev) {
             $cuff_id_prev = $colprev->cuff_id;
             $data = array($ObjCUFF->tblpref . 'edit' => 'no');
             $result1 = $ObjCUFF->update_data($data, $cuff_id_prev);
         }
         $data = array($ObjCUFF->tblpref . 'edit' => 'yes');
         $result2 = $ObjCUFF->update_data($data, $cuff_id_next);
         $response['reply'] = TRUE;
         $response['cuff_id_prev'] = $cuff_id_prev;
         $response['status_prev'] = $status_prev;
         if ($result1 && $result2) {
             $button_prev = $ObjCUFF->column_buttons($status_prev, 'no', $cuff_id_prev, $column_no_prev, $cuff_count);
             $response['button_wrapper_prev'] = $button_prev;
         }
         $colnext = $ObjCUFF->get_record_by_id($cuff_id_next);
         $fieldname_next = $colnext->cuff_fieldname;
         $used_fieldnames_array = $ObjCUFF->get_used_fieldnames_by_cuf_id($cuf_id);
         $field_selection_next = $ObjCUF->select_column_name($fieldname_next, $cuff_id_next, $used_fieldnames_array, 'yes');
         $button_next = $ObjCUFF->column_buttons($status_next, 'yes', $cuff_id_next, $column_no_next, $cuff_count);
         $response['button_wrapper_next'] = $button_next;
         $response['cuff_id_next'] = $cuff_id_next;
         $response['field_selection_next'] = $field_selection_next;
         $response['status_next'] = $status_next;
     }
     echo json_encode($response);
     exit;
 }