Skip to content

Commit

Permalink
refactor contributor table logic
Browse files Browse the repository at this point in the history
as discussed in f2d79a4
  • Loading branch information
eteubert committed Jan 14, 2014
1 parent dbb1a86 commit ef27fef
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/modules/contributors/contributors.php
Original file line number Diff line number Diff line change
Expand Up @@ -344,8 +344,8 @@ public static function contributors_form_table($current_contributions = array(),
$contributors_groups = \Podlove\Modules\Contributors\Model\ContributorGroup::selectOptions();
$cjson = array();

$has_roles = count( $contributors_roles );
$has_groups = count( $contributors_groups );
$has_roles = count( $contributors_roles ) > 0;
$has_groups = count( $contributors_groups ) > 0;

foreach (\Podlove\Modules\Contributors\Model\Contributor::all() as $contributor) {
$show_contributions = \Podlove\Modules\Contributors\Model\ShowContribution::all( "WHERE `contributor_id` = " . $contributor->id );
Expand Down Expand Up @@ -393,8 +393,8 @@ public static function contributors_form_table($current_contributions = array(),
<tr>
<th class="podlove-avatar-column" colspand="2">Contributor</th>
<th></th>
<?php echo ( $has_groups > 0 ? '<th>Group</th>' : '' ); ?>
<?php echo ( $has_roles > 0 ? '<th>Role</th>' : '' ); ?>
<?php echo ( $has_groups ? '<th>Group</th>' : '' ); ?>
<?php echo ( $has_roles ? '<th>Role</th>' : '' ); ?>
<th style="width: 60px">Remove</th>
<th style="width: 30px"></th>
</tr>
Expand Down Expand Up @@ -422,7 +422,7 @@ public static function contributors_form_table($current_contributions = array(),
</select>
<a class="clickable podlove-icon-edit podlove-contributor-edit" href="<?php echo site_url(); ?>/wp-admin/edit.php?post_type=podcast&amp;page=podlove_contributors_settings_handle&amp;action=edit&contributor={{contributor-id}}"></a>
</td>
<?php if( $has_groups > 0 ) : ?>
<?php if( $has_groups ) : ?>
<td>
<select name="<?php echo $form_base_name ?>[{{id}}][{{contributor-id}}][group]" class="chosen podlove-group">
<option value=""><?php echo __( '- none -', 'podlove' ) ?></option>
Expand All @@ -432,7 +432,7 @@ public static function contributors_form_table($current_contributions = array(),
</select>
</td>
<?php endif; ?>
<?php if( $has_roles > 0 ) : ?>
<?php if( $has_roles ) : ?>
<td>
<select name="<?php echo $form_base_name ?>[{{id}}][{{contributor-id}}][role]" class="chosen podlove-role">
<option value=""><?php echo __( '- none -', 'podlove' ) ?></option>
Expand Down

0 comments on commit ef27fef

Please sign in to comment.