Model input approach

2007-07-20 Thread Stuart

Hello,

I'm stumbling through my first CakePHP project, and have hit a bit of
a snag. The system that involves the following models:

Product hasMany Revisions
Revision hasMany Answers
Each answers is of type Question
Answers can have supporting documents


I have a form that will input one new product, one new revision of
that product, about 70 answers, each corresponding to a question, and
many documents supporting specific answers.

I'm trying to work out how to differentiate the form data for one type
of model compared to others when it comes time for the controller to
process the input. From reading the $htmlHelper documentation it
appears I can specify attribute names using "Modelname/fieldname",
which will help to some degree.

But using this approach won't help for the 70-odd answers the form may
transmit, because this won't help identify which question the answer
relates to. Similarly, I won't be able to tell which document supports
which answer.

One way to do this would be to replace 'fieldname' with something more
meaningful, eg 'Answer/answer_text:question_id', or Document/
document_name:question_id and then process these values after the
fact. This doesn't seem very elegant to me.

Is there a better way of doing this? Have I got my models muddled? Am
I trying to do something that Cake wasn't really designed for?

Any help gratefully accepted.

Thanks


Stuart


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: form helper dateTime (cake 1.2)

2007-07-20 Thread Phurter

http://www.nabble.com/form-helper-dateTime-(cake-1.2)-t4070834.html

On Jul 12, 5:00 pm, pete <[EMAIL PROTECTED]> wrote:
> hi,
> is there a way to set the minYear, maxYear for dateTime?
>
> dateTime('dateTime','DMY',24,null,null); ?>
>
> i want to reduce the number of years within the form
>
> thanks
>
> pete


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Objects and Arrays when fetching models

2007-07-20 Thread Grant Cox

In CakePHP the model class is used as an interface to the database -
the actual data you get back is always associative arrays.  If you
have a fullname() function that perhaps concatenates your first and
surnames, you could have

class YourModel
{
  function fullname( $id ){
// get the data
$model_data = $this->read(null, $id);
// return the calculated full name
return $model_data[$this->name]['firstname'].' '.$model_data[$this-
>name]['surname'];
  }
}

Or, you could retrieve the model data in your controller, and have the
model fullname() function expect the model data (and just perform the
concatenation).  Or finally, you could have a afterFind() callback in
your model, to automatically create the 'fullname' key on your
retrieved data.

Having data retrieved as simple data arrays rather than models is good
for performance, and if you write your model functions appropriately
can still be quite easy to use.  I believe that being able to actually
retrieve class instances rather than data arrays is planned for
CakePHP 2.0 (which will be some time away).


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Objects and Arrays when fetching models

2007-07-20 Thread Pablo Viojo
$name = $numberfour["MyModel"]["fullname"];

Try doing: print_r($numberfour)


-- 
Pablo Viojo
[EMAIL PROTECTED]
http://pviojo.net


On 7/20/07, youthoftoday <[EMAIL PROTECTED]> wrote:
>
>
> I'm new to cakePHP, but experienced with Rails. I can't find the
> answer to the following anywhere.
>
> Let's say I have a model for which I've defined a custom function, for
> example one that joins concatenates two fields. I retrieve this object
> from the database and I want to call a method. For instance:
>
> $bob = new MyModel;
> $numberfour = $bob->findById(4);
> $name = $numberfour->fullname();
>
> The last line doesn't work, and says "Call to a member function 
> on a non-object". In Rails the returned results would be objects, but
> in cake they seem to just be an array?
>
> So how do I call methods/functions on returned models?
>
> Thanks very much!
>
> Joe
>
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Workflow engine for cake

2007-07-20 Thread francky06l

Hi Felix,

It can be done for sure, but in there I was meaning something "built-
in" where you could play/rules the different parts of the framework
itself  We all fail in the same trap in such "workflow" concept,
that is "it has no end to what can be added" :-)

On Jul 21, 2:14 am, Felix Geisendörfer <[EMAIL PROTECTED]> wrote:
> I'm developing such an engine right now. It allows the company to take
> the items from their orders through different steps from order
> processing, to production to shipment. All steps require different stuff
> to be done to the items, certificates to be printed out, etc.. So yes
> you can do this in cake but I've done more fun stuff in the past ... : p.
>
> -- Felix
> --
> My Blog:http://www.thinkingphp.org
> My Business:http://www.fg-webdesign.de
>
> francky06l wrote:
> > I am not good at example, but I'll try ...(In a business sector that I
> > know a bit)..
>
> > Let's say you are in a banking environnement, you have an application
> > to capture loans and process them. In order to make decision, you
> > would probably call external sources of data (risk estimation), some
> > of them are very used such as Credit Bureau (ie : Equifax, Transunion,
> > Experian) etc ...
> > Now depending of the amount of loan and/or your zip code, you are
> > going to call 1, 2 or the 3 of this sources .. If one  does not you
> > might wait for a while or called the 2 others instead etc ... You want
> > to let the manager of this sector being able to change this flow
> > without changing code. He would need an "admin" interface where he
> > would change the flow..
> > Ok in this example you could set the loan amount/zip codes in a table,
> > but what if he wants to "add" another criterion for calling : the age
> > of the borrower ? Well if you haven't code this in your application,
> > he is not able to add a "rule" such as do THIS if THIS etc .
>
> > I do not know it this makes it clearer, to me the workflow is a way to
> > organize the different "action" you have according to rules based on
> > the data you have (data could also be result of action)...but letting
> > the user designing this flow (you can also have dead end  ...)
> > So in Cake, when an action is finished, based on rules, you could
> > "redirect" your application to other actions etc (again, maybe just
> > crazy thoughts)  The user can change the rules to do something
> > else.
> > Again, this can become very complex, especially to include in a
> > multipurpose application framework. However, maybe some basic "rules"
> > directing a flow might be done..
>
> > Cheers
>
> > On Jul 21, 1:13 am, "Chris Hartjes" <[EMAIL PROTECTED]> wrote:
>
> >> On 7/20/07, francky06l <[EMAIL PROTECTED]> wrote:
>
> >>> I like the idea of workflow engine or "rules" engine. Actually, Cake
> >>> is a framework to design application, but having the user (or
> >>> parameters) designing is own "flow" once the application is done is a
> >>> step further.
>
> >> I still don't get it.  Got a good example?
>
> >> --
> >> Chris Hartjes
> >> Senior Developer
> >> Cake Development Corporation
>
> >> My motto for 2007:  "Just build it, damnit!"
>
> >> @TheBallpark -http://www.littlehart.net/attheballpark
> >> @TheKeyboard -http://www.littlehart.net/atthekeyboard


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Workflow engine for cake

2007-07-20 Thread Felix Geisendörfer
I'm developing such an engine right now. It allows the company to take 
the items from their orders through different steps from order 
processing, to production to shipment. All steps require different stuff 
to be done to the items, certificates to be printed out, etc.. So yes 
you can do this in cake but I've done more fun stuff in the past ... : p.

-- Felix
--
My Blog: http://www.thinkingphp.org
My Business: http://www.fg-webdesign.de


francky06l wrote:
> I am not good at example, but I'll try ...(In a business sector that I
> know a bit)..
>
>
> Let's say you are in a banking environnement, you have an application
> to capture loans and process them. In order to make decision, you
> would probably call external sources of data (risk estimation), some
> of them are very used such as Credit Bureau (ie : Equifax, Transunion,
> Experian) etc ...
> Now depending of the amount of loan and/or your zip code, you are
> going to call 1, 2 or the 3 of this sources .. If one  does not you
> might wait for a while or called the 2 others instead etc ... You want
> to let the manager of this sector being able to change this flow
> without changing code. He would need an "admin" interface where he
> would change the flow..
> Ok in this example you could set the loan amount/zip codes in a table,
> but what if he wants to "add" another criterion for calling : the age
> of the borrower ? Well if you haven't code this in your application,
> he is not able to add a "rule" such as do THIS if THIS etc .
>
> I do not know it this makes it clearer, to me the workflow is a way to
> organize the different "action" you have according to rules based on
> the data you have (data could also be result of action)...but letting
> the user designing this flow (you can also have dead end  ...)
> So in Cake, when an action is finished, based on rules, you could
> "redirect" your application to other actions etc (again, maybe just
> crazy thoughts)  The user can change the rules to do something
> else.
> Again, this can become very complex, especially to include in a
> multipurpose application framework. However, maybe some basic "rules"
> directing a flow might be done..
>
> Cheers
>
>
>
> On Jul 21, 1:13 am, "Chris Hartjes" <[EMAIL PROTECTED]> wrote:
>   
>> On 7/20/07, francky06l <[EMAIL PROTECTED]> wrote:
>>
>>
>>
>> 
>>> I like the idea of workflow engine or "rules" engine. Actually, Cake
>>> is a framework to design application, but having the user (or
>>> parameters) designing is own "flow" once the application is done is a
>>> step further.
>>>   
>> I still don't get it.  Got a good example?
>>
>> --
>> Chris Hartjes
>> Senior Developer
>> Cake Development Corporation
>>
>> My motto for 2007:  "Just build it, damnit!"
>>
>> @TheBallpark -http://www.littlehart.net/attheballpark
>> @TheKeyboard -http://www.littlehart.net/atthekeyboard
>> 
>
>
> >
>
>   

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Workflow engine for cake

2007-07-20 Thread francky06l

I am not good at example, but I'll try ...(In a business sector that I
know a bit)..


Let's say you are in a banking environnement, you have an application
to capture loans and process them. In order to make decision, you
would probably call external sources of data (risk estimation), some
of them are very used such as Credit Bureau (ie : Equifax, Transunion,
Experian) etc ...
Now depending of the amount of loan and/or your zip code, you are
going to call 1, 2 or the 3 of this sources .. If one  does not you
might wait for a while or called the 2 others instead etc ... You want
to let the manager of this sector being able to change this flow
without changing code. He would need an "admin" interface where he
would change the flow..
Ok in this example you could set the loan amount/zip codes in a table,
but what if he wants to "add" another criterion for calling : the age
of the borrower ? Well if you haven't code this in your application,
he is not able to add a "rule" such as do THIS if THIS etc .

I do not know it this makes it clearer, to me the workflow is a way to
organize the different "action" you have according to rules based on
the data you have (data could also be result of action)...but letting
the user designing this flow (you can also have dead end  ...)
So in Cake, when an action is finished, based on rules, you could
"redirect" your application to other actions etc (again, maybe just
crazy thoughts)  The user can change the rules to do something
else.
Again, this can become very complex, especially to include in a
multipurpose application framework. However, maybe some basic "rules"
directing a flow might be done..

Cheers



