Re: problem in auth component when i was creating a login controller.

2010-06-08 Thread Narendra Padala
Thanks sir,
its working fine.!

On Tue, Jun 8, 2010 at 8:40 PM, calvin  wrote:

> Don't post the same question twice, please. You already had people
> helping you with this in the other thread.
>
> On Jun 8, 4:16 am, Narendra Padala  wrote:
> > Hi i am new to cake php, when i am  creating a login authentication using
> > app controller the following error was showed so please help me out. here
> > data base i am using postgress sql, here i dont have permission to
> chanage
> > the databse.
> >
> > this is app_controller.php
> > --
> >
> >  >
> > class AppController extends Controller {
> >
> > var $components = array('Auth', 'RequestHandler');
> >
> > var $uses = array ('Tbluser') ;
> >
> > var $helpers = array('Javascript','Html','Form','Ajax');
> >
> > function beforeFilter(){
> >
> > $this->Auth->loginAction = array('admin' => false, 'controller'
> =>
> > 'tblusers', 'action' => 'login');
> >
> > $this->Auth->authError = "Sorry, you are lacking access.";
> >
> > $this->Auth->loginError = "No, you fool! That's not the right
> > password!";
> >
> > $this->Auth->userModel = 'Tbluser';
> >
> > $this->Auth->authorize = 'tblusers';
> >
> > $this->Auth->fields = array('username' => 'struid', 'password' =>
> > 'strpid');
> >
> > $this->Auth->allow('login');
> >
> > $username = $this->Auth->user('struid');
> >
> > $id = $this->Auth->user('lnguser');
> >
> > $this->set('userId', $this->Auth->user('lnguser'));
> >
> > $this->Auth->loginRedirect = array('controller' => 'tblusers',
> > 'action' => 'index');
> >
> > }
> >
> > function isAuthorized() {
> > return true;
> > }
> >
> > }
> >
> > ?>
> >
> > Error Message :
> > 
> >
> > *Warning* (512) : Auth::isAuthorized() -
> > $authorize is set to an incorrect value.  Allowed settings are:
> > "actions", "crud", "model" or null.
> > [*CORE/cake/libs/controller/components/auth.php*, line *525*]
> > *Warning* (2) : Cannot modify header information
> > - headers already sent by (output started at
> > /var/www/wizard_auth/cake/basics.php:108)
> > [*CORE/cake/libs/controller/controller.php*, line *646*]
> >
> > Please any one can help me out...thanks in advance..!
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Cake PHP vs Zend

2010-06-08 Thread #2Will
In my mind its no contest. Use Cake.

I have used zend framework quite a bit, and when i moved to cake it
was such a massive relief. It's just so much easier to do anything in
cake than ZF. ZF just seemed over complicated, awkward and confusing.
The documentation is horrid. Ok so there is a page in the docs for
most things, but they are always isolated. Code snippets that leave
you scratching your head as to where you are supposed to put the
code.  The community here is much more helpful too.

Cake seems to have a lovely blend of having a sensible opionion on
everything (convention over configuration) and being able to customise
everything when you need to.  You arn't held hostage by the framework
when the designer or client changes a requirement slightly that
doesn't fit cake well.  That stuff seems to happen every day with
zend.  Zend didn't even really have the basic application directories
set up untill 1.9, resulting in every tutorial on the web having a
different folder structure.  Yes loosely coupled sounds cool in a
feature list but in reality it just adds to ZF's horridiy(tm).

Also, with Zend - it felt like we where having to fill in the gaps
ourselves. an obvious example is the ORM - ZF's is useless.
Relationships didn't seem to work  / needed a massive amount of
setup.  We ended up integrating doctrine & although doctrine is
gorgeous that's a lot of work just to get off the ground and
inevitably didn't integrate as well as a native orm might.

Another area of ultimate head-ache is forms. Making forms exactly how
you want them is very difficult with zend.  You have to get your head
around "decorators" just to alter the mark-up away from dl/dt lists
and it isn't easy.  So that's databases and web forms failures in
zend.  don't know about everyone else but that's quite a big
percentage of my work output right there.

Iv'e just re-read your question and realised you arn't a full time
developer.  No wonder you are finding Zend hard. Kudos if you got much
working.  And the fact you are looking at other frameworks is a
classic ZF developer trait.  I used to do it all the time.  that
feeling that this can't be the best way to make the internet is not
paranoia, it is your sub-concious stating the obvious.

and breathe.

will.






On Jun 8, 10:03 am, "Meroe Kush"  wrote:
> Folks,
>
> I'm facing a dilemma.  I'm not a programmer by profession and do this work
> as a hobby of mine.  I ask this question in all fairness and not a slide
> against any framework, but I am at a loss if I should stick with Zend or
> switch over to Cake.  
>
> The CRUD and full stack seems enticing.
>
> I'm working on what will be quite a large application with many modules,
> authentication, permissions, task tracking, risks, issues, administration
> (users, categories, organizations etc).
>
> If I ask the following question how would you respond?
>
> Why Cake over Zend or vice versa.  I know this is a loaded question and one
> that has probably been asked, buthere is another shot at it.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: General development with MVC and Cake in particular

2010-06-08 Thread Ed Propsner
It doesn't seem like the "blog" tutorial is really your thing but have you
tried it? All the fundamentals are there including functions and how they
relate to views, as well as passing data back and forth between MVC. It
really is the best place to start and any additional info can be found in
the book or the API.

http://book.cakephp.org/view/1528/Blog

http://book.cakephp.org/view/875/x1-3-Collection
http://api13.cakephp.org/

Once you get the basics down most people on this list are really great about
getting you pointed in the right direction once you start making a mess of
things 8-)

- Ed

On Tue, Jun 8, 2010 at 5:53 PM, Mike A  wrote:

> I'm new to Cake and the MVC style of programming.  I've had no luck
> finding a guide to best practices for programming this way, or even
> guides to building anything much more complicated than a blog.  I've
> been tasked with rebuilding an ancient intranet app, and I'm trying to
> use Cake to do it.  I could use a bit of advice on the best way to go
> about this.
>
> Our current app is written in Fusebox 3.  It's designed to track our
> staff vacation and sick days works as follows:
>
> 1.  user selects the employee who is taking time off
> 2.  script pulls that employees data from database A
> 3.  user is given a web form with the employees data filled in
> 4.  user selects the dates of leave and if it is charged to vacation
> and sick time, then submits the form
> 5.  script records info to database B
> 6.  web page displays the employees updated sick and vacation totals
>
> In the existing Fusebox app, I can chain a series of php pages
> together (actions, views and queries) to do all the work.  Data is
> passed from page to page via POST variables.
>
> Can someone give me advice on how to do all this in Cake?  I'm trying
> to figure out the best way.  Should I create a function in the
> controller for each step?  How can I pass that data back and forth?
>
> Thanks in advance for any advice you can give.
>
> Mike
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


controller and view extention problem.

2010-06-08 Thread fadhli -
hi everyone.

i'm new in cakephp and i want to know how to make
http://www.example.com/home/index.php in cakePHP.
controller without 's' (home not homes) and to view page i must use php
(index.php not index.ctp) extextion.

sorry. i'm not good in english.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: no flash messages in the login page using cake 1.3

2010-06-08 Thread Windex
Did you ever figure this out?  I'm running into the same issue but its
occurring with ALL flash messages.  Nothing I do seems to cause any
message to be output.

My debug level is 0 (read that anything higher will suppress the flash
output), my controllers are partly customs and partly the default add/
edit/etc actions with the cake generate flash messages.  I'm using
$this->Session->setFlash() in controllers and in my layout i'm using
$this->Session->flash(); and $this->Session->flash('auth').
$session["messages"] never seems to have anything in it and I'm not
getting any error messages.

On May 30, 6:25 pm, dtemes  wrote:
> Hi All, I am testing cake 1.3 in a new application I am building and I
> have a weird behaviour: No flash messages are shown in the login page.
> I am using Auth and ACL, and the session component and helpers are
> already in my app_controller.
>
> Seems like a new session is created everytime the user hits the login
> action of my users controller. I have some login in the login action
> to save the user IP address and log the access. any hints?
>
> Thanks in advance

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


database update file

2010-06-08 Thread Matt
Trying to learn so my apologies if I use terminology in a wonky way.

If I have a model and the data for the model is going to be kept in a
database but the database will be updated based on an XML file
somewhere. I don't want to read the XML file often because it is a
shared resource so I only want to update the database if the greatest
timemodified is < the modify date of the file.

Is the best way to do this in the view when I try to read the database
if it needs updating call a function?  If so, where should this
function live in a controller preceded by _ (eg _update_database)?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


General development with MVC and Cake in particular

2010-06-08 Thread Mike A
I'm new to Cake and the MVC style of programming.  I've had no luck
finding a guide to best practices for programming this way, or even
guides to building anything much more complicated than a blog.  I've
been tasked with rebuilding an ancient intranet app, and I'm trying to
use Cake to do it.  I could use a bit of advice on the best way to go
about this.

Our current app is written in Fusebox 3.  It's designed to track our
staff vacation and sick days works as follows:

1.  user selects the employee who is taking time off
2.  script pulls that employees data from database A
3.  user is given a web form with the employees data filled in
4.  user selects the dates of leave and if it is charged to vacation
and sick time, then submits the form
5.  script records info to database B
6.  web page displays the employees updated sick and vacation totals

In the existing Fusebox app, I can chain a series of php pages
together (actions, views and queries) to do all the work.  Data is
passed from page to page via POST variables.

Can someone give me advice on how to do all this in Cake?  I'm trying
to figure out the best way.  Should I create a function in the
controller for each step?  How can I pass that data back and forth?

Thanks in advance for any advice you can give.

Mike

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Change Hash Function problem in 1.3

2010-06-08 Thread Matthew
I followed the Simple ACL Tutorial but have a database of plain md5
passwords.

This line is storing an object of type of AppModel instead of Users.
$this->Auth->authenticate = ClassRegistry::init('Users');

The problem is when auth.php calls this (hashPasswords function):
method_exists($this->authenticate, 'hashPasswords')

It returns false.

How can I get Auth to see my custom hashPasswords function?

Here is my Users model:
lass UsersModel extends AppModel
{
var $actsAs = array('Acl' => array('type' => 'requester'));

function parentNode( ) {

if (!$this->id) {
return null;
}

$data = $this->read();

if (!$data['Users']['group_id']){
return null;
} else {
return array('model' => 'Groups', 'foreign_key' =>
$data['Users']['group_id']);
}
}

function hashPasswords($data) {
if (isset($data['Users']['password'])) {
$data['Users']['password'] = md5($data['Users']
['password']);
return $data;
}
return $data;
}
}

