Adding remember me login cookie

This commit is contained in:
Karl Cordes 2010-01-10 11:05:04 -07:00
parent 26452cd1a0
commit d7a76d9c53
23 changed files with 671 additions and 69 deletions

1
.gitignore vendored
View file

@ -8,3 +8,4 @@ tmp/*
*.tar.gz
*.swp
*.swo
vendors/tcpdf/cache/*

View file

@ -9,11 +9,23 @@ var $components = array('Auth', 'RequestHandler');
var $helpers = array('Javascript', 'Time', 'Html', 'Form', 'Ajax');
function beforeFilter() {
$this->set('currentuser', $this->Auth->user());
if($this->RequestHandler->isAjax()) {
/**
* Define the scheme for issue Types.
*/
$this->set('issueTypes', array(1=>"Bug Report", 2=>"Feature Request", 3=>"Other IT Help"));
$priorities = array(1 => 'Low',2=>"Medium",3=>"High", 4=>"Critical");
$this->set('issuePriorities', $priorities);
if($this->RequestHandler->isAjax()) {
Configure::write('debug', 0);
}
}
}
?>

View file

@ -0,0 +1,76 @@
<?php
class IssueActionsController extends AppController {
var $name = 'IssueActions';
var $helpers = array('Html', 'Form');
function index() {
$this->IssueAction->recursive = 0;
$this->set('issueActions', $this->paginate());
}
function view($id = null) {
if (!$id) {
$this->Session->setFlash(__('Invalid IssueAction.', true));
$this->redirect(array('action'=>'index'));
}
$this->set('issueAction', $this->IssueAction->read(null, $id));
}
/**
* Add an IssueAction to an Issue.
* @param int $id
*/
function add($id = null) {
if (!$id && empty($this->data)) {
$this->Session->setFlash(__('Invalid Issue ID', true));
$this->redirect(array('action'=>'index'));
}
if (!empty($this->data)) {
$this->IssueAction->create();
if ($this->IssueAction->save($this->data)) {
$this->Session->setFlash(__('The IssueAction has been saved', true));
$this->redirect(array('action'=>'index'));
} else {
$this->Session->setFlash(__('The IssueAction could not be saved. Please, try again.', true));
}
}
$users = $this->IssueAction->User->find('list');
$this->set(compact('users'));
}
function edit($id = null) {
if (!$id && empty($this->data)) {
$this->Session->setFlash(__('Invalid IssueAction', true));
$this->redirect(array('action'=>'index'));
}
if (!empty($this->data)) {
if ($this->IssueAction->save($this->data)) {
$this->Session->setFlash(__('The IssueAction has been saved', true));
$this->redirect(array('action'=>'index'));
} else {
$this->Session->setFlash(__('The IssueAction could not be saved. Please, try again.', true));
}
}
if (empty($this->data)) {
$this->data = $this->IssueAction->read(null, $id);
}
$users = $this->IssueAction->User->find('list');
$this->set(compact('users'));
}
function delete($id = null) {
if (!$id) {
$this->Session->setFlash(__('Invalid id for IssueAction', true));
$this->redirect(array('action'=>'index'));
}
if ($this->IssueAction->del($id)) {
$this->Session->setFlash(__('IssueAction deleted', true));
$this->redirect(array('action'=>'index'));
}
}
}
?>

View file

