/**
  * Add posts management column.
  *
  * @param $column_name
  */
 public function add_content_for_posts_management_column($column_name)
 {
     global $post;
     if ('icl_translations' !== $column_name) {
         return;
     }
     $active_languages = $this->get_filtered_active_lanugages();
     if (is_null($this->post_status_display)) {
         $this->post_status_display = new WPML_Post_Status_Display($active_languages);
     }
     unset($active_languages[$this->sitepress->get_current_language()]);
     foreach ($active_languages as $language_data) {
         $icon_html = $this->post_status_display->get_status_html($post->ID, $language_data['code']);
         echo $icon_html;
     }
 }
Ejemplo n.º 2
0
 function add_content_for_posts_management_column($column_name)
 {
     if ($column_name !== 'icl_translations') {
         return;
     }
     global $id;
     $active_languages = $this->get_active_languages();
     $current_language = $this->get_current_language();
     foreach ($active_languages as $v) {
         if ($v['code'] === $current_language) {
             continue;
         }
         $icon_html = $this->post_status_display->get_status_html($id, $v['code']);
         echo $icon_html;
     }
 }
    /**
     * @param string                   $lang
     * @param WPML_Post_Status_Display $status_display
     */
    private function translate_option($lang, $status_display)
    {
        static $row = 0;
        if ($this->selected_language == $lang['code']) {
            return;
        }
        $row_class = $row % 2 == 0 ? 'class="icl_odd_row"' : '';
        ?>
		<tr <?php 
        echo $row_class;
        ?>
>
			<?php 
        $translations = $this->get_translations();
        if (!isset($translations[$lang['code']])) {
            $row++;
            ?>
				<td style="padding-left: 4px;">
					<?php 
            echo $lang['display_name'];
            ?>
				</td>
				<td align="right">
					<?php 
            echo $status_display->get_status_html($this->post->ID, $lang['code']);
            ?>
				</td>
				<td align="right">
					<?php 
            $disabled_duplication = false;
            $disabled_duplication_title = esc_attr__('Create duplicate', 'sitepress');
            $element_key = array('trid' => $this->trid, 'language_code' => $lang['code']);
            $translation_status = apply_filters('wpml_tm_translation_status', null, $element_key);
            echo PHP_EOL . '<!-- $translation_status = ' . $translation_status . ' -->' . PHP_EOL;
            if ($translation_status && $translation_status < ICL_TM_COMPLETE) {
                $disabled_duplication = true;
                if ($translation_status == ICL_TM_DUPLICATE) {
                    $disabled_duplication_title = esc_attr__("This post is already duplicated.", 'sitepress');
                } else {
                    $disabled_duplication_title = esc_attr__("Can't create a duplicate. A translation is in progress.", 'sitepress');
                }
            }
            ?>
					<input<?php 
            disabled(true, $disabled_duplication);
            ?>
 type="checkbox" name="icl_dupes[]" value="<?php 
            echo $lang['code'];
            ?>
" title="<?php 
            echo $disabled_duplication_title;
            ?>
"/>
				</td>

			<?php 
        }
        ?>
		</tr>
	<?php 
    }
Ejemplo n.º 4
0
<?php

/**
 * @package wpml-core
 * @subpackage post-edit-screen
 */
/** @var $this SitePress */
/** @global $post WP_post */
/** @global $iclTranslationManagement TranslationManagement */
/** @global WPML_Post_Translation $wpml_post_translations */
global $wpdb, $wp_post_types, $iclTranslationManagement, $wpml_post_translations;
$this->noscript_notice();
$status_display = new WPML_Post_Status_Display($this->get_active_languages());
$allowed_target_langs = $wpml_post_translations->get_allowed_target_langs($post);
$icl_can_translate_post = !empty($allowed_target_langs);
$active_languages = $this->get_active_languages();
$default_language = $this->get_default_language();
$current_language = $this->get_current_language();
if ($post->ID && $post->post_status != 'auto-draft') {
    $res = $this->get_element_language_details($post->ID, 'post_' . $post->post_type);
    $trid = @intval($res->trid);
    if ($trid) {
        $element_lang_code = $res->language_code;
    } else {
        $translation_id = $this->set_element_language_details($post->ID, 'post_' . $post->post_type, null, $current_language);
        $trid_sql = "SELECT trid FROM {$wpdb->prefix}icl_translations WHERE translation_id = %d";
        $trid_prepared = $wpdb->prepare($trid_sql, array($translation_id));
        $trid = $wpdb->get_var($trid_prepared);
        $element_lang_code = $current_language;
    }
} else {