Bug #3646 and Issue #306 - Learning paths, the old Conference tool, Booking tool, Social network tool, Surveys: Fixing person name order and sorting to be dependable on the internationalization settings.

skala
Ivan Tcholakov 16 years ago
parent 56abaf7551
commit 9dce81ad53
  1. 4
      main/newscorm/aicc_api.php
  2. 2
      main/newscorm/aicc_hacp.php
  3. 164
      main/newscorm/scorm_api.php
  4. 2
      main/online/online_whoisonline.php
  5. 6
      main/reservation/rsys.php
  6. 2
      main/social/contacts.inc.php
  7. 15
      main/social/data_personal.inc.php
  8. 2
      main/social/group_contact.inc.php
  9. 108
      main/social/profile.php
  10. 2
      main/social/qualify_contact.inc.php
  11. 2
      main/social/select_friend_response.php
  12. 9
      main/social/select_options.php
  13. 2
      main/social/show_search_image.inc.php
  14. 2
      main/survey/create_new_survey.php
  15. 574
      main/survey/fillsurvey.php
  16. 128
      main/survey/survey.lib.php
  17. 2
      main/survey/survey_invitation.php
  18. 16
      main/survey/survey_invite.php
  19. 8
      whoisonline.php

@ -153,7 +153,7 @@ function LMSGetValue(param) {
result='<?php echo $_user['user_id']; ?>';
}else if(param == 'cmi.core.student_name'){
<?php
$who=addslashes($_user['lastName'].", ".$_user['firstName']);
$who=addslashes(api_get_person_name($_user['firstName'], $_user['lastName']));
echo "result='$who';";
?>
}else if(param == 'cmi.core.lesson_location'){
@ -209,7 +209,7 @@ function LMSGetValue(param) {
break;
case 'cmi.core.student_name' :
<?php
$who=addslashes($_user['firstName'].",".$_user['lastName']);
$who=addslashes(api_get_person_name($_user['firstName'], $_user['lastName']));
echo "result='$who';";
?> break;
case 'cmi.core.lesson_location' :

@ -106,7 +106,7 @@ if(!empty($_REQUEST['command']))
$result = $s_ec.$error_code.$crlf.$s_et.$error_text.$crlf.$s_ad.$crlf;
$result .= '[Core]'.$crlf;
$result .= $tab.'Student_ID='.$_user['user_id'].$crlf;
$result .= $tab.'Student_Name='.$_user['lastName'].', '.$_user['firstName'].$_user['user_id'].$crlf;
$result .= $tab.'Student_Name='.api_get_person_name($_user['firstName'], $_user['lastName']).$crlf;
$result .= $tab.'Lesson_Location='.$oItem->get_lesson_location().$crlf;
$result .= $tab.'Credit='.$oItem->get_credit().$crlf;
$result .= $tab.'Lesson_Status='.$oItem->get_status().$crlf;

@ -108,18 +108,18 @@ api_1484_11 = API_1484_11;
//api_1484_11 = new APIobject(); //for scorm 1.3
// Error codes
var G_NoError = 0;
var G_GeneralException = 101;
var G_NoError = 0;
var G_GeneralException = 101;
var G_ServerBusy = 102; // this is not in the Scorm1.2_Runtime document
var G_InvalidArgumentError = 201;
var G_InvalidArgumentError = 201;
var G_ElementCannotHaveChildren = 202;
var G_ElementIsNotAnArray = 203;
var G_NotInitialized = 301;
var G_NotImplementedError = 401;
var G_InvalidSetValue = 402;
var G_ElementIsReadOnly = 403;
var G_ElementIsWriteOnly = 404;
var G_IncorrectDataType = 405;
var G_ElementIsNotAnArray = 203;
var G_NotInitialized = 301;
var G_NotImplementedError = 401;
var G_InvalidSetValue = 402;
var G_ElementIsReadOnly = 403;
var G_ElementIsWriteOnly = 404;
var G_IncorrectDataType = 405;
// Error messages
var G_NoErrorMessage = '';
@ -250,14 +250,14 @@ function LMSInitialize() { //this is the initialize function of all APIobjects
return('false');
} else {
logit_scorm('LMSInitialise()',0);
lms_initialized=1;
return('true');
lms_initialized=1;
return('true');
}
}
function Initialize()
{ //this is the initialize function of all APIobjects
return LMSInitialize();
return LMSInitialize();
}
function LMSGetValue(param)
@ -294,9 +294,9 @@ function LMSGetValue(param)
}
// ---- cmi.core._children
if(param=='cmi.core._children' || param=='cmi.core_children') {
if(param=='cmi.core._children' || param=='cmi.core_children'){
result='entry, exit, lesson_status, student_id, student_name, lesson_location, total_time, credit, lesson_mode, score, session_time';
} else if(param == 'cmi.core.entry'){
}else if(param == 'cmi.core.entry'){
// ---- cmi.core.entry
if(lms_item_core_exit=='none') {
result='ab-initio';
@ -305,8 +305,8 @@ function LMSGetValue(param)
} else {
result='';
}
} else if(param == 'cmi.core.exit'){
// ---- cmi.core.exit
}else if(param == 'cmi.core.exit'){
// ---- cmi.core.exit
result='';
G_LastError = G_ElementIsWriteOnly;
}else if(param == 'cmi.core.session_time'){
@ -319,34 +319,34 @@ function LMSGetValue(param)
} else {
//result='not attempted';
}
} else if(param == 'cmi.core.student_id'){
}else if(param == 'cmi.core.student_id'){
// ---- cmi.core.student_id
result='<?php echo $_user['user_id']; ?>';
} else if(param == 'cmi.core.student_name'){
}else if(param == 'cmi.core.student_name'){
// ---- cmi.core.student_name
<?php
$who=addslashes($_user['lastName'].", ".$_user['firstName']);
$who=addslashes(api_get_person_name($_user['firstName'], $_user['lastName']));
echo "result='$who';";
?>
} else if(param == 'cmi.core.lesson_location'){
}else if(param == 'cmi.core.lesson_location'){
// ---- cmi.core.lesson_location
result=lesson_location;
} else if(param == 'cmi.core.total_time'){
}else if(param == 'cmi.core.total_time'){
// ---- cmi.core.total_time
result=total_time;
} else if(param == 'cmi.core.score._children'){
}else if(param == 'cmi.core.score._children'){
// ---- cmi.core.score._children
result='raw,min,max';
} else if(param == 'cmi.core.score.raw'){
}else if(param == 'cmi.core.score.raw'){
// ---- cmi.core.score.raw
result=score;
} else if(param == 'cmi.core.score.max'){
}else if(param == 'cmi.core.score.max'){
// ---- cmi.core.score.max
result=max;
} else if(param == 'cmi.core.score.min'){
}else if(param == 'cmi.core.score.min'){
// ---- cmi.core.score.min
result=min;
} else if(param == 'cmi.core.score'){
}else if(param == 'cmi.core.score'){
// ---- cmi.core.score -- non-standard item, provided as cmi.core.score.raw just in case
result=score;
}else if(param == 'cmi.core.credit'){
@ -457,22 +457,22 @@ function LMSGetValue(param)
}
}
}else if(param == 'cmi.student_data._children'){
// ---- cmi.student_data._children
// ---- cmi.student_data._children
result = 'mastery_score,max_time_allowed';
}else if(param == 'cmi.student_data.mastery_score'){
// ---- cmi.student_data.mastery_score
// ---- cmi.student_data.mastery_score
result = mastery_score;
}else if(param == 'cmi.student_data.max_time_allowed'){
// ---- cmi.student_data.max_time_allowed
// ---- cmi.student_data.max_time_allowed
result = max_time_allowed;
}else if(param == 'cmi.interactions._count'){
// ---- cmi.interactions._count
// ---- cmi.interactions._count
result = interactions.length;
}else if(param == 'cmi.interactions._children'){
// ---- cmi.interactions._children
// ---- cmi.interactions._children
result = 'id,time,type,correct_responses,weighting,student_response,result,latency';
} else {
// ---- anything else
}else{
// ---- anything else
// Invalid argument error
G_lastError = G_InvalidArgumentError ;
G_lastErrorString = G_InvalidArgumentErrorMessage;
@ -576,13 +576,13 @@ function LMSSetValue(param, val) {
if(elem_id > interactions.length) //interactions setting should start at 0
{
/*
G_LastError = G_InvalidArgumentError;
G_LastError = G_InvalidArgumentError;
G_LastErrorString = 'Invalid argument (interactions)';
return_value = false;
*/
interactions[0] = ['0','','','','','','',''];
}
if(interactions[elem_id] == null) {
if(interactions[elem_id] == null){
interactions[elem_id] = ['','','','','','','',''];
//id(0), type(1), time(2), weighting(3),correct_responses(4),student_response(5),result(6),latency(7)
interactions[elem_id][4] = new Array();
@ -634,7 +634,7 @@ function LMSSetValue(param, val) {
G_lastError = G_NotImplementedError;
G_lastErrorString = 'Not implemented yet';
}
} else if(param.substring(0,15)== 'cmi.objectives.'){
}else if(param.substring(0,15)== 'cmi.objectives.'){
var myres = '';
updatetable_to_list['objectives']='true';
if(myres = param.match(/cmi.objectives.(\d+).(id|score|status)(.*)/))
@ -697,7 +697,7 @@ function LMSSetValue(param, val) {
}
}
}
} else {
}else{
G_lastError = G_NotImplementedError;
G_lastErrorString = G_NotImplementedErrorMessage;
}
@ -742,15 +742,15 @@ function reinit_update_table_list () {
function savedata(origin) {
//origin can be 'commit', 'finish' or 'terminate'
if ((lesson_status != 'completed') && (lesson_status != 'passed') && (mastery_score >=0) && (score >= mastery_score)) {
lesson_status = 'passed';
lesson_status = 'passed';
updatetable_to_list['cmi.core.lesson_status']='true';
} else if( (mastery_score < 0) && (lms_lp_type != '2') && ( lesson_status == 'incomplete') && (score >= (0.8*max) ) ) {
//the status cannot be modified automatically by the LMS under SCORM 1.2's rules
<?php if ($autocomplete_when_80pct){ ?>
<?php if ($autocomplete_when_80pct){ ?>
lesson_status = 'completed';
updatetable_to_list['cmi.core.lesson_status']='true';
<?php }?>
;
<?php }?>
;
} else {
/*
* See notes in switch_item for why this has been disabled
@ -805,14 +805,14 @@ function savedata_onunload() {
*/
function LMSCommit(val) {
logit_scorm('LMSCommit()',0);
G_LastError = G_NoError ;
G_LastErrorMessage = 'No error';
logit_scorm('LMSCommit()',0);
G_LastError = G_NoError ;
G_LastErrorMessage = 'No error';
savedata('commit');
savedata('commit');
reinit_update_table_list();
//commit = 'false' ; //now changes have been commited, no need to update until next SetValue()
return('true');
return('true');
}
function Commit(val) {
@ -820,13 +820,13 @@ function Commit(val) {
}
function LMSFinish(val) {
G_LastError = G_NoError ;
G_LastErrorMessage = 'No error';
// why commit==false?
if (( commit == false )) {
logit_scorm('LMSFinish() (no LMSCommit())',1);
G_LastError = G_NoError ;
G_LastErrorMessage = 'No error';
// why commit==false?
if (( commit == false )) {
logit_scorm('LMSFinish() (no LMSCommit())',1);
}
}
//if ( commit == true ) {
logit_scorm('LMSFinish() called',1);
@ -956,7 +956,7 @@ function addListeners(){
/* See notes in switch_item() for why this has been disabled
if (lms_lp_type==2) {
addEvent(window,'unload',savedata_onunload,false);
}
}
*/
logit_lms('Quitting addListeners()',2);
}
@ -976,7 +976,7 @@ function load_item(item_id,url){
lms_old_item_id = lms_item_id;
var lms_new_item_id = item_id;
//load new content page into content frame
if(lms_lp_type==1 || lms_item_type=='asset') {
if(lms_lp_type==1 || lms_item_type=='asset'){
dokeos_save_asset();
}
cont_f.src = url;
@ -994,7 +994,7 @@ function load_item(item_id,url){
* Save a Dokeos learnpath item's time and mark as completed upon
* leaving it
*/
function dokeos_save_asset() {
function dokeos_save_asset(){
// only for dokeos lps
if (execute_stats=='true') {
execute_stats='false';
@ -1156,10 +1156,10 @@ function update_progress_bar(nbr_complete, nbr_total, mode)
logit_lms('update_progress_bar('+nbr_complete+','+nbr_total+','+mode+')',2);
logit_lms('could update with data: '+lms_lp_id+','+lms_view_id+','+lms_user_id,2);
if(mode == ''){mode='%';}
if(nbr_total == 0){nbr_total=1;}
var percentage = (nbr_complete/nbr_total)*100;
percentage = Math.round(percentage);
if(mode == ''){mode='%';}
if(nbr_total == 0){nbr_total=1;}
var percentage = (nbr_complete/nbr_total)*100;
percentage = Math.round(percentage);
var pr_text = $("#progress_text");
var pr_full = $("#progress_img_full");
@ -1168,16 +1168,16 @@ function update_progress_bar(nbr_complete, nbr_total, mode)
pr_full.attr('width',percentage*1.2);
pr_empty.attr('width',(100-percentage)*1.2);
var mytext = '';
switch(mode){
case 'abs':
mytext = nbr_complete + '/' + nbr_total;
break;
case '%':
default:
mytext = percentage + '%';
break;
}
var mytext = '';
switch(mode){
case 'abs':
mytext = nbr_complete + '/' + nbr_total;
break;
case '%':
default:
mytext = percentage + '%';
break;
}
pr_text.html(mytext);
return true;
@ -1223,25 +1223,25 @@ function update_message_frame(msg_msg)
* item (like 'next', 'previous', 'first' or 'last') or the id to the next item
*/
function switch_item(current_item, next_item) {
function switch_item(current_item, next_item){
//backup these params
var orig_current_item = current_item;
var orig_next_item = next_item;
var orig_lesson_status = lesson_status;
//(1) save the current item
logit_lms('Called switch_item with params '+lms_item_id+' and '+next_item+'',0);
if (lms_lp_type==1 || lms_item_type=='asset' || session_time == '0' || session_time == '0:00:00'){
if(lms_lp_type==1 || lms_item_type=='asset' || session_time == '0' || session_time == '0:00:00'){
if (lms_lp_type==1) {
xajax_save_item(lms_lp_id, lms_user_id, lms_view_id, lms_item_id, score, max, min, lesson_status, asset_timer, suspend_data, lesson_location,interactions, lms_item_core_exit);
xajax_save_item(lms_lp_id, lms_user_id, lms_view_id, lms_item_id, score, max, min, lesson_status, asset_timer, suspend_data, lesson_location,interactions, lms_item_core_exit);
} else {
my_get_value_scorm=new Array();
my_get_value_scorm=ProcessValueScorm();
xajax_save_item_scorm(lms_lp_id, lms_user_id, lms_view_id, lms_item_id,my_get_value_scorm);
}
if(item_objectives.length>0) {
xajax_save_objectives(lms_lp_id,lms_user_id,lms_view_id,lms_item_id,item_objectives);
}
} else {
xajax_save_objectives(lms_lp_id,lms_user_id,lms_view_id,lms_item_id,item_objectives);
}
}else{
/**
* Because of SCORM 1.2's special rule about unsent commits and the fact
* that a SCO should be SET TO 'completed' IF NO STATUS WAS SENT (and
@ -1267,7 +1267,7 @@ function switch_item(current_item, next_item) {
*/
//savedata('finish');
//}
// xajax_save_item(lms_lp_id, lms_user_id, lms_view_id, lms_item_id, score, max, min, lesson_status, session_time, suspend_data, lesson_location,interactions, lms_item_core_exit);
// xajax_save_item(lms_lp_id, lms_user_id, lms_view_id, lms_item_id, score, max, min, lesson_status, session_time, suspend_data, lesson_location,interactions, lms_item_core_exit);
}
execute_stats=false;
@ -1319,7 +1319,7 @@ function switch_item(current_item, next_item) {
var mysrc = 'lp_controller.php?action=content&lp_id='+lms_lp_id+'&item_id='+next_item;
var cont_f = $("#content_id");
<?php if($oLP->mode == 'fullscreen'){ ?>
<?php if($oLP->mode == 'fullscreen'){ ?>
cont_f = window.open(''+mysrc,'content_id','toolbar=0,location=0,status=0,scrollbars=1,resizable=1');
cont_f.onload=function(){
info_lms_item[0]=info_lms_item[1];
@ -1331,8 +1331,8 @@ function switch_item(current_item, next_item) {
info_lms_item[1]= info_lms_item[1];
}
<?php } else { ?>
cont_f.attr("src",mysrc);
<?php } else { ?>
cont_f.attr("src",mysrc);
<?php } ?>
if(lms_lp_type==1 || lms_item_type=='asset'){
@ -1346,7 +1346,7 @@ function switch_item(current_item, next_item) {
data: "",
success: function(tmp_data) {
$("#media").html(tmp_data);
}
}
});
/*
if ( lms_lp_type==2 && (orig_lesson_status == 'not attempted' || orig_lesson_status == '') && orig_current_item != orig_next_item) {
@ -1457,7 +1457,7 @@ function xajax_save_item_scorm(lms_lp_id, lms_user_id, lms_view_id, lms_item_id,
if (is_interactions=='true') {
interact_string = '';
interact_string = '';
temp = '';
for (i in interactions){

@ -79,7 +79,7 @@ foreach($Users as $enreg)
<td width="99%"><a <?php if($enreg['status'] == 1) echo 'class="master"'; ?> name="user_<?php echo $enreg['user_id']; ?>" href="<?php echo api_get_self(); ?>?showPic=<?php if($showPic == $enreg['user_id']) echo '0'; else echo $enreg['user_id']; ?>#user_<?php echo $enreg['user_id']; ?>"><b><?php echo $enreg['username']; ?></b></a></td>
</tr>
<tr>
<td width="99%"><small><?php echo api_ucfirst($enreg['lastname']).' '.api_ucfirst($enreg['firstname']); ?></small></td>
<td width="99%"><small><?php echo api_get_person_name($enreg['firstname'], $enreg['lastname']); ?></small></td>
</tr>
<?php if($showPic == $enreg['user_id']): ?>

@ -1237,7 +1237,7 @@ class Rsys {
$sql = "SELECT i1.name as col0,c.name as col1,
DATE_FORMAT(r1.start_at ,'%Y-%m-%d %H:%i') as col2,
DATE_FORMAT(r1.end_at ,'%Y-%m-%d %H:%i') as col3, CONCAT(u.lastname,' ',u.firstname) as col4,
DATE_FORMAT(r1.end_at ,'%Y-%m-%d %H:%i') as col3, ".(api_is_western_name_order() ? "CONCAT(u.firstname,' ',u.lastname)" : "CONCAT(u.lastname,' ',u.firstname)")." as col4,
DATE_FORMAT(s.start_at ,'%Y-%m-%d %H:%i') as col5,
DATE_FORMAT(s.end_at ,'%Y-%m-%d %H:%i') as col6, s.accepted as col7
FROM ".Rsys :: getTable('subscription')." s, ".Rsys :: getTable('reservation')." r1, ".Database :: get_main_table(TABLE_MAIN_USER)." u," .Rsys :: getTable('item')." i1,".Rsys :: getTable('category')." c
@ -1315,14 +1315,14 @@ class Rsys {
}
/*$sql = "SELECT dummy AS col0, CONCAT(u.lastname,' ',u.firstname) AS col1, s.user_id AS col2, accepted AS col3
/*$sql = "SELECT dummy AS col0, ".(api_is_western_name_order() ? "CONCAT(u.firstname,' ',u.lastname)" : "CONCAT(u.lastname,' ',u.firstname)")." AS col1, s.user_id AS col2, accepted AS col3
FROM ".Rsys :: getTable('subscription')." s
INNER JOIN ".Database :: get_main_table(TABLE_MAIN_USER)." u ON s.user_id = u.user_id ";
if (!empty ($_GET['rid'])) {
$sql .= " WHERE s.reservation_id = '".$_GET['rid']."'";
}
$sql .= " ORDER BY col".$column." ".$direction." LIMIT ".$from.",".$per_page;*/
$sql = "SELECT dummy AS col0, CONCAT(u.lastname,' ',u.firstname) AS col1, s.user_id AS col2, accepted AS col3, r.start_at, r.end_at, s.start_at, s.end_at
$sql = "SELECT dummy AS col0, ".(api_is_western_name_order() ? "CONCAT(u.firstname,' ',u.lastname)" : "CONCAT(u.lastname,' ',u.firstname)")." AS col1, s.user_id AS col2, accepted AS col3, r.start_at, r.end_at, s.start_at, s.end_at
FROM ".Rsys :: getTable('subscription')." s,".Database :: get_main_table(TABLE_MAIN_USER)." u,".Database :: get_main_table(TABLE_MAIN_RESERVATION_RESERVATION)." r
where u.user_id = s.user_id
and s.reservation_id = r.id";

@ -29,7 +29,7 @@ $image_path = UserManager::get_user_picture_path_by_id ($user_id,'web',false,tru
echo '&nbsp;&nbsp;Dokeos&nbsp;&nbsp;-&nbsp;&nbsp;';
$user_id=api_get_user_id();
$user_info=api_get_user_info($user_id);
echo $name_user=api_xml_http_response_encode($user_info['firstName'].' '.$user_info['lastName']) ;
echo $name_user=api_xml_http_response_encode(api_get_person_name($user_info['firstName'], $user_info['lastName']));
?></td>
</tr>
</table>

@ -103,10 +103,17 @@ $language_variable=api_xml_http_response_encode(get_lang('PersonalData'));
echo '<div class="social-profile-info" style="float:left;position:relative">';
echo '<dt>'.api_xml_http_response_encode(get_lang('UserName')).'</dt>
<dd>'. api_xml_http_response_encode($user_info['username']).' </dd>';
echo '<dt>'.api_xml_http_response_encode(get_lang('FirstName')).'</dt>
<dd>'. api_xml_http_response_encode($user_info['firstname']).'</dd>';
echo '<dt>'.api_xml_http_response_encode(get_lang('LastName')).'</dt>
<dd>'. api_xml_http_response_encode($user_info['lastname']).'</dd>';
if (api_is_western_name_order()) {
echo '<dt>'.api_xml_http_response_encode(get_lang('FirstName')).'</dt>
<dd>'. api_xml_http_response_encode($user_info['firstname']).'</dd>';
echo '<dt>'.api_xml_http_response_encode(get_lang('LastName')).'</dt>
<dd>'. api_xml_http_response_encode($user_info['lastname']).'</dd>';
} else {
echo '<dt>'.api_xml_http_response_encode(get_lang('LastName')).'</dt>
<dd>'. api_xml_http_response_encode($user_info['lastname']).'</dd>';
echo '<dt>'.api_xml_http_response_encode(get_lang('FirstName')).'</dt>
<dd>'. api_xml_http_response_encode($user_info['firstname']).'</dd>';
}
echo '<dt>'.api_xml_http_response_encode(get_lang('OfficialCode')).'</dt>
<dd>'. api_xml_http_response_encode($user_info['official_code']).'</dd>';
echo '<dt>'.api_xml_http_response_encode(get_lang('Email')).'</dt>

@ -59,7 +59,7 @@ for ($p=0;$p<count($list_groups);$p++) {
while ($j<$number_of_images) {
if ($list_friends_file[$j]<>"") {
$user_info=api_get_user_info($list_friends_id[$j]);
$user_name=api_xml_http_response_encode($user_info['firstName'].' '.$user_info['lastName']) ;
$user_name=api_xml_http_response_encode(api_get_person_name($user_info['firstName'], $user_info['lastName']));
if($list_friends_file[$j]==='unknown.jpg') {
$big='';
} else {

@ -199,8 +199,8 @@ $interbreadcrumb[]= array (
if (isset($_GET['u']) && is_numeric($_GET['u'])) {
$info_user=api_get_user_info($_GET['u']);
$interbreadcrumb[]= array (
'url' => '#',
'name' => $info_user['firstName'].' '.$info_user['lastName']
'url' => 'javascript: void(0);',
'name' => api_get_person_name($info_user['firstName'], $info_user['lastName'])
);
}
if (isset($_GET['u'])) {
@ -382,13 +382,13 @@ function get_logged_user_course_html($my_course, $count) {
if ( $my_course['date_start']=='0000-00-00' ) {
$session['dates'] = get_lang('WithoutTimeLimits');
if ( api_get_setting('show_session_coach') === 'true' ) {
$session['coach'] = get_lang('GeneralCoach').': '.$sessioncoach['lastname'].' '.$sessioncoach['firstname'];
$session['coach'] = get_lang('GeneralCoach').': '.api_get_person_name($sessioncoach['firstname'], $sessioncoach['lastname']);
}
$active = true;
} else {
$session ['dates'] = ' - '.get_lang('From').' '.$my_course['date_start'].' '.get_lang('To').' '.$my_course['date_end'];
if ( api_get_setting('show_session_coach') === 'true' ) {
$session['coach'] = get_lang('GeneralCoach').': '.$sessioncoach['lastname'].' '.$sessioncoach['firstname'];
$session['coach'] = get_lang('GeneralCoach').': '.api_get_person_name($sessioncoach['firstname'], $sessioncoach['lastname']);
}
$active = ($date_start <= $now && $date_end >= $now)?true:false;
}
@ -410,7 +410,7 @@ function get_logged_user_course_html($my_course, $count) {
*/
function get_user_feeds($user,$limit=5) {
if (!function_exists('fetch_rss')) { return '';}
$fields = UserManager::get_extra_fields();
$fields = UserManager::get_extra_fields();
$feed_fields = array();
$feeds = array();
$res = '<div class="sectiontitle">'.get_lang('RSSFeeds').'</div>';
@ -449,9 +449,15 @@ Display :: display_header(null);
$img_array= UserManager::get_user_picture_path_by_id($user_id,'web',true,true);
//print_r($user_info);
// Added by Ivan Tcholakov, 03-APR-2009.
if (USE_JQUERY_CORNERS_SCRIPT) {
//
echo $s="<script>$(document).ready( function(){
$('.rounded').corners();
});</script>";
//
}
//
//echo '<div id="actions">';
//echo '<a href="../auth/profile.php?show=1"">'.Display::return_icon('edit.gif').'&nbsp;'.api_convert_encoding(get_lang('EditInformation'),'UTF-8',$charset).'</a>';
@ -486,7 +492,7 @@ echo '<div class="actions-title">';
if ($user_id == api_get_user_id())
echo get_lang('ViewMySharedProfile');
else
echo get_lang('ViewSharedProfile').' - '.ucfirst($user_info['firstname']).' '.$user_info['lastname'];
echo get_lang('ViewSharedProfile').' - '.api_get_person_name($user_info['firstname'], $user_info['lastname']);
echo '</div>';
@ -525,13 +531,13 @@ echo '<div id="social-profile-wrapper">';
$j=0;
$friend_html .= '<div class="sectiontitle">'.get_lang('SocialFriend').'</div>';
$friend_html.= '<div id="friend-container" class="social-friend-container">';
$friend_html.= '<div id="friend-header">';
//$friend_html.= $friends_count.' '.get_lang('Friends');
if ($friends_count == 1)
$friend_html.= '<div style="float:left;">'.$friends_count.' '.get_lang('Friend').'</div>';
else
$friend_html.= '<div style="float:left;">'.$friends_count.' '.get_lang('Friends').'</div>';
if (api_get_user_id() == $user_id)
$friend_html.= '<div id="friend-header">';
//$friend_html.= $friends_count.' '.get_lang('Friends');
if ($friends_count == 1)
$friend_html.= '<div style="float:left;">'.$friends_count.' '.get_lang('Friend').'</div>';
else
$friend_html.= '<div style="float:left;">'.$friends_count.' '.get_lang('Friends').'</div>';
if (api_get_user_id() == $user_id)
$friend_html.= '<div style="float:right;"><a href="index.php?#remote-tab-6">'.get_lang('SeeAll').'</a></div>';
$friend_html.= '</div>'; // close div friend-header
@ -542,14 +548,14 @@ echo '<div id="social-profile-wrapper">';
while ($j<$number_of_images) {
if ($list_friends_file[$j]<>"") {
$my_user_info=api_get_user_info($list_friends_id[$j]);
$name_user=$my_user_info['firstName'].' '.$my_user_info['lastName'];
$name_user=api_get_person_name($my_user_info['firstName'], $my_user_info['lastName']);
$friend_html.='<div id=div_'.$list_friends_id[$j].' class="image_friend_network" ><span><center>';
// the height = 92 must be the sqme in the image_friend_network span style in default.css
$friends_profile = UserFriend::get_picture_user($list_friends_id[$j], $list_friends_file[$j], 92, 'medium_', 'width="85" height="90" ');
$friend_html.='<a href="profile.php?u='.$list_friends_id[$j].'&amp;'.$link_shared.'">';
$friend_html.='<img src="'.$friends_profile['file'].'" '.$friends_profile['style'].' id="imgfriend_'.$list_friends_id[$j].'" title="'.$name_user.'" />';
$friend_html.= '</center></span>';
$friend_html.= '<center class="friend">'.$my_user_info['firstName'].' '.$my_user_info['lastName'].'</a></center>';
$friend_html.= '<center class="friend">'.api_get_person_name($my_user_info['firstName'], $my_user_info['lastName']).'</a></center>';
$friend_html.= '</div>';
}
$j++;
@ -557,9 +563,9 @@ echo '<div id="social-profile-wrapper">';
}
} else {
// No friends!! :(
$friend_html .= '<div class="sectiontitle">'.get_lang('Friends').'</div>';
$friend_html.= '<div id="friend-container" class="social-friend-container">';
$friend_html.= '<div id="friend-header">';
$friend_html .= '<div class="sectiontitle">'.get_lang('Friends').'</div>';
$friend_html.= '<div id="friend-container" class="social-friend-container">';
$friend_html.= '<div id="friend-header">';
$friend_html.= '<div style="float:left; padding:0px 8px 0px 8px;">'.get_lang('NoFriendsInYourContactList').'<br /><a href="'.api_get_path(WEB_PATH).'whoisonline.php">'.get_lang('TryAndFindSomeFriends').'</a></div>';
$friend_html.= '</div>'; // close div friend-header
}
@ -567,35 +573,35 @@ echo '<div id="social-profile-wrapper">';
echo $friend_html;
//Pending invitations
if (!isset($_GET['u']) || (isset($_GET['u']) && $_GET['u']==api_get_user_id())) {
$pending_invitations = UserFriend::get_list_invitation_of_friends_by_user_id(api_get_user_id());
$list_get_path_web=UserFriend::get_list_web_path_user_invitation_by_user_id(api_get_user_id());
$count_pending_invitations = count($pending_invitations);
//echo '<div class="clear"></div><br />';
//javascript:register_friend(this)
//var_dump($pending_invitations);
echo '<div class="clear"></div><br />';
echo '<div id="social-profile-invitations" >';
if ($count_pending_invitations > 0) {
echo '<div class="sectiontitle">';
$pending_invitations = UserFriend::get_list_invitation_of_friends_by_user_id(api_get_user_id());
$list_get_path_web=UserFriend::get_list_web_path_user_invitation_by_user_id(api_get_user_id());
$count_pending_invitations = count($pending_invitations);
//echo '<div class="clear"></div><br />';
//javascript:register_friend(this)
//var_dump($pending_invitations);
echo '<div class="clear"></div><br />';
echo '<div id="social-profile-invitations" >';
if ($count_pending_invitations > 0) {
echo '<div class="sectiontitle">';
echo api_convert_encoding(get_lang('PendingInvitations'),$charset,'UTF-8');
echo '</div><br />';
for ($i=0;$i<$count_pending_invitations;$i++) {
//var_dump($invitations);
for ($i=0;$i<$count_pending_invitations;$i++) {
//var_dump($invitations);
echo '<div id="dpending_'.$pending_invitations[$i]['user_sender_id'].'" class="friend_invitations">';
echo '<div style="float:left;width:60px;" >';
echo '<img style="margin-bottom:5px;" src="'.$list_get_path_web[$i]['dir'].'/'.$list_get_path_web[$i]['file'].'" width="60px">';
echo '</div>';
echo '<div style="padding-left:70px;">';
echo '<div style="float:left;width:60px;" >';
echo '<img style="margin-bottom:5px;" src="'.$list_get_path_web[$i]['dir'].'/'.$list_get_path_web[$i]['file'].'" width="60px">';
echo '</div>';
echo '<div style="padding-left:70px;">';
echo ' '.api_convert_encoding(substr($pending_invitations[$i]['content'],0,50),$charset,'UTF-8');
echo '<br />';
echo '<a id="btn_accepted_'.$pending_invitations[$i]['user_sender_id'].'" onclick="register_friend(this)" href="javascript:void(0)">'.get_lang('SocialAddToFriends').'</a>';
echo '<div id="id_response">&nbsp;</div>';
echo '</div>';
echo '<br />';
echo '<a id="btn_accepted_'.$pending_invitations[$i]['user_sender_id'].'" onclick="register_friend(this)" href="javascript:void(0)">'.get_lang('SocialAddToFriends').'</a>';
echo '<div id="id_response">&nbsp;</div>';
echo '</div>';
echo '<div class="clear"></div>';
}
echo '</div>';
echo '<div class="clear"></div>';
}
echo '</div>';
}
echo '</div>';
}
//--Productions
@ -613,9 +619,9 @@ echo '<div id="social-profile-wrapper">';
// Images uploaded by course
$file_list = '';
if (is_array($course_list_code) && count($course_list_code)>0) {
foreach ($course_list_code as $course) {
$file_list.= UserManager::get_user_upload_files_by_course($user_id,$course['code']);
}
foreach ($course_list_code as $course) {
$file_list.= UserManager::get_user_upload_files_by_course($user_id,$course['code']);
}
}
if (!empty($file_list)) {
@ -702,7 +708,7 @@ echo '<div id="social-profile-container">';
echo '</div>';
} else {
echo '&nbsp;<a href="../messages/send_message_to_userfriend.inc.php?height=365&width=610&user_friend='.$user_id.'&view=profile&view_panel=1" class="thickbox" title="'.get_lang('SendMessage').'">'.Display::return_icon('message_new.png').'&nbsp;&nbsp;'.get_lang('SendMessage').'</a><br />';
//echo '&nbsp;&nbsp;<a href="#">'.get_lang('SendMessage').'</a>';
//echo '&nbsp;&nbsp;<a href="javascript: void(0);">'.get_lang('SendMessage').'</a>';
}
echo '</div>';
echo '<br />';
@ -726,7 +732,7 @@ echo '<div id="social-profile-container">';
$extra_information .= '</div><br />';
$extra_information .='<div class="social-content-information">';
$extra_information_value = '';
foreach($extra_user_data as $key=>$data) {
foreach($extra_user_data as $key=>$data) {
// get display text, visibility and type from user_field table
$field_variable = str_replace('extra_','',$key);
$sql = "SELECT field_display_text,field_visible,field_type FROM $t_uf WHERE field_variable ='$field_variable'";
@ -761,7 +767,7 @@ echo '<div id="social-profile-container">';
// if there are information to show
if (!empty($extra_information_value)) {
$extra_information .= $extra_information_value;
}
}
$extra_information .= '</div>';
$extra_information .= '<br /><br />';
}
@ -831,7 +837,7 @@ echo '<div id="social-profile-container">';
<dd>'. $user_info['username'].' </dd>';
if (!empty($user_info['firstname']) || !empty($user_info['lastname']))
echo '<dt>'.get_lang('Name').'</dt>
<dd>'. $user_info['firstname'].' '.$user_info['lastname'].'</dd>';
<dd>'. api_get_person_name($user_info['firstname'], $user_info['lastname']).'</dd>';
if (!empty($user_info['official_code']))
echo '<dt>'.get_lang('OfficialCode').'</dt>
<dd>'.$user_info['official_code'].'</dd>';
@ -849,17 +855,17 @@ echo '<div id="social-profile-container">';
echo '<dl>';
if (!empty($user_info['firstname']) || !empty($user_info['lastname']))
echo '<dt>'.get_lang('Name').'</dt>
<dd>'. $user_info['firstname'].' '.$user_info['lastname'].'</dd>';
<dd>'. api_get_person_name($user_info['firstname'], $user_info['lastname']).'</dd>';
echo '</div>';
}
echo '<div class="clear"></div><br />';
echo '</div>';
echo '</div>';
// COURSES LIST
if ($show_full_profile) {
//print_r($personal_course_list);
//echo '<pre>';
if (is_array($list)) {
if ( is_array($list) ) {
echo '<div class="sectiontitle">';
echo api_ucfirst(get_lang('MyCourses'));
echo '</div>';

@ -27,7 +27,7 @@ $user_friend_relation=UserFriend::get_relation_between_contacts(api_get_user_id(
<td width="50%"><br/>
<img src="<?php echo Security::remove_XSS($img_user[1]); ?>" />
<?php
echo '<br /><br />'.$name_user=api_xml_http_response_encode($user_info['firstName'].' '.$user_info['lastName']);
echo '<br /><br />'.$name_user=api_xml_http_response_encode(api_get_person_name($user_info['firstName'], $user_info['lastName']));
?>
</td>
<td width="50%"><div align="left">

@ -60,7 +60,7 @@ cellpadding="0" cellspacing="0" bgcolor="#9DACBF">
<?php
$user_id=$list_get_invitation[$i]['user_sender_id'];
$user_info=api_get_user_info($user_id);
echo api_xml_http_response_encode($user_info['firstName'].' '.$user_info['lastName']);
echo api_xml_http_response_encode(api_get_person_name($user_info['firstName'], $user_info['lastName']));
?></td>
</tr>
</table></td>

@ -10,16 +10,17 @@ $search=Database::escape_string(Security::remove_XSS($_POST['search']));
$current_date=date('Y-m-d H:i:s',time());
$html_form='<select id="id_search_name" name="id_search_name" size="8"" style="width:350px;">';
$user_id = api_get_user_id();
$is_western_name_order = api_is_western_name_order();
if (api_get_setting('allow_social_tool')=='true' && api_get_setting('allow_message_tool')=='true') {
$sql = 'SELECT DISTINCT u.user_id as id,concat(u.firstname," ",u.lastname," ","( ",u.email," )") as name
$sql = 'SELECT DISTINCT u.user_id as id, '.($is_western_name_order ? 'concat(u.firstname," ",u.lastname," ","( ",u.email," )")' : 'concat(u.lastname," ",u.firstname," ","( ",u.email," )")').' as name
FROM '.$tbl_my_user_friend.' uf ' .
'INNER JOIN '.$tbl_my_user.' AS u ON uf.friend_user_id = u.user_id ' .
'WHERE relation_type<>6 AND friend_user_id<>'.(int)$user_id.' AND concat(u.firstName,u.lastName) like CONCAT("%","'.$search.'","%") ';
'WHERE relation_type<>6 AND friend_user_id<>'.(int)$user_id.' AND '.($is_western_name_order ? 'concat(u.firstname, " ", u.lastname)' : 'concat(u.lastname, " ", u.firstname)').' like CONCAT("%","'.$search.'","%") ';
} elseif (api_get_setting('allow_social_tool')=='false' && api_get_setting('allow_message_tool')=='true') {
$valid=api_get_setting('time_limit_whosonline');
$sql='SELECT DISTINCT u.user_id as id,concat(u.firstname," ",u.lastname," ","( ",u.email," )") as name
$sql='SELECT DISTINCT u.user_id as id, '.($is_western_name_order ? 'concat(u.firstname," ",u.lastname," ","( ",u.email," )")' : 'concat(u.lastname," ",u.firstname," ","( ",u.email," )")').' as name
FROM '.$tbl_my_user.' u INNER JOIN '.$track_online_table.' t ON u.user_id=t.login_user_id
WHERE DATE_ADD(login_date,INTERVAL "'.$valid.'" MINUTE) >= "'.$current_date.'" AND concat(u.firstName,u.lastName) like CONCAT("%","'.$search.'","%") ';
WHERE DATE_ADD(login_date,INTERVAL "'.$valid.'" MINUTE) >= "'.$current_date.'" AND '.($is_western_name_order ? 'concat(u.firstname, " ", u.lastname)' : 'concat(u.lastname, " ", u.firstname)').' like CONCAT("%","'.$search.'","%") ';
}
$res=Database::query($sql,__FILE__,__LINE__);

@ -63,7 +63,7 @@ if (count($list_path_friends)!=0) {
while ($j<$number_of_images) {
if ($list_friends_file[$j]<>"") {
$user_info=api_get_user_info($list_friends_id[$j]);
$user_name=api_xml_http_response_encode($user_info['firstName'].' '.$user_info['lastName']) ;
$user_name=api_xml_http_response_encode(api_get_person_name($user_info['firstName'], $user_info['lastName']));
$friends_profile = UserFriend::get_picture_user($list_friends_id[$j], $list_friends_file[$j], 92);
$friend_html.='<div onMouseover="show_icon_delete(this)" onMouseout="hide_icon_delete(this)" class="image-social-content" id=div_'.$list_friends_id[$j].' >
<span><center><img src="'.$friends_profile['file'].'" '.$friends_profile['style'].' id="imgfriend_'.$list_friends_id[$j].'" title="'.$user_name.'" onclick=load_thick(\'qualify_contact.inc.php?path_user="'.urlencode($list_friends_dir[$j].$list_friends_file[$j]).'&amp;id_user="'.$list_friends_id[$j].'"\',"") /></center></span>

@ -215,7 +215,7 @@ if ((isset($_GET['action']) && $_GET['action'] == 'edit') && !empty($survey_id)
// Aditional Parameters
$form -> addElement('html','<div class="row">
<div class="label">
<a href="javascript://" onclick="advanced_parameters()" ><span id="plus_minus">&nbsp;'.Display::return_icon('div_show.gif',null,array('style'=>'vertical-align:middle')).'&nbsp;'.get_lang('AdvancedParameters').'</span></a>
<a href="javascript: void(0);" onclick="javascript: advanced_parameters();" ><span id="plus_minus">&nbsp;'.Display::return_icon('div_show.gif',null,array('style'=>'vertical-align:middle')).'&nbsp;'.get_lang('AdvancedParameters').'</span></a>
</div>
<div class="formw">
&nbsp;

@ -36,7 +36,7 @@
// name of the language file that needs to be included
$language_file = 'survey';
// unsetting the course id (because it is in the URL)
if (!isset ($_GET['cidReq']))
if (!isset($_GET['cidReq']))
{
$cidReset = true;
}
@ -50,11 +50,11 @@ require ('../inc/global.inc.php');
// including additional libraries
//require_once (api_get_path(LIBRARY_PATH)."survey.lib.php");
require_once ('survey.lib.php');
require_once (api_get_path(LIBRARY_PATH) . 'course.lib.php');
require_once('survey.lib.php');
require_once (api_get_path(LIBRARY_PATH).'course.lib.php');
// breadcrumbs
if (!empty ($_user))
if (!empty($_user))
{
$interbreadcrumb[] = array ("url" => 'survey_list.php?cidReq='.$_GET['course'],'name' => get_lang('SurveyList'));
}
@ -63,16 +63,16 @@ if (!empty ($_user))
Display :: display_header(get_lang('Survey'));
// getting all the course information
$_course = CourseManager :: get_course_information($_GET['course']);
$_course = CourseManager::get_course_information($_GET['course']);
// Database table definitions
$table_survey = Database :: get_course_table(TABLE_SURVEY, $_course['db_name']);
$table_survey_answer = Database :: get_course_table(TABLE_SURVEY_ANSWER, $_course['db_name']);
$table_survey_question = Database :: get_course_table(TABLE_SURVEY_QUESTION, $_course['db_name']);
$table_survey_question_option = Database :: get_course_table(TABLE_SURVEY_QUESTION_OPTION, $_course['db_name']);
$table_course = Database :: get_main_table(TABLE_MAIN_COURSE);
$table_user = Database :: get_main_table(TABLE_MAIN_USER);
$table_survey_invitation = Database :: get_course_table(TABLE_SURVEY_INVITATION, $_course['db_name']);
$table_survey = Database :: get_course_table(TABLE_SURVEY, $_course['db_name']);
$table_survey_answer = Database :: get_course_table(TABLE_SURVEY_ANSWER, $_course['db_name']);
$table_survey_question = Database :: get_course_table(TABLE_SURVEY_QUESTION, $_course['db_name']);
$table_survey_question_option = Database :: get_course_table(TABLE_SURVEY_QUESTION_OPTION, $_course['db_name']);
$table_course = Database :: get_main_table(TABLE_MAIN_COURSE);
$table_user = Database :: get_main_table(TABLE_MAIN_USER);
$table_survey_invitation = Database :: get_course_table(TABLE_SURVEY_INVITATION, $_course['db_name']);
// first we check if the needed parameters are present
if ((!isset ($_GET['course']) || !isset ($_GET['invitationcode']))&& !isset($_GET['user_id']))
@ -117,13 +117,13 @@ if ($invitationcode == "auto" && isset($_GET['scode'])){
// now we check if the invitationcode is valid
$sql = "SELECT * FROM $table_survey_invitation WHERE invitation_code = '" . Database :: escape_string($invitationcode) . "'";
$result = api_sql_query($sql, __FILE__, false); // false=suppress errors
if (Database :: num_rows($result) < 1)
if (Database::num_rows($result) < 1)
{
Display :: display_error_message(get_lang('WrongInvitationCode'), false);
Display :: display_footer();
exit;
}
$survey_invitation = Database :: fetch_array($result, 'ASSOC');
$survey_invitation = Database::fetch_array($result,'ASSOC');
// now we check if the user already filled the survey
if ($survey_invitation['answered'] == 1 && !isset($_GET['user_id']))
@ -135,10 +135,10 @@ if ($survey_invitation['answered'] == 1 && !isset($_GET['user_id']))
// checking if there is another survey with this code.
// If this is the case there will be a language choice
$sql = "SELECT * FROM $table_survey WHERE code='" . Database :: escape_string($survey_invitation['survey_code']) . "'";
$sql = "SELECT * FROM $table_survey WHERE code='".Database::escape_string($survey_invitation['survey_code'])."'";
$result = api_sql_query($sql, __FILE__, __LINE__);
if (Database :: num_rows($result) > 1)
if (Database::num_rows($result) > 1)
{
if ($_POST['language'])
{
@ -146,61 +146,61 @@ if (Database :: num_rows($result) > 1)
}
else
{
echo '<form id="language" name="language" method="POST" action="' . api_get_self() . '?course=' . $_GET['course'] . '&invitationcode=' . $_GET['invitationcode'] . '&cidReq=' . $_GET['cidReq'] . '">';
echo '<form id="language" name="language" method="POST" action="'.api_get_self().'?course='.$_GET['course'].'&invitationcode='.$_GET['invitationcode'].'&cidReq='.$_GET['cidReq'].'">';
echo ' <select name="language">';
while ($row = Database :: fetch_array($result, 'ASSOC'))
while ($row=Database::fetch_array($result,'ASSOC'))
{
echo '<option value="' . $row['survey_id'] . '">' . $row['lang'] . '</option>';
echo '<option value="'.$row['survey_id'].'">'.$row['lang'].'</option>';
}
echo '</select>';
//echo ' <input type="submit" name="Submit" value="' . get_lang('Ok') . '" class="next" />';
echo '<button type="submit" name="Submit" class="next">'.get_lang('Ok').'</button>';
echo '</form>';
display :: display_footer();
display::display_footer();
exit();
}
}
else
{
$row = Database :: fetch_array($result, 'ASSOC');
$row=Database::fetch_array($result,'ASSOC');
$survey_invitation['survey_id'] = $row['survey_id'];
}
// getting the survey information
$survey_data = survey_manager :: get_survey($survey_invitation['survey_id']);
$survey_data = survey_manager::get_survey($survey_invitation['survey_id']);
//echo '<pre>';print_r($survey_data);echo '</pre>';
//echo $survey_data['form_fields'];echo '-<br>-';echo $survey_data['show_form_profile'];
$survey_data['survey_id'] = $survey_invitation['survey_id'];
//print_r($survey_data);
// storing the answers
if (count($_POST) > 0)
if (count($_POST)>0)
{
if ($survey_data['survey_type'] === '0')
if ($survey_data['survey_type']==='0')
{
// getting all the types of the question (because of the special treatment of the score question type
$sql = "SELECT * FROM $table_survey_question WHERE survey_id = '" . Database :: escape_string($survey_invitation['survey_id']) . "'";
$sql = "SELECT * FROM $table_survey_question WHERE survey_id = '".Database::escape_string($survey_invitation['survey_id'])."'";
$result = api_sql_query($sql, __FILE__, __LINE__);
while ($row = Database :: fetch_array($result, 'ASSOC'))
while ($row = Database::fetch_array($result,'ASSOC'))
{
$types[$row['question_id']] = $row['type'];
}
// looping through all the post values
foreach ($_POST as $key => $value)
foreach ($_POST as $key=>$value)
{
// if the post value key contains the string 'question' then it is an answer on a question
if (strstr($key, 'question'))
{
// finding the question id by removing 'question'
$survey_question_id = str_replace('question', '', $key);
$survey_question_id = str_replace('question', '',$key);
// if the post value is an array then we have a multiple response question or a scoring question type
// remark: when it is a multiple response then the value of the array is the option_id
// when it is a scoring question then the key of the array is the option_id and the value is the value
if (is_array($value))
{
SurveyUtil :: remove_answer($survey_invitation['user'], $survey_invitation['survey_id'], $survey_question_id);
SurveyUtil::remove_answer($survey_invitation['user'], $survey_invitation['survey_id'], $survey_question_id);
foreach ($value as $answer_key => $answer_value)
{
if ($types[$survey_question_id] == 'score')
@ -213,7 +213,7 @@ if (count($_POST) > 0)
$option_id = $answer_value;
$option_value = '';
}
SurveyUtil :: store_answer($survey_invitation['user'], $survey_invitation['survey_id'], $survey_question_id, $option_id, $option_value, $survey_data);
SurveyUtil::store_answer($survey_invitation['user'], $survey_invitation['survey_id'], $survey_question_id, $option_id, $option_value, $survey_data);
}
}
// all the other question types (open question, multiple choice, percentage, ...)
@ -221,9 +221,9 @@ if (count($_POST) > 0)
{
if ($types[$survey_question_id] == 'percentage')
{
$sql = "SELECT * FROM $table_survey_question_option WHERE question_option_id='" . Database :: escape_string($value) . "'";
$sql = "SELECT * FROM $table_survey_question_option WHERE question_option_id='".Database::escape_string($value)."'";
$result = api_sql_query($sql, __FILE__, __LINE__);
$row = Database :: fetch_array($result, 'ASSOC');
$row = Database::fetch_array($result,'ASSOC');
$option_value = $row['option_text'];
} else {
$option_value = 0;
@ -234,77 +234,77 @@ if (count($_POST) > 0)
}
$survey_question_answer = $value;
SurveyUtil :: remove_answer($survey_invitation['user'], $survey_invitation['survey_id'], $survey_question_id);
SurveyUtil :: store_answer($survey_invitation['user'], $survey_invitation['survey_id'], $survey_question_id, $value, $option_value, $survey_data);
SurveyUtil::remove_answer($survey_invitation['user'], $survey_invitation['survey_id'], $survey_question_id);
SurveyUtil::store_answer($survey_invitation['user'], $survey_invitation['survey_id'], $survey_question_id, $value, $option_value, $survey_data);
//SurveyUtil::store_answer($user,$survey_id,$question_id, $option_id, $option_value, $survey_data);
}
}
}
}
elseif ($survey_data['survey_type'] === '1') //conditional/personality-test type surveys
{
elseif ($survey_data['survey_type']==='1') //conditional/personality-test type surveys
{
// getting all the types of the question (because of the special treatment of the score question type
$shuffle = '';
if ($survey_data['shuffle'] == '1')
$shuffle='';
if ($survey_data['shuffle']=='1')
{
$shuffle = ' ORDER BY RAND() ';
$shuffle= ' ORDER BY RAND() ' ;
}
$sql = "SELECT * FROM $table_survey_question
WHERE survey_id = '" . Database :: escape_string($survey_invitation['survey_id']) . "'
WHERE survey_id = '".Database::escape_string($survey_invitation['survey_id'])."'
AND survey_group_pri='0' $shuffle
";
$result = api_sql_query($sql, __FILE__, __LINE__);
// there is only one question type for conditional surveys
while ($row = Database :: fetch_array($result, 'ASSOC'))
// there is only one question type for conditional surveys
while ($row = Database::fetch_array($result,'ASSOC'))
{
$types[$row['question_id']] = $row['type'];
}
// looping through all the post values
foreach ($_POST as $key => $value)
foreach ($_POST as $key=>$value)
{
// if the post value key contains the string 'question' then it is an answer to a question
if (strstr($key, 'question'))
if (strstr($key,'question'))
{
// finding the question id by removing 'question'
$survey_question_id = str_replace('question', '', $key);
$survey_question_id = str_replace('question', '',$key);
// we select the correct answer and the puntuacion
$sql = "SELECT value FROM $table_survey_question_option " .
" WHERE question_option_id='" . Database :: escape_string($value) . "'";
" WHERE question_option_id='".Database::escape_string($value)."'";
$result = api_sql_query($sql, __FILE__, __LINE__);
$row = Database :: fetch_array($result, 'ASSOC');
$row = Database::fetch_array($result,'ASSOC');
$option_value = $row['value'];
//$option_value = 0;
$survey_question_answer = $value;
//we save the answer after making sure that a possible previous attempt is deleted
SurveyUtil :: remove_answer($survey_invitation['user'], $survey_invitation['survey_id'], $survey_question_id);
SurveyUtil :: store_answer($survey_invitation['user'], $survey_invitation['survey_id'], $survey_question_id, $value, $option_value, $survey_data);
//we save the answer after making sure that a possible previous attempt is deleted
SurveyUtil::remove_answer($survey_invitation['user'], $survey_invitation['survey_id'], $survey_question_id);
SurveyUtil::store_answer($survey_invitation['user'], $survey_invitation['survey_id'], $survey_question_id, $value, $option_value, $survey_data);
//SurveyUtil::store_answer($user,$survey_id,$question_id, $option_id, $option_value, $survey_data);
}
}
}
else //in case it's another type than 0 or 1
{
die(get_lang('ErrorSurveyTypeUnknown'));
}
else //in case it's another type than 0 or 1
{
die(get_lang('ErrorSurveyTypeUnknown'));
}
}
// displaying the survey title and subtitle (appears on every page)
echo '<div id="survey_title">' . $survey_data['survey_title'] . '</div>';
echo '<div id="survey_subtitle">' . $survey_data['survey_subtitle'] . '</div>';
echo '<div id="survey_title">'.$survey_data['survey_title'].'</div>';
echo '<div id="survey_subtitle">'.$survey_data['survey_subtitle'].'</div>';
// checking time availability
check_time_availability($survey_data);
// displaying the survey introduction
if (!isset ($_GET['show']))
if (!isset($_GET['show']))
{
// the first thing we do is delete the session
unset($_SESSION['paged_questions']);
unset($_SESSION['page_questions_sec']);
$paged_questions_sec=array();
echo '<div id="survey_content" class="survey_content">' . $survey_data['survey_introduction'] . '</div>';
echo '<div id="survey_content" class="survey_content">'.$survey_data['survey_introduction'].'</div>';
$limit = 0;
}
@ -337,28 +337,48 @@ if ($survey_data['form_fields']!='' && $survey_data['anonymous'] == 0 && is_arra
'style' => 'width: 75%; float: ' . ($text_dir == 'rtl' ? 'right;' : 'left;')
));
if ($list['lastname'] == 1) {
// LAST NAME
$form->addElement('text', 'lastname', get_lang('LastName'), array ('size' => 40));
if (api_get_setting('profile', 'name') !== 'true')
$form->freeze(array ('lastname'));
$form->applyFilter(array ('lastname'), 'stripslashes');
$form->applyFilter(array ('lastname'), 'trim');
$form->addRule('lastname', get_lang('ThisFieldIsRequired'), 'required');
}
if ($list['firstname'] == 1 ) {
//FIRST NAME
$form->addElement('text', 'firstname', get_lang('FirstName'), array ('size' => 40));
if (api_get_setting('profile', 'name') !== 'true')
$form->freeze(array ('firstname'));
$form->applyFilter(array ('firstname'), 'stripslashes');
$form->applyFilter(array ('firstname'), 'trim');
$form->addRule('firstname', get_lang('ThisFieldIsRequired'), 'required');
if (api_is_western_name_order()) {
if ($list['firstname'] == 1 ) {
//FIRST NAME
$form->addElement('text', 'firstname', get_lang('FirstName'), array ('size' => 40));
if (api_get_setting('profile', 'name') !== 'true') {
$form->freeze(array ('firstname'));
}
$form->applyFilter(array ('firstname'), 'stripslashes');
$form->applyFilter(array ('firstname'), 'trim');
$form->addRule('firstname', get_lang('ThisFieldIsRequired'), 'required');
}
if ($list['lastname'] == 1) {
// LAST NAME
$form->addElement('text', 'lastname', get_lang('LastName'), array ('size' => 40));
if (api_get_setting('profile', 'name') !== 'true') {
$form->freeze(array ('lastname'));
}
$form->applyFilter(array ('lastname'), 'stripslashes');
$form->applyFilter(array ('lastname'), 'trim');
$form->addRule('lastname', get_lang('ThisFieldIsRequired'), 'required');
}
} else {
if ($list['lastname'] == 1) {
// LAST NAME
$form->addElement('text', 'lastname', get_lang('LastName'), array ('size' => 40));
if (api_get_setting('profile', 'name') !== 'true') {
$form->freeze(array ('lastname'));
}
$form->applyFilter(array ('lastname'), 'stripslashes');
$form->applyFilter(array ('lastname'), 'trim');
$form->addRule('lastname', get_lang('ThisFieldIsRequired'), 'required');
}
if ($list['firstname'] == 1 ) {
//FIRST NAME
$form->addElement('text', 'firstname', get_lang('FirstName'), array ('size' => 40));
if (api_get_setting('profile', 'name') !== 'true') {
$form->freeze(array ('firstname'));
}
$form->applyFilter(array ('firstname'), 'stripslashes');
$form->applyFilter(array ('firstname'), 'trim');
$form->addRule('firstname', get_lang('ThisFieldIsRequired'), 'required');
}
}
if ($list['official_code'] == 1) {
@ -472,7 +492,7 @@ if ($survey_data['form_fields']!='' && $survey_data['anonymous'] == 0 && is_arra
break;
case USER_FIELD_TYPE_DATE :
$form->addElement('datepickerdate', 'extra_' . $field_details[1], $field_details[3],array('form_name'=>'profile'));
$form->_elements[$form->_elementIndex['extra_'.$field_details[1]]]->setLocalOption('minYear',1900);
$form->_elements[$form->_elementIndex['extra_' . $field_details[1]]]->setLocalOption('minYear', 1900);
$defaults['extra_'.$field_details[1]] = date('Y-m-d 12:00:00');
$form -> setDefaults($defaults);
if ($field_details[7] == 0)
@ -581,10 +601,10 @@ if ($survey_data['form_fields'] && $survey_data['anonymous'] == 0 && is_array($u
}
// displaying the survey thanks message
if (isset ($_POST['finish_survey']))
if (isset($_POST['finish_survey']))
{
echo '<div id="survey_content" class="survey_content"><strong>' . get_lang('SurveyFinished') . '</strong> <br />' . $survey_data['survey_thanks'] . '</div>';
survey_manager :: update_survey_answered($survey_data['survey_id'], $survey_invitation['user'], $survey_invitation['survey_code']);
echo '<div id="survey_content" class="survey_content"><strong>'.get_lang('SurveyFinished').'</strong> <br />'.$survey_data['survey_thanks'].'</div>';
survey_manager::update_survey_answered($survey_data['survey_id'], $survey_invitation['user'], $survey_invitation['survey_code']);
unset($_SESSION['paged_questions']);
unset($_SESSION['page_questions_sec']);
Display :: display_footer();
@ -592,47 +612,47 @@ if (isset ($_POST['finish_survey']))
}
// sets the random questions
$shuffle = '';
if ($survey_data['shuffle'] == 1)
$shuffle='';
if ($survey_data['shuffle']==1)
{
$shuffle = ' BY RAND() ';
$shuffle= ' BY RAND() ';
}
if (isset ($_GET['show']) || isset ($_POST['personality']))
if ( isset($_GET['show']) || isset($_POST['personality']))
{
// Getting all the questions for this page and add them to a multidimensional array where the first index is the page.
// as long as there is no pagebreak fount we keep adding questions to the page
$questions_displayed = array ();
$questions_displayed = array();
$counter = 0;
$paged_questions = array ();
$paged_questions = array();
// if non-conditional survey
if ($survey_data['survey_type'] === '0')
if ($survey_data['survey_type']==='0')
{
if (empty ($_SESSION['paged_questions']))
{
$sql = "SELECT * FROM $table_survey_question
WHERE survey_id = '" . Database :: escape_string($survey_invitation['survey_id']) . "'
ORDER BY sort ASC";
$result = api_sql_query($sql, __FILE__, __LINE__);
while ($row = Database :: fetch_array($result, 'ASSOC'))
{
if ($row['type'] == 'pagebreak')
{
$counter++;
}
else
{
// ids from question of the current survey
$paged_questions[$counter][] = $row['question_id'];
}
}
$_SESSION['paged_questions'] = $paged_questions;
}
else
{
$paged_questions = $_SESSION['paged_questions'];
}
if(empty($_SESSION['paged_questions']))
{
$sql = "SELECT * FROM $table_survey_question
WHERE survey_id = '".Database::escape_string($survey_invitation['survey_id'])."'
ORDER BY sort ASC";
$result = api_sql_query($sql, __FILE__, __LINE__);
while ($row = Database::fetch_array($result,'ASSOC'))
{
if($row['type'] == 'pagebreak')
{
$counter++;
}
else
{
// ids from question of the current survey
$paged_questions[$counter][] = $row['question_id'];
}
}
$_SESSION['paged_questions'] = $paged_questions;
}
else
{
$paged_questions = $_SESSION['paged_questions'];
}
if (key_exists($_GET['show'], $paged_questions)) {
if (isset($_GET['user_id'])) {
@ -657,16 +677,16 @@ if (isset ($_GET['show']) || isset ($_POST['personality']))
FROM $table_survey_question survey_question
LEFT JOIN $table_survey_question_option survey_question_option
ON survey_question.question_id = survey_question_option.question_id
WHERE survey_question.survey_id = '" . Database :: escape_string($survey_invitation['survey_id']) . "'
AND survey_question.question_id IN (" . implode(',', $paged_questions[$_GET['show']]) . ")
WHERE survey_question.survey_id = '".Database::escape_string($survey_invitation['survey_id'])."'
AND survey_question.question_id IN (".implode(',',$paged_questions[$_GET['show']]).")
ORDER BY survey_question.sort, survey_question_option.sort ASC";
}
$result = api_sql_query($sql, __FILE__, __LINE__);
$question_counter_max = Database :: num_rows($result);
$question_counter_max = Database::num_rows($result);
$counter = 0;
$limit = 0;
$questions = array ();
$limit=0;
$questions = array();
while ($row = Database :: fetch_array($result, 'ASSOC')) {
@ -688,86 +708,86 @@ if (isset ($_GET['show']) || isset ($_POST['personality']))
}
}
}
elseif ($survey_data['survey_type'] === '1')
elseif ($survey_data['survey_type']==='1')
{
$my_survey_id = Database :: escape_string($survey_invitation['survey_id']);
$current_user = Database :: escape_string($survey_invitation['user']);
$my_survey_id=Database::escape_string($survey_invitation['survey_id']);
$current_user = Database::escape_string($survey_invitation['user']);
if (isset ($_POST['personality']) )
if (isset($_POST['personality']))
{
// Compute the results to get the 3 groups nearest to the user's personality
if ($shuffle == '')
if ($shuffle=='')
$order = 'BY sort ASC ';
else
$order = $shuffle;
$answer_list = array ();
$answer_list=array();
// get current user results
$results = array ();
$results=array();
$sql = "SELECT survey_group_pri, user, SUM(value) as value
FROM $table_survey_answer as survey_answer INNER JOIN $table_survey_question as survey_question
ON (survey_question.question_id = survey_answer.question_id)
WHERE survey_answer.survey_id='" . $my_survey_id . "' AND
survey_answer.user='" . $current_user . "'
WHERE survey_answer.survey_id='".$my_survey_id."' AND
survey_answer.user='".$current_user."'
GROUP BY survey_group_pri
ORDER BY survey_group_pri
";
";
$result = api_sql_query($sql, __FILE__, __LINE__);
while ($row = Database :: fetch_array($result)) {
$answer_list['value'] = $row['value'];
$answer_list['group'] = $row['survey_group_pri'];
$results[] = $answer_list;
$answer_list['value']=$row['value'];
$answer_list['group']=$row['survey_group_pri'];
$results[]=$answer_list;
}
//echo "<br>";print_r($results); echo "<br>";
// get the total score for each group of questions
$totals = array ();
$totals=array();
$sql = "SELECT SUM(temp.value) as value, temp.survey_group_pri FROM
(SELECT MAX(value) as value, survey_group_pri, survey_question.question_id
FROM $table_survey_question as survey_question
INNER JOIN $table_survey_question_option as survey_question_option
ON (survey_question.question_id = survey_question_option.question_id)
WHERE survey_question.survey_id='" . $my_survey_id . "' AND survey_group_sec1='0' AND survey_group_sec2='0'
GROUP BY survey_group_pri, survey_question.question_id) as temp
GROUP BY temp.survey_group_pri
ORDER BY temp.survey_group_pri";
(SELECT MAX(value) as value, survey_group_pri, survey_question.question_id
FROM $table_survey_question as survey_question
INNER JOIN $table_survey_question_option as survey_question_option
ON (survey_question.question_id = survey_question_option.question_id)
WHERE survey_question.survey_id='".$my_survey_id."' AND survey_group_sec1='0' AND survey_group_sec2='0'
GROUP BY survey_group_pri, survey_question.question_id) as temp
GROUP BY temp.survey_group_pri
ORDER BY temp.survey_group_pri";
$result = api_sql_query($sql, __FILE__, __LINE__);
while ($row = Database :: fetch_array($result))
while ($row = Database::fetch_array($result))
{
$list['value'] = $row['value'];
$list['group'] = $row['survey_group_pri'];
$totals[] = $list;
$list['value']=$row['value'];
$list['group']=$row['survey_group_pri'];
$totals[]=$list;
}
//echo '<pre>'; print_r($totals);
$final_results = array ();
$final_results=array();
//get a percentage score for each group
//get a percentage score for each group
for ($i = 0; $i < count($totals); $i++) {
for ($j = 0; $j < count($results); $j++) {
if ($totals[$i]['group'] == $results[$j]['group']) {
$group = $totals[$i]['group'];
$porcen = ($results[$j]['value'] / $totals[$i]['value']);
$final_results[$group] = $porcen;
$group=$totals[$i]['group'];
$porcen=($results[$j]['value'] / $totals[$i]['value'] );
$final_results[$group]=$porcen;
}
}
}
// sort the results by score (getting a list of group IDs by score into $groups)
arsort($final_results);
$groups = array_keys($final_results);
$groups=array_keys($final_results);
/*
echo '<pre>';
echo '<pre>';
echo 'Group id => %';
echo "<br>";
print_r($final_results);
echo '</pre>';
*/
$result = array ();
echo '</pre>';
*/
$result=array();
$count_result=0;
foreach ($final_results as $key => $sub_result) {
$result[] = array (
@ -846,12 +866,12 @@ if (isset ($_GET['show']) || isset ($_POST['personality']))
//echo '<pre>';
//print_r($result);
// if we have only 3 or less equal scores (i.e. 0, 1 or 2 equalities), then we can use the three first groups
if ($equal_count < 4)
// if we have only 3 or less equal scores (i.e. 0,1 or 2 equalities), then we can use the three first groups
if ($equal_count<4)
{
//if there is one or less score equalities
if ($equal_count === 0 || $equal_count === 1)
{
{
//i.e 70% - 70% -60% - 60% $equal_count = 1 we only get the first 2 options
if (($result[0]['value'] == $result[1]['value']) && ($result[2]['value'] == $result[3]['value']))
{
@ -859,13 +879,13 @@ if (isset ($_GET['show']) || isset ($_POST['personality']))
}
//i.e 70% - 70% -0% - 0% - $equal_count = 0 we only get the first 2 options
/*elseif (($result[0]['value'] == $result[1]['value']) && ($result[1]['value'] != $result[2]['value']) ) {
$group_cant = 0;
$group_cant=0;
}*/
/*
//i.e 70% - 70% -60% - 60% $equal_count = 0 we only get the first 2 options
elseif (($result[0]['value'] == $result[1]['value']) && ($result[2]['value'] == $result[3]['value']))
elseif ( ($result[0]['value'] == $result[1]['value']) && ($result[2]['value'] == $result[3]['value']) )
{
$group_cant = 0;
$group_cant=0;
}*/
//i.e. 80% - 70% - 70% - 70%
elseif (($result[0]['value'] != $result[1]['value']) && ($result[1]['value'] == $result[2]['value']) && ($result[2]['value'] == $result[3]['value'])) {
@ -877,13 +897,13 @@ if (isset ($_GET['show']) || isset ($_POST['personality']))
//i.e. 80% - 80% - 70% - 50
// by default we choose the highest 3
$group_cant = 2;
$group_cant=2;
}
}
else
{
//if there are two score equalities
$group_cant = $equal_count;
$group_cant=$equal_count;
}
//@todo
@ -893,37 +913,37 @@ if (isset ($_GET['show']) || isset ($_POST['personality']))
// 2 un solo valor
// 3 valores iguales
if ($group_cant > 0)
if ($group_cant>0)
{
//echo '$equal_count'.$group_cant;
// we only get highest 3
$secondary = '';
$combi = '';
$secondary ='';
$combi='';
for ($i = 0; $i <= $group_cant; $i++) {
$group1 = $groups[$i];
$group2 = $groups[$i +1];
$group1=$groups[$i];
$group2=$groups[$i+1];
// here we made all the posibilities with the 3 groups
if ($group_cant == 2 && $i == $group_cant) {
$group2 = $groups[0];
$group2=$groups[0];
$secondary .= " OR ( survey_group_sec1 = '$group1' AND survey_group_sec2 = '$group2') ";
$secondary .= " OR ( survey_group_sec1 = '$group2' AND survey_group_sec2 = '$group1' ) ";
$combi .= $group1 . ' - ' . $group2 . " or " . $group2 . ' - ' . $group1 . "<br>";
$combi.= $group1.' - '.$group2." or ".$group2.' - '.$group1."<br>";
} else {
if ($i != 0) {
$secondary .= " OR ( survey_group_sec1 = '$group1' AND survey_group_sec2 = '$group2') ";
$secondary .= " OR ( survey_group_sec1 = '$group2' AND survey_group_sec2 = '$group1' ) ";
$combi .= $group1 . ' - ' . $group2 . " or " . $group2 . ' - ' . $group1 . "<br>";
$combi.= $group1.' - '.$group2." or ".$group2.' - '.$group1."<br>";
} else {
$secondary .= " ( survey_group_sec1 = '$group1' AND survey_group_sec2 = '$group2') ";
$secondary .= " OR ( survey_group_sec1 = '$group2' AND survey_group_sec2 = '$group1' ) ";
$combi .= $group1 . ' - ' . $group2 . " or " . $group2 . ' - ' . $group1 . "<br>";
$combi.= $group1.' - '.$group2." or ".$group2.' - '.$group1."<br>";
}
}
}
/*
echo '<pre>';
echo "Pair of Groups <br /><br />";
echo '<pre>';
echo "Pair of Groups <br /><br />";
echo $combi;
echo '</pre>';
*/
@ -931,66 +951,66 @@ if (isset ($_GET['show']) || isset ($_POST['personality']))
if (empty($_SESSION['page_questions_sec']) && !is_array($_SESSION['page_questions_sec']) && count($_SESSION['page_questions_sec']==0))
{
$sql = "SELECT * FROM $table_survey_question
WHERE survey_id = '" . $my_survey_id . "'
AND ($secondary )
ORDER BY sort ASC";
$result = api_sql_query($sql, __FILE__, __LINE__);
$counter = 0;
while ($row = Database :: fetch_array($result, 'ASSOC'))
{
if ($survey_data['one_question_per_page'] == 1)
{
$paged_questions_sec[$counter][] = $row['question_id'];
$counter++;
}
else
if ($row['type'] == 'pagebreak')
{
$counter++;
$sql = "SELECT * FROM $table_survey_question
WHERE survey_id = '".$my_survey_id."'
AND ($secondary )
ORDER BY sort ASC";
$result = api_sql_query($sql, __FILE__, __LINE__);
$counter=0;
while ($row = Database::fetch_array($result,'ASSOC'))
{
if ($survey_data['one_question_per_page']==1)
{
$paged_questions_sec[$counter][] = $row['question_id'];
$counter++;
}
else
if($row['type'] == 'pagebreak')
{
$counter++;
} else {
// ids from question of the current survey
$paged_questions_sec[$counter][] = $row['question_id'];
}
}
$_SESSION['paged_questions_sec'] = $paged_questions_sec;
}
else
{
$paged_questions_sec = $_SESSION['paged_questions_sec'];
}
// ids from question of the current survey
$paged_questions_sec[$counter][] = $row['question_id'];
}
}
$_SESSION['paged_questions_sec'] = $paged_questions_sec;
}
else
{
$paged_questions_sec = $_SESSION['paged_questions_sec'];
}
//print_r($paged_questions_sec);
$paged_questions = $_SESSION['paged_questions']; //for the sake of pages counting
//$paged_questions = $paged_questions_sec; //for the sake of pages counting coming up at display time...
$paged_questions = $_SESSION['paged_questions']; //for the sake of pages counting
//$paged_questions = $paged_questions_sec; //for the sake of pages counting coming up at display time...
if ($shuffle == '')
$shuffle = ' BY survey_question.sort, survey_question_option.sort ASC ';
if ($shuffle=='')
$shuffle=' BY survey_question.sort, survey_question_option.sort ASC ';
//$val=0;
//if ($survey_data['one_question_per_page']==0)
//{
$val = (int) $_POST['personality'];
$val=(int)$_POST['personality'];
//}
//echo '<pre>';print_r($paged_questions_sec);echo '</pre>';
if (is_array($paged_questions_sec))
{
$sql = "SELECT survey_question.survey_group_sec1, survey_question.survey_group_sec2, survey_question.survey_group_pri,
survey_question.question_id, survey_question.survey_id, survey_question.survey_question, survey_question.display, survey_question.sort, survey_question.type, survey_question.max_value,
survey_question_option.question_option_id, survey_question_option.option_text, survey_question_option.sort as option_sort
FROM $table_survey_question survey_question
LEFT JOIN $table_survey_question_option survey_question_option
ON survey_question.question_id = survey_question_option.question_id
WHERE survey_question.survey_id = '" . $my_survey_id . "'
AND survey_question.question_id IN (" . implode(',', $paged_questions_sec[$val]) . ")
ORDER $shuffle ";
survey_question.question_id, survey_question.survey_id, survey_question.survey_question, survey_question.display, survey_question.sort, survey_question.type, survey_question.max_value,
survey_question_option.question_option_id, survey_question_option.option_text, survey_question_option.sort as option_sort
FROM $table_survey_question survey_question
LEFT JOIN $table_survey_question_option survey_question_option
ON survey_question.question_id = survey_question_option.question_id
WHERE survey_question.survey_id = '".$my_survey_id."'
AND survey_question.question_id IN (".implode(',',$paged_questions_sec[$val]).")
ORDER $shuffle ";
$result = api_sql_query($sql, __FILE__, __LINE__);
$question_counter_max = Database :: num_rows($result);
$question_counter_max = Database::num_rows($result);
$counter = 0;
$limit = 0;
$questions = array ();
while ($row = Database :: fetch_array($result, 'ASSOC'))
$limit=0;
$questions = array();
while ($row = Database::fetch_array($result,'ASSOC'))
{
// if the type is not a pagebreak we store it in the $questions array
if ($row['type'] <> 'pagebreak') {
@ -1038,53 +1058,53 @@ if (isset ($_GET['show']) || isset ($_POST['personality']))
// Only the questions from the basic group
//the 50 questions A B C D E F G
$order_sql = $shuffle;
if ($shuffle == '')
$order_sql = ' BY question_id ';
if (empty ($_SESSION['paged_questions']))
{
$sql = "SELECT * FROM $table_survey_question
WHERE survey_id = '" . Database :: escape_string($survey_invitation['survey_id']) . "'
AND survey_group_sec1='0' AND survey_group_sec2='0'
ORDER " . $order_sql . " ";
//echo "<br>";echo "<br>";
$result = api_sql_query($sql, __FILE__, __LINE__);
$counter = 0;
while ($row = Database :: fetch_array($result, 'ASSOC'))
{
if ($survey_data['one_question_per_page'] == 1)
{
$paged_questions[$counter][] = $row['question_id'];
$counter++;
$order_sql= $shuffle;
if ($shuffle=='')
$order_sql=' BY question_id ';
if(empty($_SESSION['paged_questions']))
{
$sql = "SELECT * FROM $table_survey_question
WHERE survey_id = '".Database::escape_string($survey_invitation['survey_id'])."'
AND survey_group_sec1='0' AND survey_group_sec2='0'
ORDER ".$order_sql." ";
//echo "<br>";echo "<br>";
$result = api_sql_query($sql, __FILE__, __LINE__);
$counter=0;
while ($row = Database::fetch_array($result,'ASSOC'))
{
if ($survey_data['one_question_per_page']==1)
{
$paged_questions[$counter][] = $row['question_id'];
$counter++;
} else {
if ($row['type'] == 'pagebreak') {
$counter++;
$counter++;
} else {
// ids from question of the current survey
$paged_questions[$counter][] = $row['question_id'];
}
}
}
$_SESSION['paged_questions'] = $paged_questions;
}
else
{
$paged_questions = $_SESSION['paged_questions'];
}
// ids from question of the current survey
$paged_questions[$counter][] = $row['question_id'];
}
}
}
$_SESSION['paged_questions'] = $paged_questions;
}
else
{
$paged_questions = $_SESSION['paged_questions'];
}
//print_r($paged_questions);
//print_r($paged_questions);
//print_r($paged_questions);
//if (key_exists($_GET['show'],$paged_questions))
//{
$order_sql = $shuffle;
if ($shuffle == '')
$order_sql = ' BY survey_question.sort, survey_question_option.sort ASC ';
$order_sql= $shuffle;
if ($shuffle=='')
$order_sql=' BY survey_question.sort, survey_question_option.sort ASC ';
//$val=0;
//if ($survey_data['one_question_per_page']==0)
//{
$val = $_GET['show'];
$val=$_GET['show'];
//}
//echo '<pre>';print_r($paged_questions);echo $val;
@ -1104,7 +1124,7 @@ if (isset ($_GET['show']) || isset ($_POST['personality']))
WHERE survey_question.survey_id = '" . Database :: escape_string($survey_invitation['survey_id']) . "'
AND survey_question.question_id IN (" .$imploded. ")
ORDER $order_sql ";
$result = api_sql_query($sql, __FILE__, __LINE__);
$result = api_sql_query($sql, __FILE__, __LINE__);
$question_counter_max = Database :: num_rows($result);
}
}
@ -1140,20 +1160,20 @@ if (isset ($_GET['show']) || isset ($_POST['personality']))
}
}
else //in case it's another type than 0 or 1
{
echo get_lang('ErrorSurveyTypeUnknown');
}
{
echo get_lang('ErrorSurveyTypeUnknown');
}
}
// selecting the maximum number of pages
$sql = "SELECT * FROM $table_survey_question WHERE type='" . Database :: escape_string('pagebreak') . "' AND survey_id='" . Database :: escape_string($survey_invitation['survey_id']) . "'";
$sql = "SELECT * FROM $table_survey_question WHERE type='".Database::escape_string('pagebreak')."' AND survey_id='".Database::escape_string($survey_invitation['survey_id'])."'";
$result = api_sql_query($sql, __FILE__, __LINE__);
$numberofpages = Database :: num_rows($result) + 1;
$numberofpages = Database::num_rows($result) + 1;
// Displaying the form with the questions
if (isset ($_GET['show']))
if (isset($_GET['show']))
{
$show = (int) $_GET['show'] + 1;
$show = (int)$_GET['show'] + 1;
}
else
{
@ -1161,36 +1181,36 @@ else
}
// Displaying the form with the questions
if (isset ($_POST['personality']))
if (isset($_POST['personality']))
{
$personality = (int) $_POST['personality'] + 1;
$personality = (int)$_POST['personality'] + 1;
}
else
{
$personality = 0;
$personality= 0;
}
// Displaying the form with the questions
$g_c = (isset ($_GET['course']) ? Security :: remove_XSS($_GET['course']) : '');
$g_ic = (isset ($_GET['invitationcode']) ? Security :: remove_XSS($_GET['invitationcode']) : '');
$g_cr = (isset ($_GET['cidReq']) ? Security :: remove_XSS($_GET['cidReq']) : '');
$p_l = (isset ($_POST['language']) ? Security :: remove_XSS($_POST['language']) : '');
$g_c = (isset($_GET['course'])?Security::remove_XSS($_GET['course']):'');
$g_ic = (isset($_GET['invitationcode'])?Security::remove_XSS($_GET['invitationcode']):'');
$g_cr = (isset($_GET['cidReq'])?Security::remove_XSS($_GET['cidReq']):'');
$p_l = (isset($_POST['language'])?Security::remove_XSS($_POST['language']):'');
$add_parameters=isset($_GET['user_id']) ? 'user_id='.$_GET['user_id'].'&amp;': '';
echo '<form id="question" name="question" method="post" action="' . api_get_self() .'?'.$add_parameters. 'course=' . $g_c . '&invitationcode=' . $g_ic . '&show=' . $show . '&cidReq=' . $g_cr . '">';
echo '<input type="hidden" name="language" value="' . $p_l . '" />';
echo '<input type="hidden" name="language" value="'.$p_l.'" />';
if (isset ($questions) && is_array($questions))
if(isset($questions) && is_array($questions))
{
foreach ($questions as $key => $question)
foreach ($questions as $key=>$question)
{
$display = new $question['type'];
$display->render_question($question);
}
}
if ($survey_data['survey_type'] === '0')
if ($survey_data['survey_type']==='0')
{
if ($survey_data['show_form_profile']==0)
{
@ -1211,14 +1231,14 @@ if ($survey_data['survey_type'] === '0')
// the normal survey as always but with the form profile
if (isset ($_GET['show']))
{
$numberofpages = count($paged_questions);
$numberofpages=count($paged_questions);
if (($show < $numberofpages) || !$_GET['show']) //$show = $_GET['show']+1
{
//echo '<input type="submit" name="next_survey_page" value="' . get_lang('Next') . '" class="next" />';
echo '<button type="submit" name="next_survey_page" class="next">'.get_lang('Next').'</button>';
}
if ($show >= $numberofpages && $_GET['show'])
if ($show >= $numberofpages && $_GET['show'] )
{
//echo '<input type="submit" name="finish_survey" value="' . get_lang('FinishSurvey') . '" class="next" />';
echo '<button type="submit" name="finish_survey" class="next">'.get_lang('FinishSurvey').'</button>';
@ -1296,7 +1316,7 @@ elseif ($survey_data['survey_type'] === '1') //conditional/personality-test type
if ($survey_data['one_question_per_page']==1)
{
if ($show >= $numberofpages )
if ($show >= $numberofpages)
{
//echo '<input type="submit" name="finish_survey" value="' . get_lang('FinishSurvey') . ' " class="next" />';
echo '<button type="submit" name="finish_survey" class="next">'.get_lang('FinishSurvey').'</button>';

@ -585,7 +585,7 @@ class survey_manager
$icon_question = array
(
'yesno' => 'yesno.gif',
'personality' => 'yesno.gif',
'personality' => 'yesno.gif',
'multiplechoice' => 'mcua.gif',
'multipleresponse' => 'mcma.gif',
'open' => 'open_answer.gif',
@ -1270,12 +1270,13 @@ class survey_manager
if ($all_user_info)
{
$order_clause = api_sort_by_first_name() ? ' ORDER BY user.firstname, user.lastname' : ' ORDER BY user.lastname, user.firstname';
$sql = "SELECT DISTINCT answered_user.user as invited_user, user.firstname, user.lastname, user.user_id
FROM $table_survey_answer answered_user
LEFT JOIN $table_user as user
ON answered_user.user = user.user_id
WHERE survey_id= '".Database::escape_string($survey_data['survey_id'])."'
ORDER BY user.lastname, user.firstname";
WHERE survey_id= '".Database::escape_string($survey_data['survey_id'])."'".
$order_clause;
}
else
{
@ -1299,16 +1300,6 @@ class survey_manager
}
class question
{
// the html code of the form
@ -1716,7 +1707,7 @@ class multiplechoice extends question
$this->html .= get_lang('DisplayAnswersHorVert');
$this->html .= ' </div>';
$this->html .= ' <div class="formw">';
$this->html .= ' <input name="horizontalvertical" type="radio" value="horizontal"';
$this->html .= ' <input name="horizontalvertical" type="radio" value="horizontal" ';
if (empty($form_content['horizontalvertical']) or $form_content['horizontalvertical'] == 'horizontal') {
$this->html .= 'checked="checked"';
}
@ -1802,17 +1793,17 @@ class personality extends question
$this->html .= ' <tr>';
$this->html .= ' <td align="right" valign="top">&nbsp;</td>';
$this->html .= ' <td>';
$this->html .= ' <input name="horizontalvertical" type="radio" value="horizontal"';
$this->html .= ' <input name="horizontalvertical" type="radio" value="horizontal" ';
if (empty($form_content['horizontalvertical']) or $form_content['horizontalvertical'] == 'horizontal') {
$this->html .= 'checked="checked"';
}
$this->html .= '/>'.get_lang('Horizontal').'</label><br />';
$this->html .= ' <input name="horizontalvertical" type="radio" value="vertical" ';
if ($form_content['horizontalvertical'] == 'vertical')
{
$this->html .= 'checked="checked"';
}
if ($form_content['horizontalvertical'] == 'vertical')
{
$this->html .= 'checked="checked"';
}
$this->html .= ' />'.get_lang('Vertical').'</label>'; $this->html .= ' </td>';
$this->html .= ' <td>&nbsp;</td>';
@ -1853,11 +1844,11 @@ class personality extends question
if ($key<$total_number_of_answers-1)
{
$this->html .= ' <input type="image" src="../img/down.gif" value="move_down['.$key.']" name="move_down['.$key.']"/>';
$this->html .= ' <input type="image" src="../img/down.gif" value="move_down['.$key.']" name="move_down['.$key.']"/>';
}
if ($key>0)
{
$this->html .= ' <input type="image" src="../img/up.gif" value="move_up['.$key.']" name="move_up['.$key.']"/>';
$this->html .= ' <input type="image" src="../img/up.gif" value="move_up['.$key.']" name="move_up['.$key.']"/>';
}
if ($total_number_of_answers> 2)
{
@ -1908,7 +1899,7 @@ class multipleresponse extends question
$this->html .= get_lang('DisplayAnswersHorVert');
$this->html .= ' </div>';
$this->html .= ' <div class="formw">';
$this->html .= ' <input name="horizontalvertical" type="radio" value="horizontal"';
$this->html .= ' <input name="horizontalvertical" type="radio" value="horizontal" ';
if (empty($form_content['horizontalvertical']) or $form_content['horizontalvertical'] == 'horizontal') {
$this->html .= 'checked="checked"';
}
@ -2598,8 +2589,8 @@ class SurveyUtil {
echo '<a href="reporting.php?action=deleteuserreport&amp;survey_id='.Security::remove_XSS($_GET['survey_id']).'&amp;user='.Security::remove_XSS($_GET['user']).'" >'.Display::return_icon('delete.gif', get_lang('Delete')).' '.get_lang('DeleteSurveyByUser').'</a>';
// export the user report
echo '<a href="#" onclick="document.form1a.submit();">'.Display::return_icon('csv.gif', get_lang('ExportAsCSV')).' '.get_lang('ExportAsCSV').'</a> ';
echo '<a href="#" onclick="document.form1b.submit();">'.Display::return_icon('excel.gif', get_lang('ExportAsXLS')).' '.get_lang('ExportAsXLS').'</a> ';
echo '<a href="javascript: void(0);" onclick="document.form1a.submit();">'.Display::return_icon('csv.gif', get_lang('ExportAsCSV')).' '.get_lang('ExportAsCSV').'</a> ';
echo '<a href="javascript: void(0);" onclick="document.form1b.submit();">'.Display::return_icon('excel.gif', get_lang('ExportAsXLS')).' '.get_lang('ExportAsXLS').'</a> ';
echo '<form id="form1a" name="form1a" method="post" action="'.api_get_self().'?action='.Security::remove_XSS($_GET['action']).'&survey_id='.Security::remove_XSS($_GET['survey_id']).'&user_id='.Security::remove_XSS($_GET['user']).'">';
echo '<input type="hidden" name="export_report" value="export_report">';
echo '<input type="hidden" name="export_format" value="csv">';
@ -2630,7 +2621,7 @@ class SurveyUtil {
{
if ($survey_data['anonymous'] == 0)
{
$name = $person['lastname'].' '.$person['firstname'];
$name = api_get_person_name($person['firstname'], $person['lastname']);
$id = $person['user_id'];
if($id == ''){
$id = $person['invited_user'];
@ -3018,8 +3009,8 @@ class SurveyUtil {
echo '<input type="hidden" name="export_format" value="xls">';
echo '</form>';
echo '<form id="form2" name="form2" method="post" action="'.api_get_self().'?action='.Security::remove_XSS($_GET['action']).'&survey_id='.Security::remove_XSS($_GET['survey_id']).'">';
//echo '<a class="survey_export_link" href="#" onclick="document.form1a.submit();"><img align="absbottom" src="'.api_get_path(WEB_IMG_PATH).'excel.gif">&nbsp;'.get_lang('ExportAsCSV').'</a>';
//echo '<a class="survey_export_link" href="#" onclick="document.form1b.submit();"><img align="absbottom" src="'.api_get_path(WEB_IMG_PATH).'excel.gif">&nbsp;'.get_lang('ExportAsXLS').'</a>';
//echo '<a class="survey_export_link" href="javascript: void(0);" onclick="document.form1a.submit();"><img align="absbottom" src="'.api_get_path(WEB_IMG_PATH).'excel.gif">&nbsp;'.get_lang('ExportAsCSV').'</a>';
//echo '<a class="survey_export_link" href="javascript: void(0);" onclick="document.form1b.submit();"><img align="absbottom" src="'.api_get_path(WEB_IMG_PATH).'excel.gif">&nbsp;'.get_lang('ExportAsXLS').'</a>';
// the table
echo '<br /><table class="data_table" border="1">';
// getting the number of options per question
@ -3182,7 +3173,7 @@ class SurveyUtil {
$rs = api_sql_query($sql, __FILE__, __LINE__);
if($row = Database::fetch_array($rs))
{
$user_displayed = $row['lastname'].' '.$row['firstname'];
$user_displayed = api_get_person_name($row['firstname'], $row['lastname']);
}
else
{
@ -3293,13 +3284,13 @@ class SurveyUtil {
{
if($row['number_of_options'] == 0 && $row['type']=='open')
{
$return .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['survey_question']), ENT_QUOTES, $charset)).';';
$return .= str_replace("\r\n",' ', api_html_entity_decode(strip_tags($row['survey_question']), ENT_QUOTES, $charset)).';';
}
else
{
for ($ii = 0; $ii < $row['number_of_options']; $ii ++)
{
$return .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['survey_question']), ENT_QUOTES, $charset)).';';
$return .= str_replace("\r\n",' ', api_html_entity_decode(strip_tags($row['survey_question']), ENT_QUOTES, $charset)).';';
}
}
}
@ -3410,7 +3401,7 @@ class SurveyUtil {
$rs = api_sql_query($sql, __FILE__, __LINE__);
if($row = Database::fetch_array($rs))
{
$user_displayed = $row['lastname'].' '.$row['firstname'];
$user_displayed = api_get_person_name($row['firstname'], $row['lastname']);
}
else
{
@ -3436,7 +3427,7 @@ class SurveyUtil {
$user_fields_values = UserManager::get_extra_user_data(intval($user),false,false);
foreach($user_fields_values as $value)
{
$return .= '"'.str_replace('"','""',api_html_entity_decode(strip_tags($value), ENT_QUOTES, $charset)).'";';
$return .= '"'.str_replace('"','""', api_html_entity_decode(strip_tags($value), ENT_QUOTES, $charset)).'";';
}
}
@ -3464,8 +3455,8 @@ class SurveyUtil {
}
else
{
$return .= 'v';
}
$return .= 'v';
}
}
$return .= ';';
}
@ -3534,8 +3525,8 @@ class SurveyUtil {
{
if($row['number_of_options'] == 0 && $row['type']=='open')
{
$worksheet->write($line,$column,api_html_entity_decode(strip_tags($row['survey_question']), ENT_QUOTES, $charset));
$column ++;
$worksheet->write($line,$column,api_html_entity_decode(strip_tags($row['survey_question']), ENT_QUOTES, $charset));
$column ++;
}
else
{
@ -3667,7 +3658,7 @@ class SurveyUtil {
$rs = api_sql_query($sql, __FILE__, __LINE__);
if($row = Database::fetch_array($rs))
{
$user_displayed = $row['lastname'].' '.$row['firstname'];
$user_displayed = api_get_person_name($row['firstname'], $row['lastname']);
}
else
{
@ -4088,34 +4079,34 @@ class SurveyUtil {
* @version January 2007
*/
function save_invite_mail($mailtext, $mail_subject, $reminder=0) {
// Database table definition
$table_survey = Database :: get_course_table(TABLE_SURVEY);
// Database table definition
$table_survey = Database :: get_course_table(TABLE_SURVEY);
// reminder or not
// reminder or not
if ($reminder == 0) {
$mail_field = 'invite_mail';
}
$mail_field = 'invite_mail';
}
else {
$mail_field = 'reminder_mail';
}
$mail_field = 'reminder_mail';
}
$sql = "UPDATE $table_survey SET mail_subject='".Database::escape_string($mail_subject)."', $mail_field = '".Database::escape_string($mailtext)."' WHERE survey_id = '".Database::escape_string($_GET['survey_id'])."'";
$result = api_sql_query($sql, __FILE__, __LINE__);
}
$sql = "UPDATE $table_survey SET mail_subject='".Database::escape_string($mail_subject)."', $mail_field = '".Database::escape_string($mailtext)."' WHERE survey_id = '".Database::escape_string($_GET['survey_id'])."'";
$result = api_sql_query($sql, __FILE__, __LINE__);
}
/**
/**
* This function saves all the invitations of course users and additional users in the database
* and sends the invitations by email
*
*
* @param array Users array can be both a list of course uids AND a list of additional emailaddresses
* @param string Title of the invitation, used as the title of the mail
* @param string Text of the invitation, used as the text of the mail.
* The text has to contain a **link** string or this will automatically be added to the end
*
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
* @version January 2007
*
*/
* @param string Title of the invitation, used as the title of the mail
* @param string Text of the invitation, used as the text of the mail.
* The text has to contain a **link** string or this will automatically be added to the end
*
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
* @version January 2007
*
*/
function save_invitations($users_array, $invitation_title, $invitation_text,
$reminder=0, $sendmail=0, $remindUnAnswered=0) {
@ -4165,7 +4156,7 @@ class SurveyUtil {
}
}
// send the email if checkboxed
if (($newUser == true || $reminder == 1) && $sendmail <> 0) {
if (($newUser==true || $reminder==1) && $sendmail<>0) {
// make a change for absolute url
if (isset($invitation_text)) {
$invitation_text = api_html_entity_decode(api_convert_encoding($invitation_text, $charset, $_SESSION['oLP']->encoding), ENT_QUOTES, $charset);
@ -4207,7 +4198,7 @@ class SurveyUtil {
$text_link = '<a href="'.$survey_link.'">'.get_lang('ClickHereToAnswerTheSurvey')."</a><br />\r\n<br />\r\n".get_lang('OrCopyPasteTheFollowingUrl')." <br />\r\n ".$survey_link;
$replace_count = 0;
$full_invitation_text = api_str_ireplace('**link**', $text_link ,$invitation_text, $replace_count);
$full_invitation_text = api_str_ireplace('**link**', $text_link ,$invitation_text, $replace_count);
if ($replace_count < 1) {
$full_invitation_text = $full_invitation_text . "<br />\r\n<br />\r\n".$text_link;
}
@ -4219,15 +4210,15 @@ class SurveyUtil {
$result = api_sql_query($sql, __FILE__, __LINE__);
$row = Database::fetch_array($result);
$recipient_email = $row['email'];
$recipient_name = $row['lastname'].' '.$row['firstname'];
$recipient_name = api_get_person_name($row['firstname'], $row['lastname'], null, PERSON_NAME_EMAIL_ADDRESS);
}
else {
/** @todo check if the address is a valid email */
$recipient_email = $invitedUser;
}
// sending the mail
$sender_name = $_user['lastName'].' '.$_user['firstName'];
// sending the mail
$sender_name = api_get_person_name($_user['firstName'], $_user['lastName'], null, PERSON_NAME_EMAIL_ADDRESS);
$sender_email = $_user['mail'];
$replyto = array();
@ -4286,12 +4277,13 @@ class SurveyUtil {
$table_survey_invitation = Database :: get_course_table(TABLE_SURVEY_INVITATION);
$table_user = Database :: get_main_table(TABLE_MAIN_USER);
// Selecting all the invitations of this survey AND the additional emailaddresses (the left join)
// Selecting all the invitations of this survey AND the additional emailaddresses (the left join)
$order_clause = api_sort_by_first_name() ? ' ORDER BY firstname, lastname' : ' ORDER BY lastname, firstname';
$sql = "SELECT user
FROM $table_survey_invitation as table_invitation
LEFT JOIN $table_user as table_user
ON table_invitation.user = table_user.user_id
WHERE survey_code='".Database::escape_string($survey_code)."' ORDER BY lastname, firstname";
WHERE survey_code='".Database::escape_string($survey_code)."'".$order_clause;
$defaults = array();
$defaults['course_users'] = array();
@ -4380,7 +4372,7 @@ class SurveyUtil {
$languages = api_get_languages();
foreach ($languages['name'] as $index => $name)
{
echo ' <option value="'.$languages['folder'][$index].'">'.$name.'</option>';
echo '<option value="'.$languages['folder'][$index].'">'.$name.'</option>';
}
echo ' </select>';
echo ' </div>
@ -4647,7 +4639,7 @@ class SurveyUtil {
CONCAT('<a href=\"survey.php?survey_id=',survey.survey_id,'\">',survey.title,'</a>') AS col1,
survey.code AS col2,
count(survey_question.question_id) AS col3,
CONCAT(user.firstname, ' ', user.lastname) AS col4,
".(api_is_western_name_order() ? "CONCAT(user.firstname, ' ', user.lastname)" : "CONCAT(user.lastname, ' ', user.firstname)")." AS col4,
survey.lang AS col5,
survey.avail_from AS col6,
survey.avail_till AS col7,
@ -4707,7 +4699,7 @@ class SurveyUtil {
survey.title AS col1,
survey.code AS col2,
count(survey_question.question_id) AS col3,
CONCAT(user.firstname, ' ', user.lastname) AS col4,
".(api_is_western_name_order() ? "CONCAT(user.firstname, ' ', user.lastname)" : "CONCAT(user.lastname, ' ', user.firstname)")." AS col4,
survey.lang AS col5,
survey.avail_from AS col6,
survey.avail_till AS col7,
@ -4720,7 +4712,7 @@ class SurveyUtil {
WHERE survey.author = user.user_id $list_condition
$search_restriction
";
$sql .= " GROUP BY survey.survey_id ";
$sql .= " GROUP BY survey.survey_id";
$sql .= " ORDER BY col$column $direction ";
$sql .= " LIMIT $from,$number_of_items";

@ -149,7 +149,7 @@ while ($row = mysql_fetch_assoc($res))
echo '<tr>';
if (is_numeric($row['user']))
{
echo ' <td><a href="../user/userInfo.php?editMainUserInfo='.$row['user'].'">'.$row['firstname'].' '.$row['lastname'].'</a></td>';
echo ' <td><a href="../user/userInfo.php?editMainUserInfo='.$row['user'].'">'.api_get_person_name($row['firstname'], $row['lastname']).'</a></td>';
}
else
{

@ -54,11 +54,11 @@ if (!api_is_allowed_to_edit(false,true))
}
// Database table definitions
$table_survey = Database::get_course_table(TABLE_SURVEY);
$table_survey_question = Database::get_course_table(TABLE_SURVEY_QUESTION);
$table_survey_question_option = Database::get_course_table(TABLE_SURVEY_QUESTION_OPTION);
$table_course = Database::get_main_table(TABLE_MAIN_COURSE);
$table_user = Database::get_main_table(TABLE_MAIN_USER);
$table_survey = Database :: get_course_table(TABLE_SURVEY);
$table_survey_question = Database :: get_course_table(TABLE_SURVEY_QUESTION);
$table_survey_question_option = Database :: get_course_table(TABLE_SURVEY_QUESTION_OPTION);
$table_course = Database :: get_main_table(TABLE_MAIN_COURSE);
$table_user = Database :: get_main_table(TABLE_MAIN_USER);
$user_info = Database::get_main_table(TABLE_MAIN_SURVEY_REMINDER); // TODO: To be checked. TABLE_MAIN_SURVEY_REMINDER has not been defined.
// getting the survey information
@ -72,7 +72,7 @@ if (empty($survey_data)) {
}
$urlname =strip_tags(api_substr(api_html_entity_decode($survey_data['title'],ENT_QUOTES,$charset), 0, 40));
$urlname = strip_tags(api_substr(api_html_entity_decode($survey_data['title'],ENT_QUOTES,$charset), 0, 40));
if (api_strlen(strip_tags($survey_data['title'])) > 40)
{
$urlname .= '...';
@ -115,11 +115,11 @@ $form = new FormValidator('publish_form','post', api_get_self().'?survey_id='.$s
$form->addElement('header', '', $tool_name);
// Course users
$complete_user_list = CourseManager :: get_user_list_from_course_code($_course['id'], true, $_SESSION['id_session'], '', 'ORDER BY lastname');
$complete_user_list = CourseManager :: get_user_list_from_course_code($_course['id'], true, $_SESSION['id_session'], '', api_sort_by_first_name() ? 'ORDER BY firstname' : 'ORDER BY lastname');
$possible_users = array ();
foreach ($complete_user_list as $index => $user)
{
$possible_users[$user['user_id']] = $user['lastname'].' '.$user['firstname'];
$possible_users[$user['user_id']] = api_get_person_name($user['firstname'], $user['lastname']);
}
$users = $form->addElement('advmultiselect', 'course_users', get_lang('CourseUsers'), $possible_users, 'style="width: 250px; height: 200px;"');
$users->setElementTemplate('

@ -33,7 +33,7 @@ $htmlHeadXtra[] = '<link rel="stylesheet" href="./main/inc/lib/javascript/thickb
$htmlHeadXtra[] = '<script type="text/javascript">
$(document).ready(function (){
$("input#id_btn_send_invitation").bind("click", function(){
if (confirm("'.get_lang('SendMessageInvitation').'")) {
if (confirm("'.get_lang('SendMessageInvitation', '').'")) {
$("#form_register_friend").submit();
}
});
@ -42,7 +42,7 @@ function change_panel (mypanel_id,myuser_id) {
$.ajax({
contentType: "application/x-www-form-urlencoded",
beforeSend: function(objeto) {
$("#id_content_panel").html("'.get_lang('Loading').'"); },
$("#id_content_panel").html("'.get_lang('Loading', '').'"); },
type: "POST",
url: "main/messages/send_message.php",
data: "panel_id="+mypanel_id+"&user_id="+myuser_id,
@ -61,14 +61,14 @@ function action_database_panel(option_id,myuser_id) {
}
my_txt_content=$("#txt_area_invite").val();
if (my_txt_content.length==0 || my_txt_subject.length==0) {
$("#display_response_id").html("&nbsp;&nbsp;&nbsp;'.get_lang('MessageEmptyMessageOrSubject').'");
$("#display_response_id").html("&nbsp;&nbsp;&nbsp;'.get_lang('MessageEmptyMessageOrSubject', '').'");
setTimeout("message_information_display()",3000);
return false;
}
$.ajax({
contentType: "application/x-www-form-urlencoded",
beforeSend: function(objeto) {
$("#display_response_id").html("'.get_lang('Loading').'"); },
$("#display_response_id").html("'.get_lang('Loading', '').'"); },
type: "POST",
url: "main/messages/send_message.php",
data: "panel_id="+option_id+"&user_id="+myuser_id+"&txt_subject="+my_txt_subject+"&txt_content="+my_txt_content,

Loading…
Cancel
Save