예제 #1
0
 /**
  * Display table with tool/right of the profile
  */
 public function displayProfileToolRightList()
 {
     $html = '';
     $html_table_header_list = array();
     $html_table_row_list = array();
     foreach ($this->rightProfileToolRightList as $profile_id => $rightProfileToolRight) {
         $isLocked = $rightProfileToolRight->profile->isLocked();
         $className = get_class($rightProfileToolRight);
         // use strtolower for PHP4 : get_class returns class name in lowercase
         $className = strtolower($className);
         $html_table_header_list[$profile_id] = claro_get_profile_name($profile_id);
         if ($isLocked && $className == strtolower('RightCourseProfileToolRight')) {
             $displayMode = claro_is_platform_admin() ? $this->displayMode : 'read';
             $html_table_header_list[$profile_id] .= '&nbsp;<img src="' . get_icon_url('locked') . '" alt="' . get_lang('Profile locked') . '" />';
         } else {
             $displayMode = $this->displayMode;
         }
         foreach ($rightProfileToolRight->toolActionList as $tool_id => $action_list) {
             $action_right = $rightProfileToolRight->getToolRight($tool_id);
             $html_right = '';
             if ($displayMode == 'edit') {
                 $param_append = '?profile_id=' . urlencode($profile_id) . '&amp;tool_id=' . urlencode($tool_id) . '&amp;cmd=set_right';
                 foreach ($this->urlParamAppendList as $name => $value) {
                     $param_append .= '&amp;' . $name . '=' . $value;
                 }
             }
             if (claro_get_profile_label($profile_id) != ANONYMOUS_PROFILE && claro_get_profile_label($profile_id) != GUEST_PROFILE) {
                 if ($action_right == 'none') {
                     $action_param_value = 'user';
                     $html_right = '<img src="' . get_icon_url('forbidden') . '" alt="' . get_lang('No access') . '" />&nbsp;<span style="font-size: smaller;">' . get_lang('No access') . "</span>\n";
                 } elseif ($action_right == 'user') {
                     $action_param_value = 'manager';
                     $html_right = '<img src="' . get_icon_url('user') . '" alt="' . get_lang('Access allowed') . '" />&nbsp;<span style="font-size: smaller;">' . get_lang('Access allowed') . "</span>\n";
                 } else {
                     $action_param_value = 'none';
                     $html_right = '<img src="' . get_icon_url('manager') . '" alt="' . get_lang('Edition allowed') . '" />&nbsp;<span style="font-size: smaller;">' . get_lang('Edition allowed') . "</span>\n";
                 }
             } else {
                 if ($action_right == 'none') {
                     $action_param_value = 'user';
                     $html_right = '<img src="' . get_icon_url('forbidden') . '" alt="' . get_lang('No access') . '" />&nbsp;<span style="font-size: smaller;">' . get_lang('No access') . "</span>\n";
                 } else {
                     $action_param_value = 'none';
                     $html_right = '<img src="' . get_icon_url('user') . '" alt="' . get_lang('Access allowed') . '" />&nbsp;<span style="font-size: smaller;">' . get_lang('Access allowed') . "</span>\n";
                 }
             }
             if ($displayMode == 'edit') {
                 $html_right = '<a href="' . $_SERVER['PHP_SELF'] . $param_append . '&amp;right_value=' . $action_param_value . '">' . $html_right . '</a>';
             }
             $html_table_row_list[$tool_id][$profile_id] = $html_right;
         }
     }
     // build table
     $html .= '<table class="claroTable emphaseLine" >' . "\n" . '<thead>' . "\n" . '<tr class="headerX">' . "\n" . '<th>' . get_lang('Tools') . '</th>' . "\n";
     // visibility column
     if ($this->isSetCourseToolInfo()) {
         $html .= '<th style="text-align:center; width:100px;" >' . get_lang('Visibility') . '</th>' . "\n";
     }
     foreach ($html_table_header_list as $html_table_header) {
         $html .= '<th style="text-align:center; width:100px;" >' . $html_table_header . '</th>' . "\n";
     }
     $html .= '</tr>' . "\n" . '</thead>' . "\n" . '<tbody>';
     foreach ($html_table_row_list as $tool_id => $html_table_row) {
         if (claro_is_in_a_course() && (!$this->isSetCourseToolInfo() || !isset($this->courseToolInfo[$tool_id]))) {
             // Not activated in course !
             continue;
         }
         $html .= '<tr>' . "\n";
         if ($this->isSetCourseToolInfo()) {
             // Add visibility and icon from courseToolInfo
             $html .= '<td ' . ($this->courseToolInfo[$tool_id]['visibility'] == true ? '' : 'class="invisible"') . '>' . '<img src="' . $this->courseToolInfo[$tool_id]['icon'] . '" alt="" />' . get_lang(claro_get_tool_name($tool_id)) . '</td>';
         } else {
             $html .= '<td>' . get_lang(claro_get_tool_name($tool_id)) . '</td>' . "\n";
         }
         // visibility column
         if ($this->isSetCourseToolInfo()) {
             if ($this->courseToolInfo[$tool_id]['visibility'] == true) {
                 $html .= '<td align="center">' . '<a href="' . $_SERVER['PHP_SELF'] . '?cmd=exInvisible&amp;tool_id=' . $this->courseToolInfo[$tool_id]['tid'] . '" >' . '<img src="' . get_icon_url('visible') . '" alt="' . get_lang('Visible') . '" />' . '</a>' . '</td>' . "\n";
             } else {
                 $html .= '<td align="center">' . '<a href="' . $_SERVER['PHP_SELF'] . '?cmd=exVisible&amp;tool_id=' . $this->courseToolInfo[$tool_id]['tid'] . '" >' . '<img src="' . get_icon_url('invisible') . '" alt="' . get_lang('Invisible') . '" />' . '</a></td>' . "\n";
             }
         }
         // profile colums
         foreach ($html_table_row as $html_table_row_cell) {
             $html .= '<td align="center">' . $html_table_row_cell . '</td>';
         }
         $html .= '</tr>' . "\n";
     }
     $html .= '</tbody></table>';
     return $html;
 }
