Exemple #1
0
 function detail($segment_3 = '', $segment_4 = '', $segment_5 = '')
 {
     $materi_id = (int) $segment_3;
     if (empty($materi_id)) {
         show_error("Materi tidak ditemukan.");
     }
     $materi = $this->materi_model->retrieve($materi_id);
     if (empty($materi) or empty($materi['publish'])) {
         show_error("Materi tidak ditemukan.");
     }
     # tambah views jika materi terfulis
     if (empty($materi['file'])) {
         $plus_views = false;
         # buat session kalo sudah baca materi yan ini
         $session_read = $this->session->userdata('read_materi');
         if (empty($session_read)) {
             $this->session->set_userdata(array('read_materi' => array($materi['id'])));
             $plus_views = true;
         } else {
             if (!in_array($materi['id'], $session_read)) {
                 $plus_views = true;
             }
         }
         if ($plus_views) {
             $this->materi_model->plus_views($materi['id']);
         }
     }
     $data['materi'] = $materi;
     switch ($segment_4) {
         case 'laporkan':
             $komentar = $this->komentar_model->retrieve((int) $segment_5);
             if (empty($komentar) or $komentar['tampil'] == 0 or $komentar['materi_id'] != $materi['id']) {
                 show_error('Komentar tidak ditemukan');
             }
             $data['komentar'] = $komentar;
             $this->form_validation->set_rules('alasan', 'Alasan', 'required|trim|xss_clean');
             if (!empty($_POST['alasan']) and $_POST['alasan'] == 'tulis') {
                 $this->form_validation->set_rules('alasan_lain', 'Tulis alasan', 'required|trim|xss_clean');
             }
             if ($this->form_validation->run() == true) {
                 $alasan = $this->input->post('alasan', true);
                 if ($alasan == 'tulis') {
                     $alasan = $this->input->post('alasan_lain', true);
                 }
                 $unix_id = uniqid() . time();
                 $field_id = 'laporkan-komentar';
                 $retrieve_field = retrieve_field($field_id);
                 if (empty($retrieve_field)) {
                     create_field($field_id, 'Laporkan Komentar', json_encode(array($unix_id => array('materi_id' => $materi['id'], 'komentar_id' => $komentar['id'], 'alasan' => $alasan, 'login_id' => get_sess_data('login', 'id'), 'tgl_lapor' => date('Y-m-d H:i:s')))));
                 } else {
                     $value_field = json_decode($retrieve_field['value'], 1);
                     # cek sudah ada belum datanya
                     $exist = false;
                     foreach ($value_field as $val) {
                         if ($val['materi_id'] == $materi['id'] and $val['login_id'] == get_sess_data('login', 'id') and $val['komentar_id'] == $komentar['id']) {
                             $exist = true;
                         }
                     }
                     if (!$exist) {
                         $value_field[$unix_id] = array('materi_id' => $materi['id'], 'komentar_id' => $komentar['id'], 'alasan' => $alasan, 'login_id' => get_sess_data('login', 'id'), 'tgl_lapor' => date('Y-m-d H:i:s'));
                         update_field($field_id, 'Laporkan Komentar', json_encode($value_field));
                     }
                 }
                 $this->session->set_flashdata('laporkan', get_alert('success', 'Laporan berhasil dikirim.'));
                 redirect('materi/detail/' . $materi['id'] . '/laporkan/' . $komentar['id']);
             }
             $this->twig->display('laporkan-komentar.html', $data);
             break;
         default:
         case 'download':
             # jika request download
             if ($segment_4 == 'download' and !empty($materi['file'])) {
                 $data_file = file_get_contents(get_path_file($materi['file']));
                 // Read the file's contents
                 $name_file = $materi['file'];
                 $this->materi_model->plus_views($materi['id']);
                 force_download($name_file, $data_file);
             }
             # post komentar
             $this->form_validation->set_rules('komentar', 'Komentar', 'required|trim|xss_clean');
             if ($this->form_validation->run() == true) {
                 $komentar_id = $this->komentar_model->create(get_sess_data('login', 'id'), $materi['id'], $tampil = 1, $this->input->post('komentar', true));
                 redirect('materi/detail/' . $materi['id'] . '/#komentar-' . $komentar_id);
             }
             $data['materi']['download_link'] = site_url('materi/detail/' . $materi['id'] . '/download');
             # ambil komentar
             $retrieve_all_komentar = $this->komentar_model->retrieve_all(20, (int) $segment_4, null, $materi['id'], 1);
             # format komentar
             foreach ($retrieve_all_komentar['results'] as $key => $val) {
                 $retrieve_all_komentar['results'][$key] = $this->format_komentar($val);
             }
             $data['materi']['komentar'] = $retrieve_all_komentar['results'];
             $data['materi']['jml_komentar'] = $retrieve_all_komentar['total_record'];
             $data['materi']['komentar_pagination'] = $this->pager->view($retrieve_all_komentar, 'materi/detail/' . $materi['id'] . '/');
             # cari tipenya
             if (empty($materi['file'])) {
                 $type = 'tertulis';
             } else {
                 $type = 'file';
                 $data['materi']['file_info'] = get_file_info(get_path_file($materi['file']));
                 $data['materi']['file_info']['mime'] = get_mime_by_extension(get_path_file($materi['file']));
             }
             $data['type'] = $type;
             $data['materi']['mapel'] = $this->mapel_model->retrieve($materi['mapel_id']);
             # cari materi kelas
             $arr_materi_kelas_id = array();
             $materi_kelas = $this->materi_model->retrieve_all_kelas($materi['id']);
             foreach ($materi_kelas as $mk) {
                 $arr_materi_kelas_id[] = $mk['kelas_id'];
                 $kelas = $this->kelas_model->retrieve($mk['kelas_id']);
                 $data['materi']['materi_kelas'][] = $kelas;
             }
             # cari pembuatnya
             if (!empty($materi['pengajar_id'])) {
                 $pengajar = $this->pengajar_model->retrieve($materi['pengajar_id']);
                 $data['materi']['pembuat'] = array('nama' => $pengajar['nama'], 'link_foto' => get_url_image_pengajar($pengajar['foto'], 'medium', $pengajar['jenis_kelamin']));
                 if (is_admin()) {
                     $data['materi']['pembuat']['link_profil'] = site_url('pengajar/detail/' . $pengajar['status_id'] . '/' . $pengajar['id']);
                 } else {
                     $data['materi']['pembuat']['link_profil'] = site_url('pengajar/detail/' . $pengajar['id']);
                 }
             }
             if (!empty($materi['siswa_id'])) {
                 $siswa = $this->siswa_model->retrieve($materi['siswa_id']);
                 $data['materi']['pembuat'] = array('nama' => $siswa['nama'], 'link_foto' => get_url_image_siswa($siswa['foto'], 'medium', $siswa['jenis_kelamin']));
                 if (is_admin()) {
                     $data['materi']['pembuat']['link_profil'] = site_url('siswa/detail/' . $siswa['status_id'] . '/' . $siswa['id']);
                 } else {
                     $data['materi']['pembuat']['link_profil'] = site_url('siswa/detail/' . $siswa['id']);
                 }
             }
             # cari materi terkait
             $retrieve_terkait_mapel = $this->materi_model->retrieve_all($no_of_records = 10, $page_no = 1, $pengajar_id = array(), $siswa_id = array(), $mapel_id = array($materi['mapel_id']), $judul = null, $konten = null, $tgl_posting = null, $publish = 1, $kelas_id = array(), $type = array(), $pagination = false);
             $data_terkait = array();
             foreach ($retrieve_terkait_mapel as $row) {
                 if (empty($data_terkait[$row['id']]) and $row['id'] != $materi['id'] and count($data_terkait) <= 20) {
                     $data_terkait[$row['id']] = $row;
                 }
             }
             $retrieve_terkait_kelas = $this->materi_model->retrieve_all($no_of_records = 10, $page_no = 1, $pengajar_id = array(), $siswa_id = array(), $mapel_id = array(), $judul = null, $konten = null, $tgl_posting = null, $publish = 1, $kelas_id = $arr_materi_kelas_id, $type = array(), $pagination = false);
             foreach ($retrieve_terkait_kelas as $row) {
                 if (empty($data_terkait[$row['id']]) and $row['id'] != $materi['id'] and count($data_terkait) <= 20) {
                     $data_terkait[$row['id']] = $row;
                 }
             }
             $data['terkait'] = $data_terkait;
             # setup componen SyntaxHighlighter
             $html_js = load_comp_js(array(base_url('assets/comp/SyntaxHighlighter/scripts/shCore.js'), base_url('assets/comp/SyntaxHighlighter/scripts/shBrushAppleScript.js'), base_url('assets/comp/SyntaxHighlighter/scripts/shBrushAS3.js'), base_url('assets/comp/SyntaxHighlighter/scripts/shBrushBash.js'), base_url('assets/comp/SyntaxHighlighter/scripts/shBrushColdFusion.js'), base_url('assets/comp/SyntaxHighlighter/scripts/shBrushCpp.js'), base_url('assets/comp/SyntaxHighlighter/scripts/shBrushCSharp.js'), base_url('assets/comp/SyntaxHighlighter/scripts/shBrushCss.js'), base_url('assets/comp/SyntaxHighlighter/scripts/shBrushDelphi.js'), base_url('assets/comp/SyntaxHighlighter/scripts/shBrushDiff.js'), base_url('assets/comp/SyntaxHighlighter/scripts/shBrushErlang.js'), base_url('assets/comp/SyntaxHighlighter/scripts/shBrushGroovy.js'), base_url('assets/comp/SyntaxHighlighter/scripts/shBrushJava.js'), base_url('assets/comp/SyntaxHighlighter/scripts/shBrushJavaFX.js'), base_url('assets/comp/SyntaxHighlighter/scripts/shBrushJScript.js'), base_url('assets/comp/SyntaxHighlighter/scripts/shBrushPerl.js'), base_url('assets/comp/SyntaxHighlighter/scripts/shBrushPhp.js'), base_url('assets/comp/SyntaxHighlighter/scripts/shBrushPlain.js'), base_url('assets/comp/SyntaxHighlighter/scripts/shBrushPowerShell.js'), base_url('assets/comp/SyntaxHighlighter/scripts/shBrushPython.js'), base_url('assets/comp/SyntaxHighlighter/scripts/shBrushRuby.js'), base_url('assets/comp/SyntaxHighlighter/scripts/shBrushSass.js'), base_url('assets/comp/SyntaxHighlighter/scripts/shBrushScala.js'), base_url('assets/comp/SyntaxHighlighter/scripts/shBrushSql.js'), base_url('assets/comp/SyntaxHighlighter/scripts/shBrushVb.js'), base_url('assets/comp/SyntaxHighlighter/scripts/shBrushXml.js'), base_url('assets/comp/mathjax/MathJax.js?config=TeX-AMS-MML_HTMLorMML')));
             $html_js .= '<script type="text/javascript">SyntaxHighlighter.all();</script>';
             # setup tinymce komentar
             $tiny_option = 'theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,bullist,numlist,|,link,unlink,|,sub,sup,charmap,tiny_mce_wiris_formulaEditor,|,emotions,image,media,youtubeIframe,syntaxhl,code",
             theme_advanced_buttons2 : "",
             theme_advanced_buttons3 : "",
             theme_advanced_toolbar_location : "top",
             theme_advanced_toolbar_align : "left",
             theme_advanced_statusbar_location : "bottom",
             file_browser_callback : "openKCFinder",
             theme_advanced_resizing : false,
             content_css : "' . base_url('assets/comp/tinymce/com/content.css') . '",
             convert_urls: false,
             force_br_newlines : false,
             force_p_newlines : false,';
             $html_js .= get_tinymce('komentar', 'advanced', array('pdw'), $tiny_option);
             # setup colorbox
             $html_js .= load_comp_js(array(base_url('assets/comp/colorbox/jquery.colorbox-min.js'), base_url('assets/comp/colorbox/act-materi.js')));
             $data['comp_js'] = $html_js;
             $data['comp_css'] = load_comp_css(array(base_url('assets/comp/SyntaxHighlighter/styles/shCoreEclipse.css'), base_url('assets/comp/colorbox/colorbox.css')));
             $this->twig->display('detail-materi.html', $data);
             break;
     }
 }
