AW: DbAcl::allow() - Invalid node

2008-12-03 Thread Liebermann, Anja Carolin

Hey Rob,

You saved my week! Yes the trailing slash was the error. 

I had used your tool to build the acos, but when you have a typo in your 
permission setup... 

Thank you and muchas smoochas!

Anja

-Ursprüngliche Nachricht-
Von: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] Im Auftrag von Rob
Gesendet: Donnerstag, 4. Dezember 2008 05:51
An: CakePHP
Betreff: Re: DbAcl::allow() - Invalid node


Not sure if it's a typo in your post, but the line has a trailing slash in the 
string.

I wrote a little function (get_aco_node) because I was having a similar problem 
with the code in the cookbook.

I added the following action and function to my users_controller to do my 
initial Aco setup:

/**
  * Rebuild the Acl based on the current controllers in the application
  *
  * @return void
*/
function buildAcl() {
$log = array();

$aco =& $this->Acl->Aco;
$root = $this->_get_aco_node('controllers');

$this->Acl->Allow('Admin','controllers','*');
$log[] = 'Allowed access to controllers for admin user';

App::import('Core', 'File');
$Controllers = Configure::listObjects('controller');
foreach($Controllers as $ctrlName){
if (!App::import('Controller', $ctrlName))
{
$log[] = 'Import of '.$ctrlName.' failed';
} else {
$log[] = 'Import of '.$ctrlName.' succeeded';
}

}

$Plugins = $this->_get_plugin_controller_names();

$Controllers = array_merge($Controllers, $Plugins);

$appIndex = array_search('App', $Controllers);
if ($appIndex !== false ) {
unset($Controllers[$appIndex]);
}
$baseMethods = get_class_methods('Controller');
//$baseMethods[] = 'buildAcl';

// look at each controller in app/controllers
foreach ($Controllers as $ctrlName) {
$isPlugin = false;
$ctrlclass = $ctrlName . 'Controller';
$methods = get_class_methods($ctrlclass);

// find / make controller node
$controllerNode = $this->_get_aco_node('controllers/'.
$ctrlName,$root['Aco']['id']);
$log[] = 'Found/made node for controllers/'.$ctrlName;

if ($methods != null){
// Now create the methods ...
foreach ($methods as $k => $method) {
if (strpos($method, '_', 0) === 0) {
unset($methods[$k]);
continue;
}
if (in_array($method, $baseMethods)) {
unset($methods[$k]);
continue;
}
$methodNode = $this->_get_aco_node('controllers/'.
$ctrlName.'/'.$method, $controllerNode['Aco']['id']);
$log[] = 'Found/made node for controllers/'.
$ctrlName.'/'.$method;
}
} else {
$log[] = 'No methods for '.$ctrlName;
}
}

$user_controller_node = $this->_get_aco_node('controllers/
User', $controllerNode['Aco']['id']);
$user_login_node = $this->_get_aco_node('controllers/User/
login', $user_controller_node['Aco']['id']);

$this->Acl->Allow('User',
'controllers/User/login',
'*'
);

$user_logout_node = $this->_get_aco_node('controllers/User/
logout', $user_controller_node['Aco']['id']);

$this->Acl->Allow('User',
'controllers/User/logout',
'*'
);

$init_acl_controller_node = $this->_get_aco_node('controllers/
InitAcl', $controllerNode['Aco']['id']);
$init_acl_build_acl_node = $this->_get_aco_node('controllers/
InitAcl/buildAcl', $user_controller_node['Aco']['id']);


debug($log);
}

function _get_aco_node($new_node = null, $parent_id = null){
$aco =& $this->Acl->Aco;

$aco_node = $aco->node($new_node);
if (!$aco_node) {
$path = explode('/',$new_node);
$ctrlName = array_pop($path);
$aco->create(array('parent_id' => $parent_id, 'model' => null, 
'alias' => $ctrlName));
$aco_node = $aco->save();
$aco_node['Aco']['id'] = $aco->id;
$log[] = 'Created new node for '.$new_node;
} else {
$log[] = 'Aco node for '.$new_node.' already exists';
$aco_node = $aco_node[0];
}
$this->Acl->Allow('Admin',
$new_node,
'*'
);
return $aco_node;

}


Then my logic to set up the

On Dec 2, 2:42 am, "Liebermann, Anja Carolin"
<[EMAIL PROTECTED]> wrote:
>
>                  $this->Acl->allow($gruppe, 
> 'controllers/Bilds/','create'); //This is line 129 which throws the 
> error



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To 

Re: save extra filed 'entity' in HABTM join tabel

2008-12-03 Thread bookme

Thanks Rob,

I tried your solution but I am using tag behaviour for inseritng tag
by beforeSave function so I can not get entity_id that's blog's tabel
id (blog_id) in beforeSave function.

So your suggest solution is not working.

Multiple tags and entity_id is successfully inserting into
entites_tags tabel without use of EntitiesTag module.

Is there any other solution for saving one extra filed 'entity' ?

Should I use custom query solution for this If cake can not provide me
a better solution?

Please help me.

Thanks

On Dec 4, 9:30 am, Rob <[EMAIL PROTECTED]> wrote:
> If I get this correctly, you want to update the related entities from
> the blogs_controller, then you need to set the associated data by
> referencing it properly.
>
> The saveAll should handle this OK for you as long as you are setting
> the data the way you stated.
>
> You could also manually do thesavefor thejointable by doing a
> separatesaveafter you do yoursavefor the Tag:
>
> // for the 'add' action ...
>
> $this->Tag->create();
> if ($this->Tag->save($this->data)){
> $this->data['Tag']['tag_id'] = $this->Tag-
>
> >getLastInsertId();
>
> $this->data['EntitiesTag']['tag_id'] = $this->data
> ['Tag']['tag_id'];
> $this->data['EntitiesTag']['entity'] = 1;
>
> $this->Tag->EntitiesTag->create();
>
> // Thensavethe EntitiesTag ...
> if ($this->Tag->EntitiesTag->save($this->data
> ['EntitiesTag'])) {
>$user_slot_id = $this->User->UserSlot-
>
> >getLastInsertId();
>
> On Dec 2, 11:24 pm, bookme <[EMAIL PROTECTED]> wrote:
>
> > Hi,
>
> > I am trying this from last three days but can not solve
> > problem...Please help me to find a solution to this problem.
> > I want tosaveaextrafield inHABTMJointabel.
>
> > 1) tags : tag_id, tag_name .
> > 3) blogs : id, title, body
> > 4) entities_tags : tag_id,entity, entity_id .
>
> > I am usingHABTMrelation ship between Tag and Blog modal
>
> > *Blog Model*
> >  > class Blog extends AppModel {
>
> > var $name = 'Blog';
>
> > var $hasAndBelongsToMany = array(
> > 'Tag' => array('className' => 'Tag',
> > 'joinTable' => 'entities_tags',
> > 'foreignKey' => 'entity_id',
> > 'associationForeignKey' => 'tag_id',
> > 'with' => 'EntitiesTag',
> >  'unique' => true,
> > 'conditions' => 'EntitiesTag.entity= 1',
> >),
> >  );
>
> > }
>
> > ?>
>
> > entity_id, tag_id is saving in database successfully butentityis not
> > saving intabel.
>
> > I tried following solution for this in blogs_controller
>
> > 1 $this->data['EntitiesTag']['entity'] = 1
>
> > 2 $this->data['EntitiesTag'][0]['entity'] = 1
>
> > 3 I read one 
> > tutorialhttp://teknoid.wordpress.com/2008/09/24/saving-extra-fields-in-the-jo...
>
> > I tried it but not successed.
>
> > It would be gr8 for me if somebody tell how can Isavethisextra
> > field 'entity' intoJointabelentites_tags ?
>
> > Is there missing something or doing wrong?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



session lost when switching from http to https, vice versa, in cakephp rc3

2008-12-03 Thread robert123

hi, I am using cakephp rc3

I will lose my cakephp session whenever i swtich http to https: or
https to http

anyone knows how to solve this problem, reason being, the user was
adding to the shopping cart, but when the protocol changes from http
to https for checkout:, the shopping cart session is empty

the same thing happens, when the use switch from https to http in the
checkout to shopping cart, the shopping cart session will be missing
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: DbAcl::allow() - Invalid node

2008-12-03 Thread Rob

Not sure if it's a typo in your post, but the line has a trailing
slash in the string.

I wrote a little function (get_aco_node) because I was having a
similar problem with the code in the cookbook.

I added the following action and function to my users_controller to do
my initial Aco setup:

/**
  * Rebuild the Acl based on the current controllers in the
application
  *
  * @return void
*/
function buildAcl() {
$log = array();

$aco =& $this->Acl->Aco;
$root = $this->_get_aco_node('controllers');

$this->Acl->Allow('Admin','controllers','*');
$log[] = 'Allowed access to controllers for admin user';

App::import('Core', 'File');
$Controllers = Configure::listObjects('controller');
foreach($Controllers as $ctrlName){
if (!App::import('Controller', $ctrlName))
{
$log[] = 'Import of '.$ctrlName.' failed';
} else {
$log[] = 'Import of '.$ctrlName.' succeeded';
}

}

$Plugins = $this->_get_plugin_controller_names();

$Controllers = array_merge($Controllers, $Plugins);

$appIndex = array_search('App', $Controllers);
if ($appIndex !== false ) {
unset($Controllers[$appIndex]);
}
$baseMethods = get_class_methods('Controller');
//$baseMethods[] = 'buildAcl';

// look at each controller in app/controllers
foreach ($Controllers as $ctrlName) {
$isPlugin = false;
$ctrlclass = $ctrlName . 'Controller';
$methods = get_class_methods($ctrlclass);

// find / make controller node
$controllerNode = $this->_get_aco_node('controllers/'.
$ctrlName,$root['Aco']['id']);
$log[] = 'Found/made node for controllers/'.$ctrlName;

if ($methods != null){
// Now create the methods ...
foreach ($methods as $k => $method) {
if (strpos($method, '_', 0) === 0) {
unset($methods[$k]);
continue;
}
if (in_array($method, $baseMethods)) {
unset($methods[$k]);
continue;
}
$methodNode = $this->_get_aco_node('controllers/'.
$ctrlName.'/'.$method, $controllerNode['Aco']['id']);
$log[] = 'Found/made node for controllers/'.
$ctrlName.'/'.$method;
}
} else {
$log[] = 'No methods for '.$ctrlName;
}
}

$user_controller_node = $this->_get_aco_node('controllers/
User', $controllerNode['Aco']['id']);
$user_login_node = $this->_get_aco_node('controllers/User/
login', $user_controller_node['Aco']['id']);

$this->Acl->Allow('User',
'controllers/User/login',
'*'
);

$user_logout_node = $this->_get_aco_node('controllers/User/
logout', $user_controller_node['Aco']['id']);

$this->Acl->Allow('User',
'controllers/User/logout',
'*'
);

$init_acl_controller_node = $this->_get_aco_node('controllers/
InitAcl', $controllerNode['Aco']['id']);
$init_acl_build_acl_node = $this->_get_aco_node('controllers/
InitAcl/buildAcl', $user_controller_node['Aco']['id']);


debug($log);
}

function _get_aco_node($new_node = null, $parent_id = null){
$aco =& $this->Acl->Aco;

$aco_node = $aco->node($new_node);
if (!$aco_node) {
$path = explode('/',$new_node);
$ctrlName = array_pop($path);
$aco->create(array('parent_id' => $parent_id, 'model' =>
null, 'alias' => $ctrlName));
$aco_node = $aco->save();
$aco_node['Aco']['id'] = $aco->id;
$log[] = 'Created new node for '.$new_node;
} else {
$log[] = 'Aco node for '.$new_node.' already exists';
$aco_node = $aco_node[0];
}
$this->Acl->Allow('Admin',
$new_node,
'*'
);
return $aco_node;

}


Then my logic to set up the

On Dec 2, 2:42 am, "Liebermann, Anja Carolin"
<[EMAIL PROTECTED]> wrote:
>
>                  $this->Acl->allow($gruppe,
> 'controllers/Bilds/','create'); //This is line 129 which throws the
> error

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



Adding https in $html->url

2008-12-03 Thread Jipson

Hi Friends,
   In my project i am giving the links to payment page view as
follows.
url('/carts/authorize/); ?>

now i am getting the output url as http://mycart/carts/authorize/ what
i want to get is
https://mycart/carts/authorize/ , what i have to do for it,
 anybody please help me.

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



Re: save extra filed 'entity' in HABTM join tabel

2008-12-03 Thread Rob

If I get this correctly, you want to update the related entities from
the blogs_controller, then you need to set the associated data by
referencing it properly.

The saveAll should handle this OK for you as long as you are setting
the data the way you stated.

You could also manually do the save for the join table by doing a
separate save after you do your save for the Tag:

// for the 'add' action ...

$this->Tag->create();
if ($this->Tag->save($this->data)){
$this->data['Tag']['tag_id'] = $this->Tag-
>getLastInsertId();

$this->data['EntitiesTag']['tag_id'] = $this->data
['Tag']['tag_id'];
$this->data['EntitiesTag']['entity'] = 1;


$this->Tag->EntitiesTag->create();

// Then save the EntitiesTag ...
if ($this->Tag->EntitiesTag->save($this->data
['EntitiesTag'])) {
   $user_slot_id = $this->User->UserSlot-
>getLastInsertId();




On Dec 2, 11:24 pm, bookme <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I am trying this from last three days but can not solve
> problem...Please help me to find a solution to this problem.
> I want to save a extra field in HABTM Join tabel.
>
> 1) tags : tag_id, tag_name .
> 3) blogs : id, title, body
> 4) entities_tags : tag_id, entity, entity_id .
>
> I am using HABTM relation ship between Tag and Blog modal
>
> *Blog Model*
>  class Blog extends AppModel {
>
>     var $name = 'Blog';
>
>     var $hasAndBelongsToMany = array(
>                 'Tag' => array('className' => 'Tag',
>                 'joinTable' => 'entities_tags',
>                 'foreignKey' => 'entity_id',
>                 'associationForeignKey' => 'tag_id',
>                 'with' => 'EntitiesTag',
>                  'unique' => true,
>                 'conditions' => 'EntitiesTag.entity = 1',
>                ),
>          );
>
> }
>
> ?>
>
> entity_id, tag_id is saving in database successfully but entity is not
> saving in tabel.
>
> I tried following solution for this in blogs_controller
>
> 1 $this->data['EntitiesTag']['entity'] = 1
>
> 2 $this->data['EntitiesTag'][0]['entity'] = 1
>
> 3 I read one 
> tutorialhttp://teknoid.wordpress.com/2008/09/24/saving-extra-fields-in-the-jo...
>
> I tried it but not successed.
>
> It would be gr8 for me if somebody tell how can I save this extra
> field 'entity' into Join tabel entites_tags ?
>
> Is there missing something or doing wrong?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Cake Stalling (or blocking)

2008-12-03 Thread Elricho

On Dec 2, 8:38 pm, Adam Royle <[EMAIL PROTECTED]> wrote:
> I'd be interested to find out what is causing this problem, and
> whether it is cake specific or not. Let us know when you've figured it
> out.
>
> Cheers
> Adam

Not cake specific. I traced the issue back to session_start, which
blocks subsequent
sessions (that are .. errr .. using php sessions) while the initial
one is active to avoid
corrupting the php session file/variables.

fwiw : http://bugs.php.net/bug.php?id=44400

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



Re: How to add item using HABTM relation

2008-12-03 Thread Rob

You need to structure the data so that it has the right data and keys
for each record that will be added.

Your $this->data['Contract']['Person'] would be an array of the data
required for the person.

Since it appears you are doing this in your contracts controller, you
would need to get the ID for the person, then save the contract just
as you've shown.

I do something similar in my code: I have a "signup" sheet that uses
the currently logged in user's ID to add a row to the signup slots:

$this->User->create();
if ( $this->User->save($this->data) ){
$this->data['User']['user_id'] = $this->User-
>getLastInsertId();
$this->data['UserSlot']['user_id'] = $this->data
['User']['user_id'];

$this->User->UserSlot->create();

if ($this->User->UserSlot->save($this->data
['UserSlot'])) {
$user_slot_id = $this->User->UserSlot-
>getLastInsertId();


Basically I create the user, get the user ID, set the UserSlot's
user_id, and save the UserSlot ...

So as long as you set the data for the HATBM id's correctly, the rows
will be created.

On Dec 3, 9:57 am, Zeugme <[EMAIL PROTECTED]> wrote:
> Hi,
>
> How to add an item to a HABTM relation ?
>
> I have a Person and I have to add a Contract to that person.
> Here are the data on a view :
>
> data[Contract][type] : 12
> data[Contract][name] : contract-AAaa
> data[Contract][Person] : 26 // Should I put the person id here ?? or  
> something else ??
>
> In fact, that contract added to person 26 could be later on added to  
> another Person, that's why its HABTM.
> Currently, I'm trying to add a new contract to an existing person, so  
> the question, but later I'm not sure how to just link an existing  
> contract to an existing person ...
>
> Here is the code on the controller to receive that data :
>      function add() {
>          if (!empty($this->data)) {
>                         $this-> Contract->create();
>                         if ($this-> Contract->save($this->data)) {
>                             $this->set('returncode', 'Contract '.$this-> 
> Contract->id.'  
> saved');
>                         } else {
>                                 $this->set('returncode', 'ERROR : Contract 
> '.$this-
>  >data['Contract']['name'].' not saved');
>                         }
>          }
>      }
>
> 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



acl on views

2008-12-03 Thread Diego Villar
Hi guys,
I need to change the view according permits ACL

Will it be possible to consult the acl from the views?

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: bake script doesn't save my relations

2008-12-03 Thread Rob

Not sure I understand your question - when you bake, the relationships
should show up in the baked models. As long as you have the hasMany,
belongsTo and/or HABTM relationships, your view should reflect this.

On Oct 16, 5:42 pm, djXternal <[EMAIL PROTECTED]> wrote:
> Hey guys, I am just getting started using the bake script on windows,
> everything seems to be going great except after baking when I view my
> project.  None of my tables display any relations that they should
> have.
>
> I bake in this order: Models of all tables, Controllers of all Models,
> Views of all controllers
>
> When creating views I tell it to not use scaffolding, but to create
> basic actions (index, edit, add, delete)
>
> I added all the relations when I was baking the models, why would they
> not show up after baking
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: RC3 Auth: Hash value still being generated for empty password textbox?

2008-12-03 Thread Dave

Just used this method and it worked great. Thanks for the post.

Hopefully this workaround will get adjusted in the core. It seems a
little superfluous the way validations work to hash the password
before validation, but that's just me.

On Nov 30, 12:46 am, thatsgreat2345 <[EMAIL PROTECTED]> wrote:
> Check out teknoidsauthblog, should be the second code box that shows
> you how to not hash passwords so that they 
> validatehttp://teknoid.wordpress.com/2008/10/08/demystifying-auth-features-in...
>
> On Nov 30, 12:29 am, Milmar <[EMAIL PROTECTED]> wrote:
>
> > I have an "Add User" form that submits a username and apassword.
> > When I try to submit an empty username andpasswordfieldthen log it
> > in the "Users" controller (Authcomponent is used in
> > app_controller.php), the username value is returned as blank, but the
> >passwordvalue returns "ea03a66b50513f5710cb2507d7c91daecfefdab7" (may
> > be dependent on my security.salt):
>
> > [User] => Array
> >         (
> >             [username] =>
> >             [password] => ea03a66b50513f5710cb2507d7c91daecfefdab7
> >         )
>
> > I expect that no hash value would be generated since I left the
> >passwordfieldempty.
> > Also, would it be possible to validate thepasswordlength (without
> > using javascript) beforeAuthgenerates a hash value for it? Right now
> > I have avalidationfor "minimum length >=8", but that would always
> > return true since the hash value is always more than 8 characters
> > long.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Pagination & Filtering Conditions

2008-12-03 Thread Juan Sierra

I post here the way I solved in case someone found it useful as well.
I was reading several of the solutions available on the group but none
of them was working 100% for me, so I tried to figure it out the best
I could:

in the controller:

class ExpensesController extends AppController
{
...
  var $paginate = array(
 'limit' => 15,
 'order' => array(
 'Expense.stamp' => 'asc'
 )
 );
...
function index ()
{
  //set current month and year by default
  $month = date ("m");
  $year = date ("Y");

  //do we receive something from the form?
  if (
 !empty ($this->params['data']['filter']['month']['month'])
&&
 !empty ($this->params['data']['filter']['year']['year']))
 {
// yes, we forget about paging stuff
$month = $this->params['data']['filter']['month']
['month'];
$year = $this->params['data']['filter']['year']
['year'];
 }
 else
 {
//no, then maybe we are paging
if (
!empty ($this->params ['named']['filter.month']) &&
!empty ($this->params ['named']['filter.year']))
{
   $month = $this->params ['named']['filter.month'];
   $year = $this->params ['named']
['filter.year'];
}
 }

  $this->params['pass']['filter.month'] = $month;
  $this->params['pass']['filter.year'] = $year;

  $data = $this->paginate('Expense', "Expense.stamp LIKE '%$year-
$month%'");// AND Expense.stamp LIKE '%-$month-%'");
  $this->set(compact('data'));
}
...
}

in the view:

create('Expense', array('type' => 'post', 'action' =>
'index')); ?>
month ("filter.month", $this->params ["pass"]
["filter.month"], array (), false); ?>
year ("filter.year", 2000, 2020, $this->params ["pass"]
["filter.year"], array (), false); ?>
end('View'); ?>

...

params['pass']['page']); //read it somewhere in
this group, it was useful ?>
Go to Page: numbers(array('url' => $this->params
['pass'])); //it's important to pass this params.pass?>

If you see something I'm doing badly wrong or unnecesary please
advise. 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Sanitize::html replacing newlines with literal \n

2008-12-03 Thread RyOnLife


Looking at http://api.cakephp.org/sanitize_8php-source.html#l00103 it appears
that stripWhitespace() is the offending function.

I'd rather not modify the Cake core, so is there another way to change this
function to suit my needs?
-- 
View this message in context: 
http://n2.nabble.com/Sanitize%3A%3Ahtml-replacing-newlines-with-literal-%5Cn-tp1608411p1610985.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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: how can i get the page number in a model

2008-12-03 Thread ahmedhelmy007

i did it 

i passed the page current number to the (paginate) function in the
($extra) argument instead of passing it in the $limit argument,

here is the modefied code:

/// the controller //
class LessonsController extends AppController {
var $name = 'Lessons';
var $paginate = array('Lesson' => array('limit' => 2, 'page' => 1));

function friday() {
if(! isset($this->passedArgs["page"])) $pageNumber=0;
else $pageNumber=$this->passedArgs["page"]-1;

$this->paginate = Set::merge($this->paginate,
array('Lesson'=>array('limit'=>2, 'page'=>1, 'extra'=>$pageNumber)));

$this->set('lessons', $this->paginate('Lesson'));
}
}

/// the model ///
class Lesson extends AppModel {
var $name = 'Lesson';

function paginate($conditions, $fields, $order, $limit, $page = 1,
$recursive = null, $extra = array()) {

$offset=$extra["extra"];
return $this->query(
"SELECT *
FROM lessons
WHERE YEAR(created) = (
SELECT DISTINCT( YEAR(created)))
FROM lessons
ORDER BY id DESC
LIMIT $offset ,1)
ORDER BY id DESC");
}

function paginateCount($limit, $pageCount, $conditions = null,
$recursive = 0, $extra = array()) {
$results =$this->query(
"SELECT COUNT(*) count
FROM lessons
WHERE lessons.status='1'");

return $results[0][0]["count"];
}
}

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



Re: Recursive decrypt

2008-12-03 Thread Andraž

Yes.

So, any hit, how can with cipher behavior solve this thing? Or I must
do this manual?

On 3 dec., 21:17, Joel Perras <[EMAIL PROTECTED]> wrote:
> If you mean on the behaviors of associated models, then 
> no.https://trac.cakephp.org/ticket/2056
>
> -J.
>
> On Dec 3, 9:00 am, Andraž <[EMAIL PROTECTED]> wrote:
>
> > Does cake trigger callbacks on associated models?
>
> > On 3 dec., 10:56, Andraž <[EMAIL PROTECTED]> wrote:
>
> > > Any hint?
>
> > > On 2 dec., 23:31, Andraž <[EMAIL PROTECTED]> wrote:
>
> > > > Hello!
>
> > > > I'm playing with Cipher behavior (http://bakery.cakephp.org/articles/
> > > > view/cipher-behavior), but I have problems with recursive decrypt.
>
> > > > What I must change in this function, that will work with recursive
> > > > also?
>
> > > > /** Model hook to decrypt model data if auto decipher is turned on in
> > > > the
> > > >     * model behavior configuration. Only primary model data are
> > > > decrypted. */
> > > >   function afterFind(&$model, $result, $primary = false) {
> > > >     if (!$result || !isset($this->config[$model->name]['cipher']))
> > > >       return $result;
>
> > > >     if ($primary && $this->config[$model->name]['autoDecrypt']) {
> > > >       // check for single of multiple model
> > > >       $keys = array_keys($result);
> > > >       if (!is_numeric($keys[0])) {
> > > >         $this->decrypt(&$model, &$result);
> > > >       } else {
> > > >         foreach($keys as $index) {
> > > >           $this->decrypt(&$model, &$result[$index]);
> > > >         }
> > > >       }
> > > >     }
> > > >     return $result;
> > > >   }
>
> > > > Regards Andraz - Open source specialist
>
>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Recursive decrypt

2008-12-03 Thread Joel Perras

If you mean on the behaviors of associated models, then no.
https://trac.cakephp.org/ticket/2056

-J.

On Dec 3, 9:00 am, Andraž <[EMAIL PROTECTED]> wrote:
> Does cake trigger callbacks on associated models?
>
> On 3 dec., 10:56, Andraž <[EMAIL PROTECTED]> wrote:
>
> > Any hint?
>
> > On 2 dec., 23:31, Andraž <[EMAIL PROTECTED]> wrote:
>
> > > Hello!
>
> > > I'm playing with Cipher behavior (http://bakery.cakephp.org/articles/
> > > view/cipher-behavior), but I have problems with recursive decrypt.
>
> > > What I must change in this function, that will work with recursive
> > > also?
>
> > > /** Model hook to decrypt model data if auto decipher is turned on in
> > > the
> > >     * model behavior configuration. Only primary model data are
> > > decrypted. */
> > >   function afterFind(&$model, $result, $primary = false) {
> > >     if (!$result || !isset($this->config[$model->name]['cipher']))
> > >       return $result;
>
> > >     if ($primary && $this->config[$model->name]['autoDecrypt']) {
> > >       // check for single of multiple model
> > >       $keys = array_keys($result);
> > >       if (!is_numeric($keys[0])) {
> > >         $this->decrypt(&$model, &$result);
> > >       } else {
> > >         foreach($keys as $index) {
> > >           $this->decrypt(&$model, &$result[$index]);
> > >         }
> > >       }
> > >     }
> > >     return $result;
> > >   }
>
> > > Regards Andraz - Open source specialist
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Getting all the acos a aro can access?

2008-12-03 Thread Stinkbug

I asked the same question somewhere once.  I was pretty much told
since the ACL is mptt, that I would have to loop through each object
and check it that way.

That's what I'm doing.  The performance isn't the best especially in
our local development environments, but our production server is
pretty beefy, so I don't really notice any performance issues.  Not
sure how it'll hold up as the ACL grows though.

On Nov 29, 4:35 am, gk <[EMAIL PROTECTED]> wrote:
> Hi there
>
> I'm trying to work out how to get all the access control objects an
> access request object can access - for example all the blog posts a
> user can edit. Can anybody point me in the right direction on how to
> do this? Thanks very much.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: cakephp with jquery not with prototype

2008-12-03 Thread Sam Sherlock
1) enable the javascript helper
2) add $javascript->link('jquery-12.6') to your layouts/default.ctp  - also
put jquery1.2.6 in webroot/js

you can pass an array of files to the javascript->link call.
$javascript->link(Array('jquery-12.6', 'plugins/jquery-validation'))

note that you don't put file suffixes on and that in the above example
jquery-validation is in side a directory within js called plugins

There no need for a jquery helper

2008/12/3 ridwan arifandi <[EMAIL PROTECTED]>

>
> i'm a newbie in cakephp programming.
>
> cakephp uses prototype as ajax framework, but i dislike prototype just
> love jquery.
>
> i found lot of posts that discusing about cakephp with jquery, but
> none of them can satisfy me and all of them cannot work when i use
> them.
>
> before using cakephp, i have better knowledge in wordpress and i can
> use jquery within it. but with cakephp, i think it's too hard to embed
> with jquery such as ajax validatiion etc.
>
> would you like to help me give some working application with jquery.
>
> anyway, thanks for your help
>
> ps : sory for my poor english
> >
>

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



cakephp with jquery not with prototype

2008-12-03 Thread ridwan arifandi

i'm a newbie in cakephp programming.

cakephp uses prototype as ajax framework, but i dislike prototype just
love jquery.

i found lot of posts that discusing about cakephp with jquery, but
none of them can satisfy me and all of them cannot work when i use
them.

before using cakephp, i have better knowledge in wordpress and i can
use jquery within it. but with cakephp, i think it's too hard to embed
with jquery such as ajax validatiion etc.

would you like to help me give some working application with jquery.

anyway, thanks for your help

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



Problem with Phpcake

2008-12-03 Thread schneider

I had a problem with to run example application on phpcake.
Each time when I'm trying to run it , I got this error:

Fatal error: Class 'AppController' not found in

I don't know what I should do, everything is configured properly on
cakephp I have information that my connection to database is able??
wheter anybody could help me I'll be grateful


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



Re: ORM, fetching related rows of corresponding model: undefined index..

2008-12-03 Thread Joel Perras

It's a typo, and a pretty obvious one.
change $question['Answer'] to $question['Question']['Answer'] and it
should be fine, assuming there are no other typos/errors (haven't
checked).

-J.

On Dec 3, 1:27 pm, Tanay <[EMAIL PROTECTED]> wrote:
> i have two dbs questions , and answers..
>
> corresponding models
>
> questions has many answers
> answers belogns to questions
>
> in questions_controller, i have this home function
>  function home() {
>           $this->Question->recursive = 1;
>           $this->set('questions', $this->Question->find('all'));
>        }
>
> in my home.ctp, i tried to show the corresponding answers using the
> code below
> i took a question from an array of questions using foreach
> foreach question, $question['Answer'] is expected to give array of
> answers, but it says  Undefined index:  Answer
> THAT LIne is marked in code below
>
> home.ctp:
>
>     
>        No Questions yet. Be the first one to
>                  post a Question!
>     
>        
>        
>                       ?>
>                      
>              link($question['Question']['question']
>     .'?', array('action' => 'show', $question['Question']['id']))); ?>
>                               $answer_count = count($question
> ['Answer']);   //  <<-ERROR HERE
>                 if(!$answer_count)
>                    e("(no answers yet)");
>                 else if($answer_count == 1)
>                    e("(1 answer)");
>                 else
>                    e("(".$answer_count." answers)");
>               ?>
>           
>        
>        
>     
>
> the above code is a part of project in book CakePHP application
> Development,
> the code is same as in book
> is it due to some different version of cakephp that author used?
> i use latest 1.2 version
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: counterQuery, is this implemented yet?

2008-12-03 Thread BrendonKoz

I finally got around to looking at Cake's core tests.  The shown "fix"
apparently breaks 5 of Cake's test cases regarding CounterCache.  :-/
It solved my issue, but would apparently break other similar issues.
(There actually is a method in the tests called
"testCounterCacheWithSelfJoin()", so it has been tested at least -
though perhaps not thoroughly enough.  I need to take a deeper look in
to this.  At the very least, I need to come up with a test case to
prove there is a bug; considering I have an error in my code, I should
be able to easily convert that to a test case easily enough.


On Nov 18, 2:25 pm, BrendonKoz <[EMAIL PROTECTED]> wrote:
> Update: Well, I decided against using beforeSave/afterSave to write a
> manual query call and avoid counterCache...now that I'm a bit more
> clear headed, I'm not sure why.  Either way, I think I may have found
> a solution to fix this in the core, but I need to write some tests and
> submit a patch to see if the devs will approve it.  This solution may
> have a small drawback as the way things work now might be perceived by
> some as a bug, and others as a feature...I'm leaning more towards a
> missed scenario or test-case and therefore am hoping it'll be
> approved.  It's just a simple IF statement added to the
> updateCounterCache method in model.php...right before the call to
> updateAll:
>
> if($this->data[$this->alias][$assoc['foreignKey']] != null){
>  (updateAll)...
>
> }
>
> ...therefore, it won't update a row's counter on records without a
> parent.  This may only be useful to self-referencing tables, but
> without simple testing I'm having a hard time visualizing it.  :)
>
> On Nov 17, 2:16 pm,BrendonKoz<[EMAIL PROTECTED]> wrote:
>
> > counterCache was half-working when I was testing...I only tested (with
> > self-referencing tables) the creation of children nodes, not checking
> > NEW parent nodes creations...due to how updateAll works within the
> > Model::updateCounterCache method, NEW parent nodes (in a self-
> > referencing table) will first search for ALL foreign keys that match
> > NULL (in essense, getting the total number of parent nodes, including
> > itself) and using that value to update the table_count record.
>
> > In other words, it doesn't seem to work with self-referencing tables
> > (at this time?).  For my own solution, I think I'm just going to use
> > an afterSave method in my model to do what I need.  I believe it'll
> > use the same number of queries as the counterCache method was anyway.
>
> > On Oct 27, 7:25 pm,BrendonKoz<[EMAIL PROTECTED]> wrote:
>
> > > Sorry, I didn't explain my specific situation.  In my case, all I
> > > wanted to do was check to see which items in my table had children;
> > > that was all I wanted to know for my specific case.  counterCachewas
> > > all I needed, but when I couldn't get it to work (due to my own
> > > mistakes) I turned to counterQuery.  TreeBehavior was seemingly the
> > > only last option I had, but really didn't want to use (as it was huge
> > > overkill).  I ended up gettingcounterCacheto work before looking too
> > > deeply in to TreeBehavior, but I am curious to know if counterQuery is
> > > implemented in Cake 1.2 RC3.
>
> > > Thanks for the link showing how to do more with counter cache.  I like
> > > to learn as much as I can in regards to Cake.
>
> > > On Oct 27, 5:15 pm, AD7six <[EMAIL PROTECTED]> wrote:
>
> > > > On Oct 27, 8:37 pm,BrendonKoz<[EMAIL PROTECTED]> wrote:
>
> > > > > OK -CounterCachedoes work on self-joined tables (I had declared my
> > > > > association key forcounterCachein the wrong relation).  I'm still
> > > > > curious about counterQuery, however.
>
> > > > >CounterCacheis actually the best solution for my current task at
> > > > > hand, but I may like to use counterQuery at some point without the
> > > > > extra overhead of using a Tree or custom behavior.
>
> > > > If you are using the tree behavior, you really shouldn't need a self
> > > > join - I don't understand you're apparent choice between using the
> > > > tree behavior and using counterQuery/cache, they are in no way
> > > > equivalent or overlap.
>
> > > > Here's an example of how to use counter cache to do more than it does
> > > > by default:http://bin.cakephp.org/view/156582655
>
> > > > hth
>
> > > > 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: bake script doesn't save my relations

2008-12-03 Thread Adriano Varoli Piazza

Except when using var $scaffold?
I don't really understand the answer you gave.

--
Saludos
Adriano

On 16 oct, 23:22, Joel Perras <[EMAIL PROTECTED]> wrote:
> Cake does not support foreign key constraints at the dbo level.
>
> -J.
>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



ORM, fetching related rows of corresponding model: undefined index..

2008-12-03 Thread Tanay

i have two dbs questions , and answers..

corresponding models

questions has many answers
answers belogns to questions

in questions_controller, i have this home function
 function home() {
  $this->Question->recursive = 1;
  $this->set('questions', $this->Question->find('all'));
   }


in my home.ctp, i tried to show the corresponding answers using the
code below
i took a question from an array of questions using foreach
foreach question, $question['Answer'] is expected to give array of
answers, but it says  Undefined index:  Answer
THAT LIne is marked in code below

home.ctp:


   No Questions yet. Be the first one to
 post a Question!

   
   
  
 
 link($question['Question']['question']
.'?', array('action' => 'show', $question['Question']['id']))); ?>
 
  
   
   


the above code is a part of project in book CakePHP application
Development,
the code is same as in book
is it due to some different version of cakephp that author used?
i use latest 1.2 version
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: multiple email validation problem

2008-12-03 Thread rgreenphotodesign

Or you could write it into a custom function. Then call your custom
function for each of the email fields. Ie. 'email1' => array
('customFunction'), 'email2' => etc...

You do have to assign a validation to rule to each individual form
element by name, in your case email1, email2 and email3. Granted one
element can have multiple rules.


On Dec 3, 7:57 am, rgreenphotodesign <[EMAIL PROTECTED]>
wrote:
> each form field will need it's own validation rule.
>
> What you have should work, just change the name to email1, then cut/
> paste the whole rule and rename email2 etc.
>
> You could probably write something on the beforeValidates that renames
> your variables to "email", validates them, but then you'd have to get
> them back to their original variable names (email1 etc) to save in the
> DB. I assume you have 3 columns in your database? email1, email2 etc?
>
> On Dec 2, 9:27 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> wrote:
>
> > Hi there,
> > i got a problem with cake, i m using the lastest version.
>
> > i got a form with 3 email fields. email1, email2, email3.
> > and in my table, i want to record each email.
>
> > i tried to make a validation rule for email.
>
> > i got :
>
> >         var $validate = array(
> >                                   'email' => array(
> >                                                 'valid' => array(
> >                                                                         
> > 'rule' => 'email',
> >                                                                         
> > 'message' => 'Please enter a valid email address'
> >                                                  ),
> >                                                                 'unique' => 
> > array(
> >                                                                         
> > 'rule' => 'isUnique',
> >                                                                         
> > 'message' => 'This email address has already been used'
> >                                                 )
> >                                 ));
>
> > but it' doesn"t work at all. i think there's a problem with the name
> > of my form fields and the validation.
>
> > any idea ?
>
> > 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



How to add item using HABTM relation

2008-12-03 Thread Zeugme

Hi,

How to add an item to a HABTM relation ?

I have a Person and I have to add a Contract to that person.
Here are the data on a view :

data[Contract][type] : 12
data[Contract][name] : contract-AAaa
data[Contract][Person] : 26 // Should I put the person id here ?? or  
something else ??

In fact, that contract added to person 26 could be later on added to  
another Person, that's why its HABTM.
Currently, I'm trying to add a new contract to an existing person, so  
the question, but later I'm not sure how to just link an existing  
contract to an existing person ...

Here is the code on the controller to receive that data :
 function add() {
 if (!empty($this->data)) {
$this-> Contract->create();
if ($this-> Contract->save($this->data)) {
$this->set('returncode', 'Contract '.$this-> 
Contract->id.'  
saved');
} else {
$this->set('returncode', 'ERROR : Contract 
'.$this- 
 >data['Contract']['name'].' not saved');
}
 }
 }

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Validate checkbox which is not a database field

2008-12-03 Thread cronet

Hello,

I want to validate a checkbox in the model. This field is not in the
DB.

In my view:

input('policy', array('label'=>false,'div'=>false,
'type'=>'checkbox')) ?> I understand the policies



in my model:

var $validate = array(
'policy' =>
array(
'rule' => array('custom', 
'/1/'),
'message' => 'Check this box'
)
 );




But the validation progress ignores the whole policy field. Why?
How can I validate this field in the model without creating the db
field?

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



Re: save extra filed 'entity' in HABTM join tabel

2008-12-03 Thread bookme

Thanks Smelly,

my requirment is that data must be insert in entitles_tabel if I will
change name of modal specified by with than I have to use new tabel.
like:
 var $hasAndBelongsToMany = array(
'Tag' => array('className' => 'Tag',
'joinTable' => 'entities_tags',
'foreignKey' => 'entity_id',
'associationForeignKey' => 'tag_id',
'with' => 'EntitiesTag1',
 'unique' => true,
'conditions' => 'EntitiesTag1.entity = 1',
   ),
 );

If I will use modal name EntitiesTag1  than I have to use new tabel
name entities_tag1..that's not my requiremnet.

Can you write a little example using my tabel stracture that is define
above... sothat I can come out this problem also please write how
should I assign 'entity' valueinside $this->data
like: $this->data['EntitiesTag']['entity'] = 1  or something else ?

Please help  me

Thanks a lot to u and everybody

On Dec 3, 8:19 pm, Smelly_Eddie <[EMAIL PROTECTED]> wrote:
> I believe the with attribute will conflict with 'join_table' because
> the model specified by 'wiht' already knows what table it wants to
> use.
>
> You should use one or the other.
>
> I have successfully added additional fields in a HABTM using
> 'with' ..without issue
>
> > var $hasAndBelongsToMany = array(
> > 'Tag' => array('className' => 'Tag',
> > 'joinTable' => 'entities_tags',
> > 'foreignKey' => 'entity_id',
> > 'associationForeignKey' => 'tag_id',
> > 'with' => 'EntitiesTag',
> >  'unique' => true,
> > 'conditions' => 'EntitiesTag.entity = 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: save extra filed 'entity' in HABTM join tabel

2008-12-03 Thread Bookrock

Thanks Smelly,

my requirment is that data must be insert in entitles_tabel if I will
change name of modal specified by with than I have to use new tabel.
like:
 var $hasAndBelongsToMany = array(
'Tag' => array('className' => 'Tag',
'joinTable' => 'entities_tags',
'foreignKey' => 'entity_id',
'associationForeignKey' => 'tag_id',
'with' => 'EntitiesTag1',
 'unique' => true,
'conditions' => 'EntitiesTag1.entity = 1',
   ),
 );

If I will use modal name EntitiesTag1  than I have to use new tabel
name entities_tag1..that's not my requiremnet.

Can you write a little example using my tabel stracture that is define
above... sothat I can come out this problem also please write how
should I assign 'entity' valueinside $this->data
like: $this->data['EntitiesTag']['entity'] = 1  or something else ?

Please help  me

Thanks a lot to u and everybody




On Dec 3, 8:19 pm, Smelly_Eddie <[EMAIL PROTECTED]> wrote:
> I believe the with attribute will conflict with 'join_table' because
> the model specified by 'wiht' already knows what table it wants to
> use.
>
> You should use one or the other.
>
> I have successfully added additional fields in aHABTMusing
> 'with' ..without issue
>
>
>
> >     var $hasAndBelongsToMany = array(
> >                 'Tag' => array('className' => 'Tag',
> >                 'joinTable' => 'entities_tags',
> >                 'foreignKey' => 'entity_id',
> >                 'associationForeignKey' => 'tag_id',
> >                 'with' => 'EntitiesTag',
> >                  'unique' => true,
> >                 'conditions' => 'EntitiesTag.entity= 1',
> >                ),
> >          );
>
> > }- 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Current datetime in model

2008-12-03 Thread Alexey Grunichev

In this way I should replace all db-default timestamps or I'll compare
application time with db-time and they can be different (db-server is
separated from application server)

I've override AppModel with own class

class AppModel extends Model{

var $now = 'NOW()'; // mysql

function __construct()
{
parent::__construct();
$dbConfig = new DATABASE_CONFIG;
if($dbConfig->default['driver'] == 'mssql')
$this->now = 'GETDATE()';
}
}

and use $this->now in Models, but it doesn't look very good.
I hoped cake contains analog of this functionality for any db-driver,
but it seems as not.

2008/12/3 Smelly_Eddie <[EMAIL PROTECTED]>:
>
> how about
>
> $currentTime = date('Y-m-d h:i:s');  //check the format for the date
> command, I may be off.
>
> Then use $currentTime in your query
>
> On Dec 2, 8:47 am, Alexey Grunichev <[EMAIL PROTECTED]> wrote:
>> Does cake contain any functionality to pass as parametr in condition
>> function current time?
>> I need a query such as:
>> Select * from ... where exp_datetime < NOW()
>> If I passexp_datetime < NOW() in condition it won't work in MSSQL (it
>> used GETDATE())
>> I need a cross-db solution.
>>
>> I can use application time, but app and db could be located at
>> different physical servers in different time zones and in this way I
>> should replace all used default timestamps functionality in db.
>>
>> So, I wonder to know, does cake contain functionality to pass as
>> current time function as condition in Model?
> >
>

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



Re: save extra filed 'entity' in HABTM join tabel

2008-12-03 Thread Smelly_Eddie

I believe the with attribute will conflict with 'join_table' because
the model specified by 'wiht' already knows what table it wants to
use.

You should use one or the other.

I have successfully added additional fields in a HABTM using
'with' ..without issue

>     var $hasAndBelongsToMany = array(
>                 'Tag' => array('className' => 'Tag',
>                 'joinTable' => 'entities_tags',
>                 'foreignKey' => 'entity_id',
>                 'associationForeignKey' => 'tag_id',
>                 'with' => 'EntitiesTag',
>                  'unique' => true,
>                 'conditions' => 'EntitiesTag.entity = 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: PHP generated JavaScript

2008-12-03 Thread Smelly_Eddie





On Dec 3, 4:16 am, Henrik Gemal <[EMAIL PROTECTED]> wrote:
> I need to include a JavaScript URL on my page. The JavaScript needs to
> be generated by PHP.
> How do I do that?
> The PHP needs to read from the database to generate the JavaScript
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Current datetime in model

2008-12-03 Thread Smelly_Eddie

how about

$currentTime = date('Y-m-d h:i:s');  //check the format for the date
command, I may be off.

Then use $currentTime in your query

On Dec 2, 8:47 am, Alexey Grunichev <[EMAIL PROTECTED]> wrote:
> Does cake contain any functionality to pass as parametr in condition
> function current time?
> I need a query such as:
> Select * from ... where exp_datetime < NOW()
> If I passexp_datetime < NOW() in condition it won't work in MSSQL (it
> used GETDATE())
> I need a cross-db solution.
>
> I can use application time, but app and db could be located at
> different physical servers in different time zones and in this way I
> should replace all used default timestamps functionality in db.
>
> So, I wonder to know, does cake contain functionality to pass as
> current time function as condition in Model?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Understanding if a model-controller couple is needed

2008-12-03 Thread Fabio M

Thank you very much. I had reached the same conclusion while I was
waiting for replies and now you make me more self-confident.
I have no much experience in actual developing, so an extremely
minimal approach to the E-R diagram influenced me.

Again, thank you.


> Are your relationships really HABTM, or are they parent-child? I would
> think that you'd have:
>
>    1. Movies has many Reviews
>    2. Reviewers has many Reviews
>    3. Reviews belong to Movies and Reviewers
>
> On Nov 29, 11:43 am, Fabio M <[EMAIL PROTECTED]> wrote:
>

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



Re: multiple email validation problem

2008-12-03 Thread rgreenphotodesign

each form field will need it's own validation rule.

What you have should work, just change the name to email1, then cut/
paste the whole rule and rename email2 etc.

You could probably write something on the beforeValidates that renames
your variables to "email", validates them, but then you'd have to get
them back to their original variable names (email1 etc) to save in the
DB. I assume you have 3 columns in your database? email1, email2 etc?



On Dec 2, 9:27 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> Hi there,
> i got a problem with cake, i m using the lastest version.
>
> i got a form with 3 email fields. email1, email2, email3.
> and in my table, i want to record each email.
>
> i tried to make a validation rule for email.
>
> i got :
>
>         var $validate = array(
>                                   'email' => array(
>                                                 'valid' => array(
>                                                                         
> 'rule' => 'email',
>                                                                         
> 'message' => 'Please enter a valid email address'
>                                                  ),
>                                                                 'unique' => 
> array(
>                                                                         
> 'rule' => 'isUnique',
>                                                                         
> 'message' => 'This email address has already been used'
>                                                 )
>                                 ));
>
> but it' doesn"t work at all. i think there's a problem with the name
> of my form fields and the validation.
>
> any idea ?
>
> 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How to open a popup window without default layout..??

2008-12-03 Thread rgreenphotodesign

You can also use AJAX
Instead of a blank layout, make sure there is an ajax.ctp with only
echo $content_for_layout.
Create an ajax link, to the controller/blank view file.



On Dec 3, 7:48 am, Donkeybob <[EMAIL PROTECTED]> wrote:
> for the link, create a blank layout file in the layout directory.
>
> set this in the action:
> $this->layout = 'blank';
>
> easy as pie . . .read more about it 
> here:http://book.cakephp.org/view/96/Layouts
>
> On Dec 3, 2:16 am, "Aneesh S" <[EMAIL PROTECTED]> wrote:
>
> > Hi,
>
> >    Need help here. How can i open a popup window without the default layout.
> > ie i need a blank popup window to open when clicked on a link.
> > Can anyone help me with this.
>
> > Thanx in advance..
>
> > Aneesh S
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How to open a popup window without default layout..??

2008-12-03 Thread Donkeybob

for the link, create a blank layout file in the layout directory.

set this in the action:
$this->layout = 'blank';

easy as pie . . .read more about it here: 
http://book.cakephp.org/view/96/Layouts

On Dec 3, 2:16 am, "Aneesh S" <[EMAIL PROTECTED]> wrote:
> Hi,
>
>    Need help here. How can i open a popup window without the default layout.
> ie i need a blank popup window to open when clicked on a link.
> Can anyone help me with this.
>
> Thanx in advance..
>
> Aneesh S
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Pure HTML templating engine aka. total html separation in views

2008-12-03 Thread Tobiasz Cudnik

This is continuation of "total html separation in views" topic [1].

QueryTemplates [2] is a PHP templating engine using pure HTML files in
popular web 2.0 pattern load-traverse-modify using jQuery-like
chainable API.

CakeForms [3] plugin automaticaly converts HTML markup forms into
executable PHP code using CakePHP's default FormHelper. It's used to
rapidly mix designed template with CakePHP form controls. It also
handles error messages.

QT Blog [4] is a CakePHP based blog implementation created to present
various QueryTemplates usage patterns:
 * DB data injections
 * Callback sources
 * Multiple template sources
 * Form convertions

This is first public release, version 1.0 Beta1. Feedback from users
of this group is very appreciated.

[1] 
http://groups.google.com/group/cake-php/browse_thread/thread/f8a043585b2021c8/a21436a217b82a28#a21436a217b82a28
[2] http://code.google.com/p/querytemplates/
[3] http://code.google.com/p/querytemplates/wiki/CakeForms
[4] http://code.google.com/p/querytemplates/wiki/BlogImplementation
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



default order

2008-12-03 Thread yash

set the $order value in the model. this value will be used as the
default in any find.

var $order="Employee.last_name ASC";

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



PHP generated JavaScript

2008-12-03 Thread Henrik Gemal

I need to include a JavaScript URL on my page. The JavaScript needs to
be generated by PHP.
How do I do that?
The PHP needs to read from the database to generate the JavaScript

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



Re: correct way to create multiple text forms in a table

2008-12-03 Thread Todd M

Its all one form. The form goes to a model that has a belongs to
relationship to the x & y models. So the controller to initially
create the form would have

$x= $this->X->findAllBySomeId($some_id);
$this->set('x'', $x);
$y = $this->Y->findAllByDifferentId($different_id);
$this->set('y', $y);

There is a relationship between X & Y model, but I don't think that is
important for this situation.

When $x & $y are given to the view. The view will have only one form.
This form deals with the Z model. The Z model has belongsto X and
belongsToY fields. That is the Z model has a unique id, and x_id,
y_id, and value column.
An example is.
Array
(
[Z] => Array
(
[x_id] => 'value'
[y_id]=> 'value'
[description] => 'description for Z'
)
)

I wanted to use a table that is XxY wide. So in my original example
there was 2 entries for both X & Y from the findAll functions. This
would produce a 2x2 table.


The part that I don't quite understand is how to create the forms with
knowledge of the X's & Y's ID. so I know how to properly save it to
the Z model, using a saveAll. I have only had experience with doing
this one entry at a time.

Thanks for assistance in advance,
-T



On Dec 3, 1:34 am, brian <[EMAIL PROTECTED]> wrote:
> Could you query again, but without all the table display stuff? You have 4
> text boxes in a view and ... what?
>
> What's the model name, and what models is it associated to (and how)?
>
> Or is it 4 separate forms? 5?
>
> On Wed, Dec 3, 2008 at 12:27 AM, Todd M <[EMAIL PROTECTED]> wrote:
>
> > I'm creating a table where the top header row and left column are
> > text, but everything in the middle will be a text box. So if the table
> > was 5x5, there would be a 4x4 matrix of text boxes.
>
> > Each of these text inputs will represent a different entry to be saved
> > at the same model. My plan is to have one submit and the controller
> > will will call a model->saveall function. However of the text box
> > forms has a id associated to the top row and leftmost column. In other
> > words the form is saving to a model that has belongsTo association
> > with the top row and left.
>
> > Is there something that I'm missing on how to have this association
> > linked with each $form->input.
>
> > (Note:example has top left cell blank intentionally)
> > 
> >    
> >  x1
> >  x2
> > 
> > 
> >  y1
> >  text form x1/y1 for modelz
> >  text form x2/y1 for modelz
> > 
> > 
> >  y2
> >  text form x1/y2 for modelz
> >  text form x2/y2 for modelz
> > 
>
> > So the submit would save four entries into the model.
>
> > My question is how to use the form helper? And/or is there other best
> > practices out there.
>
> > The only solution that I can come up with is to not use the
> > 'Modelname.fieldname' in the naming convention and have the controller
> > parse the name into cake naming convention before saving.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Recursive decrypt

2008-12-03 Thread Andraž

Does cake trigger callbacks on associated models?

On 3 dec., 10:56, Andraž <[EMAIL PROTECTED]> wrote:
> Any hint?
>
> On 2 dec., 23:31, Andraž <[EMAIL PROTECTED]> wrote:
>
> > Hello!
>
> > I'm playing with Cipher behavior (http://bakery.cakephp.org/articles/
> > view/cipher-behavior), but I have problems with recursive decrypt.
>
> > What I must change in this function, that will work with recursive
> > also?
>
> > /** Model hook to decrypt model data if auto decipher is turned on in
> > the
> >     * model behavior configuration. Only primary model data are
> > decrypted. */
> >   function afterFind(&$model, $result, $primary = false) {
> >     if (!$result || !isset($this->config[$model->name]['cipher']))
> >       return $result;
>
> >     if ($primary && $this->config[$model->name]['autoDecrypt']) {
> >       // check for single of multiple model
> >       $keys = array_keys($result);
> >       if (!is_numeric($keys[0])) {
> >         $this->decrypt(&$model, &$result);
> >       } else {
> >         foreach($keys as $index) {
> >           $this->decrypt(&$model, &$result[$index]);
> >         }
> >       }
> >     }
> >     return $result;
> >   }
>
> > Regards Andraz - Open source specialist
>
>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Console not reporting E_NOTICE?

2008-12-03 Thread Defranco

On Nov 20, 11:33 am, "Renan Gonçalves" <[EMAIL PROTECTED]> wrote:
> Defranco,
>
> Should report if you are in development mode (debug more than 0).
> That is what that condition does.
>
> So, just increase the debug level and the E_NOTICE's will be showed.
>
> Regards,

Olá Renan,

Thanks for the reply,

As I told, I've tried debug=3 and it is still not reporting any
E_NOTICE in console test suites.

any idea?

regards

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



Fixtures not working on last nightly builds?

2008-12-03 Thread Defranco

Hi,

I've tried several different nightly build versions (November/2008
versions) after RC3 and were unable to run test suites for my
project.

Looks like fixtures are not working properly and several tests drops
due missing table issues.

Have you experienced these problems with fixtures for the last month
nightly build? It looks pretty stable except in this issue.

Any idea in how to get a test suite working version beyond RC3?

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



Re: Id missing when saving extra fields in the join table (for HABTM models)

2008-12-03 Thread Adriano Varoli Piazza

On 3 dic, 08:27, jsmale <[EMAIL PROTECTED]> wrote:
> Finally fixed the problem. Stupid me, I was running it on PHP4.
> Switched to PHP5 and it's working perfectly.
>

Shouldn't it also be working on PHP 4?

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



Re: HABTM fields type not detected in RC3

2008-12-03 Thread Jne

Hello,

can someone please help me on this matter ?

The data is retreived with :

 $this->User->id = $id;

 $params = array(
'contain' => array(
'Company',
'Skill'
)
 );

$this->data = $this->User->find('first', $params);

And $this->data has this structure :

Array
(
[User] => Array
(
[id] => 1
...
)
[Company] => Array
(
[0] => Array
(
[id] => 36
[company_type_id] => 0
[slug] => test
[name] => test
[created] => -00-00 00:00:00
[modified] => -00-00 00:00:00
[address] =>
[zip] =>
[town] =>
[state_id] => 0
[country_id] =>
[phone] =>
[website] =>
[email] =>
[banner] =>
[description] =>
[path] =>
[manager] =>
[views] => 0
[UsersCompany] => Array
(
[id] => 115
[user_id] => 1
[company_id] => 36
[is_school] => 0
[description] => test position
[start_date] => 2005-08-01
[end_date] => 2008-02-29
[current] => 0
)

)
...




All I can do now is leave the input text fields for the dates if I
want them to be saved properly.

Can this be filed as a bug if it's written properly ?

Regards,

Jérôme

PS : 'CvsController' is a controller I designed to manipulate CVs and
uses both 'User' and 'Company' model. I retreive the data with :

On 23 nov, 12:14, Jne <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I have a CV controller that Uses two models : Users and Companies
> Users HABTM Companies with a join table with :
> id (int)
> user_id (int)
> company_id (int)
> start_date (date)
> end_date (date)
> description (text)
> current(boolean)
>
> when retreiving data in my view :
>                         
>                         create('Cv', array('action' => 
> 'edit'));?>
>                         input('User.id', array('type' => 
> 'hidden'));         ?>
>                                  $form->input('Company.'.$i.'.UsersCompany.is_school',
> array('type' => 'select', 'options' => array('1' => 'School', '0' =>
> 'Work'), 'empty' => 'Type of experience ?')); ?>
>                                 
>                                          ('School name'); ?>
>                                          $ajax->autoComplete('Company.'.$i.'.name', '/cvs/
> companyComplete/'.$i); ?>
>                                 
>                                         input('Company.'.
> $i.'.UsersCompany.description');
>                                         echo 
> $form->input('Company.'.$i.'.UsersCompany.start_date');
>                                         echo 
> $form->input('Company.'.$i.'.UsersCompany.end_date', array
> ('type' => 'date', 'dateFormat' => 'MY', 'minYear' => date('Y') - 90 ,
> 'maxYear' => date('Y') + 5, 'empty' => true));
>                                         echo 
> $form->input('Company.'.$i.'.UsersCompany.current', array
> ('type' => 'checkbox'));
>
> On the first 'start_date' field, the fields is a input/text one (with
> proper value populated)
> The second one is also OK in the browser but the select fields name
> are incorrect) as it produces the following HTML :
>
> End Date name="data[Cv]" id="Cv">...
>
> where it should be :
>
> End Date name="data[Company][0][UsersCompany][EndDate][Month]" id="Cv">
>
> Am I missing something ?
>
> 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Id missing when saving extra fields in the join table (for HABTM models)

2008-12-03 Thread jsmale

Finally fixed the problem. Stupid me, I was running it on PHP4.
Switched to PHP5 and it's working perfectly.

On Dec 3, 9:09 am, jsmale <[EMAIL PROTECTED]> wrote:
> My Join table does have a primary key (http://i35.tinypic.com/
> ofozko.jpg) & all tables are InnoDB to support transactions (http://
> i36.tinypic.com/xqfhmx.jpg). However the overall type is MyISAM - is
> this a problem? If so, can it be changed?
>
> It would be nice if I could use saveAll() rather than programming the
> transaction handling into the controller.
>
> Any hints or examples would be greatly appreciated :)
>
> On Dec 3, 6:11 am, teknoid <[EMAIL PROTECTED]> wrote:
>
> > Does your join table have a primary key?
>
> > If using MySQL are your tables InnoDB? (MyISAM tables do not support
> > transactions, so it might look like it's working, but you'll run into
> > problems).
>
> > On Dec 2, 12:12 am, jsmale <[EMAIL PROTECTED]> wrote:
>
> > > Hi,
>
> > > After extensive reading, I've followed teknoid's example (http://
> > > teknoid.wordpress.com/2008/09/24/saving-extra-fields-in-the-join-table-
> > > for-habtm-models/) on how to save an extra field on a join table.
>
> > > Just one problem :( Here's the data array being saved:
> > > --
> > > Array(
> > >     [Payment] => Array(
> > >             [registry_id] => 10
> > >             [name] =>
> > >             [email] =>
> > >             [message] =>
> > >             [method] =>
> > >             [amount] => 50
> > >         )
> > >     [ItemsPayment] => Array(
> > >             [0] => Array(
> > >                     [item_id] => 18
> > >                     [amount] => 50
> > >                 )
> > >             [1] => Array(
> > >                     [item_id] => 19
> > >                     [amount] => 35
> > >                 )
> > >         )
> > > )
>
> > > Related SQL:
> > > 1. START TRANSACTION
> > > 2. INSERT INTO `payments`
> > > (`registry_id`,`name`,`email`,`message`,`method`,`amount`) VALUES
> > > (10,'','','','','50')
> > > 3. SELECT LAST_INSERT_ID() AS insertID
> > > 4. INSERT INTO `items_payments` (`item_id`,`amount`,`payment_id`)
> > > VALUES (18,'50','')
> > > 5. INSERT INTO `items_payments` (`item_id`,`amount`,`payment_id`)
> > > VALUES (19,'35','')
> > > 6. SELECT LAST_INSERT_ID() AS insertID
> > > 7. COMMIT
> > > --
>
> > > Problem is the payment_id field isn't being populated with the
> > > insertID.
>
> > > Related code from controller:
> > > $this->Payment->bindModel(array('hasMany'=>array('ItemsPayment')));
> > > $this->Payment->saveAll($this->data);
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



AW: DbAcl::allow() - Invalid node

2008-12-03 Thread Liebermann, Anja Carolin

Hi Günther,

Thanks for the link, but it doesn't help with my problem. 

It seems that all my other permissions are created with my foreach loops but 
with one controller ('Bilds') it complains about an invalid node.  It also 
doesn't exit at this stage, the other permissions after this are created.
Also when I create the permission only for this controller without the others   


$ids = array(10,11,12,13,15);
foreach($ids as $i){
 $gruppe->id = $i;
 $this->Acl->allow($gruppe, 'controllers/Bilds/');
}

I get this warning an no permission is created. It also doesn't matter for 
which group (=gruppe) I want to create this permission. 'Bilds' is like the 
others an existing aco which has as parent the 'controllers'.

Has anyone an idea how I can approach this error?

Anja

-Ursprüngliche Nachricht-
Von: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] Im Auftrag von Günther 
Theilen
Gesendet: Dienstag, 2. Dezember 2008 11:57
An: cake-php@googlegroups.com
Betreff: Re: DbAcl::allow() - Invalid node


Hi Anja,

sorry, I can't help you with your specific problem.

But maybe you want to take a look at this:
http://www.cakephpforum.net/index.php?showtopic=27&st=0
With that, I set up Auth and ACL and it works like a charm.
(You should read the entire thread, though. There are some bugfixes.)

Regards
Guenther

Liebermann, Anja Carolin schrieb:
> Hi everybody,
> 
> Today I am stuck with setting up the permissions for Auth / ACL and I 
> have the suspicion it might not only be my tired brain causing the 
> problems.  I try to set up my permissions again today, because some 
> things didn't work out as desired yesterday. So I did drop table on 
> acos and aros_acos and started with them from the start. I left aros, 
> because they look fine.
> 
> I created my Acos using the automated tool:
> http://book.cakephp.org/view/647/An-Automated-tool-for-creating-ACOs
> That filled my table nicely.
> 
> Now I am setting up my permissions on group level ("group" in German:
> "Gruppe") . I use the function initDB
> http://book.cakephp.org/view/648/Setting-up-permissions
> which I dapted for my needs.
> 
> The first lines are processed without obvious problems:
> 
>   //Allow admins to everything
>   $gruppe->id = 2;
>   $this->Acl->allow($gruppe, 'controllers');
>   //Guest are denied everything (I'm no good host)
>   $gruppe->id = 1;
>   $this->Acl->deny($gruppe, 'controllers');
> 
> 
>   ///What all other groups can see/ do
>   $ids = array(3,4,5,6,7,8,9,14,10,11,12,13,14,15);
>   foreach($ids as $i){
>$gruppe->id = $i;
>$this->Acl->deny($gruppe, 'controllers');
>$this->Acl->allow($gruppe, 'controllers','read');
>$this->Acl->allow($gruppe, 'controllers/Todos');
>$this->Acl->allow($gruppe, 'controllers/Users/edit');
> 
>   }
> 
> With the next lines my problem starts:
> 
>   //Groups, which can edit
>   $ids = array(10,11,12,13,15);
>   foreach($ids as $i){
>$gruppe->id = $i;
>$this->Acl->allow($gruppe,
> 'controllers/Bilds/','create'); //This is line 129 which throws the 
> error
>$this->Acl->allow($gruppe,
> 'controllers/Hotelinfomasters','create');
> 
> 
> With the first line ('controllers/Bilds/','create') I get an error on
> execution:
> Warning (512): DbAcl::allow() - Invalid node 
> [CORE\cake\libs\controller\components\acl.php, line 369]
> 
> $aro  =   Gruppe
> Gruppe::$name = "Gruppe"
> Gruppe::$useTable = "gruppes"
> Gruppe::$actsAs = array
> Gruppe::$hasMany = array
> Gruppe::$useDbConfig = "default"
> Gruppe::$displayField = "name"
> Gruppe::$id = 10
> Gruppe::$data = array
> Gruppe::$table = "gruppes"
> Gruppe::$primaryKey = "id"
> Gruppe::$_schema = array
> Gruppe::$validate = array
> Gruppe::$validationErrors = array
> Gruppe::$tablePrefix = ""
> Gruppe::$alias = "Gruppe"
> Gruppe::$tableToModel = array
> Gruppe::$logTransactions = false
> Gruppe::$transactional = false
> Gruppe::$cacheQueries = false
> Gruppe::$belongsTo = array
> Gruppe::$hasOne = array
> Gruppe::$hasAndBelongsToMany = array
> Gruppe::$Behaviors = BehaviorCollection object Gruppe::$whitelist = 
> array Gruppe::$cacheSources = true Gruppe::$findQueryType = NULL 
> Gruppe::$recursive = 1 Gruppe::$order = NULL Gruppe::$__exists = NULL 
> Gruppe::$__associationKeys = array Gruppe::$__associations = array 
> Gruppe::$__backAssociation = array Gruppe::$__insertID = NULL 
> Gruppe::$__numRows = NULL Gruppe::$__affectedRows = NULL 
> Gruppe::$_findMethods = array Gruppe::$_log = NULL Gruppe::$User = 
> User object Gruppe::$Aro = Aro object
> $aco  =   "controllers/Bilds/"
> $actions  =   "create"
> $value=   1
> $perms=   false
> $pe

Sanitize::html replacing newlines with literal \n

2008-12-03 Thread RyOnLife


When Sanitize::html runs on data, it is changing newlines to \n. When I look
at my data in MySQL, it's literally filled with \n characters. This renders
both PRE and nl2br() because they're looking for newlines, not the
characters \n. How can I get Sanitize::html to leave the newlines alone
instead of converting to \n? Thanks!
-- 
View this message in context: 
http://n2.nabble.com/Sanitize%3A%3Ahtml-replacing-newlines-with-literal-%5Cn-tp1608411p1608411.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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: CakePHP Unit Test Model Woes :(

2008-12-03 Thread Toad

After 2 days of reading, tweaking, swearing, bananas and nuts
driving
This worked for me, Thanks!!!

On Nov 26, 5:40 pm, Matt Curry <[EMAIL PROTECTED]> wrote:
> Here you go:http://github.com/mcurry/cakephp/tree/master/test_sample
>
> This is the template for tests that I uses.  It took me like 2 days to
> get it working, even though there are only like two differences from
> the standard baked tests.
>
> One note:  You have to include all the fixtures for associated models,
> which generally ends up being all the models.
>
> On Nov 25, 5:41 pm, pragna <[EMAIL PROTECTED]> wrote:
>
> > Hi Matt,
> > Thanks but I'm still not quite there. I have tried variations on most
> > of these calls already.
> > My test database is not empty - it has a users table but there are no
> > records in the table.  I get Error:  Database table users for model
> > User was not found if I have no users table in the 'test' DB and it
> > uses this table with the var $import = array('table' => 'name',
> > 'records' => false); line you mentioned.
> > I have been through your suggestions 1 by 1 but still don't have a
> > working test. You don't have a very simple example of a working model
> > test you could share by any chance?
> > Thanks,
> > Andy
>
> > On Nov 25, 10:04 pm, MattC <[EMAIL PROTECTED]> wrote:
>
> > > This may or may not fix your problem but:
> > > 1) You test db should be empty.  The framework will automatically
> > > create/drop the tables for each test.
> > > 2) You don't need to call "loadFixtures" at the start of each test.
> > > 3) I don't think you need to App::import your model if you use
> > > ClassRegistry::init.  Not 100% on that, and it shouldn't hurt even if
> > > you do.
> > > 4) In my fixtures I have the line:
> > > var $import = array('table' => 'name', 'records' => false);
> > > I had to use the actually table name to get everything working with
> > > ClassRegistry setting the right database.  It didn't work if I just
> > > specified the model.
>
> > > Hope that helps.
> > > -Matthttp://www.pseudocoder.com
>
> > > On Nov 25, 4:29 pm, pragna <[EMAIL PROTECTED]> wrote:
>
> > > > I've been struggling for a couple of days now to build a very simple
> > > > 'model' unit test.
>
> > > > CakePHPs "Convention over Configuration" should help me out here and
> > > > so should the Cookbook.
>
> > > > With Unit Tests though, it's quite hard to uncover the what the
> > > > conventions are. The filename conventions described in the Cookbook
> > > > (1.2) differ from, for example, the fixture files created using Bake.
> > > > Also the guys at Debuggable have re-factored and simplified the
> > > > building of model tests as well as sharing a fixturize script that
> > > > automates the building of fixtures.
>
> > > > All great stuff!
> > > > If only I could get the simplest test up and running :(
>
> > > > My failing code is 
> > > > here:http://oneyeareatingcake.blogspot.com/2008/11/cakephp-unit-test-model...
>
> > > > It is the most basic of Unit Tests on a simple findAll function in the
> > > > most basic of models. The reason this is not working has to be that
> > > > I'm breaking the convention somewhere. Maybe in file naming or in the
> > > > way I'm including the fixture?
>
> > > > I'd be very grateful if someone could get me out of this mess by
> > > > pointing out what I've got wrong.
> > > > Thanks,
> > > > Andy
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Recursive decrypt

2008-12-03 Thread Andraž

Any hint?

On 2 dec., 23:31, Andraž <[EMAIL PROTECTED]> wrote:
> Hello!
>
> I'm playing with Cipher behavior (http://bakery.cakephp.org/articles/
> view/cipher-behavior), but I have problems with recursive decrypt.
>
> What I must change in this function, that will work with recursive
> also?
>
> /** Model hook to decrypt model data if auto decipher is turned on in
> the
>     * model behavior configuration. Only primary model data are
> decrypted. */
>   function afterFind(&$model, $result, $primary = false) {
>     if (!$result || !isset($this->config[$model->name]['cipher']))
>       return $result;
>
>     if ($primary && $this->config[$model->name]['autoDecrypt']) {
>       // check for single of multiple model
>       $keys = array_keys($result);
>       if (!is_numeric($keys[0])) {
>         $this->decrypt(&$model, &$result);
>       } else {
>         foreach($keys as $index) {
>           $this->decrypt(&$model, &$result[$index]);
>         }
>       }
>     }
>     return $result;
>   }
>
> Regards Andraz - Open source specialist
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How to handle multiple templates

2008-12-03 Thread majna

http://book.cakephp.org/view/488/Themes

On Dec 3, 1:56 am, Yujin <[EMAIL PROTECTED]> wrote:
> Hi,
>
> With CakePHP, it is possible for me to switch between multiple
> templates like you can do with phpBB ?
>
> Something like
>
> http://www.phpbb.com/styles/demo/2.0/
>
> In that cause, where do i store multiple view/template files ?
>
> Thanks,
>
> Yujin
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Very Strage Routing and Cache Issue!!

2008-12-03 Thread eli_sier

My routes.php file is empty
My .htaccess file is untouched

I've noticed something very strange with routing after cake has
created its cache folders.

I can go to example.com/controller/action and everything works as
normal.

However I can also go to:

example.com/any_random_string/controller/action and still get routed
to controller/action!!!

When I remove the files inside of app\tmp\cache\persistent I then get
the usual missing controller error.

This black magick is causing me some problems at the moment. Could
anyone point me in the right direction wrt how to track down what is
causing this strangeness?




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



How to handle multiple templates

2008-12-03 Thread Yujin

Hi,

With CakePHP, it is possible for me to switch between multiple
templates like you can do with phpBB ?

Something like

http://www.phpbb.com/styles/demo/2.0/

In that cause, where do i store multiple view/template files ?

Thanks,

Yujin


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



Routing strangeness - possible bug??

2008-12-03 Thread eli_sier

Hi all,

my routes.php file is empty and .htaccess is untouched

if I access my controller like this:

example.com/controller/action

everything works as expected.

However if I access

example.com/any_random_string/controller/action

it also gets routed to example.com/controller/action??

Then if I clear app\tmp\cache\persistent and try to access example.com/
any_random_string/controller/action i get the usual missing controller
error.

Is this behaviour normal or could this be a bug?

Any ideas wrt how to hunt this problem down will be appreciated.

Thanks,
Eli

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