/**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Assignment();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Assignment'])) {
         $model->attributes = $_POST['Assignment'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model));
 }
Beispiel #2
0
 /**
  * @before _secure, _teacher
  */
 public function create($course_id, $classroom_id)
 {
     $teach = \Teach::first(array("course_id = ?" => $course_id, "user_id = ?" => $this->user->id));
     if (!$teach || $teach->classroom_id != $classroom_id) {
         self::redirect("/teacher");
     }
     $this->setSEO(array("title" => "Teacher | Create Assignments"));
     $view = $this->getActionView();
     $grade = Grade::first(array("id = ?" => $teach->grade_id), array("title", "id"));
     $classroom = Classroom::first(array("id = ?" => $classroom_id), array("section", "id"));
     $view->set("grade", $grade);
     $view->set("classroom", $classroom);
     if (RequestMethods::post("action") == "assignment") {
         $headers = getallheaders();
         $attachment = $this->_upload("attachment", "assignments");
         $assignment = new \Assignment(array("title" => RequestMethods::post("title"), "description" => RequestMethods::post("description"), "deadline" => RequestMethods::post("deadline"), "user_id" => $this->user->id, "organization_id" => $this->organization->id, "classroom_id" => $classroom_id, "course_id" => $course_id, "attachment" => $attachment));
         if (!$assignment->validate()) {
             $view->set("success", "Invalid Request");
             return;
         }
         $assignment->save();
         $view->set("success", "Assignment Created successfully!!");
     }
 }
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate($id = null)
 {
     $model = new Assignment();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Assignment'])) {
         $model->attributes = $_POST['Assignment'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     if ($id) {
         $cloned = $this->loadModel($id);
         Helpers::object2object($cloned, $model, array('subject', 'title', 'description', 'checklist', 'url', 'duedate', 'grace', 'language', 'status', 'notification', 'shown_since'));
     } else {
         $model->grace = Helpers::getYiiParam('defaultGrace');
         $model->duedate = date('Y-m-d') . ' 23:59:00';
         $model->shown_since = date('Y-m-d H:i:s');
         $model->language = Yii::app()->language;
         $model->status = Helpers::getYiiParam('defaultAssignmentStatus');
         $cloned = null;
     }
     $this->render('create', array('model' => $model, 'cloned' => $cloned));
 }
Beispiel #4
0
require_once 'includes/initialize.php';
if (!$session->is_logged_in()) {
    redirect_to("login.php");
}
if (isset($_POST['submit'])) {
    //creating a new Assignment
    $assignment = new Assignment();
    $assignment->subject = $_POST['subject'];
    $assignment->description = $_POST['description'];
    $assignment->teacher = $_POST['teacher'];
    $assignment->batch = $_POST['batch'];
    $deadline = strtotime($_POST['deadline']);
    $assignment->deadline = strftime("%Y-%m-%d %H:%M:%S", $deadline);
    $assignment->created = strftime("%Y-%m-%d %H:%M:%S", time());
    if ($assignment->save()) {
        $session->message("Assignment created successfully.");
        redirect_to('index.php');
    } else {
        // Failure
        $session->message("Assignment failed.");
        redirect_to('index.php');
    }
}
?>

<?php 
include_layout_template('admin_header.php');
?>
<!-- datepicker javascript -->
<link href="public/datetime/bootstrap-datetimepicker.min.css" rel="stylesheet" media="screen">
Beispiel #5
0
     $assignment->delete();
     //notify eventmanager
     $eventNotifier->notifyCourseEvent('work_deleted', claro_get_current_course_id(), claro_get_current_tool_id(), $assigId, claro_get_current_group_id(), '0');
     $dialogBox->success(get_lang('Assignment deleted'));
 }
 /*--------------------------------------------------------------------
                         MODIFY AN ASSIGNMENT
   --------------------------------------------------------------------*/
 /*-----------------------------------
       STEP 2 : check & query
   -------------------------------------*/
 // edit an assignment / form has been sent
 if ($cmd == 'exEditAssig') {
     // check validity of the data
     if (!is_null($assigId) && $assignment->validate()) {
         $assignment->save();
         $eventNotifier->notifyCourseEvent('work_updated', claro_get_current_course_id(), claro_get_current_tool_id(), $assigId, claro_get_current_group_id(), '0');
         $dialogBox->success(get_lang('Assignment modified'));
     } else {
         if (claro_failure::get_last_failure() == 'assignment_no_title') {
             $dialogBox->error(get_lang('Assignment title required'));
         }
         if (claro_failure::get_last_failure() == 'assignment_title_already_exists') {
             $dialogBox->error(get_lang('Assignment title already exists'));
         }
         if (claro_failure::get_last_failure() == 'assignment_incorrect_dates') {
             $dialogBox->error(get_lang('Start date must be before end date ...'));
         }
         $cmd = 'rqEditAssig';
     }
 }
 public function reassign()
 {
     $assignment = Assignment::find(new MongoId(Input::get('taskReassined')));
     $assignment->state = "nc";
     $assignment->save();
     $new = new Assignment();
     $new->description = $assignment->description;
     $new->group_id = new MongoId($assignment->group_id);
     $new->state = 'r';
     $new->rated = null;
     $new->date_assigned = new MongoDate();
     $new->score = $assignment->score;
     $new->assigned_by = new MongoId($assignment->assigned_by);
     $new->assigned_to = new MongoId(Input::get('studentsReassigned'));
     $new->deadline = new MongoDate(strtotime(Input::get('deadlineReassigned')));
     $new->reference = new MongoId($assignment->_id);
     $new->save();
     return Redirect::to(Lang::get('routes.show_all_assignment'))->with('message', Lang::get('register_assignment.reassigned'));
 }