And here is my AppController controller:
class AppController extends Controller {

var $components = array('Acl','Auth','Session');
var $helpers = array('Session', 'Form');

var $allowed = array ('pages' => '*');

function beforeFilter(){

$this->Auth->authenticate = ClassRegistry::init('Users');
debug($this->Auth->authenticate);

//Security::setHash('md5'); //Passwords are stored as md5

$this->Auth->userModel = 'Users'; // User model is called
"Users"

$this->Auth->fields = array('username' => 'email', 'password'
=> 'password'); //Field is called email instead of username in db

//$this->Auth->autoRedirect = false;

$this->Auth->actionPath = "controllers/";

$this->Auth->authorize = 'actions';
//$this->Auth->authorize = 'controller';

$this->Auth->loginAction = array('controller' => 'users',
'action' => 'login');
$this->Auth->logoutRedirect = array('controller' => 'users',
'action' => 'login');
$this->Auth->loginRedirect = array('controller' => 'news',
'action' => 'index');
//$this->Auth->allow('display');

}

//function isAuthorized() {
//  return true;
//}

}

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: i18n broken in 1.3.2?

2010-06-08 Thread Aaron Shafovaloff
I discovered the problem was calls to __(...) etc, so it's definitely
a problem with i18n

On Jun 8, 1:04 pm, Aaron  Shafovaloff  wrote:
> If I set core.php to have
>
> Configure::write('debug', 1);
>
> Trouble is, I need this set to 0 for a number of reasons.
>
> On Jun 8, 12:26 pm, Aaron  Shafovaloff  wrote:
>
>
>
> > I get this when I run my shells in 1.3.2:
>
> > "Call to undefined method App::path() in /var/www/cake/libs/i18n.php
> > on line 264"
>
> > The 1.2 to 1.3 migration guide says:
>
> > "Configure::read('modelPaths') replaced by App::path('models')"
>
> > ... but i18n.php is a core file. Any ideas?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Cake 1.3 RSS helper generating invalid feed?

2010-06-08 Thread Steve Love
Nevermind. Had removed Configure::write('debug', 0); and forgot to put
it back in.

On Jun 8, 8:27 pm, Steve Love  wrote:
> Has anyone else been using the RSS Helper to generate feeds? After
> upgrading to 1.3.x the feed being generated is no longer valid.
>
> Just me?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: URL is showing wrong

2010-06-08 Thread Dr. Loboto
You need mod_rewrite enabled.

http://book.cakephp.org/view/37/Apache-and-mod_rewrite-and-htaccess

On Jun 7, 12:40 am, Davor Ilic  wrote:
> Hi,
>
> my url is this:http://my.site/*app/webroot/index.php/*clients/add_client
>
> why is it like this it change after time but can´t say i´ve changed
> something.
>
> i wont to show the link like this with "$html->link()" 
> :http://my.site/clients/add_client

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Cake 1.3 RSS helper generating invalid feed?

2010-06-08 Thread Steve Love
Has anyone else been using the RSS Helper to generate feeds? After
upgrading to 1.3.x the feed being generated is no longer valid.

Just me?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Need help: Plugin model issue

2010-06-08 Thread Abhimanyu Grover
This shall fix your problem:

Change:

class Account extends AppModel {
var $name = 'Account';
var $belongsTo = 'Myplugin.Client';

}

to:

class Account extends AppModel {
var $name = 'Account';
var $belongsTo = array('Client' => array('className' =>
'Myplugin.Client'));

}

On Jun 9, 5:45 am, trav  wrote:
> my bad,  i just realised that the doco has this!  Im sorry to
> waste the time of the group.
>
> On Jun 9, 10:38 am, trav  wrote:
>
> > Solution:
>
> > I needed to add the plugin prefix to the Model declare in the
> > controller.
>
> > Eg.
>
> > var $uses = array("Myplugin.Account","Myplugin.Client");
>
> > I think the doco should point this out to save time and frustration.
>
> > Thanks for your help John.
>
> > -t
>
> > On Jun 9, 10:11 am, trav  wrote:
>
> > > More information...
>
> > > if i just output the model from the controller, like this:
>
> > > pr($this->Account);die;
>
> > > returns this:
>
> > > --snip
> > > [logTransactions] =>
> > >     [cacheQueries] =>
> > >     [belongsTo] => Array
> > >         (
> > >         )
>
> > >     [hasOne] => Array
> > >         (
> > >         )
>
> > >     [hasMany] => Array
> > >         (
> > >         )
>
> > >     [hasAndBelongsToMany] => Array
> > >         (
> > >         )
>
> > >     [actsAs] =>
> > > --snip
>
> > > On Jun 9, 9:21 am, trav  wrote:
>
> > > > Hi John,
>
> > > > I have tried your suggestion and it still does not function
> > > > correctly.  Can anyone get these plugin models to work with version
> > > > 1.3.2?
>
> > > > -t
>
> > > > On Jun 8, 5:41 pm, John Andersen  wrote:
>
> > > > > Hmm, just saw that your Client model is based on AppModel, which
> > > > > according to my knowledge (the CakePHP book) it shouldn't be. The
> > > > > Client model should be based on the MyPluginAppModel! (Please correct
> > > > > me if I am wrong!!)
>
> > > > > Are debug turned on? Is the Client model used in the query at all?
> > > > > Enjoy,
> > > > >    John
>
> > > > > On Jun 8, 10:10 am, trav  wrote:> Hi John,
>
> > > > > > I have tried setting recursive to 1 and 2 and still no joy.
>
> > > > > > any other suggestions?
>
> > > > > > -t
>
> > > > > [snip]

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Question Regarding Model Grandchildren

2010-06-08 Thread cricket
On Jun 8, 4:31 pm, Dima  wrote:
> First, sorry if subject name isn't accurate; I don't know how exactly
> to phrase what I'm searching for...

I know the situation. But yours seems apt.

> Here's the issue- I have a table which generates a menu for me.  The
> table has primary_key, name, parent_id, display, order_in_list.  Below
> is a sample table with display and order_in_list removed.
> primary  key
> ...
>
> Here's roughly what the menu should look like:
>
> -MenuItemA
>     -SubItemA
>     -SubItemB
> -MenuItemB
>     -SubMenuA
>         -SubItemC
>         -SubItemD
>
> This is what my model currently is:
>
> var $hasMany = array
> (
>         'ChildNavMenu'=>array
>         (
>                 'className'=>'Navmenu',
>                 'foreignKey'=>'parent_id',
>                 'conditions'=>array
>                 (
>                         'display'=>'1'
>                 ),
>                 'order'=>'order_in_list'
>         )
> );
>
> This correctly creates children of parents, BUT fails to create
> children of children of parents (SubItemC + SubItemD in example
> above.)  Does anybody know of a way to change the $hasMany in order to
> include this critical data?
>
> Thanks,
> Dima

You'd have to create a model for the child menu items, then create a
hasMany assoc. with grandchild items.
If it were up to me, I'd use MPTT [1] and TreeBehavior. That way, you
don't need to create child (or grandchild) models. This is especially
important if the branch may go deeper. You simply have one model for
all menu items and specify the parent_id, left, and right (see
explanation at the links below). The TreeBehavior makes using this
quite simple.

[1] Modified Preorder Tree Traversal
http://www.ad7six.com/entries/view/56/Working-with-Tree-data-%28MPTT%29
http://articles.sitepoint.com/article/hierarchical-data-database
http://dev.mysql.com/tech-resources/articles/hierarchical-data.html

There's also AD76's TreeHelper. Highly recommended.
http://bakery.cakephp.org/articles/view/tree-helper-1

It can be a bit confusing to set up the templates for the helper but
it works like gangbusters. Have a look at all this and let me know if
you need some help. I can give you a complete example using a Section
model (basically, a file system hierarchy) that works really well.


Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Need help: Plugin model issue

2010-06-08 Thread trav
my bad,  i just realised that the doco has this!  Im sorry to
waste the time of the group.



On Jun 9, 10:38 am, trav  wrote:
> Solution:
>
> I needed to add the plugin prefix to the Model declare in the
> controller.
>
> Eg.
>
> var $uses = array("Myplugin.Account","Myplugin.Client");
>
> I think the doco should point this out to save time and frustration.
>
> Thanks for your help John.
>
> -t
>
> On Jun 9, 10:11 am, trav  wrote:
>
> > More information...
>
> > if i just output the model from the controller, like this:
>
> > pr($this->Account);die;
>
> > returns this:
>
> > --snip
> > [logTransactions] =>
> >     [cacheQueries] =>
> >     [belongsTo] => Array
> >         (
> >         )
>
> >     [hasOne] => Array
> >         (
> >         )
>
> >     [hasMany] => Array
> >         (
> >         )
>
> >     [hasAndBelongsToMany] => Array
> >         (
> >         )
>
> >     [actsAs] =>
> > --snip
>
> > On Jun 9, 9:21 am, trav  wrote:
>
> > > Hi John,
>
> > > I have tried your suggestion and it still does not function
> > > correctly.  Can anyone get these plugin models to work with version
> > > 1.3.2?
>
> > > -t
>
> > > On Jun 8, 5:41 pm, John Andersen  wrote:
>
> > > > Hmm, just saw that your Client model is based on AppModel, which
> > > > according to my knowledge (the CakePHP book) it shouldn't be. The
> > > > Client model should be based on the MyPluginAppModel! (Please correct
> > > > me if I am wrong!!)
>
> > > > Are debug turned on? Is the Client model used in the query at all?
> > > > Enjoy,
> > > >    John
>
> > > > On Jun 8, 10:10 am, trav  wrote:> Hi John,
>
> > > > > I have tried setting recursive to 1 and 2 and still no joy.
>
> > > > > any other suggestions?
>
> > > > > -t
>
> > > > [snip]

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Need help: Plugin model issue

2010-06-08 Thread trav
Solution:

I needed to add the plugin prefix to the Model declare in the
controller.

Eg.

var $uses = array("Myplugin.Account","Myplugin.Client");

I think the doco should point this out to save time and frustration.

Thanks for your help John.

-t




On Jun 9, 10:11 am, trav  wrote:
> More information...
>
> if i just output the model from the controller, like this:
>
> pr($this->Account);die;
>
> returns this:
>
> --snip
> [logTransactions] =>
>     [cacheQueries] =>
>     [belongsTo] => Array
>         (
>         )
>
>     [hasOne] => Array
>         (
>         )
>
>     [hasMany] => Array
>         (
>         )
>
>     [hasAndBelongsToMany] => Array
>         (
>         )
>
>     [actsAs] =>
> --snip
>
> On Jun 9, 9:21 am, trav  wrote:
>
> > Hi John,
>
> > I have tried your suggestion and it still does not function
> > correctly.  Can anyone get these plugin models to work with version
> > 1.3.2?
>
> > -t
>
> > On Jun 8, 5:41 pm, John Andersen  wrote:
>
> > > Hmm, just saw that your Client model is based on AppModel, which
> > > according to my knowledge (the CakePHP book) it shouldn't be. The
> > > Client model should be based on the MyPluginAppModel! (Please correct
> > > me if I am wrong!!)
>
> > > Are debug turned on? Is the Client model used in the query at all?
> > > Enjoy,
> > >    John
>
> > > On Jun 8, 10:10 am, trav  wrote:> Hi John,
>
> > > > I have tried setting recursive to 1 and 2 and still no joy.
>
> > > > any other suggestions?
>
> > > > -t
>
> > > [snip]

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Need help: Plugin model issue

