I got problem in ajax

2011-04-24 Thread taq
i'm student and now i study cakephp with begining in cakephp from
novice to professional

and i practice follow example in book

i have problem in ajax example . i create form to recive comment and
update with ajax

but i click submit buttom no event

commentcontroller

http://upic.me/i/df/commentcontroller.jpg

view

http://upic.me/i/5w/2view.jpg

code view

http://upic.me/i/m9/viewcode.jpg

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Can't Write Session

2011-04-24 Thread thom
On Mon, Apr 25, 2011 at 10:00 AM, thom  wrote:
> Hello,,
>
> I am having problem. I couldn't write to session. I've include
> components and helpers Session at my AppController. But still, I still
> couldn't.
>
> The syntax is only $this->Session->write('variable', 'value'); isn't
> it? It mentioned already in the manual, but why I just couldn't?
> Someone could help me out? Or did I miss something?
>
> FYI, I could read session from Auth.


Forget it,, It was my mistake. After I did print_r, I got the answer. :D



-- 
Regards,,,
mastanto
http://www.mastanto.com
http://thom-sharing.blogspot.com

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Models and Table Prefix help

2011-04-24 Thread Renato de Freitas Freire
Hello guys.

I need some help with some models and table prefix.

Here is my scenario:

I have 2 controllers:
controller1 and controller2.

controller1 use table prefix c1_ and controller2 use table prefix c2_
and I have some comon tables too, without prefix, accessed by $default
config.
But the specific tables have the same name, for controller1 and
controller2...
so, my database is like this:

clients
configs
c1_configs
c1_data
c1_users
c2_configs
c2_data
c2_users

Actually, Im trying to put 2 old systems to work together for a client.
It need to be at same database, thats why I used the table prefix.

Each system is already working alone, with or without table prefix.

My first problem is:
1. The both controllers are accessing the models, that have the same name.
But now I need to put the table prefix. So, how do I keep the same name of
the Model for both controllers? Ex.: I have the model file config.php, and I
can use it on controller1, setting the table prefix to c1_, and then I can
access this model on controller1 with $this->Config. How can I keep the
$this->Config on controller2 too? So I wont need to search the whole code to
change just this.

Ps.: In some models, I use the var $useTable. Could this cause any problem
with table prefix or cake takes this var and adds the prefix to access the
table?

My second problem:
2. How do I use 2 diferent database configurations on the same controller?
Ex.: I have to access the configs table AND the c1_configs table in
controller1.
So, I need to use 2 diferent db configs.
This one doesnt need to have the same name, 'cause I will create this
functions yet. But I need to use some tables without prefix AND other tables
with prefix in the same controller.
Do I have to create one model for table configs and one model for table
c1_configs?

I already tried all that stuff found at google to change database config on
the fly, but it didnt work.
Im getting confused.

Can anyone help me?

Thank you!

--
Renato de Freitas Freire
ren...@morfer.org

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Server trouble

