| [ Index ] |
PHP Cross Reference of Drupal 6 (yi-drupal) |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * @file 5 * User page callbacks for the translation module. 6 */ 7 8 /** 9 * Overview page for a node's translations. 10 * 11 * @param $node 12 * Node object. 13 */ 14 function translation_node_overview($node) { 15 if ($node->tnid) { 16 // Already part of a set, grab that set. 17 $tnid = $node->tnid; 18 $translations = translation_node_get_translations($node->tnid); 19 } 20 else { 21 // We have no translation source nid, this could be a new set, emulate that. 22 $tnid = $node->nid; 23 $translations = array($node->language => $node); 24 } 25 26 $header = array(t('Language'), t('Title'), t('Status'), t('Operations')); 27 28 foreach (language_list() as $language) { 29 $options = array(); 30 $language_name = $language->name; 31 if (isset($translations[$language->language])) { 32 // Existing translation in the translation set: display status. 33 // We load the full node to check whether the user can edit it. 34 $translation_node = node_load($translations[$language->language]->nid); 35 $title = l($translation_node->title, 'node/'. $translation_node->nid); 36 if (node_access('update', $translation_node)) { 37 $options[] = l(t('edit'), "node/$translation_node->nid/edit"); 38 } 39 $status = $translation_node->status ? t('Published') : t('Not published'); 40 $status .= $translation_node->translate ? ' - <span class="marker">'. t('outdated') .'</span>' : ''; 41 if ($translation_node->nid == $tnid) { 42 $language_name = t('<strong>@language_name</strong> (source)', array('@language_name' => $language_name)); 43 } 44 } 45 else { 46 // No such translation in the set yet: help user to create it. 47 $title = t('n/a'); 48 if (node_access('create', $node)) { 49 $options[] = l(t('add translation'), 'node/add/'. str_replace('_', '-', $node->type), array('query' => "translation=$node->nid&language=$language->language")); 50 } 51 $status = t('Not translated'); 52 } 53 $rows[] = array($language_name, $title, $status, implode(" | ", $options)); 54 } 55 56 drupal_set_title(t('Translations of %title', array('%title' => $node->title))); 57 return theme('table', $header, $rows); 58 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Mon Jul 9 18:01:44 2012 | Cross-referenced by PHPXref 0.7 |