2010-06-08 Thread Sam Sherlock
Plugin models in 1.3.2 work fine for me

Have you cleared the files from tmp after changing the plugin model as
directed by John (you might have some other such issues elsewhere - this is
why I bake plugins)

put debug to 2 and comment out the die.  Then you should see the sql output

you have this in your layout
element('sql_dump'); ?>

- S



On 9 June 2010 01:11, trav  wrote:

> More information...
>
> if i just output the model from the controller, like this:
>
> pr($this->Account);die;
>
> returns this:
>
> --snip
> [logTransactions] =>
>[cacheQueries] =>
>[belongsTo] => Array
>(
>)
>
>[hasOne] => Array
>(
>)
>
>[hasMany] => Array
>(
>)
>
>[hasAndBelongsToMany] => Array
>(
>)
>
>[actsAs] =>
> --snip
>
>
> On Jun 9, 9:21 am, trav  wrote:
> > Hi John,
> >
> > I have tried your suggestion and it still does not function
> > correctly.  Can anyone get these plugin models to work with version
> > 1.3.2?
> >
> > -t
> >
> > On Jun 8, 5:41 pm, John Andersen  wrote:
> >
> > > Hmm, just saw that your Client model is based on AppModel, which
> > > according to my knowledge (the CakePHP book) it shouldn't be. The
> > > Client model should be based on the MyPluginAppModel! (Please correct
> > > me if I am wrong!!)
> >
> > > Are debug turned on? Is the Client model used in the query at all?
> > > Enjoy,
> > >John
> >
> > > On Jun 8, 10:10 am, trav  wrote:> Hi John,
> >
> > > > I have tried setting recursive to 1 and 2 and still no joy.
> >
> > > > any other suggestions?
> >
> > > > -t
> >
> > > [snip]
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Need help: Plugin model issue

2010-06-08 Thread trav
More information...

if i just output the model from the controller, like this:

pr($this->Account);die;

returns this:

--snip
[logTransactions] =>
[cacheQueries] =>
[belongsTo] => Array
(
)

[hasOne] => Array
(
)

[hasMany] => Array
(
)

[hasAndBelongsToMany] => Array
(
)

[actsAs] =>
--snip


On Jun 9, 9:21 am, trav  wrote:
> Hi John,
>
> I have tried your suggestion and it still does not function
> correctly.  Can anyone get these plugin models to work with version
> 1.3.2?
>
> -t
>
> On Jun 8, 5:41 pm, John Andersen  wrote:
>
> > Hmm, just saw that your Client model is based on AppModel, which
> > according to my knowledge (the CakePHP book) it shouldn't be. The
> > Client model should be based on the MyPluginAppModel! (Please correct
> > me if I am wrong!!)
>
> > Are debug turned on? Is the Client model used in the query at all?
> > Enjoy,
> >    John
>
> > On Jun 8, 10:10 am, trav  wrote:> Hi John,
>
> > > I have tried setting recursive to 1 and 2 and still no joy.
>
> > > any other suggestions?
>
> > > -t
>
> > [snip]

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Need help: Plugin model issue

2010-06-08 Thread trav
Hi John,

I have tried your suggestion and it still does not function
correctly.  Can anyone get these plugin models to work with version
1.3.2?

-t

On Jun 8, 5:41 pm, John Andersen  wrote:
> Hmm, just saw that your Client model is based on AppModel, which
> according to my knowledge (the CakePHP book) it shouldn't be. The
> Client model should be based on the MyPluginAppModel! (Please correct
> me if I am wrong!!)
>
> Are debug turned on? Is the Client model used in the query at all?
> Enjoy,
>    John
>
> On Jun 8, 10:10 am, trav  wrote:> Hi John,
>
> > I have tried setting recursive to 1 and 2 and still no joy.
>
> > any other suggestions?
>
> > -t
>
> [snip]

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Question Regarding Model Grandchildren

2010-06-08 Thread Dima
First, sorry if subject name isn't accurate; I don't know how exactly
to phrase what I'm searching for...

Here's the issue- I have a table which generates a menu for me.  The
table has primary_key, name, parent_id, display, order_in_list.  Below
is a sample table with display and order_in_list removed.
primary  key
|name
||parent_id
|| |
|| |
1   MenuItemA   0
2   MenuItemB   0
3   SubItemA  1
4   SubItemB  1
5   SubMenuA2
6   SubItemC 5
7   SubItemD 5

Here's roughly what the menu should look like:

-MenuItemA
-SubItemA
-SubItemB
-MenuItemB
-SubMenuA
-SubItemC
-SubItemD

This is what my model currently is:

var $hasMany = array
(
'ChildNavMenu'=>array
(
'className'=>'Navmenu',
'foreignKey'=>'parent_id',
'conditions'=>array
(
'display'=>'1'
),
'order'=>'order_in_list'
)
);

This correctly creates children of parents, BUT fails to create
children of children of parents (SubItemC + SubItemD in example
above.)  Does anybody know of a way to change the $hasMany in order to
include this critical data?

Thanks,
Dima

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


URL is showing wrong

2010-06-08 Thread Davor Ilic
Hi,

my url is this: http://my.site/*app/webroot/index.php/*clients/add_client

why is it like this it change after time but can´t say i´ve changed
something.

i wont to show the link like this with "$html->link()" :
http://my.site/clients/add_client

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: i18n broken in 1.3.2?

2010-06-08 Thread Aaron Shafovaloff
If I set core.php to have

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

Trouble is, I need this set to 0 for a number of reasons.

On Jun 8, 12:26 pm, Aaron  Shafovaloff  wrote:
> I get this when I run my shells in 1.3.2:
>
> "Call to undefined method App::path() in /var/www/cake/libs/i18n.php
> on line 264"
>
> The 1.2 to 1.3 migration guide says:
>
> "Configure::read('modelPaths') replaced by App::path('models')"
>
> ... but i18n.php is a core file. Any ideas?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: SQL DUMP in Comtroller

2010-06-08 Thread Theodoro
John, but in this case I have to render an action to view the dump.
I'm wanting to see the dump is already in the controller, as it was in
cake 1.2!!

example:
$ This-> Model-> find (); die;
I see the dump! At 1.2

already in 1.3 does not!

On 8 jun, 10:28, John Andersen  wrote:
> Read the migration chapter in the CakePHP book 
> at:http://book.cakephp.org/view/1567/Model-Databases-and-Datasources
>
> The last section explains how to get the sql dump.
> Enjoy,
>    John
>
> On Jun 8, 4:24 pm, Theodoro  wrote:
>
> > The controller after a find, if I apply a die he showed the SQL DUMP,
> > but in cake 1.3 it did not take place! How do I show an SQL dump of
> > the Controller?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


i18n broken in 1.3.2?

2010-06-08 Thread Aaron Shafovaloff
I get this when I run my shells in 1.3.2:

"Call to undefined method App::path() in /var/www/cake/libs/i18n.php
on line 264"

The 1.2 to 1.3 migration guide says:

"Configure::read('modelPaths') replaced by App::path('models')"

... but i18n.php is a core file. Any ideas?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


issue with parameters in url

2010-06-08 Thread mdb
Hi All,

I have a banner image in default layout which is displayed on each
page. But when i pass parameters in the URL the image is not
displayed.

Example: /users/index works fine
but
/users/index?id=1 doesnt display the image

Please Help
mdb

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Query question(s)

2010-06-08 Thread Ed Propsner
@Calvin:

I do like the idea of using array_sum() and storing the options as an INT,
I've taken this approach in the past with a different app (once) and it
worked out just fine. In this case let's say you have a value of 3 stored in
the db representing 2 options ... '1' => 'video, '2' => 'audio. A search on
that column would only hit on an exact match, no? I only need the stored
value and the search criteria to have one of their values in common, not
all. In this case if a user searched just '1' => 'video' it should return
the column containing the value of 3 because both the search and the stored
data have '1' => 'video' in common.

I won't stress the checkbox search too much at this time. I did get it
working without writing any kind of custom query. The query itself is to the
point but checking the values of the array and setting up the $orOptions to
account for each possibility was a tad lengthy. About the checkboxes ...
well ... I was submitting them as separate input fields instead of one
'multiple' ... don't ask! 8-).

The query giving me problems at this time is the advanced search. It's not
much a problem more than I'm unsure of how to approach it. I want to toy
around with it for a bit then I'll let know what issues I'm having.

@John:

[quote]

When the user submits the search, the first thing I do, is to save the
search parameters in the database (Enquiry model), so as to get an ID..

[/quote]

Errr ... Something came up and I have to leave the house but I have a few
questions for ya' ... I'll get back you when I get back in.

On Tue, Jun 8, 2010 at 3:38 AM, John Andersen wrote:

