screen_options = $screen_options_factory->create_pagination( 'tm_translations_queue_per_page', ICL_TM_DOCS_PER_PAGE ); $this->table_sort = $screen_options_factory->create_admin_table_sort(); } /** * @param array $icl_translation_filter */ public function display( $icl_translation_filter = array() ) { /** * @var TranslationManagement $iclTranslationManagement * @var WPML_Translation_Job_Factory $wpml_translation_job_factory */ global $iclTranslationManagement, $current_user, $wpml_translation_job_factory, $wpdb; if ( ( isset( $_GET['job_id'] ) && $_GET['job_id'] > 0 ) || ( isset( $_GET['trid'] ) && $_GET['trid'] > 0 ) ) { $job_id = $this->get_job_id_from_request(); $job_object = $wpml_translation_job_factory->get_translation_job( $job_id, false, 0, true ); if ( $job_object && $job_object->user_can_translate( $current_user ) ) { $translation_editor_ui = new WPML_Translation_Editor_UI( $wpdb, $this->sitepress, $iclTranslationManagement, $job_object, new WPML_TM_Job_Action_Factory( $wpml_translation_job_factory ), new WPML_TM_Job_Layout( $wpdb, $this->sitepress->get_wp_api() ) ); $translation_editor_ui->render(); return; } } if ( ! empty( $_GET[ 'resigned' ] ) ) { $iclTranslationManagement->add_message( array( 'type' => 'updated', 'text' => __( "You've resigned from this job.", 'wpml-translation-management' ) ) ); } if ( isset( $_SESSION[ 'translation_ujobs_filter' ] ) ) { $icl_translation_filter = $_SESSION[ 'translation_ujobs_filter' ]; } $current_translator = $iclTranslationManagement->get_current_translator(); $can_translate = $current_translator && $current_translator->ID > 0 && $current_translator->language_pairs; $post_link_factory = new WPML_TM_Post_Link_Factory( $this->sitepress ); if( $can_translate ) { $icl_translation_filter['translator_id'] = $current_translator->ID; $icl_translation_filter['include_unassigned'] = true; $element_type_prefix = isset( $_GET['element_type'] ) ? $_GET['element_type'] : 'post'; if ( isset( $_GET['updated'] ) && $_GET['updated'] ) { $tm_post_link_updated = $post_link_factory->view_link( $_GET['updated'] ); if ( $iclTranslationManagement->is_external_type( $element_type_prefix ) ) { $tm_post_link_updated = apply_filters( 'wpml_external_item_link', $tm_post_link_updated, $_GET['updated'], false ); } $user_message = __( 'Translation updated: ', 'wpml-translation-management' ) . $tm_post_link_updated; $iclTranslationManagement->add_message( array( 'type' => 'updated', 'text' => $user_message ) ); } elseif ( isset( $_GET['added'] ) && $_GET['added'] ) { $tm_post_link_added = $post_link_factory->view_link( $_GET['added'] ); if ( $iclTranslationManagement->is_external_type( $element_type_prefix ) ) { $tm_post_link_added = apply_filters( 'wpml_external_item_link', $tm_post_link_added, $_GET['added'], false ); } $user_message = __( 'Translation added: ', 'wpml-translation-management' ) . $tm_post_link_added; $iclTranslationManagement->add_message( array( 'type' => 'updated', 'text' => $user_message ) ); } elseif ( isset( $_GET['job-cancelled'] ) ) { $user_message = __( 'Translation has been removed by admin', 'wpml-translation-management' ); $iclTranslationManagement->add_message( array( 'type' => 'error', 'text' => $user_message ) ); } $translation_jobs = array(); if ( ! empty( $current_translator->language_pairs ) ) { $_langs_to = array(); if ( 1 < count( $current_translator->language_pairs ) ) { foreach ( $current_translator->language_pairs as $lang => $to ) { $langs_from[] = $this->sitepress->get_language_details( $lang ); $_langs_to = array_merge( (array) $_langs_to, array_keys( $to ) ); } $_langs_to = array_unique( $_langs_to ); } else { $_langs_to = array_keys( current( $current_translator->language_pairs ) ); $lang_from = $this->sitepress->get_language_details( key( $current_translator->language_pairs ) ); $icl_translation_filter['from'] = $lang_from['code']; } if ( 1 < count( $_langs_to ) ) { foreach ( $_langs_to as $lang ) { $langs_to[] = $this->sitepress->get_language_details( $lang ); } } else { $lang_to = $this->sitepress->get_language_details( current( $_langs_to ) ); $icl_translation_filter['to'] = $lang_to['code']; } $job_types = $wpml_translation_job_factory->get_translation_job_types_filter( array(), array( 'translator_id' => $current_translator->ID, 'include_unassigned' => true ) ); if ( isset( $_GET['orderby'] ) ) { $icl_translation_filter['order_by'] = filter_var( $_GET['orderby'], FILTER_SANITIZE_STRING ); } if ( isset( $_GET['order'] ) ) { $icl_translation_filter['order'] = filter_var( $_GET['order'], FILTER_SANITIZE_STRING ); } $translation_jobs = $wpml_translation_job_factory->get_translation_jobs( (array) $icl_translation_filter ); } } ?>
job_id; ?> | post_title ); ?>
tm_post_link; ?>
|
post_type ); ?> | lang_text_with_flags ?> | status_text ); ?> | deadline_date ) { echo date( 'Y-m-d', strtotime( $job->deadline_date ) ); } ?> | original_doc_id ) { ?> button_text; ?> | is_doing_job ) { ?> resign_text ?> |