Mercurial > defr > drupal > core
comparison modules/translation/translation.pages.inc @ 1:c1f4ac30525a 6.0
Drupal 6.0
author | Franck Deroche <webmaster@defr.org> |
---|---|
date | Tue, 23 Dec 2008 14:28:28 +0100 |
parents | |
children | 589fb7c02327 |
comparison
equal
deleted
inserted
replaced
0:5a113a1c4740 | 1:c1f4ac30525a |
---|---|
1 <?php | |
2 // $Id: translation.pages.inc,v 1.2 2008/01/07 13:18:40 goba Exp $ | |
3 | |
4 /** | |
5 * @file | |
6 * User page callbacks for the translation module. | |
7 */ | |
8 | |
9 /** | |
10 * Overview page for a node's translations. | |
11 * | |
12 * @param $node | |
13 * Node object. | |
14 */ | |
15 function translation_node_overview($node) { | |
16 if ($node->tnid) { | |
17 // Already part of a set, grab that set. | |
18 $tnid = $node->tnid; | |
19 $translations = translation_node_get_translations($node->tnid); | |
20 } | |
21 else { | |
22 // We have no translation source nid, this could be a new set, emulate that. | |
23 $tnid = $node->nid; | |
24 $translations = array($node->language => $node); | |
25 } | |
26 | |
27 $header = array(t('Language'), t('Title'), t('Status'), t('Operations')); | |
28 | |
29 foreach (language_list() as $language) { | |
30 $options = array(); | |
31 $language_name = $language->name; | |
32 if (isset($translations[$language->language])) { | |
33 // Existing translation in the translation set: display status. | |
34 // We load the full node to check whether the user can edit it. | |
35 $translation_node = node_load($translations[$language->language]->nid); | |
36 $title = l($translation_node->title, 'node/'. $translation_node->nid); | |
37 if (node_access('update', $translation_node)) { | |
38 $options[] = l(t('edit'), "node/$translation_node->nid/edit"); | |
39 } | |
40 $status = $translation_node->status ? t('Published') : t('Not published'); | |
41 $status .= $translation_node->translate ? ' - <span class="marker">'. t('outdated') .'</span>' : ''; | |
42 if ($translation_node->nid == $tnid) { | |
43 $language_name = '<strong>'. $language_name .'</strong> (source)'; | |
44 } | |
45 } | |
46 else { | |
47 // No such translation in the set yet: help user to create it. | |
48 $title = t('n/a'); | |
49 if (node_access('create', $node)) { | |
50 $options[] = l(t('add translation'), 'node/add/'. str_replace('_', '-', $node->type), array('query' => "translation=$node->nid&language=$language->language")); | |
51 } | |
52 $status = t('Not translated'); | |
53 } | |
54 $rows[] = array($language_name, $title, $status, implode(" | ", $options)); | |
55 } | |
56 | |
57 drupal_set_title(t('Translations of %title', array('%title' => $node->title))); | |
58 return theme('table', $header, $rows); | |
59 } |