Friday, April 30, 2010

Re: How to output UTF-8 sign?

You should think more on all the information available to you in the
view!
You already have:
1) the field name by which the sort is performed.
2) the sort direction for the chosen field name.
3) the list of fields which are sortable.

So you should be able to think it through and arrive at something like
this:
[code]
// Reset the sort direction for each sortable field.
$sortable = array('name' => 'sort_none','country' =>
'sort_none');

// Set the sort direction for the chosen sort field.
if (isset($this->params['named']['direction'])) {
$sortable[$this->params['named']['sort']] = 'sort_'.$this-
>params['named']['direction'];
}

// Present the sortable fields with the specified sort CSS classes.
foreach($sortable as $sortFieldName => $sortCssClass) {
echo $paginator->sort(ucfirst($sortFieldName),
$sortFieldName,array('class' => $sortCssClass));
}
[/code]

You can look at my site, see one of the previous posts, where the
above is implemented. No zip-file this time, am too busy :)
Enjoy,
John

On Apr 30, 11:41 pm, sebb86 <kahlc...@googlemail.com> wrote:
> Well, I don't know at which position in the source code, i have to
> reset it.
> I would reset with this source code: $sortCssClass = 'sort_none';
> I think, i need to know, which column header is clicked and then i
> have to reset all others.
> Could you give me a last hint please?
>
> Thanks!
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscribe@googlegroups.com For more options, visit this group athttp://groups.google.com/group/cake-php?hl=en

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

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

Re: Selected option in select

Sorry for not replying. I had to leave on a very short notice. I will try it again and come back with an update.

On Fri, Apr 30, 2010 at 6:24 PM, Ed Propsner <crotchfrog@gmail.com> wrote:
This also worked: 

$options=array('Generatia 1'=>'Generatia 1','Generatia 2'=>'Generatia 2', 'Generatia 3'=>'Generatia 3');
 echo $form->select('group', $options, array('selected' => 'Generatia 2'));



On Fri, Apr 30, 2010 at 11:22 AM, Ed Propsner <crotchfrog@gmail.com> wrote:
I tried this one and it worked: 

 $options=array('G1'=>'Generatia 1','G2'=>'Generatia 2', 'G3'=>'Generatia 3');
  echo $form->select('group', $options, array('selected' => 'G2'));


On Fri, Apr 30, 2010 at 11:18 AM, Andrei Mita <andrei.mita@gmail.com> wrote:
I saw that right after I sent the e-mail. Now I have:

        $options=array('G1'=>'Generatia 1','G2'=>'Generatia 2', 'G3'=>'Generatia 3');

  
        echo $form->select('group', $options, array('selected' => 'G2'));
        echo $form->select('group', $options, array('selected' => 'Generatia 2'));


None work.



On Fri, Apr 30, 2010 at 6:14 PM, Jeremy Burns <jeremyburns@me.com> wrote:
Could it be the space? Try replacing them both in the options array and the value you are trying to match (tacky I know, but at least it would isolate the problem).


Jeremy Burns

On 30 Apr 2010, at 16:12, Andrei Mita wrote:

I have added the model and there is no change.

I have noticed that if I do the options like 'G1' => 'Generatia 1' and so on, it works.


The debug on $options:

Array
(
[Generatia 1] => Generatia 1
[Generatia 2] => Generatia 2
[Generatia 3] => Generatia 3
[Mesteri] => Mesteri
)





On Fri, Apr 30, 2010 at 6:07 PM, Jeremy Burns <jeremyburns@me.com> wrote:
What about:

$form->select('Profile.group', $options, array('selected' => $this->data['Profile']['group']));

(in other words adding the model name to the select name)


Jeremy Burns


On 30 Apr 2010, at 16:04, Andrei Mita wrote:

I know, I fallowed the example but I'm missing something.


On Fri, Apr 30, 2010 at 6:01 PM, Ed Propsner <crotchfrog@gmail.com> wrote:
I just tried this one and it works : 

$options=array('M'=>'Male','F'=>'Female');
echo $form->select('gender',$options, array('selected' => 'M'));

On Fri, Apr 30, 2010 at 11:00 AM, Andrei Mita <andrei.mita@gmail.com> wrote:
It doesn't work :((



On Fri, Apr 30, 2010 at 5:58 PM, Andrei Mita <andrei.mita@gmail.com> wrote:
I've tried that. I'll try it again. If it works, I'm calling it a day :)



On Fri, Apr 30, 2010 at 5:53 PM, Ed Propsner <crotchfrog@gmail.com> wrote:
Try this. I'm "almost" sure it will work 8-)

$form->select('group', $options, array('selected' => $this->data['Profile']['group']));


On Fri, Apr 30, 2010 at 10:17 AM, Andrei Mita <andrei.mita@gmail.com> wrote:
Hello,

I'm making an edit form and I can't get the existing value to be selected into one of the select field.

The classic input in the view: echo $form->input('group');

I've changed that to a select:

$options=array('Generatia 1'=>'Generatia 1','Generatia 2'=>'Generatia 2', 'Generatia 3'=>'Generatia 3');
echo $form->select('group',$options);

The existing value is in $this->data['Profile']['group'] and, in my example, is equal to "Generatia 2"

How can I make that one selected?

echo $form->select('group',$options, $this->data['Profile']['group']), as shown in the book, doesn't work. What am I missing?

Thanks



Toate cele bune,
Andrei Mita

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
 
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en


Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
 
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en



Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
 
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en


Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
 
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en


Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
 
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en


Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
 
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en


Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
 
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
 
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
 
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en


Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
 
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
 
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

Re: DebugKit

Maybe it would be useful for others to know were was your mistake :)


On Fri, Apr 30, 2010 at 1:49 PM, Ed Propsner <crotchfrog@gmail.com> wrote:
Holy $%&! ... I got it to work the way it's supposed to. 

I'm pretty sure I know where I went wrong but I'll spare you the details for now ... I've almost reached my quota of idiocy for today :)

@Jeremy:  you're right ... simply drop it into plugins and you're off and running. 

WAY better than it was before. 

- Ed 



On Fri, Apr 30, 2010 at 6:18 AM, Ed Propsner <crotchfrog@gmail.com> wrote:
I could screw up a wet dream. 

htdocs/cake/plugins <--- works

htdocs/mysite/plugins <---- works

htdocs/cake/app/plugins <--- don't work

I'm starting to confuse myself :)


On Fri, Apr 30, 2010 at 6:11 AM, Andrei Mita <andrei.mita@gmail.com> wrote:
It has to be in /app/plugins


On Fri, Apr 30, 2010 at 1:10 PM, Jeremy Burns <jeremyburns@me.com> wrote:
Not sure - I've got it in /app/plugins.


Jeremy Burns

On 30 Apr 2010, at 11:08, Ed Propsner wrote:

K, here is a really dumb question for ya' ... does it matter where I put it, and by that I mean ... 

htdocs/cake/plugins

OR 

htdocs/mysite/plugins

On Fri, Apr 30, 2010 at 5:55 AM, Ed Propsner <crotchfrog@gmail.com> wrote:
hmmm .... 


On Fri, Apr 30, 2010 at 5:53 AM, Jeremy Burns <jeremyburns@me.com> wrote:
Nope - just followed the simple instructions - nothing non standard.


Jeremy Burns

On 30 Apr 2010, at 10:51, Ed Propsner wrote:

@Jeremy

Did you have to manually load the CSS? 

$html->css(array('style', 'addstyle', 'debug_toolbar'));


On Fri, Apr 30, 2010 at 5:46 AM, Ed Propsner <crotchfrog@gmail.com> wrote:
I had no clue it was supposed to dock itself all nice and neat like that .... you would think "toolbar" would have been a giveaway :) I'm going to scrap it and start again. 


