Re: Editor for Cakephp

2015-06-16 Thread Mario Dourado
I vote for Sublime.

On Tue, Jun 16, 2015 at 12:19 PM, Stephen S  wrote:

> I also swear by NetBeans.
>
> On 13 June 2015 at 09:33, hanna marie natividad 
> wrote:
>
>> Try Netbeans.
>>
>>
>> On Saturday, June 13, 2015 at 3:12:42 PM UTC+8, Pamela Whittaker wrote:
>>>
>>> What do you suggest as an editor for CakePHP please? I use Dreamweaver
>>> cs6 for PHP but that doesn't open .ctp files. Thanks
>>>
>>  --
>> Like Us on FaceBook https://www.facebook.com/CakePHP
>> Find us on Twitter http://twitter.com/CakePHP
>>
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "CakePHP" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to cake-php+unsubscr...@googlegroups.com.
>> To post to this group, send email to cake-php@googlegroups.com.
>> Visit this group at http://groups.google.com/group/cake-php.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> Kind Regards
>  Stephen Speakman
>
> --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to cake-php+unsubscr...@googlegroups.com.
> To post to this group, send email to cake-php@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Mario Dourado
http://zero7.org

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

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


Re: How to connect to a postgres database with CakePHP?

2014-01-15 Thread Mario Dourado
And how do you setup the CakePHP database config?


On Mon, Jan 13, 2014 at 6:23 AM, Luís de Sousa wrote:

> Any information on this issue is welcome. Thank you.
>
> --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to cake-php+unsubscr...@googlegroups.com.
> To post to this group, send email to cake-php@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php.
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 
Mario Dourado
http://zero7.org

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

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


Re: Hidden fields in IE (cakePHP: 2.3.2)

2013-04-30 Thread Mario Rico
Perfect Jeremy

I wonder why it is happening only in IE.

Thanks you very much.

On Tuesday, 30 April 2013 11:28:31 UTC+1, Jeremy Burns wrote:
>
> What happens when you try:
>
> echo $this->Form->hidden('category', array('value' => $category)); 
>
> Jeremy Burns
> Class Outfit
>
> http://www.classoutfit.com 
>
> On 30 Apr 2013, at 11:20:59, Mario Rico > 
> wrote:
>
> I'm having a problems with Internet explorer and hidden fields. it isn't 
> hide them.
>
> IE 10 or older
> cakePHP: 2.3.2
>
>
> use:
> echo $this->Form->input('category', array('type' => 'text', 'value' => 
> $category, 'hidden' => true, 'label' => false)); 
>
> source generated:
>  type="text" hidden="1" value="Certification"/>
>
>
> can you help me?
>
> thank you
>
> -- 
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>  
> --- 
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to cake-php+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.
> 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.




Hidden fields in IE (cakePHP: 2.3.2)

2013-04-30 Thread Mario Rico
I'm having a problems with Internet explorer and hidden fields. it isn't 
hide them.

IE 10 or older
cakePHP: 2.3.2


use:
echo $this->Form->input('category', array('type' => 'text', 'value' => 
$category, 'hidden' => true, 'label' => false)); 

source generated:



can you help me?

thank you

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

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




only runs default index with a subdomain

2012-12-19 Thread Mario Rico
Hello Group,

I am trying to install cakePHP 2.2.4 in my 1and1 server.

I couldn't set htaccess because it cause 500 error. I tried all htaccess 
configurations as in cakePHPcookbook guide says and I couldn't run it fine. 
I uncommented "Configure::write('App.baseUrl', env('SCRIPT_NAME'));" in 
core file. and with a subdomain it is running.

now I am using subdomain "http://mario.homesonsale.es/"; pointing to a 
directory called  "mario" and it works fine (with www.homesonsale.es/mario 
makes a controller error). but if I want to access to 
http://mario.homesonsale.es/posts/index an 404 error appear. All required 
files are in server (they are a copy of my localhost files where they run 
ok)

Where should be the problem?

thanks 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.




Set-Cookie header issue 2.0.6 vs 2.1.1

2012-04-03 Thread Mario
The exact same code:
- with 2.0.6 is serving a JSON reply with the Set-Cookie header
present in the Response Headers
- with 2.1.1 is serving the same reply without the Set-Cookie header

I tried to add in 2.1.1 the missing P3P header (ticket #2515 in
lighthouse), it worked but the issue with Set-Cookie remains.

Any suggestion or idea where to focus to find a solution?

Thank you in advance,

Mario

-- 
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: 2.1 issue with 'joins' where table is a SELECT

2012-04-01 Thread Mario
Excellent, thank you very much for pointing the right direction.

On Apr 2, 12:11 am, stork  wrote:
> ...and watch 
> tickethttp://cakephp.lighthouseapp.com/projects/42648/tickets/2709-modelsch...

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


2.1 issue with 'joins' where table is a SELECT

2012-04-01 Thread Mario
I have an issue with the new 2.1.1 version compared to 2.0.6

In several places in my models I have queries like:

