function acf_load_pof_task_duration($field) { $items = pof_taxonomy_translate_get_items_by_taxonomy_base_key("taskduration"); if (count($items) > 1) { $field['choices'] = array(); foreach ($items as $item_key => $item) { $field['choices'][str_replace("taskduration::", "", $item_key)] = $item; } } return $field; }
function pof_content_status_tags_get_sub_form($selected_taxonomy) { $taxonomy_options = pof_content_status_tags_get_tag_options(); $taxonomy_option = $taxonomy_options[$selected_taxonomy]; $options = pof_taxonomy_translate_get_items_by_taxonomy_base_key($selected_taxonomy); $ret = ""; $ret .= "<form method=\"POST\">"; $ret .= "<input type=\"hidden\" name=\"pof_taxonomy\" value=\"" . $selected_taxonomy . "\" />"; $selected_tag = ''; if (isset($_POST) && isset($_POST["pof_tag"])) { $selected_tag = $_POST["pof_tag"]; } $ret .= "Valitse tagi: <br />"; $ret .= '<select name="pof_tag">'; if ($taxonomy_option->type == 'boolean') { foreach ($options as $option_key => $option_value) { if (in_array($option_key, $taxonomy_option->options)) { $count = pof_content_status_tag_count($selected_taxonomy, $option_key); $non_count = pof_content_status_tag_count($selected_taxonomy, 'NON_' . $option_key); if ($selected_tag == $option_key) { $ret .= "<option selected=\"selected\" value=\"" . $option_key . "\">" . $option_value . " (" . $option_key . ") (" . $count . ")</option>\n"; } else { $ret .= "<option value=\"" . $option_key . "\">" . $option_value . " (" . $option_key . ") (" . $count . ")</option>\n"; } if ($selected_tag == 'NON_' . $option_key) { $ret .= "<option selected=\"selected\" value=\"" . 'NON_' . $option_key . "\">!" . $option_value . " (" . 'NON_' . $option_key . ") (" . $non_count . ")</option>\n"; } else { $ret .= "<option value=\"" . 'NON_' . $option_key . "\">!" . $option_value . " (" . 'NON_' . $option_key . ") (" . $non_count . ")</option>\n"; } } } } else { foreach ($options as $option_key => $option_value) { $count = pof_content_status_tag_count($selected_taxonomy, $option_key); if ($selected_tag == $option_key) { $ret .= "<option selected=\"selected\" value=\"" . $option_key . "\">" . $option_value . " (" . $option_key . ") (" . $count . ")</option>\n"; } else { $ret .= "<option value=\"" . $option_key . "\">" . $option_value . " (" . $option_key . ") (" . $count . ")</option>\n"; } } } $ret .= '</select>'; $ret .= '<input type="submit" name="Submit" value="Vaihda" />'; $ret .= "</form>"; return $ret; }
if ($filter_tags == "all" || strstr($filter_tags, "suoritus_valmistelu_kesto")) { //TaskPreparationDuration $item_tax_key = 'taskpreparationduration'; $items = pof_taxonomy_translate_get_items_by_taxonomy_base_key($item_tax_key); $ret->suoritus_valmistelu_kesto = pof_pages_get_tags($languages, $items, $item_tax_key); } if ($filter_tags == "all" || strstr($filter_tags, "tarvikkeet")) { //Equipments $item_tax_key = 'equpments'; $items = pof_taxonomy_translate_get_items_by_taxonomy_base_key($item_tax_key); $ret->tarvikkeet = pof_pages_get_tags($languages, $items, $item_tax_key); } if ($filter_tags == "all" || strstr($filter_tags, "taitoalueet")) { //Taitoalueet $item_tax_key = 'skillarea'; $items = pof_taxonomy_translate_get_items_by_taxonomy_base_key($item_tax_key); $ret->taitoalueet = pof_pages_get_tags($languages, $items, $item_tax_key); } if ($filter_tags == "all" || strstr($filter_tags, "kasvatustavoitteet")) { //Kasvatustavoitteet $item_tax_key = 'growth_target'; $items = pof_taxonomy_translate_get_items_by_taxonomy_base_key($item_tax_key); $ret->kasvatustavoitteet = pof_pages_get_tags($languages, $items, $item_tax_key); } if ($filter_tags == "all" || strstr($filter_tags, "yleiset")) { //Yleiset $item_tax_key = 'common'; $items = pof_taxonomy_translate_get_items_by_taxonomy_base_key($item_tax_key); $ret->yleiset = pof_pages_get_tags($languages, $items, $item_tax_key); } echo json_encode($ret);
function pof_taxonomy_icons_taskterm() { $taxonomy_base_key = "task_term"; $items = pof_taxonomy_translate_get_items_by_taxonomy_base_key($taxonomy_base_key); $title = "Aktiviteetin yläkäsite"; $title2 = "Termi"; pof_taxonomy_icons_form($taxonomy_base_key, $items, $title, $title2); }
function pof_importer_get_places($places_str) { global $wpdb; $taxonomy_base_key = "place_of_performance"; global $pof_importer_driverimporter_places; if (count($pof_importer_driverimporter_places) == 0) { $pof_importer_driverimporter_places = pof_taxonomy_translate_get_items_by_taxonomy_base_key($taxonomy_base_key, true); } $ret = array(); $parts = explode(',', $places_str); foreach ($parts as $part) { $part = trim($part); $part_key = array_search(strtolower($part), $pof_importer_driverimporter_places); if ($part_key == false) { $part_tmp = str_replace(" ", "_", strtolower($part)); $taxonomy_full_key = $taxonomy_base_key . "::" . sanitize_title_with_dashes(pof_importer_normalize_key($part_tmp)); $tmp = $wpdb->insert(pof_taxonomy_translate_get_table_name(), array('taxonomy_slug' => $taxonomy_full_key, 'agegroup_id' => 0, 'lang' => 'fi', 'content' => $part), array('%s', '%d', '%s', '%s')); $pof_importer_driverimporter_places = pof_taxonomy_translate_get_items_by_taxonomy_base_key($taxonomy_base_key, true); } $part_key = str_replace($taxonomy_base_key . '::', "", $part_key); array_push($ret, $part_key); } return $ret; }
function pof_taxonomy_translate_form_view() { $taxonomies = array(); $taxonomies['place_of_performance'] = "Suorituspaikat"; $taxonomies['groupsize'] = "Ryhmäkoot"; $taxonomies['mandatory'] = "Pakollisuus"; $taxonomies['taskduration'] = "Aktiviteetin kestot"; $taxonomies['taskpreaparationduration'] = "Aktiviteetin valmistelun kestot"; $taxonomies['equpment'] = "Tarvikkeet"; $taxonomies['skillarea'] = "Taitoalueet"; $taxonomies['growth_target'] = "Kasvatustavoitteen avainsanat"; $taxonomies['taskgroup_term'] = "Aktiviteettipaketin yläkäsite"; global $wpdb; $table_name = pof_taxonomy_translate_get_table_name(); $languages = pof_taxonomy_translate_get_languages(); $agegroups = pof_taxonomy_translate_get_agegroups(); $selected_lang = 'fi'; $taxonomy_base_key = "place_of_performance"; if (isset($_POST['language'])) { $selected_lang = $_POST['language']; } if (isset($_POST['taxonomy'])) { $taxonomy_base_key = $_POST['taxonomy']; } $items = pof_taxonomy_translate_get_items_by_taxonomy_base_key($taxonomy_base_key); $title = $taxonomies[$taxonomy_base_key]; echo '<div class="wrap">'; echo '<h1>' . $title . '</h1>'; echo '<form method="post" action="">'; echo 'Valitse taksonomia:'; echo '<select name="taxonomy">'; foreach ($taxonomies as $taxonomy_key => $taxonomy_title) { if ($taxonomy_key == $taxonomy_base_key) { echo '<option selected="selected" value="' . $taxonomy_key . '">' . $taxonomy_title . '</option>'; } else { echo '<option value="' . $taxonomy_key . '">' . $taxonomy_title . '</option>'; } } echo '</select>'; echo '<br />'; echo 'Valitse kieli:'; echo '<select name="language">'; foreach ($languages as $lang_key => $lang) { if ($lang_key == $selected_lang) { echo '<option selected="selected" value="' . $lang_key . '">' . $lang . '</option>'; } else { echo '<option value="' . $lang_key . '">' . $lang . '</option>'; } } echo '</select>'; echo '<br />'; echo '<input type="submit" value="Vaihda" />'; echo '</form>'; echo '<br /><br /><br />'; echo '<h2>Kieli: ' . $languages[$selected_lang] . ' (' . $selected_lang . ')</h2>'; echo '<table cellpadding="2" cellspacing="2" border="2">'; echo '<thead>'; echo '<tr>'; echo '<th></th>'; foreach ($agegroups as $agegroup) { echo '<th><h2>' . $agegroup->title . '</h2></th>'; } echo '</tr>'; echo '</thead>'; echo '<tbody>'; foreach ($items as $tmp_key => $tmp_title) { echo '<tr>'; echo '<td>' . $tmp_title . '<br /> (' . $tmp_key . ')</td>'; foreach ($agegroups as $agegroup) { echo '<td>'; $translation = pof_taxonomy_translate_get_translation($taxonomy_base_key, $tmp_key, $agegroup->id, $selected_lang, false); $translation_content = ""; if (!empty($translation)) { $translation_content = $translation[0]->content; } echo $translation_content; echo '</td>'; } echo '</tr>'; } echo '</tbody>'; echo '</table>'; echo '</div>'; }
function pof_taxonomy_translate_common() { $taxonomy_base_key = "common"; $items = pof_taxonomy_translate_get_items_by_taxonomy_base_key($taxonomy_base_key); $title = "Yleiset"; $title2 = "Termi"; pof_taxonomy_translate_form($taxonomy_base_key, $items, $title, $title2); }
function pof_taxonomy_searchpage_get_items_by_taxonomy_base_key($taxonomy_base_key, $tolower = false) { $ret = array(); global $wpdb; $table_name = pof_taxonomy_searchpage_get_table_name(); if ($taxonomy_base_key == 'equipment' || $taxonomy_base_key == 'skillarea') { $all_items = array(); foreach (get_terms('pof_tax_' . $taxonomy_base_key) as $term) { $all_items[$term->slug] = $term->name; } } else { $all_items = pof_taxonomy_translate_get_items_by_taxonomy_base_key($taxonomy_base_key, $tolower); } $searchpage_res = $wpdb->get_results("\r\n\t\tSELECT taxonomy_slug\r\n\t\tFROM " . pof_taxonomy_searchpage_get_table_name() . "\r\n\t\tWHERE taxonomy_base = '" . $taxonomy_base_key . "'\r\n\t\t", ARRAY_N); $enabled_keys = array(); foreach ($searchpage_res as $search_result) { array_push($enabled_keys, $search_result[0]); } foreach ($all_items as $item_key => $item) { $ret[$item_key] = new stdClass(); $ret[$item_key]->title = $item; $ret[$item_key]->enabled = false; if (in_array($taxonomy_base_key . "::" . $item_key, $enabled_keys)) { $ret[$item_key]->enabled = true; } } return $ret; }