<?php
$config = get_config('auth/shibboleth');

if ($show_instructions) {
    $columns = 'twocolumns';
} else {
    $columns = 'onecolumn';
}
?>
<div class="loginbox clearfix <?php echo $columns ?>">
  <div class="loginpanel">
    <!--<h2><?php print_string("returningtosite") ?></h2>-->
    
    <h2><?php 
        if (isset($config->login_name) && !empty($config->login_name)){
            echo $config->login_name;
        } else {
            print_string("auth_shibboleth_login_long", "auth");
        }
    ?></h2>
      <div class="subcontent loginsub">
        <div class="desc">
        <?php
          if (!empty($errormsg)) {
              echo '<div class="loginerrors">';
              formerr($errormsg);
              echo '</div>';
          }

        ?>
          <div class="guestsub">
          <p><?php print_string("auth_shibboleth_select_organization", "auth"); ?></p>
            <form action="login.php" method="post" id="guestlogin">
            <select name="idp"> 
                <option value="-" ><?php print_string("auth_shibboleth_select_member", "auth"); ?></option>
                <?php
                    print_idp_list();
                ?>
            </select><p><input type="submit" value="<?php print_string("select"); ?>" accesskey="s" /></p>
            </form>
            <p>
            <?php 
                print_string("auth_shibboleth_contact_administrator", "auth"); 
                echo '<a href="mailto:'.get_admin()->email.'"> Moodle Administrator</a>.';
            ?>
            </p>
          </div>
         </div>
      </div>

<?php if ($CFG->guestloginbutton) {  ?>
      <div class="subcontent guestsub">
        <div class="desc">
          <?php print_string("someallowguest") ?>
        </div>
        <form action="../../login/index.php" method="post" id="guestlogin">
          <div class="guestform">
            <input type="hidden" name="username" value="guest" />
            <input type="hidden" name="password" value="guest" />
            <input type="hidden" name="testcookies" value="1" />
            <input type="submit" value="<?php print_string("loginguest") ?>" />
          </div>
        </form>
      </div>
<?php } ?>
     </div>


<?php if ($show_instructions) { ?>
    <div class="signuppanel">
      <h2><?php print_string("firsttime") ?></h2>
      <div class="subcontent">
<?php     if (is_enabled_auth('none')) { // instructions override the rest for security reasons 
              print_string("loginstepsnone");
          } else if ($CFG->registerauth == 'email') {
              if (!empty($CFG->auth_instructions)) {
                  echo format_text($CFG->auth_instructions);
              } else {
                  print_string("loginsteps", "", "signup.php");
              } ?>
                 <div class="signupform">
                   <form action="../../login/signup.php" method="get" id="signup">
                   <div><input type="submit" value="<?php print_string("startsignup") ?>" /></div>
                   </form>
                 </div>
<?php     } else if (!empty($CFG->registerauth)) {
              echo format_text($CFG->auth_instructions); ?>
              <div class="signupform">
                <form action="../../login/signup.php" method="get" id="signup">
                <div><input type="submit" value="<?php print_string("startsignup") ?>" /></div>
                </form>
              </div>
<?php     } else {
              echo format_text($CFG->auth_instructions);
          } ?>
      </div>
    </div>
<?php } ?>
</div>