On Jul 21, 1:13 am, "Chris Hartjes" <[EMAIL PROTECTED]> wrote:
> On 7/20/07, francky06l <[EMAIL PROTECTED]> wrote:
>
>
>
> > I like the idea of workflow engine or "rules" engine. Actually, Cake
> > is a framework to design application, but having the user (or
> > parameters) designing is own "flow" once the application is done is a
> > step further.
>
> I still don't get it.  Got a good example?
>
> --
> Chris Hartjes
> Senior Developer
> Cake Development Corporation
>
> My motto for 2007:  "Just build it, damnit!"
>
> @TheBallpark -http://www.littlehart.net/attheballpark
> @TheKeyboard -http://www.littlehart.net/atthekeyboard


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Sortable.create

2007-07-20 Thread [EMAIL PROTECTED]

Has anyone successfully used Sortable.create with cake 1.2.
I have prototype included but it does not recognized the object
Sortable.

Thanks.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Workflow engine for cake

2007-07-20 Thread Chris Hartjes

On 7/20/07, francky06l <[EMAIL PROTECTED]> wrote:
>
> I like the idea of workflow engine or "rules" engine. Actually, Cake
> is a framework to design application, but having the user (or
> parameters) designing is own "flow" once the application is done is a
> step further.

I still don't get it.  Got a good example?

-- 
Chris Hartjes
Senior Developer
Cake Development Corporation

My motto for 2007:  "Just build it, damnit!"

@TheBallpark - http://www.littlehart.net/attheballpark
@TheKeyboard - http://www.littlehart.net/atthekeyboard

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: My first experience using the new AuthComponent in cake1.2

2007-07-20 Thread francky06l

Well, maybe the $hashMethod will be included in Auth  component
later ...
your solution is similar to mine, except to keep the possibility of
another hashMethod

