Re: displaying records in index through specific field criteria

2009-05-21 Thread dr. Hannibal Lecter

Well, if you want to filter your data *in the view*, you're doing it
wrong. It would be silly to fetch ten thousand records from the
database just to show five of them. I sure hope that's not what you're
trying to do.

Like Richard said, this is the solution to your problems:

$data = $this-ModelName-find
(
'all',
array
(
'contain' = array('RelatedModel'), // use this if you 
use the
Containable behaviour, if not well, fail..
'conditions'=array('RelatedModel.field' = $yesValue)
)
);

Does that help or did you have something else in mind?

On May 21, 6:42 am, programguru ja...@w3developing.com wrote:
 Is it possible to just run it all in the foreach like?

 foreach ($task['Status=YES'] as $task):
 --
 View this message in 
 context:http://www.nabble.com/displaying-records-in-index-through-specific-fi...
 Sent from the CakePHP mailing list archive at Nabble.com.
--~--~-~--~~~---~--~~
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: Inheriting aco permissions if no aco found in database

2009-05-21 Thread Vitaly Petrov

Can anybody help me?
--~--~-~--~~~---~--~~
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: JavascriptHelper bug?

2009-05-21 Thread Miki

 I've never used blockEnd() and don't quite understand its purpose, but
 codeBlock should take the javascript (as a string) for the first
 param. It will wrap the code with start/stop tags.

Thanks brian.

If you pass the script in the first param it works as you say, but if
the script is null the helper should take the script between the calls
to codeBlock() and blockEnd and do the same thing (if i have
understood the function). The bug is there.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Nested data saving

2009-05-21 Thread emmexx

I'd like to accomplish the following:

I have a Mains table and a Files table
The Main table contains various information.
The Files table records info about one or more files connected to the
Main table (through a foreignkey field).

When I create a new Main record I need to fill in info about the file
(I need to upload a file and make some operation about it). For
example the file could be a gpx or kml file and I want to retrieve
info that are into that file, upload the file, save the path in Files
and save the gpx info in the main table.

I tried to put a link to the 'add' view of Files in the 'add' view of
Mains but after Saving the file record I don't know how to go back to
mains.add without losing data entered in the fields.

I want to know if there's a cake method to to this or if I have to
code everything from scratch.
Note that I don't want to save the main record before having saved the
file record.

Thank you
  maxx
--~--~-~--~~~---~--~~
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 denying access issues

2009-05-21 Thread Delberto

Hello,

Try this page. --http://book.cakephp.org/view/648/Setting-up-
permissions
It is part of the turorial on Auth and ACL. It seems to work for me.

$group = $this-User-Group;

$group-id = 2;
$this-Acl-deny($group, 'controllers');

Best Regards,
  Del

On May 20, 11:33 pm, hahmadi82 hahmad...@gmail.com wrote:
 Hi,

 I have set up my ACL based on this tutorial:

 http://komunitasweb.com/2009/03/cakephp-acl-tutorial-what-and-how/

 This tutorial has a user management system with add, delete, index, and edit
 functionality. The problem I'm having is that no matter how I set up my
 aros_acos permissions, the Users always have access to these pages once
 logged in.  I can deny them access:

 cake acl deny Group.3 Users all

 or not set it up at all, yet once they log in, they have access to all those
 views.  Please help, thanks!

 --
 View this message in 
 context:http://www.nabble.com/ACL-denying-access-issues-tp23644791p23644791.html
 Sent from the CakePHP mailing list archive at Nabble.com.

--~--~-~--~~~---~--~~
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 denying access issues

2009-05-21 Thread hahmadi82


I had actually tried this exact example for the permissions and it didn't
work...


hahmadi82 wrote:
 
 Hi,
 
 I have set up my ACL based on this tutorial:
 
 http://komunitasweb.com/2009/03/cakephp-acl-tutorial-what-and-how/
 
 This tutorial has a user management system with add, delete, index, and
 edit functionality. The problem I'm having is that no matter how I set up
 my aros_acos permissions, the Users always have access to these pages once
 logged in.  I can deny them access:
 
 cake acl deny Group.3 Users all
 
 or not set it up at all, yet once they log in, they have access to all
 those views.  Please help, thanks!
 
 

-- 
View this message in context: 
http://www.nabble.com/ACL-denying-access-issues-tp23644791p23650240.html
Sent from the CakePHP mailing list archive at Nabble.com.


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Quick query regarding routing.

2009-05-21 Thread number9

I've read the cake book and a few blog posts about this but I'm still
not 100% on this.

I have set up sluggable behaviour, so that everything is given a
unique slug from the name, and I append a .html extension on the
end.

I'm now playing around with the routing, but I'm not getting the
results I'm looking for.

Hypothetically lets say I have a controller called posts.

I would like the following URLs for each action:

/posts/ - gives the index action.

/posts/$slug/ - gives the view action (where slug is the post slug).

/posts/new/ - gives the add action.

/posts/edit/$id - gives the edit action (where id is the id of the
post).

So far I have:

  Router::connect('/posts/', array('controller' = 'posts',
'action' = 'index'));// works fine.

  Router::connect('/posts/new/', array('controller' =
'posts', 'action' = 'add'));// works fine

I have managed to get /tips/view/$slug/ with the following:

   Router::connect('/tips/', array('controller' = 'tips',
'action' = 'view'));// works fine

However, I would really like to remove the view from there, because I
don't think it is necessary...

I have tried the following and these were my results:

Router::connect('/tips/*', array('controller' = 'tips', 'action' =
'view'));   // works, but messes up add view.

Router::connect('/tips/:slug/', array('controller' =
'tips', 'action' = 'view'));// same result.

I can understand why it interferes, because it is assuming anything
after tips/ must be a slug name, but I'm not sure what I can do to
avoid it. I'm sure there must be some way.

Apologies, that was quite a long winded way of putting it - but I
would appreciate any help!

Thanks
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Search a location in specific url and manage returned data in XML

2009-05-21 Thread Paulos23