$this->find('all', array(
  'joins' => array(
array(
  'type' => 'LEFT',
  'table' => '(SELECT example.id FROM ...

I know that table should contain "the table for the join" but
sometimes it came very handy to have a select there, and it worked.

Now is no longer working, apparently because where 2.0.6 writes
... LEFT JOIN (SELECT example.id FROM ...
now 2.1.1 writes
... LEFT JOIN `schemaname`.(SELECT example.id FROM...

Any idea on how to upgrade to 2.1.1 without heavily messing with my
existing tested queries?

-- 
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: Routing to /img a request to /app/img

2012-01-03 Thread Mario
Hi Andy,

great, I suspected this could be done both ways, but really hadn't a
clue about how.

Now thank to your suggestions I solved it with Media Views, see
http://book.cakephp.org/2.0/en/views/media-view.html
Quite sure that adding a mod_rewrite rule is cleaner and more
efficient, I might try that later.

Here below the full details of the -still elegant- Cake 2.0 solution.

Add to Config/routes.php

Router::connect(
  '/app/img/*',
   array(
'controller' => 'workarounds',
'action' => 'showmedia',
'file' => 'whatever'
   )
);

and create a new controller at Controller/WorkaroundsController.php

viewClass = 'Media';

$params = array(
'id' => $file.'.'.$this->request->params['ext'],
'name' => $file,
'download' => false,
'extension' => $this->request->params['ext'],
'path' => 'img'.DS
);
$this->set($params);
  }
}

?>

Thank you again.

Best,

Mario


On Jan 3, 6:52 am, AD7six  wrote:

> If you don't simply solve this with mod_rewrite (add a rule ala ^app/
> (.*) $1 to your _webroot_ .htaccess file), just route /img/* to a
> controller action that uses media view.
>
> AD

-- 
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: Routing to /img a request to /app/img

2012-01-02 Thread Mario
Ty for the answer.

Fixed everywhere, but unfortunately is not an option for an already
shipped mobile app client...
Of course future versions will take care of the issue, but I would
like to solve it server side also for the existing ones.

Best,

Mario


On Jan 2, 8:31 pm, euromark  wrote:
> one question:
> is fixing the obvious error in the "poor previous configuration" not
> an option?
> if would probably fix other similar errors, as well
>
> On 2 Jan., 20:09, Mario  wrote:
>
>
> > Hi all!
>
> > One question on routing: due to a poor previous configuration I would
> > need all the requests for image files sent to /app/attachments/... be
> > seen by Cake as sent to /attachments/... (where /attachments is a
> > folder in webroot, just like /img) so that the image can be served
> > instead of getting an "Error: [MissingActionException] Action
> > AppController::attachments() could not be found".
>
> > How can I achieve that?
>
> > I would really appreciate if anyone could point me to the right
> > direction.
>
> > Best,
>
> > Mario

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


Routing to /img a request to /app/img

2012-01-02 Thread Mario
Hi all!

One question on routing: due to a poor previous configuration I would
need all the requests for image files sent to /app/attachments/... be
seen by Cake as sent to /attachments/... (where /attachments is a
folder in webroot, just like /img) so that the image can be served
instead of getting an "Error: [MissingActionException] Action
AppController::attachments() could not be found".

How can I achieve that?

I would really appreciate if anyone could point me to the right
direction.

Best,

Mario

-- 
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: HTTPS and HTTP on same app

2011-12-19 Thread Mario
Just solved, as suggested by some nice guys on #cakephp on
irc.freenode.net, it was a matter of setting the DocumentRoot as
indicated in http://book.cakephp.org/2.0/en/installation.html#production,
that is at /cake_install/app/webroot.

On Dec 19, 7:11 pm, Mario  wrote:
> Hi all,
>
> I have just added to a fully working site based on CakePHP 2.0 and
> Apache 2.2.16 a wildcard SSL certificate. Created virtual hosts
> pointing HTTPS to the same HTTP app.
>
> But when I load the HTTPS version, the certificate is ok but lots of
> errors: first thing
> [Mon Dec 19 16:34:57 2011] [error] [client ...] PHP Notice:  Constant
> CAKE_CORE_INCLUDE_PATH already defined in /srv/www/xxx2/public_html/
> app/webroot/index.php on line 59
> [Mon Dec 19 16:34:57 2011] [error] [client ...] PHP Stack trace:
> [Mon Dec 19 16:34:57 2011] [error] [client ...] PHP   1. {main}() /srv/
> www/xxx2/public_html/index.php:0
> [Mon Dec 19 16:34:57 2011] [error] [client ...] PHP   2. require() /
> srv/www/xxx2/public_html/index.php:40
> [Mon Dec 19 16:34:57 2011] [error] [client ...] PHP   3. define() /srv/
> www/xxx2/public_html/app/webroot/index.php:59
>
> If I comment out the CAKE_CORE_INCLUDE_PATH definition in /srv/www/
> xxx2/public_html/index
> the site is loading but all the depending files are not, example
> GEThttps://test1.xxx2.com/css/additional.css404 (Not Found)
>
> I am sure there is quite simple explanation for the issue, but I can't
> find it external help...
>
> Any idea?
>
> P.S. Just to give a bit of additional context, I am in this because I
> need (as per Facebook request) to provide also an HTTPS version of a
> Facebook app

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


HTTPS and HTTP on same app

2011-12-19 Thread Mario
Hi all,

I have just added to a fully working site based on CakePHP 2.0 and
Apache 2.2.16 a wildcard SSL certificate. Created virtual hosts
pointing HTTPS to the same HTTP app.

But when I load the HTTPS version, the certificate is ok but lots of
errors: first thing
[Mon Dec 19 16:34:57 2011] [error] [client ...] PHP Notice:  Constant
CAKE_CORE_INCLUDE_PATH already defined in /srv/www/xxx2/public_html/
app/webroot/index.php on line 59
[Mon Dec 19 16:34:57 2011] [error] [client ...] PHP Stack trace:
[Mon Dec 19 16:34:57 2011] [error] [client ...] PHP   1. {main}() /srv/
www/xxx2/public_html/index.php:0
[Mon Dec 19 16:34:57 2011] [error] [client ...] PHP   2. require() /
srv/www/xxx2/public_html/index.php:40
[Mon Dec 19 16:34:57 2011] [error] [client ...] PHP   3. define() /srv/
www/xxx2/public_html/app/webroot/index.php:59

If I comment out the CAKE_CORE_INCLUDE_PATH definition in /srv/www/
xxx2/public_html/index
the site is loading but all the depending files are not, example
GET https://test1.xxx2.com/css/additional.css 404 (Not Found)

I am sure there is quite simple explanation for the issue, but I can't
find it external help...

Any idea?

P.S. Just to give a bit of additional context, I am in this because I
need (as per Facebook request) to provide also an HTTPS version of a
Facebook app

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


Strange caching

2011-05-17 Thread Mario Kastner
Hi,

@first: Please excuse my bad english - i hope you will understand what i mean

I have a Model called Newsletter. There is a field called "state" (it
marks the state of an sending) ... Since a few days the update query
works (the database show the updated value) but cake render out an
empty array field (see below) What make i wrong?

Array
(
[Newsletter] => Array
(
[id] => 8

[sender_email] => mkast...@iwaves.at
[sendtime] => 2011-05-17 15:48:07
[state] =>
[sended] => 0
[chunksactive] => 0
[lastoffset] => 0
[released] => 1
[created] => 2011-05-15 19:12:53
[modified] => 2011-05-17 15:48:38
[actions] => Array
(
[view] =>
[edit] =>
[delete] =>
)

)

)

The Update procedure in the controller:

$this->Newsletter->id = $id;
$this->Newsletter->saveField('released', '1');
$this->Newsletter->saveField('state', 'waiting'); <-- This should be
displayed --- but nothing happens on the page! In the Database
everything is set correct (Value is waiting).
$this->Newsletter->saveField('chunksactive', '0');
$this->Newsletter->saveField('sended', '0');
$this->Newsletter->saveField('lastoffset', '0');

Caching is disabled - Systemwide!

Please help! Thx

-- 
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: Interfacing with Android app (and/or iPhone)

2010-07-28 Thread Mario
Hi Shaz,

thank you very much for your answer and interesting lead.

> To answer both in one go - why not just create an app that uses the
> built in rendering engine (webkit i think) for logging in /
> identifying user/phone within your app?

The package is webkit, you are right, official page at:
http://developer.android.com/reference/android/webkit/package-summary.html

And I also found a small tutorial (didn't try it yet) at
http://senior.ceng.metu.edu.tr/2009/praeda/2009/01/11/how-to-pure-html-android-application/

But let me better understand your approach, not sure I understood. You
are suggesting to serve from Cake HTML pages (probably styled or
created on purpose) that can be browsed by the Android app?

Best, Mario

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


Interfacing with Android app (and/or iPhone)

2010-07-27 Thread Mario
Hi all,

I have developed with CakePHP a "social network" website complete with
mobile version for mobile browsing. Users are authenticated with Auth
and also tracked with cookies if not authenticated.

Now I want to develop the related Android app (and later on the iPhone
one), but before starting I have in my mind a number of unresolved
(and probably not too clever...) questions, all related to the
possible best practices to interface a CakePHP server with mobile
app... For instance:

* I expect to exchange data via JSON (services already in place for
some JS and Flex features) but as the request is not coming from a
browser, how do I get info about the user / phone? Some info are
contained in the HTTP request? How do I parse them?

* Authentication: which the best (and reasonably secure) method to
send login and password (or new user registrations) to the Auth logic?

I would really appreciate any help or link to related topics.

Thank you in advance.

Best,

Mario

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


pagination for custom query

2010-06-17 Thread Mario Simaremare
dear all,
i just learn the cake in a week. and i start to get confused with how
to paginate a custom query.
if i have a more complex table:

users:
id, group_id, name, password

groups:
id, name

roles:
id, name

group_roles
id, role_id, group_id

then i have a query:
"SELECT users.name FROM
users JOIN groups ON users.group_id=groups.id
JOIN group_roles ON groups.id=group_roles.group_id
JOIN roles ON group_roles.role_id=role.id
WHERE roles.name='someRole';

how to page it? does the Paginator can paginate it? just like
paginates a model selection.
if i modify the model, it would be bad. 'coz i think it's not really
reusable. so, can somebody help me,...

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


[ask] : reuseable view

2010-06-15 Thread Mario Simaremare
dear all,

i am very new with php and the cake. i used to play with java
actually.
i would ask you, if there is a way in the cake to create a single view
file to view, add, and edit then reuse them.
i mean to use the same view with different models. the views
automatically detects the table columns and it's header then fill the
cell with the thrown models data?

thank you,

regards,

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


Paginate: sorting JOINed data columns

2010-02-20 Thread Mario
Hi all,

I am not finding a solution for the following issue:

I have a perfectly working pagination query for model X that returns
data from:

* model X itself

* model Y, through a LEFT join to a DB table added with

$this->paginate['joins'][] = array(
'type' => 'LEFT',
'table' => 'ys',
'alias' => 'Y' ...

* Z, through a LEFT join to a custom SELECT added with

$this->paginate['joins'][] = array(
'type' => 'LEFT',
'table' => '(SELECT ... FROM ... WHERE ...)',
'alias' => 'Z' ...

The problem is that, while I can sort for pagination both X and Y data
with $paginator->sort, the same thing is not working with Z.

While
$paginator->sort('weight', 'Y.banana_weight')
nicely produces
...ORDER BY `Y`.`banana_weight`...
at the end of the SQL query,

something like
$paginator->sort('name', 'Z.apple_name')
is failing to produce the corresponding
...ORDER BY `Z`.`apple_name`...
at the end of the SQL query, nothing is there (so the view is shown
but not ordered).
But both `Y`.`banana_weight` and `Z`.`apple_name` are existing fields
in the query results and in the array returned by Cake.

What I can certainly see is that Z is not a defined model, but still I
would have expected this to work. Any idea or workaround?

Thank you in advance,

Mario

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


Issue with timeAgoInWords() method

2009-12-23 Thread Mario
Hi all,

I have a probelem with the 'userOffset' option of
http://api.cakephp.org/class/time-helper#method-TimeHelpertimeAgoInWords

This snippet of test code in view
timeAgoInWords(
$activity['Activity']['modified'],
array('userOffset' => 5)
);

echo $time->timeAgoInWords(
$activity['Activity']['modified'],
array('userOffset' => 4)
);
?>

outputs something like:

2009-12-23 10:59:30
7 hours, 4 minutes ago
7 hours, 4 minutes ago

meaning that no matter what the userOffset option contains, no offset
seems to be applied, I would have expected a 1 hour difference in
between the two outputs.

Any hint or suggestion?

Best,

Mario

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: How can I get the current session?

2009-12-03 Thread Mario
Hi Nick,

I will definitely take a look, even if my aim right now is to track
unregistered users for days and in between different sessions, imagine
shopping carts for e-commerce or any other implementation where the
registration process is delayed or completed step by step at different
times.

Regarding substituting IPs with sessions, my previous reply to Dave
might contain a possible solution.

Best,

Mario

On 3 Dic, 03:29, nurvzy  wrote:
> Hi Mario,
>
>   I've repackaged my little who's online utility as a plugin.  It
> works well enough for my purposes basing off IP, its easy to track
> test and get at easily.  /shrug
>
> If you're interested, I wrote about 
> it:http://www.webtechnick.com/blogs/view/227/CakePHP_Who_s_Online_Plugin
>
> You can dig around in the source to see how it works, if you come up
> with a better way feel free to add to it/etc... =)
>
> Nick

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: How can I get the current session?

2009-12-03 Thread Mario
Hi Dave,

thank you for help.

I moved forward a little bit on the issue.

With PHP function session_id() I can get the session id, and it
appears to be the same exact value stored in the 'CAKEPHP' cookie (or
whatever name you configure 'Session.cookie').

I just wonder, even if it is not an issue, if there is any method in
CakePHP Session to get the same.

Best,

Mario


On 3 Dic, 01:11, Dave  wrote:
> You can use the session id as the key as well if you prefer
>
> You just need to be sure to change the Security.level value in your core.php
> to at most medium.  On high it regenerates the session id every request.

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: How can I get the current session?

2009-12-02 Thread Mario
Hi Nick,

thank you for your reply, very interesting suggestion for the who's
online feature.

And yes, once I get hold of who is browsing, I want to store the data
in a table (may be 'users' with a status flag indicating they are not
registered).

But why rely on $_SERVER['REMOTE_ADDR'] (IPs aren't prone to
duplicates, two or more users behind the same firewall?), where
CakePHP automatically writes a 'CAKEPHP' (session, I think) cookie? I
mean, a part from not being to access to its value, just like
me :-) ...

Best,

Mario



On 2 Dic, 05:10, nurvzy  wrote:
> Hi Mario,
>
>   Well, if you want to use Sessions or Cookies I suggest reading the
> book on the two.  The problem you'll face is both cookie and session
> are client based objects.  So you can set all the sessions and cookies
> you want but you'll need a way to store them somewhere in either your
> server memory or a database so *you* can see it.   I suggest ditching
> the Session/Cookie idea and go with a database or flat-file.
>
>   The way I've tracked users in the past is create a database table
> ('onlines' for me).  Then in my Online model I just create a little
> method that delete's all entries greater than 10 minutes modified.  I
> then pass in $this->here to my Online's createOrUpdateUser model
> function, this is all in my beforeFilter() in my app_controller.php
>
> //app_controller beforeFilter()
> $this->Online->update();
> $this->Online->createOrUpdateUser($this->here);
>
> In createOrUpdateUser($currentPage = null) I use the IP ( $_SERVER
> ['REMOTE_ADDR'] ) as the key and just update/create where the user
> currently is in the app $this->here in the app_controller.
>
> This gives me a nice little Online table that I can look at to see
> who's online (for the last 10 minutes).
>
> Hope that helps,
> Nick
>
> On Dec 1, 11:50 am, Mario  wrote:
>
> > Hi all,
>
> > I am dealing with unregistered users (no Auth login) and I want to
> > track them from page to page using sessions.
>
> > I see in my browser a cookie named 'CAKEPHP' and I thought I could
> > read it in a controller with
> > $this->Cookie->read(Configure::read('Session.cookie'))
> > [where in my config/core.php I have
> > Configure::write('Session.cookie', 'CAKEPHP');]
> > But it doesn't work, I get nothing.
>
> > Any hint or alternative method I could implement?
>
> > Thank you in advance.
>
> > Best,
>
> > Mario

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: How can I get the current session?

2009-12-02 Thread Mario
Hi Nick,

thank you for your reply, very interesting suggestion for the who's
online feature.

And yes, once I get hold of who is browsing, I want to store the data
in a table (may be 'users' with a status flag indicating they are not
registered).

But why rely on $_SERVER['REMOTE_ADDR'] (IPs aren't prone to
duplicates, two or more users behind the same firewall?), where
CakePHP automatically writes a 'CAKEPHP' (session, I think) cookie? I
mean, a part from not being to access to its value, just like
me :-) ...

Best,

Mario



On 2 Dic, 05:10, nurvzy  wrote:
> Hi Mario,
>
>   Well, if you want to use Sessions or Cookies I suggest reading the
> book on the two.  The problem you'll face is both cookie and session
> are client based objects.  So you can set all the sessions and cookies
> you want but you'll need a way to store them somewhere in either your
> server memory or a database so *you* can see it.   I suggest ditching
> the Session/Cookie idea and go with a database or flat-file.
>
>   The way I've tracked users in the past is create a database table
> ('onlines' for me).  Then in my Online model I just create a little
> method that delete's all entries greater than 10 minutes modified.  I
> then pass in $this->here to my Online's createOrUpdateUser model
> function, this is all in my beforeFilter() in my app_controller.php
>
> //app_controller beforeFilter()
> $this->Online->update();
> $this->Online->createOrUpdateUser($this->here);
>
> In createOrUpdateUser($currentPage = null) I use the IP ( $_SERVER
> ['REMOTE_ADDR'] ) as the key and just update/create where the user
> currently is in the app $this->here in the app_controller.
>
> This gives me a nice little Online table that I can look at to see
> who's online (for the last 10 minutes).
>
> Hope that helps,
> Nick
>
> On Dec 1, 11:50 am, Mario  wrote:
>
> > Hi all,
>
> > I am dealing with unregistered users (no Auth login) and I want to
> > track them from page to page using sessions.
>
> > I see in my browser a cookie named 'CAKEPHP' and I thought I could
> > read it in a controller with
> > $this->Cookie->read(Configure::read('Session.cookie'))
> > [where in my config/core.php I have
> > Configure::write('Session.cookie', 'CAKEPHP');]
> > But it doesn't work, I get nothing.
>
> > Any hint or alternative method I could implement?
>
> > Thank you in advance.
>
> > Best,
>
> > Mario

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


How can I get the current session?

2009-12-01 Thread Mario
Hi all,

I am dealing with unregistered users (no Auth login) and I want to
track them from page to page using sessions.

I see in my browser a cookie named 'CAKEPHP' and I thought I could
read it in a controller with
$this->Cookie->read(Configure::read('Session.cookie'))
[where in my config/core.php I have
Configure::write('Session.cookie', 'CAKEPHP');]
But it doesn't work, I get nothing.

Any hint or alternative method I could implement?

Thank you in advance.

Best,

Mario

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: paginate loosing args

2009-11-24 Thread Mario Cesar
*I tried too
*
On Tue, Nov 24, 2009 at 6:36 PM, Ma'moon  wrote:

> If you are using POST to send the ID of the target article then try sending
> it using GET
>
> On Tue, Nov 24, 2009 at 3:31 PM, Mario Cesar  wrote:
>
>> i tried but didn't work
>>
>>
>>
>> On Tue, Nov 24, 2009 at 6:20 PM, Dave  wrote:
>>
>>> in the paginate array in your view file add
>>>
>>> 'url'=>$this->passedArgs
>>>
>>> On Tue, Nov 24, 2009 at 1:24 PM, Mario Cesar  wrote:
>>>
>>>> Hi All!!
>>>>
>>>> I have a problem with paginate, I'll try explicate:
>>>>
>>>> I have a form that method is "post"
>>>> the result is ok in first page but if I click in other page or some
>>>> order the paginate returns all rows of my table he is loosing the
>>>> args and I'm using the passedArgs in View page
>>>>
>>>>
>>>> what can i do?
>>>>
>>>> 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.comFor
>>>>  more options, visit this group at
>>>> http://groups.google.com/group/cake-php?hl=en
>>>>
>>>
>>>  Check out the new CakePHP Questions site http://cakeqs.org and help
>>> others with their CakePHP related questions.
>>>
>>> You received this message because you are subscribed to the Google Groups
>>> "CakePHP" group.
>>> To post to this group, send email to cake-php@googlegroups.com
>>> To unsubscribe from this group, send email to
>>> cake-php+unsubscr...@googlegroups.comFor
>>>  more options, visit this group at
>>> http://groups.google.com/group/cake-php?hl=en
>>>
>>
>>  Check out the new CakePHP Questions site http://cakeqs.org and help
>> others with their CakePHP related questions.
>>
>> You received this message because you are subscribed to the Google Groups
>> "CakePHP" group.
>> To post to this group, send email to cake-php@googlegroups.com
>> To unsubscribe from this group, send email to
>> cake-php+unsubscr...@googlegroups.comFor
>>  more options, visit this group at
>> http://groups.google.com/group/cake-php?hl=en
>>
>
>
>
> --
> http://phpirate.net
>
> 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.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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

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


Re: paginate loosing args

2009-11-24 Thread Mario Cesar
i tried but didn't work



On Tue, Nov 24, 2009 at 6:20 PM, Dave  wrote:

> in the paginate array in your view file add
>
> 'url'=>$this->passedArgs
>
> On Tue, Nov 24, 2009 at 1:24 PM, Mario Cesar  wrote:
>
>> Hi All!!
>>
>> I have a problem with paginate, I'll try explicate:
>>
>> I have a form that method is "post"
>> the result is ok in first page but if I click in other page or some
>> order the paginate returns all rows of my table he is loosing the
>> args and I'm using the passedArgs in View page
>>
>>
>> what can i do?
>>
>> 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.comFor
>>  more options, visit this group at
>> http://groups.google.com/group/cake-php?hl=en
>>
>
>  Check out the new CakePHP Questions site http://cakeqs.org and help
> others with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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

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


paginate loosing args

2009-11-24 Thread Mario Cesar
Hi All!!

I have a problem with paginate, I'll try explicate:

I have a form that method is "post"
the result is ok in first page but if I click in other page or some
order the paginate returns all rows of my table he is loosing the
args and I'm using the passedArgs in View page


what can i do?

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: Associating model aliases

2009-09-30 Thread Mario

Ok, I think I found another bit of the puzzle...

Problem was wrong: model aliases do retain the associations of
the original models, after all.

But (thank you John for pointing in that direction) the default value
of Model recursive property seems to be 1.

If I set it to 2



then I get also the Profile data for each Sender and Recipient.

But, and is another BIG but:
* I get as well a lot of unwanted data (that can be contained /
unbound)
* data are obtained with a recursion of queries, each Profile found
with one query...

So up to now the "ad hoc" join (thank you Brian) is to me the more
efficient solution, everything with the same query with 2 additional
LEFT JOINs.

I look forward to your comments.

Best,

Mario



On Sep 30, 2:17 am, brian  wrote:
> On Tue, Sep 29, 2009 at 5:21 PM, Mario  wrote:
>
> > But to me the BIG question is:
> > isn't there a simpler and more elegant way in Cake to reach the same
> > result?
>
> > I feel there should be; because the kind of problem, if I understood
> > it correctly (that is: model alias does not retain the associations of
> > the original model), seems to me quite broad and frequent.
>
> > I wonder if, for example, if (in this specific case) declaring the
> > Sender and Receiver models, therefore having the model/sender.php and
> > model/receiver.php files, could be a possible solution to be explored.
>
> > I look forward to your comments.
>
> I actually think it is pretty elegant. But, if you're doing this a
> lot, I suppose it would just be tedious. It seems like something that
> a Behavior would do very well. There may already be such a thing at
> the Bakery.
--~--~-~--~~~---~--~~
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: Associating model aliases

2009-09-29 Thread Mario

But to me the BIG question is:
isn't there a simpler and more elegant way in Cake to reach the same
result?

I feel there should be; because the kind of problem, if I understood
it correctly (that is: model alias does not retain the associations of
the original model), seems to me quite broad and frequent.

I wonder if, for example, if (in this specific case) declaring the
Sender and Receiver models, therefore having the model/sender.php and
model/receiver.php files, could be a possible solution to be explored.

I look forward to your comments.

Mario
--~--~-~--~~~---~--~~
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: Associating model aliases

2009-09-29 Thread Mario

Ok, this is solved, I can get the fields I need by adding the 'fields'
parameter

$this->data = $this->Message->find(
  'all',
  array(
'fields' => array('SenderProfile.firstname',
'RecipientProfile.firstname'),
'joins' => array(...)
  )
    );

So we have a workaround, thank you Brian!


On Sep 29, 8:40 pm, Mario  wrote:

>
> The problem is that in place of '*' I get all the Message, Sender and
> Recipient fields but not the SenderProfile and RecipientProfile ones
> (even if I can test with PHPMyAdmin that correct values are returned
> with a SELECT * ...).
>
> What do you think? Thank you in advance

--~--~-~--~~~---~--~~
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: Associating model aliases

2009-09-29 Thread Mario

Hi Brian,

modified as per your suggestion to:

$this->data = $this->Message->find(
  'all',
  array(
'joins' => array(
  array(
'type' => 'LEFT',
'table' => 'profiles',
'alias' => 'SenderProfile',
'conditions' => array(
  'Message.user_id = SenderProfile.user_id'
)
  ),
  array(
'type' => 'LEFT',
'table' => 'profiles',
'alias' => 'RecipientProfile',
'conditions' => array(
  'Message.recipient_id = RecipientProfile.user_id'
)
  )
)
  )
);

Now the resulting SQL joins are fine:

SELECT * FROM `messages` AS `Message`
LEFT JOIN profiles AS `SenderProfile` ON (`Message`.`user_id` =
`SenderProfile`.`user_id`)
LEFT JOIN profiles AS `RecipientProfile` ON (`Message`.`recipient_id`
= `RecipientProfile`.`user_id`)
LEFT JOIN `users` AS `Sender` ON (`Message`.`user_id` = `Sender`.`id`)
LEFT JOIN `users` AS `Recipient` ON (`Message`.`recipient_id` =
`Recipient`.`id`)
WHERE 1 = 1

The problem is that in place of '*' I get all the Message, Sender and
Recipient fields but not the SenderProfile and RecipientProfile ones
(even if I can test with PHPMyAdmin that correct values are returned
with a SELECT * ...).

What do you think? Thank you in advance

Best,

Mario
--~--~-~--~~~---~--~~
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: Associating model aliases

2009-09-29 Thread Mario

Hi Brian,

thank you for your help, getting closer to an initial solution.

With the following find (slightly different from yours, now profiles
are joined with the user_id / recipient_id in Message, like it is done
for users)

$this->data = $this->Message->find(
  'all',
  array(
'joins' => array(
  array(
'type' => 'LEFT',
'table' => 'profiles',
'alias' => 'SenderProfile',
'conditions' => array(
  'Message.user_id' => 'SenderProfile.user_id'
)
  ),
  array(
'type' => 'LEFT',
'table' => 'profiles',
'alias' => 'RecipientProfile',
'conditions' => array(
  'Message.recipient_id' => 'RecipientProfile.user_id'
)
  )
)
  )
);

I get the following SQL (where instead of '*' there is the complete
list of not NULL fields)

SELECT *
FROM `messages` AS `Message`
LEFT JOIN profiles AS `SenderProfile` ON (`Message`.`user_id` =
'SenderProfile.user_id')
LEFT JOIN profiles AS `RecipientProfile` ON (`Message`.`recipient_id`
= 'RecipientProfile.user_id')
LEFT JOIN `users` AS `Sender` ON (`Message`.`user_id` = `Sender`.`id`)
LEFT JOIN `users` AS `Recipient` ON (`Message`.`recipient_id` =
`Recipient`.`id`) WHERE 1 = 1

Still not working, because SenderProfile and RecipientProfile returns
NULL fields.

But if in PHPMyAdmin I change the SQL to

SELECT *
FROM `messages` AS `Message`
LEFT JOIN profiles AS `SenderProfile` ON (`Message`.`user_id` =
`SenderProfile`.`user_id`)
LEFT JOIN profiles AS `RecipientProfile` ON (`Message`.`recipient_id`
= `RecipientProfile`.`user_id`)
LEFT JOIN `users` AS `Sender` ON (`Message`.`user_id` = `Sender`.`id`)
LEFT JOIN `users` AS `Recipient` ON (`Message`.`recipient_id` =
`Recipient`.`id`) WHERE 1 = 1

the above mentioned fields are no longer NULL, it seems that the query
is working.
I just changed (almost impossible to detect...):
'SenderProfile.user_id' into `SenderProfile`.`user_id`
'RecipientProfile.user_id' into `RecipientProfile`.`user_id`

Any idea how to solve this last bit?

Best,

Mario


On Sep 29, 4:36 pm, brian  wrote:
> Try something like this:
>
> $this->Message->find(
>         'all',
>         array(
>                 'joins' => array(
>                         array(
>                                 'type' => 'LEFT',
>                                 'table' => 'users',
>                                 'alias' => 'Sender',
>                                 'conditions' => array(
>                                         'Message.user_id' => 'Sender.id'
>                                 )
>                         ),
>                         array(
>                                 'type' => 'LEFT',
>                                 'table' => 'users',
>                                 'alias' => 'Recipient',
>                                 'conditions' => array(
>                                         'Message.recipient_id' => 
> 'Recipient.id'
>                                 )
>                         )
>                 )
>         )
> );
>
> You might need to add a couple more arrays to the joins array for the
> Profiles. Maybe something like this:
>
> array(
>         'type' => 'LEFT',
>         'table' => 'profiles',
>         'alias' => 'SenderProfile',
>         'conditions' => array(
>                 'SenderProfile.user_id' => 'Sender.id'
>         )
> ),
> array(
>         'type' => 'LEFT',
>         'table' => 'profiles',
>         'alias' => 'RecipientProfile',
>         'conditions' => array(
>                 'RecipientProfile.user_id' => 'Recipient.id'
>         )
> )
>
>
>
> On Tue, Sep 29, 2009 at 8:22 AM, Mario  wrote:
>
> > Hi John,
>
> > thank you!
> > Is just very basic, no control over depth of joins.
>
> >  > class MessagesController extends AppController {
>
> >  var $name = 'Messages';
>
> >  function index() {
> >    $this->data = $this->Message->find('all');
> >

Re: Associating model aliases

2009-09-29 Thread Mario

Hi John,

thank you!
Is just very basic, no control over depth of joins.

data = $this->Message->find('all');
debug ($this->data);
die;
  }
?>

It seems to me that joins are not in place because of somehow missing
aliases association, not because I have cut them somewhere.

The underlying SQL is:
SELECT `Message`.`id`, `Message`.`user_id`, `Message`.`recipient_id`,
[...],
`Sender`.`id`, `Sender`.`username`, `Sender`.`password`, [...],
`Recipient`.`id`, `Recipient`.`username`, `Recipient`.`password`,
[...]
FROM `messages` AS `Message`
LEFT JOIN `users` AS `Sender` ON (`Message`.`user_id` = `Sender`.`id`)
LEFT JOIN `users` AS `Recipient` ON (`Message`.`recipient_id` =
`Recipient`.`id`)
WHERE 1 = 1

Best,

Mario


On Sep 29, 1:55 pm, John Andersen  wrote:
> Thanks, a little more information is needed!
> Please show the code from the controller, where you are using 
> $this->Message->find.
>
> Are you using the Containable behaviour or just the recursive option?
> Enjoy,
>    John
>
> On Sep 29, 1:43 pm, Mario  wrote:
>
>
>
> > Hi John,
>
> > thank you for your reply.
>
> > As stated, is done exactly as in the Cookbook:
>
> >  > class Message extends AppModel {
> >     var $name = 'Message';
> >     var $belongsTo = array(
> >         'Sender' => array(
> >             'className' => 'User',
> >             'foreignKey' => 'user_id'
> >         ),
> >         'Recipient' => array(
> >             'className' => 'User',
> >             'foreignKey' => 'recipient_id'
> >         )
> >     );}
>
> > ?>
>
> >  > class User extends AppModel {
> >     var $name = 'User';
> >     var $hasMany = array(
> >         'MessageSent' => array(
> >             'className' => 'Message',
> >             'foreignKey' => 'user_id'
> >         ),
> >         'MessageReceived' => array(
> >             'className' => 'Message',
> >             'foreignKey' => 'recipient_id'
> >         )
> >     );
>
> >     var $hasOne = 'Profile'; // this for the Profile association}
>
> > ?>
>
> > Best,
>
> > Mario
>
> > On Sep 29, 12:35 pm, John Andersen  wrote:
>
> > > Please provide information on how you relates the message model with
> > > the other models?
> > > Enjoy,
> > >    John
>
> > > On Sep 29, 12:52 pm, Mario  wrote:
>
> > > > Hi all,
>
> > > > probably a not so difficult question, but I am a newbie to CakePHP and
> > > > would really appreciate some advice.
>
> > > > I have coded something exactly following the situation described 
> > > > inhttp://book.cakephp.org/view/851/Multiple-relations-to-the-same-model
> > > > that is: a User model, a Message model, Sender and Recipient aliases.
> > > > Everything works smoothly.
>
> > > > Then I have a Profile model one-to-one associated with User, here as
> > > > well following the Cookbookhttp://book.cakephp.org/view/80/hasOne
> > > >  > > > class User extends AppModel {
> > > >     var $name = 'User';
> > > >     var $hasOne = 'Profile';}
>
> > > > ?>
> > > > andhttp://book.cakephp.org/view/81/belongsTo
> > > >  > > > class Profile extends AppModel {
> > > >     var $name = 'Profile';
> > > >     var $belongsTo = 'User';}
>
> > > > ?>
> > > > Relationship working fine except for the following...
>
> > > > The problem I have is that $this->Message->find('all') in
> > > > MessagesController doesn't return the Profile data for the Sender and
> > > > the Recipient. They are aliases of User, so I can expect that maybe
> > > > some extra code is needed somewhere.
>
> > > > I tried to modify the Profile model into something like:
> > > >   var $belongsTo = array(
> > > >     'User',
> > > >     'Sender' => array(
> > > >       'className' => 'User',
> > > >       'foreignKey' => 'user_id'
> > > >     ),
> > > >     'Recipient'...
> > > >   );
>
> > > > Doesn't work, half expected it, because it seems more important in
> > > > this case to declare that the Sender (Recipient) 'hasOne' Profile. But
> > > > where and how, not having a Sender (Recipient) model?
>
> > > > Thank you in advance,
>
> > > > Mario
--~--~-~--~~~---~--~~
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: Associating model aliases

2009-09-29 Thread Mario

Hi John,

thank you for your reply.

As stated, is done exactly as in the Cookbook:

 array(
'className' => 'User',
'foreignKey' => 'user_id'
),
'Recipient' => array(
'className' => 'User',
'foreignKey' => 'recipient_id'
)
);
}
?>

 array(
'className' => 'Message',
'foreignKey' => 'user_id'
),
'MessageReceived' => array(
    'className' => 'Message',
'foreignKey' => 'recipient_id'
)
);

var $hasOne = 'Profile'; // this for the Profile association
}
?>

Best,

Mario


On Sep 29, 12:35 pm, John Andersen  wrote:
> Please provide information on how you relates the message model with
> the other models?
> Enjoy,
>    John
>
> On Sep 29, 12:52 pm, Mario  wrote:
>
>
>
> > Hi all,
>
> > probably a not so difficult question, but I am a newbie to CakePHP and
> > would really appreciate some advice.
>
> > I have coded something exactly following the situation described 
> > inhttp://book.cakephp.org/view/851/Multiple-relations-to-the-same-model
> > that is: a User model, a Message model, Sender and Recipient aliases.
> > Everything works smoothly.
>
> > Then I have a Profile model one-to-one associated with User, here as
> > well following the Cookbookhttp://book.cakephp.org/view/80/hasOne
> >  > class User extends AppModel {
> >     var $name = 'User';
> >     var $hasOne = 'Profile';}
>
> > ?>
> > andhttp://book.cakephp.org/view/81/belongsTo
> >  > class Profile extends AppModel {
> >     var $name = 'Profile';
> >     var $belongsTo = 'User';}
>
> > ?>
> > Relationship working fine except for the following...
>
> > The problem I have is that $this->Message->find('all') in
> > MessagesController doesn't return the Profile data for the Sender and
> > the Recipient. They are aliases of User, so I can expect that maybe
> > some extra code is needed somewhere.
>
> > I tried to modify the Profile model into something like:
> >   var $belongsTo = array(
> >     'User',
> >     'Sender' => array(
> >       'className' => 'User',
> >       'foreignKey' => 'user_id'
> >     ),
> >     'Recipient'...
> >   );
>
> > Doesn't work, half expected it, because it seems more important in
> > this case to declare that the Sender (Recipient) 'hasOne' Profile. But
> > where and how, not having a Sender (Recipient) model?
>
> > Thank you in advance,
>
> > Mario
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Associating model aliases

2009-09-29 Thread Mario

Hi all,

probably a not so difficult question, but I am a newbie to CakePHP and
would really appreciate some advice.

I have coded something exactly following the situation described in
http://book.cakephp.org/view/851/Multiple-relations-to-the-same-model
that is: a User model, a Message model, Sender and Recipient aliases.
Everything works smoothly.

Then I have a Profile model one-to-one associated with User, here as
well following the Cookbook
http://book.cakephp.org/view/80/hasOne

and
http://book.cakephp.org/view/81/belongsTo

Relationship working fine except for the following...

The problem I have is that $this->Message->find('all') in
MessagesController doesn't return the Profile data for the Sender and
the Recipient. They are aliases of User, so I can expect that maybe
some extra code is needed somewhere.

I tried to modify the Profile model into something like:
  var $belongsTo = array(
'User',
'Sender' => array(
  'className' => 'User',
  'foreignKey' => 'user_id'
),
'Recipient'...
  );

Doesn't work, half expected it, because it seems more important in
this case to declare that the Sender (Recipient) 'hasOne' Profile. But
where and how, not having a Sender (Recipient) model?

Thank you in advance,

Mario

--~--~-~--~~~---~--~~
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: cakephp and facebook

2009-08-01 Thread mario vallejo
Ok, so what kind of help would you need? I'll be happy to give you a hand

On Mon, Jul 27, 2009 at 12:25 AM, Dhileepen Chakravarthy <
dhileepen.cake...@gmail.com> wrote:

> Please help me anyone for cakephp with facebook implementation
>
>
> >
>

--~--~-~--~~~---~--~~
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: $_POST

2009-07-17 Thread mario vallejo
Thanks for the info. Anyways the project was cancelled. Now I can calmly put
to use all of your advice.

On Fri, Jul 17, 2009 at 10:05 AM, Carlos Lavin wrote:

> Or just pr($_REQUEST)... cakephp's pre wrapper
> http://book.cakephp.org/view/707/pr
>
> 2009/7/17 womble 
>
>
>> I think you may find that FB sends the fb_sig varibales in $_GET. Just
>> to test it, in your controller method:
>> echo '';
>> print_r($_REQUEST);  // or print_r($_GET);
>> echo '';
>> exit;
>>
>>
>> On Jul 16, 9:57 am, mario vallejo  wrote:
>> > Hello and thank you for your time and attention. I am building a
>> > Facebook app and I want to use CakePHP to build it. The problem is the
>> > following
>> >
>> > I have tried to translate this into cake to no avail:
>> >
>> > $is_tab = isset($_POST['fb_sig_in_profile_tab']);
>> >
>> > if( !$is_tab ) $user = $fb->require_login();
>> >
>> > And that's really the only thing left in order to finish my app. I
>> > have got no clue on how to access 'normal' $_POST data inside of cake.
>> > Thank you very much and I really appreciate this.
>> >
>> > Mario R. Vallejo
>>
>>
>
> >
>

--~--~-~--~~~---~--~~
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: $_POST

2009-07-16 Thread mario vallejo

Hey, thank you very much! Let me try this out and I'll inform you if
it was what I needed.

On 7/16/09, cbhan  wrote:
>
> As you know Cake is MVC framework , simply you can access the data
> posted from your view(your form),in the controller's method with the
> following:
> say the function name is mario then,
> function mario()
> {
>if(!empty($this->data)){
> $mariodata=$this->data;
>$this->set('yourdata',$mariodata);
> }
> },
> Now in your mario.ctp file,which is the view file of this action
> (method rather) from where you had posted your data type the following
> code
> 
> this will solve your problem. If not i will continue to help .
>
> On Jul 16, 4:57 am, mario vallejo  wrote:
>> Hello and thank you for your time and attention. I am building a
>> Facebook app and I want to use CakePHP to build it. The problem is the
>> following
>>
>> I have tried to translate this into cake to no avail:
>>
>> $is_tab = isset($_POST['fb_sig_in_profile_tab']);
>>
>> if( !$is_tab ) $user = $fb->require_login();
>>
>> And that's really the only thing left in order to finish my app. I
>> have got no clue on how to access 'normal' $_POST data inside of cake.
>> Thank you very much and I really appreciate this.
>>
>> Mario R. Vallejo
> >
>

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



$_POST

2009-07-15 Thread mario vallejo

Hello and thank you for your time and attention. I am building a
Facebook app and I want to use CakePHP to build it. The problem is the
following

I have tried to translate this into cake to no avail:

$is_tab = isset($_POST['fb_sig_in_profile_tab']);

if( !$is_tab ) $user = $fb->require_login();

And that's really the only thing left in order to finish my app. I
have got no clue on how to access 'normal' $_POST data inside of cake.
Thank you very much and I really appreciate this.


Mario R. Vallejo

--~--~-~--~~~---~--~~
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: parameters with /

2009-01-15 Thread Mario Cesar
teknoid, why is a bad idea ???

--- p.s. It is almost always a bad idea to use requestAction() ;)

On Wed, Jan 14, 2009 at 2:29 PM, teknoid  wrote:

>
> Any params can be passed like: /controller/action/param1/param2/param3
> Or as named params: /controller/action/name:bob/city:paris/
> account:active
>
> to see the params in your controller pr($this->params)
>
> p.s. It is almost always a bad idea to use requestAction() ;)
>
>
> On Jan 14, 9:55 am, Mario Cesar  wrote:
> > hi!
> > i have parameters with / ex '2008/2,' '2008/1'
> > but the cake read only 2008
> > how can i pass the /???
> >
> > i'm using
> > $turma = 'qqq/w';
> > $this->requestAction("/turmasDisciplinasHorarios/getDisciplinaTurma/
> > $turma/$filial/$disciplina");
> >
> > someone can help 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: passing parameters with /

2009-01-14 Thread Mario Cesar
tks all for tips!!!

On Wed, Jan 14, 2009 at 3:30 PM, Marcelo Andrade wrote:

> On Wed, Jan 14, 2009 at 9:00 AM, Mario Cesar  wrote:
> >
> > hi!!
> > I need pass paramters like 2008/1 2008/2
> > but the cake only read 2008
> > how can I pass parameters like that?
>
> Can't you consider two parameters (2008 and 1)
> and mount the data you need into the controller?
>
> Best regards.
>
> --
> MARCELO DE F. ANDRADE (aka "eleKtron")
> Belem, PA, Amazonia, Brazil
> Linux User #221105
>
> [...@pará ~]# links http://pa.slackwarebrasil.org/
>
> For Libby's backstory be told on Lost
> http://www.petitiononline.com/libby423/petition.html
>
> >
>

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



parameters with /

2009-01-14 Thread Mario Cesar

hi!
i have parameters with / ex '2008/2,' '2008/1'
but the cake read only 2008
how can i pass the /???

i'm using
$turma = 'qqq/w';
$this->requestAction("/turmasDisciplinasHorarios/getDisciplinaTurma/
$turma/$filial/$disciplina");

someone can help 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
-~--~~~~--~~--~--~---



passing parameters with /

2009-01-14 Thread Mario Cesar

hi!!
I need pass paramters like 2008/1 2008/2
but the cake only read 2008
how can I pass parameters like that?
tks

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



Set:extract retaining the original id

2008-12-07 Thread mario

Hello guys,

I'm having some problem with the Set::extract feature of cakephp:

Here is my array from $this->data that was already submitted:

[User] => Array
(
[User] => Array
(
[1] => Array
(
[0] => 3
)

[2] => Array
(
[0] => 2
)

[3] => Array
(
[0] => 4
)

)

)

and I want to have a result (array) like this:

[User] => Array
(
[User] => Array
(
[1] => 3
[2] => 2
[3] => 4
)

)


However, when i do this:

$this->data['User']['User'] = Set::extract($this->data['User']
['User'], '{n}.0');

The result is always like this:

[User] => Array
(
[User] => Array
(
[0] => 3
[1] => 2
[2] => 4
)

)


See the difference? Set:extract is always resetting (from zero and so
on) the ids of the root array I'm trying to extract.

I receive,

[0] => 3
[1] => 2
[2] => 4

instead of what I want which is:

[1] => 3
[2] => 2
[3] => 4


Please help. I really need the original ids for parsing purposes.


Thanks,

Mario


--~--~-~--~~~---~--~~
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: cannot add onclick event on form input with multiple checkbox

2008-12-01 Thread mario

Thanks a lot. I now got it working.
I'll also try the mootools that you suggested if I have time. =)


On Dec 1, 7:33 am, grigri <[EMAIL PROTECTED]> wrote:
> If you really want to put the javascript inline in the onClick
> attribute of each checkbox, I'd suggest rewriting the options array to
> use the alternative format, like this:
>
> $options = array();
> foreach($roles as $value => $label) {
>   $options[] = array(
>     'name' => $label,
>     'value' => $value,
>     'onClick' => 'showDiv(this)'
>   );}
>
> echo $form->input('Role', array('options' => $options, ...));
>
> But why use inline javascript? You could do this with one line of
> mootools:
>
> $$('input[id^=ModelRole][type=checkbox]').addEvent('click', showDiv);
> (replace 'Model' with the name of your model)
>
> And I'm sure it's just as easy (or easier) in jQuery or other
> frameworks
>
> hth
> grigri
>
> On Dec 1, 2:37 pm, mario <[EMAIL PROTECTED]> wrote:
>
> > Hello,
>
> > How can I add a javascript onclick event on a form input with multiple
> > checkbox?
>
> > I'm trying to do this using the following code..
> >  >         echo $form->input('Role',
> >                           array('type'=>'select',
> >                                 'multiple'=>'checkbox',
> >                                 'options'=>$roles,
> >                                 'label'=>'Roles:',
> >                                 'onClick'=>'showTierDiv(this)'));
> > ?>
>
> > However, when I view the source of the generated page using a browser,
> > I can see
> > that the onclick event "showTierDiv" was not included.
>
> > I also tried adding an onclick event using a form input with a
> > "single" checkbox and it works.
>
> > Here is the code:
> > input('tier',array
> > ('label'=>'Tier','type'=>'checkbox', 'onclick'=>"showDiv(this)")); ?>
>
> > Is there any way to add onclick event on a form input with multiple
> > checkbox?
> > If none, are there any workarounds for this?
>
> > Thanks,
>
> > Mario
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



cannot add onclick event on form input with multiple checkbox

2008-12-01 Thread mario

Hello,

How can I add a javascript onclick event on a form input with multiple
checkbox?

I'm trying to do this using the following code..
input('Role',
  array('type'=>'select',
'multiple'=>'checkbox',
'options'=>$roles,
'label'=>'Roles:',
'onClick'=>'showTierDiv(this)'));
?>

However, when I view the source of the generated page using a browser,
I can see
that the onclick event "showTierDiv" was not included.

I also tried adding an onclick event using a form input with a
"single" checkbox and it works.

Here is the code:
input('tier',array
('label'=>'Tier','type'=>'checkbox', 'onclick'=>"showDiv(this)")); ?>


Is there any way to add onclick event on a form input with multiple
checkbox?
If none, are there any workarounds for this?


Thanks,

Mario

--~--~-~--~~~---~--~~
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: Where to find graham bird's AJAX tutorial?

2008-11-12 Thread mario

Thanks park. I've looked at the table of contents of the book
and it's a good tutorial for ajax beginners. However, there was no
cakephp mentioned there. What I'm looking for is a basic tutorial
of ajax that has something to do with cakephp. I would also like
to browse to basic ajax-cakephp source codes and learn from it.


On Nov 12, 3:42 pm, park <[EMAIL PROTECTED]> wrote:
> Manning's jQuery in Action
>
> On Nov 12, 2:40 pm, mario <[EMAIL PROTECTED]> wrote:
>
> > Ok. I know now that the tutorial is outdated.
> > I'm really looking for nice tutorials about using ajax in cakephp.
>
> > Are there any recommendations for this?
>
> > Thanks,
> > Mario
>
> > On Nov 12, 12:04 pm, mario <[EMAIL PROTECTED]> wrote:
>
> > > Hi guys,
>
> > > Where can I find graham bird's tutorial?
> > > The link (http://grahambird.co.uk/cake/tutorials/ajax.php) no longer
> > > works.
>
> > > If anyone have a copy of the tutorial, please share it as well as the
> > > source code files.
>
> > > Thanks,
>
> > > Mario
--~--~-~--~~~---~--~~
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: Where to find graham bird's AJAX tutorial?

2008-11-11 Thread mario

Ok. I know now that the tutorial is outdated.
I'm really looking for nice tutorials about using ajax in cakephp.

Are there any recommendations for this?

Thanks,
Mario


On Nov 12, 12:04 pm, mario <[EMAIL PROTECTED]> wrote:
> Hi guys,
>
> Where can I find graham bird's tutorial?
> The link (http://grahambird.co.uk/cake/tutorials/ajax.php) no longer
> works.
>
> If anyone have a copy of the tutorial, please share it as well as the
> source code files.
>
> Thanks,
>
> Mario
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Where to find graham bird's AJAX tutorial?

2008-11-11 Thread mario

Hi guys,

Where can I find graham bird's tutorial?
The link (http://grahambird.co.uk/cake/tutorials/ajax.php) no longer
works.

If anyone have a copy of the tutorial, please share it as well as the
source code files.


Thanks,

Mario
--~--~-~--~~~---~--~~
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: Looking for suggestion to filter data in cakephp

2008-10-30 Thread mario

Thanks Martin.

That gave me a bit of an idea of what I'm going to
do. And yes I want to know the specific details on how
you implemented it. It would also be good if I could see
some snippets of your code (model,controller,view) to further
understand what you're trying to explain.

Btw, I'm actually a mac developer but I'm still new in cakephp. =)

On Oct 30, 8:36 am, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> First I'll admit I did not read through all your code. But I think I
> get what you are doing.
>
> I created a filtering system about a year ago. I wanted/needed
> something that worked a bit like the find feature in Mac OS X Finder,
> or in some SQL-GUIs I have used. If you have see this you know what I
> am talking about. I also needed these to be saved and recalled later.
>
> Anyway.
> I ended up with something that is a lot more streamlined in the
> controller but with a bit more work done in the Models.
>
> Filter is the whole search setup for a particular search.
> Rule is a single filtering rule.
> Filter hasMany Rule
>
> One Rule can have:
> - a property to filter
> - an operator
> - a value entered by the user
>
> End result might be "email ends with gmail.com" for a single rule.
> Adding more rules to a Filter would narrow the search using "AND".
> This turned out the be very flexible. A filter can be attached to any
> other model and do filtering on it.
>
> The rule model contained a big data array with different operators
> (sql fragments) for different types of data. Since humans want to
> filter numbers differently from email addresses I created a number of
> these preset custom fragments that could be selected from drop-downs
> in the gui. The rule model also contained a method for converting the
> stored parameters (field, match, value) to an sql fragment for a given
> model.
>
> Some examples of fragments:
> $this->types['Text']['equals'] = '%s LIKE \'%s\'';
> $this->types['Text']['contains'] = '%s LIKE \'%%%s%%\'';
> $this->types['Text']['starts_with'] = '%s LIKE \'%s%%\'';
> $this->types['Text']['ends_with'] = '%s LIKE \'%%%s\'';
> $this->types['Date']['days_ago'] = 'FLOOR(DATEDIFF(CURDATE(),
> DATE(%s))) = \'%s\'';
> $this->types['Date']['weeks_ago'] = 'FLOOR(DATEDIFF(CURDATE(),
> DATE(%s))/7) = \'%s\'';
>
> Each field is mapped to a type. Datetime fields becomes the "Date"
> type. Text fields could be set to email or anything but defaults to
> "Text".
>
> The filter code was nothing special. The only special method there was
> "getFilterFor($model_name)" which gathers the results from each rule.
>
> The reason for this setup was partly flexibility and partly the GUI. I
> really wanted a humane gui. No wildcards or pseudo-sql. Simple selects
> and meaningful words. Looking back it is not a very difficult setup
> but it did take some time to come up with the right way to set it all
> up.
>
> I hope that gives you some ideas.
> Let me know if you want a few more boring details of the
> implementation.
>
> /Martin
>
> On Oct 30, 3:43 pm, mario <[EMAIL PROTECTED]> wrote:
>
> > Hello everyone,
>
> > I'm planning to include filters in my new project wherein it will
> > allow the user to filter or show only the information that he/she
> > wants. Of course there would be a search form
> > (textfield,combobox,checkbox, submit button) for this relative to my
> > tables' fieldnames in the database.
>
> > I've already done this before on my recent project using cakephp. I
> > will post some of my code snippets here for you to make some
> > suggestion and for me to find out if what I'm doing is correct or not.
> > I'm also looking forward on recommendations on how to improve my
> > filtering process (which I'm gonna use on my next project).
>
> > Here is the code snippet of my controller (I've placed the filters in
> > my index view):
> > --- 
> > --
> >         function index($title = null, $location = null, $date_from = null,
> > $date_to = null) {
> >                 if (empty($this->data) &&
> >                                 (!$title || ($title == 'allTitle')) &&
> >                                 (!$location || $location == 'allLocatio

Looking for suggestion to filter data in cakephp

2008-10-30 Thread mario
ort('date_accessioned');?>
sort('remarks');?>



>







image('exhibits/small/'.$exhibit['Exhibit']
['image_filename']);
}
else
{
echo 'no image';
}
?>  

format('M d, Y (D)', 
$exhibit['Exhibit']
['date_accessioned']);
?>





link(__('View', true), 
array('action'=>'view',
$exhibit['Exhibit']['id'])); ?>
link(__('Edit', true), 
array('action'=>'edit',
$exhibit['Exhibit']['id'])); ?>
link(__('Delete', true),
array('action'=>'delete', $exhibit['Exhibit']['id']), null,
sprintf(__('Are you sure you want to delete # %s?', true),
$exhibit['Exhibit']['id'])); ?>





 prev('<< '.__('previous',
true), array(), null, array('class'=>'disabled'));?> numbers();?> next(__('next',
true).' >>', array(), null, array('class'=>'disabled'));?> 

link(__('New Exhibit', true),
array('action'=>'add')); ?>|
link(__('Save as excel file', true),
array('action'=>'report',$reportTitle,$reportLocation,$reportDateFrom,
$reportDateTo)); ?>

--
End of code:


What I hate in my controller code is that it has many if-then-else
conditions. The number of if-then-else conditions mainly depends on
the number of fields that I want to use in my filter. The controller
code could produce a massive if-then-else structure if the search
fields in my index view continue to grow in number.

Is there any way to optimize this? I've seen many filter component in
cakephp as I search in google but they all have their own limitations
(cannot filter deep nested models).

I really need all of your help guys. Please make any suggestion.



Thanks,

Mario





--~--~-~--~~~---~--~~
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 in using 3rd party helper - ExcelWriter

2008-10-28 Thread mario

Thanks Samuel. Your suggestion works perfectly.

Cheers!

On Oct 28, 8:07 am, "Samuel DeVore" <[EMAIL PROTECTED]> wrote:
> In the excell helper try adding
>
> var $helpers = array();
>
> this has worked in some other older helpers when I upgraded to cake
> 1.2  (note i have not used the excel helper at all)
>
> Sam D
--~--~-~--~~~---~--~~
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 in using 3rd party helper - ExcelWriter

2008-10-28 Thread mario

I've seen this helper in thebakery (ExcelWriter)
http://bakery.cakephp.org/articles/view/generate-excel-spreadsheets-from-your-database

and I tried using it in my application.

However, when I tried to include the helper in my app with this line:
var $helpers = array('Html', 'Form','Excel');

I get the following notice:

Notice (8): Undefined property: ExcelHelper::$helpers [CORE\cake\libs
\view\view.php, line 748]
View::_loadHelpers() - CORE\cake\libs\view\view.php, line 748
View::_render() - CORE\cake\libs\view\view.php, line 633
View::render() - CORE\cake\libs\view\view.php, line 372
Controller::render() - CORE\cake\libs\controller\controller.php, line
744
Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 262
Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 213
[main] - APP\webroot\index.php, line 90


Here is the line where the notice occurred:

$loaded[$helper]->validationErrors = $this->validationErrors;
}
if (is_array($loaded[$helper]->helpers) && !empty($loaded[$helper]-
>helpers)) { //this is highlighted in yellow



Here is the context of the notice:

$loaded =   array(
"Html" => HtmlHelper
HtmlHelper::$tags = array
HtmlHelper::$base = "/testing"
HtmlHelper::$here = "/testing/salesScreen"
HtmlHelper::$params = array
HtmlHelper::$action = "index"
HtmlHelper::$data = NULL
HtmlHelper::$_crumbs = array
HtmlHelper::$__docTypes = array
HtmlHelper::$helpers = NULL
HtmlHelper::$webroot = "/testing/"
HtmlHelper::$themeWeb = NULL
HtmlHelper::$plugin = NULL
HtmlHelper::$namedArgs = NULL
HtmlHelper::$argSeparator = NULL
HtmlHelper::$validationErrors = NULL
HtmlHelper::$__tainted = NULL
HtmlHelper::$__cleaned = NULL
HtmlHelper::$_log = NULL,
"Form" => FormHelper
FormHelper::$helpers = array
FormHelper::$fieldset = array
FormHelper::$__options = array
FormHelper::$fields = array
FormHelper::$requestType = NULL
FormHelper::$base = "/testing"
FormHelper::$webroot = "/testing/"
FormHelper::$themeWeb = NULL
FormHelper::$here = "/testing/salesScreen"
FormHelper::$params = array
FormHelper::$action = "index"
FormHelper::$plugin = NULL
FormHelper::$data = NULL
FormHelper::$namedArgs = NULL
FormHelper::$argSeparator = NULL
FormHelper::$validationErrors = NULL
FormHelper::$tags = array
FormHelper::$__tainted = NULL
FormHelper::$__cleaned = NULL
FormHelper::$_log = NULL
FormHelper::$Html = HtmlHelper object,
"Excel" => ExcelHelper
ExcelHelper::$workbook = ExcelWriter object
ExcelHelper::$worksheets = array
ExcelHelper::$formats = array
ExcelHelper::$font = "Arial"
ExcelHelper::$size = 10
ExcelHelper::$align = "left"
ExcelHelper::$valign = "vcenter"
ExcelHelper::$bold = 0
ExcelHelper::$italic = 0
ExcelHelper::$_filename = NULL
ExcelHelper::$_parser = NULL
ExcelHelper::$_1904 = NULL
ExcelHelper::$_activesheet = NULL
ExcelHelper::$_firstsheet = NULL
ExcelHelper::$_selected = NULL
ExcelHelper::$_xf_index = NULL
ExcelHelper::$_fileclosed = NULL
ExcelHelper::$_biffsize = NULL
ExcelHelper::$_sheetname = NULL
ExcelHelper::$_tmp_format = NULL
ExcelHelper::$_worksheets = NULL
ExcelHelper::$_sheetnames = NULL
ExcelHelper::$_formats = NULL
ExcelHelper::$_palette = NULL
ExcelHelper::$_url_format = NULL
ExcelHelper::$_codepage = NULL
ExcelHelper::$_country_code = NULL
ExcelHelper::$_tmp_dir = NULL
ExcelHelper::$_string_sizeinfo_size = NULL
ExcelHelper::$_BIFF_version = 1280
ExcelHelper::$_byte_order = NULL
ExcelHelper::$_data = NULL
ExcelHelper::$_datasize = NULL
ExcelHelper::$_limit = NULL
ExcelHelper::$base = "/testing"
ExcelHelper::$webroot = "/testing/"
ExcelHelper::$here = "/testing/salesScreen"
ExcelHelper::$params = array
ExcelHelper::$action = "index"
ExcelHelper::$data = NULL
ExcelHelper::$themeWeb = NULL
ExcelHelper::$plugin = NULL
)
$helpers=   array(
"Html",
"Form",
"Excel",
"Paginator",
"Session"
)
$parent =   null
$helper =   "Excel"
$i  =   2
$options=   array()
$plugin =   null
$helperCn   =   "ExcelHelper"
$isLoaded   =   false
$vars   =   array(
"base",
"webroot",
"here",
"params",
"action",
"data",
"themeWeb",
"plugin"
)
$c  =   8
$j  =   8

It is very annoying to see this notice every time I set my
cakephp debug level to 2. Any idea on why this notice
occurs? Has anyone found a workaround to remove the
said notice?


Please help. I know that there is always someone there
in the cakephp community to count in to.



Thanks,

Mario




--~--~-~--~~~---~--~~
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: concatenation in find('list')

2008-10-28 Thread mario

Thanks. But Chad's suggestion works fine for me.
I suggest you also try it. =)


On Oct 28, 6:29 am, "Liebermann, Anja Carolin"
<[EMAIL PROTECTED]> wrote:
> Hi Mario,
>
> I have similar situations in my application and I guess there is no automatic 
> way to do it.
>
> So what I do is get the data wth all fields and loop through them and create 
> another array with value = id and shown sring firstname + family name.
>
> If there is a more elegant solution I don't know it.
>
> Anja
>
> -Ursprüngliche Nachricht-
> Von: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] Im Auftrag von mario
> Gesendet: Sonntag, 26. Oktober 2008 16:09
> An: CakePHP
> Betreff: concatenation in find('list')
>
> Hi guys,
>
> I have this following code snippet from my controller:
>
> $salespeople = $this->Campaign->Salesperson->find('list',
>                                   array('order' => 'Salesperson.firstname 
> ASC',
>                                           'fields' => array('Salesperson.id', 
> 'Salesperson.firstname')));
>
> In my view, I have this following line:
>
> echo $form->input('salesperson_id');
>
> This codes would create a combobox in my view that would have a key: 
> salesperson.id and value: salesperson.firstname
>
> Now here is what I want to do:
>
> I also have a field 'lastname' under my salespeople table and I want it to be 
> concatenated to the salespersons'
> firstname (with a space between the firstname and lastname).
>
> I can't just have the firstname in my combobox because there is a high 
> possibility that there would be duplicates for firstnames.
> It would be better if firstname and lastname would be displayed in my view's 
> combobox and still would match to a corresponding salesperson.id.
>
> Is there a way to do this?
>
> Thanks,
> Mario
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



concatenation in find('list')

2008-10-26 Thread mario

Hi guys,

I have this following code snippet from my controller:

$salespeople = $this->Campaign->Salesperson->find('list',
  array('order' =>
'Salesperson.firstname ASC',
  'fields' =>
array('Salesperson.id', 'Salesperson.firstname')));


In my view, I have this following line:

echo $form->input('salesperson_id');


This codes would create a combobox in my view
that would have a key: salesperson.id and value: salesperson.firstname


Now here is what I want to do:

I also have a field 'lastname' under my salespeople table
and I want it to be concatenated to the salespersons'
firstname (with a space between the firstname and lastname).

I can't just have the firstname in my combobox because there is
a high possibility that there would be duplicates for firstnames.
It would be better if firstname and lastname would be displayed
in my view's combobox and still would match to a corresponding
salesperson.id.

Is there a way to do this?


Thanks,
Mario
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Reset Auto Increment of SQL database command in Cakephp

2008-10-26 Thread mario

Hello Everyone,

I have a problem with the Auto Increment functionality of my
SQL Server (MySQL). Every time I delete a record of a specific table,
the reference for my auto increment still stays at the id of the
deleted record.
Shouldn't it suppose to move right after the largest id of the table?

Is there any command in cakephp that would reset
the Auto Increment of the table right after you delete a record?
After which it would then point it's auto increment reference at
the end of the table's largest id.



Thanks,
Mario

--~--~-~--~~~---~--~~
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: find('list') that displays blank (combobox)

2008-09-27 Thread mario

Thanks a lot. I got it working now. =)

On Sep 27, 8:54 pm, Adam Royle <[EMAIL PROTECTED]> wrote:
> input('collection_id', array('label'=> false,
> 'empty' => true)); ?>
>
> or
>
> input('collection_id', array('label'=> false,
> 'empty' => 'Please select...')); ?>
>
> On Sep 28, 1:48 pm, mario <[EMAIL PROTECTED]> wrote:
>
> > Hello everyone,
>
> > I'm creating a search page in my website and I want to take advantage
> > of cakephp's find('list') command.
>
> > Here is a snippet of my controller's code,
>
> > $collections = $this->Exhibit->Collection->find('list',
> >                                                                 array(
> >                                                                         
> > 'order' => 'Collection.name ASC',
> >                                                                         
> > 'fields' => array('Collection.id', 'Collection.name')
> >                                                                 ));
> > $this->set(compact('collections'));
>
> > Now in here, I want to generate a list of collections with their
> > corresponding id and name.
>
> > For my view,
>
> > I have this one:
>
> > input('collection_id', array('label'=> false)); ?>
>
> > As you can see, it will try to create a combobox based from my
> > collections list. My problem is that since i'm doing a search here, I
> > want to have a blank field display at the top most of my combobox
> > which find('list') can't seem to handle.
>
> > Please help.
>
> > Thanks,
>
> > Mario
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



find('list') that displays blank (combobox)

2008-09-27 Thread mario

Hello everyone,

I'm creating a search page in my website and I want to take advantage
of cakephp's find('list') command.

Here is a snippet of my controller's code,

$collections = $this->Exhibit->Collection->find('list',
array(
'order' 
=> 'Collection.name ASC',

'fields' => array('Collection.id', 'Collection.name')
));
$this->set(compact('collections'));


Now in here, I want to generate a list of collections with their
corresponding id and name.

For my view,

I have this one:

input('collection_id', array('label'=> false)); ?>

As you can see, it will try to create a combobox based from my
collections list. My problem is that since i'm doing a search here, I
want to have a blank field display at the top most of my combobox
which find('list') can't seem to handle.

Please help.



Thanks,

Mario




--~--~-~--~~~---~--~~
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: How to validate password length

2008-09-27 Thread mario

i already have a 'password2' in my form for password confirmation.
Can you please give me an example of what you are referring about?

Thanks.^_^

On Sep 27, 3:50 am, "Jon Bennett" <[EMAIL PROTECTED]> wrote:
> >  >  I want to validate the length of my password using the cakephp model's
> >  >  validation. However, since the password is being hashed before it is
> >  >  saved on the database, my length validation criteria becomes void. We
> >  >  all know that a hashed password contains many characters.
>
> > I would make a copy of 'password' before it gets to the Auth
> >  component, and add a rule for that instead.
>
> hmm, might have been a little hasty there, as you won't have a field
> in your form for 'password_plain' and therefore won't ever see the
> error message. How about adding an extra field to your form of
> 'password_confirm', then adding the rule to that. If the confirmation
> fails you'll then see the error message (and you can check they are
> the same).
>
> hth
>
> 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
-~--~~~~--~~--~--~---



How to validate password length

2008-09-27 Thread mario

Hello guys,

I want to validate the length of my password using the cakephp model's
validation. However, since the password is being hashed before it is
saved on the database, my length validation criteria becomes void. We
all know that a hashed password contains many characters.

Here is my model validation criteria:

var $validate = array(
'username' => array(
'isalphanumeric' => array(
'rule' => array('alphanumeric'),
'required' => true,
'allowEmpty' => false,
'message' => 'Only letters and numbers are 
allowed.'
),
'unique' => array(
'rule' => array('checkUnique', 'username'),
'message' => 'User name taken. Please use 
another.'
),
'notempty' => array(
'rule' => array('minLength', '6'),
'required' => true,
'allowEmpty' => false,
'message' => 'Username must have at least 6 
characters'
)
),
'password' => array(
'rule' => array('minLength', '6'),
'required' => true,
'allowEmpty' => false,
'message' => 'Password must have at least 6 
characters'

)
);

You can see there that I want my password to have at least 6
characters. Anyone of you have an idea on how to do this?



Thanks,

Mario
--~--~-~--~~~---~--~~
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: Automatic Login after Signup using Auth Component

2008-09-24 Thread mario

$this->Auth->login unfortunately doesn't use "email" as one of it's
fields
in logging in. it instead uses "username" and "password" as its
default fields.

You can see it at the implementation of the login function of Auth.

http://api.cakephp.org/1.2/auth_8php-source.html#l00568

it uses $this->identify($data)

and $this->identify($data) uses "username" and "password" as its
field.

http://api.cakephp.org/1.2/auth_8php-source.html#l00717



Maybe that's the case that its not working.

On Sep 24, 1:29 am, Edi <[EMAIL PROTECTED]> wrote:
> I am also having this problem. I can't make it login.
> Tried several versions, with both passwords (hashed, no hashed), but
> nothing.
>
> Currently i have this:
>
> $this->Auth->login(array('User'=>array('email'=>$this->data['User']
> ['email'], 'password'=>$this->data['User']['password2'])))
>
> but it is not working. (using 'email' for password).
>
> login works like a charm with cookie:
>
>                                         $cookie = array();
>                                         $cookie['email'] = 
> $this->data['User']['email'];
>                                         $cookie['password'] = 
> $this->data['User']['password'];
>                                         $this->Cookie->write('User', $cookie, 
> true, '+2 weeks');
>
>                                 $cookie = $this->Cookie->read('User');
>                                 if ($cookie)
>                                 {
>                                         $this->Auth->login($cookie);
>                                 }
>
> On 24 ruj, 10:03, Fran Iglesias <[EMAIL PROTECTED]> wrote:
>
>
>
> > El 24/09/2008, a las 9:31, mario escribió:
>
> > > So in this case,
> > > $this->Auth->login($this->data); //loginuser
>
> > I think you have the plain version of the password in password2 field.
> > You could do some like:
>
> > if ($this->User->save($this->data)) {
> >         $this->data['User']['password'] = $this->data['User']['password2'];
> >         $this->Auth->login($this->data); //loginuser
>
> > }
>
> > --
> > Fran Iglesias
> > [EMAIL PROTECTED]
--~--~-~--~~~---~--~~
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: Automatic Login after Signup using Auth Component

2008-09-24 Thread mario

Hello Fran,

I got it now working. Thanks for the big help!

Actually, $this->Auth->login($this->data); // login user
is already correct. I just missed to call the line to
redirect the user to the designated page.

Now it looks like this:

if ($this->User->save($this->data)) {
 $login = $this->Auth->login($this->data);
 if($login)
{
$this->redirect($this->Auth->redirect());
}
}

Thanks,
Mario

On Sep 24, 4:03 pm, Fran Iglesias <[EMAIL PROTECTED]> wrote:
> El 24/09/2008, a las 9:31, mario escribió:
>
> > So in this case,
> > $this->Auth->login($this->data); // login user
>
> I think you have the plain version of the password in password2 field.  
> You could do some like:
>
> if ($this->User->save($this->data)) {
>         $this->data['User']['password'] = $this->data['User']['password2'];
>         $this->Auth->login($this->data); // login user
>
> }
>
> --
> Fran Iglesias
> [EMAIL PROTECTED]
--~--~-~--~~~---~--~~
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: Automatic Login after Signup using Auth Component

2008-09-24 Thread mario

Yup. I see the point.

So in this case,
$this->Auth->login($this->data); // login user

I'm trying to pass the data from my form to be used for login.
As what I know, cakephp automatically hashes the password field of the
model 'user'.
So using $this->data in $this->Auth->login() might have some problem.

Any suggestions?

On Sep 24, 3:07 pm, Fran Iglesias <[EMAIL PROTECTED]> wrote:
> El 24/09/2008, a las 9:02, mario escribió:
>
> > This time, it failed to login the user. It seems like there is some
> > problem in terms of hashing my password.
>
> Not sure, but you may try to login the User, with the non-hashed  
> password.
> --
> Fran Iglesias
> [EMAIL PROTECTED]
--~--~-~--~~~---~--~~
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: Automatic Login after Signup using Auth Component

2008-09-24 Thread mario

That would be one option.

Here is my signup code:

function signup()
{
if (!empty($this->data)) {
if(isset($this->data['User']['password2']))
{
$password2hashed = $this->Auth->password($this-
>data['User']['password2']);
if($password2hashed == 
$this->data['User']['password'])
{
$this->User->create();
if ($this->User->save($this->data)) {

$this->Auth->login($this->data); // login user
} else {
$this->Session->setFlash('There was an 
error signing
up. Please, try again.');
$this->data = null;
}
}
else
{
$this->Session->setFlash('Different password re-
entered.');
$this->data = null;
}
}
}
}

This time, it failed to login the user. It seems like there is some
problem in terms of hashing my password.
Did I missed something here?


On Sep 24, 2:31 pm, Fran Iglesias <[EMAIL PROTECTED]> wrote:
> El 24/09/2008, a las 7:28, mario escribió:
>
> > Do anyone of you have an idea on how to automatically login
> > after signing-up using Auth Component?
>
> This seems a task for $this->Auth->login()
>
> http://api.cakephp.org/1.2/class_auth_component.html#5c2562e36d1fb6f8...
>
> --
> Fran Iglesias
> [EMAIL PROTECTED]
--~--~-~--~~~---~--~~
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: Automatic Login after Signup using Auth Component

2008-09-23 Thread mario

Thanks Amit. I have tried your suggestion.
I used:
$this->Auth->Session->write($this->Auth->sessionKey . '.id', $this-
>User->getLastInsertID());

but it just became worse.

$this->Auth->user('id') doesn't return anything if I do that.

On Sep 24, 1:39 pm, "Amit Badkas" <[EMAIL PROTECTED]> wrote:
> 2008/9/24 mario <[EMAIL PROTECTED]>
>
>
>
> > Hello everyone,
>
> > Do anyone of you have an idea on how to automatically login
> > after signing-up using Auth Component?
>
> > I have tried like:
>
> > $this->User->create();
> > if ($this->User->save($this->data))
> > {
> >        $this->Auth->Session->write($this->Auth->sessionKey, $this->User-
> > >getLastInsertID());
>
> - Try to debug session contents after this line of code to confirm that
> session data is correct
>
>
>
>
>
> >        $this->Session->setFlash('You have successfully logged in.');
> >        $this->redirect($this->Auth->redirect());
> > }
>
> > Now in my AppController, I have something like this:
>
> >  > class AppController extends Controller {
>
> >        var $components = array('Auth');
> >        var $helpers = array('Html', 'Form');
> >        var $uses = array('User');
> >        function beforeFilter()
> >        {
> >                $this->Auth->loginAction = array('controller' => 'users',
> > 'action'
> > => 'login');
> >                $this->Auth->loginRedirect = array('controller' =>
> > 'mainpage',
> > 'action' => 'home');
> >                $this->Auth->logoutRedirect = array('controller' =>
> > 'mainpage',
> > 'action' => 'home');
> >                $this->Auth->allow('home','signup');
> >                $this->Auth->authorize = 'controller';
> >                //$this->Auth->userScope = array('User.confirmed' => '1');
> >                $this->set('loggedIn', $this->Auth->user('id'));
>
> - As per your above code, it seems that you are putting user id directly in
> session using auth's session key, i.e., your need to do
> $this->Auth->Session->write($this->Auth->sessionKey . '.id',
> $this->User->getLastInsertID()); instead of
> $this->Auth->Session->write($this->Auth->sessionKey,
> $this->User->getLastInsertID());
>
>
>
>
>
> >                $result = $this->User->findById($this->Auth->user('id'));
> >        }
> >        function isAuthorized()
> >        {
> >                return true;
> >        }
> > }
> > ?>
>
> > This script is supposed to work but my problem is that $this->Auth-
> > >user('id') is only returning
> > the first digit of the number. For example, I have a userid: 53, now
> > when I will do $this->Auth->user('id'),
> > it only return "5" instead of "53".
>
> > Anyone of you can help me with this?
>
> > Thanks,
>
> > Mario
>
> --
> Amit
>
> http://amitrb.wordpress.com/http://coppermine-gallery.net/http://cheesecake-photoblog.org/http://www.sanisoft.com/blog/author/amitbadkas
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Automatic Login after Signup using Auth Component

2008-09-23 Thread mario

Hello everyone,

Do anyone of you have an idea on how to automatically login
after signing-up using Auth Component?

I have tried like:

$this->User->create();
if ($this->User->save($this->data))
{
$this->Auth->Session->write($this->Auth->sessionKey, $this->User-
>getLastInsertID());
$this->Session->setFlash('You have successfully logged in.');
$this->redirect($this->Auth->redirect());
}

Now in my AppController, I have something like this:

Auth->loginAction = array('controller' => 'users', 
'action'
=> 'login');
$this->Auth->loginRedirect = array('controller' => 'mainpage',
'action' => 'home');
$this->Auth->logoutRedirect = array('controller' => 'mainpage',
'action' => 'home');
$this->Auth->allow('home','signup');
$this->Auth->authorize = 'controller';
//$this->Auth->userScope = array('User.confirmed' => '1');
$this->set('loggedIn', $this->Auth->user('id'));
$result = $this->User->findById($this->Auth->user('id'));
}
function isAuthorized()
{
    return true;
}
}
?>

This script is supposed to work but my problem is that $this->Auth-
>user('id') is only returning
the first digit of the number. For example, I have a userid: 53, now
when I will do $this->Auth->user('id'),
it only return "5" instead of "53".

Anyone of you can help me with this?


Thanks,

Mario
--~--~-~--~~~---~--~~
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: Generate Excel from database problem (rendering layout)

2008-09-19 Thread mario

Thanks Sam.

Actually, I already found the solution.

Instead of using

$this->render('action','excel');

in my controller, I used this following code:

$this->layout = 'excel';
$this->render();


I wonder why $this->render('action','excel'); won't work.
But I also don't think that this is a deprecated api.


On Sep 18, 3:47 pm, "Sam Sherlock" <[EMAIL PROTECTED]> wrote:
> have you tried using $this->log()
>
> and double check that App::import is calling the right file
>
> 2008/9/18 mario <[EMAIL PROTECTED]>
>
>
>
>
>
> > Thanks majna. But I can't set the debug mode to 1 since the script
> > will no longer run in 1.2
> > if I do that.
>
> > On Sep 18, 12:23 pm, majna <[EMAIL PROTECTED]> wrote:
> > > set debug mode to 1. maybe you get "missingAction" error form cake.
>
> > > On Sep 18, 7:07 pm, mario <[EMAIL PROTECTED]> wrote:
>
> > > > Hello guys,
>
> > > > I want to generate and excel spreadsheets based from my
> > > > database query and I've come across this tutorialhttp://
> > bakery.cakephp.org/articles/view/generate-excel-spreadsheets-f
>
> > > > I've followed every instructions but I can't get it working.
>
> > > > I have a "reservations" contoller and it has a view called "report"
> > > > and two layouts "default.ctp" and "excel.ctp"
> > > > My default.ctp contains my main layout for html display and excel.ctp
> > > > contains the layout for rendering the excel file.
>
> > > > Everytime i visit the
> > linkhttp://localhost/{myproject}/reservations/report,
> > > > I get this error
>
> > > > Error:  The requested address '/reservations/report' was not found on
> > > > this server.
>
> > > > I've tried things commenting out the line
> > > >         $this->render('action','excel');
> > > > in my reservations controller (report function)
>
> > > > and renaming excel.ctp to default.ctp and everything works fine.
>
> > > > I think the problem has to do with rendering my layout and I just
> > > > can't find the solution for it.
> > > > Please help me since I'm already beyond my deadline in my project.
>
> > > > Thanks,
>
> > > > Mario
--~--~-~--~~~---~--~~
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: Generate Excel from database problem (rendering layout)

2008-09-18 Thread mario

Thanks majna. But I can't set the debug mode to 1 since the script
will no longer run in 1.2
if I do that.


On Sep 18, 12:23 pm, majna <[EMAIL PROTECTED]> wrote:
> set debug mode to 1. maybe you get "missingAction" error form cake.
>
> On Sep 18, 7:07 pm, mario <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hello guys,
>
> > I want to generate and excel spreadsheets based from my
> > database query and I've come across this 
> > tutorialhttp://bakery.cakephp.org/articles/view/generate-excel-spreadsheets-f
>
> > I've followed every instructions but I can't get it working.
>
> > I have a "reservations" contoller and it has a view called "report"
> > and two layouts "default.ctp" and "excel.ctp"
> > My default.ctp contains my main layout for html display and excel.ctp
> > contains the layout for rendering the excel file.
>
> > Everytime i visit the linkhttp://localhost/{myproject}/reservations/report,
> > I get this error
>
> > Error:  The requested address '/reservations/report' was not found on
> > this server.
>
> > I've tried things commenting out the line
> >         $this->render('action','excel');
> > in my reservations controller (report function)
>
> > and renaming excel.ctp to default.ctp and everything works fine.
>
> > I think the problem has to do with rendering my layout and I just
> > can't find the solution for it.
> > Please help me since I'm already beyond my deadline in my project.
>
> > Thanks,
>
> > Mario
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Generate Excel from database problem (rendering layout)

2008-09-18 Thread mario

Hello guys,

I want to generate and excel spreadsheets based from my
database query and I've come across this tutorial
http://bakery.cakephp.org/articles/view/generate-excel-spreadsheets-from-your-database.

I've followed every instructions but I can't get it working.

I have a "reservations" contoller and it has a view called "report"
and two layouts "default.ctp" and "excel.ctp"
My default.ctp contains my main layout for html display and excel.ctp
contains the layout for rendering the excel file.


Everytime i visit the link http://localhost/{myproject}/reservations/report,
I get this error

Error:  The requested address '/reservations/report' was not found on
this server.


I've tried things commenting out the line
$this->render('action','excel');
in my reservations controller (report function)

and renaming excel.ctp to default.ctp and everything works fine.

I think the problem has to do with rendering my layout and I just
can't find the solution for it.
Please help me since I'm already beyond my deadline in my project.


Thanks,

Mario
--~--~-~--~~~---~--~~
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: from database to excel (Missing files in the bakery)

2008-09-18 Thread mario

Thanks a lot Martin.


On Sep 18, 7:07 am, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> I zipped my files and put them up on my 
> dev-server.http://dev.eimermusic.com/cake_excel_writer/
> They are all for 1.2 and work on my setup. Can't remember if I tweaked
> the helper or not...
>
> They will stay there for a while but not forever.
>
> /Martin
>
> On Sep 18, 3:57 pm, mario <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hello everyone,
>
> > I wanted to generate an excel report from my database query
> > and I've come acroos this tutorial in the bakery.
>
> >http://bakery.cakephp.org/articles/view/generate-excel-spreadsheets-f...
>
> > However, it seems like the download links are already broken.
>
> >http://webdesign.janenanneriet.nl/excel_writer.ziphttp://webdesign.ja...
>
> > Does anyone of you have these files? (would be better if working in
> > cakephp 1.2)
>
> > Please share it. I really need them in my project.
>
> > Thanks,
>
> > Mario
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



from database to excel (Missing files in the bakery)

2008-09-18 Thread mario

Hello everyone,

I wanted to generate an excel report from my database query
and I've come acroos this tutorial in the bakery.

http://bakery.cakephp.org/articles/view/generate-excel-spreadsheets-from-your-database

However, it seems like the download links are already broken.

http://webdesign.janenanneriet.nl/excel_writer.zip
http://webdesign.janenanneriet.nl/ole.zip


Does anyone of you have these files? (would be better if working in
cakephp 1.2)

Please share it. I really need them in my project.


Thanks,

Mario
--~--~-~--~~~---~--~~
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 Component admin login redirect for unauthorized page access

2008-08-24 Thread mario

Thanks Marcin. I solve the problem by using $this->Auth->loginAction()
of the Auth Component.


On Aug 24, 9:02 am, "Marcin Domanski" <[EMAIL PROTECTED]> wrote:
> C'mon man- do some searching. I suggest looking at the api at auth
> component properties.
> HTH
>
> 2008/8/24,mario<[EMAIL PROTECTED]>:
>
>
>
>
>
>
>
> > Hello,
>
> > How can I configure the Auth component so that
> > it will redirect me to the login action of my admins_controller
> > everytime someone access an unauthorized page?
>
> > I see that it redirects me to the login action of my user_controller
> > which I don't want to happen.
>
> > Here is a snippet of my app_controller.php
>
> >  > class AppController extends Controller {
> >    var $components = array('Auth');
> >    function beforeFilter()
> >    {
> >            $this->Auth->loginRedirect = array('controller' => 'mainpage',
> > 'action' => 'home');
> >            $this->Auth->logoutRedirect = array('controller' => 'mainpage',
> > 'action' => 'home');
> >            $this->Auth->allow('home');
> >            $this->Auth->authorize = 'controller';
> >            $this->set('loggedIn', $this->Auth->user('id'));
> >    }
> >    function isAuthorized()
> >    {
> >                    return true;
> >    }
> > }
> > ?>
>
> > Thanks,
>
> >Mario
>
> --
> Marcin Domanskihttp://kabturek.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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Auth Component admin login redirect for unauthorized page access

2008-08-24 Thread mario

Hello,

How can I configure the Auth component so that
it will redirect me to the login action of my admins_controller
everytime someone access an unauthorized page?

I see that it redirects me to the login action of my user_controller
which I don't want to happen.

Here is a snippet of my app_controller.php

Auth->loginRedirect = array('controller' => 'mainpage',
'action' => 'home');
$this->Auth->logoutRedirect = array('controller' => 'mainpage',
'action' => 'home');
$this->Auth->allow('home');
$this->Auth->authorize = 'controller';
$this->set('loggedIn', $this->Auth->user('id'));
}
function isAuthorized()
{
return true;
}
}
?>

Thanks,

Mario


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



Authentication for admin and public user in one(1) app

2008-08-23 Thread mario

Hello everyone,

I just learn cakephp and I'm having trouble creating the admin section
of my app.

These are what I've done so far.

1. I've created a user section with the capabilities of login/logout
and signup.
2. I've created a "users" table for it.
3. I've overriden the app_controller and define the Auth component.
I've also
   created its' own beforeFilter() function.

Here is a snippet of my app_controller.php code:

Auth->loginRedirect = array('controller' => 'mainpage',
'action' => 'home');
$this->Auth->logoutRedirect = array('controller' => 'mainpage',
'action' => 'home');
$this->Auth->allow('signup','home');
$this->Auth->authorize = 'controller';
$this->set('loggedIn', $this->Auth->user('id'));
   }
   function isAuthorized()
   {
 return true;
   }
}
?>

Now, i've decided to create an admin section that could
edit,view,delete users.
I've created a separate table for the admin, namely, "admins" table.
I've also
created its' own model,view, and controller.

Now I'm stuck in implementing the admins' login/logout feature because
my main problem
is that the app_controller that I made is already "specific" to my
user's controller.

Please advise me on what to do.



Thanks,

Mario

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