0

私はITクエリシステムを持っています。ユーザーはクエリを追加できます。ユーザーがクエリを追加すると、IT部門はクエリに返信/コメントします。

ユーザーがクエリを追加するときは、it_queriesテーブルのquery_typeフィールドをOPENに変更し、IT部門がクエリを表示するときに、返信/コメントし、query_typeフィールドをOPENからPENDINGに変更し、最後にユーザーは、チェックボックスを使用してクエリをクローズとしてマークできるはずです。これにより、ステータスがPENDINGからCLOSEに変更されます。

それらがビューの追加とテーブルへの挿入で定数を設定する方法であるかどうかはわかりません。

明らかに私は学んでいます、そして誰かが私が取らなければならないステップについて私を案内してくれますか?

これがユーザーのためのaddit_queryの私のコードです

<?php echo $this->Form->create('ItQuery'); ?>
<fieldset>
<legend><?php echo __('Add It Query'); ?></legend>
<?php
echo $this->Form->hidden('hr_employee_id',array('value'=>$loggedInId));
echo $this->Form->input('it_query_type_id');
echo $this->Form->input('comment');
echo $this->Form->hidden('status_type', array('value'=>OPEN));
?>
</fieldset>
<?php echo $this->Form->end(__('Submit')); ?>

これがIT部門への私のコメントのコードです

    <?php echo $this->Form->create('ItQueryComment'); ?>

<?php echo __('Add It Query Comment'); ?>
<?php
echo $this->Form->input('it_query_id');
echo $this->Form->input('comment');
echo $this->Form->input('close_query');
?>

<?php echo $this->Form->end(__('Submit')); ?>

これが私のItQueryCommentsのコードです

public function add() {
if ($this->request->is('post')) {
$this->ItQueryComment->create();
if ($this->ItQueryComment->save($this->request->data)) {
$this->Session->setFlash(__('The it query comment has been saved'));
$this->redirect(array('controller' => 'it_queries','action' => 'view', $this->request->data['ItQueryComment']['it_query_id']));
} else {
$this->Session->setFlash(__('The it query comment could not be saved. Please, try again.'));
}
}
$itQueries = $this->ItQueryComment->ItQuery->find('list');
$hrEmployees = $this->ItQueryComment->HrEmployee->find('list');
$this->set(compact('itQueries', 'hrEmployees'));
}
4

1 に答える 1

0

特定の Itquery のコメントを保存する際に、データベースにコメントを追加した後、コメント コントローラーの add 関数で、 $this->getLastInsertID(); を使用してその ID を取得します。Itquery Model の関数 updateAll を呼び出し、その特定のクエリのステータスを「保留中」に変更します。

于 2013-03-05T14:30:38.273 に答える