2011-04-24 Thread Labe Einhorn
Thanks for responding, i'm not going to be able to do some of these
tests till a little later in the week, but as for what I have seen so
far, I have tried setting a path both absolute on the server and
relative to the web directory, I have set the debug to 2 but saw no
log generated. One thing that is unusual is it works flawlessly when I
tried it in xamp on my windows box so it may be server related.
The .htaccess I have no idea what I need to change in it to what. I
did at one point try to make a small html file under the root of the
site, cake seemed to take over and display it's own page rather than
the one I wanted it to show. I'll try a txt file next time, it is a
subdomain which may be the issue, but I didn't see any configuration
issues (though that being said i'm not really a web server admin so I
may not be seeing what the issue is. NSLOOKUP responds correctly but
pings on the server are blocked so there wouldn't be a response to
pings. I looked at the error logs a few days ago and saw nothing I saw
as unusual. At one point it was showing db connect errors (had to
update the login for it) as soon as the login info for the db was
correct, that is when it started going to the other site. I will check
the rest of the questions out when I get back.

On Apr 24, 7:22 pm, cricket  wrote:
> On Sun, Apr 24, 2011 at 3:51 PM, Labe Einhorn  wrote:
> > Hi,
> > Not sure if i'm in the right place for this but I was hoping someone
> > could point me to where I need to look. I have a webhost with a
> > standard linux distribution and i'm trying to use some code a
> > developer made for me. Problem is their code (based on cakephp) is not
> > functioning correctly and I don't know why. What is happening is I go
> > to the site in question and it goes to a completely different site on
> > the host. None of the logs are showing anything that I can determine
> > as an issue, the host is helping me but their not programmers, where
> > the programers will not work with me citing "all information is going
> > to be one way, from us to you" and I don't know where to look to get
> > this issue resolved, any idea where I should look for a solution?
> > Labe
>
> Can you visit any URL at all under the domain or is this occurring
> with just some paths?
>
> Create a file at app/webroot/foo.txt, contents: "foo". If it happens
> when you browse tohttp://the.domain/foo.txtthen the problem is with
> either the webserver or DNS and Apache is loading the default site
> (eg. first loaded virtual host) instead.
>
> Is the site a subdomain?
> Can you ping the domain? From a shell (on your computer), try
> "nslookup the.domain"
> If you're on Windows, try 
> this:http://www.windowsnetworking.com/articles_tutorials/Quickly-Test-DNS-...
>
> Has the virtual host config been created/enabled?
> Has Apache been reloaded/restarted?
> Have you checked Apache's error and access logs?
>
> If you DO see foo.txt ...
>
> What version of Cake are you running?
> If not all paths are affected, which ones are?
> set debug to 2

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: help with ckeditor and html

2011-04-24 Thread rockbust
ok I think I got it??

echo $this->Cksource->ckeditor('body', array('escape' => false));


--
View this message in context: 
http://cakephp.1045679.n5.nabble.com/help-with-ckeditor-and-html-tp4337569p4337620.html
Sent from the CakePHP mailing list archive at Nabble.com.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Can't Write Session

2011-04-24 Thread thom
Hello,,

I am having problem. I couldn't write to session. I've include
components and helpers Session at my AppController. But still, I still
couldn't.

The syntax is only $this->Session->write('variable', 'value'); isn't
it? It mentioned already in the manual, but why I just couldn't?
Someone could help me out? Or did I miss something?

FYI, I could read session from Auth.

-- 
Regards,,,
thom

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: help with ckeditor and html

2011-04-24 Thread rockbust
ex: the  tag is saved as

-- View this message in context: http://cakephp.1045679.n5.nabble.com/help-with-ckeditor-and-html-tp4337569p4337589.html Sent from the CakePHP mailing list archive at Nabble.com. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. 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


help with ckeditor and html

2011-04-24 Thread rockbust
Hello I am new to cakephp and trying to install ckeditor. all seems to work
fine except any html special chars are converted to html entities.  On the
first add all is well and the database seems like it holds just the html
tags but when editing html entities are added causing the tags to be viewed
in the editor.
ex: the  tag is saved as

I am using the cksource helper http://bakery.cakephp.org/articles/wernerhp/2010/08/31/cksource-helper-for-ckeditor . Tried both ckeditor 3.1 and 3.5.3 my edit.ctp Cksource->create('Template');?> echo $this->Cksource->input('id'); echo $this->Cksource->input('title'); echo $this->Cksource->ckeditor('body'); echo $this->Cksource->input('school_id'); ?> Cksource->end(__('Submit', true));?> my controller's edit function. function edit($id = null) { if (!$id && empty($this->data)) { $this->Session->setFlash(__('Invalid template', true)); $this->redirect(array('action' => 'index')); } if (!empty($this->data)) { if ($this->Template->save($this->data)) { $this->Session->setFlash(__('The template has been saved', true)); $this->redirect(array('action' => 'index')); } else { $this->Session->setFlash(__('The template could not be saved. Please, try again.', true)); } } if (empty($this->data)) { $this->data = $this->Template->read(null, $id); } $schools = $this->Template->School->find('list'); $this->set(compact('schools')); } Thanks all -- View this message in context: http://cakephp.1045679.n5.nabble.com/help-with-ckeditor-and-html-tp4337569p4337569.html Sent from the CakePHP mailing list archive at Nabble.com. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. 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


Media Plugin — Trouble with filtered files

2011-04-24 Thread skimmas
in my config/core.php I added

/* CAKE MEDIA PLUGIN */
require APP . 'plugins/media/config/core.php';

Configure::write('Media.filter.document.s', array(
 'convert' => 'image/jpeg',  'compress' => 1.5, 'fit' =>
array(100, 100)
));

Yet the media plugin is still generating a png image.

Do you guys have any ideia what's going on.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Help! CakePHP runs great in localhost but doesn't even shows up in remote Server ...

2011-04-24 Thread skimmas
I would try things like:

does uploading a single index.html file with some contents to the
remote server work?
does uploading a single index.php (with something like ) work?
does creating an .htacces with some simple rules work?

And if by any chance you do have access to the webserver error log it
might give you some clues.


On Apr 24, 4:55 pm, kabeerdarocker  wrote:
>  I am quite new to Cakephp, just set up doing some of my college
> projects and demonstrating in a local computer. Now, I want to be
> professional and I just have no idea of what should I be doing to go
> live. I am in deep trouble. Please help me with this. Please provide
> me a basic procedure to go cakephp live.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Server trouble

2011-04-24 Thread cricket
On Sun, Apr 24, 2011 at 3:51 PM, Labe Einhorn  wrote:
> Hi,
> Not sure if i'm in the right place for this but I was hoping someone
> could point me to where I need to look. I have a webhost with a
> standard linux distribution and i'm trying to use some code a
> developer made for me. Problem is their code (based on cakephp) is not
> functioning correctly and I don't know why. What is happening is I go
> to the site in question and it goes to a completely different site on
> the host. None of the logs are showing anything that I can determine
> as an issue, the host is helping me but their not programmers, where
> the programers will not work with me citing "all information is going
> to be one way, from us to you" and I don't know where to look to get
> this issue resolved, any idea where I should look for a solution?
> Labe

Can you visit any URL at all under the domain or is this occurring
with just some paths?

Create a file at app/webroot/foo.txt, contents: "foo". If it happens
when you browse to http://the.domain/foo.txt then the problem is with
either the webserver or DNS and Apache is loading the default site
(eg. first loaded virtual host) instead.

Is the site a subdomain?
Can you ping the domain? From a shell (on your computer), try
"nslookup the.domain"
If you're on Windows, try this:
http://www.windowsnetworking.com/articles_tutorials/Quickly-Test-DNS-Resolution.html

Has the virtual host config been created/enabled?
Has Apache been reloaded/restarted?
Have you checked Apache's error and access logs?

If you DO see foo.txt ...

What version of Cake are you running?
If not all paths are affected, which ones are?
set debug to 2

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Allowing rights to their own records only for users and admin.

2011-04-24 Thread Pankaj Agrawal
I tried but it looks like Find is not used in most of the CURD
actions. so it doesn't effect. It gets more complicated when there are
table associations like hasMany,belongsTo and hasAndBelongsToMany

:)