@ -0,0 +1,68 @@
<?php
class IssuesController extends AppController {
var $name = 'Issues';
var $helpers = array('Html', 'Form');
function index() {
$this->Issue->recursive = 0;
$this->set('issues', $this->paginate());
}
function view($id = null) {
if (!$id) {
$this->Session->setFlash(__('Invalid Issue.', true));
$this->redirect(array('action'=>'index'));
}
$this->set('issue', $this->Issue->read(null, $id));
}
function add() {
if (!empty($this->data)) {
$this->Issue->create();
if ($this->Issue->save($this->data)) {
$this->Session->setFlash(__('The Issue has been saved', true));
$this->redirect(array('action'=>'index'));
} else {
$this->Session->setFlash(__('The Issue could not be saved. Please, try again.', true));
}
}
$users = $this->Issue->User->find('list');
$this->set(compact('users'));
}
function edit($id = null) {
if (!$id && empty($this->data)) {
$this->Session->setFlash(__('Invalid Issue', true));
$this->redirect(array('action'=>'index'));
}
if (!empty($this->data)) {
if ($this->Issue->save($this->data)) {
$this->Session->setFlash(__('The Issue has been saved', true));
$this->redirect(array('action'=>'index'));
} else {
$this->Session->setFlash(__('The Issue could not be saved. Please, try again.', true));
}
}
if (empty($this->data)) {
$this->data = $this->Issue->read(null, $id);
}
$users = $this->Issue->User->find('list');
$this->set(compact('users'));
}
function delete($id = null) {
if (!$id) {
$this->Session->setFlash(__('Invalid id for Issue', true));
$this->redirect(array('action'=>'index'));
}
if ($this->Issue->del($id)) {
$this->Session->setFlash(__('Issue deleted', true));
$this->redirect(array('action'=>'index'));
}
}
}
?>

View file

