Re: Label information for Multiple Checkboxes

2009-01-15 Thread brian

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

On Thu, Jan 15, 2009 at 5:02 PM, Tony Thomas  wrote:
>
> I follow you up to this bit:
>
>> >
>> echo $form->input(
>>   'Category',
>>   array(
>> 'type'=>'select',
>> 'multiple'=>'checkbox',
>> 'options'=>$ids,
>> 'label'=>false
>> )
>>   );
>> ?>
>
> This doesn't seem to solve the problem of getting the other
> information into my label. In fact, it's the exact method I'm using
> now. I understand using $this->find('all', $options) and extract() to
> separate the ids from the rest of the information, but how do I get
> the other information displayed in my form? This method still leaves
> me with checkboxes and ids, but no other info.
> >
>

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



Re: Editable table

2009-01-15 Thread Miles J

Tablekit mainly JS/AJAX, which can simply be ported to CakePHP with a
little effort.
--~--~-~--~~~---~--~~
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: Saving Your Data

2009-01-15 Thread brian

To clarify, if all you want to do is edit a Profile, you only need the
user_id in $this->data[Profile']

If that's good to go, just do $this->User->Profile->save($this->data);

On Fri, Jan 16, 2009 at 1:08 AM, brian  wrote:
> Because the assumption is that a User is being created in the same
> action. Read back to the sentence before the one you quoted. "... that
> handles the saving of a new User and a related Profile."
>
> On Thu, Jan 15, 2009 at 8:15 PM, Delirium tremens  wrote:
>>
>> "The example action shown below will assume that you've POSTed enough
>> data (using the FormHelper) to create a single User and a single
>> Profile."
>>
>> http://book.cakephp.org/view/84/Saving-Related-Model-Data-hasOne-hasMany-belongsTo
>>
>>
>> POSTed enough data to save a single User and a single Profile???
>>
>> If I have
>> - email and password fields for user
>> - title and body fields for post
>>
>> Why do I need to post not just user ID, but also user email and user
>> password to save profile title and profile body???
>> >>
>>
>

--~--~-~--~~~---~--~~
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: Saving Your Data

2009-01-15 Thread brian

Because the assumption is that a User is being created in the same
action. Read back to the sentence before the one you quoted. "... that
handles the saving of a new User and a related Profile."

On Thu, Jan 15, 2009 at 8:15 PM, Delirium tremens  wrote:
>
> "The example action shown below will assume that you've POSTed enough
> data (using the FormHelper) to create a single User and a single
> Profile."
>
> http://book.cakephp.org/view/84/Saving-Related-Model-Data-hasOne-hasMany-belongsTo
>
>
> POSTed enough data to save a single User and a single Profile???
>
> If I have
> - email and password fields for user
> - title and body fields for post
>
> Why do I need to post not just user ID, but also user email and user
> password to save profile title and profile body???
> >
>

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



Quote marks in model names and Use of undefined constant notices

2009-01-15 Thread clarkphp

Check out the extra quotes in the model name in the WHERE clause
below:

SELECT `Organization`.`name`, `Organization`.`description` FROM
`organizations` AS `Organization`   WHERE `‘Organization’`.`status` =
'inactive'   ORDER BY `Organization`.`name` asc

I've used SimpleTest before, but am now beginning to use it in the
context of CakePHP's testing framework.  All test cases that involving
a model are failing because the model names are getting enclosed with
single quotes, which produces table names in database queries that of
course don't exist.  For example:

App::import('Model', 'Organization');

class OrganizationTestCase extends CakeTestCase
{
public $useTable = 'organizations';
public $fixtures = array('app.organization');

public function testInactive()
{
$this->Organization = ClassRegistry::init('Organization');

$result = $this->Organization->inactive(array('name',
'description'));
$expected = array(
   array('Organization' => array('name' => 'Test Company
Name', 'description'=> 'Mortgages'))
);
$this->assertEqual($result, $expected);
}
}

results in a failed assertion and two E_NOTICES.

The failed assertion:
Equal expectation fails as [Boolean: false] does not match [Array: 1
items] at [/usr/local/apache2/vhosts/dev-obfuscated.com/app/tests/
cases/models/organization.test.php line 19]

The Errors:
Unexpected PHP error [Use of undefined constant �Organization� -
assumed '�Organization�'] severity [E_NOTICE] in [/usr/local/
apache2/vhosts/dev-obfuscated.com/cake/libs/class_registry.php line
134]

Unexpected PHP error [SQL
Error: 1054: Unknown column '�Organization�.status'
in 'where clause'] severity [E_USER_WARNING] in [/usr/local/
apache2/vhosts/dev-obfuscated.com/cake/libs/model/datasources/
dbo_source.php line 514]

The use (or lack of) $useTable in the app/models or tests/cases/models
code makes little difference. If I leave out the $useTable statement,
the inflector creates this table name: 'organization's generating this
message:
Error:  Database table ‘organization’s for model Organization was not
found.

What obvious thing am I missing here?
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: unwanted user_id increase

2009-01-15 Thread Delirium tremens

I removed the line, but it still does not work, because user_id is
empty.

On 16 jan, 00:51, stefano  wrote:
> why are you doing the save into User's model? remove this line
> $usersaved = $this->User->save($this->data);
>
> function add() {
>        if (!empty ($this->data)) {
>                $this->data['Post']['user_id'] = $this->User->id;
>                $postsaved = $this->User->Post->save($this->data);
>                if($postsaved) {
>                        $this->flash('The post has been saved.', '/posts');
>                }
>        }
>
>
>
> }
> On Thu, Jan 15, 2009 at 11:45 PM, Delirium tremens  wrote:
>
> > I have a User hasMany Post and a Post belongs to User. The function to
> > add a post with an user id is inserting a user with null email and
> > null password into the users table and a post with an user id
> > increased by one into the posts table. Take a look...
>
> > function add() {
> >        if (!empty ($this->data)) {
> >                $usersaved = $this->User->save($this->data);
> >                $this->data['Post']['user_id'] = $this->User->id;
> >                $postsaved = $this->User->Post->save($this->data);
> >                if($postsaved && $usersaved) {
> >                        $this->flash('The post has been saved.', '/posts');
> >                }
> >        }
> > }
>
> > How to solve this problem?
>
> --
> Stefano Salvatori M.http://stefano.salvatori.cl/
--~--~-~--~~~---~--~~
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: Simple validation, required=true does not work or has preg_match() [function.preg-match]: Delimiter must not be alphanumeric or backslash

2009-01-15 Thread phpcurious

I just noticed another thing about your problem.
The reason why you get a preg_match error is because you weren't able
to follow the proper syntax for the validation rule.

for simple rules, you can follow this sample code (got from book):
var $validate = array(
'fieldName1' => array(
'rule' => 'ruleName', // or: array('ruleName', 'param1',
'param2' ...)
'required' => true,
'allowEmpty' => false,
'on' => 'create', // or: 'update'
'message' => 'Your Error Message'
)
);

for multiple rules:
var $validate = array(
'fieldName' => array(
'ruleName' => array(
'rule' => 'ruleName',
// extra keys like on, required, etc. go here...
),
'ruleName2' => array(
'rule' => 'ruleName2',
// extra keys like on, required, etc. go here...
)
)
);


On Jan 15, 1:52 pm, "Louie Miranda"  wrote:
> Guys, is there a new way of doing a simple this field is required? true or
> false?
>
> The code example and my code below, does not work.
>
> My code:
>
> var $validate = array(
>
> >    'officer'=>array('required'=>true)
> > );
>
> I am using CakePHP (Stable/Latest release). I get an error of...
>
> > preg_match() [function.preg-match ]:
> > Delimiter must not be alphanumeric or backslash [*
> > CORE/cake/libs/model/model.php*, line *2413*]
>
> Shall I always use alphanumeric on the rule? I just want to make it
> required, true or false. Is it still the same?
>
> Help!
> --
> Louie Miranda (lmira...@gmail.com)http://www.louiemiranda.net
>
> Security Is A Series Of Well-Defined Steps
> chmod -R 0 / ; and smile :)
--~--~-~--~~~---~--~~
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: unwanted user_id increase

2009-01-15 Thread Delirium tremens

The order is actually:

1. $this->User->save($this->data);
2. $this->data['Profile']['user_id'] = $this->User->id;
3. $this->User->Profile->save($this->data);

On 16 jan, 01:03, Delirium tremens  wrote:
> On 16 jan, 00:51, stefano  wrote:
>
> > why are you doing the save into User's model?
>
> http://book.cakephp.org/view/84/Saving-Related-Model-Data-hasOne-hasM...
>
> The add example on top of that page uses...
>
> 1. $this->User->Profile->save($this->data);
> 2. $this->data['Profile']['user_id'] = $this->User->id;
> 3. $this->User->save($this->data);
>
> If I'm using User hasMany Post and Post belongsTo User, why does the
> example need the three lines, but I don't?
>
> > remove this line
> > $usersaved = $this->User->save($this->data);
>
> > function add() {
> >        if (!empty ($this->data)) {
> >                $this->data['Post']['user_id'] = $this->User->id;
> >                $postsaved = $this->User->Post->save($this->data);
> >                if($postsaved) {
> >                        $this->flash('The post has been saved.', '/posts');
> >                }
> >        }
>
> > }
> > On Thu, Jan 15, 2009 at 11:45 PM, Delirium tremens  
> > wrote:
>
> > > I have a User hasMany Post and a Post belongs to User. The function to
> > > add a post with an user id is inserting a user with null email and
> > > null password into the users table and a post with an user id
> > > increased by one into the posts table. Take a look...
>
> > > function add() {
> > >        if (!empty ($this->data)) {
> > >                $usersaved = $this->User->save($this->data);
> > >                $this->data['Post']['user_id'] = $this->User->id;
> > >                $postsaved = $this->User->Post->save($this->data);
> > >                if($postsaved && $usersaved) {
> > >                        $this->flash('The post has been saved.', '/posts');
> > >                }
> > >        }
> > > }
>
> > > How to solve this problem?
>
> > --
> > Stefano Salvatori M.http://stefano.salvatori.cl/
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Editable table

2009-01-15 Thread Al

Hello,

Can anyone point me in the correct direction for creating an editable
table in cakePHP, much like "tablekit"

http://www.millstream.com.au/view/code/tablekit

I use tablekit currently, should I just be figuring out how to use it
within cakePHP?

Thanks!

Al
--~--~-~--~~~---~--~~
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: unwanted user_id increase

2009-01-15 Thread Delirium tremens

On 16 jan, 00:51, stefano  wrote:
> why are you doing the save into User's model?

http://book.cakephp.org/view/84/Saving-Related-Model-Data-hasOne-hasMany-belongsTo

The add example on top of that page uses...

1. $this->User->Profile->save($this->data);
2. $this->data['Profile']['user_id'] = $this->User->id;
3. $this->User->save($this->data);

If I'm using User hasMany Post and Post belongsTo User, why does the
example need the three lines, but I don't?

> remove this line
> $usersaved = $this->User->save($this->data);
>
> function add() {
>        if (!empty ($this->data)) {
>                $this->data['Post']['user_id'] = $this->User->id;
>                $postsaved = $this->User->Post->save($this->data);
>                if($postsaved) {
>                        $this->flash('The post has been saved.', '/posts');
>                }
>        }
>
>
>
> }
> On Thu, Jan 15, 2009 at 11:45 PM, Delirium tremens  wrote:
>
> > I have a User hasMany Post and a Post belongs to User. The function to
> > add a post with an user id is inserting a user with null email and
> > null password into the users table and a post with an user id
> > increased by one into the posts table. Take a look...
>
> > function add() {
> >        if (!empty ($this->data)) {
> >                $usersaved = $this->User->save($this->data);
> >                $this->data['Post']['user_id'] = $this->User->id;
> >                $postsaved = $this->User->Post->save($this->data);
> >                if($postsaved && $usersaved) {
> >                        $this->flash('The post has been saved.', '/posts');
> >                }
> >        }
> > }
>
> > How to solve this problem?
>
> --
> Stefano Salvatori M.http://stefano.salvatori.cl/
--~--~-~--~~~---~--~~
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: Nested Associations / Multiple Joins

2009-01-15 Thread seth

Also, what is "read", I'm not having any luck finding any
documentation on this (perhaps I should be using "find" and that's my
problem to begin with...).  I just copied this line from a baked
controller:
$user = $this->User->read(null, $id);
--~--~-~--~~~---~--~~
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: unwanted user_id increase

2009-01-15 Thread stefano

why are you doing the save into User's model? remove this line
$usersaved = $this->User->save($this->data);

function add() {
   if (!empty ($this->data)) {
   $this->data['Post']['user_id'] = $this->User->id;
   $postsaved = $this->User->Post->save($this->data);
   if($postsaved) {
   $this->flash('The post has been saved.', '/posts');
   }
   }
}

On Thu, Jan 15, 2009 at 11:45 PM, Delirium tremens  wrote:
>
> I have a User hasMany Post and a Post belongs to User. The function to
> add a post with an user id is inserting a user with null email and
> null password into the users table and a post with an user id
> increased by one into the posts table. Take a look...
>
> function add() {
>if (!empty ($this->data)) {
>$usersaved = $this->User->save($this->data);
>$this->data['Post']['user_id'] = $this->User->id;
>$postsaved = $this->User->Post->save($this->data);
>if($postsaved && $usersaved) {
>$this->flash('The post has been saved.', '/posts');
>}
>}
> }
>
> How to solve this problem?
> >
>



-- 
Stefano Salvatori M.
http://stefano.salvatori.cl/

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



Nested Associations / Multiple Joins

2009-01-15 Thread seth

I have the following setup:

Users hasAndBelongsToMany Albums
Albums belongsTo Artists

It's easy enough to retrieve all the users albums with:

$user = $this->User->read(null, $id);

This populates $user['Album'].  But what is the best practice for
getting the artist info associated with the album?

This seems like a fairly common occurrence so I figure I'm missing
something obvious here, hopefully it's not too vague.

Here's the query it's executing:

SELECT `Album`.`id`, `Album`.`artist_id`, `Album`.`name`,
`Album`.`created`, `Album`.`modified`, `AlbumsUser`.`id`,
`AlbumsUser`.`album_id`, `AlbumsUser`.`user_id` FROM `albums` AS
`Album` JOIN `albums_users` AS `AlbumsUser` ON (`AlbumsUser`.`user_id`
= 2 AND `AlbumsUser`.`album_id` = `Album`.`id`) WHERE 1 = 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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



unwanted user_id increase

2009-01-15 Thread Delirium tremens

I have a User hasMany Post and a Post belongs to User. The function to
add a post with an user id is inserting a user with null email and
null password into the users table and a post with an user id
increased by one into the posts table. Take a look...

function add() {
if (!empty ($this->data)) {
$usersaved = $this->User->save($this->data);
$this->data['Post']['user_id'] = $this->User->id;
$postsaved = $this->User->Post->save($this->data);
if($postsaved && $usersaved) {
$this->flash('The post has been saved.', '/posts');
}
}
}

How to solve 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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Saving Your Data

2009-01-15 Thread Delirium tremens

"The example action shown below will assume that you've POSTed enough
data (using the FormHelper) to create a single User and a single
Profile."

http://book.cakephp.org/view/84/Saving-Related-Model-Data-hasOne-hasMany-belongsTo


POSTed enough data to save a single User and a single Profile???

If I have
- email and password fields for user
- title and body fields for post

Why do I need to post not just user ID, but also user email and user
password to save profile title and profile body???
--~--~-~--~~~---~--~~
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: Security.level with Blackberry over SSL

2009-01-15 Thread Elmo

So I finally figured out why the sessions keep mysteriously dropping
on my blackberry. The symptoms are simple. Login to the cake app, and
you get to the first logged in page. Then when you click on anything
else to take you deeper into the site, you get redirected back to the
login page.

The problem was that this was only really happening in the test
staging site and not on my development site. So I 'diff -r' the
directories, and the only differences I could find were in the
core.php files. In the development site, I have debug set to level 2,
and I have the security level to low. In the production training site
I have security level set to high. Lo-and-behold, changing the
security level to low would allow for the blackberry to continue on
its merry way. I then ratcheted the staging site up to medium, and the
blackberry continued to work.

So the only thing I could think of is that the blackberry couldn't
handle swapping of session ID's between requests. According to the
cakephp cookbook, section 3.4.3.2 High and medium enable
session.referer_check, while in high the CakePHP session IDs are
regenerated between requests. The blackberry typically goes through a
proxy server, so that might be it.

-e


On Jan 14, 10:25 pm, Elmo  wrote:
> I am having a problem. While developing I keep my Security.level to
> low while also using SSL. When I am ready to stage my site for
> testing, I have the production setting which is Security.level on high
> and SSL. The entire site is locked down (you need to login to access
> the site).
> My problem is that while using aBlackberryto visit the pre-
> production site, session information is not stored past the "Login"
> click. The next click afterwards goes back to the login page.
>
> - If I go to a non-SSL version of the pre-production site with myblackberry, 
> everything works.
> - If I go to a Security.level low SSL version of the pre-production
> site with myblackberry, everything works.
> - If I go to a Security.level medium (SSL or non-SSL) version of the
> pre-production site with myblackberryeverything works.
>
> I want to keep it on Security.level high. Why can't I do so with 
> theblackberry?
--~--~-~--~~~---~--~~
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: Tabs in Layout... Help Please.

2009-01-15 Thread nurvzy

@Andrew: Thank you very much for the link to your great article; its
well written and much appreciated.

Thank you all for your quick responses, help and advice.  Very much
appreciated!

Nick
On Jan 15, 2:05 pm, "ache...@gmail.com"  wrote:
> Nurvzy,
>
> Yes! This is the first time I've written anything and then been able
> to link to it. I don't like the idea of using your server to process
> this, I think it's a task much better suited to CSS I wrote about it
> here if you want to take a lookhttp://www.lifeiscake.com/posts/view/css-menus
>
> Sincerely,
> ~Andrew Allen
>
> On Jan 13, 4:05 pm, nurvzy  wrote:
>
> > Hi All,
>
> >   I'm new to cakephp and working through my first cake app.  I'm
> > chugging along and am now stumped as to where to put a function I've
> > written to help decide if a navigation tab should have the
> > id="selected" assigned to the anchor tag.
>
> > Basically the gist is I have a  Navigation bar with various links:
> > (Home, Contact, ect..) and depending on the current controller or
> > action or whatever I pass in; I want the id of that  tag to be
> > "selected".
>
> > So I've written a little function:
>
> > function is_selected($controller_or_action, $link_text){
> >   if (strpos($controller_or_action,$link_text) !== false) return true;
> >   else return false;
>
> > }
>
> > And I'm calling it like so in the default.ctp layout:
>
> >  >  if(is_selected($this->params['controller'], "pages")) echo $html->link
> > ('Contact', array('controller' => 'pages', 'action' => 'contactus'),
> > array('id' => 'selected'));
> > else echo $html->link('Contact', array('controller' => 'pages',
> > 'action' => 'contactus'));
> >  ?>
>
> > But that's really tedious and quite ugly, plus I have that function
> > just written at the top of the layout which is a big no-no.  So I'm
> > looking for some help/advice.  How do you specify a tab type layout in
> > your cake app?
>
> > Thank you for your advice and/or help.
> > Nick
--~--~-~--~~~---~--~~
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 do I access a HABTM relationship from another model?

2009-01-15 Thread Miles J

$mastercats = $this->User->find('all',
array('conditions'=>array('User.id' => $id),
'contain' => array(
'Mastercat.id', 'Mastercat.desc'),
),
)
);
--~--~-~--~~~---~--~~
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 do I access a HABTM relationship from another model?

