Семя – орган полового размножения и расселения растений: наружи у семян имеется плотный покров – кожура...
Типы оградительных сооружений в морском порту: По расположению оградительных сооружений в плане различают волноломы, обе оконечности...
Топ:
Проблема типологии научных революций: Глобальные научные революции и типы научной рациональности...
Организация стока поверхностных вод: Наибольшее количество влаги на земном шаре испаряется с поверхности морей и океанов...
Отражение на счетах бухгалтерского учета процесса приобретения: Процесс заготовления представляет систему экономических событий, включающих приобретение организацией у поставщиков сырья...
Интересное:
Подходы к решению темы фильма: Существует три основных типа исторического фильма, имеющих между собой много общего...
Берегоукрепление оползневых склонов: На прибрежных склонах основной причиной развития оползневых процессов является подмыв водами рек естественных склонов...
Принципы управления денежными потоками: одним из методов контроля за состоянием денежной наличности является...
Дисциплины:
2021-03-17 | 61 |
5.00
из
|
Заказать работу |
|
|
Листинг точки входа index. php
<?php
/*
|---------------------------------------------------------------
| PHP ERROR REPORTING LEVEL
|---------------------------------------------------------------
|
| By default CI runs with error reporting set to ALL. For security
| reasons you are encouraged to change this when your site goes live.
| For more info visit: http://www.php.net/error_reporting
|
*/
error_reporting(E_ALL);
/*
|---------------------------------------------------------------
| SYSTEM FOLDER NAME
|---------------------------------------------------------------
|
| This variable must contain the name of your "system" folder.
| Include the path if the folder is not in the same directory
| as this file.
|
| NO TRAILING SLASH!
|
*/
$system_folder = "system";
/*
|---------------------------------------------------------------
| APPLICATION FOLDER NAME
|---------------------------------------------------------------
|
| If you want this front controller to use a different "application"
| folder then the default one you can set its name here. The folder
| can also be renamed or relocated anywhere on your server.
| For more info please see the user guide:
| http://codeigniter.com/user_guide/general/managing_apps.html
|
|
| NO TRAILING SLASH!
|
*/
$application_folder = "application";
/*
|===============================================================
| END OF USER CONFIGURABLE SETTINGS
|===============================================================
*/
/*
|---------------------------------------------------------------
| SET THE SERVER PATH
|---------------------------------------------------------------
|
| Let's attempt to determine the full-server path to the "system"
| folder in order to reduce the possibility of path problems.
| Note: We only attempt this if the user hasn't specified a
| full server path.
|
*/
if (strpos($system_folder, '/') === FALSE)
{
if (function_exists('realpath') AND @realpath(dirname(__FILE__))!== FALSE)
{
$system_folder = realpath(dirname(__FILE__)).'/'.$system_folder;
}
}
else
{
// Swap directory separators to Unix style for consistency
$system_folder = str_replace("\\", "/", $system_folder);
}
/*
|---------------------------------------------------------------
| DEFINE APPLICATION CONSTANTS
|---------------------------------------------------------------
|
| EXT - The file extension. Typically ".php"
| FCPATH - The full server path to THIS file
| SELF - The name of THIS file (typically "index.php")
| BASEPATH - The full server path to the "system" folder
| APPPATH - The full server path to the "application" folder
|
*/
define('EXT', '.'.pathinfo(__FILE__, PATHINFO_EXTENSION));
|
define('FCPATH', __FILE__);
define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME));
define('BASEPATH', $system_folder.'/');
if (is_dir($application_folder))
{
define('APPPATH', $application_folder.'/');
}
else
{
if ($application_folder == '')
{
$application_folder = 'application';
}
define('APPPATH', BASEPATH.$application_folder.'/');
}
/*
|---------------------------------------------------------------
| LOAD THE FRONT CONTROLLER
|---------------------------------------------------------------
|
|
*/
require_once BASEPATH.'codeigniter/CodeIgniter'.EXT;
/* End of file index.php */
/* Location:./index.php */
Листинг layout_main.php
<html>
<head>
<title><?php if (isset($title_for_layout)) { echo $title_for_layout;}?></title>
<link rel="shortcut icon" href="/favicon.ico" />
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<!-- CSS for JQuery UI -->
<link rel="stylesheet" type="text/css" href="/theme/jquery-ui-1.7.custom.css" />
<!-- *******************-->
<link rel="stylesheet" type="text/css" href="/css/reset.css" />
<link rel="stylesheet" type="text/css" href="/css/ext.css" />
<script type="text/javascript" src="/jquery.js"></script>
<script type="text/javascript" src="/jquery.ui.js"></script>
<script type="text/javascript" src="/ui.datepicker-ru.js"></script>
</head>
<body>
<div id="header_logo"> </div><div id="header"><h2>Библиотека кафедры ИТ-4</h2></div>
<div id="menu">
<a class="menu_item" href="/library/">Главная</a><br />
<a class="menu_item" href="/library/sprv">Справочники</a><br />
<a class="menu_item" href="/library/books">Книги</a><br />
<a class="menu_item" href="/library/books/search">Поиск книг</a><br />
</div>
<div id="content">
<?php echo $content_for_layout;?>
</div>
<div id="footer"><?php echo date('Y');?> © ИТ-4 </div>
</body>
</html>
Листинг layout.php
<?php
if (!defined('BASEPATH')) exit('No direct script access allowed');
class Layout
{
var $obj;
var $layout;
function Layout($layout = "layout_main")
{
$this->obj =& get_instance();
$this->layout = $layout;
}
function setLayout($layout)
{
$this->layout = $layout;
}
function view($view, $data=null, $return=false)
{
$loadedData = array();
$loadedData['content_for_layout'] = $this->obj->load->view($view,$data,true);
if($return)
{
$output = $this->obj->load->view($this->layout, $loadedData, true);
|
return $output;
}
else
{
$this->obj->load->view($this->layout, $loadedData, false);
}
}
}
?>
Листинг sprv.php
<?php
class Sprv extends Controller {
function Sprv()
{
parent::Controller();
$this->load->model('Sprv_db');
}
// Список справочников
function index()
{
$this->layout->view('sprv_list');
}
// Справочник разделов
function sections() {
$this->layout->view('sprv_sections');
}
// Справочник дисциплин
function disciplines() {
$data['disciplines'] = $this->Sprv_db->get_disciplines();
$this->layout->view('sprv_disciplines', $data);
}
function disciplines_add()
{
if ($this->input->post('name')!= FALSE && $this->input->post('code')!= FALSE)
$this->Sprv_db->add_discipline($this->input->post('name'), $this->input->post('code'));
redirect('/sprv/disciplines');
}
function disciplines_del($id)
{
$this->Sprv_db->del_discipline($id);
redirect('/sprv/disciplines');
}
function disciplines_edit($id)
{
if ($this->input->post('name')!= FALSE && $this->input->post('code')!= FALSE) {
$this->Sprv_db->save_discipline($this->input->post('name'), $this->input->post('code'), $id);
redirect('/sprv/disciplines');
return;
}
$data['discipline'] = $this->Sprv_db->get_discipline_by_id($id);
if ($data['discipline'] === FALSE)
show_404('');
$this->layout->view('sprv_discipline_edit', $data);
}
// Справочник авторов
function authors() {
$this->layout->view('sprv_authors');
}
// Справочник типов изданий
function publication_types() {
$this->layout->view('sprv_publication_types');
}
}
Листинг sprv_db.php
<?php
class Sprv_db extends Model {
function Sprv_db()
{
parent::Model();
}
function get_disciplines()
{
$this->db->order_by("code", "asc");
$query = $this->db->get('disciplines');
return $query->result_array();
}
function add_discipline($name, $code)
{
$data = array(
'name' => $name,
'code' => $code,
);
$this->db->insert('disciplines', $data);
}
function del_discipline($id)
{
$this->db->delete('disciplines', array('id' => $id));
}
function get_discipline_by_id($id)
{
$query = $this->db->get_where('disciplines', array('id' => $id));
if ($query->num_rows() < 1)
return FALSE;
return $query->row_array();
}
function save_discipline($name, $code, $id)
{
$data = array(
'name' => $name,
'code' => $code
);
$this->db->where('id', $id);
$this->db->update('disciplines', $data);
}
}
Листинг sprv_disciplines.php
<h2>Добавить дисциплину</h2>
<div>
<form action="/library/sprv/disciplines_add" method="post">
<strong>Название</strong><br /><input type="text" name="name" value="" /><br /><br />
<strong>Шифр</strong><br /><input type="text" name="code" value="" /><br /><br />
<input type="submit" name="submit" value="Добавить" />
|
</form>
</div>
<h2>Список дисциплин</h2>
<table cellpadding="0" cellspacing="0" class="std_table" border="1px">
<tr><td><strong>Название</strong></td><td><strong>Шифр</strong></td><td><strong>Действия</strong></td></tr>
<?php foreach($disciplines as $discipline):?>
<tr>
<td><?php echo $discipline['name'];?></td>
<td><?php echo $discipline['code'];?></td>
<td><a href="/library/sprv/disciplines_del/<?php echo $discipline['id'];?>">Удалить</a> / <a href="/library/sprv/disciplines_edit/<?php echo $discipline['id'];?>">Редактировать</a></td>
</tr>
<?php endforeach;?>
</table>
<br />
Листинг sprv_disciplines_edit.php
<h2>Редактирование дисциплины</h2>
<div>
<form action="/library/sprv/disciplines_edit/<?php echo $discipline['id'];?>" method="post">
<strong>Название</strong><br /><input type="text" name="name" value="<?php echo $discipline['name'];?>" /><br /><br />
<strong>Шифр</strong><br /><input type="text" name="code" value="<?php echo $discipline['code'];?>" /><br /><br />
<input type="submit" name="submit" value="Сохранить" />
</form>
</div>
<br />
Листинг sprv_list.php
<h2>Список справочников</h2>
<div>
<a href="/library/sprv/sections">Разделы</a><br />
<a href="/library/sprv/disciplines">Дисциплины</a><br />
<a href="/library/sprv/authors">Авторы</a><br />
<a href="/library/sprv/publication_types">Типы изданий</a><br />
</div>
<br />
Листинг welcome.php
<?php
class Welcome extends Controller {
function Welcome()
{
parent::Controller();
}
function index()
{
$this->layout->view('welcome_message');
}
}
Приложение Б
Графический материал
|
|
Адаптации растений и животных к жизни в горах: Большое значение для жизни организмов в горах имеют степень расчленения, крутизна и экспозиционные различия склонов...
Типы сооружений для обработки осадков: Септиками называются сооружения, в которых одновременно происходят осветление сточной жидкости...
Организация стока поверхностных вод: Наибольшее количество влаги на земном шаре испаряется с поверхности морей и океанов (88‰)...
Кормораздатчик мобильный электрифицированный: схема и процесс работы устройства...
© cyberpedia.su 2017-2024 - Не является автором материалов. Исключительное право сохранено за автором текста.
Если вы не хотите, чтобы данный материал был у нас на сайте, перейдите по ссылке: Нарушение авторских прав. Мы поможем в написании вашей работы!