On Apr 24, 3:55 pm, Fons Vandamme  wrote:
> You can add a user_id to your post or whatever you want users/admins
> to delete. then you can use the afterFind to determine if the user can
> or can't do actions on that record.
>
> Hope this helps! should be easy to implement ;)
>
> On 24 apr, 09:28, Pankaj Agrawal  wrote:
>
>
>
>
>
>
>
> > Hi,
>
> > I feel this is a must feature and should already be there. But after a
> > lot of searching I could only find ways to restrict users to
> > particular actions like view, add, delete.
>
> > I have Baked CURD pages for all my tables that are associated.
>
> > What I want is to be able to allow a particular user to be able to
> > list/view/edit/update/delete his own posts/profile etc only.
>
> > An Admin to be be able to list/view/edit/update/delete only his own
> > users and posts from his own users only.
>
> > And a particular admin to be able to do everything.
>
> > I am not able to find a way which can let any db query to be
> > restricted to certain conditions that specifies the ownership for the
> > user. For a direct php query it would be comparatively simple with
> > some extra where clause.
>
> > I did a lot of searching but I am so far disappointed regarding this
> > feature which is probably the core of any site.
>
> > Thanks for all your help.
>
> > - Pankaj

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Server trouble

2011-04-24 Thread acl68
Hi Labe,