On Fri, Apr 30, 2010 at 5:44 AM, Jeremy Burns <jeremyburns@me.com> wrote:
It works locally on FF, Safari and Chrome. Remote - no CSS and I get what you're getting.


Jeremy Burns

On 30 Apr 2010, at 10:41, Ed Propsner wrote:

wtf? I'm on a mission now ... Is that browser specific (FF presumably)? I must have an underlying problem somewhere still because I'm getting a 'break on' error in FF. 

On Fri, Apr 30, 2010 at 5:37 AM, Jeremy Burns <jeremyburns@me.com> wrote:
Not sure if this will post OK...

<Screen shot 2010-04-30 at 10.36.42.png>


Jeremy Burns

On 30 Apr 2010, at 10:35, Ed Propsner wrote:

You don't say ?? That would be just swell and I'm not getting that. 

On Fri, Apr 30, 2010 at 5:32 AM, Jeremy Burns <jeremyburns@me.com> wrote:
If it installs correctly it minimises to an icon in the upper right hand corner of the page. Clicking on it zooms it out and gives drop downs. When the CSS doesn't work, you get the long list at the foot of the page.


Jeremy Burns


On 30 Apr 2010, at 10:29, Andrei Mita wrote:

Same install steps here on 1.2.7 / linux / apache.
No errors.


On Fri, Apr 30, 2010 at 12:16 PM, Zaky Katalan-Ezra <procsharp@gmail.com> wrote:
I just install and run this kit with no problem.
I learned about it from this thread
Using cakekphp 1.3, apach, linux

