Ejemplo n.º 1
0
function get_childs_for_suoritepaketti($parent_id)
{
    $ret = array('name' => 'childs');
    $args = array('numberposts' => -1, 'posts_per_page' => -1, 'post_type' => 'pof_post_taskgroup', 'meta_key' => 'suoritepaketti', 'meta_value' => $parent_id);
    $the_query = new WP_Query($args);
    if ($the_query->have_posts()) {
        while ($the_query->have_posts()) {
            $the_query->the_post();
            pof_checkDatetime($the_query->post);
            $tmp = array('name' => 'node', 'attributes' => array('type' => "taskgroup"), array('name' => 'title', 'value' => $the_query->post->post_title), array('name' => 'guid', 'value' => wp_hash($the_query->post->id)), array('name' => 'id', 'value' => $the_query->post->ID), array('name' => 'details', 'value' => get_site_url() . "/item-xml/?postID=" . $the_query->post->ID), get_post_tags_XML($the_query->post->ID), get_post_images_XML($the_query->post->ID), get_childs_for_suoritepaketti($the_query->post->ID));
            array_push($ret, $tmp);
        }
    }
    wp_reset_query();
    $args = array('numberposts' => -1, 'posts_per_page' => -1, 'post_type' => 'pof_post_task', 'meta_key' => 'suoritepaketti', 'meta_value' => $parent_id);
    $the_query = new WP_Query($args);
    if ($the_query->have_posts()) {
        while ($the_query->have_posts()) {
            $the_query->the_post();
            pof_checkDatetime($the_query->post);
            $tmp = array('name' => 'node', 'attributes' => array('type' => "task"), array('name' => 'title', 'value' => $the_query->post->post_title), array('name' => 'guid', 'value' => wp_hash($the_query->post->id)), array('name' => 'id', 'value' => $the_query->post->ID), array('name' => 'details', 'value' => get_site_url() . "/item-xml/?postID=" . $the_query->post->ID), get_post_tags_XML($the_query->post->ID), get_post_images_XML($the_query->post->ID));
            array_push($ret, $tmp);
        }
    }
    wp_reset_query();
    return $ret;
}
Ejemplo n.º 2
0
function getJsonTree($root_id)
{
    $classPrograms = "POFTREE\\programs";
    $classProgram = "POFTREE\\program";
    $root_post = get_post($root_id);
    pof_checkDatetime($root_post);
    $program = new $classProgram();
    $program = getJsonItemDetailsProgram($program, $root_post);
    $program->title = $root_post->post_title;
    $program = getJsonItemBaseDetails($program, $root_post);
    $program->agegroups = getJsonAgeGroups($root_post->ID);
    $programs = new $classPrograms();
    $programs->program[0] = $program;
    return $programs;
}
Ejemplo n.º 3
0
$jsonItem->post = new stdClass();
$jsonItem->post->id = $task_post->ID;
$jsonItem->post->title = $task_post->post_title;
$jsonItem->post->guid = get_post_meta($task_post->ID, "post_guid", true);
foreach ($suggestions as $suggestion) {
    $suggestiong_lang = get_post_meta($suggestion->ID, "pof_suggestion_lang", true);
    if (strtolower($suggestiong_lang) == $lang || $lang == 'fi' && $suggestiong_lang == '') {
        $suggestiong_writer = get_post_meta($suggestion->ID, "pof_suggestion_writer", true);
        $item = new stdClass();
        $item->title = $suggestion->post_title;
        $item->guid = get_post_meta($suggestion->ID, "post_guid", true);
        $item->content = $suggestion->post_content;
        $item->publisher = new stdClass();
        $item->publisher->nickname = $suggestiong_writer;
        $item->published = $suggestion->post_date;
        if ($pof_settings_lastupdate_overwrite == null) {
            $item->modified = $suggestion->post_modified;
        } else {
            $item->modified = $pof_settings_lastupdate_overwrite;
        }
        $item->additional_content = get_post_additional_content_JSON($suggestion->ID, strtolower($lang));
        pof_checkDatetime($suggestion);
        array_push($jsonItem->items, $item);
    }
}
if ($pof_settings_lastupdate_overwrite == null) {
    $jsonItem->lastModified = date("Y-m-d H:i:s", $lastModified);
} else {
    $jsonItem->lastModified = $pof_settings_lastupdate_overwrite;
}
echo json_encode($jsonItem);