upgrade
This commit is contained in:
18
main/auth/shibboleth/app/view/admin_login.php
Normal file
18
main/auth/shibboleth/app/view/admin_login.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace Shibboleth;
|
||||
|
||||
/**
|
||||
* Administratrive login. Useful when the standard login is not available anymore
|
||||
* which is usually the case.
|
||||
*
|
||||
* This page allow administrators to log into the application using the standard
|
||||
* Chamilo method when Shibboleth is not available.
|
||||
*
|
||||
* @license see /license.txt
|
||||
* @author Laurent Opprecht <laurent@opprecht.info>, Nicolas Rod for the University of Geneva
|
||||
*/
|
||||
$dir = __DIR__;
|
||||
include_once "$dir/../../init.php";
|
||||
|
||||
ShibbolethController::instance()->admin_login();
|
||||
20
main/auth/shibboleth/app/view/request.php
Normal file
20
main/auth/shibboleth/app/view/request.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace Shibboleth;
|
||||
|
||||
/**
|
||||
* Display the Request another status/additional rights. The request is emailed
|
||||
* to the shibboleth and platform administrators for processing.
|
||||
*
|
||||
* Users such as staff that can be either student or teachers are presented with
|
||||
* this page upon first login.
|
||||
*
|
||||
* Other users - teachers, students - are directly logged-in.
|
||||
*
|
||||
* @license see /license.txt
|
||||
* @author Laurent Opprecht <laurent@opprecht.info>, Nicolas Rod for the University of Geneva
|
||||
*/
|
||||
$dir = __DIR__;
|
||||
include_once "$dir/../../init.php";
|
||||
|
||||
ShibbolethController::instance()->request_status();
|
||||
66
main/auth/shibboleth/app/view/shibboleth_display.class.php
Normal file
66
main/auth/shibboleth/app/view/shibboleth_display.class.php
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace Shibboleth;
|
||||
|
||||
use \Display;
|
||||
|
||||
/**
|
||||
* Utility display functions tailored for the Shibboleth pluging.
|
||||
*
|
||||
* @license see /license.txt
|
||||
* @author Laurent Opprecht <laurent@opprecht.info>, Nicolas Rod for the University of Geneva
|
||||
*/
|
||||
class ShibbolethDisplay
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
* @return ShibbolethDisplay
|
||||
*/
|
||||
public static function instance()
|
||||
{
|
||||
static $result = false;
|
||||
if (empty($result))
|
||||
{
|
||||
$result = new self();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $message
|
||||
*/
|
||||
public function error_page($message)
|
||||
{
|
||||
$page_title = get_lang('ShibbolethLogin');
|
||||
|
||||
Display :: display_header($page_title);
|
||||
echo Display::return_message($message, 'error');
|
||||
Display :: display_footer();
|
||||
die;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $message
|
||||
*/
|
||||
public function message_page($message, $title = '')
|
||||
{
|
||||
$title = $title ? $title : get_lang('ShibbolethLogin');
|
||||
|
||||
Display::display_header($title);
|
||||
echo Display::return_message($message, 'confirm');
|
||||
Display::display_footer();
|
||||
die;
|
||||
}
|
||||
|
||||
public function page($content, $title = '')
|
||||
{
|
||||
$title = $title ? $title : get_lang('ShibbolethLogin');
|
||||
|
||||
Display :: display_header($title);
|
||||
echo $content;
|
||||
Display :: display_footer();
|
||||
die;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace Shibboleth;
|
||||
|
||||
/**
|
||||
* Enter email form. When the email is mandatory and the Shibboleth email user field
|
||||
* is empty the system display this form and ask the user to provide an email.
|
||||
*
|
||||
* @todo: add email validation
|
||||
*
|
||||
* @license see /license.txt
|
||||
* @author Laurent Opprecht <laurent@opprecht.info>, Nicolas Rod for the University of Geneva
|
||||
*/
|
||||
class ShibbolethEmailForm
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
* @return ShibbolethEmailForm
|
||||
*/
|
||||
public static function instance()
|
||||
{
|
||||
static $result = false;
|
||||
if (empty($result))
|
||||
{
|
||||
$result = new self();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
function display()
|
||||
{
|
||||
|
||||
$email = get_lang('Email');
|
||||
$submit = get_lang('Submit');
|
||||
return <<<EOT
|
||||
<form id="email_form" action="" method="post">
|
||||
<label for="">$email</label>
|
||||
<input type="text" value="" tabindex="1" name="email" id="email_email" class=""><br/>
|
||||
<input type="submit" value="$submit" tabindex="2" name="submit" id="email_submit" class="submit">
|
||||
</form>
|
||||
|
||||
EOT;
|
||||
}
|
||||
|
||||
function get_email()
|
||||
{
|
||||
return isset($_POST['email']) ? $_POST['email'] : '';
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
|
||||
namespace Shibboleth;
|
||||
|
||||
use Display;
|
||||
|
||||
/**
|
||||
* Status request form. Display a form allowing the user to request additional
|
||||
* rights/ another status.
|
||||
*
|
||||
* @license see /license.txt
|
||||
* @author Laurent Opprecht <laurent@opprecht.info>, Nicolas Rod for the University of Geneva
|
||||
*/
|
||||
class ShibbolethStatusRequestForm
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
* @return ShibbolethStatusRequestForm
|
||||
*/
|
||||
public static function instance()
|
||||
{
|
||||
static $result = false;
|
||||
if (empty($result))
|
||||
{
|
||||
$result = new self();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
function display()
|
||||
{
|
||||
if ($this->is_submitted() && $this->get_reason() == '')
|
||||
{
|
||||
$reason_is_mandatory = get_lang('ReasonIsMandatory');
|
||||
echo Display::return_message($reason_is_mandatory, 'error');
|
||||
}
|
||||
|
||||
$status_request_message = get_lang('StatusRequestMessage');
|
||||
$label_new_status = get_lang('NewStatus');
|
||||
$label_reason = get_lang('Reason');
|
||||
$label_ok = get_lang('Ok');
|
||||
$label_cancel = get_lang('Cancel');
|
||||
|
||||
$user = Shibboleth::session()->user();
|
||||
$items = array();
|
||||
if ($user['status'] == Shibboleth::UNKNOWN_STATUS)
|
||||
{
|
||||
$items[Shibboleth::STUDENT_STATUS] = get_lang('Student');
|
||||
}
|
||||
$items[Shibboleth::TEACHER_STATUS] = get_lang('Teacher');
|
||||
$status_options = '';
|
||||
foreach ($items as $key => $value)
|
||||
{
|
||||
$status_options.= "<option value=\"$key\">$value</option>";
|
||||
}
|
||||
|
||||
return <<<EOT
|
||||
<div id="askAccountText">
|
||||
<p>$status_request_message</p>
|
||||
</div>
|
||||
<form method="post" action="request.php" id="status_request_form">
|
||||
|
||||
<input type="hidden" name="formPosted" value="true"/>
|
||||
|
||||
<label for="status">$label_new_status:</label>
|
||||
<select name="status">
|
||||
$status_options
|
||||
</select>
|
||||
<label for="reason">$label_reason:</label>
|
||||
<textarea name="reason" style="min-width:400px; min-height:100px;"></textarea>
|
||||
<p><input name="submit" type="submit" value="$label_ok" style="margin-right:10px;"/><input name="cancel" type="submit" value="$label_cancel" /></p>
|
||||
</form>
|
||||
EOT;
|
||||
}
|
||||
|
||||
public function is_submitted()
|
||||
{
|
||||
return isset($_POST['submit']) ? $_POST['submit'] : false;
|
||||
}
|
||||
|
||||
public function cancelled()
|
||||
{
|
||||
return isset($_POST['cancel']) ? $_POST['cancel'] : false;
|
||||
}
|
||||
|
||||
function get_reason()
|
||||
{
|
||||
return isset($_POST['reason']) ? $_POST['reason'] : '';
|
||||
}
|
||||
|
||||
function get_status()
|
||||
{
|
||||
return isset($_POST['status']) ? $_POST['status'] : '';
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user