1. Download http://www.ohloh.net/p/cakephp-debugkit/download?filename=debug_kit_1.2.tar.bz2
2. extract it under app/plugins/debug_kit (doesn't work without the underscore)
3. Add debug_kit tool bar to app_controller.
    In my case var $components = array ('Session','Cookie','DebugKit.Toolbar');
4. Didn't change my debug level, Configure::write('debug', 2);

voila.

I get a long list of debug properties in the bottom of the page which I presume is what I should get from this kit.


Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
 
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en


Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
 
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en


Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
 
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en


Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
 
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en


Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
 
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en


Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
 
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en


Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
 
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en



Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
 
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en


Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
 
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en



Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
 
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
 
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
 
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en


Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
 
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
 
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

Re: CakePHP Auth Component - Users, Groups & Permissions

i dont see no errors, i want change this code for work with cakephp 1.3

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

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

Re: CakePHP Auth Component - Users, Groups & Permissions

i have this app_controller code in cakephp 1.2:


<?php
class AppController extends Controller {
var $helpers = array('Html', 'Form', 'Javascript');
/**
* Array of components to load for every controller in the
application
*
* @var $components array
* @access public
*/
var $components = array('Auth');
/**
* beforeFilter
*
* Application hook which runs prior to each controller action
*
* @access public
*/
function beforeFilter(){

if (isset($this->params['admin'])) {
// Set the default layout
$this->layout = 'admin';
}else {
$this->layout = 'default';
}
//Override default fields used by Auth component
$this->Auth->fields =
array('username'=>'email_address','password'=>'password');
//Set application wide actions which do not require
authentication
$this->Auth-
>allow(array('display','view','admin_login','index','pindex'));//
IMPORTANT for CakePHP 1.2 final release change this to $this->Auth-
>allow(array('display'));
//Set the default redirect for users who logout
$this->Auth->logoutRedirect = '/';
//Set the default redirect for users who login
$this->Auth->loginRedirect = '/admin/images/index';
//Extend auth component to include authorisation via
isAuthorized action
$this->Auth->authorize = 'controller';
//Restrict access to only users with an active account
$this->Auth->userScope = array('User.active = 1');
//Pass auth component data over to view files
$this->set('Auth',$this->Auth->user());
}

/**
* beforeRender
*
* Application hook which runs after each action but, before the
view file is
* rendered
*
* @access public
*/
function beforeRender(){
//If we have an authorised user logged then pass over an array
of controllers
//to which they have index action permission
if($this->Auth->user()){
$controllerList = Configure::listObjects('controller');
$permittedControllers = array();
foreach($controllerList as $controllerItem){
if($controllerItem <> 'App'){
if($this->__permitted($controllerItem,'index')){
$permittedControllers[] = $controllerItem;
}
}
}
}
$this->set(compact('permittedControllers'));
}
/**
* isAuthorized
*
* Called by Auth component for establishing whether the current
authenticated
* user has authorization to access the current controller:action
*
* @return true if authorised/false if not authorized
* @access public
*/
function isAuthorized(){
return $this->__permitted($this->name,$this->action);
}
/**
* __permitted
*
* Helper function returns true if the currently authenticated
user has permission
* to access the controller:action specified by $controllerName:
$actionName
* @return
* @param $controllerName Object
* @param $actionName Object
*/
function __permitted($controllerName,$actionName){
//Ensure checks are all made lower case
$controllerName = low($controllerName);
$actionName = low($actionName);
//If permissions have not been cached to session...
if(!$this->Session->check('Permissions')){
//...then build permissions array and cache it
$permissions = array();
//everyone gets permission to logout
$permissions[]='users:logout';
//Import the User Model so we can build up the permission
cache
App::import('Model', 'User');
$thisUser = new User;
//Now bring in the current users full record along with
groups
$thisGroups = $thisUser->find(array('User.id'=>$this->Auth-
>user('id')));
$thisGroups = $thisGroups['Group'];
foreach($thisGroups as $thisGroup){
$thisPermissions = $thisUser->Group-
>find(array('Group.id'=>$thisGroup['id']));
$thisPermissions = $thisPermissions['Permission'];
foreach($thisPermissions as $thisPermission){
$permissions[]=$thisPermission['name'];
}
}
//write the permissions array to session
$this->Session->write('Permissions',$permissions);
}else{
//...they have been cached already, so retrieve them
$permissions = $this->Session->read('Permissions');
var_dump($permissions);

}
//Now iterate through permissions for a positive match
foreach($permissions as $permission){
if($permission == '*'){
return true;//Super Admin Bypass Found
}
if($permission == $controllerName.':*'){
return true;//Controller Wide Bypass Found
}
if($permission == $controllerName.':'.$actionName){
return true;//Specific permission found
}
}
return false;
}
}
?>


when i am run this code in cakephp 1.3 i dont see variable in session
(var_dump($permissions);)

where is problem?

note: this code for "cakephp user Auth"

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

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

some session problem in cakephp 1.3 (help me)

i have this app_controller code in cakephp 1.2:


<?php
class AppController extends Controller {
var $helpers = array('Html', 'Form', 'Javascript');
/**
* Array of components to load for every controller in the
application
*
* @var $components array
* @access public
*/
var $components = array('Auth');
/**
* beforeFilter
*
* Application hook which runs prior to each controller action
*
* @access public
*/
function beforeFilter(){

if (isset($this->params['admin'])) {
// Set the default layout
$this->layout = 'admin';
}else {
$this->layout = 'default';
}
//Override default fields used by Auth component
$this->Auth->fields =
array('username'=>'email_address','password'=>'password');
//Set application wide actions which do not require
authentication
$this->Auth-
>allow(array('display','view','admin_login','index','pindex'));//
IMPORTANT for CakePHP 1.2 final release change this to $this->Auth-
>allow(array('display'));
//Set the default redirect for users who logout
$this->Auth->logoutRedirect = '/';
//Set the default redirect for users who login
$this->Auth->loginRedirect = '/admin/images/index';
//Extend auth component to include authorisation via
isAuthorized action
$this->Auth->authorize = 'controller';
//Restrict access to only users with an active account
$this->Auth->userScope = array('User.active = 1');
//Pass auth component data over to view files
$this->set('Auth',$this->Auth->user());
}

/**
* beforeRender
*
* Application hook which runs after each action but, before the
view file is
* rendered
*
* @access public
*/
function beforeRender(){
//If we have an authorised user logged then pass over an array
of controllers
//to which they have index action permission
if($this->Auth->user()){
$controllerList = Configure::listObjects('controller');
$permittedControllers = array();
foreach($controllerList as $controllerItem){
if($controllerItem <> 'App'){
if($this->__permitted($controllerItem,'index')){
$permittedControllers[] = $controllerItem;
}
}
}
}
$this->set(compact('permittedControllers'));
}
/**
* isAuthorized
*
* Called by Auth component for establishing whether the current
authenticated
* user has authorization to access the current controller:action
*
* @return true if authorised/false if not authorized
* @access public
*/
function isAuthorized(){
return $this->__permitted($this->name,$this->action);
}
/**
* __permitted
*
* Helper function returns true if the currently authenticated
user has permission
* to access the controller:action specified by $controllerName:
$actionName
* @return
* @param $controllerName Object
* @param $actionName Object
*/
function __permitted($controllerName,$actionName){
//Ensure checks are all made lower case
$controllerName = low($controllerName);
$actionName = low($actionName);
//If permissions have not been cached to session...
if(!$this->Session->check('Permissions')){
//...then build permissions array and cache it
$permissions = array();
//everyone gets permission to logout
$permissions[]='users:logout';
//Import the User Model so we can build up the permission
cache
App::import('Model', 'User');
$thisUser = new User;
//Now bring in the current users full record along with
groups
$thisGroups = $thisUser->find(array('User.id'=>$this->Auth-
>user('id')));
$thisGroups = $thisGroups['Group'];
foreach($thisGroups as $thisGroup){
$thisPermissions = $thisUser->Group-
>find(array('Group.id'=>$thisGroup['id']));
$thisPermissions = $thisPermissions['Permission'];
foreach($thisPermissions as $thisPermission){
$permissions[]=$thisPermission['name'];
}
}
//write the permissions array to session
$this->Session->write('Permissions',$permissions);
}else{
//...they have been cached already, so retrieve them
$permissions = $this->Session->read('Permissions');
var_dump($permissions);

}
//Now iterate through permissions for a positive match
foreach($permissions as $permission){
if($permission == '*'){
return true;//Super Admin Bypass Found
}
if($permission == $controllerName.':*'){
return true;//Controller Wide Bypass Found
}
if($permission == $controllerName.':'.$actionName){
return true;//Specific permission found
}
}
return false;
}
}
?>


when i am run this code in cakephp 1.3 i dont see variable in session
(var_dump($permissions);)

where is problem?

note: this code for "cakephp user Auth"

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

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

Re: DebugKit

Holy $%&! ... I got it to work the way it's supposed to. 

I'm pretty sure I know where I went wrong but I'll spare you the details for now ... I've almost reached my quota of idiocy for today :)

@Jeremy:  you're right ... simply drop it into plugins and you're off and running. 

WAY better than it was before. 

- Ed 



On Fri, Apr 30, 2010 at 6:18 AM, Ed Propsner <crotchfrog@gmail.com> wrote:
I could screw up a wet dream. 

htdocs/cake/plugins <--- works

htdocs/mysite/plugins <---- works

htdocs/cake/app/plugins <--- don't work

I'm starting to confuse myself :)


On Fri, Apr 30, 2010 at 6:11 AM, Andrei Mita <andrei.mita@gmail.com> wrote:
It has to be in /app/plugins


On Fri, Apr 30, 2010 at 1:10 PM, Jeremy Burns <jeremyburns@me.com> wrote:
Not sure - I've got it in /app/plugins.


Jeremy Burns

On 30 Apr 2010, at 11:08, Ed Propsner wrote:

K, here is a really dumb question for ya' ... does it matter where I put it, and by that I mean ... 

htdocs/cake/plugins

OR 

htdocs/mysite/plugins

On Fri, Apr 30, 2010 at 5:55 AM, Ed Propsner <crotchfrog@gmail.com> wrote:
hmmm .... 


On Fri, Apr 30, 2010 at 5:53 AM, Jeremy Burns <jeremyburns@me.com> wrote:
Nope - just followed the simple instructions - nothing non standard.


Jeremy Burns

On 30 Apr 2010, at 10:51, Ed Propsner wrote:

@Jeremy

Did you have to manually load the CSS? 

$html->css(array('style', 'addstyle', 'debug_toolbar'));


On Fri, Apr 30, 2010 at 5:46 AM, Ed Propsner <crotchfrog@gmail.com> wrote:
I had no clue it was supposed to dock itself all nice and neat like that .... you would think "toolbar" would have been a giveaway :) I'm going to scrap it and start again. 


On Fri, Apr 30, 2010 at 5:44 AM, Jeremy Burns <jeremyburns@me.com> wrote:
It works locally on FF, Safari and Chrome. Remote - no CSS and I get what you're getting.


Jeremy Burns

On 30 Apr 2010, at 10:41, Ed Propsner wrote:

wtf? I'm on a mission now ... Is that browser specific (FF presumably)? I must have an underlying problem somewhere still because I'm getting a 'break on' error in FF. 

On Fri, Apr 30, 2010 at 5:37 AM, Jeremy Burns <jeremyburns@me.com> wrote:
Not sure if this will post OK...

<Screen shot 2010-04-30 at 10.36.42.png>


Jeremy Burns

On 30 Apr 2010, at 10:35, Ed Propsner wrote:

You don't say ?? That would be just swell and I'm not getting that. 

On Fri, Apr 30, 2010 at 5:32 AM, Jeremy Burns <jeremyburns@me.com> wrote:
If it installs correctly it minimises to an icon in the upper right hand corner of the page. Clicking on it zooms it out and gives drop downs. When the CSS doesn't work, you get the long list at the foot of the page.


Jeremy Burns


On 30 Apr 2010, at 10:29, Andrei Mita wrote:

Same install steps here on 1.2.7 / linux / apache.
No errors.


