[ Index ]

MailPress 7.1

[ Index ]     [ Classes ]     [ Functions ]     [ Variables ]     [ Constants ]     [ Statistics ]    

title

Body

[close]

/mp-admin/includes/ -> mailinglists.php (source)

   1  <?php
   2  
   3  if ( !( function_exists( 'current_user_can' ) && current_user_can( MP_AdminPage::capability ) ) ) die( 'Access denied' );
   4  
   5  $url_parms = MP_AdminPage::get_url_parms();
   6  
   7  //
   8  // MANAGING H1
   9  //
  10  
  11  $h1 = __( 'Mailing lists', 'MailPress' ); 
  12  
  13  //
  14  // MANAGING MESSAGE
  15  //
  16  
  17  $messages[1] = __( 'Mailinglist added.', 'MailPress' );
  18  $messages[2] = __( 'Mailinglist updated.', 'MailPress' );
  19  $messages[3] = __( 'Mailinglist deleted.', 'MailPress' );
  20  $messages[4] = __( 'Mailinglists deleted.', 'MailPress' );
  21  $messages[91] = __( 'Mailinglist not added.', 'MailPress' );
  22  $messages[92] = __( 'Mailinglist not updated.', 'MailPress' );
  23  
  24  if ( isset( MP_AdminPage::$get_['message'] ) )
  25  {
  26      $message = $messages[MP_AdminPage::$get_['message']];
  27      $_SERVER['REQUEST_URI'] = remove_query_arg( array( 'message' ), $_SERVER['REQUEST_URI'] );
  28  }
  29  
  30  //
  31  // MANAGING BULK ACTIONS
  32  //
  33  
  34  $bulk_actions['']        = __( 'Bulk Actions' );
  35  $bulk_actions['delete']    = __( 'Delete', 'MailPress' );
  36  
  37  //
  38  // MANAGING CONTENT
  39  //
  40  
  41  global $action;
  42  wp_reset_vars( array( 'action' ) );
  43  if ( 'edit' == $action ) 
  44  {
  45      $action = 'edited';
  46      $cancel = '<input type="submit" name="cancel" class="button" value="' . esc_attr( __( 'Cancel', 'MailPress' ) ) . '" />';
  47  
  48      $id = ( int ) MP_AdminPage::$get_['id'];
  49      $mailinglist = MP_Mailinglist::get( $id, OBJECT, 'edit' );
  50  
  51      $h3 = __( 'Edit Mailing List', 'MailPress' );
  52      $hb3= __( 'Update' );
  53      $hbclass = '-primary';
  54  
  55      $disabled = '';
  56  
  57      $hidden =  '<input type="hidden" name="id"   value="' . $id . '" />';
  58      $hidden .= '<input type="hidden" name="name" value="' . esc_attr( $mailinglist->name ) . '" />';
  59  }
  60  else 
  61  {
  62      $action = MP_AdminPage::add_form_id;
  63      $cancel = '';
  64  
  65      $mailinglist = new stdClass();
  66  
  67      $h3 = $hb3 = __( 'Add Mailing List', 'MailPress' );
  68      $hbclass = '';
  69  
  70      $disabled = '';
  71      $hidden = '';
  72  }
  73  
  74  //
  75  // MANAGING LIST
  76  //
  77  
  78  $url_parms['paged'] = isset( $url_parms['paged'] ) ? $url_parms['paged'] : 1;
  79  $_per_page = MP_AdminPage::get_per_page();
  80  
  81  $total = ( isset( $url_parms['s'] ) ) ? count( MP_Mailinglist::get_all( array( 'hide_empty' => 0, 'search' => $url_parms['s'] ) ) ) : wp_count_terms( MP_AdminPage::taxonomy );
  82  
  83  ?>
  84  <div class="wrap nosubsub">
  85      <h1>
  86          <?php echo esc_html( $h1 ); ?> 
  87  <?php if ( isset( $url_parms['s'] ) ) printf( '<span class="subtitle">' . __( 'Search results for &#8220;%s&#8221;' ) . '</span>', esc_attr( $url_parms['s'] ) ); ?>
  88      </h1>
  89  <?php if ( isset( $message ) ) MP_AdminPage::message( $message, ( MP_AdminPage::$get_['message'] < 90 ) ); ?>
  90      <form class="search-form topmargin" method="get">
  91  
  92          <input type="hidden" name="page" value="<?php echo MP_AdminPage::screen; ?>" />
  93  
  94          <p class="search-box">
  95              <input type="text" name="s" class="search-input" value="<?php if ( isset( $url_parms['s'] ) ) echo esc_attr( $url_parms['s'] ); ?>" />
  96              <input type="submit" class="button" value="<?php _e( 'Search', 'MailPress' ); ?>" />
  97          </p>
  98  
  99      </form>
 100      <br class="clear" />
 101      <div id="col-container">
 102          <div id="col-right">
 103              <div class="col-wrap">
 104                  <form id="posts-filter" method="get">
 105  
 106                      <input type="hidden" name="page" value="<?php echo MP_AdminPage::screen; ?>" />
 107  
 108                      <div class="tablenav top">
 109  <?php MP_AdminPage::pagination( $total ); ?>
 110                          <div class="alignleft actions bulkactions">
 111  <?php    MP_AdminPage::get_bulk_actions( $bulk_actions ); ?>
 112                          </div>
 113                          <br class="clear" />
 114                      </div>
 115                      <div class="clear"></div>
 116                      <table class="wp-list-table widefat fixed striped <?php echo MP_AdminPage::tr_prefix_id; ?>">
 117                          <thead>
 118                              <tr>
 119  <?php MP_AdminPage::columns_list(); ?>
 120                              </tr>
 121                          </thead>
 122                          <tbody id="<?php echo MP_AdminPage::list_id; ?>" class="list:<?php echo MP_AdminPage::tr_prefix_id; ?> mailinglists">
 123  <?php MP_AdminPage::get_list( array( 'start' => $url_parms['paged'], '_per_page' => $_per_page ) ); ?>
 124                          </tbody>
 125                          <tfoot>
 126                              <tr>
 127  <?php MP_AdminPage::columns_list( false ); ?>
 128                              </tr>
 129                          </tfoot>
 130                      </table>
 131                      <div class="tablenav bottom">
 132  <?php MP_AdminPage::pagination( $total, 'bottom' ); ?>
 133                          <div class="alignleft actions bulkactions">
 134  <?php    MP_AdminPage::get_bulk_actions( $bulk_actions, 'action2' ); ?>
 135                          </div>
 136                          <br class="clear" />
 137                      </div>
 138                      <br class="clear" />
 139                  </form>
 140                  <div class="form-wrap">
 141                      <p><?php printf( __( '<strong>Note:</strong><br />Deleting a mailing list does not delete the MailPress users in that mailing list. Instead, MailPress users that were only assigned to the deleted mailing list are set to the mailing list <strong>%s</strong>.', 'MailPress' ), MP_Mailinglist::get_name( get_option( MailPress_mailinglist::option_name_default ) ) ) ?></p>
 142                  </div>
 143              </div>
 144          </div><!-- /col-right -->
 145          <div id="col-left">
 146              <div class="col-wrap">
 147                  <div class="form-wrap">
 148                      <h3><?php echo esc_html( $h3 ); ?></h3>
 149                      <div id="ajax-response"></div>
 150                      <form name="<?php echo $action; ?>"  id="<?php echo $action; ?>"  method="post" class="<?php echo $action; ?>:<?php echo MP_AdminPage::list_id; ?>: validate">
 151  
 152                          <input type="hidden" name="action"   value="<?php echo $action; ?>" />
 153                          <input type="hidden" name="formname" value="mailinglist_form" />
 154                          <?php echo $hidden; ?>
 155                          <?php wp_nonce_field( 'update-' . MP_AdminPage::tr_prefix_id ); ?>
 156  
 157                          <div class="form-field form-required nopm">
 158                              <label for="mailinglist_name"><?php _e( 'Name', 'MailPress' ); ?></label>
 159                              <input type="text" name="name" id="mailinglist_name" size="40" aria-required="true" value="<?php if ( isset( $mailinglist->name ) ) echo esc_attr( $mailinglist->name ); ?>"<?php echo $disabled; ?> />
 160                              <p><?php _e( 'The name is used to identify the mailinglist almost everywhere.', 'MailPress' ); ?></p>
 161                          </div>
 162                          <div class="form-field nopm">
 163                              <label for="mailinglist_slug"><?php _e( 'Slug', 'MailPress' ) ?></label>
 164                              <input type="text" name="slug" id="mailinglist_slug" size="40" value="<?php if ( isset( $mailinglist->slug ) ) echo esc_attr( $mailinglist->slug ); ?>" />
 165                              <p><?php _e( 'The &#8220;slug&#8221; is a unique id for the mailing list (not so friendly !).', 'MailPress' ); ?></p>
 166                          </div>
 167                          <div class="form-field nopm">
 168                              <label for="mailinglist_description"><?php _e( 'Description', 'MailPress' ) ?></label>
 169                              <input type="text" name="description" id="mailinglist_description" size="40" value="<?php if ( isset( $mailinglist->description ) ) echo stripslashes( $mailinglist->description ); ?>" />
 170                              <p><?php _e( 'The description is not prominent by default.', 'MailPress' ); ?></p>
 171                          </div>
 172                          <div class="form-field nopm">
 173                              <label for="mailinglist_parent"><?php _e( 'Mailing list Parent', 'MailPress' ) ?></label>
 174                              <?php MP_Mailinglist::dropdown( array( 'hide_empty' => 0, 'htmlname' => 'parent', 'orderby' => 'name', 'htmlid' => 'mailinglist_parent', 'selected' => ( isset( $mailinglist->parent ) ) ? $mailinglist->parent : '', 'exclude' => ( isset( $id ) ) ? $id : '', 'hierarchical' => true, 'show_option_none' => __( 'None', 'MailPress' ) ) ); ?>
 175                              <p><?php _e( "Mailing list can have a hierarchy. You might have a Rock'n roll mailing list, and under that have children mailing lists for Elvis and The Beatles. Totally optional !", 'MailPress' ); ?></p>
 176                          </div>
 177                          <p class="submit">
 178                              <input type="submit" name="submit" id="mailinglist_submit" class="button<?php echo $hbclass; ?>" value="<?php echo $hb3; ?>" />
 179                              <?php echo $cancel; ?>
 180                          </p>
 181                      </form>
 182                  </div>
 183              </div>
 184          </div><!-- /col-left -->
 185      </div><!-- /col-container -->
 186  </div><!-- /wrap -->


Generated: Mon Mar 11 18:33:33 2019 Cross-referenced by PHPXref 0.7.1