コード例 #1
0
<script type="text/html" id="table-listing-filter">
	<?php 
global $iclTranslationManagement, $sitepress, $wpdb;
$translation_services = array('local', TranslationProxy::get_current_service_id());
$args = array('name' => 'filter[translator_id]', 'default_name' => __('All', 'wpml-translation-management'), 'selected' => isset($icl_translation_filter['translator_id']) ? $icl_translation_filter['translator_id'] : '', 'services' => $translation_services, 'add_label' => true);
$blog_translators = wpml_tm_load_blog_translators();
$translators_dropdown = new WPML_TM_Translators_Dropdown($blog_translators);
$translators_dropdown->render($args);
?>
	&nbsp;	<label for="filter-job-status">
		<?php 
_e('Status', 'wpml-translation-management');
?>
</label>&nbsp;		<select id="filter-job-status" name="filter[status]">
		<option value=""><?php 
_e('All translation jobs', 'wpml-translation-management');
?>
</option>
		<option value="<?php 
echo ICL_TM_WAITING_FOR_TRANSLATOR;
?>
"><?php 
echo TranslationManagement::status2text(ICL_TM_WAITING_FOR_TRANSLATOR);
?>
</option>
		<option value="<?php 
echo ICL_TM_IN_PROGRESS;
?>
"><?php 
echo TranslationManagement::status2text(ICL_TM_IN_PROGRESS);
?>
コード例 #2
0
    private function build_translation_options()
    {
        global $sitepress, $wpdb;
        $basket_items_number = TranslationProxy_Basket::get_basket_items_count(true);
        $basket_name_max_length = TranslationProxy::get_current_service_batch_name_max_length();
        if ($basket_items_number > 0) {
            $source_language = TranslationProxy_Basket::get_source_language();
            $basket_name_placeholder = sprintf(__("%s|WPML|%s", 'wpml-translation-management'), get_option('blogname'), $source_language);
            $basket = new WPML_Translation_Basket($wpdb);
            $basket_name_placeholder = esc_attr($basket->get_unique_basket_name($basket_name_placeholder, $basket_name_max_length));
            ?>
            <h3>2. <?php 
            _e('Choose translation options', 'wpml-translation-management');
            ?>
</h3>

            <form method="post" id="translation-jobs-translators-form" name="translation-jobs-translators" action="">
                <input type="hidden" name="icl_tm_action" value="send_all_jobs"/>
                <label for="basket_name"><strong><?php 
            _e('Batch name', 'wpml-translation-management');
            ?>
:</strong></label>
                &nbsp;<input id="basket_name"
                             name="basket_name"
                             type="text"
                             style="width: 40%;"
                             value="<?php 
            echo $basket_name_placeholder;
            ?>
"
                             maxlength="<?php 
            echo $basket_name_max_length;
            ?>
"
                             placeholder="<?php 
            echo $basket_name_placeholder;
            ?>
">
                <br/><span class="description"><?php 
            _e('Give a name to the batch. If omitted, the default name will be applied.', 'wpml-translation-management');
            ?>
</span>

                <table class="widefat fixed" id="icl-translation-translators" cellspacing="0">
                    <thead>
                    <tr>
                        <th scope="col" width="15%"><?php 
            _e('Language', 'wpml-translation-management');
            ?>
</th>
                        <th scope="col"><?php 
            _e('Translator', 'wpml-translation-management');
            ?>
</th>
                    </tr>
                    </thead>
                    <tfoot>
                    <tr>
                        <th scope="col"><?php 
            _e('Language', 'wpml-translation-management');
            ?>
</th>
                        <th scope="col"><?php 
            _e('Translator', 'wpml-translation-management');
            ?>
</th>
                    </tr>
                    </tfoot>
                    <?php 
            $basket_languages = TranslationProxy_Basket::get_target_languages();
            if ($basket_languages) {
                ?>
                        <tbody>
                        <?php 
                $target_languages = $sitepress->get_active_languages();
                foreach ($target_languages as $key => $lang) {
                    if (!in_array($lang['code'], $basket_languages)) {
                        unset($target_languages[$key]);
                    }
                }
                foreach ($target_languages as $lang) {
                    if ($lang['code'] === TranslationProxy_Basket::get_source_language()) {
                        continue;
                    }
                    ?>
                            <tr>
                                <td><strong><?php 
                    echo $lang['display_name'];
                    ?>
</strong></td>
                                <td>
                                    <label for="<?php 
                    echo esc_attr('translator[' . $lang['code'] . ']');
                    ?>
">
                                        <?php 
                    _e('Translate by', 'wpml-translation-management');
                    ?>
                                    </label>
                                    <?php 
                    $selected_translator = isset($icl_selected_translators[$lang['code']]) ? $icl_selected_translators[$lang['code']] : false;
                    if ($selected_translator === false) {
                        $selected_translator = TranslationProxy_Service::get_wpml_translator_id();
                    }
                    $args = array('from' => TranslationProxy_Basket::get_source_language(), 'to' => $lang['code'], 'name' => 'translator[' . $lang['code'] . ']', 'selected' => $selected_translator, 'services' => array('local', TranslationProxy::get_current_service_id()));
                    $blog_translators = wpml_tm_load_blog_translators();
                    $translators_dropdown = new WPML_TM_Translators_Dropdown($blog_translators);
                    $translators_dropdown->render($args);
                    ?>
                                    <a href="admin.php?page=<?php 
                    echo WPML_TM_FOLDER;
                    ?>
/menu/main.php&sm=translators"><?php 
                    _e('Manage translators', 'wpml-translation-management');
                    ?>
</a>
                                </td>
                            </tr>
                        <?php 
                }
                ?>
                        </tbody>
                    <?php 
            }
            ?>
                </table>
                <br>
                <?php 
            echo TranslationProxy_Basket::get_basket_extra_fields_section();
            ?>
                <?php 
            wp_nonce_field('send_basket_items_nonce', '_icl_nonce_send_basket_items');
            ?>
                <?php 
            wp_nonce_field('send_basket_item_nonce', '_icl_nonce_send_basket_item');
            ?>
                <?php 
            wp_nonce_field('send_basket_commit_nonce', '_icl_nonce_send_basket_commit');
            ?>
                <?php 
            wp_nonce_field('check_basket_name_nonce', '_icl_nonce_check_basket_name');
            ?>
                <input type="submit" class="button-primary" name="send-all-jobs-for-translation" value="<?php 
            _e('Send all items for translation', 'wpml-translation-management');
            ?>
">
            </form>
        <?php 
        }
        do_action('wpml_translation_basket_page_after');
    }
