Custom helpers not available on error pages

2015-05-11 Thread LDSign
Hi

Ive set up some custom error pages which include the main layout (including 
navigation) for e.g. page not found errors. In the header-element 
included I make use of a custom helper (MyTextHelper extends TextHelper).

Unfortunatley this custom helper is not used in the error page resulting in 
a warning call_user_func_array() expects parameter 1 to be a valid 
callback.

How can I make this custom helper available on error pages?

CakePHP 2.6.4

Thanks,
Frank

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: Custom helpers not available on error pages

2015-05-11 Thread LDSign
Ok, thanks :)

How can I do this (overriding a core helper on these error pages)?

Regards,
Frank

Am Montag, 11. Mai 2015 18:25:25 UTC+2 schrieb LDSign:

 Hi

 Ive set up some custom error pages which include the main layout 
 (including navigation) for e.g. page not found errors. In the 
 header-element included I make use of a custom helper (MyTextHelper extends 
 TextHelper).

 Unfortunatley this custom helper is not used in the error page resulting 
 in a warning call_user_func_array() expects parameter 1 to be a valid 
 callback.

 How can I make this custom helper available on error pages?

 CakePHP 2.6.4

 Thanks,
 Frank


-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


CakePHP 2.6: Check if form has any required fields on form create

2015-04-11 Thread LDSign
Hi

I would like to add a required description (e.g. * indicates required 
field) on forms automatically if the form has at least one required field. 
Is there any method, which could be used to check this on form create?

Thanks,
Frank

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Custom method in custom LogEngine

2015-02-25 Thread LDSign
Hi

Ive created a custom DatabaseLog Engine which logs to the database. I would 
like to save the user too, so I have this method:

public function write($type, $message,$user_id = null) {
if (empty($user_id)) {
$user_id = CakeSession::read('Auth.User.id');
}

$log['action'] = $type;
$log['user_id'] = (empty($user_id)) ? null : $user_id;
$log['description'] = $message;
$log['remote_address'] = ($_SERVER['REMOTE_ADDR'] == '::1') ? '127.0.0.1' : 
$_SERVER['REMOTE_ADDR'];
$log['created'] = date('Y-m-d H:i:s');

$this-Log-create();
return $this-Log-save($log);
}

This works if the user is logged in (Auth.User.id is set). But when the 
user is logged out, I would like to set the user_id manually. So I have put 
the user_id in the parameter list of this method.

But the LogEngine ignores this additional parameter. A custom method (like 
the convience ones) will be irgnored too:

public function user($message,$user_id = null) {
$log['action'] = 'user';
$log['user_id'] = (empty($user_id)) ? null : $user_id;
$log['description'] = $message;
$log['remote_address'] = ($_SERVER['REMOTE_ADDR'] == '::1') ? '127.0.0.1' : 
$_SERVER['REMOTE_ADDR'];
$log['created'] = date('Y-m-d H:i:s');

$this-Log-create();
return $this-Log-save($log);
}

How can I achieve to give the write method the user_id on the way?

Thanks,
Frank


-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: CacheEngine and garbage collection

2015-02-19 Thread LDSign
Yes, of course, I know ;)

Ive figured it out already,,,

'prefix' = false was the little wrongdoer 
http://dict.leo.org/#/search=wrongdoersearchLoc=0resultOrder=basicmultiwordShowSingle=on.
 Shame 
on me ;)

