[ Index ]

PHP Cross Reference of GlotPress

title

Body

[close]

/gp-templates/ -> glossary-view.php (source)

   1  <?php
   2  gp_title( __( 'View Glossary &lt; GlotPress', 'glotpress' ) );
   3  gp_breadcrumb( array(
   4      gp_project_links_from_root( $project ),
   5      gp_link_get( gp_url_project_locale( $project->path, $locale->slug, $translation_set->slug ), $translation_set->name ),
   6      __( 'Glossary', 'glotpress' )
   7  ) );
   8  
   9  $ge_delete_ays    = __( 'Are you sure you want to delete this entry?', 'glotpress' );
  10  $delete_url       = gp_url_join( $url, '-delete' );
  11  $glossary_options = compact( 'can_edit', 'url', 'delete_url', 'ge_delete_ays' );
  12  
  13  gp_enqueue_scripts( 'gp-glossary' );
  14  wp_localize_script( 'gp-glossary', '$gp_glossary_options', $glossary_options );
  15  
  16  gp_tmpl_header();
  17  
  18  $title = __( 'Glossary for %1$s translation of %2$s', 'glotpress' );
  19  if ( 0 === $project->id ) {
  20      $title = __( 'Glossary for %1$s', 'glotpress' );
  21  }
  22  ?>
  23  
  24  <h2><?php printf( esc_html( $title ), esc_html( $translation_set->name ), esc_html( $project->name ) ); ?>
  25      <?php gp_link_glossary_edit( $glossary, $translation_set, __( '(edit)', 'glotpress' ) ); ?>
  26      <?php gp_link_glossary_delete( $glossary, $translation_set, __( '(delete)', 'glotpress' ) ); ?>
  27  </h2>
  28  
  29  <?php
  30  if ( $glossary->description ) {
  31      echo '<p class="description">' . make_clickable( nl2br( wp_kses_post( $glossary->description ) ) ) . '</p>';
  32  }
  33  ?>
  34  
  35  <table class="glossary" id="glossary">
  36      <thead>
  37          <tr>
  38              <th style="width:20%"><?php _ex( 'Item', 'glossary entry', 'glotpress' ); ?></th>
  39              <th style="width:20%"><?php _ex( 'Part of speech', 'glossary entry', 'glotpress' ); ?></th>
  40              <th style="width:20%"><?php _ex( 'Translation', 'glossary entry', 'glotpress' ); ?></th>
  41              <th style="width:30%"><?php _ex( 'Comments', 'glossary entry', 'glotpress' ); ?></th>
  42          <?php if ( $can_edit) : ?>
  43              <th style="width:10%">&mdash;</th>
  44          <?php endif; ?>
  45          </tr>
  46      </thead>
  47      <tbody>
  48  <?php
  49      if ( count( $glossary_entries ) > 0 ) {
  50          foreach( $glossary_entries as $entry ) {
  51              gp_tmpl_load( 'glossary-entry-row', get_defined_vars() );
  52          }
  53      }
  54      else {
  55          ?>
  56          <tr>
  57              <td colspan="5">
  58                  <?php _e( 'No glossary entries yet.', 'glotpress' ); ?>
  59              </td>
  60          </tr>
  61          <?php
  62      }
  63  ?>
  64          <?php if ( $can_edit ) : ?>
  65          <tr>
  66              <td colspan="5">
  67                  <h4><?php _e( 'Create an entry', 'glotpress' );?></h4>
  68  
  69                  <form action="<?php echo esc_url( gp_url_join( $url, '-new' ) ); ?>" method="post">
  70                      <dl>
  71                          <dt><label for="new_glossary_entry_term"><?php echo esc_html( _x( 'Original term:', 'glossary entry', 'glotpress' ) ); ?></label></dt>
  72                          <dd><input type="text" name="new_glossary_entry[term]" id="new_glossary_entry_term" value=""></dd>
  73                          <dt><label for="new_glossary_entry_post"><?php _ex( 'Part of speech', 'glossary entry', 'glotpress' ); ?></label></dt>
  74                          <dd>
  75                              <select name="new_glossary_entry[part_of_speech]" id="new_glossary_entry_post">
  76                              <?php
  77                                  foreach ( GP::$glossary_entry->parts_of_speech as $pos => $name ) {
  78                                      echo "\t<option value='".esc_attr( $pos )."'>" . esc_html( $name ) . "</option>\n";
  79                                  }
  80                              ?>
  81                              </select>
  82                          </dd>
  83                          <dt><label for="new_glossary_entry_translation"><?php _ex( 'Translation', 'glossary entry', 'glotpress' ); ?></label></dt>
  84                          <dd><input type="text" name="new_glossary_entry[translation]" id="new_glossary_entry_translation" value=""></dd>
  85                          <dt><label for="new_glossary_entry_comments"><?php _ex( 'Comments', 'glossary entry', 'glotpress' ); ?></label></dt>
  86                          <dd><textarea type="text" name="new_glossary_entry[comment]" id="new_glossary_entry_comments"></textarea></dd>
  87                      </dl>
  88                      <p>
  89                          <input type="hidden" name="new_glossary_entry[glossary_id]" value="<?php echo esc_attr( $glossary->id ); ?>">
  90                          <input type="submit" name="submit" value="<?php esc_attr_e( 'Create', 'glotpress' ); ?>" id="submit" />
  91                      </p>
  92                      <?php gp_route_nonce_field( 'add-glossary-entry_' . $project->path . $locale->slug . $translation_set->slug ); ?>
  93                  </form>
  94              </td>
  95          </tr>
  96          <?php endif; ?>
  97      </tbody>
  98  </table>
  99  
 100  <p class="clear actionlist secondary">
 101      <?php if( $can_edit ): ?>
 102          <?php echo gp_link( gp_url_join( gp_url_project_locale( $project->path, $locale_slug, $translation_set_slug ), array( 'glossary', '-import' ) ), __( 'Import', 'glotpress' ) ); ?>  &bull;&nbsp;
 103      <?php endif; ?>
 104  
 105      <?php echo gp_link( gp_url_join( gp_url_project_locale( $project->path, $locale_slug, $translation_set_slug ), array( 'glossary', '-export' ) ), __( 'Export as CSV', 'glotpress' ) ); ?>
 106  </p>
 107  
 108  <?php gp_tmpl_footer();


Generated: Mon Oct 14 01:01:57 2019 Cross-referenced by PHPXref 0.7.1