2009-01-15 Thread Nancy

I'm getting closer!  I have this right now:

$mastercats = $this->User->find('all',
array('conditions'=>array('User.id' => $id),
'contain' => array(
'Mastercat' => array(
'fields'=>array('id','desc')
),
),
)
);

I can't quite figure out how to get just the Mastercat id and
description of the ones associated with the user, and all the ones not
associated, so I can have a properly populated (with selections)
select list.

Any suggestions?  Maybe a manual query would be easier, but I still
don't know how to pass that to the view so it'd create a proper select
list.
--~--~-~--~~~---~--~~
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: Creating a "Does not Equal To" SQL Statement

2009-01-15 Thread exo_duz

Thanks for that. Works perfect!

On Jan 15, 8:24 am, Graham Weldon  wrote:
> Hey,
>
> 'conditions' => array(
>    'OpportunityCategory.id !=' => 1)
>
> That should do it for you.
>
> Cheers.
>
> On Thu, 15 Jan 2009 05:13:20 -0800 (PST), exo_duz 
> wrote:> Hi all,
>
> > Simple question. I want to create a "Does Not Equal To" SQL statement
> > within the Controller. The SQL statement would just get me back all
> > data when "OpportunityCategory.id" <> 1.
>
> > $findOtherOpportunities = $this->OpportunityCategory->find('all', array
> > (
>
> > 'conditions' => array(
>
> > 'OpportunityCategory.id' => '1'
>
>                               ),
>
> > 'order' => array(
>
> > 'OpportunityCategory.id ASC',
>
>                           )
>
>
>
>           )
> >                                                                     );
> >             $this->set('other_opportunities',
> > $findOtherOpportunities);
>
> > Is there a way to do it using the Model::find function? Or would I
> > have to create a custom SQL within the model?
>
> > Thanks for your 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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How do I access a HABTM relationship from another model?

2009-01-15 Thread Miles J

Well more like this I believe:

$this->Recipe->find('first',array('conditions'=>array('User.id'=>
$user_id),'recursive'=>2, 'contain' => array('Category', 'User')))
--~--~-~--~~~---~--~~
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 do I access a HABTM relationship from another model?

2009-01-15 Thread Nancy

On Jan 15, 3:32 pm, Miles J  wrote:
> Set your recursive level to 2/3 and the User association will grab the
> categories along with it. Use containable to filter the results.

I'm new to cakephp so I'll try to echo back what I think you're
saying.

In my recipes controller then I'd do something like this?

$this->User->Category('list',array('options'=>array('User.id'=>
$user_id),'recursive'=>2))

I haven't used containable, I'll have to look that one up.

--~--~-~--~~~---~--~~
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 do I access a HABTM relationship from another model?

2009-01-15 Thread Miles J

Set your recursive level to 2/3 and the User association will grab the
categories along with it. Use containable to filter the results.
--~--~-~--~~~---~--~~
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 do I access a HABTM relationship from another model?

2009-01-15 Thread Nancy

Hopefully I can explain this adequately.  I have 3 models

Recipe:  belongsTo User
Recipe: HaBTM Category

User: HaBTM Category (same categories as recipes)
User: hasMany Recipe

Category: HaBTM User
Category: HaBTM Recipe

(join tables categories_users and categories_recipes)


Everything works great, in the recipe model I can get the categories
that belong to that recipe, in the user model I can get the categories
that belong to that user.  I can make selection lists with all the
right stuff.

What I can't figure out is how to get the categories that belong to
the user (for instance) when I'm in the recipe model.  I have access
to the user_id (stuffed away in the session).

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



Re: Label information for Multiple Checkboxes

2009-01-15 Thread Tony Thomas

I follow you up to this bit:

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

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



Re: mod_rewrite problems

2009-01-15 Thread neridaj

I should have mentioned that I'm a newb, thanks for the help.

On Jan 15, 12:43 pm, Graham Weldon  wrote:
> Hey,
>
> I know its a basic thing, so don't get annoyed at me for asking..
> But are you restarting the webserver after these changes?
> You'll need to restart or reload your apache config in order for changes to
> take effect.
>
> Cheers,
> Graham
>
> On Thu, 15 Jan 2009 10:15:38 -0800 (PST), neridaj 
> wrote:
>
> > I tried adding that line in the 1.2.x.x .htaccess file as well as the /
> > app .htaccess file with no luck.
>
> > On Jan 15, 8:53 am, Smelly_Eddie  wrote:
> >> Try adding
> >>  RewriteBase /
>
> >> just after
> >> RewriteEngine On
>
> >> in your htaccess files.
>
> >> When I was on godaddy i found this to be a requirement to get things
> >> working.
>
> >> On Jan 14, 4:14 pm,neridaj wrote:
>
> >> > Hello,
>
> >> > I've edited my httpd.conf file as instructed and can't get mod_rewrite
> >> > working. Any suggestions?
>
> >> > /etc/httpd/httpd.conf:
>
> >> > LoadModule rewrite_module     libexec/httpd/mod_rewrite.so
>
> >> > DocumentRoot "/Library/WebServer/Documents"
>
> >> > 
>
> >> > #
> >> > # This may also be "None", "All", or any combination of "Indexes",
> >> > # "Includes", "FollowSymLinks", "ExecCGI", or "MultiViews".
> >> > #
> >> > # Note that "MultiViews" must be named *explicitly* --- "Options All"
> >> > # doesn't give it to you.
> >> > #
> >> >     Options Indexes FollowSymLinks MultiViews
>
> >> > #
> >> > # This controls which options the .htaccess files in directories can
> >> > # override. Can also be "All", or any combination of "Options",
> >> > "FileInfo",
> >> > # "AuthConfig", and "Limit"
> >> > #
> >> >     AllowOverride All
>
> >> > #
> >> > # Controls who can get stuff from this server.
> >> > #
> >> >     Order allow,deny
> >> >     Allow from all
> >> > 
>
> >> > Thanks,
>
> >> > Jason
--~--~-~--~~~---~--~~
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: A new discussion about "controllers which extend another-controller-other-than-AppController"

2009-01-15 Thread Bernardo Vieira

Just one question though, why can't you just use app_controller for 
this? Or better yet, for added flexibility, put whatever you need in a 
component and use it in the controllers where you need remoting 
capabilities.

Graham Weldon wrote:
> Hey,
>
> Better than including php files, use the CakePHP App::import() and
> ClassRegistry::init() methods.
> These locate, include and in the case of the ClassRegistry, instantiate and
> return the object for you.
>
> You would in this case, do something like:
>
> App::import('Controller', 'RemotingController');
> class RemotingUsersController extends RemotingController {
>/// implementation
> }
>
> Run a few tests with that, but its my understanding that this method should
> make the components available for the RemotingUsersController class.
> If not, ensuring that the __construct() passes back to the parent should
> ensure that the parent class is processed properly, but this should happen
> by default.
>
> Try the App::import() and let me know how you go with the components.
>
> Cheers,
> Graham
>
>
> On Thu, 15 Jan 2009 12:47:58 -0800 (PST), caminante
>  wrote:
>   
>> Being released 1.2 final version of CakePHP, I opened this discussion
>> to try to bring some light together to this issue.
>>
>> My need:
>> What's in the subject of this discussion; I have a couple of "special"
>> controllers to be called from flash (through cakeswxphp). What I need
>> is those controllers extending a "RemotingController" (with it's set
>> of thingies for communication with flash) which in turn extends
>> AppController. Sounded easy when I thought it, it's a common practice
>> in OOP and I cannot see why it wouldn't be implemented in an OOP
>> framework as CakePHP. Let's see:
>>
>> 1) class RemotingController extends AppController {}   // dir: app/ or
>> app/controllers/
>> 2) class RemotingUsersController extends RemotingController {}   //
>> dir: app/controllers/
>>
>> When I make a request to an action in RemotingUsersController, "Class
>> 'RemotingController' not found", either putting it at app/ or app/
>> controllers/. Ok, CakePHP didn't noticed RemotingController class
>> existed.
>>
>> There are a couple of (old or even antique) discussions on the
>> subject:
>>
>>
>> 
> http://groups.google.com/group/cake-php/browse_thread/thread/83bad7a3498001c7
>   
>> (from 2005)
>> and a more recent one:
>>
>> 
> http://groups.google.com/group/cake-php/browse_thread/thread/f3c62f08147fcfe9/
>   
>> (from mid 2007)
>>
>> Neither seemed to found a (nice?) way to do this and according to
>> dates, they were discussing on different stages in the evolution of
>> the framework.
>> I applied something said in the first one, suggesting the following:
>>
>> require_once('parent_controller.php');
>> class ChildController extends ParentController {}
>>
>> The requirement for the php file with my RemotingController class
>> would work fine (though not being a pretty/frameworkian solution, but
>> I can live with that). Now my class seems to be recognized by Cake but
>> I have another problem: The components I declare for this class don't
>> work ("Call to a member function requestedWith() on a non-object", for
>> example). Seems that leaving a little bit the CakePHP "rigorous-
>> mechanics/convention-over-configuration" of Cake, there are some
>> things that stop working "automagically", such as automatic components
>> initialization.
>>
>> My questions:
>> How, then, can I initialize components? (and maybe why there's nothing
>> in the book on this subject?)
>> What can be the most practical and conventional way of doing what I
>> need?
>> Are others there that achieved good results with this?
>>
>> 
>
> >
>
>   


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



Re: Questions about forms / validation

2009-01-15 Thread fly2279

On the first part of the question you can do an 'on' => 'create' so
that it doesn't run that portion of validation when updating a
record.

http://book.cakephp.org/view/131/on

I'll let someone more experienced answer the second part about
population.

On Jan 15, 1:45 am, Miles J  wrote:
> So Im working on this area where users can edit their profile, etc.
> All the validation works, its just on the email field it always errors
> because I am using the isUnique rule.
>
> It keeps erroring because the email in the input is THEIR email, and
> it does exist in the database. So it keeps throwing the isUnique error
> "This email is already in use.". Is there a way I can get this
> working, while keeping the input email field populated?
>
> ---
>
> Also my form is prepopulated doing: array('value' => $user['User']
> ['value']). But when I make changes and hit submit, and an error
> occurs, the fields go back to the $user value and not the value they
> just did. A way around this 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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Tabs in Layout... Help Please.

2009-01-15 Thread ache...@gmail.com

Nurvzy,

Yes! This is the first time I've written anything and then been able
to link to it. I don't like the idea of using your server to process
this, I think it's a task much better suited to CSS I wrote about it
here if you want to take a look http://www.lifeiscake.com/posts/view/css-menus

Sincerely,
~Andrew Allen

On Jan 13, 4:05 pm, nurvzy  wrote:
> Hi All,
>
>   I'm new to cakephp and working through my first cake app.  I'm
> chugging along and am now stumped as to where to put a function I've
> written to help decide if a navigation tab should have the
> id="selected" assigned to the anchor tag.
>
> Basically the gist is I have a  Navigation bar with various links:
> (Home, Contact, ect..) and depending on the current controller or
> action or whatever I pass in; I want the id of that  tag to be
> "selected".
>
> So I've written a little function:
>
> function is_selected($controller_or_action, $link_text){
>   if (strpos($controller_or_action,$link_text) !== false) return true;
>   else return false;
>
> }
>
> And I'm calling it like so in the default.ctp layout:
>
>   if(is_selected($this->params['controller'], "pages")) echo $html->link
> ('Contact', array('controller' => 'pages', 'action' => 'contactus'),
> array('id' => 'selected'));
> else echo $html->link('Contact', array('controller' => 'pages',
> 'action' => 'contactus'));
>  ?>
>
> But that's really tedious and quite ugly, plus I have that function
> just written at the top of the layout which is a big no-no.  So I'm
> looking for some help/advice.  How do you specify a tab type layout in
> your cake app?
>
> Thank you for your advice and/or help.
> Nick
--~--~-~--~~~---~--~~
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: A new discussion about "controllers which extend another-controller-other-than-AppController"

2009-01-15 Thread Graham Weldon


Hey,

Better than including php files, use the CakePHP App::import() and
ClassRegistry::init() methods.
These locate, include and in the case of the ClassRegistry, instantiate and
return the object for you.

You would in this case, do something like:

App::import('Controller', 'RemotingController');
class RemotingUsersController extends RemotingController {
   /// implementation
}

Run a few tests with that, but its my understanding that this method should
make the components available for the RemotingUsersController class.
If not, ensuring that the __construct() passes back to the parent should
ensure that the parent class is processed properly, but this should happen
by default.

Try the App::import() and let me know how you go with the components.

Cheers,
Graham


On Thu, 15 Jan 2009 12:47:58 -0800 (PST), caminante
 wrote:
> Being released 1.2 final version of CakePHP, I opened this discussion
> to try to bring some light together to this issue.
> 
> My need:
> What's in the subject of this discussion; I have a couple of "special"
> controllers to be called from flash (through cakeswxphp). What I need
> is those controllers extending a "RemotingController" (with it's set
> of thingies for communication with flash) which in turn extends
> AppController. Sounded easy when I thought it, it's a common practice
> in OOP and I cannot see why it wouldn't be implemented in an OOP
> framework as CakePHP. Let's see:
> 
> 1) class RemotingController extends AppController {}   // dir: app/ or
> app/controllers/
> 2) class RemotingUsersController extends RemotingController {}   //
> dir: app/controllers/
> 
> When I make a request to an action in RemotingUsersController, "Class
> 'RemotingController' not found", either putting it at app/ or app/
> controllers/. Ok, CakePHP didn't noticed RemotingController class
> existed.
> 
> There are a couple of (old or even antique) discussions on the
> subject:
> 
>
http://groups.google.com/group/cake-php/browse_thread/thread/83bad7a3498001c7
> (from 2005)
> and a more recent one:
>
http://groups.google.com/group/cake-php/browse_thread/thread/f3c62f08147fcfe9/
> (from mid 2007)
> 
> Neither seemed to found a (nice?) way to do this and according to
> dates, they were discussing on different stages in the evolution of
> the framework.
> I applied something said in the first one, suggesting the following:
> 
> require_once('parent_controller.php');
> class ChildController extends ParentController {}
> 
> The requirement for the php file with my RemotingController class
> would work fine (though not being a pretty/frameworkian solution, but
> I can live with that). Now my class seems to be recognized by Cake but
> I have another problem: The components I declare for this class don't
> work ("Call to a member function requestedWith() on a non-object", for
> example). Seems that leaving a little bit the CakePHP "rigorous-
> mechanics/convention-over-configuration" of Cake, there are some
> things that stop working "automagically", such as automatic components
> initialization.
> 
> My questions:
> How, then, can I initialize components? (and maybe why there's nothing
> in the book on this subject?)
> What can be the most practical and conventional way of doing what I
> need?
> Are others there that achieved good results with this?
> 

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



A new discussion about "controllers which extend another-controller-other-than-AppController"

2009-01-15 Thread caminante

Being released 1.2 final version of CakePHP, I opened this discussion
to try to bring some light together to this issue.

My need:
What's in the subject of this discussion; I have a couple of "special"
controllers to be called from flash (through cakeswxphp). What I need
is those controllers extending a "RemotingController" (with it's set
of thingies for communication with flash) which in turn extends
AppController. Sounded easy when I thought it, it's a common practice
in OOP and I cannot see why it wouldn't be implemented in an OOP
framework as CakePHP. Let's see:

1) class RemotingController extends AppController {}   // dir: app/ or
app/controllers/
2) class RemotingUsersController extends RemotingController {}   //
dir: app/controllers/

When I make a request to an action in RemotingUsersController, "Class
'RemotingController' not found", either putting it at app/ or app/
controllers/. Ok, CakePHP didn't noticed RemotingController class
existed.

There are a couple of (old or even antique) discussions on the
subject:

http://groups.google.com/group/cake-php/browse_thread/thread/83bad7a3498001c7
(from 2005)
and a more recent one:
http://groups.google.com/group/cake-php/browse_thread/thread/f3c62f08147fcfe9/
(from mid 2007)

Neither seemed to found a (nice?) way to do this and according to
dates, they were discussing on different stages in the evolution of
the framework.
I applied something said in the first one, suggesting the following:

require_once('parent_controller.php');
class ChildController extends ParentController {}

The requirement for the php file with my RemotingController class
would work fine (though not being a pretty/frameworkian solution, but
I can live with that). Now my class seems to be recognized by Cake but
I have another problem: The components I declare for this class don't
work ("Call to a member function requestedWith() on a non-object", for
example). Seems that leaving a little bit the CakePHP "rigorous-
mechanics/convention-over-configuration" of Cake, there are some
things that stop working "automagically", such as automatic components
initialization.

My questions:
How, then, can I initialize components? (and maybe why there's nothing
in the book on this subject?)
What can be the most practical and conventional way of doing what I
need?
Are others there that achieved good results with this?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: mod_rewrite problems

2009-01-15 Thread Graham Weldon


Hey,

I know its a basic thing, so don't get annoyed at me for asking..
But are you restarting the webserver after these changes?
You'll need to restart or reload your apache config in order for changes to
take effect.

Cheers,
Graham



On Thu, 15 Jan 2009 10:15:38 -0800 (PST), neridaj 
wrote:
> I tried adding that line in the 1.2.x.x .htaccess file as well as the /
> app .htaccess file with no luck.
> 
> On Jan 15, 8:53 am, Smelly_Eddie  wrote:
>> Try adding
>>  RewriteBase /
>>
>> just after
>> RewriteEngine On
>>
>> in your htaccess files.
>>
>> When I was on godaddy i found this to be a requirement to get things
>> working.
>>
>> On Jan 14, 4:14 pm,neridaj wrote:
>>
>> > Hello,
>>
>> > I've edited my httpd.conf file as instructed and can't get mod_rewrite
>> > working. Any suggestions?
>>
>> > /etc/httpd/httpd.conf:
>>
>> > LoadModule rewrite_module     libexec/httpd/mod_rewrite.so
>>
>> > DocumentRoot "/Library/WebServer/Documents"
>>
>> > 
>>
>> > #
>> > # This may also be "None", "All", or any combination of "Indexes",
>> > # "Includes", "FollowSymLinks", "ExecCGI", or "MultiViews".
>> > #
>> > # Note that "MultiViews" must be named *explicitly* --- "Options All"
>> > # doesn't give it to you.
>> > #
>> >     Options Indexes FollowSymLinks MultiViews
>>
>> > #
>> > # This controls which options the .htaccess files in directories can
>> > # override. Can also be "All", or any combination of "Options",
>> > "FileInfo",
>> > # "AuthConfig", and "Limit"
>> > #
>> >     AllowOverride All
>>
>> > #
>> > # Controls who can get stuff from this server.
>> > #
>> >     Order allow,deny
>> >     Allow from all
>> > 
>>
>> > Thanks,
>>
>> > Jason
> 

--~--~-~--~~~---~--~~
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: Questions about forms / validation

2009-01-15 Thread Miles J

Any help would be lovely!
--~--~-~--~~~---~--~~
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: Save flow behaviour ..

2009-01-15 Thread teknoid

sounds like your model isn't found, so cake uses an instance of
AppModel, which of course doesn't have beforeSave() defined.
make sure the file is named correctly.

On Jan 15, 7:22 am, "Marcelo Iwata"  wrote:
> At cakePHP documentation, it's clear that beforeSave have to return true to
> continue the Save process.
> But, i was doing some tests..
> function beforeSave(){return false;}
> function save() {
>     $this->set("CSS", "main");if (!empty($this->data)) {if
> ($this->User->save($this->data)) {$this->flash('Your user has been saved.',
> '/users');}}
>
> }
>
> my view:
> element('esquerdoPadrao'); ?>
> 
> Add Post
> create('User');
> echo $form->input('name');
> echo $form->input('username');
> echo $form->input('password');
> echo $form->input('email');
> echo $form->end('Salvar Usuario');?>
> 
>
> and ,saved.
>
> I was at tmp/cache/..
> and cleaned. But , it continues..
>
> Why?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Session - setFlash - redirect - GONE!

2009-01-15 Thread deedod


Hello All,

I'm having an issue pretty much exactly like the issue posted here:
http://www.nabble.com/Sessions,-redirects-and-setFlash-td14792737.html

Basically I set a session variable when an admin logs in with some info
$this->Session->write('AdminInfo', $admin);

And then on every page in the admin area I check if that session variable
is still valid or if it's expired using:

public function beforeFilter()
{
$this->checkLogin();
}

public function checkLogin()
{
if ($this->Session->check('AdminInfo') === false)
{
// Save the URL of where you want to go.
$this->Session->setFlash('You must login to view this area.');
$this->Session->write('RedirectURL', Router::url('', false));
$this->redirect('/admin/login/');
}
}

Now the problem is that after the redirect back to the login screen
all my session info is gone.  Neither the RedirectURL nor the setFlash
message exist upon returning to the login page.  All I see in the
session is the userAgent, rand, timeout, etc.

This only happens if the session existed beforehand and not when you
try to go to a page fresh before every logging in.  As a flow example:

1. Not Logged In - Go to admin area page - Redirect to login - Redirect URL
and setFlash both work

2. Logged In - Go to admin area page - session has timed out - Redirect to
login - Redirect URL and setFlash both gone now.

At no point in my code do I ever delete the session variables or sesion
itself.  This is only happening when the session times out on its own.

Does anyone have a solution or know whats going on here?  I've spent
hours trying to figure this out and the thread above didn't really offer
a solution since I don't use the DAuth component.

Any help would be greatly appreciated.

Thanks.



-- 
View this message in context: 
http://www.nabble.com/Session---setFlash---redirect---GONE%21-tp21485684p21485684.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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Rendering an add form within another controller's view (with all automagicness)

2009-01-15 Thread Martin Westin


I can only think of one far-fetched thing to check. Make sure you
specify the inputs with the Modelname present.
$html->input(Modelname.fieldname);

Or get around requestAction of-course :)

/Martin


On Jan 15, 8:08 pm, jwerd  wrote:
> Sorry, it was about 3am when I wrote that and I was prettty vague on
> the precise problem.
>
> The automagicness (as far as cake finding out what field goes where)
> is working fine, the problem I'm having is with the drop downs,
> basically the select box outputs in a weird form:
>
> it shows every field from the shows table in the form instead of like
>
> Value 1
> Value 2
> Value 3
> Value 4
> Value 5
>
> Like it would if I directly acesss /show_attendees/add/
>
> It looks like
> 1
> 2
> 3
> 4
> Value 1
> Some spacing
> 5
> 6
> 7
> 8
>
> That's the only thing that's the issue now.  Do you have any idea how
> I can fix that?
>
> On Jan 15, 10:07 am, Martin Westin  wrote:
>
> > A quick suggestion to follow along with Lecter's reply:
>
> > Since it is an add form it does not show any pre-populated data,
> > right? I am not sure what you mean by automagicness, though? Do you
> > mean Cakes ability to figure out that one thing is a textfield and
> > another is a dropdown?
>
> > Try to put your add form (the one you get from the requestAction call)
> > into an element and have both views call that element. That should
> > yield the same form in both views without an extra request. To get
> > some possibly lost automagicness you may have to include the attendee-
> > model in the controller (so the form-helper can read the schema), but
> > that is a guess. I haven't looked too closely into the form helper
> > code.
>
> > Please, don't take this the wrong way:
> > Your question sounds like you are thinking that view, controller and
> > model are more tightly linked than you need to. The controller does
> > not "own" the model of the same name. You can often come far using
> > this one to one relationship but you will also come across places
> > where one Controller makes use of (and even saves data to) "another"
> > Model. An ExampleController and the example-views can be seen as
> > pretty tightly integrated. But the ExampleModel does not have to be
> > accessed from only the ExampleController.
>
> > I used to think I was "cheating" when I defined $uses = array
> > ('AnotherModel') in a controller, but that is actually good design...
> > at least compared to using requestAction... but I am not expert on MVC
> > design, so I may be shooting myself in the foot here. ;)
>
> > good luck.
> > /Martin
>
> > On Jan 15, 10:41 am, "dr. Hannibal Lecter" 
> > wrote:
>
> > > It is very difficult to see what the problem is without the code.
> > > Also, it would be the best if you can avoid the requestAction :-)
>
> > > On Jan 15, 10:19 am, jwerd  wrote:
>
> > > > Hello fellow bakers, I've searched this group before I was going to
> > > > post this question but I cant' seem to find my current dilema
> > > > addressed yet.
>
> > > > I have two controllers, which serve different purposes, but for the
> > > > sake of this example, they share some things in common :
>
> > > > shows_controller is used to pretty much the shows in the system
>
> > > > show_attendees_controller is used to capture the attendees of any
> > > > given show
>
> > > > On the view /shows/view/# page I need to include the "add form" of
> > > > show_attendees/add/ but what's happening is, it's not doing all the
> > > > automagicness, and it's creating weird drop down menus that don't
> > > > really capture the same format they do if I was directly accessing
> > > > them from /show_attendees/add/.
>
> > > > Also, I'm using requestAction, just so everyone knows.
>
> > > > Any help is much appreciated.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Label information for Multiple Checkboxes

2009-01-15 Thread Tony Thomas

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

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

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



Validation error messages of related model are not shown

2009-01-15 Thread Braindead

I have a view were I show a news and it's related comments.
There is also a form in the view where the user can enter a new
comment.

I want to save the new comment in the news controller comment action,
because I don't want to use a comments controller.

Everything works well except the fact that the validation error
messages are not shown, but the validation works as expected. So when
I fill both fields the data is saved. If one or both fields are left
blank, the data is not saved and the form is shown agaib. But there
are no error messages.

I asked google and tried several things over the whole day, but
nothing helped. So any help is highly appreciated. :-)


That is the code I use to generate the form:

create(
null,
array(
'url' => array(
'controller' => 'news',
'action' => 'comment'
)
)
);
echo $form->input(
'Comment.foreign_id',
array(
'type' => 'hidden',
'value' => $the_news['News']['id']
)
);
echo $form->input(
'Comment.nickname',
array(
'label' => 'Nickname:',
'error' => 'This field cannot be left blank.'
)
);
echo $form->input(
'Comment.text',
array(
'label' => 'Text:',
'error' => 'This field cannot be left blank.'
)
);
echo $form->end('Abschicken');
?>


This is the code of my comment action:

function comment() {
if(!empty($this->data)) {
if ($this->News->Comment->save($this->data)) {
// Message for the user
$this->flash(
'The comment was saved..',
array(
'controller' => 'news',
'action' => 'view',
$this->data['Comment']['foreign_id']
),
2
);
} else {
// Get the news to show the title when a validation error
occurs
$the_news = $this->News->find(
'first',
array(
'conditions' => array(
'News.id' => $this->data['Comment']
['foreign_id']
),
'recursive' => 1
)
);

$this->set('the_news', $the_news);
}
}
}


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



RE: Label information for Multiple Checkboxes

2009-01-15 Thread David Coleman
Easy as cake my friend.

 

Just use this code, and build the list for your checkboxes...

 

$selected_users=array();

 

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

  $this->data = $this->Site->read(null, $id);

/*

  here you would replace the data=read with something like

  $ali_list =
$this->Aliquot->find('all',array('conditions'=>.)). and get whatever you
need to make a list of.

 

  As long as your models are set up correctly you should
have all the related data that you need to build your names

*/

  //below modify the references to $this->data. and
replace them with the array structure of $ali_list

  foreach($this->data['User'] as $user){

if(is_array($user)){

//extract($user,EXTR_PREFIX_ALL,'user');

  extract($ali_list,EXTR_PREFIX_ALL,'ali');

  if($user_id !=
$this->data['Site']['admin_id']){

$selected_users[$ali_id]=$ali_username;

  }

}

  }

}

 

Then use this code to display it.

 

input(

  'Category',

  array(

'type'=>'select',

'multiple'=>'checkbox',

'options'=>$categories,

'label'=>false

)

  );

?>

 

Don't worry about the 'label' = false.

 

What you are doing is making a multi select box with no label and displaying
the individual options as checkboxes.  Internally, cake will convert this to
checkboxes and labels.

-Original Message-
From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf
Of Tony Thomas
Sent: Thursday, January 15, 2009 5:09 PM
To: CakePHP
Subject: Re: Label information for Multiple Checkboxes

 

 

On Jan 15, 1:03 pm, "David Coleman" 

wrote:

> Do you need checkboxes from multiple tables?  

 

No. The checkboxes in this case only pertain to my aliquots table so

that users can assign them to a box, which is in turn assigned to a

freezer. But in order to identify where the aliquots go, there are a

few fields from my specimens table (blood comes in as a specimen and

is then divided into aliquots) that I'd like to display in the label.

 

If so you need to use the

> trick I posted earlier today to make the hidden elements not be
duplicated.

> Overload your form.php in your app/views/helpers folder.

> 

> What you are doing is similar to a recent application that I wrote, in
which

> I developed this extention to the form->input method to accomplish just
this

> effect.

> 

> See the message "re: Ticket #5577 (new Enhancement)"  If this is what you

> need.

> 

> -Original Message-

> From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On
Behalf

> 

> Of Tony Thomas

> Sent: Thursday, January 15, 2009 4:52 PM

> To: CakePHP

> Subject: Re: Label information for Multiple Checkboxes

> 

> The complicating factor here is that Aliquot belongs to Specimen in my

> model and I want to display some information from both tables:

> Specimen.type, Specimen.draw_date, Aliquot.additive & etc. It looks

> more and more like I'm going to have to put that information in an

> array and loop through it, building each checkbox one at a time

> instead of my example below. Or am I missing something?

> 

> On Jan 15, 11:01 am, grigri  wrote:

> > You need to set the $displayField property inside your `Aliquot` model

> > to whatever field you want for the label.

> 

> > On Jan 15, 4:47 pm, Tony Thomas  wrote:

> 

> > > I'm building a list of checkboxes like so:

> 

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

> > >


> 'type' => 'select',

> > >


> 'multiple' => 'checkbox',

> > >


> 'options' => $aliquots));

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

> 

> > > $aliquots above is built from $this->Aliquot->find('list', $options);

> > > which finds all the ids of the pertinent records. The problem I have

> > > this this only generates a list of ids. Is there good way to load an

> > > array for 'label' so that I can display more than just the list of
ids?


 


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



Re: Label information for Multiple Checkboxes

2009-01-15 Thread Tony Thomas

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

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

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



Re: Rendering an add form within another controller's view (with all automagicness)

2009-01-15 Thread jwerd

Sorry, it was about 3am when I wrote that and I was prettty vague on
the precise problem.

The automagicness (as far as cake finding out what field goes where)
is working fine, the problem I'm having is with the drop downs,
basically the select box outputs in a weird form:

it shows every field from the shows table in the form instead of like

Value 1
Value 2
Value 3
Value 4
Value 5

Like it would if I directly acesss /show_attendees/add/

It looks like
1
2
3
4
Value 1
Some spacing
5
6
7
8

That's the only thing that's the issue now.  Do you have any idea how
I can fix that?

On Jan 15, 10:07 am, Martin Westin  wrote:
> A quick suggestion to follow along with Lecter's reply:
>
> Since it is an add form it does not show any pre-populated data,
> right? I am not sure what you mean by automagicness, though? Do you
> mean Cakes ability to figure out that one thing is a textfield and
> another is a dropdown?
>
> Try to put your add form (the one you get from the requestAction call)
> into an element and have both views call that element. That should
> yield the same form in both views without an extra request. To get
> some possibly lost automagicness you may have to include the attendee-
> model in the controller (so the form-helper can read the schema), but
> that is a guess. I haven't looked too closely into the form helper
> code.
>
> Please, don't take this the wrong way:
> Your question sounds like you are thinking that view, controller and
> model are more tightly linked than you need to. The controller does
> not "own" the model of the same name. You can often come far using
> this one to one relationship but you will also come across places
> where one Controller makes use of (and even saves data to) "another"
> Model. An ExampleController and the example-views can be seen as
> pretty tightly integrated. But the ExampleModel does not have to be
> accessed from only the ExampleController.
>
> I used to think I was "cheating" when I defined $uses = array
> ('AnotherModel') in a controller, but that is actually good design...
> at least compared to using requestAction... but I am not expert on MVC
> design, so I may be shooting myself in the foot here. ;)
>
> good luck.
> /Martin
>
> On Jan 15, 10:41 am, "dr. Hannibal Lecter" 
> wrote:
>
> > It is very difficult to see what the problem is without the code.
> > Also, it would be the best if you can avoid the requestAction :-)
>
> > On Jan 15, 10:19 am, jwerd  wrote:
>
> > > Hello fellow bakers, I've searched this group before I was going to
> > > post this question but I cant' seem to find my current dilema
> > > addressed yet.
>
> > > I have two controllers, which serve different purposes, but for the
> > > sake of this example, they share some things in common :
>
> > > shows_controller is used to pretty much the shows in the system
>
> > > show_attendees_controller is used to capture the attendees of any
> > > given show
>
> > > On the view /shows/view/# page I need to include the "add form" of
> > > show_attendees/add/ but what's happening is, it's not doing all the
> > > automagicness, and it's creating weird drop down menus that don't
> > > really capture the same format they do if I was directly accessing
> > > them from /show_attendees/add/.
>
> > > Also, I'm using requestAction, just so everyone knows.
>
> > > Any help is much appreciated.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



RE: Label information for Multiple Checkboxes

2009-01-15 Thread David Coleman

Do you need checkboxes from multiple tables?  If so you need to use the
trick I posted earlier today to make the hidden elements not be duplicated.
Overload your form.php in your app/views/helpers folder.

What you are doing is similar to a recent application that I wrote, in which
I developed this extention to the form->input method to accomplish just this
effect.

See the message "re: Ticket #5577 (new Enhancement)"  If this is what you
need.

-Original Message-
From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf
Of Tony Thomas
Sent: Thursday, January 15, 2009 4:52 PM
To: CakePHP
Subject: Re: Label information for Multiple Checkboxes


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

On Jan 15, 11:01 am, grigri  wrote:
> You need to set the $displayField property inside your `Aliquot` model
> to whatever field you want for the label.
>
> On Jan 15, 4:47 pm, Tony Thomas  wrote:
>
> > I'm building a list of checkboxes like so:
>
> > echo $form->input('Aliquot.id', array( 'label' => FALSE,
> >                                                                        
        'type' => 'select',
> >                                                                        
        'multiple' => 'checkbox',
> >                                                                        
        'options' => $aliquots));
> > echo $form->input('box_id', array('options' => $boxes));
>
> > $aliquots above is built from $this->Aliquot->find('list', $options);
> > which finds all the ids of the pertinent records. The problem I have
> > this this only generates a list of ids. Is there good way to load an
> > array for 'label' so that I can display more than just the list of ids?




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



Re: Beginner: Cake PHP and XAMPP (windows)

2009-01-15 Thread Henrique Machado
Or try Wamp that is ready to go

2009/1/15 Bernardo Vieira 

>
> Xampp comes with mod_rewrite disabled by default. Edit
> c:\xampp\apache\conf\httpd.conf, uncomment the LoadModule mod_rewrite
> line, restart apache and you should be good do go.
>
> Celso wrote:
> > Hello! I am new in cakephp, I am with a proposal to replace the asp by
> > php here in my work. Tentei
> http://www.sitepoint.com/article/application-development-cakephp/2/,
> > but does not work in XAMPP ...
> >
> >
> > Celso
> >
> > >
> >
> >
>
>
> >
>

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



Re: Label information for Multiple Checkboxes

2009-01-15 Thread Tony Thomas

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

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



RE: Label information for Multiple Checkboxes

2009-01-15 Thread David Coleman
Odd, I'm using that very syntax and it works just fine...

 

$selected_users=array();

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

  $this->data = $this->Site->read(null, $id);

/*

  here you would do something like

  $ali_list =
$this->Aliquot->find('all',array('conditions'=>.)). and get whatever you
need to make a list of.

*/

  //below modify the references to $this->data. and
replace them with the array structure of $ali_list

  foreach($this->data['User'] as $user){

if(is_array($user)){

//extract($user,EXTR_PREFIX_ALL,'user');

  extract($ali_list,EXTR_PREFIX_ALL,'ali');

  if($user_id !=
$this->data['Site']['admin_id']){

$selected_users[$ali_id]=$ali_username;

  }

}

  }

}

 

I use this method for building a custom list in another section of my site.

 

Maybe you can modify this logic to assist with this issue.

 

Load ('all') to get the data you need and then pass through the list and
then use $this->set(.) to send it to the view.  

 

it's a little dirty :-(  

 

But it should produce the desired results :-)

 

Best luck friend.

 

-Original Message-
From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf
Of Tony Thomas
Sent: Thursday, January 15, 2009 4:43 PM
To: CakePHP
Subject: Re: Label information for Multiple Checkboxes

 

 

I tried that very thing, but it didn't produce the expected results.

Maybe find('list', $options) isn't meant to accommodate more than a

single field. I'm not sure.

 

On Jan 15, 11:34 am, "David Coleman" 

wrote:

> You could also do something like this in your controller:

> 

> $aliquots = $this->Aliquot->find(

> 

>   'list',

> 

>   array(

> 

> 'fields'=>array(

> 

>   'Aliquot.id',

> 

>   'Aliquot.name'

> 

>   ),

> 

> 'conditions'=>array(

> 

>   // some conditions if necessary.

> 

>   )

> 

> )

> 

>   );

> 

> And then pass this to your view with

> 

> $this->set('aliquotes', $aliquots);

 


 


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



Re: best cakephp calendar?

2009-01-15 Thread Nate

I actually wrote one a bit ago that I was gonna release this week.
I'll post the URL back here when I do.

On Jan 15, 12:23 pm, ezekfred  wrote:
> Hi,
>
> I have to display a schedule and I'd like to know which calendar
> plugin/helper do you use in your projects?
>
> till now I 
> know:http://www.stellarcore.com/2009/01/07/cakephp-calendar-helper/#more-90http://github.com/davidgolding/anno-domini/tree/masterhttp://www.formation-cakephp.com/14/generation-automatique-calendrier...
>
> the last one is in french but rather understandable.
>
> 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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Complex AJAX and Cookies issue Question with CakePHP

2009-01-15 Thread David Coleman
I’m designing a survey module using CakePHP.

 

The purpose of this module is to be called from a foreign site by this code:

 

http://global_survey.localhost/visitor_sessions/init/1234";>



 

Obviously, localhost will be replaced with the production server when live.

 

I am creating the cookie with Cake’s CookieComponent.

 

When the remote site calls the init method, the cookie is not visible on the
client system

 

When I call the init component directly in the browser to test the cookie
functionality, I discover that I am not saving my cookie, even though I set
$this->Cookie->time=100;  

 

The cookie is visible in my browser when I am calling the init method
directly.

 

The code is as follows:

 

class VisitorSessionsController extends AppController {

 

  var $name = 'VisitorSessions';

  var $helpers = array('Html', 'Form','Ajax','Javascript');

  var $components = array( 'RequestHandler', 'Auth','Cookie');

  function beforeFilter(){

parent::beforeFilter();

$this->Auth->allow(

  array(

'init',

'refresh',

'respond',

'end'

)

  );

$this->Cookie->name='visitor_session';

$this->Cookie->domain='global_survey_client.localhost';

$this->Cookie->time=100;

 

  }

  function init($site_id = null){

$this->layout='ajax';

Configure::write('debug',0);

//check for existing sessions with this ip address

$ip_addr= env('REMOTE_ADDR');

$this->set('ip_addr',$ip_addr);

$num_times=$this->Cookie->read('num_times');

$this->Cookie->write('test','test');

$this->Cookie->write('num_times',($num_times?$num_times:0)+1);

$num_times=$this->Cookie->read('num_times');

$test=$this->Cookie->read('test');

$this->set('test',$test);

$this->set('num_times',$num_times);

//if no current cookie

  //create cookie

  //create session

//set ip address

//set hit times

//else

  //load current cookie

  //update current session

//update last hit.

//create javascript with links to active session

  }

  function refresh($session_id=null){

//update session.last_hit

  }

  function respond($session_id=null){

 

  }

}

 

 

In my init.ctp, I only have this simple code for now:

 

alert('test  ()');

 

The stored value is not incrementing…  Ultimately, I want to store my cookie
for the life of the browser, and create a new session when the user closes
the current browser instance, and then goes back to the client website at
some later date.

 

Can anybody tell me what I am doing wrong?

 

I’m trying to look on google and the cookbook for how to do this properly,
and I am having trouble finding anything.

 

Thank you all very much.

 

 
  
  
   David Kenneth Coleman

Software Developer

 
………

United States: +
1 6468108783 Dept:  Development

Argentina:
+ 54 11 52465987  E-mail:
david.cole...@connaxis.com

The Netherlands:+ 31
208080017 Skype:   david.k.coleman

 

 

 

¡   
  
   NEW! Please check out
our new   Portfolio Website:

  Connaxis Creative Outsourcing
Specialist  
www.creative-outsourcing.com

First page position Google.com:
 Creative Outsourcing

 


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

<>

Re: mod_rewrite problems

2009-01-15 Thread neridaj

I tried adding that line in the 1.2.x.x .htaccess file as well as the /
app .htaccess file with no luck.

On Jan 15, 8:53 am, Smelly_Eddie  wrote:
> Try adding
>  RewriteBase /
>
> just after
> RewriteEngine On
>
> in your htaccess files.
>
> When I was on godaddy i found this to be a requirement to get things
> working.
>
> On Jan 14, 4:14 pm,neridaj wrote:
>
> > Hello,
>
> > I've edited my httpd.conf file as instructed and can't get mod_rewrite
> > working. Any suggestions?
>
> > /etc/httpd/httpd.conf:
>
> > LoadModule rewrite_module     libexec/httpd/mod_rewrite.so
>
> > DocumentRoot "/Library/WebServer/Documents"
>
> > 
>
> > #
> > # This may also be "None", "All", or any combination of "Indexes",
> > # "Includes", "FollowSymLinks", "ExecCGI", or "MultiViews".
> > #
> > # Note that "MultiViews" must be named *explicitly* --- "Options All"
> > # doesn't give it to you.
> > #
> >     Options Indexes FollowSymLinks MultiViews
>
> > #
> > # This controls which options the .htaccess files in directories can
> > # override. Can also be "All", or any combination of "Options",
> > "FileInfo",
> > # "AuthConfig", and "Limit"
> > #
> >     AllowOverride All
>
> > #
> > # Controls who can get stuff from this server.
> > #
> >     Order allow,deny
> >     Allow from all
> > 
>
> > Thanks,
>
> > Jason
--~--~-~--~~~---~--~~
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: multiple httpd.conf files

2009-01-15 Thread neridaj

I installed from the svn trunk and I have the .htaccess file in my
1.2.x.x folder under the DocumentRoot - "/Library/WebServer/
Documents", are you saying that I need to copy this file to my apache
directory? I tried copying that file to "/opt/local/apache2/htdocs but
it made no difference.


On Jan 14, 4:24 pm, Bob Albert  wrote:
> It looks like your httpd.conf file is correct. You just want the  
> AllowOverride set to All. I had a very similar problem with my Mac.  
> I'm using MAMP install, but i think your problem could be  
> the .htaccess file. In the 1.2 generic folder that you use as the  
> basis of your app has a .htaccess file that needs to be present in  
> your htdocs or webroot of the app folder in your Apache folder.  
> Sometimes this does not get copied correctly if you copied the  
> expanded folder.
>
> Either ls -la the folder in the terminal or show your hidden files and  
> make sure that .htaccess file was copied correctly to the root of your  
> cake app folder.
>
> On Jan 14, 2009, at 3:44 PM, Webweave wrote:
>
>
>
> > Looks like you are running on Mac.
>
> > If you're using the built in web server, then it is located at /
> > private/etc/apache2/httpd.conf
>
> > The 'which' command doesn't find files, it just tells you where the
> > executable is in your path.
>
> > On Jan 13, 3:54 pm,neridaj wrote:
> >> Hello,
>
> >> I just installed cake version 1.2.0.7962 and was going through the
> >> blog tutorial when I got the generic index page because there is a
> >> problem with my httpd.conf. I ran locate and found quite a few
> >> different httpd.conf files:
>
> >> $ locate httpd.conf
> >> /Applications/TextMate.app/Contents/SharedSupport/Bundles/
> >> Apache.tmbundle/Commands/Open httpd.conf.plist
> >> /opt/local/apache2/conf/httpd.conf
> >> /opt/local/apache2/conf/original/httpd.conf
> >> /opt/local/var/macports/software/apache2/2.2.11_0/opt/local/apache2/
> >> conf/original/httpd.conf
> >> /opt/local/var/macports/sources/rsync.macports.org/release/ports/www/
> >> apache2/files/patch-httpd.conf.in-sensitive-files.diff
> >> /opt/local/var/macports/sources/rsync.macports.org/release/ports/www/
> >> htdig/files/httpd.conf
> >> /opt/local/var/macports/sources/rsync.macports.org/release/ports/www/
> >> lighttpd/files/patch-doc-lighttpd.conf
> >> /opt/local/var/macports/sources/rsync.macports.org/release/ports/www/
> >> lighttpd-devel/files/patch-doc-lighttpd.conf
> >> /private/etc/httpd/httpd.conf
> >> /private/etc/httpd/httpd.conf.bak
> >> /private/etc/httpd/httpd.conf.default
> >> /private/etc/httpd/httpd.conf.entropy.backup
> >> /usr/local/apache2/conf/httpd.conf
> >> /usr/local/apache2/conf/original/httpd.conf
>
> >> I'm assuming I need to edit the "/opt/local/apache2/conf/httpd.conf"
> >> file as instructed 
> >> underhttp://book.cakephp.org/view/333/A-Note-on-mod_rewrite
> >> but it doesn't fix the problem. Here is what I have in the
> >> aforementioned httpd.conf file:
>
> >> DocumentRoot "/opt/local/apache2/htdocs"
>
> >> 
> >>     #
> >>     # Possible values for the Options directive are "None", "All",
> >>     # or any combination of:
> >>     #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI
> >> MultiViews
> >>     #
> >>     # Note that "MultiViews" must be named *explicitly* --- "Options
> >> All"
> >>     # doesn't give it to you.
> >>     #
> >>     # The Options directive is both complicated and important.  
> >> Please
> >> see
> >>     #http://httpd.apache.org/docs/2.2/mod/core.html#options
> >>     # for more information.
> >>     #
> >>     Options Indexes FollowSymLinks
>
> >>     #
> >>     # AllowOverride controls what directives may be placed
> >> in .htaccess files.
> >>     # It can be "All", "None", or any combination of the keywords:
> >>     #   Options FileInfo AuthConfig Limit
> >>     #
> >>     AllowOverride All
>
> >>     #
> >>     # Controls who can get stuff from this server.
> >>     #
> >>     Order allow,deny
> >>     Allow from all
>
> >> 
>
> >> I thought maybe I needed to add this httpd.conf to my .bash_profile
> >> which I did with:
>
> >> PATH="/opt/local/bin:/opt/local/sbin:$PATH"
> >> export DISPLAY=:0.0
>
> >> export PATH=${PATH}:"/usr/local/mysql-5.0.51a-osx10.4-powerpc/bin/"
>
> >> export EDITOR='mate -w'
>
> >> # Setting PATH for MacPython 2.5
> >> # The orginal version is saved in .bash_profile.pysave
> >> PATH="/Library/Frameworks/Python.framework/Versions/Current/bin:$
> >> {PATH}"
> >> export PATH
>
> >> #export PATH=${PATH}:/usr/local/mysql-5.0.51a-osx10.4-powerpc/bin/
> >> PATH="/opt/local/apache2/conf:${PATH}"
> >> export PATH
>
> >> ...but when I run "which httpd.conf" I get this:
>
> >> $ which httpd.conf
> >> no httpd.conf in /opt/local/apache2/conf /Library/Frameworks/
> >> Python.framework/Versions/Current/bin /opt/local/bin /opt/local/
> >> sbin /
> >> opt/local/apache2/conf /Library/Frameworks/Python.framework/Versions/
> >> Current/bin /opt/local/bin /opt/local/sbin /bin /sbin /usr/bin /usr/
> >> sbin /us

Re: Beginner: Cake PHP and XAMPP (windows)

2009-01-15 Thread Bernardo Vieira

Xampp comes with mod_rewrite disabled by default. Edit 
c:\xampp\apache\conf\httpd.conf, uncomment the LoadModule mod_rewrite 
line, restart apache and you should be good do go.

Celso wrote:
> Hello! I am new in cakephp, I am with a proposal to replace the asp by
> php here in my work. Tentei 
> http://www.sitepoint.com/article/application-development-cakephp/2/,
> but does not work in XAMPP ...
>
>
> Celso
>
> >
>
>   


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



RE: Label information for Multiple Checkboxes

2009-01-15 Thread David Coleman
You could also do something like this in your controller:

 

$aliquots = $this->Aliquot->find(

  'list',

  array(

'fields'=>array(

  'Aliquot.id',

  'Aliquot.name'

  ),

'conditions'=>array(

  // some conditions if necessary.

  )

)

  );

 

And then pass this to your view with

 

$this->set(‘aliquotes’, $aliquots);

 

 

 
  
  
   David Kenneth Coleman

Software Developer

 
………

United States: +
1 6468108783 Dept:  Development

Argentina:
+ 54 11 52465987  E-mail:
david.cole...@connaxis.com

The Netherlands:+ 31
208080017 Skype:   david.k.coleman

 

 

 

¡   
  
   NEW! Please check out
our new   Portfolio Website:

  Connaxis Creative Outsourcing
Specialist  
www.creative-outsourcing.com

First page position Google.com:
 Creative Outsourcing

 

 

-Original Message-
From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf
Of Tony Thomas
Sent: Thursday, January 15, 2009 2:48 PM
To: CakePHP
Subject: Label information for Multiple Checkboxes

 

 

I'm building a list of checkboxes like so:

 

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

'type' =>
'select',

'multiple' =>
'checkbox',

'options' =>
$aliquots));

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

 

$aliquots above is built from $this->Aliquot->find('list', $options);

which finds all the ids of the pertinent records. The problem I have

this this only generates a list of ids. Is there good way to load an

array for 'label' so that I can display more than just the list of ids?


 


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

<>

best cakephp calendar?

2009-01-15 Thread ezekfred

Hi,

I have to display a schedule and I'd like to know which calendar
plugin/helper do you use in your projects?

till now I know:
http://www.stellarcore.com/2009/01/07/cakephp-calendar-helper/#more-90
http://github.com/davidgolding/anno-domini/tree/master
http://www.formation-cakephp.com/14/generation-automatique-calendrier-simplecalendarcomponent

the last one is in french but rather understandable.

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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Beginner: Cake PHP and XAMPP (windows)

2009-01-15 Thread Celso

Hello! I am new in cakephp, I am with a proposal to replace the asp by
php here in my work. Tentei 
http://www.sitepoint.com/article/application-development-cakephp/2/,
but does not work in XAMPP ...


Celso

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



Re: Label information for Multiple Checkboxes

2009-01-15 Thread grigri

You need to set the $displayField property inside your `Aliquot` model
to whatever field you want for the label.

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



Re: mod_rewrite problems

2009-01-15 Thread Smelly_Eddie

Try adding
 RewriteBase /

just after
RewriteEngine On

in your htaccess files.

When I was on godaddy i found this to be a requirement to get things
working.

On Jan 14, 4:14 pm, neridaj  wrote:
> Hello,
>
> I've edited my httpd.conf file as instructed and can't get mod_rewrite
> working. Any suggestions?
>
> /etc/httpd/httpd.conf:
>
> LoadModule rewrite_module     libexec/httpd/mod_rewrite.so
>
> DocumentRoot "/Library/WebServer/Documents"
>
> 
>
> #
> # This may also be "None", "All", or any combination of "Indexes",
> # "Includes", "FollowSymLinks", "ExecCGI", or "MultiViews".
> #
> # Note that "MultiViews" must be named *explicitly* --- "Options All"
> # doesn't give it to you.
> #
>     Options Indexes FollowSymLinks MultiViews
>
> #
> # This controls which options the .htaccess files in directories can
> # override. Can also be "All", or any combination of "Options",
> "FileInfo",
> # "AuthConfig", and "Limit"
> #
>     AllowOverride All
>
> #
> # Controls who can get stuff from this server.
> #
>     Order allow,deny
>     Allow from all
> 
>
> Thanks,
>
> Jason
--~--~-~--~~~---~--~~
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: Bake scripts without shell access

2009-01-15 Thread Smelly_Eddie

Check out dreamhost. Shared hosting keep costs down and you get full
shell access.

But yes, I would recommend baking locally and uploading.

You can even limit the edits you need to make by customizing your
database config file a bit.

http://edwardawebb.com/programming/php-programming/cakephp/automatically-choose-database-connections-cakephp

Also if you have the domain url pointing to webroot you shouldn't need
to edit .htaccess unless your webhost is doing something obscure.

On Jan 15, 9:39 am, mark_story  wrote:
> Most non-shared hosting companies do provide a shell.  You can
> sometimes get a Java client with applications like cPanel or Plesk as
> well.  If you are just running bake and such most people will run that
> locally.  If you write shells that you need to run remotely like
> maintenance scripts etc.  Then you might want to consider moving to
> different host.
>
> -Mark
>
> On Jan 14, 2:06 pm, Bob Albert  wrote:
>
> > I'm new to this group and CakePHP so please excuse these questions if  
> > they've been covered on the list. I have been working through David  
> > Golding's "Beginning CakePHP" book from Apress. I just got through the  
> > chapter were he describes the Bake scripts.
>
> > My question is how others use this in the real world given that most  
> > hosting companies don't allow shell access. Do most use these scripts  
> > in a dev environment such as a local box to build out the application  
> > and then just move the files to the prod environment when done, thus  
> > shell is not needed cuz all the bake scripts are done in Dev?
>
> > Also it looks like there might be some tools for Bake that one can  
> > install on these hosting companies that allow you to use Bake scripts  
> > via the browser like webbaker?
>
> > Thanks,
> > Bob
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Label information for Multiple Checkboxes

2009-01-15 Thread Tony Thomas

I'm building a list of checkboxes like so:

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

'type' => 'select',

'multiple' => 'checkbox',

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

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



Re: Where to validate multiple fields?

2009-01-15 Thread Smelly_Eddie

You can create a custom function and use it in the $validate
parameter.

Have a look at this article to get an idea of how that would work in
your case. (The compare passwords option)

http://edwardawebb.com/programming/php-programming/cakephp/complex-validation-cakephp-12

On Jan 14, 11:44 am, fly2279  wrote:
> I am creating an app that's similar to a punch clock in the way that
> it functions. The user enters a start and stop datetime and I need to
> do some validations. I need to check that there is not a previously
> entered "time block" in the database that conflicts with the data
> being entered. No two time blocks may overlap and I have additional
> rules also regarding how much time there needs to be in between two
> blocks.
>
> I considered running a custom validation function on the 'start' field
> but I need to make sure that there is no time block overlapping the
> time period from 'start' to 'end'. I'm not sure how to go about this.
>
> Since it needs to check two fields (start and end) against the
> database should I run a function in beforeValidate() instead of in
> validate? Then should I validate the normal stuff such as date/time/
> alphanumeric etc. in the validate portion of the model? What's the
> "best practice" way of doing it?
>
> Here is a picture of what I'm trying to do.http://kenfrey.net/block.png
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Foreign Key Syntax in CakePHP Migrations

2009-01-15 Thread Phoenix Rising

Hi everyone,

I'm trying to create a migration in CakePHP 1.2 that will add a table
for a HABTM relationship and set the foreign keys for it.  Here's my
code (generated via 'cake schema generate', selecting 'snapshot'):

// --snip --
var $phones_phone_features = array(
'id' => array('type' => 'integer', 'null' => false, 'default' =>
NULL, 'key' => 'primary'),
'phones_id' => array('type' => 'integer', 'null' => false, 
'default'
=> 1, 'foreignKey' => 'phones.id'),
'phone_features_id' => array('type' => 'integer', 'null' => 
false,
'default' => 1, 'foreignKey' => 'phone_features.id'),
'indexes' => array('PRIMARY' => array('column' => 'id', 
'unique' =>
1))
);
}
// --snip--

As you can see, I have 'foreignKey' specified, but the resulting SQL
(I'm using MySQL to develop, deploying on Oracle) doesn't contain a
foreign key definition:

Dry run for phones_phone_features :
CREATE TABLE `phones_phone_features` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`phones_id` int(11) DEFAULT 1 NOT NULL,
`phone_features_id` int(11) DEFAULT 1 NOT NULL, PRIMARY KEY  (`id`));

So how exactly am I supposed to tell cake's migration shell to assign
foreign keys correctly?

Thanks for any help you can supply.

--~--~-~--~~~---~--~~
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: PHP Page inside of Cake but not Cake

2009-01-15 Thread Pyrite

Thanks a bunch!

Sometimes you just don't know how to do things the CakePHP way and
need to get it working first, you can then show somebody in the
community and ask for help converting to the CakePHP method of good
coding practice.

On Jan 15, 10:13 am, grigri  wrote:
> Sure, put the .php file inside the app/webroot folder.
>
> eg: app/webroot/bacon.php
>
> Then callhttp://server/bacon.php
>
> hth
> grigri
>
> On Jan 15, 4:07 pm, Pyrite  wrote:
>
>
>
> > Is there a way to make a plain jane custom php page and access it
> > inside of the cake directory but not have CakePHP interefere with it.
> > I am wanting to test a page and CakePHP and is screwing up the java
> > script and I want to test the page as if CakePHP wasn't there.
>
> > However, I am at work and do not have a separate webspace to test php
> > pages except the CakePHP app directory.- Hide quoted text -
>
> - Show quoted text -
--~--~-~--~~~---~--~~
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: PHP Page inside of Cake but not Cake

2009-01-15 Thread grigri

Sure, put the .php file inside the app/webroot folder.

eg: app/webroot/bacon.php

Then call http://server/bacon.php

hth
grigri

On Jan 15, 4:07 pm, Pyrite  wrote:
> Is there a way to make a plain jane custom php page and access it
> inside of the cake directory but not have CakePHP interefere with it.
> I am wanting to test a page and CakePHP and is screwing up the java
> script and I want to test the page as if CakePHP wasn't there.
>
> However, I am at work and do not have a separate webspace to test php
> pages except the CakePHP app directory.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



PHP Page inside of Cake but not Cake

2009-01-15 Thread Pyrite

Is there a way to make a plain jane custom php page and access it
inside of the cake directory but not have CakePHP interefere with it.
I am wanting to test a page and CakePHP and is screwing up the java
script and I want to test the page as if CakePHP wasn't there.

However, I am at work and do not have a separate webspace to test php
pages except the CakePHP app directory.
--~--~-~--~~~---~--~~
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: Rendering an add form within another controller's view (with all automagicness)

2009-01-15 Thread Martin Westin


A quick suggestion to follow along with Lecter's reply:

Since it is an add form it does not show any pre-populated data,
right? I am not sure what you mean by automagicness, though? Do you
mean Cakes ability to figure out that one thing is a textfield and
another is a dropdown?

Try to put your add form (the one you get from the requestAction call)
into an element and have both views call that element. That should
yield the same form in both views without an extra request. To get
some possibly lost automagicness you may have to include the attendee-
model in the controller (so the form-helper can read the schema), but
that is a guess. I haven't looked too closely into the form helper
code.


Please, don't take this the wrong way:
Your question sounds like you are thinking that view, controller and
model are more tightly linked than you need to. The controller does
not "own" the model of the same name. You can often come far using
this one to one relationship but you will also come across places
where one Controller makes use of (and even saves data to) "another"
Model. An ExampleController and the example-views can be seen as
pretty tightly integrated. But the ExampleModel does not have to be
accessed from only the ExampleController.

I used to think I was "cheating" when I defined $uses = array
('AnotherModel') in a controller, but that is actually good design...
at least compared to using requestAction... but I am not expert on MVC
design, so I may be shooting myself in the foot here. ;)

good luck.
/Martin


On Jan 15, 10:41 am, "dr. Hannibal Lecter" 
wrote:
> It is very difficult to see what the problem is without the code.
> Also, it would be the best if you can avoid the requestAction :-)
>
> On Jan 15, 10:19 am, jwerd  wrote:
>
> > Hello fellow bakers, I've searched this group before I was going to
> > post this question but I cant' seem to find my current dilema
> > addressed yet.
>
> > I have two controllers, which serve different purposes, but for the
> > sake of this example, they share some things in common :
>
> > shows_controller is used to pretty much the shows in the system
>
> > show_attendees_controller is used to capture the attendees of any
> > given show
>
> > On the view /shows/view/# page I need to include the "add form" of
> > show_attendees/add/ but what's happening is, it's not doing all the
> > automagicness, and it's creating weird drop down menus that don't
> > really capture the same format they do if I was directly accessing
> > them from /show_attendees/add/.
>
> > Also, I'm using requestAction, just so everyone knows.
>
> > Any help is much appreciated.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: FlyUpload RFP Web Development Project, about $10k

2009-01-15 Thread Henrique Machado
http://cakephp.org/jobs

2009/1/14 khalid.j.sha...@gmail.com 

>
> We are looking for a good team of developers to build out
> www.flyupload.com.
>
> We are looking at products and services from
> www.depositfiles.com
> www.esnips.com
> www.imagebam.com
>
> I know the last web site would take days to build, and we want that as
> well.  We'd like a team that can do all of this, in CAKE / PHP and
> integrate it with FlyUpload.
>
> Please contact ASAP
> Khalid
> 408 712 3580
>
> >
>

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



FlyUpload RFP Web Development Project, about $10k

2009-01-15 Thread khalid.j.sha...@gmail.com

We are looking for a good team of developers to build out www.flyupload.com.

We are looking at products and services from
www.depositfiles.com
www.esnips.com
www.imagebam.com

I know the last web site would take days to build, and we want that as
well.  We'd like a team that can do all of this, in CAKE / PHP and
integrate it with FlyUpload.

Please contact ASAP
Khalid
408 712 3580

--~--~-~--~~~---~--~~
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: Pulling dynamic content with cake 1.2 final

2009-01-15 Thread Bankai

Thanks for the routing part, but how can I accomplish something
similar to that and more secure with cakephp?



On 15 ene, 00:11, Miles J  wrote:
> Your previous  code is extremely unsecure and uses bad logic.
>
> If your views name is sitemap.ctp within /views/pages/, the url would
> be /pages/sitemap/.
>
> If you want it to just be /sitemap, you would have to do some routing.
>
> Router::connect('/sitemap', array('controller' => 'pages', 'action' =>
> 'display', 'sitemap'));

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



Save flow behaviour ..

2009-01-15 Thread Marcelo Iwata
At cakePHP documentation, it's clear that beforeSave have to return true to
continue the Save process.
But, i was doing some tests..
function beforeSave(){return false;}
function save() {
$this->set("CSS", "main");if (!empty($this->data)) {if
($this->User->save($this->data)) {$this->flash('Your user has been saved.',
'/users');}}
}


my view:
element('esquerdoPadrao'); ?>

Add Post
create('User');
echo $form->input('name');
echo $form->input('username');
echo $form->input('password');
echo $form->input('email');
echo $form->end('Salvar Usuario');?>


and ,saved.

I was at tmp/cache/..
and cleaned. But , it continues..


Why?

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

requestAction() is a bit seductive. It can look like a simple solution
to a lot of things but the problem (that you notice later on) is that
is has a high "cost" in the processing overhead and in that you don't
improve your design instead of using the "quick fix".

When requestAction() is called you are effectively making a new
request more or less as you would by refreshing the browser. You are
starting up the router and dispatcher again. You are instantiating a
new controller, loading new Models, querying the database. And, worst
of all as I understand it, you are often doing a full render of an
extra View. All this results in a very costly feature.

There are times when requestAction is a good tool (the only tool?) but
they are quite few. But without knowing your application I can't say
if you have a justified situation or not. I always feel dutifully
ashamed each time i use this feature which forces me to think if I
can't get around my problem some other way :)

In my current project I actually have a few but in those cases doing
without it is too complicated for my taste and in only one instance is
the processing overhead an issue.

/Martin


On Jan 15, 3:05 pm, "Mario Cesar"  wrote:
> 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: Bake scripts without shell access

2009-01-15 Thread mark_story

Most non-shared hosting companies do provide a shell.  You can
sometimes get a Java client with applications like cPanel or Plesk as
well.  If you are just running bake and such most people will run that
locally.  If you write shells that you need to run remotely like
maintenance scripts etc.  Then you might want to consider moving to
different host.

-Mark

On Jan 14, 2:06 pm, Bob Albert  wrote:
> I'm new to this group and CakePHP so please excuse these questions if  
> they've been covered on the list. I have been working through David  
> Golding's "Beginning CakePHP" book from Apress. I just got through the  
> chapter were he describes the Bake scripts.
>
> My question is how others use this in the real world given that most  
> hosting companies don't allow shell access. Do most use these scripts  
> in a dev environment such as a local box to build out the application  
> and then just move the files to the prod environment when done, thus  
> shell is not needed cuz all the bake scripts are done in Dev?
>
> Also it looks like there might be some tools for Bake that one can  
> install on these hosting companies that allow you to use Bake scripts  
> via the browser like webbaker?
>
> Thanks,
> Bob
--~--~-~--~~~---~--~~
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: How to prevent updating other fields when calling model::save()

2009-01-15 Thread K3

Great. Many 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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Creating a "Does not Equal To" SQL Statement

2009-01-15 Thread Graham Weldon


Hey,

'conditions' => array(
   'OpportunityCategory.id !=' => 1)

That should do it for you.

Cheers.


On Thu, 15 Jan 2009 05:13:20 -0800 (PST), exo_duz 
wrote:
> Hi all,
> 
> Simple question. I want to create a "Does Not Equal To" SQL statement
> within the Controller. The SQL statement would just get me back all
> data when "OpportunityCategory.id" <> 1.
> 
> $findOtherOpportunities = $this->OpportunityCategory->find('all', array
> (
>  
> 'conditions' => array(
>  
> 'OpportunityCategory.id' => '1'
>  
  ),
>  
> 'order' => array(
>  
> 'OpportunityCategory.id ASC',
>  
  )
>  
  )
> );
> $this->set('other_opportunities',
> $findOtherOpportunities);
> 
> Is there a way to do it using the Model::find function? Or would I
> have to create a custom SQL within the model?
> 
> Thanks for your 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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Creating a "Does not Equal To" SQL Statement

2009-01-15 Thread exo_duz

Hi all,

Simple question. I want to create a "Does Not Equal To" SQL statement
within the Controller. The SQL statement would just get me back all
data when "OpportunityCategory.id" <> 1.

$findOtherOpportunities = $this->OpportunityCategory->find('all', array
(
 
'conditions' => array(
 
'OpportunityCategory.id' => '1'

),
 
'order' => array(
 
'OpportunityCategory.id ASC',

)

)
);
$this->set('other_opportunities',
$findOtherOpportunities);

Is there a way to do it using the Model::find function? Or would I
have to create a custom SQL within the model?

Thanks for your 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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How to prevent updating other fields when calling model::save()

2009-01-15 Thread Flipflops

Hi

I had real trouble finding this the first time too.

save(array $data = null, boolean $validate = true, array $fieldList =
array())

$fieldList is an array of the fields you actually want to save.

http://book.cakephp.org/view/75/Saving-Your-Data

John

On Jan 15, 12:39 pm, K3  wrote:
> Hi,
>
> if for example end user changed the html form and adds another field,
> he can update another field.
> What i mean by example is changing:
>
> 
>    
> 
>
> to
>
> 
>    
>    
> 
>
> then access_level field will be updated.How can i prevent this?
>
> 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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How to prevent updating other fields when calling model::save()

2009-01-15 Thread Günther Theilen

Hi,

you can add a list of allowed fields as third parameter.
http://api.cakephp.org/1.2/class_model.html#ebe42ae387be89985b5a35dd428f5c81

Regards
Günther

K3 schrieb:
> Hi,
> 
> if for example end user changed the html form and adds another field,
> he can update another field.
> What i mean by example is changing:
> 
> 
>
> 
> 
> to
> 
> 
>
>
> 
> 
> then access_level field will be updated.How can i prevent this?
> 
> 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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



How to prevent updating other fields when calling model::save()

2009-01-15 Thread K3

Hi,

if for example end user changed the html form and adds another field,
he can update another field.
What i mean by example is changing:


   


to


   
   


then access_level field will be updated.How can i prevent this?

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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Simple validation, required=true does not work or has preg_match() [function.preg-match]: Delimiter must not be alphanumeric or backslash

2009-01-15 Thread Dr. Loboto

Better user both notEmpty and required. Required will raise validation
error when field do not present in POST data at all. notEmpty without
required will not do it.

On Jan 15, 2:26 pm, "Louie Miranda"  wrote:
> Hi! Yes, this one.http://book.cakephp.org/view/740/notEmpty
>
> Works! I thought from the other examples that is how I should do it, until I
> found your suggestions and googled notEmpty.
>
> Thanks again!
> --
> Louie Miranda (lmira...@gmail.com)http://www.louiemiranda.net
>
> Security Is A Series Of Well-Defined Steps
> chmod -R 0 / ; and smile :)
>
> On Thu, Jan 15, 2009 at 3:30 PM, phpcurious wrote:
>
>
>
> > Louie,
>
> > I read it somewhere in some people's blog, that the 'required'
> > validation rule doesn't really mean the field being required. Even I
> > don't get much the idea of it. But You might consider checking up
> > "notEmpty" instead if you want the field not to be empty.
>
> > On Jan 15, 1:52 pm, "Louie Miranda"  wrote:
> > > Guys, is there a new way of doing a simple this field is required? true
> > or
> > > false?
>
> > > The code example and my code below, does not work.
>
> > > My code:
>
> > > var $validate = array(
>
> > > >    'officer'=>array('required'=>true)
> > > > );
>
> > > I am using CakePHP (Stable/Latest release). I get an error of...
>
> > > > preg_match() [function.preg-match  > >]:
> > > > Delimiter must not be alphanumeric or backslash [*
> > > > CORE/cake/libs/model/model.php*, line *2413*]
>
> > > Shall I always use alphanumeric on the rule? I just want to make it
> > > required, true or false. Is it still the same?
>
> > > Help!
> > > --
> > > Louie Miranda (lmira...@gmail.com)http://www.louiemiranda.net
>
> > > Security Is A Series Of Well-Defined Steps
> > > chmod -R 0 / ; and smile :)
--~--~-~--~~~---~--~~
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: Calendar Helper

2009-01-15 Thread Flipflops

Hi Mike

I built a calendar helper about a year ago. It is pretty basic -
literally just a shell that lays out the days of the week and a back
and forward button. Its up to you to get the data to it in the right
format. To be honest I always meant to re-factor it and write a
component to sit behind it, but never had the time. Anyway there is
code and an example here 
http://www.flipflops.org/2008/04/08/cakephp-calendar-helper/

Basically you just create  a array which you send to the helper where
the numeric key corresponds to the day of the month - and you can put
what ever you want into it.

I've used it in a bunch of CRM systems and also here 
http://www.mevagisseyholiday.com/
(not a Cake site but the function that builds the calendar is
basically the same one as the helper) - so it is pretty easy to get
working with AJAX.

As I say it is very basic, but might be a good place to start. I think
the most recent version it was tested on is 1.2 RC2

John



On Jan 14, 5:50 am, Mike  wrote:
> Hi everyone,
>
> I was wondering if there is a good up to date calendar helper that I
> can use to integrate to my intranet application ?
>
> Thanks for 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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Bakery Article Comment Notification broken

2009-01-15 Thread grigri

I noticed this too; In thunderbird the email content is blank. You
have to "view source" to actually see the content.

On Jan 15, 9:43 am, "dr. Hannibal Lecter"  wrote:
> I have reported this a while ago:
>
> https://trac.cakephp.org/ticket/5001
>
> Still having the same problem.
>
> On Jan 15, 8:32 am, majna  wrote:
>
> > I cant open mail notification in gmail.
> > content type is multipart/alternative,
> > message is attached as unknown file.
--~--~-~--~~~---~--~~
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: Bakery Article Comment Notification broken

2009-01-15 Thread dr. Hannibal Lecter

I have reported this a while ago:

https://trac.cakephp.org/ticket/5001

Still having the same problem.

On Jan 15, 8:32 am, majna  wrote:
> I cant open mail notification in gmail.
> content type is multipart/alternative,
> message is attached as unknown file.
--~--~-~--~~~---~--~~
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: Rendering an add form within another controller's view (with all automagicness)

2009-01-15 Thread dr. Hannibal Lecter

It is very difficult to see what the problem is without the code.
Also, it would be the best if you can avoid the requestAction :-)

On Jan 15, 10:19 am, jwerd  wrote:
> Hello fellow bakers, I've searched this group before I was going to
> post this question but I cant' seem to find my current dilema
> addressed yet.
>
> I have two controllers, which serve different purposes, but for the
> sake of this example, they share some things in common :
>
> shows_controller is used to pretty much the shows in the system
>
> show_attendees_controller is used to capture the attendees of any
> given show
>
> On the view /shows/view/# page I need to include the "add form" of
> show_attendees/add/ but what's happening is, it's not doing all the
> automagicness, and it's creating weird drop down menus that don't
> really capture the same format they do if I was directly accessing
> them from /show_attendees/add/.
>
> Also, I'm using requestAction, just so everyone knows.
>
> Any help is much appreciated.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Writing to a database from a view

2009-01-15 Thread xybersoftw...@gmail.com

Jon,
Thanks for your detailed help.
One thing I might not have made clear is that my view/filtering form
has only one check box and the check box is not connected to each
record.  And I have other fields in the form that let me filter the
records that I am looking for.  Once the user has filtered the records
he wants to modify, then he finally checks the 'Mark records shown'
check box and then clicks the submit button to mark only the records
that are showing with todays date in a date field for each record
shown. Although Ajax would be nice to have, it is not necessary if I
can just get the data to show properly after the change with a
refresh...So I think I need an array of shown records that gets built
as the records are filtered and then use that array to update the
records from the controller...So I guess the question now is how do I
build the data array manually from the view file...

view/process_member.thtml
for ()
{
   if ($chkMark=='1')
   {
  // Mark selected months
  if($chkMonth1=='on')
 //*** If the next line would write to the database it would
work but it doesn't write to the database
 $subscription['Subscription']['month1_mailinginfo_sent']=date
('Y-m-d');
 // So I guess I need to build an array here and then use that
in the controller to update the datbase
 //THIS IS WHERE I NEED TO POST BUT NOT SURE HOW TO DO
THAT??
***
   }

On Jan 14, 10:45 pm, "Jon Bennett"  wrote:
> Hi xybersoftware,
>
> >  My form does not have any editable fields...
> >  I only want to change certain fields of the records that are shown in
> >  the view if a user checks a check box and clicks submit...
> >  If the user checks the box then I want to mark all the records that
> >  are shown with todays date...
> >  I guess the question now is how do I post the data from the view so
> >  that in the controller so I can update the database...
>
> if you want to do this _without_ a page refresh, you'll have to do so
> via an AJAX request. This requires all the same logic and controller
> code as a normal save from a form, there's no shortcut!
>
> The functions you need are:
>
> controller method which accepts POST data ($this->data)
> model method which saves POST data
> prototype/jquery/mootools javascript code to submit the form when a
> checkbox is changed
>
> in psyudeo code you want to:
>
> * a html page which lists all your items inside a single form
> * each item in the html page has a checkbox, which has a unique ID and
> name. The ID of the checkbox should correspond to the record, eg the
> ID (primary key) of the record
> * the form submits to a controller method, say 
> /my_controller/update_all_records
> * this controller method calls a (custom) model method, 
> Model->updateAll($data)
> * Model->updateAll() loops over the data, and all records that have a
> checked checkbox are updated
> * back to your view, you have some javascript which is listening to
> the 'onchange' event for all your checkboxes
> * when a checkbox is changed, some more javascript creates a http post
> request to another controller method, update_record
> * the controller method calls a corresponding model method,
> Model->updateRecord($data);
> * your model method validates the data, and if it's ok and the
> checkbox is checked, it updates the date field
>
> That's about the size of it - good luck!
>
> Hope this helps
>
> Jon
> ps: if you don't need a degradable non-javascript version, you can
> skip all the 'update all records' stuff above
>
> --
>
> 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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Rendering an add form within another controller's view (with all automagicness)

2009-01-15 Thread jwerd

Hello fellow bakers, I've searched this group before I was going to
post this question but I cant' seem to find my current dilema
addressed yet.

I have two controllers, which serve different purposes, but for the
sake of this example, they share some things in common :

shows_controller is used to pretty much the shows in the system

show_attendees_controller is used to capture the attendees of any
given show

On the view /shows/view/# page I need to include the "add form" of
show_attendees/add/ but what's happening is, it's not doing all the
automagicness, and it's creating weird drop down menus that don't
really capture the same format they do if I was directly accessing
them from /show_attendees/add/.

Also, I'm using requestAction, just so everyone knows.

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



Re: CakePHP and Microsoft CRM

2009-01-15 Thread Martin Westin

I know next to nothing about Microsoft CRM so there will be very basic
and general tips.
After 5min on Google I would say that Microsoft CRM does have an
official API. It looks like this can be accessed from php using soap.
To get further you need access to Microsoft CRM to start setting up
and testing.

You probably won't find any turn-key solution for this but here is how
I would proceed (have worked like this before on similar things).

Look for some sample code or tutorial on using nusoap and CakePHP

Look for ... on using a web service as a datasource (I guess the CRM
should be accessed as a "model" if possible)

Look for ... on how the CRM API works (probably mostly for asp.net
which is fun to translate)
http://www.developer.com/lang/article.php/3509586

Check out M$ directions for using nusoap to access their .net web
services
http://msdn.microsoft.com/en-us/library/ms980207.aspx#MWS_PHPLoc_Calling_FindAddress


Depending on how much interactivity you need with the CRM getting
something going could take a few days to a few weeks maybe. It won't
be the usual Cake-lightning but it can certainly be done.

/Martin

On Jan 15, 6:19 am, AussieFreelancer 
wrote:
> Hi all, on a couple of occasions, clients have requested the
> integration of their website with Microsoft CRM. It seems to me that
> MS CRM is actually very closed and secure code, so 'hooking' into it,
> is not too easy, but I can't seem to find any information on the
> internet with regards to integrating a CakePHP website with CRM.
>
> Does anyone know if this has been done before, if there are any notes
> about it, and if there are any training courses or tutorials on doing
> it?
>
> Thanks
>
> Patrick
--~--~-~--~~~---~--~~
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: Simple validation, required=true does not work or has preg_match() [function.preg-match]: Delimiter must not be alphanumeric or backslash

2009-01-15 Thread Louie Miranda
Hi! Yes, this one.
http://book.cakephp.org/view/740/notEmpty

Works! I thought from the other examples that is how I should do it, until I
found your suggestions and googled notEmpty.

Thanks again!
--
Louie Miranda (lmira...@gmail.com)
http://www.louiemiranda.net

Security Is A Series Of Well-Defined Steps
chmod -R 0 / ; and smile :)



On Thu, Jan 15, 2009 at 3:30 PM, phpcurious wrote:

>
> Louie,
>
> I read it somewhere in some people's blog, that the 'required'
> validation rule doesn't really mean the field being required. Even I
> don't get much the idea of it. But You might consider checking up
> "notEmpty" instead if you want the field not to be empty.
>
>
> On Jan 15, 1:52 pm, "Louie Miranda"  wrote:
> > Guys, is there a new way of doing a simple this field is required? true
> or
> > false?
> >
> > The code example and my code below, does not work.
> >
> > My code:
> >
> > var $validate = array(
> >
> > >'officer'=>array('required'=>true)
> > > );
> >
> > I am using CakePHP (Stable/Latest release). I get an error of...
> >
> > > preg_match() [function.preg-match  >]:
> > > Delimiter must not be alphanumeric or backslash [*
> > > CORE/cake/libs/model/model.php*, line *2413*]
> >
> > Shall I always use alphanumeric on the rule? I just want to make it
> > required, true or false. Is it still the same?
> >
> > Help!
> > --
> > Louie Miranda (lmira...@gmail.com)http://www.louiemiranda.net
> >
> > Security Is A Series Of Well-Defined Steps
> > chmod -R 0 / ; and smile :)
> >
>

--~--~-~--~~~---~--~~
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: Questions about forms / validation

2009-01-15 Thread Miles J

My date validation keeps failing also, but its in the correct format:
[birthdate] => 02-26-1988

'birthdate' => array(
'rule' => 'date',
'message' => 'birthdateInvalid',
)
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---