Re: Contain with an associated plugin

2013-06-01 Thread Larry Lutz
That did it, Cricket! I was trying to do contain 'Users.User'. As soon as I 
removed the 'Users', it worked. I didn't modify any of the plugin files. 
The CakeDC plugin is supposed to take care of the association in its model, 
so the only place I specified an association was in the Group model. I do 
have some 'Users' routes, but they have to do with login, register, etc. 
That shouldn't affect the Group model on association.

Thanks again for your help!

On Friday, May 31, 2013 10:33:05 PM UTC-5, Larry Lutz wrote:
>
> I'm having difficulty getting containable to work when the contained model 
> is in a plugin. Specifically, I have a Group model that is associated with 
> a Users (CakeDC) plugin. Normally, you just prefix the plugin model name 
> with the plugin name such as Users.User, but it seems that the Containable 
> behavior can't deal with that. Specifically, I've tried
>
> $this->set('group', $this->Group->find('first',
> array(
>'conditions' => array('Group.slug' => $slug),
>'fields' => array(
>  'Group.id',
>  'Group.name',
>  'Group.slug',
>  'Group.description',
>  ),
>  'contain'=> array(
>  'Users.User' => array(
>  'conditions' => 
> array('Users.User.group_id' => 'Group.id'),
>  'fields' => array(
>  'Users.User.id',
>  'Users.User.username',
>  'Users.User.slug',
>  'Users.User.email',
>  'Users.User.active',
>  'Users.User.last_login',
>  ),
>  'order'  => 
> array('Users.User.username' => 'asc'),
>  ),
>  ),
> )
> ));
>
> Unfortunately, that results in this error:
>
> *Error: * *UsersController* could not be found.
>
> I've also tried it without the "Users." prefix, but that yields the same 
> error. I have this in my Group model:
>
> public $hasMany = array(
> 'User' => array(
> 'className'=> 'Users.User',
> 'foreignKey'   => 'group_id',
> 'dependent'=> FALSE,
> )
> );
>
> Can anyone tell me how to handle plugin models within a contain.
>

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

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




Re: how to change a drop down based on a previously selected drop down in cakephp

2013-06-01 Thread Karey Powell
I think this is what you are looking for: 
http://www.willis-owen.co.uk/2011/11/dynamic-select-box-with-cakephp-2-0/

On Friday, 31 May 2013 09:04:42 UTC-4, sneha kulkarni wrote:
>
> hi..
> I am trying to change a drop down based on a previously selected drop down 
> ... How i should achieve the same using CakePHP.
> plz help
>

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

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




JS Link Submit or JS Submit with Class

2013-06-01 Thread Joey
I am trying to submit a form using CakePHP, but either I can't stylize the
button correctly or the form will not submit.

Basically, this question is how to submit form with a stylized
image/link/whatever using the cake routines.

Here's what I have so far:

echo $this->Js->submit ($this->Html->tag ('i', '', array ('class' =>
'icon-search icon-white')),
array ('update' => '#plot_area',
 'buffer' => false,
 'div' => false,
 'async' => true,
 'escape' => true,
 'url' => 'filterLayoutsList',
 'class' => 'btn btn-primary',
  ));

This submits the form correctly, but doesn't have my icon correct.

  echo $this->Js->link ($this->Html->tag ('i', '', array ('class' =>
'icon-search icon-white')),
  array ('controller' => 'plots', 'action'
=> 'filterLayoutsList'),
  array ('update' => '#plot_area',
 'id' => 'linkSubmit',
 'escape' => false,
 'class' => 'btn btn-primary',
 'dataExpression' => false,
 'evalScripts' => true,
 'buffer' => false,
 'data' =>
$this->Js->get('#PlotFilterLayoutsListForm')->serializeForm ()
));

This looks right, but doesn't submit my form.

I feel like I am very close, but not there.

Thank you for any advice!

Joey

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

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




Re: Routes and multilanguage site

2013-06-01 Thread lowpass
Another tip.

bootstrap:

Configure::write('Config.languages', array('eng','ned', 'deu'));

routes:

$lang_regexp = implode('|', Configure::read('Config.languages'));

Now you can use the following without having to repeat your list of langs:

'language' => $lang_regexp,


On Thu, May 30, 2013 at 4:12 AM, iFemke  wrote:

> That worked! Thanks!
>
> I feel so stupid now haha. We tried so many things and in the maintime it
> would all have worked if we had just put that part below everything else.
>
> Op donderdag 30 mei 2013 08:28:02 UTC+2 schreef Bogdan Soos het volgende:
>
>> Hi there,
>>
>> Try changing the order, nothing is being routed after your first rule, at
>> least move the first rule at the end, that should be your last rule.
>>
>> Regards,
>> Bogdan.
>>
>>  --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to cake-php+unsubscr...@googlegroups.com.
> To post to this group, send email to cake-php@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

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

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




