Example #1
0
 /**
  * 
  * @param Evaluation $evalObj
  */
 private function getVotePercentage($evalObj)
 {
     $questionCount = count($evalObj->getQuestions());
     $votes = $evalObj->getVotes();
     $currentVotes = array();
     $usersVoted = array();
     foreach ($votes as $vote) {
         array_push($currentVotes, $vote->getVote());
         array_push($usersVoted, $vote->getUser()->getId());
     }
     $sum = array_sum($currentVotes);
     $users = count(array_unique($usersVoted));
     return $sum / ($questionCount * 5) * 100 / $users;
 }
Example #2
0
 public static function getList($nurser_id = '')
 {
     $model = Evaluation::model();
     $command = $model->getDbConnection()->CreateCommand();
     $condition = "c.id=b.order_id And a.id=b.customer_id And b.nurser_id={$nurser_id}";
     return $command->select('a.name,c.server_name,b.context,b.create_time,b.id')->from('t_customer a, t_evaluation b, t_order c')->where($condition)->order('b.create_time DESC')->queryAll();
 }
Example #3
0
 function __construct()
 {
     parent::__construct();
     $this->load->model('exam_model', 'exam');
     $this->project = $this->exam;
     $this->evaluation = $this->exam;
 }
Example #4
0
 public function run($id)
 {
     $evaluation_info = Evaluation::model()->findByPk($id);
     if ($evaluation_info->delete()) {
         $this->controller->success('');
     }
 }
 public function destroy($id)
 {
     $evaluation = Evaluation::find($id);
     $evaluation->delete();
     Session::flash('message', 'Successfully deleted the Evaluations!');
     return Redirect::to('evaluations');
 }
Example #6
0
 public function run()
 {
     $nurser_id = Yii::app()->request->getParam('id', 0);
     $evaluation_model = Evaluation::getList($nurser_id);
     //print_r($evaluation_model);die;
     $vars = array('evaluation_model' => $evaluation_model);
     $this->controller->render('index', $vars);
 }
Example #7
0
 public function evaluateAction()
 {
     $username = $this->_getParam('username');
     if (!empty($username)) {
         $form = $this->_getEvaluationForm($username);
         if ($this->getRequest()->isPost() && $form->isValid($this->getRequest()->getPost())) {
             $values = $form->getValues();
             require_once APPLICATION_PATH . "/model/Evaluation.php";
             $table = new Evaluation();
             $date = new Zend_Date();
             $data['date'] = $date->getIso();
             $data['rating'] = $values['rating'];
             $data['motivation'] = $values['motivation'];
             $data['evaluator'] = Zend_Auth::getInstance()->getIdentity()->username;
             $data['evaluated_user'] = $username;
             $table->insert($data);
             $this->_helper->redirector('profile', 'user', 'default', array('username' => $username, 'evaluationInserted' => true));
         }
         $this->view->form = $form;
     }
 }
 public function update($id)
 {
     // Validate
     // read more on validation at http://laravel.com/docs/validation
     $rules = array('eva_name' => 'required', 'eva_duration' => 'required');
     $validator = Validator::make(Input::all(), $rules);
     // process the login
     if ($validator->fails()) {
         return Redirect::to('evaluations/' . $id . '/edit')->withErrors($validator);
     } else {
         // store
         $evaluation = new Evaluation();
         $evaluation->eva_name = Input::get('eva_name');
         $evaluation->eva_duration = Input::get('eva_duration');
         $evaluation->questions_id = Input::get('questions_id');
         $evaluation->save();
         // Redirect
         Session::flash('message', 'Successfully created Evaluation!');
         return Redirect::to('evaluations');
     }
 }
Example #9
0
/**
 * @param $eleve
 * @param $trimestre
 */
