Re: Problem with Cake PHP blog tutorial..Can't add

2010-11-23 Thread Jeremy Burns | Class Outfit
That's the error message PHP delivers when something is printed to screen 
before the actual output (the headers referred to in the error message). Check 
you code for debug statements or other errors that could be doing this.

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 23 Nov 2010, at 16:26, John Maxim wrote:

>  class PostsController extends AppController {
> var $name = 'Posts';
>function index() {
>$this->set('posts', $this->Post->find('all'));
>}
>function view($id = null) {
> $this->Post->id = $id;
> $this->set('post', $this->Post->read());
>}
>   function add() {
>if (!empty($this->data)) {
>if ($this->Post->save($this->data)) {
>$this->Session->setFlash('Your post has been saved.');
>$this->redirect(array('action' => 'index'));
>   }
>   }
>   }
> }
> ?>
> 
> I'm using the above code as the posts_controller
> 
> As I try to key in some thing to Add.. from my index page :
> 
> 
>Blog posts
>   Html->link('Add Post', array('controller' =>
> 'posts', 'action' => 'add')); ?>
>   
>
>Id
>Title
>Created
>
>
>
>
>
>
>Html->link($post['Post']['title'],
>array('controller' => 'posts', 'action' => 'view', $post['Post']
> ['id'])); ?>
>
>
>
>
> 
>   
> 
> I get this error:
> 
> Cannot modify header information - headers already sent by (output
> started at C:\xampp\htdocs\cakephp\app\controllers
> \posts_controller.php:1) [CORE\cake\libs\controller\controller.php,
> line 746]
> 
> 
> Can someone enlighten 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

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


error in my cake php

2010-11-23 Thread siva
im new to cakephp

i started with name convention program but did not get answer there
some error that  i noted below


(default) 0 query took ms
Nr  Query   Error   AffectedNum. rows   Took (ms)

im using wamp server

pls help me to find the answer

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


noob - Problems with default selected option

2010-11-23 Thread lash
I have a view doing:

echo $form->input('cities');

and a controller doing:

  function edit($id = null) {
$this->set('cities', $this->Venue->City->find('list'));
$this->Venue->id = $id;
if (empty($this->data)) {
  $this->data = $this->Venue->read();
} else {
  $this->data['Venue']['city_id'] = $this->data['Venue']['cities']
['id'];
  $venue = $this->Venue->save($this->data);
  if (!empty($venue)) {
$this->Session->setFlash('Your venue has been saved.');
$this->redirect(array('action' => 'index'));
  }
}
  }

DB table names are cities and venues (id columns in both tables are
named id)
venue belongsTo city.
foreignKey is city_id in the venue table.

The "cities" select box doesn't select the current value, only the top
value of the option list.
As far as I can see I'm following naming conventions, and this should
be working out of the box. The data is stored correctly in the db, so
I know the relation works.

It works if I add to the controller:

$this->set('venue', $this->Venue->read());

and edit the input function in the view to:

   echo $form->input('cities', array('default' => $venue['City']
['id']));

...but that's clumsy compared to the "proper" solution.

What am I missing to get this to work?

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: Baffling blank screen problem

2010-11-23 Thread jason miyashiro
It could be you are missing the cake log file in
/cake/libs/cake_log.php. Check to see that the file is
there. It has happened to me before because the way
I had my .gitignore set up, it ignored the cake_log.php
file when I pulled from git. That might be the problem.

On Nov 24, 9:02 am, Jules  wrote:
> Using version 1.3.5, is working now with 'log' set to false in
> config.php. Not ideal, but is working for now.

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 should my blog look like ?

2010-11-23 Thread Leow
This confusion has been solved, I read another tutorial which there were
snapshots and found that my installation was correct.

On Wed, Nov 24, 2010 at 12:01 AM, John Maxim  wrote:

> I'm going through a tutorial set up by cake PHP, where creating a
> blog. I mean after creating it successfully, why is there query
> numbers, error messages at the bottom of the view page ?
>
> I wonder if my XAMPP is working correctly I have checked my httpd.conf
> file and it seems to be fine. The welcome page doesn't look like the
> best but I'm not sure if I still need to rewrite mod or should I move
> on to my apps and check if the mod is not really the issue here..
>
> Can I post a screenshot here ?
>
>

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


Ajax Helper autoComplete

2010-11-23 Thread macpclinux
I have been using CakePHP for a short while but, recently tried to use
autoComplete for one of my displays.  During my testing I felt it
necessary to include an option array for 'after' to call a javascript
of mine.  While the code does not break the page display or any of the
CakePHP functionality, it also does not call my javascript as is
explained in the Version 1.3 documentation.

The call provides for 3 parameters to be passed with the third one
being an options array. By changing the option chosen by me to many of
the other options I still am unable to have my script called.

Any suggestions?

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 timestamp in cakephp 1.3 and postgresql 9

2010-11-23 Thread Erik
I am new to cakephp and have tried to install on Vista with WAPP from
bitnami. I succeeded in making it run, but is having problem with the
datatype for created and modified. Have tried all dateformat provided
by postgesql, but gets an error message. If I change to character var
it is OK, but then it is not timestamp.

This is the query:
Query: INSERT INTO "cakes" ("user_id", "cakename", "modified",
"created") VALUES ('4ceacf69-1bcc-4a43-93cb-0970a4d2bb16', 'testcake',
'\\x323031302d31312d3233', '\\x323031302d31312d3233')

and I get this two errormessages.

Warning (2): pg_query() [function.pg-query]: Query failed: ERROR:
invalid input syntax for type date: "\x323031302d31312d3233"
LINE 1: ...ceacf69-1bcc-4a43-93cb-0970a4d2bb16', 'testcake', '\
\x323031...
 ^ [CORE
\cake\libs\model\datasources\dbo\dbo_postgres.php, line 167]

Warning (512): SQL Error: ERROR:  invalid input syntax for type date:
"\x323031302d31312d3233"
LINE 1: ...ceacf69-1bcc-4a43-93cb-0970a4d2bb16', 'testcake', '\
\x323031...
 ^ [CORE
\cake\libs\model\datasources\dbo_source.php, line 681]

I have searched at internet, but have not found any solution. I have
tried to insert data in the tables using phppgadmin. If i replace \
\x323031302d31312d3233 with '2011-12-11 21:12:11' it is stored
correctly.

I have used the bake functionality and have not written the php code
myself. Is it a common problem that cakephp and postgresql dows not
works wells together.

Erik

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 with Cake PHP blog tutorial..Can't add

2010-11-23 Thread John Maxim
set('posts', $this->Post->find('all'));
 }
 function view($id = null) {
 $this->Post->id = $id;
 $this->set('post', $this->Post->read());
}
function add() {
if (!empty($this->data)) {
if ($this->Post->save($this->data)) {
$this->Session->setFlash('Your post has been saved.');
$this->redirect(array('action' => 'index'));
}
}
}
 }
 ?>

I'm using the above code as the posts_controller

As I try to key in some thing to Add.. from my index page :


Blog posts
Html->link('Add Post', array('controller' =>
'posts', 'action' => 'add')); ?>


Id
Title
Created






Html->link($post['Post']['title'],
array('controller' => 'posts', 'action' => 'view', $post['Post']
['id'])); ?>





   

I get this error:

Cannot modify header information - headers already sent by (output
started at C:\xampp\htdocs\cakephp\app\controllers
\posts_controller.php:1) [CORE\cake\libs\controller\controller.php,
line 746]


Can someone enlighten 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


How should my blog look like ?

2010-11-23 Thread John Maxim
I'm going through a tutorial set up by cake PHP, where creating a
blog. I mean after creating it successfully, why is there query
numbers, error messages at the bottom of the view page ?

I wonder if my XAMPP is working correctly I have checked my httpd.conf
file and it seems to be fine. The welcome page doesn't look like the
best but I'm not sure if I still need to rewrite mod or should I move
on to my apps and check if the mod is not really the issue here..

Can I post a screenshot here ?

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


Only show records associated with group

2010-11-23 Thread Logan

Hi all, I appreciate the help in advance.

I'm trying to create a personnel management application, where as
records (employee information) would be associated with a group.
Administrators should be allowed to access and edit (or view only
based on group), employees multiple groups... for the sharing of
information between departments.

My first thought was to assign each employee's record to a group.
Then in an "access" table, add entries for each administrator / group
combination for access.  So that when an administrator goes the
personnel page, it would query the access table and retrieve the
groups he/she has access to... then displays everyone in those groups.

It seems I'm making it more complicated than it needs to be.  Does
anyone have a better suggestion, or an easier way to implement this?

Thanks for reading...
Logan

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


Integrating facebook class to cakePHP 1.2

2010-11-23 Thread sumit
Hi ,

We are using cakePHP version 1.2.3.8166 in our application.
Any pointers/help to the below questions will be very helpful.

* Getting the facebook class to work in CakePHP 1.2
* Is it disruptive to migrate to CakePHP 1.3?

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: Drop down menu not retrieving last inserted element in IE

2010-11-23 Thread Master Ram...!
Yes. recently-added record? is not fetching to menu.

how to salve this problem.