Re: Contain with an associated plugin

2013-06-01 Thread lowpass
Do not prefix the model alias with plugin name in your find() call. All
that is for is creating the alias in the query, and then setting up the
data array. Including the plugin name in the association as you have it is
correct. The bare 'User' alias can then be used in your finds.

I presume the code you posted is in GroupsController. Do you have any
routes pointing to UsersController? Or did you modify any of the plugin
files?


On Fri, May 31, 2013 at 11:33 PM, Larry Lutz  wrote:

> I'm having difficulty getting containable to work when the contained model
> is in a plugin. Specifically, I have a Group model that is associated with
> a Users (CakeDC) plugin. Normally, you just prefix the plugin model name
> with the plugin name such as Users.User, but it seems that the Containable
> behavior can't deal with that. Specifically, I've tried
>
> $this->set('group', $this->Group->find('first',
> array(
>'conditions' => array('Group.slug' => $slug),
>'fields' => array(
>  'Group.id',
>  'Group.name',
>  'Group.slug',
>  'Group.description',
>  ),
>  'contain'=> array(
>  'Users.User' => array(
>  'conditions' =>
> array('Users.User.group_id' => 'Group.id'),
>  'fields' => array(
>  'Users.User.id',
>  'Users.User.username',
>  'Users.User.slug',
>  'Users.User.email',
>  'Users.User.active',
>  'Users.User.last_login',
>  ),
>  'order'  =>
> array('Users.User.username' => 'asc'),
>  ),
>  ),
> )
> ));
>
> Unfortunately, that results in this error:
>
> *Error: * *UsersController* could not be found.
>
> I've also tried it without the "Users." prefix, but that yields the same
> error. I have this in my Group model:
>
> public $hasMany = array(
> 'User' => array(
> 'className'=> 'Users.User',
> 'foreignKey'   => 'group_id',
> 'dependent'=> FALSE,
> )
> );
>
> Can anyone tell me how to handle plugin models within a contain.
>
> --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to cake-php+unsubscr...@googlegroups.com.
> To post to this group, send email to cake-php@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

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

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




Re: File load from server javascript cakephp2

2013-06-01 Thread lowpass
WWW_ROOT is meaningless to javascript. Also, you did not provide your
file_exists function. Or are you trying to call the php function of the
same name? That won't work. Those paths are all over the place. Of the
different paths you tried, the one beginning with '/files' looks the most
promising. Is the file sitting inside the app/webroot/files directory? Is
it readable? Does your javascript make an AJAX request for the file?
(Remember, this code is running in the browser, not on the server.) Can you
successfully make AJAX requests for other files?


On Tue, May 28, 2013 at 5:37 PM,  wrote:

>
>
> **
>
> I have a aplication in cakephp2. In home.ctp I wan't to use a javascript
> function to load a file from filesystem and create a track in a map, but I
> donnĀ“t know how to locate it.
>
> In the javascript function I declare a var with the name of the file and
> then I check if the file exists, and always return false.
>
> var gpxfile='WWW_ROOT.files.DS.hoyo.gpx';
> if(file_exists(gpxfile)){
> alert('Si existe');} else {
> alert('No existe'); }
>
> I tried with the names:
>
> var gpxfile='WWW_ROOT.files.DS.hoyo.gpx';
> var gpxfile='/app/files/hoyo.gpx';
> var gpxfile='/files/hoyo.gpx';
> var gpxfile='/webroot/files/hoyo.gpx';
>
> But nothing. How can I locate it?
>
> It is necesary to configure the core.php?
>
> Thanks
>
> --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to cake-php+unsubscr...@googlegroups.com.
> To post to this group, send email to cake-php@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

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

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




Re: connect to remote server (my sql apache)

2013-06-01 Thread lowpass
You provide the remote IP address and port # in the config. However, the
remote db must be configured to allow for network connections. Check the
remote DB config for the skip-networking and bind-address options.

Then also the DB user for the remote application must have permission to
connect. Check the mysql.user table on the *remote* server. If the Host
column for your User only includes a record for localhost then you'll need
to GRANT again for the server IP:

GRANT SELECT,INSERT,UPDATE,DELETE ON db_remote.* TO 'user'@'xxx.xxx.xxx.xxx'
IDENTIFIED BY 'thepassword';
FLUSH PRIVILEGES;

