Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
d24b90a9
Commit
d24b90a9
authored
Jan 20, 2015
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
work in progress new phalcon model code, doesn't interfere with current codebase
parent
cc42648f
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
189 additions
and
15 deletions
+189
-15
services.php
src/opnsense/mvc/app/config/services.php
+70
-0
IndexController.php
src/opnsense/mvc/app/controllers/IndexController.php
+0
-10
ControllerBase.php
...ense/mvc/app/controllers/OPNsense/Base/ControllerBase.php
+16
-0
IndexController.php
...nse/mvc/app/controllers/OPNsense/Base/IndexController.php
+14
-0
IndexController.php
...nse/mvc/app/controllers/OPNsense/Core/IndexController.php
+12
-0
IndexController.php
...e/mvc/app/controllers/OPNsense/Sample/IndexController.php
+13
-0
PageController.php
...se/mvc/app/controllers/OPNsense/Sample/PageController.php
+39
-0
Sample.php
src/opnsense/mvc/app/models/OPNsense/Sample/Sample.php
+9
-0
index.volt
src/opnsense/mvc/app/views/OPNsense/Core/index.volt
+1
-0
index.volt
src/opnsense/mvc/app/views/OPNsense/Sample/index.volt
+3
-0
page.show.volt
src/opnsense/mvc/app/views/OPNsense/Sample/page.show.volt
+7
-0
page.volt
src/opnsense/mvc/app/views/OPNsense/Sample/page.volt
+1
-0
index.volt
src/opnsense/mvc/app/views/index/index.volt
+0
-3
footer.volt
src/opnsense/mvc/app/views/layout_partials/footer.volt
+1
-0
std_input_field.volt
...nsense/mvc/app/views/layout_partials/std_input_field.volt
+1
-0
default.volt
src/opnsense/mvc/app/views/layouts/default.volt
+2
-2
No files found.
src/opnsense/mvc/app/config/services.php
View file @
d24b90a9
...
@@ -81,3 +81,73 @@ $di->set('session', function () {
...
@@ -81,3 +81,73 @@ $di->set('session', function () {
$di
->
set
(
'config'
,
$config
);
$di
->
set
(
'config'
,
$config
);
/**
* Setup router
*/
$di
->
set
(
'router'
,
function
()
{
$router
=
new
\Phalcon\Mvc\Router
(
false
);
$router
->
setDefaultController
(
'index'
);
$router
->
setDefaultAction
(
'index'
);
$router
->
setDefaultNamespace
(
'OPNsense\Core'
);
$router
->
add
(
'/'
,
array
(
"controller"
=>
'index'
,
"action"
=>
'index'
));
// probe registered modules and create a namespace map
// for example, OPNsense\Core will be mapped at http(s):\\host\core\..
// module names should be unique in the application, unless you want to overwrite functionality (check glob's sorting).
//
// if the glob for probing the directories turns out to be too slow, we should consider some kind of caching here
//
$registered_modules
=
array
();
$controller_dir
=
__DIR__
.
"/../controllers/"
;
foreach
(
glob
(
$controller_dir
.
"*"
,
GLOB_ONLYDIR
)
as
$namespace_base
)
{
foreach
(
glob
(
$namespace_base
.
"/*"
,
GLOB_ONLYDIR
)
as
$module_name
)
{
if
(
strpos
(
$module_name
,
'OPNsense/Base'
)
===
false
)
{
$namespace_name
=
str_replace
(
'/'
,
'\\'
,
str_replace
(
$controller_dir
,
''
,
$module_name
));
$registered_modules
[
strtolower
(
basename
(
$module_name
))]
=
$namespace_name
;
}
}
}
// add routing for all controllers, using the following convention:
// \module\controller\action\params
// where module is mapped to the corresponding namespace
foreach
(
$registered_modules
as
$module_name
=>
$namespace_name
)
{
$router
->
add
(
"/"
.
$module_name
.
"/"
,
array
(
"namespace"
=>
$namespace_name
));
$router
->
add
(
"/"
.
$module_name
.
"/:controller/"
,
array
(
"namespace"
=>
$namespace_name
,
"controller"
=>
1
));
$router
->
add
(
"/"
.
$module_name
.
"/:controller/:action/"
,
array
(
"namespace"
=>
$namespace_name
,
"controller"
=>
1
,
"action"
=>
2
));
$router
->
add
(
"/"
.
$module_name
.
"/:controller/:action/:params"
,
array
(
"namespace"
=>
$namespace_name
,
"controller"
=>
1
,
"action"
=>
2
,
"params"
=>
3
));
}
$router
->
handle
();
return
$router
;
});
src/opnsense/mvc/app/controllers/IndexController.php
deleted
100644 → 0
View file @
cc42648f
<?php
namespace
OPNsense\unused
;
class
IndexController
extends
ControllerBase
{
public
function
indexAction
()
{
}
}
src/opnsense/mvc/app/controllers/ControllerBase.php
→
src/opnsense/mvc/app/controllers/
OPNsense/Base/
ControllerBase.php
View file @
d24b90a9
<?php
<?php
namespace
OPNsense\Base
;
namespace
OPNsense\unused
;
use
Phalcon\Mvc\Controller
;
use
Phalcon\Mvc\Controller
;
class
ControllerBase
extends
Controller
class
ControllerBase
extends
Controller
{
{
/**
* Default action. Set the standard layout.
*/
public
function
initialize
()
{
$this
->
view
->
setTemplateBefore
(
'default'
);
}
}
}
src/opnsense/mvc/app/controllers/OPNsense/Base/IndexController.php
0 → 100644
View file @
d24b90a9
<?php
namespace
OPNsense\Base
;
class
IndexController
extends
\OPNsense\Base\ControllerBase
{
public
function
indexAction
()
{
// $this->view->title = $this->request->getURI();
// $this->view->pick('OPNsense/Sample/index');
}
}
src/opnsense/mvc/app/controllers/OPNsense/Core/IndexController.php
0 → 100644
View file @
d24b90a9
<?php
namespace
OPNsense\Core
;
class
IndexController
extends
\OPNsense\Base\IndexController
{
public
function
indexAction
()
{
$this
->
view
->
pick
(
'OPNsense/Core/index'
);
}
}
src/opnsense/mvc/app/controllers/OPNsense/Sample/IndexController.php
0 → 100644
View file @
d24b90a9
<?php
namespace
OPNsense\Sample
;
class
IndexController
extends
\OPNsense\Base\IndexController
{
public
function
indexAction
()
{
$this
->
view
->
title
=
$this
->
request
->
getURI
();
$this
->
view
->
pick
(
'OPNsense/Sample/index'
);
}
}
\ No newline at end of file
src/opnsense/mvc/app/controllers/OPNsense/Sample/PageController.php
0 → 100644
View file @
d24b90a9
<?php
namespace
OPNsense\Sample
;
use
Phalcon\Mvc\Controller
;
use
\OPNsense\Base\ControllerBase
;
class
PageController
extends
ControllerBase
{
public
function
indexAction
()
{
$this
->
view
->
title
=
"XXX"
;
$this
->
view
->
pick
(
'OPNsense/Sample/page'
);
}
public
function
showAction
(
$postId
)
{
$sample
=
new
Sample
();
$this
->
view
->
title
=
$sample
->
title
;
$this
->
view
->
items
=
array
(
array
(
'field_name'
=>
'test'
,
'field_content'
=>
'1234567'
,
'field_type'
=>
"text"
)
);
// Pass the $postId parameter to the view
//$this->view->setVar("postId", $postId);
// $robot = new Sample\Sample();
// $robot->title = 'hoi';
//
// $this->view->title = $postId. "/". $this->persistent->name;
//
$this
->
view
->
pick
(
'OPNsense/Sample/page.show'
);
// $this->flash->error("You don't have permission to access this area");
//
// // Forward flow to another action
// $this->dispatcher->forward(array(
// "controller" => "sample",
// "action" => "index"
// ));
}
}
src/opnsense/mvc/app/models/OPNsense/Sample/Sample.php
0 → 100644
View file @
d24b90a9
<?php
namespace
OPNsense\Sample
;
class
Sample
{
public
$title
=
"xx"
;
}
\ No newline at end of file
src/opnsense/mvc/app/views/OPNsense/Core/index.volt
0 → 100644
View file @
d24b90a9
Core index
\ No newline at end of file
src/opnsense/mvc/app/views/OPNsense/Sample/index.volt
0 → 100644
View file @
d24b90a9
test sample index page
{{ title }}
{{ partial('layout_partials/footer') }}
src/opnsense/mvc/app/views/OPNsense/Sample/page.show.volt
0 → 100644
View file @
d24b90a9
show template... {{title|default("??") }}
{% for item in items %}
{{ partial('layout_partials/std_input_field',item) }}
{% endfor %}
src/opnsense/mvc/app/views/OPNsense/Sample/page.volt
0 → 100644
View file @
d24b90a9
test sample -> page
src/opnsense/mvc/app/views/index/index.volt
deleted
100644 → 0
View file @
cc42648f
<h1>Congratulations!</h1>
<p>You're now flying with Phalcon. Great things are about to happen!</p>
src/opnsense/mvc/app/views/layout_partials/footer.volt
0 → 100644
View file @
d24b90a9
//////footer/////
src/opnsense/mvc/app/views/layout_partials/std_input_field.volt
0 → 100644
View file @
d24b90a9
<input type={{field_type}} value="{{field_content}}" name="{{field_name}}" >
src/opnsense/mvc/app/views/
index
.volt
→
src/opnsense/mvc/app/views/
layouts/default
.volt
View file @
d24b90a9
<!DOCTYPE html>
<!DOCTYPE html>
<html>
<html>
<head>
<head>
<title>
Phalcon PHP Framework
</title>
<title>
{{title|default("OPNsense") }}
</title>
</head>
</head>
<body>
<body>
{{ content() }}
{{ content() }}
</body>
</body>
</html>
</html>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment