$this->here DOUBLE path problem

2008-12-13 Thread _Z


Hello,

Using $this->here within my $form->create(..) brings me to action="/
path/to/cake/path/to/cake/action/id" while my installation is in "/
path/to/cake".

This then causes the action to fail, as an extra 'path/to/cake' is
added.  (This is a generalized example.)

Anyone else having this troubles?

Any help appreciated!

_Zach
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: What's the Model Association for a Lookup Table

2008-12-13 Thread Rob Wilkerson


Rob Wilkerson wrote:
> I have a vendors table that contains a field named "address_id" that
> is a foreign key to addresses.id. If I define the models as shown
> below then I'm unable to request a scaffolded version of /vendors/
> without getting an error: "Unknown column 'Address.vendor_id' in 'on
> clause'".  I don't want a "vendor_id" in the addresses table because I
> need to share that data with other tables later in the dev cycle (e.g.
> the volunteers table).
>
> class Vendor extends AppModel {
>
>   public $name   = 'Vendor';
>   public $hasOne = array ( 'CommercialVendor', 'Address' );
>
> }
>
> class Address extends AppModel {
>
>   public $name  = 'Address';
>   public $belongsTo = array ( 'Vendor' );
>
> }
>
> If I remove 'Address' from the hasOne array on the Vendor model,
> everything renders, but there's no association between the two. I'm
> new to Cake and I think I'm thinking about this incorrectly, but I
> don't know what I'm missing.

A little time away from it and a re-read of TFM pointed out the error
of my ways. I was defining the relationship intuitively rather than
logically. Intuitively, each vendor has an address, but logically each
address has a vendor:

class Vendor extends AppModel {

public $name   = 'Vendor';
public $hasOne = array ( 'CommercialVendor' );

}

class Address extends AppModel {

public $name  = 'Address';
public $hasOne = array ( 'Vendor' );

}

This seems to work more like what I'd expect.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: Getting simpletest to work with test DB

2008-12-13 Thread Ed Howland

You seem to be rught Mark, But why does this dependency exist in the
first place?

Ed

On Sat, Dec 13, 2008 at 10:36 AM, mark_story  wrote:
>
> Ed, looks like those fails are on the schema and containable classes,
> not the model.  And as you found out bake doesn't search through every
> related model to add fixtures from.  It only goes one level deep, you
> need to manually add all the missing fixtures.
>
> -Mark
>
> On Dec 12, 5:53 pm, "Ed Howland"  wrote:
>> I forgot to mention that I am still getting the previous errors on the
>> Core/model tests.
>> --
>> Ed Howlandhttp://greenprogrammer.blogspot.comhttp://twitter.com/ed_howland
> >
>



-- 
Ed Howland
http://greenprogrammer.blogspot.com
http://twitter.com/ed_howland

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: Explanation for model validation on parameter in conjunction with required = true [SOLVED]

2008-12-13 Thread mr_timp

Hi Adam,

Awesome!  Exactly the kind of feedback I was looking for.  Your right
I'm probably basing my design on older ways of doing things, your
example is much less complicated and easier to read.

Thanks for your feedback!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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
-~--~~~~--~~--~--~---



What's the Model Association for a Lookup Table

2008-12-13 Thread Rob Wilkerson

I have a vendors table that contains a field named "address_id" that
is a foreign key to addresses.id. If I define the models as shown
below then I'm unable to request a scaffolded version of /vendors/
without getting an error: "Unknown column 'Address.vendor_id' in 'on
clause'".  I don't want a "vendor_id" in the addresses table because I
need to share that data with other tables later in the dev cycle (e.g.
the volunteers table).

class Vendor extends AppModel {

public $name   = 'Vendor';
public $hasOne = array ( 'CommercialVendor', 'Address' );

}

class Address extends AppModel {

public $name  = 'Address';
public $belongsTo = array ( 'Vendor' );

}

If I remove 'Address' from the hasOne array on the Vendor model,
everything renders, but there's no association between the two. I'm
new to Cake and I think I'm thinking about this incorrectly, but I
don't know what I'm missing.

Any insight would be appreciated.

Rob
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: Explanation for model validation on parameter in conjunction with required = true

2008-12-13 Thread Adam Royle

Hi Mr Timp,

Yes, your example looks a bit old/odd. The "correct" equivalent of :

$this->User->data = $this->data;

is this:

$this->User->set($this->data);

This will ensure $this->User->id is updated with the correct value.

However, having said that, most of the code you've got seems unneeded.
Replace with something like this, which automatically calls set() and
validates().

function edit() {
if (!empty($this->data)) {
if ($this->User->save($this->data)) {
$this->Session->setFlash('Your details have been 
updated');
$this->redirect('index');
} else {
$this->Session->setFlash('There was a problem updating 
your
details, please try again shortly');
}
}
}

On Dec 14, 7:42 am, mr_timp  wrote:
> Hi There,
>
> Problem solved.  $this->User->id was unset inside the controller -
> which is kinda weird.  I have fixed it by doing the following:
>
> $this->User->id = $this->data["User"]["id"];
>
> Does it seems odd that I should have to do that?  The example of code
> I'm using was taken from a supposed working application (maybe it was
> written for Cake 1.1 and I'm using 1.2)?.
>
> Cheers
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Explanation for model validation on parameter in conjunction with required = true

2008-12-13 Thread mr_timp

Hi There,

Problem solved.  $this->User->id was unset inside the controller -
which is kinda weird.  I have fixed it by doing the following:

$this->User->id = $this->data["User"]["id"];

Does it seems odd that I should have to do that?  The example of code
I'm using was taken from a supposed working application (maybe it was
written for Cake 1.1 and I'm using 1.2)?.

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



Re: Explanation for model validation on parameter in conjunction with required = true

2008-12-13 Thread mr_timp

Hi again,

I have managed to track back what I think the problem is but I'm
having a hard time thinking this is an issue inside Cake given the
number of users who are using the on parameter. If I add $this->id =
[the id of my user] as the first line inside cake/libs/model/model.php
in the invalidFields method the validation works as intended (i.e. if
the record already exists and on = create and required = true then the
rule is skipped, if the record exists and on = update and required =
true the rule is validate.

How I'm calling the validation from inside my controller is as
follows:

// pass the posted data into the user object
$this->User->data = $this->data;

// validate the user details
if ($this->User->validates()) {
// save the user data and redirect
if ($this->User->save($this->data)) {
$this->set("successMessage",
"Your details have been updated.");
} else {
$this->set("errorMessage",
"There was a problem updating your details, please try again
shortly.");
}
} else {
$this->validateErrors($this->User);
}

I notice the $this->User->validates() has $this->id empty but when
$this->validateErrors($this->User) is called the $this->id = is set.

I suspect I'm going about something the wrong way!

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



Re: Finding Auth'd users Username

2008-12-13 Thread bioselem...@gmail.com

Hmm, Thanks. I'll have to toy with that. Looks like a good way to do
it. ^_^

On Dec 12, 3:58 am, "Liebermann, Anja Carolin"
 wrote:
> Hi Bios,
>
> What I do is in my app_cotroller.php:
>
>                 $this->set('usergroup',$this->Auth->user('group_id'));
>                 $this->set('user_id',$this->Auth->user('id'));
>                 $this->set('username',$this->Auth->user('name'));
>
> In the element, which I use as part of my navigation I do:
>     '.$username.' in group '.$usergroup; ?>
>
> HTH
> Anja
>
> -Ursprüngliche Nachricht-
> Von: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] Im Auftrag 
> von bioselem...@gmail.com
> Gesendet: Freitag, 12. Dezember 2008 00:03
> An: CakePHP
> Betreff: Re: Finding Auth'd users Username
>
> Amazing. Thanks for your help, both of you. I think I'm good now. ^_^ *goes 
> off to write a snippit on it*. Thanks alot. :)
>
> On Dec 11, 4:20 pm, "Brett Wilton"  wrote:
>
> > In your view you can use something like :-
>
> > if ($session->check('Auth.User.id')) {
> >   echo $session->read('Auth.User.username');
>
> > }
>
> > 
> > Brett Wiltonhttp://wiltonsoftware.com
>
> > On Fri, Dec 12, 2008 at 8:10 AM, bioselem...@gmail.com
>
> >  wrote:
>
> > > I've been wacking my head on the wall for the past few days on this.
> > > I've got a basic auth login/logout system set up but for some reason
> > > nothing i try gets me the username. I just want to display it as in
> > > "Your logged in as xyz". I know it's probably something stupid and
> > > I'm no doubt going about it the wrong way. Any 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 Define a Zero or One Relationship?

2008-12-13 Thread Rob Wilkerson



On Dec 13, 1:33 pm, WebbedIT  wrote:
> > Is it correct to associate my models such that:
>
> > commercial_vendor belongsTo vendor
> > organizational_vendor belongsTo vendor
>
> Yes, in the first application I am working on with CakePHP I have the
> following tables
>
> organisations
> people
> agencies
> households
> schemes
> agency_contacts
> clients
> staff
>
> I have created the belongsTo relationships as follow:
>
> Agency, Household and Scheme belongsTo => 'Organisation'
> AgencyContact, Client, Staff belongsTo => 'Person'
>
> And the reverse hasOne relations:
>
> Organisation hasOne => array('Agency', 'Household', 'Scheme')
> Person hasOne => array('AgencyContact', 'Client', 'Staff')
>

Okay, I guess I'm going to have to take this in bite-sized chunks
because something's not working right (or my expectations are wrong).
I have a vendors table whose PK field is named "id", a
commercial_vendors table whose PK is named "vendor_id" that also has a
FK on "vendor_id" pointing back to the vendors table (it's really more
of an inheritance model: a commercial_vender is-a vendor).  The shared
vendor data also references an address in an address table (PK:id) via
a FK named address_id. Each commercial vendor is of a certain type
(food, educational, etc.). To illustrate, here is my DDL script for
this section of the model:

CREATE TABLE addresses (
id  CHAR(36)
NOT NULL,
streetaddress_1 VARCHAR(255)NOT NULL,
streetaddress_2 VARCHAR(255)NULL,
cityVARCHAR(255)NOT NULL,
state_idVARCHAR(255)NOT NULL,
zipcode INT 
NOT NULL,
PRIMARY KEY ( id )
)
ENGINE=InnoDB;

CREATE TABLE commercial_vendor_types (
id  VARCHAR(255)NOT NULL,
title   VARCHAR(255)NOT NULL,
description VARCHAR(255)NULL,
PRIMARY KEY ( id )
)
ENGINE=InnoDB;

CREATE TABLE vendors (
id  CHAR(36)
NOT NULL,
business_name   VARCHAR(255)NOT NULL,
applicant_lastname  VARCHAR(255)NOT NULL,
applicant_firstname VARCHAR(255)NOT NULL,
applicant_title VARCHAR(255)NOT NULL,
phone_numberINT NOT 
NULL,
address_id  CHAR(36)NOT 
NULL,
created DATETIMENOT 
NULL,
modifiedDATETIMENOT 
NULL,
PRIMARY KEY ( id ),
FOREIGN KEY ( address_id )
REFERENCES addresses ( id )
ON DELETE CASCADE
ON UPDATE CASCADE
)
ENGINE=InnoDB;

CREATE TABLE commercial_vendors (
vendor_id   CHAR(36)
NOT NULL,
commercial_vendor_type_id   VARCHAR(255)NOT NULL,
booth_width INT 
NOT NULL,
booth_heightINT 
NOT NULL,
description TEXT
NOT NULL,
prior_participant   BOOLEAN NOT 
NULL,
PRIMARY KEY ( vendor_id ),
FOREIGN KEY ( vendor_id )
REFERENCES vendors ( id )
ON DELETE CASCADE
ON UPDATE CASCADE,
FOREIGN KEY ( commercial_vendor_type_id )
REFERENCES commercial_vendor_types ( id )
ON DELETE CASCADE
ON UPDATE CASCADE
)
ENGINE=InnoDB;

Given that data structure, here are the relevant models:

class Vendor extends AppModel {

public $name   = 'Vendor';
public $hasOne = array ( 'CommercialVendor', 'Address' );

}

class Address extends AppModel {

public $name  = 'Address';
/** no relationship defined b/c this will only be edited through a
vendor */
}

class CommercialVendor extends AppModel {

public $name= 'CommercialVendor';
public $primaryKey  = 'vendor_id';
public $hasOne  = array ( 'CommercialVendorType' );
public $belongsTo   = array ( 'Vendor' );
}

class CommercialVendorType extends AppModel {

public $name  = 'CommercialVendorType';
}

I was hoping that Cake's scaffolding would allow me to access
http://servername/commercial_vendors/add and enter:

- The shared vendor data, including an address
- The data specific to commercial vendors
- Select (rather than type) the commercial vendor type

Instead, I see inputs

Re: Notice (8): unserialize() [function.unserialize]: Error at offset

2008-12-13 Thread João Aguiam

Does anyone can help me with this please?

Thank you
Joao

On Dec 11, 11:47 pm, "João Aguiam"  wrote:
> Hello,
> I'm developing two sites in cake php at the same time. In each site (both
> are on the same machine) the following error is occurring:
>
> *Notice* (8) : unserialize()
> [function.unserialize ]: Error at
> offset 6 of 730 bytes [*CORE\cake\libs\cache\file.php*, line *182*]
>
> It's strange because it happened at the same time in each site. I've been
> searching and it seams to be a problem with the cache but I've already
> cleaned the cached dir but the same happens.
>
> Anyone has a suggestion?
>
> Thank you,
> João

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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 Define a Zero or One Relationship?

2008-12-13 Thread WebbedIT

> Is it correct to associate my models such that:
>
> commercial_vendor belongsTo vendor
> organizational_vendor belongsTo vendor

Yes, in the first application I am working on with CakePHP I have the
following tables

organisations
people
agencies
households
schemes
agency_contacts
clients
staff

I have created the belongsTo relationships as follow:

Agency, Household and Scheme belongsTo => 'Organisation'
AgencyContact, Client, Staff belongsTo => 'Person'

And the reverse hasOne relations:

Organisation hasOne => array('Agency', 'Household', 'Scheme')
Person hasOne => array('AgencyContact', 'Client', 'Staff')

As one organisation or person can only relate to any one of the
allowed models (organisation cannot be a scheme and an agency) it
would possibly have been better to have the organisation or person
belong to the related model and include 'parent_model' and 'parent_id'
fields in the organisations/people tables.  This way I could have
created the relationships as follows:

class Organisation extends AppModel {
  var $name = 'Organisation';
  var $belongsTo = array(
'Agency' => array(
'className' => 'Agency',
'foreignKey' => 'parent_id',
'conditions' => array('Organisation.parent_model' => 'Agency')
  ),
'Household' => array(
'className' => 'Household',
'foreignKey' => 'parent_id',
'conditions' => array('Organisation.parent_model' => 'Household')
)
  ),
'Scheme' => array(
'className' => 'Scheme',
'foreignKey' => 'parent_id',
'conditions' => array('Organisation.parent_model' => 'Scheme')
)
  );
}

class Person extends AppModel {
  var $name = 'Person';
  var $belongsTo = array(
'AgencyContact' => array(
'className' => 'AgencyContact',
'foreignKey' => 'parent_id',
'conditions' => array('Person.parent_model' => 'AgencyContact')
  ),
'Client' => array(
'className' => 'Client',
'foreignKey' => 'parent_id',
'conditions' => array('Person.parent_model' => 'AgencyContact')
)
  ),
'Staff' => array(
'className' => 'Staff',
'foreignKey' => 'parent_id',
'conditions' => array('Person.parent_model' => 'Staff')
)
  );
}

class Agency extends AppModel {
  var $name = 'Agency';
  var $hasOne = array(
'Organisation' => array(
'className' => 'Organisation',
'foreignKey' => 'parent_id',
'conditions' => array('Organisation.parent_model' => 'Agency')
  );
}

class AgencyContact extends AppModel {
  var $name = 'AgencyContact';
  var $hasOne = array(
'Person' => array(
'className' => 'Person',
'foreignKey' => 'parent_id',
'conditions' => array('Person.parent_model' => 'AgencyContact')
  );
}

Hope this makes some sort of sense ;)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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
-~--~~~~--~~--~--~---



calling clearCache twice produces different results

2008-12-13 Thread Mathew

If I have view caching enabled and I have the following files.

news.php
news_find_something.php
news_find_something_page_2.php
element_news_something.php
documents_find_news_page_4.php

If I call clearCache('news') the news.php file is deleted but the
other files remain.

If I call it again a second time then all the files with the word news
are deleted.

The clearCache function should not produce different results when
called with the same parameters.

The other problems is that the clearCache will delete any cached file
with the word "news" in it, but only after being called a second time.
For example; documents_find_news_page_4.php was also deleted.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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 Define a Zero or One Relationship?

2008-12-13 Thread Rob Wilkerson

I have a vendors table with a few common properties shared between
commercial_vendors and organizational_vendors.  Any given vendor can
be either a commercial vendor _or_ an organizational vendor, but not
both.  Is it correct to associate my models such that:

commercial_vendor belongsTo vendor
organizational_vendor belongsTo vendor

Is that sufficient?  Will scaffolding pick that up? The whole context
of what I'm trying to do is this:

Share some vendor data including an address pulled from a separate
table that is associated with the vendors table (vendor hasOne
address). I want to be able to query on commercial or organizational
vendors and pull all shared data as well.

I'm looking for any insight on how best to associate my models to make
this happen.

Thanks.

Rob
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: Is CakePHP 1.2 fully backwards compatible with 1.1.16?

2008-12-13 Thread Stinkbug

I've published a little information on the migration process.  Maybe
that will help you out.  One of the biggest hurdles for me was the ACL
changes.  At the time there wasn't much information about the changes,
but I think most of that information has been updated in the Cook book
now.  My article also has links to other articles where people have
published deprecated stuff in 1.2, so there's a good list to follow if
your wondering if the methods have changed.

http://blog.stinkbug.net/?p=1204

Hope it helps!

On Dec 12, 11:04 am, glastoveteran  wrote:
> Hi all,
>
> Is CakePHP 1.2 fully backwards compatible with 1.1.16?  If I just
> upgrade the cake directory can I expect everything to work straight
> away?
>
> Thanks,
>
> Alex
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: Getting simpletest to work with test DB

2008-12-13 Thread mark_story

Ed, looks like those fails are on the schema and containable classes,
not the model.  And as you found out bake doesn't search through every
related model to add fixtures from.  It only goes one level deep, you
need to manually add all the missing fixtures.

-Mark

On Dec 12, 5:53 pm, "Ed Howland"  wrote:
> I forgot to mention that I am still getting the previous errors on the
> Core/model tests.
> --
> Ed Howlandhttp://greenprogrammer.blogspot.comhttp://twitter.com/ed_howland
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: unobtrusive datepicker

2008-12-13 Thread cakephpro...@googlemail.com

Adam,

thanks, firebug is a really useful addition. I managed to track down
one problem and it now shows the first button of looped items but not
any subsequent ones. This is the code :

foreach ($applications as $applicant):?>

 

input('Application.dateOnly', 
array('size' =>
'10', 'label'=> false, 'class' => 'w8em format-d-m-y divider-dash
highlight-days-12 no-transparency'));?>

 


Thanks, Roger


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: My Paginator

2008-12-13 Thread AD7six



On Dec 13, 4:30 am, thankyou  wrote:
> Hello,
>
> I'm a little confused with My Paginatorplease forgive me as i'm a
> basic learner :)
>
> I'm currently showing links to pages 1 2 3 4 5 on the bottom of my
> website:
> Here is part of the code: 1 2 etc etc5
>
> What I want it to doI want it to show pages upto page 10 (it only
> goes to page 5) <-- I'm stuck, any ideas?
>
> I found the frontendpaginator function (below) which appears to help
> with this:
> function frontendPaginator($option = array())
>                 {
>                         $current = "";
>
>                         if($this->numbers($option))
>                         {
>                                 $current = $this->frontendNumbers($option);
>                         }
>
>                         $result = "";
>                         $result .=
>                         "".$current ."";
>                         return $result;
>                 }

Are you using CakePHP? If so the core paginate functionality doesn't
work like that.

http://book.cakephp.org/revisions/results/query:paginate/collection:2/lang:en

AD
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: Association not producing dropdown list, help! :(

2008-12-13 Thread _Z

Ok gents:

In Waitlists controller, just reading session variable, and returning
all entries that match that store.

Waitlists Controller

function index() {
$this->Waitlist->recursive = 0;
$storeid = $this->Session->read('UserStoreId');
$store_tables = $this->Waitlist->StoreTable->find('list');

$this->set(compact('store_tables'));
//conditional Paginate for sorting, great!
$this->set('waitlists', $this->paginate(null , array
('Waitlist.store_id' => $storeid,'Waitlist.seated_ts'=> Null)));

}


Now the index.ctp view:

>







  






input('store_table_id'); 


I just keep getting a textbox :(

Thank you all very much for your help!
_Zach



On Dec 13, 8:58 am, Alexandru Ciobanu  wrote:
> _Z wrote:
> > I validated with pr($store_tables); That I am indeed getting back a
> > list of tables.
>
> > However the echo $form->input('store_table_id'); does not produce a
> > dropdown.
>
> > Any other ideas or things I need to check?
>
> Like yash said, please paste your controller and view.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Association not producing dropdown list, help! :(

2008-12-13 Thread Alexandru Ciobanu

_Z wrote:
> I validated with pr($store_tables); That I am indeed getting back a
> list of tables.
>
> However the echo $form->input('store_table_id'); does not produce a
> dropdown.
>
> Any other ideas or things I need to check?
>   
Like yash said, please paste your controller and view.


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



Re: unobtrusive datepicker

2008-12-13 Thread Adam Royle

I use Firebug in this case to see what files are being loaded, and to
make sure I'm getting no 404s on things like js or css files, etc.

Cheers,
Adam

On Dec 13, 8:34 pm, "cakephpro...@googlemail.com"
 wrote:
> Hello,
>
> I'm using the unobtrusive datepicker 
> (http://bakery.cakephp.org/articles/view/using-the-unobtrusive-date-pi...
> ) but the calendar button is not showing up.
>
> The output HTML is:
>
> 
>       
> ...
>
> 

Re: Validation with CakePHP/ExtJS

2008-12-13 Thread Adam Royle

Hi Paul,

You can also access the validation errors directly in the view, so you
could just have this in your controller...

$this->User->save($this->data);

and something like this in your view...

 empty($this->validationErrors),
'errors' => $this->validationErrors
}

echo $javascript->object($response);

?>


Cheers,
Adam


On Dec 13, 6:50 pm, pkclarke  wrote:
> Hi Guys,
>
> It's OK, I found the "invalidFields()" function.  Here's the
> implementation if your interested:
>
> if ($this->User->save($this->data)) {
>   $this->set('success', '{success:true}');} else {
>
>   $errors = $this->User->invalidFields();
>   $this->set('success', '{success:false, errors:'.json_encode
> ($errors).'}');
>
> }
>
> Cheers Paul.
>
> On Dec 13, 7:20 pm, pkclarke  wrote:
>
> > I am trying to integrate CakePHP with ExtJS.  What is the best way to
> > handle validation?  How can I capture validation messages in the
> > Controller so that I can return them to the ExtJS form in JSON format?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: Association not producing dropdown list, help! :(

2008-12-13 Thread yash

are you doing the right form->create(); ???

best would be if you copy paste you controller and view so i can have
a look at it.

Alexandru's solution should work..

cheers


On Dec 12, 8:56 pm, _Z  wrote:
> Hi Alexandru.
> Thank you for the input. But a dropdown box is STILL not happening :/
>
> I validated with pr($store_tables); That I am indeed getting back a
> list of tables.
>
> However the echo $form->input('store_table_id'); does not produce a
> dropdown.
>
> Any other ideas or things I need to check?
>
> There is a field called 'name' in the store_tables DB table.
>
> Thank you!
>
> On Dec 12, 2:46 pm, Alexandru Ciobanu  wrote:
>
> > _Z wrote:
> > > Hello,
>
> > > I am expecting a dropdown box in my /add action, but only a textbox is
> > > produced.
>
> > In your controller:
>
> > $store_tables = $this->Waitlist->StoreTable->find('list');
>
> > $this->set(compact('store_tables'));
>
> > In your view:
>
> > echo $form->input('store_zone_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
-~--~~~~--~~--~--~---



My Paginator

2008-12-13 Thread thankyou

Hello,

I'm a little confused with My Paginatorplease forgive me as i'm a
basic learner :)

I'm currently showing links to pages 1 2 3 4 5 on the bottom of my
website:
Here is part of the code: 1 2 etc etc5

What I want it to doI want it to show pages upto page 10 (it only
goes to page 5) <-- I'm stuck, any ideas?

I found the frontendpaginator function (below) which appears to help
with this:
function frontendPaginator($option = array())
{
$current = "";

if($this->numbers($option))
{
$current = $this->frontendNumbers($option);
}

$result = "";
$result .=
"".$current ."";
return $result;
}

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



Re: Database design . Beginner having trouble.

2008-12-13 Thread gearvOsh

If I believe what you are saying, something like this would work (not
sure what fields you need):

// all the tenants
tenants
- id
- name

// all the expenses
expenses
- id
- cost

// relating a tenant to an expense = multiple tenants possible on an
expense
tenantExpenseRelation
- id
- tenant_id
- expenses_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
-~--~~~~--~~--~--~---



unobtrusive datepicker

2008-12-13 Thread cakephpro...@googlemail.com

Hello,

I'm using the unobtrusive datepicker (
http://bakery.cakephp.org/articles/view/using-the-unobtrusive-date-picker-widget-in-cakephp
) but the calendar button is not showing up.

The output HTML is:


  
...




.




The Application model has been amended to include the validation code
and datepicker.js is in /webroot/js .

How can I check the code is doing what it should ( or not in this
case )?

Any ideas on what is happening here will be greatly appreciated.

Thanks,

Roger





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



Database design . Beginner having trouble.

2008-12-13 Thread Tanay

I have two database tables. Tenants and expenses. Tenant has many
expenses. Expense belongs to tenant. When ever a new expense is
created a tenant who has paid for the expense is associated with it.

Now i want another relationship which is "affects". Each expense may
not affect all tenants. So while creating an expense i need to mention
using multiple select all tenants who are affected by the expense. How
and what should i design the database tables. ?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: $form->input with onkeyup, onfocus, etc

2008-12-13 Thread Adam Royle

CakePHP doesn't discern between html attributes, by default it escapes
all attribute values. If you want to change this behaviour, then you
can pass 'escape' => false as part of that second array, *however* you
will manually need to escape all other values (including the input
value I believe).

A better alternative is to separate your php and javascript and assign
the javascript method dynamically using jQuery (or your preferred JS
framework).

Cheers,
Adam

On Dec 13, 10:33 am, gearvOsh  wrote:
> So I have input fields that need javascript events for onfocus and
> onkeyup.. here is my code:
>
>  echo $form->input('username', array('onkeyup' => "populateUrl
> ('username', 'usernameUrl');", 'onfocus'   => "showSignupHelp
> ('username');")); ?>
>
> That works, BUT when you look at the source it looks like the
> following:
>
>  onfocus="showSignupHelp('username');" value=""
> id="UserUsername" />
>
> It seems the form helper is escaping all quotes and characters How
> am I to bypass this? I've tried different combinations of quotes and
> escaping quotes (\') etc but nothing works.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: Validation with CakePHP/ExtJS

2008-12-13 Thread pkclarke

Hi Guys,

It's OK, I found the "invalidFields()" function.  Here's the
implementation if your interested:

if ($this->User->save($this->data)) {
  $this->set('success', '{success:true}');
} else {
  $errors = $this->User->invalidFields();
  $this->set('success', '{success:false, errors:'.json_encode
($errors).'}');
}


Cheers Paul.


On Dec 13, 7:20 pm, pkclarke  wrote:
> I am trying to integrate CakePHP with ExtJS.  What is the best way to
> handle validation?  How can I capture validation messages in the
> Controller so that I can return them to the ExtJS form in JSON format?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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 with CakePHP/ExtJS

2008-12-13 Thread pkclarke

I am trying to integrate CakePHP with ExtJS.  What is the best way to
handle validation?  How can I capture validation messages in the
Controller so that I can return them to the ExtJS form in JSON format?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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
-~--~~~~--~~--~--~---