Re: cake.po: Mixed up translations for "timeAgoInWords"

2012-09-12 Thread Johannes N
ok, that's weird.

after removing all the additional headers (created by poedit) everything is 
working correctly.

I only have following headers in the file:

"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

Well, that's not a satisfying solution (sounds bit "randomish" to me), but 
i'm happy, that it's working now).

On Wednesday, September 12, 2012 12:45:53 PM UTC+2, AD7six wrote:
>
> It looks like you're creating the po file manually - or not via cake
>
> Therefore:
>
>
>- use the I18n shell to generate your po file
>- Ensure the plural rule is correctly defined ("Plural-Forms: 
>nplurals=2; plural=(n != 1)\n" is correct)
>- create/edit the de po file
>
>
> AD
>

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




Re: cake.po: Mixed up translations for "timeAgoInWords"

2012-09-12 Thread Johannes N
anyone with an idea? :-(

On Friday, September 7, 2012 10:24:58 AM UTC+2, Johannes N wrote:
>
> Hi guys!
>
> I searched the whole web, but didn't found anything about this one. 
>
> In my latest project I use following code to inform the user, when a 
> sweepstake is going to end:
>
> Time->timeAgoInWords($challenge["Challenge"]["end"], array("end" 
> => "+1 year"))?>
>
> Code itself works like a charme, but unfortunately the translations get 
> mixed up. CakePHP translates some singular values to plural, and vice versa.
>
> So, my /Locale/deu/LC_MESSAGES/cake.po file looks like
>
> msgid "%d year"
> msgstr "%d Jahr"
>
> msgid "%d years"
> msgstr "%d Jahre"
>
> msgid "%d month"
> msgstr "%d Monat"
>
> msgid "%d months"
> msgstr "%d Monate"
>
> msgid "%d week"
> msgstr "%d Woche"
>
> msgid "%d weeks"
> msgstr "%d Wochen"
>
> msgid "%d day"
> msgstr "%d Tag"
>
> msgid "%d days"
> msgstr "%d Tage"
>
> msgid "%d hour"
> msgstr "%d Stunde"
>
> msgid "%d hours"
> msgstr "%d Stunden"
>
> msgid "%d minute"
> msgstr "%d Minute"
>
> msgid "%d minutes"
> msgstr "%d Minuten"
>
> msgid "%d second"
> msgstr "%d Sekunde"
>
> msgid "%d seconds"
> msgstr "%d Sekunden"
>
>
> Currently the app displays the : 5 Monat, 3 Woche, 3 Tag, although it 
> should be: 5 Monate, 3 Wochen, 3 Tage (5 months, 3 weeks, 3 days).
>
> In my opinion everything's set up correctly. I've looked into 
> /lib/Cake/Utility/CakeTime.php (829-835) and double checked the code there 
> as well. So, Guys, can anyone help me with this problem?
>
> Greetings from Vienna,
>

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




Re: Miles J Uploader

2012-09-10 Thread Johannes N
well, probably it's the

'name' => 'name' // Saves the file in database with actual name of uploaded 
file

line. :) i would strip down the code to the only needed lines, so you would 
end with:



   1. 'Uploader.Attachment' => array (
   2. 'fileName' => array (
   3. 'name'  => 'generateFilename',
   4. 'dbColumn'  => 'path',  
   5. 'overwrite' => false,   
   6. 'stopSave'  => true,
   7. 'allowEmpty'=> false,   
   8. );
   

greetings,

On Monday, September 10, 2012 2:01:16 PM UTC+2, CrotchFrog wrote:
>
> I'm using Miles J Uploader plugin and Cake 2.2.2. I've configured the 
> plugin in my model as $actsAs => Uploader.attachment. 
> What I'm having problems with is that I have a custom function in the 
> bootstrap to save the file with a unique filename and that works ok
> but its saves the record in the database with the original name of the 
> uploaded file. Any idea how to get the two filenames to match? 
>
> Please see Pastebin: 
> http://bin.cakephp.org/view/70326247 
>
> - ED
>

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




Re: cake.po: Mixed up translations for "timeAgoInWords"

2012-09-07 Thread Johannes N
thx ad7six! didn't know that there even exists a msg_id_plural. now that i 
know, searching the web for this problem is a lot easier.

but it turned out that it doesn't work at all - although i'm using po edit 
now:

msgid ""
msgstr ""
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"Project-Id-Version: Challenge App\n"
"POT-Creation-Date: \n"
"PO-Revision-Date: \n"
"Last-Translator: \n"
"Language-Team: xxx\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: German\n"
"X-Poedit-SourceCharset: UTF-8\n"

msgid "%d year"
msgid_plural "%d years"
msgstr[0] "%d Jahr"
msgstr[1] "%d Jahre"

msgid "%d month"
msgid_plural "%d months"
msgstr[0] "%d Monat"
msgstr[1] "%d Monate"

msgid "%d week"
msgid_plural "%d weeks"
msgstr[0] "%d Woche"
msgstr[1] "%d Wochen"

msgid "%d day"
msgid_plural "%d days"
msgstr[0] "%d Tag"
msgstr[1] "%d Tage"

msgid "%d hour"
msgid_plural "%d hours"
msgstr[0] "%d Stunde"
msgstr[1] "%d Stunden"

msgid "%d minute"
msgid_plural "%d minutes"
msgstr[0] "%d Minute"
msgstr[1] "%d Minuten"

msgid "%d second"
msgid_plural "%d seconds"
msgstr[0] "%d Sekunde"
msgstr[1] "%d Sekunden"


leads to a "Missing plural form translation for "%d month" in "cake" 
domain, "deu" locale.  Check your po file for correct plurals and valid 
Plural-Forms header. [CORE/Cake/I18n/I18n.php, line 211]"

weeks and days work on a random basis. maybe this problem is related to a 
caching issue?

greetings,

On Friday, September 7, 2012 10:24:58 AM UTC+2, Johannes N wrote:
>
> Hi guys!
>
> I searched the whole web, but didn't found anything about this one. 
>
> In my latest project I use following code to inform the user, when a 
> sweepstake is going to end:
>
> Time->timeAgoInWords($challenge["Challenge"]["end"], array("end" 
> => "+1 year"))?>
>
> Code itself works like a charme, but unfortunately the translations get 
> mixed up. CakePHP translates some singular values to plural, and vice versa.
>
> So, my /Locale/deu/LC_MESSAGES/cake.po file looks like
>
> msgid "%d year"
> msgstr "%d Jahr"
>
> msgid "%d years"
> msgstr "%d Jahre"
>
> msgid "%d month"
> msgstr "%d Monat"
>
> msgid "%d months"
> msgstr "%d Monate"
>
> msgid "%d week"
> msgstr "%d Woche"
>
> msgid "%d weeks"
> msgstr "%d Wochen"
>
> msgid "%d day"
> msgstr "%d Tag"
>
> msgid "%d days"
> msgstr "%d Tage"
>
> msgid "%d hour"
> msgstr "%d Stunde"
>
> msgid "%d hours"
> msgstr "%d Stunden"
>
> msgid "%d minute"
> msgstr "%d Minute"
>
> msgid "%d minutes"
> msgstr "%d Minuten"
>
> msgid "%d second"
> msgstr "%d Sekunde"
>
> msgid "%d seconds"
> msgstr "%d Sekunden"
>
>
> Currently the app displays the : 5 Monat, 3 Woche, 3 Tag, although it 
> should be: 5 Monate, 3 Wochen, 3 Tage (5 months, 3 weeks, 3 days).
>
> In my opinion everything's set up correctly. I've looked into 
> /lib/Cake/Utility/CakeTime.php (829-835) and double checked the code there 
> as well. So, Guys, can anyone help me with this problem?
>
> Greetings from Vienna,
>

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




cake.po: Mixed up translations for "timeAgoInWords"

2012-09-07 Thread Johannes N
Hi guys!

I searched the whole web, but didn't found anything about this one. 

In my latest project I use following code to inform the user, when a 
sweepstake is going to end:

Time->timeAgoInWords($challenge["Challenge"]["end"], array("end" 
=> "+1 year"))?>

Code itself works like a charme, but unfortunately the translations get 
mixed up. CakePHP translates some singular values to plural, and vice versa.

So, my /Locale/deu/LC_MESSAGES/cake.po file looks like

msgid "%d year"
msgstr "%d Jahr"

msgid "%d years"
msgstr "%d Jahre"

msgid "%d month"
msgstr "%d Monat"

msgid "%d months"
msgstr "%d Monate"

msgid "%d week"
msgstr "%d Woche"

msgid "%d weeks"
msgstr "%d Wochen"

msgid "%d day"
msgstr "%d Tag"

msgid "%d days"
msgstr "%d Tage"

msgid "%d hour"
msgstr "%d Stunde"

msgid "%d hours"
msgstr "%d Stunden"

msgid "%d minute"
msgstr "%d Minute"

msgid "%d minutes"
msgstr "%d Minuten"

msgid "%d second"
msgstr "%d Sekunde"

msgid "%d seconds"
msgstr "%d Sekunden"


Currently the app displays the : 5 Monat, 3 Woche, 3 Tag, although it 
should be: 5 Monate, 3 Wochen, 3 Tage (5 months, 3 weeks, 3 days).

In my opinion everything's set up correctly. I've looked into 
/lib/Cake/Utility/CakeTime.php (829-835) and double checked the code there 
as well. So, Guys, can anyone help me with this problem?

Greetings from Vienna,

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




Re: Problem with radio labels

2011-04-12 Thread Johannes Hansen
Thank you both for your answers.

I don't actually want multi-select, I just want the radio option to be
selected when clicking on the corresponding label. At the moment the
ids of all the radio buttons are the same so independent of which
label you click, there would always be the first radio selected.

I also considered the 0 to be the problem, but firstly it doesn't work
without the 0 either. And secondly I need the 0 because I am using
multiple sets of radio buttons in one view. And that's the cake way to
do so.

So I absolutely don't know what's the problem here, I think it should
work with exactly that code.
Do I maybe need to do some special configuration when creating the
form?

On 12 Apr., 15:54, mi...@brightstorm.co.uk wrote:
> > Hey,
>
> > I am having a problem with my radio inputs and the corresponding
> > labels.
> > My code looks like this:
> >  >  echo $form->radio('Model.0.fieldName', array('1' => 'Value1', '2' =>
> > 'Value2', '3' => 'Value3'));
> > ?>
>
> > What I get as a result is
> >  > for="Model0FieldName">Value1
> >  > for="Model0FieldName">Value2
> >  > for="Model0FieldName">Value3
>
> > What I am expecting to get is rather "Model0FieldName1" as "id" and
> > "for" attribute (with the value added) so I could click on each label
> > to select the radio button.
>
> > Does anyone have an idea what I am doing wrong? Since the code is
> > quite simple I don't know where else to look for the error.
>
> you just need to loose the .0.
>
>   echo $form->radio('Model.fieldName', array('1' => 'Value1', '2' =>
> 'Value2', '3' => 'Value3'));
> ?>
>
> which produces
>
> FieldName id="ModelFieldName_" name="data[Model][fieldName]"> value="1" id="ModelFieldName1" name="data[Model][fieldName]"> for="ModelFieldName1">Value1 id="ModelFieldName2" name="data[Model][fieldName]"> for="ModelFieldName2">Value2 id="ModelFieldName3" name="data[Model][fieldName]"> for="ModelFieldName3">Value3
>
> which is what you are after.

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


Problem with radio labels

2011-04-12 Thread Johannes Hansen
Hey,

I am having a problem with my radio inputs and the corresponding
labels.
My code looks like this:
radio('Model.0.fieldName', array('1' => 'Value1', '2' =>
'Value2', '3' => 'Value3'));
?>

What I get as a result is
Value1
Value2
Value3

What I am expecting to get is rather "Model0FieldName1" as "id" and
"for" attribute (with the value added) so I could click on each label
to select the radio button.

Does anyone have an idea what I am doing wrong? Since the code is
quite simple I don't know where else to look for the error.

Thanks!

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


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


Re: Authentication against 2 different user tables

2010-11-25 Thread Johannes
Thanks for your input, I've decided to step over the big ACL chapter,
trying to really understand it ;-)
Do you know any other good tutorials than the example in the cookbook?
(Yes, I've already googled - but i would like to know what you would
recommend ;-))
Regards
Johannes

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