Hi Cake ppl,
First of all i want to ty for your replies and your efforts for all of
us!
To get to the point i want to make a search action with the relevant
search textfield in order to search for locations.Now the specific
location will handle a site http://www.geonames.org/export/geonames-
search.html
which takes some parameters for that location.Let's say that according
to the API i want 1 parameter which is the q.So when the user hits one
location i want to get the returned data and show to him.The returned
data is in XML format so i have to parse it.I am wonder if my search
function is fine coz when i hit a location nothing happened.If anyone
has an opinion plz let me know.
Here is my code to help you as much i can.

Controller:

?php
class DestinationsController extends AppController {
var $name = 'Destinations';


function beforeFilter() {
parent::beforeFilter();
$this-Auth-allow('*');
}

function search() {
$this-layout ='search';
App::import('Core', 'HttpSocket');
$HttpSocket = new HttpSocket();
$results = $HttpSocket-get('http://ws.geonames.org/search?',
'q=name');

}


}
?

View:

div id=search_dest
?php echo ($form-create('Destination', array
('controller'='destinations','action' ='search')));?

fieldset

?php echo $form-input ('name', array('type' = 'text', 'label'=
'Search Location:'));?
/fieldset

br

  ?php echo ($form-submit('Search', array('div' = false,'class'
= 'submitbutton'))); ?

 ?php echo($form-end()); ?
/div

Ty in advance!
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



AppController issue

2009-05-21 Thread lakers fan

Hello,

I want to create a variable and initialize it in say AppController in 
beforeFilter() and use the variable in the view (ctp file). I created a 
variable $admin = false and tried to use it in view and I get error saying 
$admin is undeclared variable. Is there any other way of doing this?

 

Thanks,

Bharani

_
Hotmail® has a new way to see what's up with your friends.
http://windowslive.com/Tutorial/Hotmail/WhatsNew?ocid=TXT_TAGLM_WL_HM_Tutorial_WhatsNew1_052009
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Auth component on IIS7

2009-05-21 Thread andy

Has anyone ever had a problem with the Auth component not working
properly on an IIS7 server? I am able to login and am redirected to
the appropriate page. However, if I try to access another protected
page, I am immediately logged out. I have the same code on an Apache
and it works great.
--~--~-~--~~~---~--~~
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: AppController issue

2009-05-21 Thread Luke

Hi,

I am very new to cakePHP aswell, but I just tried something out which
seems to work. In the beforeFilter of the AppController, I added the
variable the following way:

$this-set('admin', false);

I can now access my $admin in the view without a problem. But as I
said I am very new to cakePHP so maybe a Cake Guru want to comment on
it.

Regards, Luke
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



simpletest and ClassRegistry::init() always loading AppController (?)

2009-05-21 Thread Edmunds Kalnins

Hi!

