Re: Themed bootstrap

2012-10-16 Thread Lucky1968
Hi Paul,

Thanx for this info. I understand how it should work but it doesn't work in 
my system.

Maybe the problem is because $this->Html->css looks for a bootstrap.css 
instead of a bootstrap.php?

On Thursday, October 11, 2012 1:36:19 PM UTC+2, Paulo Henrique wrote:
>
> bootstrap.php => 
> https://github.com/hugodias/cakeStrap/blob/master/app/Config/bootstrap.php#L173
>
> default.ctp => 
> https://github.com/hugodias/cakeStrap/blob/master/app/View/Layouts/default.ctp#L21
>
> Em quarta-feira, 10 de outubro de 2012 03h14min42s UTC-3, Lucky1968 
> escreveu:
>>
>> Does anyone know how to integrate a bootstrap.php in a theme and how to 
>> open it dynamically?
>>
>> In my bootstrap.php I have certain settings which should change according 
>> to the selected theme so I would like to put a bootstrap.php file into the 
>> theme folder which should be called dynamically according to the selected 
>> theme.
>>
>> But how to do this?
>>
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: Odd array structure when using Model->query()

2012-10-16 Thread Andras Kende
Here is similar query, maybe helpful:

$unit = ($unit == 'km') ? 1.609344 : 1 ;

$results = $this->Location->find('all', array(
'limit' => 100,
'order' => array(
'distance' => 'ASC',
'Location.name' => 'ASC',
),
'recursive' => -1,
'conditions' => '1 = 1 HAVING `distance` <= 50' ,
'fields' => "*, TRUNCATE((3958 * 3.1415926 * SQRT((`lat` - {$lat}) * 
(`lat` - {$lat}) + COS(`lat` / 57.29578) * COS({$lat} / 57.29578) * (`lng` - 
{$lng}) * (`lng` - {$lng})) / 180) * 1.609344, 5)  AS `distance`"
));


Or you could foreach your results and move from ,classifications to Locations...


Andras Kende
http://www.kende.com

On Oct 16, 2012, at 6:43 PM, bmcelhany  wrote:

> Unfortunately, that didn't change anything.
> 
> On Tuesday, October 16, 2012 5:10:30 PM UTC-7, cricket wrote:
> Try adding the model alias: 
> 
> AND (Location.classification_id = $classification_id) 
> 
> On Tue, Oct 16, 2012 at 7:42 PM, bmcelhany  wrote: 
> > Hello, 
> > 
> > I have a model (Location) that points to a view (locations) in MySQL. The 
> > view contains address, zip code and latitude/longitude data that I use to 
> > calculate the distance between two locations (or find all locations within 
> > a 
> > given radius from a particular zip code). 
> > 
> > In my model, I have a function that takes 3 parameters: a zip code, a 
> > classification id and a specialty id. Using those three parameters, I 
> > construct a sql string ($sql), call $this->query($sql) and return the 
> > resulting array. The reason I simply don't call the model's standard 
> > $this->find() method is because, in addition to the fields from the 
> > database 
> > view, I need to perform a huge and ugly calculation to determine the number 
> > of miles each record's zip code is from the zip code passed in to the 
> > function. I'm using this as a virtual field in the model called "Miles". 
> > 
> > At any rate, this is mostly working but I'm noticing some strange behavior 
> > with how the resulting array is structured. Any time I add something to the 
> > WHERE clause of my sql statement and have an ORDER BY clause in the sql 
> > statement, those items are returned in an array that is separate from my 
> > expected Location array. If I don't add any fields to my WHERE clause, 
> > everything is returned as expected (just with no filters applied to the 
> > result set). Oddly, if I remove the ORDER BY clause everything works fine 
> > too. It's only when I ORDER BY my Miles virtual field AND have stuff in my 
> > WHERE clause that things start to break. 
> > 
> > I should note too, that when I look at the actual query that is being run 
> > and copy it into MySQL, it runs fine and returns the correct results. 
> > 
> > Here is the relavant code ($lat_lon['lat'] and $lat_lon['lon'] are from a 
> > local array and are returning the correct numbers): 
> > 
> > - 
> > 
> > $this->virtualFields['Miles'] = 0; 
> > 
> > $sql = "SELECT " 
> > ."Location.classification_id, " 
> > ."Location.classification_name, " 
> > ."Location.first_name, " 
> > ."Location.last_name, " 
> > ."Location.suffix, " 
> > ."Location.title, " 
> > ."Location.specialty_id, " 
> > ."Location.specialty_name, " 
> > ."Location.specialty_ame, " 
> > ."Location.specialty_pr4, " 
> > ."Location.address_id, " 
> > ."Location.address, " 
> > ."Location.city, " 
> > ."Location.state, " 
> > ."Location.zip, " 
> > ."Location.address_ame, " 
> > ."Location.address_pr4, " 
> > ."Location.zip_code, " 
> > ."Location.lat, " 
> > ."Location.lon, " 
> > ."(3956 * 2 * ATAN2(SQRT(POW(SIN((RADIANS(".$lat_lon['lat'].") - " 
> > .'RADIANS(Location.lat)) / 2), 2) + COS(RADIANS(Location.lat)) * ' 
> > ."COS(RADIANS(".$lat_lon['lat'].")) * POW(SIN((RADIANS(".$lat_lon['lon'].") 
> > - " 
> > ."RADIANS(Location.lon)) / 2), 2)), SQRT(1 - 
> > POW(SIN((RADIANS(".$lat_lon['lat'].") - " 
> > ."RADIANS(Location.lat)) / 2), 2) + COS(RADIANS(Location.lat)) * " 
> > ."COS(RADIANS(".$lat_lon['lat'].")) * POW(SIN((RADIANS(".$lat_lon['lon'].") 
> > - " 
> > ."RADIANS(Location.lon)) / 2), 2 AS Location__Miles " 
> > ."FROM locations AS Location " 
> > ."WHERE " 
> > ."(lat BETWEEN ROUND({$lat_lon['lat']} - (25 / 69.172), 4) " 
> > ."AND ROUND({$lat_lon['lat']} + (25 / 69.172), 4) " 
> > ."AND lon BETWEEN ROUND({$this->lon} - ABS(25 / COS({$lat_lon['lat']}) * 
> > 69.172)) " 
> > ."AND ROUND({$lat_lon['lon']} + ABS(25 / COS({$lat_lon['lat']}) * 69.172)) 
> > " 
> > ."AND 3956 * 2 * ATAN2(SQRT(POW(SIN((RADIANS({$lat_lon['lat']}) - " 
> > ."RADIANS(Location.lat)) / 2), 2) + COS(RADIANS(Location.lat)) * " 
> > ."COS(RADIANS({$lat_lon['lat']})) * POW(SIN((RADIANS({$lat_lon['lon']}) - " 
> > ."RADIANS(Location.lon)) / 2), 2)), SQRT(1 - 
> > POW(SIN((RADIANS({$lat_lon['lat']}) - " 
> > ."RADIANS(Location.lat)) / 2), 2) + COS(RADIANS(Location.lat)) * " 
> > ."COS(RADIANS({$lat_lon['lat']})) * POW

Re: Logged in users seeing other users profiles

2012-10-16 Thread Jeremy Burns | Class Outfit
It might not be isolated to this one organisation - just not reported elsewhere 
yet. I know that it's fine for some - maybe even most - but is a problem for at 
least one.

Jeremy Burns
Class Outfit

http://www.classoutfit.com

On 16 Oct 2012, at 19:12:43, lowpass  wrote:

> Is it just one organisation this is happening with? I'm wondering if
> it's something peculiar to their network, eg. proxy. Although I
> suppose that this sort of thing would come up with other sites, so
> maybe that's not it.
> 
> 
> On Tue, Oct 16, 2012 at 6:45 AM, Jeremy Burns
>  wrote:
>> I've got some more info now. They are on Windows 7/IE9 and cookies are
>> enabled. The user they see is the first user to log in (I am assuming that's
>> the case until that person's session has expired). Server all good and the
>> issue is not present for all users of the system. The error log and debug
>> log are not showing any recent entries.
>> 
>> 
>> On Tuesday, 16 October 2012 05:11:12 UTC+1, Jeremy Burns wrote:
>>> 
>>> I have inherited a 1.3 app that has users who belong to organisations. I
>>> have had reports from a few organisations who say that when more than one
>>> user from an organisation is logged in they all see the same user account (a
>>> logged in user from the same organisation). Local and test instances don't
>>> behave like this, and the code pulls up a user record based on
>>> $this->Auth->user('id'), so it sounds as if the session is not functioning
>>> correctly. Anyone experienced this or can give pointers about where to start
>>> looking for the issue?
>> 
>> --
>> Like Us on FaceBook https://www.facebook.com/CakePHP
>> Find us on Twitter http://twitter.com/CakePHP
>> 
>> ---
>> 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.
>> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>> 
>> 
> 
> -- 
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
> 
> --- 
> 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.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
> 
> 

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: Implementing jQuery File Upload in CakePHP 2.1.x

2012-10-16 Thread Thiago Reis
I need integrate the Plugin with one Model.
any idea?

Em sábado, 28 de abril de 2012 08h46min59s UTC-3, Hugo Dias escreveu:
>
> Changed the source code for a single plugin . Now much easy to implement.
>>
>
> Link: https://github.com/hugodias/FileUpload 
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: Odd array structure when using Model->query()

2012-10-16 Thread bmcelhany
Unfortunately, that didn't change anything.

On Tuesday, October 16, 2012 5:10:30 PM UTC-7, cricket wrote:
>
> Try adding the model alias: 
>
> AND (Location.classification_id = $classification_id) 
>
> On Tue, Oct 16, 2012 at 7:42 PM, bmcelhany > 
> wrote: 
> > Hello, 
> > 
> > I have a model (Location) that points to a view (locations) in MySQL. 
> The 
> > view contains address, zip code and latitude/longitude data that I use 
> to 
> > calculate the distance between two locations (or find all locations 
> within a 
> > given radius from a particular zip code). 
> > 
> > In my model, I have a function that takes 3 parameters: a zip code, a 
> > classification id and a specialty id. Using those three parameters, I 
> > construct a sql string ($sql), call $this->query($sql) and return the 
> > resulting array. The reason I simply don't call the model's standard 
> > $this->find() method is because, in addition to the fields from the 
> database 
> > view, I need to perform a huge and ugly calculation to determine the 
> number 
> > of miles each record's zip code is from the zip code passed in to the 
> > function. I'm using this as a virtual field in the model called "Miles". 
> > 
> > At any rate, this is mostly working but I'm noticing some strange 
> behavior 
> > with how the resulting array is structured. Any time I add something to 
> the 
> > WHERE clause of my sql statement and have an ORDER BY clause in the sql 
> > statement, those items are returned in an array that is separate from my 
> > expected Location array. If I don't add any fields to my WHERE clause, 
> > everything is returned as expected (just with no filters applied to the 
> > result set). Oddly, if I remove the ORDER BY clause everything works 
> fine 
> > too. It's only when I ORDER BY my Miles virtual field AND have stuff in 
> my 
> > WHERE clause that things start to break. 
> > 
> > I should note too, that when I look at the actual query that is being 
> run 
> > and copy it into MySQL, it runs fine and returns the correct results. 
> > 
> > Here is the relavant code ($lat_lon['lat'] and $lat_lon['lon'] are from 
> a 
> > local array and are returning the correct numbers): 
> > 
> > - 
> > 
> > $this->virtualFields['Miles'] = 0; 
> > 
> > $sql = "SELECT " 
> > ."Location.classification_id, " 
> > ."Location.classification_name, " 
> > ."Location.first_name, " 
> > ."Location.last_name, " 
> > ."Location.suffix, " 
> > ."Location.title, " 
> > ."Location.specialty_id, " 
> > ."Location.specialty_name, " 
> > ."Location.specialty_ame, " 
> > ."Location.specialty_pr4, " 
> > ."Location.address_id, " 
> > ."Location.address, " 
> > ."Location.city, " 
> > ."Location.state, " 
> > ."Location.zip, " 
> > ."Location.address_ame, " 
> > ."Location.address_pr4, " 
> > ."Location.zip_code, " 
> > ."Location.lat, " 
> > ."Location.lon, " 
> > ."(3956 * 2 * ATAN2(SQRT(POW(SIN((RADIANS(".$lat_lon['lat'].") - " 
> > .'RADIANS(Location.lat)) / 2), 2) + COS(RADIANS(Location.lat)) * ' 
> > ."COS(RADIANS(".$lat_lon['lat'].")) * 
> POW(SIN((RADIANS(".$lat_lon['lon'].") 
> > - " 
> > ."RADIANS(Location.lon)) / 2), 2)), SQRT(1 - 
> > POW(SIN((RADIANS(".$lat_lon['lat'].") - " 
> > ."RADIANS(Location.lat)) / 2), 2) + COS(RADIANS(Location.lat)) * " 
> > ."COS(RADIANS(".$lat_lon['lat'].")) * 
> POW(SIN((RADIANS(".$lat_lon['lon'].") 
> > - " 
> > ."RADIANS(Location.lon)) / 2), 2 AS Location__Miles " 
> > ."FROM locations AS Location " 
> > ."WHERE " 
> > ."(lat BETWEEN ROUND({$lat_lon['lat']} - (25 / 69.172), 4) " 
> > ."AND ROUND({$lat_lon['lat']} + (25 / 69.172), 4) " 
> > ."AND lon BETWEEN ROUND({$this->lon} - ABS(25 / COS({$lat_lon['lat']}) * 
> > 69.172)) " 
> > ."AND ROUND({$lat_lon['lon']} + ABS(25 / COS({$lat_lon['lat']}) * 
> 69.172)) " 
> > ."AND 3956 * 2 * ATAN2(SQRT(POW(SIN((RADIANS({$lat_lon['lat']}) - " 
> > ."RADIANS(Location.lat)) / 2), 2) + COS(RADIANS(Location.lat)) * " 
> > ."COS(RADIANS({$lat_lon['lat']})) * POW(SIN((RADIANS({$lat_lon['lon']}) 
> - " 
> > ."RADIANS(Location.lon)) / 2), 2)), SQRT(1 - 
> > POW(SIN((RADIANS({$lat_lon['lat']}) - " 
> > ."RADIANS(Location.lat)) / 2), 2) + COS(RADIANS(Location.lat)) * " 
> > ."COS(RADIANS({$lat_lon['lat']})) * POW(SIN((RADIANS({$lat_lon['lon']}) 
> - " 
> > ."RADIANS(Location.lon)) / 2), 2))) <= $miles " 
> > ."AND 3956 * 2 * ATAN2(SQRT(POW(SIN((RADIANS({$lat_lon['lat']}) - " 
> > ."RADIANS(Location.lat)) / 2), 2) + COS(RADIANS(Location.lat)) * " 
> > ."COS(RADIANS({$lat_lon['lat']})) * POW(SIN((RADIANS({$lat_lon['lon']}) 
> - " 
> > ."RADIANS(Location.lon)) / 2), 2)), SQRT(1 - 
> > POW(SIN((RADIANS({$lat_lon['lat']}) - " 
> > ."RADIANS(Location.lat)) / 2), 2) + COS(RADIANS(Location.lat)) * " 
> > ."COS(RADIANS({$lat_lon['lat']})) * POW(SIN((RADIANS({$lat_lon['lon']}) 
> - " 
> > ."RADIANS(Location.lon)) / 2), 2))) >= 0) " 
> > ."AND (classification_id = $classification_id) "; 
> > 
> > if(!empty($specialty_id)) { 
> >

Re: Odd array structure when using Model->query()

2012-10-16 Thread lowpass
Try adding the model alias:

AND (Location.classification_id = $classification_id)

On Tue, Oct 16, 2012 at 7:42 PM, bmcelhany  wrote:
> Hello,
>
> I have a model (Location) that points to a view (locations) in MySQL. The
> view contains address, zip code and latitude/longitude data that I use to
> calculate the distance between two locations (or find all locations within a
> given radius from a particular zip code).
>
> In my model, I have a function that takes 3 parameters: a zip code, a
> classification id and a specialty id. Using those three parameters, I
> construct a sql string ($sql), call $this->query($sql) and return the
> resulting array. The reason I simply don't call the model's standard
> $this->find() method is because, in addition to the fields from the database
> view, I need to perform a huge and ugly calculation to determine the number
> of miles each record's zip code is from the zip code passed in to the
> function. I'm using this as a virtual field in the model called "Miles".
>
> At any rate, this is mostly working but I'm noticing some strange behavior
> with how the resulting array is structured. Any time I add something to the
> WHERE clause of my sql statement and have an ORDER BY clause in the sql
> statement, those items are returned in an array that is separate from my
> expected Location array. If I don't add any fields to my WHERE clause,
> everything is returned as expected (just with no filters applied to the
> result set). Oddly, if I remove the ORDER BY clause everything works fine
> too. It's only when I ORDER BY my Miles virtual field AND have stuff in my
> WHERE clause that things start to break.
>
> I should note too, that when I look at the actual query that is being run
> and copy it into MySQL, it runs fine and returns the correct results.
>
> Here is the relavant code ($lat_lon['lat'] and $lat_lon['lon'] are from a
> local array and are returning the correct numbers):
>
> -
>
> $this->virtualFields['Miles'] = 0;
>
> $sql = "SELECT "
> ."Location.classification_id, "
> ."Location.classification_name, "
> ."Location.first_name, "
> ."Location.last_name, "
> ."Location.suffix, "
> ."Location.title, "
> ."Location.specialty_id, "
> ."Location.specialty_name, "
> ."Location.specialty_ame, "
> ."Location.specialty_pr4, "
> ."Location.address_id, "
> ."Location.address, "
> ."Location.city, "
> ."Location.state, "
> ."Location.zip, "
> ."Location.address_ame, "
> ."Location.address_pr4, "
> ."Location.zip_code, "
> ."Location.lat, "
> ."Location.lon, "
> ."(3956 * 2 * ATAN2(SQRT(POW(SIN((RADIANS(".$lat_lon['lat'].") - "
> .'RADIANS(Location.lat)) / 2), 2) + COS(RADIANS(Location.lat)) * '
> ."COS(RADIANS(".$lat_lon['lat'].")) * POW(SIN((RADIANS(".$lat_lon['lon'].")
> - "
> ."RADIANS(Location.lon)) / 2), 2)), SQRT(1 -
> POW(SIN((RADIANS(".$lat_lon['lat'].") - "
> ."RADIANS(Location.lat)) / 2), 2) + COS(RADIANS(Location.lat)) * "
> ."COS(RADIANS(".$lat_lon['lat'].")) * POW(SIN((RADIANS(".$lat_lon['lon'].")
> - "
> ."RADIANS(Location.lon)) / 2), 2 AS Location__Miles "
> ."FROM locations AS Location "
> ."WHERE "
> ."(lat BETWEEN ROUND({$lat_lon['lat']} - (25 / 69.172), 4) "
> ."AND ROUND({$lat_lon['lat']} + (25 / 69.172), 4) "
> ."AND lon BETWEEN ROUND({$this->lon} - ABS(25 / COS({$lat_lon['lat']}) *
> 69.172)) "
> ."AND ROUND({$lat_lon['lon']} + ABS(25 / COS({$lat_lon['lat']}) * 69.172)) "
> ."AND 3956 * 2 * ATAN2(SQRT(POW(SIN((RADIANS({$lat_lon['lat']}) - "
> ."RADIANS(Location.lat)) / 2), 2) + COS(RADIANS(Location.lat)) * "
> ."COS(RADIANS({$lat_lon['lat']})) * POW(SIN((RADIANS({$lat_lon['lon']}) - "
> ."RADIANS(Location.lon)) / 2), 2)), SQRT(1 -
> POW(SIN((RADIANS({$lat_lon['lat']}) - "
> ."RADIANS(Location.lat)) / 2), 2) + COS(RADIANS(Location.lat)) * "
> ."COS(RADIANS({$lat_lon['lat']})) * POW(SIN((RADIANS({$lat_lon['lon']}) - "
> ."RADIANS(Location.lon)) / 2), 2))) <= $miles "
> ."AND 3956 * 2 * ATAN2(SQRT(POW(SIN((RADIANS({$lat_lon['lat']}) - "
> ."RADIANS(Location.lat)) / 2), 2) + COS(RADIANS(Location.lat)) * "
> ."COS(RADIANS({$lat_lon['lat']})) * POW(SIN((RADIANS({$lat_lon['lon']}) - "
> ."RADIANS(Location.lon)) / 2), 2)), SQRT(1 -
> POW(SIN((RADIANS({$lat_lon['lat']}) - "
> ."RADIANS(Location.lat)) / 2), 2) + COS(RADIANS(Location.lat)) * "
> ."COS(RADIANS({$lat_lon['lat']})) * POW(SIN((RADIANS({$lat_lon['lon']}) - "
> ."RADIANS(Location.lon)) / 2), 2))) >= 0) "
> ."AND (classification_id = $classification_id) ";
>
> if(!empty($specialty_id)) {
> $sql .= "AND (specialty_id = $specialty_id) ";
> $criteria['Specialty'] = $specialty_name;
> }
> $sql .= "ORDER BY Location__Miles ASC";
> $foundData = $this->query($sql);
> echo pr($foundData);
>
> -
> The $foundData array looks like:
>
> Array
> (
> [0] => Array
> (
> [classifications] => Array
> (
> [classification_id] => 1
>

Odd array structure when using Model->query()

2012-10-16 Thread bmcelhany
Hello,

I have a model (*Location*) that points to a view (*locations*) in MySQL. 
The view contains address, zip code and latitude/longitude data that I use 
to calculate the distance between two locations (or find all locations 
within a given radius from a particular zip code).

In my model, I have a function that takes 3 parameters: a zip code, a 
classification id and a specialty id. Using those three parameters, I 
construct a sql string (*$sql*), call *$this->query($sql)* and return the 
resulting array. The reason I simply don't call the model's standard *
$this->find()* method is because, in addition to the fields from the 
database view, I need to perform a huge and ugly calculation to determine 
the number of miles each record's zip code is from the zip code passed in 
to the function. I'm using this as a virtual field in the model called 
"Miles".

At any rate, this is mostly working but I'm noticing some strange behavior 
with how the resulting array is structured. Any time I add something to the 
WHERE clause of my sql statement and have an ORDER BY clause in the sql 
statement, those items are returned in an array that is separate from my 
expected Location array. If I don't add any fields to my WHERE clause, 
everything is returned as expected (just with no filters applied to the 
result set). Oddly, if I remove the ORDER BY clause everything works fine 
too. It's only when I ORDER BY my Miles virtual field AND have stuff in my 
WHERE clause that things start to break.

I should note too, that when I look at the actual query that is being run 
and copy it into MySQL, it runs fine and returns the correct results.

Here is the relavant code ($lat_lon['lat'] and $lat_lon['lon'] are from a 
local array and are returning the correct numbers):

-

$this->virtualFields['Miles'] = 0;

$sql = "SELECT "  
."Location.classification_id, "
."Location.classification_name, "
."Location.first_name, "  
."Location.last_name, "  
."Location.suffix, "
."Location.title, "
."Location.specialty_id, "
."Location.specialty_name, "  
."Location.specialty_ame, "
."Location.specialty_pr4, "  
."Location.address_id, "
."Location.address, "
."Location.city, "
."Location.state, "
."Location.zip, "  
."Location.address_ame, "
."Location.address_pr4, "
."Location.zip_code, "
."Location.lat, "
."Location.lon, "  
."(3956 * 2 * ATAN2(SQRT(POW(SIN((RADIANS(".$lat_lon['lat'].") - "
.'RADIANS(Location.lat)) / 2), 2) + COS(RADIANS(Location.lat)) * '
."COS(RADIANS(".$lat_lon['lat'].")) * POW(SIN((RADIANS(".$lat_lon['lon'].") 
- "
."RADIANS(Location.lon)) / 2), 2)), SQRT(1 - 
POW(SIN((RADIANS(".$lat_lon['lat'].") - "
."RADIANS(Location.lat)) / 2), 2) + COS(RADIANS(Location.lat)) * "
."COS(RADIANS(".$lat_lon['lat'].")) * POW(SIN((RADIANS(".$lat_lon['lon'].") 
- "
."RADIANS(Location.lon)) / 2), 2 AS Location__Miles "
."FROM locations AS Location "
."WHERE "  
."(lat BETWEEN ROUND({$lat_lon['lat']} - (25 / 69.172), 4) "
."AND ROUND({$lat_lon['lat']} + (25 / 69.172), 4) "
."AND lon BETWEEN ROUND({$this->lon} - ABS(25 / COS({$lat_lon['lat']}) * 
69.172)) "
."AND ROUND({$lat_lon['lon']} + ABS(25 / COS({$lat_lon['lat']}) * 69.172)) "
."AND 3956 * 2 * ATAN2(SQRT(POW(SIN((RADIANS({$lat_lon['lat']}) - "
."RADIANS(Location.lat)) / 2), 2) + COS(RADIANS(Location.lat)) * "
."COS(RADIANS({$lat_lon['lat']})) * POW(SIN((RADIANS({$lat_lon['lon']}) - "
."RADIANS(Location.lon)) / 2), 2)), SQRT(1 - 
POW(SIN((RADIANS({$lat_lon['lat']}) - "
."RADIANS(Location.lat)) / 2), 2) + COS(RADIANS(Location.lat)) * "
."COS(RADIANS({$lat_lon['lat']})) * POW(SIN((RADIANS({$lat_lon['lon']}) - "
."RADIANS(Location.lon)) / 2), 2))) <= $miles "
."AND 3956 * 2 * ATAN2(SQRT(POW(SIN((RADIANS({$lat_lon['lat']}) - "
."RADIANS(Location.lat)) / 2), 2) + COS(RADIANS(Location.lat)) * "
."COS(RADIANS({$lat_lon['lat']})) * POW(SIN((RADIANS({$lat_lon['lon']}) - "
."RADIANS(Location.lon)) / 2), 2)), SQRT(1 - 
POW(SIN((RADIANS({$lat_lon['lat']}) - "
."RADIANS(Location.lat)) / 2), 2) + COS(RADIANS(Location.lat)) * "
."COS(RADIANS({$lat_lon['lat']})) * POW(SIN((RADIANS({$lat_lon['lon']}) - "
."RADIANS(Location.lon)) / 2), 2))) >= 0) "
."AND (classification_id = $classification_id) ";
   
if(!empty($specialty_id)) {
$sql .= "AND (specialty_id = $specialty_id) ";
$criteria['Specialty'] = $specialty_name; 
}
$sql .= "ORDER BY Location__Miles ASC";
 $foundData = $this->query($sql);
echo pr($foundData);

-
The $foundData array looks like:

Array
(
[0] => Array
(
[classifications] => Array
(
[classification_id] => 1
[classification_name] => AME
)

[Location] => Array
(
[first_name] => John
[last_name] => Doe
[suffix] => 
[title] => PHD
[

RE: Upgrade 1.3 -> 2.1.3 Issue - SOLVED

2012-10-16 Thread Advantage+
I was missing dataType: 'json', in the js...

 

Dave

 

From: Advantage+ [mailto:movepix...@gmail.com] 
Sent: Tuesday, October 16, 2012 3:26 PM
To: cake-php@googlegroups.com
Subject: Upgrade 1.3 -> 2.1.3 Issue

 

My app 1.3 version was working fine, now slowly upgrading / converting to
2.1.3 and running into an issue with my JSON response.

 

In 1.3 I clicked "Add to favorite" and the js would update my favorite
counter such as Favorites ( 8 )  <- 8 , 9, 10 whatever number of favorite
they had saved. Pretty simple.

The JSON response was {"count":5}
 
Using js function:
 
$("a.favorite").live("click", function(){
   $(this).toggleClass("not");
   $.ajax({
   type: "POST",
   url: $(this).attr('href'),
   success: function(r){
  $('a#fav_count span
span').html(r.count);
   }
   });
   return false;
});
 
Rendered HTML for the counter is:
Favorites(6)

 

 

I have been using this to return my JSON :

 

public function _ajaxReturn( $response = null ) {





//original 1.3 version  

$this->header('Content-Type: application/json');



//new 2.1.3 version

//$this->RequestHandler->setContent('json',
'application/json');

echo json_encode($response);

 

exit();

}

 

But for some reason the Favorite counter no longer updates the number.
Getting zero errors, check error log, no js errors. The response still comes
back as it did in 1.3 but nothing happens to the number count.

 

Any ideas anyone?

 

Thanks,

Dave

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




CakePHP 1.3 Multiple Model Trees with translations getting errors

2012-10-16 Thread Constantin.FF
I am using one database table for storing all the data of the site. Every 
model saves its records in this table and every model has Tree and 
Translate behavior. Every record has a `type` row where the model name is 
stored. 
So when saving data for each model it also saves a record in the i18n table 
with the translation. 
Now when I try any action with the tree I get an error, for example:
- if I try to verify the tree I get errors for all the records which 
parents are not from the same model due to the Translate behavior
- if I move some record up and down in one model it moves between all other 
record from the other models along the tree, so sometimes if the parent 
record has 10 records from a different model I will have to move up (for 
example) 10 times without no visual effect
- the same scenario as the last one but if I add scope behavior to the 
model just before moving up/down  I am getting an error if there is a 
record from other model that is "on it's way" up or down

Right now I'm trying to scope the tree using another behavior that extends 
the tree behavior but has 
$this->settings[$model->alias]['scope'] = array($model->alias . 
'.type' => $model->alias);
but saving record like this gives no lft,rght values bucause does not "see" 
the parent

Is there any way to fix this, to get it working or to look for other option?
Is there any option to use multiple trees inside one database. So the 
rght,lft values will be dublicated for every model but there will be no 
conflict because they will not "know" for each other.

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: Logged in users seeing other users profiles

2012-10-16 Thread lowpass
Is it just one organisation this is happening with? I'm wondering if
it's something peculiar to their network, eg. proxy. Although I
suppose that this sort of thing would come up with other sites, so
maybe that's not it.


On Tue, Oct 16, 2012 at 6:45 AM, Jeremy Burns
 wrote:
> I've got some more info now. They are on Windows 7/IE9 and cookies are
> enabled. The user they see is the first user to log in (I am assuming that's
> the case until that person's session has expired). Server all good and the
> issue is not present for all users of the system. The error log and debug
> log are not showing any recent entries.
>
>
> On Tuesday, 16 October 2012 05:11:12 UTC+1, Jeremy Burns wrote:
>>
>> I have inherited a 1.3 app that has users who belong to organisations. I
>> have had reports from a few organisations who say that when more than one
>> user from an organisation is logged in they all see the same user account (a
>> logged in user from the same organisation). Local and test instances don't
>> behave like this, and the code pulls up a user record based on
>> $this->Auth->user('id'), so it sounds as if the session is not functioning
>> correctly. Anyone experienced this or can give pointers about where to start
>> looking for the issue?
>
> --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> 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.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Upgrade 1.3 -> 2.1.3 Issue

2012-10-16 Thread Advantage+
My app 1.3 version was working fine, now slowly upgrading / converting to
2.1.3 and running into an issue with my JSON response.

 

In 1.3 I clicked "Add to favorite" and the js would update my favorite
counter such as Favorites ( 8 )  <- 8 , 9, 10 whatever number of favorite
they had saved. Pretty simple.

The JSON response was {"count":5}
 
Using js function:
 
$("a.favorite").live("click", function(){
   $(this).toggleClass("not");
   $.ajax({
   type: "POST",
   url: $(this).attr('href'),
   success: function(r){
  $('a#fav_count span
span').html(r.count);
   }
   });
   return false;
});
 
Rendered HTML for the counter is:
Favorites(6)

 

 

I have been using this to return my JSON :

 

public function _ajaxReturn( $response = null ) {





//original 1.3 version  

$this->header('Content-Type: application/json');



//new 2.1.3 version

//$this->RequestHandler->setContent('json',
'application/json');

echo json_encode($response);

 

exit();

}

 

But for some reason the Favorite counter no longer updates the number.
Getting zero errors, check error log, no js errors. The response still comes
back as it did in 1.3 but nothing happens to the number count.

 

Any ideas anyone?

 

Thanks,

Dave

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: Error to load a third Libs

2012-10-16 Thread Lucas Simon Rodrigues Magalhaes
I am using cake2.2

Em terça-feira, 16 de outubro de 2012 11h50min46s UTC-3, MaJerle.Eu 
escreveu:
>
> your file is .class ??..and tell us which cake u use
> --
> Lep pozdrav, Tilen Majerle
> http://majerle.eu
>
>
>
> 2012/10/16 Lucas Simon Rodrigues Magalhaes 
> >
>
>> Hiii, good morning!
>>
>> I have a erro when I try load a third Lib in my controller.
>>
>> The code:
>>
>> App::uses('html2pdf/html2pdf.class', 'Lib'); 
>>
>> App::import('Lib', 'html2pdf/html2pdf.class');
>> pr(App::paths());
>> try{
>> $pdf = new HTML2PDF('P','A4','fr');
>>  $pdf->pdf->SetDisplayMode('fullpage');
>> $pdf->writeHTML($content);
>> $pdf->Output('test.pdf');
>> }
>> catch(HTML2PDF_exception $e){
>> die($e);
>> }
>>
>> The error:
>> Fatal Error *Error: * Class 'HTML2PDF' not found 
>> *Line: * 196
>> *Notice: * If you want to customize this error message, create 
>> app\View\Errors\fatal_error.ctp
>>
>>
>> My folder:
>>
>> Lucas Simon@LUCAS-PC app/Lib/html2pdf (master)
>> $ ls
>> _LGPL.txt   _lisez_moi.txt  exampleslocale
>> _changelog.txt  _read_me.txthtml2pdf.class.php
>> _class  _tcpdf_5.0.002  html2pdf_v4.03
>>
>> -- 
>> Like Us on FaceBook https://www.facebook.com/CakePHP
>> Find us on Twitter http://twitter.com/CakePHP
>>  
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "CakePHP" group.
>> To post to this group, send email to cake...@googlegroups.com
>> .
>> To unsubscribe from this group, send email to 
>> cake-php+u...@googlegroups.com .
>> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>>  
>>  
>>
>
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: Error to load a third Libs

2012-10-16 Thread Tilen Majerle
your file is .class ??..and tell us which cake u use
--
Lep pozdrav, Tilen Majerle
http://majerle.eu



2012/10/16 Lucas Simon Rodrigues Magalhaes 

> Hiii, good morning!
>
> I have a erro when I try load a third Lib in my controller.
>
> The code:
>
> App::uses('html2pdf/html2pdf.class', 'Lib');
>
> App::import('Lib', 'html2pdf/html2pdf.class');
> pr(App::paths());
> try{
> $pdf = new HTML2PDF('P','A4','fr');
>  $pdf->pdf->SetDisplayMode('fullpage');
> $pdf->writeHTML($content);
> $pdf->Output('test.pdf');
> }
> catch(HTML2PDF_exception $e){
> die($e);
> }
>
> The error:
> Fatal Error *Error: * Class 'HTML2PDF' not found
> *Line: * 196
> *Notice: * If you want to customize this error message, create
> app\View\Errors\fatal_error.ctp
>
>
> My folder:
>
> Lucas Simon@LUCAS-PC app/Lib/html2pdf (master)
> $ ls
> _LGPL.txt   _lisez_moi.txt  exampleslocale
> _changelog.txt  _read_me.txthtml2pdf.class.php
> _class  _tcpdf_5.0.002  html2pdf_v4.03
>
> --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> 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.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>
>
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Error to load a third Libs

2012-10-16 Thread Lucas Simon Rodrigues Magalhaes
Hiii, good morning!

I have a erro when I try load a third Lib in my controller.

The code:

App::uses('html2pdf/html2pdf.class', 'Lib'); 

App::import('Lib', 'html2pdf/html2pdf.class');
pr(App::paths());
try{
$pdf = new HTML2PDF('P','A4','fr');
$pdf->pdf->SetDisplayMode('fullpage');
$pdf->writeHTML($content);
$pdf->Output('test.pdf');
}
catch(HTML2PDF_exception $e){
die($e);
}

The error:
Fatal Error*Error: * Class 'HTML2PDF' not found 
*Line: * 196
*Notice: * If you want to customize this error message, create 
app\View\Errors\fatal_error.ctp


My folder:

Lucas Simon@LUCAS-PC app/Lib/html2pdf (master)
$ ls
_LGPL.txt   _lisez_moi.txt  exampleslocale
_changelog.txt  _read_me.txthtml2pdf.class.php
_class  _tcpdf_5.0.002  html2pdf_v4.03

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: Progressive PHP to CakePHP

2012-10-16 Thread euromark
how should anyone without a crystal ball or magic capabilities be able to 
answer that? without any details or the code?

but in general: yes



Am Dienstag, 16. Oktober 2012 11:39:28 UTC+2 schrieb Robert Haylor:
>
> Hi All, 
>
> Hope all is well. 
>
> Quick question, I have been working on a website in a Progressive capacity 
> and I'd like to look at moving it over to CakePHP, what I'd like to know is 
> it possible to use the progressive PHP that I have thus far and make it 
> Object Orientated??  
>
> If anyone could get back to me that would be great. 
>
> Cheers
>
> Rob
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: Logged in users seeing other users profiles

2012-10-16 Thread Jeremy Burns
I've got some more info now. They are on Windows 7/IE9 and cookies are 
enabled. The user they see is the first user to log in (I am assuming 
that's the case until that person's session has expired). Server all good 
and the issue is not present for all users of the system. The error log and 
debug log are not showing any recent entries.

On Tuesday, 16 October 2012 05:11:12 UTC+1, Jeremy Burns wrote:
>
> I have inherited a 1.3 app that has users who belong to organisations. I 
> have had reports from a few organisations who say that when more than one 
> user from an organisation is logged in they all see the same user account 
> (a logged in user from the same organisation). Local and test instances 
> don't behave like this, and the code pulls up a user record based on 
> $this->Auth->user('id'), so it sounds as if the session is not functioning 
> correctly. Anyone experienced this or can give pointers about where to 
> start looking for the issue?

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Progressive PHP to CakePHP

2012-10-16 Thread Robert Haylor
Hi All, 

Hope all is well. 

Quick question, I have been working on a website in a Progressive capacity 
and I'd like to look at moving it over to CakePHP, what I'd like to know is 
it possible to use the progressive PHP that I have thus far and make it 
Object Orientated??  

If anyone could get back to me that would be great. 

Cheers

Rob

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: modifying cache times based on API call

2012-10-16 Thread Greg Skerman
ok so one idea I had was to call GC before every read, and then read
everything with an obnoxiously long expiry time via set...

which seems terrible to me but might work - anyone got any better ideas?


On Mon, Oct 15, 2012 at 1:18 AM, Greg Skerman  wrote:

> Hi,
>
> I am connecting an API which provides values that are intended to instruct
> the consumer on how long to cache a result for. Different API calls have
> different cache times (and these cache times may be variable, so setting up
> a config for each possible outcome is out of the question).
>
> Essentially there is a callTime and a cacheTime value in the response -
> callTime is the server timestamp that the data was retrieved, and cacheTime
> is the server timestamp that I am expected to wait until I make the next
> call.
>
> Now, I can easily perform some date math here to figure out the cache time
> and plug it into cache::set before writing my local cache - but whilst
> reading the caching documentation on the subject I discovered this:
>
> *If you use Cache::set() to change the settings for a write, you should
> also use Cache::set() before reading the data back in. If you fail to do
> so, the default settings will be used when the cache key is read.:*
>
> How does one get around this? I cannot "know" the cache duration until
> *after* I have read the value - and if the default is used there is a good
> chance that the value will be prematurely garbage collected. If I set the
> default value to an obscenely long time (upwards of 24 hours), then I run
> the risk that the cache will *never* be garbage collected.
>
> Do I need to store a "key map" somewhere that describes the cache time
> values so I can look them up? or is there a way to inspect the cache time
> before reading the value?
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.