> This may not be relevant to your issue, but maybe to your solution. I
> will try to explain how I did my search functionality.
>
> In my application, the user will search for a specific object
> (Article, Author, Blog, etc.), not a combination of these.
>
> The search form provides the following entries:
> Words [text] - one or more words
>
> Word criteria [radiogroup] - :
> 1) must contain all words.
> 2) must contain at least one word.
> 3) must contain exact phrase.
>
> Search criteria [checkbox] - :
> 1) In title (default).
> 2) In summary.
> 3) In body.
>
> Category(ies) [checkbox] - all categories.
>
> When the user submits the search, the first thing I do, is to save the
> search parameters in the database (Enquiry model), so as to get an ID.
>
> The search parameters are then passed on to the responsible model
> (Article, Author, Blog, etc), which then performs the actual search.
> The resulting rows (ids) are passed back to the Enquiry model, which
> saves the result (creates relationships between Enquiry model and
> responsible model).
>
> I then uses the ID to paginate the result, when presenting it to the
> user.
>
> Building the search query:
> 1) I split into single words from the Words entry.
> 2) Based on the Word criteria, I prepare the respective AND, OR, or
> phrase condition(s) for all possible Search criteria. That is one for
> Title, one for Summary and one for Body.
> 3) Based on the Search criteria, I include the respective conditions
> for Title, Summary and/or Body.
>
> The resulting find conditions looks like this (Words equal "a b c",
> Word criteria "must contain all words", Search critera "In title, In
> summary, In body":
> [code]
> Array
> (
>   [OR] => Array
>  (
> [0] => Array
>(
>   [AND] => Array
>  (
> [0] => Array
>(
>   [LOWER(Article.title) LIKE] => %a%
>)
> [1] => Array
>(
>   [LOWER(Article.title) LIKE] => %b%
>)
> [2] => Array
>(
>   [LOWER(Article.title) LIKE] => %c%
>)
>  )
>)
> [1] => Array
>(
>   [AND] => Array
>  (
> [0] => Array
>(
>   [LOWER(Article.summary) LIKE] => %a%
>)
> [1] => Array
>(
>   [LOWER(Article.summary) LIKE] => %b%
>)
> [2] => Array
>(
>   [LOWER(Article.summary) LIKE] => %c%
>)
>  )
>)
> [2] => Array
>(
>   [AND] => Array
>  (
> [0] => Array
>(
>   [LOWER(Article.content) LIKE] => %a%
>)
> [1] => Array
>(
>   [LOWER(Article.content) LIKE] => %b%
>)
> [2] => Array
>(
> 

How php form availabilities do you know?

2010-06-08 Thread LoveYou
Hey!
I have such question: How php form availabilities do you know? PHP
Form have different varifications and functions such as form
generator, form creator, form builder... And Can php form keeps in
touch with java script?
http://phpforms.net/tutorial/html-basics/php-forms.html

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: cakephp cms with CCK Funcionality

2010-06-08 Thread calvin
I would suggest giving a text description of what the video is in,
both, this thread and your YouTube video description. You may also
want to record a new video where you narrate what you are doing
(perhaps including a clear and audible intro at the start of the
video, explaining to viewers the purpose of the video). An explanation
of what "CCK" is would also be helpful.

On Jun 7, 7:38 pm, Toan Nguyen Dinh  wrote:
> i 'm still working. i hope get more tips from all members
>
> http://www.youtube.com/watch?v=j4JFlTNvDYM
>
> thanks
>
> kind regards

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: difficulty with report component

2010-06-08 Thread calvin
Perhaps you should explain your solution in case someone else
encounters the same problem in the future.

Also, if a Bakery admin is reading this, please remove the spam
comment at the bottom of this page:
http://bakery.cakephp.org/articles/view/report-creator-component

On Jun 8, 8:37 am, butterlamb  wrote:
> Nevermind. I figured out the fix a while back.
>
> On May 4, 9:31 am, butterlamb  wrote:
>
> > Hello,
>
> > I'm having difficulty implementing the report component that was
> > posted in the bakery some time 
> > ago:http://bakery.cakephp.org/articles/view/report-creator-component
>
> > Since I'm using Cake 1.2.6, I modified it as suggested further down in
> > the comments, but I'm getting the below fatal error when I try to run
> > the reports:
>
> > Fatal error: Class '' not found in [path/to/component/class] on line
> > 78
>
> > The line in question is:
>
> > $this-> model = new $value;
>
> > I'm wondering if anyone has had any luck using this in 1.2, and if so,
> > do you have any suggestions on how to fix this?
>
> > Best,
> > butterlamb
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others 
> > with their CakePHP related questions.
>
> > You received this message because you are subscribed to the Google Groups 
> > "CakePHP" group.
> > To post to this group, send email to cake-php@googlegroups.com
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> > athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: User errors and fat model, skinny controller

2010-06-08 Thread calvin
Thanks for your reply. It's good to know that I'm on the right track.
I guess part of what was tripping me up was wanting to have high-level
Model functions when in actuality some of them belonged in the
controller since they contained application flow logic/requirements.
And I've also decided that returning a mixed data array with some kind
of a status structure is the best way to go. I'm also in the process
to implementing an event logger in my application to track errors,
anomalous conditions, and possibly usage patterns.

It's also interesting that you mentioned your method for importing CSV
data as an example as that's the exact problem I was working on when I
wrote the original post. I haven't tried offloading data processing to
a background task, but I may have to investigate that approach as some
of my CSV spreadsheets can take quite a while to process as well (it's
an intranet app, so I just increase the max script execution time). By
the way, you wouldn't happen to have found a way to import .xls (Excel
spreadsheet) data have you? My data sets (sales data from various
distributors) almost always comes in the form of Excel xls
spreadsheets or, occasionally, Excel html spreadsheets. The html
spreadsheets are pretty easy to deal with since they're just HTML
tables with some proprietary tags and attributes, but as yet I've
found no way to process or automatically convert XLS data to something
readable like CSV.

On Jun 7, 9:06 am, LunarDraco  wrote:
> I've been using fat model for a while now. It was difficult for me to
> get over what now appear to insignificant problems but at the time
> they looked huge.
>
> As the model's primary responsibility is to deal with data, I found it
> useful to always return something more than a boolean. So most of my
> model functions return a mixed data array.
> Part of that result array is a status structure which I can then refer
> to from the controller to display errors or redirect etc. This also
> allows the model to process a set of data and return an iterative list
> of errors. As an example I have a csv import which will process the
> first 100 rows of an import. Each row has the potential of creating an
> error, and the loop moves on to the next row. all these errors are
> returned in a single result. The model then passes the file to a
> background task to process the remainder of the rows. The controller
> displays via the view to the user the results of the first 100 rows
> along with the list of errors. I did this because some of these files
> are huge and would timeout. I can process 100 rows fairly quick and
> return control back to the user where they can see those newly
> imported records along with any errors.
>
> A second reason for this process is the model code doesn't know if it
> is being called by human interaction or via a cron script in either
> case the errors are also written to a logger which the user can review
> at any point in the app.
>
> In a previous post to this thread you mentioned you needed to redirect
> in certain conditions. Don't get your business logic (model) confused
> with your application flow (controller). A lighter controller doesn't
> mean there isn't any logic in those functions it just means there is
> less logic in them. Logic to control redirects definitely does belong
> in the controller and your model needs to be able to give enough
> information back to the controller to make those decisions.
>
> I've also found building test for the models is a lot easier than for
> the controller. If your using test do your best to write the test
> first. If your not using test, at least think in the mindset of the
> model code being called from human interaction as well as from a
> headless script. This will force you to deal with errors in a batch
> mode instead of one off exceptions.
>
> Overall your on the right track your making your model fat and you
> have identified the model is too deep for direct human interaction. I
> think there are many ways to deal with this without breaking the MVC
> pattern.
>
> My method explained above may seam too much for some, but having the
> errors logged and being able to review them has helped in identifying
> pieces of code which were in need of rework. A type of live profiling.
> Not so much of the performance but more so on quality and intuitive
> use or to identify poor assumptions on my part about the ability of my
> users.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: difficulty with report component

2010-06-08 Thread butterlamb
Nevermind. I figured out the fix a while back.

On May 4, 9:31 am, butterlamb  wrote:
> Hello,
>
> I'm having difficulty implementing the report component that was
> posted in the bakery some time 
> ago:http://bakery.cakephp.org/articles/view/report-creator-component
>
> Since I'm using Cake 1.2.6, I modified it as suggested further down in
> the comments, but I'm getting the below fatal error when I try to run
> the reports:
>
> Fatal error: Class '' not found in [path/to/component/class] on line
> 78
>
> The line in question is:
>
> $this-> model = new $value;
>
> I'm wondering if anyone has had any luck using this in 1.2, and if so,
> do you have any suggestions on how to fix this?
>
> Best,
> butterlamb
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Using Javascript->link Inside An Element

2010-06-08 Thread calvin
I know, it sucks. I think I did manage to achieve a similar result in
a very roundabout way in one of my older applications, but it's not
really worth the hassle; Cake just isn't set up for it.

On Jun 8, 7:15 am, Dima  wrote:
> My original implementation did exactly what you describe but I was
> hoping that it could be done otherwise.  Guess not.
>
> Thanks,
> Dima
>
> On Jun 7, 8:12 pm, calvin  wrote:
>
> > You only use echo when you're linking them inline. So you would never
> > have something like:
>
> > echo $javascript->link($scriptname, false);
>
> > It would either be:
>
> > echo $javascript->link($scriptname);
>
> > or:
>
> > $javascript->link($scriptname, false);
>
> > Unfortunately, you can't use the $scripts_for_layout variable in the
> > layout or elements included from the layout because usually by that
> > point the variable has already been printed out.
>
> > Your best bet would be to just place inline link calls in the header
> > section of the layout.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: URL is showing wrong

2010-06-08 Thread calvin
Check your web server configurations. Cake usually generates urls like
that when you set your www_root/document_root to the / instead of /app/
webroot .

On Jun 8, 7:35 am, Davor Ilic  wrote:
> This is my code which i use to display my link:  
>   $ui_Url): ?>
>  
>  
>  link($ui_naviName,
>
>  array('controller'=>'clients','action'=>$ui_Url),
>
>   array('class'=>'gpFloatLeft')
>
>   ) ?>
>  
>
>  link('',
>  array('controller'=>'clients','action'=>'add_client'),
>  array('class'=>'ui_icons ui_icon_add gpFloatLeft tool-tip','title'=>'')
>  ) ?>
>  
>  
>  
>  
>  
>   and this is my route.php:   Router::connect('/', array('controller'
> => 'clients', 'action' => 'index'));
> 2010/6/7 John Andersen 
>
> > Yes, I understand what the result is, but which code (please show) is
> > the base for the link?
> > Have you defined any routes that may affect this - if yes, then show
> > them too!
> > Which folder is your webroot set to in your web server? Is it the app
> > folder or the app/webroot folder?
> > Enjoy,
> >   John
>
> > On Jun 7, 5:36 pm, Davor Ilic  wrote:
> > >  this creates link "
> >http://my.site/*app/webroot/index.php/*clients/add_client";
> > > but i want to tell link to show it without
> > > *app/webroot/index.php/ it should look like this url *
> >http://my.site/clients/add_client.
>
> > > thanks
>
> > > 2010/6/7 John Andersen 
>
> > > > And I were too fast here, sorry for that!
>
> > > > What is the code that creates the link?
> > > > Enjoy,
> > > >   John
>
> > > > On Jun 7, 4:28 pm, Davor Ilic  wrote:
> > > > > does anybody else have this issue too?
>
> > > > > 2010/6/6 Davor Ilic 
>
> > > > > > Hi,
>
> > > > > > my url is this:
> > > >http://my.site/*app/webroot/index.php/*clients/add_client
>
> > > > > > why is it like this it change after time but can´t say i´ve changed
> > > > > > something.
>
> > > > > > i wont to show the link like this with "$html->link()" :
> > > > > >http://my.site/clients/add_client
>
> > > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp
> > others
> > > > with their CakePHP related questions.
>
> > > > You received this message because you are subscribed to the Google
> > Groups
> > > > "CakePHP" group.
> > > > To post to this group, send email to cake-php@googlegroups.com
> > > > To unsubscribe from this group, send email to
> > > > cake-php+unsubscr...@googlegroups.com
> > >For
> > more options, visit this group at
> > > >http://groups.google.com/group/cake-php?hl=en
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others
> > with their CakePHP related questions.
>
> > You received this message because you are subscribed to the Google Groups
> > "CakePHP" group.
> > To post to this group, send email to cake-php@googlegroups.com
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.comFor
> >  more options, visit this group at
> >http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: problem in auth component when i was creating a login controller.

2010-06-08 Thread calvin
Don't post the same question twice, please. You already had people
helping you with this in the other thread.

On Jun 8, 4:16 am, Narendra Padala  wrote:
> Hi i am new to cake php, when i am  creating a login authentication using
> app controller the following error was showed so please help me out. here
> data base i am using postgress sql, here i dont have permission to chanage
> the databse.
>
> this is app_controller.php
> --
>
> 
> class AppController extends Controller {
>
>     var $components = array('Auth', 'RequestHandler');
>
>     var $uses = array ('Tbluser') ;
>
>     var $helpers = array('Javascript','Html','Form','Ajax');
>
>     function beforeFilter(){
>
>         $this->Auth->loginAction = array('admin' => false, 'controller' =>
> 'tblusers', 'action' => 'login');
>
>         $this->Auth->authError = "Sorry, you are lacking access.";
>
>         $this->Auth->loginError = "No, you fool! That's not the right
> password!";
>
>         $this->Auth->userModel = 'Tbluser';
>
>         $this->Auth->authorize = 'tblusers';
>
>         $this->Auth->fields = array('username' => 'struid', 'password' =>
> 'strpid');
>
>         $this->Auth->allow('login');
>
>         $username = $this->Auth->user('struid');
>
>         $id = $this->Auth->user('lnguser');
>
>         $this->set('userId', $this->Auth->user('lnguser'));
>
>         $this->Auth->loginRedirect = array('controller' => 'tblusers',
> 'action' => 'index');
>
>     }
>
>     function isAuthorized() {
>             return true;
>     }
>
> }
>
> ?>
>
> Error Message :
> 
>
> *Warning* (512) : Auth::isAuthorized() -
> $authorize is set to an incorrect value.  Allowed settings are:
> "actions", "crud", "model" or null.
> [*CORE/cake/libs/controller/components/auth.php*, line *525*]
> *Warning* (2) : Cannot modify header information
> - headers already sent by (output started at
> /var/www/wizard_auth/cake/basics.php:108)
> [*CORE/cake/libs/controller/controller.php*, line *646*]
>
> Please any one can help me out...thanks in advance..!

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Problems with $model->find() in nest conditions

2010-06-08 Thread calvin
Cake doesn't do joins automatically with hasOne/Many or belongsTo
associations. Instead, it fetches the data from the first table, then
it performs additional queries to get the associated data.

You'll have to specify the joins manually if you want to base a find
condition on associated data:
http://book.cakephp.org/view/1047/Joining-tables

On Jun 7, 3:28 pm, jamc  wrote:
> Hello Friends, I want to do a query like this:
>
> $Anuncio->Inmueble->Zona
>
> where Anuncio hasOne Inmueble and Inmueble belongsTo Zona,
> obtain data works perfect, but the problem is to filter Anuncios
> according to one Zona.ciudad_id
> for that I am doing this:
> $this->Anuncio->find('all', array('conditions' => array(
>                                               'Zona.ciudad_id' =>
> $idCiudad
> )))
>
> where I can get $ciudadId with 'GET'.
>
> do it that way gives me the following error:
>
> SQL Error: 1054: Unknown column 'Zona.ciudad_id' in 'where clause'
>
> can someone please tell me how I can make that kind of conditions?
>
> Note: Excuse me, but I do not write English very well

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: URL is showing wrong

2010-06-08 Thread Davor Ilic
This is my code which i use to display my link:  
  $ui_Url): ?>
 
 
 link($ui_naviName,

 array('controller'=>'clients','action'=>$ui_Url),

  array('class'=>'gpFloatLeft')

  ) ?>
 

 link('',
 array('controller'=>'clients','action'=>'add_client'),
 array('class'=>'ui_icons ui_icon_add gpFloatLeft tool-tip','title'=>'')
 ) ?>
 
 
 
 
 
  and this is my route.php:   Router::connect('/', array('controller'
=> 'clients', 'action' => 'index'));
2010/6/7 John Andersen 

> Yes, I understand what the result is, but which code (please show) is
> the base for the link?
> Have you defined any routes that may affect this - if yes, then show
> them too!
> Which folder is your webroot set to in your web server? Is it the app
> folder or the app/webroot folder?
> Enjoy,
>   John
>
> On Jun 7, 5:36 pm, Davor Ilic  wrote:
> >  this creates link "
> http://my.site/*app/webroot/index.php/*clients/add_client";
> > but i want to tell link to show it without
> > *app/webroot/index.php/ it should look like this url *
> http://my.site/clients/add_client.
> >
> > thanks
> >
> > 2010/6/7 John Andersen 
> >
> > > And I were too fast here, sorry for that!
> >
> > > What is the code that creates the link?
> > > Enjoy,
> > >   John
> >
> > > On Jun 7, 4:28 pm, Davor Ilic  wrote:
> > > > does anybody else have this issue too?
> >
> > > > 2010/6/6 Davor Ilic 
> >
> > > > > Hi,
> >
> > > > > my url is this:
> > >http://my.site/*app/webroot/index.php/*clients/add_client
> >
> > > > > why is it like this it change after time but can´t say i´ve changed
> > > > > something.
> >
> > > > > i wont to show the link like this with "$html->link()" :
> > > > >http://my.site/clients/add_client
> >
> > > Check out the new CakePHP Questions sitehttp://cakeqs.organd help
> others
> > > with their CakePHP related questions.
> >
> > > You received this message because you are subscribed to the Google
> Groups
> > > "CakePHP" group.
> > > To post to this group, send email to cake-php@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > cake-php+unsubscr...@googlegroups.com
> >For
> more options, visit this group at
> > >http://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Using Javascript->link Inside An Element

2010-06-08 Thread Dima
My original implementation did exactly what you describe but I was
hoping that it could be done otherwise.  Guess not.

Thanks,
Dima

On Jun 7, 8:12 pm, calvin  wrote:
> You only use echo when you're linking them inline. So you would never
> have something like:
>
> echo $javascript->link($scriptname, false);
>
> It would either be:
>
> echo $javascript->link($scriptname);
>
> or:
>
> $javascript->link($scriptname, false);
>
> Unfortunately, you can't use the $scripts_for_layout variable in the
> layout or elements included from the layout because usually by that
> point the variable has already been printed out.
>
> Your best bet would be to just place inline link calls in the header
> section of the layout.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: SQL DUMP in Comtroller

2010-06-08 Thread John Andersen
Read the migration chapter in the CakePHP book at:
http://book.cakephp.org/view/1567/Model-Databases-and-Datasources

The last section explains how to get the sql dump.
Enjoy,
   John

On Jun 8, 4:24 pm, Theodoro  wrote:
> The controller after a find, if I apply a die he showed the SQL DUMP,
> but in cake 1.3 it did not take place! How do I show an SQL dump of
> the Controller?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


SQL DUMP in Comtroller

2010-06-08 Thread Theodoro
The controller after a find, if I apply a die he showed the SQL DUMP,
but in cake 1.3 it did not take place! How do I show an SQL dump of
the Controller?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Duplicate Queries in MODEL->HABTM->HABTM->HasMany relationship

2010-06-08 Thread John Andersen
This is a frequent topic, retrieving data from models over several
levels of association.

The current answers nearly always are:

1) Look into using the Containable behavior, see:
http://book.cakephp.org/view/1323/Containable

2) Look into using joins, see:
http://book.cakephp.org/view/1047/Joining-tables

The above should make it possible for you to avoid the additional
queries.
Enjoy,
   John


On Jun 8, 1:10 pm, pinker42  wrote:
> Hi,
>
> i urgently need some help with a really nasty problem.
>
> I have 4 main tables A,B,C,D and two join tables AB, BC joined: A (1
> record) -> (HABTM AB) B (13 records) -> (HABTM BC) C (131 records) ->
> (hasMany) D (405 records). When i fetch the data with A->find('All')
> cake does a good job for A,B and C. But than repeats the Query for D
> 13 times (number of records for B !).
> The result set is okay, but the performance is really sad, because the
> result set for D is quite Huge. Is it not possible to handle 
> MODEL->HABTM->HABTM->HasMany releationships with simple model binds in
>
> Cake ?
>
> Best regards and thanks in advance
>
> Dirk

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: problem in auth component when i was creating a login controller.

2010-06-08 Thread Jeremy Burns
Read the error message and obey:

You have:  $this->Auth->authorize = 'tblusers';

The error says:

> Warning (512): Auth::isAuthorized() - $authorize is set to an incorrect 
> value.  Allowed settings are: "actions", "crud", "model" or null. 
> [CORE/cake/libs/controller/components/auth.php, line 525]


Jeremy Burns
jeremybu...@me.com


On 8 Jun 2010, at 12:16, Narendra Padala wrote:

> Hi i am new to cake php, when i am  creating a login authentication using app 
> controller the following error was showed so please help me out. here data 
> base i am using postgress sql, here i dont have permission to chanage the 
> databse.
> 
> 
> this is app_controller.php
> --
> 
>  
> class AppController extends Controller {
> 
> var $components = array('Auth', 'RequestHandler');
> 
> var $uses = array ('Tbluser') ; 
> 
> var $helpers = array('Javascript','Html','Form','Ajax');
> 
> function beforeFilter(){
> 
> $this->Auth->loginAction = array('admin' => false, 'controller' => 
> 'tblusers', 'action' => 'login');
> 
> $this->Auth->authError = "Sorry, you are lacking access.";
> 
> $this->Auth->loginError = "No, you fool! That's not the right 
> password!";
> 
> $this->Auth->userModel = 'Tbluser';
> 
> $this->Auth->authorize = 'tblusers';
> 
> $this->Auth->fields = array('username' => 'struid', 'password' => 
> 'strpid');
> 
> $this->Auth->allow('login');
> 
> $username = $this->Auth->user('struid');
> 
> $id = $this->Auth->user('lnguser');
> 
> $this->set('userId', $this->Auth->user('lnguser'));
> 
> $this->Auth->loginRedirect = array('controller' => 'tblusers', 
> 'action' => 'index');
> 
> }
> 
> function isAuthorized() {
> return true;
> }
> 
> }
> ?>
> 
> 
> Error Message :
> 
> 
> Warning (512): Auth::isAuthorized() - $authorize is set to an incorrect 
> value.  Allowed settings are: "actions", "crud", "model" or null. 
> [CORE/cake/libs/controller/components/auth.php, line 525]
> 
> Warning (2): Cannot modify header information - headers already sent by 
> (output started at /var/www/wizard_auth/cake/basics.php:108) 
> [CORE/cake/libs/controller/controller.php, line 646]
> 
> 
> 
> Please any one can help me out...thanks in advance..!
> 
> 
> 
> Check out the new CakePHP Questions site http://cakeqs.org and help others 
> with their CakePHP related questions.
>  
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
> http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Validate only some field

2010-06-08 Thread josu jauregui
Hi marco!

I use: $this->myModel->validate = Set::merge($this->myModel->validate,
$newValidation); where $newValidation has the new rules to the specific
case. for example:

$newValidation= array('name_of_the_field_in_the_model_validation' =>
array('name_of_validation' => array('rule' => VALID_NOT_EMPTY,


'last' => true)));
With something like this, you modificate on execution time the rule that is
defined in the model.

I hope it can help you. Regards.

2010/6/8 marco.rizze...@gmail.com 

> Hi
> I have this need.
> I have to do a model's save with a field that normally can't be empty
> but in this case can be empty.
> How can I do to save doing the validation only on some fields and not
> on others fields?
> Many Thanks
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


cakephp cms with CCK Funcionality

2010-06-08 Thread Toan Nguyen Dinh
i 'm still working. i hope get more tips from all members

http://www.youtube.com/watch?v=j4JFlTNvDYM

thanks

kind regards

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Freshbooks Datasource

2010-06-08 Thread cakeman
Hi

I'm considering writing a datasource for interacting with the
Freshbooks API.  I have a PHP library I'd like to build the datasource
on top of, but it's quite large (lots of files/includes).  Does that
matter?  Are there any related performance/scalability issues?  I
guess I have a perception of a datasource being a pretty lightweight
object, so want to make sure I'm taking the correct approach.

Regards

Paul

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Cake PHP vs Zend

2010-06-08 Thread Meroe Kush
Folks,

 

I'm facing a dilemma.  I'm not a programmer by profession and do this work
as a hobby of mine.  I ask this question in all fairness and not a slide
against any framework, but I am at a loss if I should stick with Zend or
switch over to Cake.  

 

The CRUD and full stack seems enticing. 

 

I'm working on what will be quite a large application with many modules,
authentication, permissions, task tracking, risks, issues, administration
(users, categories, organizations etc).

 

If I ask the following question how would you respond?

 

Why Cake over Zend or vice versa.  I know this is a loaded question and one
that has probably been asked, buthere is another shot at it.

 

 

 

 

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Problems with $model->find() in nest conditions

2010-06-08 Thread jamc
Hello Friends, I want to do a query like this:

$Anuncio->Inmueble->Zona

where Anuncio hasOne Inmueble and Inmueble belongsTo Zona,
obtain data works perfect, but the problem is to filter Anuncios
according to one Zona.ciudad_id
for that I am doing this:
$this->Anuncio->find('all', array('conditions' => array(
  'Zona.ciudad_id' =>
$idCiudad
)))

where I can get $ciudadId with 'GET'.

do it that way gives me the following error:

SQL Error: 1054: Unknown column 'Zona.ciudad_id' in 'where clause'

can someone please tell me how I can make that kind of conditions?

Note: Excuse me, but I do not write English very well

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


problem in auth component when i was creating a login controller.

2010-06-08 Thread Narendra Padala
Hi i am new to cake php, when i am  creating a login authentication using
app controller the following error was showed so please help me out. here
data base i am using postgress sql, here i dont have permission to chanage
the databse.


this is app_controller.php
--

Auth->loginAction = array('admin' => false, 'controller' =>
'tblusers', 'action' => 'login');

$this->Auth->authError = "Sorry, you are lacking access.";

$this->Auth->loginError = "No, you fool! That's not the right
password!";

$this->Auth->userModel = 'Tbluser';

$this->Auth->authorize = 'tblusers';

$this->Auth->fields = array('username' => 'struid', 'password' =>
'strpid');

$this->Auth->allow('login');

$username = $this->Auth->user('struid');

$id = $this->Auth->user('lnguser');

$this->set('userId', $this->Auth->user('lnguser'));

$this->Auth->loginRedirect = array('controller' => 'tblusers',
'action' => 'index');

}

