Пример #1
0
    $tool_content .= "<div class='alert alert-warning'>{$langNoLearningPath}</div>";
    draw($tool_content, 2, null, $head_content);
    exit;
} else {
    $tool_content .= "<div class='alert alert-info'>\n           <b>{$langDumpUserDurationToFile}: </b>1. <a href='dumpuserlearnpathdetails.php?course={$course_code}'>{$langcsvenc2}</a>\n                2. <a href='dumpuserlearnpathdetails.php?course={$course_code}&amp;enc=1253'>{$langcsvenc1}</a>          \n          </div>";
}
// display tab header
$tool_content .= "\n  <table class='table-default'>\n  <tr>\n    <th class='left'><div align='left'>{$langStudent}</div></th>\n    <th width='120'>{$langAm}</th>\n    <th>{$langGroup}</th>\n    <th colspan='2'>{$langProgress}&nbsp;&nbsp;</th>\n  </tr>\n";
// display tab content
$k = 0;
foreach ($usersList as $user) {
    // list available learning paths
    $learningPathList = Database::get()->queryArray("SELECT learnPath_id FROM lp_learnPath WHERE course_id = ?d", $course_id);
    $iterator = 1;
    $globalprog = 0;
    $tool_content .= "  <tr>";
    foreach ($learningPathList as $learningPath) {
        // % progress
        $prog = get_learnPath_progress($learningPath->learnPath_id, $user->id);
        if ($prog >= 0) {
            $globalprog += $prog;
        }
        $iterator++;
    }
    $total = round($globalprog / ($iterator - 1));
    $tool_content .= '    <td><a href="detailsUser.php?course=' . $course_code . '&amp;uInfo=' . $user->id . '">' . q($user->surname) . ' ' . q($user->givenname) . '</a></td>' . '    <td class="center">' . q(uid_to_am($user->id)) . '</td>' . '    <td align="center">' . user_groups($course_id, $user->id) . '</td>' . '    <td class="right" width=\'120\'>' . disp_progress_bar($total, 1) . '</td>' . '    <td align="left" width=\'10\'>' . $total . '%</td>' . '</tr>';
    $k++;
}
// foot of table
$tool_content .= '</table>';
draw($tool_content, 2, null, $head_content);
Пример #2
0
function create_group_list($groups, $account_id)
{
    $group_list = '';
    if (is_array($groups)) {
        foreach ($groups as $i => $value) {
            $group_list .= '<option value="' . $groups[$i]['account_id'] . '"';
            if (user_groups($groups[$i]['account_id'], $account_id)) {
                $group_list .= ' selected> ' . $groups[$i]['account_lid'] . ' </option>';
            } else {
                $group_list .= '>' . $groups[$i]['account_lid'] . '</option>';
            }
        }
    }
    return $group_list;
}
Пример #3
0
<form class="form-horizontal validate" action="" method="post">
    <div class="box-body">
        <div class="form-group">
            <label class="col-sm-2 control-label" for="group">New Group</label>
            <div class="col-sm-8">
                <select id="group" name="newGroup" class="form-control required" required>
                    <?php 
echo user_groups(set_value('newGroup'), true, $group->getSlug());
?>
                </select>
            <?php 
echo form_error('newGroup');
?>
            </div>
        </div>
    </div>
    
    <div class="box-footer clearfix">
        <div class="form-group">
            <div class="col-sm-offset-4 col-sm-8">
                <button type="submit" class="btn btn-primary" value="Continue">Continue</button>
                <a href="<?php 
echo site_url('admin/user/group');
?>
" class="btn btn-danger">Cancel</a>
            </div>
        </div>
    </div>
</form>
Пример #4
0
} else {
    $format = 'html';
    $toolName = $langUsage;
    $pageName = $langUserDuration;
    $navigation[] = array('url' => 'index.php?course=' . $course_code, 'name' => $langUsage);
    statistics_tools($course_code, "userduration");
    // display number of users
    $tool_content .= "\n        <div class='alert alert-info'>\n           <b>{$langDumpUserDurationToFile}: </b>1. <a href='userduration.php?course={$course_code}&amp;format=csv'>{$langcsvenc2}</a>\n                2. <a href='userduration.php?course={$course_code}&amp;format=csv&amp;enc=1253'>{$langcsvenc1}</a>\n          </div>";
    $tool_content .= "\n        <table class='tbl_alt' width='99%'>\n        <tr>\n          <th class='left'>&nbsp;&nbsp;&nbsp;{$langSurname} {$langName}</th>\n          <th>{$langAm}</th>\n          <th>{$langGroup}</th>\n          <th>{$langDuration}</th>\n        </tr>";
}
$result = user_duration_query($course_id);
if (count($result) > 0) {
    $i = 0;
    foreach ($result as $row) {
        $i++;
        $grp_name = user_groups($course_id, $row->id, $format);
        if ($format == 'html') {
            if ($i % 2 == 0) {
                $tool_content .= "<tr class='even'>";
            } else {
                $tool_content .= "<tr class='odd'>";
            }
            $tool_content .= "<td class='bullet'>" . display_user($row->id) . "</td>\n                                <td class='center'>{$row->am}</td>\n                                <td class='center'>{$grp_name}</td>\n                                <td class='center'>" . format_time_duration(0 + $row->duration) . "</td>\n                                </tr>";
        } else {
            echo csv_escape($row->surname . ' ' . $row->givenname), ';', csv_escape($row->am), ';', csv_escape($grp_name), ';', csv_escape(format_time_duration(0 + $row->duration)), $crlf;
        }
    }
    if ($format == 'html') {
        $tool_content .= "</table>";
    }
}
Пример #5
0
                            )
            )            
        ));
        //die(var_dump($myrow->id == $_SESSION["uid"] && $myrow->reviewer == '1'));
        $user_roles = array();
        ($myrow->status == '1') ? array_push($user_roles, $langTeacher) : array_push($user_roles, $langStudent);
        if ($myrow->tutor == '1') array_push($user_roles, $langTutor);
        if ($myrow->editor == '1') array_push($user_roles, $langEditor);        
        if ($myrow->reviewer == '1') array_push($user_roles, $langOpenCoursesReviewer);
        //setting datables column data
        $data['aaData'][] = array(
            'DT_RowId' => getIndirectReference($myrow->id),
            'DT_RowClass' => 'smaller',
            '0' => display_user($myrow->id) . "&nbsp<span>(<a href='mailto:" . $myrow->email . "'>" . $myrow->email . "</a>) $am_message</span>",
            '1' => "<small>".implode(', ', $user_roles)."</small>",
            '2' => user_groups($course_id, $myrow->id),
            '3' => $date_field,
            '4' => $user_role_controls
        );
    }
    echo json_encode($data, JSON_UNESCAPED_UNICODE);
    exit();
}

$limit = isset($_REQUEST['limit']) ? intval($_REQUEST['limit']) : 0;

$toolName = $langUsers;
load_js('tools.js');
load_js('datatables');
load_js('datatables_filtering_delay');
$head_content .= "
Пример #6
0
<form class="form-horizontal validate" action="" method="post">
    <div class="box-body">
        <div class="form-group">
            <label class="col-sm-2 control-label" for="group">New Post Type</label>
            <div class="col-sm-8">
                <select id="group" name="newPostType" class="form-control required" required>
                    <?php 
echo user_groups(set_value('newPostType'), true, $postType->getSlug());
?>
                </select>
            <?php 
echo form_error('newPostType');
?>
            </div>
        </div>
    </div>
    
    <div class="box-footer clearfix">
        <div class="form-group">
            <div class="col-sm-offset-4 col-sm-8">
                <button type="submit" class="btn btn-primary" value="Continue">Continue</button>
                <a href="<?php 
echo site_url('admin/post/type');
?>
" class="btn btn-danger">Cancel</a>
            </div>
        </div>
    </div>
