Skip to content

Commit 6f2b6ad

Browse files
committed
form add
1 parent cbd78bc commit 6f2b6ad

4 files changed

Lines changed: 89 additions & 2 deletions

File tree

ajax.php

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
3+
// start the session
4+
session_start();
5+
6+
7+
8+
#--------------------------------
9+
# Load the class
10+
#--------------------------------
11+
require_once "application/config/constants.php";
12+
require_once LIBRARY_DIR . "loader.class.php";
13+
14+
15+
16+
17+
#--------------------------------
18+
# Init Loader class
19+
#--------------------------------
20+
$loader = new Loader;
21+
$loader->database_connect(); // Connect the database
22+
$loader->load_settings(); // load the settings
23+
$loader->set_language('en'); // set the language
24+
$loader->login(); // do login ( you must pass login=your_login and password=your_password)
25+
$loader->set_theme(); // set theme
26+
$loader->set_page('index'); // set page layout
27+
$loader->init_route(); // init the route
28+
29+
30+
31+
#--------------------------------
32+
# Auto Load the Controller
33+
# init_route set the controller/action/params
34+
# to load the controller
35+
#--------------------------------
36+
echo $loader->load_controller( $loader->get_selected_controller(), $loader->get_selected_action(), $loader->get_selected_params() );
37+
38+
39+
40+
?>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?php if(!class_exists('raintpl')){exit;}?><div class="content">
2+
<h1><?php echo $title;?></h1>
3+
<div class="text"><?php echo $content;?></div>
4+
</div>
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?php if(!class_exists('raintpl')){exit;}?><!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<title><?php echo $title;?></title>
5+
<link rel="stylesheet" href="http://localhost/github/rainframework/application/views//css/style.css" type="text/css" />
6+
7+
<!-- Style & Script -->
8+
<?php $counter1=-1; if( isset($style) && is_array($style) && sizeof($style) ) foreach( $style as $key1 => $value1 ){ $counter1++; ?><link rel="stylesheet" href="<?php echo $value1;?>" type="text/css" />
9+
<?php } ?>
10+
11+
<?php $counter1=-1; if( isset($script) && is_array($script) && sizeof($script) ) foreach( $script as $key1 => $value1 ){ $counter1++; ?><script src="<?php echo $value1;?>" type="text/javascript"></script>
12+
<?php } ?>
13+
14+
<?php echo $javascript;?>
15+
<!-- // -->
16+
17+
</head>
18+
<body>
19+
20+
<div id="header" class="doc">
21+
<div id="menu"><div><img src="http://localhost/github/rainframework/application/views//img/logo_mini.png"><?php $counter1=-1; if( isset($menu) && is_array($menu) && sizeof($menu) ) foreach( $menu as $key1 => $value1 ){ $counter1++; ?><a href="http://localhost/github/rainframework/<?php echo $value1["link"];?>" <?php echo $value1["selected"]?'class="selected"':null;?>><?php echo $value1["name"];?></a><?php } ?></div>
22+
</div>
23+
24+
<div id="section" class="doc">
25+
<div id="section_inside">
26+
<div id="section_inside_inside">
27+
<?php echo $center;?>
28+
</div>
29+
</div>
30+
</div>
31+
32+
<div id="footer">
33+
<div id="inner_footer">
34+
<div class="left"><?php $counter1=-1; if( isset($menu) && is_array($menu) && sizeof($menu) ) foreach( $menu as $key1 => $value1 ){ $counter1++; ?><?php echo $counter1?' | ':'';?><a href="http://localhost/github/rainframework/<?php echo $value1["link"];?>" <?php echo $value1["selected"]?'class="selected"':null;?>><?php echo $value1["name"];?></a><?php } ?></div>
35+
<div class="center">execution time: <?php echo $execution_time;?><br/>
36+
executed query: <?php echo $n_query;?><br/>
37+
</div>
38+
<div class="right">Copyright rain team</div>
39+
</div>
40+
</div>
41+
42+
</body>
43+
</html>

application/controllers/form.controller.class.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ function index(){
77
$options = array( "a"=>1, "b"=>2 );
88

99
require_once LIBRARY_DIR . "form.class.php";
10-
$form = new Form( URL . "test.php" );
10+
$form = new Form( URL . "ajax.php/test/" );
1111
$form->open_table( "Table title" );
1212
$form->add_hidden( 'a', 1 );
1313
$form->add_item( 'text', 'name', 'text', 'description', '' );
@@ -22,7 +22,7 @@ function index(){
2222
$form->add_html( 'this is plain html' );
2323
$form->add_button();
2424
$form->close_table();
25-
$form->draw( false, true );
25+
$form->draw( $return_string = false, $use_ajax = true );
2626

2727
}
2828

0 commit comments

Comments
 (0)