コード例 #3
0
 protected function get_translator_html($job)
 {
     $job = (object) $job;
     $current_service_name = TranslationProxy::get_current_service_name();
     $translation_services = array('local', TranslationProxy::get_current_service_id());
     if (isset($job->translation_service) && !in_array($job->translation_service, $translation_services)) {
         $inactive_service = $this->get_inactive_translation_service($job->translation_service);
         $current_service_name = $inactive_service->name;
     }
     $translator = '';
     if ($job->translation_service && $job->translation_service !== 'local') {
         try {
             $project = TranslationProxy::get_current_project();
             if ($project) {
                 if ($project->service->has_translator_selection) {
                     $translator_contact_iframe_url = $project->translator_contact_iframe_url($job->translator_id);
                     $iframe_args = array('title' => __('Contact the translator', 'wpml-translation-management'), 'unload_cb' => 'icl_thickbox_refresh');
                     $translator .= TranslationProxy_Popup::get_link($translator_contact_iframe_url, $iframe_args);
                     $translator .= esc_html($job->translator_name);
                     $translator .= "</a> (" . $current_service_name . ")";
                 } else {
                     $translator .= $current_service_name;
                 }
             } else {
                 $translator .= esc_html($job->translator_name);
             }
         } catch (Exception $e) {
             // Just doesn't create the output
         }
     } elseif ($job->status == ICL_TM_COMPLETE) {
         $translator_data = get_userdata($job->translator_id);
         $translator_name = $translator_data ? $translator_data->display_name : "";
         $translator = '<span class="icl-finished-local-name">' . $translator_name . '</span>';
     } else {
         $translator .= '<span class="icl_tj_select_translator">';
         $selected_translator = isset($job->translator_id) ? $job->translator_id : false;
         $disabled = false;
         if ($job->translation_service && $job->translation_service !== 'local' && is_numeric($job->translation_service)) {
             $selected_translator = TranslationProxy_Service::get_wpml_translator_id($job->translation_service, $job->translator_id);
             $disabled = true;
         }
         $job_id = isset($job->job_id) ? $job->job_id : $job->id;
         $local_only = isset($job->local_only) ? $job->local_only : true;
         $args = array('id' => 'icl_tj_translator_for_' . $job_id, 'name' => 'icl_tj_translator_for_' . $job_id, 'from' => $job->source_language_code, 'to' => $job->language_code, 'selected' => $selected_translator, 'services' => $translation_services, 'disabled' => $disabled, 'echo' => false, 'local_only' => $local_only);
         $translators_dropdown = new WPML_TM_Translators_Dropdown($this->blog_translators);
         $translator .= $translators_dropdown->render($args);
         $translator .= '<input type="hidden" id="icl_tj_ov_' . $job_id . '" value="' . (int) $job->translator_id . '" />';
         $translator .= '<input type="hidden" id="icl_tj_ty_' . $job_id . '" value="' . strtolower($this->get_type()) . '" />';
         $translator .= '<span class="icl_tj_select_translator_controls" id="icl_tj_tc_' . $job_id . '">';
         $translator .= '<input type="button" class="button-secondary icl_tj_ok" value="' . __('Send', 'wpml-translation-management') . '" />&nbsp;';
         $translator .= '<input type="button" class="button-secondary icl_tj_cancel" value="' . __('Cancel', 'wpml-translation-management') . '" />';
         $translator .= '</span>';
     }
     return $translator;
 }