On Wed, Nov 24, 2010 at 12:27 AM, cricket  wrote:

> On Tue, Nov 23, 2010 at 6:10 AM, Master Ram  wrote:
> > Hi.. all
> >
> > I have problem with IE drop down menu.
> >
> > i have inserted one element its stored in the DB. i am fetching that
> > field in the drop down menu. but the last
> >
> > inserted element is not retrieving in the drop down menu. In IE. but
> > its working in Firefox.
>
> Seems like a browser problem, then, and nothing to do with Cake. Do
> you see it when you view source?
>
> By "last element" do you mean a recently-added record? Could the page
> simply be cached?
>
> 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
>



-- 
Master Ram.
Founder n Director of rgPlanets Pvt. Ltd.

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: Dynamic data in fixtures

2010-11-23 Thread Amit Badkas
Hi,

Yes, exactly like that.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Wed, Nov 24, 2010 at 3:41 AM, Jacob  wrote:

> You mean like this?
>
> class AnyFixture {
>
> var $today;
> var $tomorrow;
>
> function __construct() {
>$this->today = date('Y-m-d H:i:s');
>$this->tomorrow = date('Y-m-d H:i:s', strtotime('+1 day'));
> }
> }
>
> On 22 nov, 07:21, Amit Badkas  wrote:
> > Hi,
> >
> > You can't assign default values to class properties using expressions
> like
> > functions etc. Try to populate the data for class property in constructor
> of
> > the class.
> >
> > Amit Badkas
> >
> > PHP Applications for E-Biz:http://www.sanisoft.com
> >
> > On Thu, Nov 18, 2010 at 7:24 PM, Jacob  wrote:
> > > Hello all,
> >
> > > today I started with unit testing with SimpleTest and ran into a
> > > problem. In some model i have a method 'findToday', which finds
> > > records where 'day' is set to today's date. It's is a very simple
> > > function which works but to become familiar with unit testing I wrote
> > > a test en a fixture for it. While writing the fixture I realized that
> > > the 'day' field had to be dynamic for the tests to succeed so i made a
> > > variable $today which contains todays date date('Y/m/d'). This
> > > variable I put in the fixed data.
> > > I ran the test and it gave me an error:
> > >  'Parse error: syntax error, unexpected '(', expecting ',' or ';'
> > > in  on line 18'
> > > I ran in to some information which said that fixture data is really
> > > fixed, so there can't be any dynamic data in it.
> > > How should I fix this problem? I don't want to update my fixtures
> > > every time I want to test my function.
> >
> > > Greetz Jacob
> >
> > > 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: pagination url options

2010-11-23 Thread Dr. Loboto
$paginator->options(array('url' => array('?' => $this-
>data['Search']));

On 24 ноя, 09:31, Dmitry Shevchenko  wrote:
> I found a very bad solution
> 1. make convert from array to url manually
> 2. add this to parameters array
> 3. unset not flat array's in param
>
> f.e.
> $seeking_url = '';
>             if (!empty($this->data['Search']['seeking']))
>             {
>                 $seeking_url .= "seeking="; //make url to string
>
>                 foreach ($this->data['Search']['seeking'] as $field=>
> $value)
>                 {
>                     $seeking_url .= "&seeking[]=".$value; //make url
> to string
>                 }
>                 $this->data['Search']['see'] = $seeking_url; //add to
> params
>
>                unset($this->data['Search']['seeking']); // unset real
> array
>
>     }
>
> but this is VERY UGLY solution. Maybe someone knew better ??
>
> On Nov 23, 3:55 pm, Dmitry Shevchenko  wrote:
>
>
>
>
>
>
>
> > Hi.
> > I found a some error when using paginator-> options ( .. url ..)
>
> > for example this is my call for paginator in view.
> > $paginator->options  (array('url' => $this->data['Search'] ..
>
> > and if data['Search'] is flat array - all is good - it will create a
> > correct url
> > but if it contain a sub arrays like:
> > $url    =       array(
> >         "controller" => "profiles",
> >         "plugin" => null,
> >         "page" => 1,
> >         "search_type" => "advanced",
> >         "age_from" => "0",
> >         "age_to" => "0",
> >         "with_photo" => "0",
> >         "is_online" => "0",
> >         "seeking" => array(
> >         "5",
> >         "7"
> > ),
>
> > I'm getting a Array to string conversion [ROOT\cake\cake\libs
> > \router.php, line 952]
>
> > It seems cake doesn't convert sub arrays like
> > seeking=&seeking[]=1&seeking[]=2&seeking[]=4&seeking[]=7
>
> > Do anyone knew some workaround for this?
>
> > p.s. I'm using cake 1.2.6 and possibly found a bug

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: pagination url options

2010-11-23 Thread Dmitry Shevchenko
I found a very bad solution
1. make convert from array to url manually
2. add this to parameters array
3. unset not flat array's in param

f.e.
$seeking_url = '';
if (!empty($this->data['Search']['seeking']))
{
$seeking_url .= "seeking="; //make url to string

foreach ($this->data['Search']['seeking'] as $field=>
$value)
{
$seeking_url .= "&seeking[]=".$value; //make url
to string
}
$this->data['Search']['see'] = $seeking_url; //add to
params

   unset($this->data['Search']['seeking']); // unset real
array

}


but this is VERY UGLY solution. Maybe someone knew better ??


On Nov 23, 3:55 pm, Dmitry Shevchenko  wrote:
> Hi.
> I found a some error when using paginator-> options ( .. url ..)
>
> for example this is my call for paginator in view.
> $paginator->options  (array('url' => $this->data['Search'] ..
>
> and if data['Search'] is flat array - all is good - it will create a
> correct url
> but if it contain a sub arrays like:
> $url    =       array(
>         "controller" => "profiles",
>         "plugin" => null,
>         "page" => 1,
>         "search_type" => "advanced",
>         "age_from" => "0",
>         "age_to" => "0",
>         "with_photo" => "0",
>         "is_online" => "0",
>         "seeking" => array(
>         "5",
>         "7"
> ),
>
> I'm getting a Array to string conversion [ROOT\cake\cake\libs
> \router.php, line 952]
>
> It seems cake doesn't convert sub arrays like
> seeking=&seeking[]=1&seeking[]=2&seeking[]=4&seeking[]=7
>
> Do anyone knew some workaround for this?
>
> p.s. I'm using cake 1.2.6 and possibly found a bug

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


Security component and combine requireSecure() and requireLogin()

2010-11-23 Thread rj
Hello,
I try to use the security component in cakePHP 1.3 and want to combine
the requirements to establish an SSL connection with a simple security
login.
First I want to redirect to a secure connection. Then transmitting the
password should be okay.

Both methods work fine as long as long as I don't combine them. I can
automatically redirect to SSL via _forceSSL() and I can force a basic
login with $this->Security->requireLogin();
Together, however, this creates an endless redirection error:
"The page isn't redirecting properly
Firefox has detected that the server is redirecting the request for
this address in a way that will never complete."

The code:
class AppController extends Controller{
var $components = array('Security');

function beforeFilter(){
$this->Security->blackHoleCallback = '_forceSSL';
$this->Security->requireSecure();

$this->Security->loginOptions = array(
'type'=>'basic',
'realm'=>'myrealm'
);
$this->Security->loginUsers = array(
'username'=>'password',
);
$this->Security->requireLogin();
}

function _forceSSL(){
$this->redirect(HOME.$this->here);
}
}
I tried detecting whether the protocoll is already SSL in the
blackhole function and to skip the redirect if so, and I tried
redefining/resetting the blackhole function just before "$this-
>Security->requireLogin();", both to no avail. I must be missing
something obvious? Thanks for any hints.
PS: the HOME constant is defined in bootstrap.php, because I have to
specify different ports on dev. and production systems. It works as
long as I don't combine the two requirements.

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: Baffling blank screen problem

2010-11-23 Thread Jules
Using version 1.3.5, is working now with 'log' set to false in
config.php. Not ideal, but is working for now.

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 Messaging sysytem

2010-11-23 Thread euromark
i implemented the "facebook" way
i hate those old fashioned messaging system. they are so out of date.
with "threaded" conversations you always have the last messages at
hand.

conversations HM conversation_users
conversations HM conversation_messages
conversation_users BT users
conversation_messages BT converstations AND conversation_users

works quite well without any redundancy (even with many users per
conversation)


On 23 Nov., 22:14, John Andersen  wrote:
> You should specify your requirement to the messaging system!
> 1) A message must have a sender.
> 2) A message must have one or more receivers.
> 3) A message must indicate for each receiver, whether it has been read
> or not.
> 4) A message must retain its list of receivers, even though a receiver
> has deleted the message.
> 5) A message must retain its sender, even though the sender has
> deleted the message.
> 6) Messages between a sender and a receiver will be shown together
> (correspondance).
>
> User A -> sends -> message A
> User A -> is sender of -> message A
> User B -> receives -> message A
> User B -> is receiver of -> message A
>
> So User A sees the correspondance with User B as:
> 1) all the messages User A sends.
> 2) all the messages User A receives for which User B is sender of.
>
> So the models/associations become:
> User, Correspondance, Adressee, Message
> User hasAndBelongsToMany Message using Correspondance
> User hasAndBelongsToMany Message using Adressee
> and reverse.
>
> The above is just thrown together from what I would require from a
> message system. Can probably be improved :)
> Enjoy,
>    John
>
> On 23 Nov., 17:45, "whmeroe"  wrote:
>
>
>
>
>
>
>
> > I've been doing some reading on how to set up the tables as I would want
> > each message to go to multiple users if the sender so desires.  I found this
> > on stackoverflow.  Anyone out there done something similar that can look at
> > this schema and provide input?
>
> > messages table
>
> > id
> > timestamp
> > sender_id
> > subject
> > message
> > due_date
> > urgent_flag
> > open_flag
> > reply_id
>
> > message_user (table)
>
> > id
> > timestamp
> > message_id
> > receiver_id
> > read_flag
>
> > The CakePHP relations are as follows :
>
> > Message Model
>
> > var $hasMany = array(
> >         'MessageUser' => array(
> >             'className'     => 'MessageUser',
> >             'foreignKey'    => 'message_id',    
> >                 )
> >     );  
> > var $belongsTo = array (
> >     'User' => array (
> >         'className' =>  'User',
> >         'foreignKey' => 'sender_id',
> >     )
> > );
> > var $hasAndBelongsTo=array(
> >     'Message' => array (
> >         'className' => 'Message',
> >         'foreignKey' => 'reply_id',
> >        )
> > );
>
> > MessageUser Model
>
> > var $belongsTo = array (
> >     'User' => array (
> >         'className' =>  'User',
> >         'foreignKey' => 'receiver_id',
> >     ),
> >     'Message' => array (
> >         'className' =>  'Message',
> >         'foreignKey' => 'message_id'
>
> >     )
> > );
>
> [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: Dynamic data in fixtures

2010-11-23 Thread Jacob
You mean like this?

class AnyFixture {

var $today;
var $tomorrow;

function __construct() {
$this->today = date('Y-m-d H:i:s');
$this->tomorrow = date('Y-m-d H:i:s', strtotime('+1 day'));
}
}

On 22 nov, 07:21, Amit Badkas  wrote:
> Hi,
>
> You can't assign default values to class properties using expressions like
> functions etc. Try to populate the data for class property in constructor of
> the class.
>
> Amit Badkas
>
> PHP Applications for E-Biz:http://www.sanisoft.com
>
> On Thu, Nov 18, 2010 at 7:24 PM, Jacob  wrote:
> > Hello all,
>
> > today I started with unit testing with SimpleTest and ran into a
> > problem. In some model i have a method 'findToday', which finds
> > records where 'day' is set to today's date. It's is a very simple
> > function which works but to become familiar with unit testing I wrote
> > a test en a fixture for it. While writing the fixture I realized that
> > the 'day' field had to be dynamic for the tests to succeed so i made a
> > variable $today which contains todays date date('Y/m/d'). This
> > variable I put in the fixed data.
> > I ran the test and it gave me an error:
> >  'Parse error: syntax error, unexpected '(', expecting ',' or ';'
> > in  on line 18'
> > I ran in to some information which said that fixture data is really
> > fixed, so there can't be any dynamic data in it.
> > How should I fix this problem? I don't want to update my fixtures
> > every time I want to test my function.
>
> > Greetz Jacob
>
> > 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: Drop down menu not retrieving last inserted element in IE

2010-11-23 Thread Joshua Muheim
Internet Explorer is known to be very buggy in such things. Can you
post the HTML source code?

On Tue, Nov 23, 2010 at 7:57 PM, cricket  wrote:
> On Tue, Nov 23, 2010 at 6:10 AM, Master Ram  wrote:
>> Hi.. all
>>
>> I have problem with IE drop down menu.
>>
>> i have inserted one element its stored in the DB. i am fetching that
>> field in the drop down menu. but the last
>>
>> inserted element is not retrieving in the drop down menu. In IE. but
>> its working in Firefox.
>
> Seems like a browser problem, then, and nothing to do with Cake. Do
> you see it when you view source?
>
> By "last element" do you mean a recently-added record? Could the page
> simply be cached?
>
> 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: Acl and bindNode

2010-11-23 Thread netusco
I just had the same problem, it really looks like a bug on cakephp...

It was working when ids of groups where the same as ids of aros, but
not working when different.

I agree with parallel 32 but I would prefer not to use his approach as
it would break in any upgrading...

Is there anyone who could get a light on this issue?

thanks

On Nov 22, 8:37 pm, Jeremy Burns | Class Outfit
 wrote:
> See the previous reply in this thread that arrived yesterday - haven't 
> followed it through yet.
>
> Jeremy Burns
> Class Outfit
>
> jeremybu...@classoutfit.comhttp://www.classoutfit.com
>
> On 21 Nov 2010, at 22:49, Rajat wrote:
>
> > i m also facing this issue.
> > did u get any official updates on this?
>
> > On Nov 4, 1:34 am, Jeremy Burns | Class Outfit
> >  wrote:
> >> I'm still really hoping that someone with some inside knowledge can shed a 
> >> light on this for me.
>
> >> Jeremy Burns
> >> Class Outfit
>
> >> jeremybu...@classoutfit.comhttp://www.classoutfit.com
>
> >> On 1 Nov 2010, at 07:24, Jeremy Burns | Class Outfit wrote:> Because the 
> >> users table has a group_id on it.
>
> >>> Jeremy Burns
> >>> Class Outfit
>
> >>> jeremybu...@classoutfit.com
> >>>http://www.classoutfit.com
>
> >>> On 31 Oct 2010, at 14:48, huoxito wrote:
>
>  Guess I dont get your point.
>
>  Users still must de added on Aro's table, otherwise how would your
>  system know that an user A belongs to group ALFA ?
>
>  On 29 out, 08:23, Jeremy Burns | Class Outfit
>   wrote:
> > Anybody else got any more ideas on this? Anyone using it with success?
>
> > Jeremy Burns
> > Class Outfit
>
> > jeremybu...@classoutfit.com
> > (t) +44 (0) 208 123 3822
> > (m) +44 (0) 7973 481949
> > Skype: jeremy_burnshttp://www.classoutfit.com
>
> > On 27 Oct 2010, at 17:10, Jeremy Burns | Class Outfit wrote:
>
> >> I wish that were the case, but the guide then gives an example of the 
> >> aros table, which only includes 
> >> groups:http://book.cakephp.org/view/1547/Acts-As-a-Requester
>
> >> Jeremy Burns
> >> Class Outfit
>
> >> jeremybu...@classoutfit.com
> >>http://www.classoutfit.com
>
> >> On 27 Oct 2010, at 13:41, cricket wrote:
>
> >>> On Tue, Oct 26, 2010 at 4:40 PM, Jeremy Burns
> >>>  wrote:
>  According to the online tutorial:
>
>  "
>  In case we want simplified per-group only permissions, we need to
>  implement bindNode() in User model.
>  Code View
>
>  function bindNode($user) {
>    return array('Group' => array('id' => $user['User']['group_id']));
>  }
>
>   function bindNode($user) {
>      return array('Group' => array('id' => $user['User']
>  ['group_id']));
>   }
>
>  This method will tell ACL to skip checking User Aro's and to check
>  only Group Aro's.
>  "
>
>  I've done this but I'm still getting users added to the aros table.
>  What am I missing?
>
> >>> I believe that's normal. Users will still be present in aros but the
> >>> point is that ACL won't /check/ User, but Group.
>
> >>> Check out the new CakePHP Questions 
> >>> sitehttp://cakeqs.organdhelpothers 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 sitehttp://cakeqs.organdhelpothers 
> >> 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 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 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 unsub

Re: Behaviors that arm models with new public methods, e.g. $model->readRandom()?

2010-11-23 Thread Joshua Muheim
Thank you, Majna!

On Tue, Nov 23, 2010 at 10:17 PM, majna  wrote:
>  if ($this->MyModel->Behaviors->attached('Translate'))
>
> http://api13.cakephp.org/class/behavior-collection#method-BehaviorCollectionattached
>
> On Nov 23, 3:09 pm, Joshua Muheim  wrote:
>> Oh, and is there a standard way to check whether a behavior is loaded?
>> E.g. when creating behaviors that are depending on other behaviors?
>>
>> Thanks,
>> Josh
>>
>> On Tue, Nov 23, 2010 at 3:08 PM, Joshua Muheim  wrote:
>> > Oh great, I was exactly on the right track but didn't dig deep enough!
>> > Silly me. Thanks for the hint!
>>
>> > On Tue, Nov 23, 2010 at 2:42 PM, euromark  
>> > wrote:
>> >> well, usually, if you attach behaviors you can access those public
>> >> methods from the model:
>>
>> >> $this->Model->thisisabehaviormethod() etc
>>
>> >> so i would recommand using behaviors - thats pretty much exactly what
>> >> those behaviors are supposed to do
>> >> they enhance your current model.
>>
>> >> e.g. Tree Behavior:
>> >> genereteetreelist() can then be called in the model itself, like you
>> >> wanted to
>>
>> >> On 23 Nov., 09:02, Joshua Muheim  wrote:
>> >>> So far I didn't come to a better solution than just wrapping the
>> >>> methods I want to implement:
>>
>> >>> class AppModel extends Model {
>> >>>   function someFunction($params) {
>> >>>     return BetterModel::someFunction($params);
>> >>>   }
>>
>> >>> }
>>
>> >>> But I remember that there's some OOP function in PHP5 that catches
>> >>> missing methods, right? In CakePHP, what is done with it? I know that
>> >>> I get "error in your sql syntax" or something when calling a not
>> >>> existing method, so I think CakePHP already uses this method for
>> >>> something specific, but I'm going to investigate this further. Maybe I
>> >>> can use it for my purpose (sending calls to not existing methods to a
>> >>> module or something), too. :-)
>>
>> >>> On Mon, Nov 22, 2010 at 6:13 PM, psybear83  wrote:
>> >>> > Hi all
>>
>> >>> > I have some functionality in my AppModel that I'd like to publish as a
>> >>> > plugin or so, so I can re-use the code in other projects.
>>
>> >>> > So far it looks like this:
>>
>> >>> > class AppModel extends Model {
>> >>> >  function readRandom() {}
>> >>> > }
>>
>> >>> > Now one possibility is to extract my functionality into a class that
>> >>> > will be put between AppModel and Model:
>>
>> >>> > class BetterModel extends Model {
>> >>> >  function readRandom() {}
>> >>> > }
>>
>> >>> > class AppModel extends BetterModel {
>> >>> > }
>>
>> >>> > But this isn't very flexible be cause I'm constructing a fixed
>> >>> > inheritance chain this way. In every project I'd have to put this
>> >>> > manually into my AppModel - when only having one such feature-rich
>> >>> > model this isn't a big problem, but what when I have several more
>> >>> > feature-rich models? AppModelWithFunctionality,
>> >>> > AppModelWithMoreFunctionality, AppModelWithEvenMoreFunctionality etc.?
>> >>> > Then the inheritance chain gets really awkward and isn't flexible
>> >>> > anymore when differently combining those functionalities in different
>> >>> > projects.
>>
>> >>> > So is there a solution for this? With behaviors one can create awesome
>> >>> > functionality that is run automatically, but I don't see that they
>> >>> > would help me in solving my problem...? Or do I miss something?
>>
>> >>> > Thanks a lot
>> >>> > Josh
>>
>> >>> > 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 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
>

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

Re: Behaviors that arm models with new public methods, e.g. $model->readRandom()?

2010-11-23 Thread majna
 if ($this->MyModel->Behaviors->attached('Translate'))

http://api13.cakephp.org/class/behavior-collection#method-BehaviorCollectionattached

On Nov 23, 3:09 pm, Joshua Muheim  wrote:
> Oh, and is there a standard way to check whether a behavior is loaded?
> E.g. when creating behaviors that are depending on other behaviors?
>
> Thanks,
> Josh
>
> On Tue, Nov 23, 2010 at 3:08 PM, Joshua Muheim  wrote:
> > Oh great, I was exactly on the right track but didn't dig deep enough!
> > Silly me. Thanks for the hint!
>
> > On Tue, Nov 23, 2010 at 2:42 PM, euromark  
> > wrote:
> >> well, usually, if you attach behaviors you can access those public
> >> methods from the model:
>
> >> $this->Model->thisisabehaviormethod() etc
>
> >> so i would recommand using behaviors - thats pretty much exactly what
> >> those behaviors are supposed to do
> >> they enhance your current model.
>
> >> e.g. Tree Behavior:
> >> genereteetreelist() can then be called in the model itself, like you
> >> wanted to
>
> >> On 23 Nov., 09:02, Joshua Muheim  wrote:
> >>> So far I didn't come to a better solution than just wrapping the
> >>> methods I want to implement:
>
> >>> class AppModel extends Model {
> >>>   function someFunction($params) {
> >>>     return BetterModel::someFunction($params);
> >>>   }
>
> >>> }
>
> >>> But I remember that there's some OOP function in PHP5 that catches
> >>> missing methods, right? In CakePHP, what is done with it? I know that
> >>> I get "error in your sql syntax" or something when calling a not
> >>> existing method, so I think CakePHP already uses this method for
> >>> something specific, but I'm going to investigate this further. Maybe I
> >>> can use it for my purpose (sending calls to not existing methods to a
> >>> module or something), too. :-)
>
> >>> On Mon, Nov 22, 2010 at 6:13 PM, psybear83  wrote:
> >>> > Hi all
>
> >>> > I have some functionality in my AppModel that I'd like to publish as a
> >>> > plugin or so, so I can re-use the code in other projects.
>
> >>> > So far it looks like this:
>
> >>> > class AppModel extends Model {
> >>> >  function readRandom() {}
> >>> > }
>
> >>> > Now one possibility is to extract my functionality into a class that
> >>> > will be put between AppModel and Model:
>
> >>> > class BetterModel extends Model {
> >>> >  function readRandom() {}
> >>> > }
>
> >>> > class AppModel extends BetterModel {
> >>> > }
>
> >>> > But this isn't very flexible be cause I'm constructing a fixed
> >>> > inheritance chain this way. In every project I'd have to put this
> >>> > manually into my AppModel - when only having one such feature-rich
> >>> > model this isn't a big problem, but what when I have several more
> >>> > feature-rich models? AppModelWithFunctionality,
> >>> > AppModelWithMoreFunctionality, AppModelWithEvenMoreFunctionality etc.?
> >>> > Then the inheritance chain gets really awkward and isn't flexible
> >>> > anymore when differently combining those functionalities in different
> >>> > projects.
>
> >>> > So is there a solution for this? With behaviors one can create awesome
> >>> > functionality that is run automatically, but I don't see that they
> >>> > would help me in solving my problem...? Or do I miss something?
>
> >>> > Thanks a lot
> >>> > Josh
>
> >>> > 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 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: cakephp Messaging sysytem