</form>
Пример #7
0
function editusers()
{
    global $logged;
    //search for users
    if (!isset($_GET['find'])) {
        return "\n\t\t\t\t<form method='post' action='acp.php?action=edituser&find='>\n\t\t\t\t\t<table width='100%'>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td width='100%' align='center'><input type='text' name='username' /></td>\n\t\t\t\t\t\t</tr>\t\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td width='100%'><input type='submit' name='userz' value='Find' /></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</table>\n\t\t\t\t</form>\n\t\t\t";
    } else {
        $users = "";
        $search = htmlspecialchars($_POST['username']);
        $sql = mysql_query("SELECT `username` FROM `users` WHERE `username` LIKE '%" . $search . "%'");
        if (mysql_num_rows($sql) > 0) {
            while ($row = mysql_fetch_array($sql)) {
                $users .= "<option value='" . $row['username'] . "'>" . $row['username'] . "</option>";
            }
            if (!isset($_GET['edit'])) {
                return "\n\t\t\t\t\t\t<form method='post' action='acp.php?action=edituser&find=&edit='>\n\t\t\t\t\t\t\t<table width='100%'>\n\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t<td width='100%' align='center'><select name='users'>" . $users . "</select></td>\n\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t<td width='100%'><input type='submit' name='edit' value='Edit This Account' /></td>\n\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t</table>\n\t\t\t\t\t\t</form>\n\t\t\t\t\t";
            } else {
                $uname = htmlspecialchars($_POST['users']);
                $use = mysql_query("SELECT * FROM `users` WHERE `username` = '" . $uname . "'");
                if (!isset($_POST['modify'])) {
                    $info = mysql_fetch_array($use);
                    return "\n\t\t\t\t\t\t\t\t<form method='post' action=''>\n\t\t\t\t\t\t\t\t\t<table width='100%'>\n\t\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t\t<td width='30%'>IP Address</td>\n\t\t\t\t\t\t\t\t\t\t\t<td width='70%'><em>" . $info['ip'] . "</em></td>\n\t\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t\t<td width='30%'>Username</td>\n\t\t\t\t\t\t\t\t\t\t\t<td width='70%'><input type='hidden' name='id' value='" . $info['id'] . "' /><input type='text' name='username' value='" . $info['username'] . "' /></td>\n\t\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t\t<td width='30%'>Email</td>\n\t\t\t\t\t\t\t\t\t\t\t<td width='70%'><input type='text' name='email' value='" . $info['email'] . "' /></td>\n\t\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t\t<td width='30%'>Group</td>\n\t\t\t\t\t\t\t\t\t\t\t<td width='70%'><select name='group'>" . user_groups($info['level']) . "</select></td>\n\t\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t\t<td width='30%'>Banned</td>\n\t\t\t\t\t\t\t\t\t\t\t<td width='70%'><input type='checkbox' name='banned' " . ($info['banned'] == 0 ? '' : 'checked="checked"') . " /></td>\n\t\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t\t<td width='30%' valign='top'>Signature</td>\n\t\t\t\t\t\t\t\t\t\t\t<td width='70%'><textarea name='signature' cols='20' rows='5'>" . $info['signature'] . "</textarea></td>\n\t\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t\t<td width='30%'>Avatar</td>\n\t\t\t\t\t\t\t\t\t\t\t<td width='100%'><input type='text' name='avatar' value='" . $info['avatar'] . "' /></td>\n\t\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t\t<td width='30%'>Posts</td>\n\t\t\t\t\t\t\t\t\t\t\t<td width='70%'><input type='text' name='post' value='" . $info['post'] . "' /></td>\n\t\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t\t<td width='100%' colspan='2' align='center'><input type='submit' name='modify' value='Edit Profile' /></td>\n\t\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t</table>\n\t\t\t\t\t\t\t\t</form>\n\t\t\t\t\t\t\t";
                } else {
                    if (!empty($_POST['username']) and !empty($_POST['email'])) {
                        $username = htmlspecialchars($_POST['username']);
                        $id = intval(htmlspecialchars($_POST['id']));
                        $email = htmlspecialchars($_POST['email']);
                        $post = htmlspecialchars($_POST['post']);
                        $signature = htmlspecialchars($_POST['signature']);
                        $avy = htmlspecialchars($_POST['avatar']);
                        $banned = $_POST['id'] == 1 ? 0 : (isset($_POST['banned']) ? 1 : 0);
                        $group = $_POST['id'] == 1 ? 5 : intval(htmlspecialchars($_POST['group']));
                        if ($_POST['id'] == 1) {
                            if ($logged['id'] == 1) {
                                if (mysql_query("UPDATE `users` SET `username` = '" . $username . "',`email` = '" . $email . "', `post` = '" . $post . "',`level` = '" . $group . "',`signature` = '" . $signature . "',`avatar` = '" . $avy . "',`banned` = '" . $banned . "' WHERE `id` = '" . $id . "' ")) {
                                    return "This account was updated successfully.";
                                } else {
                                    return "There was an error inserting data into database, please contact Nevux Ability Boards Support Tech.";
                                }
                            } else {
                                return "Sorry, you can't modify the root account.";
                            }
                        } else {
                            if (mysql_query("UPDATE `users` SET `username` = '" . $username . "',`email` = '" . $email . "', `post` = '" . $post . "',`level` = '" . $group . "',`signature` = '" . $signature . "',`avatar` = '" . $avy . "',`banned` = '" . $banned . "' WHERE `id` = '" . $id . "' ")) {
                                return "This account was updated successfully.";
                            } else {
                                return "There was an error inserting data into database, please contact Nevux Ability Boards Support Tech.";
                            }
                        }
                    } else {
                        return "You either left the email,username or signature field empty, please go back and make sure those fields where not left blank.";
                    }
                }
            }
        } else {
            return "There are no users.";
        }
    }
}
 $crlf;