Has anyone else experienced this? I'm finally trying to add tests to
an existing cake app, and created a simple test case (:

class InviteTestCase extends CakeTestCase {
var $fixtures = array('app.invite');
function testEncodeDecode() {
$this-Invite = ClassRegistry::init('Invite');
}
}

Running which I get error:

Error:  Database table sections for model Section was not found.

Which was really weird, since the model Invite is in no way associated
to Section (in fact it has no associations at all). I finally realized
that for some reason app_controller.php gets called by
ClassRegistry::init('Invite'). Anybody has any ideas why this happens
and how to avoid it? Or should i just stick to:

App::import('Model','Invite');
$this-Invite = new Invite();

if i want to run isolated tests on a model?

--~--~-~--~~~---~--~~
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: AppController issue

2009-05-21 Thread dr. Hannibal Lecter

As Luke already pointed out, to prepare any kind of variable / data
for your views, you need to use the Controller::set() method.

Declaring a variable is not enough because it is only a local var
then, isn't it? Besides, if you view could see every single variable
from your controller, that wouldn't be very clean, right? :)

Also, since this is a very basic question, you might want to take a
look at the blog tutorial in the cookbook.

On May 21, 12:57 pm, lakers fan lakersfa...@msn.com wrote:
 Hello,

     I want to create a variable and initialize it in say AppController in 
 beforeFilter() and use the variable in the view (ctp file). I created a 
 variable $admin = false and tried to use it in view and I get error saying 
 $admin is undeclared variable. Is there any other way of doing this?

 Thanks,

 Bharani

 _
 Hotmail® has a new way to see what's up with your 
 friends.http://windowslive.com/Tutorial/Hotmail/WhatsNew?ocid=TXT_TAGLM_WL_HM...
--~--~-~--~~~---~--~~
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: Star Rating Help

2009-05-21 Thread Faza

I'd start with removing DB connection related settings and replace all 
querying to Cake functions - they all look like basic selects/inserts.

Also you could divide whole this code into some controller functions to 
tidy it up.

Or read the code, understand it, and make a helper from scratch in 
proper cake way :P

cake_baker pisze:
 hey guys i searched the whole google i coudnt find any star rating
 helper for cakephp i found two they are oudated

 i found a star rating called ajaxstarrater_v122 its php and it stores
 it in database and i have no idea how to implement it to cakephp if
 some help here thank you in advance

 these are some code give u ideas


 this is the databse file

 ?php
 /*
 Page:   _config-rating.php
 Created:Aug 2006
 Last Mod:   Mar 18 2007
 Holds info for connecting to the db, and some other vars
 -
 ryan masuga, masugadesign.com
 r...@masugadesign.com
 Licensed under a Creative Commons Attribution 3.0 License.
 http://creativecommons.org/licenses/by/3.0/
 See readme.txt for full credit details.
 - */

   //Connect to  your rating database
   $rating_dbhost= 'localhost';
   $rating_dbuser= 'root';
   $rating_dbpass= 'root';
   $rating_dbname= 'rating';
   $rating_tableName = 'ratings';
   $rating_path_db   = ''; // the path to your db.php file (not used
 yet!)
   $rating_path_rpc  = ''; // the path to your rpc.php file (not
 used yet!)

   $rating_unitwidth = 30; // the width (in pixels) of each rating
 unit (star, etc.)
   // if you changed your graphic to be 50 pixels wide, you should
 change the value above

 $rating_conn = mysql_connect($rating_dbhost, $rating_dbuser,
 $rating_dbpass) or die  ('Error connecting to mysql');
   //mysql_select_db($rating_dbname);

 ?



 this _drawrating.php


 ?php
 /*
 Page:   _drawrating.php
 Created:Aug 2006
 Last Mod:   Mar 18 2007
 The function that draws the rating bar.
 -
 ryan masuga, masugadesign.com
 r...@masugadesign.com
 Licensed under a Creative Commons Attribution 3.0 License.
 http://creativecommons.org/licenses/by/3.0/
 See readme.txt for full credit details.
 - */
 function rating_bar($id,$units='',$static='') {

 require('_config-rating.php'); // get the db connection info

 //set some variables
 $ip = $_SERVER['REMOTE_ADDR'];
 if (!$units) {$units = 10;}
 if (!$static) {$static = FALSE;}

 // get votes, values, ips for the current rating bar
 $query=mysql_query(SELECT total_votes, total_value, used_ips FROM
 $rating_dbname.$rating_tableName WHERE id='$id' )or die( Error:
 .mysql_error());


 // insert the id in the DB if it doesn't exist already
 // see: 
 http://www.masugadesign.com/the-lab/scripts/unobtrusive-ajax-star-rating-bar/#comment-121
 if (mysql_num_rows($query) == 0) {
 $sql = INSERT INTO $rating_dbname.$rating_tableName
 (`id`,`total_votes`, `total_value`, `used_ips`) VALUES ('$id', '0',
 '0', '');
 $result = mysql_query($sql);
 }

 $numbers=mysql_fetch_assoc($query);


 if ($numbers['total_votes']  1) {
   $count = 0;
 } else {
   $count=$numbers['total_votes']; //how many votes total
 }
 $current_rating=$numbers['total_value']; //total number of rating
 added together and stored
 $tense=($count==1) ? vote : votes; //plural form votes/vote

 // determine whether the user has voted, so we know how to draw the ul/
 li
 $voted=mysql_num_rows(mysql_query(SELECT used_ips FROM $rating_dbname.
 $rating_tableName WHERE used_ips LIKE '%.$ip.%' AND id='.$id.'
 ));

 // now draw the rating bar
 $rating_width = @number_format($current_rating/$count,2)*
 $rating_unitwidth;
 $rating1 = @number_format($current_rating/$count,1);
 $rating2 = @number_format($current_rating/$count,2);


 if ($static == 'static') {

   $static_rater = array();
   $static_rater[] .= \n.'div class=ratingblock';
   $static_rater[] .= 'div id=unit_long'.$id.'';
   $static_rater[] .= 'ul id=unit_ul'.$id.' class=unit-rating
 style=width:'.$rating_unitwidth*$units.'px;';
   $static_rater[] .= 'li class=current-rating style=width:'.
 $rating_width.'px;Currently '.$rating2.'/'.$units.'/li';
   $static_rater[] .= '/ul';
   $static_rater[] .= 'p class=static'.$id.'. Rating: strong 
 '.
 $rating1.'/strong/'.$units.' ('.$count.' '.$tense.' cast) emThis
 is \'static\'./em/p';
   $static_rater[] .= '/div';
   $static_rater[] .= '/div'.\n\n;

   return join(\n, $static_rater);


 } else {

   $rater ='';
   $rater.='div class=ratingblock';

   $rater.='div id=unit_long'.$id.'';
   $rater.='  ul id=unit_ul'.$id.' class=unit-rating
 

Un-needed Controllers

2009-05-21 Thread Dave Maharaj :: WidePixels.com
I have 5 or 6 empty controllers. I merged all the admin functions to the
app_controller and these controllers now have no functions inside them.
 
For example my bookmarks controller is simply
?php
  class BookmarksController extends AppController
  {
  var $name = 'Bookmarks';
  var $helpers = array('Html', 'Form');
  var $uses = array('Bookmark');

  function beforeFilter()
  {
  parent::beforeFilter();
  $this-Auth-autoRedirect = false;
  }
}
?
 
These controllers all have models that are needed but can remove these
controllers from the app? 
 
Dave

--~--~-~--~~~---~--~~
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: Poll: what do you hate about CakePHP?

2009-05-21 Thread rich...@home

One minor niggle-ette for me:

I hate how form helpers $form-create() doesn't default to the current
actions (it defaults to add). I always end up having to type:

?echo $form-create(User, array(action=$this-action)) ?

oh, and another:

$html-css() defaults to inline, it should default to putting it in
the $script_for_layout. As it doesn't, you have to type:

$html-css(my_css, null, array(), false);

(same with the $javascript helper too)
--~--~-~--~~~---~--~~
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: Un-needed Controllers

2009-05-21 Thread rich...@home

No, you can't. If you remove them you will get a controller not found
error when you go to your bookmarks pages

On a side note, you can remove the $uses line as CakePHP automatically
adds the model associated with the controller (unless your
AppController explicitly sets $uses = array() )

On May 21, 3:27 pm, Dave Maharaj :: WidePixels.com
d...@widepixels.com wrote:
 I have 5 or 6 empty controllers. I merged all the admin functions to the
 app_controller and these controllers now have no functions inside them.

 For example my bookmarks controller is simply
 ?php
   class BookmarksController extends AppController
   {
       var $name = 'Bookmarks';
       var $helpers = array('Html', 'Form');
       var $uses = array('Bookmark');

       function beforeFilter()
       {
           parent::beforeFilter();
           $this-Auth-autoRedirect = false;
       }}

 ?

 These controllers all have models that are needed but can remove these
 controllers from the app?

 Dave
--~--~-~--~~~---~--~~
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: JavascriptHelper bug?

2009-05-21 Thread brian

On Thu, May 21, 2009 at 4:38 AM, Miki morbeg...@gmail.com wrote:

 I've never used blockEnd() and don't quite understand its purpose, but
 codeBlock should take the javascript (as a string) for the first
 param. It will wrap the code with start/stop tags.

 Thanks brian.

 If you pass the script in the first param it works as you say, but if
 the script is null the helper should take the script between the calls
 to codeBlock() and blockEnd and do the same thing (if i have
 understood the function). The bug is there.

Yes, I think I see what you mean. I hadn't noticed that. Sorry, I
don't think I can help.

--~--~-~--~~~---~--~~
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: Un-needed Controllers

2009-05-21 Thread keymaster

I like Grigri's generic controller approach for eliminating empty
controllers:

http://groups.google.com/group/cake-php/browse_thread/thread/7638b690ae0545ff/1845d3c1c30d3a03?lnk=gstq=generic+controller#1845d3c1c30d3a03

disclaimer - although it's on my list to implement, I haven't gotten
to it yet, so can't tell you if there are any gotchas (sorry), but it
seems pretty straightforward.

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



Re: Problem with Auth. with an AJAX Request

2009-05-21 Thread christo

well, i haven't done this specifically so I'm not sure I can
demonstrate exactly how, but you probably either have to allow
('addToWatchlist') in your before filter then instead test if the
request comes from a logged in user in that action before you add the
link to the watch list. If it does NOT, you can serve up a login form
in a popup window via AJAX, but you won't be redirected unless you do
some kind of javascript XML or JSON test on the response.
The reason you don't redirect is that if you let auth handle the
'behind the scenes' request, it will simply re-route the request to
your default login redirect - probably the login page - which won't do
anything at all since you aren't doing anything with the request. You
should read up on AJAX. If you want to know how to serve up a login
form with AJAX and submit it start with a basic AJAX tutorial and go
from there?

http://www.w3schools.com/Ajax/Default.Asp




On May 20, 4:21 pm, Luke eik...@hotmail.com wrote:
 Hi,

 I am not sure what else I could copy  paste from the sourcecode. I
 only have a normal login action, in my user controller, which only
 saves the last login and thats pretty much it. An Login AJAX action?
 How would this look?
 Have you got an example?

 Thanks. Luke

 On 20 Mai, 22:18, christo christia...@gmail.com wrote:

  all I can think of is that you don't have a login AJAX action set up
  so the request dies without redirecting to a log in if you try to
  access the link from not logged in? I dunno it's hard to tell from
  your description. pastebin maybe?


--~--~-~--~~~---~--~~
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: Poll: what do you hate about CakePHP?

2009-05-21 Thread dr. Hannibal Lecter

Oh yeah, +1 on everything you sad man. That action thing is a real
mystery and a major pain.

On May 21, 4:49 pm, rich...@home richardath...@gmail.com wrote:
 One minor niggle-ette for me:

 I hate how form helpers $form-create() doesn't default to the current
 actions (it defaults to add). I always end up having to type:

 ?echo $form-create(User, array(action=$this-action)) ?

 oh, and another:

 $html-css() defaults to inline, it should default to putting it in
 the $script_for_layout. As it doesn't, you have to type:

 $html-css(my_css, null, array(), false);

 (same with the $javascript helper too)
--~--~-~--~~~---~--~~
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: Modelling Users, Groups, Portfolios and Media using CakePHP

2009-05-21 Thread christo

question 4 has all the other questions in it so...

if this is the way you want your app to work, then this is how to set
it up. An alternative might be to have a portfolios table and a medias
table, and include a user_id, and a group_id in each so that each
belongs to a user and/or a group. OR you can link each with two habtm
tables.  That way you don't have repeats of your data.


On May 20, 6:54 pm, Shiv Indap indap.s...@gmail.com wrote:
 I am creating a simple design for a social-networking site using
 CakePHP for a project, I have a table called Users which stores all
 the User Details, I have a Groups Table which stores all the Group
 details, the relation between these 2 models is has and belongs to
 many, then I have a group_portfolios table which stores all portfolios
 belonging to a group and a user_portfolio table which stores all
 portfolio information related to a user. A user can have multiple
 portfolios A group can have multiple portfolios A user can have many
 media A group can have many Media

 I have separated the functionality for media associated with users and
 groups, My question would be,

 1) am I thinking in the correct way in terms of modelling an MVC
 application?
 2) Since I am separating the the functionality for users and groups I
 am ending up with 2 tables for all information related to them e.g
 media and portfolio. Does this cause any redundancy and performance
 related issues, especially when searching for a portfolio and so on?
 3) Will this be able to scale when I want to add more features later
 on?
 4) Is there a better way to model the system?

 Thank You
