first commit

This commit is contained in:
RomanGolienko 2024-11-12 13:08:43 +03:00
commit ecc45eb6aa
5 changed files with 235 additions and 0 deletions

5
description.php Normal file
View File

@ -0,0 +1,5 @@
<?php
//Описание модуля, наличие этого файла в папке говорит о том что это папка содержит модуль
$modul['name'] = 'Модуль записи и просмотра посещений';
$modul['author'] = 'Голиенко Р. В.';
$modul['version'] = '1.0';

64
inc/attendancelog.php Normal file
View File

@ -0,0 +1,64 @@
<?php
class attendancelog {
private string $name;
private $DB;
public function __construct($DB, $name){
$this->DB = $DB;
$this->name = $name;
}
function getAllGrupps() {
$sql_search = 'SELECT id, sokr, fo, kurs FROM acs_grupp ORDER BY `sokr` DESC';
$rez = $this->DB->QUR_SEL($sql_search);
return $rez;
}
function getStudentsByGroup($groupName,$educationForm)
{
$educationForm = urlencode($educationForm);
$groupName = urlencode($groupName);
$url = 'https://eios.mkgtu.ru/api.php?des=studentsByGrupp&param1=' . $groupName . '&param2=' . $educationForm;
return json_decode(file_get_contents($url),1);
}
function mainPageAction()
{
$des = ''; if(isset($_GET['des'])) $des = $_GET['des'];
if ($des == 'show'){
//получаем список студентов по группе
$sql_search = 'SELECT sokr, fo FROM acs_grupp WHERE id='. $_GET['id'] .' ';
$current_group = $this->DB->QUR_SEL($sql_search);
return $this->getStudentsByGroup($current_group[1]['sokr'], $current_group[1]['fo']);
}
}
function HTML()
{
$html = '';
$groups = $this->getAllGrupps();
$actionResult = $this->mainPageAction();
//$html .= '<pre>'. print_r($groups,1) . '</pre>';
//$html .= '<pre>'. print_r($actionResult,1) . '</pre>';
//$html .= '<pre>'. print_r($_GET,1) . '</pre>';
GLOBAL $smarty;
$page = ''; if(isset($_GET['page'])) $page = $_GET['page'];
$des = ''; if(isset($_GET['des'])) $des = $_GET['des'];
$smarty->assign('des', $des);
$smarty->assign('name', $this->name);
if($page == 'headman') {
$smarty->clearCache('moduls/attendancelog/tpl/headman.html');
$html .= $smarty->fetch('moduls/attendancelog/tpl/headman.html');
}
if ($page == ''){
$smarty->assign('groups',$groups);
$smarty->clearCache('moduls/attendancelog/tpl/main_page.html');
$html .= $smarty->fetch('moduls/attendancelog/tpl/main_page.html');
}
if ($page == 'main'){
$smarty->assign('actionResult', $actionResult);
$smarty->assign('groups',$groups);
$smarty->clearCache('moduls/attendancelog/tpl/main_page.html');
$html .= $smarty->fetch('moduls/attendancelog/tpl/main_page.html');
}
return $html;
}
}

30
out.php Normal file
View File

@ -0,0 +1,30 @@
<?php
//echo '<pre>' . print_r($_SESSION['user'],1) . '</pre>';
include_once "inc/attendancelog.php";
global $DB;
if (isset($_SESSION['user']['fio'])){
// $class = new attendancelog($DB, $_SESSION['user']['fio']);
$class = new attendancelog($DB, $_SESSION['user']['fio']);
$OUT = $class->HTML();
} else {
}
//#МОДУЛИ
//RewriteRule ^modul/([^/]*)/([^/]*)/p([[0-9]+]*)/$ /index.php?modul=$1&page=$2&p=$3 [L]
//RewriteRule ^modul/([^/]*)/([^/]*)/([^/]*)/([[0-9]+]*)/$ /index.php?modul=$1&page=$2&des=$3&id=$4 [L]
//RewriteRule ^modul/([^/]*)/([^/]*)/([^/]*)/$ /index.php?modul=$1&page=$2&des=$3 [L]
//RewriteRule ^modul/([^/]*)/([^/]*)/$ /index.php?modul=$1&page=$2 [L]
//RewriteRule ^modul/([^/]*)/$ /index.php?modul=$1 [L]
//RewriteRule ^modul/$ /index.php?modul [L]
//$OUT .= '<pre>'.print_r($_GET,1).'</pre>';
//https://eios.mkgtu.ru/modul/aiassistant/admin/edit/12/
//Array
//(
// [modul] => aiassistant
// [page] => admin
// [des] => edit
// [id] => 12
//)
//$out = $smarty->fetch('moduls/skudp/tpl/index.html');