Am Donnerstag, 19. Februar 2015 15:36:21 UTC+1 schrieb Domingos Coelho:

 In the book is written the following: ...used to do clean up *when 
 resources expire*. FileEngine uses this to *delete files containing 
 expired content*. ( 
 http://book.cakephp.org/2.0/en/core-libraries/caching.html#CacheEngine::gc 
 )

 If the content is not expired, the file stay in the cache

 Em quarta-feira, 18 de fevereiro de 2015 02:47:29 UTC-4, LDSign escreveu:

 Hi

 Ive set up a cache config as follow:

 Cache::config('file', array(
 'engine' = 'File',
 'prefix' = false,
 'duration' = '+10 minutes',
 'path' = CACHE . 'files' . DS,
 ));

 After writing to this cache config I call

 Cache::gc('file');

 But this does...nothing :( The files stay in the cache.

 Am I missing someting or why does this not work?

 Its Cake 2.6.1

 Thanks,
 Frank



-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


CacheEngine and garbage collection

2015-02-17 Thread LDSign
Hi

Ive set up a cache config as follow:

Cache::config('file', array(
'engine' = 'File',
'prefix' = false,
'duration' = '+10 minutes',
'path' = CACHE . 'files' . DS,
));

After writing to this cache config I call

Cache::gc('file');

But this does...nothing :( The files stay in the cache.

Am I missing someting or why does this not work?

Its Cake 2.6.1

Thanks,
Frank

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: Use function in controller AND view

2014-12-23 Thread LDSign
Just one question in addition. The cookbook says

If you need NumberHelper 
http://book.cakephp.org/2.0/en/core-libraries/helpers/number.html#NumberHelper
 functionalities 
outside of a View, use the CakeNumber class:

Whats the point using CakeNumber:: inside of views instead of 
$this-Number? Is this just a style quqstion or has it any drawbacks?

Thanks,
Frank

Am Montag, 22. Dezember 2014 16:06:23 UTC+1 schrieb LDSign:

 Hi

 Ive a function which converts a number to currency value (e.g. 10 - 10,00 
 EUR).

 So far I have a custom TextHelper with that method within (becuase its 
 view related).

 The problem is, now I need this (exactly same) method in a controller (for 
 generating a flash message). Of course I could place this as a simple 
 function in bootstrap.php (and use it in both, controller and view), but as 
 far as I remember this is bad practice. Bad practice too is to clone this 
 functionality in a component for DRY reasons.

 So whats the best practice for such a case?

 Thanks,
 Frank


-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Use function in controller AND view

2014-12-22 Thread LDSign
Hi

Ive a function which converts a number to currency value (e.g. 10 - 10,00 
EUR).

So far I have a custom TextHelper with that method within (becuase its 
view related).

The problem is, now I need this (exactly same) method in a controller (for 
generating a flash message). Of course I could place this as a simple 
function in bootstrap.php (and use it in both, controller and view), but as 
far as I remember this is bad practice. Bad practice too is to clone this 
functionality in a component for DRY reasons.

So whats the best practice for such a case?

Thanks,
Frank

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: Use function in controller AND view

2014-12-22 Thread LDSign
Damn, classic not seeing the wood for the trees. Solutions are often so 
close! Thanks :)

Am Dienstag, 23. Dezember 2014 01:12:09 UTC+1 schrieb euromark:

 That's why we refactored the whole thing into a lib class:

 https://github.com/cakephp/cakephp/blob/master/lib/Cake/Utility/CakeNumber.php

 App::uses('CakeNumber', 'Utility');
 $formattedNumber = CakeNumber::currency($value, $currency);

 It is documented quite thorougly, by the way:

 http://book.cakephp.org/2.0/en/core-utility-libraries/number.html#CakeNumber::currency

 Mark



 Am Montag, 22. Dezember 2014 16:06:23 UTC+1 schrieb LDSign:

 Hi

 Ive a function which converts a number to currency value (e.g. 10 - 
 10,00 EUR).

 So far I have a custom TextHelper with that method within (becuase its 
 view related).

 The problem is, now I need this (exactly same) method in a controller 
 (for generating a flash message). Of course I could place this as a simple 
 function in bootstrap.php (and use it in both, controller and view), but as 
 far as I remember this is bad practice. Bad practice too is to clone this 
 functionality in a component for DRY reasons.

 So whats the best practice for such a case?

 Thanks,
 Frank



-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: Handling pagination past the end of the result set

2014-11-04 Thread LDSign
Hi

Ive done this in Cake 2.5. Ive put all the pagination logic into a 
component and there is one function which checks for last page:

// Check if results are outside the current page stored in session (to 
prevent NotFound error)
 private function __checkLastPage($conditions = array(),$contain = array()) 
{
$count = 
$this-Controller-{$this-modelClass}-find('count',array('conditions' = 
$conditions,'contain' = $contain));
$lastPage = ceil($count / Configure::read('Config.paginateLimit'));
 if (empty($lastPage)) {
$lastPage = 1;
}
 if (empty($this-Controller-request-params['named']['page'])) {
$this-Controller-request-params['named']['page'] = 1;
}
 if ($lastPage  $this-Controller-request-params['named']['page']) {
$this-Controller-request-params['named']['page'] = $lastPage;
}
}


This should give you an idea. Have fun!

Frank


Am Samstag, 1. November 2014 17:20:05 UTC+1 schrieb Rob Cowie:

 Hi all, and have added filtering code to my app (cakephp3) and all is 
 great. The only problem I have is catching when the results set gives us 
 less pages than the user is on (ie, user sets a filter whilst on page 9, 
 but the resulting set only fills 3 pages). I am catching the exception, but 
 do not know the correct way to change the page I am going to display in the 
 controller. can any one help?


-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Get aco path/fragments from url

2014-10-02 Thread LDSign
Hi

I have modified/extended the Html-link() helper method to check if an acl 
permission is set or not (to return the link or null from the link() 
method).

This works nicely with Router::parse and Inflector::camelize if the 
url-string (or array) follows cake naming convention. But unfortunatley if 
there is a custom route set, the parse method returns the fragments of the 
aliases of course.

How do I get the real controller/plugin/action names from a url (string 
or array) given?

Thanks,
Frank

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Order using Containable-Behaviour on deeper levels (1)

2014-05-29 Thread LDSign
Hi