--~--~-~--~~~---~--~~
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: Star Rating Help

2009-05-21 Thread Henrique Machado
I never saw a decent solution to the cake when it comes to star rating

Henrique Machado



2009/5/21 Faza f...@ansi.pl


 I'd start with removing DB connection related settings and replace all
 querying to Cake functions - they all look like basic selects/inserts.

 Also you could divide whole this code into some controller functions to
 tidy it up.

 Or read the code, understand it, and make a helper from scratch in
 proper cake way :P

 cake_baker pisze:
  hey guys i searched the whole google i coudnt find any star rating
  helper for cakephp i found two they are oudated
 
  i found a star rating called ajaxstarrater_v122 its php and it stores
  it in database and i have no idea how to implement it to cakephp if
  some help here thank you in advance
 
  these are some code give u ideas
 
 
  this is the databse file
 
  ?php
  /*
  Page:   _config-rating.php
  Created:Aug 2006
  Last Mod:   Mar 18 2007
  Holds info for connecting to the db, and some other vars
  -
  ryan masuga, masugadesign.com
  r...@masugadesign.com
  Licensed under a Creative Commons Attribution 3.0 License.
  http://creativecommons.org/licenses/by/3.0/
  See readme.txt for full credit details.
  - */
 
//Connect to  your rating database
$rating_dbhost= 'localhost';
$rating_dbuser= 'root';
$rating_dbpass= 'root';
$rating_dbname= 'rating';
$rating_tableName = 'ratings';
$rating_path_db   = ''; // the path to your db.php file (not
 used
  yet!)
$rating_path_rpc  = ''; // the path to your rpc.php file (not
  used yet!)
 
$rating_unitwidth = 30; // the width (in pixels) of each rating
  unit (star, etc.)
// if you changed your graphic to be 50 pixels wide, you should
  change the value above
 
  $rating_conn = mysql_connect($rating_dbhost, $rating_dbuser,
  $rating_dbpass) or die  ('Error connecting to mysql');
