Saturday, February 28, 2009

2 foreign keys to same model?

Hi, cake1.2 here,

I have a question on how to set this database up by cake's convention.
I have the following 2 tables:

users
assets

each user has many assets, but users can allow other users to access
their assets
so I figure the following, a third table is needed:

a table that has attributes:
owner, allowed

they both point to users_id, how do I make this table model in
cakephp? Is there another way to do this?
Because i know users_id means foreign key to table users, but how do
you have 2 foreign to the same table?

thank you

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

Re: What do you develop in (ide, text editor, etc.)?

Textmate.

On Feb 28, 9:51 pm, Jorge Horacio Cué Cantú <jorge....@gmail.com>
wrote:
> I switched to Eclipse from Netbeans 6.5 because Netbeans does not handle
> well accents in Fedora 10.
>
> If I could solve this only issue, I would back to Netbeans immediately.
>
> 2009/2/28 jitka (poLK) <slunii...@gmail.com>
>
>
>
> > I switched from Eclipse 3.4 and PDT2 to Netbeans 6.5 this week as well.

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

Re: how to arrange Checkbox in one Row

I used to set label=>false and add the label with after='text'.
Just another way :)

2009/3/1 Dhana <sldhana@gmail.com>:
>
> You might have to use CSS for that.  If there is a div around each
> checkbox,  just make sure you assign a float to them in css lke this:
> In case you just want to target the checkboxes div, wrap a div around
> all your checboxes.  Give it a class or an id.
>
> Then in css,
> #divname input{
>   float: left;
> }
>
> or
>
> .divname input{
>   float: left;
> }
>
> On Feb 28, 5:29 am, Maulik <maulik....@gmail.com> wrote:
>> hi to all,
>> here my question is how can i arrange my checkbox in one row.
>> thanks,
> >
>

--
Att,
Everton Yoshitani
www.notreve.com
+81-80-3660-6560

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

Re: What do you develop in (ide, text editor, etc.)?

I switched to Eclipse from Netbeans 6.5 because Netbeans does not handle well accents in Fedora 10.

If I could solve this only issue, I would back to Netbeans immediately.

2009/2/28 jitka (poLK) <sluniicko@gmail.com>

I switched from Eclipse 3.4 and PDT2 to Netbeans 6.5 this week as well.



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

ACL and Auth with additional checking

Hello,

I need to do some additional row level ACL access control for two of
my models.

My system has the following groups: admins, editors, authors and
users.

I'm restricting access to my controller actions using the Auth
component, via $this->Auth->authorize = 'actions'.

At the moment, my authors have access to "controllers/Papers/view", I
need to be able to limit their access to "controllers/Papers/view/n".
Whether I use a custom query to check access to "n" or an ACL, I don't
mind, both are feasible so whichever is easier.

Similarly, I need to control access to "controllers/Volumes/view/n"
for editors.

Does anyone have any suggestions for achieving this?

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

Re: What do you develop in (ide, text editor, etc.)?

I switched from Eclipse 3.4 and PDT2 to Netbeans 6.5 this week as well.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: how to set current time for local computer

TimeHelper methods can use $userOffset.
Another option (not proper/smart in your case, because it would affect
time/date php functions globally, therefore also created/modified
stored in db) would be date_default_timezone_set() for php >= 5.2 or
date.timezone in php.ini
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Cake core is throwing unlink warnings

On Feb 28, 6:05 pm, RyOnLife <ryan.mckil...@gmail.com> wrote:
> Lovely... I went to try this out and the warnings have vanished as
> mysteriously as they first appeared. I've got this thread bookmarked and
> will update again as they come back.

Ok.

If anyone will see this issue again, join us in #cakephp@freenode
please so we can chat about it in realtime.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Problem with various content structure

Hi.

I need some help with the structure of my project:

I have a table of "places" and a table of "guides". Each "guide"
belongs to a "place". So far, so ok.

The problem is that there are three types of "guides" which are stored
in three tables.

For example:
table "type1": id, title, text1, text2, text3, text4, text5
table "type2": id, title, text6, text 7
table "type3": id, title, text8, text9, text10

That's why I cannot solve it this way: table "guides": id, title,
description, type_id
Because the IDs of the guides repeat.

Now I tried to store the "type" in the table "guides": id, title,
description, type, type_id
But how can I find() the right information for my "guide" now?

Kinda like this?
$this->set('fields', $this->Guide->$type->find(all, array('conditions'
=> '$type.id = $type_id')));


Thank you for any help!

Fox

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

customizing error messages from form helper

two questions--

the default class returned from error() within the html helper is
error-message. how do i override this in my controller?

more importantly, how can i inject some html content inside the error div
after a failed form validation?

right now its:

<div class="error-message">error message here</div>

i would like it to hypothetically be:

<div class="error-message"><div class="nested-div">error message
here</div></div>

is this possible sanely?

--
View this message in context: http://www.nabble.com/customizing-error-messages-from-form-helper-tp22269823p22269823.html
Sent from the CakePHP mailing list archive at Nabble.com.


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

Re: What do you develop in (ide, text editor, etc.)?

On Sat, Feb 28, 2009 at 5:14 PM, adam <abennett712@sbcglobal.net> wrote:
>
> I'm using Eclipse with PDT, but Dreamweaver for making layouts.

Geany.
...and Vim sometimes.

Atenciosamente.

--
MARCELO DE F. ANDRADE (aka "eleKtron")
Belem, PA, Amazonia, Brazil
Linux User #221105

[gus@pará ~]# links http://pa.slackwarebrasil.org/

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

Re: Complex model relationship problems

On Feb 28, 6:10 pm, Dan Soendergaard <dan1...@gmail.com> wrote:
> No, the function is in my model so calling $this->Space->find();
> results in Undefined property:  Space::$Space.

Sorry, I had forgotten it was a model function and not in your
controller. It should be $this->find() in the code I posted above,
instead.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Security component breaks my ajax requests

Looking at the Security component source, you need to override the
validatePost value in SecurityComponent. The following is untested code,
but I think it should work.

function beforeFilter() {
if ($this->action == 'your_action') {
$this->Security->validatePost = false;
}
parent::beforeFilter();
}