Authentication against 2 different user tables

2010-11-22 Thread Johannes
Hello,

I want to set up a new project, using CakePHP 1.3 and have one big
problem.

I have set up all the tables i need, but i have 2 "user-tables" called
users and agents.
I want to set up 2 different login sites, one for the users and one
for the agents (who have more or the less CRUD-Gui for the items they
are linked with).

But i have no clue, how to tell cake, that only "agents" have access
to the administration an not all the users.
---> Would one table "users" with acl be the best way?

there is also one other thing, i have the tables:
agents
agents_events   -> "administrating"
agents_locations-> "administrating"
users
users_event  -> "attending"
locations_users -> "bookmarked"

this is very convenient, because i have the agents and the users baked
in their own controller, which i wouldn't have if the agents and users
would be in one table, the problem is, that the agents and users have
different actions & fields in the database.

Is there an best-practice-way to have at least 2 different
loginsystems? (e.g. Frontend / Backenduser) ?

LG.
Jo

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: Modify Base Url

2010-04-17 Thread Johannes Goll
after changing the security level to 'low' it worked.



2010/4/11 Johannes Goll :
> I have redefined FULL_BASE_URL
>
>  define('FULL_BASE_URL', 'www.company.com');
>
> in the cake paths.php file
>
> http://api11.cakephp.org/paths_8php-source.html
>
> The urls are now all pointing to www.company.com/app, but still there
> is a problem with logging in the application (uses the authsome
> authentification component).
>
> After some debugging, I think that something with the session handling
> does not work properly . The site is being load balanced as well, so I
> switched to database based session handling (sessions are being logged
> in the session table).
>
> Still, I am not able to login.
>
> $this->Session->setFlash() is executed but no message is shown after
> the redirect?
>
> Any suggestions?
>
> Johannes
>
> 2010/4/7 Johannes Goll :
>> Hi All,
>>
>> we are building cake website that is externally accessible
>> at http://www.company.com/cakeapp
>> with mod rewrite enabled.
>>
>> Internally, that website gets translated to
>> http://cakeapp.company.com/cakeapp
>>
>> Everything works when accessing the page from
>> within the firewall but when accessing the page
>> from the outside only the index page
>> shows up - no links/controller actions work
>> as all of them use the internal url
>> http://cakeapp.company.com/cakeapp
>> as the base url which is not accessable
>> from the outside.
>>
>> How can one configure cake, to always use
>> a specific URL, here
>> http://www.company.com/cakeapp as the
>> web root?
>>
>> Any suggestions are highly appreciated.
>> Thank you.
>>
>> Johannes
>>
>
>
>
> --
> Johannes Goll
> 211 Curry Ford Lane
> Gaithersburg, Maryland 20878
>