예제 #2
0
// Build query and find info in db
//----------------------------------
$sql = "SELECT U.user_id  AS user_id,\n               U.nom      AS name,\n               U.prenom   AS firstname,\n               U.username AS username,\n               CU.profile_id AS profileId,\n               CU.isCourseManager\n        FROM  `" . $tbl_mdb_names['user'] . "` AS U\n            , `" . $tbl_mdb_names['rel_course_user'] . "` AS CU\n          WHERE CU.`user_id` = U.`user_id`\n            AND CU.`code_cours` = '" . claro_sql_escape($cidToEdit) . "'";
$myPager = new claro_sql_pager($sql, $pager_offset, get_conf('userPerPage', 20));
$sortKey = isset($_GET['sort']) ? $_GET['sort'] : 'user_id';
$sortDir = isset($_GET['dir']) ? $_GET['dir'] : SORT_ASC;
$myPager->set_sort_key($sortKey, $sortDir);
$myPager->set_pager_call_param_name('pager_offset');
$userList = $myPager->get_result_list();
// Start the list of users
$userDataList = array();
foreach ($userList as $lineId => $user) {
    $userDataList[$lineId]['user_id'] = $user['user_id'];
    $userDataList[$lineId]['name'] = $user['name'];
    $userDataList[$lineId]['firstname'] = $user['firstname'];
    $userDataList[$lineId]['profileId'] = claro_get_profile_name($user['profileId']);
    if ($user['isCourseManager']) {
        $userDataList[$lineId]['isCourseManager'] = '<img class="qtip" src="' . get_icon_url('manager') . '" ' . 'alt="' . get_lang('Course manager') . '" ' . 'title="' . get_lang('Course manager') . '" />';
    } else {
        $userDataList[$lineId]['isCourseManager'] = '<img class="qtip" src="' . get_icon_url('user') . '" ' . 'alt="' . get_lang('Student') . '" ' . 'title="' . get_lang('Student') . '" />';
    }
    $userDataList[$lineId]['cmd_cu_edit'] = '<a href="admin_user_course_settings.php' . '?cidToEdit=' . $cidToEdit . '&amp;uidToEdit=' . $user['user_id'] . '&amp;ccfrom=culist">' . '<img src="' . get_icon_url('edit') . '" alt="' . get_lang('Edit') . '"/>' . '</a>';
    $userDataList[$lineId]['cmd_cu_unenroll'] = '<a href="' . $_SERVER['PHP_SELF'] . '?cidToEdit=' . $cidToEdit . '&amp;cmd=unsub&amp;user_id=' . $user['user_id'] . '&amp;pager_offset=' . $pager_offset . '" ' . ' onclick="return ADMIN.confirmationUnReg(\'' . clean_str_for_javascript($user['username']) . '\');">' . "\n" . '<img src="' . get_icon_url('unenroll') . '" alt="' . get_lang('Unregister user') . '" />' . "\n" . '</a>' . "\n";
}
// end display users table
// Prepare output
// Javascript confirm pop up declaration for header
JavascriptLanguage::getInstance()->addLangVar('Are you sure you want to unregister %name ?');
JavascriptLoader::getInstance()->load('admin');
// Config Datagrid
$sortUrlList = $myPager->get_sort_url_list($_SERVER['PHP_SELF'] . '?cidToEdit=' . $cidToEdit);
예제 #3
0
            default:
                $dialogBox->error(get_lang('Unknow error during unsubscribing'));
        }
    }
}
$addToUrl = 'ulist' == $cfrom ? '&amp;cfrom=ulist' : '';
$sqlUserCourseList = prepare_sql_get_courses_of_a_user($uidToEdit);
$myPager = new claro_sql_pager($sqlUserCourseList, $offset, get_conf('coursePerPage', 20));
$myPager->set_sort_key($pagerSortKey, $pagerSortDir);
$userCourseList = $myPager->get_result_list();
$userCourseGrid = array();
foreach ($userCourseList as $courseKey => $course) {
    $userCourseGrid[$courseKey]['officialCode'] = $course['officialCode'];
    $iconUrl = get_course_access_icon($course['access']);
    $userCourseGrid[$courseKey]['name'] = '<img class="iconDefinitionList" src="' . $iconUrl . '" alt="" />' . '<a href="' . get_path('clarolineRepositoryWeb') . 'course/index.php?cid=' . claro_htmlspecialchars($course['sysCode']) . '">' . $course['name'] . '</a><br />' . $course['titular'];
    $userCourseGrid[$courseKey]['profileId'] = claro_get_profile_name($course['profileId']);
    if ($course['isCourseManager']) {
        $userCourseGrid[$courseKey]['isCourseManager'] = '<img class="qtip" src="' . get_icon_url('manager') . '" alt="' . get_lang('Course manager') . '" />';
    } else {
        $userCourseGrid[$courseKey]['isCourseManager'] = '<img class="qtip" src="' . get_icon_url('user') . '" alt="' . get_lang('Student') . '" />';
    }
    $userCourseGrid[$courseKey]['edit_course_user'] = '******' . $course['sysCode'] . '&amp;uidToEdit=' . $uidToEdit . '&amp;ccfrom=uclist">' . '<img src="' . get_icon_url('edit') . '" alt="' . get_lang('Course manager') . '" title="' . get_lang('User\'s course settings') . '" />' . '</a>';
    $userCourseGrid[$courseKey]['delete'] = '<a href="' . $_SERVER['PHP_SELF'] . '?uidToEdit=' . $uidToEdit . '&amp;cmd=unsubscribe' . $addToUrl . '&amp;courseId=' . claro_htmlspecialchars($course['sysCode']) . '&amp;sort=' . $pagerSortKey . '&amp;dir=' . $pagerSortDir . '&amp;offset=' . $offset . '"' . ' onclick="return ADMIN.confirmationUnReg(\'' . clean_str_for_javascript($userData['firstname'] . ' ' . $userData['lastname']) . '\');">' . "\n" . '<img src="' . get_icon_url('unenroll') . '" alt="' . get_lang('Delete') . '" />' . "\n" . '</a>' . "\n";
}
$sortUrlList = $myPager->get_sort_url_list($_SERVER['PHP_SELF'] . '?uidToEdit=' . $uidToEdit);
$userCourseDataGrid = new claro_datagrid();
$userCourseDataGrid->set_grid($userCourseGrid);
// extended setting for this datagrid
$userCourseDataGrid->set_colTitleList(array('officialCode' => '<a href="' . $sortUrlList['officialCode'] . '">' . get_lang('Course code') . '</a>', 'name' => '<a href="' . $sortUrlList['name'] . '">' . get_lang('Course title') . '</a>', 'profileId' => '<a href="' . $sortUrlList['profileId'] . '">' . get_lang('User profile') . '</a>', 'isCourseManager' => '<a href="' . $sortUrlList['isCourseManager'] . '">' . get_lang('Role') . '</a>', 'edit_course_user' => get_lang('Edit settings') . '</a>', 'delete' => get_lang('Unregister user')));
if (0 == count($userCourseGrid)) {
    $userCourseDataGrid->set_noRowMessage(get_lang('No course to display'));
예제 #4
0
파일: userInfo.php 프로젝트: rhertzog/lcs
    } else {
        $out .= '<textarea  cols="80" rows="' . $catToEdit['nbline'] . '" name="content" id="content" >' . $catToEdit['content'] . '</textarea>';
    }
    $out .= '<input type="submit" name="submitContent" value="' . get_lang('Ok') . '" />' . "\n" . '</form>';
} elseif ($displayMode == "viewMainInfoEdit") {
    if ($mainUserInfo) {
        $hidden_param = array('submitMainUserInfo' => $userIdViewed, 'uInfo' => $userIdViewed);
        $out .= course_user_html_form($mainUserInfo, claro_get_current_course_id(), $userIdViewed, $hidden_param);
    }
} elseif ($displayMode == "viewContentList") {
    /*>>>>>>>>>>>> CATEGORIES CONTENTS : LIST <<<<<<<<<<<<*/
    if ($mainUserInfo) {
        $mainUserInfo['role'] = !empty($mainUserInfo['role']) ? $mainUserInfo['role'] : ' - ';
        $mainUserInfo['tutor'] = $mainUserInfo['isTutor'] == 1 ? get_lang('Group Tutor') : ' - ';
        $mainUserInfo['isCourseManager'] = $mainUserInfo['isCourseManager'] == 1 ? get_lang('Course manager') : ' - ';
        $out .= '<table class="claroTable" width="80%" border="0">' . "\n" . '<thead>' . "\n" . '<tr class="headerX">' . "\n" . '<th align="left">' . get_lang('Name') . '</th>' . "\n" . '<th align="left">' . get_lang('Profile') . '</th>' . "\n" . '<th aling="left">' . get_lang('Skype account') . '</th>' . "\n" . '<th align="left">' . get_lang('Role') . '</th>' . "\n" . '<th>' . get_lang('Group Tutor') . '</th>' . "\n" . '<th>' . get_lang('Course manager') . '</th>' . "\n" . ($allowedToEditDef ? '<th>' . get_lang('Edit') . '</th>' . "\n" : '') . ($is_allowedToTrack ? "<th>" . get_lang('Tracking') . '</th>' . "\n" : '') . '</tr>' . "\n" . '</thead>' . "\n" . '<tbody>' . "\n" . '<tr align="center">' . "\n" . '<td align="left"><b>' . htmlize($mainUserInfo['firstName']) . ' ' . htmlize($mainUserInfo['lastName']) . '</b></td>' . "\n" . '<td align="left">' . htmlize(claro_get_profile_name($mainUserInfo['profileId'])) . '</td>' . "\n" . '<td align="center">' . $skypeStatus . '</td>' . "\n" . '<td>' . htmlize($mainUserInfo['role']) . '</td>' . "\n" . '<td>' . $mainUserInfo['tutor'] . '</td>' . '<td>' . $mainUserInfo['isCourseManager'] . '</td>';
        if ($allowedToEditDef) {
            $out .= '<td>' . '<a href="' . claro_htmlspecialchars(Url::Contextualize($_SERVER['PHP_SELF'] . '?editMainUserInfo=' . $userIdViewed)) . '">' . '<img alt="' . get_lang('Edit') . '" src="' . get_icon_url('edit') . '" />' . '</a>' . '</td>' . "\n";
        }
        if ($is_allowedToTrack) {
            $out .= '<td>' . '<a href="' . claro_htmlspecialchars(Url::Contextualize(get_path('clarolineRepositoryWeb') . 'tracking/userReport.php' . '?userId=' . $userIdViewed)) . '">' . '<img alt="' . get_lang('Tracking') . '" src="' . get_icon_url('statistics') . '" />' . '</a>' . '</td>' . "\n";
        }
        $out .= '</tr>' . "\n" . '</tbody>' . "\n" . '</table>' . "\n\n";
        if (claro_is_user_authenticated() || !get_conf('user_email_hidden_to_anonymous')) {
            $out .= '<p><a href="mailto:' . claro_htmlspecialchars($mainUserInfo['email']) . '">' . $mainUserInfo['email'] . '</a></p>';
        }
        if (current_user_is_allowed_to_send_message_to_user($userIdViewed)) {
            $out .= '<p><a href="' . claro_htmlspecialchars(Url::Contextualize(get_path('clarolineRepositoryWeb') . '/messaging/sendmessage.php?cmd=rqMessageToUser&userId=' . $userIdViewed)) . '">' . get_lang('Send a message') . '</a></p>';
        }
        $out .= '<hr noshade="noshade" size="1" />' . "\n";
    }
예제 #5
0
파일: user.php 프로젝트: rhertzog/lcs
/*----------------------------------------------------------------------
   Display users
  ----------------------------------------------------------------------*/
$i = $offset;
$previousUser = -1;
reset($userList);
foreach ($userList as $thisUser) {
    // Username column
    $i++;
    $out .= '<tr align="center" valign="top">' . "\n" . '<td align="left">' . '<img src="' . get_icon_url('user') . '" alt="" />' . "\n" . '<small>' . $i . '</small>' . "\n" . '&nbsp;';
    if ($is_allowedToEdit || get_conf('linkToUserInfo')) {
        $out .= '<a href="' . claro_htmlspecialchars(Url::Contextualize(get_module_url('CLUSR') . '/userInfo.php?uInfo=' . (int) $thisUser['user_id'])) . '">' . claro_htmlspecialchars(ucfirst(strtolower($thisUser['nom']))) . '</a>';
    } else {
        $out .= claro_htmlspecialchars(ucfirst(strtolower($thisUser['nom'])));
    }
    $out .= '</td>' . '<td align="left">' . claro_htmlspecialchars($thisUser['prenom']) . '</td>' . '<td align="left">' . claro_get_profile_name($thisUser['profile_id']) . '</td>' . "\n";
    // User role column
    if (empty($thisUser['role'])) {
        $out .= '<td> - </td>' . "\n";
    } else {
        $out .= '<td>' . claro_htmlspecialchars($thisUser['role']) . '</td>' . "\n";
    }
    if (empty($thisUser['groups'])) {
        $out .= '<td> - </td>' . "\n";
    } else {
        $out .= '<td>' . claro_htmlspecialchars($thisUser['groups']) . '</td>' . "\n";
    }
    if ($previousUser == $thisUser['user_id']) {
        $out .= '<td>&nbsp;</td>' . "\n";
    } elseif ($is_allowedToEdit) {
        if (!empty($thisUser['enrollment_date'])) {