Tuesday, March 5, 2013

Changing table field using 2 different models

I have an IT query system were by users can add their queries, when they add their query the IT department then replies/comments on the query.

How is should work is when the user adds a query it must change the query_type field in the it_queries table to OPEN and when the IT department views the query they reply/comment on it and must change query_type field from OPEN to PENDING then finally when the user has been helped/assisted they should be able to mark the query as closed using a checkbox, that will then change the status from PENDING TO CLOSE.

Not sure if they is a way of setting the constants in the add views and insert in the table.

Obviously i am learning and can someone please guide me on the steps i must take.

Here is my code for the add it_query for the users

    <?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->input('it_status_query_id');
    ?>
    </fieldset>
    <?php echo $this->Form->end(__('Submit')); ?>

Here is the code for my comments for IT Department

    <div class="comment form">
    <h2><?php echo __('Add a comment'); ?></h2>
    <?php
    echo $this->Form->create
    (
    'Feedback.Comment',
    array
    (
    'url' => array
    (
    'plugin' => 'feedback',
    'controller' => 'comments',
    'action' => 'add',
    $foreign_model,
    $foreign_id
    )
    )
    );
    ?>
    <?php echo $this->Form->input('Comment.author_name', array('label' => __('Name'))); ?>
    <?php echo $this->Form->input('Comment.hairy_pot', array('type' => 'hidden')); ?>
    <?php echo $this->Form->input('Comment.content', array('label' => __('Comments'))); ?>
    <?php echo $this->Form->input('Comment.foreign_model', array('type' => 'hidden', 'value' => $foreign_model)); ?>
    <?php echo $this->Form->input('Comment.foreign_id', array('type' => 'hidden', 'value' => $foreign_id)); ?>
    <?php echo $this->Form->end(__('Save comment')); ?>   
    </div>

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments: