Ver Fonte

新建课程增加日期和持续时间

visuddhinanda há 5 anos atrás
pai
commit
bd1d72165d

+ 1 - 6
app/course/my_course_new.php

@@ -17,11 +17,6 @@ echo '</div>';
 <input type="hidden" name="op" value="insert" />
 
 <div id="userfilelist">
-    <div style="display:flex;">
-    <div style="flex:2;">封面</div>
-    <div style="flex:8;"></div>
-    <input type="hidden" name="cover" value="" />
-    </div>
 
     <div style="display:flex;">
     <div style="flex:2;">标题</div>
@@ -31,7 +26,7 @@ echo '</div>';
     </div>
     </div>
 
-    <div style="display:flex;">
+    <div style="display:none;">
     <div style="flex:2;">副标题</div>
     <div style="flex:8;">
         <div style="text-align: right;color:gray;">0/32</div>

+ 8 - 3
app/course/my_lesson_insert.php

@@ -6,11 +6,16 @@ require_once '../public/function.php';
 global $PDO;
 PDO_Connect("sqlite:"._FILE_DB_COURSE_);
 
-$query = "INSERT INTO lesson (id, course_id, video, link, title,  subtitle, creator, tag, summary, status, cover, teacher, attachment , lang , speech_lang , create_time , modify_time , receive_time ) 
-                      VALUES (? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? )";
+$query = "INSERT INTO lesson (id, course_id,  live, replay, title,  subtitle ,  date ,  duration  ,  creator,  tag,  summary,  status,  cover,  teacher, attachment , lang , speech_lang , create_time , modify_time , receive_time ) 
+				 VALUES (? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? )";
+
 $sth = $PDO->prepare($query);
+$data = strtotime($_POST["lesson_date"]);
+$time = strtotime($_POST["lesson_time"]) - strtotime("today");
+$datatime = ($data+$time)*1000;
+$duration = strtotime($_POST["duration"]) - strtotime("today");
 
-$sth->execute(array(UUID::v4(), $_POST["course_id"] , $_POST["video"] , $_POST["link"] ,$_POST["title"] , $_POST["subtitle"]  , $_COOKIE["userid"] , $_POST["tag"] ,$_POST["summary"] , 1, $_POST["cover"] ,$_POST["teacher"] , $_POST["attachment"] , $_POST["lang"] , $_POST["speech_lang"] ,mTime() , mTime() ,  mTime() ));
+$sth->execute(array(UUID::v4(), $_POST["course_id"] , $_POST["live"] , $_POST["replay"] ,$_POST["title"] , $_POST["subtitle"]  , $datatime  , $duration  , $_COOKIE["userid"] , $_POST["tag"] ,$_POST["summary"] , 1, $_POST["cover"] ,$_POST["teacher"] , $_POST["attachment"] , $_POST["lang"] , $_POST["speech_lang"] ,mTime() , mTime() ,  mTime() ));
 $respond=array("status"=>0,"message"=>"");
 if (!$sth || ($sth && $sth->errorCode() != 0)) {
 	$error = PDO_ErrorInfo();

+ 15 - 9
app/course/my_lesson_new.php

@@ -31,10 +31,6 @@ echo '</div>';
 <input type="hidden" name="video" value="" />
 
 <div id="userfilelist">
-    <div style="display:flex;">
-    <div style="flex:2;">封面</div>
-    <div style="flex:8;"></div>
-    </div>
 
     <div style="display:flex;">
     <div style="flex:2;">标题</div>
@@ -44,7 +40,7 @@ echo '</div>';
     </div>
     </div>
 
-    <div style="display:flex;">
+    <div style="display:none;">
     <div style="flex:2;">副标题</div>
     <div style="flex:8;">
         <div style="text-align: right;color:gray;">0/32</div>
@@ -66,12 +62,20 @@ echo '</div>';
     </div> 
 
     <div style="display:flex;">
-    <div style="flex:2;">链接</div>
-    <div style="flex:8;"><textarea  style="height:6em;"></textarea></div>
+        <div style="flex:2;">直播信息</div>
+        <div style="flex:8;"><textarea  name="live"  style="height:6em;"></textarea></div>
     </div>
     <div style="display:flex;">
-    <div style="flex:2;">链接(中国大陆)</div>
-    <div style="flex:8;"><textarea style="height:6em;"></textarea></div>
+        <div style="flex:2;">课程时间</div>
+        <div style="flex:8;">
+    日期: <input type="date" name="lesson_date" value=""/>
+    时间: <input type="time" name="lesson_time" value="08:00"/>
+   课程持续时间: <input type="time" name="duration" value="01:00"/>
+        </div>
+    </div>
+    <div style="display:flex;">
+    <div style="flex:2;">录播信息</div>
+    <div style="flex:8;"><textarea name="replay" style="height:6em;"></textarea></div>
     </div>
 
     <div style="display:flex;">
@@ -82,6 +86,8 @@ echo '</div>';
     </div>
     </div> 
 
+
+
     <div style="display:flex;">
     <div style="flex:2;">标签</div>
     <div   style="flex:8;">

+ 77 - 59
app/ucenter/name_selector.js

@@ -1,73 +1,91 @@
 var user_select_param;
-function name_selector_init(container,parameter){
-    user_select_param = parameter;
-    $.get("../ucenter/get.php",
-        {
-            id:$("#"+parameter.input_id).val()
-        },
-        function(data,status){
-            let result= JSON.parse(data);
-            let html = '<div id="user_select_nickname" onclick="user_select_click()">';
-            if(result.length>0){
-                html += result[0].nickname;
-            }
-            else{
-                html += "未找到";
-            }
-            html += "</div>";
-            html += "<div id='user_selector_popwin' style='position: absolute; background-color: dimgray; padding: 8px;display: none;'><input id='user_selector_input' type='input' onkeyup=\"user_select_search_keyup(event,this)\" /><div id='user_selector_list'></div></div>"
-            $("#"+container).html(html);
-        });
+function name_selector_init(container, parameter) {
+  user_select_param = parameter;
+  $.get(
+    "../ucenter/get.php",
+    {
+      id: $("#" + parameter.input_id).val(),
+    },
+    function (data, status) {
+      let result = JSON.parse(data);
+      let html =
+        '<div id="user_select_nickname" onclick="user_select_click()">';
+      if (result.length > 0) {
+        html += result[0].nickname;
+      } else {
+        html += "未找到";
+      }
+      html += "</div>";
+      html +=
+        "<div id='user_selector_popwin' style='position: absolute; background-color: dimgray; padding: 8px;display: none;'>";
+      html +=
+        "<input id='user_selector_input' type='input' onkeyup=\"user_select_search_keyup(event,this)\" />";
+      html += "<div id='user_selector_list'></div>";
+      html += "<span onclick='user_select_close()'>关闭</span>";
+      html += "</div>";
+      $("#" + container).html(html);
+    }
+  );
 }
 
-function user_select_click(){
-    $("#user_selector_popwin").show();
+function user_select_click() {
+  $("#user_selector_popwin").show();
 }
 
-function user_select_search_keyup(e,obj){
-    var keynum
-    var keychar
-    var numcheck
+function user_select_close() {
+  $("#user_selector_popwin").hide();
+}
 
+function user_select_search_keyup(e, obj) {
+  var keynum;
+  var keychar;
+  var numcheck;
 
-    
-    if(window.event) // IE
-    {
-        keynum = e.keyCode
-    }
-    else if(e.which) // Netscape/Firefox/Opera
-    {
-        keynum = e.which
-    }
-    var keychar = String.fromCharCode(keynum)
-    if(keynum==13){
-
-    }
-    else{
-        user_select_search(obj.value);
-    }
+  if (window.event) {
+    // IE
+    keynum = e.keyCode;
+  } else if (e.which) {
+    // Netscape/Firefox/Opera
+    keynum = e.which;
+  }
+  var keychar = String.fromCharCode(keynum);
+  if (keynum == 13) {
+  } else {
+    user_select_search(obj.value);
+  }
 }
 
-function user_select_search(keyword){
-    $.get("../ucenter/get.php",
+function user_select_search(keyword) {
+  $.get(
+    "../ucenter/get.php",
     {
-        username:keyword
+      username: keyword,
     },
-    function(data,status){
-        let result= JSON.parse(data);
-        let html="<div id='user_list'>";
-        if(result.length>0){
-            for(x in result){
-                html += "<div><a onclick=\"user_select_apply('"+result[x].id+"','"+result[x].nickname+"')\">"+result[x].nickname+"["+result[x].email+"]</a></div>";
-            }
+    function (data, status) {
+      let result = JSON.parse(data);
+      let html = "<div id='user_list'>";
+      if (result.length > 0) {
+        for (x in result) {
+          html +=
+            "<div><a onclick=\"user_select_apply('" +
+            result[x].id +
+            "','" +
+            result[x].nickname +
+            "')\">" +
+            result[x].nickname +
+            "[" +
+            result[x].email +
+            "]</a></div>";
         }
-        html += "</div>";
-        $("#user_selector_list").html(html);
-    });
+      }
+      html += "</div>";
+      $("#user_selector_list").html(html);
+    }
+  );
 }
 
-function user_select_apply(userid,nickname){
-    $("#"+user_select_param.input_id).val(userid);
-    $("#user_select_nickname").html(nickname);
-    $("#user_list").hidden();
-}
+function user_select_apply(userid, nickname) {
+  $("#" + user_select_param.input_id).val(userid);
+  $("#user_select_nickname").html(nickname);
+  $("#user_selector_popwin").hide();
+}