示例#1
0
                         <label class='col-sm-2 control-label'>$langEditAuthMethod:</label>
                           <div class='col-sm-10'>" . selection($auth_names, 'auth', intval($current_auth), "class='form-control'") . "</div>
                         </div>
                         <div class='col-sm-offset-2 col-sm-10'>
                             <input class='btn btn-primary' type='submit' name='submit_editauth' value='$langModify'>
                           </div>
                         <input type='hidden' name='u' value='$u'>
                         </fieldset>
                         </form>
                         </div>";
     draw($tool_content, 3, null, $head_content);
     exit;
 }
 if (!$u_submitted) { // if the form was not submitted
     // Display Actions Toolbar
     $ind_u = getIndirectReference($u);
     $tool_content .= action_bar(array(
         array('title' => $langUserMerge,
             'url' => "mergeuser.php?u=$u",
             'icon' => 'fa-share-alt',
             'level' => 'primary-label',
             'show' => ($u != 1 and get_admin_rights($u) < 0)),
         array('title' => $langChangePass,
             'url' => "password.php?userid=$u",
             'icon' => 'fa-key',
             'level' => 'primary-label',
             'show' => !(in_array($info->password, $auth_ids))),
         array('title' => $langEditAuth,
             'url' => "$_SERVER[SCRIPT_NAME]?u=$u&amp;edit=auth",
             'icon' => 'fa-key',
             'level' => 'primary'),
示例#2
0
            $tool_content .= "<div class='alert alert-warning'>$langMailNotVerified $link</div>";
        }
    }
    if (!get_user_email_notification_from_courses($uid)) {
        $head_content .= '<script type="text/javascript">$(control_deactivate);</script>';
        $tool_content .= "<div class='alert alert-info'>$langEmailUnsubscribeWarning</div>
                                  <input type='checkbox' id='unsub' name='unsub' value='1'>&nbsp;$langEmailFromCourses";
    }
    $tool_content .= "<div class='alert alert-info'>$langInfoUnsubscribe</div>
                          <div id='unsubscontrols'>";
    if (isset($_REQUEST['cid'])) { // one course only
        $cid = intval($_REQUEST['cid']);
        $course_title = course_id_to_title($cid);
        $selected = get_user_email_notification($uid, $cid) ? 'checked' : '';
        $tool_content .= "<input type='checkbox' name='c_unsub' value='1' $selected>&nbsp;" . q($course_title) . "<br />";
        $tool_content .= "<input type='hidden' name='cid' value='" . getIndirectReference($cid) . "'>";
    } else { // displays all courses
        foreach ($_SESSION['courses'] as $code => $status) {
            $title = course_code_to_title($code);
            $cid = course_code_to_id($code);
            $selected = get_user_email_notification($uid, $cid) ? 'checked' : '';
            $tool_content .= "<input type='checkbox' name='c_unsub[$code]' value='1' $selected>&nbsp;" . q($title) . "<br />";
        }
    }
    $tool_content .= "</div>
                    <br>
                        <input class='btn btn-primary' type='submit' name='submit' value='$langSubmit'>
                        <a class='btn btn-default' href='display_profile.php'>$langCancel<a>";
    $tool_content .= generate_csrf_token_form_field() ."</form>";
}
示例#3
0
            } else {
                $definition_data = '-';
            }

            $tool_content .= "<tr>
                     <td width='150'><strong><a href='$base_url&amp;id=" . getIndirectReference($g->id) . "'>" . q($g->term) . "</a></strong><br><span><small>$cat_descr</small></span></td>
                     <td><em>$definition_data</em>$urllink</td>";

            if ($is_editor) {
                $tool_content .= "<td class='option-btn-cell'>";
                $tool_content .= action_button(array(
                        array('title' => $langEditChange,
                              'url' => "$edit_url&amp;edit=" . getIndirectReference($g->id),
                              'icon' => 'fa-edit'),
                        array('title' => $langDelete,
                              'url' => "$edit_url&amp;delete=" . getIndirectReference($g->id),
                              'icon' => 'fa-times',
                              'class' => 'delete',
                              'confirm' => $langConfirmDelete))
                    );
               $tool_content .= "</td>";
            }                        
            $tool_content .= "</tr>";        
        }
        $tool_content .= "</table></div>";
    } else {
        $tool_content .= "<br><div class='alert alert-warning'>$langNoResult</div>";
    }
}
draw($tool_content, 2, null, $head_content);
示例#4
0
                $tip = $langStudent;
                break;
            case USER_GUEST:
                $icon = 'fa-male';
                $tip = $langVisitor;
                break;
            default:
                $icon = false;
                $tip = $langOther;
                break;
        }

        if ($logs->id == 1) { // don't display actions for admin user
            $icon_content = "&mdash;&nbsp;";
        } else {
            $iuid = getIndirectReference($logs->id);
            $changetip = q("$langChangeUserAs $logs->username");
            $icon_content = action_button(array(
                array(
                    'title' => $langEditChange,
                    'icon' => 'fa-edit',
                    'url' => "edituser.php?u=$logs->id"
                ),
                array(
                    'title' => $langActions,
                    'icon' => 'fa-list-alt',
                    'url' => "userlogs.php?u=$logs->id"
                ),
                array(
                    'title' => $changetip,
                    'icon' => 'fa-key',
示例#5
0
                           'icon' => 'fa-arrow-down',
                           'disabled' => $cu->id == $last_id),
                     array('title' => $langUp,
                           'level' => 'primary',
                           'url' => "$_SERVER[SCRIPT_NAME]?up=". getIndirectReference($cu->id),
                           'icon' => 'fa-arrow-up',
                           'disabled' => $count_index == 1),
                     array('title' => $vis == 1? $langViewHide : $langViewShow,
                           'url' => "$_SERVER[SCRIPT_NAME]?vis=". getIndirectReference($cu->id),
                           'icon' => $vis == 1? 'fa-eye-slash' : 'fa-eye'),
                     array('title' => $access == 1? $langResourceAccessLock : $langResourceAccessUnlock,
                           'url' => "$_SERVER[SCRIPT_NAME]?access=". getIndirectReference($cu->id),
                           'icon' => $access == 1? 'fa-lock' : 'fa-unlock',
                           'show' => $visible == COURSE_OPEN),
                     array('title' => $langDelete,
                           'url' => "$_SERVER[SCRIPT_NAME]?del=". getIndirectReference($cu->id),
                           'icon' => 'fa-times',
                           'class' => 'delete',
                           'confirm' => $langCourseUnitDeleteConfirm))) .
                 '</div>';
             }
         }
                     $cunits_content .= "</div>	
                                     <div class='item-body'>";
                     $cunits_content .= ($cu->comments == ' ')?'':$cu->comments;
                     $cunits_content .= "</div></div>";
         $cunits_content .= "</div></div></div>";            
     }
 } else {
     $cunits_content .= "<div class='col-sm-12'><div class='panel'><div class='panel-body not_visible'> - $langNoUnits - </div></div></div>";
 }