On Fri, Apr 30, 2010 at 12:16 PM, Zaky Katalan-Ezra <procsharp@gmail.com> wrote:
I just install and run this kit with no problem.
I learned about it from this thread
Using cakekphp 1.3, apach, linux

1. Download http://www.ohloh.net/p/cakephp-debugkit/download?filename=debug_kit_1.2.tar.bz2
2. extract it under app/plugins/debug_kit (doesn't work without the underscore)
3. Add debug_kit tool bar to app_controller.
    In my case var $components = array ('Session','Cookie','DebugKit.Toolbar');
4. Didn't change my debug level, Configure::write('debug', 2);

voila.

I get a long list of debug properties in the bottom of the page which I presume is what I should get from this kit.


Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
 
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en


Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
 
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en


Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
 
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en


Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
 
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en


Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
 
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en


Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
 
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en


Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
 
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en



Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
 
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en


Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
 
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en



Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
 
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
 
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
 
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en


Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
 
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

Re: plz help me out

I was tried like this is correct or  not i dont know any one can help me out
$rsCDLog = pg_numrows($rsCDLog);


var $intCDLogCnt = $this->Tblcdlog->find(                  
         'count', array(
                        'conditions' => array(
                            'Tblcdlog.blnsuccess' => 1
                        ),
                        'fields' => array(
                            'Tblcdlog.dtmcreated'
                        )
                )
        );

On Fri, Apr 30, 2010 at 4:13 PM, Narendra Padala <crazycakephp@gmail.com> wrote:
$intProfileCnt = pg_numrows($rsProfile);


var $intCDLogCnt = $this->Tblcdlog->find(                  
         'count', array(
                        'conditions' => array(
                            'Tblcdlog.blnsuccess' => 1
                        ),
                        'fields' => array(
                            'Tblcdlog.dtmcreated'
                        )
                )
        );

I was tried like this is correct or  not i dont know any one can help me out


On Wed, Apr 28, 2010 at 3:54 PM, Jeremy Burns <jeremylp burns@me.com> wrote:
Almost...

You need to run finds/counts against the model that is related to your table. For your table tblmusicprofiles your model will be Tblmusicprofile (singular, camel cased).

So, for example, your find statement would be something like this:

$rsProfile = $this->Tblmusicprofile->find(
'all',
array(
'conditions' => array(
'Tblmusicprofile.lngprofile' => '$PROFILE_ID'
),
'fields' => array(
'Tblmusicprofile.strprofilename'
)
)
);

I would also recommend looking up the Containable behaviour (http://book.cakephp.org/view/1323/Containable).

Your table naming convention is not ideal. I'd point you towards http://book.cakephp.org/view/903/Model-and-Database-Conventions for more details.


Jeremy Burns


On 28 Apr 2010, at 11:13, chandrasekhar reddy wrote:

I am new for cakephp plz help me out . below statements are correct or wrong . idontknow


While converting this sql query into cakephp for result set and count

1.  Result set

$rsProfile = pg_exec($conn,"SELECT strprofilename FROM tblmusicprofiles WHERE lngprofile = $PROFILE_ID");



var $rsProfile = $this->tblmusicprofiles->find('all', array('conditions' => array('tblmusicprofiles.lngprofile' => '$PROFILE_ID'),
             'fields' => array('tblmusicprofiles.strprofilename')));
 



2. count

 $intProfileCnt = pg_numrows($rsProfile);


var $intProfileCnt = $this->tblmusicprofiles->find('count',    array('conditions' => array('tblmusicprofiles.lngprofile' => '$PROFILE_ID'),
           'fields' => array('tblmusicprofiles.strprofilename')));
               



Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
 
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
 
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en


Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
 
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

Re: plz help me out

$intProfileCnt = pg_numrows($rsProfile);


var $intCDLogCnt = $this->Tblcdlog->find(                  
         'count', array(
                        'conditions' => array(
                            'Tblcdlog.blnsuccess' => 1
                        ),
                        'fields' => array(
                            'Tblcdlog.dtmcreated'
                        )
                )
        );

I was tried like this is correct or  not i dont know any one can help me out

On Wed, Apr 28, 2010 at 3:54 PM, Jeremy Burns <jeremylp burns@me.com> wrote:
Almost...

You need to run finds/counts against the model that is related to your table. For your table tblmusicprofiles your model will be Tblmusicprofile (singular, camel cased).

So, for example, your find statement would be something like this:

$rsProfile = $this->Tblmusicprofile->find(
'all',
array(
'conditions' => array(
'Tblmusicprofile.lngprofile' => '$PROFILE_ID'
),
'fields' => array(
'Tblmusicprofile.strprofilename'
)
)
);

I would also recommend looking up the Containable behaviour (http://book.cakephp.org/view/1323/Containable).

Your table naming convention is not ideal. I'd point you towards http://book.cakephp.org/view/903/Model-and-Database-Conventions for more details.


Jeremy Burns


On 28 Apr 2010, at 11:13, chandrasekhar reddy wrote:

I am new for cakephp plz help me out . below statements are correct or wrong . idontknow


While converting this sql query into cakephp for result set and count

1.  Result set

$rsProfile = pg_exec($conn,"SELECT strprofilename FROM tblmusicprofiles WHERE lngprofile = $PROFILE_ID");



var $rsProfile = $this->tblmusicprofiles->find('all', array('conditions' => array('tblmusicprofiles.lngprofile' => '$PROFILE_ID'),
             'fields' => array('tblmusicprofiles.strprofilename')));
 



2. count

 $intProfileCnt = pg_numrows($rsProfile);


var $intProfileCnt = $this->tblmusicprofiles->find('count',    array('conditions' => array('tblmusicprofiles.lngprofile' => '$PROFILE_ID'),
           'fields' => array('tblmusicprofiles.strprofilename')));
               



Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
 
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
 
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
 
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en