Re: Formatar a mensagem - $this->Session->setFlash(__('minha msg'));

2013-04-22 Thread Tony Messias
Seguinte, o método setFlash aceita 4 parâmetros: 1) String da mensagem; 2) *
element* que será usado; 3) array de parâmetros; e 4) índice da mensagem na
sessão;

Vejo pelo menos três formas de você fazer isso:

   1. Criando um *element* para cada tipo de mensage;
   2. Com apenas um *element* e passando a *class* "good/bad" para mudar o
   estilo de exibição;
   3. Usar índices diferentes e, com isso, você pode colocar em div's
   diferentes.

Lembro que uma vez tive o mesmo problema e escolhi usar um *element* só
passando a *class*, deu certo pra mim.

Se ainda tiver dúvida, pode perguntar.

Att,


--

Luiz Antonio S Messias
Desenvolvedor Web

<http://twitter.com/tonyzrp>
@tonyzrp <http://twitter.com/tonyzrp>
*LinkedIn* <http://www.linkedin.com/in/luizantoniosmessias>


2013/4/22 Anderson Moraes 

> Tony, obrigado pela resposta.
>
> Não entendi muito bem como por em prática o que vc me passou, eu tenho que
> criar um estilo para cada tipo de mensagem (bad / good)???
>
>
>
> Em segunda-feira, 22 de abril de 2013 17h17min15s UTC-3, Anderson Moraes
> escreveu:
>
>>  Boa tarde pessoal,
>>
>> Então, na página default.ctp eu tenho a seguinte linha: > $this->Session->flash(); ?>
>> Quando uma mensagem é setada é essa linha que exibe, correto?
>>
>> Então se eu tenho uma mensagem de sucesso: $this->Session->setFlash(__('*
>> *Usuário cadastrado com sucesso.')); eu gostaria que o background-color
>> da minha mensagem fosse verde e só exibisse o vermelho em casos onde a
>> mensagem tenha uma relação negativa, ex.: 
>> $this->Session->setFlash(__('**Usuário
>> ou senha inválidos.'));
>>
>> o CakePHP 2.x tem alguma forma de informar qual "style" usuar na
>> mensagem???
>>
>> Grato desde já,
>>
>> Anderson
>>
>  --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to cake-php+unsubscr...@googlegroups.com.
> To post to this group, send email to cake-php@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

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




Re: Formatar a mensagem - $this->Session->setFlash(__('minha msg'));

2013-04-22 Thread Tony Messias
Tem isso aqui:

http://book.cakephp.org/2.0/en/core-libraries/components/sessions.html#creating-notification-messages

Att,


--

Luiz Antonio S Messias
Desenvolvedor Web


@tonyzrp 
*LinkedIn* 


2013/4/22 Anderson Moraes 

>  Boa tarde pessoal,
>
> Então, na página default.ctp eu tenho a seguinte linha:  $this->Session->flash(); ?>
> Quando uma mensagem é setada é essa linha que exibe, correto?
>
> Então se eu tenho uma mensagem de sucesso:
> $this->Session->setFlash(__('Usuário cadastrado com sucesso.')); eu
> gostaria que o background-color da minha mensagem fosse verde e só exibisse
> o vermelho em casos onde a mensagem tenha uma relação negativa, ex.:
> $this->Session->setFlash(__('Usuário ou senha inválidos.'));
>
> o CakePHP 2.x tem alguma forma de informar qual "style" usuar na
> mensagem???
>
> Grato desde já,
>
> Anderson
>
> --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to cake-php+unsubscr...@googlegroups.com.
> To post to this group, send email to cake-php@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

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




Re: Image Upload

2013-03-01 Thread Tony Messias
See this:

http://book.cakephp.org/2.0/en/core-libraries/helpers/form.html#FormHelper::file

Att,


--

Luiz Antonio S Messias
Desenvolvedor Web


@tonyzrp 
*LinkedIn* 


On 1 March 2013 13:56, Steven Scaffidi  wrote:

> Hi I'm trying to create an image upload form in CakePHP. How do I do this
> without a plugin? Is there a simple way? I don't need any validation or
> advanced functionality - just looking for the simplest method. Any
> suggestions?
>
> I have a table with 7 fields. 1 of them is the photo field.
>
> Thanks,
>
> Steven
>
> --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to cake-php+unsubscr...@googlegroups.com.
> To post to this group, send email to cake-php@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

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




Re: Best way to retriving api and webservice data

2013-02-25 Thread Tony Messias
Look the 1.3 example (twitter):

http://book.cakephp.org/1.3/en/The-Manual/Developing-with-CakePHP/DataSources.html#an-example

and the 2.x:

http://book.cakephp.org/2.0/en/models/datasources.html#an-example

You'll basically use HttpSocket to "talk" to the webserver, see:

http://book.cakephp.org/2.0/en/core-utility-libraries/httpsocket.html#httpsocket

Att,


--

Luiz Antonio S Messias
Desenvolvedor Web

<http://twitter.com/tonyzrp>
@tonyzrp <http://twitter.com/tonyzrp>
*LinkedIn* <http://www.linkedin.com/in/luizantoniosmessias>


On 25 February 2013 06:54, Mathias R  wrote:

> Hi,
>
> thx for your answer. I read about datasources too but i don't know how to
> work with.
> i want to access data from xml-, json- and/or soap-webservices.
>
> M.
>
> Am Montag, 25. Februar 2013 04:04:35 UTC+1 schrieb Tony:
>>
>> I've never used (and I would like to), but I believe it would be the case
>> of using/creating *DataSources:*
>> *
>> *
>> http://book.cakephp.org/2.0/**en/models/datasources.html<http://book.cakephp.org/2.0/en/models/datasources.html>
>> *
>> *
>>
>> Att,
>>
>>
>> --
>>
>> Luiz Antonio S Messias
>> Desenvolvedor Web
>>
>> <http://twitter.com/tonyzrp>
>> @tonyzrp <http://twitter.com/tonyzrp>
>> *LinkedIn* <http://www.linkedin.com/in/luizantoniosmessias>
>>
>>
>> On 24 February 2013 17:23, Mathias R  wrote:
>>
>>>  Hi,
>>>
>>> i'm creating an app which is need to get data from multiple api sources.
>>> fo each source i wan't to create an own plugin. That's my idea.
>>>
>>> which way is the best to access an api or webservice?
>>> Creating a Model without table and access webservice with it's methods?
>>>
>>> hope u understand my terrible english ;)
>>>
>>> Greetings
>>>
>>> M.
>>>
>>> --
>>> Like Us on FaceBook 
>>> https://www.facebook.com/**CakePHP<https://www.facebook.com/CakePHP>
>>> Find us on Twitter http://twitter.com/CakePHP
>>>
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "CakePHP" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to cake-php+u...@**googlegroups.com.
>>> To post to this group, send email to cake...@googlegroups.com.
>>>
>>> Visit this group at 
>>> http://groups.google.com/**group/cake-php?hl=en<http://groups.google.com/group/cake-php?hl=en>
>>> .
>>> For more options, visit 
>>> https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out>
>>> .
>>>
>>>
>>>
>>
>>  --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to cake-php+unsubscr...@googlegroups.com.
> To post to this group, send email to cake-php@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

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




Re: Best way to retriving api and webservice data

2013-02-24 Thread Tony Messias
I've never used (and I would like to), but I believe it would be the case
of using/creating *DataSources:*
*
*
http://book.cakephp.org/2.0/en/models/datasources.html*
*

Att,


--

Luiz Antonio S Messias
Desenvolvedor Web


@tonyzrp 
*LinkedIn* 


On 24 February 2013 17:23, Mathias R  wrote:

> Hi,
>
> i'm creating an app which is need to get data from multiple api sources.
> fo each source i wan't to create an own plugin. That's my idea.
>
> which way is the best to access an api or webservice?
> Creating a Model without table and access webservice with it's methods?
>
> hope u understand my terrible english ;)
>
> Greetings
> M.
>
> --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to cake-php+unsubscr...@googlegroups.com.
> To post to this group, send email to cake-php@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

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




Re: Multi Tenancy / SaaS

2013-02-03 Thread Tony Messias
Well, I believe it's possible to get the authenticated user from anywhere
using the AuthComponent::user() static method (cake 2.x). I tried it here,
and it worked.. but I couldn't test it using TDD, I found it veeery hard..
Could anyone help? How can I test a model that depends on a logged user? Is
it right (this kind of dependency)?


--

Luiz Antonio S Messias
Desenvolvedor Web


@tonyzrp 
*LinkedIn* 


On 1 February 2013 19:46, Andrew Wilson  wrote:

> I've got the same issue on a project I'm working on.  Any solutions you
> came up with Dylan?
>
>
> On Monday, August 6, 2012 4:02:15 PM UTC-6, Dylan Jennings wrote:
>>
>> Hello
>>
>> I'm currently building a SaaS application using cakePHP. I've worked with
>> cakePHP before a few times and I'm comfortable with how it all works.
>>
>> So, I have an `accounts` table which holds information about each tenant,
>> and then a `users` table aswell, which will contain the users for each
>> account/tenant. New users will initially be added through a basic plain PHP
>> or WordPress front-end, so there won't be the need to create new `accounts`
>> through the cakePHP side of the app.
>>
>> Just to be clear, each tenant will be on a subdomain of the main domain.
>> For example, http://dylan.mycakeapp.dev/ could be a tenant. The
>> front-end site will be held in the root of the site,
>> http://mycakeapp.dev/. When new users sign up on the front-end site,
>> their `accounts` record and a single `users` record will be created, they
>> will get redirected to their subdomain, and the cakePHP app will take it
>> from there.
>>
>> So here's the problem. I want all tenants to share the same database,
>> separated by an 'account_id' which will be in all tables. I'm not 100% on
>> this, but I think the correct approach is to use the 'beforeSave',
>> 'beforeDelete' and 'beforeFind' callbacks in the model, and simply add the
>> `account_id` as a query condition. The problem comes when I'm trying to
>> detect which tenant to use, because I can't use the database within the
>> model.
>>
>> Does anyone have any experience with SaaS/multi-tenancy apps in cakePHP,
>> and can help? Thanks in advance.
>>
>> Cheers
>>
>  --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to cake-php+unsubscr...@googlegroups.com.
> To post to this group, send email to cake-php@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

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




Re: Adding multple records through REST XML web services

2012-11-28 Thread Tony Messias
You have to parse the XML to Cake's pattern and then you can use saveMany,
for example.
http://book.cakephp.org/2.0/en/models/saving-your-data.html#model-savemany-array-data-null-array-options-array

Att,


--

Luiz Antonio S Messias
Desenvolvedor Web


@tonyzrp 
*LinkedIn* 



On 28 November 2012 04:18, Sam  wrote:

> Dear CakePHP experts,
>
> I have an add() record function that is used as a REST web service via
> XML. The code is very simple. Something like below;
>
> $this->Object->create();
> $this->Object->save($this->request->data);
>
> The limitation is that this function can only add one record at a time.
> What I want is to add multiple records at one time. The XML file can
> contain multiple records. So, I would like the function to be able to add
> multiple records via REST XML. May I know if CakePHP can be made to do this?
>
>  I tried googling for a solution but could not find any. Can the experts
> here advise or provide some hints on how to start?
>
> Thank you very much
>
> --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com.
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>
>
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

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




Re: One slug route connected to multiple controllers?

2012-08-30 Thread Tony Messias
If you use different constants on your slug, like "Dis*Person*IsKewl " or
"TehEpic*Startup*", I think you can do it with regular expression.

e.g.  https://gist.github.com/3526814

Well, I think it could work. If the slug match with the first regular
expression, it will call the StartupsController... if it doesn't, it will
check the second expression... if it match, the controller called will be
the PeopleController.

I don't know if the regular expressions I used are correct, it was just an
example.

Att,

--

Luiz Antonio S Messias
Desenvolvedor Web


@tonyzrp 
*LinkedIn* 



2012/8/30 42startups 

> Hi
>
> So I have two controllers: Startups and People
>
> But I'd like a direct slug to link to either.
>
> eg:
> domain.com/TehEpicStartup - should go to startups->view
> domain.com/DisPersonIsKewl - should go to people->view
>
> Is there an easy option here, or do I need to create a separate
> controller, or should I just go with the default
> domain.com/startups/TehEpicStartup and domain/people/DisPersonIsKewl ??
>
> In routes.php:
>
>  Router::connect(
>> '/:slug',
>> array(
>> 'controller' => 'startups',
>> 'action' => 'view'
>> ),
>> array(
>>  'slug' => '[a-zA-Z0-9_-]+'
>> )
>> );
>
>
>
> Cheers!
>
> --
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com.
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
>
>
>

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




Re: Cakephp with Extjs

2012-07-13 Thread Tony Messias
Well, I think it might help you: http://banchaproject.org/

In case you don't want to use this project, you could simply use the extjs
way of development with a folder in it named "php", where you'll have the
cakephp inside. Then, on your Stores (extjs), you point to
"php/:Controller/:action.json". I mean, use the cakephp as an API, without
views. Your app folder should look like this:

[image: Imagem inline 1]

And your stores should look like this:

https://gist.github.com/3105016

I don't know if it's the best way, but it should work.

Hope it helps.
Att,

--

Luiz Antonio S Messias
Desenvolvedor Web


@tonyzrp 
*LinkedIn* 



2012/7/13 Mr. Manager 

> Hi all,
>
> anyone know how to get and use extjs, especially integrate with cakephp.
>
> I am looking forward to hearing a good news as soon as possible.
>
> Best Regard,
> Mr, Manager,
>
>  --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php
<>

Is CakePHP 2.x support firebird database

2012-06-26 Thread tony
If yes, how to connect to firebird database?

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Recover associated data of second level.

2012-05-12 Thread Tony Messias
What about the "recursive" param on your params array?

http://book.cakephp.org/2.0/en/models/retrieving-your-data.html#find

i.e:
$this->User->find('all', array('recursive' => 2));

--

Luiz Antonio S Messias
Desenvolvedor Web


@tonyzrp 
*LinkedIn* 



2012/5/12 J. 

> To Be more precise I have :
>
> User hasOne Profile
> Profile belongsTo USer
>
> Profile HABTM Card
> Card HABTM Profile
>
> Since profile belongs to User, How can I get its associated data (CArd)
> from the USer view ?
>
>
>
> Le samedi 12 mai 2012 16:25:48 UTC+2, J. a écrit :
>
>> Hi,
>>
>> In my cake app I have :
>>
>> User hasOne Profile HasAndBelongsToMany Card
>>
>> When I find a user, I get this array :
>>
>> array(
>>> 'User' => array(
>>> 'password' => '*',
>>> 'id' => '1',
>>> 'email' => '***',
>>> 'username' => '**',
>>> ),
>>> 'Profile' => array(
>>> 'id' => '1',
>>> 'user_id' => '1',
>>> 'background' => 'galaxy.png',
>>> 'modified' => '2012-05-12 15:09:59'
>>> )
>>> )
>>>
>>>
>> When I find a profile I got this array :
>>
>> array(
>>  'Profile' => array(
>>  'id' => '1',
>>  'user_id' => '1',
>>  'background' => 'http://pierrebozon.com/**galaxy.png 
>> ',
>>  'modified' => '2012-05-12 15:09:59'
>>  ),
>>  'User' => array(
>>  'password' => '*',
>>  'id' => '1',
>>  'username' => '*',
>>  'created' => '2012-05-08 00:00:00'
>>  ),
>>  'Card' => array(
>>  (int) 0 => array(
>>  'id' => '1',
>>  'label' => '',
>>  'LicensesProfile' => array(
>>  'id' => '1',
>>  'profile_id' => '1',
>>  'Card_id' => '1'
>>  )
>>  )
>>  )
>>
>>
>>
>>> )
>>
>>
>>
>> How can I get Card info from the User view ? I mean something like this :
>>
>>  array(
>>
>>
>>  'User' => array(
>>  'password' => '*',
>>  'id' => '1',
>>  'email' => '***',
>>  'username' => '**',
>>  ),
>>  'Profile' => array(
>>  'id' => '1',
>>  'user_id' => '1',
>>  'background' => 'galaxy.png',
>>  'modified' => '2012-05-12 15:09:59'
>>  'Card' => array(
>>
>>
>>  'id' => '1 ' etc
>>
>>
>>  )
>>
>>
>>   )
>> )
>>
>>
>> Thanks a lot !
>>
>>  --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Send email Shell Application

2012-05-02 Thread Tony Presnow
I recently upgraded from cakephp 2.0.6 to 2.1.1 and started having problem 
sending out nightly emails. I'm getting smtp connection time out errors. 
Nothing has changed on the email server, and emails generated from website 
forms are still working ... Is it possible that the connection is being 
dropped because of the malformed message id?  
http://cakephp.lighthouseapp.com/projects/42648/tickets/2698-cakeemail-messageid-in-cli-environment
 

If so, how do I go about fixing this issue? 

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Flash message after render not showing

2012-02-06 Thread Tony
I'm a dufus.

I didn't realize that $this->Session->flash() had been commented out
of the view.

When I did debug($this->Session->read()) in the view, I noticed that
the value was set, so that sent me on the right path.

Sorry for the bother. Thanks for the reply.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Flash message after render not showing

2012-02-05 Thread Tony
In my code (CakePHP v2.0.5) , I am doing the following:

public function invite() {
...
$this->Session->setFlash(__('The invitation has 
been created.'));

$this->set('email',$this->request->data['Invite']['email']);
$this->render('welcome');
...
}

The problem is that when "welcome" is rendered, the flash message is
not showing up until the user goes to the page following the content
rendered by the "invite" action.

In other words, the user submits their information and gets the
"welcome" content, they don't see the flash message. When the user
clicks on a link and goes to the next page, the 'The invitation has
been created.' flash message appears.

Both the welcome content and the page they go to after use the same
layout that uses the "echo $this->Session->flash();" code.

Thanks.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Help with CakePHP-LinkedIn Plugin

2012-01-17 Thread Tony Smith
Good day.

I am trying to do some basic LinkedIn integration and am having a lot
of trouble with the CakePHP-LinkedIn plugin.

For the moment, I would just like to add an action to my
UsersController that dumps my LinkedIn profile. Nothing fancy, just a
basic print_r of the information received back from LinkedIn when I
browse to /users/linkedin .

For some reason, I am just not understanding the plugin process. I've
never used them before and I am getting a number of different errors
when I try different things.

So far, I copied the following plugins into place:

LinkedIn into app/Plugins/linkedin
HttpSocketOauth plugin (ProLoser fork) to app/Plugins/
http_socket_oauth
Apis plugin to app/Plugins/apis

In app/Config/database.php, I've added the following:

var $linkedin = array(
'datasource' => 'Apis.Apis',
'driver' => 'Linkedin.Linkedin',
'login' => '_redacted_',
'password' => '_redacted_',
);

Now I get lost ... I'm not sure what needs to happen end up with a
"linkedin" method to my Users controller. I've tried a bunch of
different things, but it like taking shots in the dark.

Should I be setting up a new model and controller in app/Models and
app/Controllers?
Do I just need to load the plugins via 'CakePlugin::loadAll();' in
bootstrap and then put something in the Users controller to access
them?

Some errors that I have gotten:

Datasource class Apis.Apis could not be found.
Fatal error: Cannot redeclare class...

Any pointers would be appreciated.

Thanks.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Confusion with model, belongsTo, and conditions

2011-05-20 Thread Tony
I have what I think is a simple model and I am trying to apply some
conditions, but it appears that the conditions are being ignored.

Here is a simplified version of the models (that is, I left out some
lines for brevity):

Model 1 - Query:
---
class Query extends AppModel {

var $name = 'Query';
var $belongsTo = array(
'Industry' => array(
'className' => 'Industry',
'conditions' => array('Industry.code' => '11')
)
);

}
---
Note that, if it matters, the code is defined in the DB as a VARCHAR.

Model 2 - Industry:
---
class Industry extends AppModel {

var $hasMany = array(
'Query' => array(
'dependent' => true
)
);

}
---

When I do the following in a controller, I get ALL rows, not just the
rows filtered by the condition:

$industries = $this->Query->Industry->find('list');

Am I doing something wrong?

Thanks.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


How to make random user names out of list of a list of names in a text file, I can not complete my php script

2011-01-25 Thread Tony
Hi;
I am not expert in php and trying to make a php script for making
random user names from a list of first names in a text file and write
it to a new text file, I got some simple php code but I am not sure
how to proceed,


I am very grateful if anyone can help here.,

I have a list of first names in a text file, one name per line, the
list has been copied from a excel column,
now I want the script to read the text file and then add random number
and characters ( max of 5) after the name separated by a underscore or
hyphen then print the new made user names into a new text file
organized the same way the first name file is, one user name per line.


e.g of first name text file:
SAM
David
bob
and then the example of new user names becomes similarly like this:
SAM_6yt66
David_23rt
bob-44uyt
here is what I could get so far:



-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Multiple tables output at one View

2010-08-14 Thread tony mak
I have just learnt cakephp.
If I do not misunderstand the tutorial, one model represents one table
in database and each controller controls one model which means one
table. And one view for one controller to layout the webpage.
Then, if my view(webpage) need to have data from more than one table,
what should  I do?

-
btw, I bake tha cake(blog ) which is  the exmaple of the offical
doucment.
However, the output seems to be in debug mode which including the
query table.
How can I see the actual view of my webpage?


THX

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

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


Re: Complex find() using Oracle

2010-02-18 Thread Tony Fugere
Do I post those here? If so, here goes... I only have time for a quick test
case

/**
 * test that fields() will accept objects made from DboSource::expression
 *
 * @return void
 */
function testFieldsWithExpression() {
$expression =&
$this->testDb->expression("SUM(DECODE(SUBSTR(Sample.id,1), '1', 1, 0)) AS
\"Sample.case_col\"");
$result = $this->testDb->fields($this->Model, null, array("id",
$expression));
$expected = array(
'`TestModel`.`id`',
"SUM(DECODE(SUBSTR(Sample.id,1), '1', 1, 0)) AS
\"Sample.case_col\""
);
$this->assertEqual($result, $expected);
}

One could argue that I shouldn't be using DECODE anyways as it is Oracle SQL
specific. If this app were to change databases, I would have to rewrite a
lot of custom fields that don't have cross-platform SQL. Is that a valid
argument IYO?

On Thu, Feb 18, 2010 at 1:51 PM, Martin Radosta wrote:

>  I would only change:
>
> $this->find('all', array('fields' => $fields,...etc, etc.)
>
> Would be great if you post the test case (or even better, a patch) to avoid
> other people waste time with the same issue.
>
> Bye
>
> MARTIN
>
>
>
>
> On 02/18/2010 05:39 PM, Tony Fugere wrote:
>
> It does not fix the problem. Am I doing it correctly?
>
> $dbo = $this->getDataSource();
> $expression =
> $dbo->expression('SUM(DECODE(SUBSTR(ServiceData.stat_parameter,22),
> \'service1\',
> ServiceData.stat_value,0)) AS "ServiceData.service1"');
> $fields = array('ServiceData.stat_date',
>  $expression);
> $this->find('all', array($fields,...etc, etc.)
>
> Still results in the ugly data.
>
> HOWEVER, I did notice the use of CASE WHEN statements in the test case. So,
> I switched my DECODE to CASE WHEN and it works as expected. I will draw up a
> test case and report the issue of DECODE failing to function properly.
>
> Thanks for your help Martin!
>
> -Tony
>
> On Thu, Feb 18, 2010 at 11:40 AM, Martin Radosta 
> wrote:
>
>> Check the text case in this commit for an example:
>>
>>
>> http://github.com/cakephp/cakephp1x/commit/02330b2d9c292110240c606e976e182c973897e9
>>
>> let me know if that fix the problem, if not, you can prepare a test case
>> and report the issue.
>>
>>
>>
>>
>> On 02/18/2010 03:21 PM, TonyFugere wrote:
>>
>>> I don't follow what you mean by "Try using expression for fields." Can
>>> you clarify or give me an example?
>>>
>>> On Feb 18, 11:12 am, Martin Radosta  wrote:
>>>
>>>
>>>> CakePhp is not correctly parsing the alias for the decode fields, thats
>>>> why you see decode... on array keys.
>>>> Try using expression for fields. If that works, should also fix the data
>>>> missmatch.
>>>>
>>>> Regards
>>>>
>>>> MARTIN
>>>>
>>>> On 02/18/2010 02:38 PM, TonyFugere wrote:
>>>>
>>>>
>>>>
>>>>> I've search this group and Google for a solution without any luck.
>>>>>
>>>>>
>>>>
>>>>
>>>>> I can read (SELECT) data, but cannot change this database at all. To
>>>>> get the data I run the following find:
>>>>>
>>>>>
>>>>
>>>>
>>>>> $this->find('all',
>>>>>array(
>>>>>  'fields' =>array(
>>>>>'ServiceData.stat_date',
>>>>>'SUBSTR(ServiceData.stat_parameter,1,4) AS
>>>>> "ServiceData.schema"',
>>>>>'SUBSTR(ServiceData.stat_parameter,19,2) AS
>>>>> "ServiceData.state"',
>>>>>'SUM(DECODE(SUBSTR(ServiceData.stat_parameter,22), \'service1\',
>>>>> ServiceData.stat_value,0)) AS "ServiceData.service1"',
>>>>>'SUM(DECODE(SUBSTR(ServiceData.stat_parameter,22), \'service2\',
>>>>> ServiceData.stat_value,0)) AS "ServiceData.service2"',
>>>>>'SUM(DECODE(SUBSTR(ServiceData.stat_parameter,22), \'service3\',
>>>>> ServiceData.stat_value,0)) AS "ServiceData.service3"',
>>>>>'SUM(DECODE(SUBSTR(ServiceData.stat_parameter,22), \'service4\',
&

Re: Complex find() using Oracle

2010-02-18 Thread Tony Fugere
It does not fix the problem. Am I doing it correctly?

$dbo = $this->getDataSource();
$expression =
$dbo->expression('SUM(DECODE(SUBSTR(ServiceData.stat_parameter,22),
\'service1\',
ServiceData.stat_value,0)) AS "ServiceData.service1"');
$fields = array('ServiceData.stat_date',
 $expression);
$this->find('all', array($fields,...etc, etc.)

Still results in the ugly data.

HOWEVER, I did notice the use of CASE WHEN statements in the test case. So,
I switched my DECODE to CASE WHEN and it works as expected. I will draw up a
test case and report the issue of DECODE failing to function properly.

Thanks for your help Martin!

-Tony

On Thu, Feb 18, 2010 at 11:40 AM, Martin Radosta wrote:

> Check the text case in this commit for an example:
>
>
> http://github.com/cakephp/cakephp1x/commit/02330b2d9c292110240c606e976e182c973897e9
>
> let me know if that fix the problem, if not, you can prepare a test case
> and report the issue.
>
>
>
>
> On 02/18/2010 03:21 PM, TonyFugere wrote:
>
>> I don't follow what you mean by "Try using expression for fields." Can
>> you clarify or give me an example?
>>
>> On Feb 18, 11:12 am, Martin Radosta  wrote:
>>
>>
>>> CakePhp is not correctly parsing the alias for the decode fields, thats
>>> why you see decode... on array keys.
>>> Try using expression for fields. If that works, should also fix the data
>>> missmatch.
>>>
>>> Regards
>>>
>>> MARTIN
>>>
>>> On 02/18/2010 02:38 PM, TonyFugere wrote:
>>>
>>>
>>>
>>>> I've search this group and Google for a solution without any luck.
>>>>
>>>>
>>>
>>>
>>>> I can read (SELECT) data, but cannot change this database at all. To
>>>> get the data I run the following find:
>>>>
>>>>
>>>
>>>
>>>> $this->find('all',
>>>>array(
>>>>  'fields' =>array(
>>>>'ServiceData.stat_date',
>>>>'SUBSTR(ServiceData.stat_parameter,1,4) AS
>>>> "ServiceData.schema"',
>>>>'SUBSTR(ServiceData.stat_parameter,19,2) AS
>>>> "ServiceData.state"',
>>>>'SUM(DECODE(SUBSTR(ServiceData.stat_parameter,22), \'service1\',
>>>> ServiceData.stat_value,0)) AS "ServiceData.service1"',
>>>>'SUM(DECODE(SUBSTR(ServiceData.stat_parameter,22), \'service2\',
>>>> ServiceData.stat_value,0)) AS "ServiceData.service2"',
>>>>'SUM(DECODE(SUBSTR(ServiceData.stat_parameter,22), \'service3\',
>>>> ServiceData.stat_value,0)) AS "ServiceData.service3"',
>>>>'SUM(DECODE(SUBSTR(ServiceData.stat_parameter,22), \'service4\',
>>>> ServiceData.stat_value,0)) AS "ServiceData.service4"',
>>>>'SUM(DECODE(SUBSTR(ServiceData.stat_parameter,22), \'service5\',
>>>> ServiceData.stat_value,0)) AS "ServiceData.service5"',
>>>>'SUM(DECODE(SUBSTR(ServiceData.stat_parameter,22), \'service6\',
>>>> ServiceData.stat_value,0)) AS "ServiceData.service6"',
>>>>'SUM(DECODE(SUBSTR(ServiceData.stat_parameter,22), \'service7\',
>>>> ServiceData.stat_value,0)) AS "ServiceData.service7"',
>>>>'SUM(DECODE(SUBSTR(ServiceData.stat_parameter,22), \'service8\',
>>>> ServiceData.stat_value,0)) AS "ServiceData.service8"'
>>>>  ),
>>>>  'conditions' =>array(
>>>>'SUBSTR(ServiceData.stat_parameter, 5, 13)' =>
>>>> 'customer_lookup',
>>>>'SUBSTR(ServiceData.stat_parameter, 1, 4)' =>$active_schema,
>>>>'ServiceData.stat_server LIKE' =>'PRODUCTION%',
>>>>'ServiceData.stat#' =>999,
>>>>'ServiceData.stat_date' =>$load_date,
>>>>  ),
>>>>  'group' =>array(
>>>>'ServiceData.stat_date',
>>>>'SUBSTR(ServiceData.stat_parameter,1,4)',
>>>>'SUBSTR(ServiceData.stat_parameter,19,2)'
>>>>  ),
>>>>  &#

