修改:javascript
1,請假時間,去除週末php
2,加班紅字日標註html
3,加班時間9:00-18:00 9:30-18:30java
4,加班時間18:30開始計算git
5, 手動改換休時間github
git clone ...............oa.git
算法
而後找到database裏的sql文件執行sql
修改App.inc.default.php另存爲App.inc.phpapache
log2,請假時間改成9:00-18:00 和9:30-18:30
數組
location: HavedaysModel.php function validHave
版本控制:
git init
git add .
查看:git status -s
git commit -m "Improve:choose leave time"
3.紅字日修改
OvertimeController.php
overtimelist_amin.html
取出表並assign到view:
$sh = $this->get('sh'); $sh['year'] = $sh['year'] ? $sh['year'] : date('Y'); $this->view->assign('redday',$name_list); $userList = $this->UserModel->dayList($sh); $this->view->assign('day_list',$userList);
而後overtimelist.html:
<{for $i=0;$i<16;$i++}> <{if ($overtime.day==$day_list[$i]['red_day'])}> <{$red="red"}><{break}> <{else}><{$red=""}> <{/if}> <{/for}> <font color="<{$red}>"><{brave_date_format date=$overtime.day format='y-m-d'}></font>
git commit -m "red_day modify ok"
4.加班時間18:00~18:30算作18:30
modify OverTimeModel function OverTime:
//modified start_dt date_default_timezone_set("Asia/Shanghai"); // $update['start_dt']=1451298481; $timeStr=(date('Y/m/d/H/i',$update['start_dt'])); $timeArr=explode("/", $timeStr); if ($timeArr[3]==18 && ($timeArr[4] < 30)) { $timeArr[4]=30; } $update['start_dt']=strtotime(implode("", $timeArr));
時間戳與日期相互轉換:day(),strtotime() (生成unix時間戳 time())
數組,字符串互轉:implode(), explode()
5.手動修改換休時間,userController inputAction
$holiday = $this->post('holiday',$this->getSession('holiday_input')); $holidays = $this->UserModel->getInfoHolidays($id); $this->view->assign('holidays',$holidays);
從輸入view到確認view再到save,都是在inputAction中實現,重要的是沒有發現submit,原來都是用session實現的……
$user['work_holiday']=(string)array_sum($holiday['work_holiday_detail']); $user['year_holiday']=(string)array_sum($holiday['year_holiday_detail']);
input.html
<tr><th>換休</th> <td> <{$user.work_holiday|escape}>小時(合計) <{brave_error_hint errors=$errors name=work_holiday}> </td> </tr> <tr><th></th><td> <{if $holidays}> <{foreach from=$holidays.work_holiday_detail item=holiday name=holiday key=key}> <{$key}>: <input style="width:5%;" type="text" name="holiday[work_holiday_detail][]" value="<{$holiday}>">小時<br> <{/foreach}><{/if}> </td> </tr>
動態更新換休總時間:
</script> <script type="text/javascript"> function totaltime(){ var i=0; var work =0; for (var i = 0; i < 4; i++) { var temp = document.getElementById(i).value; var temp = parseFloat(temp); work = work+temp; }; document.getElementById('total-work-holiday').value=work; } </script>
加法老是出問題,由於js是弱類型語言,因此a=1,b=1,a+b會獲得11,必須先parseInt或者parseFloat
提交到git:
查看destination別名origin:
$ git remote -v
設置origin
git remote set-url origin https://github.com/xxx.gitor git remote add origin https://github.com/xxx.git
直接git clone,copy下來的是master branch,指定branch克隆:
git clone -b <branch> <remote_repo>
查看遠程倉庫的詳細信息:
git remote show origin
2016/1/14
加班提交驗證,id,start_time ,end_time
時間修改,兩年
apache conf修改
http://stackoverflow.com/questions/10873295/error-message-forbidden-you-dont-have-permission-to-access-on-this-server
<Directory /> #Options FollowSymLinks Options Indexes FollowSymLinks Includes ExecCGI AllowOverride All Order deny,allow Allow from all </Directory>
JS判斷表單重複提交:
var checkSubmitFlg = false; if (checkSubmitFlg == true) { alert('重複提交'); return false; }else{ checkSubmitFlg == true; $('#submit_text').submit(); }
2016/2/25
請假時間又出問題了,因此從新找了一個算法來減去週末的時間:
http://www.jb51.net/article/20886.htm
function get_weekend_days($start_date,$end_date){ if (strtotime($start_date) > strtotime($end_date)) list($start_date, $end_date) = array($end_date, $start_date); $start_reduce = $end_add = 0; $start_N = date('N',strtotime($start_date)); $start_reduce = ($start_N == 7) ? 1 : 0; $end_N = date('N',strtotime($end_date)); in_array($end_N,array(6,7)) && $end_add = ($end_N == 7) ? 2 : 1; $days = abs(strtotime($end_date) - strtotime($start_date))/86400 + 1; return floor(($days + $start_N - 1 - $end_N) / 7) * 2 - $start_reduce + $end_add; }