set in the file /config/core.php the debug value to at least 1 better 3, so you 
might get some output.

Are you sure the path to your cake folder is set correctly? It might be that 
you have to use an absolute path here.

Please check if you copied all .htaccess files when moving them to the live 
host.


These are the three hints which come to my mind. Hope that helps!

Anja


Am Sonntag, 24. April 2011, um 21:51:38 schrieb Labe Einhorn:
> Hi,
> Not sure if i'm in the right place for this but I was hoping someone
> could point me to where I need to look. I have a webhost with a
> standard linux distribution and i'm trying to use some code a
> developer made for me. Problem is their code (based on cakephp) is not
> functioning correctly and I don't know why. What is happening is I go
> to the site in question and it goes to a completely different site on
> the host. None of the logs are showing anything that I can determine
> as an issue, the host is helping me but their not programmers, where
> the programers will not work with me citing "all information is going
> to be one way, from us to you" and I don't know where to look to get
> this issue resolved, any idea where I should look for a solution?
> Labe

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Server trouble

2011-04-24 Thread Labe Einhorn
Hi,
Not sure if i'm in the right place for this but I was hoping someone
could point me to where I need to look. I have a webhost with a
standard linux distribution and i'm trying to use some code a
developer made for me. Problem is their code (based on cakephp) is not
functioning correctly and I don't know why. What is happening is I go
to the site in question and it goes to a completely different site on
the host. None of the logs are showing anything that I can determine
as an issue, the host is helping me but their not programmers, where
the programers will not work with me citing "all information is going
to be one way, from us to you" and I don't know where to look to get
this issue resolved, any idea where I should look for a solution?
Labe

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Help! CakePHP runs great in localhost but doesn't even shows up in remote Server ...

2011-04-24 Thread kabeerdarocker
 I am quite new to Cakephp, just set up doing some of my college
projects and demonstrating in a local computer. Now, I want to be
professional and I just have no idea of what should I be doing to go
live. I am in deep trouble. Please help me with this. Please provide
me a basic procedure to go cakephp live.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: You favorite IDE/ Dev Setup?

2011-04-24 Thread acl68
kubuntu 10.4
Eclipse PDT
Apache/MySql

Anja


Am Mittwoch, 30. März 2011, um 21:49:47 schrieb Chris:
> How do you develop for CakePHP? OS, Editor, control system, etc.?
> Ubuntu 10.10
> Geany
> GIT
> Apache/MySql
> Bunch of Shell scripts

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: You favorite IDE/ Dev Setup?

2011-04-24 Thread evilbloodydemon
Windows 7, PhpStorm, git, apache/mysql

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: hasMany problem !!

2011-04-24 Thread taq

database
http://upic.me/i/v4/database.jpg
book model
http://upic.me/i/qp/modelbook.jpg
book catagorie model
http://upic.me/i/an/model.jpg
view eror message
http://upic.me/i/ov/xview.jpg
i test hasOne and belongsTo between books and bookcats it's no eror
but i test hasMany i got error in view error message

