Esempio n. 1
0
 /**
  * @param array $group_list
  * @param int $category_id
  */
 static function process_groups($group_list, $category_id = null)
 {
     global $origin, $charset;
     $category_id = intval($category_id);
     $totalRegistered = 0;
     $group_data = array();
     $user_info = api_get_user_info();
     $session_id = api_get_session_id();
     $user_id = $user_info['user_id'];
     $orig = isset($origin) ? $origin : null;
     foreach ($group_list as $this_group) {
         // Validation when belongs to a session
         $session_img = api_get_session_image($this_group['session_id'], $user_info['status']);
         // All the tutors of this group
         $tutorsids_of_group = self::get_subscribed_tutors($this_group['id'], true);
         // Create a new table-row
         $row = array();
         // Checkbox
         if (api_is_allowed_to_edit(false, true) && count($group_list) > 1) {
             $row[] = $this_group['id'];
         }
         // Group name
         if ((api_is_allowed_to_edit(false, true) || in_array($user_id, $tutorsids_of_group) || $this_group['is_member'] || self::user_has_access($user_id, $this_group['id'], self::GROUP_TOOL_FORUM) || self::user_has_access($user_id, $this_group['id'], self::GROUP_TOOL_DOCUMENTS) || self::user_has_access($user_id, $this_group['id'], self::GROUP_TOOL_CALENDAR) || self::user_has_access($user_id, $this_group['id'], self::GROUP_TOOL_ANNOUNCEMENT) || self::user_has_access($user_id, $this_group['id'], self::GROUP_TOOL_WORK) || self::user_has_access($user_id, $this_group['id'], self::GROUP_TOOL_WIKI)) && !(api_is_course_coach() && intval($this_group['session_id']) != $session_id)) {
             $group_name = '<a href="group_space.php?cidReq=' . api_get_course_id() . '&amp;origin=' . $orig . '&amp;gidReq=' . $this_group['id'] . '">' . Security::remove_XSS($this_group['name']) . '</a> ';
             if (!empty($user_id) && !empty($this_group['id_tutor']) && $user_id == $this_group['id_tutor']) {
                 $group_name .= Display::label(get_lang('OneMyGroups'), 'success');
             } elseif ($this_group['is_member']) {
                 $group_name .= Display::label(get_lang('MyGroup'), 'success');
             }
             if (api_is_allowed_to_edit() && !empty($this_group['session_name'])) {
                 $group_name .= ' (' . $this_group['session_name'] . ')';
             }
             $group_name .= $session_img;
             $row[] = $group_name . '<br />' . stripslashes(trim($this_group['description']));
         } else {
             $row[] = $this_group['name'] . '<br />' . stripslashes(trim($this_group['description']));
         }
         // Tutor name
         $tutor_info = null;
         if (count($tutorsids_of_group) > 0) {
             foreach ($tutorsids_of_group as $tutor_id) {
                 $tutor = api_get_user_info($tutor_id);
                 $username = api_htmlentities(sprintf(get_lang('LoginX'), $tutor['username']), ENT_QUOTES);
                 if (api_get_setting('show_email_addresses') == 'true') {
                     $tutor_info .= Display::tag('span', Display::encrypted_mailto_link($tutor['mail'], api_get_person_name($tutor['firstName'], $tutor['lastName'])), array('title' => $username)) . ', ';
                 } else {
                     if (api_is_allowed_to_edit()) {
                         $tutor_info .= Display::tag('span', Display::encrypted_mailto_link($tutor['mail'], api_get_person_name($tutor['firstName'], $tutor['lastName'])), array('title' => $username)) . ', ';
                     } else {
                         $tutor_info .= Display::tag('span', api_get_person_name($tutor['firstName'], $tutor['lastName']), array('title' => $username)) . ', ';
                     }
                 }
             }
         }
         $tutor_info = api_substr($tutor_info, 0, api_strlen($tutor_info) - 2);
         $row[] = $tutor_info;
         // Max number of members in group
         $max_members = $this_group['maximum_number_of_members'] == self::MEMBER_PER_GROUP_NO_LIMIT ? ' ' : ' / ' . $this_group['maximum_number_of_members'];
         // Number of members in group
         $row[] = $this_group['number_of_members'] . $max_members;
         // Self-registration / unregistration
         if (!api_is_allowed_to_edit(false, true)) {
             if (self::is_self_registration_allowed($user_id, $this_group['id'])) {
                 $row[] = '<a class = "btn" href="group.php?' . api_get_cidreq() . '&category=' . $category_id . '&amp;action=self_reg&amp;group_id=' . $this_group['id'] . '" onclick="javascript:if(!confirm(' . "'" . addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES, $charset)) . "'" . ')) return false;">' . get_lang('GroupSelfRegInf') . '</a>';
             } elseif (self::is_self_unregistration_allowed($user_id, $this_group['id'])) {
                 $row[] = '<a class = "btn" href="group.php?' . api_get_cidreq() . '&category=' . $category_id . '&amp;action=self_unreg&amp;group_id=' . $this_group['id'] . '" onclick="javascript:if(!confirm(' . "'" . addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES, $charset)) . "'" . ')) return false;">' . get_lang('GroupSelfUnRegInf') . '</a>';
             } else {
                 $row[] = '-';
             }
         }
         $url = api_get_path(WEB_CODE_PATH) . 'group/';
         // Edit-links
         if (api_is_allowed_to_edit(false, true) && !(api_is_course_coach() && intval($this_group['session_id']) != $session_id)) {
             $edit_actions = '<a href="' . $url . 'settings.php?' . api_get_cidreq(true, false) . '&gidReq=' . $this_group['id'] . '"  title="' . get_lang('Edit') . '">' . Display::return_icon('edit.png', get_lang('EditGroup'), '', ICON_SIZE_SMALL) . '</a>&nbsp;';
             $edit_actions .= '<a href="' . $url . 'member_settings.php?' . api_get_cidreq(true, false) . '&gidReq=' . $this_group['id'] . '"  title="' . get_lang('GroupMembers') . '">' . Display::return_icon('user.png', get_lang('GroupMembers'), '', ICON_SIZE_SMALL) . '</a>&nbsp;';
             $edit_actions .= '<a href="' . $url . 'group_overview.php?action=export&type=xls&' . api_get_cidreq(true, false) . '&id=' . $this_group['id'] . '"  title="' . get_lang('ExportUsers') . '">' . Display::return_icon('export_excel.png', get_lang('Export'), '', ICON_SIZE_SMALL) . '</a>&nbsp;';
             /*$edit_actions .= '<a href="'.api_get_self().'?'.api_get_cidreq(true, false).'&category='.$category_id.'&amp;action=empty_one&amp;id='.$this_group['id'].'" onclick="javascript: if(!confirm('."'".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES))."'".')) return false;" title="'.get_lang('EmptyGroup').'">'.
               Display::return_icon('clean.png',get_lang('EmptyGroup'),'',ICON_SIZE_SMALL).'</a>&nbsp;';*/
             $edit_actions .= '<a href="' . api_get_self() . '?' . api_get_cidreq(true, false) . '&category=' . $category_id . '&amp;action=fill_one&amp;id=' . $this_group['id'] . '" onclick="javascript: if(!confirm(' . "'" . addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES)) . "'" . ')) return false;" title="' . get_lang('FillGroup') . '">' . Display::return_icon('fill.png', get_lang('FillGroup'), '', ICON_SIZE_SMALL) . '</a>&nbsp;';
             $edit_actions .= '<a href="' . api_get_self() . '?' . api_get_cidreq(true, false) . '&category=' . $category_id . '&amp;action=delete_one&amp;id=' . $this_group['id'] . '" onclick="javascript: if(!confirm(' . "'" . addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES)) . "'" . ')) return false;" title="' . get_lang('Delete') . '">' . Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL) . '</a>&nbsp;';
             $row[] = $edit_actions;
         }
         if (!empty($this_group['nbMember'])) {
             $totalRegistered = $totalRegistered + $this_group['nbMember'];
         }
         $group_data[] = $row;
     }
     // end loop
     $table = new SortableTableFromArrayConfig($group_data, 1, 20, 'group_category_' . $category_id);
     $table->set_additional_parameters(array('category' => $category_id));
     $column = 0;
     if (api_is_allowed_to_edit(false, true) and count($group_list) > 1) {
         $table->set_header($column++, '', false);
     }
     $table->set_header($column++, get_lang('Groups'));
     $table->set_header($column++, get_lang('GroupTutor'));
     $table->set_header($column++, get_lang('Registered'), false);
     if (!api_is_allowed_to_edit(false, true)) {
         // If self-registration allowed
         $table->set_header($column++, get_lang('GroupSelfRegistration'), false);
     }
     if (api_is_allowed_to_edit(false, true)) {
         // Only for course administrator
         $table->set_header($column++, get_lang('Modify'), false);
         $form_actions = array();
         $form_actions['fill_selected'] = get_lang('FillGroup');
         $form_actions['empty_selected'] = get_lang('EmptyGroup');
         $form_actions['delete_selected'] = get_lang('Delete');
         if (count($group_list) > 1) {
             $table->set_form_actions($form_actions, 'group');
         }
     }
     $table->display();
 }
