Example #1
0
 public function getMessage()
 {
     if ($this->_user->isLoggedIn()) {
         $task = new DBTask();
         $reply = new DBReply();
         $taskSubmit = new TaskSubmit();
         //$date = new Date();
         $date = strtotime('now');
         $date1 = $date + 24 * 3600;
         $taskArray = $task->findWithDateBetween($date, $date1);
         //在task里寻找截止时间在$date和$date+1的;
         if ($taskArray) {
             foreach ($taskArray as $key => $value) {
                 if (!$taskSubmit->findWithUserAndTask($this->_user->data()->id, $value->id)) {
                     //查找数据库里有没有改学生提交作业的记录
                     array_push($this->_calendarArray, $value);
                     $message = '';
                     if ($this->_user->data()->group == "S") {
                         if ($value->type == "H") {
                             $message = "您的实验尚未完成,该试验为" . $value->title;
                         } else {
                             if ($value->type == "E") {
                                 $message = "您的作业尚未完成,该作业为" . $value->title;
                             }
                         }
                         $array = array('type' => 'task', 'taskId' => $value->id, 'message' => $message);
                         array_push($this->_messageArray, $array);
                     }
                 }
             }
         }
         $replyArray = $reply->findWithIdNotRead($this->_user->data()->id);
         if ($replyArray) {
             foreach ($replyArray as $key => $value) {
                 # code...
                 $sender = $this->_user->find($value->sender)->data()->name;
                 $array = array('type' => 'post', 'replyId' => $value->id, 'postId' => $value->post_id, 'message' => $sender . "在论坛帖子中回复了你");
                 array_push($this->_replyArray, $value);
                 array_push($this->_messageArray, $array);
             }
         }
         return $this->_messageArray;
     } else {
         return false;
     }
 }
Example #2
0
<?php

include 'includes/header.php';
$task = new DBTask();
$taskAll = $task->findAll();
$dbtaskSubmit = new DBTaskSubmit();
$taskSubmit = new TaskSubmit();
$submitData = $dbtaskSubmit->findAll();
$student = new DBStudent();
$stu = $student->findAll();
//var_dump($submitData);
?>
<link rel="stylesheet" type="text/css" href="css/table/component.css">
<link rel="stylesheet" type="text/css" href="css/grade.css">  
<div id="modal" class="modal fade" role="dialog" aria-labelledby="newEventModal">
      <div class="modal-dialog" role="document">
          <div class="modal-content">
            <div class="modal-header">
              <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
              <h4 class="modal-title" id="ModalLabel">任务权重</h4>
            </div>
            <div class="modal-body">
            <div class="task-box row">
                <div class="col-md-10 col-md-offset-1">
                    <p>为各个作业分配0-10的权重</p>
                    <?php 
if ($taskAll) {
    foreach ($taskAll as $key => $value) {
        # code...
        ?>
                    <div class="tasks">
<?php

require_once "core/init.php";
$taskSubmit = new TaskSubmit();
$data = Input::get('data');
$success = array("info" => "success");
$fail = array("info" => "fail");
//echo json_encode($data);
if ($taskSubmit->update($data)) {
    echo json_encode($success);
} else {
    echo json_encode($fail);
}