Miles J wrote:
> When I add the Security component, all my ajax requests fail. They
> never finish or return data. I am using jQuery and not the built in
> ajax.
>
> What do I have to do to allow this to work? The manual for Security is
> a bit vague.
> >
>
>

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

Security component breaks my ajax requests

When I add the Security component, all my ajax requests fail. They
never finish or return data. I am using jQuery and not the built in
ajax.

What do I have to do to allow this to work? The manual for Security is
a bit vague.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: What do you develop in (ide, text editor, etc.)?

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

Re: Complex model relationship problems

No, the function is in my model so calling $this->Space->find();
results in Undefined property: Space::$Space.

The error isn't that strange, it happens because I removed the Space
from the fields so that 'Space.description' became 'description. Cake
thinks that 'name' is a model, which of course doesn't exist.

I've posted my full Space model at http://pastebin.com/m46f3797b with
some modifications. Right now I'm just testing using find('all'), but
changing 'all' to 'threaded' will show the error that I mentioned in
the first post. I also renamed the function and made some convenience
functions. Might as well work with the parts that I can get working :)

On Feb 28, 11:14 pm, mscdex <msc...@gmail.com> wrote:
> On Feb 28, 2:07 pm, Dan Soendergaard <dan1...@gmail.com> wrote:
>
> > That doesn't help much, I've tried it and it gives errors like this:
>
> > Model "Space" is not associated with model "name" [CORE/cake/libs/
> > model/behaviors/containable.php, line 340]
>
> Strange error. Is this what you tried:
>
>         function get_structure($user = null) {
>                 $spaces = $this->Space->find('threaded', array(
>                                 'conditions' => array('User.id' =>
> $user),
>                                 'fields' => array('Space.name',
> 'Space.description', 'Space.created', 'Space.parent_id', 'Space.lft',
> 'Space.rght', 'User.id', 'User.username'),
>                                 'contain' => array(
>                                         'User', 'Document'
>                                 ),
>                                 'order' => array('Space.name')
>                         )
>                 );
>
>                 return array('spaces' => $spaces);
>         }
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: What do you develop in (ide, text editor, etc.)?

On Sat, Feb 28, 2009 at 8:06 PM, Mauricio Morales <maomorales@gmail.com> wrote:

I just downloaded Netbeans for PHP 6.5 and it's great.  I've been
using Eclipse for a long but I think you can enjoy Netbeans (open
source and works in linux, mac, windows).

http://www.netbeans.org/features/php/

I second this. NetBeans for PHP 6.5 is excellent! I've stopped using Eclipse myself.

- Gonzalo


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

Re: habtm - need some clarification

On Sat, Feb 28, 2009 at 3:30 PM, Dhana <sldhana@gmail.com> wrote:
>
> I have a groups, users and tasks models.
>
> Groups has a HABTM to users.
> Users has a HABTM to groups.
> Users has many tasks.
>
> From the tasks model, I am trying to find out which group the user
> belongs to. Once I have this information, I plan to put into a session
> variable so I only need to query this once while the user is in
> session.
>
> But, how do I make this query efficiently?

I'm not sure if I understood your question. On your
controller, set the recursive property to the Task
model to 2 and get the full resultset with a
find('all') method, like

$this->Task->recursive= 2;
$all= $this->Task->find('all');

Be sure that your models are correctly associated.

Best regards.

--
MARCELO DE F. ANDRADE (aka "eleKtron")
Belem, PA, Amazonia, Brazil
Linux User #221105

[gus@pará ~]# links http://pa.slackwarebrasil.org/

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

Re: habtm - need some clarification

On Feb 28, 1:30 pm, Dhana <sldh...@gmail.com> wrote:
> But, how do I make this query efficiently?

One solution would be to use the Containable behavior with the User
model. Then you can find what groups the user belongs to by doing a
find and including a 'contain' option which is an array containing the
associated models you are interested in (in this case, 'Group').

So for example (in the User model), something like:
function getGroups($userID) {
return $this->find('first', array('conditions' => array
('User.id' => $userID), 'contain' => array('Group')));
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Complex model relationship problems

On Feb 28, 2:07 pm, Dan Soendergaard <dan1...@gmail.com> wrote:
> That doesn't help much, I've tried it and it gives errors like this:
>
> Model "Space" is not associated with model "name" [CORE/cake/libs/
> model/behaviors/containable.php, line 340]

Strange error. Is this what you tried:

function get_structure($user = null) {
$spaces = $this->Space->find('threaded', array(
'conditions' => array('User.id' =>
$user),
'fields' => array('Space.name',
'Space.description', 'Space.created', 'Space.parent_id', 'Space.lft',
'Space.rght', 'User.id', 'User.username'),
'contain' => array(
'User', 'Document'
),
'order' => array('Space.name')
)
);

return array('spaces' => $spaces);
}

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

Re: Very slow response times with CakePHP

Alright, in that case, for adding some additional speed, I've just
increased cache time when Debug > 1 inside Configure::__loadBooststrap
()

Just increased it to 20 minutes and I think problem is resolved now.
Much better speed now :)

Thanks