On Apr 24, 1:55 pm, Jens Dittrich  wrote:
> if you expect help, then you shoul consider sharing more information
> about what you have done.
>
> On 24 Apr., 07:42, taq  wrote:
>
>
>
>
>
>
>
> > I set up a table and try to do hasmany Ee Long says can not find.
> > But when put into the back hasone found it simple tight

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Allowing rights to their own records only for users and admin.

2011-04-24 Thread Fons Vandamme
You can add a user_id to your post or whatever you want users/admins
to delete. then you can use the afterFind to determine if the user can
or can't do actions on that record.

Hope this helps! should be easy to implement ;)



On 24 apr, 09:28, Pankaj Agrawal  wrote:
> Hi,
>
> I feel this is a must feature and should already be there. But after a
> lot of searching I could only find ways to restrict users to
> particular actions like view, add, delete.
>
> I have Baked CURD pages for all my tables that are associated.
>
> What I want is to be able to allow a particular user to be able to
> list/view/edit/update/delete his own posts/profile etc only.
>
> An Admin to be be able to list/view/edit/update/delete only his own
> users and posts from his own users only.
>
> And a particular admin to be able to do everything.
>
> I am not able to find a way which can let any db query to be
> restricted to certain conditions that specifies the ownership for the
> user. For a direct php query it would be comparatively simple with
> some extra where clause.
>
> I did a lot of searching but I am so far disappointed regarding this
> feature which is probably the core of any site.
>
> Thanks for all your help.
>
> - Pankaj

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Validation for a complex form

2011-04-24 Thread acl68
Hi Milos,


can you post the validation rules for this checkboxes and radio buttons? 


Anja


Am Sonntag, 24. April 2011, um 10:41:55 schrieb Miloš Vučinić:
> Hi,
> 
> I have a form which has many select boxes as well as many radio
> groups. The problem I'm having is that when I validate the data in the
> model, I receive general error If some data is not entered, but it is
> not shown under the radio button group or near a select box item.
> 
> If I place a regular input text field , the validation message is show
> correctly.
> 
> Can anyone help me with this ? Did anyone experience similar
> problems ?
> 
> All the best,
> Milos Vucinic

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Pagination hasMAny

2011-04-24 Thread acl68
Ho Domink,

maybe this link can help you:

http://stackoverflow.com/questions/1694047/cakephp-pagination-with-conditions-
on-has-many

On the first glance it looks like somebody has the same problem.

Anja


Am Samstag, 23. April 2011, um 23:47:26 schrieb Dominik Gajewski:
> Hi.
> I have problem with pagination. Everything is working till i don't
> want sort byt admission date. I think is only need to add one line of
> code in $var paginate. Or maybe that is problem becasue UserData
> hasMany MainBook and i want select only this one which is empty in
> field MainBook.extract_date
> 
> Could you help me?
> 
> I have tables in database
> 
> user_datas
> 
> id
> user_id
> name
> sName
> surname
> birthDate
> sex
> nationality
> pesel
> 
> main_books
> 
> id
> year
> baby_id
> user_data_id
> admission_date
> admission_mode
> extract_date
> extract_mode
> doctor_id
> 
> Model MainBook
> ===
> class MainBook extends AppModel{
>   var $name = 'MainBook';
> 
>   var $belongsTo = array(
>   'UserData' => array(
>   'className' => 'UserData',
>   'foreignKey' => 'user_data_id'
>   )
>   );
> }
> 
> Model UserData
> ===
> class UserData extends AppModel{
>   var $name = 'UserData';
>   var $hasMany = array(
>   'MainBook' => array(
>   'className' => 'MainBook',
>   'foreignKey' => 'user_data_id'
>   ),
>   );
> }
> 
> MainBooksController
> ===
> class MainBooksController extends AppController{
> 
>   var $name = 'MainBooks';
> 
>   var $paginate = array(
> 'limit' => 20,
> 'order' => array(
>   'UserData.surname' => 'asc',
> ),
> 'conditions' => array(
>   'User.status' => '1'
> ),
> );
> 
> 
>   function show_current(){
>   /**
>   Menu i kontrola sesji
>*/
>   $s = $this->sesionCheck(2);
>   $m = $this->menu($s);
>   $this->set('menu', $m);
> 
>   $data = $this->paginate('UserData');
>   $this->set('data', $data);
> 
> 
>   }
> }
> 
> My view show_current.ctp
> 
>   
>   Paginator->sort('Name', 'UserData.name'); 
?>
>   Paginator->sort('Surname', 
'UserData.surname');
> ?> Paginator->sort('PESEL', 'UserData.pesel');
> ?> Paginator->sort('Admission Date',
> 'MainBook.admission_date'); ?>   
>  
>   
>
>
>
>
>   
>   
> 

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Allowing rights to their own records only for users and admin.