示例#6
0
             Database::get()->query("UPDATE attendance_activities SET `title` = ?s, date = ?t, 
                                             description = ?s, `auto` = ?d
                                         WHERE id = ?d", $actTitle, $actDate, $actDesc, $auto, $id);
             Session::Messages("$langGradebookEdit", "alert-success");
             redirect_to_home_page("modules/attendance/index.php?course=$course_code&attendance_id=$attendance_id");
         } else {
             //insert
             $insertAct = Database::get()->query("INSERT INTO attendance_activities SET attendance_id = ?d, title = ?s, 
                                                         `date` = ?t, description = ?s", 
                                                 $attendance_id, $actTitle, $actDate, $actDesc);
             Session::Messages("$langGradebookSucInsert","alert-success");
             redirect_to_home_page("modules/attendance/index.php?course=$course_code&attendance_id=$attendance_id");
         }            
     } else {
         Session::flashPost()->Messages($langFormErrors)->Errors($v->errors());
         $new_or_edit = $_POST['id'] ?  "&modify=".getIndirectReference($_POST['id']) : "&addActivity=1";
         redirect_to_home_page("modules/attendance/index.php?course=$course_code&attendance_id=".$attendance_id.$new_or_edit);            
     }        
 }
 
 elseif (isset($_GET['delete'])) {
     delete_attendance_activity($attendance_id, getDirectReference($_GET['delete']));
     redirect_to_home_page("modules/attendance/index.php?course=$course_code&attendance_id=$attendance_id");
 
 // delete attendance
 } elseif (isset($_GET['delete_at'])) {        
     delete_attendance($_GET['delete_at']);
     redirect_to_home_page("modules/attendance/index.php?course=$course_code");
 }
 
 //DISPLAY: list of users and form for each user
示例#7
0
/**
 * @brief insert user presence
 * @global string $tool_content
 * @global type $langGradebookEdit
 * @param type $attendance_id
 * @param type $actID
 */
function insert_presence($attendance_id, $actID) {
      
    global $tool_content, $langGradebookEdit, $course_code;

    if (isset($_POST['userspresence'])) {
       
        $to_be_inserted = array_keys($_POST['userspresence']);
        $already_inserted = [];
        Database::get()->queryFunc("SELECT uid FROM attendance_book 
                                        WHERE attendance_activity_id = ?d", 
        function($attendance_book) use (&$already_inserted){
            array_push($already_inserted, $attendance_book->uid);
        },$actID);
        
        $to_be_deleted = array_diff($already_inserted, $to_be_inserted);
        foreach ($to_be_deleted as $row) {
            Database::get()->query("DELETE FROM attendance_book WHERE attendance_activity_id = ?d AND uid = ?d", $actID, $row);
        }      
        foreach ($to_be_inserted as $row) {
            // check if there is record for the user for this activity
            $checkForBook = Database::get()->querySingle("SELECT COUNT(id) AS count, id FROM attendance_book 
                                        WHERE attendance_activity_id = ?d AND uid = ?d", $actID, $row);
            if (!$checkForBook->count) {
                Database::get()->query("INSERT INTO attendance_book SET uid = ?d, attendance_activity_id = ?d, attend = ?d, comments = ?s", $row, $actID, 1, '');
            }
        }
    } else {
        Database::get()->query("DELETE FROM attendance_book WHERE attendance_activity_id = ?d", $actID);
    }
    Session::Messages($langGradebookEdit, 'alert-success');
    redirect_to_home_page("modules/attendance/index.php?course=$course_code&attendance_id=$attendance_id&ins=".  getIndirectReference($actID));
}
示例#8
0
                        $langCourseWeeklyFormat
                      </label>
                    </div>                         
                </div>                    
            </div>
            <div class='form-group'>
                <div class='col-sm-10 col-sm-offset-2' id='weeklyDates'>
                        $langStartDate 
                        <input class='dateInForm form-control' type='text' name='start_date' value='".($c->start_date != "0000-00-00" ? $c->start_date : "")."' readonly>                       
                        $langEndDate
                        <input class='dateInForm form-control' type='text' name='finish_date' value='".($c->finish_date != "0000-00-00" ? $c->finish_date : "")."' readonly>
                </div>
            </div>";

    if ($isOpenCourseCertified) {
        $tool_content .= "<input type='hidden' name='course_license' value='" . getIndirectReference($course_license) . "'>";
    }
    $language = $c->lang;
    $tool_content .= "        
            <div class='form-group'>
                <label class='col-sm-2 control-label'>$langOpenCoursesLicense:</label>
                <div class='col-sm-10'>
                    <div class='radio'>
                      <label>
                        <input type='radio' name='l_radio' value='0'$license_checked[0]$disabledVisibility>
                        {$license[0]['title']}
                      </label>
                    </div>
                    <div class='radio'>
                      <label>
                        <input type='radio' name='l_radio' value='10'$license_checked[10]$disabledVisibility>
示例#9
0
        foreach ($q as $cat) {        
            if ($cat->description) {
                $desc = "<br>" . standard_text_escape($cat->description);
            } else {
                $desc = '';
            }        
            $tool_content .= "<tr><td class='space-left'><a href='$base_url&amp;cat=" . getIndirectReference($cat->id) . "'><strong>" . q($cat->name) . "</strong></a><small><span class='text-muted'>$desc</span></small></td>";                       
            if ($is_editor) {
                $tool_content .= "<td class='option-btn-cell'>";
                $tool_content .= action_button(array(
                        array('title' => $langCategoryMod,
                              'url' => "$cat_url&amp;edit=" . getIndirectReference($cat->id),
                              'icon' => 'fa-edit'),
                        array('title' => $langCategoryDel,
                              'url' => "$cat_url&amp;delete=" . getIndirectReference($cat->id),
                              'icon' => 'fa-times',
                              'class' => 'delete',
                              'confirm' => $langConfirmDelete))
                    );
               $tool_content .= "</td>";                        
            }
            $tool_content .= "</tr>";
        }
        $tool_content .= "</table></div>";
    } else {
        $tool_content .= "<br><br><br><div class='alert alert-warning'>$langNoResult</div>";
    }
}

