예제 #1
0
                    } else {
                        $tool_content .= "<br>({$langGradebookInsMan})";
                    }
                    $tool_content .= "</td>";
                } else {
                    $tool_content .= "<td class='smaller'>{$langAttendanceActivity}</td>";
                }
                $tool_content .= "<td class='text-center'>" . $announce->weight . "%</td>";
                $tool_content .= "<td width='' class='text-center'>";
                if ($announce->visible) {
                    $tool_content .= $langYes;
                } else {
                    $tool_content .= $langNo;
                }
                $tool_content .= "</td>";
                $tool_content .= "<td width='120' class='text-center'>" . userGradebookTotalActivityStats($announce->id, $gradebook_id) . "</td>";
                $tool_content .= "<td class='option-btn-cell text-center'>" . action_button(array(array('title' => $langDelete, 'icon' => 'fa-times', 'url' => "{$_SERVER['SCRIPT_NAME']}?course={$course_code}&amp;delete={$announce->id}", 'confirm' => $langConfirmDelete, 'class' => 'delete'), array('title' => $langModify, 'icon' => 'fa-edit', 'url' => "{$_SERVER['SCRIPT_NAME']}?course={$course_code}&amp;modify={$announce->id}"), array('title' => $langGradebookBook, 'icon' => 'fa-plus', 'url' => "{$_SERVER['SCRIPT_NAME']}?course={$course_code}&amp;ins={$announce->id}"))) . "</td>";
            }
            // end of while
            $tool_content .= "</table></div></div></div>";
        }
    }
} else {
    //==========Student View==============
    $userID = $uid;
    //visible flag
    $visible = 1;
    //check if there are grade records for the user, otherwise alert message that there is no input
    $checkForRecords = Database::get()->querySingle("SELECT COUNT(gradebook_book.id) as count FROM gradebook_book, gradebook_activities WHERE gradebook_book.gradebook_activity_id = gradebook_activities.id AND gradebook_activities.visible = ?d AND uid = ?d AND gradebook_activities.gradebook_id = ?d", $visible, $userID, $gradebook_id)->count;
    if (!$checkForRecords) {
        $tool_content .= "<div class='alert alert-warning'>{$langGradebookTotalGradeNoInput}</div>";
예제 #2
0
/**
 * @brief display gradebook activities
 * @global type $course_code
 * @global type $course_id
 * @global type $urlServer
 * @global type $tool_content
 * @global type $langGradebookGradeAlert
 * @global type $langGradebookNoActMessage1
 * @global type $langTitle
 * @global type $langView
 * @global type $langScore
 * @global type $langGradebookActList
 * @global type $langGradebookActivityDate2
 * @global type $langGradebookWeight
 * @global type $langGradebookNoTitle
 * @global type $langType
 * @global type $langExercise
 * @global type $langGradebookInsAut
 * @global type $langGradebookInsMan
 * @global type $langAssignment
 * @global type $langGradebookActivityAct
 * @global type $langAttendanceActivity
 * @global type $langDelete
 * @global type $langConfirmDelete
 * @global type $langEditChange
 * @global type $langYes
 * @global type $langNo
 * @global type $langConfig
 * @global type $langUsers
 * @global type $langGradebookAddActivity
 * @global type $langInsertWorkCap
 * @global type $langInsertExerciseCap
 * @global type $langLearningPath
 * @global type $langAdd
 * @param type $gradebook_id
 */
function display_gradebook($gradebook) {

    global $course_code, $urlServer, $tool_content, $langGradebookGradeAlert, $langGradebookNoActMessage1,
           $langTitle, $langView, $langScore, $langGradebookActList, $langAdd,
           $langGradebookActivityDate2, $langGradebookWeight, $langGradebookNoTitle, $langType, $langExercise,
           $langGradebookInsAut, $langGradebookInsMan, $langAttendanceActivity, $langDelete, $langConfirmDelete,
           $langEditChange, $langYes, $langNo, $langPreview, $langAssignment, $langGradebookActivityAct, $langGradebookGradeAlert3,
           $langGradebookExams, $langGradebookLabs, $langGradebookOral, $langGradebookProgress, $langGradebookOtherType,
           $langConfig, $langUsers, $langGradebookAddActivity, $langInsertWorkCap, $langInsertExerciseCap, $langLearningPath,
           $langExport, $langcsvenc1, $langcsvenc2, $langBack, $langToA, $langNoRegStudent, $langHere, $langStudents;

    $tool_content .= action_bar(
        array(
            array('title' => $langAdd,
                  'level' => 'primary-label',
                  'options' => array(
                      array('title' => $langGradebookAddActivity,
                            'url' => "$_SERVER[SCRIPT_NAME]?course=$course_code&amp;gradebook_id=" . getIndirectReference($gradebook->id) . "&amp;addActivity=1",
                            'icon' => 'fa fa-plus fa space-after-icon',
                            'class' => ''),
                      array('title' => "$langInsertWorkCap",
                            'url' => "$_SERVER[SCRIPT_NAME]?course=$course_code&amp;gradebook_id=" . getIndirectReference($gradebook->id) . "&amp;addActivityAs=1",
                            'icon' => 'fa fa-flask space-after-icon',
                            'class' => ''),
                      array('title' => "$langInsertExerciseCap",
                            'url' => "$_SERVER[SCRIPT_NAME]?course=$course_code&amp;gradebook_id=" . getIndirectReference($gradebook->id) . "&amp;addActivityEx=1",
                            'icon' => 'fa fa-edit space-after-icon',
                            'class' => ''),
                      array('title' => "$langLearningPath",
                            'url' => "$_SERVER[SCRIPT_NAME]?course=$course_code&amp;gradebook_id=" . getIndirectReference($gradebook->id) . "&amp;addActivityLp=1",
                            'icon' => 'fa fa-ellipsis-h space-after-icon',
                            'class' => ''),
                      ),
                  'icon' => 'fa-plus'),
            array('title' => $langEditChange,
                  'url' => "$_SERVER[SCRIPT_NAME]?course=$course_code&amp;gradebook_id=" . getIndirectReference($gradebook->id) . "&amp;editSettings=1",
                  'icon' => 'fa-cog'),
            array('title' => $langStudents,
                  'url' => "$_SERVER[SCRIPT_NAME]?course=$course_code&amp;gradebook_id=" . getIndirectReference($gradebook->id) . "&amp;gradebookBook=1",
                  'icon' => 'fa-users',
                  'level' => 'primary-label'),
            array('title' => "$langExport $langToA $langcsvenc1",
                  'url' => "dumpgradebook.php?course=$course_code&amp;gradebook_id=" . getIndirectReference($gradebook->id) . "&amp;enc=1253",
                  'icon' => 'fa-file-excel-o'),
            array('title' => "$langExport $langToA $langcsvenc2",
                  'url' => "dumpgradebook.php?course=$course_code&amp;gradebook_id=" . getIndirectReference($gradebook->id) . "",
                  'icon' => 'fa-file-excel-o'),
            array('title' => $langBack,
                  'url' => "$_SERVER[SCRIPT_NAME]?course=$course_code",
                  'icon' => 'fa-reply',
                  'level' => 'primary-label'),
            ),
            true
        );

    $participantsNumber = Database::get()->querySingle("SELECT COUNT(id) AS count 
                                        FROM gradebook_users WHERE gradebook_id=?d ", $gradebook->id)->count;
    if ($participantsNumber == 0) {
        $tool_content .= "<div class='alert alert-warning'>$langNoRegStudent <a href='$_SERVER[SCRIPT_NAME]?course=$course_code&amp;gradebook_id=" . getIndirectReference($gradebook->id) . "&amp;editUsers=1'>$langHere</a>.</div>";
    }
    $weightMessage = "";
    //get all the available activities
    $result = Database::get()->queryArray("SELECT * FROM gradebook_activities WHERE gradebook_id = ?d ORDER BY `DATE` DESC", $gradebook->id);
    $activityNumber = count($result);
    
    if (!$result or $activityNumber == 0) {
        $tool_content .= "<div class='alert alert-warning'>$langGradebookNoActMessage1</a></div>";
    } else {
        foreach ($result as $details) {
            if ($details->weight == 0 or (empty($details->weight))) { // check if there are activities with 0% weight
                $weightMessage = "<div class='alert alert-warning'>$langGradebookGradeAlert3</div>";
            }
        }
        //check if there is spare weight
        if(weightleft($gradebook->id, 0)) {
            $weightMessage = "<div class='alert alert-warning'>$langGradebookGradeAlert (" . weightleft($gradebook->id, 0) . "%)</div>";
        }
        $tool_content .= $weightMessage;
        $tool_content .= "<div class='row'>
                            <div class='col-sm-12'>
                                <div class='table-responsive'>
                                    <table class='table-default'>
                                        <tr class='list-header'>
                                            <th colspan='7' class='text-center'>$langGradebookActList</th>
                                        </tr>
                                        <tr class='list-header'>
                                            <th>$langTitle</th>
                                            <th>$langGradebookActivityDate2</th>
                                            <th>$langType</th><th>$langGradebookWeight</th>
                                            <th class='text-center'>$langView</th>
                                            <th class='text-center'>$langScore</th>
                                            <th class='text-center'>".icon('fa-cogs')."</i></th>
                                        </tr>";
        foreach ($result as $details) {
            $content = ellipsize_html($details->description, 50);
            $tool_content .= "<tr><td><b>";
            $tool_content .= "<a href='$_SERVER[SCRIPT_NAME]?course=$course_code&amp;gradebook_id=" . getIndirectReference($gradebook->id) . "&amp;ins=" . getIndirectReference($details->id) . "'>" .(!empty($details->title) ? q($details->title) : $langGradebookNoTitle) . "</a>";
            $tool_content .= "<small class='help-block'>";
            switch ($details->activity_type) {
                 case 1: $tool_content .= "($langGradebookOral)"; break;
                 case 2: $tool_content .= "($langGradebookLabs)"; break;
                 case 3: $tool_content .= "($langGradebookProgress)"; break;
                 case 4: $tool_content .= "($langGradebookExams)"; break;
                 case 5: $tool_content .= "($langGradebookOtherType)"; break;
                 default : $tool_content .= "";
             }
            $tool_content .= "</small";
            $tool_content .= "</b>";
            $tool_content .= "</td><td><div class='smaller'>" . nice_format($details->date, true, true) . "</div></td>";

            if ($details->module_auto_id) {
                if ($details->module_auto_type == GRADEBOOK_ACTIVITY_ASSIGNMENT) {
                    $tool_content .= "<td class='smaller'>$langAssignment";
                }
                if ($details->module_auto_type == GRADEBOOK_ACTIVITY_EXERCISE) {
                    $tool_content .= "<td class='smaller'>$langExercise ";
                }
                if ($details->module_auto_type == GRADEBOOK_ACTIVITY_LP) {
                    $tool_content .= "<td class='smaller'>$langGradebookActivityAct";
                }

                if ($details->auto) {
                    $tool_content .= "<small class='help-block'>($langGradebookInsAut)</small>";
                } else {
                    $tool_content .= "<small class='help-block'>($langGradebookInsMan)</small>";
                }
                $tool_content .= "</td>";
            } else {
                $tool_content .= "<td class='smaller'>$langAttendanceActivity</td>";
            }

            $tool_content .= "<td class='text-center'>" . $details->weight . "%</td>";
            $tool_content .= "<td width='' class='text-center'>";
            if ($details->visible) {
                $tool_content .= $langYes;
            } else {
                $tool_content .= $langNo;
            }
            $tool_content .= "</td>";
            $tool_content .= "<td width='120' class='text-center'>" . userGradebookTotalActivityStats($details, $gradebook) . "</td>";
            if ($details->module_auto_id and $details->module_auto_type == GRADEBOOK_ACTIVITY_EXERCISE) {
                $preview_link = "${urlServer}modules/exercise/results.php?course=$course_code&amp;exerciseId=$details->module_auto_id";
            } elseif ($details->module_auto_id and $details->module_auto_type == GRADEBOOK_ACTIVITY_ASSIGNMENT) {
                $preview_link = "${urlServer}modules/work/index.php?course=$course_code&amp;id=$details->module_auto_id";
            } elseif ($details->module_auto_id and $details->module_auto_type == GRADEBOOK_ACTIVITY_LP) {
                $preview_link = "${urlServer}modules/learnPath/detailsAll.php?course=$course_code";
            } else {
                $preview_link = '';
            }
            $tool_content .= "<td class='option-btn-cell text-center'>".
                action_button(array(
                            array('title' => $langEditChange,
                                'icon' => 'fa-edit',
                                'url' => "$_SERVER[SCRIPT_NAME]?course=$course_code&amp;gradebook_id=" . getIndirectReference($gradebook->id) . "&amp;modify=" . getIndirectReference($details->id)),
                            array('title' => $langPreview,
                                'icon' => 'fa-plus',
                                'url' => $preview_link,
                                'show' => (!empty($preview_link))),
                            array('title' => $langDelete,
                                'icon' => 'fa-times',
                                'url' => "$_SERVER[SCRIPT_NAME]?course=$course_code&amp;gradebook_id=" . getIndirectReference($gradebook->id) . "&amp;delete=" . getIndirectReference($details->id),
                                'confirm' => $langConfirmDelete,
                                'class' => 'delete')
                    )).
                "</td>";
            
        } // end of while
        $tool_content .= "</table></div></div></div>";
    }
}