Re: history log table
When I put the $actAs within my user model for example I get the following error: Undefined property: UsersController::$activeUser [APP/ app_controller.php, line 20] Thanks On Oct 5, 8:20 am, elogic wrote: > Thanks, so where do I add the $activeUser part? > > On Oct 5, 2:06 am, majna wrote: > > > > > > > > > Add $actsAs to AppModel -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: history log table
Thanks, so where do I add the $activeUser part? On Oct 5, 2:06 am, majna wrote: > Add $actsAs to AppModel -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: history log table
Add $actsAs to AppModel -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: history log table
I took a look at the loggable behavoir but I wasn't sure where the $activeUser information was to be put. I have done the following: 1. added the logable.php behavour to the models / behavour folder 2. Created a logs table with required feilds. 3. Added the following into my beforefilter in the AppController if (sizeof($this->uses) && $this->{$this->modelClass}->Behaviors- >attached('Logable')) { $this->{$this->modelClass}->setUserData($this->activeUser); } 4. Add the following into the AppController var $actsAs = array('Logable' => array('userModel' => 'User', 'userKey' => 'user_id')); Is this right so far and also where does the active user info go? Thankyou On Oct 4, 10:16 am, elogic wrote: > Thanks, that looks like what I am after. > > On Oct 4, 7:11 am, "Meroe Kush" wrote: > > > > > > > > > Have a look at this: > > >http://bakery.cakephp.org/articles/alkemann/2008/10/21/logablebehavior > > > -Original Message----- > > From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf > > > Of elogic > > Sent: Monday, October 03, 2011 5:07 PM > > To: CakePHP > > Subject: Re: history log table > > > Thanks for the reply. > > > Are you able to explain further or direct me to something online that > > could help me out in getting this sorted? I'm just starting with > > cakephp. > > > Thankyou > > > On Oct 3, 7:59 pm, euromark wrote: > > > you could write a method in the model or even a behavior which will do > > > that for you > > > in the beforeSave() callback it can be triggered globally > > > > On 3 Okt., 06:38, elogic wrote: > > > > > My client wants a listing of all actions that happen within the system > > > > so they can check back and search the records at a later date. > > > > > I thought the best way to handle this would be to have a histories > > > > table which would be similar to below: > > > > > CREATE TABLE `histories` ( > > > > `id` INT(11) NULL AUTO_INCREMENT, > > > > `user_id` INT(11) NOT NULL DEFAULT '0', > > > > `action` VARCHAR(50) NULL DEFAULT NULL, > > > > `content` VARCHAR(250) NULL DEFAULT NULL, > > > > `created` DATETIME NULL DEFAULT NULL, > > > > `modified` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON > > UPDATE > > > > CURRENT_TIMESTAMP, > > > > PRIMARY KEY (`id`), > > > > INDEX `user_id` (`user_id`) > > > > ) > > > > > How would I go about inserting the user_id (the logged user - using > > > > Auth), action (i.e. create, edit, delete, login etc) and content > > > > (added joe blogs or deleted record ID123 etc) from every section > > > > within the site? > > > > > Thanks > > > -- > > Our newest site for the community: CakePHP Video > > Tutorialshttp://tv.cakephp.org > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp > > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > > cake-php+unsubscr...@googlegroups.com For more options, visit this group > > athttp://groups.google.com/group/cake-php -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: history log table
Thanks, that looks like what I am after. On Oct 4, 7:11 am, "Meroe Kush" wrote: > Have a look at this: > > http://bakery.cakephp.org/articles/alkemann/2008/10/21/logablebehavior > > > > > > > > -Original Message- > From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf > > Of elogic > Sent: Monday, October 03, 2011 5:07 PM > To: CakePHP > Subject: Re: history log table > > Thanks for the reply. > > Are you able to explain further or direct me to something online that > could help me out in getting this sorted? I'm just starting with > cakephp. > > Thankyou > > On Oct 3, 7:59 pm, euromark wrote: > > you could write a method in the model or even a behavior which will do > > that for you > > in the beforeSave() callback it can be triggered globally > > > On 3 Okt., 06:38, elogic wrote: > > > > My client wants a listing of all actions that happen within the system > > > so they can check back and search the records at a later date. > > > > I thought the best way to handle this would be to have a histories > > > table which would be similar to below: > > > > CREATE TABLE `histories` ( > > > `id` INT(11) NULL AUTO_INCREMENT, > > > `user_id` INT(11) NOT NULL DEFAULT '0', > > > `action` VARCHAR(50) NULL DEFAULT NULL, > > > `content` VARCHAR(250) NULL DEFAULT NULL, > > > `created` DATETIME NULL DEFAULT NULL, > > > `modified` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON > UPDATE > > > CURRENT_TIMESTAMP, > > > PRIMARY KEY (`id`), > > > INDEX `user_id` (`user_id`) > > > ) > > > > How would I go about inserting the user_id (the logged user - using > > > Auth), action (i.e. create, edit, delete, login etc) and content > > > (added joe blogs or deleted record ID123 etc) from every section > > > within the site? > > > > Thanks > > -- > Our newest site for the community: CakePHP Video > Tutorialshttp://tv.cakephp.org > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help > others with their CakePHP related questions. > > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com For more options, visit this group > athttp://groups.google.com/group/cake-php -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
RE: history log table
Have a look at this: http://bakery.cakephp.org/articles/alkemann/2008/10/21/logablebehavior -Original Message- From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf Of elogic Sent: Monday, October 03, 2011 5:07 PM To: CakePHP Subject: Re: history log table Thanks for the reply. Are you able to explain further or direct me to something online that could help me out in getting this sorted? I'm just starting with cakephp. Thankyou On Oct 3, 7:59 pm, euromark wrote: > you could write a method in the model or even a behavior which will do > that for you > in the beforeSave() callback it can be triggered globally > > On 3 Okt., 06:38, elogic wrote: > > > > > > > > > My client wants a listing of all actions that happen within the system > > so they can check back and search the records at a later date. > > > I thought the best way to handle this would be to have a histories > > table which would be similar to below: > > > CREATE TABLE `histories` ( > > `id` INT(11) NULL AUTO_INCREMENT, > > `user_id` INT(11) NOT NULL DEFAULT '0', > > `action` VARCHAR(50) NULL DEFAULT NULL, > > `content` VARCHAR(250) NULL DEFAULT NULL, > > `created` DATETIME NULL DEFAULT NULL, > > `modified` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE > > CURRENT_TIMESTAMP, > > PRIMARY KEY (`id`), > > INDEX `user_id` (`user_id`) > > ) > > > How would I go about inserting the user_id (the logged user - using > > Auth), action (i.e. create, edit, delete, login etc) and content > > (added joe blogs or deleted record ID123 etc) from every section > > within the site? > > > Thanks -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: history log table
Thanks for the reply. Are you able to explain further or direct me to something online that could help me out in getting this sorted? I'm just starting with cakephp. Thankyou On Oct 3, 7:59 pm, euromark wrote: > you could write a method in the model or even a behavior which will do > that for you > in the beforeSave() callback it can be triggered globally > > On 3 Okt., 06:38, elogic wrote: > > > > > > > > > My client wants a listing of all actions that happen within the system > > so they can check back and search the records at a later date. > > > I thought the best way to handle this would be to have a histories > > table which would be similar to below: > > > CREATE TABLE `histories` ( > > `id` INT(11) NULL AUTO_INCREMENT, > > `user_id` INT(11) NOT NULL DEFAULT '0', > > `action` VARCHAR(50) NULL DEFAULT NULL, > > `content` VARCHAR(250) NULL DEFAULT NULL, > > `created` DATETIME NULL DEFAULT NULL, > > `modified` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE > > CURRENT_TIMESTAMP, > > PRIMARY KEY (`id`), > > INDEX `user_id` (`user_id`) > > ) > > > How would I go about inserting the user_id (the logged user - using > > Auth), action (i.e. create, edit, delete, login etc) and content > > (added joe blogs or deleted record ID123 etc) from every section > > within the site? > > > Thanks -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: history log table
you could write a method in the model or even a behavior which will do that for you in the beforeSave() callback it can be triggered globally On 3 Okt., 06:38, elogic wrote: > My client wants a listing of all actions that happen within the system > so they can check back and search the records at a later date. > > I thought the best way to handle this would be to have a histories > table which would be similar to below: > > CREATE TABLE `histories` ( > `id` INT(11) NULL AUTO_INCREMENT, > `user_id` INT(11) NOT NULL DEFAULT '0', > `action` VARCHAR(50) NULL DEFAULT NULL, > `content` VARCHAR(250) NULL DEFAULT NULL, > `created` DATETIME NULL DEFAULT NULL, > `modified` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE > CURRENT_TIMESTAMP, > PRIMARY KEY (`id`), > INDEX `user_id` (`user_id`) > ) > > How would I go about inserting the user_id (the logged user - using > Auth), action (i.e. create, edit, delete, login etc) and content > (added joe blogs or deleted record ID123 etc) from every section > within the site? > > Thanks -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php