-- 
Johannes Goll
211 Curry Ford Lane
Gaithersburg, Maryland 20878

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: Modify Base Url

2010-04-11 Thread Johannes Goll
I have redefined FULL_BASE_URL

 define('FULL_BASE_URL', 'www.company.com');

in the cake paths.php file

http://api11.cakephp.org/paths_8php-source.html

The urls are now all pointing to www.company.com/app, but still there
is a problem with logging in the application (uses the authsome
authentification component).

After some debugging, I think that something with the session handling
does not work properly . The site is being load balanced as well, so I
switched to database based session handling (sessions are being logged
in the session table).

Still, I am not able to login.

$this->Session->setFlash() is executed but no message is shown after
the redirect?

Any suggestions?

Johannes

2010/4/7 Johannes Goll :
> Hi All,
>
> we are building cake website that is externally accessible
> at http://www.company.com/cakeapp
> with mod rewrite enabled.
>
> Internally, that website gets translated to
> http://cakeapp.company.com/cakeapp
>
> Everything works when accessing the page from
> within the firewall but when accessing the page
> from the outside only the index page
> shows up - no links/controller actions work
> as all of them use the internal url
> http://cakeapp.company.com/cakeapp
> as the base url which is not accessable
> from the outside.
>
> How can one configure cake, to always use
> a specific URL, here
> http://www.company.com/cakeapp as the
> web root?
>
> Any suggestions are highly appreciated.
> Thank you.
>
> Johannes
>