Re: Redirect After Using render('action')

2009-09-25 Thread Tony Thomas

Thanks Brian,

I thought that might be the case.

On Sep 24, 7:30 pm, brian  wrote:
> Whether Cake spits out a CSV file or redirects to another
> controller/action, headers need to be sent to the client, but you
> can't send headers for both simultaneously.
>
> If you really want the form to disappear, use JS to submit the form
> using AJAX and hide/change certain elements of the page.
>
> On Thu, Sep 24, 2009 at 3:17 PM, Tony Thomas  wrote:
>
> > I have a controller function that's using $this->render('action') to
> > render a view that creates a CSV file after submitting some info in a
> > form.
>
> > What I want to do is redirect the user after the CSV file is
> > downloaded. So the steps would be:
>
> > 1. User submits data.
> > 2. Queries are run and a CSV file is rendered and saved by the user.
> > 3. Controller redirects to another view.
>
> > If I do a simple redirect using $this->redirect('controller/action'),
> > the CSV file is not rendered, even though render() is called first. If
> > I don't redirect, the CSV is successfully rendered, but the user is
> > left with a form that is still filled-in. I'd like to redirect to
> > another view and display a "Success" flash message once the CSV is
> > rendered.
>
> > Any tips?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Redirect After Using render('action')

2009-09-24 Thread Tony Thomas

I have a controller function that's using $this->render('action') to
render a view that creates a CSV file after submitting some info in a
form.

What I want to do is redirect the user after the CSV file is
downloaded. So the steps would be:

1. User submits data.
2. Queries are run and a CSV file is rendered and saved by the user.
3. Controller redirects to another view.

If I do a simple redirect using $this->redirect('controller/action'),
the CSV file is not rendered, even though render() is called first. If
I don't redirect, the CSV is successfully rendered, but the user is
left with a form that is still filled-in. I'd like to redirect to
another view and display a "Success" flash message once the CSV is
rendered.

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



Re: Ajax Errors

2009-08-11 Thread Tony Thomas

I actually ending up using this:

http://deadlytechnology.com/scripts/javascript/ajax-failure-callback/

It sends a 403 server error back if the transaction doesn't validate
which triggers my error message in the view.