$sql .= " WHERE cu.user_id = u.user_id AND cu.course_code = '" . $code . "'\n        AND cu.relation_type <> " . COURSE_RELATION_TYPE_RRHH;
$res = Database::query($sql);
$is_western_name_order = api_is_western_name_order();
if (Database::num_rows($res) > 0) {
    $users = array();
    while ($obj = Database::fetch_object($res)) {
        $user = array();
        $user[] = $obj->official_code;
        if ($is_western_name_order) {
            $user[] = $obj->firstname;
            $user[] = $obj->lastname;
        } else {
            $user[] = $obj->lastname;
            $user[] = $obj->firstname;
        }
        $user[] = Display::encrypted_mailto_link($obj->email, $obj->email);
        $user[] = $obj->course_status == 5 ? get_lang('Student') : get_lang('Teacher');
        $user[] = '<a href="user_information.php?user_id=' . $obj->user_id . '">' . Display::return_icon('synthese_view.gif', get_lang('UserInfo')) . '</a>';
        $users[] = $user;
    }
    $table = new SortableTableFromArray($users, 0, 20, 'user_table');
    $table->set_additional_parameters(array('code' => $code));
    $table->set_other_tables(array('usage_table', 'class_table'));
    $table->set_header(0, get_lang('OfficialCode'), true);
    if ($is_western_name_order) {
        $table->set_header(1, get_lang('FirstName'), true);
        $table->set_header(2, get_lang('LastName'), true);
    } else {
        $table->set_header(1, get_lang('LastName'), true);
        $table->set_header(2, get_lang('FirstName'), true);
    }
 function format_email($email)
 {
     return Display::encrypted_mailto_link($email, $email);
 }
/**
* Returns a mailto-link
* @param string $email An email-address
* @return string HTML-code with a mailto-link
*/
function email_filter($email)
{
    return Display::encrypted_mailto_link($email, $email);
}
Esempio n. 5
0
 /**
  * Handle encrypted password, send an email to a user with his password
  *
  * @param int	user id
  * @param bool	$by_username
  *
  * @author Olivier Cauberghe <*****@*****.**>, Ghent University
  */
 public static function handle_encrypted_password($user, $by_username = false)
 {
     $email_subject = "[" . api_get_setting('platform.site_name') . "] " . get_lang('LoginRequest');
     // SUBJECT
     if ($by_username) {
         // Show only for lost password
         $user_account_list = self::get_user_account_list($user, true, $by_username);
         // BODY
         $email_to = $user['email'];
     } else {
         $user_account_list = self::get_user_account_list($user, true);
         // BODY
         $email_to = $user[0]['email'];
     }
     $email_body = get_lang('DearUser') . " :\n" . get_lang('password_request') . "\n";
     $email_body .= $user_account_list . "\n-----------------------------------------------\n\n";
     $email_body .= get_lang('PasswordEncryptedForSecurity');
     $email_body .= "\n\n" . get_lang('SignatureFormula') . ",\n" . api_get_setting('admin.administrator_name') . " " . api_get_setting('administratorSurname') . "\n" . get_lang('PlataformAdmin') . " - " . api_get_setting('platform.site_name');
     $sender_name = api_get_person_name(api_get_setting('admin.administrator_name'), api_get_setting('admin.administrator_surname'), null, PERSON_NAME_EMAIL_ADDRESS);
     $email_admin = api_get_setting('admin.administrator_email');
     $result = @api_mail_html('', $email_to, $email_subject, $email_body, $sender_name, $email_admin);
     if ($result == 1) {
         return get_lang('YourPasswordHasBeenEmailed');
     } else {
         $admin_email = Display::encrypted_mailto_link(api_get_setting('admin.administrator_email'), api_get_person_name(api_get_setting('admin.administrator_name'), api_get_setting('admin.administrator_surname')));
         $message = sprintf(get_lang('ThisPlatformWasUnableToSendTheEmailPleaseContactXForMoreInformation'), $admin_email);
         return $message;
     }
 }
    $i_user_id = $_user['user_id'];
}
if (!empty($_GET['student'])) {
    $student_id = intval($_GET['student']);
    // infos about user
    $a_infosUser = UserManager::get_user_info_by_id($student_id);
    if ($_user['status'] == DRH && $a_infosUser['hr_dept_id'] != $_user['user_id']) {
        api_not_allowed();
    }
    $a_infosUser['name'] = $a_infosUser['firstname'] . ' ' . $a_infosUser['lastname'];
    // Actions bar
    echo '<div class="actions">';
    echo '<a href="#" onclick="window.print()"><img src="../img/printmgr.gif">&nbsp;' . get_lang('Print') . '</a>';
    echo '<a href="' . api_get_self() . '?' . Security::remove_XSS($_SERVER['QUERY_STRING']) . '&export=csv"><img src="../img/excel.gif">&nbsp;' . get_lang('ExportAsCSV') . '</a>';
    if (!empty($a_infosUser['email'])) {
        $sendMail = Display::encrypted_mailto_link($a_infosUser['email'], get_lang('SendMail'));
    } else {
        $sendMail = Display::return_icon('send_mail.gif', get_lang('SendMail')) . ' ' . get_lang('SendMail');
    }
    echo $sendMail;
    if (!empty($_GET['student']) && !empty($_GET['course'])) {
        //only show link to connection details if course and student were defined in the URL
        echo '<a href="access_details.php?student=' . Security::remove_XSS($_GET['student']) . '&course=' . Security::remove_XSS($_GET['course']) . '&amp;origin=' . Security::remove_XSS($_GET['origin']) . '&amp;cidReq=' . Security::remove_XSS($_GET['course']) . '">' . Display::return_icon('statistics.gif', get_lang('AccessDetails')) . ' ' . get_lang('AccessDetails') . '</a>';
    }
    echo '</div>';
    // is the user online ?
    $statistics_database = Database::get_statistic_database();
    $student_on_line = Security::remove_XSS($_GET['student']);
    $a_usersOnline = WhoIsOnline($student_on_line, $statistics_database, 30);
    foreach ($a_usersOnline as $a_online) {
        if (in_array($_GET['student'], $a_online)) {
Esempio n. 7
0
     // check if user is in this course
     $tracking_is_accepted = $is_course_member;
     $tracked_user_info = api_get_user_info($uInfo);
     $title[0] = $tracked_user_info[1] . '_' . $tracked_user_info[2];
 } else {
     // check if user is in the group of this tutor
     $sql = "SELECT u.firstname,u.lastname, u.email\n                FROM {$TABLECOURSE_GROUPSUSER} gu , {$TABLEUSER} u\n                WHERE gu.user_id = u.user_id\n                AND gu.group_id = '{$_gid}'\n                AND u.user_id = '{$uInfo}'";
     $query = Database::query($sql);
     $tracked_user_info = @Database::fetch_assoc($query);
     if (is_array($tracked_user_info)) {
         $tracking_is_accepted = true;
     }
     $title[0] = $tracked_user_info['firstname'] . '_' . $tracked_user_info['lastname'];
 }
 if ($tracking_is_accepted) {
     $tracked_user_info['email'] == '' ? $mail_link = get_lang('NoEmail') : ($mail_link = Display::encrypted_mailto_link($tracked_user_info['email']));
     if (!isset($view)) {
         $view = '0000000';
     }
     //Logins
     list($title_line1, $line1) = TrackingUserLogCSV::display_login_tracking_info($view, $uInfo, $courseId);
     //Exercise results
     list($title_line2, $line2) = TrackingUserLogCSV::display_exercise_tracking_info($view, $uInfo, $_cid);
     //Student publications uploaded
     list($title_line3, $line3) = TrackingUserLogCSV::display_student_publications_tracking_info($view, $uInfo, $courseId);
     //Links usage
     list($title_line4, $line4) = TrackingUserLogCSV::display_links_tracking_info($view, $uInfo, $_cid);
     //Documents downloaded
     list($title_line5, $line5) = TrackingUserLogCSV::display_document_tracking_info($view, $uInfo, $_cid);
     $title_line = $title_line1 . $title_line2 . $title_line3 . $title_line4 . $title_line5;
     $line = $line1 . $line2 . $line3 . $line4 . $line5;
Esempio n. 8
0
 /**
  * Displays the information of an individual user
  * @param int $user_id
  */
 public static function display_individual_user($user_id, $returnContent = false)
 {
     global $interbreadcrumb;
     $safe_user_id = intval($user_id);
     $curretUserId = api_get_user_id();
     $user_table = Database::get_main_table(TABLE_MAIN_USER);
     $sql = "SELECT * FROM {$user_table} WHERE user_id = " . $safe_user_id;
     $result = Database::query($sql);
     $userInfo = api_get_user_info($user_id);
     $content = null;
     if (Database::num_rows($result) == 1) {
         $user_object = Database::fetch_object($result);
         $alt = $userInfo['complete_name'] . ($curretUserId == $user_id ? '&nbsp;(' . get_lang('Me') . ')' : '');
         $status = api_get_status_from_code($user_object->status);
         $interbreadcrumb[] = array('url' => SocialManager::getUserOnlineLink(), 'name' => get_lang('UsersOnLineList'));
         if ($returnContent == false) {
             Display::display_header($alt, null, $alt);
         }
         $content = '<div class ="thumbnail">';
         if (strlen(trim($user_object->picture_uri)) > 0) {
             $sysdir_array = UserManager::get_user_picture_path_by_id($safe_user_id, 'system');
             $sysdir = $sysdir_array['dir'];
             $webdir_array = UserManager::get_user_picture_path_by_id($safe_user_id, 'web');
             $webdir = $webdir_array['dir'];
             $fullurl = $webdir . $user_object->picture_uri;
             $system_image_path = $sysdir . $user_object->picture_uri;
             list($width, $height, $type, $attr) = @getimagesize($system_image_path);
             $height += 30;
             $width += 30;
             // get the path,width and height from original picture
             $big_image = $webdir . 'big_' . $user_object->picture_uri;
             $big_image_size = api_getimagesize($big_image);
             $big_image_width = $big_image_size['width'];
             $big_image_height = $big_image_size['height'];
             $url_big_image = $big_image . '?rnd=' . time();
             //echo '<a href="javascript:void()" onclick="javascript: return show_image(\''.$url_big_image.'\',\''.$big_image_width.'\',\''.$big_image_height.'\');" >';
             $content .= '<img src="' . $fullurl . '" alt="' . $alt . '" />';
         } else {
             $content .= Display::return_icon('unknown.jpg', get_lang('Unknown'));
         }
         if (!empty($status)) {
             $content .= '<div class="caption">' . $status . '</div>';
         }
         $content .= '</div>';
         if (api_get_setting('show_email_addresses') == 'true') {
             $content .= Display::encrypted_mailto_link($user_object->email, $user_object->email) . '<br />';
         }
         if ($user_object->competences) {
             $content .= Display::page_subheader(get_lang('MyCompetences'));
             $content .= '<p>' . $user_object->competences . '</p>';
         }
         if ($user_object->diplomas) {
             $content .= Display::page_subheader(get_lang('MyDiplomas'));
             $content .= '<p>' . $user_object->diplomas . '</p>';
         }
         if ($user_object->teach) {
             $content .= Display::page_subheader(get_lang('MyTeach'));
             $content .= '<p>' . $user_object->teach . '</p>';
         }
         $content .= SocialManager::display_productions($user_object->user_id);
         if ($user_object->openarea) {
             $content .= Display::page_subheader(get_lang('MyPersonalOpenArea'));
             $content .= '<p>' . $user_object->openarea . '</p>';
         }
     } else {
         if ($returnContent == false) {
             Display::display_header(get_lang('UsersOnLineList'));
         }
         $content .= '<div class="actions-title">';
         $content .= get_lang('UsersOnLineList');
         $content .= '</div>';
     }
     if ($returnContent) {
         return $content;
     } else {
         echo $content;
     }
 }
Esempio n. 9
0
 /**
  * Displays the information of an individual user
  * @param int $user_id
  */
 public static function display_individual_user($user_id)
 {
     global $interbreadcrumb;
     $safe_user_id = intval($user_id);
     $currentUserId = api_get_user_id();
     $user_table = Database::get_main_table(TABLE_MAIN_USER);
     $sql = "SELECT * FROM {$user_table} WHERE user_id = " . $safe_user_id;
     $result = Database::query($sql);
     $html = null;
     if (Database::num_rows($result) == 1) {
         $user_object = Database::fetch_object($result);
         $userInfo = api_get_user_info($user_id);
         $alt = $userInfo['complete_name'] . ($currentUserId == $user_id ? '&nbsp;(' . get_lang('Me') . ')' : '');
         $status = get_status_from_code($user_object->status);
         $interbreadcrumb[] = array('url' => 'whoisonline.php', 'name' => get_lang('UsersOnLineList'));
         $html .= '<div class ="thumbnail">';
         $fullurl = $userInfo['avatar'];
         $html .= '<img src="' . $fullurl . '" alt="' . $alt . '" />';
         if (!empty($status)) {
             $html .= '<div class="caption">' . $status . '</div>';
         }
         $html .= '</div>';
         if (api_get_setting('display.show_email_addresses') == 'true') {
             $html .= Display::encrypted_mailto_link($user_object->email, $user_object->email) . '<br />';
         }
         if ($user_object->competences) {
             $html .= Display::page_subheader(get_lang('MyCompetences'));
             $html .= '<p>' . $user_object->competences . '</p>';
         }
         if ($user_object->diplomas) {
             $html .= Display::page_subheader(get_lang('MyDiplomas'));
             $html .= '<p>' . $user_object->diplomas . '</p>';
         }
         if ($user_object->teach) {
             $html .= Display::page_subheader(get_lang('MyTeach'));
             $html .= '<p>' . $user_object->teach . '</p>';
         }
         SocialManager::display_productions($user_object->user_id);
         if ($user_object->openarea) {
             $html .= Display::page_subheader(get_lang('MyPersonalOpenArea'));
             $html .= '<p>' . $user_object->openarea . '</p>';
         }
     } else {
         $html .= '<div class="actions-title">';
         $html .= get_lang('UsersOnLineList');
         $html .= '</div>';
     }
     return $html;
 }
//getting the user image
$sysdir_array = UserManager::get_user_picture_path_by_id($user['user_id'], 'system', false, true);
$sysdir = $sysdir_array['dir'];
$webdir_array = UserManager::get_user_picture_path_by_id($user['user_id'], 'web', false, true);
$webdir = $webdir_array['dir'];
$fullurl = $webdir . $webdir_array['file'];
$system_image_path = $sysdir . $webdir_array['file'];
list($width, $height, $type, $attr) = @getimagesize($system_image_path);
$resizing = $height > 200 ? 'height="200"' : '';
$height += 30;
$width += 30;
$window_name = 'window' . uniqid('');
$onclick = $window_name . "=window.open('" . $fullurl . "','" . $window_name . "','alwaysRaised=yes, alwaysLowered=no,alwaysOnTop=yes,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=" . $width . ",height=" . $height . ",left=200,top=20'); return false;";
echo '<a href="javascript: void(0);" onclick="' . $onclick . '" ><img src="' . $fullurl . '" ' . $resizing . ' /></a><br />';
echo '<p>' . ($user['status'] == 1 ? get_lang('Teacher') : get_lang('Student')) . '</p>';
echo '<p>' . Display::encrypted_mailto_link($user['mail'], $user['mail']) . '</p>';
/**
 * Show the sessions and the courses in wich this user is subscribed
 */
echo Display::page_subheader(get_lang('SessionList'));
$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
$tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
$tbl_user = Database::get_main_table(TABLE_MAIN_USER);
$user_id = $user['user_id'];
$sessions = SessionManager::get_sessions_by_user($user_id, true);
$personal_course_list = array();
if (count($sessions) > 0) {
    $header[] = array(get_lang('Code'), true);
    $header[] = array(get_lang('Title'), true);
    $header[] = array(get_lang('Status'), true);
    $header[] = array('', false);
Esempio n. 11
0
/**
 * Get list of users who have not given the task
 * @param int
 * @param int
 * @return array
 * @author cvargas
 * @author Julio Montoya <*****@*****.**> Fixing query
 */
function get_list_users_without_publication($task_id, $studentId = null)
{
    $work_table              = Database::get_course_table(TABLE_STUDENT_PUBLICATION);
    $table_course_user       = Database::get_main_table(TABLE_MAIN_COURSE_USER);
    $table_user              = Database::get_main_table(TABLE_MAIN_USER);
    $session_course_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);

    //condition for the session
    $session_id    = api_get_session_id();
    $course_id     = api_get_course_int_id();

    $task_id = intval($task_id);

    if ($session_id == 0) {
        $sql = "SELECT user_id as id FROM $work_table
                WHERE
                    c_id = $course_id AND
                    parent_id='$task_id' AND
                    active IN (0, 1)";
    } else {
        $sql = "SELECT user_id as id FROM $work_table
                WHERE
                    c_id = $course_id AND
                    parent_id='$task_id' AND
                    session_id='".$session_id."' AND
                    active IN (0, 1)";
    }

    $result = Database::query($sql);
    $users_with_tasks = array();
    while($row = Database::fetch_array($result)) {
        $users_with_tasks[] = $row['id'];
    }

    if ($session_id == 0) {
        $sql_users = "SELECT cu.user_id, u.lastname, u.firstname, u.email FROM $table_course_user AS cu, $table_user AS u
                      WHERE u.status != 1 and cu.course_code='".api_get_course_id()."' AND u.user_id = cu.user_id";
    } else {
        $sql_users = "SELECT cu.id_user, u.lastname, u.firstname, u.email FROM $session_course_rel_user AS cu, $table_user AS u
                      WHERE u.status != 1 and cu.course_code='".api_get_course_id()."' AND u.user_id = cu.id_user and cu.id_session = '".$session_id."'";
    }

    if (!empty($studentId)) {
        $sql_users.= " AND u.user_id = ".intval($studentId);
    }

    $group_id = api_get_group_id();

    $new_group_user_list = array();

    if ($group_id) {
        $group_user_list = GroupManager::get_subscribed_users($group_id);
        if (!empty($group_user_list)) {
            foreach($group_user_list as $group_user) {
                $new_group_user_list[] = $group_user['user_id'];
            }
        }
    }

    $result_users = Database::query($sql_users);
    $users_without_tasks = array();
    while ($row_users = Database::fetch_row($result_users)) {

        if (in_array($row_users[0], $users_with_tasks)) {
            continue;
        }

        if ($group_id && !in_array($row_users[0], $new_group_user_list)) {
            continue;
        }
        $userId = $row_users[0];
        $row_users[0] = $row_users[1];
        $row_users[1] = $row_users[2];
        $row_users[2] = Display::encrypted_mailto_link($row_users[3]);
        $row_users[3] = $userId;
        $users_without_tasks[] = $row_users;
    }
    return $users_without_tasks;
}
Esempio n. 12
0
                            AND gu.group_id = '$_gid'
                            AND u.user_id = '$uInfo'";
            $query = Database::query($sql);
            $tracked_user_info = @Database::fetch_assoc($query);
            if (is_array($tracked_user_info)) {
                $tracking_is_accepted = true;
            }

            $title[0] = $tracked_user_info['firstname'] . '_' . $tracked_user_info['lastname'];
        }

        if ($tracking_is_accepted) {
            $tracked_user_info['email'] == '' ? $mail_link = get_lang(
                'NoEmail'
            ) : $mail_link = Display::encrypted_mailto_link(
                $tracked_user_info['email']
            );

            if (!isset($view)) {
                $view = '0000000';
            }
            //Logins
            list($title_line1, $line1) = TrackingUserLogCSV::display_login_tracking_info(
                $view,
                $uInfo,
                $_cid
            );

            //Exercise results
            list($title_line2, $line2) = TrackingUserLogCSV::display_exercise_tracking_info(
                $view,
Esempio n. 13
0
/**
 * Get list of users who have not given the task
 * @param int
 * @param int
 * @return array
 * @author cvargas
 * @author Julio Montoya <*****@*****.**> Fixing query
 */
function get_list_users_without_publication($task_id, $studentId = null)
{
    $work_table = Database::get_course_table(TABLE_STUDENT_PUBLICATION);
    $table_course_user = Database::get_main_table(TABLE_MAIN_COURSE_USER);
    $table_user = Database::get_main_table(TABLE_MAIN_USER);
    $session_course_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
    $users = getAllUserToWork($task_id, api_get_course_int_id());
    $users = array_column($users, 'user_id');
    // Condition for the session
    $session_id = api_get_session_id();
    $course_id = api_get_course_int_id();
    $task_id = intval($task_id);
    if ($session_id == 0) {
        $sql = "SELECT user_id as id FROM {$work_table}\n                WHERE\n                    c_id = {$course_id} AND\n                    parent_id = '{$task_id}' AND\n                    active IN (0, 1)";
    } else {
        $sql = "SELECT user_id as id FROM {$work_table}\n                WHERE\n                    c_id = {$course_id} AND\n                    parent_id = '{$task_id}' AND\n                    session_id = '" . $session_id . "' AND\n                    active IN (0, 1)";
    }
    $result = Database::query($sql);
    $users_with_tasks = array();
    while ($row = Database::fetch_array($result)) {
        $users_with_tasks[] = $row['id'];
    }
    if ($session_id == 0) {
        $sql_users = "SELECT cu.user_id, u.lastname, u.firstname, u.email\n                      FROM {$table_course_user} AS cu, {$table_user} AS u\n                      WHERE u.status != 1 and cu.c_id='" . $course_id . "' AND u.user_id = cu.user_id";
    } else {
        $sql_users = "SELECT cu.user_id, u.lastname, u.firstname, u.email\n                      FROM {$session_course_rel_user} AS cu, {$table_user} AS u\n                      WHERE\n                        u.status != 1 AND\n                        cu.c_id='" . $course_id . "' AND\n                        u.user_id = cu.user_id AND\n                        cu.session_id = '" . $session_id . "'";
    }
    if (!empty($studentId)) {
        $sql_users .= " AND u.user_id = " . intval($studentId);
    }
    $group_id = api_get_group_id();
    $new_group_user_list = array();
    if ($group_id) {
        $group_user_list = GroupManager::get_subscribed_users($group_id);
        if (!empty($group_user_list)) {
            foreach ($group_user_list as $group_user) {
                $new_group_user_list[] = $group_user['user_id'];
            }
        }
    }
    $result_users = Database::query($sql_users);
    $users_without_tasks = array();
    while ($rowUsers = Database::fetch_array($result_users)) {
        $userId = $rowUsers['user_id'];
        if (in_array($userId, $users_with_tasks)) {
            continue;
        }
        if ($group_id && !in_array($userId, $new_group_user_list)) {
            continue;
        }
        if (!empty($users)) {
            if (!in_array($userId, $users)) {
                continue;
            }
        }
        $row_users = [];
        $row_users[0] = $rowUsers['lastname'];
        $row_users[1] = $rowUsers['firstname'];
        $row_users[2] = Display::encrypted_mailto_link($rowUsers['email']);
        $row_users[3] = $userId;
        $users_without_tasks[] = $row_users;
    }
    return $users_without_tasks;
}
Esempio n. 14
0
 /**
  * Set footer parameters
  */
 private function setFooterParameters()
 {
     //Show admin data
     //$this->assign('show_administrator_data', api_get_setting('show_administrator_data'));
     if (api_get_setting('show_administrator_data') == 'true') {
         //Administrator name
         $administrator_data = get_lang('Manager') . ' : ' . Display::encrypted_mailto_link(api_get_setting('emailAdministrator'), api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname')));
         $this->assign('administrator_name', $administrator_data);
     }
     //Loading footer extra content
     if (!api_is_platform_admin()) {
         $extra_footer = trim(api_get_setting('footer_extra_content'));
         if (!empty($extra_footer)) {
             $this->assign('footer_extra_content', $extra_footer);
         }
     }
     $courseId = api_get_course_int_id();
     //Tutor name
     if (api_get_setting('show_tutor_data') == 'true') {
         // Course manager
         $id_session = api_get_session_id();
         if (isset($courseId) && $courseId != -1 && !empty($courseId)) {
             $tutor_data = '';
             if ($id_session != 0) {
                 $coachs_email = CourseManager::get_email_of_tutor_to_session($id_session, $courseId);
                 $email_link = array();
                 foreach ($coachs_email as $coach) {
                     $email_link[] = Display::encrypted_mailto_link($coach['email'], $coach['complete_name']);
                 }
                 if (count($coachs_email) > 1) {
                     $tutor_data .= get_lang('Coachs') . ' : ';
                     $tutor_data .= ArrayClass::array_to_string($email_link, CourseManager::USER_SEPARATOR);
                 } elseif (count($coachs_email) == 1) {
                     $tutor_data .= get_lang('Coach') . ' : ';
                     $tutor_data .= ArrayClass::array_to_string($email_link, CourseManager::USER_SEPARATOR);
                 } elseif (count($coachs_email) == 0) {
                     $tutor_data .= '';
                 }
             }
             $this->assign('session_teachers', $tutor_data);
         }
     }
     if (api_get_setting('show_teacher_data') == 'true') {
         // course manager
         if (isset($courseId) && $courseId != -1 && !empty($courseId)) {
             $courseInfo = api_get_course_info();
             $teacher_data = null;
             $label = get_lang('Teacher');
             if (count($courseInfo['teacher_list']) > 1) {
                 $label = get_lang('Teachers');
             }
             $teacher_data .= $label . ' : ' . $courseInfo['teacher_list_formatted'];
             $this->assign('teachers', $teacher_data);
         }
     }
 }
Esempio n. 15
0
?>
</h3>
<table width="100%" cellpadding="2" cellspacing="3" border="0">
    <?php 
// check if uid is tutor of this group
$courseId = api_get_course_int_id();
if ($is_allowedToTrack || $is_allowedToTrackEverybodyInCourse) {
    if ($is_allowedToTrackEverybodyInCourse) {
        $sql = "SELECT u.firstname,u.lastname, u.email\n                    FROM {$TABLECOURSUSER} cu , {$TABLEUSER} u\n                    WHERE\n                        cu.user_id = u.user_id AND\n                        cu.relation_type<>" . COURSE_RELATION_TYPE_RRHH . " AND\n                        cu.c_id = '{$courseId}' AND\n                        u.user_id = '{$uInfo}'";
    } else {
        $sql = "SELECT u.firstname,u.lastname, u.email\n                    FROM {$TABLECOURSE_GROUPSUSER} gu , {$TABLEUSER} u\n                    WHERE gu.user_id = u.user_id\n                        AND gu.group_id = '{$_gid}'\n                        AND u.user_id = '{$uInfo}'";
    }
    $query = Database::query($sql);
    $res = @Database::fetch_array($query);
    if (is_array($res)) {
        $res[2] == "" ? $res2 = get_lang('NoEmail') : ($res2 = Display::encrypted_mailto_link($res[2]));
        echo "<tr><td>";
        echo $informationsAbout . " : <br>";
        echo "<ul>\n" . "<li>" . get_lang('FirstName') . " : " . $res[0] . "</li>\n" . "<li>" . get_lang('LastName') . " : " . $res[1] . "</li>\n" . "<li>" . get_lang('Email') . " : " . $res2 . "</li>\n" . "</ul>";
        echo "</td></tr>";
        /*             * ***** MENU ******* */
        echo "<tr>\n                <td>\n                [<a href='userLog.php?uInfo={$uInfo}&view={$view}'>" . get_lang('Back') . "</a>]\n        ";
        echo "  &nbsp;&nbsp;&nbsp;||&nbsp;&nbsp;&nbsp;\n                [<a href='" . api_get_self() . "?uInfo={$uInfo}&view={$view}&period=week&reqdate={$reqdate}' class='specialLink'>" . get_lang('PeriodWeek') . "</a>]\n                [<a href='" . api_get_self() . "?uInfo={$uInfo}&view={$view}&period=month&reqdate={$reqdate}' class='specialLink'>" . get_lang('PeriodMonth') . "</a>]\n                &nbsp;&nbsp;&nbsp;||&nbsp;&nbsp;&nbsp;\n        ";
        switch ($period) {
            case "week":
                // previous and next date must be evaluated
                $previousReqDate = $reqdate - 7 * 86400;
                $nextReqDate = $reqdate + 7 * 86400;
                echo "\n                    [<a href='" . api_get_self() . "?uInfo={$uInfo}&view={$view}&period=week&reqdate={$previousReqDate}' class='specialLink'>" . get_lang('PreviousWeek') . "</a>]\n                    [<a href='" . api_get_self() . "?uInfo={$uInfo}&view={$view}&period=week&reqdate={$nextReqDate}' class='specialLink'>" . get_lang('NextWeek') . "</a>]\n                ";
                break;
            default:
Esempio n. 16
0
    $table_header[] = array(get_lang('Email'), true);
    $table_header[] = array(get_lang('Status'), true);
    $table_header[] = array('', false);
    $data = array();
    foreach ($users as $index => $user) {
        $username = api_htmlentities(sprintf(get_lang('LoginX'), $user['username']), ENT_QUOTES);
        $row = array();
        $row[] = $user['official_code'];
        if ($is_western_name_order) {
            $row[] = $user['firstname'];
            $row[] = "<span title='{$username}'>" . $user['lastname'] . "</span>";
        } else {
            $row[] = "<span title='{$username}'>" . $user['lastname'] . "</span>";
            $row[] = $user['firstname'];
        }
        $row[] = Display::encrypted_mailto_link($user['email'], $user['email']);
        $row[] = $user['status'] == 5 ? get_lang('Student') : get_lang('Teacher');
        $row[] = '<a href="user_information.php?user_id=' . $user['user_id'] . '">' . Display::return_icon('synthese_view.gif', get_lang('Info')) . '</a>';
        $data[] = $row;
    }
    Display::display_sortable_table($table_header, $data, array(), array(), array('id' => $_GET['id']));
} else {
    echo get_lang('NoUsersInClass');
}
/**
 * Show all courses in which this class is subscribed.
 */
$courses = ClassManager::get_courses($class_id);
if (count($courses) > 0) {
    $header[] = array(get_lang('Code'), true);
    $header[] = array(get_lang('Title'), true);
Esempio n. 17
0
    /**
     * Set footer parameters
     */
    private function set_footer_parameters()
    {
        global $_configuration;

        //Show admin data
        //$this->assign('show_administrator_data', api_get_setting('show_administrator_data'));

        if (api_get_setting('show_administrator_data') == 'true') {
            //Administrator name
            $administrator_data = get_lang('Manager').' : '.Display::encrypted_mailto_link(
                    api_get_setting('emailAdministrator'),
                    api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'))
                );
            $this->assign('administrator_name', $administrator_data);
        }

        //Loading footer extra content
        if (!api_is_platform_admin()) {
            $extra_footer = trim(api_get_setting('footer_extra_content'));
            if (!empty($extra_footer)) {
                $this->assign('footer_extra_content', $extra_footer);
            }
        }

        //Tutor name
        if (api_get_setting('show_tutor_data') == 'true') {
            // Course manager
            $id_course  = api_get_course_id();
            $id_session = api_get_session_id();
            if (isset($id_course) && $id_course != -1) {
                $tutor_data = '';
                if ($id_session != 0) {
                    $coachs_email = CourseManager::get_email_of_tutor_to_session($id_session, $id_course);
                    $email_link   = array();
                    foreach ($coachs_email as $coach) {
                        $email_link[] = Display::encrypted_mailto_link($coach['email'], $coach['complete_name']);
                    }
                    if (count($coachs_email) > 1) {
                        $tutor_data .= get_lang('Coachs').' : ';
                        $tutor_data .= array_to_string($email_link, CourseManager::USER_SEPARATOR);
                    } elseif (count($coachs_email) == 1) {
                        $tutor_data .= get_lang('Coach').' : ';
                        $tutor_data .= array_to_string($email_link, CourseManager::USER_SEPARATOR);
                    } elseif (count($coachs_email) == 0) {
                        $tutor_data .= '';
                    }
                }
                $this->assign('session_teachers', $tutor_data);
            }
        }

        if (api_get_setting('show_teacher_data') == 'true') {
            // course manager
            $id_course = api_get_course_id();
            if (isset($id_course) && $id_course != -1) {
                $teacher_data = '';
                $mail         = CourseManager::get_emails_of_tutors_to_course($id_course);
                if (!empty($mail)) {
                    $teachers_parsed = array();
                    foreach ($mail as $value) {
                        foreach ($value as $email => $name) {
                            $teachers_parsed[] = Display::encrypted_mailto_link($email, $name);
                        }
                    }
                    $label = get_lang('Teacher');
                    if (count($mail) > 1) {
                        $label = get_lang('Teachers');
                    }
                    $teacher_data .= $label.' : '.array_to_string($teachers_parsed, CourseManager::USER_SEPARATOR);
                }
                $this->assign('teachers', $teacher_data);
            }
        }
        /* $stats = '';
          $this->assign('execution_stats', $stats); */
    }
Esempio n. 18
0
        }

        if ($allowedToEditDef && api_get_setting('allow_user_course_subscription_by_course_admin') == 'true') {
            //echo	"<td>";
            //echo	"<a href=\"".api_get_self()."?".api_get_cidreq()."&editMainUserInfo=$userIdViewed\"><img border=\"0\" alt=\"\" src=\"../img/edit.gif\" /></a>";
            //echo	"</td>";
        }
        if ($is_allowedToTrack) {
            //echo "<td>";
            //echo "<a href=\"../mySpace/myStudents.php?".api_get_cidreq()."&origin=user_course&student=$userIdViewed&details=true&course=".$_course['id']."\"><img border=\"0\" alt=\"".get_lang('Tracking')." : $userIdViewed\" src=\"../img/statistics.gif\" /></a>";
            //echo "</td>";
        }
        echo "</tr></table>";

        if (api_get_setting("show_email_addresses") == "true") {
            echo "<p>". Display::encrypted_mailto_link($mainUserInfo['email'],$mainUserInfo['email']). "</p>";
        }

        if (api_get_setting('extended_profile') == 'true') {
            if (!empty($mainUserInfo['competences']))
                echo '<div style="margin-top:10px;" class="actions-message"><strong>'.get_lang('MyCompetences').'</strong></div><div>'.$mainUserInfo['competences'].'</div>';
            if (!empty($mainUserInfo['diplomas']))
                echo '<div style="margin-top:10px;" class="actions-message"><strong>'.get_lang('MyDiplomas').'</strong></div><div>'.$mainUserInfo['diplomas'].'</div>';
            if (!empty($mainUserInfo['teach']))
                echo '<div style="margin-top:10px;" class="actions-message"><strong>'.get_lang('MyTeach').'</strong></div><div>'.$mainUserInfo['teach'].'</div>';
            if (!empty($mainUserInfo['openarea']))
                echo '<div style="margin-top:10px;" class="actions-message"><strong>'.get_lang('MyPersonalOpenArea').'</strong></div><div>'.$mainUserInfo['openarea'].'</div>';
            if (!empty($mainUserInfo['competences']))
                echo '<div style="margin-top:10px;" class="actions-message"><strong>'.get_lang('MyProductions').'</strong></div><div>'.UserManager::build_production_list($mainUserInfo['user_id']).'</div>';
        }
    } else {