Thursday, September 30, 2010

phpreports

Does anybody know or make phpreports with CAKEPHP VERSION 1.3

This is a website of how to make phpreports, just php without CAKEPHP

http://phpreports.sourceforge.net/better.html

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

Re: beforeCreate() and afterCreate(): better implementation than mine?

afterSave already contains "created/updated":
http://book.cakephp.org/view/684/afterSave
note the param passed

On 30 Sep., 16:35, psybear83 <psybea...@gmail.com> wrote:
> Hello folks
>
> From Ruby On Rails I know the beforeCreate() and afterCreate() hooks
> of models. I didn't find them for CakePHP, so I implemented them
> myself:
>
>   function isNewRecord() {
>     return empty($this->id) || $this->field('created') == $this->field('modified');
>
>   }
>
>   function beforeSave() {
>     if($this->isNewRecord()) {
>       return $this->beforeCreate();
>     }
>   }
>
>   function afterSave() {
>     if($this->isNewRecord()) {
>       return $this->afterCreate();
>     }
>   }
>
>   function beforeCreate() {
>     return true;
>   }
>
>   function afterCreate() {
>     return true;
>   }
>
> Sadly, this implementation depends on created and modified fields, and
> the isNewRecord() method itself isn't very beautiful, too. So maybe
> there is a better implementation?
>
> Thanks
> Josh

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

beforeCreate() and afterCreate(): better implementation than mine?

Hello folks

From Ruby On Rails I know the beforeCreate() and afterCreate() hooks
of models. I didn't find them for CakePHP, so I implemented them
myself:

function isNewRecord() {
return empty($this->id) || $this->field('created') == $this-
>field('modified');
}

function beforeSave() {
if($this->isNewRecord()) {
return $this->beforeCreate();
}
}

function afterSave() {
if($this->isNewRecord()) {
return $this->afterCreate();
}
}

function beforeCreate() {
return true;
}

function afterCreate() {
return true;
}

Sadly, this implementation depends on created and modified fields, and
the isNewRecord() method itself isn't very beautiful, too. So maybe
there is a better implementation?

Thanks
Josh

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

Re: opening a popup window when clicking on a link

thx mike,

i was hoping there is a way with $ajax->link and scriptaculous or sth
like that......u know using the ajax helper

On 30 Sep., 15:52, "Mike Karthauser" <mi...@brightstorm.co.uk> wrote:
> On Thu, September 30, 2010 2:03 pm, Tomfox Wiranata wrote:
> > hi everyone,
>
> > in my view I have  a link:
> >                               echo $html->link('My
> > Favorites'...........);
>
> > now when a user clicks the link i want a popup window to open and show
> > data from the database with the ajax paginator. but how can i open a
> > new window as a popup??
>
> doing this will require client side js.
>
> you could look at jquery ui modalhttp://jqueryui.com/demos/dialog/#modal-message
>
> bear in mind there are users that cant launch new windows or modal boxes
> (mobile users for example) so provide an inpage way to do it and then
> enhance with javascript accordingly.
>
> --
> Mike Karthauser
> Managing Director - Brightstorm Ltd
>
> Email: mi...@brightstorm.co.uk
> Web:http://www.brightstorm.co.uk
> Tel:  07939 252144begin_of_the_skype_highlighting              07939 252144      end_of_the_skype_highlighting(mobile)
> Fax: 0870 1320560
>
> Address: 1 Brewery Court, North Street, Bristol, BS3 1JS

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

Re: CakePHP ignores notEmpty validation rule when the field's name is not a key in $data! (Bug or Feature?)

So rapid development sounds to me like developing without testing...
Not very promising. And it would be *much* more rapid when such basic
stuff was already taken care of, because every serious web app will
have to implement this.

On Thu, Sep 30, 2010 at 3:34 PM, euromark <dereuromark@googlemail.com> wrote:
> well, it is this way for "rapid development"
> not for "most secure web application" :)
>
> the second part is your job then
> although i think my methods should find their way into the core
> because they certainly help to achieve that.
>
>
> On 30 Sep., 15:28, Joshua Muheim <psybea...@gmail.com> wrote:
>> Thanks Euromark for your good hint. I certainly should read through
>> your blogs in the near future...
>>
>> But do you know why CakePHP handles stuff this way? Looks very, very
>> unintuitive to me. With Ruby on Rails I had much better experiences
>> about stuff like this a few years ago (everything just seemed to work
>> the way I expected it although I didn't have much experience with it
>> then), and I'm sure today they even have progressed much farer...
>>
>> It seems a bit sad to me that CakePHP clearly doesn't seem to be able
>> to come even close to the experience of RoR. Any yes, I know CakePHP
>> isn't RoR, and yes, I could switch (well actually, I can't)... Just my
>> 2 c€nts...
>>
>>
>>
>> On Thu, Sep 30, 2010 at 2:58 PM, euromark <dereurom...@googlemail.com> wrote:
>> > actually it is NOT a bug
>> > although many are not aware of that behavior :)
>>
>> > you need to make sure that the field is passed to the validation
>> > otherwise it will be ignored
>>
>> > @seehttp://www.dereuromark.de/2010/09/21/saving-model-data-and-security/
>>
>> > On 30 Sep., 14:52, psybear83 <psybea...@gmail.com> wrote:
>> >> Hi everybody
>>
>> >> I have baked the following very straight-forward model:
>>
>> >> class Post extends AppModel {
>> >>         var $name = 'Post';
>> >>         var $displayField = 'name';
>> >>         var $validate = array(
>> >>                 'name' => array(
>> >>                         'notempty' => array(
>> >>                                 'rule' => array('notempty')
>> >>                         ),
>> >>                 ),
>> >>         );
>>
>> >> }
>>
>> >> It only needs a value for "name" to be saved.
>>
>> >> Now I've written the following 3 tests:
>>
>> >>   function testShouldNotBeValidWithEmptyName() {
>> >>     $this->Post->create(array('name' => ''));
>> >>     $this->assertFalse($this->Post->validates());
>> >>   }
>>
>> >>   function testShouldNotBeValidWithoutName() {
>> >>     $this->Post->create();
>> >>     $this->assertFalse($this->Post->validates()); // Fails!
>> >>   }
>>
>> >>   function testShouldNotBeValidWithNullName() {
>> >>     $this->Post->create(array('name' => null));
>> >>     $this->assertFalse($this->Post->validates());
>> >>   }
>>
>> >> I expect all three of them to work, but the 2nd one fails! So why does
>> >> it validate when there truly is no value for the "name" field? Is this
>> >> really the way it should be, or is it a bug?
>>
>> >> I'm on version 1.3.4.
>>
>> >> Thanks for help
>> >> Josh
>>
>> > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with their CakePHP related questions.
>>
>> > You received this message because you are subscribed to the Google Groups "CakePHP" group.
>> > To post to this group, send email to cake-php@googlegroups.com
>> > To unsubscribe from this group, send email to
>> > cake-php+unsubscribe@googlegroups.com For more options, visit this group athttp://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