-- 
Johannes Goll
211 Curry Ford Lane
Gaithersburg, Maryland 20878

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, reply using "remove me" as the subject.


Modify Base Url

2010-04-07 Thread Johannes Goll
Hi All,

we are building cake website that is externally accessible
at http://www.company.com/cakeapp
with mod rewrite enabled.

Internally, that website gets translated to
http://cakeapp.company.com/cakeapp

Everything works when accessing the page from
within the firewall but when accessing the page
from the outside only the index page
shows up - no links/controller actions work
as all of them use the internal url
http://cakeapp.company.com/cakeapp
as the base url which is not accessable
from the outside.

How can one configure cake, to always use
a specific URL, here
http://www.company.com/cakeapp as the
web root?

Any suggestions are highly appreciated.
Thank you.

Johannes

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, reply using "remove me" as the subject.


missing HABTM associated models

2010-03-25 Thread Johannes Goll
how do you fetch model information that is associated with
tables that have a  HBTM relationship?

I have

projects
users
project_users
libraries

projects and users are linked via a HBTM relationship
projects have many libraries (hasMany)

a search returns only the HBTM models and no Libraries (which are
associated with projects)
$projects = $this->Project->User->find('all',
array('conditions'=>array('User.id'=>$userId)));

How do you get the associated information as well?