draw($tool_content, 2, null, $head_content);
示例#10
0
            $tool_content .= "<script type='text/javascript' src='../auth/sorttable.js'></script>
                <table width='100%' class='sortable' id='t7' align='left'>
        <tr>
                  <th colspan='2' class='left'>$langLinks:</th>
                </tr>";

            $numLine = 0;
            foreach ($linkHits as $linkHit) {
                $link = Database::get()->querySingle("SELECT title, description FROM link WHERE id = ?d", $linkHit->pkid);                

                $class = ($numLine % 2) ? 'odd' : 'even';
                $tool_content .= "<tr class='$class'>
                    <td width='1' valign='top'><img style='padding-top:3px;' src='$themeimg/arrow.png' title='bullet' /></td>
                    <td>";
                $desc_text = (empty($link->description)) ? "" : "<span class='smaller'>" . $link->description . "</span>";
                $tool_content .= "<a href='" . $urlServer . "modules/link/go.php?course=" . course_id_to_code($linkHit->courseid) . "&amp;id=" . getIndirectReference($linkHit->pkid) . "&amp;url=" .
                urlencode($linkHit->url) . "' target=_blank> " . q($link->title) . "</a> $desc_text </td></tr>";
                $numLine++;
            }
            $tool_content .= "</table>";
            $found = true;
        }
    }

    // search in video and videolinks
    if ($video) {
        $videoHits = $idx->searchRaw(VideoIndexer::buildQuery($_POST));
        $vlinkHits = $idx->searchRaw(VideolinkIndexer::buildQuery($_POST));
        if (count($videoHits) > 0) {
            $tool_content .= "<script type='text/javascript' src='../auth/sorttable.js'></script>
                <table width='99%' class='sortable'  id='t8' align='left'>
示例#11
0
    switch ($row->privilege) {
        case '0': $message = $langAdministrator;
            break;
        case '1': $message = $langPowerUser;
            break;
        case '2': $message = $langManageUser;
            break;
        case '3' : $message = $langManageDepartment;
            break;
    }
    $tool_content .= "<td align='left'>$message</td>";
    if ($row->id != 1) {
        $tool_content .="<td class='center'>" .
                action_button(array(
                    array('title' => $langDelete,
                        'url' => "$_SERVER[SCRIPT_NAME]?delete=1&amp;aid=" . q(getIndirectReference($row->id)),
                        'class' => 'delete',
                        'icon' => 'fa-times'),
                )) .
                "</td>";
    } else {
        $tool_content .= "<td class='center'></td>";
    }
    $tool_content .= "</tr>";
});
$tool_content .= "</table>";

draw($tool_content, 3);


/**
示例#12
0
                action_button(array(
                    array('title' => $langEditChange,
                        'url' => "$_SERVER[SCRIPT_NAME]?modify=" . getIndirectReference($note->id),
                        'icon' => 'fa-edit'),
                    array('title' => $langDelete,
                        'url' => "$_SERVER[SCRIPT_NAME]?delete=" . getIndirectReference($note->id),
                        'confirm' => $langSureToDelNote,
                        'class' => 'delete',
                        'icon' => 'fa-times'),
                    array('title' => $langMove . " " . $langUp,
                        'url' => "$_SERVER[SCRIPT_NAME]?up=" . getIndirectReference($note->id),
                        'level' => 'primary',
                        'disabled' => $iterator == 1,
                        'icon' => 'fa-arrow-up'),
                    array('title' => $langMove . " " . $langDown,
                        'url' => "$_SERVER[SCRIPT_NAME]?down=" . getIndirectReference($note->id),
                        'level' => 'primary',
                        'disabled' => $iterator >= $bottomNote,
                        'icon' => 'fa-arrow-down')
                )) .
                "</td>";

        $tool_content .= "</tr>";
        $iterator ++;
    } // end of while
    $tool_content .= "</table></div>";

    if ($noteNumber < 1) {
        $no_content = true;
        if (isset($_GET['addNote'])) {
            $no_content = false;
示例#13
0
.generate_csrf_token_form_field() .<<<tForm
    </form>
</div>
tForm;

// display table to edit/delete external links
$tool_content .= "<table class='table-default'>
<tr><th colspan='2'>$langOperations</th></tr>
<tr>  
  <th width='90%' class='text-left'>$langTitle</th>
  <th class='text-center'>".icon('fa-gears')."</th>
</tr>";
$q = Database::get()->queryArray("SELECT id, title FROM link
                        WHERE category = -1 AND
                        course_id = ?d", $course_id);
foreach ($q as $externalLinks) {
    $tool_content .= "<td class='text-left'>" . q($externalLinks->title) . "</td>";
    $tool_content .= "<td class='text-center'>";
    $tool_content .= action_button(array(
                array('title' => $langDelete,
                      'url' => "?course=$course_code&amp;delete=".getIndirectReference($externalLinks->id),
                      'icon' => 'fa-times',
                      'class' => 'delete',
                      'confirm' => $langConfirmDelete)
            ));
    $tool_content .= "</td></tr>";
}
$tool_content .= "</table>";

draw($tool_content, 2, null, $head_content);
示例#14
0
/**
 * @brief Print a box with the details of a bbb session
 * @global type $course_id
 * @global type $tool_content
 * @global type $is_editor
 * @global type $langNewBBBSessionStart
 * @global type $langNewBBBSessionType
 * @global type $langConfirmDelete
 * @global type $langNewBBBSessionPublic
 * @global type $langNewBBBSessionPrivate
 * @global type $langBBBSessionJoin
 * @global type $langNewBBBSessionDesc
 * @global type $course_code
 * @global type $langNote
 * @global type $langBBBNoteEnableJoin
 * @global type $langTitle
 * @global type $langActivate
 * @global type $langDeactivate
 * @global type $langModify
 * @global type $langDelete
 */
