public function dateselect($label, $fieldname)
    {
        $_months = array_values(PA::getMonthsList());
        array_unshift($_months, " ");
        $monthnames = $_months;
        $years = PA::getYearsList();
        $v = $this->getVal($fieldname);
        $vyear = $vmonth = $vday = 0;
        if ($v) {
            list($vyear, $vmonth, $vday) = explode('-', $v);
        } else {
            if ($this->getVal($fieldname . '_day')) {
                $vday = $this->getVal($fieldname . '_day');
                $vmonth = $this->getVal($fieldname . '_month');
                $vyear = $this->getVal($fieldname . '_year');
            }
        }
        ?>
      <div class="<?php 
        echo $this->field_class;
        ?>
">
        <h4><label for="<?php 
        echo $fieldname;
        ?>
"><?php 
        echo $label;
        ?>
</label></h4>
        <div class="center">
          <select name="<?php 
        echo $fieldname . '_day';
        ?>
" id="<?php 
        echo $fieldname . '_day';
        ?>
" class="select-txt">
            <option value=""></option>
          <?php 
        for ($i = 1; $i <= 31; $i++) {
            if ($i == (int) $vday) {
                $selected = " selected=\"selected\" ";
            } else {
                $selected = "";
            }
            ?>
            <option <?php 
            echo $selected;
            ?>
 value="<?php 
            echo $i;
            ?>
"><?php 
            echo $i;
            ?>
</option>
          <?php 
        }
        ?>
        </select>
        <select name="<?php 
        echo $fieldname . '_month';
        ?>
" id="<?php 
        echo $fieldname . '_month';
        ?>
" class="select-txt">
          <?php 
        for ($i = 1; $i <= 12; $i++) {
            if ($i == (int) $vmonth) {
                $selected = " selected=\"selected\" ";
            } else {
                $selected = "";
            }
            ?>
            <option <?php 
            echo $selected;
            ?>
 value="<?php 
            echo $i;
            ?>
"><?php 
            echo $monthnames[$i];
            ?>
</option>
          <?php 
        }
        ?>
        </select>
        <select name="<?php 
        echo $fieldname . '_year';
        ?>
" id="<?php 
        echo $fieldname . '_year';
        ?>
" class="select-txt">
            <option value=""></option>
          <?php 
        foreach ($years as $k => $year) {
            if ($year == (int) $vyear) {
                $selected = " selected=\"selected\" ";
            } else {
                $selected = "";
            }
            ?>
            <option <?php 
            echo $selected;
            ?>
 value="<?php 
            echo $year;
            ?>
"><?php 
            echo $year;
            ?>
</option>
          <?php 
        }
        ?>
        </select>

        </div>
        <br />
      </div>
  <?php 
    }
  public function dateselect($label, $fieldname, $section, $seq=NULL, $show_access_list=true) {
     
    $_months = array_values(PA::getMonthsList());
    array_unshift($_months, " ");
    $monthnames = $_months;
    $years = PA::getYearsList();

    $f = @$this->user->{$section}[$fieldname];
    if ($seq) {
      $f = $f[$seq]; // we have a collection here
      $fieldname = $fieldname."[$seq]"; // to properly pass in HTML
    }
    $v = @$f['value'];
    $vyear = $vmonth = $vday = 0;
    if ($v) {
      list($vyear, $vmonth, $vday) = explode('-', $v);
    }
  ?>
      <div class="field_medium">
        <h4><label for="<?=$fieldname.'[value]'?>"><?=$label?></label></h4>
        <div class="center">
          <select name="<?=$fieldname.'_day[value]'?>" id="<?=$fieldname.'_day[value]'?>" class="select-txt">
            <option value=""></option>
          <?php
          for ($i=1; $i<=31; $i++) {
              if($i == (int)$vday) {
                $selected = " selected=\"selected\" ";
              } else {
                $selected = "";
              }
            ?>
            <option <?=$selected;?> value="<?=$i?>"><?=$i?></option>
          <?php } ?>
        </select>
        <select name="<?=$fieldname.'_month[value]'?>" id="<?=$fieldname.'_month[value]'?>" class="select-txt">
          <?php
          for ($i=1; $i<=12; $i++) {
              if($i == (int)$vmonth) {
                $selected = " selected=\"selected\" ";
              } else {
                $selected = "";
              }
            ?>
            <option <?=$selected;?> value="<?=$i?>"><?=$monthnames[$i]?></option>
          <?php } ?>
        </select>
        <select name="<?=$fieldname.'_year[value]'?>" id="<?=$fieldname.'_year[value]'?>" class="select-txt">
            <option value=""></option>
          <?php
          foreach ($years as $k=>$year) {
              if($year == (int)$vyear) {
                $selected = " selected=\"selected\" ";
              } else {
                $selected = "";
              }
            ?>
            <option <?=$selected?> value="<?=$year?>"><?=$year?></option>
          <?php } ?>
        </select>

        </div>
        <?php
          if ($show_access_list) {
        ?>
        <div>
        <?php
          print uihelper_get_user_access_list($fieldname."[perm]", $f["perm"]);
        ?>
        </div>
        <?php
          }
        ?>
        <br />
      </div>
  <?
  }
 private function handleGET_addChild($request_data)
 {
     $this->renderer->add_page_js(PA::$theme_url . '/javascript/jquery.validate.js');
     $this->renderer->add_page_js(PA::$theme_url . '/javascript/jquery.metadata.js');
     $this->renderer->add_page_js(PA::$theme_url . '/javascript/ajaxfileupload.js');
     $this->renderer->add_page_js(PA::$theme_url . '/javascript/child_registration.js');
     $title = __("Add a Child");
     $years = array_flip(PA::getYearsList());
     $years[' '] = '';
     $months = array_flip(PA::getMonthsList());
     $months[' '] = '';
     $states = array("-2" => '-Select-', "-1" => 'Other');
     $states = $states + array_values(PA::getStatesList());
     $countries = array("-1" => '-Select-');
     $countries = $countries + array_values(PA::getCountryList());
     $this->inner_HTML = $this->generate_inner_html(array('title' => $title, 'states' => $states, 'countries' => $countries, 'months' => $months, 'years' => $years, 'parent_uid' => PA::$login_uid));
 }