[ Index ]

PHP Cross Reference of GlotPress

title

Body

[close]

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

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


Generated: Fri Nov 22 01:01:58 2019 Cross-referenced by PHPXref 0.7.1