* finish task#1649.

This commit is contained in:
azhi
2013-07-30 09:49:58 +08:00
parent d49e026924
commit 0d1188f737
2 changed files with 10 additions and 2 deletions
+3
View File
@@ -256,6 +256,7 @@ class deptModel extends model
$parentPath = ',';
}
$i = 1;
foreach($childs as $deptID => $deptName)
{
if(empty($deptName)) continue;
@@ -264,10 +265,12 @@ class deptModel extends model
$dept->name = strip_tags($deptName);
$dept->parent = $parentDeptID;
$dept->grade = $grade;
$dept->order = $this->post->maxOrder + $i * 10;
$this->dao->insert(TABLE_DEPT)->data($dept)->exec();
$deptID = $this->dao->lastInsertID();
$childPath = $parentPath . "$deptID,";
$this->dao->update(TABLE_DEPT)->set('path')->eq($childPath)->where('id')->eq($deptID)->exec();
$i++;
}
else
{
+7 -2
View File
@@ -48,7 +48,12 @@
</td>
<td>
<?php
foreach($sons as $sonDept) echo html::input("depts[id$sonDept->id]", $sonDept->name) . '<br />';
$maxOrder = 0;
foreach($sons as $sonDept)
{
if($sonDept->order > $maxOrder) $maxOrder = $sonDept->order;
echo html::input("depts[id$sonDept->id]", $sonDept->name) . '<br />';
}
for($i = 0; $i < DEPT::NEW_CHILD_COUNT ; $i ++) echo html::input("depts[]") . '<br />';
?>
</td>
@@ -56,7 +61,7 @@
<tr>
<td></td>
<td>
<?php echo html::submitButton() . html::backButton();?>
<?php echo html::submitButton() . html::backButton() . html::hidden('maxOrder', $maxOrder);?>
<input type='hidden' value='<?php echo $deptID;?>' name='parentDeptID' />
</td>
</tr>