2010-11-23 Thread John Andersen
You should specify your requirement to the messaging system!
1) A message must have a sender.
2) A message must have one or more receivers.
3) A message must indicate for each receiver, whether it has been read
or not.
4) A message must retain its list of receivers, even though a receiver
has deleted the message.
5) A message must retain its sender, even though the sender has
deleted the message.
6) Messages between a sender and a receiver will be shown together
(correspondance).

User A -> sends -> message A
User A -> is sender of -> message A
User B -> receives -> message A
User B -> is receiver of -> message A

So User A sees the correspondance with User B as:
1) all the messages User A sends.
2) all the messages User A receives for which User B is sender of.

So the models/associations become:
User, Correspondance, Adressee, Message
User hasAndBelongsToMany Message using Correspondance
User hasAndBelongsToMany Message using Adressee
and reverse.

The above is just thrown together from what I would require from a
message system. Can probably be improved :)
Enjoy,
   John


On 23 Nov., 17:45, "whmeroe"  wrote:
> I've been doing some reading on how to set up the tables as I would want
> each message to go to multiple users if the sender so desires.  I found this
> on stackoverflow.  Anyone out there done something similar that can look at
> this schema and provide input?
>
> messages table
>
> id
> timestamp
> sender_id
> subject
> message
> due_date
> urgent_flag
> open_flag
> reply_id
>
> message_user (table)
>
> id
> timestamp
> message_id
> receiver_id
> read_flag
>
> The CakePHP relations are as follows :
>
> Message Model
>
> var $hasMany = array(
>         'MessageUser' => array(
>             'className'     => 'MessageUser',
>             'foreignKey'    => 'message_id',    
>                 )
>     );  
> var $belongsTo = array (
>     'User' => array (
>         'className' =>  'User',
>         'foreignKey' => 'sender_id',
>     )
> );
> var $hasAndBelongsTo=array(
>     'Message' => array (
>         'className' => 'Message',
>         'foreignKey' => 'reply_id',
>        )
> );
>
> MessageUser Model
>
> var $belongsTo = array (
>     'User' => array (
>         'className' =>  'User',
>         'foreignKey' => 'receiver_id',
>     ),
>     'Message' => array (
>         'className' =>  'Message',
>         'foreignKey' => 'message_id'
>
>     )
> );
[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: cakephp + jquery help

2010-11-23 Thread Michael T
Note that if you want to use the JsHelper, you might find that some
jQuery widgets/functions might not be available e.g. autocomplete. You
will have to extend the JsHelper yourself to do that.

Good luck!

On Nov 19, 12:42 am, jd  wrote:
> Hi All
>
> Excuse the beginners question but...
>
> I want to learn how to use jquery with cake. I presume that I should
> use the JS helper. Apart from the docs at book.cakephp.org and
> api.cakephp.org, are there any good sources of info for a beginner? I
> have found lots of articles through Google, but they are a little over
> my head. I have a good understanding of JavaScript and Ajax, but I am
> relatively new to jquery.
>
> Thanks in advance,
>
> J

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: AJAX Chain Reaction - Multiple Divs.

2010-11-23 Thread Michael T
Hi Stephen,

We need some more information about your problem to be able to help.

What does your code look like at the moment? Are you using any of the
AJAX/JS helper methods provided by Cake? Which JS engine are you using
(jQuery, prototype, ...)? Are you firing a new AJAX request each time
the value of a select list changes? Are you pre-loading all
conceivable options once at the start and just selecting the
appropriate subset of options when you change values?

Regards,
Michael

On Nov 22, 11:09 pm, Stephen  wrote:
> Hi There
>
> I have a system in place for adding, editing and duplicating orders which
> relies on ajax heavily. When adding an item, you select from an initial drop
> down list which will then in turn load the next drop down list and so on and
> so on.
> They go in this order:
>
> 1. Identifier (Preloaded)
> 2. Category (Compulsory)
> 3. Product (Optional)
> 4. Size (Optional)
> 5. Fabric (Compulsory)
> 6. Loads a list of options, then the choices associated to each option.
>
> It all works great at the moment, for adding, editing and duplicating items
>
> My manager has asked me to show all the drop down boxes at once with the
> defaults already selected depending on which Identifier you choose, I have
> managed to select the category by default - but then selecting the product
> (if applicable), size (if applicable), fabric and all associated options -
> based on the selection of "1. Identifier" is proving a little more difficult
> because I still want the users to be able to modify their selection at any
> point.
>
> I did see this:http://www.reversefolds.com/articles/show/ajaxbut I'm not
> sure if I can make it load 5 actions one by one and update the associated
> divs
>
> Any advice?
>
> --
> Kind Regards
>  Stephen

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: JS helper

2010-11-23 Thread Michael T
Huoxito - are you referring to server side and client side validation?
Generally, it's a good idea to do both anyway. That way you can
guarantee that even if someone attempts to trick the server into
saving something invalid, it will still be validated.

On Nov 22, 7:22 pm, huoxito  wrote:
> I just thought the section about the request method as weel as the
> other,http://book.cakephp.org/view/1593/Methods, could have a better
> example to make things clearer about it. Also I believe the way i
> treat ajax calls on controller is a little bit messy, as for example
> when trying to save some data I need to put conditions both on the
> controller code and on the js view code in order to give a relevant
> answer to the user. Wish I knew, if there is any, a way to make it in
> only one part of the code.
>
> and thanks for offering help here Mark
>
> On 22 nov, 02:45, mark_story  wrote:
>
>
>
>
>
>
>
> > Sorry to hear you aren't enjoying the JsHelper.  I've updated the
> > documentation examples for Ajax Pagination to include the omissions
> > you had trouble with (http://book.cakephp.org/view/1600/Ajax-
> > Pagination).
>
> > As for the complexity of making links, you could use JsHelper::link()
> > to make those a bit easier.
>
> > echo $this->Js->link(
> >   $image,
> >   array('controller' => 'characters', 'action' => 'display', $id),
> >   array('update' => '#InfoBox1', 'before' => ''),
> > );
>
> > would create the  and the necessary javascript.  What else did you
> > find lacking in the documentation for JsHelper?  Hopefully, I can add
> > some more examples and clarify some of the missing information.  For
> > some background on the helper,  it wasn't intended to solve every
> > javascript need you could possibly have, as that's an impossible goal
> > to try and achieve.  In the past there were numerous complaints about
> > how AjaxHelper was too tightly coupled to Prototype and that it would
> > be nice to have something that integrated with other libraries like
> > jQuery.  JsHelper does solve that issue, and provides an extensible
> > interface for you to plug in Javascript generating functions.  But it
> > doesn't and can't prevent you from having to write Javascript. Sorry
> > that it didn't meet your expectations on that front.
>
> > -Mark
>
> > On Sep 27, 3:56 am, "l...@poczta.fm"  wrote:
>
> > > Hi,
>
> > > I needed a simple Ajax feature to load box with additional info and
> > > close it after reading. I am new to Ajax and seldom used JS scripts
> > > till now. I need your opinion/help on optimizing following piece of
> > > code. The JS helper documentation is terrible - I'll share my
> > > experience on this at the end of this post for these interested.
> > > Please advice on questions that follow the code.
>
> > > 1. I have 'ajaxInfoBox' element that is called with an ID of the
> > > object I want to display. I have a need of few on the page hence
> > > element - to keep unique div ids.
> > > 2. Element displays icons with arrows down (opens box when clicked)
> > > and up (closes box when clicked). Additionally they hide/show
> > > alternatively themselves. Also I have a hidden busy indicator on main
> > > layout that is copied and displayed within the box while the box data
> > > is being loaded.
> > > 3. The content of the box comes (Ajax request) from another
> > > controller, which prepares set of data and renders it through
> > > dedicated HTML view. To makes things simple (I am not efficient in JS)
> > > I prefer using HTML views rather then JSON and JQuery loaded by
> > > inclusions functions.
>
> > > Here is the 'ajaxInfoBox' element code (bare functionality, no
> > > exceptions):
>
> > >         echo '';
> > >         echo ' > > alt="Info">'.$this->Html->image('icons/Colored/PNG/arrow_down.png').'';
>
> > >         echo $this->Js->get('#OpenCommand'.$Id)->event('click',
> > >                 $this->Js->request(array('controller' => 'Characters', 
> > > 'action' =>
> > > 'displayCharacter', $Id), array (
> > >                         'update' => '#InfoBox'.$Id,
> > >                         'before' 
> > > =>'$("#busy-indicator").clone().appendTo("#InfoBox'.
> > > $Id.'").show();'
> > >                         . '$("#InfoBox'.$Id.'").show();',
> > >                 ))
> > >         );
> > >         echo $this->Js->get('#OpenCommand'.$Id)->event('click', '$
> > > ("#OpenCommand'.$Id.'").hide();');
> > >         echo $this->Js->get('#OpenCommand'.$Id)->event('click', '$
> > > ("#CloseCommand'.$Id.'").show();');
> > >         echo ' > > style="display: none">'.$this->Html->image('icons/Colored/PNG/
> > > arrow_top.png').'';
> > >         echo $this->Js->get('#CloseCommand'.$Id)->event('click', '$
> > > ("#InfoBox'.$Id.'").empty();');
> > >         echo $this->Js->get('#CloseCommand'.$Id)->event('click', '$
> > > ("#CloseCommand'.$Id.'").hide();');
> > >         echo $this->Js->get('#CloseCommand'.$Id)->event('click', '$
> > > ("#InfoBox'.$Id.'").hide();');
> > >         echo $this->Js->get

Re: CakePHP 1.3, JSHelper and Autocomplete, Missing method?

2010-11-23 Thread Michael T
I ran into this issue a while ago. I decided to add the autocomplete
method to the JsHelper / jQuery engine myself. Here's what you need to
do.

In jquery_engine.php, you need to create an autocomplete method. You
can copy/paste from a similar method e.g. the 'sortable' method. You
might want to make some modifications regarding the callback functions
that you pass in the options argument. This is what I had in the end:

/**
 * Create an autocomplete element.
 *
 * @param array $options Array of options for the autocomplete.
 * @return string Completed autocomplete script.
 * @access public
 * @see JsBaseEngineHelper::autocomplete() for options list.
 */
function autocomplete($options = array()) {
$template = '%s.autocomplete({%s});';
// don't escape the 'select' or 'search' functions
$callbacks = array('select', 'search');
return $this->_methodTemplate('autocomplete', $template, 
$options,
$callbacks);
}

Note that if you want to use Autocomplete's custom rendering (http://
jqueryui.com/demos/autocomplete/#custom-data), you'll have to change
the template above and allow for additional arguments that specify the
rendering function.

If you want to make the rendered JS for the autocomplete appear in the
JS buffer, you need to add your 'autocomplete' method to the list of
bufferedMethods in the JsBaseEngineHelper class (js.php).

That should be it! You can then use your autocomplete in your view
like this:

$this->Js->get('#employee_autocomplete')->autocomplete(
array(  'source' => $this->Html-
>url(array('controller'=>'employees',
'action'=>'get_employee_names')),
'minLength' => 3,
'search' => 'function (event, ui) { ... }',
'select' => 'function (event, ui) { ... }'));

One last hint - FireBug (or similar network debugging tool) is your
friend when trying to figure out why your AJAX posts don't return any
results. You can check the "Response" tab for Cake/PHP generated
errors.

Hope this helps!

On Nov 19, 7:06 am, nurvzy  wrote:
> That cookbook link you reference is for the Ajax Helper, not the
> JsHelper.  To my knowledge autocomplete is not supported out of the
> box using the JsHelper.  But it's simple enough to do on your own.
>
> http://docs.jquery.com/UI/Autocomplete
>
> Nick
>
> On Nov 18, 1:09 am, Louie Miranda  wrote:
>
>
>
>
>
>
>
> > I am trying to migrate my autocomplete to JSHelper using JQuery (As the
> > default). And I think there are no documentation or examples yet that has
> > been publicized as of this writing.
>
> > Anyway, I did what the manual has told...
>
> > *Controller:*
> > var $helpers = array('Html', 'Form', 'Time', 'Js' => array('Jquery'));
>
> > *Default.ctp*
> > echo 
> > $html->script('http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js');
> > $this->Js->JqueryEngine->jQueryObject = '$j';
> > print $this->Html->scriptBlock('var $j = jQuery.noConflict();',
> >     array('inline' => false)); //Tell jQuery to go into noconflict mode
>
> > *Now, from autocomplete (under view).*
>
> > *The old code:*
> > autoComplete('q', '/publications/autocompletetitle',
> > array('minChars' => 4, 'class' => 'search')); ?>
>
> > *Was switched to the following:*
> > autoComplete('q', '/publications/autocompletetitle',
> > array('minChars' => 4, 'class' => 'search')); ?>
>
> > And the usual, it did not worked! :(. I turned-on debug and found this error
> > message.
> > *JsHelper:: Missing Method autoComplete is undefined
> > [CORE/cake/libs/view/helpers/js.php, line 154]*
>
> > So, I searched the API for 
> > JSHelper.http://api13.cakephp.org/view_source/js-helper/
>
> > And I did not find the code. The odd thing was actually following the
> > example of the cakephp book for 1.3 for 
> > autocomplete.http://book.cakephp.org/view/1370/autoComplete, and it turned 
> > out wrong.
>
> > Any ideas, how can I make autocomplete work on the new JSHelper? But, if the
> > method does not exist, then it won't make any sense. I think I am missing
> > something here? :(
>
> > Please help.
> > --
> > Louie Miranda
> >  - Email: lmira...@gmail.com
> >  - Web:http://www.louiemiranda.com

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: Drop down menu not retrieving last inserted element in IE

2010-11-23 Thread cricket
On Tue, Nov 23, 2010 at 6:10 AM, Master Ram  wrote:
> Hi.. all
>
> I have problem with IE drop down menu.
>
> i have inserted one element its stored in the DB. i am fetching that
> field in the drop down menu. but the last
>
> inserted element is not retrieving in the drop down menu. In IE. but
> its working in Firefox.

Seems like a browser problem, then, and nothing to do with Cake. Do
you see it when you view source?

By "last element" do you mean a recently-added record? Could the page
simply be cached?

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: Controller::__mergeVars() automatically adds model class to Controller::uses that doesn't exist! --psybear

2010-11-23 Thread Miles J
Cake automatically adds a model to your controller based on your
controllers name. To disable that, pass an empty $uses.

public $uses = array();

On Nov 23, 8:47 am, AD7six  wrote:
> On Nov 23, 5:02 pm, psybear83  wrote:
>
> > Hey everybody
>
> > Because I need it in every controller.
>
> which is IMO a classic mistake.
>
> Don't you have $this->OtherModel->User always available?
>
> AD

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: Controller::__mergeVars() automatically adds model class to Controller::uses that doesn't exist! --psybear

2010-11-23 Thread AD7six


On Nov 23, 5:02 pm, psybear83  wrote:
> Hey everybody
>
> Because I need it in every controller.

which is IMO a classic mistake.

Don't you have $this->OtherModel->User always available?

AD

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::__mergeVars() automatically adds model class to Controller::uses that doesn't exist! --psybear

2010-11-23 Thread psybear83
Hey everybody

Because I need it in every controller, I have added 'User' to
AppController::uses. But then something strange happened: When calling
my SearchController, I got the error that the table searches for the
model Search doesn't exist. The funny thing: there IS no Search model.
I tracked the problem down to the following cause... but let me
explain the context first.

My SearchController is able to search in any models that are specified
in the following var:

Configure::write('Zivi.search.models', array(
'admin' => array('User', 'Problem') // When in 'admin' context,
search in these models...
,'lib' => array('Medium', 'Author') // etc...
,'users' => array('User')
,'inv' => array('Hardware')
,'term' => array('TermolinoWord')
,'contr' => array('Contract')
));

The context is set using the URL parameter "layout", and the models to
search are set using an overridden constructClasses() method:

  function constructClasses() {
$conf = Configure::read($this->usesConfigureKey);
$layout = $this->__getLayout();
if (!empty($conf[$layout])) {
 $this->uses = $conf[$layout];
} else {
 trigger_error(get_class($this).' is not using any models with
layout "'
   .$layout.'", you have to configure it in core.php: "'
   .$this->usesConfigureKey.'"', E_USER_WARNING);
}

return parent::constructClasses();
  }

This just sets the $this->uses variable to one of the arrays in the
"Zivi.search.models" setting.

So far, so good. Everything worked before I added the User model to
AppController::uses. But as said, after adding it, CakePHP complained
that the table searches is missing.

The problem is in Controller::__mergeVars(), look at the last line of
the following code:

function __mergeVars() {
$pluginName = Inflector::camelize($this->plugin);
$pluginController = $pluginName . 'AppController';

if (is_subclass_of($this, 'AppController') || 
is_subclass_of($this,
$pluginController)) {
$appVars = get_class_vars('AppController');
$uses = $appVars['uses'];
$merge = array('components', 'helpers');
$plugin = null;

if (!empty($this->plugin)) {
$plugin = $pluginName . '.';
if (!is_subclass_of($this, $pluginController)) {
$pluginController = null;
}
} else {
$pluginController = null;
}

if ($uses == $this->uses && !empty($this->uses)) {
if (!in_array($plugin . $this->modelClass, 
$this->uses)) {
array_unshift($this->uses, $plugin . 
$this->modelClass);

This makes that a model "Search" is added to the $this->uses variable,
because $uses is Array('User') and $this->uses is Array('User'), too!
So it adds $plugin.$this->modelClass to $this->uses, while $plugin is
empty (don't really know what's this for) and $this->modelClass is
"Search".

I don't really know why CakePHP adds this model to the $this->uses
variable - SearchController DOESN'T have a primary model, so it
shouldn't be added automatically, should it? Or does CakePHP enforce
every controller to have a primary model?

At the time being I solved the problem by adding another model to be
searched instead of only User:

Configure::write('Zivi.search.models', array(
...
,'users' => array('User', 'UserProfile')
...
));

This prevents addition of the Search model. It's working, but I'm
still wondering where's the real problem here. Maybe I'm doing
something in an unclean way?

Thanks a lot for replies... This one really freaked me out some
hours. ;-)
Josh

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: Model - Retrieve data

2010-11-23 Thread Sarpidon
Or even better this!!!

Example:

Array
(
[Projectcategory] = Array
 (
   [id] => 2
   [title] => Residential
   [alias] => residential
   [imagepath] =>
   [weight] => 1
   [published] => 1
   [RANDOM IMAGE FROM PROJECTS BELONG TO THIS CATEGORY FOUND
IN PROJECTIMAGES TABLE WHICH BELONGS TO PROJECTS]
 )
}

Thanks!

On Nov 23, 5:49 pm, Sarpidon  wrote:
> Hi. I am not sure how to do the following  - what is the best
> practice.
>
> I have a Projectcategories table that has many Projects.
> A Project has many Projectimages. What I want to do is to get the
> Projectcategory and a random image for each Project from
> Projectimages.
>
> For example:
>
> Array
> (
>     [Projectcategory] => Array
>         (
>             [id] => 2
>             [title] => Residential
>             [alias] => residential
>             [imagepath] =>
>             [weight] => 1
>             [published] => 1
>         )
>
>     [Project] => Array
>         (
>             [0] => Array
>                 (
>                     [id] => 1
>                     [category_id] => 2
>                     [title] => Project title
>                     [weight] => 1
>                     [published] => 1
>                     [Projectimage] => Random image from Projectimages
> table
>                )
>           )
> )
>
> I hope I am making my self clear :)
>
> 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


Model - Retrieve data

2010-11-23 Thread Sarpidon
Hi. I am not sure how to do the following  - what is the best
practice.

I have a Projectcategories table that has many Projects.
A Project has many Projectimages. What I want to do is to get the
Projectcategory and a random image for each Project from
Projectimages.

For example:

Array
(
[Projectcategory] => Array
(
[id] => 2
[title] => Residential
[alias] => residential
[imagepath] =>
[weight] => 1
[published] => 1
)

[Project] => Array
(
[0] => Array
(
[id] => 1
[category_id] => 2
[title] => Project title
[weight] => 1
[published] => 1
[Projectimage] => Random image from Projectimages
table
   )
  )
)

I hope I am making my self clear :)

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: some acl and auth problem

2010-11-23 Thread pave2009
here is the link:
http://book.cakephp.org/view/1543/Simple-Acl-controlled-Application
please check your cakephp version tutorial.Link shows tute for cakephp
1.3.x

On Nov 22, 4:48 pm, hoss7  wrote:
> i am new in cakephp ,and i want use ,user and group and permation
> system,but i cant find out how can i install cakephp acl and auth for
> use in my project,i am search internet and all cakephp website but i
> cant find how can i use it,i dont want use plugin for solve this
> problem, please help me and show me best way

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: IIS

2010-11-23 Thread pave2009
Yes, It works!!

here is the link: 
http://bakery.cakephp.org/articles/filippo.toso/2008/01/29/cakephp-on-iis
hope it solves the problem.

On Nov 22, 10:28 pm, Kevin Davis  wrote:
> Hi there,
>
> Can CakePHP work on IIS??

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: Behaviors that arm models with new public methods, e.g. $model->readRandom()?

2010-11-23 Thread Joshua Muheim
Oh, and is there a standard way to check whether a behavior is loaded?
E.g. when creating behaviors that are depending on other behaviors?

Thanks,
Josh

On Tue, Nov 23, 2010 at 3:08 PM, Joshua Muheim  wrote:
> Oh great, I was exactly on the right track but didn't dig deep enough!
> Silly me. Thanks for the hint!
>
> On Tue, Nov 23, 2010 at 2:42 PM, euromark  wrote:
>> well, usually, if you attach behaviors you can access those public
>> methods from the model:
>>
>> $this->Model->thisisabehaviormethod() etc
>>
>> so i would recommand using behaviors - thats pretty much exactly what
>> those behaviors are supposed to do
>> they enhance your current model.
>>
>> e.g. Tree Behavior:
>> genereteetreelist() can then be called in the model itself, like you
>> wanted to
>>
>>
>> On 23 Nov., 09:02, Joshua Muheim  wrote:
>>> So far I didn't come to a better solution than just wrapping the
>>> methods I want to implement:
>>>
>>> class AppModel extends Model {
>>>   function someFunction($params) {
>>>     return BetterModel::someFunction($params);
>>>   }
>>>
>>> }
>>>
>>> But I remember that there's some OOP function in PHP5 that catches
>>> missing methods, right? In CakePHP, what is done with it? I know that
>>> I get "error in your sql syntax" or something when calling a not
>>> existing method, so I think CakePHP already uses this method for
>>> something specific, but I'm going to investigate this further. Maybe I
>>> can use it for my purpose (sending calls to not existing methods to a
>>> module or something), too. :-)
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> On Mon, Nov 22, 2010 at 6:13 PM, psybear83  wrote:
>>> > Hi all
>>>
>>> > I have some functionality in my AppModel that I'd like to publish as a
>>> > plugin or so, so I can re-use the code in other projects.
>>>
>>> > So far it looks like this:
>>>
>>> > class AppModel extends Model {
>>> >  function readRandom() {}
>>> > }
>>>
>>> > Now one possibility is to extract my functionality into a class that
>>> > will be put between AppModel and Model:
>>>
>>> > class BetterModel extends Model {
>>> >  function readRandom() {}
>>> > }
>>>
>>> > class AppModel extends BetterModel {
>>> > }
>>>
>>> > But this isn't very flexible be cause I'm constructing a fixed
>>> > inheritance chain this way. In every project I'd have to put this
>>> > manually into my AppModel - when only having one such feature-rich
>>> > model this isn't a big problem, but what when I have several more
>>> > feature-rich models? AppModelWithFunctionality,
>>> > AppModelWithMoreFunctionality, AppModelWithEvenMoreFunctionality etc.?
>>> > Then the inheritance chain gets really awkward and isn't flexible
>>> > anymore when differently combining those functionalities in different
>>> > projects.
>>>
>>> > So is there a solution for this? With behaviors one can create awesome
>>> > functionality that is run automatically, but I don't see that they
>>> > would help me in solving my problem...? Or do I miss something?
>>>
>>> > Thanks a lot
>>> > Josh
>>>
>>> > 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
>>
>

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: Behaviors that arm models with new public methods, e.g. $model->readRandom()?

2010-11-23 Thread Joshua Muheim
Oh great, I was exactly on the right track but didn't dig deep enough!
Silly me. Thanks for the hint!

On Tue, Nov 23, 2010 at 2:42 PM, euromark  wrote:
> well, usually, if you attach behaviors you can access those public
> methods from the model:
>
> $this->Model->thisisabehaviormethod() etc
>
> so i would recommand using behaviors - thats pretty much exactly what
> those behaviors are supposed to do
> they enhance your current model.
>
> e.g. Tree Behavior:
> genereteetreelist() can then be called in the model itself, like you
> wanted to
>
>
> On 23 Nov., 09:02, Joshua Muheim  wrote:
>> So far I didn't come to a better solution than just wrapping the
>> methods I want to implement:
>>
>> class AppModel extends Model {
>>   function someFunction($params) {
>>     return BetterModel::someFunction($params);
>>   }
>>
>> }
>>
>> But I remember that there's some OOP function in PHP5 that catches
>> missing methods, right? In CakePHP, what is done with it? I know that
>> I get "error in your sql syntax" or something when calling a not
>> existing method, so I think CakePHP already uses this method for
>> something specific, but I'm going to investigate this further. Maybe I
>> can use it for my purpose (sending calls to not existing methods to a
>> module or something), too. :-)
>>
>>
>>
>>
>>
>>
>>
>> On Mon, Nov 22, 2010 at 6:13 PM, psybear83  wrote:
>> > Hi all
>>
>> > I have some functionality in my AppModel that I'd like to publish as a
>> > plugin or so, so I can re-use the code in other projects.
>>
>> > So far it looks like this:
>>
>> > class AppModel extends Model {
>> >  function readRandom() {}
>> > }
>>
>> > Now one possibility is to extract my functionality into a class that
>> > will be put between AppModel and Model:
>>
>> > class BetterModel extends Model {
>> >  function readRandom() {}
>> > }
>>
>> > class AppModel extends BetterModel {
>> > }
>>
>> > But this isn't very flexible be cause I'm constructing a fixed
>> > inheritance chain this way. In every project I'd have to put this
>> > manually into my AppModel - when only having one such feature-rich
>> > model this isn't a big problem, but what when I have several more
>> > feature-rich models? AppModelWithFunctionality,
>> > AppModelWithMoreFunctionality, AppModelWithEvenMoreFunctionality etc.?
>> > Then the inheritance chain gets really awkward and isn't flexible
>> > anymore when differently combining those functionalities in different
>> > projects.
>>
>> > So is there a solution for this? With behaviors one can create awesome
>> > functionality that is run automatically, but I don't see that they
>> > would help me in solving my problem...? Or do I miss something?
>>
>> > Thanks a lot
>> > Josh
>>
>> > 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
>

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


pagination url options

2010-11-23 Thread Dmitry Shevchenko
Hi.
I found a some error when using paginator-> options ( .. url ..)

for example this is my call for paginator in view.
$paginator->options  (array('url' => $this->data['Search'] ..

and if data['Search'] is flat array - all is good - it will create a
correct url
but if it contain a sub arrays like:
$url=   array(
"controller" => "profiles",
"plugin" => null,
"page" => 1,
"search_type" => "advanced",
"age_from" => "0",
"age_to" => "0",
"with_photo" => "0",
"is_online" => "0",
"seeking" => array(
"5",
"7"
),

I'm getting a Array to string conversion [ROOT\cake\cake\libs
\router.php, line 952]

It seems cake doesn't convert sub arrays like
seeking=&seeking[]=1&seeking[]=2&seeking[]=4&seeking[]=7


Do anyone knew some workaround for this?


p.s. I'm using cake 1.2.6 and possibly found a bug

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: Behaviors that arm models with new public methods, e.g. $model->readRandom()?

2010-11-23 Thread euromark
well, usually, if you attach behaviors you can access those public
methods from the model:

$this->Model->thisisabehaviormethod() etc

so i would recommand using behaviors - thats pretty much exactly what
those behaviors are supposed to do
they enhance your current model.

e.g. Tree Behavior:
genereteetreelist() can then be called in the model itself, like you
wanted to


On 23 Nov., 09:02, Joshua Muheim  wrote:
> So far I didn't come to a better solution than just wrapping the
> methods I want to implement:
>
> class AppModel extends Model {
>   function someFunction($params) {
>     return BetterModel::someFunction($params);
>   }
>
> }
>
> But I remember that there's some OOP function in PHP5 that catches
> missing methods, right? In CakePHP, what is done with it? I know that
> I get "error in your sql syntax" or something when calling a not
> existing method, so I think CakePHP already uses this method for
> something specific, but I'm going to investigate this further. Maybe I
> can use it for my purpose (sending calls to not existing methods to a
> module or something), too. :-)
>
>
>
>
>
>
>
> On Mon, Nov 22, 2010 at 6:13 PM, psybear83  wrote:
> > Hi all
>
> > I have some functionality in my AppModel that I'd like to publish as a
> > plugin or so, so I can re-use the code in other projects.
>
> > So far it looks like this:
>
> > class AppModel extends Model {
> >  function readRandom() {}
> > }
>
> > Now one possibility is to extract my functionality into a class that
> > will be put between AppModel and Model:
>
> > class BetterModel extends Model {
> >  function readRandom() {}
> > }
>
> > class AppModel extends BetterModel {
> > }
>
> > But this isn't very flexible be cause I'm constructing a fixed
> > inheritance chain this way. In every project I'd have to put this
> > manually into my AppModel - when only having one such feature-rich
> > model this isn't a big problem, but what when I have several more
> > feature-rich models? AppModelWithFunctionality,
> > AppModelWithMoreFunctionality, AppModelWithEvenMoreFunctionality etc.?
> > Then the inheritance chain gets really awkward and isn't flexible
> > anymore when differently combining those functionalities in different
> > projects.
>
> > So is there a solution for this? With behaviors one can create awesome
> > functionality that is run automatically, but I don't see that they
> > would help me in solving my problem...? Or do I miss something?
>
> > Thanks a lot
> > Josh
>
> > 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: Authentication against 2 different user tables

2010-11-23 Thread Naresh Kumar
Hi,

If you use ACL it will help.

Regards,
Naresh

On Mon, Nov 22, 2010 at 8:01 PM, Johannes  wrote:

> Hello,
>
> I want to set up a new project, using CakePHP 1.3 and have one big
> problem.
>
> I have set up all the tables i need, but i have 2 "user-tables" called
> users and agents.
> I want to set up 2 different login sites, one for the users and one
> for the agents (who have more or the less CRUD-Gui for the items they
> are linked with).
>
> But i have no clue, how to tell cake, that only "agents" have access
> to the administration an not all the users.
> ---> Would one table "users" with acl be the best way?
>
> there is also one other thing, i have the tables:
> agents
> agents_events   -> "administrating"
> agents_locations-> "administrating"
> users
> users_event  -> "attending"
> locations_users -> "bookmarked"
>
> this is very convenient, because i have the agents and the users baked
> in their own controller, which i wouldn't have if the agents and users
> would be in one table, the problem is, that the agents and users have
> different actions & fields in the database.
>
> Is there an best-practice-way to have at least 2 different
> loginsystems? (e.g. Frontend / Backenduser) ?
>
> LG.
> Jo
>
> 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: Authentication against 2 different user tables

2010-11-23 Thread Santiago Basulto
What happens if you want to have a user that is both, a member and an
Agent?

On Nov 22, 11:31 am, Johannes  wrote:
> Hello,
>
> I want to set up a new project, using CakePHP 1.3 and have one big
> problem.
>
> I have set up all the tables i need, but i have 2 "user-tables" called
> users and agents.
> I want to set up 2 different login sites, one for the users and one
> for the agents (who have more or the less CRUD-Gui for the items they
> are linked with).
>
> But i have no clue, how to tell cake, that only "agents" have access
> to the administration an not all the users.
> ---> Would one table "users" with acl be the best way?
>
> there is also one other thing, i have the tables:
> agents
> agents_events       -> "administrating"
> agents_locations    -> "administrating"
> users
> users_event          -> "attending"
> locations_users     -> "bookmarked"
>
> this is very convenient, because i have the agents and the users baked
> in their own controller, which i wouldn't have if the agents and users
> would be in one table, the problem is, that the agents and users have
> different actions & fields in the database.
>
> Is there an best-practice-way to have at least 2 different
> loginsystems? (e.g. Frontend / Backenduser) ?
>
> LG.
> Jo

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


Drop down menu not retrieving last inserted element in IE

2010-11-23 Thread Master Ram
Hi.. all

I have problem with IE drop down menu.

i have inserted one element its stored in the DB. i am fetching that
field in the drop down menu. but the last

inserted element is not retrieving in the drop down menu. In IE. but
its working in Firefox.

regards:
Master



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: Session data missing

2010-11-23 Thread Renato de Freitas Freire
You may check your domain config.
I solved my "losing session data" changing the scope of cookie session
on php.ini.

I guess you are using a shared host, or a server with more then one domain.



On Tuesday, November 23, 2010, Raph  wrote:
> Hello,
>
> We had weird problem with session data.
>
> Let's say we have a kind of wizard with two steps. In first step we
> saving some data in session i.e.:
>
> $this->Session->write('user.step1.data', 'foo');
>
> In second step we have:
>
> if (!$this->Session->check('user.step1.data')) {
>                 $this->flash(__('No data', true), array('controller'
> => 'user', 'action' => 'step1'), 2);
>  }
>
> $seekId = $this->User->field('id', array('User.data' => $this->Session-
>>read('user.step1.data')));
>
> The problem is that we had situation where data from session
> (('user.step1.data') was missing (I have no idea why) in step, but
> session key 'user.step1.data' left, so condition  'if (!$this->Session-
>>check('user.step1.data'))' was false, and the next line of code was
> actually:
>
> $seekId = $this->User->field('id', array('User.data' => null));
>
> This situation is rare (we had it twice), but dangerous. Did you have
> similiar situations? What's is the reason of it? Maybe it's good idea
> to report this as a bug? But the problem is I can't recreate this
> problem.
>
>
>
>
> 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
>

-- 

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

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: Session data missing

2010-11-23 Thread Raph
Cake version is 1.2.8.

On 23 Lis, 11:26, Raph  wrote:
> Hello,
>
> We had weird problem with session data.
>
> Let's say we have a kind of wizard with two steps. In first step we
> saving some data in session i.e.:
>
> $this->Session->write('user.step1.data', 'foo');
>
> In second step we have:
>
> if (!$this->Session->check('user.step1.data')) {
>                 $this->flash(__('No data', true), array('controller'
> => 'user', 'action' => 'step1'), 2);
>  }
>
> $seekId = $this->User->field('id', array('User.data' => $this->Session-
>
> >read('user.step1.data')));
>
> The problem is that we had situation where data from session
> (('user.step1.data') was missing (I have no idea why) in step, but
> session key 'user.step1.data' left, so condition  'if 
> (!$this->Session->check('user.step1.data'))' was false, and the next line of 
> code was
>
> actually:
>
> $seekId = $this->User->field('id', array('User.data' => null));
>
> This situation is rare (we had it twice), but dangerous. Did you have
> similiar situations? What's is the reason of it? Maybe it's good idea
> to report this as a bug? But the problem is I can't recreate this
> problem.

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


Session data missing

2010-11-23 Thread Raph
Hello,

We had weird problem with session data.

Let's say we have a kind of wizard with two steps. In first step we
saving some data in session i.e.:

$this->Session->write('user.step1.data', 'foo');

In second step we have:

if (!$this->Session->check('user.step1.data')) {
$this->flash(__('No data', true), array('controller'
=> 'user', 'action' => 'step1'), 2);
 }

$seekId = $this->User->field('id', array('User.data' => $this->Session-
>read('user.step1.data')));

The problem is that we had situation where data from session
(('user.step1.data') was missing (I have no idea why) in step, but
session key 'user.step1.data' left, so condition  'if (!$this->Session-
>check('user.step1.data'))' was false, and the next line of code was
actually:

$seekId = $this->User->field('id', array('User.data' => null));

This situation is rare (we had it twice), but dangerous. Did you have
similiar situations? What's is the reason of it? Maybe it's good idea
to report this as a bug? But the problem is I can't recreate this
problem.




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: application enhancement. how to update acl

2010-11-23 Thread Trent
Use this plugin:

https://github.com/markstory/acl_extras/tree/master

Then you just need to run the following command in your terminal and
it will sync all your acos:
cake acl_extras aco_sync


On Nov 23, 6:40 am, rethab  wrote:
> Hi all
>
> I have a deployed CakePHP application in production with DB based ACL
> for authentication. Every time I enhance the application (like another
> action), I truncate the tables acos and aros_acos. After that, I run
> the build_acl tool (which is suggested in the CakePHP Tutorial) and I
> set all the permissions.
>
> Is that the correct way to do it? How do you do that? I mean, that
> must be a lot of work, update all these tables every time you have an
> enhancement..
>
> Regards,
> Reto

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: Behaviors that arm models with new public methods, e.g. $model->readRandom()?

2010-11-23 Thread Joshua Muheim
So far I didn't come to a better solution than just wrapping the
methods I want to implement:

class AppModel extends Model {
  function someFunction($params) {
return BetterModel::someFunction($params);
  }
}

But I remember that there's some OOP function in PHP5 that catches
missing methods, right? In CakePHP, what is done with it? I know that
I get "error in your sql syntax" or something when calling a not
existing method, so I think CakePHP already uses this method for
something specific, but I'm going to investigate this further. Maybe I
can use it for my purpose (sending calls to not existing methods to a
module or something), too. :-)

On Mon, Nov 22, 2010 at 6:13 PM, psybear83  wrote:
> Hi all
>
> I have some functionality in my AppModel that I'd like to publish as a
> plugin or so, so I can re-use the code in other projects.
>
> So far it looks like this:
>
> class AppModel extends Model {
>  function readRandom() {}
> }
>
> Now one possibility is to extract my functionality into a class that
> will be put between AppModel and Model:
>
> class BetterModel extends Model {
>  function readRandom() {}
> }
>
> class AppModel extends BetterModel {
> }
>
> But this isn't very flexible be cause I'm constructing a fixed
> inheritance chain this way. In every project I'd have to put this
> manually into my AppModel - when only having one such feature-rich
> model this isn't a big problem, but what when I have several more
> feature-rich models? AppModelWithFunctionality,
> AppModelWithMoreFunctionality, AppModelWithEvenMoreFunctionality etc.?
> Then the inheritance chain gets really awkward and isn't flexible
> anymore when differently combining those functionalities in different
> projects.
>
> So is there a solution for this? With behaviors one can create awesome
> functionality that is run automatically, but I don't see that they
> would help me in solving my problem...? Or do I miss something?
>
> Thanks a lot
> Josh
>
> 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