function afficheEvaluation(Eleve $eleve, Trimestre $trimestre, $idMatiere)
{
    $evaluations = Evaluation::getByMatiereTrimestre($idMatiere, $trimestre->getIdTrimestre());
    if (count($evaluations) > 0) {
        foreach ($evaluations as $uneEvaluation) {
            $laNote = Note::getById($eleve->getIdEleve(), $uneEvaluation->getIdEvaluation());
            if (!empty($laNote->getNote())) {
                echo '<tr>
						<td colspan="3"></td>
						<td class="Evaluation">' . $uneEvaluation->getLibelleEvaluation() . '</td>';
                afficheNote($uneEvaluation->getMaxEvaluation(), $laNote->getNote());
                echo '</tr>';
            }
        }
    }
}
    /**
     * Retrieve evaluations where a student has results for
     * and return them as an array of Evaluation objects
     * @param int $cat_id parent category (use 'null' to retrieve them in all categories)
     * @param int $stud_id student id
     */
    public static function get_evaluations_with_result_for_student($cat_id = null, $stud_id)
    {
        $tbl_grade_evaluations = Database::get_main_table(TABLE_MAIN_GRADEBOOK_EVALUATION);
        $tbl_grade_results = Database::get_main_table(TABLE_MAIN_GRADEBOOK_RESULT);
        $sql = 'SELECT * FROM ' . $tbl_grade_evaluations . '
				WHERE id IN (
					SELECT evaluation_id FROM ' . $tbl_grade_results . '
					WHERE user_id = ' . intval($stud_id) . ' AND score IS NOT NULL
				)';
        if (!api_is_allowed_to_edit()) {
            $sql .= ' AND visible = 1';
        }
        if (isset($cat_id)) {
            $sql .= ' AND category_id = ' . intval($cat_id);
        } else {
            $sql .= ' AND category_id >= 0';
        }
        $result = Database::query($sql);
        $alleval = Evaluation::create_evaluation_objects_from_sql_result($result);
        return $alleval;
    }
Example #11
0
<?php

set_time_limit(0);
$strPageTitle = 'Add Image';
include "../includes/logincheck.php";
if (!empty($_FILES)) {
    $objEvaluation = new Evaluation(NULL, NULL);
    $arrImageAdded = $objEvaluation->addImage(isset($_POST['imageid']) ? $_POST['imageid'] : NULL, isset($_POST['evalid']) ? $_POST['evalid'] : NULL);
    if (!empty($arrImageAdded) && $arrImageAdded != 'error') {
        echo $arrImageAdded[0];
    } else {
        echo 'error';
    }
}
Example #12
0
<?php

include "../includes/logincheck.php";
if (!empty($_POST)) {
    if (!empty($_POST['download-pdf'])) {
        if (!ini_get('display_errors')) {
            ini_set('display_errors', '1');
        }
        require_once '../includes/html2pdf_v4.03/html2pdf.class.php';
        $iEvaluationId = $_POST['evaluation-id'];
        $html2pdf = new HTML2PDF('P', 'A4', 'en');
        $username = '******';
        $password = '******';
        $context = stream_context_create(array('http' => array('header' => "Authorization: Basic " . base64_encode("{$username}:{$password}"))));
        $content = file_get_contents('http://jamestoothill.co.uk/dev/eval/admin/view_eval_pdf.php?skip_auth=1HGstGtw8272891H&eval_id=' . $iEvaluationId . '&remove_formatting=true', false, $context);
        $objEvaluation = new Evaluation(NULL, NULL);
        $objEvaluation->emailEvaluation('*****@*****.**', 'James Toothill', $content);
        //echo $content;
        //$html2pdf->WriteHTML($content);
        //$html2pdf->Output('exemple.pdf');
        exit;
    }
}
 /**
  * Lazy load function to get the linked evaluation
  */
 protected function get_evaluation()
 {
     if (!isset($this->evaluation)) {
         if (isset($this->ref_id)) {
             $evalarray = Evaluation::load($this->get_ref_id());
             $this->evaluation = $evalarray[0];
         } else {
             $eval = new Evaluation();
             $eval->set_category_id(-1);
             $eval->set_date(api_get_utc_datetime());
             // these values will be changed
             $eval->set_weight(0);
             //   when the link setter
             $eval->set_visible(0);
             //     is called
             $eval->set_id(-1);
             // a 'real' id will be set when eval is added to db
             $eval->set_user_id($this->get_user_id());
             $eval->set_course_code($this->get_course_code());
             $this->evaluation = $eval;
             $this->set_ref_id($eval->get_id());
         }
     }
     return $this->evaluation;
 }