//mysql_select_db($rating_dbname);
 
  ?
 
 
 
  this _drawrating.php
 
 
  ?php
  /*
  Page:   _drawrating.php
  Created:Aug 2006
  Last Mod:   Mar 18 2007
  The function that draws the rating bar.
  -
  ryan masuga, masugadesign.com
  r...@masugadesign.com
  Licensed under a Creative Commons Attribution 3.0 License.
  http://creativecommons.org/licenses/by/3.0/
  See readme.txt for full credit details.
  - */
  function rating_bar($id,$units='',$static='') {
 
  require('_config-rating.php'); // get the db connection info
 
  //set some variables
  $ip = $_SERVER['REMOTE_ADDR'];
  if (!$units) {$units = 10;}
  if (!$static) {$static = FALSE;}
 
  // get votes, values, ips for the current rating bar
  $query=mysql_query(SELECT total_votes, total_value, used_ips FROM
  $rating_dbname.$rating_tableName WHERE id='$id' )or die( Error:
  .mysql_error());
 
 
  // insert the id in the DB if it doesn't exist already
  // see:
 http://www.masugadesign.com/the-lab/scripts/unobtrusive-ajax-star-rating-bar/#comment-121
  if (mysql_num_rows($query) == 0) {
  $sql = INSERT INTO $rating_dbname.$rating_tableName
  (`id`,`total_votes`, `total_value`, `used_ips`) VALUES ('$id', '0',
  '0', '');
  $result = mysql_query($sql);
  }
 
  $numbers=mysql_fetch_assoc($query);
 
 
  if ($numbers['total_votes']  1) {
$count = 0;
  } else {
$count=$numbers['total_votes']; //how many votes total
  }
  $current_rating=$numbers['total_value']; //total number of rating
  added together and stored
  $tense=($count==1) ? vote : votes; //plural form votes/vote
 
  // determine whether the user has voted, so we know how to draw the ul/
  li
  $voted=mysql_num_rows(mysql_query(SELECT used_ips FROM $rating_dbname.
  $rating_tableName WHERE used_ips LIKE '%.$ip.%' AND id='.$id.'
  ));
 
  // now draw the rating bar
  $rating_width = @number_format($current_rating/$count,2)*
  $rating_unitwidth;
  $rating1 = @number_format($current_rating/$count,1);
  $rating2 = @number_format($current_rating/$count,2);
 
 
  if ($static == 'static') {
 
$static_rater = array();
$static_rater[] .= \n.'div class=ratingblock';
$static_rater[] .= 'div id=unit_long'.$id.'';
$static_rater[] .= 'ul id=unit_ul'.$id.'
 class=unit-rating
  style=width:'.$rating_unitwidth*$units.'px;';
$static_rater[] .= 'li class=current-rating
 style=width:'.
  $rating_width.'px;Currently '.$rating2.'/'.$units.'/li';
$static_rater[] .= '/ul';
$static_rater[] .= 'p class=static'.$id.'. Rating:
 strong '.
  $rating1.'/strong/'.$units.' ('.$count.' '.$tense.' cast) emThis
  is \'static\'./em/p';
$static_rater[] .= '/div';
$static_rater[] .= '/div'.\n\n;
 
   

ACL model.id and alias from console

2009-05-21 Thread rrd...@gmail.com

Hari,

Is there any way to create an ACL node by the console which has
model.id AND alias property also? I may do it by sql but I can not
figure out how to do it with the cake console.
--~--~-~--~~~---~--~~
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 much to donate to CakePHP???

2009-05-21 Thread Tim

I am finishing up some cake projects and I am going to donate a small
amount back to the community. What is a reasonable amount to ask my
company to donate for each project completed in cake? What amounts
have you guys donated in the past?

I assume the donations go for developer pizza parties?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



User Registration Default Group

2009-05-21 Thread nic

Can someone inform me of the best way to set a default group for a new
user?

--~--~-~--~~~---~--~~
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 much to donate to CakePHP???

2009-05-21 Thread Gwoo

pizza is good...
--~--~-~--~~~---~--~~
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: Detecting if a link is to an image

2009-05-21 Thread JamesF

before you save the data you could run a regex replace function on
$this-data['Data']['texarea'] to search for urls and add the html
tags around it.

On May 21, 12:01 am, Kyle Decot kdec...@gmail.com wrote:
 I might look into those. I quickly ran into a problem because I tried
 to do $text-autoLink($autolink-images($text)); and the autoLink does
 not have a considerHtml option. Any ideas?

 On May 20, 11:53 pm, Andrew McCafferty andrew.mccaffe...@gmail.com
 wrote:

  Glad it works...

  You might be better trying out the Textile or BBCode helpers though if
  you need more flexibility:

 http://cakeforge.org/projects/textilehelper/http://bakery.cakephp.org...

  On 21 May, 04:15, Kyle Decot kdec...@gmail.com wrote:

   Awesome! It's definetly a step in the right direction. I've already
   added it here:

  http://www.theskateparkdirectory.com/forums/industry-news/clear-odyss...

   I'll probably end up modifying it as there are some other things I
   would like it to do. Perhaps when it's done, We can post it on the
   bakery! Thanks!

   On May 20, 11:03 pm, Andrew McCafferty andrew.mccaffe...@gmail.com
   wrote:

Hi Kyle,

I've hacked together a helper based on the TextHelper methods that
should do what you're looking for...

   http://bin.cakephp.org/view/1261676226

Save it to app/views/helpers/autolink.php and include it in your
helpers array:

var $helpers = array('Html', 'Form', 'Autolink');

And in your view:

?php echo $autolink-images($post['Post']['content']); ?

Not very well tested I'm afraid but it should give you some ideas...

On 21 May, 02:00, Kyle Decot kdec...@gmail.com wrote:

 I would prefer not allowing the users to use a WYSIWYG editor. I would
 rather they use a simple textarea, and if they happen to include a URL
 in their post, then change that into a link, somewhat like $text-

 autoLink() but instead of creating links, create img /'s

 On May 20, 8:46 pm, JamesF usaexportexpe...@gmail.com wrote:

  you might want to check out the jquery fck editor plugin. i use this
  in conjunction with jquery to turn my text area inputs into a 
  wysiwyg
  editor and it saves html to the database. (make sure you sanitize
  first).

  so if you were to go this route you first need to get jquery working
  in its most basic form on your site, than get the fck editor plugin
  for jquery, then install fck to your vendors folder.

  explaining in detail would be a bit lengthy but i hope it gives you
  some ideas.

  On May 20, 3:10 am, Kyle Decot kdec...@gmail.com wrote:

   I am building a forum and I want to make it so that if someone 
   enters
   some text w/ a link to an image in it, my script will take out the
   link and replace it w/ the image. Anyone know how I would do 
   this? I
   would also like to do the same thing w/ youtube and vimeo links 
   in the
   future. Thanks for any insight or help you can provide.
--~--~-~--~~~---~--~~
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: Poll: what do you hate about CakePHP?

2009-05-21 Thread Rich

If you still use PHP4 on production servers your framework might not
be your biggest problem :-)  True that Alex, true that.

On May 20, 10:09 am, Alexandru Ciobanu ics.cake...@gmail.com wrote:
 On 05/20/2009 10:20 AM, Constantin Botnari wrote: Smelly i totally agree 
 with you :) and for all haters of php4 support
  in cake : people php4 support is vital for an framework !!! that means
  i can develop my cake app for any php version starting from php4 an
  ending with php5! its a real pain for an developer if he has to
  develop an web app and production server is built with php4..

 PHP4 support was nice (not vital) one year ago, now it's pretty much
 useless...
 As of 2008-08-08 the PHP team completely ignores PHP4; this means not
 even critical security fixes.
 If you still use PHP4 on production servers your framework might not be
 your biggest problem :-)
