diff --git a/2016/event-translate.php b/2016/event-translate.php index 5a18a60..2580ed2 100644 --- a/2016/event-translate.php +++ b/2016/event-translate.php @@ -1,134 +1,147 @@ . // load the framework require 'load.php'; // only allow translators // read the Event ID $id = isset( $_GET['id'] ) ? (int) $_GET['id'] : null; // require the Event ID if( !$id ) { die_with_404(); } // query the Event $event = ( new QueryEvent() ) ->whereEventID( $id ) ->joinConference() - ->joinTrack() + ->joinChapter() ->queryRow(); // no Event no party if( !$event ) { die_with_404(); } // no permissions no party if( !$event->isEventEditable() && !has_permission( 'translate' ) ) { error_die( 'not enough permissions' ); } $DEFAULT_LANGUAGE = RegisterLanguage::instance()->getDefault(); // register form action if( is_action( 'translate-event' ) ) { $tosave = []; // for each language save the fields foreach( all_languages() as $lang ) { // do not allow to edit the default language if you are not the Event owner if( $lang === $DEFAULT_LANGUAGE && !$event->isEventEditable() ) { continue; } // for each translatable fields foreach( Event::fields_i18n() as $i18n_column ) { // generic column name in this language $field = $i18n_column . '_' . $lang->getISO(); // sent column value $value = isset( $_POST[ $field ] ) ? $_POST[ $field ] : null; // set empty strings as null if( !$value ) { $value = null; } // sanitize the value before update (allow string and null) $tosave[] = new DBCol( $field, $value, 'snull' ); } } // update the fields ( new QueryEvent() ) ->whereEvent( $event ) ->update( $tosave ); // POST -> redirect -> GET http_redirect( $_SERVER[ 'REQUEST_URI' ], 303 ); } // print the site header Header::spawn( null, [ 'title' => $event->getEventTitle(), ] ); ?> +

getConferenceURL(), + esc_html( $event->getConferenceTitle() ) . icon( 'home', 'left' ) +) ?>

+ +

getEventURL(), + + // text + __( "Vedi" ) . icon( 'account_box', 'left' ) +) ?>

+
$event, 'field' => Event::ABSTRACT, 'label' => __( "Abstract" ) ] ) ?> $event, 'field' => Event::DESCRIPTION, 'label' => __( "Descrizione" ) ] ) ?> $event, 'field' => Event::NOTE, 'label' => __( "Note" ) ] ) ?>
. + +/* + * This is the template for the internationalized fields (textarea) + * + * Variable that should be available: + * + * @param string $label Textarea label + * @param string $field Database field and input name + * @param object $event + */ + +// do not visit this page directly +if( !defined( 'ABSPATH' ) ) { + exit; +} + +// default language of the website +$DEFAULT_LANGUAGE = RegisterLanguage::instance()->getDefault(); +?> + +
+

+
+ + + getISO() ?> + +
+

getHuman() ?>

+ + +
+ +
+