# ===================================================== END: check the evalID #
# check the itemID =========================================================  #
$itemID = Request::option('itemID');
if ($itemID) {
    $_SESSION['itemID'] = $itemID;
} elseif (Request::submitted('newButton')) {
    $_SESSION['itemID'] = "root";
}
# ===================================================== END: check the itemID #
# check the rangeID ========================================================  #
if (Request::option("rangeID")) {
    $_SESSION['rangeID'] = Request::option("rangeID");
}
# ==================================================== END: check the rangeID #
# EVTAU: employees of the vote-team against urlhacking ====================== #
$eval = new Evaluation($evalID, NULL, EVAL_LOAD_NO_CHILDREN);
// someone has voted
if ($eval->hasVoted()) {
    $error = EvalCommon::createReportMessage(_("An dieser Evaluation hat bereits jemand teilgenommen. Sie darf nicht mehr verändert werden."), EVAL_PIC_ERROR, EVAL_CSS_ERROR);
    $error_msgs[] = $error->createContent();
}
// only the author or user with tutor perm in all evalRangeIDs should edit an eval
$authorID = $eval->getAuthorID();
$db = new EvaluationObjectDB();
if ($authorID != $user->id) {
    $no_permisson = 0;
    if (is_array($eval->getRangeIDs())) {
        foreach ($eval->getRangeIDs() as $rangeID) {
            $user_perm = $db->getRangePerm($rangeID, $user->id, YES);
            // every range with a lower perm than Tutor
            if ($user_perm < 7) {
Example #15
0
	if (isset($_POST['selectEval']) && !empty($_POST['selectEval']))
		header('location: ../Intranet/modifCpt.php?idEval='.$_POST['selectEval']);
}

if (isset($_POST['verif'])){
	if (isset($_POST['selectEval']) && !empty($_POST['selectEval']))
		header('location: ../Intranet/verifNote.php?idEval='.$_POST['selectEval']);
}

if (isset($_POST['noter'])){
	if (isset($_POST['selectEval']) && !empty($_POST['selectEval']))
		header('location: ../Intranet/affectNote.php?idEval='.$_POST['selectEval']);
}

if (isset($_POST['btAjouter'])) {
	$evaluation = new Evaluation();
	$evaluation->setDateEvaluation($_POST['addDate']);
	$evaluation->setIdMatiereNiveau(MatiereNiveau::getByMatiereNiveau($_POST['addMatiere'], $_POST['addNiveau'])->getIdMatiereNiveau());
	$evaluation->setIdTypeEvaluation($_POST['addType']);
	$evaluation->setTitreEvaluation(db_connect::escape_string($_POST['addTitre']));
//	echo $evaluation->getTitreEvaluation();
	$evaluation->setMaxEvaluation($_POST['addMax']);
	if ($evaluation->getIdTypeEvaluation() == 3)
		$evaluation->setAutreEvaluation(db_connect::escape_string($_POST['autreEval']));

	if ($evaluation->insert()){
		$msgInsert = "<h4 style='color: green'>
				L'ajout de l'&eacute;valuation a r&eacute;ussi.
			</h4>";
	}
	else{
 * @package chamilo.gradebook
 */
require_once '../inc/global.inc.php';
api_block_anonymous_users();
$isDrhOfCourse = CourseManager::isUserSubscribedInCourseAsDrh(api_get_user_id(), api_get_course_info());
if (!$isDrhOfCourse) {
    GradebookUtils::block_students();
}
$interbreadcrumb[] = array('url' => $_SESSION['gradebook_dest'], 'name' => get_lang('Gradebook'));
//load the evaluation & category
$select_eval = Security::remove_XSS($_GET['selecteval']);
if (empty($select_eval)) {
    api_not_allowed();
}
$displayscore = ScoreDisplay::instance();
$eval = Evaluation::load($select_eval);
$overwritescore = 0;
if ($eval[0]->get_category_id() < 0) {
    // if category id is negative, then the evaluation's origin is a link
    $link = LinkFactory::get_evaluation_link($eval[0]->get_id());
    $currentcat = Category::load($link->get_category_id());
} else {
    $currentcat = Category::load($eval[0]->get_category_id());
}
//load the result with the evaluation id
if (isset($_GET['delete_mark'])) {
    $result = Result::load($_GET['delete_mark']);
    if (!empty($result[0])) {
        $result[0]->delete();
    }
}
Example #17
0
	public function getEvaluation(){
		return Evaluation::getById($this->getIdEvaluation());
	}
 * @package chamilo.gradebook
 */
//$cidReset = true;
require_once '../inc/global.inc.php';
api_block_anonymous_users();
GradebookUtils::block_students();
$interbreadcrumb[] = array('url' => $_SESSION['gradebook_dest'] . '?', 'name' => get_lang('Gradebook'));
$interbreadcrumb[] = array('url' => $_SESSION['gradebook_dest'] . '?selectcat=' . Security::remove_XSS($_GET['selectcat']), 'name' => get_lang('Details'));
$interbreadcrumb[] = array('url' => 'gradebook_showlog_eval.php?visiblelog=' . Security::remove_XSS($_GET['visiblelog']) . '&amp;selectcat=' . Security::remove_XSS($_GET['selectcat']), 'name' => get_lang('GradebookQualifyLog'));
$this_section = SECTION_COURSES;
Display::display_header('');
echo Display::page_header(get_lang('GradebookQualifyLog'));
$t_linkeval_log = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINKEVAL_LOG);
$t_user = Database::get_main_table(TABLE_MAIN_USER);
$visible_log = Security::remove_XSS($_GET['visiblelog']);
$evaledit = Evaluation::load($visible_log);
$sql = "SELECT le.name,le.description,le.weight,le.visible,le.type,le.created_at,us.username FROM " . $t_linkeval_log . " le INNER JOIN " . $t_user . " us\n      ON le.user_id_log=us.user_id where id_linkeval_log=" . $evaledit[0]->get_id() . " and type='evaluation';";
$result = Database::query($sql);
$list_info = array();
while ($row = Database::fetch_row($result)) {
    $list_info[] = $row;
}
foreach ($list_info as $key => $info_log) {
    $list_info[$key][5] = $info_log[5] ? api_convert_and_format_date($info_log[5]) : 'N/A';
    $list_info[$key][3] = $info_log[3] == 1 ? get_lang('GradebookVisible') : get_lang('GradebookInvisible');
}
$parameters = array('visiblelog' => $visible_log, 'selectcat' => intval($_GET['selectcat']));
$table = new SortableTableFromArrayConfig($list_info, 1, 20, 'gradebookeval');
$table->set_additional_parameters($parameters);
$table->set_header(0, get_lang('GradebookNameLog'));
$table->set_header(1, get_lang('GradebookDescriptionLog'));
Example #19
0
<?php

$strPageTitle = 'Puckstoppers Goaltending Evaluation';
include "layout/header.php";
if (isset($_GET['eval_id']) && is_numeric($_GET['eval_id'])) {
    $iEvaluationId = $_GET['eval_id'];
    $objEvaluation = new Evaluation(NULL, $iEvaluationId);
    $blnDeleted = $objEvaluation->deleteEvaluation();
    if ($blnDeleted) {
        setTopMessage('success', 'Success! The Evaluation has been deleted.');
        header('Location: ' . $strLocation . 'admin/');
    } else {
        setTopMessage('error', 'Error! The Evaluation has not been deleted, please try again.');
        header('Location: ' . $strLocation . 'admin/');
    }
} else {
    header('Location: ' . $strLocation . 'admin/');
}
include "layout/footer_js.php";
include "layout/footer.php";
Example #20
0
                header('Location: ' . $strLocation . 'admin/view_eval.php?eval_id=' . $iEvaluationId);
            }
        } else {
            header('Cache-Control: public');
            header('Content-type: application/pdf');
            header('Content-Disposition: attachment; filename="evaluation-' . $iEvaluationId . '.pdf"');
            header('Content-Length: ' . strlen($Result));
            echo $Result;
        }
    }
}
$strPageTitle = 'Puckstoppers Goaltending Evaluation';
include "layout/header.php";
if (isset($_GET['eval_id']) && is_numeric($_GET['eval_id'])) {
    $iEvaluationId = $_GET['eval_id'];
    $objEvaluation = new Evaluation(NULL, $iEvaluationId);
    $arrEvaluation = $objEvaluation->getEvaluation();
    $objEvaluation->markComplete();
    $arrCompletedComponents = $objEvaluation->getCompletedComponents();
    $arrCompletedComments = $objEvaluation->getCompletedComments();
} else {
    header('Location: ' . $strLocation . 'admin/');
}
$objComment = new Comment(NULL, NULL, NULL);
$arrComponents = $objComment->getComponents();
$arrCommentTypes = $objComment->getCommentTypes();
?>
    <?php 