--~--~-~--~~~---~--~~
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: Poll: what do you hate about CakePHP?

2009-05-21 Thread Javier Adrian Ortiz de la Tabla

El mié, 20-05-2009 a las 08:19 -0700, avairet escribió:

 I hate the lack of rigor with relational model and SQL norm. I think
 compound primary keys, sub-queries, multi-level JOIN should be
 implemented. It will permit to avoid artificial id in HABTM for
 example and thus tons of intermediate queries. More data types should
 be available too (like ENUM and SET for MySQL).
+1
 I hate the limited internationalisation of core methods like
 Validate::alphanumeric() or Inflector::slug(). Accented and special
 chars should be available and mb_ functions might be used, maybe by
 including localized chars files (setting a var in config/core.php for
 example). More internationalisation for Validate::phone() or
 Validate::ssn() would be great too. We can help you to do that: please
 delegate some responsibilities to the numerous dynamic international
 communities!
+1


--~--~-~--~~~---~--~~
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: Star Rating Help

2009-05-21 Thread cake_baker

Your are Right Henrique Machado i searched the whole google i couldnt
find any good one.

well this is the problem i'm new to cake  this is what i did to this
code

i create the database table then MVC then linked the java files and
css what i dont know is how to the database instert /selects  ajax
calls in cakephp  is this something you put in model or controller
never done it before

this is the link to the file 
http://www.masugadesign.com/the-lab/scripts/unobtrusive-ajax-star-rating-bar/
if some one wanna help me with that i think there is alot of people
looking for star rating for cakephp .


there is alot of star rating  helpers for Ruby on Rails all other
framework but not cakephp


thank you all

--~--~-~--~~~---~--~~
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 can related records be removed when master is deleted?

2009-05-21 Thread John R

Isn't this what deleteAll() is for?
--~--~-~--~~~---~--~~
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: displaying records in index through specific field criteria

2009-05-21 Thread programguru


Lector,

Yes. This does help. But my confusion lies in how specifically I update my
foreach loop based on this new controller var.

I don't understand what you meant by fail below either. I am certainly not
using Containable.

$data = $this-Task-find
('all', array ('contain' = array('Status'),
'conditions'=array('Status.name' = $yesValue)
)
);

I updated the above code with what I believe is correct for my use based on
your notes.

My taskstable is associated to the statusestable (and association is working
perfect). statuses table has name col.

Does the above code belong in my task_controller ? And in order to generate
this query in my view, what data do I use for the foreach? I am currently
using this format:

foreach ($tasks as $task): 

and accessing each like so: ... $task['Task']['description'] ...

---

Thanks in advance for any advice on this... I've been banging my head over
this in the cake help area and a Cake book I've been reading, and can't
seem to revolve it..




-- 
View this message in context: 
http://www.nabble.com/displaying-records-in-index-through-specific-field-criteria-tp23641397p23661732.html
Sent from the CakePHP mailing list archive at Nabble.com.


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Heads up: UUID pimary field can now be stored as binary instead of char

2009-05-21 Thread Aaron Shafovaloff

Just a heads up: CakePHP, as of about 2 months ago I think, supports
UUIDs as a binary primary field type instead of just char.

See:

https://trac.cakephp.org/ticket/4119

I believe the field length still has to be 36.

From this:

http://www.mysqlperformanceblog.com/2007/03/13/to-uuid-or-not-to-uuid/

I think I gather that using the binary field type brings it down to 16
bytes instead of 36 bytes (even though the field length is left at
36?).

Take care,

Aaron
--~--~-~--~~~---~--~~
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: Heads up: UUID pimary field can now be stored as binary instead of char

2009-05-21 Thread Aaron Shafovaloff

Hrmm, actually from this:

http://kekoav.com/blog/36-computers/58-uuids-as-primary-keys-in-mysql.html

and this:

http://www.mydatabasesupport.com/forums/mysql/246972-uuid-datatype.html

... it seems one really does need to use binary(16) and then perform a
hex conversion, otherwise there isn't a performance increase. But
CakePHP requires the length of 36 with a binary type.

Any thoughts?

On May 21, 5:09 pm, Aaron  Shafovaloff aarons...@gmail.com wrote:
 Just a heads up: CakePHP, as of about 2 months ago I think, supports
 UUIDs as a binary primary field type instead of just char.

 See:

 https://trac.cakephp.org/ticket/4119

 I believe the field length still has to be 36.

 From this:

 http://www.mysqlperformanceblog.com/2007/03/13/to-uuid-or-not-to-uuid/

 I think I gather that using the binary field type brings it down to 16
 bytes instead of 36 bytes (even though the field length is left at
 36?).

 Take care,

 Aaron