@ -6,8 +6,21 @@ class ProductsController extends AppController {
var $helpers = array('Html', 'Form', 'Ajax', 'Number');
function index() {
$this->Product->recursive = 0;
/*$this->Product->recursive = 0;
$this->set('products', $this->paginate());
*
*/
$this->set('principles', $this->Product->Principle->find('all', array('order' => 'Principle.name ASC')));
}
function view_principle($id = null) {
if(!$id) {
$this->Session->setFlash(__('Invalid Principle ID', true));
$this->redirect(array('action'=>'index'));
}
$this->set('products', $this->paginate('Product', array('Product.principle_id'=> $id)));
$this->set('principle', $this->Product->Principle->findById($id));
}
function view($id = null) {

32
models/issue.php Normal file
View file

@ -0,0 +1,32 @@
<?php
class Issue extends AppModel {
var $name = 'Issue';
var $validate = array(
'title' => array('notempty'),
'description' => array('notempty'),
'priority' => array('numeric'),
'user_id' => array('numeric')
);
//The Associations below have been created with all possible keys, those that are not needed can be removed
var $belongsTo = array(
'User' => array(
'className' => 'User',
'foreignKey' => 'user_id',
'conditions' => '',
'fields' => '',
'order' => ''
)
);
var $hasMany = array(
'IssueAction' => array(
'className' => 'IssueAction',
'foreignKey' => 'issue_id',
'dependent' => false
)
);
}
?>

25
models/issue_action.php Normal file
View file

@ -0,0 +1,25 @@
<?php
class IssueAction extends AppModel {
var $name = 'IssueAction';
var $validate = array(
'description' => array('notempty'),
);
//The Associations below have been created with all possible keys, those that are not needed can be removed
var $belongsTo = array(
'User' => array(
'className' => 'User',
'foreignKey' => 'user_id',
'conditions' => '',
'fields' => '',
'order' => ''
),
'Issue' => array(
'className' => 'Issue',
'foreignKey' => 'issue_id'
)
);
}
?>

7
vendors/xtcpdf.php vendored
View file

@ -393,6 +393,13 @@ class XTCPDF extends TCPDF {
}
function termsAndConditions() {
}

View file

@ -0,0 +1,6 @@
<?
echo $form->input('priority', array('options' => $priorities));
?>

View file

@ -0,0 +1,19 @@
<div class="issueActions form">
<?php echo $form->create('IssueAction');?>
<fieldset>
<legend><?php __('Add IssueAction');?></legend>
<?php
echo $form->input('user_id');
echo $form->input('description');
?>
</fieldset>
<?php echo $form->end('Submit');?>
</div>
<div class="actions">
<ul>
<li><?php echo $html->link(__('List IssueActions', true), array('action' => 'index'));?></li>
<li><?php echo $html->link(__('List Users', true), array('controller' => 'users', 'action' => 'index')); ?> </li>
<li><?php echo $html->link(__('New User', true), array('controller' => 'users', 'action' => 'add')); ?> </li>
</ul>
</div>

View file

@ -0,0 +1,20 @@
<div class="issueActions form">
<?php echo $form->create('IssueAction');?>
<fieldset>
<legend><?php __('Edit IssueAction');?></legend>
<?php
echo $form->input('id');
echo $form->input('user_id');
echo $form->input('description');
?>
</fieldset>
<?php echo $form->end('Submit');?>
</div>
<div class="actions">
<ul>
<li><?php echo $html->link(__('Delete', true), array('action' => 'delete', $form->value('IssueAction.id')), null, sprintf(__('Are you sure you want to delete # %s?', true), $form->value('IssueAction.id'))); ?></li>
<li><?php echo $html->link(__('List IssueActions', true), array('action' => 'index'));?></li>
<li><?php echo $html->link(__('List Users', true), array('controller' => 'users', 'action' => 'index')); ?> </li>
<li><?php echo $html->link(__('New User', true), array('controller' => 'users', 'action' => 'add')); ?> </li>
</ul>
</div>

View file

@ -0,0 +1,58 @@
<div class="issueActions index">
<h2><?php __('IssueActions');?></h2>
<p>
<?php
echo $paginator->counter(array(
'format' => __('Page %page% of %pages%, showing %current% records out of %count% total, starting on record %start%, ending on %end%', true)
));
?></p>
<table cellpadding="0" cellspacing="0">
<tr>
<th><?php echo $paginator->sort('id');?></th>
<th><?php echo $paginator->sort('created');?></th>
<th><?php echo $paginator->sort('user_id');?></th>
<th><?php echo $paginator->sort('description');?></th>
<th class="actions"><?php __('Actions');?></th>
</tr>
<?php
$i = 0;
foreach ($issueActions as $issueAction):
$class = null;
if ($i++ % 2 == 0) {
$class = ' class="altrow"';
}
?>
<tr<?php echo $class;?>>
<td>
<?php echo $issueAction['IssueAction']['id']; ?>
</td>
<td>
<?php echo $issueAction['IssueAction']['created']; ?>
</td>
<td>
<?php echo $html->link($issueAction['User']['id'], array('controller' => 'users', 'action' => 'view', $issueAction['User']['id'])); ?>
</td>
<td>
<?php echo $issueAction['IssueAction']['description']; ?>
</td>
<td class="actions">
<?php echo $html->link(__('View', true), array('action' => 'view', $issueAction['IssueAction']['id'])); ?>
<?php echo $html->link(__('Edit', true), array('action' => 'edit', $issueAction['IssueAction']['id'])); ?>
<?php echo $html->link(__('Delete', true), array('action' => 'delete', $issueAction['IssueAction']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $issueAction['IssueAction']['id'])); ?>
</td>
</tr>
<?php endforeach; ?>
</table>
</div>
<div class="paging">
<?php echo $paginator->prev('<< '.__('previous', true), array(), null, array('class'=>'disabled'));?>
| <?php echo $paginator->numbers();?>
<?php echo $paginator->next(__('next', true).' >>', array(), null, array('class' => 'disabled'));?>
</div>
<div class="actions">
<ul>
<li><?php echo $html->link(__('New IssueAction', true), array('action' => 'add')); ?></li>
<li><?php echo $html->link(__('List Users', true), array('controller' => 'users', 'action' => 'index')); ?> </li>
<li><?php echo $html->link(__('New User', true), array('controller' => 'users', 'action' => 'add')); ?> </li>
</ul>
</div>

View file

@ -0,0 +1,35 @@
<div class="issueActions view">
<h2><?php __('IssueAction');?></h2>
<dl><?php $i = 0; $class = ' class="altrow"';?>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Id'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $issueAction['IssueAction']['id']; ?>
&nbsp;
</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Created'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $issueAction['IssueAction']['created']; ?>
&nbsp;
</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('User'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $html->link($issueAction['User']['id'], array('controller' => 'users', 'action' => 'view', $issueAction['User']['id'])); ?>
&nbsp;
</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Description'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $issueAction['IssueAction']['description']; ?>
&nbsp;
</dd>
</dl>
</div>
<div class="actions">
<ul>
<li><?php echo $html->link(__('Edit IssueAction', true), array('action' => 'edit', $issueAction['IssueAction']['id'])); ?> </li>
<li><?php echo $html->link(__('Delete IssueAction', true), array('action' => 'delete', $issueAction['IssueAction']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $issueAction['IssueAction']['id'])); ?> </li>
<li><?php echo $html->link(__('List IssueActions', true), array('action' => 'index')); ?> </li>
<li><?php echo $html->link(__('New IssueAction', true), array('action' => 'add')); ?> </li>
<li><?php echo $html->link(__('List Users', true), array('controller' => 'users', 'action' => 'index')); ?> </li>
<li><?php echo $html->link(__('New User', true), array('controller' => 'users', 'action' => 'add')); ?> </li>
</ul>
</div>

25
views/issues/add.ctp Normal file
View file

@ -0,0 +1,25 @@
<div class="issues form">
<?php echo $form->create('Issue');?>
<fieldset>
<legend><?php __('Add Issue');?></legend>
<?php
echo $form->input('issue_type', array('options' => $issueTypes));
echo $form->input('title');
echo $form->input('description');
echo $form->input('issue_priority', array('options'=>$issuePriorities));
echo $form->input('user_id', array('type'=>'hidden', 'value'=>$currentuser['User']['id']));
?>
</fieldset>
<?php echo $form->end('Submit');?>
</div>
<div class="actions">
<ul>
<li><?php echo $html->link(__('List Issues', true), array('action' => 'index'));?></li>
<li><?php echo $html->link(__('List Users', true), array('controller' => 'users', 'action' => 'index')); ?> </li>
<li><?php echo $html->link(__('New User', true), array('controller' => 'users', 'action' => 'add')); ?> </li>
<li><?php echo $html->link(__('List Issue Actions', true), array('controller' => 'issue_actions', 'action' => 'index')); ?> </li>
<li><?php echo $html->link(__('New Issue Action', true), array('controller' => 'issue_actions', 'action' => 'add')); ?> </li>
</ul>
</div>
<?php debug($currentuser); ?>

25
views/issues/edit.ctp Normal file
View file

@ -0,0 +1,25 @@
<div class="issues form">
<?php echo $form->create('Issue');?>
<fieldset>
<legend><?php __('Edit Issue');?></legend>
<?php
echo $form->input('id');
echo $form->input('title');
echo $form->input('description');
echo $form->input('priority');
echo $form->input('user_id');
echo $form->input('resolved');
?>
</fieldset>
<?php echo $form->end('Submit');?>
</div>
<div class="actions">
<ul>
<li><?php echo $html->link(__('Delete', true), array('action' => 'delete', $form->value('Issue.id')), null, sprintf(__('Are you sure you want to delete # %s?', true), $form->value('Issue.id'))); ?></li>
<li><?php echo $html->link(__('List Issues', true), array('action' => 'index'));?></li>
<li><?php echo $html->link(__('List Users', true), array('controller' => 'users', 'action' => 'index')); ?> </li>
<li><?php echo $html->link(__('New User', true), array('controller' => 'users', 'action' => 'add')); ?> </li>
<li><?php echo $html->link(__('List Issue Actions', true), array('controller' => 'issue_actions', 'action' => 'index')); ?> </li>
<li><?php echo $html->link(__('New Issue Action', true), array('controller' => 'issue_actions', 'action' => 'add')); ?> </li>
</ul>
</div>

79
views/issues/index.ctp Normal file
View file

@ -0,0 +1,79 @@
<div class="issues index">
<h2><?php __('Open Issues');?></h2>
<p>
<?php
echo $paginator->counter(array(
'format' => __('Page %page% of %pages%, showing %current% records out of %count% total, starting on record %start%, ending on %end%', true)
));
?></p>
<table cellpadding="0" cellspacing="0">
<tr>
<th><?php echo $paginator->sort('ID');?></th>
<th><?php echo $paginator->sort('created');?></th>
<th><?php echo $paginator->sort('Created By');?></th>
<th><?php echo $paginator->sort('title');?></th>
<th><?php echo $paginator->sort('description');?></th>
<th><?php echo $paginator->sort('priority');?></th>
<th><?php echo $paginator->sort('resolved');?></th>
<th class="actions"><?php __('Actions');?></th>
</tr>
<?php
$i = 0;
foreach ($issues as $issue):
$class = null;
if ($i++ % 2 == 0) {
$class = ' class="altrow"';
}
?>
<tr<?php echo $class;?>>
<td>
<?php echo $html->link(__($issue['Issue']['id'], true), array('action' => 'view', $issue['Issue']['id'])); ?>
</td>
<td>
<?php echo $time->niceShort($issue['Issue']['created']);
echo " (".$time->timeAgoInWords($issue['Issue']['created']).")"; ?>
</td>
<td>
<?php echo $html->link($issue['User']['username'], array('controller' => 'users', 'action' => 'view', $issue['User']['id'])); ?>
</td>
<td>
<?php echo $issue['Issue']['title']; ?>
</td>
<td>
<?php echo $issue['Issue']['description']; ?>
</td>
<td>
<?php echo $issuePriorities[$issue['Issue']['priority']]; ?>
</td>
<td>
<?php echo $issue['Issue']['resolved']; ?>
</td>
<td class="actions">
<?php echo $html->link(__('View', true), array('action' => 'view', $issue['Issue']['id'])); ?>
<?php echo $html->link(__('Edit', true), array('action' => 'edit', $issue['Issue']['id'])); ?>
<?php echo $html->link(__('Delete', true), array('action' => 'delete', $issue['Issue']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $issue['Issue']['id'])); ?>
</td>
</tr>
<?php endforeach; ?>
</table>
</div>
<div class="paging">
<?php echo $paginator->prev('<< '.__('previous', true), array(), null, array('class'=>'disabled'));?>
| <?php echo $paginator->numbers();?>
<?php echo $paginator->next(__('next', true).' >>', array(), null, array('class' => 'disabled'));?>
</div>
<div class="actions">
<ul>
<li><?php echo $html->link(__('New Issue', true), array('action' => 'add')); ?></li>
<li><?php echo $html->link(__('List Users', true), array('controller' => 'users', 'action' => 'index')); ?> </li>
<li><?php echo $html->link(__('New User', true), array('controller' => 'users', 'action' => 'add')); ?> </li>
<li><?php echo $html->link(__('List Issue Actions', true), array('controller' => 'issue_actions', 'action' => 'index')); ?> </li>
<li><?php echo $html->link(__('New Issue Action', true), array('controller' => 'issue_actions', 'action' => 'add')); ?> </li>
</ul>
</div>

92
views/issues/view.ctp Normal file
View file

@ -0,0 +1,92 @@
<div class="issues view">
<h2><?php __('Issue');?></h2>
<dl><?php $i = 0; $class = ' class="altrow"';?>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Id'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $issue['Issue']['id']; ?>
&nbsp;
</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Created'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $issue['Issue']['created']; ?>
&nbsp;
</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Title'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $issue['Issue']['title']; ?>
&nbsp;
</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Description'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $issue['Issue']['description']; ?>
&nbsp;
</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Priority'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $issue['Issue']['priority']; ?>
&nbsp;
</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('User'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $html->link($issue['User']['id'], array('controller' => 'users', 'action' => 'view', $issue['User']['id'])); ?>
&nbsp;
</dd>
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Resolved'); ?></dt>
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
<?php echo $issue['Issue']['resolved']; ?>
&nbsp;
</dd>
</dl>
</div>
<div class="actions">
<ul>
<li><?php echo $html->link(__('Edit Issue', true), array('action' => 'edit', $issue['Issue']['id'])); ?> </li>
<li><?php echo $html->link(__('Delete Issue', true), array('action' => 'delete', $issue['Issue']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $issue['Issue']['id'])); ?> </li>
<li><?php echo $html->link(__('List Issues', true), array('action' => 'index')); ?> </li>
<li><?php echo $html->link(__('New Issue', true), array('action' => 'add')); ?> </li>
<li><?php echo $html->link(__('List Users', true), array('controller' => 'users', 'action' => 'index')); ?> </li>
<li><?php echo $html->link(__('New User', true), array('controller' => 'users', 'action' => 'add')); ?> </li>
<li><?php echo $html->link(__('List Issue Actions', true), array('controller' => 'issue_actions', 'action' => 'index')); ?> </li>
<li><?php echo $html->link(__('New Issue Action', true), array('controller' => 'issue_actions', 'action' => 'add')); ?> </li>
</ul>
</div>
<div class="related">
<h3><?php __('Related Issue Actions');?></h3>
<?php if (!empty($issue['IssueAction'])):?>
<table cellpadding = "0" cellspacing = "0">
<tr>
<th><?php __('Id'); ?></th>
<th><?php __('Created'); ?></th>
<th><?php __('User Id'); ?></th>
<th><?php __('Description'); ?></th>
<th class="actions"><?php __('Actions');?></th>
</tr>
<?php
$i = 0;
foreach ($issue['IssueAction'] as $issueAction):
$class = null;
if ($i++ % 2 == 0) {
$class = ' class="altrow"';
}
?>
<tr<?php echo $class;?>>
<td><?php echo $issueAction['id'];?></td>
<td><?php echo $issueAction['created'];?></td>
<td><?php echo $issueAction['user_id'];?></td>
<td><?php echo $issueAction['description'];?></td>
<td class="actions">
<?php echo $html->link(__('View', true), array('controller' => 'issue_actions', 'action' => 'view', $issueAction['id'])); ?>
<?php echo $html->link(__('Edit', true), array('controller' => 'issue_actions', 'action' => 'edit', $issueAction['id'])); ?>
<?php echo $html->link(__('Delete', true), array('controller' => 'issue_actions', 'action' => 'delete', $issueAction['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $issueAction['id'])); ?>
</td>
</tr>
<?php endforeach; ?>
</table>
<?php endif; ?>
<div class="actions">
<ul>
<li><?php echo $html->link(__('New Issue Action', true), array('controller' => 'issue_actions', 'action' => 'add'));?> </li>
</ul>
</div>
</div>

View file

@ -0,0 +1 @@
/Users/karlcordes/Sites/quotenik/app/views/products/index.ctp

View file

@ -4,24 +4,23 @@
<fieldset>
<legend><?php __('Add Product');?></legend>
<?php
echo $form->input('principle_id');
echo $form->input('principle_id', array('empty' => 'Choose a Principle'));
echo $form->input('title', array('class' => 'required', 'title'=>'Please Enter the Title for the Product'));
echo $form->input('description', array('id' => 'description', 'class'=>'ckeditor'));
//echo $javascript->codeBlock("CKEDITOR.replace('description');");
echo $form->input('part_number');
echo $form->input('notes');
//echo $html->link('Show/Hide Costing Details', '#', array('onClick' => "Effect.toggle('costingdetails', 'appear'); return false;"));
echo $html->link('Show/Hide Costing Details', '#', array('onClick' => "Effect.toggle('costingdetails', 'appear'); return false;"));
echo $html->image('calculator.png');
//echo $ajax->div('costingdetails');
echo $ajax->div('costingdetails');
//echo $this->e
//lement('product_costing', array('modelName' => 'Product'));
//echo $ajax->divEnd('costingdetails');
echo $ajax->divEnd('costingdetails');

View file

@ -1,58 +1,14 @@
<div class="products index">
<h2><?php __('Product Index');?></h2>
<p>
<?php
echo $paginator->counter(array(
'format' => __('Page %page% of %pages%, showing %current% records out of %count% total, starting on record %start%, ending on %end%', true)
));
?></p>
<table cellpadding="0" cellspacing="0">
<tr>
<th><?php echo $paginator->sort('principle_id');?></th>
<th><?php echo $paginator->sort('title');?></th>
<th><?php echo $paginator->sort('model_number');?></th>
<th class="actions"><?php __('Actions');?></th>
</tr>
<?php
$i = 0;
foreach ($products as $product):
$class = null;
if ($i++ % 2 == 0) {
$class = ' class="altrow"';
}
?>
<tr<?php echo $class;?>>
<td>
<?php echo $html->link($product['Principle']['name'], array('controller'=> 'principles', 'action'=>'view', $product['Principle']['id'])); ?>
</td>
<td>
<?php echo $product['Product']['title']; ?>
</td>
<td>
<?php echo $product['Product']['model_number']; ?>
</td>
<td class="actions">
<?php echo $html->link(__('View', true), array('action'=>'view', $product['Product']['id'])); ?>
<?php echo $html->link(__('Edit', true), array('action'=>'edit', $product['Product']['id'])); ?>
<?php echo $html->link(__('Delete', true), array('action'=>'delete', $product['Product']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $product['Product']['id'])); ?>
</td>
</tr>
<?php endforeach; ?>
</table>
</div>
<div class="paging">
<?php echo $paginator->prev('<< '.__('previous', true), array(), null, array('class'=>'disabled'));?>
| <?php echo $paginator->numbers();?>
<?php echo $paginator->next(__('next', true).' >>', array(), null, array('class'=>'disabled'));?>
</div>
<div class="actions">
<ul>
<li><?php echo $html->link(__('New Product', true), array('action'=>'add')); ?></li>
<li><?php echo $html->link(__('List Principles', true), array('controller'=> 'principles', 'action'=>'index')); ?> </li>
<li><?php echo $html->link(__('New Principle', true), array('controller'=> 'principles', 'action'=>'add')); ?> </li>
<li><?php echo $html->link(__('List Product Options', true), array('controller'=> 'product_options', 'action'=>'index')); ?> </li>
<li><?php echo $html->link(__('New Product Option', true), array('controller'=> 'product_options', 'action'=>'add')); ?> </li>
</ul>
<h2><?php __('Product List');?></h2>
<h3>Choose a Principle to view their Products</h3>
</div>
<div>
<ul class="principlesList">
<?php foreach($principles as $principle) {
echo "<li>".$html->link($principle['Principle']['name'], array('action'=>'view_principle', $principle['Principle']['id']))."</li>";
}
?>
</ul>
</div>

View file

@ -0,0 +1,36 @@
<div class="products view">
<h2><?php echo $principle['Principle']['name']; ?>: Products</h2>
<table cellpadding="0" cellspacing="0" class="productTable">
<tr>
<th><?php echo $paginator->sort('title');?></th>
<th class="actions"><?php __('Actions');?></th>
</tr>
<?php
$i = 0;
foreach ($products as $product):
$class = null;
if ($i++ % 2 == 0) {
$class = ' class="altrow"';
}
?>
<tr<?php echo $class;?>>
<td>
<?php echo $product['Product']['title']; ?>
</td>
<td class="actions">
<?php echo $html->link(__('View', true), array('action'=>'view', $product['Product']['id'])); ?>
<?php echo $html->link(__('Edit', true), array('action'=>'edit', $product['Product']['id'])); ?>
</td>
<?php endforeach; ?>
</table>
</div>
<?php debug($products); ?>

View file

@ -1,7 +1,8 @@
<?php
if ($session->check('Message.auth')) $session->flash('auth');
echo $form->create('User', array('action' => 'login'));
echo $form->input('username');
echo $form->input('password');
echo $form->end('Login');
if ($session->check('Message.auth')) $session->flash('auth');
echo $form->create('User', array('action' => 'login'));
echo $form->input('username');
echo $form->input('password');
echo $form->input('remember_me', array('label' => 'Keep me logged in on this Computer', 'type' => 'checkbox'));
echo $form->end('Login');
?>

View file

@ -106,6 +106,15 @@ ul, li {
}
ul.principlesList {
font-size: 150%;
}
ul.principlesList li {
margin: 1em;
}
ul.principle-emails {
list-style: none;
margin-left: 0;
@ -558,6 +567,13 @@ td.rightAlign {
text-align: right;
}
/* View Products Table */
table.productTable {
width: auto;
}
/* Paging */
div.paging {