This was discussed several times on the inet - it seems that it is not 
possible to use an order on a deeper association connected with the 
containable behaviour, because the behaviour splits the query in several 
parts :(

Whats the best approach to make sorting on deeper levels work with 
containable?

Ive found an older behaviour called Linkable which promised to fill this 
gap, but unfortunatley it doesn't work with cake 2.5 :(

Thanks for your input!

Regards,
Frank

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: Order using Containable-Behaviour on deeper levels (1)

2014-05-29 Thread LDSign
Thanks. Ive already looked at the Hash::sort method.

But with that it is not possible to sort on multiple fields in priority. 
e.g. first lastname than firstname 

Or do I miss something?

Frank

Am Donnerstag, 29. Mai 2014 12:41:00 UTC+2 schrieb Jeremy Burns:

 Look at Hash::sort - 
 http://book.cakephp.org/2.0/en/core-utility-libraries/hash.html#Hash::sort

 On 29 May 2014, at 11:28, LDSign fr...@lamozik.de javascript: wrote:

 Hi

 This was discussed several times on the inet - it seems that it is not 
 possible to use an order on a deeper association connected with the 
 containable behaviour, because the behaviour splits the query in several 
 parts :(

 Whats the best approach to make sorting on deeper levels work with 
 containable?

 Ive found an older behaviour called Linkable which promised to fill this 
 gap, but unfortunatley it doesn't work with cake 2.5 :(

 Thanks for your input!

 Regards,
 Frank

 -- 
 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 unsubscribe from this group and stop receiving emails from it, send an 
 email to cake-php+u...@googlegroups.com javascript:.
 To post to this group, send email to cake...@googlegroups.comjavascript:
 .
 Visit this group at http://groups.google.com/group/cake-php.
 For more options, visit https://groups.google.com/d/optout.




-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: Order using Containable-Behaviour on deeper levels (1)

2014-05-29 Thread LDSign
Yehaw! It seems running Hash::Sort multiple times in the opposite direction 
one would do in a normal query solves exaclty this task :)

Hope, it doesnt have any drawbacks... ;)

Regards,
Frank

Am Donnerstag, 29. Mai 2014 12:55:57 UTC+2 schrieb LDSign:

 Thanks. Ive already looked at the Hash::sort method.

 But with that it is not possible to sort on multiple fields in priority. 
 e.g. first lastname than firstname 

 Or do I miss something?

 Frank

 Am Donnerstag, 29. Mai 2014 12:41:00 UTC+2 schrieb Jeremy Burns:

 Look at Hash::sort - 
 http://book.cakephp.org/2.0/en/core-utility-libraries/hash.html#Hash::sort

 On 29 May 2014, at 11:28, LDSign fr...@lamozik.de wrote:

 Hi

 This was discussed several times on the inet - it seems that it is not 
 possible to use an order on a deeper association connected with the 
 containable behaviour, because the behaviour splits the query in several 
 parts :(

 Whats the best approach to make sorting on deeper levels work with 
 containable?

 Ive found an older behaviour called Linkable which promised to fill 
 this gap, but unfortunatley it doesn't work with cake 2.5 :(

 Thanks for your input!

 Regards,
 Frank

 -- 
 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 unsubscribe from this group and stop receiving emails from it, send an 
 email to cake-php+u...@googlegroups.com.
 To post to this group, send email to cake...@googlegroups.com.
 Visit this group at http://groups.google.com/group/cake-php.
 For more options, visit https://groups.google.com/d/optout.




-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Exclude prefix (e.g. admin) from cacheAction globally

2014-04-22 Thread LDSign
Hi

CacheAction allows us to set the actions which should be cached after 
setting Cahce.check to true. So far so good.

But is it possible to disable caching for a special prefix so say cache all 
actions except for those which have the prefix admin?

This will be a big increase in maintance in my special case, because only 
the backend (=admin) requires  dynamic generation (=no caching)?

Or is there any other approach?

Thanks,
Frank

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Tree / parent name (from parent_id) as virtual field

2014-03-13 Thread LDSign
Hi

Ive tried to set up a virtual field in the model to get the parent_name of 
a normal tree in cake. No luck so far :(

Here is the query Ive tried:

public $virtualFields = array(
'parent_name' = 'SELECT Category.name FROM categories as Category WHERE 
Category.id = Category.parent_id NULL LIMIT 1'
);

I know the virtualField attribute accepts standard SQL-queries, but this 
does not work.

Could you give me a hint?

Thanks,
Frank

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Set title_for_layout in controller or view?

2014-02-17 Thread LDSign
Hi

Sure, the title could be set in the controller and/or in the view.

But what is the best practice regarding coding standards and the MVC 
pattern? The docs are not clear at this point. What do you think?

Thanks,
Frank

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Set title_for_layout in controller or view?

2014-02-17 Thread LDSign
Thanks.

But any reason for this? I would have guessed the title is more related to 
the view than to the controller...

Frank

Am Montag, 17. Februar 2014 09:25:59 UTC+1 schrieb perumal:

 Hi, 

 The best practice well be setting title in controller. 

 Regards, 
 Perumal S 

 On Mon, Feb 17, 2014 at 1:54 PM, LDSign fr...@lamozik.de javascript: 
 wrote: 
  Hi 
  
  Sure, the title could be set in the controller and/or in the view. 
  
  But what is the best practice regarding coding standards and the MVC 
  pattern? The docs are not clear at this point. What do you think? 
  
  Thanks, 
  Frank 
  
  -- 
  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 unsubscribe from this group and stop receiving emails from it, send 
 an 
  email to cake-php+u...@googlegroups.com javascript:. 
  To post to this group, send email to cake...@googlegroups.comjavascript:. 

  Visit this group at http://groups.google.com/group/cake-php. 
  For more options, visit https://groups.google.com/groups/opt_out. 


-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.


Complex fluid user/company structure

2014-01-23 Thread LDSign
Hi

Just for brainstorming ;) Think of the following structure:

#1:
Company 1 (e.g. administration house)
 Company 2 (e.g. managers)
  Company 3 (e.g. regular company)
   Company 4 (e.g. subsidiary of a company)

#2:
Users

...with roles (ACL controlled) which belong to a certain company above. 
These could (!) have relations in between. So User 1 could be a manager 
of User 2 at every point of the structure a.s.o.

Unfortunatly this layout is fluid :( So there could be more or less levels 
of companies as shown above.

Each user of a specified company-level should only see and manage his 
users down below the tree.

Tree! Hooray! That comes first to my mind, but could this thing be achieved 
with the build-in TreeBehaviour, so I could keep queries simple and 
straight-forward? e.g. searching for a specified company will give all (!) 
related users (and data) of all related companies down the structure?

And to make this complete, users (whit ACL rights) can manage (edit/create) 
a company down the tree again.

What do you think? I need a push into the right direction ;)

Thanks,
Frank

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Layout question - adding a class to a wrapper div

2013-12-08 Thread LDSign
Hi

I always put this to my layout body:

body class=?php echo $this-params-controller ?

So I am ready to call each rendered controller separately via css. Sure, 
you could also add $this-params-action to have finer granulation :)

