test cakephp

2014-10-27 Thread buffalix
test cakephp

-- 
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+unsubscr...@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.
For more options, visit https://groups.google.com/d/optout.


edit two models data in a single view

2014-10-27 Thread buffalix
so I have two models, family and students, each family could have several 
students. I want to use one view (edit view for family) for both family and 
students editing. 



Edit family

Form->create('Family'); ?>

Form->input('id', array('type'=>'hidden'));  ?>
  Form->input('father'); ?> 
  Form->input('mother'); ?>  
  Form->input('address'); ?> 
Form->input('zip'); ?>  
  Form->input('phone'); ?> 
  Form->input('email');  ?>  


  Form->input('Student.Name'); ?> 
  Form->input($student['Student']['Birthday']); 
?> 
   
  
Form->end('Save Post'); ?>

I can see the current value for family model in the form but, it does not 
show the current student info in the form.  

"CakePHP will assume that you are editing a model if the ‘id’ field is 
present in the
data array. If no ‘id’ is present (look back at our add view), CakePHP will 
assume that you are inserting a
new model when save() is called."

So I guess I am missing this portion "id" field for the second model 
"student".  but the "student" table has a "family_id" referencing back to 
the "id" field of "family' table

So how I can fix this?



-- 
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+unsubscr...@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.
For more options, visit https://groups.google.com/d/optout.


Re: Security Component is Ruining my Life

2014-10-27 Thread Florian Krämer
I've turned the idea into an implementation. Proof of concept goes 
here: 
https://github.com/burzum/cakephp/commit/9d8f6b4cb7653dd14130af68dbc632e9055d8d76

This will output the dirty fields as a list below the error message. I hope 
this is going to make it into the core. :)

On Sunday, October 19, 2014 12:26:44 AM UTC+2, glk wrote:
>
> Florian... What a wonderful idea.  
>
> Just wish I understood all of Cake well enough to help implement.  I've 
> fought with the Security Component many times and, although I've never 
> lost, it has created many headaches.  Hope the Development team can add 
> this functionality during debugging.
>
>

-- 
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+unsubscr...@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.
For more options, visit https://groups.google.com/d/optout.


Re: Going back to the page after changes

2014-10-27 Thread Salines
Whoops, I sent the wrong answer, here again

