manual calendar feature
This commit is contained in:
parent
576b4672ac
commit
55c9ddfe45
|
@ -55,11 +55,25 @@ class attendancelog {
|
||||||
$rez['week1'] = $week['week_cur'];
|
$rez['week1'] = $week['week_cur'];
|
||||||
return $rez;
|
return $rez;
|
||||||
}
|
}
|
||||||
function timeGroup() {
|
|
||||||
|
|
||||||
$raspis = $this->mainPageAction();
|
|
||||||
|
|
||||||
|
function getGroupNameByID($id) {
|
||||||
|
$sql_search = 'SELECT sokr, fo FROM acs_grupp WHERE id='. $id .' ';
|
||||||
|
return $this->DB->QUR_SEL($sql_search);
|
||||||
|
}
|
||||||
|
function mainPageAction()
|
||||||
|
{
|
||||||
|
$current_group = $this->getGroupNamebyID($_GET['id']);
|
||||||
|
$current_group_classes = $this->getClassesByGroup($current_group[1]['sokr'], $current_group[1]['fo']);
|
||||||
|
$currentTime = $this->currentTime();
|
||||||
$out = array();
|
$out = array();
|
||||||
|
foreach ($current_group_classes['raspis'] as $class) {
|
||||||
|
if ($class['week1'] == $currentTime['week1']) {
|
||||||
|
$out['info'][$class['day1']]['day_name'] = $class['day_name'];
|
||||||
|
$out['info'][$class['day1']][$class['time1']] = $class;
|
||||||
|
$out['students'] = $this->getStudentsByGroup($current_group[1]['sokr'], $current_group[1]['fo']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$currentTime = $this->currentTime();
|
$currentTime = $this->currentTime();
|
||||||
$first_weekday_of_year = $currentTime['year'] .'-01-01';
|
$first_weekday_of_year = $currentTime['year'] .'-01-01';
|
||||||
$first_weekday_of_year= date('w', strtotime($first_weekday_of_year));
|
$first_weekday_of_year= date('w', strtotime($first_weekday_of_year));
|
||||||
|
@ -69,49 +83,20 @@ class attendancelog {
|
||||||
$day = 1;
|
$day = 1;
|
||||||
$week = 1;
|
$week = 1;
|
||||||
for ($day; $day <= $day_in_month; $day++){
|
for ($day; $day <= $day_in_month; $day++){
|
||||||
if($weekday > 7){
|
|
||||||
$weekday = 1;
|
|
||||||
$week++;
|
|
||||||
}
|
|
||||||
$tmp1 = $currentTime['year'] . '-' . $month . '-' . '01';
|
$tmp1 = $currentTime['year'] . '-' . $month . '-' . '01';
|
||||||
$month_name = date('M',strtotime($tmp1));
|
$month_name = date('M',strtotime($tmp1));
|
||||||
$out[$currentTime['year']][$month_name][$week . ' неделя'][$day] = $raspis['info'][$weekday];
|
$result[$currentTime['year']][$month_name][$week][$day] = $out['info'][$weekday];
|
||||||
|
if($weekday > 6){
|
||||||
|
$weekday = 1;
|
||||||
$weekday++;
|
$week++;
|
||||||
|
}else{
|
||||||
}
|
$weekday++;
|
||||||
}
|
|
||||||
|
|
||||||
return $out;
|
|
||||||
}
|
|
||||||
function getGroupNameByID($id) {
|
|
||||||
$sql_search = 'SELECT sokr, fo FROM acs_grupp WHERE id='. $id .' ';
|
|
||||||
return $this->DB->QUR_SEL($sql_search);
|
|
||||||
}
|
|
||||||
function mainPageAction()
|
|
||||||
{
|
|
||||||
$des = ''; if(isset($_GET['des'])) $des = $_GET['des'];
|
|
||||||
if ($des == 'show'){
|
|
||||||
//получаем список пар по имени группы
|
|
||||||
// $current_group = $this->getGroupNamebyID($_GET['id']);
|
|
||||||
// return $this->getStudentsByGroup($current_group[1]['sokr'], $current_group[1]['fo']);
|
|
||||||
|
|
||||||
|
|
||||||
$current_group = $this->getGroupNamebyID($_GET['id']);
|
|
||||||
$current_group_classes = $this->getClassesByGroup($current_group[1]['sokr'], $current_group[1]['fo']);
|
|
||||||
$currentTime = $this->currentTime();
|
|
||||||
$out = array();
|
|
||||||
foreach ($current_group_classes['raspis'] as $class) {
|
|
||||||
if ($class['week1'] == $currentTime['week1']) {
|
|
||||||
$out['info'][$class['day1']]['day_name'] = $class['day_name'];
|
|
||||||
$out['info'][$class['day1']][$class['time1']] = $class;
|
|
||||||
$out['students'] = $this->getStudentsByGroup($current_group[1]['sokr'], $current_group[1]['fo']);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $out;
|
}
|
||||||
}elseif($des == 'calendar_show'){
|
$des = ''; if(isset($_GET['des'])) $des = $_GET['des'];
|
||||||
|
if ($des == 'show'){
|
||||||
|
return $result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function HTML()
|
function HTML()
|
||||||
|
@ -120,12 +105,10 @@ class attendancelog {
|
||||||
$groups = $this->getAllGrupps();
|
$groups = $this->getAllGrupps();
|
||||||
$actionResult = $this->mainPageAction();
|
$actionResult = $this->mainPageAction();
|
||||||
$currentTime = $this->currentTime();
|
$currentTime = $this->currentTime();
|
||||||
$timeGroup = $this->timeGroup();
|
|
||||||
//$html .= '<pre>'. print_r($groups,1) . '</pre>';
|
//$html .= '<pre>'. print_r($groups,1) . '</pre>';
|
||||||
//$html .= '<pre>'. print_r($actionResult,1) . '</pre>';
|
$html .= '<pre>'. print_r($actionResult,1) . '</pre>';
|
||||||
$html .= '<pre>'. print_r($timeGroup,1) . '</pre>';
|
|
||||||
//$html .= '<pre>'. print_r($currentTime,1) . '</pre>';
|
//$html .= '<pre>'. print_r($currentTime,1) . '</pre>';
|
||||||
//$html .= '<pre>'. print_r($_GET,1) . '</pre>';
|
$html .= '<pre>'. print_r($_GET,1) . '</pre>';
|
||||||
//$html .= '<pre>'. print_r($_POST,1) . '</pre>';
|
//$html .= '<pre>'. print_r($_POST,1) . '</pre>';
|
||||||
//$html .= '<pre>'. print_r($_SESSION,1) . '</pre>';
|
//$html .= '<pre>'. print_r($_SESSION,1) . '</pre>';
|
||||||
GLOBAL $smarty;
|
GLOBAL $smarty;
|
||||||
|
|
|
@ -32,84 +32,127 @@
|
||||||
<div class="span12">
|
<div class="span12">
|
||||||
<div class="widget blue">
|
<div class="widget blue">
|
||||||
<div class="widget-title">
|
<div class="widget-title">
|
||||||
<h4><i class="icon-reorder"></i> Посещение группы {$groupName} </h4>
|
<h4><i class="icon-reorder"></i> Посещение группы </h4>
|
||||||
<span class="tools"><a href="javascript:;" class="icon-chevron-down"></a></span>
|
<span class="tools"><a href="javascript:;" class="icon-chevron-down"></a></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="widget-body">
|
<div class="widget-body">
|
||||||
<div class="tabbable custom-tab">
|
{foreach from=$actionResult[$currentTime['year']] key=month_key item=month}
|
||||||
<ul class="nav nav-tabs">
|
<table class="table table-striped table-bordered">
|
||||||
{foreach from=$actionResult.info key=key item=day}
|
<tbody>
|
||||||
<li {if $key == $currentTime.day1} class="active" {/if}><a href="#tab_1_{$key}" data-toggle="tab">{$day['day_name']}</a></li>
|
<tr><td colspan="8" style="text-align: center">{$month_key}</td></tr>
|
||||||
{/foreach}
|
<tr>
|
||||||
</ul>
|
<th style="text-align: center">Понедельник</th>
|
||||||
<div class="tab-content" style="overflow-x: scroll">
|
<th style="text-align: center">Вторник</th>
|
||||||
{foreach from=$actionResult.info key=key item=day}
|
<th style="text-align: center">Среда</th>
|
||||||
<div class="tab-pane {if $key == $currentTime.day1} active {/if}" id="tab_1_{$key}">
|
<th style="text-align: center">Четверг</th>
|
||||||
<div class="accordion" id="accordion{$key}">
|
<th style="text-align: center">Пятница</th>
|
||||||
{foreach from=$day key=key item=class}
|
<th style="text-align: center">Суббота</th>
|
||||||
{if $key != 0}
|
<th style="text-align: center">Воскресенье</th>
|
||||||
<table class="table">
|
</tr>
|
||||||
<tbody>
|
{foreach from=$month key=week_key item=week}
|
||||||
<tr>
|
<tr>
|
||||||
<td style="vertical-align: middle; text-align: center;"><h3 class="text-warning">{$class.time1}</h3></td>
|
{if count($week) < 7 and $week_key == 1}
|
||||||
<td style="vertical-align: middle; "><div class="accordion-group">
|
{for $foo=1 to (7 - count($week))}
|
||||||
<div class="accordion-heading">
|
<td></td>
|
||||||
<a class="accordion-toggle {if $key != $currentTime.time1 } collapsed {/if}" data-toggle="collapse" data-parent="#accordion{$day.day1}" href="#collapse_{$class.day1}-{$class.time1}">
|
{/for}
|
||||||
{$class.predmet}
|
{/if}
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
<div id="collapse_{$class.day1}-{$class.time1}" class="accordion-body collapse {if $key == $currentTime.time1 } in {/if}">
|
|
||||||
<div class="accordion-inner">
|
|
||||||
<form action="" method="post">
|
|
||||||
<table class="table table-striped">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>No</th>
|
|
||||||
<th>ФИО</th>
|
|
||||||
<th>Присутствие</th>
|
|
||||||
<th>Примечание</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
{foreach from=$actionResult.students.students key=key item=student}
|
|
||||||
<tr>
|
|
||||||
<td>{$key}</td>
|
|
||||||
<td>{$student}</td>
|
|
||||||
<td>
|
|
||||||
<input type="hidden" name="attendance_add_edit[attendance][{$student}]" value="off">
|
|
||||||
<input type="hidden" name="attendance_add_edit[info]['week1']" value="{$class.week1}">
|
|
||||||
<input type="hidden" name="attendance_add_edit[info]['day1']" value="{$class.day1}">
|
|
||||||
<input type="hidden" name="attendance_add_edit[info]['time1']" value="{$class.time1}">
|
|
||||||
<input type="hidden" name="attendance_add_edit[info]['predmet']" value="{$class.predmet}">
|
|
||||||
<input type="hidden" name="attendance_add_edit[info]['gruppa']" value="{$groupName}">
|
|
||||||
<input type="checkbox" name="attendance_add_edit[attendance][{$student}]" id="{$key}">
|
|
||||||
</td>
|
|
||||||
<td><input type="text" name="" id="" value=""></td>
|
|
||||||
</tr>
|
|
||||||
{/foreach}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
<button type="submit" class="btn btn-success">Сохранить</button>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div></td>
|
{foreach from=$week key=day_key item=day}
|
||||||
</tr>
|
<td style="text-align: center"><a href="/modul/attendancelog/main/day_show/{$smarty.get.id}?month={$month_key}&week={$week_key}&day={$day_key}/">{$day_key}</a> </td>
|
||||||
</tbody>
|
|
||||||
|
|
||||||
</table>
|
|
||||||
{/if}
|
|
||||||
{/foreach}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{/foreach}
|
{/foreach}
|
||||||
</div>
|
</tr>
|
||||||
</div>
|
{/foreach}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
{/foreach}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{else if $des == 'day_show'}
|
||||||
|
<!-- <div class="row-fluid">-->
|
||||||
|
<!-- <div class="span12">-->
|
||||||
|
<!-- <div class="widget blue">-->
|
||||||
|
<!-- <div class="widget-title">-->
|
||||||
|
<!-- <h4><i class="icon-reorder"></i> Посещение группы {$groupName} </h4>-->
|
||||||
|
<!-- <span class="tools"><a href="javascript:;" class="icon-chevron-down"></a></span>-->
|
||||||
|
<!-- </div>-->
|
||||||
|
<!-- <div class="widget-body">-->
|
||||||
|
<!-- <div class="tabbable custom-tab">-->
|
||||||
|
<!-- <ul class="nav nav-tabs">-->
|
||||||
|
<!-- {foreach from=$actionResult.info key=key item=day}-->
|
||||||
|
<!-- <li {if $key == $currentTime.day1} class="active" {/if}><a href="#tab_1_{$key}" data-toggle="tab">{$day['day_name']}</a></li>-->
|
||||||
|
<!-- {/foreach}-->
|
||||||
|
<!-- </ul>-->
|
||||||
|
<!-- <div class="tab-content" style="overflow-x: scroll">-->
|
||||||
|
<!-- {foreach from=$actionResult.info key=key item=day}-->
|
||||||
|
<!-- <div class="tab-pane {if $key == $currentTime.day1} active {/if}" id="tab_1_{$key}">-->
|
||||||
|
<!-- <div class="accordion" id="accordion{$key}">-->
|
||||||
|
<!-- {foreach from=$day key=key item=class}-->
|
||||||
|
<!-- {if $key != 0}-->
|
||||||
|
<!-- <table class="table">-->
|
||||||
|
<!-- <tbody>-->
|
||||||
|
<!-- <tr>-->
|
||||||
|
<!-- <td style="vertical-align: middle; text-align: center;"><h3 class="text-warning">{$class.time1}</h3></td>-->
|
||||||
|
<!-- <td style="vertical-align: middle; "><div class="accordion-group">-->
|
||||||
|
<!-- <div class="accordion-heading">-->
|
||||||
|
<!-- <a class="accordion-toggle {if $key != $currentTime.time1 } collapsed {/if}" data-toggle="collapse" data-parent="#accordion{$day.day1}" href="#collapse_{$class.day1}-{$class.time1}">-->
|
||||||
|
<!-- {$class.predmet} {if $key == $currentTime.time1 } <span class="label label-success">Сейчас!</span>{/if}-->
|
||||||
|
<!-- </a>-->
|
||||||
|
<!-- </div>-->
|
||||||
|
<!-- <div id="collapse_{$class.day1}-{$class.time1}" class="accordion-body collapse {if $key == $currentTime.time1 } in {/if}">-->
|
||||||
|
<!-- <div class="accordion-inner">-->
|
||||||
|
<!-- <form action="" method="post">-->
|
||||||
|
<!-- <table class="table table-striped">-->
|
||||||
|
<!-- <thead>-->
|
||||||
|
<!-- <tr>-->
|
||||||
|
<!-- <th>No</th>-->
|
||||||
|
<!-- <th>ФИО</th>-->
|
||||||
|
<!-- <th>Присутствие</th>-->
|
||||||
|
<!-- <th>Примечание</th>-->
|
||||||
|
<!-- </tr>-->
|
||||||
|
<!-- </thead>-->
|
||||||
|
<!-- <tbody>-->
|
||||||
|
<!-- {foreach from=$actionResult.students.students key=key item=student}-->
|
||||||
|
<!-- <tr>-->
|
||||||
|
<!-- <td>{$key}</td>-->
|
||||||
|
<!-- <td>{$student}</td>-->
|
||||||
|
<!-- <td>-->
|
||||||
|
<!-- <input type="hidden" name="attendance_add_edit[attendance][{$student}]" value="off">-->
|
||||||
|
<!-- <input type="hidden" name="attendance_add_edit[info]['week1']" value="{$class.week1}">-->
|
||||||
|
<!-- <input type="hidden" name="attendance_add_edit[info]['day1']" value="{$class.day1}">-->
|
||||||
|
<!-- <input type="hidden" name="attendance_add_edit[info]['time1']" value="{$class.time1}">-->
|
||||||
|
<!-- <input type="hidden" name="attendance_add_edit[info]['predmet']" value="{$class.predmet}">-->
|
||||||
|
<!-- <input type="hidden" name="attendance_add_edit[info]['gruppa']" value="{$groupName}">-->
|
||||||
|
<!-- <input type="checkbox" name="attendance_add_edit[attendance][{$student}]" id="{$key}">-->
|
||||||
|
<!-- </td>-->
|
||||||
|
<!-- <td><input type="text" name="" id="" value=""></td>-->
|
||||||
|
<!-- </tr>-->
|
||||||
|
<!-- {/foreach}-->
|
||||||
|
<!-- </tbody>-->
|
||||||
|
<!-- </table>-->
|
||||||
|
<!-- <button type="submit" class="btn btn-success">Сохранить</button>-->
|
||||||
|
<!-- </form>-->
|
||||||
|
<!-- </div>-->
|
||||||
|
<!-- </div>-->
|
||||||
|
|
||||||
|
<!-- </div></td>-->
|
||||||
|
<!-- </tr>-->
|
||||||
|
<!-- </tbody>-->
|
||||||
|
|
||||||
|
<!-- </table>-->
|
||||||
|
<!-- {/if}-->
|
||||||
|
<!-- {/foreach}-->
|
||||||
|
<!-- </div>-->
|
||||||
|
<!-- </div>-->
|
||||||
|
<!-- {/foreach}-->
|
||||||
|
<!-- </div>-->
|
||||||
|
<!-- </div>-->
|
||||||
|
<!-- </div>-->
|
||||||
|
<!-- </div>-->
|
||||||
|
<!-- </div>-->
|
||||||
|
<!-- </div>-->
|
||||||
{else}
|
{else}
|
||||||
<div class="row-fluid">
|
<div class="row-fluid">
|
||||||
<div class="span4">
|
<div class="span4">
|
||||||
|
@ -119,7 +162,6 @@
|
||||||
<span class="tools"><a href="javascript:;" class="icon-chevron-down"></a></span>
|
<span class="tools"><a href="javascript:;" class="icon-chevron-down"></a></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="widget-body">
|
<div class="widget-body">
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -157,4 +199,5 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
<script src="js/common-scripts.js"></script>
|
Loading…
Reference in New Issue