Cheers,
Frank

Am Freitag, 6. Dezember 2013 18:26:50 UTC+1 schrieb Dave M.:

 Let's say I have a default layout containing this body (overly-simplified):

 div id=wrapper
   div id=nav
!-- some nav stuff --
   /div
  div id=content
?php echo $this-fetch('content'); ?
  /div
 /div

 I have a need to add a class to the wrapper id for a couple of pages on my 
 site.
 It seems like creating a new layout is overkill for just one minor 
 addition when everything inside the wrapper div is the same.

 Any ideas on how to accomplish 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 unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Quick way to wrap input[type=radio] in label tags?

2013-06-18 Thread LDSign
Hi

Have a look at the form helper options (
http://book.cakephp.org/2.0/en/core-libraries/helpers/form.html).

Using format, after,before and between even complex wrapping is 
possible. Ive used this in combination of an extended FormHelper to make 
the markup for bootstrap (including errors, tooltips a.s.o.), but staying 
as close to the core as possible.

Cheers!

Frank

Am Dienstag, 18. Juni 2013 06:25:33 UTC+2 schrieb OJ Tibi - @ojtibi:

 Good day, folks!

 I was wondering if there was any quick option of making label tags wrap 
 the inputs they're associated with, instead of sitting beside the input 
 itself (e.g., labels for radio buttons generated by FormHelper-input() or 
 FormHelper-radio() don't actually wrap the radio buttons they're 
 associated with).

 Reason I'm asking this is that certain front-end frameworks like ZURB 
 Foundation require labels to wrap radio buttons for the Custom Form 
 features to work.

 Cheers,
 OJ


-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.




Switch validation set within model?

2013-06-13 Thread LDSign
Hi

I would liket to switch a complete validation set for a model (in the 
controller). Deeper levels of the application requires more and more user 
data, so I had the idea to define multiple validation sets within the 
models for each level.

Best solution will be an automatic switch for a specified action.

Ive already searched a litte and found this:

http://php.dzone.com/news/cakephp-12-multiple-validation

Unfortunatley this is for Cake 1.2 - does anyone have a working solution 
for 2.3.6?

Or is there a better approach of doing this?

Thanks,
Frank

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




File download from Soap Resonse (binary from xml)

2013-05-17 Thread LDSign
Hi

Ive a working soapclient now. So far so good :)

In the response I am getting a binary string as a object (php5 Soapclient 
class). NowI would like to extract this binary-object and offer a option to 
display or download it.

What is the best way to do this with cake? I have already tried the build 
in response class. But it seems this will need to have the file in the file 
system first (needs path setting in the cookbook example). I am glad to 
avoid this.

Could you provide a short example how to do this?

Thanks,
Frank

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Best practice: Record associated to one or all

2013-05-13 Thread LDSign
Hi

What is the best practice to store records which are either related to one 
parent OR to all parents?

Related to one is clear (set parent_id to id), but which method is the 
better approach:

Set parent_id to 0 to make the record available to all parents or set it to 
null and make a global switch (tinyint 0/1)?

In real life a document can belong to one company OR (not at the same time) 
to all companies.

What would you do?

Thanks,
Frank

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Best place for a SoapClient?

2013-05-13 Thread LDSign
Hi


I am trying to include a really complex php5 SoapClient interface with tons 
of objects and methods in my cake app. What do you think is the best place 
for the code? Controller, component, model or a DBSource?

The code must not be reusable, because its very specific.

Thank you for pushing me into the right direction,
Frank

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Confused about routing

2013-04-17 Thread LDSign
Hi

I am trying to make a special route, but had no success so far. Could you 
help?

The url looks like:

/products/:category_slug/:product_slug


So, when product_slug isnt specified I would like to use

array('controller' = 'categories','action' = 'index')


and in the other case (when product_slug is specified):

array('controller' = 'products','action' = 'index')


For example:

/products/category_a should point to /categories/index/category_a


and (note the same category_slug)

/products/category_a/product_a should point to 
/products/index/category_a/product_a


Is this possible and could you provide an example?

Thank you very much,
Frank 

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Check if permission is inherited

2013-03-24 Thread LDSign
Hi