function isAuthorized() {
return true;
}

}
?>


Error Message :


*Warning* (512) : Auth::isAuthorized() -
$authorize is set to an incorrect value.  Allowed settings are:
"actions", "crud", "model" or null.
[*CORE/cake/libs/controller/components/auth.php*, line *525*]
*Warning* (2) : Cannot modify header information
- headers already sent by (output started at
/var/www/wizard_auth/cake/basics.php:108)
[*CORE/cake/libs/controller/controller.php*, line *646*]


Please any one can help me out...thanks in advance..!

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Saving A User, Their Profile, and Some Tags At The Same Time

2010-06-08 Thread Jonathan
Thanks a ton for your response Paul. Being able to do a saveAll would
be awesome and it looks like it would definitely shorten my code up
substantially. But, if it requires me using checkboxes for the
subjects/tags it's a no go. When instructors are registering they need
to be able to type in their subjects. This way if their subject
doesn't exist in the DB it'll be added. I did it this way so that I
didn't have to have checkboxes, but then also have another field for
"if you don't see yours listed add one".

When instructors type their subjects into the form field with commas
separating each, the subjects are then exploded and trimmed and saved
separately. I actually figured out how to do that part with the help
of the link you posted. I've used this method before as well but it
didn't involve a user and an profile as well as tags. It was just
saving a post and tags at the same time.

