+ add the required fields of project.

This commit is contained in:
wangchunsheng
2010-03-25 06:09:00 +00:00
parent 8f568710c6
commit ae8695f7fc
4 changed files with 22 additions and 36 deletions

View File

@@ -0,0 +1,3 @@
<?php
$config->project->create->requiredFields = 'name,code,team,begin,end';
$config->project->edit->requiredFields = 'name,code,team,begin,end';

View File

@@ -42,6 +42,7 @@ class projectModel extends model
/* 新增项目。*/
public function create()
{
$this->lang->project->team = $this->lang->project->teamname;
$project = fixer::input('post')
->add('company', $this->app->company->id)
->stripTags('name, code, team')
@@ -49,7 +50,7 @@ class projectModel extends model
->get();
$this->dao->insert(TABLE_PROJECT)->data($project)
->autoCheck($skipFields = 'begin,end')
->batchCheck('name,code,team', 'notempty')
->batchcheck($this->config->project->create->requiredFields, 'notempty')
->checkIF($project->begin != '', 'begin', 'date')
->checkIF($project->end != '', 'end', 'date')
->check('name', 'unique')
@@ -61,6 +62,7 @@ class projectModel extends model
/* 更新一个项目。*/
public function update($projectID)
{
$this->lang->project->team = $this->lang->project->teamname;
$projectID = (int)$projectID;
$project = fixer::input('post')
->stripTags('name, code, team')
@@ -70,7 +72,7 @@ class projectModel extends model
->get();
$this->dao->update(TABLE_PROJECT)->data($project)
->autoCheck($skipFields = 'begin,end')
->batchCheck('name,code,team', 'notempty')
->batchcheck($this->config->project->edit->requiredFields, 'notempty')
->checkIF($project->begin != '', 'begin', 'date')
->checkIF($project->end != '', 'end', 'date')
->check('name', 'unique', "id!=$projectID")

View File

@@ -30,43 +30,35 @@
<caption><?php echo $lang->project->create;?></caption>
<tr>
<th class='rowhead'><?php echo $lang->project->name;?></th>
<td><input type='text' name='name' class='text-3' /></td>
<td><?php echo html::input('name', '', "class='text-3'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->project->code;?></th>
<td><input type='text' name='code' class='text-3' /></td>
<td><?php echo html::input('code', '', "class='text-3'");?></td>
</tr>
<!--
<tr>
<th class='rowhead'><?php echo $lang->project->parent;?></th>
<td><?php echo html::select('parent', $projects, '', 'class=select-3');?></td>
</tr>
-->
<tr>
<th class='rowhead'><?php echo $lang->project->begin;?></th>
<td><input type='text' name='begin' class='text-3 date' /></td>
<td><?php echo html::input('begin', '', "class='text-3 date'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->project->end;?></th>
<td><input type='text' name='end' class='text-3 date' /></td>
<td><?php echo html::input('end', '', "class='text-3 date'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->project->teamname;?></th>
<td><input type='text' name='team' class='text-3' /></td>
<td><?php echo html::input('team', '', "class='text-3'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->project->goal;?></th>
<td><textarea name='goal' rows='5' class='area-1'></textarea></td>
<td><?php echo html::textarea('goal', '', "rows='5' class='area-1'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->project->desc;?></th>
<td><textarea name='desc' rows='5' class='area-1'></textarea></td>
<td><?php echo html::textarea('desc', '', "rows='5' class='area-1'");?></td>
</tr>
<tr>
<td colspan='2' class='a-center'>
<?php echo html::submitButton() . html::resetButton();?>
</td>
<td colspan='2' class='a-center'><?php echo html::submitButton() . html::resetButton();?></td>
</tr>
</table>
</form>

View File

@@ -30,43 +30,32 @@
<caption><?php echo $lang->project->edit;?></caption>
<tr>
<th class='rowhead'><?php echo $lang->project->name;?></th>
<td><input type='text' name='name' value='<?php echo $project->name;?>' class='text-3' /></td>
<td><?php echo html::input('name', $project->name, "class='text-3'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->project->code;?></th>
<td><input type='text' name='code' value='<?php echo $project->code;?>' class='text-3' /></td>
<td><?php echo html::input('code', $project->code, "class='text-3'");?></td>
</tr>
<!---
<tr>
<th class='rowhead'><?php echo $lang->project->parent;?></th>
<td><?php echo html::select('parent', $projects, $project->parent, 'class=select-3');?></td>
</tr>
-->
<tr>
<th class='rowhead'><?php echo $lang->project->begin;?></th>
<td><input type='text' name='begin' value='<?php echo $project->begin;?>' class='text-3 date' /></td>
<td><?php echo html::input('begin', $project->begin, "class='text-3 date'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->project->end;?></th>
<td><input type='text' name='end' value='<?php echo $project->end;?>' class='text-3 date' /></td>
<td><?php echo html::input('end', $project->end, "class='text-3 date'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->project->teamname;?></th>
<td><input type='text' name='team' value='<?php echo $project->team;?>' class='text-3' /></td>
<td><?php echo html::input('team', $project->team, "class='text-3'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->project->status;?></th>
<td><?php echo html::select('status', $lang->project->statusList, $project->status, 'class=text-3');?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->project->goal;?></th>
<td><textarea name='goal' rows='5' class='area-1'><?php echo stripslashes($project->goal);?></textarea></td>
<td><?php echo html::textarea('goal', $project->goal, "rows='5' class='area-1'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->project->desc;?></th>
<td><textarea name='desc' rows='5' class='area-1'><?php echo stripslashes($project->desc);?></textarea></td>
<td><?php echo html::textarea('desc', $project->desc, "rows='5' class='area-1'");?></td>
</tr>
<tr>
<td colspan='2' class='a-center'><?php echo html::submitButton() . html::resetButton();?></td>