function bbb_session_details() {
    global $course_id, $tool_content, $is_editor, $course_code, $head_content,
        $langNewBBBSessionStart, $langNewBBBSessionType, $langParticipants,
        $langConfirmDelete, $langNewBBBSessionPublic, $langNewBBBSessionPrivate,
        $langBBBSessionJoin, $langNewBBBSessionDesc, $langNote,
        $langBBBNoteEnableJoin, $langTitle,$langActivate, $langDeactivate,
        $langEditChange, $langDelete, $langNoBBBSesssions, $langDaysLeft, $m,
        $langBBBNotServerAvailableStudent, $langBBBNotServerAvailableTeacher,
        $langBBBImportRecordings;

    load_js('trunk8');

    $myGroups = Database::get()->queryArray("SELECT group_id FROM group_members WHERE user_id=?d", $_SESSION['uid']);

    $activeClause = $is_editor? '': "AND active = '1'";
    $result = Database::get()->queryArray("SELECT * FROM bbb_session
        WHERE course_id = ?s $activeClause ORDER BY start_date DESC", $course_id);
    if (get_total_bbb_servers() == '0') {
        if ($is_editor) {
            $tool_content .= "<p class='alert alert-danger'><b>$langNote</b>:<br />$langBBBNotServerAvailableTeacher</p>";
        } else {
            $tool_content .= "<p class='alert alert-danger'><b>$langNote</b>:<br />$langBBBNotServerAvailableStudent</p>";
        }
    } elseif ($result) {
        if (!$is_editor) {
            $tool_content .= "<div class='alert alert-info'><label>$langNote</label>:<br>$langBBBNoteEnableJoin</div>";
        }
        $headingsSent = false;
        $headings = "<div class='row'>
                       <div class='col-md-12'>
                         <div class='table-responsive'>
                           <table class='table-default'>
                             <tr class='list-header'>
                               <th style='width:25%'>$langTitle</th>
                               <th class='text-center'>$langNewBBBSessionDesc</th>
                               <th class='text-center'>$langNewBBBSessionStart</th>
                               <th class='text-center'>$langParticipants</th>
                               <th class='text-center'>".icon('fa-gears')."</th>
                             </tr>";

        define('DAY_MINUTES', 24 * 40);
        foreach ($result as $row) {
            $participants = '';
            // Get participants
            $r_group = explode(",",$row->participants);
            foreach ($r_group as $participant_uid) {
                if ($participants) {
                    $participants .= ', ';
                }
                $participant_uid = str_replace("'", '', $participant_uid);
                if (preg_match('/^_/', $participant_uid)) {
                    $participants .= gid_to_name(str_replace("_", '', $participant_uid));
                } else {
                    $participants .= uid_to_name($participant_uid, 'fullname');
                }
            }
            $participants = "<span class='trunk8'>$participants</span>";
            $id = $row->id;
            $title = $row->title;
            $start_date = $row->start_date;
            $timeLeft = date_diff_in_minutes($start_date, date('Y-m-d H:i:s'));
            $timeLabel = $start_date;
            if ($timeLeft > 0) {
                $timeLabel .= "<br><span class='label label-warning'><small>$langDaysLeft " .
                    format_time_duration($timeLeft * 60) .
                    "</small></span>";
            } elseif (-$timeLeft > DAY_MINUTES) {
                $timeLabel .= "<br><span class='label label-danger'><small>$m[expired]</small></span>";
            }

            // $row->public == '1' ? $type = $langNewBBBSessionPublic: $type = $langNewBBBSessionPrivate;
            $meeting_id = $row->meeting_id;
            $att_pw = $row->att_pw;
            $mod_pw = $row->mod_pw;
            $record = $row->record;
            $desc = isset($row->description)? $row->description: '';

            $canJoin = $row->active == '1' &&
                $timeLeft < $row->unlock_interval &&
                -$timeLeft < DAY_MINUTES &&
                get_total_bbb_servers() <> '0';
            if ($canJoin) {
                if($is_editor)
                {
                    $joinLink = "<a href='$_SERVER[SCRIPT_NAME]?course=$course_code&amp;choice=do_join&amp;meeting_id=" . urlencode($meeting_id) . "&amp;title=".urlencode($title)."&amp;att_pw=".urlencode($att_pw)."&amp;mod_pw=".urlencode($mod_pw)."&amp;record=$record' target='_blank'>" . q($title) . "</a>";
                }else
                {
                    //$joinLink = "<a href='$_SERVER[SCRIPT_NAME]?course=$course_code&amp;choice=do_join&amp;meeting_id=" . urlencode($meeting_id) . "&amp;att_pw=".urlencode($att_pw)."' target='_blank'>" . q($title) . "</a>";
                    $joinLink = "<a href='$_SERVER[SCRIPT_NAME]?course=$course_code&amp;choice=do_join&amp;meeting_id=" . urlencode($meeting_id) . "&amp;title=".urlencode($title)."&amp;att_pw=".urlencode($att_pw)."&amp;record=$record' target='_blank'>" . q($title) . "</a>";
                }
            } else {
                $joinLink = q($title);
            }

            if ($is_editor) {
                if (!$headingsSent) {
                    $tool_content .= $headings;
                    $headingsSent = true;
                }
                $tool_content .= '<tr' . ($row->active? '': " class='not_visible'") . ">
                    <td class='text-left'>$joinLink</td>
                    <td>$desc</td>
                    <td class='text-center'>$timeLabel</td>
                    <td style='width: 30%'>$participants</td>
                    <td class='option-btn-cell'>".
                        action_button(array(
                            array(  'title' => $langEditChange,
                                    'url' => "$_SERVER[SCRIPT_NAME]?course=$course_code&amp;id=" . getIndirectReference($id) . "&amp;choice=edit",
                                    'icon' => 'fa-edit'),
                            array(  'title' => $langBBBImportRecordings,
                                    'url' => "$_SERVER[SCRIPT_NAME]?course=$course_code&amp;id=" . getIndirectReference($row->id) . "&amp;choice=import_video",
                                    'icon' => "fa-edit"),
                            array(  'title' => $row->active? $langDeactivate : $langActivate,
                                    'url' => "$_SERVER[SCRIPT_NAME]?course=$course_code&amp;id=" . getIndirectReference($row->id) . "&amp;choice=do_".
                                             ($row->active? 'disable' : 'enable'),
                                    'icon' => $row->active ? 'fa-eye': 'fa-eye-slash'),
                            array(  'title' => $langDelete,
                                    'url' => "$_SERVER[SCRIPT_NAME]?course=$course_code&amp;id=" . getIndirectReference($row->id) . "&amp;choice=do_delete",
                                    'icon' => 'fa-times',
                                    'class' => 'delete',
                                    'confirm' => $langConfirmDelete)
                            )) .
                    "</td></tr>";
            } else {
                // Allow access to session only if user is in participant group or session is scheduled for everyone
                $access = false;
                if(!empty($r_group) && count($r_group)>0 && $r_group[0]<>'')
                {
                    foreach ($myGroups as $mg) {
                        if (in_array("'_" . $mg->group_id . "'", $r_group)) {
                            $access = true;
                        }
                }
                }else{
                    $access = true;
                }
                // Always allow access to editor switched to student view
                $access = $access || in_array("'".$_SESSION['uid']."'", $r_group) ||
                    (isset($_SESSION['student_view']) and $_SESSION['student_view'] == $course_code);

                if ($access) {
                    if (!$headingsSent) {
                        $tool_content .= $headings;
                        $headingsSent = true;
                    }
                    $tool_content .= "<tr>
                        <td class='text-center'>$joinLink</td>
                        <td>$desc</td>
                        <td class='text-center'>$timeLabel</td>
                        <td style='width: 30%'>$participants</td>
                        <td class='text-center'>";
                    // Join url will be active only X minutes before scheduled time and if session is visible for users
                    if ($canJoin) {
                        $tool_content .= icon('fa-sign-in', $langBBBSessionJoin,"$_SERVER[SCRIPT_NAME]?course=$course_code&amp;choice=do_join&amp;title=".urlencode($title)."&amp;meeting_id=" . urlencode($meeting_id) . "&amp;att_pw=".urlencode($att_pw)."&amp;record=$record' target='_blank");
                    } else {
                        $tool_content .= "-</td>";
                    }
                    $tool_content .= "</tr>";
                }
            }
        }
        if ($headingsSent) {
            $tool_content .= "</table></div></div></div>";
        }

        if (get_total_bbb_servers() == '0') {
            if ($is_editor) {
                $tool_content .= "<p class='alert alert-danger'><b>$langNote</b>:<br />$langBBBNotServerAvailableTeacher</p>";
            } else {
                $tool_content .= "<p class='alert alert-danger'><b>$langNote</b>:<br />$langBBBNotServerAvailableStudent</p>";
            }
        }
        if (!$is_editor and !$headingsSent) {
            $tool_content .= "<div class='alert alert-warning'>$langNoBBBSesssions</div>";
        }
    } else {
        $tool_content .= "<div class='alert alert-warning'>$langNoBBBSesssions</div>";
    }
}
示例#15
0
            $rule = $item->id;
            $statusLabel = q(($item->status == USER_STUDENT)? $langStudents: $langTeachers);
            $rules[$rule] = "
          <div class='panel panel-info'>
            <div class='panel-heading'>
              $langAutoEnrollRule $i
              <div class='pull-right'>" .
              action_button(array(
                  array(
                      'title' => $langEditChange,
                      'icon' => 'fa-edit',
                      'url' => "autoenroll.php?edit=" . getIndirectReference($rule)),
                  array(
                      'title' => $langDelete,
                      'icon' => 'fa-times',
                      'url' => "autoenroll.php?delete=" . getIndirectReference($rule),
                      'confirm' => $langSureToDelRule,
                      'btn_class' => 'delete_btn btn-default'),
              )) . "
              </div>
            </div>
            <div class='panel-body'>
              <div>$langApplyTo: <b>$statusLabel</b> ";

            $deps = Database::get()->queryArray('SELECT hierarchy.id, name
                FROM autoenroll_rule_department, hierarchy
                WHERE autoenroll_rule_department.department = hierarchy.id AND
                      rule = ?d', $rule);
            if ($deps) {
                $rules[$rule] .= $langApplyDepartments . ':<ul>';
                foreach ($deps as $dep) {
示例#16
0
                     array('title' => $row->visible ? $langRemoveFromCourseHome : $langAddToCourseHome,
                         'url' => "$_SERVER[SCRIPT_NAME]?course=$course_code&amp;vis=" . getIndirectReference($row->id),
                         'icon' => $row->visible ? 'fa-eye-slash' : 'fa-eye'
                     ),
                     array('title' => q($langUp),
                         'level' => 'primary',
                         'icon' => 'fa-arrow-up',
                         'url' => "$_SERVER[SCRIPT_NAME]?course=$course_code&amp;up=" . getIndirectReference($row->id),
                         'disabled' => $i <= 0),
                     array('title' => q($langDown),
                         'level' => 'primary',
                         'icon' => 'fa-arrow-down',
                         'url' => "$_SERVER[SCRIPT_NAME]?course=$course_code&amp;down=" . getIndirectReference($row->id),
                         'disabled' => $i + 1 >= count($q)),
                     array('title' => q($langDelete),
                         'url' => "$_SERVER[SCRIPT_NAME]?course=$course_code&amp;del=" . getIndirectReference($row->id),
                         'icon' => 'fa-times',
                         'class' => 'delete',
                         'confirm' => $langConfirmDelete)                            
                 )
         ) ."</div>";
 }
 $tool_content .= "  
       <h3 class='panel-title'>".q($row->title)." ".($row->visible && $is_editor ? "&nbsp;<span data-original-title='$langSeenToCourseHome' data-toggle='tooltip' data-placement='bottom' class='label label-primary'><i class='fa fa-eye'></i></span>" : "")."</h3>      
       </div>
       <div class='panel-body'>"
         .handleType($row->type)."<br><br>"
        . standard_text_escape($row->comments) . 
       "</div>
     </div>";
 $i++;
示例#17
0
    $types[$type->id] = $title;
}