public function edit($id = null) {
 if (!$this->Article->exists($id)) {
throw new NotFoundException(__('Invalid article'));
}
if ($this->request->is(array('post', 'put'))) {
if ($this->Article->save($this->request->data)) {
$this->Session->setFlash(__('The article has been saved.'));
return $this->redirect($this->request->data['Article']['referer']);
} else {
$this->Session->setFlash(__('The articlecould not be saved. Please, try 
again.'));
}
} else {
$options = array('conditions' => array('Article.' . 
$this->Article->primaryKey => $id));
$this->request->data = $this->Article->find('first', $options);
}
$this->set('referer',$this->referer();
}


edit.ctp

 
 Form->hidden('referer', array('value' =>$referer)); ?>




-- 
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+unsubscr...@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.
For more options, visit https://groups.google.com/d/optout.


Re: Going back to the page after changes

2014-10-27 Thread Salines
$this->redirect(array('action' => 'view',$id));

-- 
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+unsubscr...@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.
For more options, visit https://groups.google.com/d/optout.


Re: Going back to the page after changes

2014-10-27 Thread Steven Scaffidi
Anyone have any suggestions?

On Sunday, October 19, 2014 9:11:06 AM UTC-5, Steven Scaffidi wrote:
>
> Hi - If I have a list of articles and someone makes a change to one of 
> those articles on page 2 for example. How can I redirect the user back to 
> page 2 after the change? I've tried using 
> $this->redirect($this->referer()); but that doesn't seem to work. Any help 
> is greatly appreciated.
>

-- 
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+unsubscr...@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.
For more options, visit https://groups.google.com/d/optout.


Re: Virtual fields or other solution

2014-10-27 Thread Salines
I forgot to say, the results should be sorted by periods

-- 
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+unsubscr...@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.
For more options, visit https://groups.google.com/d/optout.


Virtual fields or other solution

2014-10-27 Thread Salines
Hi there,

need a little help, 

I have a simple model where the data is stored in the following format: 

id | product_id | period | price .. 

1  | 1  | 10 | 9.99 
2  | 1  | 20 | 18.99 
3  | 1  | 30 | 27.99 


Each product will have more 'period' data stored in a relational table. 

When we browse all the products I should show these periods as virtual 
fields. 

eg 

id | name  | period 10 | 20 Period | Period 30 
--  
1  | sweet product | 9.99  | 18.99 | 27.99 



Can someone give me directions? 

thank you

-- 
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+unsubscr...@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.
For more options, visit https://groups.google.com/d/optout.


CakeEmail problems

2014-10-27 Thread Peter Bradley
I'm currently rewriting a client's web application using cakephp.  One of 
the pages requires sending the data in a form to the company in an email.  
I'm having problems with this in my development environment:

   - Ubuntu 14.10
   - Apache2/PHP  with all the normal libraries like lib_php, mod_rewrite, 
   etc
   - PHP 5.5
   - CakePHP 2.5.4
   
After poking about a bit on the web, I've seen that I have to load 
lib_openssl and that I should include the following line in my php.ini 
file.  So in /etc/php5/apache2/php.ini I've added the recommended line to 
the Dynamic Extensions section:

extension=php_openssl.so

I'm not sure if this is correct because Ubuntu includes php_openssl via gnutls. 
 However, I don't know how to test this.

I've created an email.php file under app/Config with the following class 
definition:

class EmailConfig {
 public $gmail = array(
 'host' => 'ssl://smtp.gmail.com',
 'port' => 465,
 'username' => 'myusern...@gmail.com',
 'password' => 'mypassword',
 'transport' => 'Smtp',
 );
}

The username and password are copied from Thunderbird, so should be OK.

Finally, I set up a test page under app/View/Pages, called email-tester.ctp 
containing the code:

from(array('myusern...@gmail.com' => 'My Gmail Address'))
 ->to('myem...@myemailprovider.con')
 ->subject('About')
 ->send('My message');
?>
Email sent...

When I try to open this page at localhost/myproject/pages/email-tester I get an 
error message as follows:


*Error: * An Internal Error Has Occurred.
Stack Trace 
   
   - CORE/Cake/Network/Email/MailTransport.php line 51 
    → 
MailTransport->_mail(string, 
   string, string, string, null) 
    
   - CORE/Cake/Network/Email/CakeEmail.php line 1158 
    → 
   MailTransport->send(CakeEmail) 
    
   - APP/View/Pages/email-tester.ctp line 8 
    → 
   CakeEmail->send(string) 
    
   - CORE/Cake/View/View.php line 948 
    → include(string) 
    
   - CORE/Cake/View/View.php line 910 
    → 
View->_evaluate(string, 
   array)  
   - CORE/Cake/View/View.php line 471 
    → 
   View->_render(string)  
   - CORE/Cake/Controller/Controller.php line 954 
    → View->render(string, 
   null)  
   - APP/Controller/PagesController.php line 69 
    → 
   Controller->render(string) 
    
   - [internal function]  
   → PagesController->display(string) 
    
   - CORE/Cake/Controller/Controller.php line 490 
    → 
ReflectionMethod->invokeArgs(PagesController, 
   array)  
   - CORE/Cake/Routing/Dispatcher.php line 191 
    → 
   Controller->invokeAction(CakeRequest) 
    
   - CORE/Cake/Routing/Dispatcher.php line 165 
    → 
Dispatcher->_invoke(PagesController, 
   CakeRequest)  
   - APP/webroot/index.php line 108 
    → 
Dispatcher->dispatch(CakeRequest, 
   CakeResponse) 

If anyone can decode this for me, or give me some idea as to what I should try 
next, I'd be very grateful.

Thanks in advance


Peter

-- 
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+unsubscr...@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.
For more options, visit https://groups.google.com/d/optout.


[Vagrant] Cake Dev Box

2014-10-27 Thread João Paulo Barbosa Neto
Hi,

First, sorry for the bad english.

I want to share with you a vagrant box for cakephp development

https://github.com/jpaulobneto/cake-dev-box

It install CakePHP with app (cake_app) and core (cake_core) in root folder 
and webroot in www folder.

Thanks and i hope you enjoy and help.

-- 
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+unsubscr...@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.
For more options, visit https://groups.google.com/d/optout.