On Feb 27, 7:24 pm, Matt Curry <m...@mcurry.net> wrote:
> When you have debug set to 0 the file paths are cached in /app/tmp/
> cache/persistent for a long time.  With debug set to 0 the cache
> expiration is set to 10 seconds, so it is rebuilt often.  This came up
> recently:http://groups.google.com/group/cake-php/browse_thread/thread/acb50b49...
>
> I wouldn't get my hopes up that your ticket will be acted on.
>
> -Matthttp://www.pseudocoder.com
>
> On Feb 27, 7:51 am, Abhimanyu Grover <gigapromot...@gmail.com> wrote:
>
> > I added a small hacky code in my bootstrap.php:
>
> > require_once(CORE_PATH . 'cake' . DS .'dispatcher.php');
> > require_once(LIBS .'router.php');
> > require_once(APP .'app_controller.php');
> > require_once(LIBS . DS . 'view' .DS.'view.php');
> > require_once(LIBS .'string.php');
>
> > This makes the homepage appear quickly. But the problem does exists if
> > I open any other page, because it searches for any given controller
> > too. I've also opened a ticket with details here:https://trac.cakephp.org/ticket/6143
>
> > Let me know if anymore of you are facing the same issue.
>
> > On Feb 9, 8:19 pm, Emanuel Nedelcu <emanuel.nede...@gmail.com> wrote:
>
> > > I've reduce the request time of a page by changing bootstrap.php file
> > > like this:
> > >  //App::import('Core', array('Dispatcher'));
> > >  include('dispatcher.php')
>
> > > I've noticed that it takes a lot of time to load the dispatcher using
> > > the App::import function, so since bootstrap and dispatcher are in the
> > > same folder I thought it won't be a problem to load the dispatcher
> > > using include.
>
> > > Emanuel
>
> > > On Dec 16 2008, 4:09 pm, GeneSys <bernhard.bo...@gmail.com> wrote:
>
> > > > Hey Folks!
>
> > > > So I'm using CakePHP for a couple of months now. The company I am
> > > > working at asked me to write a new web portal for them, so I thought,
> > > > "Well, Cake could make it!"
>
> > > > After spending some hours the website was (nearly) finished and so I
> > > > put it on the webspace the old webpage was at.
>
> > > > I already noticed during development that the site requests took about
> > > > 3 - 5 secs until the page displayed, but I thought this is due to my
> > > > development environment (i just installed the XAMPP from apachefriends
> > > > with all default settings), but after uploading the website on the
> > > > host it got even worse.
>
> > > > Request times are between 4 to (up to!) 15 secs. Which is really ..
> > > > tooslowfor a business website. I also tried to cache a lot of
> > > > database requests so I limited most of the page calls to only 3 or 4
> > > > queries. But still load times are as high as they were before.
>
> > > > So there are some facts about my project: It is just a small
> > > > project ...
> > > >  - Core
> > > >    - 1 Model, 1 Controller, some views
> > > >  - 5 Plugins: Often containing nothing more than a model and a
> > > > controller
> > > >  - intended use: about 1000 visitors per month
>
> > > > So i don't have the faintest idea why cakePHP is running thatslow?
>
> > > > Probably someone could take a look at the website:http://www.eurolyser.com/v4/
> > > > (cakePHP)http://www.eurolyser.com/_new/(oldwebsite, plain PHP and
> > > > html) and tell what could be the problem about the high load times?
>
> > > > I don't know which configuration settings to post and due to security
> > > > concerns I just don't want to publish the whole cake config or
> > > > phpinfo. But if any information is necessary needed please don't
> > > > hesitate to ask.
>
> > > > Thank you all in advance guys!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: What do you develop in (ide, text editor, etc.)?

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

Re: What do you develop in (ide, text editor, etc.)?

I just downloaded Netbeans for PHP 6.5 and it's great. I've been
using Eclipse for a long but I think you can enjoy Netbeans (open
source and works in linux, mac, windows).

http://www.netbeans.org/features/php/

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

Re: Tree misbehaviour

Hi folks,

I've got the same problem.. It's really strange because all of my code
was working in the last Beta version.

This is my DB table:

CREATE TABLE intracategories (
id SERIAL PRIMARY KEY,
parent_id INT,
lft INT,
rght INT,
name VARCHAR(255),
tags VARCHAR(255),
ispublic SMALLINT,
description TEXT,
slug VARCHAR(255),
deleted INT DEFAULT 0,
deleted_date TIMESTAMP,
created TIMESTAMP,
modified TIMESTAMP,
cretedby INT,
modifiedby INT
);

And this is my model:
class Intracategory extends AppModel {

var $name = 'Intracategory';
var $actsAs = array('Tree');
}

When I try to save categories with a parent it fails (it sends to me
to the form again), but if I save categories without parent always
works. There is no SQL errors when I use debug on 2.

:S

Somebody else with this problem in 1.2.1.8004 ?

On Feb 25, 3:42 pm, Jon Bennett <jmbenn...@gmail.com> wrote:
> Hi Mark,
>
> >  Can anybody see anything wrong with the file or class names below?
>
> They look ok to me, just checking, you are using the Tree behaviour
> aren't you? You've got:
>
> var $actsAs = array('Tree'); in your model?
>
> j
>
> --
>
> 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 cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Shell: problems with Models which have associations

The problem is solved!
In what it was?
I had a model having the name "Query" - It is all explains =)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: What do you develop in (ide, text editor, etc.)?

TextMate.

On Feb 28, 1:14 pm, adam <abennett...@sbcglobal.net> wrote:
> I'm using Eclipse with PDT, but Dreamweaver for making layouts.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

What do you develop in (ide, text editor, etc.)?

I'm using Eclipse with PDT, but Dreamweaver for making layouts.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Complex model relationship problems

That doesn't help much, I've tried it and it gives errors like this:

Model "Space" is not associated with model "name" [CORE/cake/libs/
model/behaviors/containable.php, line 340]

for alle fields that I specified for Space.* in the contain options.
Also, an invalid query is now being created which gives the following
error:

SQL Error: 1054: Unknown column 'User.id' in 'where clause'

Any suggestions? :)

On Feb 28, 6:40 pm, mscdex <msc...@gmail.com> wrote:
> In get_structure(), have you tried changing: $this->SpacesUser->find()
> to $this->find() ? Then maybe also move the Space.* entries from
> 'contain' to the 'fields' array.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: empty query and 55ms - debug

errata i means Nr 5 > empty query ?

On 28 Lut, 17:31, "andrzejborkow...@gmail.com"
<andrzejborkow...@gmail.com> wrote:
> Nr      Query   Error   Affected        Num. rows       Took (ms)
> 1       DESCRIBE `locations`            5       5       3
> 2       DESCRIBE `countries`            4       4       4
> 3       DESCRIBE `cities`               4       4       3
> 4       DESCRIBE `states`               3       3       3
> 5                       0       0       42
>
> what is n. 4 ?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

[Bug Report] Bug in PaginatorHelper

Version: 1.2.1.8004
File: libs/view/helpers/paginator.php on line 163
Function: sortDir()

if 'order' is set as a string. e.g. my pagination option is set as
follows:

$this->paginate['Product'] = array(
'limit' => 18,
'recursive' => 0,
'fields' => array('Product.id', 'Product.title'),
'order' => 'Product.id DESC'
);

then when i call $paginator->sortDir() in my view, it returns asc.
because sortDir() does not parse 'order' option of string type.

solution:
i'm new to php, so i dont know if it is a proper way

function sortDir($model = null, $options = array()) {
......
if (isset($options['direction'])) {
$dir = strtolower($options['direction']);
} elseif (isset($options['order']) && is_array($options['order'])) {
$dir = strtolower(current($options['order']));
} elseif (isset($options['order']) && is_string($options['order']))
{
if (preg_match('/(\w+)$/', $options['order'], $result) && isset
($result[1])) {
$dir = strtolower($result[1]);
}
}
......
}

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

habtm - need some clarification

I have a groups, users and tasks models.

Groups has a HABTM to users.
Users has a HABTM to groups.
Users has many tasks.

From the tasks model, I am trying to find out which group the user
belongs to. Once I have this information, I plan to put into a session
variable so I only need to query this once while the user is in
session.

But, how do I make this query efficiently?

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

Re: Validate rule: multiple (CookBook -> 4.1.4.17 Multiple)

Well, first of all, your syntax is wrong. If you had read Abrar's
example...

Your code:

var $validate = array(
'Role' => array(
'rule' => array('multiple', array('min' => 1)),
'message' => 'Please select at least one role'
)
);

If you read the book pages (or Abrar's example), you'd see that it
should be the following:

var $validate = array(
'fieldname' => array(
'rulename' => array( // rulename can be anything you choose.
'rule' => 'ruletype', // ruletype should be the rule
you're using, i.e. isUnique, notempty, email, multiple, etc. Use an
array if the rule has options (such as multiple).
'message' => 'errormessage'
)
)
);

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

HtmlHelper and Umlauts

Hello,

I have an issue with the htmlHelper:
If I want to insert an Image with an alternative text I use

<?php echo $html->image('path/to/image.jpg', array('alt' => 'My alt
text'); ?>

This works fine as long as the alt text does not include any umlaut.
With an '&' in it it works fine: it is translated to '&amp;'. But a
German umlaut 'ü' is not translated but alt text is empty (which seems
to be a problem of htmlspecialchars with UTF-8.

Any idea of a solution for this problem?

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

Re: Complex model relationship problems

In get_structure(), have you tried changing: $this->SpacesUser->find()
to $this->find() ? Then maybe also move the Space.* entries from
'contain' to the 'fields' array.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: how to arrange Checkbox in one Row

You might have to use CSS for that. If there is a div around each
checkbox, just make sure you assign a float to them in css lke this:
In case you just want to target the checkboxes div, wrap a div around
all your checboxes. Give it a class or an id.

Then in css,
#divname input{
float: left;
}

or

.divname input{
float: left;
}

On Feb 28, 5:29 am, Maulik <maulik....@gmail.com> wrote:
> hi to all,
> here my question is how can i arrange my checkbox in one row.
> thanks,
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Autocomplete search on users table

This is what I'm using:

http://www.pengoworks.com/workshop/jquery/autocomplete.htm

$(document).ready(function()
{
$('#foo').autocomplete(
'/my_controller/autocomplete',
{
minChars: 2,
lineSeparator: '^',
extraParams: { // other params to pass to controller },
cacheLength: 1,
maxItemsToShow: 20,
autoFill: false,
onItemSelect: function(li)
{
// handler for result selection
}
}
);
});


I then get the query text from $this->data['Search']['q'], rather than
as a method param.

I'm using a cusomised version of this SearchableBehavior:

http://code.google.com/p/searchable-behaviour-for-cakephp/


On Sat, Feb 28, 2009 at 4:01 AM, Mike <mickael.henry@gmail.com> wrote:
>
> I took a look at it following the URL you provided. It's exactly what
> I'm supposed to build
>
> As I'm not yet pretty familiar with AJAX/JSON Query in Cake, I guess
> using the helper provided in Cake will not help too much.
>
>> Of course, the cooler, more hip options are to postback after observing a
>> change on the input, and AJAX/JSON look for data, only returning back
>> strings containing the information you have partially entered. This could
>> potentially be more powerful, allowing you to pass back more information
>> like ID's to link to, as well as doing SQL "WHERE LIKE" matches, for
>> mid-string matching.
>
> How can I make it work, here is a piece of code from my UserController
> class to retrieve users depending on what the end user entered in the
> field.
>
>        if(!empty($search_txt)){
>                //Check if the input is an email address
>                if(eregi("^[[:alnum:]][a-z0-9_.-]*@[a-z0-9.-]+\.[a-z]{2,4}$",
> $search_txt)) {
>                        $conditions = array('User.email' => $search_txt);
>                        $this->set('users', $this->paginate('User',$conditions));
>                }
>                else{
>                        $conditions = array('OR' => array('User.firstname LIKE ' =>
> '%'.$search_txt.'%', 'User.lastname LIKE ' => '%'.$search_txt.'%'));
>                        $this->set('users', $this->paginate('User',$conditions));
>                }
>        }
>
> I don't really know for now how to pass the variables everytime the
> user input a key in the search field.
>
>
> On 24 fév, 12:33, Graham Weldon <gra...@grahamweldon.com> wrote:
>> My first disclaimer is that I dont use jQuery nearly as much as I want to.
>> I tend towards prototype. However..
>>
>> http://docs.jquery.com/Plugins/Autocomplete
>> This looks like a pretty good Autocomplete plugin for jQuery.
>>
>> It just wants an array of data that it is supposed to match to.
>> Not sure how this works in searching all your data, and matching to a user.
>> But as a starting point, you could return names to begin with:
>>
>> // Controller Code
>> $names = implode('|', Set::extract('/MyModel/name',
>> $this->MyModel->find('all', array('conditions' => array( ... )))));
>> $this->set(compact('names'));
>>
>> // Javascript code
>> var names = "<?php echo $names; ?>";
>> $("#my_input").autocomplete(names.split('|'));
>>
>> Of course, the cooler, more hip options are to postback after observing a
>> change on the input, and AJAX/JSON look for data, only returning back
>> strings containing the information you have partially entered. This could
>> potentially be more powerful, allowing you to pass back more information
>> like ID's to link to, as well as doing SQL "WHERE LIKE" matches, for
>> mid-string matching.
>>
>> Hope this gets you started.
>>
>> Cheers,
>>
>> Graham Weldon
>> w.http://grahamweldon.com
>> e. gra...@grahamweldon.com
>> p. +61 407 017 293
>>
>> On Mon, 23 Feb 2009 19:59:02 -0800 (PST), Mike <mickael.he...@gmail.com>
>> wrote:> Hi everyone,
>>
>> > I'd like to know if there is out there a component or helper using
>> > JQuery to help me build a search autocomplete functionnality on a
>> > users table.
>>
>> > I'd like the end user to be able to search a user by firstname,
>> > lastname, email and phone number, everything using an autocomplete
>> > text field.
>>
>> > Any help or start point ?
>>
>> > Thx
>>
>> --
> >
>

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

Re: how to set current time for local computer

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

Re: Cake core is throwing unlink warnings

Lovely... I went to try this out and the warnings have vanished as
mysteriously as they first appeared. I've got this thread bookmarked and
will update again as they come back.

jitka (poLK) wrote:
>
>
> I've never seen this issue before, and it is hard to reproduce it in
> test case if it misbehaves randomly...
> Try one thing, please: in cake/libs/file.php in File::delete() replace
> clearstatcache();
> with
> clearstatcache(true);
> and let us know if that helps.
> >
>
>

--
View this message in context: http://n2.nabble.com/Cake-core-is-throwing-unlink-warnings-tp2374269p2401339.html
Sent from the CakePHP mailing list archive at Nabble.com.


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

Re: Submit several forms with a button

This actually might work, thanks to all for your advices, they give
direction =].

Regards from Mexico


On 27 feb, 06:12, Stinkbug <justink...@gmail.com> wrote:
> So let's think about this.  Is your client just worried about how the
> form looks (3 buttons and 1submitall button)?  Technically, if there
> is no reason to have 3 separateforms, don't create 3 separateforms,
> unless the client requirement is calling the programming shots too.
> It's possible you could have one form but still have 4 different
> buttons, achieving the same effect.  Any of the buttons do the same
> thing...  submitall the data to the server... and then you can do
> whatever you want with it...  whether it be only using part of it or
> all of it.
>
> Then your satisfying the client requirement for the look of the form.
> If that's what they're really worried about.
>
> On Feb 26, 1:30 pm, keogh <keog...@gmail.com> wrote:
>
> > @scs Yes, it's necessary to have the 3formsseparately and onesubmit
> > all button =S, it's the client requirements, you know how strict they
> > are =S.
>
> > @brian that could be usefully, thanks.
>
> > If anybody could suggest anything else, I'll appreciate it.
>
> > Thanks
>
> > On 26 feb, 12:07, scs <scs2...@gmail.com> wrote:
>
> > > I s there any reason you need this a seprateformsand not just use
> > > one form?
>
> > > On Feb 26, 1:35 pm, brian <bally.z...@gmail.com> wrote:
>
> > > > You need to add a javascript onclick handler for the button that would
> > > > thensubmiteach form asynchronously. There are a number of ways to do
> > > > this, including serialising the data from each form and posting
> > > > separately, or using jquery's form plugin, for instance.
>
> > > > As for how you'll "call the view" I'm not sure, what you mean. Each
> > > > controller action will have its own view. But, since you'll need to
> > > > use AJAX in order tosubmit3formssimultaneously, you can simply
> > > > update the current page with the output from each of the actions. I
> > > > suppose Cake's AjaxHelper could take care of pretty much all of the
> > > > heavy lifting for you, but I don't use it so I can't give you any more
> > > > direction than that.
>
> > > > On Thu, Feb 26, 2009 at 12:22 PM, keogh <keog...@gmail.com> wrote:
>
> > > > > Hi,
>
> > > > > I have 3 separatelyformsin the same view, each with its ownsubmit
> > > > > button, what I want is to put one button that submits all the 3forms
> > > > > to its respectively controllers then I call the view where the 3forms
> > > > > are. Is there a way to do this with CakePHP? Is there any advice that
> > > > > you can give me?
>
> > > > > Any suggest and/or advice will be appreciate. Thanks in advance
>
> > > > > Regards,
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: how to set current time for local computer

I had the same issue a week a go, my server is located on GMT -6 and
my country is on GMT -5
The function takes the GMT from Server within the timestamp

/* @param integer $time server timestamp (time()) or whatever
timestamp
* @param integer $userGMT this is the GMT you want convert to
* @return timestamp calculated
*/

//I put this function on app_controller
function gmtConvert($time, $userGMT) {
//Gets server GMT (-5, -4 0, 5, 6 etc.)
$serverGMT = ((int)date('O', $time))/100;
//Calculates the difference between server and user's GMT
$difference = $userGMT - $serverGMT;
//Calculates the new timestamp
$newtime = $time + ($difference * (60 * 60));
return $newtime;
}

//This is how to use
//gmtConvert(server timestamp, your GMT);
$this->gmtConvert(time(), -5);

Hope this help!

On Feb 28, 9:53 am, vikas <vikas...@gmail.com> wrote:
> Hello all..
>
> My problem is my site is running on a server resides on different
> country..
>
> I used to show the current time on a home page.. but It shows me
> server time..which is nearly 12 hours behind my country..
>
> I want to show user a time of a computer he or she uses..
>
> P.S. : I used date() function..to show date and time
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

empty query and 55ms - debug

Nr Query Error Affected Num. rows Took (ms)
1 DESCRIBE `locations` 5 5 3
2 DESCRIBE `countries` 4 4 4
3 DESCRIBE `cities` 4 4 3
4 DESCRIBE `states` 3 3 3
5 0 0 42

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

Re: unload app_controller to force speed :)

ok problem resolved thnx for help

On 27 Lut, 17:04, AgBorkowski <andrzejborkow...@gmail.com> wrote:
> generaly i do it somethong like that
>
> require_once '../xhr_controller.php';
> class SuggestsController extends XhrController {
>         public $components  = array('Xhr');
>     public $helpers = array();
>     public $uses = array();
>
> but still i see in debug app controler is active becouse script show
> that
>
> Nr      Query   Error   Affected        Num. rows       Took (ms)
> 1       DESCRIBE `aros`         7       7       4
> 2       DESCRIBE `acos`         7       7       4
> 3       DESCRIBE `aros_acos`            7       7       7
> 4       DESCRIBE `comments`             7       7       3
> 5       DESCRIBE `users`                13      13      4
> 6       DESCRIBE `groups`               6       6       9
> 7       DESCRIBE `logs`
>
> i dont understand why in my SuggestController extendts XhrController
> extends Controler still load app controller
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

how to set current time for local computer

Hello all..

My problem is my site is running on a server resides on different
country..

I used to show the current time on a home page.. but It shows me
server time..which is nearly 12 hours behind my country..

I want to show user a time of a computer he or she uses..

P.S. : I used date() function..to show date and time
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Complex model relationship problems

Hi bakers!

In my application I've got the concept of "Spaces" which are basically
directories. I also have User and Document models.

Space -> HABTM <- User (a user may have access to several spaces)
Space -> hasMany -> Document
Document -> HABTM <- User (a document can have several owners)

The HABTM relationships are set up according to the solution shown
here: http://www.cricava.com/blogs/index.php?blog=6&title=modelizing_habtm_join_tables_in_cakephp_&more=1&c=1&tb=1&pb=1

Space uses the Tree behavior and the spaces table is properly
configured to use it (lft, rght and parent_id columns). A Space
contains Documents, and both Space and Document can be created by a
User.

I've been trying for two days to try figuring out how to do this:

1. Get a tree of all rooms and documents that a specific user is
associated with
2. Do the same, but only for a sub-tree

This seems impossible to do because Cake thinks that it should look
for parent_id, lft, and rght in the table spaces_users when using the
following query:

$spaces = $this->SpacesUser->find('threaded', array(
'conditions' => array('User.id' => $user),
'contain' => array(
'User.id', 'User.username',
'Space.name', 'Space.description', 'Space.created',
'Space.parent_id', 'Space.lft', 'Space.rght',
'Document'
),
'order' => array('Space.name')
)
);

On the other hand, this is the only way I can think of that allows me
to get the spaces associated with the user. Cake gives the following
errors:

Model "SpacesUser" is not associated with model "Document" [CORE/cake/
libs/model/behaviors/containable.php, line 340]

Undefined index: parent_id [CORE/cake/libs/model/model.php, line
2163]

Note that when setting find('threaded'), the tree is not properly
built. Cake still returns a flat list.

Here are my models:

<?php
class Space extends AppModel {

var $name = 'Space';

var $actsAs = array('Tree');

var $hasAndBelongsToMany = array(
'User' => array(
'with' => 'SpacesUser'
)
);

var $hasMany = array(
'Document'
);

function get_structure($user = null) {
$spaces = $this->SpacesUser->find('threaded', array(
'conditions' => array('User.id' => $user),
'contain' => array(
'User.id', 'User.username',
'Space.name', 'Space.description', 'Space.created',
'Space.parent_id', 'Space.lft', 'Space.rght',
'Document'
),
'order' => array('Space.name')
)
);

return array('spaces' => $spaces);
}

}
?>

<?php
class User extends AppModel {

var $name = 'User';

var $hasAndBelongsToMany = array(
'Space' => array(
'with' => 'SpacesUser'
),
'Document' => array(
'with' => 'DocumentsUser'
)
);

}
?>

<?php
class Document extends AppModel {

var $name = 'Document';
var $hasAndBelongsToMany = array(
'User' => array(
'with' => 'DocumentsUser'
)
);

}
?>

<?php
class SpacesUser extends AppModel {

var $name = 'SpacesUser';
var $belongsTo = array('Space', 'User');

}
?>

<?php
class DocumentsUser extends AppModel {

var $name = 'DocumentsUser';
var $belongsTo = array('Document', 'User');

}
?>

<?php
class SpacesController extends AppController {

var $name = 'Spaces';
var $helpers = array('Html', 'Form', 'Time', 'Text');
var $components = array('RequestHandler');

var $paginate = array(
'order' => array('Space.name' => 'asc')
);

function index() {
$this->set('spaces', $this->Space->get_structure(7));
}

}
?>

I hope that someone will be able to help :) Thanks in advance!

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

how to arrange Checkbox in one Row

hi to all,
here my question is how can i arrange my checkbox in one row.
thanks,

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

Re: Big Problem with 1:1 Association

Yoe´ve been right.
That works.
Thank you very much.

On 28 Feb., 14:06, Gonzalo Servat <gser...@gmail.com> wrote:
> On Sat, Feb 28, 2009 at 10:49 AM, GetIT <david.bruen...@t-online.de> wrote:
> > [..snip..]
>
> > But if I save the data only the thing belonging to the client are
> > saved. The data from the progress is not saved.
> > Why?
>
> I may be leading you onto the wrong path, but as far as I know you need to
> call save() on $this->Client->Progress as well (ie.
> $this->Client->Progress->save()).
>
> BTW, does it make sense that a patient can only ever have 0 or 1 progress?
>
> - Gonzalo
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Big Problem with 1:1 Association

If it still isn't working after those suggestions, try additionally
changing your Progress form inputs to a format like so: $form->input
('Progress.0.<fieldName>');
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Big Problem with 1:1 Association

On Feb 28, 7:49 am, GetIT <david.bruen...@t-online.de> wrote:
> But if I save the data only the thing belonging to the client are
> saved. The data from the progress is not saved.
> Why?

Are you using 'save' or 'saveAll' to save your data? You should be
using 'saveAll'. Also, I'm assuming you have the Client and Progress
fields in the same form?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Big Problem with 1:1 Association

On Sat, Feb 28, 2009 at 11:06 AM, Gonzalo Servat <gservat@gmail.com> wrote:
On Sat, Feb 28, 2009 at 10:49 AM, GetIT <david.bruenner@t-online.de> wrote:
[..snip..]


But if I save the data only the thing belonging to the client are
saved. The data from the progress is not saved.
Why?

I may be leading you onto the wrong path, but as far as I know you need to call save() on $this->Client->Progress as well (ie. $this->Client->Progress->save()).

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

Re: Big Problem with 1:1 Association

On Sat, Feb 28, 2009 at 10:49 AM, GetIT <david.bruenner@t-online.de> wrote:
[..snip..]

But if I save the data only the thing belonging to the client are
saved. The data from the progress is not saved.
Why?

I may be leading you onto the wrong path, but as far as I know you need to call save() on $this->Client->Progress as well (ie. $this->Client->Progress->save()).

BTW, does it make sense that a patient can only ever have 0 or 1 progress?

- Gonzalo

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

Big Problem with 1:1 Association

First of all I want to say that I´m not english.
So please forgive me for my bad english and please use easy to
understand english in your answers.
Thank you!!

I write a programm for doctors.
I´ve got a table called 'clients' which looks like

id:int(11):primary key
salutation_id:tinyint(3) //a belongsTo association to table
salutations
title_id:smallint(5) //a belongsTo association to table
titles
gender_id:tinyint(1) //a belongsTo association to table genders
first_name:varchar(50)
last_name:varchar(50)
...
progress_id:int(11) //a hasOne association to table progresses


I want to save a progress for every client (which doctor has talked
with client, what time has it taken, what has been done and so on).
So I wrote a table 'progresses':

id:int(11):primary_key
employee_id //a belongsTo association to table
employees
previous_employees:text
date:date
action:varchar(60)
...


In my view I´ve got 2 divs.
In one div are the input-fields (and Dropdowns) for the client.
In the second div are all field for the progress.

I submit both and the values are submitted to the action.
If I call pr($this->data) and comment out saving of the data then I
see that everything is in the array.

But if I save the data only the thing belonging to the client are
saved. The data from the progress is not saved.
Why?


My Models:
client: hasOne = array('Progress');
progress: hasOne = array('Client');

My Controller:
$this->set->('progresses', $this->Client->Progress->find('list'));

View:
echo $form->input('Progress.<fieldName>');


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

Re: Problem in inserting data

Finally I got the solution...I had created objects in my related .ctp
file with wrong names instead of table field names...Hope this would
help any neophyte facing same problem...Thanks guys for your
help...Now I think using Cakephp would be more enjoyable with such an
active community :)


On Feb 28, 12:54 am, CHANDAN KUMAR <mechanda...@gmail.com> wrote:
> best way debug just look $this->data in controller.
>
> On Fri, Feb 27, 2009 at 8:13 PM, AnkitLimkar <ankit.lim...@gmail.com> wrote:
>
> > Hi All....As I am a beginner I am facing problems in inserting data in
> > the sample application database. I've followed the sample 'Blog
> > Tutorial' for implementing this. I've followed all the CakePHP
> > conventions. When I add the data No Error is displayed & page is
> > redirected to correct location too, but data is not saved. Anyone
> > please can help me out...Thanks....
>
> --
> Chandan Kumar
> +919873014269

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

Re: Problem in inserting data

Finally I got the solution...I had created objects in my related .ctp
file with wrong names instead of table field names...Hope this would
help any neophyte facing same problem...Thanks guys for your
help...Now I think using Cakephp would be more enjoyable with such an
active community :)