foreach ($tables as $table) {
    ?>
				
					CREATE TABLE auditoria.<?php 
    echo 'auditoria_' . $table->name;
    ?>
(<br>
						id_auditoria SERIAL,<br>
						tipo_alteracao_auditoria character(1),<br>
						data_registro_auditoria TIMESTAMP,<br>
						usuario_banco_auditoria name,<br>
						<?php 
    for ($i = 0; $i < sizeof($table->fields); $i++) {
        ?>
							<?php 
        echo create_field($table->fields[$i]);
        ?>
							<?php 
        if ($i < sizeof($table->fields) - 1) {
            ?>
							,
							<?php 
        }
        ?>
<br>
						<?php 
    }
    ?>
							
					);
					<br>
Exemple #3
0
 function submit_upload($tugas_id = '', $unix_id = '')
 {
     if (!is_siswa()) {
         redirect('tugas');
     }
     $tugas_id = (int) $tugas_id;
     $tugas = $this->tugas_model->retrieve($tugas_id);
     if (empty($tugas) or $tugas['type_id'] != 1) {
         redirect('tugas');
     }
     if (empty($unix_id)) {
         redirect('tugas');
     }
     # cek sudah mengerjakan belum
     if (sudah_ngerjakan($tugas['id'], get_sess_data('user', 'id'))) {
         $this->session->set_flashdata('tugas', get_alert('warning', 'Anda sudah mengerjakan tugas ini.'));
         redirect('tugas');
     }
     $field_id = 'mengerjakan-' . get_sess_data('user', 'id') . '-' . $tugas['id'];
     $check_field = retrieve_field($field_id);
     if (!empty($check_field)) {
         # bandingkan unix_id nya
         $check_field_value = json_decode($check_field['value'], 1);
         if ($unix_id != $check_field_value['unix_id']) {
             $this->session->set_flashdata('tugas', get_alert('warning', 'Anda tidak mengerjakan tugas ini.'));
             redirect('tugas');
         }
         $config['upload_path'] = get_path_file();
         $config['allowed_types'] = 'doc|zip|rar|txt|docx|xls|xlsx|pdf|tar|gz|jpg|jpeg|JPG|JPEG|png|ppt|pptx';
         $config['max_size'] = '0';
         $config['max_width'] = '0';
         $config['max_height'] = '0';
         $config['file_name'] = $unix_id;
         $this->upload->initialize($config);
         if ($this->upload->do_upload()) {
             $upload_data = $this->upload->data();
             $check_field_value['file_name'] = $upload_data['file_name'];
         } else {
             $this->session->set_flashdata('upload', '<span class="text-error">' . $this->upload->display_errors() . '</span>');
             redirect('tugas/kerjakan/' . $tugas['id']);
         }
         # hapus field tambahan
         delete_field($field_id);
         # simpan history
         $new_field_id = 'history-mengerjakan-' . get_sess_data('user', 'id') . '-' . $tugas['id'];
         $sekarang = date('Y-m-d H:i:s');
         $check_field_value['tgl_submit'] = $sekarang;
         create_field($new_field_id, 'History pengerjaan tugas', json_encode($check_field_value));
         $this->session->set_flashdata('tugas', get_alert('success', 'Anda telah berhasil mengerjakan tugas ini.'));
         redirect('tugas');
     }
     redirect('tugas');
 }
Exemple #4
0
function db_update($new, $old, &$out = null, $echo = null)
{
    foreach ($new as $new_table_title => $new_table) {
        $new_table['title'] = $new_table_title;
        if (is_array($old[$new_table_title])) {
            $old_fields = $old[$new_table_title]['fields'];
            foreach ($new_table['fields'] as $new_field_title => $new_field) {
                if (isset($new_field['db'])) {
                    $new_field = $new_field['db'];
                }
                if (!is_array($old_fields[$new_field_title])) {
                    $alter = false;
                    if (is_array($new_field['prev'])) {
                        foreach ($new_field['prev'] as $old_field_title) {
                            if (is_array($old_fields[$old_field_title])) {
                                $new_field['title'] = $new_field_title;
                                $new_field = create_field($new_field, $error);
                                if (!$new_field) {
                                    error($error);
                                }
                                $queries[] = "ALTER TABLE `{$new_table['title']}` CHANGE `{$old_field_title}` {$new_field}";
                                $alter = true;
                            }
                        }
                    }
                    if (!$alter) {
                        $new_field['title'] = $new_field_title;
                        $new_field = create_field($new_field, $error);
                        if (!$new_field) {
                            error($error);
                        }
                        $queries[] = "ALTER TABLE `{$new_table['title']}` ADD {$new_field}";
                    }
                } else {
                    $old_field = $old_fields[$new_field_title];
                    $alter = false;
                    foreach ($new_field as $new_field_param => $new_field_val) {
                        switch ($new_field_param) {
                            case 'prev':
                                break;
                            default:
                                if ($old_field[$new_field_param] != $new_field_val) {
                                    $alter = true;
                                }
                        }
                    }
                    if ($alter) {
                        $new_field['title'] = $new_field_title;
                        $new_field = create_field($new_field, $error);
                        if (!$new_field) {
                            error($error);
                        }
                        $queries[] = "ALTER TABLE `{$new_table['title']}` CHANGE `{$new_field_title}` {$new_field}";
                    }
                }
            }
            // dropping fields is probably a bad idea in case an update goes wrong
            // the developer has responsibility but the framework shouldn't be so destructive
            // foreach ($old_fields as $old_field_title => $old_field){
            // 	if (!isset($new_table['fields'][$old_field_title])){
            // 		$queries[]="ALTER TABLE `".$new_table['title']."` DROP `".$old_field_title."`";
            // 	}
            // }
            if (is_array($new_table['index'])) {
                foreach ($new_table['index'] as $index) {
                    if (!@in_array($index, $old[$new_table['title']]['index'])) {
                        $queries[] = "ALTER TABLE `{$new_table['title']}` ADD INDEX (`{$index}`)";
                    }
                }
            }
            if (is_array($old[$new_table['title']]['index'])) {
                foreach ($old[$new_table['title']]['index'] as $index) {
                    if (!@in_array($index, $new_table['index'])) {
                        $queries[] = "ALTER TABLE `{$new_table['title']}` DROP INDEX `{$index}`";
                    }
                }
            }
        } elseif (is_array($new_table['prev'])) {
            foreach ($new_table['prev'] as $old_table_title) {
                if (is_array($old[$old_table_title])) {
                    $queries[] = "RENAME TABLE `{$old_table_title}` TO `{$new_table['title']}`";
                }
            }
        } else {
            $create = create_table($new_table, $error);
            if (empty($create)) {
                error($error);
            }
            $queries[] = $create;
            if (is_array($new_table['index'])) {
                foreach ($new_table['index'] as $index) {
                    $queries[] = "ALTER TABLE `{$new_table['title']}` ADD INDEX (`{$index}`)";
                }
            }
        }
        if (is_array($new_table['triggers'])) {
            foreach ($new_table['triggers'] as $trigger_type => $trigger) {
                $trigger_name = $new_table['title'] . '_' . $trigger_type;
                // need to ensure it doesn't crash the process if user lacks privilege or trigger exists
                // $queries[]="CREATE TRIGGER `$trigger_name` BEFORE $trigger_type ON `{$new_table['title']}` FOR EACH ROW $trigger";
            }
        }
    }
    log_file($queries, 'DB Update', 'db.log');
    if (!$echo) {
        if (is_array($queries)) {
            foreach ($queries as $query) {
                $query = query($query, null, null, null, null, true);
                $out .= $query . '<br/>';
            }
        }
    } else {
        echo_array($queries);
        die;
    }
}
Exemple #5
0
					</form>
				</fieldset>
				
				<!-- Register -->
				<fieldset>
					<legend>Register</legend>
					<form name="register" onsubmit="return clientvalidate(this);" method="POST" action="Account.php" >						
						<ul class="textcontrols">
							<?php 
    create_field("RUser", "Username", "username", "text", false, "Must start with a letter, and only contain letters and numbers.");
    create_field("RAddr", "Address", "address", "text", false, "ie. 5 Streetname, Suburb 4504");
    display_states("RState", "QLD");
    create_field("REmail", "Email Address", "email", "email", false, null);
    create_radios("RGend", "gender", "M", "Male", "F", "Female");
    create_field("RPass", "Password", "password", "password", false, null);
    create_field("RConf", "Confirm Password", "confpassword", "password", false, null);
    createSubmit("register", "Register Account!", "RErr");
    ?>
						</ul>
					</form>
				</fieldset>
								
				<?php 
}
?>
			</div>
			<?php 
