I have a directory in the main called Dashboard. In this directory I have my actions.ini, conf.ini, and index.php
actions.ini:
[mydashboard]
permission=view
--------------------------
conf.ini:
[_database]
all my login info here
[_tables]
dashboard = "Dashboard"
myTable = "test"
---------------------------
In this Dashboard folder I have folder called actions with a file named dashboard.php
dashboard.php:
- Code: Select all
<?php
class actions_dashboard {
function handle(&$params){
$bib= df_get_records_array('myTable', array());
df_display(array('myTable'=>$bib), 'dashboard.html');
}
}
?>
In this Dashboard folder I have folder called conf with a file named ApplicationDelegate.php
ApplicationDelegate.php:
- Code: Select all
<?php
/**
* A delegate class for the entire application to handle custom handling of
* some functions such as permissions and preferences.
*/
class conf_ApplicationDelegate {
/**
* Returns permissions array. This method is called every time an action is
* performed to make sure that the user has permission to perform the action.
* @param record A Dataface_Record object (may be null) against which we check
* permissions.
* @see Dataface_PermissionsTool
* @see Dataface_AuthenticationTool
*/
function getPermissions(&$record){
$auth =& Dataface_AuthenticationTool::getInstance();
$user =& $auth->getLoggedInUser();
if ( !isset($user) ) return Dataface_PermissionsTool::NO_ACCESS();
// if the user is null then nobody is logged in... no access.
// This will force a login prompt.
$role = $user->val('role');
return Dataface_PermissionsTool::getRolePermissions($role);
// Returns all of the permissions for the user's current role.
}
function beforeHandleRequest(){
$app =& Dataface_Application::getInstance();
$query =& $app->getQuery();
if ( $query['-table'] == 'dashboard' and ($query['-action'] == 'browse' or $query['-action'] == 'list') ){
$query['-action'] = 'dashboard';
}
}
}
?>
In this Dashboard folder I have folder called tables with 2 other folders inside called dashboard and myTable. This includes my class delegate files.
In this Dashboard folder I have another folder called templates with file called dashboard.html
dashboard.html:
- Code: Select all
{use_macro file="Dataface_Main_Template.html"}
{fill_slot name="main_column"}
<h1>My Management System (RCMS)</h1>
<p>This system allows you to manage your publications and publish
them on the web. Some common actions you may perform with this system
include:
<ul>
<li><img src="{$ENV.DATAFACE_URL}/images/add_icon.gif"/>
<a href="{$ENV.DATAFACE_SITE_HREF}?-table=myTable&-action=new">
Do Something</a>
</li>
<li><img src="{$ENV.DATAFACE_URL}/images/edit.gif"/>
Edit existing bibliography:
<select onchange="window.location.href=this.options[this.selectedIndex].value">
<option value="">Select ...</option>
{foreach from=$myTable item=bibliography}
<option value="{$bibliography->getURL('-action=edit')}">
{$bibliography->getTitle()}
</option>
{/foreach}
</select>
</li>
<li><img src="{$ENV.DATAFACE_URL}/images/file.gif"/>
Embed your bibliography in a webpage:
<select onchange="window.location.href=this.options[this.selectedIndex].value">
<option value="">Select ...</option>
{foreach from=$myTable item=bibliography}
<option value="{$bibliography->getURL('-action=view')}#embed">
{$bibliography->getTitle()}
</option>
{/foreach}
</select>
</li>
</ul>
{/fill_slot}
{/use_macro}
Whats causing the redirect error?