$tool_content .= action_bar(array(
            array('title' => $langBack,
                  'url' => "index.php?course=$course_code",
                  'icon' => 'fa-reply',
                  'level' => 'primary-label')));

$tool_content .= "
    <div class='row'>
        <div class='col-xs-12'>
            <div class='form-wrapper'>
                <form class='form-horizontal' role='form' method='post' action='index.php?course=$course_code'>";
if ($editId !== false) {
    $tool_content .= "<input type='hidden' name='editId' value='" . getIndirectReference($editId) . "' />";
}
$tool_content .= "
                    <fieldset>
                        <div class='form-group'>
                            <label for='typSel' class='col-sm-2 control-label'>$langType:</label>
                            <div class='col-sm-10'>
                            " . selection($types, 'editType', $defaultType, 'class="form-control" id="typSel"') . "
                            </div>
                        </div>
                        <div class='form-group".(Session::getError('editTitle') ? " has-error" : "")."'>
                            <label for='titleSel' class='col-sm-2 control-label'>$langTitle:</label>
                            <div class='col-sm-10'>
                                <input type='text' name='editTitle' class='form-control' value='$cdtitle' size='40' id='titleSel'>
                                <span class='help-block'>".Session::getError('editTitle')."</span>                                    
                            </div>
示例#18
0
  }
 
  //DISPLAY: list of users and form for each user
  elseif(isset($_GET['gradebookBook']) or isset($_GET['book'])) {        
      if (isset($_GET['update']) and $_GET['update']) {
          $tool_content .= "<div class='alert alert-success'>$langAttendanceUsers</div>";
      }
      //record booking
      if(isset($_POST['bookUser'])) {
          if (!isset($_POST['token']) || !validate_csrf_token($_POST['token'])) csrf_token_error();
          $userID = intval(getDirectReference($_POST['userID'])); //user
          //get all the gradebook activies --> for each gradebook activity update or insert grade
          $result = Database::get()->queryArray("SELECT * FROM gradebook_activities  WHERE gradebook_id = ?d", $gradebook_id);
          if ($result) {
              foreach ($result as $activity) {
                  $attend = floatval($_POST[getIndirectReference($activity->id)]); //get the record from the teacher (input name is the activity id)
                  //check if there is record for the user for this activity
                  $checkForBook = Database::get()->querySingle("SELECT id FROM gradebook_book  WHERE gradebook_activity_id = ?d AND uid = ?d", $activity->id, $userID);
                  if($checkForBook){
                      //update
                      Database::get()->query("UPDATE gradebook_book SET grade = ?f WHERE id = ?d ", $attend, $checkForBook->id);
                  } else {
                      //insert
                      Database::get()->query("INSERT INTO gradebook_book SET uid = ?d, gradebook_activity_id = ?d, grade = ?f, comments = ?s", $userID, $activity->id, $attend, '');
                  }
              }
              $message = "<div class='alert alert-success'>$langGradebookEdit</div>";
          }
      }
      // display user grades 
      if(isset($_GET['book'])) {
示例#19
0
/**
 * @brief Enter the modified info submitted from the link form into the database
 * @global type $course_id
 * @global type $langLinkMod
 * @global type $langLinkAdded
 * @global type $urllink
 * @global type $title
 * @global type $description
 * @global type $selectcategory
 * @global type $langLinkNotPermitted
 * @global string $state
 * @return type
 */
function submit_link() {
    global $course_id, $langLinkMod, $langLinkAdded, $course_code, $uid, $langSocialCategory,
    $urllink, $title, $description, $selectcategory, $langLinkNotPermitted, $state;

    register_posted_variables(array('urllink' => true,
        'title' => true,
        'description' => true), 'all', 'trim');
    $urllink = canonicalize_url($urllink);
    if (!is_url_accepted($urllink,"(https?|ftp)")){
        $message = $langLinkNotPermitted;
        if (isset($_POST['id'])) {
            $id =  getDirectReference($_POST['id']);
            redirect_to_home_page("modules/link/index.php?course=$course_code&action=editlink&id=" . getIndirectReference($id) . "&urlview=");
        } else {
            redirect_to_home_page("modules/link/index.php?course=$course_code&action=addlink&urlview=");
        }
    }
    $set_sql = "SET url = ?s, title = ?s, description = ?s, category = ?d";
    $terms = array($urllink, $title, purify($description), intval(getDirectReference($_POST['selectcategory'])));

    if (isset($_POST['id'])) {
        $id = intval(getDirectReference($_POST['id']));
        Database::get()->query("UPDATE `link` $set_sql WHERE course_id = ?d AND id = ?d", $terms, $course_id, $id);

        $log_type = LOG_MODIFY;
    } else {
        $order = Database::get()->querySingle("SELECT MAX(`order`) as maxorder FROM `link`
                                      WHERE course_id = ?d AND category = ?d", $course_id, getDirectReference($_POST['selectcategory']))->maxorder;
        $order++;
        $id = Database::get()->query("INSERT INTO `link` $set_sql, course_id = ?d, `order` = ?d, user_id = ?d", $terms, $course_id, $order, $uid)->lastInsertID;
        $log_type = LOG_INSERT;
    }
    Indexer::queueAsync(Indexer::REQUEST_STORE, Indexer::RESOURCE_LINK, $id);
    // find category name
    if ($selectcategory == -2) {
        $category = $langSocialCategory;
    } else {
        $category_object = Database::get()->querySingle("SELECT link_category.name as name FROM link, link_category
                                                        WHERE link.category = link_category.id
                                                        AND link.course_id = ?s
                                                        AND link.id = ?d", $course_id, $id);
        $category = $category_object ? $category_object->name : 0;
    }
    $txt_description = ellipsize_html(canonicalize_whitespace(strip_tags($description)), 50, '+');
    Log::record($course_id, MODULE_ID_LINKS, $log_type, @array('id' => $id,
        'url' => $urllink,
        'title' => $title,
        'description' => $txt_description,
        'category' => $category));

}
示例#20
0
                'show' => get_config('opencourses_enable') && 
                            (
                                ($myrow->id == $_SESSION["uid"] && $myrow->reviewer == '1') || 
                                ($myrow->id != $_SESSION["uid"] && $is_opencourses_reviewer && $is_admin)
                            )
            )            
        ));
        //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;
示例#21
0
/**
 * @brief insert grades for activity
 * @global string $tool_content
 * @global type $langGradebookEdit
 * @param type $gradebook_id
 * @param type $actID
 */
function insert_grades($gradebook_id, $actID) {

    global $tool_content, $langGradebookEdit, $gradebook, $langTheField, 
           $course_code, $langFormErrors, $m;

    $errors = [];  
    $v = new Valitron\Validator($_POST['usersgrade']);
    $v->addRule('emptyOrNumeric', function($field, $value, array $params) {
        if(is_numeric($value) || empty($value)) return true;
    });    
    foreach ($_POST['usersgrade'] as $userID => $userInp) {
        $v->rule('emptyOrNumeric', array("$userID"));
        $v->rule('min', array("$userID"), 0);
        $v->rule('max', array("$userID"), $gradebook->range);
        $v->labels(array(
            "$userID" => "$langTheField $m[grade]"
        ));
    }
    if($v->validate()) {
        foreach ($_POST['usersgrade'] as $userID => $userInp) {
            if ($userInp == '') {
                Database::get()->query("DELETE FROM gradebook_book WHERE gradebook_activity_id = ?d AND uid = ?d", $actID, getDirectReference($userID));
            } else {               
                // //check if there is record for the user for this activity
                $checkForBook = Database::get()->querySingle("SELECT COUNT(id) AS count, id FROM gradebook_book
                                            WHERE gradebook_activity_id = ?d AND uid = ?d", $actID, getDirectReference($userID));
                if ($checkForBook->count) { // update
                    Database::get()->query("UPDATE gradebook_book SET grade = ?f WHERE id = ?d", $userInp/$gradebook->range, $checkForBook->id);
                } else { // insert
                    Database::get()->query("INSERT INTO gradebook_book SET uid = ?d, gradebook_activity_id = ?d, grade = ?f, comments = ?s", getDirectReference($userID), $actID, $userInp/$gradebook->range, '');
                }
            }
        }
    } else {     
        Session::flashPost()->Messages($langFormErrors)->Errors($v->errors());
        redirect_to_home_page("modules/gradebook/index.php?course=$course_code&gradebook_id=".getIndirectReference($gradebook->id)."&ins=".getIndirectReference($actID));        
    }    


    $message = "<div class='alert alert-success'>$langGradebookEdit</div>";
    $tool_content .= $message . "<br/>";
}
示例#22
0
	   //$navigation[] = array('url' => "$_SERVER[SCRIPT_NAME]?course=$course_code", 'name' => $langGroups);
	   $tool_content .= "<div class = 'form-wrapper'>";
	   $tool_content .= "<form class = 'form-horizontal' role='form' method='post' action='index.php?course=$course_code&amp;editcategory=1' onsubmit=\"return checkrequired(this, 'categoryname');\">";
	   $tool_content .= "<fieldset>
                        <div class='form-group".(Session::getError('categoryname') ? " has-error" : "")."'>
                            <label for='CatName' class='col-sm-2 control-label'>$langCategoryName:</label>
                            <div class='col-sm-10'>
                                <input class='form-control' type='text' name='categoryname' size='53' placeholder='$langCategoryName' $form_name>
								<span class='help-block'>".Session::getError('categoryname')."</span>
                            </div>
                        </div>
                        <div class='form-group'>
                            <label for='CatDesc' class='col-sm-2 control-label'>$langDescription:</label>
                            <div class='col-sm-10'>
                                <textarea class='form-control' rows='5' name='description'>$form_description</textarea>
                            </div>
                        </div>
						<input type='hidden' name='id' value='" . getIndirectReference($id) . "' />
                        <div class='form-group'>
                            <div class='col-sm-10 col-sm-offset-2'>
                                <input type='submit' class='btn btn-primary' name='submitCategory' value='$form_legend' />
                                <a href='index.php?course=$course_code' class='btn btn-default'>$langCancel</a>
                            </div>
                        </div>
                        </fieldset>
                     ". generate_csrf_token_form_field() ."
                    </form>
                </div>";
    } 

draw($tool_content, 2);
示例#23
0
                    SELECT user_id FROM course_user WHERE course_id = ?d", $course_id);
        $result = Database::get()->queryArray("SELECT u.id, u.surname, u.givenname, u.username, u.am FROM
                                                user u LEFT JOIN lala c ON u.id = c.user_id WHERE
                                                c.user_id IS NULL AND $query", $values);
        if ($result) {
            $tool_content .= "<table class='table-default'>
                                <tr>
                                  <th>$langID</th>
                                  <th>$langName</th>
                                  <th>$langSurname</th>
                                  <th>$langUsername</th>
                                  <th>$langAm</th>
                                  <th>$langActions</th>
                                </tr>";
            $i = 1;
            foreach ($result as $myrow) {                
                $tool_content .= "<td class='text-right'>$i.</td><td>" . q($myrow->givenname) . "</td><td>" .
                        q($myrow->surname) . "</td><td>" . q($myrow->username) . "</td><td>" .
                        q($myrow->am) . "</td><td class='text-center'>" .
                        icon('fa-sign-in', $langRegister, "$_SERVER[SCRIPT_NAME]?course=$course_code&amp;add=" . getIndirectReference($myrow->id)). "</td></tr>";
                $i++;
            }
            $tool_content .= "</table>";
        } else {
            $tool_content .= "<div class='alert alert-danger'>$langNoUsersFound</div>";
        }
        Database::get()->query("DROP TABLE lala");
    }
}
draw($tool_content, 2);
示例#24
0
function unpack_zip_show_files($zipfile) {
    global $langEndFileUnzip, $langLesFound, $langRestore, $langLesFiles;

    $retArr = unpack_zip_inner($zipfile, FALSE);
    $retString = '';

    if (count($retArr) > 0) {
        $retString .= "<br />$langEndFileUnzip<br /><br />$langLesFound
                           <form action='$_SERVER[SCRIPT_NAME]' method='post'>
                             <ol>";
        $checked = ' checked';

        foreach ($retArr as $entry) {
            $path = $entry['path'];
            $file = q($entry['file']);
            $course = q($entry['course']);

            $retString .= "<li>$langLesFiles <input type='radio' name='restoreThis' value='" . q(getIndirectReference($path)) . "'$checked>
                            <b>$course</b> ($file)</li>\n";
            $checked = '';
        }

        $retString .= "</ol><br /><input class='btn btn-primary' type='submit' name='do_restore' value='$langRestore' />
                      ".generate_csrf_token_form_field()."
                      </form>";
    }

    return $retString;
}
示例#25
0
    </div>
	<div class='form-group'>
            <label for='selectcategory' class='col-sm-2 control-label'>$langCategory:</label>
            <div class='col-sm-3'>
                <select class='form-control' name='selectcategory' id='selectcategory'>
                <option value='0'>--</option>";
        if ($social_bookmarks_enabled) {
            $tool_content .= "<option value='" . getIndirectReference(-2) . "'";
            if (isset($category) and -2 == $category) {
                $tool_content .= " selected='selected'";
            }
            $tool_content .= ">$langSocialCategory</option>";
        }
        $resultcategories = Database::get()->queryArray("SELECT * FROM group_category WHERE course_id = ?d ORDER BY `name`", $course_id);
        foreach ($resultcategories as $myrow) {
            $tool_content .= "<option value='" . getIndirectReference($myrow->id) . "'";
            if (isset($category) and $myrow->id == $category) {
                $tool_content .= " selected='selected'";
            }
            $tool_content .= '>' . q($myrow->name) . "</option>";
        }
        $tool_content .= "
            </select>
            </div>
        </div>
            <div class='form-group'>
             <label class='col-sm-2 control-label'>$langGroupStudentRegistrationType:</label>
                <div class='col-xs-9'>             
                    <div class='checkbox'>
                    <label>
                     <input type='checkbox' name='self_reg' checked>$langGroupAllowStudentRegistration