<?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_shibboleth");
        }
    ?></h2>
      <div class="subcontent loginsub">
        <div class="desc">
        <?php
          if (!empty($errormsg)) {
              echo '<div class="loginerrors">';
              echo $OUTPUT->error_text($errormsg);
              echo '</div>';
          }

        ?>
          <div class="guestsub">
          <p><label for="idp"><?php print_string("auth_shibboleth_select_organization", "auth_shibboleth"); ?></label></p>
            <form action="login.php" method="post" id="guestlogin">
            <select id="idp" name="idp">
                <option value="-" ><?php print_string("auth_shibboleth_select_member", "auth_shibboleth"); ?></option>
                <?php
                    print_idp_list();
                ?>
            </select><p><input type="submit" value="<?php print_string("select"); ?>" accesskey="s" /></p>
            </form>
            <p>
            <?php
                print_string("auth_shib_contact_administrator", "auth_shibboleth", get_admin()->email);
            ?>
            </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="logintoken" value="<?php echo s(\core\session\manager::get_login_token()); ?>" />
            <input type="hidden" name="username" value="guest" />
            <input type="hidden" name="password" value="guest" />
            <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>
