<?php
  /**
   * Copyright 2011 Zazavi - http://www.zazavi.com
   * Zazavi is free software released under the terms of the GNU General Public License.
   * You should have received a copy of the license.  If not, see <http://www.gnu.org/licenses/>.
   */
  if (!defined("_VALID_PHP"))
      die('Direct access to this location is not allowed.');
?>
<!-- Full Layout -->
<div id="main-col">
  <div class="wrap">
    <div class="main-col-inner">
      <h1><?php echo _UA_TITLE1;?></h1>
      <p class="info"><?php echo _UA_INFO1;?></p>
      <div class="box">
        <table width="100%" border="0" cellpadding="3" cellspacing="0">
          <tr>
            <td colspan="2"><h3><?php echo _UA_SEL_MEMBERSHIP;?></h3></td>
          </tr>
          <tr>
            <td width="200"><strong><?php echo _MS_TITLE;?>:</strong></td>
            <?php foreach ($listpackrow as $prow):?>
            <td class="center" style="color:#09F"><strong><?php echo $prow['title'];?></strong></td>
            <?php endforeach;?>
          </tr>
          <tr>
            <td><strong><?php echo _MS_PRICE;?>:</strong></td>
            <?php foreach ($listpackrow as $prow):?>
            <td class="center" style="color:#09F"><?php echo $core->formatMoney($prow['price']);?></td>
            <?php endforeach;?>
          </tr>
          <tr>
            <td><strong><?php echo _MS_PERIOD;?>:</strong></td>
            <?php foreach ($listpackrow as $prow):?>
            <td class="center" style="color:#09F"><?php echo $prow['days'] . ' ' .$member->getPeriod($prow['period']);?></td>
            <?php endforeach;?>
          </tr>
          <tr>
            <td><strong><?php echo _MS_RECURRING;?>:</strong></td>
            <?php foreach ($listpackrow as $prow):?>
            <td class="center" style="color:#09F"><?php echo ($prow['recurring']) ? _YES : _NO;?></td>
            <?php endforeach;?>
          </tr>
          <tr>
            <td valign="top"><strong><?php echo _MS_DESC;?>:</strong></td>
            <?php foreach ($listpackrow as $prow):?>
            <td class="center"><span style="font-size:11px"><?php echo $prow['description'];?></span></td>
            <?php endforeach;?>
          </tr>
          <tr>
            <td>&nbsp;</td>
            <?php foreach ($listpackrow as $prow):?>
            <td class="center" style=" border-top-width: 1px; border-top-style: dashed; border-top-color: #ddd;">
              <?php if($prow['price'] == 0):?>
               <a href="javascript:void(0);" class="add-cart" id="item_<?php echo $prow['id'].':FREE';?>"> 
              <img src="<?php echo SITEURL;?>/assets/activate.png" alt="" title="<?php echo _UA_ACTIVATE;?>"/> 
              </a> 
              <?php else:?>            
			  <?php if($gatelist):?>
              <?php foreach($gatelist as $grow):?>
              <?php if ($grow['active']):?>
              <a href="javascript:void(0);" class="add-cart" id="item_<?php echo $prow['id'].':'.$grow['id'];?>"> 
              <img src="<?php echo SITEURL.'/gateways/'.$grow['dir'].'/'.$grow['displayname'].'.png';?>" alt="" title="<?php echo $grow['displayname'];?>"/> 
              </a>
              <?php endif;?>     
              <?php endforeach;?>
			  <?php endif;?>
              <?php endif;?></td>
            <?php endforeach;?>
          </tr>
        </table>
      </div>
      <div id="show-result"></div>
      <br />
      <div class="box">
        <form action="" method="post" id="admin_form" name="admin_form">
          <table width="100%" border="0" cellpadding="3" cellspacing="0">
            <tr>
              <td colspan="2"><div style="position:relative"><div id="msgholder"></div><h3><?php echo _UA_SUBTITLE1;?></h3></div></td>
            </tr>
            <tr>
              <td width="180"><strong><?php echo _USERNAME;?>:</strong></td>
              <td><input name="username" type="text" disabled="disabled" class="inputbox" value="<?php echo $row['username'];?>" size="45" /></td>
            </tr>
            <tr>
              <td><strong><?php echo _PASSWORD;?>:</strong></td>
              <td><input name="password" type="password"  class="inputbox" size="45" />
                &nbsp;&nbsp; <?php echo tooltip(_UR_PASS_T);?></td>
            </tr>
            <tr>
              <td><strong><?php echo _UR_EMAIL;?>: <?php echo required();?></strong></td>
              <td><input name="email" type="text" class="inputbox" value="<?php echo $row['email'];?>" size="45" maxlength="40" /></td>
            </tr>
            <tr>
              <td><strong><?php echo _UR_FNAME;?>:</strong> <?php echo required();?></td>
              <td><input name="fname" type="text" class="inputbox" value="<?php echo $row['fname'];?>" size="45" /></td>
            </tr>
            <tr>
              <td><strong><?php echo _UR_LNAME;?>:</strong> <?php echo required();?></td>
              <td><input name="lname" type="text" class="inputbox" value="<?php echo $row['lname'];?>" size="45" /></td>
            </tr>
            <tr>
              <td><strong><?php echo _UR_IS_NEWSLETTER;?>:</strong></td>
              <td><span class="input-out">
                <input type="radio" name="newsletter" value="1" <?php getChecked($row['newsletter'], 1); ?> />
                <?php echo _YES;?> &nbsp;
                <input type="radio" name="newsletter" value="0" <?php getChecked($row['newsletter'], 0); ?>/>
                <?php echo _NO;?></span></td>
            </tr>
            <tr>
              <td><strong><?php echo _UR_DATE_REGGED;?>:</strong></td>
              <td><span class="input-out"><?php echo $row['cdate'];?></span></td>
            </tr>
            <tr>
              <td><strong><?php echo _UR_LASTLOGIN;?>:</strong></td>
              <td><span class="input-out"><?php echo $row['ldate'];?></span></td>
            </tr>
            <tr>
              <td colspan="2"><input name="submit" type="submit" value="<?php echo _UA_UPDATE;?>"  class="button"/></td>
            </tr>
          </table>
        </form>
      </div>
      <div class="box">
        <table width="100%" border="0" cellpadding="3" cellspacing="0">
          <tr>
            <td><strong><?php echo _UA_CUR_MEMBERSHIP;?></strong></td>
            <td><strong><?php echo _UA_VALID_UNTIL;?></strong></td>
          </tr>
          <?php if($row['membership_id'] == 0) :?>
          <tr>
            <td><?php echo _UA_NO_MEMBERSHIP;?></td>
            <td>--/--</td>
          </tr>
          <?php else:?>
          <tr>
            <td style="color:#09F"><strong> <?php echo $mrow['title'];?> </strong></td>
            <td style="color:#09F"><strong> <?php echo $mrow['expiry'];?> </strong></td>
          </tr>
          <?php endif;?>
        </table>
      </div>
    </div>
  </div>
</div>
<?php echo $core->doForm("processUser","ajax/controller.php");?>
<script type="text/javascript">
// <![CDATA[
$(document).ready(function () {
    $("a.add-cart").live("click", function () {
        var parent = $(this);
        $.ajax({
            type: "POST",
            url: "ajax/controller.php",
            data: 'addtocart=' + $(this).attr('id').replace('item_', ''),
            success: function (msg) {
                $("#show-result").html(msg);

            }
        });
        return false;
    });
});
// ]]>
</script>
<!-- Full Layout /--> 