I want to manage my user account from my entries index view i have
link on my entries/index  page when i click on this link it will take
user to users/edit view how to do this  my entries controller look
like
<?php
class EntriesController extends AppController {
        var $name = 'Entries';
    var $helpers = array('Html','Form','Javascript','Ajax');
    var $components = array('RequestHandler');
        function index()
        {

            $this->set('id',$this->Entry->User->find('all',array
('fields'=>'User.id','recursive'=>'0','conditions'=>array
('username'=>'pooja'))));
                $this->Entry->recursive = 1;
                $this->set('entries', $this->Entry->findAll());

        }
        function view($id = null)
        {
                if (!$id)
                 {
                        $this->Session->setFlash('Invalid id for Entry.');
                        $this->redirect('/entries/index');
                  }
                $this->set('entry', $this->Entry->read(null, $id));

        }

function add()
{
        $this->set('sections', $this->Entry->Section->find('list',array
('fields'=>'Section.section','Section.id')));
                if (empty($this->data))
                 {
                        $this->render();
                 }

                 else
                 {
                        $this->data['Entry']['name'] = 
$this->data['Entry']['File']
['name'];
            $this->data['Entry']['type'] = $this->data['Entry']['File']
['type'];
            $this->data['Entry']['size'] = $this->data['Entry']['File']
['size'];
                        if ($this->Entry->save($this->data))
                                {

                                        $this->Session->setFlash('The Entry has 
been saved');
                                }
                           else
                           {
                                        $this->Session->setFlash('Please 
correct errors below.');
                                }
        if (move_uploaded_file($this->data['Entry']['File']
['tmp_name'], WWW_ROOT.'/files/' .$this->data['Entry']['File']
['name']))
                                   {
                            echo "File uploaded successfully";
                                        }
                                        else
                                        {
                        echo "There was an error uploading the file,
please try again!";
                                        }
                                        $this->redirect('/entries/index');
                }

}
        function edit($id = null)
         {
                if (empty($this->data))
                 {
                        if (!$id)
                         {
                                $this->Session->setFlash('Invalid id for 
Entry');
                                $this->redirect('/entries/index');
                        }

                        $this->set('sections', 
$this->Entry->Section->find('list',array
('fields'=>'Section.section','Section.id','recursive' => 1,'page' =>
1,)));
                        $this->data = $this->Entry->read(null, $id);
                }
                else
                {

                            if ($this->Entry->save($this->data))
                                 {
                                        $this->Session->setFlash('The Entry has 
been saved');
                                        $this->redirect('/entries/index');
                                 }
                        else
                                {
                                        $this->Session->setFlash('Please 
correct errors below.');
                                }


                }
        }

function delete($id = null) {
                if (!$id) {
                        $this->Session->setFlash('Invalid id for Entry');
                        $this->redirect('/entries/index');
                }
                if ($this->Entry->del($id)) {
                        $this->Session->setFlash('Record deleted successfully');
                        $this->redirect('/entries/index');
                }
        }
function update_select()
{
if(!empty($this->data['Entry']['section_id']))
 {
 $section_id = (int)$this->data['Entry']['section_id'];
$options = $this->Entry->Submenu->find('list',array('section_id'=>
$section_id,'recursive' => 1,'conditions'=>array('section_id'=>
$section_id),'page' => 1,'fields'=>'Submenu.submenu'));
    $this->set('options',$options);
}


}

}
?>
i don't have user_id in entries table
my index view as follows


<h2>Welcome <?php echo $id=$session->read('User')?></h2>
<h2>Count :</h2>
 <div class="entries">
 <?php
echo $html->css('default');
?>
<table cellpadding="0" cellspacing="0">
<?echo $html->tableHeaders(
    array(

      'Section',
      'Submenu',
      'Listitem',
          'Detail',
          'Actions'
    )
);?>
<?php
$i = 0;
 foreach ($entries as $entry):
   $class = null;
        if ($i++ % 2 == 0) {
             $class ='class="altrow"';
        }
  ?>
<tr <?php echo $class;?>>
        <td><?php echo $entry['Section']['section']; ?></td>
        <td><?php echo $entry['Submenu']['submenu']; ?></td>
        <td><?php
        if(strlen($entry['Entry']['Listitem'])>0)
        {
        echo $entry['Entry']['Listitem'];
        }
        else{
        echo "----";
        }
        ?></td>
        <td><?php
        if(strlen($entry['Entry']['Detail'])>0)
        {
        echo $entry['Entry']['Detail'];
        }
        else{
        echo "----";
        }
        ?></td>
        <td class="actions">
                <?php echo $html->link('View','/entries/view/' . $entry['Entry']
['id'])?>
                <?php echo $html->link('Edit','/entries/edit/' . $entry['Entry']
['id'])?>
                <?php echo $html->link('Delete','/entries/delete/' . 
$entry['Entry']
['id'], null, 'Are you sure you want to delete record' )?>
        </td>
</tr>
<?php endforeach; ?>
</table>
<table style="border:none; width:90px;">

<tr class="actions"><td class="actions">
<?php echo $html->link('New Content entry', '/entries/add'); ?></td>
<td class="actions"><?php echo $html->link('Logout','/users/logout');?
></td>
<td class="actions"><?php echo $html->link('Manage Account','/users/
edit'.$form->value('User/id'));?></td>
<td class="actions"><?php echo $html->link('Update Counter','/updates/
index');?></td>
</tr>
</table>
</div>
can anybody help me its very urgent please try to help me
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to