manual calendar feature

This commit is contained in:
RomanGolienko 2024-11-25 12:42:55 +03:00
parent 576b4672ac
commit 55c9ddfe45
2 changed files with 143 additions and 117 deletions

View File

@ -55,49 +55,13 @@ class attendancelog {
$rez['week1'] = $week['week_cur'];
return $rez;
}
function timeGroup() {
$raspis = $this->mainPageAction();
$out = array();
$currentTime = $this->currentTime();
$first_weekday_of_year = $currentTime['year'] .'-01-01';
$first_weekday_of_year= date('w', strtotime($first_weekday_of_year));
$weekday = $first_weekday_of_year;
for ($month = 1; $month <= 12; $month++){
$day_in_month = cal_days_in_month(CAL_GREGORIAN, $month, $currentTime['year']);
$day = 1;
$week = 1;
for ($day; $day <= $day_in_month; $day++){
if($weekday > 7){
$weekday = 1;
$week++;
}
$tmp1 = $currentTime['year'] . '-' . $month . '-' . '01';
$month_name = date('M',strtotime($tmp1));
$out[$currentTime['year']][$month_name][$week . ' неделя'][$day] = $raspis['info'][$weekday];
$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();
@ -109,9 +73,30 @@ class attendancelog {
$out['students'] = $this->getStudentsByGroup($current_group[1]['sokr'], $current_group[1]['fo']);
}
}
return $out;
}elseif($des == 'calendar_show'){
$currentTime = $this->currentTime();
$first_weekday_of_year = $currentTime['year'] .'-01-01';
$first_weekday_of_year= date('w', strtotime($first_weekday_of_year));
$weekday = $first_weekday_of_year;
for ($month = 1; $month <= 12; $month++){
$day_in_month = cal_days_in_month(CAL_GREGORIAN, $month, $currentTime['year']);
$day = 1;
$week = 1;
for ($day; $day <= $day_in_month; $day++){
$tmp1 = $currentTime['year'] . '-' . $month . '-' . '01';
$month_name = date('M',strtotime($tmp1));
$result[$currentTime['year']][$month_name][$week][$day] = $out['info'][$weekday];
if($weekday > 6){
$weekday = 1;
$week++;
}else{
$weekday++;
}
}
}
$des = ''; if(isset($_GET['des'])) $des = $_GET['des'];
if ($des == 'show'){
return $result;
}
}
function HTML()
@ -120,12 +105,10 @@ class attendancelog {
$groups = $this->getAllGrupps();
$actionResult = $this->mainPageAction();
$currentTime = $this->currentTime();
$timeGroup = $this->timeGroup();
//$html .= '<pre>'. print_r($groups,1) . '</pre>';
//$html .= '<pre>'. print_r($actionResult,1) . '</pre>';
$html .= '<pre>'. print_r($timeGroup,1) . '</pre>';
$html .= '<pre>'. print_r($actionResult,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($_SESSION,1) . '</pre>';
GLOBAL $smarty;

View File

@ -32,84 +32,127 @@
<div class="span12">
<div class="widget blue">
<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>
</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">
{foreach from=$actionResult[$currentTime['year']] key=month_key item=month}
<table class="table table-striped table-bordered">
<tbody>
<tr><td colspan="8" style="text-align: center">{$month_key}</td></tr>
<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}
</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>
<th style="text-align: center">Понедельник</th>
<th style="text-align: center">Вторник</th>
<th style="text-align: center">Среда</th>
<th style="text-align: center">Четверг</th>
<th style="text-align: center">Пятница</th>
<th style="text-align: center">Суббота</th>
<th style="text-align: center">Воскресенье</th>
</tr>
{foreach from=$month key=week_key item=week}
<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 count($week) < 7 and $week_key == 1}
{for $foo=1 to (7 - count($week))}
<td></td>
{/for}
{/if}
{foreach from=$week key=day_key item=day}
<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>
{/foreach}
</div>
</div>
</tr>
{/foreach}
</tbody>
</table>
{/foreach}
</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}
<div class="row-fluid">
<div class="span4">
@ -119,7 +162,6 @@
<span class="tools"><a href="javascript:;" class="icon-chevron-down"></a></span>
</div>
<div class="widget-body">
</div>
</div>
@ -158,3 +200,4 @@
</div>
{/if}
<script src="js/common-scripts.js"></script>