Thanks for your answer. I was hoping that there is a internal function in 
Acl to accomplish this. Do you have a code example for a custom function to 
check inheritance?

Regards,
Frank

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Check if permission is inherited

2013-03-23 Thread LDSign
Hi

Acl-check() only returns if a permission is granted or not. Is there a 
way to check (for a single element) if the permission is directly 
granted/denied or just inherited?

Thanks,
Frank

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Extract path from multidimensional (threaded) array

2013-03-22 Thread LDSign
Hi

I am not sure if this is directly related to cake. But I think the Hash 
class could do the job. I have already fiddled around with it, but with no 
success :(

I would like to transform a multidimensional array to a path syntax in a 
most simple way. Please look at the example input array attached as a 
txt-file.

The resulting flat array should look like this:

Array (
[0] = controllers
[1] = controllers/Actions
[2] = controllers/Actions/admin_index
[3] = controllers/Actions/admin_edit
[4] = controllers/Actions/admin_inline
[5] = controllers/Agents
[6] = controllers/Agents/register
[7] = controllers/Agents/admin_verify
[8] = controllers/Agents/admin_index
[9] = controllers/Applications
[10] = controllers/Applications/pension
[11] = controllers/AclManager
[12] = controllers/AclManager/Acl
[13] = controllers/AclManager/Acl/admin_drop
[14] = controllers/AclManager/Acl/admin_drop_perms
)

The input array could have many children - it is not predictable how  
deep the array actually is.

I am sure this could be achieved with a single line of code, but I don't 
know how. You?

Thank you very much,
Frank

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Array
(
[0] = Array
(
[Aco] = Array
(
[alias] = controllers
)

[children] = Array
(
[0] = Array
(
[Aco] = Array
[alias] = Actions

)

[children] = Array
(
[0] = Array
(
[Aco] = Array
[alias] = admin_index
)
)

[1] = Array
(
[Aco] = Array
(
[alias] = admin_edit
)
)

[2] = Array
(
[Aco] = Array
(
[alias] = admin_inline
)
)

)

)

[1] = Array
(
[Aco] = Array
(
[alias] = Agents
)

[children] = Array
(
[0] = Array
(
[Aco] = Array
(
[alias] = register
)
)

[1] = Array
(
[Aco] = Array
(
[alias] = admin_verify
)
)

[2] = Array
(
[Aco] = Array
(
[alias] = admin_index
)
)
)

)

[2] = Array
(
[Aco] = Array
(
[alias] = Applications

CakePHP 2.3.0: Bug in CacheEngine?

2013-02-27 Thread LDSign
Hi

Related to my post below I have switched from File to APC Cache. Read and 
write commands to the APC-Cache work like expected. But when I use clear() 
and clearGroup() nothing happens.

I have digged a little deeper and put some debug info in the related 
FileEngine.php and ApcEngine.php. Result: The functions (clear  
clearGroup) in ApcEngine.php are never used - instead the ones of the 
FileEngine.php are used. Its clear, that this does not work.

Is this a bug?

Ive debugged the $engine-variable in core.php. It is Apc like it should - 
File isn't used at all anymore in my app.

Thanks,
Frank

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Cache::clearGroup in model and component building cache again

2013-02-26 Thread LDSign
Hi

I have ran into a problem which drives me crazy :(

Ive a component which is used on every page to build the navigation for 
every individual user. The navigation is database driven so caching is a 
good idea - so far so good

The cache is built in the startup-callback of the component like so 
(package and agent is just an example):
 

 public function initialize(Controller $controller) {
 parent::initialize($controller);
 $package = Cache::read($this-Auth-user('id'),'packages');

 if (!$package) {
 $agent = ClassRegistry::init('Agent')-find('first',array('conditions' = 
 array('Agent.id' = $this-Auth-user('Company.agent_id';

 if (!empty($agent)) {
 Cache::write($this-Auth-user('id'), $agent['Package'],'packages');
 }
 }
 }


This works as expected (if the cache file does not exist it would be 
generated).

Now, I would like to push the creation of the cache manually when a 
data-change happens. So Ive put an afterSave-callback in the model:

public function afterSave($created) {
 Cache::clearGroup('packages');
 }


This works too if I test this seperatly. But when I use this together 
with the component-callback I will get an error-message:

*Warning* (2): 
unlink(C:\xampp\htdocs\ebsst\tmp\cache\packages\ebsst_package_73): Permission 
denied [*CORE\Cake\Cache\Engine\FileEngine.php*, line *368*]

The cache-file is not cleared though. I guess the file is locked by the 
file-system (Xampp on Windows 7) through the component. I am not sure about the 
order of these callbacks and how they interfere between models and components. 
So ive tried different callbacks in both - but no luck.

Do you have a hint to solve this problem or is this a complete false approach?

Thanks,
Frank


-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Cache::clearGroup in model and component building cache again

2013-02-26 Thread LDSign
Just one addition: The unlink-error is the same when I use the
AutoCache-Plugin instead of the component-logic above...

On Feb 26, 6:50 pm, LDSign fr...@lamozik.de wrote:
 Hi

 I have ran into a problem which drives me crazy :(

 Ive a component which is used on every page to build the navigation for
 every individual user. The navigation is database driven so caching is a
 good idea - so far so good

 The cache is built in the startup-callback of the component like so
 (package and agent is just an example):

  public function initialize(Controller $controller) {
  parent::initialize($controller);
  $package = Cache::read($this-Auth-user('id'),'packages');

  if (!$package) {
  $agent = ClassRegistry::init('Agent')-find('first',array('conditions' =
  array('Agent.id' = $this-Auth-user('Company.agent_id';

  if (!empty($agent)) {
  Cache::write($this-Auth-user('id'), $agent['Package'],'packages');
  }
  }
  }

 This works as expected (if the cache file does not exist it would be
 generated).

 Now, I would like to push the creation of the cache manually when a
 data-change happens. So Ive put an afterSave-callback in the model:

 public function afterSave($created) {

  Cache::clearGroup('packages');
  }

 This works too if I test this seperatly. But when I use this together
 with the component-callback I will get an error-message:

 *Warning* (2): 
 unlink(C:\xampp\htdocs\ebsst\tmp\cache\packages\ebsst_package_73): Permission 
 denied [*CORE\Cake\Cache\Engine\FileEngine.php*, line *368*]

 The cache-file is not cleared though. I guess the file is locked by the 
 file-system (Xampp on Windows 7) through the component. I am not sure about 
 the order of these callbacks and how they interfere between models and 
 components. So ive tried different callbacks in both - but no luck.

 Do you have a hint to solve this problem or is this a complete false approach?

 Thanks,
 Frank

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Model relations (optional level)

2013-02-19 Thread LDSign
Hi

Thank you both for your answers :)

@Yvon: It will be choice 1 - every subsidiary is unique to a company.
But I am not sure what you actually mean in your solution for this
case (why a parent_id?).

@Jermeny: The tree behaviour seems exaclty to do what I am looking
for. Hopefully this does not complicate the queries/finds Ive already
built. Usally all actions in my app are and will be on company-level.
The (optional) subsidiary-relation is only for statistic purposes (and
to run grouping operations).

Thanks again,
Frank

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Model relations (optional level)

2013-02-18 Thread LDSign
Hi

I am not sure how to give this thread a clear title or topic. But let me 
explain what I am trying to do (or find the best and right practice for 
this approch).

Think of 3 tables: Users, companies and subsidiaries. Users always belong 
to a company but they could (!) belong to subsidiary which is itself 
related to a company.

So there are 2 constellations:

Company - Users

Company - Subsidiaries - Users

The relation between a company and a subsidiary is clear. But what is the 
best approach for storing the user relation?

Set both company_id + subsidiary_id in the user model although 
subsidiary_id has already a relation to a company? This could lead into 
illogical data, if the relation between company and subsidiary has changed.

Or leaving company_id empty in that case and only setting the 
subsidiary_id? In the other case leave subsidiary_id empty if a user 
belongs directly to a company.

What do you think?

Thanks,
Frank

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Best practice to call cake schema update without shell

2013-01-29 Thread LDSign
The hoster is 11 (Business Pro Shared Host). Ive already tried
accessing the shell via ssh, but it seems Ive no right for that.

I would like to call cake schema update on a scheme I have uploaded
to the production/presentation server which is currently in testing
state (so db changes are common). In an optimum way, I would to
migrate the db within the admin-interface with a simple click.

Do you have any hint how I could accomplish this on the given 11
host?

Thanks,
Frank



On Jan 29, 10:51 am, euromark dereurom...@gmail.com wrote:
 It can. If you got sufficient rights to do that (executable rights for this
 user - www-data probably).
 But I am not sure if thats a very good idea.
 Why not providing shell access here?

 Am Dienstag, 29. Januar 2013 05:59:51 UTC+1 schrieb LDSign:









  Hi

  I would like to call a shell command on a prdouction server without
  shell access. Whats the best practice of doing that? Can a shell-
  command being called from a controller?

  Thank you,
  Frank

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Best practice to call cake schema update without shell

2013-01-28 Thread LDSign
Hi

I would like to call a shell command on a prdouction server without
shell access. Whats the best practice of doing that? Can a shell-
command being called from a controller?

Thank you,
Frank

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Any way to check url before redirect?

2013-01-25 Thread LDSign
Hi

I am searching for a way in cake to check an url before it is called
(via redirect).

Real world:

The user could set a custom start page to which he is redirect after
login. This page is mapped to / all the time too. So far so good :)
Unfortunately it is not predictable that this page is available in the
future (deleted or just because he has no rights to access this page
anymore). Of course this results in an error or even worse in a
redirect loop.

What I like to do is to check the given url for accessibility and if
it is not available redirect the user to a default page (which is
always accessible).

Can this be achieved with cake?

Thanks,
Frank

-- 
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: Any way to check url before redirect?

2013-01-25 Thread LDSign
Thank you :) Thats a good starting point, but how do I check there if
the redirect will be successfull?

Frank

On Jan 25, 11:48 am, euromark dereurom...@gmail.com wrote:
 Use a component and its beforeRedirect() callback
 see the docs for more infos, but basically you can intercept the redirect
 this way.

 Am Freitag, 25. Januar 2013 11:28:37 UTC+1 schrieb LDSign:









  Hi

  I am searching for a way in cake to check an url before it is called
  (via redirect).

  Real world:

  The user could set a custom start page to which he is redirect after
  login. This page is mapped to / all the time too. So far so good :)
  Unfortunately it is not predictable that this page is available in the
  future (deleted or just because he has no rights to access this page
  anymore). Of course this results in an error or even worse in a
  redirect loop.

  What I like to do is to check the given url for accessibility and if
  it is not available redirect the user to a default page (which is
  always accessible).

  Can this be achieved with cake?

  Thanks,
  Frank

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




Restrict access to records for certain groups / control by acl

2013-01-21 Thread LDSign
Hi

I am using ACL to control access for groups and users to different actions. 
Now I would like to extend this behaviour to record level.

Think of 3 groups: Users, agents and administrators. The model for 
restricted access is company for example (in real life there are much 
more like documents a.s.o)

Admins should have CRUD access to all companies application wide, agents 
only to the ones which have an corresponding agent_id and users have no 
admin control at all (easy because of acl).

So far so good. I could hack every controller to find out which companies 
are allowed, but I think this is not really the MVC/DRY way, because there 
are many models which share this behaviour.

Could you point me into the right direction?

Next: I would like to give the decision if a user could access all records 
or only his own ones in the hand of acl. Ive made to methods for this (in 
the corresponding controller - here companies): admin_all and admin_own 
which returns a list of all valid ids. These methods/acos are easily 
integrated into acl. Is this the right approach?

Hope that Ive explained my problem good enough - not so easy for me in 
english ;)

Thank you,
Frank

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




Best practice for naming ACOs in Cake?

2013-01-10 Thread LDSign
Hi

Ive implemented a complete ACL-Solution in my app. I am using an 
administration form for acl-management (allow/deny) which I am building 
directly on-the-fly (from the aco-table).

So now, I would like to make this acl-form accessible to some groups with 
non-technical knowledge. Of course displaying the default method aliases 
to the user is not so self-explanatory for everyone. I would like to add a 
real name and a description.

What do you think were I should store this information for the aco? 
Modifying/extend the cake aco-table? Or in a related table? Which is most 
cake-like? In an optimum way the description and the name is related to the 
translateable behaviour to offer different languages.

Has somebody done this already?

Thanks for your input!

Regards,
Frank

-- 
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: Translate behaviour / Save multiple languages at once

2012-12-27 Thread LDSign
Hi

Thanks - you pushed me in the right direction :)

$this-Yourmodel-locale = false;

as you suggested produces an array_merge error. But using

$this-Yourmodel-locale = array('deu','eng');

will exactly do what I want when adding a new record (in combination
with the two form elements).

But this runs into the next problem: In the edit-action only the
translated original field will be populated with the request-data -
whatever I set as locale. What wrongs here?

Literally this behaviour drives me crazy. But Ive not given up yet ;)

Regards,
Frank

On Dec 24, 3:10 am, matthieu.ri...@googlemail.com wrote:
 Hey

 The translate behaviour seems to be quite bad documented.

 If you want to work with it correctly, you've to mind to set the locale
 attribute:

 $this-Yourmodel-locale = false; //storing multiple languages at once
 $this-Yourmodel-locale = null; //will use the locale in your conf
 $this-Yourmodel-locale = 'any string you that you makes happy';//custom
 one

 if you save or retrieve the data you've to set that attribute!

 greetz

 Am Samstag, 1. Dezember 2012 16:29:56 UTC+1 schrieb LDSign:









  Hi

  Ive searched for several hours now and unfortunatly the translate
  behaviour does not work as expected. I try to save multiple translation
  fields at once like so:

  echo $this-Form-adminText('name.deu',__('Name german'));
  echo $this-Form-adminText('name.eng',__('Name english'));

   My controller (save)action is unmodified from the one baked. In the model
  Ive correctly included the translate behaviour:

  public $actsAs = array('Translate' = array('name'));

  Cake-Version is 2.2.3

  So what happens? I expect that the two name fields would be saved to the
  i18n table under their corresponding langauge after transmitting the form.
  But instead of this only the (actual) language stored in the session will
  be used...so only one language-entry is added to the i18n table and the
  other language will be completly ignored.

  After searching the net several people had success with the approach shown
  above, but on my side it doesn't work. What I am doing wrong? Is this a bug?

  Thank you for your help.

  Greetings,
  Frank

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




Translate behaviour / Save multiple languages at once

2012-12-01 Thread LDSign
Hi

Ive searched for several hours now and unfortunatly the translate behaviour 
does not work as expected. I try to save multiple translation fields at 
once like so:

echo $this-Form-adminText('name.deu',__('Name german'));
 echo $this-Form-adminText('name.eng',__('Name english'));


 My controller (save)action is unmodified from the one baked. In the model 
Ive correctly included the translate behaviour:

public $actsAs = array('Translate' = array('name'));


Cake-Version is 2.2.3 

So what happens? I expect that the two name fields would be saved to the 
i18n table under their corresponding langauge after transmitting the form. 
But instead of this only the (actual) language stored in the session will 
be used...so only one language-entry is added to the i18n table and the 
other language will be completly ignored.

After searching the net several people had success with the approach shown 
above, but on my side it doesn't work. What I am doing wrong? Is this a bug?

Thank you for your help.

Greetings,
Frank

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




Asset filtering CakePHP 2.0.5 / css.php not included anymore?

2012-01-09 Thread LDSign
Hi there

I've tried to enable the CSS asset filtering in CakePHP 2.0.5, but it
doesn't work. csspp is placed in vendors.

It seems the required file css.php in the webroot-dir is missing.
Any hints? Or has the scheme changed in 2.0?

Thank you,
Frank

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


find('list') - 'fields'-parameter in model?

2010-03-19 Thread LDSign
Hi

Is it possible to move the fields-parameter for find('list') into the
model so it can be used with every find('list') command?

Thanks,
Frank

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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

To unsubscribe from this group, send email to 
cake-php+unsubscribegooglegroups.com or reply to this email with the words 
REMOVE ME as the subject.


Tree behaviour when parent is in other table?

2010-03-15 Thread LDSign
Hi

I use the tree behaviour mainly for sorting items (with moveup/
movedown). These items have their parents in an other table (foreign
key). The parent_id from the tree will be left null.

Of course this will make some trouble when moving the items around.
How could I tell CakePHP to look for a parent_id in a other table?

Think of it like an user/group relation with two tables. Each user
belongs to only one group. Now I would like to move the user user up
and down in an automagic way...

Thanks,
Frank

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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Tree behaviour when parent is in other table?

2010-03-15 Thread LDSign
Hi

Thank you for your help. Regarding to the user/group-relation: I would
like to move a user up and down in ONE specified group. There are
users in other groups for example which should not interfer with this
particular reorder-action.

Example:

User, Group, lft, right

UserA, GroupA, 1, 2
UserB, GroupA, 2, 3
UserC, GroupB, 3, 4
UserD, GroupA, 4, 5

Now here is the problem: If I would like to move UserD between UserA
and UserB, I've to skip UserC in any way. If the parents are in the
same table, the situation is clear (handled by Cake) but here Cake
does not know UserC belongs to another branch. Of course it won't ;)

Should I try to make dummy-parents and exclude them from any
queries ? Or is this ugly?

Thank you again,
Frank

On Mar 15, 6:03 pm, Jon Bennett jmbenn...@gmail.com wrote:
  Think of it like an user/group relation with two tables. Each user
  belongs to only one group. Now I would like to move the user user up
  and down in an automagic way...

 Ahh! ok, in that case, you've gone about it slightly the wrong way.

 Your User model isn't a tree, teh groups ahh. You don't move the user
 around the tree, you change the group that user belongs to.

 You can then change the position of a group till your hearts content.

 J

 --
 jon bennett -www.jben.net- blog.jben.net

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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Tree behaviour when parent is in other table?

2010-03-15 Thread LDSign
Thats exactly why I seperated these things into two tables. They don't
belong together in a semantical manner. User/group is only an example,
but it shows what I mean.

To make it clear.

Table A - Item 1
   + Table B - Item 1
   + Table B - Item 2
   + Table B - Item 3
Table A- Item 2
   + Table B - Item 1
   + Table B - Item 2
   + Table B - Item 3

a.s.o.

Having a look at my second post...how can I reorder the items of Table
B in its own branch?

On Mar 15, 9:15 pm, Jon Bennett jmbenn...@gmail.com wrote:
 hi,





  Thank you for your help. Regarding to the user/group-relation: I would
  like to move a user up and down in ONE specified group. There are
  users in other groups for example which should not interfer with this
  particular reorder-action.

  Example:

  User, Group, lft, right

  UserA, GroupA, 1, 2
  UserB, GroupA, 2, 3
  UserC, GroupB, 3, 4
  UserD, GroupA, 4, 5

  Now here is the problem: If I would like to move UserD between UserA
  and UserB, I've to skip UserC in any way. If the parents are in the
  same table, the situation is clear (handled by Cake) but here Cake
  does not know UserC belongs to another branch. Of course it won't ;)

  Should I try to make dummy-parents and exclude them from any
  queries ? Or is this ugly?

 I think things are rather complicated at the mo. Semantically, how can
 a user also be a group? If you remove groups entirely, and say that a
 user that has children is a 'group', doesn't your problem go away?

 Cheers,

 J

 --
 jon bennett -www.jben.net- blog.jben.net

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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


CakePHP Auth-component in AppController

2010-03-04 Thread LDSign
Hi

Ive implemented the login-logic with help of Auth. This works fine.
But I would like to have auth all over my site. So I would like to
include this component to the AppController (for global access). As
soon as I do so, the site stops working. The page will load for some
seconds and then there comes blank page with a redirect-error (sorry
Ive this only in german):

Diese Webseite weist eine Weiterleitung auf.

Die Webseite unter http://localhost/ben/users/login hat zu viele
Umleitungen erzeugt. Das Löschen Ihrer Cookies für diese Website oder
das Zulassen von Drittanbieter-Cookies könnte das Problem
möglicherweise beheben. Sollte das Problem damit nicht behoben sein,
liegt möglicherweise ein Serverkonfigurationsfehler und kein Problem
mit Ihrem Computer vor.

This drives my nuts. Do you have any hint? Until now Ive thought that
when I move my components from the (sub-)controller to the
AppController that this doesnt make any change execpt for accessing it
globally.

I use cakePHP 1.3 - latest beta. Are there any known issues?

Thank you,
Frank

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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en