Re: cacheQueries and memory usage

2011-07-08 Thread DanielMedia
Unfortunately I still can't track down what might be causing the
memory issue with calls to find(). The models I'm using have no
associations or callbacks. I checked my app model and I'm not using
any callbacks there either. My app model is pretty simple:

class AppModel extends Model{

var $actsAs = array('Containable');
var $recursive = -1;

}

And the two models I'm using:

class MasterIssuer extends AppModel {

var $useTable = 'master_issuers';

}

class MasterIssue extends AppModel  {

var $useTable = 'master_issues';

}

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


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


data from models onto pages.. e.g. /pages/home etc

2011-07-08 Thread elogic
Hi All,

How do I go about calling data from models within my system onto the
standard pages? I have built an intranet with models such as accounts,
users, groups, properties and now I want to create a dashboard /
homepage (it is /pages/dashboard). I have the blank page but I want to
call stuff from those other models on to this page.

How do I do this?

Thanks

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


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: count(*) how to retrieve?

2011-07-08 Thread Dominik Gajewski
Thanks for your reply

2011/7/8 Dr. Loboto drlob...@gmail.com:
 In case of
 $res = $this-DepartmentBook-find('all', array(

 'fields' = array(

 'count(*) AS kl',

 'DepartmentBook.department_id'
                                                                ),

 'conditions' =      array(

 'DepartmentBook.extract_date' = null,
                                                                ),

 'order' = array(

 'DepartmentBook.department_id'
                                                                ),

 'group' = array(

 'DepartmentBook.department_id'
                                                                )
                ));
 You'll have your count under $res[$i][0]['kl'] - NOT $res[$i]
 ['DepartmentBook']['kl']. Result of aggregate function does not belong
 to source table and resides under unknown index.

 All such problems can be solved by simple output of array to look into
 its structure.

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


 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php




-- 
Pozdrawiam
Dominik Gajewski

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


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


watermark on image

2011-07-08 Thread Miqdad Ali
hi cake bakers,

  let me know there is any option to add watermark on image while
uploading ???






-


Miqdad Ali K
+919995258790
http://www.miqdadalik.com

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


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Display char ID in add view

2011-07-08 Thread Jorge Arauz
Thank you for open my eyes :D!!

Ok, this table will be a reference table example property type (House,
Apartment, Office,...) and not will change a lot, also will be used by
admin user, not all users.

My purpose is avoid a lot of joins tables. to check the performance of
the App with a lot of concurrency when this app grow.

Jorge

On Jul 8, 3:59 pm, Jens Dittrich jdittr...@gmail.com wrote:
 Hiding IDs in forms is a convention that CakePHP follows, but convention
 over configuration does not mean you could or should not configure. Just
 tell the input field not to be hidden.
 But the real question should be Why do you want to have people enter a PK
 in an add form?. That sounds like nonsense.

 regards,
 Jens

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


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: editing multiple records with beforesave. beforesave working but data not updating

2011-07-08 Thread elogic
I worked this one out. I had the beforesave within the accounts model
while it should have been in the users model seeing that is where the
data was being saved.

Easy really but as I only just started cakephp there are many things
like this I am yet to understand.

Thanks



On Jul 7, 3:36 pm, elogic asymo...@elogicmedia.com.au wrote:
 Hi All,

 I am having some issues with the following: I have 2 tables that I
 have saving data to, accounts and users. I need to save the password
 field within users as MD5 and so I am usingbeforesavefunction in my
 model. It seems to be ignoring it though. Any ideas how I can go about
 this?

 ACCOUNT model
 
 functionbeforeSave() {
    if ($this-data['User'][0]['password'])
    {
                 $this-data['User'][0]['password'] = 
 md5($this-data['User'][0]
 ['password']);
                 echo $this-data['User'][0]['password'];
    }
    return true;}

 ---

 NOTE: Above I have echo $this-data['User'][0]['password'], this is
 printing out the encrypted password...

 ACCOUNT controller
 --

         function edit($id = null) {
                 if (!$id  empty($this-data)) {
                         $this-Session-setFlash(__('Invalid account', true));
                         $this-redirect(array('action' = 'index'));
                 }
                 if (!empty($this-data))
                 {
                         if ($this-Account-save($this-data))
                         {
                                 $this-data['User'][0]['account_id'] = 
 $this-Account-id;
                                 $this-Account-User-save($this-data);

                                 $this-Session-setFlash(__('The account has 
 been saved', true));
                                 echo pre;
                                 print_r($this-data);
                                 echo /pre;
                                 //$this-redirect(array('action' = 'index'));
                         } else {
                                 $this-Session-setFlash(__('The account 
 could not be saved.
 Please, try again.', true));
                         }
                 }
                 if (empty($this-data)) {
                         $this-data = $this-Account-read(null, $id);
                 }
                 //$users = $this-Account-User-find('list');
                 //$this-set(compact('users'));
         }
 
 NOTE: by this stage the password is back to the unencrypted way...
 (when I call the print_r($this-data);)

 Thanks

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


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Single Quotes

2011-07-08 Thread Davor Ilic
my be your content ouput have another tag that will cut the endtag. may be
don´t know your output exactly

2011/7/8 Davor Ilic webfa...@gmail.com

 what puts content out, because i try this and it works well

 ?= $this-Html-link(

 substr('kajsdklfjklasjfklajsdklfjkalsdjflkasdjflkjasdlkfjakldsfj',0,10),
 array(
 'controller' = 'control',
 'action' = 'view'
 ),
 array('title' =
 substr(stripslashes('kajsdklfjklasjfklajsdklfjkalsdjflkasdjflkjasdlkfjakldsfj'),0,20).
 ..., 'class' = 'agrizlink')
 ); ?

 2011/7/8 Prabha Vathi prabha.ridd...@gmail.com

 Hi,

 I am still having the problem
 echo $this-Html-link(
 substr($post_array['content'],0,75),
 array(
 'controller' = 'control',
 'action' = 'view'
 ),
 array('title' =
 substr(stripslashes($post_array['content']),0,20). ..., 'class' =
 'agrizlink')
 );

 It displays #38; like this for single quotes.

 echo $this-Html-link(
 e(substr($post_array['content'],0,75)),
 array(
 'controller' = 'control',
 'action' = 'view'
 ),
 array('title' =
 substr(stripslashes($post_array['content']),0,20). ..., 'class' =
 'agrizlink')
 );
 It removes the link. It is because two echos

 Any other method to do this?
 Thanks

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


 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group
 at http://groups.google.com/group/cake-php




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


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


data filtering

2011-07-08 Thread Plastika
Please forgive me, I am still fairly new to cakephp and in the process of
reviving my redundant PhP skills. 

I have searched all over the interweb for the answer, sadly to no avail. 

Here is the scenario: 

I have 4 tables - 1 being Users the other Groups ( for permissions). 

users table - pretty standard plus some additional profile info. 
Groups table - holds Administrators, Super Users, Auth Users and Unauth
Users. 

The Users table is being used for authentication and profiles (other users
can browse user profiles).  Now with this in mind, I cannot work out how to
filter out which users get rendered into the index view based on which group
the users (not the the currently logged user) belong. 

For example, The admin and Super user accounts profiles are being rendered
and belongs to the Administrators and Super users groups respectively
along with all the other Users.  However all I want end users (Auth Users)
to be able to see are other user profiles which are part of the Auth Users
group. 

So my hairline and I both would greatly appreciate any and all help in
resolving to this problem. 
  

--
View this message in context: 
http://cakephp.1045679.n5.nabble.com/data-filtering-tp4563439p4563439.html
Sent from the CakePHP mailing list archive at Nabble.com.

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


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: problems with Localization in Cakephp eng - default.po

2011-07-08 Thread Davor Ilic
hmmm does anybody no this issue?

2011/7/7 Davor Ilic webfa...@gmail.com

 It works well, but in some views wehere is use some translations they do
 not work well.
 this sheet i use to translate the hardcoded text in my view (I will mark
 which do not work):

 msgid  Name
 msgstr Name

 msgid  Telefonnr.
 msgstr Telephone-Nr.

 msgid  Telefonnr.
 msgstr Phone-nr.

 msgid  Von
 msgstr From

 msgid  Bis
 msgstr Until

 msgid  Sitzplatz
 msgstr Seat

 msgid  Anfrage Senden
 msgstr Send request

 msgid  Senden
 msgstr Send

 msgid  Email
 msgstr E-Mail

 msgid  Text
 msgstr Message

 msgid  mehr
 msgstr more

 msgid  zurück
 msgstr back

 msgid Fehler // also this in wanna use in my Session flash but do not
 show any like there for i use the template in error folder
 msgstr Error

 hope someone have something

 thx


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


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: saveAll with a hasMany relationship

2011-07-08 Thread ianemv
This last message made me decide not to use saveall. So, I used saveall for
each model since I have to indicate the name of model for me to save
multiple record. 

-
The best thing we can share in this world is knowledge
Shared Corner 
--
View this message in context: 
http://cakephp.1045679.n5.nabble.com/saveAll-with-a-hasMany-relationship-tp1328838p4564408.html
Sent from the CakePHP mailing list archive at Nabble.com.

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


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Authorization missing autoMagic?

2011-07-08 Thread Adrian B.
Hi,

I've been trying a bunch of different configurations, but I believe
this is the one that has me the closest.  Since I've inherited a table
of users with custom sha256 hashed passwords, I'm using
hashPasswords() in my model, which does replace the password in $data
with the correct (verified) hash.

function hashPasswords($data) {
Security::setHash('sha256');

if (isset($data['Panels']['username'])) {
$data['Panels']['password'] =
Security::hash(Configure::read('Security.salt').$data['Panels']
['password']);
return $data;
}

return $data;
}

My challenge is this:  when I attempt to login in thru my form, no
attempt to actually login is made by the Auth component.  Instead, I
get the values submitted by the form with one exception.  The password
input now has the hashed value of password filled in the form.  Manual
attempts to login  using $this-Auth-login($user) fail as well
(return false)...  However, The usernames and passwords match.


///*** HERE IS MY CONTROLLER SETUP ... I'm using  /panels/login as the
controller/method for logging in, and the user pw fields in my db are
non-standard.  ***///

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

//Array of components used by Controller

var $components = array(
'Auth' = array(
'loginAction' = array(
'controller' = 'panels',
'action' = 'login',
'plugin' = false,
'admin' = false,
),
 'fields' = array(
'username' = 'user_id',
'password' = 'user_password',
),
 'userModel' = 'User',
 'authorize' = 'controller',
 'allowedActions' = array('login','logout')
 ),
 'Session',
 'Cookie'
 );

function beforeFilter() {
$this-Auth-authenticate = ClassRegistry::init('User');
parent::beforeFilter();
}


function login() {

//Where is the Auth Magic?
}

function logout() {
//Leave empty for now.
}

function isAuthorized() {
var_dump(this is running);  /// This never actually runs!  UGH
if (
 !empty($this-data) 
 !empty($this-Auth-data['User']['username']) 
 !empty($this-Auth-data['User']['password'])
){
  $user = $this-User-find('first', array('conditions' 
=
array('User.user_id' = $this-Auth-data['Panels']
['username'],'User.user_password' = $this-Auth-data['Panels']
['password']), 'recursive' = -1 ));
  var_dump(check this out!-);
  var_dump($this-Auth-login($user));
  if (!empty($user)  $this-Auth-login($user)) {
 if ($this-Auth-autoRedirect) {
return true;
 }
  }else{
  $this-Session-setFlash($this-Auth-loginError, $this-
Auth-flashElement, array(), 'auth');
  return false;
  }
}else{
return false;
}
}


///*** HERE IS MY LOGIN FORM


div class = auth
?php

echo $this-Session-flash('auth');   // This displays nothing on
the second instance form
echo $this-Form-create('Panels');
echo $this-Form-input('username');
echo $this-Form-input('password');
echo $this-Form-end('Login');

?
/div


$this-Auth-data['Panels']['username']  $this-Auth-data['Panels']
['password'] both contain values the second iteration thru login()...
I am missing something, but I feel I am close.

Any direction would very much be appreciated!

Thanks, AdrianB

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


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Setting variables in AppController to use in Layout.

2011-07-08 Thread Angad Nadkarni
I am setting variables in AppController in order to use them in
default.ctp.

This is my code:

function beforeRender ( )
{
@Controller::loadModel('User');
$login_url = [trimmed];
$this-set('loginurl', $login_url);
$this-set('user', $this-Cookie-read('User'));
$this-set('examdata', $this-User-query('select listing from 
exams
limit 0,1'));
$this-set('exam', $this-Cookie-read('exam'));
}

The logic for above code has been performed in beforeFilter().

Now when I use the variables in default.ctp, such as say $loginurl, or
$examdata, I get:

Undefined variable: loginurl

or Undefined variable: examdata


What am I doing wrong?

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


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Facebook Connect

2011-07-08 Thread Angad Nadkarni
Please refer to FB API for this issue.
There is an onlogin property that calls JS iirc.

I tried to do this myself but I couldnt get it to work well enough.
Besides
the button was giving compatibility problems in IE.

I solved this issue by using cURL to access the Graph API and
writing most of the things on my own.

On Jul 8, 6:57 am, Prabha Vathi prabha.ridd...@gmail.com wrote:
 How to implement Cakephp and Facebook Connect.?

 fb:login-button v=2 perms=email,user_birthday
 autologoutlink=truefb:intlFacebook Login/fb:intl/fb:login-button

 Where should i write functions when user click this?
 Email, and password are the login fields.
 Got facebook_num to store facebook id

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


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


David Persson Media Plugin and saveAll

2011-07-08 Thread michalmalinowski
Hey, I have the same problem as Brad
http://groups.google.com/group/cake-php/browse_thread/thread/aa331e6a9938f242/779445eead7e9b12?lnk=gstq=saveall+media#779445eead7e9b12

I am able to edit record with attachment, change attachment, change
user data etc. But I can not create new record in the 'user' model. I
tried different options:
-disabled validator
-check what will be saved in beforeSave()
-check database queries
[11] = Array
(
[query] = START TRANSACTION
[error] =
[affected] = 0
[numRows] =
[took] = 0
)

[12] = Array
(
[query] = COMMIT
[error] =
[affected] = 0
[numRows] =
[took] = 0
)
that is all..

With every option that I tried my $this-data['User'] will be empty in
the beforeSave(), but it's not in controller. When I'm trying if($this-
User-saveAll($this-data, 'validate' = 'first')) script always
returns true, but nothing will be saved.

Can anyone please advise with that? At least in which direction we can
do research etc.

Michal

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


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php