Rah
This commit is contained in:
parent
1456d4ff04
commit
5b1f72489b
|
|
@ -27,10 +27,9 @@ class IndustriesController extends AppController {
|
||||||
$this->Session->setFlash(__('The Industry could not be saved. Please, try again.', true));
|
$this->Session->setFlash(__('The Industry could not be saved. Please, try again.', true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$customers = $this->Industry->Customer->find('list');
|
|
||||||
$parents = $this->Industry->find('list', array('conditions' => array(
|
$parents = $this->Industry->find('list', array('conditions' => array(
|
||||||
'Industry.parent_id' => null)));
|
'Industry.parent_id' => null)));
|
||||||
$this->set(compact('customers', 'parents'));
|
$this->set(compact('parents'));
|
||||||
}
|
}
|
||||||
|
|
||||||
function edit($id = null) {
|
function edit($id = null) {
|
||||||
|
|
|
||||||
36
models/industry.php
Normal file
36
models/industry.php
Normal file
|
|
@ -0,0 +1,36 @@
|
||||||
|
<?
|
||||||
|
|
||||||
|
class Industry extends AppModel {
|
||||||
|
|
||||||
|
var $name = 'Industry';
|
||||||
|
|
||||||
|
|
||||||
|
var $hasAndBelongsToMany = array (
|
||||||
|
'Customer' => array(
|
||||||
|
'className' => 'Customer',
|
||||||
|
'joinTable' => 'industries_customers'
|
||||||
|
// 'foreignKey' => 'industry_id',
|
||||||
|
// 'associationForeignKey' => 'customer_id'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
var $belongsTo = array (
|
||||||
|
'ParentIndustry' => array(
|
||||||
|
'className' => 'Industries',
|
||||||
|
'foreignKey' => 'parent_id'
|
||||||
|
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
var $hasMany = array (
|
||||||
|
'subIndustry' => array(
|
||||||
|
'className' => 'Industries',
|
||||||
|
'foreignKey' => 'parent_id',
|
||||||
|
'dependent' => true
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
Binary file not shown.
Binary file not shown.
|
|
@ -5,7 +5,6 @@
|
||||||
<?php
|
<?php
|
||||||
echo $form->input('name');
|
echo $form->input('name');
|
||||||
echo $form->input('parent_id');
|
echo $form->input('parent_id');
|
||||||
echo $form->input('Customer');
|
|
||||||
?>
|
?>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<?php echo $form->end('Submit');?>
|
<?php echo $form->end('Submit');?>
|
||||||
|
|
|
||||||
|
|
@ -11,19 +11,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
?></h2>
|
?></h2>
|
||||||
<dl><?php $i = 0; $class = ' class="altrow"';?>
|
|
||||||
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Name'); ?></dt>
|
|
||||||
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
|
|
||||||
<?php echo $industry['Industry']['name']; ?>
|
|
||||||
|
|
||||||
</dd>
|
|
||||||
<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Parent Industry'); ?></dt>
|
|
||||||
<dd<?php if ($i++ % 2 == 0) echo $class;?>>
|
|
||||||
<?php echo $html->link($industry['ParentIndustry']['name'], array('controller'=> 'industries', 'action'=>'view', $industry['ParentIndustry']['id'])); ?>
|
|
||||||
|
|
||||||
</dd>
|
|
||||||
</dl>
|
|
||||||
</div>
|
|
||||||
<div class="actions">
|
<div class="actions">
|
||||||
<ul>
|
<ul>
|
||||||
<li><?php echo $html->link(__('Edit Industry', true), array('action'=>'edit', $industry['Industry']['id'])); ?> </li>
|
<li><?php echo $html->link(__('Edit Industry', true), array('action'=>'edit', $industry['Industry']['id'])); ?> </li>
|
||||||
|
|
@ -34,9 +23,9 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<?php if (!empty($industry['subIndustry'])):?>
|
||||||
<div class="related">
|
<div class="related">
|
||||||
<h3><?php __('Sub-Industries');?></h3>
|
<h3><?php __('Sub-Industries');?></h3>
|
||||||
<?php if (!empty($industry['subIndustry'])):?>
|
|
||||||
<table cellpadding = "0" cellspacing = "0">
|
<table cellpadding = "0" cellspacing = "0">
|
||||||
<tr>
|
<tr>
|
||||||
<th><?php __('Name'); ?></th>
|
<th><?php __('Name'); ?></th>
|
||||||
|
|
@ -60,13 +49,16 @@
|
||||||
</tr>
|
</tr>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</table>
|
</table>
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<div class="actions">
|
<div class="actions">
|
||||||
<ul>
|
<ul>
|
||||||
<li><?php echo $html->link(__('New Sub Industry', true), array('controller'=> 'industries', 'action'=>'add'));?> </li>
|
<li><?php echo $html->link(__('New Sub Industry', true), array('controller'=> 'industries', 'action'=>'add'));?> </li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -112,9 +104,4 @@
|
||||||
</table>
|
</table>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<div class="actions">
|
|
||||||
<ul>
|
|
||||||
<li><?php echo $html->link(__('New Customer', true), array('controller'=> 'customers', 'action'=>'add'));?> </li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue