Exemple #1
0
function siw_update_vfb_mail_template($form)
{
    $vfb_form_id = siw_get_vfb_form_id($form);
    //haal mail-template
    global $wp_filesystem;
    $directory = $wp_filesystem->wp_themes_dir('siw');
    $filename = $directory . "/siw/assets/html/mail/vfb_{$form}.html";
    $template = $wp_filesystem->get_contents($filename);
    //ondertekening naam
    $signature = siw_get_mail_signature_name("aanmelding_{$form}");
    $template = str_replace("[_signature_{$form}]", $signature, $template);
    //update template
    global $wpdb;
    if (!isset($wpdb->vfbp_formmeta)) {
        $wpdb->vfbp_formmeta = $wpdb->prefix . 'vfbp_formmeta';
    }
    $wpdb->query($wpdb->prepare("UPDATE {$wpdb->vfbp_formmeta}\n\t\t\tSET meta_value = %s\n\t\t\t\tWHERE {$wpdb->vfbp_formmeta}.meta_key  = 'email-template'\n\t\t\t\tAND {$wpdb->vfbp_formmeta}.form_id = %d", $template, $vfb_form_id));
}
function siw_get_vfb_applications_per_month($form, $results)
{
    $form_id = siw_get_vfb_form_id($form);
    global $wpdb;
    $query = "SELECT Year({$wpdb->posts}.post_date)  AS application_year, \n\t\t\t\t\t\tMonth({$wpdb->posts}.post_date) AS application_month, \n\t\t\t\t\t\tCount(*) \t\t\t\t      AS application_count \n\t\t\t\t\tFROM   {$wpdb->posts} \n\t\t\t\t\t\tJOIN {$wpdb->postmeta} \n\t\t\t\t\t\t\tON {$wpdb->posts}.id = {$wpdb->postmeta}.post_id \n\t\t\t\t\tWHERE  {$wpdb->posts}.post_type = 'vfb_entry' \n\t\t\t\t\t\tAND {$wpdb->postmeta}.meta_key = '_vfb_form_id' \n\t\t\t\t\t\tAND {$wpdb->postmeta}.meta_value = %d \n\t\t\t\t\tGROUP  BY application_year, \n\t\t\t\t\t\t\tapplication_month \n\t\t\t\t\tORDER  BY application_year DESC, \n\t\t\t\t\t\t\tapplication_month DESC \n\t\t\t\t\tLIMIT  %d; ";
    $applications = $wpdb->get_results($wpdb->prepare($query, $form_id, $results), ARRAY_A);
    return $applications;
}
<?php 
global $post;
$id = $post->ID;
$start_ts = get_post_meta($id, 'siw_agenda_start', true);
$start_date = date("Y-m-d", $start_ts);
$end_ts = get_post_meta($id, 'siw_agenda_eind', true);
$date_range = siw_get_date_range_in_text(date("Y-m-d", $start_ts), date("Y-m-d", $end_ts), false);
$start_time = date("H:i", $start_ts);
$end_time = date("H:i", $end_ts);
$program = get_post_meta($id, 'siw_agenda_programma', true);
$description = get_post_meta($id, 'siw_agenda_beschrijving', true);
$location = get_post_meta($id, 'siw_agenda_locatie', true);
$address = get_post_meta($id, 'siw_agenda_adres', true);
$postal_code = get_post_meta($id, 'siw_agenda_postcode', true);
$city = get_post_meta($id, 'siw_agenda_plaats', true);
$vfb_form_id = siw_get_vfb_form_id('community_day');
$application = get_post_meta($id, 'siw_agenda_aanmelden', true);
$application_explanation = get_post_meta($id, 'siw_agenda_aanmelden_toelichting', true);
$application_link_url = get_post_meta($id, 'siw_agenda_aanmelden_link_url', true);
$application_link_text = get_post_meta($id, 'siw_agenda_aanmelden_link_tekst', true);
$location_map = '[gmap address="' . $address . ', ' . $postal_code . ' ' . $city . '" title="' . $location . '" zoom="15" maptype="ROADMAP"]';
$hide_form_days_before_cd = siw_get_hide_form_days_before_cd();
$limit_date = date("Y-m-d", strtotime(date("Y-m-d") . "+" . $hide_form_days_before_cd . " days"));
$text_after_hide_cd_form = siw_get_text_after_hide_cd_form();
$agenda_page_url = get_permalink(siw_get_parent_page('agenda'));
?>
	
<div id="content" class="container">
    <div class="row single-article">
		<div class="main col-md-12 kt-nosidebar" role="main">
		<?php 
Exemple #4
0
function siw_settings_show_vfb_field($option)
{
    $form_id = siw_get_vfb_form_id('community_day');
    global $wpdb;
    if (!isset($wpdb->vfbp_fields)) {
        $wpdb->vfbp_fields = $wpdb->prefix . 'vfbp_fields';
    }
    $query = "SELECT {$wpdb->vfbp_fields}.id, {$wpdb->vfbp_fields}.data FROM {$wpdb->vfbp_fields} WHERE {$wpdb->vfbp_fields}.form_id = %d ORDER BY {$wpdb->vfbp_fields}.field_order ASC";
    $fields = $wpdb->get_results($wpdb->prepare($query, $form_id), ARRAY_A);
    if (!empty($fields)) {
        echo '<select name="', esc_attr($option), '">';
        foreach ($fields as $field) {
            $id = $field['id'];
            $label = maybe_unserialize($field['data'])['label'];
            echo '<option value="', $id, '"', get_option($option) == $id ? ' selected="selected"' : '', '>', esc_html($label), '</option>';
        }
        echo '</select>';
    }
}