Re: opening a popup window when clicking on a link

On Thu, September 30, 2010 2:03 pm, Tomfox Wiranata wrote:
> hi everyone,
>
> in my view I have a link:
> echo $html->link('My
> Favorites'...........);
>
>
> now when a user clicks the link i want a popup window to open and show
> data from the database with the ajax paginator. but how can i open a
> new window as a popup??

doing this will require client side js.

you could look at jquery ui modal
http://jqueryui.com/demos/dialog/#modal-message

bear in mind there are users that cant launch new windows or modal boxes
(mobile users for example) so provide an inpage way to do it and then
enhance with javascript accordingly.

--
Mike Karthauser
Managing Director - Brightstorm Ltd

Email: mikek@brightstorm.co.uk
Web: http://www.brightstorm.co.uk
Tel: 07939 252144 (mobile)
Fax: 0870 1320560

Address: 1 Brewery Court, North Street, Bristol, BS3 1JS

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

Re: CakePHP ignores notEmpty validation rule when the field's name is not a key in $data! (Bug or Feature?)

well, it is this way for "rapid development"
not for "most secure web application" :)

the second part is your job then
although i think my methods should find their way into the core
because they certainly help to achieve that.


On 30 Sep., 15:28, Joshua Muheim <psybea...@gmail.com> wrote:
> Thanks Euromark for your good hint. I certainly should read through
> your blogs in the near future...
>
> But do you know why CakePHP handles stuff this way? Looks very, very
> unintuitive to me. With Ruby on Rails I had much better experiences
> about stuff like this a few years ago (everything just seemed to work
> the way I expected it although I didn't have much experience with it
> then), and I'm sure today they even have progressed much farer...
>
> It seems a bit sad to me that CakePHP clearly doesn't seem to be able
> to come even close to the experience of RoR. Any yes, I know CakePHP
> isn't RoR, and yes, I could switch (well actually, I can't)... Just my
> 2 c€nts...
>
>
>
> On Thu, Sep 30, 2010 at 2:58 PM, euromark <dereurom...@googlemail.com> wrote:
> > actually it is NOT a bug
> > although many are not aware of that behavior :)
>
> > you need to make sure that the field is passed to the validation
> > otherwise it will be ignored
>
> > @seehttp://www.dereuromark.de/2010/09/21/saving-model-data-and-security/
>
> > On 30 Sep., 14:52, psybear83 <psybea...@gmail.com> wrote:
> >> Hi everybody
>
> >> I have baked the following very straight-forward model:
>
> >> class Post extends AppModel {
> >>         var $name = 'Post';
> >>         var $displayField = 'name';
> >>         var $validate = array(
> >>                 'name' => array(
> >>                         'notempty' => array(
> >>                                 'rule' => array('notempty')
> >>                         ),
> >>                 ),
> >>         );
>
> >> }
>
> >> It only needs a value for "name" to be saved.
>
> >> Now I've written the following 3 tests:
>
> >>   function testShouldNotBeValidWithEmptyName() {
> >>     $this->Post->create(array('name' => ''));
> >>     $this->assertFalse($this->Post->validates());
> >>   }
>
> >>   function testShouldNotBeValidWithoutName() {
> >>     $this->Post->create();
> >>     $this->assertFalse($this->Post->validates()); // Fails!
> >>   }
>
> >>   function testShouldNotBeValidWithNullName() {
> >>     $this->Post->create(array('name' => null));
> >>     $this->assertFalse($this->Post->validates());
> >>   }
>
> >> I expect all three of them to work, but the 2nd one fails! So why does
> >> it validate when there truly is no value for the "name" field? Is this
> >> really the way it should be, or is it a bug?
>
> >> I'm on version 1.3.4.
>
> >> Thanks for help
> >> Josh
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with their CakePHP related questions.
>
> > You received this message because you are subscribed to the Google Groups "CakePHP" group.
> > To post to this group, send email to cake-php@googlegroups.com
> > To unsubscribe from this group, send email to
> > cake-php+unsubscribe@googlegroups.com For more options, visit this group athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en