| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- <?php
- class meetingClassModel extends Model
- {
- public $hyarra, $ytarra, $hyarrb;
- public function initModel()
- {
- $this->hyarra = array('正常', '会议中', '结束', '取消');
- $this->ytarra = array('待进行', '待进行', '进行中', '已结束');
- $this->hyarrb = array('green', 'blue', '#ff6600', '#888888');
- }
- /**
- * 判断会议室是否重复申请了
- */
- public function isapplymsg($startdt, $enddt, $hyname, $id=0, $meetType=1)
- {
- $msg = '';
- if ($meetType == 1) {
- $sql = /** @lang text */
- 'select id, meeting_room, start_time, end_time, title
- from xinhu_meeting where id <> '.$id.' and meet_state in (0, 1)
- union all
- select id, meeting_room, start_time, end_time, title
- from xinhu_meeting_key where meet_state in (0, 1)';
- } else {
- $sql = /** @lang text */
- 'select id, meeting_room, start_time, end_time, title
- from xinhu_meeting where meet_state in (0, 1)
- union all
- select id, meeting_room, start_time, end_time, title
- from xinhu_meeting_key where id <> '.$id.' and meet_state in (0, 1)';
- }
- m('log')->addlog("验证", $sql);
- $rows = $this->db->getall($sql);
- foreach($rows as $k=>$rs){
- if($rs['meeting_room'] != $hyname)continue;
- $sdt = $rs['start_time'];
- $edt = $rs['end_time'];
- m('log')->addlog("验证", json_encode($rs));
- if(
- ($sdt<=$startdt && $edt>$startdt)
- || ($sdt<$enddt && $edt>=$enddt)
- || ($sdt>$startdt && $edt<$enddt)
- || ($sdt==$startdt && $edt==$enddt)
- )$msg = '该会议室的时间段已被申请过了,主题“'.$rs['title'].'”';
- }
- return $msg;
- }
- public function firstMeetingTopicStart($meeting_id) {
- $topic = m('meeting_topics')->getone("mid={$meeting_id}", "id", 'sort');
- if (isset($topic['id'])) {
- m('meeting_topics')->update(['topic_state'=>'2'], 'id='.$topic['id']);
- }
- }
- // 会议室状态
- public function getstatezt($zt)
- {
- if (isset($this->hyarrb[$zt])) {
- $html = '<font color="'.$this->hyarrb[$zt].'">'.$this->hyarra[$zt].'</font>';
- return $html;
- } else {
- return null;
- }
- }
- }
|