if (!empty($iEvaluationId)) {
    ?>
    <input name="evaluation-id" type="hidden" value="<?php 
Example #21
0
require_once '../Require/Objects.php';
$utilisateur = new Utilisateur();
if (isset($_SESSION['id'])) {
	$utilisateur = Utilisateur::getById($_SESSION['id']);
	if (!($utilisateur->estAdministrateur() || $utilisateur->estProfesseur())) {
		header('location: ../Intranet/mesInformations.php');
	}
}
else {
	header('location: ../Intranet/connexion.php');
}

if (!isset($_GET['idEval'])) {
	header('location: ../Intranet/addEvaluation.php');
}
$evaluation = Evaluation::getById($_GET['idEval']);

// préparation du select du niveau de cpt
$selectNiveauCpt = "<option></option>";
$niveauCpt       = NiveauCpt::getAll();
foreach ($niveauCpt as $nv) {
	$selectNiveauCpt .= "<option value=" . $nv->getIdNiveauCpt() . ">" . $nv->getLibelleNiveauCpt() . "</option>";
}

?>
<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>EDEIP : Evaluation</title>
	<link rel="stylesheet" href="../Intranet/styleIntranet.css" type="text/css" media="screen"/>
Example #22
0
                        $link[0]->save();
                    }
                }
                $confirmation_message = get_lang('ItemsVisible');
                $filter_confirm_msg = false;
                break;
            case 'setinvisible':
                foreach ($_POST['id'] as $indexstr) {
                    if (substr($indexstr, 0, 4) == 'CATE') {
                        $cats = Category::load(substr($indexstr, 4));
                        $cats[0]->set_visible(0);
                        $cats[0]->save();
                        $cats[0]->apply_visibility_to_children();
                    }
                    if (substr($indexstr, 0, 4) == 'EVAL') {
                        $eval = Evaluation::load(substr($indexstr, 4));
                        $eval[0]->set_visible(0);
                        $eval[0]->save();
                    }
                    if (substr($indexstr, 0, 4) == 'LINK') {
                        $link = LinkFactory::load(substr($indexstr, 4));
                        $link[0]->set_visible(0);
                        $link[0]->save();
                    }
                }
                $confirmation_message = get_lang('ItemsInVisible');
                $filter_confirm_msg = false;
                break;
        }
    }
}
/**
 * Init
 */