Thanks,

Johannes

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.


cakephp 1.3 migration | $ajax->observeField

2010-03-18 Thread Johannes Goll
Hi,

I am migrating from 1.2 to cakephp 1.3 and am trying to
switch to the new JsHelper (engine JQuery)

anybody an idea how to easily replace the deprecated  $ajax->observeField
with the new $js-> functionality ? e.g. for the example in
http://book.cakephp.org/view/630/observeField

create( 'Post' ); ?>
 'Tom', 2 => 'Dick', 3 => 'Harry' ); ?>  
input( 'title', array( 'options' => $titles ) ) ?>


observeField( 'PostTitle',
array(
    'url' => array( 'action' => 'edit' ),
'frequency' => 0.2,
)
);
?>

Thanks

Johannes

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: cakephp 1.3 $this->Session->setFlash

2010-03-18 Thread Johannes Goll
I have changed the layout code to

  
flash(); 
   echo $content_for_layout;
?>  
  

and it worked perfectly. Thanks Jeremy .

Johannes

2010/3/18 Jeremy Burns :
> You need to do:
>
> echo $session->flash(); now.
>
> Jeremy Burns
> jeremybu...@me.com
>
> On 18 Mar 2010, at 13:06, Johannes Goll wrote:
>
>> Hi,
>>
>> I am migrating from 1.2 to cakephp 1.3 and am trying to
>> switch to the new $this->Session->setFlash functionality that
>> uses elements:
>>
>> Projects Controller:
>> function edit($id = null) {
>> ...
>> $this->Session->setFlash('The Project has been saved','message');
>> $this->redirect(array('action'=>'index'));
>> ...
>> }
>>
>> Layout:
>> 
>> >
>> $session->flash();
>>
>> echo $content_for_layout;
>> ?>
>> 
>>
>> Element;
>>
>> 
>>       >          echo $message;
>>       ?>
>> 
>>
>> No message is shown on the Projects index page after executing the
>> edit action of the controller.
>> But when I do a die($message) inside the element, the message is displayed.
>>
>> What am I doing wrong here?
>>
>> Thanks,
>> Johannes
>>
>> 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
>
> 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



-- 
Johannes Goll
211 Curry Ford Lane
Gaithersburg, Maryland 20878

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 1.3 $this->Session->setFlash

2010-03-18 Thread Johannes Goll
Hi,

I am migrating from 1.2 to cakephp 1.3 and am trying to
switch to the new $this->Session->setFlash functionality that
uses elements:

Projects Controller:
function edit($id = null) {
...
$this->Session->setFlash('The Project has been saved','message');
$this->redirect(array('action'=>'index'));
...
}

Layout:
  
 flash();

 echo $content_for_layout;
?>  
  

Element;

 
  


No message is shown on the Projects index page after executing the
edit action of the controller.
But when I do a die($message) inside the element, the message is displayed.

What am I doing wrong here?

Thanks,
Johannes

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: need a little help with model::saveAll function

2009-11-24 Thread Johannes
i had exactly the same problem and solved it by removing empty lines
in the beforeFilter() of the controller responsible for saving items.
In my case its very specific you could apppend your logic to make it
more universal.

p.s. im not sure about the following line in your example, because im
not sure if !null is defined in php
if (array_search(!null, $record)) $validRecords[] = $record;
maybe im wrong but i dont think this filters your data correctly.


--- in my app i use:
class InvoicesController extends AppController {
function beforeFilter() {
if (!empty($this->data)) {

// remove empty forms from data
if (isset($this->data['InvoicesItem'])) {
$data = array();
foreach ($this->data['InvoicesItem'] as $row) {
if (!empty($row['quantity']) || 
!empty($row['price'])) {
$data[] = $row;
}
}
if (empty($data)) {
unset($this->data['InvoicesItem']);
}
else {
$this->data['InvoicesItem'] = $data;
}
}
}

}
...
}

On Nov 24, 4:28 pm, Ernesto  wrote:
> A - i already have a routine that *should* to that... but it isn't
> working properly. here's the code
>
> function beforeValidate() {
>      $validRecords = array();
>      foreach ($this->data as $model => $records) {
>           foreach ($records as $key => $record) {
>                if (is_numeric($key)) {
>                     if (array_search(!null, $record)) $validRecords[]
> = $record;
>                } else break;
>                $this->data[$model] = $validRecords;
>           }
>      }
>      return true;
>
> }
>
> B - my saveAll is already overwritten in AppModel and atm it's working
> ok. i was just asking if it's possible to do that in a Behavior :)
>
> On 23 Nov, 20:52, Marcelo Andrade  wrote:
>
> > On Mon, Nov 23, 2009 at 12:29 PM, Ernesto  wrote:
> > > (..)
> > > A - user can insert just 2 or 3 rows, it's not necesasry to fill all
> > > the 10 "Item" rows. saveAll tries to save even empty insertions. Blank
> > > rows = validation errors. is there any way to avoid this?
>
> > You'll have to loop $this->data and unset the entries when
> > you get blank fields.
>
> > > B - is it pobbile to create a behavior that forces "validate" =>
> > > "first" to every saveAll call?
>
> > You can override the saveAll method in your AppModel,
> > changing the validate entry in the options to 'first' always.
>
> > Best regards.
>
> > --
> > MARCELO DE F. ANDRADE
> > Belem, PA, Amazonia, Brazil
> > Linux User #221105

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


id is getting lost inside ClassRegistry::init. BUG?!

2009-09-02 Thread Johannes Nohl

Am I wrong or is id dropped inside init funtion in /cake/libs/
class_registry.php ?!

I'm trying to load a model on the fly. I can pass a id to the function
like:

ClassRegistry::init( array('class' => 'User', 'id' => $id), 'Model' );

But inside the function init the id is never handled. Since this the
id is always the lowest available (mostly 1).


This is especially questionable because the example in the manual
(http://book.cakephp.org/view/845/loadModel) doesn't work:

$this->loadModel('User', 2);
$user = $this->User->read();

loadModel is using ClassRegistry::init -> Id will be lost.

Am I wrong? please correct me.

Johannes

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