I think you've sparked something and I'll have to give it a try and
report back.

In the mean time, if anyone can tell me why Cake thinks that a
zip_code and a phone number are instructor_id's that can be used in my
join table, that would be great.

Thanks,
Jonathan

On Jun 8, 6:44 am, WebbedIT  wrote:
> If you structure your data array correctly you could use one saveAll
> command on the instructor table and the 3 models would save.  So your
> save code would be reduced to:
>
> if (!empty($this->data)) {
>   if ($this->User->Instructor->saveAll($this->data,
> array('validate'=>'first'))) {
>     $this->Session->setFlash('User saved');
>     $this->redirect(array('action'=>'view', $this->User->id));
>   } else {
>     $this->Session->setFlash('Usernot saved');
>   }
>
> }
>
> To do this, you need to get your head around how to use Cake's
> automagic to retrieve your HABTM subjects and display them as a
> multiple select or checkbox list in your form so the resulting data
> structure ends up looking something like
>
> Array
> (
>     [User] => Array
>         (
>             [username] => MrInstructor
>             [password] => cddb06c93c72f34eb9408610529a34645c29c55d
>             [group_id] => 2
>         )
>
>     [Instructor] => Array
>         (
>             [name] => Jimmy Bob
>             [email] => j...@gmail.com
>             [phone] => 111222
>             [city] => Beverly Hills
>             [zip_code] => 90210
>             [states] => 5
>             [website] =>www.jimmybobschool.com
>             [description] => Jimmy Box is an instructor.
>             [user_id] => 1
>             [id] => 1
>         )
>
>     [Subject] => Array
>         (
>             [Subject] => Array
>             (
>                 [0] => 15 // id for hitting
>                 [1] => 21 // id for pitching
>             )
>         )
> )
>
> Not read through this blog post fully, but may be of some 
> help:http://mrphp.com.au/code/working-habtm-form-data-cakephp
>
> HTH
>
> Paul.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Saving A User, Their Profile, and Some Tags At The Same Time

2010-06-08 Thread WebbedIT
If you structure your data array correctly you could use one saveAll
command on the instructor table and the 3 models would save.  So your
save code would be reduced to:

if (!empty($this->data)) {
  if ($this->User->Instructor->saveAll($this->data,
array('validate'=>'first'))) {
$this->Session->setFlash('User saved');
$this->redirect(array('action'=>'view', $this->User->id));
  } else {
$this->Session->setFlash('Usernot saved');
  }
}

To do this, you need to get your head around how to use Cake's
automagic to retrieve your HABTM subjects and display them as a
multiple select or checkbox list in your form so the resulting data
structure ends up looking something like

Array
(
[User] => Array
(
[username] => MrInstructor
[password] => cddb06c93c72f34eb9408610529a34645c29c55d
[group_id] => 2
)

[Instructor] => Array
(
[name] => Jimmy Bob
[email] => j...@gmail.com
[phone] => 111222
[city] => Beverly Hills
[zip_code] => 90210
[states] => 5
[website] => www.jimmybobschool.com
[description] => Jimmy Box is an instructor.
[user_id] => 1
[id] => 1
)

[Subject] => Array
(
[Subject] => Array
(
[0] => 15 // id for hitting
[1] => 21 // id for pitching
)
)
)

Not read through this blog post fully, but may be of some help:
http://mrphp.com.au/code/working-habtm-form-data-cakephp

HTH

Paul.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Validate only some field

2010-06-08 Thread marco.rizze...@gmail.com
Hi
I have this need.
I have to do a model's save with a field that normally can't be empty
but in this case can be empty.
How can I do to save doing the validation only on some fields and not
on others fields?
Many Thanks

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Duplicate Queries in MODEL->HABTM->HABTM->HasMany relationship

2010-06-08 Thread pinker42
Hi,

i urgently need some help with a really nasty problem.

I have 4 main tables A,B,C,D and two join tables AB, BC joined: A (1
record) -> (HABTM AB) B (13 records) -> (HABTM BC) C (131 records) ->
(hasMany) D (405 records). When i fetch the data with A->find('All')
cake does a good job for A,B and C. But than repeats the Query for D
13 times (number of records for B !).
The result set is okay, but the performance is really sad, because the
result set for D is quite Huge. Is it not possible to handle MODEL-
>HABTM->HABTM->HasMany releationships with simple model binds in
Cake ?

Best regards and thanks in advance

Dirk

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: How to create login page using app_controller.php

2010-06-08 Thread Narendra Padala
I was changed some changes in my app controller after that i got this error
message

this is code what i am wrote
--
app_controller.php
---
Auth->userModel = 'Tbluser';

$this->Auth->authorize = 'tblusers';

$this->Auth->fields = array('username' => 'struid', 'password' =>
'strpid');

$this->Auth->allow('login');

$username = $this->Auth->user('struid');

$id = $this->Auth->user('lnguser');

$this->set('userId', $this->Auth->user('lnguser '));

$this->Auth->loginRedirect = array('controller' => 'tblusers',
'action' => 'index');

}

function isAuthorized() {

 return true;

 }
}
?>


Erros:

