[ Index ]

PHP Cross Reference of GlotPress

title

Body

[close]

/gp-templates/ -> project.php (source)

   1  <?php
   2  gp_title(
   3      sprintf(
   4          /* translators: %s: Project name. */
   5          __( '%s &lt; GlotPress', 'glotpress' ),
   6          esc_html( $project->name )
   7      )
   8  );
   9  gp_breadcrumb_project( $project );
  10  gp_enqueue_scripts( array( 'gp-editor', 'tablesorter' ) );
  11  gp_enqueue_style( 'tablesorter-theme' );
  12  $edit_link = gp_link_project_edit_get( $project, __( '(edit)', 'glotpress' ) );
  13  
  14  if ( $project->active ) {
  15      add_filter(
  16          'gp_breadcrumb_items',
  17          function( $items ) {
  18              $items[ count( $items ) - 1 ] .= ' <span class="active bubble">' . __( 'Active', 'glotpress' ) . '</span>';
  19  
  20              return $items;
  21          }
  22      );
  23  }
  24  
  25  gp_tmpl_header();
  26  ?>
  27  <h2>
  28      <?php
  29      echo esc_html( $project->name );
  30      // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
  31      echo $edit_link;
  32      ?>
  33  </h2>
  34  
  35  <?php
  36  /**
  37   * Filter a project description.
  38   *
  39   * @since 1.0.0
  40   *
  41   * @param string     $description Project description.
  42   * @param GP_Project $project     The current project.
  43   */
  44  // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
  45  $project_description = apply_filters( 'gp_project_description', $project->description, $project );
  46  
  47  if ( $project_description ) {
  48      // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Sanitized via filters.
  49      echo '<div class="project-description">' . $project_description . '</div>';
  50  }
  51  ?>
  52  
  53  <?php if ( $can_write ) : ?>
  54  
  55  <div class="actionlist">
  56      <a href="#" class="project-actions" id="project-actions-toggle"><?php echo __( 'Project actions', 'glotpress' ) . ' &darr;'; ?></a>
  57      <div class="project-actions hide-if-js">
  58          <?php gp_project_actions( $project, $translation_sets ); ?>
  59      </div>
  60  </div>
  61  <?php endif; ?>
  62  
  63  <?php
  64  $project_class = $sub_projects ? 'with-sub-projects' : '';
  65  ?>
  66  <div id="project" class="<?php echo esc_attr( $project_class ); ?>">
  67  
  68  <?php if ( $translation_sets ) : ?>
  69  <div id="translation-sets">
  70      <h3><?php _e( 'Translations', 'glotpress' ); ?></h3>
  71      <table class="translation-sets tablesorter tablesorter-glotpress">
  72          <thead>
  73              <tr class="tablesorter-headerRow">
  74                  <th class="header tablesorter-header tablesorter-headerUnSorted"><?php _e( 'Locale', 'glotpress' ); ?></th>
  75                  <th class="header tablesorter-header tablesorter-headerUnSorted"><?php _ex( '%', 'locale translation percent header', 'glotpress' ); ?></th>
  76                  <th class="header tablesorter-header tablesorter-headerDesc"><?php _e( 'Translated', 'glotpress' ); ?></th>
  77                  <th class="header tablesorter-header tablesorter-headerUnSorted"><?php _e( 'Fuzzy', 'glotpress' ); ?></th>
  78                  <th class="header tablesorter-header tablesorter-headerUnSorted"><?php _e( 'Untranslated', 'glotpress' ); ?></th>
  79                  <th class="header tablesorter-header tablesorter-headerUnSorted"><?php _e( 'Waiting', 'glotpress' ); ?></th>
  80                  <?php if ( has_action( 'gp_project_template_translation_set_extra' ) ) : ?>
  81                  <th class="header tablesorter-header tablesorter-headerUnSorted extra"><?php _e( 'Extra', 'glotpress' ); ?></th>
  82                  <?php endif; ?>
  83              </tr>
  84          </thead>
  85          <tbody>
  86          <?php
  87          $class = '';
  88  
  89          foreach ( $translation_sets as $set ) :
  90              $class = ( 'odd' === $class ) ? 'even' : 'odd';
  91  
  92          ?>
  93              <tr class="<?php echo esc_attr( $class ); ?>">
  94                  <td>
  95                      <strong><?php gp_link( gp_url_project( $project, gp_url_join( $set->locale, $set->slug ) ), $set->name_with_locale() ); ?></strong>
  96                      <?php
  97                      if ( $set->current_count && $set->current_count >= $set->all_count * 0.9 ) :
  98                              $percent = floor( $set->current_count / $set->all_count * 100 );
  99                      ?>
 100                          <span class="bubble morethan90"><?php echo number_format_i18n( $percent ); ?>%</span>
 101                      <?php endif; ?>
 102                  </td>
 103                  <td class="stats percent"><?php echo number_format_i18n( $set->percent_translated ); ?>%</td>
 104                  <td class="stats translated" title="translated">
 105                      <?php
 106                      gp_link(
 107                          gp_url_project(
 108                              $project,
 109                              gp_url_join( $set->locale, $set->slug ),
 110                              array(
 111                                  'filters[translated]' => 'yes',
 112                                  'filters[status]'     => 'current',
 113                              )
 114                          ),
 115                          number_format_i18n( $set->current_count )
 116                      );
 117                      ?>
 118                  </td>
 119                  <td class="stats fuzzy" title="fuzzy">
 120                      <?php
 121                      gp_link(
 122                          gp_url_project(
 123                              $project,
 124                              gp_url_join( $set->locale, $set->slug ),
 125                              array(
 126                                  'filters[translated]' => 'yes',
 127                                  'filters[status]'     => 'fuzzy',
 128                              )
 129                          ),
 130                          number_format_i18n( $set->fuzzy_count )
 131                      );
 132                      ?>
 133                  </td>
 134                  <td class="stats untranslated" title="untranslated">
 135                      <?php
 136                      gp_link(
 137                          gp_url_project(
 138                              $project,
 139                              gp_url_join( $set->locale, $set->slug ),
 140                              array(
 141                                  'filters[status]' => 'untranslated',
 142                              )
 143                          ),
 144                          number_format_i18n( $set->untranslated_count )
 145                      );
 146                      ?>
 147                  </td>
 148                  <td class="stats waiting">
 149                      <?php
 150                      gp_link(
 151                          gp_url_project(
 152                              $project,
 153                              gp_url_join( $set->locale, $set->slug ),
 154                              array(
 155                                  'filters[translated]' => 'yes',
 156                                  'filters[status]'     => 'waiting',
 157                              )
 158                          ),
 159                          number_format_i18n( $set->waiting_count )
 160                      );
 161                      ?>
 162                  </td>
 163                  <?php if ( has_action( 'gp_project_template_translation_set_extra' ) ) : ?>
 164                      <td class="extra">
 165                          <?php
 166                          /**
 167                           * Fires in an extra information column of a translation set.
 168                           *
 169                           * @since 1.0.0
 170                           *
 171                           * @param GP_Translation_Set $set     The translation set.
 172                           * @param GP_Project         $project The current project.
 173                           */
 174                          do_action( 'gp_project_template_translation_set_extra', $set, $project );
 175                          ?>
 176                      </td>
 177                  <?php endif; ?>
 178              </tr>
 179          <?php endforeach; ?>
 180          </tbody>
 181      </table>
 182  </div>
 183  <?php elseif ( ! $sub_projects ) : ?>
 184      <p><?php _e( 'There are no translations of this project.', 'glotpress' ); ?></p>
 185  <?php endif; ?>
 186  
 187  
 188  <?php if ( $sub_projects ) : ?>
 189  <div id="sub-projects">
 190  <h3><?php _e( 'Sub-projects', 'glotpress' ); ?></h3>
 191  <dl>
 192  <?php foreach ( $sub_projects as $sub_project ) : ?>
 193      <dt>
 194          <?php gp_link_project( $sub_project, esc_html( $sub_project->name ) ); ?>
 195          <?php gp_link_project_edit( $sub_project, null, array( 'class' => 'bubble' ) ); ?>
 196          <?php
 197          if ( $sub_project->active ) {
 198              echo "<span class='active bubble'>" . __( 'Active', 'glotpress' ) . '</span>';
 199          }
 200          ?>
 201      </dt>
 202      <dd>
 203          <?php
 204          /**
 205           * Filter a sub-project description.
 206           *
 207           * @since 1.0.0
 208           *
 209           * @param string     $description Sub-project description.
 210           * @param GP_Project $project     The sub-project.
 211           */
 212          echo esc_html( gp_html_excerpt( apply_filters( 'gp_sub_project_description', $sub_project->description, $sub_project ), 111 ) );
 213          ?>
 214      </dd>
 215  <?php endforeach; ?>
 216  </dl>
 217  </div>
 218  <?php endif; ?>
 219  
 220  </div>
 221  
 222  <div class="clear"></div>
 223  
 224  
 225  <script type="text/javascript" charset="utf-8">
 226      $gp.showhide('a.personal-options', 'div.personal-options', {
 227          show_text: '<?php echo __( 'Personal project options', 'glotpress' ) . ' &darr;'; ?>',
 228          hide_text: '<?php echo __( 'Personal project options', 'glotpress' ) . ' &uarr;'; ?>',
 229          focus: '#source-url-template',
 230          group: 'personal'
 231      });
 232      jQuery('div.personal-options').hide();
 233      $gp.showhide('a.project-actions', 'div.project-actions', {
 234          show_text: '<?php echo __( 'Project actions', 'glotpress' ) . ' &darr;'; ?>',
 235          hide_text: '<?php echo __( 'Project actions', 'glotpress' ) . ' &uarr;'; ?>',
 236          focus: '#source-url-template',
 237          group: 'project'
 238      });
 239      jQuery(document).ready(function($) {
 240          $(".translation-sets").tablesorter({
 241              theme: 'glotpress',
 242              sortList: [[2,1]],
 243              headers: {
 244                  0: {
 245                      sorter: 'text'
 246                  }
 247              },
 248              widgets: ['zebra']
 249          });
 250      });
 251  </script>
 252  <?php
 253  gp_tmpl_footer();


Generated: Sun Nov 29 01:01:57 2020 Cross-referenced by PHPXref 0.7.1