// display a list of user and their respective progress
$sql = "SELECT U.`surname`, U.`givenname`, U.`id`
		FROM `user` AS U, `course_user` AS CU
		WHERE U.`id`= CU.`user_id`
		AND CU.`course_id` = $course_id
		ORDER BY U.`surname` ASC, U.`givenname` ASC";
$usersList = get_limited_list($sql, 500000);
foreach ($usersList as $user) {
    echo "$crlf";
    $learningPathList = Database::get()->queryArray("SELECT learnPath_id FROM lp_learnPath WHERE course_id = ?d", $course_id);
    $iterator = 1;
    $globalprog = 0;

    foreach ($learningPathList as $learningPath) {
        // % progress
        $prog = get_learnPath_progress($learningPath->learnPath_id, $user->id);
        if ($prog >= 0) {
            $globalprog += $prog;
        }
        $iterator++;
    }
    $total = round($globalprog / ($iterator - 1));
    echo csv_escape(uid_to_name($user->id)) .
    ";" . csv_escape(uid_to_am($user->id)) .
    ";" . csv_escape(user_groups($course_id, $user->id, 'csv')) .
    ";" . $total . "%";
}
echo $crlf;
Пример #9
0
        <div class="form-group">
            <label class="col-sm-2 control-label" for="email">Email Address</label>
            <div class="col-sm-8">
            	<input class="form-control" type="email" id="email" value="<?php 
echo $user->getEmail();
?>
" placeholder="Email Address" readonly="readonly"> 
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-2 control-label" for="group">Group</label>
            <div class="col-sm-8">
                <select id="group" name="group" class="form-control required" required>
                	<?php 
echo user_groups(set_value('group') ?: $user->getGroup()->getId());
?>
                </select>
            <?php 
echo form_error('group');
?>
            </div>
        </div>

        <div class="form-group">
            <div class="col-sm-offset-2 col-sm-8">
                <button type="submit" class="btn btn-info" value="Update">Update</button>
            </div>
        </div>

    </form>
Пример #10
0
echo set_value('email');
?>
" placeholder="Email Address" required>
                <?php 
echo form_error('email');
?>
    
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-2 control-label" for="group">Group</label>
            <div class="col-sm-8">
                <select id="group" name="group" class="form-control required" required>
                	<?php 
echo user_groups(set_value('group'));
?>
                </select>
            <?php 
echo form_error('group');
?>
            </div>
        </div>

        <div class="form-group">
            <div class="col-sm-offset-2 col-sm-8">
                <button type="submit" class="btn btn-info" value="Create">Create</button>
            </div>
        </div>

    </form>