*Warning* (512) : Auth::isAuthorized() -
$authorize is set to an incorrect value.  Allowed settings are:
"actions", "crud", "model" or null.
[*CORE/cake/libs/controller/components/auth.php*, line *525*]

Code  | Context 

$type   =   "tblusers"
$object =   null
$user   =   array(
"Tbluser" => array(
"lnguser" => "35",
"strfname" => "d",
"strlname" => "",
"struid" => "admin",
"lnguser_group" => "13",
"strtelarea" => null,
"strtelno" => "dd",
"stremail" => "dd",
"struserconfirm" => null,
"dtmregistered" => null,
"dtmapproved" => null,
"blnchatuser" => null
)
)
$valid  =   false

break;default:
trigger_error(__('Auth::isAuthorized() - $authorize is set to an
incorrect value.  Allowed settings are: "actions", "crud", "model" or
null.', true), E_USER_WARNING);

AuthComponent::isAuthorized() -
CORE/cake/libs/controller/components/auth.php, line 525
AuthComponent::startup() -
CORE/cake/libs/controller/components/auth.php, line 400
Component::startup() - CORE/cake/libs/controller/component.php, line 111
Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 209
Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 193
[main] - APP/webroot/index.php, line 87

*Warning* (2) : Cannot modify header information
- headers already sent by (output started at
/var/www/wizard_auth/cake/basics.php:108)
[*CORE/cake/libs/controller/controller.php*, line *646*]








Code  | Context 

$type   =   "tblusers"
$object =   null
$user   =   array(
"Tbluser" => array(
"lnguser" => "35",
"strfname" => "d",
"strlname" => "",
"struid" => "admin",
"lnguser_group" => "13",
"strtelarea" => null,
"strtelno" => "dd",
"stremail" => "dd",
"struserconfirm" => null,
"dtmregistered" => null,
"dtmapproved" => null,
"blnchatuser" => null
)
)
$valid  =   false

break;default:
trigger_error(__('Auth::isAuthorized() - $authorize is set to an
incorrect value.  Allowed settings are: "actions", "crud", "model" or
null.', true), E_USER_WARNING);

AuthComponent::isAuthorized() -
CORE/cake/libs/controller/components/auth.php, line 525
AuthComponent::startup() -
CORE/cake/libs/controller/components/auth.php, line 400
Component::startup() - CORE/cake/libs/controller/component.php, line 111
Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 209
Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 193
[main] - APP/webroot/index.php, line 87

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: I'm trying to make a good find with three HABTM models

2010-06-08 Thread DrLaban
Yes, I worked it out and I confirm that what's been said here all
comes together just fine. Thank you all!

On Jun 8, 9:45 am, John Andersen  wrote:
> The find('list') will give you the table ID column and the first
> column thereafter (when no name or title column), so what you got was
> the table ID and the user_id values.
>
> Add a field list to your find options like:
> [code]
> $options = array(
>    'conditions' => array(
>       'ProjectsUser.user_id' => 12
>    ),
>    'fields' => array(
>       'user_id', 'project_id'
>    )
> );
> [/code]
>
> Enjoy,
>    John
>
> On Jun 8, 10:36 am, DrLaban  wrote:
>
>
>
> > This comes very close to what I'm looking for, but the first find that
> > I wrote (it isn't an exact copy of your code but should be equal):
>
> > $options = array(
> >             'conditions' => array(
> >                 'ProjectsUser.user_id' => 12
> >             )
> >         );
> > debug($this->Project->ProjectsUser->find('list',$options));
>
> > prints the unique id:s of the matched rows in the projects_users
> > table. Unfortunately, it gives me a list of;
>
> > [0] => 61
> > [1] => 67
>
> > but these id:s don't exist in the Project-table.
>
> > Just a small example of three rows of actual values in the
> > projects_users table;
>
> > projects_users
> > id | user_id | project_id
> > 61| 12        | 2
> > 67 | 12       | 7
> > 68 | 13       | 5
>
> > Now, I get the id-column when doing the suggested find and this I
> > can't match to the Project-table id's. I guess what I want are the
> > project_id's from the project_users table to be able to match this
> > right.
> > I'll go back and fiddle a bit more with this but to come with
> > suggestions.
>
> > This worked almost right out of the box, I'm impressed! Thank you for
> > these and any further comments!
>
> [snip]

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: I'm trying to make a good find with three HABTM models

2010-06-08 Thread John Andersen
The find('list') will give you the table ID column and the first
column thereafter (when no name or title column), so what you got was
the table ID and the user_id values.

Add a field list to your find options like:
[code]
$options = array(
   'conditions' => array(
  'ProjectsUser.user_id' => 12
   ),
   'fields' => array(
  'user_id', 'project_id'
   )
);
[/code]

Enjoy,
   John

On Jun 8, 10:36 am, DrLaban  wrote:
> This comes very close to what I'm looking for, but the first find that
> I wrote (it isn't an exact copy of your code but should be equal):
>
> $options = array(
>             'conditions' => array(
>                 'ProjectsUser.user_id' => 12
>             )
>         );
> debug($this->Project->ProjectsUser->find('list',$options));
>
> prints the unique id:s of the matched rows in the projects_users
> table. Unfortunately, it gives me a list of;
>
> [0] => 61
> [1] => 67
>
> but these id:s don't exist in the Project-table.
>
> Just a small example of three rows of actual values in the
> projects_users table;
>
> projects_users
> id | user_id | project_id
> 61| 12        | 2
> 67 | 12       | 7
> 68 | 13       | 5
>
> Now, I get the id-column when doing the suggested find and this I
> can't match to the Project-table id's. I guess what I want are the
> project_id's from the project_users table to be able to match this
> right.
> I'll go back and fiddle a bit more with this but to come with
> suggestions.
>
> This worked almost right out of the box, I'm impressed! Thank you for
> these and any further comments!
>
[snip]

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Need help: Plugin model issue

2010-06-08 Thread John Andersen
Hmm, just saw that your Client model is based on AppModel, which
according to my knowledge (the CakePHP book) it shouldn't be. The
Client model should be based on the MyPluginAppModel! (Please correct
me if I am wrong!!)

Are debug turned on? Is the Client model used in the query at all?
Enjoy,
   John

On Jun 8, 10:10 am, trav  wrote:
> Hi John,
>
> I have tried setting recursive to 1 and 2 and still no joy.
>
> any other suggestions?
>
> -t
>
[snip]

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Query question(s)

2010-06-08 Thread John Andersen
This may not be relevant to your issue, but maybe to your solution. I
will try to explain how I did my search functionality.

In my application, the user will search for a specific object
(Article, Author, Blog, etc.), not a combination of these.

The search form provides the following entries:
Words [text] - one or more words

Word criteria [radiogroup] - :
1) must contain all words.
2) must contain at least one word.
3) must contain exact phrase.

Search criteria [checkbox] - :
1) In title (default).
2) In summary.
3) In body.

Category(ies) [checkbox] - all categories.

When the user submits the search, the first thing I do, is to save the
search parameters in the database (Enquiry model), so as to get an ID.

The search parameters are then passed on to the responsible model
(Article, Author, Blog, etc), which then performs the actual search.
The resulting rows (ids) are passed back to the Enquiry model, which
saves the result (creates relationships between Enquiry model and
responsible model).

I then uses the ID to paginate the result, when presenting it to the
user.

Building the search query:
1) I split into single words from the Words entry.
2) Based on the Word criteria, I prepare the respective AND, OR, or
phrase condition(s) for all possible Search criteria. That is one for
Title, one for Summary and one for Body.
3) Based on the Search criteria, I include the respective conditions
for Title, Summary and/or Body.

The resulting find conditions looks like this (Words equal "a b c",
Word criteria "must contain all words", Search critera "In title, In
summary, In body":
[code]
Array
(
   [OR] => Array
  (
 [0] => Array
(
   [AND] => Array
  (
 [0] => Array
(
   [LOWER(Article.title) LIKE] => %a%
)
 [1] => Array
(
   [LOWER(Article.title) LIKE] => %b%
)
 [2] => Array
(
   [LOWER(Article.title) LIKE] => %c%
)
  )
)
 [1] => Array
(
   [AND] => Array
  (
 [0] => Array
(
   [LOWER(Article.summary) LIKE] => %a%
)
 [1] => Array
(
   [LOWER(Article.summary) LIKE] => %b%
)
 [2] => Array
(
   [LOWER(Article.summary) LIKE] => %c%
)
  )
)
 [2] => Array
(
   [AND] => Array
  (
 [0] => Array
(
   [LOWER(Article.content) LIKE] => %a%
)
 [1] => Array
(
   [LOWER(Article.content) LIKE] => %b%
)
 [2] => Array
(
   [LOWER(Article.content) LIKE] => %c%
)
   )
 )
  )
   [Article.state] => 2
)
[/code]

If you have questions to the above, or just curious about other
things, feel free to ask :) Hope you will get your search up and
running!
Enjoy,
   John


[snip]

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: I'm trying to make a good find with three HABTM models