Beispiel #7
0
    $autoFeedbackSubmitMethod = $_REQUEST['autoFeedbackSubmitMethod'];
}
if ($is_allowedToEdit) {
    /*--------------------------------------------------------------------
      MODIFY An ASSIGNMENT FEEDBACK
      --------------------------------------------------------------------*/
    /*-----------------------------------
      STEP 2 : check & query
      -------------------------------------*/
    // edit an assignment / form has been sent
    if ($cmd == 'exEditFeedback') {
        $assignment->setAutoFeedbackText($autoFeedbackText);
        $assignment->setAutoFeedbackFilename($autoFeedbackFilename);
        $assignment->setAutoFeedbackSubmitMethod($autoFeedbackSubmitMethod);
        // form data have been handled before this point if the form was sent
        if ($formCorrectlySent && $assignment->save()) {
            $dialogBox->success(get_lang('Feedback edited'));
            $dialogBox->info('<a href="' . claro_htmlspecialchars(Url::Contextualize('./work_list.php?assigId=' . $assignmentId)) . '">' . get_lang('Continue') . '</a>');
            $displayFeedbackForm = false;
            //report event to eventmanager "feedback_posted"
            $eventNotifier->notifyCourseEvent("work_feedback_posted", claro_get_current_course_id(), claro_get_current_tool_id(), $assignmentId, '0', '0');
        } else {
            $cmd = 'rqEditFeedback';
        }
    }
    /*-----------------------------------
      STEP 1 : display form
      -------------------------------------*/
    // edit assignment / display the form
    if ($cmd == 'rqEditFeedback') {
        require_once get_path('incRepositorySys') . '/lib/form.lib.php';
 public function post_assignauditors()
 {
     $auditors = Input::get('auditorCheckBox');
     $categories = Input::get('categoryCheckBox');
     //Start our validator
     $validator = Validator::make(array('auditors' => $auditors, 'categories' => $categories), array('auditors' => 'required|array', 'categories' => 'required|array'));
     if ($validator->fails()) {
         return Redirect::route('consoleassignauditors')->withErrors($validator);
     }
     $auditors = implode(',', $auditors) . ',';
     $vas = '';
     foreach ($categories as $category) {
         $query = User::where('categories', 'like', '%' . $category . ',%')->where('status', '>', -1)->get();
         foreach ($query as $va) {
             $vas = $vas . $va->cid . ',';
         }
     }
     //Now check for duplicate entries (duplicate VAs)
     $vaarray = explode(',', $vas);
     //Remove the last empty array key
     $vaarraycount = count($vaarray) - 1;
     unset($vaarray[$vaarraycount]);
     //Remove duplicate keys
     $vaarray = array_unique($vaarray);
     //Convert it back to a comma delimitted string
     $vas = implode(',', $vaarray) . ',';
     $categories = implode(',', $categories) . ',';
     $assignment = new Assignment();
     $assignment->vas = $vas;
     $assignment->categories = $categories;
     $assignment->auditors = $auditors;
     //Save our new assignment
     $assignment->save();
     //Finally redirect back to the assignments page
     return Redirect::route('consoleassignauditors')->with('message', 'New Auditor Assignment Created Successfully.');
 }