On Feb 27, 7:43 pm, AnkitLimkar <ankit.lim...@gmail.com> wrote:
> Hi All....As I am a beginner I am facing problems in inserting data in
> the sample application database. I've followed the sample 'Blog
> Tutorial' for implementing this. I've followed all the CakePHP
> conventions. When I add the data No Error is displayed & page is
> redirected to correct location too, but data is not saved. Anyone
> please can help me out...Thanks....

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

Re: Autocomplete search on users table

I took a look at it following the URL you provided. It's exactly what
I'm supposed to build

As I'm not yet pretty familiar with AJAX/JSON Query in Cake, I guess
using the helper provided in Cake will not help too much.

> Of course, the cooler, more hip options are to postback after observing a
> change on the input, and AJAX/JSON look for data, only returning back
> strings containing the information you have partially entered. This could
> potentially be more powerful, allowing you to pass back more information
> like ID's to link to, as well as doing SQL "WHERE LIKE" matches, for
> mid-string matching.

How can I make it work, here is a piece of code from my UserController
class to retrieve users depending on what the end user entered in the
field.

if(!empty($search_txt)){
//Check if the input is an email address
if(eregi("^[[:alnum:]][a-z0-9_.-]*@[a-z0-9.-]+\.[a-z]{2,4}$",
$search_txt)) {
$conditions = array('User.email' => $search_txt);
$this->set('users', $this->paginate('User',$conditions));
}
else{
$conditions = array('OR' => array('User.firstname LIKE ' =>
'%'.$search_txt.'%', 'User.lastname LIKE ' => '%'.$search_txt.'%'));
$this->set('users', $this->paginate('User',$conditions));
}
}

