Ejemplo n.º 1
0
function prevProject($returnData = false)
{
    global $clerk;
    $projectsList = array();
    $orderedProjects = array();
    $currentProject = projectInfo(selectedProject());
    $currentIndex = 0;
    $count = 0;
    $page = pageInfo(currentPage());
    $options = prepare_settings($page['content_options']);
    $section = $clerk->query_fetchArray($clerk->query_select("project_sections", "", "WHERE name= '{$options['section']}' OR slug= '{$options['section']}' OR id='{$options['section']}'"));
    $section = $section['id'];
    if (!empty($section)) {
        $projects = $clerk->query_select("projects", "", "WHERE section= '{$section}' ORDER BY pos ASC");
    } else {
        $projects = $clerk->query_select("projects", "", "ORDER BY section, pos ASC");
    }
    while ($project = $clerk->query_fetchArray($projects)) {
        $projectsList[] = $project;
    }
    $getSections = $clerk->query_select("project_sections", "", "ORDER BY pos ASC");
    while ($section = $clerk->query_fetchArray($getSections)) {
        foreach ($projectsList as $p) {
            if ($p['section'] == $section['id']) {
                $orderedProjects[] = $p;
                if ($p['id'] == $currentProject['id']) {
                    $currentIndex = $count;
                }
                $count++;
            }
        }
    }
    if ($currentIndex == 0) {
        $prevProject = $orderedProjects[count($orderedProjects) - 1];
    } else {
        $prevProject = $orderedProjects[$currentIndex - 1];
    }
    if ($returnData) {
        $prevProject['link'] = linkToProject($prevProject['id']);
        return $prevProject;
    }
    return linkToProject($prevProject['id']);
}
 $dataset_add_info = $dataset_node['dataset']->field_dataset_add_info;
 $dataset_beg_end_date = $dataset_node['dataset']->field_beg_end_date;
 $dataset_purpose = $dataset_node['dataset']->field_dataset_purpose;
 $dataset_maintenance = $dataset_node['dataset']->field_dataset_maintenance;
 $dataset_methods = $dataset_node['dataset']->field_methods;
 $dataset_id = $dataset_node['dataset']->field_dataset_id;
 $dataset_related_links = $dataset_node['dataset']->field_dataset_related_links;
 // have to check those two fields due to strange Notice after reinstall
 // TODO: find why those and only those?
 if (isset($dataset_node['dataset']->field_instrumentation)) {
     $dataset_instrumentation = $dataset_node['dataset']->field_instrumentation;
 }
 if (isset($dataset_node['dataset']->field_quality)) {
     $dataset_quality = $dataset_node['dataset']->field_quality;
 }
 $last_settings = prepare_settings();
 global $user;
 $current_destination = drupal_get_destination();
 if (empty($user->uid)) {
     drupal_set_message('Please login in');
     drupal_goto('user/login', $current_destination);
 } elseif (!$last_settings['last_acronym']) {
     drupal_set_message("Please provide the site specific settings");
     drupal_goto('eml_config', $current_destination);
 }
 $acr = $last_settings['last_acronym'];
 $metadata_provider_arr = array(node_load($last_settings['last_metadata_provider_ref']));
 $publisher_arr = array(node_load($last_settings['last_publisher_ref']));
 $views_bonus_eml_site_name = variable_get('site_name', NULL);
 /* -----------------
  * 2) calculate vid version
Ejemplo n.º 3
0
function pageContent($page = "")
{
    global $clerk;
    $id = empty($page) ? PAGE : $page;
    if (!empty($id)) {
        $page = $clerk->query_fetchArray($clerk->query_select("pages", "", "WHERE id='{$id}' OR slug='{$id}' LIMIT 1"));
        if ($page['content_type'] == "none") {
            return;
        }
        $module = empty($page['content_type']) ? "projects" : $page['content_type'];
        $options = prepare_settings($page['content_options']);
        return $module($options);
    }
    return null;
}
Ejemplo n.º 4
0
function prev_post($return_data = false)
{
    global $clerk, $blog;
    $post_list = array();
    $current_post = postInfo(selectedPost());
    $current_index = 0;
    $count = 0;
    $page = pageInfo(currentPage());
    $options = prepare_settings($page['content_options']);
    $defaults = array('order' => 'date', 'orderHow' => 'desc');
    $options = merge_settings($options, $defaults);
    $posts = $clerk->query_select("secretary_blog", "", "WHERE status= 1 ORDER BY {$options['order']} {$options['orderHow']}");
    while ($post = $clerk->query_fetchArray($posts)) {
        $post_list[] = $post;
        if ($post['id'] == $current_post['id']) {
            $current_index = $count;
        }
        $count++;
    }
    if ($current_index == 0) {
        $prev_post = $post_list[count($post_list) - 1];
    } else {
        $prev_post = $post_list[$current_index - 1];
    }
    if ($return_data) {
        $prev_post['link'] = post_link(false, $prev_post['id']);
        return $prev_post;
    }
    return post_link(false, $prev_post['id']);
}