2010-06-08 Thread DrLaban
This comes very close to what I'm looking for, but the first find that
I wrote (it isn't an exact copy of your code but should be equal):

$options = array(
'conditions' => array(
'ProjectsUser.user_id' => 12
)
);
debug($this->Project->ProjectsUser->find('list',$options));

prints the unique id:s of the matched rows in the projects_users
table. Unfortunately, it gives me a list of;

[0] => 61
[1] => 67

but these id:s don't exist in the Project-table.

Just a small example of three rows of actual values in the
projects_users table;

projects_users
id | user_id | project_id
61| 12| 2
67 | 12   | 7
68 | 13   | 5

Now, I get the id-column when doing the suggested find and this I
can't match to the Project-table id's. I guess what I want are the
project_id's from the project_users table to be able to match this
right.
I'll go back and fiddle a bit more with this but to come with
suggestions.

This worked almost right out of the box, I'm impressed! Thank you for
these and any further comments!


On Jun 7, 10:02 pm, vekija  wrote:
> The easiest way that comes to mine mind would be to get the ids of the
> projects you are involved at first and then pass those as condition in
> the before mentioned find call.
>
> Something like...
>
> $this->loadModel('ProjectsUser');
>
> $ids = $this->ProjectsUser->find('list', array('conditions' =>
> array('ProjectsUser.user_id => $yourId)));
>
> $projects = $this->Project->find('all', array(
>      'contain' => array(
>           'Group' => array('User')
>      ),
>      'conditions => array('Project.id' => array_keys($ids))
> ));
>
> there are probably other ways of doing this, but I would have to think
> and test before I recommend them. :)
>
> Cheers
>
> On Jun 7, 9:03 pm, DrLaban  wrote:
>
>
>
> > Oooh! That's pretty awesome, and it seems to work like a charm,
> > thanks!
>
> > Just one more question on this subject. This involves a bit more
> > trickery I believe;
>
> > I'd also like to be able to view all the Groups/Users for all the
> > projects I'm involved at. This would look something like
> > [Project 1]
> >   [Group 1]
> >     [User 2]
> >     [User 3]
> >     [User 4]
> >   [Group 10]
> >     [User 1]
> >     [User 3]
> > [Project 2]
> >   [Group 25]
> >   [User 1]
> >   [User 3]
> >   [User 7]
>
> > Now, the information about what projects I'm involved at is stored in
> > projects_users. I guess I somehow have to use this information to be
> > able to present it in the above described way? Otherwise I'm not sure
> > as to how I could first filter out all the projects I'm involved with
> > and then go hunt for the groups and users. Any insights on this matter
> > is really appreciated.
>
> > Thank you in advance!
>
> > On Jun 7, 3:26 pm, vekija  wrote:
>
> > > You can try Containable behavior.
>
> > > In models put
>
> > >      var $actsAs = array('Containable');
>
> > > and then in the controller
>
> > >      $this->Project->find('all', array('contain' => array('Group' =>
> > > array('User';
>
> > > you can find out more about the Containable behavior in the cook 
> > > bookhttp://book.cakephp.org/view/1323/Containable
>
> > > On Jun 7, 2:54 pm, DrLaban  wrote:
>
> > > > My setup is pretty straightforward;
> > > > User HABTM Group
> > > > Group HABTM Project
> > > > Project HABTM User
>
> > > > I would like to produce a find-query that takes a single project-id
> > > > and builds a hierarchic contact list, in which the users belong to
> > > > their respective group(s).
>
> > > > Something along these lines:
> > > > [Project 1]
> > > >   [Group 1]
> > > >     [User 1]
> > > >     [User 5]
> > > >   [Group 2]
> > > >     [User 1]
> > > >     [User 2]
> > > >     [User 3]
> > > >   [Group 4]
> > > >     [User 3]
> > > >     [User 4]
> > > > ...
>
> > > > Is this possible and if so, how? All I've been able to produce is
> > > > something of a flat structure where I can't match the user to a group;
> > > > [Project 1]
> > > >   [User 1]
> > > >   [User 3]
> > > >   [User 4]
> > > >   [User 6]
> > > >   [Group 1]
> > > >   [Group 3]
> > > >   [Group 4]
>
> > > > This is produced when I do;
> > > > $this->Project->find('all');

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Need help: Plugin model issue

2010-06-08 Thread trav
Hi John,

I have tried setting recursive to 1 and 2 and still no joy.

any other suggestions?

-t

On Jun 8, 5:03 pm, John Andersen  wrote:
> What is recursive set to? Should be set to 1 in order to retrieve
> second level related information (Client)!
> Enjoy,
>    John
>
> On Jun 8, 7:59 am, trav  wrote:
>
> > Hi,
>
> > I hope someone can give me some assistance with Plugin models.
>
> > Cake Version: 1.3.2
> > ==
> > Problem: Query result does not build model joins when using a plugin
> > ==
> > Location: Model files are in app/plugin/Myplugin/models
> > Plugin Name: Myplugin
>
> > Model A:
> > --
> > class Client extends AppModel {
> >         var $name = 'Client';
>
> > }
>
> > Model B:
> > ---
> > class Account extends AppModel {
> >         var $name = 'Account';
> >         var $belongsTo = 'Myplugin.Client';
>
> > }
>
> > Call:
> > ---
> > $data = $this->Account->find('all');
>
> > Query output from cake/libs/models/model.php (line 2086):
> > 
> > Array
> > (
> >     [conditions] => Array
> >         (
> >         )
>
> >     [fields] =>
> >     [joins] => Array
> >         (
> >         )
>
> >     [limit] =>
> >     [offset] =>
> >     [order] => Array
> >         (
> >             [0] =>
> >         )
>
> >     [page] => 1
> >     [group] =>
> >     [callbacks] => 1
> > )
>
> > Result:
> > -
> > Array
> > (
> >     [0] => Array
> >         (
> >             [Account] => Array
> >                 (
> >                     [id] => 85
> >                     [client_id] => 1
> >                 )
>
> >         )
>
> >     [1] => Array
> >         (
> >             [Account] => Array
> >                 (
> >                     [id] => 86
> >                     [client_id] => 2
> >                 )
>
> >         )
> > )

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: How to create login page using app_controller.php

2010-06-08 Thread Jeremy Burns
I think this piece of the guide will help: 
http://book.cakephp.org/view/1265/AuthComponent-Variables#authorize-1275

Try adding: $this->Auth->authorize = 'controller'; to your app_controller's 
beforeFilter.

Jeremy Burns
jeremybu...@me.com


On 8 Jun 2010, at 07:50, Narendra Padala wrote:

> its not at all showing the index page, its back to the login page only
> in the debugger no wuery also executed
> 
> 
> On Tue, Jun 8, 2010 at 12:07 PM, Jeremy Burns  wrote:
> What errors are you getting?
> 
> Jeremy Burns
> jeremybu...@me.com
> 
> 
> On 8 Jun 2010, at 07:28, Narendra Padala wrote:
> 
>> Hi am new to cakephp, i am using postgress sql database this is an existing 
>> database here i am not having permissions to change any thing in database. 
>> but i have to wrote user authentication using app_controller.php
>> so tried to wrote code like this but it was not working properly please any 
>> one can help me out to solve this problem.
>> 
>> 
>> -
>> Database table: 
>> -
>> table name: tbluser
>> -
>> 
>> 
>>  Column |  Type  |  
>> Modifiers  
>> ++-
>>  lnguser| integer| not null default 
>> nextval(('"tbluser_lnguser_seq"'::text)::regclass)
>>  strfname   | character varying(100) | not null
>>  strlname   | character varying(100) | not null
>>  struid | character varying(100) | not null
>>  strpid | character varying(100) | not null
>>  lnguser_group  | integer| not null
>>  strtelarea | character varying(20)  | 
>>  strtelno   | character varying(20)  | 
>>  stremail   | character varying(100) | 
>>  struserconfirm | character varying(100) | 
>>  dtmregistered  | date   | 
>>  dtmapproved| date   | 
>>  blnchatuser| bit(1) | 
>> Indexes:
>> "tbluser_pkey" PRIMARY KEY, btree (lnguser)
>> 
>> 
>> 
>> Model : tbluser.php
>> 
>> > 
>> class Tbluser extends AppModel { 
>> 
>> var $useTable = 'tbluser'; 
>> } 
>> ?>
>> 
>> 
>> 
>> -
>> Controller : tblusers_controller.php
>> -
>> > 
>> class TblusersController extends AppController {
>> 
>> var $name = "Tblusers";
>> 
>> var $uses = array('Tbluser');
>> 
>> var $helpers = array('Html', 'Form');
>> 
>> function login() {
>> 
>> }
>> 
>> function index() {
>> 
>> }
>> function logout() {
>> 
>> $this->Session->setFlash('Successfully logout');
>> 
>> $this->redirect($this->Auth->logout());
>> }
>> 
>> 
>> }
>> 
>> ?>
>> 
>> 
>> ---
>> Login page : login.ctp
>> ---
>> 
>> > if ($session->check('Message.auth')) {
>>$session->flash('auth');
>> }
>> if ($form->isFieldError('User.username')) {
>> e($form->error ('User.username', null));
>> }
>> ?>
>> 
>> 
>> 
>> create('Tbluser',array('action' => 'login'))); ?>
>> 
>>   
>>  Username 
>>  text('struid')); ?> 
>>   
>> 
>> 
>> 
>>   
>>  Password 
>>  password('strpid')); ?> 
>>   
>> 
>> 
>> 
>>   
>>   
>> submit('Login')); ?>
>>   
>> 
>> end()); ?>
>> 
>> 
>> 
>> 
>> 
>> ---
>> index page : login.ctp
>> ---
>> > echo "Welcome cakephp world ...!";
>> ?>
>> 
>> 
>> 
>> 
>> 
>> App Controller : app_controller.php
>> 
>> 
>> > 
>> class AppController extends Controller {
>> {
>> var $components = array('Auth', 'RequestHandler');
>> 
>> var $uses = array ('Tbluser') ; 
>> 
>> var $helpers = array('Javascript','Html','Form','Ajax');
>> 
>> function beforeFilter(){
>> 
>> $this->Auth->allow('adduser');
>> 
>> $struid = $this->Auth->user('struid');
>> 
>> $id = $this->Auth->user('lnguser');
>> 
>> $this -> Session -> write('struid', $struid);
>> 
>> $this -> Session -> write('id', $id);
>> 
>> $this->set('struid', $this->Auth->user('struid'));
>> 
>> $this->set('userId', $this->Auth->user('lnguser'));
>> 
>> $this->Auth->loginRedirect = array('controller' => 'tblusers', 
>> 'action' => 'index');
>> 
>> }
>> 
>> function isAuthorized() {
>> 
>>  return true;
>> 
>>  }
>> 
>> }
>> 
>> ?>
>> 
>> 
>> please any one can help me out...here i attached the copy code as text file.
>> 
>> 
>> 
>> Check out the

Re: Need help: Plugin model issue

2010-06-08 Thread John Andersen
What is recursive set to? Should be set to 1 in order to retrieve
second level related information (Client)!
Enjoy,
   John

On Jun 8, 7:59 am, trav  wrote:
> Hi,
>
> I hope someone can give me some assistance with Plugin models.
>
> Cake Version: 1.3.2
> ==
> Problem: Query result does not build model joins when using a plugin
> ==
> Location: Model files are in app/plugin/Myplugin/models
> Plugin Name: Myplugin
>
> Model A:
> --
> class Client extends AppModel {
>         var $name = 'Client';
>
> }
>
> Model B:
> ---
> class Account extends AppModel {
>         var $name = 'Account';
>         var $belongsTo = 'Myplugin.Client';
>
> }
>
> Call:
> ---
> $data = $this->Account->find('all');
>
> Query output from cake/libs/models/model.php (line 2086):
> 
> Array
> (
>     [conditions] => Array
>         (
>         )
>
>     [fields] =>
>     [joins] => Array
>         (
>         )
>
>     [limit] =>
>     [offset] =>
>     [order] => Array
>         (
>             [0] =>
>         )
>
>     [page] => 1
>     [group] =>
>     [callbacks] => 1
> )
>
> Result:
> -
> Array
> (
>     [0] => Array
>         (
>             [Account] => Array
>                 (
>                     [id] => 85
>                     [client_id] => 1
>                 )
>
>         )
>
>     [1] => Array
>         (
>             [Account] => Array
>                 (
>                     [id] => 86
>                     [client_id] => 2
>                 )
>
>         )
> )

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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