27
tpl/headman.html Normal file
View File

@ -0,0 +1,27 @@
<div class="row-fluid">
<div class="span">
<h3 class="page-title"> Посещаемость </h3>
<ul class="breadcrumb">
<li><a href="/">Главная</a><span class="divider">/</span></li>
<li class="active"><a href="/modul/attendancelog/">Посещаемость</a></li>
</ul>
</div>
</div>
<div class="row-fluid">
<div class="span">
<div class="navbar">
<div class="navbar-inner">
<div class="container">
<ul class="nav ">
<li><a href="https://eios.mkgtu.ru/modul/attendancelog/">Главная</a></li>
<li class="active" ><a href="https://eios.mkgtu.ru/modul/attendancelog/headman/">Старосты</a></li>
</ul>
<ul class="nav pull-right">
<li><a href="#">{$name}</a></li>
</ul>
</div>
</div>
</div>
</div>
</div>

109
tpl/main_page.html Normal file
View File

@ -0,0 +1,109 @@
<div class="row-fluid">
<div class="span">
<h3 class="page-title"> Посещаемость </h3>
<ul class="breadcrumb">
<li><a href="/">Главная</a><span class="divider">/</span></li>
<li class="active"><a href="/modul/attendancelog/">Посещаемость</a></li>
</ul>
</div>
</div>
<div class="row-fluid">
<div class="span">
<div class="navbar">
<div class="navbar-inner">
<div class="container">
<ul class="nav ">
<li class="active" ><a href="https://eios.mkgtu.ru/modul/attendancelog/">Главная</a></li>
<li><a href="https://eios.mkgtu.ru/modul/attendancelog/headman/">Старосты</a></li>
</ul>
<ul class="nav pull-right">
<li><a href="#">{$name}</a></li>
</ul>
</div>
</div>
</div>
</div>
</div>
{if $des == 'show'}
<a href="https://eios.mkgtu.ru/modul/attendancelog/" role="button" class="btn"> Вернуться </a>
<div class="row-fluid">
<div class="span9">
<div class="widget blue">
<div class="widget-title">
<h4><i class="icon-reorder"></i></h4>
<span class="tools"><a href="javascript:;" class="icon-chevron-down"></a></span>
</div>
<div class="widget-body">
<table class="table table-striped table-bordered">
<caption> Посещения группы </caption>
</table>
</div>
</div>
</div>
</div>
<div class="row-fluid">
<div class="span9">
<div class="widget blue">
<div class="widget-title">
<h4><i class="icon-reorder"></i></h4>
<span class="tools"><a href="javascript:;" class="icon-chevron-down"></a></span>
</div>
<div class="widget-body">
<table class="table table-striped table-bordered">
<caption> Студенты группы </caption>
<thead>
<tr>
<th>Номер</th>
<th>Имя</th>
</tr>
</thead>
<tbody>
{foreach from=$actionResult['students'] key=key item=name}
<tr>
<td>{$key +1 }</td>
<td>{$name}</td>
</tr>
{/foreach}
</tbody>
</table>
</div>
</div>
</div>
</div>
{else}
<div class="row-fluid">
<div class="span8">
<div class="widget red">
<div class="widget-title">
<h4><i class="icon-reorder"></i> Все группы</h4>
<span class="tools"><a href="javascript:;" class="icon-chevron-down"></a></span>
</div>
<div class="widget-body" style="height: 40em; overflow:scroll; overflow-x:hidden;">
<table class="table table-striped table-bordered">
<caption><h4>Выберите группу для просмотра</h4> </caption>
<thead>
<tr>
<th>Название</th>
<th>Форма обучения</th>
<th>Курс</th>
</tr>
</thead>
<tbody>
{foreach from=$groups key=key item=group}
{if $key != 0}
<tr>
<td><a href="https://eios.mkgtu.ru/modul/attendancelog/main/show/{$group['id']}/">{$group['sokr']}</a></td>
<td>{$group['fo']}</td>
<td>{$group['kurs']}</td>
</tr>
{/if}
{/foreach}
</tbody>
</table>
</div>
</div>
</div>
</div>
{/if}