Esempio n. 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;
     }
 }
Esempio n. 2
0
 public function findCalender()
 {
     $task = new DBTask();
     $data = $task->findAll();
     $array = array();
     for ($i = 0; $i < count($data); $i++) {
         $date = strtotime($data[$i]->start_time);
         $date = date('m-d-Y', $date);
         if (!isset($array[$date])) {
             $array[$date] = "";
         }
         $array[$date] .= "<a href='taskdetail.php?taskmark=" . $data[$i]->id . "'>" . $data[$i]->title . "</a>";
     }
     // var_dump($array);
     return json_encode($array);
 }
Esempio n. 3
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';
$user = new User();
if (Input::exists('post') && $user->isLoggedIn()) {
    if ($user->data()->group == "T") {
        $data = Input::get('data');
        //var_dump($data);
        $task = new DBTask();
        $flag = true;
        foreach ($data as $key => $value) {
            # code...
            try {
                $task->update(array('importance' => $value['importance']), $value['id']);
            } catch (Exception $e) {
                //echo $e.getMessage();
                $flag = false;
            }
        }
        if ($flag == true) {
            echo 'success';
        } else {
            echo 'later';
        }
    } else {
        echo "noRight";
    }
} else {
    echo 'noLogin';
}