--~--~-~--~~~---~--~~
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 Routing Dilemma

2009-05-21 Thread Dave Maharaj :: WidePixels.com
I have a problem and wondering if there is a quick solution to this.
 
In my routes i have:
Router::connect('/journals/:entry_key', array('controller' = 'journals',
'action' = 'view'),array('entry_key' = '[-_A-Za-z0-9]+','pass' =
array('entry_key')));
which works fine.
 
In the view i have a AJAX link to save the page as a bookmark which also
works perfect.
 
Issue is if i firebug the link that renders journals/save/58gh26 and edit
the link to journals/save/ removing the entry_id and try saving, Cake thinks
save is a entry_key and renders a blank entry page into the div where
Saved message would normally appear because the is no entry called save
 
I tried adding this to the controller inside the if
($this-RequestHandler-isAjax()) {
if (empty($entry_key)) {
  $this-layout = 'ajax';
  $this-render('/errors/entry_error');
  }
But it seems the routes is still taking over because the empty journal page
loads.
 
My question is how can i ensure that if the entry_id is removed by the user
messing around that it renders an error rather than what it is currently
doing?
 
I was thinking a work around may be adding a route to journal/save to
'controller' = 'journals', 'action' = 'error'
 
and make a error function inside the controller to render either the Ajax
error or standard html error page depending on how the user arrived to
journals/save
 
Would that be the best option? Does not seem like the best way I am sure
there must be an easier way...
 
open to ideas, suggestions please
 
Thanks
 
Dave 

--~--~-~--~~~---~--~~
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: Security question

2009-05-21 Thread jperras

If you're not modifying form fields with javascript, AJAX form
submissions should have no impact on the use of the Security component
and it's ability to prevent CSRF attacks.

-j.

On May 20, 11:22 pm, Dave Maharaj :: WidePixels.com
d...@widepixels.com wrote:
 I am trying to break my application.

 How can I tell if a logged in user is trying to do the same by using firebug
 and adding a form to a page?
 I don't want to just sanitize and all of that...i want to know and ban that
 specific user. What would be the best approach to determine if a user is
 trying to submit data that should not be submitted.
 For example a page that has no form and someone adds a form and tries to
 submit could I easily check $this-data because there should be none?

 if(!empty($this-data))
 {
 ...banuser()..

 }

 Is there a better method or something already around that can help. Most of
 my requests are AJAX so for pages with forms the Security component is no
 good for me.
 Ideas? Suggestions?

 Thanks,

 Dave
--~--~-~--~~~---~--~~
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 can related records be removed when master is deleted?

2009-05-21 Thread Jorge Garifuna
Since I'm new to cakePHP, I wouldn't know much. setting dependent=true
served my purpose.

On Thu, May 21, 2009 at 3:46 PM, John R john...@gmail.com wrote:


 Isn't this what deleteAll() is for?
 



-- 
Jorge Garifuna
Professional Web Developer
Your Web Solution Partner
Garinet Media Network, LLC.
811 Wilshire Blvd. Suite 1705
Los Angeles, CA 90017
http://www.GariDigital.com
Business Operating Hours: Monday - Friday: 9AM - 6 PM PST

--~--~-~--~~~---~--~~
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 association w/ multipart key

2009-05-21 Thread michaelc

Hi all. Just asking to rely on the wisdom of those with greater
experience than me. My Settings model has fields id, group, key, and
value, while my SettingOptions model has fields id, group, key, type,
and default. My intent is to use the data available in the
setting_options table to validate correct value types being saved to
the settings table on the fly - these then will be read elsewhere.  My
problem is - I don't know how to bind the two tables. I could implode
('.', array($group, $key)) before storing in the table, but I fear
maintenance issues later. Any advice or suggestions from the great old
ones? (Obviously I'd like to keep clear of a static class variable
with ClassRegistry::init.)

--
Thanks in advance,

Michaelc

--~--~-~--~~~---~--~~
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-editor help

2009-05-21 Thread double07

Hi All,

I'm currently working on a comments section of my site and I'm trying
to allow the comments to be edited via an ajax edit-in-place field. I
can't work out how the data is passed to the controller though and
also how to access that data in the controller...

In my controller I have:

function admin_edit() {
   $this-Comment-saveField('body', ???);
   $this-set('comment', ??? );
   $this-layout = 'ajax';
}

In my view I have:
echo 'div id=Comment'. $comment['id'] . '' . $comment['body'] . '/
div';
echo $ajax-editor(
'Comment'.$comment['id'],
array(
'controller' = 'comments',
'action' = 'admin_edit',
$comment['id']
),
array('okText' = 'Save', 'rows' = '4', 'cols' 
= '72',
'highlightcolor' = '#d1eeff', 'highlightendcolor' = '#f4f4f4')
);
echo '/div';

In the submitted view I have:
?php echo $comment);?

I can't work out what I'm supposed to put where the question marks
are. In my searching high and low for an answer I came across a
similar post on these groups saying that the data is available in the
controller via $this-params['formname']['field'] - so does this mean
that I have to put the $ajax-editor inside a form? If not how do I
know what the ajax form/field is named???

Thanks,

-Brett

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



app_error question

2009-05-21 Thread Dave Maharaj :: WidePixels.com
When building error functions in  app_error.php can it be built just like a
controller function? I mean can you specify 
 
if ($this-RequestHandler-isAjax()) {
display the AJAX error
} else {
display normal error or render a specific layout
}
 
 
Dave 

--~--~-~--~~~---~--~~
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 to abort save?

2009-05-21 Thread cakephp101

i have 5 rows of forms for date and time. when only 4 out of the 5
forms are not null, how can i abort the save for the empty/null form?

ps, the 5 forms are submitted at the same time so i only have to abort
the save for the form/s with no entered value.

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



Re: how to abort save?

2009-05-21 Thread JamesF

can you clarify what you mean 'by rows of forms'

i assume you mean fields in a table...


On May 21, 10:29 pm, cakephp101 valenzuela...@gmail.com wrote:
 i have 5 rows of forms for date and time. when only 4 out of the 5
 forms are not null, how can i abort the save for the empty/null form?

 ps, the 5 forms are submitted at the same time so i only have to abort
 the save for the form/s with no entered value.
--~--~-~--~~~---~--~~
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: Un-needed Controllers

2009-05-21 Thread JamesF

you might also want to have a look at bindModel

http://book.cakephp.org/view/86/Creating-and-Destroying-Associations-on-the-Fly

On May 21, 10:27 am, Dave Maharaj :: WidePixels.com
d...@widepixels.com wrote:
 I have 5 or 6 empty controllers. I merged all the admin functions to the
 app_controller and these controllers now have no functions inside them.

 For example my bookmarks controller is simply
 ?php
   class BookmarksController extends AppController
   {
       var $name = 'Bookmarks';
       var $helpers = array('Html', 'Form');
       var $uses = array('Bookmark');

       function beforeFilter()
       {
           parent::beforeFilter();
           $this-Auth-autoRedirect = false;
       }}

 ?

 These controllers all have models that are needed but can remove these
 controllers from the app?

 Dave
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Accessing Array Data the view (not index) File :: Where am I wrong?

2009-05-21 Thread programguru


I am trying to echo out my Comment data to my Task view file, and it will not
work!

Does anyone know if it is possible to print the [comment] field value? I am
able to print all Task related items with for example ?php echo
$task['Color']['name']; ?. this works OK.

But when I try to print: ?php echo $task['Comment']['comment']; ? nothing
will echo? even though I can see my array with debug and all of the data
is there?

What am I doing wrong?

[Color] = Array
(
[id] = 7
[name] = productionTaskStatus
)


[Comment] = Array
(
[0] = Array
(
[id] = 1
[comment] = this is a test comment
[task_id] = 40
)

[1] = Array
(
[id] = 2
[comment] = sdfsdfsdfds
[task_id] = 40
)

[2] = Array
(
[id] = 3
[comment] = this is a test comment
[task_id] = 40
)

)

)

-- 
View this message in context: 
http://www.nabble.com/Accessing-Array-Data-the-view-%28not-index%29-File-%3A%3A-Where-am-I-wrong--tp23664192p23664192.html
Sent from the CakePHP mailing list archive at Nabble.com.


--~--~-~--~~~---~--~~
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 much to donate to CakePHP???

2009-05-21 Thread double07

I generally donate $10 everytime I download cakephp from the website.
--~--~-~--~~~---~--~~
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: Accessing Array Data the view (not index) File :: Where am I wrong?

2009-05-21 Thread John Andersen

The Comment array is deeper than you think!

Use:
?php
foreach( $task['Comment'] as $commentNo = $comment ) {
   echo $comment['comment'];
}
?

Enjoy,
   John


On May 22, 7:24 am, programguru ja...@w3developing.com wrote:
 I am trying to echo out my Comment data to my Task view file, and it will not
 work!

 Does anyone know if it is possible to print the [comment] field value? I am
 able to print all Task related items with for example ?php echo
 $task['Color']['name']; ?. this works OK.

 But when I try to print: ?php echo $task['Comment']['comment']; ? nothing
 will echo? even though I can see my array with debug and all of the data
 is there?

 What am I doing wrong?

 [Color] = Array
         (
             [id] = 7
             [name] = productionTaskStatus
         )

     [Comment] = Array
         (
             [0] = Array
                 (
                     [id] = 1
                     [comment] = this is a test comment
                     [task_id] = 40
                 )

             [1] = Array
                 (
                     [id] = 2
                     [comment] = sdfsdfsdfds
                     [task_id] = 40
                 )

             [2] = Array
                 (
                     [id] = 3
                     [comment] = this is a test comment
                     [task_id] = 40
                 )

         )

 )

 --
 View this message in 
 context:http://www.nabble.com/Accessing-Array-Data-the-view-%28not-index%29-F...
 Sent from the CakePHP mailing list archive at Nabble.com.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: how to abort save?

2009-05-21 Thread cakephp101


yes, i mean fields in a table. i'm doing a timesheet for a payroll.
the start sched, end sched, time in and time out of the employee are
the input. that means i have 4 fields. i have 5 rows of those 4
fields. the 5 rows is equal to 5 days because 1 row is equal to 1 day.
when i only put input in 4 of the rows and 1 form is empty, it will
still save the empty fields with a null value in my database. i'm
saving it through saveAll. how can i abort the save for the fields
that are empty? i think it should be done in beforeSave but i don't
know how.

--~--~-~--~~~---~--~~
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: Accessing Array Data the view (not index) File :: Where am I wrong?

2009-05-21 Thread programguru


Hi John,

Thanks for your advice. I was able to get it to work with:

foreach ($task['Comment'] as $Comment = $comment ):

But now I'm facing a new issue. I need to be able to post a comment from the
Task view page, and I'm trying to work out the url.

Any advice on this one? This is what I have, and it's not working. It's
defaulting to the Add Task action:

echo $html-link(__('New Comment', true), array('action'='add',
$task['Comment']['comment'])); ?
-- 
View this message in context: 
http://www.nabble.com/Accessing-Array-Data-the-view-%28not-index%29-File-%3A%3A-Where-am-I-wrong--tp23664192p23664688.html
Sent from the CakePHP mailing list archive at Nabble.com.


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



foreach data displaying in all instances instead of only related id

2009-05-21 Thread programguru


i would just like my comments to display only to the task id they are
associated with, but for some reason all comments are printing in all tasks.

my relations are all setup perfect and tested with debug etc. but i just
need to be able to filter the comments so they only display to the tasks
they are associated with.

I assume an id will be required in the foreach  () but I tried many
variations with only errors or no output. 

here is my code:

?php 

foreach ($task['Comment'] as $Comment = $comment ):

echo $comment['comment']; 

endforeach; 

?
-- 
View this message in context: 
http://www.nabble.com/foreach-data-displaying-in-all-instances-instead-of-only-related-id-tp23664815p23664815.html
Sent from the CakePHP mailing list archive at Nabble.com.


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---