//Disabling code when course code is null (gradebook as a tab) see issue #2705
exit;
$language_file = 'gradebook';
require_once '../inc/global.inc.php';
$this_section = SECTION_MYGRADEBOOK;
require_once 'lib/be.inc.php';
require_once 'lib/fe/displaygradebook.php';
require_once 'lib/gradebook_functions.inc.php';
require_once 'lib/fe/evalform.class.php';
require_once 'lib/scoredisplay.class.php';
api_block_anonymous_users();
block_students();
$evaluation = Evaluation::load($_GET['selecteval']);
$newstudents = $evaluation[0]->get_not_subscribed_students();
if (count($newstudents) == '0') {
    header('Location: gradebook_view_result.php?nouser=&selecteval=' . Security::remove_XSS($_GET['selecteval']));
    exit;
}
$add_user_form = new EvalForm(EvalForm::TYPE_ADD_USERS_TO_EVAL, $evaluation[0], null, 'add_users_to_evaluation', null, api_get_self() . '?selecteval=' . Security::remove_XSS($_GET['selecteval']), Security::remove_XSS($_GET['firstletter']), $newstudents);
if (isset($_POST['submit_button'])) {
    $users = is_array($_POST['add_users']) ? $_POST['add_users'] : array();
    foreach ($users as $key => $value) {
        $users[$key] = intval($value);
    }
    if (count($users) == 0) {
        header('Location: ' . api_get_self() . '?erroroneuser=&selecteval=' . Security::remove_XSS($_GET['selecteval']));
        exit;
    } else {
 /**
 * prints out the item details
 *
 * @access  private
 * @param   string   $item_id the current item
 * @return  string   the item details (html)
 */
 function createTreeItemDetails($item_id)
 {
     $mode = $this->getInstance($item_id);
     switch ($mode) {
         case ROOT_BLOCK:
             $eval = new Evaluation($this->evalID, NULL, EVAL_LOAD_FIRST_CHILDREN);
             $hasKids = $eval->getNumberChildren() == 0 ? NO : YES;
             $isLastKid = YES;
             break;
             break;
         case ARRANGMENT_BLOCK:
             $group =& $this->tree->getGroupObject($item_id);
             $hasKids = $group->getNumberChildren() == 0 ? NO : YES;
             $par = $this->getInstance($group->getParentID());
             if ($par == ROOT_BLOCK) {
                 $parent = new Evaluation($group->getParentID(), NULL, EVAL_LOAD_FIRST_CHILDREN);
             } else {
                 $parent =& $this->tree->getGroupObject($group->getParentID());
             }
             $isLastKid = $parent->getNumberChildren() == $group->getPosition() + 1 ? YES : NO;
             break;
         case QUESTION_BLOCK:
             $hasKids = NO;
             $group =& $this->tree->getGroupObject($item_id);
             $par = $this->getInstance($group->getParentID());
             if ($par == ROOT_BLOCK) {
                 $parent = new Evaluation($group->getParentID(), NULL, EVAL_LOAD_FIRST_CHILDREN);
             } else {
                 $parent =& $this->tree->getGroupObject($group->getParentID);
             }
             $isLastKid = $parent->getNumberChildren() == $group->getPosition() + 1 ? YES : NO;
             break;
         default:
             $hasKids = NO;
             $isLastKid = NO;
             break;
     }
     if (!$hasKids || !$this->itemID == $item_id) {
         $level_output = $this->createLevelOutputTD("forumleer.gif") . $level_output;
     } else {
         $level_output = $this->createLevelOutputTD("forumstrich.gif") . $level_output;
     }
     #
     #   if (($isLastKid))
     #       $level_output = $this->createLevelOutputTD ("forumleer.gif") . $level_output;
     #   else
     #       $level_output = $this->createLevelOutputTD ("forumstrich.gif") . $level_output;
     if ($item_id != $this->startItemID) {
         $parent_id = $item_id;
         while ($this->tree->tree_data[$parent_id]['parent_id'] != $this->tree->tree_data[$this->startItemID]['parent_id'] && $this->tree->tree_data[$parent_id]['parent_id'] != $start_itemID && $this->tree->tree_data[$parent_id]['parent_id'] != ROOT_BLOCK) {
             $parent_id = $this->tree->tree_data[$parent_id]['parent_id'];
             #           if (($this->tree->isLastKid($parent_id)) || (!$hasKids))
             #               $level_output = $this->createLevelOutputTD ("forumleer.gif") . $level_output;
             #           else
             #               $level_output = $this->createLevelOutputTD ("forumstrich.gif") . $level_output;
         }
     }
     $table = new HTML("table");
     $table->addAttr("border", "0");
     $table->addAttr("cellspacing", "0");
     $table->addAttr("cellpadding", "0");
     $table->addAttr("width", "100%");
     $tr = new HTML("tr");
     if ($level_output) {
     }
     $tr->addHTMLContent($level_output);
     $td = new HTML("td");
     $td->addAttr("class", "printcontent");
     $td->addAttr("width", "100%");
     $div = new HTML("div");
     $div->addAttr("align", "center");
     $div->setTextareaCheck();
     $div->addHTMLContent($this->getItemContent($item_id));
     $td->addContent($div);
     $tr->addContent($td);
     $table->addContent($tr);
     return $table->createContent();
 }
 /**
  * @param int $id
  * @param float $weight
  */
 public static function updateEvaluationWeight($id, $weight)
 {
     $table_evaluation = Database::get_main_table(TABLE_MAIN_GRADEBOOK_EVALUATION);
     $id = intval($id);
     $evaluation = new Evaluation();
     $evaluation->add_evaluation_log($id);
     $sql = 'UPDATE ' . $table_evaluation . '
            SET weight = ' . "'" . Database::escape_string($weight) . "'" . '
            WHERE id = ' . $id;
     Database::query($sql);
 }
Example #26
0
GradebookUtils::block_students();
$select_cat = isset($_GET['selectcat']) ? Security::remove_XSS($_GET['selectcat']) : '';
$is_allowedToEdit = $is_courseAdmin;
$evaladd = new Evaluation();
$evaladd->set_user_id($_user['user_id']);
if (isset($_GET['selectcat']) && !empty($_GET['selectcat'])) {
    $evaladd->set_category_id($_GET['selectcat']);
    $cat = Category::load($_GET['selectcat']);
    $evaladd->set_course_code($cat[0]->get_course_code());
} else {
    $evaladd->set_category_id(0);
}
$form = new EvalForm(EvalForm::TYPE_ADD, $evaladd, null, 'add_eval_form', null, api_get_self() . '?selectcat=' . $select_cat . '&' . api_get_cidreq());
if ($form->validate()) {
    $values = $form->exportValues();
    $eval = new Evaluation();
    $eval->set_name($values['name']);
    $eval->set_description($values['description']);
    $eval->set_user_id($values['hid_user_id']);
    if (!empty($values['hid_course_code'])) {
        $eval->set_course_code($values['hid_course_code']);
    }
    //Always add the gradebook to the course
    $eval->set_course_code(api_get_course_id());
    $eval->set_category_id($values['hid_category_id']);
    $parent_cat = Category::load($values['hid_category_id']);
    $global_weight = $cat[0]->get_weight();
    //$values['weight'] = $values['weight_mask']/$global_weight*$parent_cat[0]->get_weight();
    $values['weight'] = $values['weight_mask'];
    $eval->set_weight($values['weight']);
    $eval->set_max($values['max']);
Example #27
0
    $arrCompletedComments = $objEvaluation->getCompletedComments();
} else {
    include "layout/header.php";
}
if (!empty($_POST)) {
    if (!empty($_POST['evaluation-id'])) {
        $objEvaluation = new Evaluation($_POST, $_POST['evaluation-id']);
        $blnEvaluationUpdated = $objEvaluation->addEvaluation(true);
        if ($blnEvaluationUpdated && !empty($_POST['complete'])) {
            header('Location: ' . $strLocation . 'admin/view_eval.php?eval_id=' . $_POST['evaluation-id']);
        } else {
            setTopMessage('success', 'Success! An the Evaluation for ' . $_POST['name'] . ' has been updated.');
            header('Location: ' . $strLocation . 'admin/');
        }
    } else {
        $objEvaluation = new Evaluation($_POST);
        $blnEvaluationAdded = $objEvaluation->addEvaluation(false);
        if ($blnEvaluationAdded) {
            setTopMessage('success', 'Success! An Evaluation has been added for ' . $_POST['name'] . '.');
            header('Location: ' . $strLocation . 'admin/');
        }
    }
}
$objComment = new Comment(NULL, NULL, NULL);
$arrComponents = $objComment->getComponents();
$arrCommentTypes = $objComment->getCommentTypes();
if (is_array($arrComponents)) {
    ?>
<div data-magellan-expedition="fixed">
  <dl class="sub-nav">
  <?php 
 /**
  * Get appropriate evaluations visible for the user
  * @param int $stud_id student id (default: all students)
  * @param boolean $recursive process subcategories (default: no recursion)
  */
 public function get_evaluations($stud_id = null, $recursive = false, $course_code = '')
 {
     $evals = array();
     if (empty($course_code)) {
         $course_code = api_get_course_id();
     }
     // 1 student
     if (isset($stud_id) && !empty($stud_id)) {
         // special case: this is the root
         if ($this->id == 0) {
             $evals = Evaluation::get_evaluations_with_result_for_student(0, $stud_id);
         } else {
             $evals = Evaluation::load(null, null, $course_code, $this->id, api_is_allowed_to_edit() ? null : 1);
         }
     } else {
         // all students
         // course admin
         if ((api_is_allowed_to_edit() || api_is_drh() || api_is_session_admin()) && !api_is_platform_admin()) {
             // root
             if ($this->id == 0) {
                 $evals = Evaluation::load(null, api_get_user_id(), null, $this->id, null);
             } elseif (isset($this->course_code) && !empty($this->course_code)) {
                 // inside a course
                 $evals = Evaluation::load(null, null, $course_code, $this->id, null);
             } else {
                 // course independent
                 $evals = Evaluation::load(null, api_get_user_id(), null, $this->id, null);
             }
         } elseif (api_is_platform_admin()) {
             //platform admin
             $evals = Evaluation::load(null, null, $course_code, $this->id, null);
         }
     }
     if ($recursive) {
         $subcats = $this->get_subcategories($stud_id, $course_code);
         if (!empty($subcats)) {
             foreach ($subcats as $subcat) {
                 $subevals = $subcat->get_evaluations($stud_id, true, $course_code);
                 //$this->debugprint($subevals);
                 $evals = array_merge($evals, $subevals);
             }
         }
     }
     return $evals;
 }
Example #29
0
if (isset($_GET['search']) && !empty($_GET['search'])) {
    $keyword = Security::remove_XSS($_GET['search']);
}
if ($simple_search_form->validate() && empty($keyword)) {
    $keyword = $values['keyword'];
}
if (!empty($keyword)) {
    $cats = Category::load($category);
    $allcat = array();
    if (isset($_GET['selectcat']) && $_GET['selectcat'] == 0 && isset($_GET['search'])) {
        $allcat = $cats[0]->get_subcategories(null);
        $allcat_info = Category::find_category($keyword, $allcat);
        $alleval = array();
        $alllink = array();
    } else {
        $alleval = Evaluation::find_evaluations($keyword, $cats[0]->get_id());
        $alllink = LinkFactory::find_links($keyword, $cats[0]->get_id());
    }
} elseif (isset($_GET['studentoverview'])) {
    //@todo this code seems to be deprecated because the gradebook tab is off
    $cats = Category::load($category);
    $stud_id = api_is_allowed_to_edit() ? null : api_get_user_id();
    $allcat = array();
    $alleval = $cats[0]->get_evaluations($stud_id, true);
    $alllink = $cats[0]->get_links($stud_id, true);
    if (isset($_GET['exportpdf'])) {
        $datagen = new GradebookDataGenerator($allcat, $alleval, $alllink);
        $header_names = array(get_lang('Name'), get_lang('Description'), get_lang('Weight'), get_lang('Date'), get_lang('Results'));
        $data_array = $datagen->get_data(GradebookDataGenerator::GDG_SORT_NAME, 0, null, true);
        $newarray = array();
        foreach ($data_array as $data) {
    $resource_name = Database::fetch_array($tempsql);
    if (isset($resource_name['lp_type'])) {
        $resource_name = $resource_name[2];
    } else {
        $resource_name = $resource_name[1];
    }
    $output .= '<tr><td>' . build_type_icon_tag($row['type']) . '</td><td> ' . $resource_name . ' ' . Display::label($table_evaluated[$row['type']][3], 'info') . ' </td>';
    $output .= '<td><input type="hidden" name="link_' . $row['id'] . '" value="' . $resource_name . '" /><input size="10" type="text" name="link[' . $row['id'] . ']" value="' . $item_weight . '"/></td></tr>';
}
$sql = Database::query('SELECT * FROM ' . $table_evaluation . ' WHERE category_id = ' . $my_selectcat);
while ($row = Database::fetch_array($sql)) {
    $item_weight = $row['weight'];
    //$item_weight = $masked_total*$item_weight/$original_total;
    //update only if value changed
    if (isset($_POST['evaluation'][$row['id']])) {
        Evaluation::add_evaluation_log($row['id']);
        //$new_weight = trim($_POST['evaluation'][$row['id']]*$original_total/$masked_total);
        $new_weight = trim($_POST['evaluation'][$row['id']]);
        $update_sql = 'UPDATE ' . $table_evaluation . ' SET weight = ' . "'" . Database::escape_string($new_weight) . "'" . ' WHERE id = ' . $row['id'];
        Database::query($update_sql);
        $item_weight = trim($_POST['evaluation'][$row['id']]);
    }
    $type_evaluated = isset($row['type']) ? $table_evaluated[$type_evaluated][3] : null;
    $output .= '<tr><td>' . build_type_icon_tag('evalnotempty') . '</td><td>' . $row['name'] . ' ' . Display::label(get_lang('Evaluation') . $type_evaluated) . '</td>';
    $output .= '<td><input type="hidden" name="eval_' . $row['id'] . '" value="' . $row['name'] . '" /><input type="text" size="10" name="evaluation[' . $row['id'] . ']" value="' . $item_weight . '"/></td></tr>';
}
//by iflorespaz
$my_api_cidreq = api_get_cidreq();
if ($my_api_cidreq == '') {
    $my_api_cidreq = 'cidReq=' . $my_category['course_code'];
}