I don't really know for now how to pass the variables everytime the
user input a key in the search field.


On 24 fév, 12:33, Graham Weldon <gra...@grahamweldon.com> wrote:
> My first disclaimer is that I dont use jQuery nearly as much as I want to.
> I tend towards prototype. However..
>
> http://docs.jquery.com/Plugins/Autocomplete
> This looks like a pretty good Autocomplete plugin for jQuery.
>
> It just wants an array of data that it is supposed to match to.
> Not sure how this works in searching all your data, and matching to a user.
> But as a starting point, you could return names to begin with:
>
> // Controller Code
> $names = implode('|', Set::extract('/MyModel/name',
> $this->MyModel->find('all', array('conditions' => array( ... )))));
> $this->set(compact('names'));
>
> // Javascript code
> var names = "<?php echo $names; ?>";
> $("#my_input").autocomplete(names.split('|'));
>
> Of course, the cooler, more hip options are to postback after observing a
> change on the input, and AJAX/JSON look for data, only returning back
> strings containing the information you have partially entered. This could
> potentially be more powerful, allowing you to pass back more information
> like ID's to link to, as well as doing SQL "WHERE LIKE" matches, for
> mid-string matching.
>
> Hope this gets you started.
>
> Cheers,
>
> Graham Weldon
> w.http://grahamweldon.com
> e. gra...@grahamweldon.com
> p. +61 407 017 293
>
> On Mon, 23 Feb 2009 19:59:02 -0800 (PST), Mike <mickael.he...@gmail.com>
> wrote:> Hi everyone,
>
> > I'd like to know if there is out there a component or helper using
> > JQuery to help me build a search autocomplete functionnality on a
> > users table.
>
> > I'd like the end user to be able to search a user by firstname,
> > lastname, email and phone number, everything using an autocomplete
> > text field.
>
> > Any help or start point ?
>
> > Thx
>
> --
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Friday, February 27, 2009

