parent
fdadb054d2
commit
03de0860c2
@ -1,37 +1,34 @@ |
|||||||
<?php |
<?php |
||||||
/* For licensing terms, see /license.txt */ |
/* For licensing terms, see /license.txt */ |
||||||
/** |
/** |
||||||
* Users trying to login, who do not yet exist in the Chamilo database, |
* Users trying to login, who do not yet exist in the Chamilo database, |
||||||
* can be added by this script which tries to retrieve ldap information |
* can be added by this script which tries to retrieve ldap information |
||||||
* about them. |
* about them. |
||||||
* @author Roan Embrechts |
* @author Roan Embrechts |
||||||
* @package chamilo.auth.ldap |
* @package chamilo.auth.ldap |
||||||
*/ |
*/ |
||||||
/** |
/** |
||||||
* when a user does not exist yet in dokeos, |
* when a user does not exist yet in dokeos, |
||||||
* but he or she does exist in the LDAP, |
* but he or she does exist in the LDAP, |
||||||
* we add him to the dokeos database |
* we add him to the dokeos database |
||||||
*/ |
*/ |
||||||
//require_once('../../inc/global.inc.php'); - this script should be loaded by the /index.php script anyway, so global is already loaded |
//require_once('../../inc/global.inc.php'); - this script should be loaded by the /index.php script anyway, so global is already loaded |
||||||
require_once('authldap.php'); |
require_once 'authldap.php'; |
||||||
|
|
||||||
//error_log('Trying to register new user '.$login.' with pass '.$password,0); |
|
||||||
|
|
||||||
$ldap_login_success = ldap_login($login, $password); |
$ldap_login_success = ldap_login($login, $password); |
||||||
|
|
||||||
if ($ldap_login_success) |
if ($ldap_login_success) { |
||||||
{ |
//error_log('Found user '.$login.' on LDAP server',0); |
||||||
//error_log('Found user '.$login.' on LDAP server',0); |
/* |
||||||
/* |
In here, we know that |
||||||
In here, we know that |
- the user does not exist in dokeos |
||||||
- the user does not exist in dokeos |
- the users login and password are correct |
||||||
- the users login and password are correct |
*/ |
||||||
*/ |
$info_array = ldap_find_user_info($login); |
||||||
$info_array = ldap_find_user_info($login); |
ldap_put_user_info_locally($login, $info_array); |
||||||
ldap_put_user_info_locally($login, $info_array); |
|
||||||
} else { |
} else { |
||||||
//error_log('Could not find '.$login.' on LDAP server',0); |
//error_log('Could not find '.$login.' on LDAP server',0); |
||||||
$loginFailed = true; |
$loginFailed = true; |
||||||
unset($_user['user_id']); |
unset($_user['user_id']); |
||||||
$uidReset = false; |
$uidReset = false; |
||||||
} |
} |
||||||
|
@ -1,70 +1,71 @@ |
|||||||
<?php |
<?php |
||||||
|
// @deprecated? @todo check if this file is used |
||||||
|
|
||||||
$reports_template['exercicesMultiCourses'] = array( |
$reports_template['exercicesMultiCourses'] = array( |
||||||
'description' => 'Result of each test per student', |
'description' => 'Result of each test per student', |
||||||
'getSQL' => 'reports_template_exercicesMultiCourses_getSQL', |
'getSQL' => 'reports_template_exercicesMultiCourses_getSQL', |
||||||
'wizard' => |
'wizard' => |
||||||
' |
' |
||||||
<span id="exercicesMultiCourses" class="step"> |
<span id="exercicesMultiCourses" class="step"> |
||||||
<span class="font_normal_07em_black">Result of each test per student</span><br /> |
<span class="font_normal_07em_black">Result of each test per student</span><br /> |
||||||
|
|
||||||
<!-- <label for="scoremin">Score min</label><br /> |
<!-- <label for="scoremin">Score min</label><br /> |
||||||
<input class="input_field_25em" name="scoremin" id="scoremin" value="0"><br /> |
<input class="input_field_25em" name="scoremin" id="scoremin" value="0"><br /> |
||||||
<label for="scoremax">Score max</label><br /> |
<label for="scoremax">Score max</label><br /> |
||||||
<input class="input_field_25em" name="scoremax" id="scoremax" value="0"><br /> |
<input class="input_field_25em" name="scoremax" id="scoremax" value="0"><br /> |
||||||
--> <label for="tattempt">How to treat Attempts</label><br /> |
--> <label for="tattempt">How to treat Attempts</label><br /> |
||||||
<select name="tattempt" id="tattempt"> |
<select name="tattempt" id="tattempt"> |
||||||
<!-- <option value="first">take only the first one</option> |
<!-- <option value="first">take only the first one</option> |
||||||
<option value="last">take only the last one</option> |
<option value="last">take only the last one</option> |
||||||
--> <option value="avg">take the average value</option> |
--> <option value="avg">take the average value</option> |
||||||
<option value="min">take the minimum value</option> |
<option value="min">take the minimum value</option> |
||||||
<option value="max">take the maximum value</option> |
<option value="max">take the maximum value</option> |
||||||
</select><br /> |
</select><br /> |
||||||
<!-- <label name="gcourses">Do you want to group quiz per courses</label><br /> |
<!-- <label name="gcourses">Do you want to group quiz per courses</label><br /> |
||||||
<select name="gcourses" id="gcourses"> |
<select name="gcourses" id="gcourses"> |
||||||
<option value="nogroup">Do not group</option> |
<option value="nogroup">Do not group</option> |
||||||
<option value="average">group and take the average value</option> |
<option value="average">group and take the average value</option> |
||||||
<option value="min">group and take the minimum value</option> |
<option value="min">group and take the minimum value</option> |
||||||
<option value="max">group and take the maximum value</option> |
<option value="max">group and take the maximum value</option> |
||||||
</select><br /> |
</select><br /> |
||||||
--> <input type="hidden" class="link" value="format" /> |
--> <input type="hidden" class="link" value="format" /> |
||||||
</span> |
</span> |
||||||
'); |
'); |
||||||
|
|
||||||
function reports_template_exercicesMultiCourses_getSQL() { |
function reports_template_exercicesMultiCourses_getSQL() |
||||||
// foreach quiz |
{ |
||||||
$result = array(); |
// foreach quiz |
||||||
$columns = Database::query('select r.id as kid, c.title as course, '. |
$result = array(); |
||||||
'r.child_name as test from '. |
$columns = Database::query('select r.id as kid, c.title as course, '. |
||||||
Database::get_main_table(TABLE_MAIN_REPORTS_KEYS).' r, '. |
'r.child_name as test from '. |
||||||
Database::get_main_table(TABLE_MAIN_COURSE).' c '. |
Database::get_main_table(TABLE_MAIN_REPORTS_KEYS).' r, '. |
||||||
'where r.course_id=c.id and r.tool_id='. |
Database::get_main_table(TABLE_MAIN_COURSE).' c '. |
||||||
reports_getToolId(TOOL_QUIZ). |
'where r.course_id=c.id and r.tool_id='. |
||||||
' order by r.course_id, r.child_name'); |
reports_getToolId(TOOL_QUIZ). |
||||||
if (Database::num_rows($columns) == 0) |
' order by r.course_id, r.child_name'); |
||||||
die('<b>'.get_lang('no data found').'</b>'); |
if (Database::num_rows($columns) == 0) |
||||||
$query = 'select u.lastname Name, u.firstname Firstname'; |
die('<b>'.get_lang('no data found').'</b>'); |
||||||
$columns = Database::store_result($columns); |
$query = 'select u.lastname Name, u.firstname Firstname'; |
||||||
if ($_REQUEST['tattempt'] == 'min' || $_REQUEST['tattempt'] == 'max') |
$columns = Database::store_result($columns); |
||||||
$function = $_REQUEST['tattempt']; |
if ($_REQUEST['tattempt'] == 'min' || $_REQUEST['tattempt'] == 'max') |
||||||
else |
$function = $_REQUEST['tattempt']; |
||||||
$function = 'avg'; |
else |
||||||
foreach ($columns as $key => $column) |
$function = 'avg'; |
||||||
$query .= ', '.$function.'(k'.$key.'.score) as `'. |
foreach ($columns as $key => $column) |
||||||
$column['course'].' - '. |
$query .= ', '.$function.'(k'.$key.'.score) as `'. |
||||||
$column['test'].'` '; |
$column['course'].' - '. |
||||||
$query .= ' from '.Database::get_main_table(TABLE_MAIN_USER).' u '; |
$column['test'].'` '; |
||||||
foreach ($columns as $key => $column) // fixme sessions |
$query .= ' from '.Database::get_main_table(TABLE_MAIN_USER).' u '; |
||||||
$query .= 'left outer join '. |
foreach ($columns as $key => $column) // fixme sessions |
||||||
Database::get_main_table(TABLE_MAIN_REPORTS_VALUES). |
$query .= 'left outer join '. |
||||||
' k'.$key. |
Database::get_main_table(TABLE_MAIN_REPORTS_VALUES). |
||||||
' on k'.$key.'.key_id = '.$column['kid']. |
' k'.$key. |
||||||
' and k'.$key.'.user_id = u.user_id '; |
' on k'.$key.'.key_id = '.$column['kid']. |
||||||
$query .= ' group by '; |
' and k'.$key.'.user_id = u.user_id '; |
||||||
foreach ($columns as $key => $column) // grouping attempt |
$query .= ' group by '; |
||||||
$query .= 'k'.$key.'.attempt, '; |
foreach ($columns as $key => $column) // grouping attempt |
||||||
$query = substr($query, 0, -2); // removing last ', '; |
$query .= 'k'.$key.'.attempt, '; |
||||||
|
$query = substr($query, 0, -2); // removing last ', '; |
||||||
|
|
||||||
|
return $query; |
||||||
return $query; |
|
||||||
} |
} |
||||||
|
Loading…
Reference in new issue