(Or db_remote.table_name if you don't require all of them to be accessed.)


On Wed, May 29, 2013 at 8:41 AM, Nikunj Amipara wrote:

> hi all,
> Does any one have any idea how to connect to remote server in cakephp???
> i have one local database which does have most of required information for
> application to run but some data is needed from remote server.
> it means i want to connect cakephp to 2 databases at a time one local and
> one remote is it possible?
> can any one help ?
>
> thanks.
>
> --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to cake-php+unsubscr...@googlegroups.com.
> To post to this group, send email to cake-php@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

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

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




Re: Is there a way to get a 'has many' relationship left joined without forcing the join such that I can get a count of the child table?

2013-06-01 Thread lowpass
ContainableBehavior doesn't work like that, unfortunately. It's a really
good addition to the toolbox, though at the cost of the extra queries. (I
use it a lot, but only where I can cache the results.) What you should be
doing is either adding the 'joins' option, or using counterCache. If all
you want is a count of the comments when listing your posts then the latter
is a good solution.

http://book.cakephp.org/2.0/en/models/associations-linking-models-together.html#belongsto


On Wed, May 29, 2013 at 5:39 AM, heavyKevy  wrote:

> I am trying to extend the blog example where my Posts belong to Users and
> Posts has many comments and to get a  query where the comments are left
> joined into the query such that I can get a comment count for  each post
> for listing out in my index page.
>
>  According to the documentation, it should be able to work, but after
> trying nearly everything I could find in the documentation including
> changing recursive to 1 and using contain, the paginate call to find_all
> still refuses to include comments in the join list such that I get an error
> that the comments.id was not found.
>
> When I get rid of the count, fields, and contain and set recursive to 1,
> it generates 2 separate queries, the first left joining the posts with the
> users,  the second querying the comments.
>
>
> Is there something I am missing?
>
> This is the Query I am expecting:
>
> SELECT `Post`.`id`, `Post`.`user_id`, `Post`.`title`, `Post`.`post`,
> `User`.`id`, `User`.`role`, `User`.`username`, `User`.`password`,
> `User`.`email`, `User`.`Avatar`, `User`.`first_name`, `User`.`last_name`,
> `User`.`created`, COUNT(`Comment`.`id`) comments FROM `blog`.`Posts` AS
> `Post` LEFT JOIN `blog`.`Comments` AS `Comment` ON (`Comment`.`Post_id` =
> `Post`.`id`) LEFT JOIN `blog`.`users` AS `User` ON (`Post`.`user_id` =
> `User`.`id`) WHERE 1 = 1 GROUP BY `Comment`.`post_id`;
>
> This is what is produced:
> SELECT `Post`.`id`, `Post`.`user_id`, `Post`.`title`, `Post`.`post`,
> `User`.`id`, `User`.`role`, `User`.`username`, `User`.`password`,
> `User`.`email`, `User`.`Avatar`, `User`.`first_name`, `User`.`last_name`,
> `User`.`created`, COUNT(`Comment`.`id`) comments FROM `blog`.`Posts` AS
> `Post` LEFT JOIN `blog`.`users` AS `User` ON (`Post`.`user_id` =
> `User`.`id`) WHERE 1 = 1 GROUP BY `Comment`.`post_id`;
>
> using this code:
> $this->Question->recursive = 1;
> $this->set('userId',$this->Auth->user('id'));
>
> $this->Question->Behaviors->load('Containable', array('autoFields'
> => false));
>
> $this->paginate =array(
> 'fields' => array('Question.id', 'Question.user_id',
> 'Question.title', 'Question.question',
> 'User.id', 'User.role', 'User.username',
> 'User.password', 'User.email', 'User.Avatar',
> 'User.first_name', 'User.last_name',
> 'User.created', 'COUNT(Comment.id)  answers'
> ),
> 'group' => 'Comment.question_id',
> 'contain' => array('User','Comment.id'));
> $this->set('questions', $this->paginate());
>
>
>  Is the only way to get it to work without using my own SQL to specify all
> the fields and force the joins?
>  Adding Joins to the options, I can force the join and it works like I
> want, but shouldn't it be able to figure out the joins by itself with the
> contain specifying the comment table?
>
> Code for options with forced Join for the comments table:
> $this->paginate =array(
> 'fields' => array('Question.id', 'Question.user_id',
> 'Question.title', 'Question.question',
> 'User.id', 'User.role', 'User.username',
> 'User.password', 'User.email', 'User.Avatar',
> 'User.first_name', 'User.last_name',
> 'User.created', 'COUNT(Comment.id)  answers'
> ),
> 'group' => 'Comment.question_id',
> 'joins' => array(array(
> 'table'=>'Comments', 'alias'=>'Comment',
> 'type'=>'LEFT',
> 'conditions'=>array('Comment.question_id =
> Question.id'))) ,
> 'contain' => array('User','Comment.id'));
>
>  --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to cake-php+unsubscr...@googlegroups.com.
> To post to this group, send email to cake-php@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

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

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop

Re: dom pdf con cake php

2013-06-01 Thread KEVIVAELKAOS
Estimado una consulta, si yo quiero mostar en el pdf los datos de la tabla 
Alumnos, la cual contiene como campos, ID, NOMBRE, DIRECCION, TELEFONO, 
etc...
como tendria que llamar a estos campos para que se logren mostrar...

Saludos

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

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