Re: using ajax helper to reload an element

OK, finally getting a chance to look at this again. The biggest
problem I'm having is passing variable information to the element, so
that it can reduce the scope of what's returned and filter based on a
drop down selection.

Here's some code snippets:

http://bin.cakephp.org/view/168041585

Basically, I've gotten it to call the element from within a 'refresh'
view, called by the controller. However, Firebug shows *no* data being
sent in the AJAX POST, so I can't seem to get the data for the form
element that changed. The debug log shows no data for $this->data when
logged from the controller (homes).

The CDATA for the AJAX observer seems to be setup right:
//<![CDATA[
new Form.Element.EventObserver('booksubject', function(element, value)
{new Ajax.Request('/homes/latest_books_refresh', {asynchronous:true,
evalScripts:true, parameters:Form.Element.serialize('booksubject')})})
//]]>

I tried wrapping it in a FORM tag but that didn't help. Any ideas what
might be going on here?

Thanks :)

- Corey Crawford

On Feb 11, 9:25 am, WebbedIT <p...@webbedit.co.uk> wrote:
> As this is an AJAX request you are interfacing with the DOM and as
> such it does not matter whether the element to be updated was built
> with a view or element. As long as you have the link/observer calling
> a new instance of ajax.updater and have set it to update the required elementid then all should be happy. Your refreshSearchElement action
> needs a /home/refresh_search_element.ctp view and if you are using the
> RequestHandler component Cake should do all the rest for you.
>
> Have you got FireBug installed? If so what POST and Response data does
> it show for the ajax request?