Пример #11
0
                        $user_role_controls .= "<a href='{$_SERVER['SCRIPT_NAME']}?course={$course_code}&amp;removeReviewer={$myrow->id}'><img src='{$themeimg}/reviewer_remove.png' alt='{$langRemoveRightReviewer}' title='{$langRemoveRightReviewer}'></a>";
                    } else {
                        $user_role_controls .= "<a href='{$_SERVER['SCRIPT_NAME']}?course={$course_code}&amp;giveReviewer={$myrow->id}'><img src='{$themeimg}/reviewer_add.png' alt='{$langGiveRightReviewer}' title='{$langGiveRightReviewer}'></a>";
                    }
                }
            } else {
                if ($myrow->reviewer == '1') {
                    $user_role_controls .= "<img src='{$themeimg}/reviewer.png' alt='{$langOpenCoursesReviewer}' title='{$langOpenCoursesReviewer}'>";
                } else {
                    // do nothing as the course teacher cannot make himeself a reviewer
                    $user_role_controls .= "";
                }
            }
        }
        //setting datables column data
        $data['aaData'][] = array('DT_RowId' => $myrow->id, 'DT_RowClass' => 'smaller', '0' => $iterator, '1' => display_user($myrow->id) . "&nbsp<span>(<a href='mailto:" . $myrow->email . "'>" . $myrow->email . "</a>) {$am_message}</span>", '2' => user_groups($course_id, $myrow->id), '3' => $date_field, '4' => $user_role_controls);
        $iterator++;
    }
    echo json_encode($data);
    exit;
}
$limit = isset($_REQUEST['limit']) ? intval($_REQUEST['limit']) : 0;
$toolName = $langUsers;
load_js('tools.js');
load_js('datatables');
load_js('datatables_filtering_delay');
$head_content .= "\r\n<script type='text/javascript'>\r\n        \$(document).ready(function() {\r\n           var oTable = \$('#users_table{$course_id}').dataTable ({\r\n                'bStateSave': true,\r\n                'bProcessing': true,\r\n                'bServerSide': true,\r\n                'sScrollX': true,\r\n                'sDom': '<\"top\"pfl<\"clear\">>rt<\"bottom\"ip<\"clear\">>',\r\n                'sAjaxSource': '{$_SERVER['REQUEST_URI']}',                   \r\n                'aLengthMenu': [\r\n                   [10, 15, 20 , -1],\r\n                   [10, 15, 20, '{$langAllOfThem}'] // change per page values here\r\n               ],                    \r\n                'sPaginationType': 'full_numbers',              \r\n                'bSort': true,\r\n                'aoColumnDefs': [{ 'bSortable': false, 'aTargets': [ 0 ] }, { 'bSortable': false, 'aTargets': [ 2 ] }, { 'bSortable': false, 'aTargets': [ 4 ] }],\r\n                'oLanguage': {                       \r\n                       'sLengthMenu':   '{$langDisplay} _MENU_ {$langResults2}',\r\n                       'sZeroRecords':  '" . $langNoResult . "',\r\n                       'sInfo':         '{$langDisplayed} _START_ {$langTill} _END_ {$langFrom2} _TOTAL_ {$langTotalResults}',\r\n                       'sInfoEmpty':    '{$langDisplayed} 0 {$langTill} 0 {$langFrom2} 0 {$langResults2}',\r\n                       'sInfoFiltered': '',\r\n                       'sInfoPostFix':  '',\r\n                       'sSearch':       '" . $langSearch . "',\r\n                       'sUrl':          '',\r\n                       'oPaginate': {\r\n                           'sFirst':    '&laquo;',\r\n                           'sPrevious': '&lsaquo;',\r\n                           'sNext':     '&rsaquo;',\r\n                           'sLast':     '&raquo;'\r\n                       }\r\n                   }\r\n            }).fnSetFilteringDelay(1000);\r\n            \$(document).on( 'click','.delete_btn', function (e) {\r\n                e.preventDefault();\r\n                if (confirmation('" . js_escape($langDeleteUser) . " " . js_escape($langDeleteUser2) . "')) {\r\n                    var row_id = \$(this).closest('tr').attr('id');\r\n                    \$.ajax({\r\n                      type: 'POST',\r\n                      url: '',\r\n                      datatype: 'json',\r\n                      data: {\r\n                        action: 'delete', \r\n                        value: row_id\r\n                      },\r\n                      success: function(data){\r\n                        var num_page_records = oTable.fnGetData().length;\r\n                        var per_page = oTable.fnPagingInfo().iLength;\r\n                        var page_number = oTable.fnPagingInfo().iPage;\r\n                        if(num_page_records==1){\r\n                            if(page_number!=0) {\r\n                                page_number--;\r\n                            }\r\n                        }\r\n                        \$('#tool_title').after('<p class=\"success\">{$langUserDeleted}</p>');\r\n                        \$('.success').delay(3000).fadeOut(1500);    \r\n                        oTable.fnPageChange(page_number);\r\n                      },\r\n                      error: function(xhr, textStatus, error){\r\n                          console.log(xhr.statusText);\r\n                          console.log(textStatus);\r\n                          console.log(error);\r\n                      }\r\n                    });                    \r\n                 }\r\n            });\r\n            \$('.dataTables_filter input').attr('placeholder', '{$langName}, Username, Email');\r\n            \$('.success').delay(3000).fadeOut(1500);\r\n        });\r\n        </script>";
$limit_sql = '';
// Handle user removal / status change
if (isset($_GET['giveAdmin'])) {
    $new_admin_gid = intval($_GET['giveAdmin']);
Пример #12
0
 * For a full list of contributors, see "credits.txt".
 *
 * Open eClass is an open platform distributed in the hope that it will
 * be useful (without any warranty), under the terms of the GNU (General
 * Public License) as published by the Free Software Foundation.
 * The full license can be read in "/info/license/license_gpl.txt".
 *
 * Contact address: GUnet Asynchronous eLearning Group,
 *                  Network Operations Center, University of Athens,
 *                  Panepistimiopolis Ilissia, 15784, Athens, Greece
 *                  e-mail: info@openeclass.org
 * ======================================================================== */
$require_current_course = true;
$require_course_admin = true;
include '../../include/init.php';
if (isset($_GET['enc']) and $_GET['enc'] == '1253') {
    $charset = 'Windows-1253';
} else {
    $charset = 'UTF-8';
}
$crlf = "\r\n";
header("Content-Type: text/csv; charset={$charset}");
header("Content-Disposition: attachment; filename=listusers.csv");
echo join(';', array_map("csv_escape", array($langSurname, $langName, $langEmail, $langAm, $langUsername, $langGroups)));
echo $crlf;
echo $crlf;
$sql = Database::get()->queryArray("SELECT user.id, user.surname, user.givenname, user.email, user.am, user.username\n                        FROM course_user, user\n                        WHERE `user`.`id` = `course_user`.`user_id` AND\n                              `course_user`.`course_id` = ?d\n                        ORDER BY user.surname, user.givenname", $course_id);
foreach ($sql as $a) {
    echo join(';', array_map("csv_escape", array($a->surname, $a->givenname, $a->email, $a->am, $a->username, user_groups($course_id, $a->id, 'txt'))));
    echo "{$crlf}";
}
require_once 'include/lib/learnPathLib.inc.php';
require_once 'modules/group/group_functions.php';
if (isset($_GET['enc']) and $_GET['enc'] == '1253') {
    $charset = 'Windows-1253';
} else {
    $charset = 'UTF-8';
}
$crlf = "\r\n";
header("Content-Type: text/csv; charset={$charset}");
header("Content-Disposition: attachment; filename=userslearningpathstats.csv");
echo join(';', array_map("csv_escape", array($langStudent, $langAm, $langGroup, $langProgress))), $crlf;
// display a list of user and their respective progress
$sql = "SELECT U.`surname`, U.`givenname`, U.`id`\n\t\tFROM `user` AS U, `course_user` AS CU\n\t\tWHERE U.`id`= CU.`user_id`\n\t\tAND CU.`course_id` = {$course_id}\n\t\tORDER BY U.`surname` ASC, U.`givenname` ASC";
$usersList = get_limited_list($sql, 500000);
foreach ($usersList as $user) {
    echo "{$crlf}";
    $learningPathList = Database::get()->queryArray("SELECT learnPath_id FROM lp_learnPath WHERE course_id = ?d", $course_id);
    $iterator = 1;
    $globalprog = 0;
    foreach ($learningPathList as $learningPath) {
        // % progress
        $prog = get_learnPath_progress($learningPath->learnPath_id, $user->id);
        if ($prog >= 0) {
            $globalprog += $prog;
        }
        $iterator++;
    }
    $total = round($globalprog / ($iterator - 1));
    echo csv_escape(uid_to_name($user->id)) . ";" . csv_escape(uid_to_am($user->id)) . ";" . csv_escape(user_groups($course_id, $user->id, 'csv')) . ";" . $total . "%";
}
echo $crlf;
Пример #14
0
    // list available learning paths
    $learningPathList = Database::get()->queryArray("SELECT learnPath_id FROM lp_learnPath WHERE course_id = ?d", $course_id);

    $iterator = 1;
    $globalprog = 0;
    
    $tool_content .= "  <tr>";
    foreach ($learningPathList as $learningPath) {
        // % progress
        $prog = get_learnPath_progress($learningPath->learnPath_id, $user->id);
        if ($prog >= 0) {
            $globalprog += $prog;
        }
        $iterator++;
    }
    $total = round($globalprog / ($iterator - 1));
    $tool_content .= 
            '    <td><a href="detailsUser.php?course=' . $course_code . '&amp;uInfo=' . $user->id . '&amp;uName=' . $user->givenname . '">' .  profile_image($user->id, IMAGESIZE_SMALL, 'img-circle')."&nbsp;". q($user->surname) . ' ' . q($user->givenname) . '</a></td>'
            . '    <td class="text-center">' . q(uid_to_am($user->id)) . '</td>'
            . '    <td class="text-left">' . user_groups($course_id, $user->id) . '</td>'
            . '    <td class="text-right" width=\'120\'>'
            . disp_progress_bar($total, 1)
            . '</td>'
            . '</tr>';
    $k++;
}
// foot of table
$tool_content .= '</table></div>';

draw($tool_content, 2, null, $head_content);