include_once 'incfiles/asgnFooter.inc';
?>
		</div>
	</body>
function buddyforms_acf_frontend_form_elements($form, $form_args)
{
    global $buddyforms, $nonce;
    extract($form_args);
    $post_type = $buddyforms[$form_slug]['post_type'];
    if (!$post_type) {
        return $form;
    }
    if (!isset($customfield['type'])) {
        return $form;
    }
    switch ($customfield['type']) {
        case 'acf-field':
            $post_id = $post_id == 0 ? 'new_post' : $post_id;
            $form->addElement(new Element_HTML('<div id="poststuff">'));
            if (!$nonce) {
                $form->addElement(new Element_HTML('<input type="hidden" name="acf_nonce" value="' . wp_create_nonce('input') . '" />'));
                $nonce = 'nonce';
            }
            if (!isset($customfield['acf_field'])) {
                return $form;
            }
            $field = get_field_object($customfield['acf_field'], $post_id);
            // make sure we have a field key. If user switc from free to pro ACF this can happen so we need to catch it...
            if (!isset($field['key'])) {
                return $form;
            }
            $field['name'] = 'fields[' . $field['key'] . ']';
            ob_start();
            if (post_type_exists('acf-field-group')) {
                create_field($field, $post_id);
            } else {
                do_action('acf/create_field', $field, $post_id);
            }
            $acf_form_field = ob_get_clean();
            $required_class = '';
            // if the field type is not set for any reason, make it a text field. This check is again in tplace for people how switch from pro to free and have some elements with no type
            $field_type = isset($field['type']) ? $field['type'] : 'text';
            // Create the BuddyForms Form Element Structure
            if (post_type_exists('acf-field-group')) {
                // Create the BuddyForms Form Element Structure
                $form->addElement(new Element_HTML('
                          <div id="acf-' . $field['name'] . '" class="bf_field_group acf-field acf-field-' . $field_type . ' acf-field' . $field['key'] . $required_class . '" data-name="' . $field['name'] . '" data-key="' . $field['key'] . '" data-type="' . $field_type . '"><label for="' . $field['name'] . '">'));
            } else {
                // Create the BuddyForms Form Element Structure
                $form->addElement(new Element_HTML('
                          <div id="acf-' . $field['name'] . '" class="bf_field_group field field_type-' . $field_type . ' field_key-' . $field['key'] . $required_class . '" data-field_name="' . $field['name'] . '" data-field_key="' . $field['key'] . '" data-field_type="' . $field_type . '"><label for="' . $field['name'] . '">'));
            }
            if ($field['required']) {
                $form->addElement(new Element_HTML('<span class="required" aria-required="true">* </span>'));
                $acf_form_field = str_replace('type=', 'required type=', $acf_form_field);
            }
            $acf_form_field = str_replace('acf-input-wrap', '', $acf_form_field);
            if ($field['instructions']) {
                $form->addElement(new Element_HTML('<smal>' . $field['instructions'] . '</smal>'));
            }
            $form->addElement(new Element_HTML('<div class="bf_inputs"> ' . $acf_form_field . '</div> '));
            $form->addElement(new Element_HTML('</div>'));
            $form->addElement(new Element_HTML('</div>'));
            //acf_form($new_post);
            break;
        case 'acf-group':
            $post_id = $post_id == 0 ? 'new_post' : $post_id;
            // load fields
            if (post_type_exists('acf-field-group')) {
                $fields = acf_get_fields((int) $customfield['acf_group']);
            } else {
                $fields = apply_filters('acf/field_group/get_fields', array(), $customfield['acf_group']);
            }
            if (!isset($fields) || !is_array($fields)) {
                return $form;
            }
            $form->addElement(new Element_HTML('<div id="poststuff">'));
            if (!$nonce) {
                $form->addElement(new Element_HTML('<input type="hidden" name="acf_nonce" value="' . wp_create_nonce('input') . '" />'));
                $nonce = 'nonce';
            }
            foreach ($fields as $field) {
                // set value
                if (!isset($field['value'])) {
                    if (post_type_exists('acf-field-group')) {
                        $field['value'] = get_field($field['name'], $post_id, false);
                    } else {
                        $field['value'] = apply_filters('acf/load_value', false, $post_id, $field);
                        $field['value'] = apply_filters('acf/format_value', $field['value'], $post_id, $field);
                    }
                }
                ob_start();
                if (post_type_exists('acf-field-group')) {
                    create_field($field, $post_id);
                } else {
                    do_action('acf/create_field', $field, $post_id);
                    // create field specific html
                    do_action("acf/render_field", $field);
                    do_action("acf/render_field/type={$field['type']}", $field);
                }
                $acf_form_field = ob_get_clean();
                $required_class = '';
                if (post_type_exists('acf-field-group')) {
                    // Create the BuddyForms Form Element Structure
                    $form->addElement(new Element_HTML('
                          <div id="acf-' . $field['name'] . '" class="bf_field_group acf-field acf-field-' . $field['type'] . ' acf-field' . $field['key'] . $required_class . '" data-name="' . $field['name'] . '" data-key="' . $field['key'] . '" data-type="' . $field['type'] . '"><label for="' . $field['name'] . '">'));
                } else {
                    // Create the BuddyForms Form Element Structure
                    $form->addElement(new Element_HTML('
                          <div id="acf-' . $field['name'] . '" class="bf_field_group field field_type-' . $field['type'] . ' field_key-' . $field['key'] . $required_class . '" data-field_name="' . $field['name'] . '" data-field_key="' . $field['key'] . '" data-field_type="' . $field['type'] . '"><label for="' . $field['name'] . '">'));
                }
                if ($field['required']) {
                    $form->addElement(new Element_HTML('<span class="required" aria-required="true">* </span>'));
                    $acf_form_field = str_replace('type=', 'required type=', $acf_form_field);
                }
                $acf_form_field = str_replace('acf-input-wrap', '', $acf_form_field);
                if ($field['instructions']) {
                    $form->addElement(new Element_HTML('<smal>' . $field['instructions'] . '</smal>'));
                }
                $form->addElement(new Element_HTML('<div class="bf_inputs"> ' . $acf_form_field . '</div> '));
                $form->addElement(new Element_HTML('</div>'));
            }
            $form->addElement(new Element_HTML('</div>'));
            break;
    }
    return $form;
}