2011-04-24 Thread Salines
Try to use beforeFind & afterFind
http://book.cakephp.org/view/1049/beforeFind

-check if a user logged in
-check if a user is admin or author (user_id)
-if is not admin or post author redirect and show error message, else
allow to manage post.

in views show links for authors and admin, hide for other...

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: updating habtm data with empty data (delete existing associations)

2011-04-24 Thread Tonu Tusk
Hi guys - any ideas? Am I doing this wrong, or is this just
inconsistent behaviour and I should raise a ticket?

cheers




On Apr 22, 7:26 pm, Tonu Tusk  wrote:
> Hi there ...
>
> so let's say I have
>
> Cake habtm Ingredient
>
> and
>
> Ingredient habmt Cake
>
> If I was to prep $data such as
>
> [Cake][id] => 1
> [Ingredient] => array(1, 2, 3)
>
> and did a
>
> Cake->save($data)
>
> this would delete any existing associating records in the join table
> between these two models and
> then associate Ingredients with id 1,2,3 to Cake record with id 1 ...
>
> To save on code, I am trying to spit the contents of my form generated
> posted data array
> straight to a model, but am not sure how to handle it if the
> associated model data is empty.
>
> (i.e where originally I had Ingredients 1,2,3 associated with Cake id
> 1, I would just want to
> feed some data back so that a simple Cake->save($data) would delete
> the existing associations.
>
> I have tried
>
> [Cake][id] => 1
> [Ingredient] => null
>
> and
>
> [Cake][id] => 1
> [Ingredient] => array()
>
> but it just retains the currently stored associations.
>
> I know I can catch a lack of associated Ingredients in the controller
> and manually delete the
> related records in the join table, but I would like to know if there
> is an easier (well less code) way of doing this as sugested above?
>
> cheers

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Validation for a complex form

2011-04-24 Thread Miloš Vučinić
Hi,

I have a form which has many select boxes as well as many radio
groups. The problem I'm having is that when I validate the data in the
model, I receive general error If some data is not entered, but it is
not shown under the radio button group or near a select box item.

If I place a regular input text field , the validation message is show
correctly.

Can anyone help me with this ? Did anyone experience similar
problems ?

All the best,
Milos Vucinic

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Allowing rights to their own records only for users and admin.

2011-04-24 Thread Pankaj Agrawal
Hi,

I feel this is a must feature and should already be there. But after a
lot of searching I could only find ways to restrict users to
particular actions like view, add, delete.

I have Baked CURD pages for all my tables that are associated.

What I want is to be able to allow a particular user to be able to
list/view/edit/update/delete his own posts/profile etc only.

An Admin to be be able to list/view/edit/update/delete only his own
users and posts from his own users only.

And a particular admin to be able to do everything.

I am not able to find a way which can let any db query to be
restricted to certain conditions that specifies the ownership for the
user. For a direct php query it would be comparatively simple with
some extra where clause.

I did a lot of searching but I am so far disappointed regarding this
feature which is probably the core of any site.

Thanks for all your help.

- Pankaj

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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