if ($base_url != $result['domain']) {
    $result['node'] = (object) $result['node'];
    if (is_array($result['node']->taxonomy)) {
        foreach ($result['node']->taxonomy as $tid => $term) {
            $result['node']->taxonomy[$tid] = (object) $result['node']->taxonomy[$tid];
        }
    }
}
$node = $result['node'];
$node->searchresult = 1;
$showborder = abs($node->grouping) % 2;
//will give 0 or 1. Alternate groups *hopefully* are consecutive
if ($showborder) {
    print "<dl title='" . strip_tags(_kentry_status($node->approved)) . "' class='{$zebra}' style='border-left:10px #A50000 solid; margin-right:25px;' id='cluster{$node->grouping}'>";
} else {
    print "<dl title='" . strip_tags(_kentry_status($node->approved)) . "' class='{$zebra}' style='border-right:10px #A50000 solid; margin-right:15px;' id='cluster{$node->grouping}'>";
}
//Now add the links
print str_replace("<##snippet##>", $snippet, theme('kentry', $node, 1, 0));
$domain = $result['domain'];
if ($node->comment_count) {
    $links[] = l("({$node->comment_count})", "{$domain}/node/{$node->nid}", array('fragment' => 'comments', 'attributes' => array('title' => t('Read all comments'))));
}
$links[] = l(".", "{$domain}/node/{$node->nid}", array('attributes' => array('title' => t('Full view, including other languages'), 'class' => 'readmore')));
if (user_access('review entry')) {
    $links[] = l('.', "{$domain}/node/{$node->nid}/edit", array('attributes' => array('title' => t('Edit'), 'class' => 'edit')));
    $links[] = l('.', "{$domain}/node/{$node->nid}/relations", array('attributes' => array('title' => t('Create links to other entries'), 'class' => 'link')));
}
$links[] = l('.', "{$domain}/comment/reply/{$node->nid}", array('fragment' => 'comment_form', 'attributes' => array('class' => 'commentlink', 'title' => t('Add new comment'))));
print "<div align='right'>" . join(" ", $links) . "</div>";
print "</dl>";
Exemple #2
0
<?php
// $Id: node.tpl.php,v 1.5 2007/10/11 09:51:29 goba Exp $
?>
<div id="node-<?php print $node->nid; ?>" class="node<?php if ($sticky) { print ' sticky'; } ?><?php if (!$status) { print ' node-unpublished'; } ?>">
<?php if(substr($node->type, 0, 6)=='kentry'){
    print "<dl title='".strip_tags(_kentry_status($node->approved))."'>";
    print $content;
    //print str_replace("<##snippet##>", $snippet, theme('kentry', $node, 1, 0));
    $domain = $result['domain']; 
    if(!$page){
        $nlinks[] = l(".",
        "$domain/node/$node->nid",
             array('attributes'=>array(
                    'title'=>t('Full view, including other languages'),
                    'class'=>'readmore')));
    }
    if($node->comment_count){
        $nlinks[] = l("($node->comment_count)",
          "$domain/node/$node->nid", array('fragment'=>'comments',
            'attributes'=>array('title'=>t('Read all comments'))));
    }
    if($page){
        $nlinks[] = l('.', "$domain/comment/reply/$node->nid",
        array('fragment'=>'comment_form',
              'attributes'=>array('class'=>'commentlink',
                'title'=>t('Add new comment'))));
    }
    if(user_access('review entry')){
        $nlinks[] = l('.', "$domain/node/$node->nid/edit",
        array('attributes'=>array('title'=>t('Edit'),
            'class'=>'edit')));
Exemple #3
0
function paldo_kentry($node, $teaser = FALSE, $page = FALSE)
{
    global $user, $base_url;
    $pcat = is_array($node->taxonomy) ? l($rawpos = $node->taxonomy[$node->partofspeech]->name, "taxonomy/term/" . $node->partofspeech) : "";
    $pcat = empty($rawpos) ? '' : "( {$rawpos} )";
    $domain = "http://" . variable_get('kclient_domain', '');
    //TODO: don't assume 'http://'
    $dbnames = variable_get('kclient_db_names', array());
    $dbname = l($dbnames[$node->iso], "{$domain}/all/{$node->iso}");
    $process = '';
    $nodisplay = variable_get('kentry_show', array());
    drupal_add_css(drupal_get_path('module', 'kdictionary') . '/kdictionary.css');
    $output = $word_classes = $variants = $semantic_relations = $partofspeech = '';
    if (!empty($node->example)) {
        $examples = "<dd class='examples'>";
        if (is_array($node->example)) {
            foreach ($node->example as $source => $example) {
                if (trim($example) != "") {
                    $examples .= "<div class='example'>" . '<label>' . t('!source example', array('!source' => $dbnames[$node->iso])) . '</label> ' . check_markup(preg_replace("/~/", theme('placeholder', $node->word), $example), $node->filter, 0) . "</div>";
                }
            }
        }
        $examples .= "</dd>";
    }
    if (module_exists('taxonomy') && is_array($node->taxonomy) && empty($node->in_preview)) {
        foreach ($node->taxonomy as $tid => $term_obj) {
            $word_classes .= '<div class="pos">' . t($term_obj->name) . l('&#151;', "{$domain}/taxonomy/term/{$tid}", array('html' => 1, 'attributes' => array('title' => preg_replace("/~/", $node->word, $term_obj->description)))) . '&nbsp;&nbsp;&nbsp;</div>';
        }
        $word_classes .= '<br style="clear:both"/>';
    }
    $reviewstatus = $nodisplay['rstatus'] ? '' : _kentry_status($node->approved);
    //$output.= "<dl class='$zebra'>";
    $output .= "<dt><strong title='{$dbname}'>{$node->title}</strong> {$pcat} </dt>";
    //TODO: if($node->iso != 'sw'){ do not use theme_kentry_synonyms. Simply use the 'English Word' field values}
    $output .= ($page or !$node->searchresult) ? !$nodisplay['links'] ? theme('kentry_synonyms', $node, 0) : '' : "<##snippet##>";
    //$output.= "<dd>".$word_classes."</dd>";
    $output .= "<dd>" . preg_replace("/<span.*?View.*?span>/", "", $node->children_html) . "</dd>";
    //$output.= "<dd>".$node->children_html."</dd>";
    $output .= "<dd>" . $node->body . "</dd>";
    //When node->defn is evaluated it becomes node->body
    $output .= strip_tags($examples) && !$nodisplay['example'] ? $examples : '';
    $output .= "<dd>";
    //$output.= join(" ", $attribution);
    $output .= "</dd>";
    $output .= "<dd>" . $word_classes . "</dd>";
    //$output.="</dl>";
    //$output.= $node->teaser?"<span class='teaser'>".check_markup($node->teaser, $node->format, 0)."</span>":'';
    if ($page) {
        if (variable_get('kentry_showcitation', FALSE)) {
            $output .= "<div class='citation'><span class='reviewstatus'>" . _kentry_status($node->approved) . "</span><b>" . t('Cite') . "</b><br/>" . $node->title . '. ' . $pcat . '. ' . _kentry_cite($node) . " " . t("from !url", array('!url' => l(url(drupal_get_path_alias("node/{$node->nid}"), array('absolute' => TRUE)), "node/{$node->nid}"))) . "</div>";
        }
        if (variable_get('show_linksgroupingtool', FALSE)) {
            foreach ($node->relations as $relid => $rels) {
                if (user_access('review entry') && count($rels)) {
                    //TODO: make 'review entry' perms database-specific e.g. 'review akan entries only'
                    $output .= "<div class='title'>" . t('modify display order of %dbase %relid entries linked with %group', array('%dbase' => '', '%relid' => variable_get('ksynset_' . $relid . '_name', ''), '%group' => $node->title)) . "</div>";
                    $output .= "<div>" . t('If you have JavaScript enabled you can use the <span style="cursor: crosshair;">cross-hair handle at the beginning of each row</span> to move entries up or down to reorder them') . "</div>";
                    $output .= l(t('Return to %group', array('%group' => $start)), "all/{$iso}/{$start}", array('html' => TRUE));
                    $output .= drupal_get_form('kgrouping_form', $node->vid, '', 'links');
                    $output .= theme('pager', NULL, $page_increment);
                }
            }
        }
    }
    return $output;
}