On Aug 11, 2:50 am, Saliem  wrote:
> I am not quite sure what you are missing but you might want to double
> check a couple of things including:
>
> the name of your aliquot model file,
> the validate variable in your aliquot model file and
> try using the validationErrors method available for each of the models
> created and returning any errors as json
>
> please see :
>
> http://book.cakephp.org/view/410/Validating-Data-from-the-Controller
>
> On Aug 10, 3:42 pm, Tony Thomas  wrote:
>
> > This is something that's so simple, I'm embarrassed to ask. But after
> > a few dozen Google searches, I'm going to swallow my pride and post my
> > question here.
>
> > I have a simple ajax function in my controller and I want it to return
> > an error is the request is not successful. For example:
>
> > function ajax_update_box($boxId, $aliquotIds){
> >         if ($this->RequestHandler->isAjax()) { // if the request is AJAX
> >                 if($aliquots = $this->Aliquot->validateMove($aliquotIds, 
> > $boxId))
> > { // make sure a slot is open in the box
> >                         foreach($aliquots as $aliquot_id => $position ) { 
> > // validateMove
> > returns an array
> >                                 if 
> > ($this->Aliquot->save($this->data['Aliquot'] =! true)) {
> >                                         Configure::write('debug', 0);
> >                                         $this->autoRender = false;
> >                                         exit('There was an error and some 
> > of the aliquots were not
> > moved.');
> >                                 }
> >                         }
>
> >                         echo $this->unstored();
>
> >                 } else { // this is where I want it to return an error.
> >                         Configure::write('debug', 0);
> >                         $this->autoRender = false;
> >                         exit('The move did not work. Check to see if the 
> > box is full.');
>
> >                 }
> >                 Configure::write('debug', 0);
> >                         $this->autoRender = false;
> >                         exit(0);
> >         }
>
> > }
>
> > If the request doesn't pass validation in my model, I want to display
> > an error message, but I can't seem to get that to work. Everything is
> > treated as success. What am I missing?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Ajax Errors

2009-08-10 Thread Tony Thomas

This is something that's so simple, I'm embarrassed to ask. But after
a few dozen Google searches, I'm going to swallow my pride and post my
question here.

I have a simple ajax function in my controller and I want it to return
an error is the request is not successful. For example:

function ajax_update_box($boxId, $aliquotIds){
if ($this->RequestHandler->isAjax()) { // if the request is AJAX
if($aliquots = $this->Aliquot->validateMove($aliquotIds, 
$boxId))
{ // make sure a slot is open in the box
foreach($aliquots as $aliquot_id => $position ) { // 
validateMove
returns an array
if ($this->Aliquot->save($this->data['Aliquot'] 
=! true)) {
Configure::write('debug', 0);
$this->autoRender = false;
exit('There was an error and some of 
the aliquots were not
moved.');
}
}

echo $this->unstored();

} else { // this is where I want it to return an error.
Configure::write('debug', 0);
$this->autoRender = false;
exit('The move did not work. Check to see if the box is 
full.');

}
Configure::write('debug', 0);
$this->autoRender = false;
exit(0);
}
}

If the request doesn't pass validation in my model, I want to display
an error message, but I can't seem to get that to work. Everything is
treated as success. What am I missing?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Create Dynamic Navigation Based On Tree Behavior

2009-07-29 Thread Tony Thomas

Thanks for this tip. It was exactly what I needed!

On Jul 26, 7:51 pm, brian  wrote:
> I used this:
>
> http://bakery.cakephp.org/articles/view/tree-helper-1
>
> My nav is an element with:
>
> 
>  echo $tree->generate(
>         $section_nodes,
>         array(
>                 'element' => 'sections/nav_node',
>                 'model' => 'Section'
>         )
> );
> ?>
> 
>
> And nav_node.ctp looks like:
>
> $tree->addItemAttribute('id', 'section_'.$data['Section']['id']);
>
> if ($depth == 0)
> {
>         $tree->addItemAttribute('class', 'Section HideMe');
>
> }
>
> if ($hasChildren)
> {
>         $tree->addItemAttribute('class', 'NavParent');
>
> }
>
> $is_current = (isset($section_node_id) && $section_node_id ==
> $data['Section']['id'])
>         ? ' class="Current"'
>         : null;
>
> echo ' rel="'.$data['Section']['id'].'"'.$is_current.'>'.$data['Section']['name'].'';
>
> On Sun, Jul 26, 2009 at 3:57 PM, Tony Thomas wrote:
>
> > I have a Pages table in my app with the following fields:
>
> > id
> > parent_id
> > lft
> > rght
> > title
> > body
> > created
> > modified
>
> > My model uses $actsAs = array('Tree')
>
> > All the data associations are correct and generatetreelist() returns
> > the appropriate values. What I'm looking for is a way to turn the tree
> > information into a nested list for dynamically built navigation. I
> > want new pages to appear in the menu when they are created, but I want
> > them to appear in the hierarchy according to where they fall in the
> > tree.
>
> > Does anyone have any tips for me?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Create Dynamic Navigation Based On Tree Behavior

2009-07-26 Thread Tony Thomas

I have a Pages table in my app with the following fields:

id
parent_id
lft
rght
title
body
created
modified

My model uses $actsAs = array('Tree')

All the data associations are correct and generatetreelist() returns
the appropriate values. What I'm looking for is a way to turn the tree
information into a nested list for dynamically built navigation. I
want new pages to appear in the menu when they are created, but I want
them to appear in the hierarchy according to where they fall in the
tree.

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



Re: Database Table not Found for a Model I haven't Created

2009-07-01 Thread Tony Bianco

@NegoBlack That worked! Thank you very much. I'm not sure I would have
figured that out.

I notice that CakePHP will query a database when the page loads
regardless of if you issue a find method on the database or not. Is
there a particular reason it does this and can you stop CakePHP from
doing that when you don't need it to do so in a controller action.

Thanks!

On Jul 1, 7:37 am, NegoBlack®  wrote:
> I think you must create the model Site and configure it to do not use
> a table like this:
>
> class Site extends AppModel {
>     var $useTable = false;
>
> }
>
> On Jun 30, 1:25 pm, Tony  wrote:
>
> > I'm running into a problem in getting this error:
> > Error:  Database table sites for model Site was not found.
>
> > I don't have a model for Sites because I don't even have a table for
> > it.
>
> > I have a Sites controller but in the $uses array it is using the model
> > "User".
>
> > Can anyone help me here.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Database Table not Found for a Model I haven't Created

2009-06-30 Thread Tony Bianco

I only have one model called "User" and one controller called
"Sites".

And is there a way to keep CakePHP from running a query unless asked
to? Isn't that useless overhead that you don't need to have happen?


On Jun 30, 10:55 am, brian  wrote:
> Check all of your models' associations. I think you probably have a
> Site model listed somewhere.
>
> On Tue, Jun 30, 2009 at 12:25 PM, Tony wrote:
>
> > I'm running into a problem in getting this error:
> > Error:  Database table sites for model Site was not found.
>
> > I don't have a model for Sites because I don't even have a table for
> > it.
>
> > I have a Sites controller but in the $uses array it is using the model
> > "User".
>
> > Can anyone help me here.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Database Table not Found for a Model I haven't Created

2009-06-30 Thread Tony

I'm running into a problem in getting this error:
Error:  Database table sites for model Site was not found.

I don't have a model for Sites because I don't even have a table for
it.

I have a Sites controller but in the $uses array it is using the model
"User".

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



Building a helper; Fatal error cake/libs/view/view.php on line 702

2009-03-24 Thread Tony Thomas

I want to build some options for use across several views, so a custom
HTML helper seems like the best option. However, I'm running into
problems. Here's the helper:

class PositionHelper extends AppHelper {
var $helpers = array('Html');
function getPositions() {
$yaxes = array('A','B','C','D','E','F','G','H','I');
$xaxes = array
('001','002','003','004','005','006','007','008','009');
$options = array();
foreach($yaxes as $y){
foreach($xaxes as $x) {
$options = array_pad($options,1, $y . ',' . $x);
}
}
return $this->output($form->input('position', array('options' =>
$options)));
}
}

This is an attempt to build a select list of options. Right now I get
this error when I try to use it:

Fatal error: [] operator not supported for strings in /path/cake/libs/
view/view.php on line 702

As you can see, I just want to build a list of options that can be
used in more than one view and not coded into each one. Am I just
approaching this the wrong way?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Mod_rewrite not working

2009-03-21 Thread Tony Thomas

I still don't know exactly what the problem was, but I downloaded a
new copy of cake and moved my models and controllers over and it
worked right away. Something must have happened when copying the files
over originally.

On Mar 21, 11:10 am, Tony Thomas  wrote:
> mod_rewrite is enabled. Like I mentioned, I can run another CakePHP
> app already using mod_rewrite with my current setup. It's only this
> brand new one that's behaving bizarrely.
>
> On Mar 20, 5:22 pm, Miles J  wrote:
>
> > Id first check your apache config files anyways, to make sure
> > mod_rewrite is enabled. If you are using vhosts, check those settings
> > also.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Mod_rewrite not working

2009-03-21 Thread Tony Thomas

mod_rewrite is enabled. Like I mentioned, I can run another CakePHP
app already using mod_rewrite with my current setup. It's only this
brand new one that's behaving bizarrely.

On Mar 20, 5:22 pm, Miles J  wrote:
> Id first check your apache config files anyways, to make sure
> mod_rewrite is enabled. If you are using vhosts, check those settings
> also.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Mod_rewrite not working

2009-03-20 Thread Tony Thomas

I'm starting up a fresh project in Cake, so I downloaded the latest
version, built my models and controllers using $scaffold, but the app
is acting like mod_rewrite is not working. The .htaccess files are all
there.

I'm running a local setup using MAMP on OS X.

The odd thing is that I have another CakePHP setup on this same
computer that functions just fine.

Here's what happens:

If I go to http://localhost:/project/pages I get an Apache 404
error.

If I go to http://localhost:/project/index.php/pages I get the
expected output but the paths to the css files in the head are all
wrong.

It's exactly like the .htaccess files aren't there or mod_rewrite
isn't on, except that my other local CakePHP project works just as
expected.

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



Retrieve Associated Count

2009-03-17 Thread Tony Thomas

I have a simple hasMany relationship set up with CakePHP and I want to
retrieve a couple of fields from the parent table based on the count
of the child.

The scenario: I have boxes that hold 81 aliquots each. (Each box is
9X9.) I want to retrieve the id and description from the boxes table
of boxes that have fewer than 81 aliquots to generate a list. In other
words, I want a list of boxes that are not full.

My models:

class Box extends AppModel {
var $name = 'Box';
var $hasMany = array('Aliquot');
var $belongsTo = 'Freezer';
}

class Aliquot extends AppModel
{
var $name = 'Aliquot';
var $belongsTo = array('Box','Specimen');
}

I can't seem to work out the best way to get a count of the aliquots
for each box. I haven't been working with CakePHP all that long, so
I'm hoping there's a relatively simple way to do this that I'm
missing. It doesn't seem like a very complicated thing to do, yet I've
spent the better part of my morning working on it with not success.
This seems like it would work:

http://book.cakephp.org/view/75/Saving-Your-Data#counterCache-Cache-your-count-490

Except that my tables are already populated, so creating the
aliquot_count field in my boxes table just leaves me with a bunch of
empty fields. Does anyone have some advice that will point me in the
right direction?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Redirect Loop

2009-03-14 Thread Tony Thomas

Since someone emailed me off the list to inquire about this, I thought
I'd post my fix for the problem for those who find this in the future.
Here's what I wrote in my email:

It turned out that I had moved some code in the layout that was trying
to check against Auth. I have this code in my app_controller.php file:

function beforeFilter(){
if ($role = $this->Auth->user('role')) {
$this->set('user_info', $this->Auth->user());
}
}

I check for that $user_info variable in the layout. I'm not sure
exactly what caused the problem but I'm pretty sure that was the root
of it. Here's what the layout has:

if (isset($user_info)) {

// display the username and some other info

}

I was modifying the layout and put that part of the code at the very
beginning. The effect was that the code was run before the page could
be rendered so that even when I went to log in, it was being checked,
thus trying to redirect me toward the login page. I think it went
something like this:

   1. I tried to access a page that was protected by Auth.
   2. I was redirected to the login page
   3. The login page tried to check for $user_info which wasn't set
because I hadn't logged in. Since it was checking before the page
rendered, it kept redirecting without ever rendering the page until
Firefox decided that it was an infinite loop (it was) and stopped
trying.


At least I think that's what was happening. As soon as I moved that
section down into a part of the page that would be run after the page
started to render, it solved my problem. It was bizarre. You wouldn't
think that modifying a layout would send the application into an
infinite loop. In retrospect it makes sense if my understanding of the
problem is correct. In any case, the problem was solved.

On Mar 11, 4:07 pm, Tony Thomas  wrote:
> I've been working on a local copy of my CakePHP app that runs on a my
> computer. Today I've only been working on a layout and the style
> sheet. I took a break and went back to it which prompted a new login.
> Suddenly I'm getting aredirectloop. Firefox gives me this following
> message:
>
> RedirectLoop
>
> Firefox has detected that the server is redirecting the request for
> this address in a way that will never complete.
>
> The browser has stopped trying to retrieve the requested item. The
> site is redirecting the request in a way that will never complete.
>
>     * Have you disabled or blocked cookies required by this site?
>     * NOTE: If accepting the site's cookies does not resolve the
> problem, it is likely a server configuration issue and not your
> computer.
>
> Any thoughts on what might cause that if I wasn't working in the a
> controller? More importantly, how do I fix it?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Redirect Loop

2009-03-11 Thread Tony Thomas

I've been working on a local copy of my CakePHP app that runs on a my
computer. Today I've only been working on a layout and the style
sheet. I took a break and went back to it which prompted a new login.
Suddenly I'm getting a redirect loop. Firefox gives me this following
message:

Redirect Loop

Firefox has detected that the server is redirecting the request for
this address in a way that will never complete.

The browser has stopped trying to retrieve the requested item. The
site is redirecting the request in a way that will never complete.

* Have you disabled or blocked cookies required by this site?
* NOTE: If accepting the site's cookies does not resolve the
problem, it is likely a server configuration issue and not your
computer.

Any thoughts on what might cause that if I wasn't working in the a
controller? More importantly, how do I fix it?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Best Way to Nest Lists w/ nestedList()

2009-03-11 Thread Tony Thomas

I'm trying to create navigation in CakePHP that uses this method with
CSS drop-downs:

http://www.webmonkey.com/tutorial/Add_CSS_Drop-Down_Menus

So, of course I want to leverage nestedList(), but since I have two
"levels" of nested lists, I'm getting unexpected results.

Here's what I want:

Main List Item 1
>>Secondary List Item 1
>>Secondary List Item 2
Tertiary List Item 1
Main List Item 2

Here's what I have set up at the moment:

$nav = $html->nestedList(
array(
$html->link('Main List Item 1', '#') => array(
$html->link('Secondary List Item 1', '/url/'),
array($html->link('Secondary List Item 2', '/url/') =>
array($html->link('Tertiary List Item 1', '/
url'))),
$html->link('Secondary List Item 2', '/url/'),
$html->link('Secondary List Item 3', '/visits/'),
),
$html->link('Main List Item 2', '#'),
$html->link('Main List Item 3', '#'))
This gets me close, but the result is this:

Main List Item 1
>>Secondary List Item 1
>>1
Secondary List Item 2 (winds up in the tertiary list)
Tertiary List Item 1
>>Secondary List Item 2
>>Secondary List Item 3
Main List Item 2
Main List Item 3

How can I set this up using nestedList so that the list is formatted
without the "1" above and with the secondary list item 2 in the proper
place? Or am I approaching this from the wrong angle altogether?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: "Undefined variable: javascript" when Javascript is absolutely loaded

2009-02-27 Thread Tony Thomas

This must be something unrelated to CakePHP. My local version
functions perfectly and now the production server doesn't give me the
non-object fatal error, but doesn't include my JavaScript either.
(BUT, at least the information is displayed, which is a start.)
There's something bizarre happening with the server.

On Feb 27, 1:51 pm, brian  wrote:
> On Fri, Feb 27, 2009 at 2:42 PM, Tony Thomas  wrote:
>
> > This problem just cropped up out of the blue for me. I made no changes
> > to the AppController where the helpers are defined. I can't figure it
> > out. TheJavaScriptfile in question is clearly in the HTML, but
> > everything is broken.
>
> What's broken? You're seeing the non-object fatal error?
>
> But, if thejavascriptlink is present (and the path is correct) are
> you just having JS issues?
>
> > I had made a simple change to a different controller that seemed to
> > precipitate the error, but commenting out the function in question has
> > no effect. Does anyone have any idea why this would seem to happen
> > spontaneously?
>
> Have you emptied your cache?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: "Undefined variable: javascript" when Javascript is absolutely loaded

2009-02-27 Thread Tony Thomas

I forgot to add that if I remove 'echo $javascript->link('js.js');'
nothing is rendered at all. Even if I hand code the link to the
JavaScript. It's truly bizarre and has broken my entire application.
On Friday afternoon no less. :-(

On Feb 27, 1:42 pm, Tony Thomas  wrote:
> This problem just cropped up out of the blue for me. I made no changes
> to the AppController where the helpers are defined. I can't figure it
> out. TheJavaScriptfile in question is clearly in the HTML, but
> everything is broken.
>
> I had made a simple change to a different controller that seemed to
> precipitate the error, but commenting out the function in question has
> no effect. Does anyone have any idea why this would seem to happen
> spontaneously?
>
> On Feb 4, 11:29 am, Stonk  wrote:
>
> > Maybe it will help someone in the future.
>
> > >Undefinedvariable:javascript[APP\views\layouts\default.ctp, line 8]
> > > Fatal error: Call to a member function link() on a non-object in 
> > > xy\default.ctp on line Y
>
> > If one helper can't be loaded (typo), no helper will be loaded. So if
> > it says "javascriptisundefined", it can be a typo anywhere in the
> > $helpers var.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: "Undefined variable: javascript" when Javascript is absolutely loaded

2009-02-27 Thread Tony Thomas

This problem just cropped up out of the blue for me. I made no changes
to the AppController where the helpers are defined. I can't figure it
out. The JavaScript file in question is clearly in the HTML, but
everything is broken.

I had made a simple change to a different controller that seemed to
precipitate the error, but commenting out the function in question has
no effect. Does anyone have any idea why this would seem to happen
spontaneously?

On Feb 4, 11:29 am, Stonk  wrote:
> Maybe it will help someone in the future.
>
> >Undefinedvariable:javascript[APP\views\layouts\default.ctp, line 8]
> > Fatal error: Call to a member function link() on a non-object in 
> > xy\default.ctp on line Y
>
> If one helper can't be loaded (typo), no helper will be loaded. So if
> it says "javascriptisundefined", it can be a typo anywhere in the
> $helpers var.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Odd Behavior with allow()

2009-02-13 Thread Tony Thomas

It was a routing issue. I managed to piece it together when the 'edit'
function of the same controller was acting bizarrely. Once I fixed the
routing, everything worked as expected.

On Feb 13, 1:13 pm, brian  wrote:
> This seems like a routing issue. What's the route you're using for this?
>
> And, are you certain that the both servers have an identical routes.php?
>
> On Fri, Feb 13, 2009 at 1:07 PM, Tony Thomas  wrote:
>
> > I moved my CakePHP app to a new server and everything is working fine
> > except the one area where I have to allow public access.
>
> > The controller I want to allow is 'report', so in the pertinent
> > controller, I have this:
>
> > function beforeFilter() {
> >                $this->Auth->allow('report');
> >        }
> > }
>
> > This worked fine on the previous server. However, on the new server,
> > when I try to access the URL in question, I'm sent to the login page.
>
> > Let's say my url is 'example.com/controller_name/report'
>
> > I'm immediately redirected to 'example.com/users/login'
>
> > But, if I go to 'example.com/Controller_Name/report', it works fine.
> > The only problem is that since the form on the page is built using
> > $form->create('ControllerName', array('action' => 'report')), the form
> > action winds up reverting to the CakePHP convention of
> > 'controller_name/action' rather than 'Controller_Name/action' and I'm
> > once again kicked out.
>
> > I'm sure there's probably something simple I'm missing that will
> > correct this, but I don't know where to start. Has anyone run into
> > this behavior before?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Odd Behavior with allow()

2009-02-13 Thread Tony Thomas

I moved my CakePHP app to a new server and everything is working fine
except the one area where I have to allow public access.

The controller I want to allow is 'report', so in the pertinent
controller, I have this:

function beforeFilter() {
$this->Auth->allow('report');
}
}

This worked fine on the previous server. However, on the new server,
when I try to access the URL in question, I'm sent to the login page.

Let's say my url is 'example.com/controller_name/report'

I'm immediately redirected to 'example.com/users/login'

But, if I go to 'example.com/Controller_Name/report', it works fine.
The only problem is that since the form on the page is built using
$form->create('ControllerName', array('action' => 'report')), the form
action winds up reverting to the CakePHP convention of
'controller_name/action' rather than 'Controller_Name/action' and I'm
once again kicked out.

I'm sure there's probably something simple I'm missing that will
correct this, but I don't know where to start. Has anyone run into
this behavior before?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Migrating to Media Temple DV Server - Path problem

2009-01-22 Thread Tony Thomas

Aha! After further investigation, the .htaccess from cake's root was
missing. Once I created that, all was fixed.

On Jan 22, 10:20 am, Tony Thomas  wrote:
> I'm moving my CakePHP app onto to a Media Temple Dedicated Virtual
> server and my paths are all wrong.
>
> There seem to be two issues, one more severe than the other:
>
> First, the paths to webroot don't work, so the head of my document
> links my stylesheet like so:
>
> 
>
> Notice that first, index.php is inserted into the beginning of the
> link and second that the path is completely wrong. When I access the
> base url, I get the Apache 404 error. If I insert index.php in the the
> url, it works fine so thathttps://example.com/index.php/users/login
> works (but with incorrect links to style sheets and layout as noted
> above), buthttps://example.com/users/loginproduces an Apache 404
> error.
>
> It seems the problem is a mod_rewrite one perhaps. The default
> CakePHP .htaccess files are on the server. Any thoughts? There seem to
> be a lot of forum posts that are somehow related, but don't quite fit
> my scenario.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Migrating to Media Temple DV Server - Path problem

2009-01-22 Thread Tony Thomas

I'm moving my CakePHP app onto to a Media Temple Dedicated Virtual
server and my paths are all wrong.

There seem to be two issues, one more severe than the other:

First, the paths to webroot don't work, so the head of my document
links my stylesheet like so:



Notice that first, index.php is inserted into the beginning of the
link and second that the path is completely wrong. When I access the
base url, I get the Apache 404 error. If I insert index.php in the the
url, it works fine so that https://example.com/index.php/users/login
works (but with incorrect links to style sheets and layout as noted
above), but https://example.com/users/login produces an Apache 404
error.

It seems the problem is a mod_rewrite one perhaps. The default
CakePHP .htaccess files are on the server. Any thoughts? There seem to
be a lot of forum posts that are somehow related, but don't quite fit
my scenario.

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



Re: Label information for Multiple Checkboxes

2009-01-20 Thread Tony Thomas

That worked! Thanks!

On Jan 20, 8:54 am, grigri  wrote:
> // controller
> $aliquots = $this->Aliquot->find('all', array(
>   'conditions' => whatever,
>   'fields' => array(
>     'Aliquot.id',
>     'Aliquot.additive',
>     'Specimen.type',
>     'Specimen.draw_date'
>   ),
>   'recursive' => 0
> ));
> $this->set('aliquots', Set::combine($aliquots,
>   '{n}.Aliquot.id',
>   array(
>     '{0} [{1} / {2}]', // Format
>     '{n}.Aliquot.additive', // Field #0
>     '{n}.Specimen.type', // Field #1
>     '{n}.Specimen.draw_date' // Field #2
>   )
> ));
> // view
> echo $form->input('Aliquot', array('options' => 'aliquots', 'multiple'
> => 'checkbox'));
>
> Alternatively, if you want the checkboxes grouped - say by specimen
> type, then use this:
>
> $this->set('aliquots', Set::combine($aliquots,
>   '{n}.Aliquot.id',
>   array(
>     '{0} [{1} / {2}]', // Format
>     '{n}.Aliquot.additive', // Field #0
>     '{n}.Specimen.type', // Field #1
>     '{n}.Specimen.draw_date' // Field #2
>   ),
>   '{n}.Specimen.type'
> ));
> // view
> echo $form->input('Aliquot', array('options' => 'aliquots', 'multiple'
> => 'checkbox'));
>
> hth
> grigri
>
> On Jan 20, 2:32 pm, Tony Thomas  wrote:
>
> > On Jan 16, 12:22 am, brian  wrote:
>
> > > I think you could probably easily build the structure you want using
> > > Set in afterFind() (if not in the find itself). Can you post an
> > > example  of the sort of array you would need if you were, say,
> > > displaying each option in an html table? Like if you did a straight
> > > find('all', $your_conditions).
>
> > Just to keep it simple, I've only got two fields in my 'find' until I
> > work out the logic. Once I have that worked out, I should be able to
> > open it up to however many fields I want.
>
> > $aliquots = $this->Aliquot->find(
> >                                                 'all',
> >                                                 array('fields' => array(
> >                                                         'Aliquot.id',
> >                                                         'Specimen.type'),
> >                                                         'conditions' => 
> > 'Aliquot.box_id IS NULL', 'limit' => '0, 100',
> > 'recursive' => 2
> >                                                         )
> >                                                 );
> > $this->set('aliquots', $aliquots);
>
> > Then in the view:
>
> > echo $form->input('Aliquot', array( 'label' => false,
> >                                                                         
> > 'type' => 'select',
> >                                                                         
> > 'multiple' => 'checkbox',
> >                                                                         
> > 'options' => $aliquots));
>
> > The problem is that 'options' above doesn't seem to display a nested
> > array correctly. It's fine if I only define a single field in my find,
> > but since it uses the array for the labels as well as the value for
> > each checkbox, I can't define more information there to be displayed
> > only in the label. At least I haven't figured out how.
>
> > I could loop through and define each checkbox separately, but making a
> > multiple selection is difficult in that scenario unless I abandon the
> > form helpers altogether and just hand code the form.
>
> > > On Thu, Jan 15, 2009 at 5:02 PM, Tony Thomas  wrote:
>
> > > > I follow you up to this bit:
>
> > > >> 
> > > >> echo $form->input(
> > > >>       'Category',
> > > >>       array(
> > > >>             'type'=>'select',
> > > >>             'multiple'=>'checkbox',
> > > >>             'options'=>$ids,
> > > >>             'label'=>false
> > > >>             )
> > > >>       );
> > > >> ?>
>
> > > > This doesn't seem to solve the problem of getting the other
> > > > information into my label. In fact, it's the exact method I'm using
> > > > now. I understand using $this->find('all', $options) and extract() to
> > > > separate the ids from the rest of the information, but how do I get
> > > > the other information displayed in my form? This method still leaves
> > > > me with checkboxes and ids, but no other info.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Label information for Multiple Checkboxes

2009-01-20 Thread Tony Thomas

On Jan 16, 12:22 am, brian  wrote:
> I think you could probably easily build the structure you want using
> Set in afterFind() (if not in the find itself). Can you post an
> example  of the sort of array you would need if you were, say,
> displaying each option in an html table? Like if you did a straight
> find('all', $your_conditions).

Just to keep it simple, I've only got two fields in my 'find' until I
work out the logic. Once I have that worked out, I should be able to
open it up to however many fields I want.

$aliquots = $this->Aliquot->find(
'all',
array('fields' => array(
'Aliquot.id',
'Specimen.type'),
'conditions' => 
'Aliquot.box_id IS NULL', 'limit' => '0, 100',
'recursive' => 2
)
);
$this->set('aliquots', $aliquots);

Then in the view:

echo $form->input('Aliquot', array( 'label' => false,
'type' 
=> 'select',

'multiple' => 'checkbox',

'options' => $aliquots));

The problem is that 'options' above doesn't seem to display a nested
array correctly. It's fine if I only define a single field in my find,
but since it uses the array for the labels as well as the value for
each checkbox, I can't define more information there to be displayed
only in the label. At least I haven't figured out how.

I could loop through and define each checkbox separately, but making a
multiple selection is difficult in that scenario unless I abandon the
form helpers altogether and just hand code the form.

> On Thu, Jan 15, 2009 at 5:02 PM, Tony Thomas  wrote:
>
> > I follow you up to this bit:
>
> >> 
> >> echo $form->input(
> >>       'Category',
> >>       array(
> >>             'type'=>'select',
> >>             'multiple'=>'checkbox',
> >>             'options'=>$ids,
> >>             'label'=>false
> >>             )
> >>       );
> >> ?>
>
> > This doesn't seem to solve the problem of getting the other
> > information into my label. In fact, it's the exact method I'm using
> > now. I understand using $this->find('all', $options) and extract() to
> > separate the ids from the rest of the information, but how do I get
> > the other information displayed in my form? This method still leaves
> > me with checkboxes and ids, but no other info.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Label information for Multiple Checkboxes

2009-01-15 Thread Tony Thomas

I follow you up to this bit:

> 
> echo $form->input(
>   'Category',
>   array(
> 'type'=>'select',
> 'multiple'=>'checkbox',
> 'options'=>$ids,
> 'label'=>false
> )
>   );
> ?>

This doesn't seem to solve the problem of getting the other
information into my label. In fact, it's the exact method I'm using
now. I understand using $this->find('all', $options) and extract() to
separate the ids from the rest of the information, but how do I get
the other information displayed in my form? This method still leaves
me with checkboxes and ids, but no other info.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Label information for Multiple Checkboxes

2009-01-15 Thread Tony Thomas

I tried that very thing, but it didn't produce the expected results.
Maybe find('list', $options) isn't meant to accommodate more than a
single field. I'm not sure.

On Jan 15, 11:34 am, "David Coleman" 
wrote:
> You could also do something like this in your controller:
>
>             $aliquots = $this->Aliquot->find(
>
>                   'list',
>
>                   array(
>
>                         'fields'=>array(
>
>                               'Aliquot.id',
>
>                               'Aliquot.name'
>
>                               ),
>
>                         'conditions'=>array(
>
>                               // some conditions if necessary.
>
>                               )
>
>                         )
>
>                   );
>
> And then pass this to your view with
>
> $this->set(‘aliquotes’, $aliquots);

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



Re: Label information for Multiple Checkboxes

2009-01-15 Thread Tony Thomas

On Jan 15, 1:03 pm, "David Coleman" 
wrote:
> Do you need checkboxes from multiple tables?  

No. The checkboxes in this case only pertain to my aliquots table so
that users can assign them to a box, which is in turn assigned to a
freezer. But in order to identify where the aliquots go, there are a
few fields from my specimens table (blood comes in as a specimen and
is then divided into aliquots) that I'd like to display in the label.

If so you need to use the
> trick I posted earlier today to make the hidden elements not be duplicated.
> Overload your form.php in your app/views/helpers folder.
>
> What you are doing is similar to a recent application that I wrote, in which
> I developed this extention to the form->input method to accomplish just this
> effect.
>
> See the message "re: Ticket #5577 (new Enhancement)"  If this is what you
> need.
>
> -Original Message-
> From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf
>
> Of Tony Thomas
> Sent: Thursday, January 15, 2009 4:52 PM
> To: CakePHP
> Subject: Re: Label information for Multiple Checkboxes
>
> The complicating factor here is that Aliquot belongs to Specimen in my
> model and I want to display some information from both tables:
> Specimen.type, Specimen.draw_date, Aliquot.additive & etc. It looks
> more and more like I'm going to have to put that information in an
> array and loop through it, building each checkbox one at a time
> instead of my example below. Or am I missing something?
>
> On Jan 15, 11:01 am, grigri  wrote:
> > You need to set the $displayField property inside your `Aliquot` model
> > to whatever field you want for the label.
>
> > On Jan 15, 4:47 pm, Tony Thomas  wrote:
>
> > > I'm building a list of checkboxes like so:
>
> > > echo $form->input('Aliquot.id', array( 'label' => FALSE,
> > >                                                                        
>         'type' => 'select',
> > >                                                                        
>         'multiple' => 'checkbox',
> > >                                                                        
>         'options' => $aliquots));
> > > echo $form->input('box_id', array('options' => $boxes));
>
> > > $aliquots above is built from $this->Aliquot->find('list', $options);
> > > which finds all the ids of the pertinent records. The problem I have
> > > this this only generates a list of ids. Is there good way to load an
> > > array for 'label' so that I can display more than just the list of ids?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Label information for Multiple Checkboxes

2009-01-15 Thread Tony Thomas

The complicating factor here is that Aliquot belongs to Specimen in my
model and I want to display some information from both tables:
Specimen.type, Specimen.draw_date, Aliquot.additive & etc. It looks
more and more like I'm going to have to put that information in an
array and loop through it, building each checkbox one at a time
instead of my example below. Or am I missing something?

On Jan 15, 11:01 am, grigri  wrote:
> You need to set the $displayField property inside your `Aliquot` model
> to whatever field you want for the label.
>
> On Jan 15, 4:47 pm, Tony Thomas  wrote:
>
> > I'm building a list of checkboxes like so:
>
> > echo $form->input('Aliquot.id', array( 'label' => FALSE,
> >                                                                             
> >     'type' => 'select',
> >                                                                             
> >     'multiple' => 'checkbox',
> >                                                                             
> >     'options' => $aliquots));
> > echo $form->input('box_id', array('options' => $boxes));
>
> > $aliquots above is built from $this->Aliquot->find('list', $options);
> > which finds all the ids of the pertinent records. The problem I have
> > this this only generates a list of ids. Is there good way to load an
> > array for 'label' so that I can display more than just the list of ids?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Label information for Multiple Checkboxes

2009-01-15 Thread Tony Thomas

I'm building a list of checkboxes like so:

echo $form->input('Aliquot.id', array( 'label' => FALSE,

'type' => 'select',

'multiple' => 'checkbox',

'options' => $aliquots));
echo $form->input('box_id', array('options' => $boxes));

$aliquots above is built from $this->Aliquot->find('list', $options);
which finds all the ids of the pertinent records. The problem I have
this this only generates a list of ids. Is there good way to load an
array for 'label' so that I can display more than just the list of ids?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Anyone Integrate with iContact

2008-12-23 Thread Tony

Has anyone integrated their CakePHP application with iContact?

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



Re: Error Messages Not Displaying in View or in Validations Array

2008-12-19 Thread Tony

I don't think I was clear in that last message. I'm using a model name
that is not associated with the controller. For example my controller
is businesses but my model is users because I'm adding information
into my users database for marketing to them.

I was under the impression that it's the controller action that
handles the data and that the validation of the model is what happens
to the action. Maybe what's wrong is that the validation message is
for the current action of the controller and I should use a flash
message instead if I was going to use different action.

Is that much clearer? (if that's even a word LOL)

On Dec 19, 10:57 am, Tony  wrote:
> Well I have a model for the user table and I have a controller called
> businesses and within businesses I have two actions (index and
> thank_you). In my controller I am using the model Users doing:
> var $uses = array('User');
>
> But are you saying that I should be adding the form data to this page
> and then have it kick over to the thank_you page?
>
> On Dec 19, 5:54 am, Smelly_Eddie  wrote:
>
> > Just a guess but it looks like your sending the form data to a
> > different page...
>
> > Validation was intended to display on the same model in a circular
> > manner. i.e. empty user/add form is shown -> data submitted to user/
> > add action -> user/add validates data -> form is repeated if invalid
> > OR redirect user to secondary page.
>
> > On Dec 18, 3:51 pm, Tony  wrote:
>
> > > For some reason I can't get my error messages for validations to work.
> > > I tried outputting the validations by doing:
> > > pr($this->validationErrors);
>
> > > But all I get is an empty array. What do you guys see that I'm doing
> > > wrong?
>
> > > Thanks,
> > > Tony
>
> > > Here's my model:
> > > 
> > > class User extends AppModel {
>
> > >         var $name = 'User';
>
> > >     // This model is a self-join
> > >         var $belongsTo  =       array(
> > >                                                                 
> > > 'ParentMember' => array(
> > >                                                                           
> > >                               'className' => 'User',
> > >                                                                           
> > >                               'foreignKey' => 'parent_id'),
> > >                                                 );
>
> > >         var $hasMany    =       array(
> > >                                                                 
> > > 'ChildMember' => array(
> > >                                                                           
> > >                               'className' => 'User',
> > >                                                                           
> > >                               'foreignKey' => 'parent_id'),
> > >                                                 );
>
> > >    // Place the validation rules here:
>
> > >    var  $validate = array(
> > >                         'first_name' => array(
> > >                                 'rule' => 'alphaNumeric',
> > >                                 'required' => true,
> > >                                 'message' => 'Name is required. Please 
> > > enter your first name.',
> > >                                 'last' => true
> > >                         ),
> > >                         'email' => array(
> > >                                 'rule' => array('email', true),
> > >                                 'required' => true,
> > >                                 'message' => 'Email is required. Please 
> > > enter your email
> > > address.',
> > >                                 'last' => true
> > >                         ),
> > >                         'phone' => array(
> > >                                 'rule' => array('phone', null, 'us'),
> > >                                 'message' => 'Phone number is not valid. 
> > > Please enter valid phone
> > > number.',
> > >                            

Re: Error Messages Not Displaying in View or in Validations Array

2008-12-19 Thread Tony
Well I have a model for the user table and I have a controller called
businesses and within businesses I have two actions (index and
thank_you). In my controller I am using the model Users doing:
var $uses = array('User');

But are you saying that I should be adding the form data to this page
and then have it kick over to the thank_you page?



On Dec 19, 5:54 am, Smelly_Eddie  wrote:
> Just a guess but it looks like your sending the form data to a
> different page...
>
> Validation was intended to display on the same model in a circular
> manner. i.e. empty user/add form is shown -> data submitted to user/
> add action -> user/add validates data -> form is repeated if invalid
> OR redirect user to secondary page.
>
> On Dec 18, 3:51 pm, Tony  wrote:
>
> > For some reason I can't get my error messages for validations to work.
> > I tried outputting the validations by doing:
> > pr($this->validationErrors);
>
> > But all I get is an empty array. What do you guys see that I'm doing
> > wrong?
>
> > Thanks,
> > Tony
>
> > Here's my model:
> > 
> > class User extends AppModel {
>
> >         var $name = 'User';
>
> >     // This model is a self-join
> >         var $belongsTo  =       array(
> >                                                                 
> > 'ParentMember' => array(
> >                                                                             
> >                             'className' => 'User',
> >                                                                             
> >                             'foreignKey' => 'parent_id'),
> >                                                 );
>
> >         var $hasMany    =       array(
> >                                                                 
> > 'ChildMember' => array(
> >                                                                             
> >                             'className' => 'User',
> >                                                                             
> >                             'foreignKey' => 'parent_id'),
> >                                                 );
>
> >    // Place the validation rules here:
>
> >    var  $validate = array(
> >                         'first_name' => array(
> >                                 'rule' => 'alphaNumeric',
> >                                 'required' => true,
> >                                 'message' => 'Name is required. Please 
> > enter your first name.',
> >                                 'last' => true
> >                         ),
> >                         'email' => array(
> >                                 'rule' => array('email', true),
> >                                 'required' => true,
> >                                 'message' => 'Email is required. Please 
> > enter your email
> > address.',
> >                                 'last' => true
> >                         ),
> >                         'phone' => array(
> >                                 'rule' => array('phone', null, 'us'),
> >                                 'message' => 'Phone number is not valid. 
> > Please enter valid phone
> > number.',
> >                                 'last' => true
> >                         )
> >    );
>
> > }
>
> > 
>
> > Here's my controller with the method action it's being submitted to:
> > 
> > function thank_you()
> >     {
> >                 $member = $this->Session->read('teamMember');
> >                 $this->set('pageTitle', 'Before you leave TriVita 
> > Cooperative
> > Marketing\'s website');
> >         $this->set('bigTitle', 'BEFORE YOU LEAVEA SPECIAL THANK
> > YOU FROM ME...');
> >                 $this->set('member', $member);
>
> >         if( !empty($this->data) )
> >         {
>
> >             $this->User->create();
>
> >             if( $this->User->save($this->data) )
> >             {
>
> >                 $tony = $this->User->

Error Messages Not Displaying in View or in Validations Array

2008-12-18 Thread Tony

For some reason I can't get my error messages for validations to work.
I tried outputting the validations by doing:
pr($this->validationErrors);

But all I get is an empty array. What do you guys see that I'm doing
wrong?

Thanks,
Tony

Here's my model:

class User extends AppModel {

var $name = 'User';

// This model is a self-join
var $belongsTo  =   array(
'ParentMember' 
=> array(

'className' => 'User',

'foreignKey' => 'parent_id'),
);

var $hasMany=   array(
'ChildMember' 
=> array(

'className' => 'User',

'foreignKey' => 'parent_id'),
);

   // Place the validation rules here:

   var  $validate = array(
'first_name' => array(
'rule' => 'alphaNumeric',
'required' => true,
'message' => 'Name is required. Please enter 
your first name.',
'last' => true
),
'email' => array(
'rule' => array('email', true),
'required' => true,
'message' => 'Email is required. Please enter 
your email
address.',
'last' => true
),
'phone' => array(
'rule' => array('phone', null, 'us'),
'message' => 'Phone number is not valid. Please 
enter valid phone
number.',
'last' => true
)
   );

}



Here's my controller with the method action it's being submitted to:

function thank_you()
{
$member = $this->Session->read('teamMember');
$this->set('pageTitle', 'Before you leave TriVita Cooperative
Marketing\'s website');
$this->set('bigTitle', 'BEFORE YOU LEAVEA SPECIAL THANK
YOU FROM ME...');
    $this->set('member', $member);

if( !empty($this->data) )
{

$this->User->create();

if( $this->User->save($this->data) )
{

$tony = $this->User->findByAffiliateNumber
('11167706');



$prospect = 
$this->User->findById($this->User->id);



$this->set('prospectName', $prospect['User']
['first_name']);
    $this->set('tonyEmail', $tony);



if( $prospect['User']['email'] != '' || 
$prospect['User']
['email'] != null )
    {
$this->_sendThankYouEmail($prospect, 
$member);
}
/*
if( $member['User']['affiliate_number'] != 
'11167706')
{

$this->_sendMemberNotificationEmail($prospect, $member, $tony);
}
*/
$this->_sendMemberNotificationEmail($prospect, 
$member, $tony);
$this->_sendTonyEmail($prospect, $member, 
$tony);


}
else
{
$this->redirect(array('action' => 'index'),null,true);
}
}
else
{
// we're at this place because a form was not filled in
$this->redirect(array('action' => 'index'),null,true);
}
}
===

Re: Where Does This Fall in the MVC Architecture?

2008-12-09 Thread Tony Thomas

Fantastic. That worked!

On Dec 9, 9:30 am, "Jon Bennett" <[EMAIL PROTECTED]> wrote:
> > I would:
>
> >  * create a method in your model to fetch the data
> >  * create a method in your controller to access this data
> >  * create an element that calls via 'requestAction' the data from the 
> > controller
> >  * insert this element into your layout and add array('cache'=>'1 hour');
>
> take a look 
> athttp://bakery.cakephp.org/articles/view/creating-reusable-elements-wi...
> for ideas.
>
> jon
>
> --
>
> jon bennett
> w:http://www.jben.net/
> iChat (AIM): jbendotnet Skype: jon-bennett
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: using Google Visualization

2008-12-09 Thread Tony Thomas

"http://www.google.com/jsapi"; doesn't appear to be a valid URL for the
library you're trying to use.

On Dec 9, 7:30 am, Juan <[EMAIL PROTECTED]> wrote:
> I'm trying to use the Google Visualization API with my CakePHP app.
> The two first obstacles are:
>
> - how to link an external JS library?
>
> I try this in my view:
> $javascript->link('http://www.google.com/jsapi', false);
>
> but it's not working. I see in the CakePHP source code that it doesn't
> seem possible to do 
> this:http://api.cakephp.org/javascript_8php-source.html#l00258
>
> I solve this by just adding the 

Where Does This Fall in the MVC Architecture?

2008-12-09 Thread Tony Thomas

I'm working on an application to store information on lab specimens.
The lab receive specimens which are divided into aliquots which are
then put into boxes and in turn stored in freezers.

I want to create a function to find all unstored aliquots and display
a message on every page to alert the lab users that there are aliquots
that haven't been assigned to boxes yet. It's a simple query:

SELECT COUNT(aliquot.id)
FROM aliquots
WHERE aliquots.box_id IS NULL

The problem is that I can't quite decide where it belongs in the MVC
architecture. It seems like a helper since the alert message would
appear in the left column of every page. But it runs a query, so does
it belong in a model? The problem is that I want to retrieve the
information no matter which model is currently in use.

What's the best way to preserve the MCV structure and DRY philosophy
while including a function like this in my application?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Error when submitting form to a controller using different model name

2008-12-08 Thread Tony

Yeah I had the correct controller. What happened is that I didn't pass
a variable I was using within the default.ctp into the action. This
caused a bunch of errors.

The second thing I didn't do is that I wasn't using the html and
JavaScript helpers to include the CSS and JavaScript files correctly
and that was causing the layout error.

Once I fixed that everything worked out just fine.

- Tony

On Dec 7, 9:42 pm, thatsgreat2345 <[EMAIL PROTECTED]> wrote:
> Do you have a controller called businesses_controller.php and in that
> a function called thank_you?
>
> On Dec 7, 9:37 pm, Tony <[EMAIL PROTECTED]> wrote:
>
> > I'm in the process of creating a website that is for my affiliates and
> > their information is stored into a model called 'User' and I have a
> > controller called businesses with two actions;  index and thank_you.
>
> > When a prospect lands onto the page they are given a sales letter and
> > a form to fill out. This form will use the User model but I want it to
> > submit to the businesses thank_you action.
>
> > I'm putting the prospects information into the Users model because
> > they could be converted into an affiliate.
>
> > Where I'm having the problem is that currently my form code looks like
> > this:
>
> > ===CODE===
> > echo $form->create('User', array('url' => '/businesses/thank_you'));
> > echo $form->hidden('parent_id', array('value' => $member['User']
> > ['affiliate_number']));
> > echo '* Name:';
> > echo $form->input('first_name', array('label' => false, 'size' =>
> > 20));
> > echo '* Email:';
> > echo $form->input('email', array('label' => false, 'size' => 20));
> > echo '';
> > echo 'Phone: (optional, for those who really want
> > change)';
> > echo $form->input('phone', array('label' => false));
> > echo '';
> > echo $form->end(array('label' => 'I Want Change in My Life'));
> > ===CODE===
>
> > The problem is that when I submit this form the url at the top is
> > correct:http://example.com/businesses/thank_you
>
> > But I get this error:
>
> > Not Found
>
> > Error: The requested address '/businesses/thank_you' was not found on
> > this server.
>
> > What am I doing wrong here?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Error when submitting form to a controller using different model name

2008-12-07 Thread Tony

I'm in the process of creating a website that is for my affiliates and
their information is stored into a model called 'User' and I have a
controller called businesses with two actions;  index and thank_you.

When a prospect lands onto the page they are given a sales letter and
a form to fill out. This form will use the User model but I want it to
submit to the businesses thank_you action.

I'm putting the prospects information into the Users model because
they could be converted into an affiliate.

Where I'm having the problem is that currently my form code looks like
this:

===CODE===
echo $form->create('User', array('url' => '/businesses/thank_you'));
echo $form->hidden('parent_id', array('value' => $member['User']
['affiliate_number']));
echo '* Name:';
echo $form->input('first_name', array('label' => false, 'size' =>
20));
echo '* Email:';
echo $form->input('email', array('label' => false, 'size' => 20));
echo '';
echo 'Phone: (optional, for those who really want
change)';
echo $form->input('phone', array('label' => false));
echo '';
echo $form->end(array('label' => 'I Want Change in My Life'));
===CODE===

The problem is that when I submit this form the url at the top is
correct:
http://example.com/businesses/thank_you

But I get this error:

Not Found

Error: The requested address '/businesses/thank_you' was not found on
this server.


What am I doing wrong here?

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



Creating and Using True Self-referential Joins

2008-12-06 Thread Tony

I'm working on an application where people can sign up to use a
service and can refer others into the network. I'm wanting to use a
self-referential join table where I have one table with of course an
ID and an associate id where that will join to a parent record within
that table.

So if Jane referred in Tom then then Tom's associate id field would
have Jane's id # in it.

The I have several questions:

1) How do you set up a table that uses self-referential joins within
CakePHP and using cake migrations.

2) How would you reference those associations within the model?

3) How would you save to the database using a self-referential join.

Most of the posts on the user group have people using two different
tables and to me that's not a self-referential join. I'll do some more
searching. If CakePHP is a close port from Ruby on Rails then I guess
I could look at some Rails examples to see how they are doing. I think
they have acts_as_tree.

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



updateAll Syntax question

2008-12-05 Thread Tony Thomas

I have a scenario where I want to update multiple records
simultaneously. In this case, I have a form with check boxes next to
ids from the table I want to update. These are aliquots stored in a
lab.

updateAll seems like a natural solution, except I can't quite get my
head around defining the proper conditions. In my case the controller
receives an array of aliquot ids and one box id where they will all be
store.

$this->data['Aliquot']['id'][] // an array of selected ids sent from
my form
$this->data['Aliquot']['box_id'] // the id of the box we're going to
store the aliquots in

How would you define the conditions in updateAll() so that all of the
sent aliquot ids get the same box id?

$this->Aliquot->updateAll(array('Aliquot.box_id' => $this->data
['Aliquot']['box_id']));

Will the above syntax automagically update all of the aliquot records
with the same box id if I don't define conditions?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Warning 512 error, I make the tmp dir writable and I get more errors

2008-11-29 Thread Tony

Yes that did it! Thank you so much. It was driving me crazy.

On Nov 29, 1:12 am, majna <[EMAIL PROTECTED]> wrote:
> check permission of this file:tmp/cache/persistent/
> cake_core_core_paths
>
> set permissions totmprecursive.
> chmod -R 0777tmp
>
> On Nov 29, 6:04 am, Tony <[EMAIL PROTECTED]> wrote:
>
> > This is driving me crazy and I have googled this and nothing that I
> > have found is fixing this problem I'm having.
>
> > I'm getting the typicalWarning512errorwhere it says that my "app/
> >tmp/cache/ is not writable". I go to chmod 777 this directory and all
> > hell brakes loose on me and I get a whole bunch of errors.
>
> >Warning: unlink(/Users/myname/Sites/myapp/app/tmp/cache/persistent/
> > cake_core_core_paths) [function.unlink]: Permission denied in /Users/
> > myname/Sites/myapp/cake/libs/file.php on line 279
>
> >Warning: fopen(/Users/myname/Sites/myapp/app/tmp/cache/persistent/
> > cake_core_core_paths) [function.fopen]: failed to open stream:
> > Permission denied in /Users/myname/Sites/myapp/cake/libs/file.php on
> > line 146
>
> > What's happening here and how can I fix this?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Warning 512 error, I make the tmp dir writable and I get more errors

2008-11-28 Thread Tony

This is driving me crazy and I have googled this and nothing that I
have found is fixing this problem I'm having.

I'm getting the typical Warning 512 error where it says that my "app/
tmp/cache/ is not writable". I go to chmod 777 this directory and all
hell brakes loose on me and I get a whole bunch of errors.

Warning: unlink(/Users/myname/Sites/myapp/app/tmp/cache/persistent/
cake_core_core_paths) [function.unlink]: Permission denied in /Users/
myname/Sites/myapp/cake/libs/file.php on line 279

Warning: fopen(/Users/myname/Sites/myapp/app/tmp/cache/persistent/
cake_core_core_paths) [function.fopen]: failed to open stream:
Permission denied in /Users/myname/Sites/myapp/cake/libs/file.php on
line 146

What's happening here and how can I fix this?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Manual Search Not Working?

2008-10-01 Thread Tony Thomas

Has something changed with the CakePHP Cookbook's search
(book.cakephp.org)? Over the last few days every search turns up no
results. I just tried a search for "model" and it returned no results.
Anyone who works on that know anything?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Auth Redirect Problems

2008-09-30 Thread Tony Thomas

I don't know why. Are you you using 1.2 or 1.1? I'm using 1.2.

This:

$this->Auth->autoRedirect = FALSE;

Gives me:

"unexpected T_VARIABLE"

I haven't had a chance to investigate.

On Sep 30, 2:06 am, "Okto Silaban" <[EMAIL PROTECTED]> wrote:
> How come? I get no problem with the syntax.. It works fine for me..
>
> This is the full code in app/app_controller.php (I just copy paste it)
>
> beforeFilter()
> {
>         $this->Auth->loginAction = array('controller' => 'users', 'action'
> => 'login');
>         $this->Auth->logoutRedirect = '/';
>         $this->Auth->loginRedirect = array('controller' => 'users', 'action'
> => 'login');
>         $this->Auth->autoRedirect = FALSE;
>
> }
>
> Okto.Silaban.Net
>
> On Fri, Sep 26, 2008 at 10:00 PM, Tony Thomas <[EMAIL PROTECTED]> wrote:
>
> > This gives me an "unexpected T_VARIABLE" error on the line with $this-
> > >Auth->autoRedirect = FALSE;
>
> > I think the algorithm might be right, but the syntax is wrong.
>
> > On Sep 17, 12:20 pm, "Okto Silaban" <[EMAIL PROTECTED]> wrote:
> > > I'm not really sure, but I think :
> > > $this->Auth->loginRedirect
>
> > > doesn't tell we're we gonna go after logging in..
>
> > > But, if we're acessing an area which not allowed by Auth, we will sent to
> > > that page.. (if you're not login yet..).
>
> > > So I set that in beforeFilter :
>
> > > function beforeFilter() {
> > >   $this->Auth->loginRedirect = array('controller' => 'controller_name',
> > > 'action' => 'index');
> > >    $this->Auth->autoRedirect = FALSE; // so after logging in we're not
> > auto
> > > redirected
>
> > > }
>
> > > then manually set
>
> > > function login() {
> > >     $this->redirect('somewhere');
> > >     exit();
>
> > > }
> > > On Tue, Sep 9, 2008 at 10:12 PM, Tony Thomas <[EMAIL PROTECTED]> wrote:
>
> > > > If someone is familiar with a post to this group or blog entry that
> > > > addresses this issue, please let me know. I've spent the morning
> > > > scouring both with no satisfactory results.
>
> > > > I have a cakePHP app on a shared server. In local testing, everything
> > > > worked fine. But mod_rewrite did not function properly on the shared
> > > > server, so I'm using CakePHP pretty URLS instead. Also caching (at
> > > > least temporarily) is off. I've uncommented the pertinent lines of
> > > > code in core.php and I've dutifully deleted the .htaccess files.
>
> > > > The problem I have is that after logging in, the redirect is
> > > > inconsistent. About 2/3 of the time I get redirected to
> > > >https://[base_url]/https:/[domain]. I just can't seem to find away
> > > > around this problem.
>
> > > > My login function looks like this:
>
> > > > function login() {
> > > >                        $this->Auth->loginRedirect = array('controller'
> > =>
> > > > 'controller_name', 'action' => 'index');
> > > >    }
>
> > > > I still get inconsistent results with the redirect going to a URL like
> > > > the former example the majority of the time. Any insight, links, etc.
> > > > would be appreciated.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Get month, day, year helper to put dates in an array

2008-09-29 Thread Tony Thomas

I'm using the form helpers for month, day & year to record several
start and end dates. What I'd like is for each respective helper to
create an array of months, days & years. I don't think there's a way
to do that with the helper the way it is, is there?

Right now $form->month('Model.field', date('m'), FALSE)

produces:

...etc. 

What I'd really like is:

...etc. 

The user will be reporting several dates and I'd like to loop through
the array and insert the dates into a table. Unfortunately as it is,
only the last date will be recorded. Anyone have any advice for me
aside from hand coding the form?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Auth Redirect Problems

2008-09-26 Thread Tony Thomas

This gives me an "unexpected T_VARIABLE" error on the line with $this-
>Auth->autoRedirect = FALSE;

I think the algorithm might be right, but the syntax is wrong.

On Sep 17, 12:20 pm, "Okto Silaban" <[EMAIL PROTECTED]> wrote:
> I'm not really sure, but I think :
> $this->Auth->loginRedirect
>
> doesn't tell we're we gonna go after logging in..
>
> But, if we're acessing an area which not allowed by Auth, we will sent to
> that page.. (if you're not login yet..).
>
> So I set that in beforeFilter :
>
> function beforeFilter() {
>   $this->Auth->loginRedirect = array('controller' => 'controller_name',
> 'action' => 'index');
>    $this->Auth->autoRedirect = FALSE; // so after logging in we're not auto
> redirected
>
> }
>
> then manually set
>
> function login() {
>     $this->redirect('somewhere');
>     exit();
>
> }
> On Tue, Sep 9, 2008 at 10:12 PM, Tony Thomas <[EMAIL PROTECTED]> wrote:
>
> > If someone is familiar with a post to this group or blog entry that
> > addresses this issue, please let me know. I've spent the morning
> > scouring both with no satisfactory results.
>
> > I have a cakePHP app on a shared server. In local testing, everything
> > worked fine. But mod_rewrite did not function properly on the shared
> > server, so I'm using CakePHP pretty URLS instead. Also caching (at
> > least temporarily) is off. I've uncommented the pertinent lines of
> > code in core.php and I've dutifully deleted the .htaccess files.
>
> > The problem I have is that after logging in, the redirect is
> > inconsistent. About 2/3 of the time I get redirected to
> >https://[base_url]/https:/[domain]. I just can't seem to find away
> > around this problem.
>
> > My login function looks like this:
>
> > function login() {
> >                        $this->Auth->loginRedirect = array('controller' =>
> > 'controller_name', 'action' => 'index');
> >    }
>
> > I still get inconsistent results with the redirect going to a URL like
> > the former example the majority of the time. Any insight, links, etc.
> > would be appreciated.
>
>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Best way to validate dates to prevent future dating

2008-09-25 Thread Tony Thomas

The problem I had was that each new record that was being added, would
then go to a step to add several related records in a different table.
So even though I could check the datestamps against each other, the
flash messages were getting lost because the application immediately
redirects and starts using another model. In my case these are lab
specimens that are divided into aliquots.

The user begins by creating a new record for a specimen. There are
three date fields. The draw date, the receive date and the storage
date. The record is added and the user is prompted for how many
aliquots will be created from the specimen. They enter a number and a
corresponding number of aliquot records are created. In leaving the
specimen model and going to the aliquot model, I was losing flash
messages before anyone saw the specimen record again.

I decided (for now) to check the dates in the view, so I created a
simple helper to format any dates that are before the 'created' date
in red text. (I should add that all of my dates are being stored as
Unix timestamps.) I created this helper:

 0) {

if ($datestamp > $created) {

$thedate = '' . date($format,
$datestamp) . ' This record was created on ' . date('m/d/Y',
$created) . ' at ' . date('G:i', $created) . '. Specimens cannot be
future dated. ';

} else {

$thedate = date($format, $datestamp);

}

return $this->output($thedate);

} else {

$thedate = '';
return $this->output($thedate);

}

}
}

?>

Since my helper is called 'DateHelper', add 'Date' to the helper var
in the AppController.

Then I can just send any date as:

$date->future($date, $created, $format)

and the date is sent back formatted like $format (the same as the php
date() function). If the date in question is later than the date the
record was created, it's formatted with the class 'redtext' so it
stands out.

There's probably a better way to do all of this utilizing AJAX, but
I'm not there yet.

For now, my helper is handy and I can reuse it in the other views that
use dates.

One big reason I did it this was as that I wanted the record to be
saved, but send also send a message to the user that something is
wrong with the date. I'll refine this as I develop the application
further, but for now this works.

On Sep 16, 12:36 pm, LunarDraco <[EMAIL PROTECTED]> wrote:
> Here is a sample that I use, Its not exactly what your looking for,
> but a little tweaking will get you where you need to be:
>
> var $validate = array(
>    'expires' =>
> array('rule'=>array('date','mdy'),'rule'=>array('validateFutureDate'),'on'=>'create')
> );
>
>         function validateFutureDate($value) {
>         $valid = false;
>
>         $timestamp = strtotime(str_replace('-','/',
> $value['expires']));
>                 $t = time()+(86400*34);
>                 if($timestamp >= $t)
>                         $valid = true;
>
>         return $valid;
>     }
>
> On Sep 16, 3:08 am, RichardAtHome <[EMAIL PROTECTED]> wrote:
>
> > > I was afraid that might be the case
>
> > It's really not difficult :-)
>
> > And its a very powerful solution once you understand how it works.
>
> > On Sep 16, 1:46 am, Tony Thomas <[EMAIL PROTECTED]> wrote:
>
> > > Thanks. I was afraid that might be the case.
>
> > > On Sep 15, 7:42 pm, "Dardo Sordi Bogado" <[EMAIL PROTECTED]> wrote:
>
> > > > You can't use functions i.e date() at class definitions, create a
> > > > custom method in the model and use that as a validation rule.
>
> > > > On Mon, Sep 15, 2008 at 9:34 PM, Tony Thomas <[EMAIL PROTECTED]> wrote:
>
> > > > > According to the documentation that's the proper way to define the
> > > > > array.
>
> > > > >http://book.cakephp.org/view/139/comparison
>
> > > > > It just amounts to defining an array without defining the keys if I'm
> > > > > not mistaken. I'll take a closer look at the syntax in the morning
> > > > > when my mind is a little fresher. I'll post something here if
> > > > > something jumps out at me.
>
> > > > > On Sep 15, 4:20 pm, 703designs <[EMAIL PROTECTED]> wrote:
> > > > >> I noticed that the way you coded your array would definitely throw a
> > > > >> syntax error.
>
&

Auth Redirect Problems

2008-09-09 Thread Tony Thomas

If someone is familiar with a post to this group or blog entry that
addresses this issue, please let me know. I've spent the morning
scouring both with no satisfactory results.

I have a cakePHP app on a shared server. In local testing, everything
worked fine. But mod_rewrite did not function properly on the shared
server, so I'm using CakePHP pretty URLS instead. Also caching (at
least temporarily) is off. I've uncommented the pertinent lines of
code in core.php and I've dutifully deleted the .htaccess files.

The problem I have is that after logging in, the redirect is
inconsistent. About 2/3 of the time I get redirected to
https://[base_url]/https:/[domain]. I just can't seem to find away
around this problem.

My login function looks like this:

function login() {
$this->Auth->loginRedirect = array('controller' =>
'controller_name', 'action' => 'index');
}

I still get inconsistent results with the redirect going to a URL like
the former example the majority of the time. Any insight, links, etc.
would be appreciated.

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



Re: Auth login redirect unreliable?

2008-09-09 Thread Tony Thomas

Plus, the problem I ran into with this solution is that the logout
function goes into an infinite loop.

I will note that I didn't have problems with redirect until I started
using database sessions & stopped using mod_rewrite because of
restrictions on the shared server I'm using.

On Jul 15, 8:50 am, jhicks <[EMAIL PROTECTED]> wrote:
> That will only work as long as the browser supports HTTP_REFERER.
>
> On Jul 6, 2:52 pm, Chez17 <[EMAIL PROTECTED]> wrote:
>
> > Using Eric's post, I created a very simple way to get the Auth
> > component toredirectto the referring page no matter what. I think
> > its userful:
>
> >  > class UsersController extends AppController
> > {
> >     var $name = "Users";
>
> >     var $components = array("Auth");
>
> >     function beforeFilter()
> >     {
> >         $this->Auth->autoRedirect = false;
> >     }
>
> >     function login()
> >     {
> >         $this->redirect($_SERVER['HTTP_REFERER']);
> >     }
>
> > }
>
> > On Jul 2, 1:56 pm, Rich <[EMAIL PROTECTED]> wrote:
>
> > > that worked perfectly for me. thanks Eric!
>
> > > On Jul 2, 12:32 pm, Eric <[EMAIL PROTECTED]> wrote:
>
> > > > I had a similar problem and here is what I did.
>
> > > > 1. Change your setupAuth function like this
> > > > function setupAuth(  )
> > > > {
> > > > ...
> > > > $this->Auth->loginRedirect = '/users/loginRedirect';
> > > > $this->Auth->autoRedirect = false; // <-- handle redirecting yourself
>
> > > > }
>
> > > > 2. create a loginRedirect action which determines where to go after a
> > > > login has succeeded
>
> > > > function loginRedirect()
> > > > {
> > > >  $this->log('users/LoginRedirect()', LOG_DEBUG);
> > > >  if (parent::getAuthGroup() ===  "ADMIN")
> > > >  {
> > > >   $this->log('--redirecting to admin', LOG_DEBUG);
> > > >   $this->redirect('/admin/myCtrl/index');
> > > >  }
> > > >  else
> > > >  {
> > > >   $this->log('--redirecting to normal', LOG_DEBUG);
> > > >   $this->redirect('/myCtrl/index');
>
> > > > }
>
> > > > 3. Your login action is pretty simple then
>
> > > > function login()
> > > > {
> > > >  if ($this->Auth->login())
> > > >  {
> > > >    $this->loginRedirect();
> > > >  }
> > > >  else
> > > >  {
> > > >   if (!empty($this->data))
> > > >     $this->Session->setFlash($this->Auth->loginError);
> > > >  }
>
> > > > }
>
> > > > I think you can get the page that the user was trying to access via
> > > > the session, andredirectthere, but taking them to the front page
> > > > works for me
> > > > .
> > > > Hopefully this helps.
>
> > > > -Eric
>
> > > > On Jul 2, 10:44 am, leo <[EMAIL PROTECTED]> wrote:
>
> > > > > On 2 Jul, 17:27, "dr. Hannibal Lecter" <[EMAIL PROTECTED]> wrote:
>
> > > > > > I see what you mean, but I'm not sure that you can put 'action' => 
> > > > > > '/'
> > > > > > or 'controller' => '/'.
>
> > > > > Sorry, I missed that. Nope, I wouldn't want to be doing that even if
> > > > > it was valid.

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



Re: Retrieving User Information with Auth/Acl

2008-07-03 Thread Tony Thomas

On Jul 3, 6:23 pm, francky06l <[EMAIL PROTECTED]> wrote:
> I do not understand the "on the fly" there ..

Meaning I don't want to have to statically define who can do what.
Instead of something like:

if ($this->Auth->user('username') == 'User1') {

// allow them to do stuff

} else {

// kick them out

}

I want to get user information after they've gone through the login
process in Auth, look at the Acl and determine whether or not they
have permission to do what they want to do. In other words, I don't
want static rules in the controller. I want to load up some variables
from the session and check it against Acl.

>You are wanted to check
> a permission on an action regarding a user, but is this User "logged-
> in" ? I mean a member of a User model or something similar ??

In this case I'm certain the user (me) is logged in. Auth is working
as expected. I just can't get my head around checking Acl.

For now I've abandoned the built in Acl in lieu of a simple system
using "roles" in the user table. The Acl component is more flexible,
so I'd still like to use it if anyone has advice.

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



Retrieving User Information with Auth/Acl

2008-07-03 Thread Tony Thomas

I've been trying to get Acl working for a long time now. I think I'm
very close, but I'm tired of doing endless Google searches for an
answer, so I'm just going to ask.

My Acl is all set up in the database, and Auth is working. It's the
Acl check that I'm not getting. This article got me close:

http://bakery.cakephp.org/articles/view/real-world-access-control

But what is lacking is a way to generalize this. Like most articles &
blog posts I've read about Acl, it focuses on setting up super-
granular permissions, i.e., checking for one specific user. What I
want to do (and what I imagine a lot of folks would find useful) is
check the user on the fly in and see what permissions they have.

So I apologize if I missed this somewhere, but it really has eluded me
after about a month of trying. So without further complaining, here is
my AppController class as it exists right now:

class AppController extends Controller {

var $components = array('Acl','Auth', 'Session');
var $helpers = array('Html', 'Javascript', 'Form');

function beforeFilter(){

$user = $this->Auth->identify();
$user_id = $user[0];

$page = $this->name.DS.$this->action;
$access = $this->Acl->check($user_id, $page, '*');

if ($access === false) {
$this->Session->setFlash("$page, $user_id");
}

 else {
$this->Session->setFlash("$page, $user_id");
}

}

Right now, I'm just setting a flash message so I can debug this thing
and see if the variables have the expected variables. Those who know
more about this than I do will see that I'm clearly not using
identify() correctly. But I think you can see what I'm trying to do. I
want to retrieve the user info from the session and check it against
the Acl permissions. How can I use AuthComponent::identify to get the
user's id and then run the Acl check?

I am at your mercy. Please help.

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



Firefox 3 Cookies & Auth

2008-06-30 Thread Tony Thomas

I spent a long time on this so I thought I'd share it with the
community. I was wracking my brain trying to get Auth to work properly
on a site I'm testing locally in Firefox 3. No matter what I did, the
application locked me out with a message stating "You are not
authorized...". I read several blog posts about Auth and the entry in
the manual over and over.

Then on a whim I tested the same site in Safari and got totally
different results. Today I looked at my Firefox cookies and noticed
that there were two CakePHP cookies. One current (presumably from just
having logged in) and one expired. I deleted the expired cookie and
the application worked.

Here are the specifics:

Cake 1.2.0.7125 RC1
Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10.4; en-US; rv:1.9) Gecko/
2008061004 Firefox/3.0

I'm not sure if this is a fluke, a Firefox bug or a CakePHP bug. I
just thought I'd share what I found in case anyone else is
troubleshooting Auth and is having trouble.

The upside to this story is that I learned an awful lot about CakePHP
Auth in the process.

Here a list of articles I found helpful:

http://www.webdevelopment2.com/cakephp-auth-component-tutorial-1/
http://www.littlehart.net/atthekeyboard/2007/09/11/a-hopefully-useful-tutorial-for-using-cakephps-auth-component/
http://bakery.cakephp.org/articles/view/simple-form-authentication-in-1-2-x-x
http://lemoncake.wordpress.com/2007/07/19/using-authcomponent-and-acl-in-cakephp-12/
http://realm3.com/articles/setting_up_users_groups_withacl_and_auth_in_cake_1.2.php

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



Re: Defining more than one hasMany relationship

2008-05-19 Thread Tony Thomas

I tried resetting the array as you describe but the problem persisted.
The only thing that worked was to stop using foreach. I don't get it,
but I stopped trying once I found a solution.

On May 16, 10:58 pm, David Christopher Zentgraf <[EMAIL PROTECTED]>
wrote:
> foreach() does neither modify nor unset the original array unless
> explicitly told to.
> Maybe you're having issues with the array pointer?
>
> http://jp2.php.net/foreach
>
> > foreach has some side effects on the array pointer. Don't rely on
> > the array pointer during or after the foreach without resetting it.
>
> http://jp2.php.net/manual/en/function.reset.php
>
> $numbers = array(1, 2, 3, 4);
>
> foreach ($numbers as $number) {
> $number = null; // does nothing to $numbers
>
> }
>
> print_r(current($numbers)); // prints nothing
>
> reset($numbers);
> print_r(current($numbers)); // prints '1'
>
> print_r($numbers);  // prints 'array([0] => 1, [1] => 2 
> ...)'
>
> On 16 May 2008, at 22:26, Tony Thomas wrote:
>
>
>
> > No. It's simply looping through and echoing the array, but once it
> > does, the contents of the array are no longer available. As soon as I
> > looped through using while(list($key, $value) = each($array) instead
> > of a foreach loop, I was able to loop through it twice to create the
> > second table. Please correct me if I'm wrong, but I presume it's
> > because foreach() operates from a copy of the array, which is then
> > unset after looping through the data. At least, that's what my results
> > suggest. As soon as I switched methods as noted above, the data
> > remained available to loop through again to create a second table from
> > separate data in the array.
>
> > On May 15, 4:20 pm, Dovdimus Prime <[EMAIL PROTECTED]> wrote:
> >> Are you saying that this foreach loop is modifying the contents of
> >> the
> >> array?

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



Re: Defining more than one hasMany relationship

2008-05-16 Thread Tony Thomas

No. It's simply looping through and echoing the array, but once it
does, the contents of the array are no longer available. As soon as I
looped through using while(list($key, $value) = each($array) instead
of a foreach loop, I was able to loop through it twice to create the
second table. Please correct me if I'm wrong, but I presume it's
because foreach() operates from a copy of the array, which is then
unset after looping through the data. At least, that's what my results
suggest. As soon as I switched methods as noted above, the data
remained available to loop through again to create a second table from
separate data in the array.

On May 15, 4:20 pm, Dovdimus Prime <[EMAIL PROTECTED]> wrote:
> Are you saying that this foreach loop is modifying the contents of the
> array?

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



Re: Defining more than one hasMany relationship

2008-05-15 Thread Tony Thomas

Thanks for all of the help. The tips I got pointed me in the right
direction. Once I changed my foreach loops to while (list($key,
$value) = each($patient['Visit'])) and while (list($key, $value) =
each($patient['M5Symptoms'])) respectively, my data appeared. I
figured this out once I realized the foreach() operates on a copy of
the array and list($key, $value) = each($array) doesn't.

http://us2.php.net/foreach
http://us2.php.net/manual/en/function.list.php

(Links for reference to those who might come upon this in the future.
Hello from the past.)

On May 15, 2:26 pm, Tony Thomas <[EMAIL PROTECTED]> wrote:
> OK, some additional information. (I apologize, because I think this is
> getting into PHP territory and may not be specifically related to
> CakePHP.)
>
> If I place debug($patient) before the first foreach loop (for
> 'Visit'), I get the arrays as below. If I place it after the foreach
> loop I get the same "Undefined index" message. How can I preserve that
> array to reuse it to make a second table?
>
> On May 15, 12:35 pm, Tony Thomas <[EMAIL PROTECTED]> wrote:
>
> > debug($patient) produces:
>
> > Array
> > (
> > [Patient] => Array
> > (
> > [id] => 5007
> > [med_hist_id] => 0
> > [gender] => M
> > [st_of_birth] => [redacted]
> > [st_of_res] => [redacted]
> > [res_length] => 11 yrs
> > [cntry_of_origin] => U.S.
> > [dob] => [redacted]
> > [siblings] => 2
> > [birth_order] => 1
> > [mono_before] => N
> > [ethnicity] => [redacted]
> > [race] => [redacted]
> > [contact_by] => email
> > [withdrawn] => N
> > [kdas] => NKDA
> > [mono_dx] => N
> > )
>
> > [Visit] => Array
> > (
> > [0] => Array
> > (
> > [id] => 2060
> > [quest_id] =>
> > [patient_id] => 5007
> > [protocol] => Mono 5
> > [vdate] => 4/22/2008
> > [vtmstmp] => 1208840400
> > [week] =>
> > [yr] => 2
> > [number] => 8
> > [notes] => [redacted]
> > [kit] => 0
> > [sev_p] => 0
> > [sev_scr] => 0
> > [sev_pain] =>
> > [modified] => 4/22/2008 2:25:47 PM
> > [created] => 4/22/2008 2:11:39 PM
> > )
> > //truncated here, but shows the last ten visits as expected
>
> > )
>
> > [M5Symptom] => Array
> > (
> > [0] => Array
> > (
> > [id] => 19
> > [patient_id] => 5007
> >     [symptom] => Stuffy Nose
> > [start_date] => 12/18/2006
> > [end_date] => 12/21/2006
> > [severity] =>
> > [exported] =>
> > [date_reported] =>
> > [created] =>
> > [modified] =>
> > )
> > // again truncated by me, but the list of 25 shows up in the array
>
> > )
>
> > )
>
> > On May 15, 12:23 pm, "[EMAIL PROTECTED]"
>
> > <[EMAIL PROTECTED]> wrote:
> > > Hi Tony,
> > > What do you have in the $patient variable when you debug it?
> > > debug($patient)
>
> > > /Martin
>
> > > On May 15, 5:37 pm, Tony Thomas <[EMAIL PROTECTED]> wrote:
>
> > > > Hi All,
>
> > > > I'm building a CakePHP app for tracking clinic patients, their visits,
> > > > their symptoms and questionnaire answers. The barrier I've encountered
> > > > is that each patient has many visits AND many symptoms. I want to view
> > > > the patient record and their aggregate visits and symptoms.
>
> > > > I've defined a hasMany relationship in the patient model as such:
>
> > > > var $hasMany = array(
> > > > 'Visit' => array(
> > > > 'order'=> 'Visit.id DESC',
>

Re: Defining more than one hasMany relationship

2008-05-15 Thread Tony Thomas

OK, some additional information. (I apologize, because I think this is
getting into PHP territory and may not be specifically related to
CakePHP.)

If I place debug($patient) before the first foreach loop (for
'Visit'), I get the arrays as below. If I place it after the foreach
loop I get the same "Undefined index" message. How can I preserve that
array to reuse it to make a second table?

On May 15, 12:35 pm, Tony Thomas <[EMAIL PROTECTED]> wrote:
> debug($patient) produces:
>
> Array
> (
> [Patient] => Array
> (
> [id] => 5007
> [med_hist_id] => 0
> [gender] => M
> [st_of_birth] => [redacted]
> [st_of_res] => [redacted]
> [res_length] => 11 yrs
> [cntry_of_origin] => U.S.
> [dob] => [redacted]
> [siblings] => 2
> [birth_order] => 1
> [mono_before] => N
> [ethnicity] => [redacted]
> [race] => [redacted]
> [contact_by] => email
> [withdrawn] => N
> [kdas] => NKDA
> [mono_dx] => N
> )
>
> [Visit] => Array
> (
> [0] => Array
> (
> [id] => 2060
> [quest_id] =>
> [patient_id] => 5007
> [protocol] => Mono 5
> [vdate] => 4/22/2008
> [vtmstmp] => 1208840400
> [week] =>
> [yr] => 2
> [number] => 8
> [notes] => [redacted]
> [kit] => 0
> [sev_p] => 0
> [sev_scr] => 0
> [sev_pain] =>
> [modified] => 4/22/2008 2:25:47 PM
> [created] => 4/22/2008 2:11:39 PM
> )
> //truncated here, but shows the last ten visits as expected
>
> )
>
> [M5Symptom] => Array
> (
> [0] => Array
> (
> [id] => 19
> [patient_id] => 5007
> [symptom] => Stuffy Nose
> [start_date] => 12/18/2006
> [end_date] => 12/21/2006
> [severity] =>
>     [exported] =>
> [date_reported] =>
> [created] =>
>     [modified] =>
> )
> // again truncated by me, but the list of 25 shows up in the array
>
> )
>
> )
>
> On May 15, 12:23 pm, "[EMAIL PROTECTED]"
>
> <[EMAIL PROTECTED]> wrote:
> > Hi Tony,
> > What do you have in the $patient variable when you debug it?
> > debug($patient)
>
> > /Martin
>
> > On May 15, 5:37 pm, Tony Thomas <[EMAIL PROTECTED]> wrote:
>
> > > Hi All,
>
> > > I'm building a CakePHP app for tracking clinic patients, their visits,
> > > their symptoms and questionnaire answers. The barrier I've encountered
> > > is that each patient has many visits AND many symptoms. I want to view
> > > the patient record and their aggregate visits and symptoms.
>
> > > I've defined a hasMany relationship in the patient model as such:
>
> > > var $hasMany = array(
> > > 'Visit' => array(
> > > 'order'=> 'Visit.id DESC',
> > > 'limit'=> '10'
> > > ),
> > > 'M5Symptom' => array(
> > > 'className' => 'M5Symptom',
> > > 'order' => 'M5Symptom.modified DESC',
> > > 'limit' => '25'
> > > )
> > > );
>
> > > In the patient view I get the relevant patient data, and the
> > > corresponding list of visits, but I get the message, "Undefined
> > > index:  M5Symptom" for listing the symptoms. As far as I can tell the
> > > model is correct, because the query for the patient view finds and
> > > retrieves a list of 25 symptom records exactly as specified in the
> > > model. From that I take that the model and controller must be working
> > > as expected. Otherwise the query wouldn't be right and/or it wouldn't
> > &g

Re: Defining more than one hasMany relationship

2008-05-15 Thread Tony Thomas

debug($patient) produces:

Array
(
[Patient] => Array
(
[id] => 5007
[med_hist_id] => 0
[gender] => M
[st_of_birth] => [redacted]
[st_of_res] => [redacted]
[res_length] => 11 yrs
[cntry_of_origin] => U.S.
[dob] => [redacted]
[siblings] => 2
[birth_order] => 1
[mono_before] => N
[ethnicity] => [redacted]
[race] => [redacted]
[contact_by] => email
[withdrawn] => N
[kdas] => NKDA
[mono_dx] => N
)

[Visit] => Array
(
[0] => Array
(
[id] => 2060
[quest_id] =>
[patient_id] => 5007
[protocol] => Mono 5
[vdate] => 4/22/2008
[vtmstmp] => 1208840400
[week] =>
[yr] => 2
[number] => 8
[notes] => [redacted]
[kit] => 0
[sev_p] => 0
[sev_scr] => 0
[sev_pain] =>
[modified] => 4/22/2008 2:25:47 PM
[created] => 4/22/2008 2:11:39 PM
)
//truncated here, but shows the last ten visits as expected

)

[M5Symptom] => Array
(
[0] => Array
(
[id] => 19
[patient_id] => 5007
[symptom] => Stuffy Nose
[start_date] => 12/18/2006
[end_date] => 12/21/2006
[severity] =>
[exported] =>
[date_reported] =>
[created] =>
[modified] =>
)
// again truncated by me, but the list of 25 shows up in the array

)

)

On May 15, 12:23 pm, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> Hi Tony,
> What do you have in the $patient variable when you debug it?
> debug($patient)
>
> /Martin
>
> On May 15, 5:37 pm, Tony Thomas <[EMAIL PROTECTED]> wrote:
>
> > Hi All,
>
> > I'm building a CakePHP app for tracking clinic patients, their visits,
> > their symptoms and questionnaire answers. The barrier I've encountered
> > is that each patient has many visits AND many symptoms. I want to view
> > the patient record and their aggregate visits and symptoms.
>
> > I've defined a hasMany relationship in the patient model as such:
>
> > var $hasMany = array(
> > 'Visit' => array(
> > 'order'=> 'Visit.id DESC',
> > 'limit'=> '10'
> > ),
> > 'M5Symptom' => array(
> > 'className' => 'M5Symptom',
> > 'order' => 'M5Symptom.modified DESC',
> > 'limit' => '25'
> > )
> > );
>
> > In the patient view I get the relevant patient data, and the
> > corresponding list of visits, but I get the message, "Undefined
> > index:  M5Symptom" for listing the symptoms. As far as I can tell the
> > model is correct, because the query for the patient view finds and
> > retrieves a list of 25 symptom records exactly as specified in the
> > model. From that I take that the model and controller must be working
> > as expected. Otherwise the query wouldn't be right and/or it wouldn't
> > retrieve the pertinent records. The query that results is EXACTLY what
> > I want.
>
> > That leads me to believe the problem must be in the view.
>
> > Here's the view function in the patient controller:
>
> > function view($id = null) {
>
> > $this->Patient->id = $id;
> > $this->set('patient', $this->Patient->read());
>
> > }
>
> > Everything works right up until I try to list the symptoms. Here's the
> > code for listing symptoms in the view:
>
> > echo $html->tableHeaders(array('Symptom','Start Date','End Date',
> > 'Severity'));
>
> > foreach ($patient['M5Symptom'] as $symptom) {
>
> > echo $html->tableCells(
>
> > array($symptom['symptom'],
> >   $symptom['start_date'],
> >   $symptom['end_date

Re: Defining more than one hasMany relationship

2008-05-15 Thread Tony Thomas

print_r($patient['M5Symptom']) results in the expected list of
symptoms:

Array
(
[0] => Array
(
[id] => 19
[patient_id] => 5007
[symptom] => Stuffy Nose
[start_date] => 12/18/2006
[end_date] => 12/21/2006
[severity] =>
[exported] =>
[date_reported] =>
[created] =>
[modified] =>
)

//etc. for the full list of 25 most recent symptoms

)


On May 15, 12:00 pm, Dovdimus Prime <[EMAIL PROTECTED]> wrote:
> Yep: 'undefined index' definitely means you're not referencing your
> part of the patients array properly. The problem may well be nothing
> to do with the associations in your model.
>
> Use print_r to look at the array you're passing into the view.
>
> David

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



Defining more than one hasMany relationship

2008-05-15 Thread Tony Thomas

Hi All,

I'm building a CakePHP app for tracking clinic patients, their visits,
their symptoms and questionnaire answers. The barrier I've encountered
is that each patient has many visits AND many symptoms. I want to view
the patient record and their aggregate visits and symptoms.

I've defined a hasMany relationship in the patient model as such:

var $hasMany = array(
'Visit' => array(
'order'=> 'Visit.id DESC',
'limit'=> '10'
),
'M5Symptom' => array(
'className' => 'M5Symptom',
'order' => 'M5Symptom.modified DESC',
'limit' => '25'
)
);

In the patient view I get the relevant patient data, and the
corresponding list of visits, but I get the message, "Undefined
index:  M5Symptom" for listing the symptoms. As far as I can tell the
model is correct, because the query for the patient view finds and
retrieves a list of 25 symptom records exactly as specified in the
model. From that I take that the model and controller must be working
as expected. Otherwise the query wouldn't be right and/or it wouldn't
retrieve the pertinent records. The query that results is EXACTLY what
I want.

That leads me to believe the problem must be in the view.

Here's the view function in the patient controller:

function view($id = null) {

$this->Patient->id = $id;
$this->set('patient', $this->Patient->read());

}

Everything works right up until I try to list the symptoms. Here's the
code for listing symptoms in the view:

echo $html->tableHeaders(array('Symptom','Start Date','End Date',
'Severity'));

foreach ($patient['M5Symptom'] as $symptom) {

echo $html->tableCells(

array($symptom['symptom'],
  $symptom['start_date'],
  $symptom['end_date'],
  $symptom['severity'],
)
);

}

I've looked at all of this over and over and I just can't find out why
'M5Symptom' is undefined. Just above this, 'Visit' lists recent visit
dates for me with the exact same logic in place.

Am I wrong in assuming I can define more than one hasMany? If so, why
is the correct query generated? I'm hoping another set of eyes will
find what I'm missing. Sleeping on it didn't help.

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



Re: Validation: beforeSave and setting fields

2007-04-05 Thread Tony

Nice. That works perfectly.

Thanks,
- Tony


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Validation: beforeSave and setting fields

2007-04-04 Thread Tony

I am looking for an answer related to validation and haven't been able
to track it down. I am using cake v1.1.13.4450 and all validation is
done at the model level using beforeSave().

The goal is to invalidate and then prepopulate a field so that it will
display with an error but will have the content I specify.

Something like:

app/models/model.php:
...
function beforeSave()
{
...
$this->invalidate('field');
$this->data['Model']['field'] = 'New content';
...
}

...but that doesn't work.

Any tips would be appreciated.

Thanks,
- Tony


--~--~-~--~~~---~--~~
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: Need help with linked tables

2007-01-10 Thread Tony Lambiris

Nevermind, I got it working. game.php was actually named
games.php... sorry for the noise!


--~--~-~--~~~---~--~~
 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
-~--~~~~--~~--~--~---



Need help with linked tables

2007-01-09 Thread Tony Lambiris

The way my app works is I have three tables: users, systems and games.

users relates to systems
systems relates to games
users does not relate directly to games

When I am in my User controller, I want to be able to issue a command
like this:
$this->User->System->find("ps3")
and have it return a list of games based off PK systems.id (which
equals games.system_id).

In my models (user.php, system.php and game.php), I have the following
(respectively):

class User extends AppModel {
  var $name = 'User';
  var $hasMany = array('System');
}

class System extends AppModel {
  var $name = 'System';
  var $hasMany = array('Game');
  var $belongsTo = array('User');
}

class Game extends AppModel {
  var $name = 'Game';
  var $belongsTo = array('System');
}

When I try to access my User controller, I get the error:

Fatal error: Class 'Game' not found in
/vhosts/site/cake_1.1.12.4205/cake/libs/model/model_php5.php on line
438

Any ideas? Im kinda new to the MVC world, so it's kind of confusing to
me. I read some where scaffolding helps sort these out visually.

TIA.


--~--~-~--~~~---~--~~
 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: Multiple Databases

2006-09-13 Thread Tony

Nate that's pretty interesting. I'm glad to see that there is a way of
using multiple databases with an application.

When you were talking about this;
// Run a query
$this->Model->findAll(...);
// Switch to a different database connection
$this->Model->setDataSource("other_connection");
// Run another query
$this->Model->findAll(...);
// Switch back to the original database
$this->Model->setDataSource("default");  connection

Would that be in the View or the Controller? Would I also need to
create a Model file for each table in the other database?

- Tony


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Migrating to Cake and Few General Questions

2006-09-12 Thread Tony

Okay I just thought of something John. If I'm doing a $hasMany in the
Level model will I also need to do a $belongsTo in the Role model?

Would I do the same thing and just use

class Roles extends AppModel
{

var $name = 'Roles';
var $belongsTo = array('Level' => array('className'   => 'Level',
'condition'
 => '',
'order'
   => '',

'foreignKey'=> 'role1_id'
 ),
 'Level2' => array('className'   =>
'Level',
'condition'
 => '',
'order'
   => '',

'foreignKey'=> 'role2_id'
 )
 );
}


Am I close here?


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Migrating to Cake and Few General Questions

2006-09-12 Thread Tony

DOH! Typo with the same key names.

Okay that makes perfect sense. Dang now I'm really seeing how CakePHP
can totally help me out here.

And yes that REALLY helps out here. It's so sad I had to leave my
office to chat on IRC because our IT department won't let me have
access to an IRC channel, have a localhost, or anything along those
lines. Sometimes I'm surprised how I get anything done around here. LOL
HA HA HA!


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Migrating to Cake and Few General Questions

2006-09-12 Thread Tony

John and AD7six,

Did I do this correctly?

class Level extends AppModel
{
   var $name = "Level";
   var $hasMany = array('Role1' =>
 array('className'   => 'Role',
   'conditions'   => '',
   'order'  => '',
   'limit'   => '',
   'foreignKey'  => 'role1_id',
   'dependent'  => false,
   'exclusive'   => false
   'finderSql'   => ''
 ),
 'Role2' =>
 array('className'   => 'Role',
   'conditions'  => '',
   'order'  => '',
   'limit'   => '',
   'foreignKey' => 'role1_id',
   'dependent' => false,
   'exclusive'  => false
   'finderSql'   => ''
 )
   );
}

I hope that's right LOL! If I have this correct how would I pull in the
data. Would I do something like $this->Level->read(null, '44');

Then how would I access the titles field in the roles database when I'm
outputting into the view.

You guys are helping me out so much I totally appreciate all the help.


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Migrating to Cake and Few General Questions

2006-09-12 Thread Tony

So I was on the right track with the URL params. I totally agree with
you that cake makes things a lot easier. I read through pretty much the
entire CakePHP manual, including the models chapter.

Let me refocus my question. If I have those two role fields that aren't
named according to convention, how do I override the default. I read in
the manual that you can do it to one field but can I do it to more than
one field and also how do I do that?

The manual is good and all but it's just so unclear on things. It just
gives a really really high level view but nothing very well or detailed
in the documentation. That's why I'm here at the google group.


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Migrating to Cake and Few General Questions

2006-09-11 Thread Tony

S...no one has been able to answer my question about the roles,
having two fields (role1_id and role2_id) that relate to the roles
table. I guess what I'm trying to ask is how do you over ride
scaffolding in this situation. Is there documentation that shows me
what I need to do?


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Migrating to Cake and Few General Questions

2006-09-08 Thread Tony

nate, that helps a lot. Based on the url you gave me
http://site.com/posts/list/5/9 you're saying that it would be in an
array(5, 9) and that to get that I would do something like
$this->params['pass'][0] to get 5 and $this->params['pass'][1] to get
9?

If that's correct then that's pretty easy. I sorta had an idea that it
would be something like that but wasn't quite sure.

OKAY... so now back to my first question about the migration how do I
deal with two foreign keys that relate to the same table for the roles.


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Migrating to Cake and Few General Questions

2006-09-08 Thread Tony

Yes my IT department is COMPLETELY anal. It's so bad I can't even have
a localhost. And yes I meant to say "down" and not "done". LOL!

I'm getting this error:
Connection to irc://irc.freenode.org reset. Reconnecting in 30 seconds.

Would that be an IT being anal thing.

Ha ha ha... I dont' think I'm getting the clear pictures of how to grab
the values from a url. I know in traditional PHP I can do something
like this $_GET['myUrlParam'] or $_POST['formItem']

So how do I do that? Is it $this->data['myUrlParam']? That's what I'm
trying to figure out. 

- Tony


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Migrating to Cake and Few General Questions

2006-09-08 Thread Tony

I was just using Chatzilla and then I tried the cakephp irc page and
both disconnected me to the server. It's been such a freaking long time
since I have used IRC that I'm totally rusty here.

Is the server done?


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Migrating to Cake and Few General Questions

2006-09-08 Thread Tony

John,

That would be great to join into IRC but what client should I use for
IRC, is there one that is free?

And yeah I know my set up sucks. It's not so much mine but one of those
things that IT set up and I'm looking at it going "WTF?" I wanted it a
much better way but they insisted that it be the way it is now and now
I'm getting screwed over for it.

BTW what's the IRC channel?

- Tony


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Migrating to Cake and Few General Questions

2006-09-08 Thread Tony

Hey AD7six,

How do I grab the params from a url using cake?

Here's what my database looks like:
++
+ LevelID < - (Item id for conent)
+ ParentLevelID <- (holds an ID from LevelID that will be the parent of
the child level)
+ Level <- (what level it is i.e 1, 2, 3, 4, 5)
+ LevelOrder <-(order in which the items appears within that level)
+ RoleID1 <-(Role ID that relate to the table Roles)
+ RoleID2 <-(Role ID that relate to the table Roles)
+ LevelTitle
+ Content
++

The self join makes sense, but what do I do for roles?

How many keys can you over ride in the association defenition? The main
problem is that I have two foriegn key fields that relate to the same
table, Roles. 


-t


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Migrating to Cake and Few General Questions

2006-09-08 Thread Tony

I'm new to Cake so I'm a bit confused on a few things after reading
part of the documentation. We are a PHP shop and I'm a big fan of the
homegrown framework so I turned to Cake and I like what I'm seeing.

First off, how do I format and access multiple url params? For example
in normal PHP we do something like
index.php?module=levels&action=show&level=2&parentLevelId=24&levelId=44

Also I'm in the process of migrating code from an older application
into using CakePHP. What I'm possibly having a problem with is how my
database was set up as far as fields go. Not so much in the naming but
how they are storing data. How it works is we have multiple levels
(i.e. Level 1, Level 2, Level 3, Level 4) but we have one table
(levels) and a field called "Level" that contains what Level it is and
"ParentLevelID" which if we are on Level 2 then we would have a
ParentLevelID of a Level 1 item from that same table. (I know this
isn't the best design and it's not how I wanted it designed).

So basically ParentLevelID is the foriegn key of it's own table and I
have to check to see if there are any levels that relate to the parent
level before deleting. How do I check for this and set up the model for
that?

One more question. Within that same table levels we have two role ids
(role1_id and role2_id) as we can have 2 roles per level. The problem
I'm seeing is that according to how cake works with the database you
have "theforiegntableName_id" but I have two foriegn fields that relate
to the same table. Again not how I wanted it designed. So how would I
deal with this without changing the database structure? Do I rename
those fields or add a variable some where to configure something?

Thanks for the help.


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Cake Errors I'm getting with

2006-09-06 Thread Tony

I just figured that out and came back to post that. I didn't see
anything with the documentation for that.


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Cake Errors I'm getting with

2006-09-06 Thread Tony

Hey guys,

I'm using CakePHP and I'm getting a few errors. I'm going through the
blog tutorial and this is what is happening:


Warning:
file_put_contents(/www/mydomainname.com/mysite/app/tmp/cache/models/default_scribble_list)
[function.file-put-contents]: failed to open stream: Permission denied
in /www/mydomainname.com/mysite/cake/basics.php on line 826

Warning:
file_put_contents(/www/mydomainname.com/mysite/app/tmp/cache/models/default_posts)
[function.file-put-contents]: failed to open stream: Permission denied
in /www/mydomainname.com/mysite/cake/basics.php on line 826

Warning: session_start() [function.session-start]: Cannot send session
cookie - headers already sent by (output started at
/www/mydomainname.com/mysite/cake/basics.php:826) in
/www/mydomainname.com/mysite/cake/libs/session.php on line 131

Warning: session_start() [function.session-start]: Cannot send session
cache limiter - headers already sent (output started at
/www/mydomainname.com/mysite/cake/basics.php:826) in
/www/mydomainname.com/mysite/cake/libs/session.php on line 131


I had to uncomment the line:
 define ('BASE_URL', env('SCRIPT_NAME'));
in the folder /app/config/core.php

Am I missing something here? I'm also using the development setup and
mysite is the webroot as you can see from above.

The funny thing is that everything seems to be working but I'm getting
those errors.


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Models, find/findAll and object programming

2006-09-01 Thread Tony

Thanks all ;)

I know of limitations of OO in PHP4. I "prefer" version 5 ... if I'm
able to choose not to use it :D

Bret writes :
"to override the core of
cakePHP's behavior and write code that takes cake's array format and
converts it to objects"

That's what I have done (adding some findOO method, calling find and
returning an instance). And it's not really hard to code. That's why
I'm so surprise it's not in the cake package yet.

But from now, I will wait for the 2.0 version, hoping those
functionnalities will be considered as important.  And for the time, I
will try to find some real OO solution online, like Rails.

Tony


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



  1   2   >