On Feb 11, 10:32 am, brian <bally.z...@gmail.com> wrote:
> Sorry, I forgot something, actually
>
> $this->layout = false;
> $this->set('new_param', $new_param);
>
> $this->viewPath = 'elements';
>
> /*
> OR:
> $this->viewPath = 'elements'.DS.'some_other_dir';
> */
>
> $this->render('search_element_1');
>
> This will force Cake to use only the element to render the view.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Admin login and user login without ACL

Have a look at this tutorial
http://www.studiocanaria.com/articles/cakephp_auth_component_users_groups_permissions_revisited



2009/2/27 Dhana <sldhana@gmail.com>

Is it possible to secure the admin_path so that regular users don't
have access to it?  I am already using the Auth component for a user
login where they can perform their user tasks.  But I would also like
to have an admin that can see all the users stuff.  The prefix routing
works fine in creating the admin pages, but I was wondering if I could
create a separate login for admins so that only they can access the
admin tasks.  The acl component looks a little too complex for my
current app.





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

Re: Cake core is throwing unlink warnings

I've never seen this issue before, and it is hard to reproduce it in
test case if it misbehaves randomly...
Try one thing, please: in cake/libs/file.php in File::delete() replace
clearstatcache();
with
clearstatcache(true);
and let us know if that helps.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Admin login and user login without ACL

Is it possible to secure the admin_path so that regular users don't
have access to it? I am already using the Auth component for a user
login where they can perform their user tasks. But I would also like
to have an admin that can see all the users stuff. The prefix routing
works fine in creating the admin pages, but I was wondering if I could
create a separate login for admins so that only they can access the
admin tasks. The acl component looks a little too complex for my
current app.


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

Re: $paginator->link sorting – Is this a Bug?

As there was no reply I ended up posting a bug ticket for this. I'm
posting the result here for future searches on the subject.

Apparently this inheritance is the intended behavior of the Paginator
helper. Personally this makes no sense to me, but I guess there must
be good reason for it.

If you need a link that doesn't adapt to the current parameters (e.g.
having a permanent direction:desc) then it's recommended to use
HtmlHelper::link. The links generated with this do not change, thus
giving the desired results.

For example, in my index.ctp view I changed;

echo $paginator->link('Recent', array('sort'=>'released',>
'direction'=>'desc');

to

echo $html->link('Recent', array('sort' => 'released', 'direction' =>
'desc'));


-- Mike


On Feb 15, 11:49 am, Mike Cook <m...@epubbooks.com> wrote:
> I had posted about this previously but I guess the title and
> explanation I used were not very good. Hopefully this will be better.
>
> Here is my code;
>
> // Controller
>   function index() {
>     $this->paginate['Book'] = array(
>       'contain' => array('Author', 'Language', 'Genre'),
>       'order'   => 'title asc'
>     );
>     $this->set('books', $this->paginate());
>   }
>
> // index.ctp view
> <ul>
>   <li><?php echo $paginator->sort('Title', 'title'); ?></li>
>   <li><?php echo $paginator->link('Recent', array('sort'=>'released',
> 'direction'=>'desc'); ?></li>
>   <li><?php echo $paginator->sort('Language', 'Language.code'); ?></
> li>
> </ul>
>
> When the view loads the links are;
>
> http://localhost/books/index/page:1/sort:title/direction:deschttp://localhost/books/index/page:1/sort:released/direction:deschttp://localhost/books/index/page:1/sort:Language.code/direction:asc
>
> (I am trying to force the 'Recent' sort order to always default to
> 'desc')
>
> These all work as expected when the link is clicked for the first time
> on the initial page load. The problem I am having is with the
> $paginator->link('Recent', ...) sort, which is inheriting the model
> from the previous sort that was made.
>
> So, if I click 'Title' followed by the 'Recent' link, I get this URL;
>
> http://localhost/books/index/page:1/sort:Book.released/direction:desc
>
> As you can see, the link has inherited 'Book.released'. If I click
> 'Language' then the released link becomes 'Language.released'. The
> direction is also being inherited depending on the previous sort
> order.
>
> Even if I set the link in the view to use 'Book.released';
>
> $paginator->link('Recent', array('sort'=>'Book.released',
> 'direction'=>'desc');
>
> It still inherits the model, 'Language.released'. The $paginator->sort
> always plays nice as the 'Title' link remains as 'sort:title'.
>
> So, is this a bug with $paginator->link, and if not can anyone advise
> me on how to get it working properly?
>
> Thanks,
> Mike
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---