On Jul 21, 12:57 am, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> Here was my (not so pretty solution)
>
> In controllers/components/mycustomauthcomponent.php:
>  require( CAKE_CORE_INCLUDE_PATH . DS . 'cake/libs/controller/
> components/auth.php' );
> class MycustomauthComponent extends AuthComponent {
> function password($password) {
> return md5( $password );
> }
> //function __destruct(  ) { debug( $this ); die; }}
>
> ?>
>
> The in the app_controller:
> var $components = array ('Acl', 'Mycustomauth');
>
> $this->Mycustomauth->authorize = 'actions';
>
> ...etc...
>
> It appears to work (not getting parentNode() to execute, but I think
> that's a separate problem), but surely there is a more elegant
> solution out there.
>
> On Jul 20, 6:27 pm, francky06l <[EMAIL PROTECTED]> wrote:
>
> > Well, I had a chat with Gwoo yesterday about this. Actually the
> > security object accept 3 hash methods : sha1 (default), md5 and
> > sha256..
>
> > The idea, with a derived Auth, to declare $var hashMethod = 'sha1';
> > Overwrite the hashPassword function with :
>
> > function hashpassword($password)
> > {
> > Security::hash(CAKE_SESSION_STRING.$password, $this->hashMethod);
>
> > This is the idea, you can set the $hasMethod in beforeFilter for
> > example. Of course you depend of the methods handled by the security
> > class (the 3 mentionned above so far).
>
> > Actually I have tested this by modifying, for test purpose, the Auth
> > component itself. But that should be be easy in a derived component
> > ( I have to test this though..)
>
> > Let me know about your progress
>
> > On Jul 20, 10:28 pm, "[EMAIL PROTECTED]"
>
> > <[EMAIL PROTECTED]> wrote:
> > > Can you provide more information on how you overwrote the hash method
> > > (Auth::password()) in AuthComponent *without* actually touching the
> > > cakephp core code?
>
> > > I've been tearing my hair out attempting to do this. I would think you
> > > could create a component (e.g., CustomAuth) and override the method,
> > > but, alas, this doesn't appear to work like I think it should.
>
> > > On Jul 12, 7:41 am, francky06l <[EMAIL PROTECTED]> wrote:
>
> > > > Hi bakers,
>
> > > > Just wanted to share my experience of integrating the Auth component
> > > > into a non-finished application in cake12.
> > > > Overall, the component is great and easy to implement, however I had
> > > > to deal with some "tricky" features.
>
> > > > First the application context:
>
> > > > I have users spread out in different centers. Basically a user belongs
> > > > to a center. I have then a "Center" model and a "User" model. User
> > > > belongsTo a Center.
> > > > I can have a user "John Smith" in center A, and another "John Smith"
> > > > in center B. Thus on login screen a field "Center name" is also
> > > > captured. I can also disabled a complete center, meaning that every
> > > > user of this center would fail to login.
>
> > > > Using the Auth component, I have set the following in my login
> > > > function :
>
> > > > if(!empty($this->data))
> > > > {
> > > >   // Add the Center checks
>
> > > >$this->Auth->userScope = array( 'Center.disabled' => 0,
>
> > > > 'Center.name' => $this->data['Center']['name']);
>
> > > >if(!$this->Auth->login($this->data))
> > > >{
>
> > > > That should do the trick I though ...  well not exactly. That does not
> > > > work because the Auth component include a -1 as the recursive flag for
> > > > the call to User->find.
> > > > Workaround : I have added a $recursive variable to the component and
> > > > initialized it to -1. Now I just have to add $this->Auth->recursive =
> > > > 1; prior to the Auth->login call.
>
> > > > Second "small" problem, I need to keep in the Session some fields of
> > > > the Center record. For now, the login function of the Auth stores only
> > > > $data['User'].
> > > > I did solve this, in a "dirty way" by changing the return of the
> > > > identify function :
>
> > > > return $this->recursive > 0 ? $data : $data[$this->userModel];
>
> > > > I am sure the above might give me some problems later, feel free to
> > > > give me hints.
>
> > > > Another problem that I faced, was the default hash parameters to use.
> > > > My DB already had some user password hashed using md5.
> > > > I did add a variable called $hashMethod in the component, and
> > > > initialized to 'sha1', I can then override the variable if I need
> > > > something else. I also added a $hashPrefix initialized to the
> > > > CAKE_SESSION_STRING, and I can override it.
> > > > The password function is modified as :
>
> > > > function password($password) {
> > > > return Security::hash($hashPrefix . $password, 
> > > > $hashMethod);
> > > > }
>
> > > > The hashPasswords imple

Re: Only include js in certain views

2007-07-20 Thread francky06l

have a look to Nate's articles about this, especially the 3rd
section :

http://cake.insertdesignhere.com/posts/view/17

On Jul 20, 7:55 pm, Joshua Benner <[EMAIL PROTECTED]> wrote:
> Put $javascript->link in the view instead of the [EMAIL PROTECTED]:Is there a 
> way to only include a javascript file in certain selected views. I have it as 
> being included in the default layout with  $javascript->link('tooltip')."\n"; ?> but I it's causing errors on views I 
> don't need it on. I'm using cake 1.2.x if that makes a difference. Matt


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: My first experience using the new AuthComponent in cake1.2

2007-07-20 Thread [EMAIL PROTECTED]

Here was my (not so pretty solution)

In controllers/components/mycustomauthcomponent.php:


The in the app_controller:
var $components = array ('Acl', 'Mycustomauth');

$this->Mycustomauth->authorize = 'actions';

...etc...

It appears to work (not getting parentNode() to execute, but I think
that's a separate problem), but surely there is a more elegant
solution out there.


On Jul 20, 6:27 pm, francky06l <[EMAIL PROTECTED]> wrote:
> Well, I had a chat with Gwoo yesterday about this. Actually the
> security object accept 3 hash methods : sha1 (default), md5 and
> sha256..
>
> The idea, with a derived Auth, to declare $var hashMethod = 'sha1';
> Overwrite the hashPassword function with :
>
> function hashpassword($password)
> {
> Security::hash(CAKE_SESSION_STRING.$password, $this->hashMethod);
>
> This is the idea, you can set the $hasMethod in beforeFilter for
> example. Of course you depend of the methods handled by the security
> class (the 3 mentionned above so far).
>
> Actually I have tested this by modifying, for test purpose, the Auth
> component itself. But that should be be easy in a derived component
> ( I have to test this though..)
>
> Let me know about your progress
>
> On Jul 20, 10:28 pm, "[EMAIL PROTECTED]"
>
> <[EMAIL PROTECTED]> wrote:
> > Can you provide more information on how you overwrote the hash method
> > (Auth::password()) in AuthComponent *without* actually touching the
> > cakephp core code?
>
> > I've been tearing my hair out attempting to do this. I would think you
> > could create a component (e.g., CustomAuth) and override the method,
> > but, alas, this doesn't appear to work like I think it should.
>
> > On Jul 12, 7:41 am, francky06l <[EMAIL PROTECTED]> wrote:
>
> > > Hi bakers,
>
> > > Just wanted to share my experience of integrating the Auth component
> > > into a non-finished application in cake12.
> > > Overall, the component is great and easy to implement, however I had
> > > to deal with some "tricky" features.
>
> > > First the application context:
>
> > > I have users spread out in different centers. Basically a user belongs
> > > to a center. I have then a "Center" model and a "User" model. User
> > > belongsTo a Center.
> > > I can have a user "John Smith" in center A, and another "John Smith"
> > > in center B. Thus on login screen a field "Center name" is also
> > > captured. I can also disabled a complete center, meaning that every
> > > user of this center would fail to login.
>
> > > Using the Auth component, I have set the following in my login
> > > function :
>
> > > if(!empty($this->data))
> > > {
> > >   // Add the Center checks
>
> > >$this->Auth->userScope = array( 'Center.disabled' => 0,
>
> > > 'Center.name' => $this->data['Center']['name']);
>
> > >if(!$this->Auth->login($this->data))
> > >{
>
> > > That should do the trick I though ...  well not exactly. That does not
> > > work because the Auth component include a -1 as the recursive flag for
> > > the call to User->find.
> > > Workaround : I have added a $recursive variable to the component and
> > > initialized it to -1. Now I just have to add $this->Auth->recursive =
> > > 1; prior to the Auth->login call.
>
> > > Second "small" problem, I need to keep in the Session some fields of
> > > the Center record. For now, the login function of the Auth stores only
> > > $data['User'].
> > > I did solve this, in a "dirty way" by changing the return of the
> > > identify function :
>
> > > return $this->recursive > 0 ? $data : $data[$this->userModel];
>
> > > I am sure the above might give me some problems later, feel free to
> > > give me hints.
>
> > > Another problem that I faced, was the default hash parameters to use.
> > > My DB already had some user password hashed using md5.
> > > I did add a variable called $hashMethod in the component, and
> > > initialized to 'sha1', I can then override the variable if I need
> > > something else. I also added a $hashPrefix initialized to the
> > > CAKE_SESSION_STRING, and I can override it.
> > > The password function is modified as :
>
> > > function password($password) {
> > > return Security::hash($hashPrefix . $password, 
> > > $hashMethod);
> > > }
>
> > > The hashPasswords implemented into the startup function gave me some
> > > trouble as well. I have a "changeDetail" function used by any user to
> > > change their details as well as their password. I have set a control
> > > to enforce the password strength such as at least 6 different
> > > characters among them 2 digits.
> > > This rule can't be verified anymore since the startup function will
> > > "hash" my password prior to my verification.
> > > For now the WorkAround is to use another field than "password" into
> > > the view and just add the "password" ($this->data['User']['password']
> > > = $this->Auth->password($this->data['User']['passtrick']) prior to
> > > save.
> > > This is no really "elegant", maybe a "ena

Re: Changes to table not reflected in Model

2007-07-20 Thread francky06l

Delete all files in the tmp/cache/model  directory.

On Jul 21, 12:06 am, RTigger <[EMAIL PROTECTED]> wrote:
> Sorry, I should've tested this sooner, it does work if I specify the
> column in an array as an argument with the findAll($condition,
> $fields) method.  I'm assuming this does mean that the fields for the
> model are cached somehow (which makes sense, instead of running a desc
> query every time), but how would one either force a refresh of this
> cache or delete the current model cache to force a refresh?
>
> On Jul 20, 3:51 pm, RTigger <[EMAIL PROTECTED]> wrote:
>
> > Hi All,
>
> > N00b question I'm sure, as I'm just maintaining someone else's cakephp
> > project, but I've run into a problem:
>
> > I have a table that is tied to a model.  I've added another column to
> > the end of the table (IsFile tinyint(1)), but after running a 
> > model->findAll($condition) in my controller it doesn't return the new column
>
> > in any of the objects returned.  It returns the exact same data as
> > before, just without the new column.  The values for that column have
> > all been set to 0, so it's not null or anything like that.  Anyone
> > have any suggestions?  Is it possible the previous table layout was
> > cached somewhere and it's using that for the findAll Query?  Should I
> > have to specify a field array as a findAll argument to ensure that
> > field is selected?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Passing values to renderElement

2007-07-20 Thread francky06l

renderElement('representation_type_select', array('id' => $id))

On Jul 20, 8:26 pm, peterhf <[EMAIL PROTECTED]> wrote:
> I have an, representation_type_select.thtml, which consists of a
> selectTag.
>
>  $html->selectTag(
> $model_name . '/type_' . $id,
> array(
>   'option_1' => 'option_1',
>   .
>   .
>   .
>   'option_n' => 'option_nr'
>),
>   '',
>   array('id' => 'type_' . $id, 'size' => '6',
> 'multiple' => 'multiple', 'class' => 'classname'),
>   null,
>   false,
>   false
> );
> ?>
>
> This select tag is used multiple times in a form and its name needs to
> be different for each use, therefore the "$id" variable. The
> $model_name is set in the controller and appears correctly in the
> rendered html. However, I have not been able successfully pass the
> value of $id to the $this->renderElement('representation_type_select'). The 
> value of $id does
>
> not appear as a postfix to either 'type_' in the html. I tried  $id = '1'; echo $this->renderElement('representation_type_select'); ?>
>
> Thanks in advance for any suggestions.
>
> Peter -


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Workflow engine for cake

2007-07-20 Thread francky06l

I like the idea of workflow engine or "rules" engine. Actually, Cake
is a framework to design application, but having the user (or
parameters) designing is own "flow" once the application is done is a
step further.
The danger is to become very complex and degrading performances.
In my mind, it would be a super component that would manage other
components and also the action "redirect"  Actually, considering
ACL as a starting point ..( a bit of "create_function" with parameters
in it) you could have a component redirecting you based on system
rules as well as user rules.

Well, this are just ideas (surely crazy, I know cake only for few
months). I have done a workflow engine in a "previous life" with other
technology and also targeted to a specific business.. The problem is
the notion of "Workflow" that everyone interprets differently,
according to business needs.

Something to think about anyway.

On Jul 20, 10:14 pm, "Chris Hartjes" <[EMAIL PROTECTED]> wrote:
> On 7/20/07, Kunthar <[EMAIL PROTECTED]> wrote:
>
> > 2. If cake claims to be a real alternative MVC it has to own workflow
> > engine internal,
>
> What does having it's own internal workflow engine have to do with
> Cake's implementation of MVC?
>
> Chris Hartjes
> Senior Developer
> Cake Development Corporation
>
> My motto for 2007:  "Just build it, damnit!"
>
> @TheBallpark -http://www.littlehart.net/attheballpark
> @TheKeyboard -http://www.littlehart.net/atthekeyboard


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: My first experience using the new AuthComponent in cake1.2

2007-07-20 Thread francky06l

Well, I had a chat with Gwoo yesterday about this. Actually the
security object accept 3 hash methods : sha1 (default), md5 and
sha256..

The idea, with a derived Auth, to declare $var hashMethod = 'sha1';
Overwrite the hashPassword function with :

function hashpassword($password)
{
Security::hash(CAKE_SESSION_STRING.$password, $this->hashMethod);

This is the idea, you can set the $hasMethod in beforeFilter for
example. Of course you depend of the methods handled by the security
class (the 3 mentionned above so far).

Actually I have tested this by modifying, for test purpose, the Auth
component itself. But that should be be easy in a derived component
( I have to test this though..)

Let me know about your progress


On Jul 20, 10:28 pm, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> Can you provide more information on how you overwrote the hash method
> (Auth::password()) in AuthComponent *without* actually touching the
> cakephp core code?
>
> I've been tearing my hair out attempting to do this. I would think you
> could create a component (e.g., CustomAuth) and override the method,
> but, alas, this doesn't appear to work like I think it should.
>
> On Jul 12, 7:41 am, francky06l <[EMAIL PROTECTED]> wrote:
>
> > Hi bakers,
>
> > Just wanted to share my experience of integrating the Auth component
> > into a non-finished application in cake12.
> > Overall, the component is great and easy to implement, however I had
> > to deal with some "tricky" features.
>
> > First the application context:
>
> > I have users spread out in different centers. Basically a user belongs
> > to a center. I have then a "Center" model and a "User" model. User
> > belongsTo a Center.
> > I can have a user "John Smith" in center A, and another "John Smith"
> > in center B. Thus on login screen a field "Center name" is also
> > captured. I can also disabled a complete center, meaning that every
> > user of this center would fail to login.
>
> > Using the Auth component, I have set the following in my login
> > function :
>
> > if(!empty($this->data))
> > {
> >   // Add the Center checks
>
> >$this->Auth->userScope = array( 'Center.disabled' => 0,
>
> > 'Center.name' => $this->data['Center']['name']);
>
> >if(!$this->Auth->login($this->data))
> >{
>
> > That should do the trick I though ...  well not exactly. That does not
> > work because the Auth component include a -1 as the recursive flag for
> > the call to User->find.
> > Workaround : I have added a $recursive variable to the component and
> > initialized it to -1. Now I just have to add $this->Auth->recursive =
> > 1; prior to the Auth->login call.
>
> > Second "small" problem, I need to keep in the Session some fields of
> > the Center record. For now, the login function of the Auth stores only
> > $data['User'].
> > I did solve this, in a "dirty way" by changing the return of the
> > identify function :
>
> > return $this->recursive > 0 ? $data : $data[$this->userModel];
>
> > I am sure the above might give me some problems later, feel free to
> > give me hints.
>
> > Another problem that I faced, was the default hash parameters to use.
> > My DB already had some user password hashed using md5.
> > I did add a variable called $hashMethod in the component, and
> > initialized to 'sha1', I can then override the variable if I need
> > something else. I also added a $hashPrefix initialized to the
> > CAKE_SESSION_STRING, and I can override it.
> > The password function is modified as :
>
> > function password($password) {
> > return Security::hash($hashPrefix . $password, $hashMethod);
> > }
>
> > The hashPasswords implemented into the startup function gave me some
> > trouble as well. I have a "changeDetail" function used by any user to
> > change their details as well as their password. I have set a control
> > to enforce the password strength such as at least 6 different
> > characters among them 2 digits.
> > This rule can't be verified anymore since the startup function will
> > "hash" my password prior to my verification.
> > For now the WorkAround is to use another field than "password" into
> > the view and just add the "password" ($this->data['User']['password']
> > = $this->Auth->password($this->data['User']['passtrick']) prior to
> > save.
> > This is no really "elegant", maybe a "enable/disable" method (or an
> > array of controller/view to avoid the call to hashPasswords) could be
> > implemented into the Auth ?
>
> > That's about it for now. Do not get me wrong, I know I have listed
> > mainly problems but the Auth is great component. I could work without
> > the Auth component since my application requires login for every
> > action (except the login / logout actions of course), but my main
> > interest is to link it with the cake12  ACL (next step).
>
> > Again, some of the above might be due to my misunderstanding of the
> > component, please feel free to suggest or comments.
>
> > Than

Re: Changes to table not reflected in Model

2007-07-20 Thread RTigger

Sorry, I should've tested this sooner, it does work if I specify the
column in an array as an argument with the findAll($condition,
$fields) method.  I'm assuming this does mean that the fields for the
model are cached somehow (which makes sense, instead of running a desc
query every time), but how would one either force a refresh of this
cache or delete the current model cache to force a refresh?

On Jul 20, 3:51 pm, RTigger <[EMAIL PROTECTED]> wrote:
> Hi All,
>
> N00b question I'm sure, as I'm just maintaining someone else's cakephp
> project, but I've run into a problem:
>
> I have a table that is tied to a model.  I've added another column to
> the end of the table (IsFile tinyint(1)), but after running a 
> model->findAll($condition) in my controller it doesn't return the new column
>
> in any of the objects returned.  It returns the exact same data as
> before, just without the new column.  The values for that column have
> all been set to 0, so it's not null or anything like that.  Anyone
> have any suggestions?  Is it possible the previous table layout was
> cached somewhere and it's using that for the findAll Query?  Should I
> have to specify a field array as a findAll argument to ensure that
> field is selected?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Changes to table not reflected in Model

2007-07-20 Thread RTigger

Hi All,

N00b question I'm sure, as I'm just maintaining someone else's cakephp
project, but I've run into a problem:

I have a table that is tied to a model.  I've added another column to
the end of the table (IsFile tinyint(1)), but after running a model-
>findAll($condition) in my controller it doesn't return the new column
in any of the objects returned.  It returns the exact same data as
before, just without the new column.  The values for that column have
all been set to 0, so it's not null or anything like that.  Anyone
have any suggestions?  Is it possible the previous table layout was
cached somewhere and it's using that for the findAll Query?  Should I
have to specify a field array as a findAll argument to ensure that
field is selected?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Oracle Driver problem for delete

2007-07-20 Thread starkey

Hello!  I am a developer at the University of Richmond; we are an
Oracle shop.  I am testing Cake for some projects we have planned and
am using the Oracle driver (the version in 1.2alpha).  To learn Cake's
functionality I'm walking through the 15 minute Blog tutorial from the
manual.  I am having a problem when trying to delete records.  I've
searched the Internet and cakephp.org and have not found a comment
anywhere on this problem or a trac item so I figure I'm doing
something wrong.  I'd be grateful if someone would enlighten me.

This is what appears to happen:
posts_controller.php calls Post->del($id)
model_php5.php del() method calls exists()
 exists() calls hasAny()
dbo_source.php hasAny() method calls fetchRow()
dbo_oracle.php fetchRow() method starts with the following line
if ($this->_currentRow >= $this->_numRows) {
Problem: Both _currentRow and _numRows are empty so fetchRow returns
false.  This is before any count(*) query has been executed and the
record is never deleted.

Here is the output when trying to delete a post:
Warning: ocifreestatement(): 43 is not a valid oci8 statement resource
in /WWW/external/devphpfw1/cake/cake/libs/model/dbo/dbo_oracle.php on
line 323

Warning: ocifreestatement(): 43 is not a valid oci8 statement resource
in /WWW/external/devphpfw1/cake/cake/libs/model/dbo/dbo_oracle.php on
line 323

The post with id: 4 has been deleted.

3 queries took 253 ms NrQuery   Error   AffectedNum. rows   
Took (ms)
1   ALTER SESSION SET NLS_DATE_FORMAT='-MM-DD HH24:MI:SS'   
0   2
2   SELECT view_name AS name FROM user_views UNION SELECT table_name AS
name FROM user_tables   3   3   246
3   SELECT COLUMN_NAME, DATA_TYPE FROM user_tab_columns WHERE table_name
= 'POSTS'   5   5   5

Thank you for any assistance!
Shawn


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: db table design

2007-07-20 Thread rtanz

i am using the previous version of cakephp, i dont understand why
francky said for 1.2 only, any explanation for that, i would like to
know since im using the previous version thanks

On Jul 19, 11:07 pm, Felix Geisendörfer <[EMAIL PROTECTED]> wrote:
> > @Felix, yes you right for cake 1.2, sorry
>
> Nothing to be sorry about ; ). But why am I right for 1.2 only? I
> suggest using an id field join tables, even if it's not a PHP app ^^.
>
> -- Felix
> --
> My Blog:http://www.thinkingphp.org
> My Business:http://www.fg-webdesign.de
>
> francky06l wrote:
> > @Felix, yes you right for cake 1.2, sorry
>
> > On Jul 19, 4:24 pm, Felix Geisendörfer <[EMAIL PROTECTED]> wrote:
>
> >>> The primary key is the combination of the 2 fields.
>
> >> Don't do that. Give it an id. It will make your life *much* easier. It
> >> will allow you to create a model for you join table and easily model
> >> relationships
> >> .
>
> >> Compound keys are never ever a good idea. I'm not saying it can't be
> >> done, but it will make your life harder. So please, add an 'id' column
> >> to your join table.
>
> >> -- Felix
> >> --
> >> My Blog:http://www.thinkingphp.org
> >> My Business:http://www.fg-webdesign.de
>
> >> francky06l wrote:
>
> >>> The primary key is the combination of the 2 fields.
>
> >>> On Jul 19, 3:54 pm, rtanz <[EMAIL PROTECTED]> wrote:
>
>  hi when i have a join table such as users_modules do i have to make a
>  separate id for the table itself or will the primary key be the
>  combined fields user_id and module_id?
>
>  thanks


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: My first experience using the new AuthComponent in cake1.2

2007-07-20 Thread [EMAIL PROTECTED]

Can you provide more information on how you overwrote the hash method
(Auth::password()) in AuthComponent *without* actually touching the
cakephp core code?

I've been tearing my hair out attempting to do this. I would think you
could create a component (e.g., CustomAuth) and override the method,
but, alas, this doesn't appear to work like I think it should.

On Jul 12, 7:41 am, francky06l <[EMAIL PROTECTED]> wrote:
> Hi bakers,
>
> Just wanted to share my experience of integrating the Auth component
> into a non-finished application in cake12.
> Overall, the component is great and easy to implement, however I had
> to deal with some "tricky" features.
>
> First the application context:
>
> I have users spread out in different centers. Basically a user belongs
> to a center. I have then a "Center" model and a "User" model. User
> belongsTo a Center.
> I can have a user "John Smith" in center A, and another "John Smith"
> in center B. Thus on login screen a field "Center name" is also
> captured. I can also disabled a complete center, meaning that every
> user of this center would fail to login.
>
> Using the Auth component, I have set the following in my login
> function :
>
> if(!empty($this->data))
> {
>   // Add the Center checks
>
>$this->Auth->userScope = array( 'Center.disabled' => 0,
>
> 'Center.name' => $this->data['Center']['name']);
>
>if(!$this->Auth->login($this->data))
>{
>
> That should do the trick I though ...  well not exactly. That does not
> work because the Auth component include a -1 as the recursive flag for
> the call to User->find.
> Workaround : I have added a $recursive variable to the component and
> initialized it to -1. Now I just have to add $this->Auth->recursive =
> 1; prior to the Auth->login call.
>
> Second "small" problem, I need to keep in the Session some fields of
> the Center record. For now, the login function of the Auth stores only
> $data['User'].
> I did solve this, in a "dirty way" by changing the return of the
> identify function :
>
> return $this->recursive > 0 ? $data : $data[$this->userModel];
>
> I am sure the above might give me some problems later, feel free to
> give me hints.
>
> Another problem that I faced, was the default hash parameters to use.
> My DB already had some user password hashed using md5.
> I did add a variable called $hashMethod in the component, and
> initialized to 'sha1', I can then override the variable if I need
> something else. I also added a $hashPrefix initialized to the
> CAKE_SESSION_STRING, and I can override it.
> The password function is modified as :
>
> function password($password) {
> return Security::hash($hashPrefix . $password, $hashMethod);
> }
>
> The hashPasswords implemented into the startup function gave me some
> trouble as well. I have a "changeDetail" function used by any user to
> change their details as well as their password. I have set a control
> to enforce the password strength such as at least 6 different
> characters among them 2 digits.
> This rule can't be verified anymore since the startup function will
> "hash" my password prior to my verification.
> For now the WorkAround is to use another field than "password" into
> the view and just add the "password" ($this->data['User']['password']
> = $this->Auth->password($this->data['User']['passtrick']) prior to
> save.
> This is no really "elegant", maybe a "enable/disable" method (or an
> array of controller/view to avoid the call to hashPasswords) could be
> implemented into the Auth ?
>
> That's about it for now. Do not get me wrong, I know I have listed
> mainly problems but the Auth is great component. I could work without
> the Auth component since my application requires login for every
> action (except the login / logout actions of course), but my main
> interest is to link it with the cake12  ACL (next step).
>
> Again, some of the above might be due to my misunderstanding of the
> component, please feel free to suggest or comments.
>
> Thanks


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Workflow engine for cake

2007-07-20 Thread Chris Hartjes

On 7/20/07, Kunthar <[EMAIL PROTECTED]> wrote:
> 2. If cake claims to be a real alternative MVC it has to own workflow
> engine internal,

What does having it's own internal workflow engine have to do with
Cake's implementation of MVC?

Chris Hartjes
Senior Developer
Cake Development Corporation

My motto for 2007:  "Just build it, damnit!"

@TheBallpark - http://www.littlehart.net/attheballpark
@TheKeyboard - http://www.littlehart.net/atthekeyboard

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Workflow engine for cake

2007-07-20 Thread Kunthar

Hello all,

I need to manage some conditional behaviour for my app. Samples;
1. customer adds new campaign to discount product x and also want to
show banner in selected pages,
2. if basket.order.totals > 100 USD then do some favour to him,
3. check conditions and send email to some customers, etc.

Actions could be user driven or system driven. And workflow management
came to play.

I've searched for several workflow solutions but, i couldn't find any
suitable entry point to start.
Let me list them;
Galaxy http://workflow.tikiwiki.org/tiki-index.php (found one xml in
bin but no more activity)
Radicore http://www.radicore.org/ (also claims framework, but deeply
useless :) )
Jetbox http://jetbox.streamedge.com/ (they say they have internal
workflow engine)
The best i could found is there but only for php5;
http://www.slideshare.net/sebastian_bergmann/graphoriented-programming-with-php
http://sebastian-bergmann.de/archives/642-eZ-Components-Workflow-Engine.html

struts4php http://wiki.struts4php.org/index.php/Main_Page also needs
php5

After a long hours of comparison;
1. I really need to cake power,
2. If cake claims to be a real alternative MVC it has to own workflow
engine internal,
3. As far as i see, all implementations using php5 abilities but, i
need php4 implementation. As we know,
lots of, bunch of hosting companies still must use php4,

My question is, is this impossible to code workflow engine for php4
and 5 at the same time?
Any comments on this issue?

Take care all.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: i18n and sprintf

2007-07-20 Thread Fran Simó

Is there any tutorial about i18n on static templates for Cake 1.1?
Thanks


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



ionCube's encoder and CakePHP

2007-07-20 Thread Christian \"Jippi\" Winther
Hello

 

Does ionCube's encoder works okay with CakePHP ? 

 

/Regards Christian Winther

 

Nb. This is ment as a phun !

 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Passing values to renderElement

2007-07-20 Thread peterhf

I have an, representation_type_select.thtml, which consists of a
selectTag.

selectTag(
$model_name . '/type_' . $id,
array(
  'option_1' => 'option_1',
  .
  .
  .
  'option_n' => 'option_nr'
   ),
  '',
  array('id' => 'type_' . $id, 'size' => '6',
'multiple' => 'multiple', 'class' => 'classname'),
  null,
  false,
  false
);
?>

This select tag is used multiple times in a form and its name needs to
be different for each use, therefore the "$id" variable. The
$model_name is set in the controller and appears correctly in the
rendered html. However, I have not been able successfully pass the
value of $id to the $this-
>renderElement('representation_type_select'). The value of $id does
not appear as a postfix to either 'type_' in the html. I tried renderElement('representation_type_select'); ?>

Thanks in advance for any suggestions.

Peter -


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Best Practices with: Model->beforeValidate()

2007-07-20 Thread [EMAIL PROTECTED]

According to cakephp's core library model_php[4|5].php
beforeValidate() gets called on every save, regardless of whether its
an update or new row.

not sure about telling whether its new or an update -- the save()
function seems to use $this->exists()

On Jul 20, 8:20 am, phirschybar <[EMAIL PROTECTED]> wrote:
> I want to use beforeValidate() to make some edits to data before it
> gets validated (combining 2 input fields, etc.).
>
> Does beforeValidate get called on EVERY save, including on UPDATE? Or
> just the initial save?
>
> What is the best practice here. If I want to just look for an initial
> SAVE, rather than an UPDATE, do I just check that
>
> !isset($this->data['Model']['id'])


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Heavy loaded sites

2007-07-20 Thread Chris Hartjes

On 7/20/07, mutabor <[EMAIL PROTECTED]> wrote:
>
> Hi guys,
>
> I am wondering does anybody know a Cake based sites with a lot of
> traffic? A kind of big sites. And how good and fast Cake behaves with
> such conditions?
>

Mozilla's FireFox addons site uses it
http://addons.mozilla.org

I won't repeat my views on CakePHP's ability to scale, as a search of
this mailing list will reveal those.


-- 
Chris Hartjes
Senior Developer
Cake Development Corporation

My motto for 2007:  "Just build it, damnit!"

@TheBallpark - http://www.littlehart.net/attheballpark
@TheKeyboard - http://www.littlehart.net/atthekeyboard

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Heavy loaded sites

2007-07-20 Thread Felix Geisendörfer
Maybe I should have phrased my last post differently:

* *CakePHP is not an application*, it's a framework
* You can build applications with CakePHP
* How well those applications perform is largely the responsibility
  of the developer
* Looking at other big cake site tells you how good a job they did -
  not how fast the framework they used is
* People unable to use the search are unlikely to build sites which
  will gain substantial traffic ; )

-- Felix
--
My Blog: http://www.thinkingphp.org
My Business: http://www.fg-webdesign.de

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: generateList with multiple values

2007-07-20 Thread Tane Piper

Seems a rather long-winded way of doing it.  Instead you can use
cakephp's standard generateList(), and use afterFind to generate the
arrays you want pass in.

Paul Herron has a good article on this:

http://www.paulherron.net/articles/view/cakephp_afterfind_psuedofields


On 7/20/07, mithnik <[EMAIL PROTECTED]> wrote:
>
> Hi all,
> I needed a function to return more than one value for a key so this is
> what I have done. I hope it will helps someone.
>
>  /**
>* Generates an array with keys defined by $keyPath and
> concatenated values from $valuePath
>  *
>  * @param array $conditions limites the array of result if defined
>  * @param mixed $keyPath A dot-separated
>  * @param mixed $valuePath A dot-separated string.
>  * @param mixed $delimeter string to seperate values.
>  * @param numerical $recursive defines depth of search.
>  * @return array Array with keys defined from  $keyPath and values
> concatenated string of $valuePath
>  * @access public
>  */
>   function generateListExtended($conditions = null, $keyPath,
> $valuePath = null, $delimeter = " ", $recursive = -1)
>   {
>   if(empty($valuePath))
>   return false;
>
>   $this->recursive = $recursive;
>   $rows = $this->findAll($conditions);
>   if(empty($rows))
>   return null;
>   $returnKeys = Set::extract($rows, $keyPath);
>
>   $listVals = array();
>   foreach($valuePath as $key => $value)
>   $listVals[] = Set::extract($rows, $value);
>
>   $returnVals = array();
>   foreach($listVals as $fieldKey => $fieldValue)
>   {
>   foreach($fieldValue as $key => $value)
>   {
>   if(!empty($value))
>   {
>   if(isset($returnVals[$key]))
>   $returnVals[$key] .= 
> $delimeter.$value;
>   else
>   $returnVals[$key]  = $value;
>   }
>   }
>   }
>
>   if (!empty($returnKeys) && !empty($returnVals)) {
>  $return = array_combine($returnKeys, $returnVals);
>  return $return;
> }
> return null;
>   }
>
>
> >
>


-- 
Tane Piper
http://digitalspaghetti.tooum.net

This email is: [ ] blogable [ x ] ask first [ ] private

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Heavy loaded sites

2007-07-20 Thread Felix Geisendörfer
>
> I am wondering does anybody know a Cake based sites with a lot of
> traffic? A kind of big sites. And how good and fast Cake behaves with
> such conditions?
No all traffic goes to: 
http://groups.google.com/groups/search?q=cakephp+high+traffic for some 
reason these days ... : /

-- Felix
--
My Blog: http://www.thinkingphp.org
My Business: http://www.fg-webdesign.de


pyrobot wrote:
> http://snook.ca is built on cakephp and gets a good amount of traffic.
>
> For a list of other sites: 
> http://groups.google.com/group/cake-php/web/cake-apps-sites-in-the-wild
>
>
>
> On Jul 20, 10:32 am, mutabor <[EMAIL PROTECTED]> wrote:
>   
>> Hi guys,
>>
>> I am wondering does anybody know a Cake based sites with a lot of
>> traffic? A kind of big sites. And how good and fast Cake behaves with
>> such conditions?
>>
>> Thanks, Kostya.
>> 
>
>
> >
>
>   

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Only include js in certain views

2007-07-20 Thread Joshua Benner





Put $_javascript_->link in the view instead of the layout?

[EMAIL PROTECTED] wrote:

  Is there a way to only include a _javascript_ file in certain selected
views.  I have it as being included in the default layout with link('tooltip')."\n"; ?> but I it's causing errors
on views I don't need it on.  I'm using cake 1.2.x if that makes a
difference.

Matt



  


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake PHP" group.  To post to this group, send email to cake-php@googlegroups.com  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  -~--~~~~--~~--~--~---





Only include js in certain views

2007-07-20 Thread [EMAIL PROTECTED]

Is there a way to only include a javascript file in certain selected
views.  I have it as being included in the default layout with link('tooltip')."\n"; ?> but I it's causing errors
on views I don't need it on.  I'm using cake 1.2.x if that makes a
difference.

Matt


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Heavy loaded sites

2007-07-20 Thread pyrobot

http://snook.ca is built on cakephp and gets a good amount of traffic.

For a list of other sites: 
http://groups.google.com/group/cake-php/web/cake-apps-sites-in-the-wild



On Jul 20, 10:32 am, mutabor <[EMAIL PROTECTED]> wrote:
> Hi guys,
>
> I am wondering does anybody know a Cake based sites with a lot of
> traffic? A kind of big sites. And how good and fast Cake behaves with
> such conditions?
>
> Thanks, Kostya.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Heavy loaded sites

2007-07-20 Thread mutabor

Hi guys,

I am wondering does anybody know a Cake based sites with a lot of
traffic? A kind of big sites. And how good and fast Cake behaves with
such conditions?

Thanks, Kostya.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Objects and Arrays when fetching models

2007-07-20 Thread youthoftoday

I'm new to cakePHP, but experienced with Rails. I can't find the
answer to the following anywhere.

Let's say I have a model for which I've defined a custom function, for
example one that joins concatenates two fields. I retrieve this object
from the database and I want to call a method. For instance:

$bob = new MyModel;
$numberfour = $bob->findById(4);
$name = $numberfour->fullname();

The last line doesn't work, and says "Call to a member function 
on a non-object". In Rails the returned results would be objects, but
in cake they seem to just be an array?

So how do I call methods/functions on returned models?

Thanks very much!

Joe


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Software Design Dilemma -- getting data from Model to View

2007-07-20 Thread oleonav

Maybe a suggestion which does not infects performance;

1. Add a collumn to the photoset table containing the number of photos
in the set. You can use this in your users/view action with no loss of
performance
2. When adding or deleting photos to a set this collumn in the
photoset model needs to be altered. Do this in the Photo model
(afterSave and afterDelete actions). This has a very low decrease of
performance added to the Photos edit, add & delete actions.

Success.



On Jul 20, 1:57 pm, tawm <[EMAIL PROTECTED]> wrote:
> Hey Geoff,
>
> Thanks for your reply. I guess your approach is the best possible one.
> I do not like it tremendously though. Thanks to CakePHP's associations
> all photosets are automatically part of a user data-array. So we
> already have them, and therefore would rather not findAll them again.
> Also, since we are already looping the photosets in the view, I don't
> like to loop it once again in the controller. But I guess I'm asking
> too much.
>
> The ideal solution would be, in my opinion, to have a model instance
> or value object passed to the view, instead of a data array. That
> object then can contain not only data fields, but also methods that
> deliver meta-data such as age (based on birthdate) for user instances
> or number of photos for photoset instances. I think this idea will be
> only be looked at towards version 2.0 though...
>
> Tim
>
> On 20 jul, 13:30, Geoff Ford <[EMAIL PROTECTED]> wrote:
>
> > Option 3. From the model via the controller e.g.
>
> > Users controller.
> > $this->set('photosets', $this->User->PhotoSet-
>
> > >findWithCount($conditions));
>
> > PhotSet Model
>
> > function findWithCount($conditions){
> >   $this->recursive = -1; //stops all associations
> >   $photosets = $this->findAll($conditions);  // if you need sort,
> > fields etc you will have to pass them through as well
>
> >   //loop the $photosets and add a field called count
> >   foreach ($photosets as $key => $set) {
> > $photosets[$key']['PhotoSet']['count'] = $this->Photo-
>
> > >findCount(array('photoset_id' => $set['PhotoSet']['id']));
> >   }
> > }
>
> > Geoff
> > --http://lemoncake.wordpress.com
>
> > On Jul 20, 8:24 pm, tawm <[EMAIL PROTECTED]> wrote:
>
> > > Hello,
>
> > > I'm dealing with the following dilemma, simply cannot decide what's
> > > the best approach. Your $0.02 is highly appreciated!
>
> > > Consider the following structure: User hasMany Photoset, which in turn
> > > hasMany Photo.
>
> > > The UserController has a view (/users/view/{id}) action, which shows
> > > the user's data and its photosets. Each photoset is represented as its
> > > title and the total number of photos within the set. Since in this
> > > action we do not need to have the data of all a photoset's photos at
> > > our disposal, we unbinded the Photoset hasMany Photo association. As a
> > > result, in order to know how many photos a photoset contains, we need
> > > to query this additionally.
>
> > > Obviously, the method that will perform this photo-count-query is to
> > > be implemented in the Photoset Model, as it is meta-data of a
> > > Photoset.
>
> > > Now the question is:>From where do we call this method? -OR- How do we 
> > > move the result of
>
> > > this method from model to view?
>
> > > Option 1: from the Controller
> > > Your first reaction might be; easy, that's what a Controller is for!
> > > It has access to the Model and can hand data over the View. True, but
> > > in our situation this approach has a huge disadvantage as well.
> > > Remember that we are talking about the UserController here, while the
> > > values we want to obtain are the total number of photos for *every*
> > > photoset that belongs to this user. I.e. if we want to call the photo-
> > > count-method from the Controller, it means we will have to loop all
> > > photosets belonging to this user, call the method and store its result
> > > for every one of them and pass this information forward to the View.
> > > Then of course the View will have to loop all of them again. That's a
> > > lot of code and redundant loops!
>
> > > Option 2: from the View
> > > Eventually, we need to have the photo-count-value at our disposal in
> > > the appropriate View. So it would be convenient to send out the
> > > request for this value in the View as well. But, from a View we can
> > > reach Controller nor Model directly, so this is a problem. Our only
> > > option would be to call requestAction, but considered that we just
> > > need a single integer value (the photo count) that feels like
> > > overkill. Furthermore, we just need some basic data from the database
> > > -- no controlling involved -- so a call to the Model seems more
> > > appropriate than a call to the Controller (???). The only type of call
> > > that we can make to the Model is a static one though, which is
> > > insufficient for our needs, since we will be using the Model's find*
> > > methods which are instance methods.
>
> > > That were our option

Re: i18n translation in db tables - how to do this like Symfony?

2007-07-20 Thread oleonav

Sorry, my post was not about labels or div's.

The input tag transforms Model.Fieldname to a forminput named
Model.Fieldname with the value of the fieldname applied to it, for
example $Article['title']

$form->input('Article.title') will become http://bakery.cakephp.org/articles/view/multiple-rules-of-validation-per-field-in-cakephp-1-2





On Jul 20, 4:33 pm, zwobot <[EMAIL PROTECTED]> wrote:
> I have found a way here in the google group (don't memorize the exact
> source though):
>
> input('player.vorname', array('div' => false,
> 'label' => false));?>
>
> The options in the secon parameter prevent the input function to
> automatically wrap a div tag and the column name as label around the
> input tag itsself.
> So you can for example use:
>
> 
> input('player.vorname', array('div' => false,
> 'label' => false));?>
>
> --
>
> Another issue:
> Do you know how to change the error message on a failed validation in
> a view?
> If I have for example VALID_NOT_EMPTY defined for my title column in
> the Post model, and I leave the input field for title empty in the add
> view a standard message is echoed.
> How can I alter the error message in cake 1.2? With cake 1.1 you could
> use the HtmlHelper and its "tagErrorMsg" function for that, but how to
> do this in cake 1.2?
> I have tried "error" function from FormHelper but it did not work.
>
> On Jul 20, 12:46 pm, oleonav <[EMAIL PROTECTED]> wrote:
>
> > If we could use something like $form->input('TransTitle.fra.content')
> > that would be nice. Using this produces a form input but the value is
> > lost.
>
> > We can write some logic (like I have shown in my recent posts about
> > this topic) to loop through the TransTitle & TransContent array, but
> > this seems not to be the most elegant solution. Not very 'Cake' like.
> > Also in the controller function we have to parse things back again.
>
> > On Jul 19, 9:37 am, zwobot <[EMAIL PROTECTED]> wrote:
>
> > > Good question oleonav. I wondered how this works too.
> > > In general I want to use any label for an input field, seems like
> > > there is missing a parameter for an input label and you cannot use the
> > > second 'options' parameter to define a label as it seems.
>
> > > On Jul 17, 4:29 am, oleonav <[EMAIL PROTECTED]> wrote:
>
> > > > Presenting a formtag for [Article][active] is simple: 
> > > > $form->input('Article.active'). How to output a tag for the French 
> > > > title is
>
> > > > a mystery to me.
> > > > $form->input('TransTitle.??? ') ??


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Best Practices with: Model->beforeValidate()

2007-07-20 Thread phirschybar

I want to use beforeValidate() to make some edits to data before it
gets validated (combining 2 input fields, etc.).

Does beforeValidate get called on EVERY save, including on UPDATE? Or
just the initial save?

What is the best practice here. If I want to just look for an initial
SAVE, rather than an UPDATE, do I just check that

!isset($this->data['Model']['id'])


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



How to cache views with no layout

2007-07-20 Thread Joel Stein

Does anyone know why views that have no layout ($this->layout = false)
don't get cached?

I'm caching many of my pages, but there's one which uses a special
layout, so in order to make it cache, I have to create a layout just
for this one view, and then it works.  Any ideas?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: i18n translation in db tables - how to do this like Symfony?

2007-07-20 Thread zwobot

I have found a way here in the google group (don't memorize the exact
source though):

input('player.vorname', array('div' => false,
'label' => false));?>

The options in the secon parameter prevent the input function to
automatically wrap a div tag and the column name as label around the
input tag itsself.
So you can for example use:


input('player.vorname', array('div' => false,
'label' => false));?>

--

Another issue:
Do you know how to change the error message on a failed validation in
a view?
If I have for example VALID_NOT_EMPTY defined for my title column in
the Post model, and I leave the input field for title empty in the add
view a standard message is echoed.
How can I alter the error message in cake 1.2? With cake 1.1 you could
use the HtmlHelper and its "tagErrorMsg" function for that, but how to
do this in cake 1.2?
I have tried "error" function from FormHelper but it did not work.

On Jul 20, 12:46 pm, oleonav <[EMAIL PROTECTED]> wrote:
> If we could use something like $form->input('TransTitle.fra.content')
> that would be nice. Using this produces a form input but the value is
> lost.
>
> We can write some logic (like I have shown in my recent posts about
> this topic) to loop through the TransTitle & TransContent array, but
> this seems not to be the most elegant solution. Not very 'Cake' like.
> Also in the controller function we have to parse things back again.
>
> On Jul 19, 9:37 am, zwobot <[EMAIL PROTECTED]> wrote:
>
> > Good question oleonav. I wondered how this works too.
> > In general I want to use any label for an input field, seems like
> > there is missing a parameter for an input label and you cannot use the
> > second 'options' parameter to define a label as it seems.
>
> > On Jul 17, 4:29 am, oleonav <[EMAIL PROTECTED]> wrote:
>
> > > Presenting a formtag for [Article][active] is simple: 
> > > $form->input('Article.active'). How to output a tag for the French title 
> > > is
>
> > > a mystery to me.
> > > $form->input('TransTitle.??? ') ??


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



generateList with multiple values

2007-07-20 Thread mithnik

Hi all,
I needed a function to return more than one value for a key so this is
what I have done. I hope it will helps someone.

 /**
   * Generates an array with keys defined by $keyPath and
concatenated values from $valuePath
   *
   * @param array $conditions limites the array of result if defined
   * @param mixed $keyPath A dot-separated
   * @param mixed $valuePath A dot-separated string.
   * @param mixed $delimeter string to seperate values.
   * @param numerical $recursive defines depth of search.
   * @return array Array with keys defined from  $keyPath and values
concatenated string of $valuePath
   * @access public
   */
function generateListExtended($conditions = null, $keyPath,
$valuePath = null, $delimeter = " ", $recursive = -1)
{
if(empty($valuePath))
return false;

$this->recursive = $recursive;
$rows = $this->findAll($conditions);
if(empty($rows))
return null;
$returnKeys = Set::extract($rows, $keyPath);

$listVals = array();
foreach($valuePath as $key => $value)
$listVals[] = Set::extract($rows, $value);

$returnVals = array();
foreach($listVals as $fieldKey => $fieldValue)
{
foreach($fieldValue as $key => $value)
{
if(!empty($value))
{
if(isset($returnVals[$key]))
$returnVals[$key] .= 
$delimeter.$value;
else
$returnVals[$key]  = $value;
}
}
}

if (!empty($returnKeys) && !empty($returnVals)) {
 $return = array_combine($returnKeys, $returnVals);
 return $return;
}
return null;
}


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



[PATCH] Configurable aliases for nodes created by Acl Behaviour

2007-07-20 Thread Magnus Bergmark

I just submitted my first patch to CakePHP. I was thinking some of you
might like it.
https://trac.cakephp.org/ticket/2942
Look in the comments as it's not my ticket.

So what does it do? Well, it makes the default aliases for ACL nodes
configurable - and yes, they are dynamic. It's very useful if you hate
seeing trees of numbers when looking at your ACOs/AROs. With this
patch, it's possible to have the nodes named much, much better.

Tell me what you think. What can I do better?
I'm thinking of adding support for empty aliases/empty parts of the
alias. One might not need a prefix and a suffix, for example.
(Although, I think you could set prefix and glue to an empty string
and get that functionality. Not tested it, though...)


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Accessing username with only id from foreign model

2007-07-20 Thread Magnus Bergmark

If you have User associated, you might already have the info in $this-
>data.
Here's an example:
class Message extends AppModel
{
var $name = 'Message';
var $belongsTo = array('User');
}

class MessagesController extends Appcontroller
{
function view($id)
{
$result = $this->Message->find(array('Message.id' => $id),
null, null, true); // recursive set to true, will fetch associations
$message_title = $result['Message']['title'];
$sender = $result['User']['username'];
}
}

On 20 Juli, 12:34, CakeSpork <[EMAIL PROTECTED]> wrote:
> Hi,
> I have a pretty basic question that I've still not gotten through to
> after these past weeks of plunging into Cake and I thought I might
> find some help here. How do you guys mostly go around to finding the
> associated User to a user_id? I seem to do this so often that at the
> very least uses('User') along with $this->User->findById seems very
> insufficient (ie. lengthen loading times).
>
> These models are obviously already associated to the User models with,
> for example, Message belongsTo Sender with foreign ID sender_id   and
> Message belongsTo Receiver, foreign ID user_id. And of course, User
> hasMany Message. So, how _should_ I ask up more info. about these
> users?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: $this->cakeError refuses to load a custom layout.

2007-07-20 Thread Ski

Hi,

  I managed to override the default layout and individual templates
locally but cannot get it
working live:

  I did this by setting the layout at the top of my custom template
files...

  I have overridden my error handler to mail some messages before
calling parent methods, but I guess I am going to have to implement
duplicate the rendering in my own class.  This seems a bit bx
having to override a whole error handler just to
use custom layouts and templates, maybe this will get fixed for
another release - isn't that what inheritance is about?

  Ski


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: $this->cakeError refuses to load a custom layout.

2007-07-20 Thread Ski

Hi,

  I managed to override the default layout locally but cannot get it
working live:

  I did this by setting the layout at the top of my custom template
files...

  Seems a bit bollox to have to override a whole error handler just to
use custom layouts and templates, maybe this will get fixed for
another release so we can override some methods and still call parent
ones - isn't that what inheritance is about?

  Glen



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Date format with $form->input

2007-07-20 Thread Braindead

> There is already a Enhancement ticket in the trac for this 
> athttps://trac.cakephp.org/ticket/2405(along with a few other dateTime
> enhancements).
>
> If you want it now you can apply the patch in the ticket.

Thanks for the link. The first attachment already includes a patch for
my problem. So I think there is no need to submit the patch again.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: $this->cakeError refuses to load a custom layout.

2007-07-20 Thread Ski

Hi,



On Jul 19, 10:16 pm, francky06l <[EMAIL PROTECTED]> wrote:
> Sorry guys did not know "errors always use the default layouts".
>
> On Jul 18, 12:00 am, phpjoy <[EMAIL PROTECTED]> wrote:
>
> > that's great to know, "errors always use the default layouts". :)
> > didn't see it in the manual..
>
> > thanks a tons for the solution.
>
> > On Jul 16, 7:52 pm, rtconner <[EMAIL PROTECTED]> wrote:
>
> > > Ah.. phpjoy, I had the same problem. There is no easy solution so far
> > > as I could find. No good solution that I liked anyways. Errors always
> > > use the defaultlayout, and there is nothing you can do to change
> > > that.
>
> > > .. So.. the best solution as I could figure is this..
>
> > > Create /app/error.php and copy and paste ErrorHandler into it. Then
> > > modify it to read "class AppError extends ErrorHandler"
>
> > > The modify the file to handle dynamic layouts. Here I'll make it easy
> > > and just copy and past my (Cake 1.2)error.php file for you. Hope this
> > > helps.
>
> > > 
> > > 
> > > /**
> > >  * Override defaults cakeerrorbehavior
> > >  */
> > > class AppError extends ErrorHandler {
>
> > > var $layout= 'error';
>
> > > /**
> > >  * Displays anerrorpage (e.g. 404 Not found).
> > >  *
> > >  * @param array $params Parameters for controller
> > >  * @access public
> > >  */
> > > functionerror($params) {
> > > extract($params);
> > > $this->controller->base = $base;
> > > $this->controller->webroot = $this->_webroot();
> > > $this->controller->viewPath='errors';
> > > $this->controller->set(array('code' => $code,
> > >   
> > >   'name' => $name,
> > >   
> > >   'message' => $message,
> > >   
> > >   'title' => $code . ' ' . $name));
> > > $this->controller->render('error404', $this->layout);
> > > exit();
> > > }
> > > /**
> > >  * Convenience method to display a 404 page.
> > >  *
> > >  * @param array $params Parameters for controller
> > >  * @access public
> > >  */
> > > function error404($params) {
> > > extract($params);
>
> > > if (!isset($url)) {
> > > $url = $action;
> > > }
> > > if (!isset($message)) {
> > > $message = '';
> > > }
> > > if (!isset($base)) {
> > > $base = '';
> > > }
>
> > > header("HTTP/1.0 404 Not Found");
> > > $this->error(array('code' => '404',
> > > 'name' => 'Not 
> > > found',
> > > 'message' => 
> > > sprintf(__("The requested address %s was not found
> > > on this server.", true), $url, $message),
> > > 'base' => $base));
> > > exit();
> > > }
> > > /**
> > >  * Renders the Missing Controller web page.
> > >  *
> > >  * @param array $params Parameters for controller
> > >  * @access public
> > >  */
> > > function missingController($params) {
> > > extract(Router::getPaths());
> > > extract($params, EXTR_OVERWRITE);
>
> > > $this->controller->base = $base;
> > > $this->controller->webroot = $webroot;
> > > $this->controller->viewPath ='errors';
> > > $controllerName = str_replace('Controller', '', 
> > > $className);
> > > $this->controller->set(array('controller' => $className,
> > >   
> > >   'controllerName' => $controllerName,
> > >   
> > >   'title' => __('Missing Controller', true)));
> > > $this->controller->render('missingController', 
> > > $this->layout);
> > > exit();
> > > }
> > > /**
> > >  * Renders the Missing Action web page.
> > >  *
> > >  * @param array $params Parameters for controller
> > >  * @access public
> > >  */
> > > function missingAction($params) {
> > > extract(Router::getPaths());
> > > extract($params, EXTR_OVERWRITE);
>
> > > $this->controller->base = $base;
> > > $this->controller->webroot = $webroot;
> > > $this->controller->viewPath = 'errors';
> > > $this->controller->set(array('controller' => $className,
> > >   
> > >   

Re: Software Design Dilemma -- getting data from Model to View

2007-07-20 Thread tawm

Hey Geoff,

Thanks for your reply. I guess your approach is the best possible one.
I do not like it tremendously though. Thanks to CakePHP's associations
all photosets are automatically part of a user data-array. So we
already have them, and therefore would rather not findAll them again.
Also, since we are already looping the photosets in the view, I don't
like to loop it once again in the controller. But I guess I'm asking
too much.

The ideal solution would be, in my opinion, to have a model instance
or value object passed to the view, instead of a data array. That
object then can contain not only data fields, but also methods that
deliver meta-data such as age (based on birthdate) for user instances
or number of photos for photoset instances. I think this idea will be
only be looked at towards version 2.0 though...

Tim


On 20 jul, 13:30, Geoff Ford <[EMAIL PROTECTED]> wrote:
> Option 3. From the model via the controller e.g.
>
> Users controller.
> $this->set('photosets', $this->User->PhotoSet-
>
> >findWithCount($conditions));
>
> PhotSet Model
>
> function findWithCount($conditions){
>   $this->recursive = -1; //stops all associations
>   $photosets = $this->findAll($conditions);  // if you need sort,
> fields etc you will have to pass them through as well
>
>   //loop the $photosets and add a field called count
>   foreach ($photosets as $key => $set) {
> $photosets[$key']['PhotoSet']['count'] = $this->Photo-
>
> >findCount(array('photoset_id' => $set['PhotoSet']['id']));
>   }
> }
>
> Geoff
> --http://lemoncake.wordpress.com
>
> On Jul 20, 8:24 pm, tawm <[EMAIL PROTECTED]> wrote:
>
> > Hello,
>
> > I'm dealing with the following dilemma, simply cannot decide what's
> > the best approach. Your $0.02 is highly appreciated!
>
> > Consider the following structure: User hasMany Photoset, which in turn
> > hasMany Photo.
>
> > The UserController has a view (/users/view/{id}) action, which shows
> > the user's data and its photosets. Each photoset is represented as its
> > title and the total number of photos within the set. Since in this
> > action we do not need to have the data of all a photoset's photos at
> > our disposal, we unbinded the Photoset hasMany Photo association. As a
> > result, in order to know how many photos a photoset contains, we need
> > to query this additionally.
>
> > Obviously, the method that will perform this photo-count-query is to
> > be implemented in the Photoset Model, as it is meta-data of a
> > Photoset.
>
> > Now the question is:>From where do we call this method? -OR- How do we move 
> > the result of
>
> > this method from model to view?
>
> > Option 1: from the Controller
> > Your first reaction might be; easy, that's what a Controller is for!
> > It has access to the Model and can hand data over the View. True, but
> > in our situation this approach has a huge disadvantage as well.
> > Remember that we are talking about the UserController here, while the
> > values we want to obtain are the total number of photos for *every*
> > photoset that belongs to this user. I.e. if we want to call the photo-
> > count-method from the Controller, it means we will have to loop all
> > photosets belonging to this user, call the method and store its result
> > for every one of them and pass this information forward to the View.
> > Then of course the View will have to loop all of them again. That's a
> > lot of code and redundant loops!
>
> > Option 2: from the View
> > Eventually, we need to have the photo-count-value at our disposal in
> > the appropriate View. So it would be convenient to send out the
> > request for this value in the View as well. But, from a View we can
> > reach Controller nor Model directly, so this is a problem. Our only
> > option would be to call requestAction, but considered that we just
> > need a single integer value (the photo count) that feels like
> > overkill. Furthermore, we just need some basic data from the database
> > -- no controlling involved -- so a call to the Model seems more
> > appropriate than a call to the Controller (???). The only type of call
> > that we can make to the Model is a static one though, which is
> > insufficient for our needs, since we will be using the Model's find*
> > methods which are instance methods.
>
> > That were our options. None of them satisfies me. What would be your
> > approach?
>
> > Tim


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Best way to make controllers

2007-07-20 Thread Geoff Ford

If you are asking about access control - which user role can perform
what action - have a look on the Frequent Discussions page for ACL and
Auth.

http://groups.google.com/group/cake-php/web/frequent-discussions

Geoff
--
http://lemoncake.wordpress.com

On Jul 20, 1:52 am, Cacho <[EMAIL PROTECTED]> wrote:
> On Jul 19, 2:34 pm, Geoff Ford <[EMAIL PROTECTED]> wrote:
>
> > My personal opinion - one controller per 'type' of 'operation'.  I
> > think all actions that can be performed on a single object (not
> > necessarily a single model) should be managed in the one controller.
> > Different permissions to those actions should be handled by ACL.
>
> > I think different controllers for each role could get very messy, very
> > quick and lead to lots of duplicate code.
>
> Thanks for your reply.
>
> I think I do agree with you but now I wonder how should be driven the
> "names normalization". So, Cake samples define a model Product and a
> product_controller. Which is the best practice to call to a controller
> for logged user operations on a product ? (if that exists, obviously).
>
> Thanks in advance
>
> J


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Software Design Dilemma -- getting data from Model to View

2007-07-20 Thread Geoff Ford

Option 3. From the model via the controller e.g.

Users controller.
$this->set('photosets', $this->User->PhotoSet-
>findWithCount($conditions));

PhotSet Model

function findWithCount($conditions){
  $this->recursive = -1; //stops all associations
  $photosets = $this->findAll($conditions);  // if you need sort,
fields etc you will have to pass them through as well

  //loop the $photosets and add a field called count
  foreach ($photosets as $key => $set) {
$photosets[$key']['PhotoSet']['count'] = $this->Photo-
>findCount(array('photoset_id' => $set['PhotoSet']['id']));
  }
}

Geoff
--
http://lemoncake.wordpress.com


On Jul 20, 8:24 pm, tawm <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I'm dealing with the following dilemma, simply cannot decide what's
> the best approach. Your $0.02 is highly appreciated!
>
> Consider the following structure: User hasMany Photoset, which in turn
> hasMany Photo.
>
> The UserController has a view (/users/view/{id}) action, which shows
> the user's data and its photosets. Each photoset is represented as its
> title and the total number of photos within the set. Since in this
> action we do not need to have the data of all a photoset's photos at
> our disposal, we unbinded the Photoset hasMany Photo association. As a
> result, in order to know how many photos a photoset contains, we need
> to query this additionally.
>
> Obviously, the method that will perform this photo-count-query is to
> be implemented in the Photoset Model, as it is meta-data of a
> Photoset.
>
> Now the question is:>From where do we call this method? -OR- How do we move 
> the result of
>
> this method from model to view?
>
> Option 1: from the Controller
> Your first reaction might be; easy, that's what a Controller is for!
> It has access to the Model and can hand data over the View. True, but
> in our situation this approach has a huge disadvantage as well.
> Remember that we are talking about the UserController here, while the
> values we want to obtain are the total number of photos for *every*
> photoset that belongs to this user. I.e. if we want to call the photo-
> count-method from the Controller, it means we will have to loop all
> photosets belonging to this user, call the method and store its result
> for every one of them and pass this information forward to the View.
> Then of course the View will have to loop all of them again. That's a
> lot of code and redundant loops!
>
> Option 2: from the View
> Eventually, we need to have the photo-count-value at our disposal in
> the appropriate View. So it would be convenient to send out the
> request for this value in the View as well. But, from a View we can
> reach Controller nor Model directly, so this is a problem. Our only
> option would be to call requestAction, but considered that we just
> need a single integer value (the photo count) that feels like
> overkill. Furthermore, we just need some basic data from the database
> -- no controlling involved -- so a call to the Model seems more
> appropriate than a call to the Controller (???). The only type of call
> that we can make to the Model is a static one though, which is
> insufficient for our needs, since we will be using the Model's find*
> methods which are instance methods.
>
> That were our options. None of them satisfies me. What would be your
> approach?
>
> Tim


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Date format with $form->input

2007-07-20 Thread Geoff Ford

Looks like you are right, I read the source a little closer.  I saw
that input was just using dateTime() and assume you could pass along a
the format option, but when you get to the switch statement MDY is
hardcoded.

There is already a Enhancement ticket in the trac for this at
https://trac.cakephp.org/ticket/2405 (along with a few other dateTime
enhancements).

If you want it now you can apply the patch in the ticket.

Geoff
--
http://lemoncake.wordpress.com

On Jul 20, 8:16 pm, Braindead <[EMAIL PROTECTED]> wrote:
> On Jul 20, 1:02 am, Geoff Ford <[EMAIL PROTECTED]> wrote:
>
> > It is possible, you misread what speccy was saying.  Use what you have
> > and add a dateFormat key in the options array
>
> I tried to add the dateFormat key yesterday before posting my question
> and I tried it 2 minutes ago. Both times the selects were displayed in
> MDY order. As I already wrote it is fixed to MDY according to the API.
> I use Cake 1.2.0.5427alpha. Maybe it was possible to change via the
> dateFormat key in a version prior 1.2.0.5427alpha?
>
> How do I submit a change request to the Cake developers to change this
> behaviour?
>
> Geoff, my site will be used by an online gaming clan. The oldest
> member they have is 50. And I don't think that there will be someone
> older than 60. ;-)


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: AuthComponent Tutorial

2007-07-20 Thread Geoff Ford

Hey cakeFreak,

I have a slightly different approach for development bypassing.  I
have a condition like

if (Config::read()) {
  $this->Auth->allow();
}

This checks if CAKE_DEBUG is greater than 0 and bypass authentication
and authorization.

Personally I think it is safer than the extra property way that you
have shown cause you may forget to turn it off, whereas with using
DEBUG you will notice when you forget to turn it off when debug
statements and sql logs start showing up :)

Geoff
--
http://lemoncake.wordpress.com

On Jul 20, 7:22 pm, cakeFreak <[EMAIL PROTECTED]> wrote:
> Hey Geoff Ford,
>
> cheers for the tutorial!
>
> Great!
>
> I just modified a bit you beforeFilter function in the AppController
> to basically allow access to all controllers during development with
> ease!
>
> -
> function beforeFilter(){
> if (isset($this->Auth)) {
>   $this->Auth->userScope = array('User.disabled' => 0);
>   $this->Auth->loginAction = '/users/login';
>   $this->Auth->loginRedirect = '/users/account';
>   $this->Auth->fields = array('username' => 'username',
> 'password' => 'passwrd');
>   $this->Auth->authorize = 'actions';
>
>   if(!$this->inDev){
>   if (in_array(low($this->params['controller']), $this-
>
> >publicControllers)) {
>
>   $this->Auth->allow();
>   }
>   }
>   else{
>   $this->Auth->allow('*');
>   }
> }
> }
> -
>
> Then in your App controller you set:
>
> var $inDev = true; //true if your are in development phase / false if
> the app is live


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Software Design Dilemma -- getting data from Model to View

2007-07-20 Thread tawm

Hello,

I'm dealing with the following dilemma, simply cannot decide what's
the best approach. Your $0.02 is highly appreciated!

Consider the following structure: User hasMany Photoset, which in turn
hasMany Photo.

The UserController has a view (/users/view/{id}) action, which shows
the user's data and its photosets. Each photoset is represented as its
title and the total number of photos within the set. Since in this
action we do not need to have the data of all a photoset's photos at
our disposal, we unbinded the Photoset hasMany Photo association. As a
result, in order to know how many photos a photoset contains, we need
to query this additionally.

Obviously, the method that will perform this photo-count-query is to
be implemented in the Photoset Model, as it is meta-data of a
Photoset.

Now the question is:
>From where do we call this method? -OR- How do we move the result of
this method from model to view?

Option 1: from the Controller
Your first reaction might be; easy, that's what a Controller is for!
It has access to the Model and can hand data over the View. True, but
in our situation this approach has a huge disadvantage as well.
Remember that we are talking about the UserController here, while the
values we want to obtain are the total number of photos for *every*
photoset that belongs to this user. I.e. if we want to call the photo-
count-method from the Controller, it means we will have to loop all
photosets belonging to this user, call the method and store its result
for every one of them and pass this information forward to the View.
Then of course the View will have to loop all of them again. That's a
lot of code and redundant loops!

Option 2: from the View
Eventually, we need to have the photo-count-value at our disposal in
the appropriate View. So it would be convenient to send out the
request for this value in the View as well. But, from a View we can
reach Controller nor Model directly, so this is a problem. Our only
option would be to call requestAction, but considered that we just
need a single integer value (the photo count) that feels like
overkill. Furthermore, we just need some basic data from the database
-- no controlling involved -- so a call to the Model seems more
appropriate than a call to the Controller (???). The only type of call
that we can make to the Model is a static one though, which is
insufficient for our needs, since we will be using the Model's find*
methods which are instance methods.

That were our options. None of them satisfies me. What would be your
approach?

Tim


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: i18n translation in db tables - how to do this like Symfony?

2007-07-20 Thread oleonav

If we could use something like $form->input('TransTitle.fra.content')
that would be nice. Using this produces a form input but the value is
lost.

We can write some logic (like I have shown in my recent posts about
this topic) to loop through the TransTitle & TransContent array, but
this seems not to be the most elegant solution. Not very 'Cake' like.
Also in the controller function we have to parse things back again.



On Jul 19, 9:37 am, zwobot <[EMAIL PROTECTED]> wrote:
> Good question oleonav. I wondered how this works too.
> In general I want to use any label for an input field, seems like
> there is missing a parameter for an input label and you cannot use the
> second 'options' parameter to define a label as it seems.
>
> On Jul 17, 4:29 am, oleonav <[EMAIL PROTECTED]> wrote:
>
>
>
> > Presenting a formtag for [Article][active] is simple: 
> > $form->input('Article.active'). How to output a tag for the French title is
>
> > a mystery to me.
> > $form->input('TransTitle.??? ') ??


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Accessing username with only id from foreign model

2007-07-20 Thread CakeSpork

Hi,
I have a pretty basic question that I've still not gotten through to
after these past weeks of plunging into Cake and I thought I might
find some help here. How do you guys mostly go around to finding the
associated User to a user_id? I seem to do this so often that at the
very least uses('User') along with $this->User->findById seems very
insufficient (ie. lengthen loading times).

These models are obviously already associated to the User models with,
for example, Message belongsTo Sender with foreign ID sender_id   and
Message belongsTo Receiver, foreign ID user_id. And of course, User
hasMany Message. So, how _should_ I ask up more info. about these
users?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Date format with $form->input

2007-07-20 Thread Braindead

On Jul 20, 1:02 am, Geoff Ford <[EMAIL PROTECTED]> wrote:
> It is possible, you misread what speccy was saying.  Use what you have
> and add a dateFormat key in the options array

I tried to add the dateFormat key yesterday before posting my question
and I tried it 2 minutes ago. Both times the selects were displayed in
MDY order. As I already wrote it is fixed to MDY according to the API.
I use Cake 1.2.0.5427alpha. Maybe it was possible to change via the
dateFormat key in a version prior 1.2.0.5427alpha?

How do I submit a change request to the Cake developers to change this
behaviour?

Geoff, my site will be used by an online gaming clan. The oldest
member they have is 50. And I don't think that there will be someone
older than 60. ;-)


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: View this page "Create an interactive production wiki using PHP: IBM D

2007-07-20 Thread Mike Green

Very interested in reading this! thankyou to those involved.

MIke


On 18/07/07, margin <[EMAIL PROTECTED]> wrote:
>
> Update:  I downloaded the source code and uploaded a complete zip:
>
> http://download.yousendit.com/BE0382DB2EB95D0F
>
>
> >
>


-- 

Mike Green

Find yourself some misspelled ebay bargains!
http://www.typingwand.com

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: AuthComponent Tutorial

2007-07-20 Thread cakeFreak

Hey Geoff Ford,

cheers for the tutorial!

Great!

I just modified a bit you beforeFilter function in the AppController
to basically allow access to all controllers during development with
ease!

-
function beforeFilter(){
if (isset($this->Auth)) {
  $this->Auth->userScope = array('User.disabled' => 0);
  $this->Auth->loginAction = '/users/login';
  $this->Auth->loginRedirect = '/users/account';
  $this->Auth->fields = array('username' => 'username',
'password' => 'passwrd');
  $this->Auth->authorize = 'actions';

  if(!$this->inDev){
  if (in_array(low($this->params['controller']), $this-
>publicControllers)) {

  $this->Auth->allow();
  }
  }
  else{
  $this->Auth->allow('*');
  }
}
}
-

Then in your App controller you set:

var $inDev = true; //true if your are in development phase / false if
the app is live


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Paginating the results after creating a dummy model to filter HABTM results?

2007-07-20 Thread cakeFreak

I have a similar problem:

I have a Tag model that has a HABM association with Post and Photos.

I wanna to retrieve 2 separate pagination results for the records for
a given Tag, iin order to display the reults with 2 pagination blocks
via Ajax on the same page.

I'm trying to call 2 separate functions via Ajax:

- 1 for retrieving the Posts  for the given Tag
- 1 for retrieving the Phots for the given Tag

Which conditions should I pass to my paginate() function?


cheers

Dan


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Intermittently no-response to ajax request

2007-07-20 Thread francky06l

Can you spot an action where this problem happen ? I mean does that
happen randomly on different action ?
Did you also check the Apache log ?

On Jul 20, 5:47 am, cdomigan <[EMAIL PROTECTED]> wrote:
> Greetings!
>
> I'm having an intermittent problem (ie very difficult to debug :-)
> with CakePHP seemingly not returning anything in response to a
> request.
>
> My app is largely ajax-driven. About 1 in 20 times, when an ajax
> request is made there is no response received from the server, and
> Firebug just displays "Loading...". This is happening both on my dev
> localhost box (Windows) and my live box (Linux).
>
> Part of the frustration is not knowing if this is a CakePHP problem,
> an Apache problem, or something else. Has anyone else encountered a
> problem like this and are there any pointers as to where one might
> start in debugging such an issue?
>
> Thanks in advance,
>
> Chris


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---