language problem in database cake1.3

2012-12-10 Thread Chris
hi guys,...
I'm having a problem with language in database... I'm in cake 1.3 
I have in app_controller: 
  App::import('Core', 'L10n'); 
  App::import('Core', 'I18n'); 

I upload video from Youtube and have video "name" and "description" saved 
in database in Russina language,... but it gives me crap: 
›Ð°Ñ ковый май- Розовый вечер 
in a view and in db... 

link(__($video['Video']['name'], true), '/videos/show/' . 
$video['Video']['id']) ?>

 how can I fix this,...  

thanks in advance 
chris

-- 
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: Validating multiple models in one form

2012-12-10 Thread jodator
Why do you have $name = 'UserInfos' while your class is UserInfo (and also 
'Users')? Try to make it by Cake conventions and it should validate all 
associeated models on saveAll().

I would drop those lines, as they are not needed. And try changing UsrInfos 
to UserInfo in form generation.

Also:

 $this->User->create();
*// not needed:*   $this->loadModel('UserInfo');

UserInfo is available in $this->User->UserInfo (whith your current belongs 
to in $this->User->UserInfo).

And:


  'UsersInfos' => array( // why not just UserInfo ?
   'className' => 'users_infos', //Class name should be: UserInfo

Also read about associations in CakePHP, your foreign keys should be 
user_id (not users_id). It's easier to go by Cake's conventions.



On Tuesday, December 11, 2012 1:08:38 AM UTC+1, Robert Hunt wrote:
>
> Hi All,
>
> I hope someone can help clear this up for me.
>
> Basically I have two models producing fields in a form but when saving it 
> only validates the parent model.
>
> I have attempted to use saveAssociated and I have tried validating the 
> data on a per model basis with no success.
>
> Here is my code:
>
> *User Model*
>
>> class User extends AppModel {
>>  public $name = 'Users';
>>  var $hasOne = array(
>>   'UsersInfos' => array(
>>'className' => 'users_infos',
>>'foreignKey' => 'users_id'
>>   )
>>  );
>>  var $hasMany = array(
>>   'UsersIps' => array(
>>'className' => 'users_ips',
>>'foreignKey' => 'users_id'
>>   ),
>>   'UsersStats' => array(
>>'className' => 'users_stats',
>>'foreignKey' => 'users_id'
>>   ),
>>   'UsersSkills' => array(
>>'className' => 'users_skills',
>>'foreignKey' => 'users_id'
>>   ),
>>   'UsersBuildings' => array(
>>'className' => 'users_buildings',
>>'foreignKey' => 'users_id'
>>   ),
>>   'UsersItems' => array(
>>'className' => 'users_items',
>>'foreignKey' => 'users_id'
>>   ),
>>   'UsersMinerals' => array(
>>'className' => 'users_minerals',
>>'foreignKey' => 'users_id'
>>   )
>>  );
>>  
>>  public $validate = array(
>>   'username' => array(
>>'required' => array(
>> 'rule' => array('notEmpty'),
>> 'message' => 'Please enter a Username'
>>),
>>'isUnique' => array(
>> 'rule' => array('isUnique'),
>> 'on' => array('create'),
>> 'message' => 'This Username is already taken, please choose another'
>>)
>>   ),
>>   'password' => array(
>>'required' => array(
>> 'rule' => array('notEmpty'),
>> 'message' => 'Please enter a Password'
>>),
>>'minLength' => array(
>> 'rule' => array('minLength', '6'),
>> 'message' => 'Your Password must be a minimum of 6 characters long'
>>)
>>   )
>>  );
>
>
> *UserInfo Model *
>
>> class UserInfo extends AppModel {
>>  public $name = 'UsersInfos';
>>  public $useTable = 'users_infos';
>>  
>>  public $belongsTo = array(
>>   'Users' => array(
>>'className' => 'Users',
>>'foreignKey' => 'users_id'
>>   )
>>  );
>>  
>>  public $validate = array(
>>   'first_name' => array(
>>'required' => array(
>> 'rule' => array('notEmpty'),
>> 'message' => 'Please enter your First Name'
>>)
>>   ),
>>   'last_name' => array(
>>'required' => array(
>> 'rule' => array('notEmpty'),
>> 'message' => 'Please enter your Last Name'
>>)
>>   ),
>>   'email' => array(
>>'required' => array(
>> 'rule' => array('notEmpty'),
>> 'message' => 'Please enter your Email'
>>),
>>'email' => array(
>> 'rule' => array('email'),
>> 'message' => 'Please enter a valid Email'
>>),
>>'isUnique' => array(
>> 'rule' => array('isUnique'),
>> 'on' => array('create'),
>> 'message' => 'This Email is already taken, duplicate accounts are not 
>> allowed'
>>)
>>   ),
>>   'age' => array(
>>'required' => array(
>> 'rule' => array('notEmpty'),
>> 'message' => 'Please select your Age'
>>)
>>   ),
>>   'sex' => array(
>>'required' => array(
>> 'rule' => array('notEmpty'),
>> 'message' => 'Please select your Sex'
>>)
>>   ),
>>   'location' => array(
>>'required' => array(
>> 'rule' => array('notEmpty'),
>> 'message' => 'Please enter your General Location'
>>)
>>   ),
>>   'race_id' => array(
>>'required' => array(
>> 'rule' => array('notEmpty'),
>> 'message' => 'Please select your Race'
>>)
>>   )
>>  );
>
>
> *Create Account Form*
>
>>  echo $this->Session->flash();
>>echo $this->Form->create('User');
>>echo $this->Form->input('User.username', array(
>>  'label' => 'User:'
>> )
>>);
>>echo $this->Form->input('User.password', array(
>>  'label' => 'Pass:' 
>> )
>>);
>>echo $this->Form->input('UsersInfos.first_name', array(
>>  'label' => 'First Name:'
>> )
>>);
>>echo $this->Form->input('UsersInfos.last_name', array(
>>  'label' => 'Last Name:'
>> )
>>);
>>echo $this->Form->input('UsersInfos.email', array(
>>  'label' => 'Email:'
>> )
>>); 
>>e

Re: cakephp admin app

2012-12-10 Thread Jeremy Burns | Class Outfit
Prefix routing? 
http://book.cakephp.org/2.0/en/development/routing.html#prefix-routing

Jeremy Burns
Class Outfit

http://www.classoutfit.com

On 11 Dec 2012, at 00:05:47, Devario Johnson  wrote:

> So I searched a bit, and honestly I have kind of a headache right now, and 
> can't seem to find exactly what Im looking for.  So Im hoping someone can 
> point me in the right direction via an article or something.
> 
> I would like to have an admin section as a new cake app in the structure as 
> follows
> 
> (my regular site)
> is 
> htdocs/
> --- app/
> everything else
> 
> What modifications would I have to make to allow for this to live 
> harmoniously with that 
> 
> htdocs/
> ---admin/
> app/
> ---everything else
> 
> along with (or on the side of) what is above.
> 
> Basically a new cake install only for the app side?
> 
> One way I was looking at was having both apps inside of htdocs/app1/app 
> htdocs/admin/app, but since I already have this setup I wanted to know if I 
> can do it the way i want without changing the structure.  Thanks
> 
> -- 
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>  
> --- 
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com.
> To unsubscribe from this group, send email to 
> cake-php+unsubscr...@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>  
>  

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

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




Re: Cake PHP v 2.2.4 - Newbie, blog tutorial does not work?

2012-12-10 Thread Marcelo F Andrade
Em 11/12/2012 00:42, "Paul Marriott" 
escreveu:
>
> I have installed and run through the Blog tutorial and am getting the
error
>
> http://localhost/cakephp-cakephp-b2812f2/posts/index
>
> "Error: PostsController could not be found"
>
> The file definitely exists, I have tried the tutorial twice now so must
have something wrong.

Are you sure about the CakePHP version?  Double check the name of your
posts_controller or PostsController file.

If you're in doubt, try to generate this file with cake bake.

Cheers.

MARCELO DE FREITAS ANDRADE
"Minha alma é maior do que eu."

-- 
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: Cake PHP v 2.2.4 - Newbie, blog tutorial does not work?

2012-12-10 Thread Tim Denholm
Hi Paul, could you please include the contents of your PostsController.php
file.

Cheers


On Tue, Dec 11, 2012 at 1:44 PM, Nathaniel Sumaya  wrote:

> If you are using IIS refer here .
> Otherwise cookbook  is
> sufficient for your needs.
>
> On Tue, Dec 11, 2012 at 1:29 AM, Paul Marriott <
> paulmarrio...@googlemail.com> wrote:
>
>> I have installed and run through the Blog tutorial and am getting the
>> error
>>
>> http://localhost/cakephp-cakephp-b2812f2/posts/index
>>
>> "Error: PostsController could not be found"
>>
>> The file definitely exists, I have tried the tutorial twice now so must
>> have something wrong. However I cannot find a download of the files from a
>> working installation. Can anyone help me out here?
>>
>> So have a followed the instructions incorrectly or does the example not
>> work?
>>
>> I want to use CakePHP but if I cannot get a simple example working I have
>> little confidence that more complex projects will work reliably.
>>
>> Cheers
>>
>> Paul
>>
>> --
>> 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.
>>
>>
>>
>
>
>
> --
> Thanks and Best Regards,
> Nathaniel N. Sumaya
>
>  --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com.
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>
>
>

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

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




Re: Cake PHP v 2.2.4 - Newbie, blog tutorial does not work?

2012-12-10 Thread Nathaniel Sumaya
If you are using IIS refer here . Otherwise
cookbook  is sufficient for your
needs.

On Tue, Dec 11, 2012 at 1:29 AM, Paul Marriott  wrote:

> I have installed and run through the Blog tutorial and am getting the error
>
> http://localhost/cakephp-cakephp-b2812f2/posts/index
>
> "Error: PostsController could not be found"
>
> The file definitely exists, I have tried the tutorial twice now so must
> have something wrong. However I cannot find a download of the files from a
> working installation. Can anyone help me out here?
>
> So have a followed the instructions incorrectly or does the example not
> work?
>
> I want to use CakePHP but if I cannot get a simple example working I have
> little confidence that more complex projects will work reliably.
>
> Cheers
>
> Paul
>
> --
> 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.
>
>
>



-- 
Thanks and Best Regards,
Nathaniel N. Sumaya

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




Validating multiple models in one form

2012-12-10 Thread Robert Hunt
Hi All,

I hope someone can help clear this up for me.

Basically I have two models producing fields in a form but when saving it 
only validates the parent model.

I have attempted to use saveAssociated and I have tried validating the data 
on a per model basis with no success.

Here is my code:

*User Model*

> class User extends AppModel {
>  public $name = 'Users';
>  var $hasOne = array(
>   'UsersInfos' => array(
>'className' => 'users_infos',
>'foreignKey' => 'users_id'
>   )
>  );
>  var $hasMany = array(
>   'UsersIps' => array(
>'className' => 'users_ips',
>'foreignKey' => 'users_id'
>   ),
>   'UsersStats' => array(
>'className' => 'users_stats',
>'foreignKey' => 'users_id'
>   ),
>   'UsersSkills' => array(
>'className' => 'users_skills',
>'foreignKey' => 'users_id'
>   ),
>   'UsersBuildings' => array(
>'className' => 'users_buildings',
>'foreignKey' => 'users_id'
>   ),
>   'UsersItems' => array(
>'className' => 'users_items',
>'foreignKey' => 'users_id'
>   ),
>   'UsersMinerals' => array(
>'className' => 'users_minerals',
>'foreignKey' => 'users_id'
>   )
>  );
>  
>  public $validate = array(
>   'username' => array(
>'required' => array(
> 'rule' => array('notEmpty'),
> 'message' => 'Please enter a Username'
>),
>'isUnique' => array(
> 'rule' => array('isUnique'),
> 'on' => array('create'),
> 'message' => 'This Username is already taken, please choose another'
>)
>   ),
>   'password' => array(
>'required' => array(
> 'rule' => array('notEmpty'),
> 'message' => 'Please enter a Password'
>),
>'minLength' => array(
> 'rule' => array('minLength', '6'),
> 'message' => 'Your Password must be a minimum of 6 characters long'
>)
>   )
>  );


*UserInfo Model *

> class UserInfo extends AppModel {
>  public $name = 'UsersInfos';
>  public $useTable = 'users_infos';
>  
>  public $belongsTo = array(
>   'Users' => array(
>'className' => 'Users',
>'foreignKey' => 'users_id'
>   )
>  );
>  
>  public $validate = array(
>   'first_name' => array(
>'required' => array(
> 'rule' => array('notEmpty'),
> 'message' => 'Please enter your First Name'
>)
>   ),
>   'last_name' => array(
>'required' => array(
> 'rule' => array('notEmpty'),
> 'message' => 'Please enter your Last Name'
>)
>   ),
>   'email' => array(
>'required' => array(
> 'rule' => array('notEmpty'),
> 'message' => 'Please enter your Email'
>),
>'email' => array(
> 'rule' => array('email'),
> 'message' => 'Please enter a valid Email'
>),
>'isUnique' => array(
> 'rule' => array('isUnique'),
> 'on' => array('create'),
> 'message' => 'This Email is already taken, duplicate accounts are not 
> allowed'
>)
>   ),
>   'age' => array(
>'required' => array(
> 'rule' => array('notEmpty'),
> 'message' => 'Please select your Age'
>)
>   ),
>   'sex' => array(
>'required' => array(
> 'rule' => array('notEmpty'),
> 'message' => 'Please select your Sex'
>)
>   ),
>   'location' => array(
>'required' => array(
> 'rule' => array('notEmpty'),
> 'message' => 'Please enter your General Location'
>)
>   ),
>   'race_id' => array(
>'required' => array(
> 'rule' => array('notEmpty'),
> 'message' => 'Please select your Race'
>)
>   )
>  );


*Create Account Form*

>  echo $this->Session->flash();
>echo $this->Form->create('User');
>echo $this->Form->input('User.username', array(
>  'label' => 'User:'
> )
>);
>echo $this->Form->input('User.password', array(
>  'label' => 'Pass:' 
> )
>);
>echo $this->Form->input('UsersInfos.first_name', array(
>  'label' => 'First Name:'
> )
>);
>echo $this->Form->input('UsersInfos.last_name', array(
>  'label' => 'Last Name:'
> )
>);
>echo $this->Form->input('UsersInfos.email', array(
>  'label' => 'Email:'
> )
>); 
>echo $this->Form->input('UsersInfos.age', array(
>  'type' => 'select',
>  'options' => array_combine(range(14,100), range(14,100)),
>  'label' => 'Select Your Age:',
>  'empty' => 'Your Age'
> )
>);
>echo $this->Form->input('UsersInfos.sex', array(
>  'type' => 'select',
>  'options' => array(
>   'm' => 'Male',
>   's' => 'Female'
>  ),
>  'label' => 'Select Your Sex:',
>  'empty' => 'Your Sex'
> )
>);
>echo $this->Form->input('UsersInfos.location', array(
>  'label' => 'Location:'
> )
>);
>// TODO : generate $raceIDs variable using race table
>$raceIDs = array(0 => 'Terran', 1 => 'Nexus');
>echo $this->Form->input('UsersInfos.race_id', array(
>  'type' => 'select',
>  'options' => $raceIDs,
>  'label' => 'Choose Your In-Game Race:',
>  'empty' => 'Choose Your Race'
> )
>);
>echo $this->Form->submit('Go!', array(
>  'class' => 'btn'
> )
>); 
>echo $this->Form->end();


*Create Account Action*

>  p

Cake PHP v 2.2.4 - Newbie, blog tutorial does not work?

2012-12-10 Thread Paul Marriott
I have installed and run through the Blog tutorial and am getting the error

http://localhost/cakephp-cakephp-b2812f2/posts/index

"Error: PostsController could not be found" 

The file definitely exists, I have tried the tutorial twice now so must 
have something wrong. However I cannot find a download of the files from a 
working installation. Can anyone help me out here?

So have a followed the instructions incorrectly or does the example not 
work?

I want to use CakePHP but if I cannot get a simple example working I have 
little confidence that more complex projects will work reliably.

Cheers

Paul

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




executing tests from Netbeans IDE

2012-12-10 Thread Greg Skerman
Hi,

Not strictly a cakephp issue, more of a netbeans one. I want to execute my
application tests from within the IDE. Netbeans seems to dislike this (the
unit test runner has to be an absolute path without args, so pointing it at
cake.bat with the test shell in params doesn't work)

it then goes on to fail if the PHPUnit.bat runner is used because obviously
the cakephp dependencies are not available.

Anyone out there using Netbeans and running unit tests from the IDE care to
share how they got it working?

working with
Netbeans 7.2
Cakephp 2.3 beta
Windows 7

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

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




cakephp admin app

2012-12-10 Thread Devario Johnson
So I searched a bit, and honestly I have kind of a headache right now, and 
can't seem to find exactly what Im looking for.  So Im hoping someone can 
point me in the right direction via an article or something.

I would like to have an admin section as a new cake app in the structure as 
follows

(my regular site)
is 
htdocs/
--- app/
everything else

What modifications would I have to make to allow for this to live 
harmoniously with that 

htdocs/
---admin/
app/
---everything else

along with (or on the side of) what is above.

Basically a new cake install only for the app side?

One way I was looking at was having both apps inside of htdocs/app1/app 
htdocs/admin/app, but since I already have this setup I wanted to know if I 
can do it the way i want without changing the structure.  Thanks

-- 
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: Un-related models / functions

2012-12-10 Thread Advantage+
Ok I copied exactly as described in the book.

 

My default layout has : element('footer_feature_product',
array('cache' => '+1 hour'));?>

 

The element is:

requestAction(array('controller' => 'products'
,'action' => 'feature'));?>

Html->image('footer_block_1.jpg', array('alt' => 'Featured
Product'));?>



Featured Product

Text->truncate($product['Product']['description'],$length=100,array
()));?> read more



 

Controller:

public function feature() {

if (empty($this->request->params['requested'])) {

throw new ForbiddenException();

}

return $this->Product->find('first', array(

'Product.featured' => 1, 

'contain' => false));

}

 

Now on the index page no issues. Click login (hover over the link =>
users/login) but when I click login I get directed to products/feature with
error message

 

Forbidden

Error: The requested address '/products/feature?url=products%2Ffeature' was
not found on this server. And whats with the crazy url?

 

 

From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf
Of Piotr Beschel
Sent: Monday, December 10, 2012 5:31 AM
To: cake-php@googlegroups.com
Subject: Re: Un-related models / functions

 

read about Controller::requestAction(string $url, array $options)
http://book.cakephp.org/2.0/en/controllers.html

W dniu poniedziałek, 10 grudnia 2012 03:35:05 UTC+1 użytkownik advantage+
napisał:

I have a footer which has a featured product and recent news. 

What is the best way to call these actions getFeatured(), and getNews() when
there is no related model to use as they are permanent "blocks" in the
footer in default.ctp layout?

 

Thanks,

Dave

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
--- 
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 

-- 
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: Problem with saveAll translations within one form - CakePHP multilingual website

2012-12-10 Thread maurozadu
I have the same problem, did you came up with a solution?

Thank you!

El lunes, 23 de enero de 2012 16:05:43 UTC-3, Anna P escribió:
>
> Hello. 
>
> I'm making multilingual website and I want administrator to add and 
> edit subpage in all available languages within one form. 
>
> The add function works fine, the problem is when I want to edit 
> subpage and all translations at one time - one of the fields does not 
> want to update in i18n table. 
>
> Model: 
> http://pastebin.com/Mas1aciu 
>
> add function (works fine, adds record to "subpages" table and records 
> to "i18n" table containing title, link and content in every language): 
> http://pastebin.com/N61WLwNQ 
>
> add view: 
> http://pastebin.com/Y6a1WquA 
>
> edit function: 
> http://pastebin.com/1ZdumqUe 
>
> edit view: 
> http://pastebin.com/BWcXvGKY 
>
> Editing title and content and saving form changes only the 
> translations of fields "link" and "content" in i18n table. The title 
> just won't change at all in translations table, after editing a form. 
>
> I've just build another model - Category. Same issue here, although I 
> translate only two fields (name and link, based on the name). The same 
> situation with editing - only "link" translation is being updated, and 
> "name" isn't. 
>
> Anyone has a clue? Or maybe there is some better solution to create 
> and update dynamic translations with the use of one form? 
>
> Regards, 
> Anna

-- 
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: Please help, How to find nested posts...

2012-12-10 Thread Salines
I solved the problem of finding articles in a deep tree subordinate levels!

In itself habtm tables store id of all parental level.

-- 
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: Using database session in the filemanager

2012-12-10 Thread mebibyte
I didn't try installing the filemanager as a Vendor. I will read about that 
in the cookbook.

I know that u have to use php for accessing my database but I do need the 
session id for searching in the cake_sessions table.
The $_SESSION remains empty.
I found this article about the problem 
http://bakery.cakephp.org/articles/brightball/2009/02/18/using-cake-sessions-outside-of-cake
 but 
I do not quite understand it.


Op zondag 9 december 2012 22:47:05 UTC+1 schreef cricket het volgende:
>
> Just a thought: Have you tried installing this filemanager in Vendor 
> and then creating a Component that Cake can use to interact with it? 
>
> On Sun, Dec 9, 2012 at 3:35 PM, mebibyte > 
> wrote: 
> > Thanx for your respons 
> > 
> > Your suggestion is working when I use this configuration 
> > Configure::write('Session', array( 
> > 'defaults' => 'php' 
> > )); 
> > but not when I use 
> > Configure::write('Session', array( 
> > 'defaults' => 'database' 
> > )); 
> > 
> > The filemananger is not working through the cakephp framework. So I 
> can't 
> > use the  $this->Session->read('FileManager.access'); 
> > I'm doing this: 
> > session_name('CAKEPHP'); 
> > session_start(); 
> > if($_SESSION['filemanager'] != 'true') {die();} 
> > 
> > However, in this method the $_SESSION remains empty. 
> > 
> > 
> > Op zaterdag 8 december 2012 13:16:17 UTC+1 schreef mebibyte het 
> volgende: 
> >> 
> >> Hey 
> >> 
> >> I'm using the simogeo filemanager and I want to check if the user is 
> >> authorized to acces the filemanager. 
> >> When I use the php session, I can acces the session data. But I want to 
> >> use the database session in cakephp and with that I can't acces the 
> session 
> >> id for searching in my database table. 
> >> 
> >> So, how can I get the id which is saved in the database session? 
> >> 
> >> Thanx 
> >> 
> >> 
> >> 
> >> 
> > -- 
> > Like Us on FaceBook https://www.facebook.com/CakePHP 
> > Find us on Twitter http://twitter.com/CakePHP 
> > 
> > --- 
> > You received this message because you are subscribed to the Google 
> Groups 
> > "CakePHP" group. 
> > To post to this group, send email to cake...@googlegroups.com. 
>
> > To unsubscribe from this group, send email to 
> > cake-php+u...@googlegroups.com . 
> > Visit this group at http://groups.google.com/group/cake-php?hl=en. 
> > 
> > 
>

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

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




concerns regarding arrays in urls

2012-12-10 Thread euromark
By accident and looking at the error logs I found something that concerns 
me.
Currently sth like this is used by probably most of us:

if (!empty($this->request->params['named']['sort'])) {
$sort = strtolower($this->request->params['named']['sort']); // we 
expect a string in 99% of all cases
// do sth with it
}

But if you generate urls like `.../sort:created/sort:foo/sort:bar/...` you 
can easily break the logic here.
So, if someone wants to hurt you he could just try to do that will all your 
pages where you except named (or query) strings and
on such a big scale that your error logs fill up in the MB range in the 
hope to fill the hard disk. should we have any concerns here?

Shouldn't we whitelist the named/query params that can/will be arrays? like 
$this->request->exceptAsArray('sort') etc?
Or always use this (I found at least 400 places in my code where this array 
trick would result in lots of broken code by the way):

if (!empty($this->request->params['named']['sort'])) {
if (is_array($this->request->params['named']['sort'])) {
$this->request->params['named']['sort'] = 
array_shift($this->request->params['named']['sort']);
}
$sort = strtolower($this->request->params['named']['sort']);
//do sth with it
}

Adding some whitelisting would be cleaner here IMO.

-- 
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: Please help, How to find nested posts...

2012-12-10 Thread Salines
Thanks for the reply,

this approach is ok, if you want to show child categories or articles.

I am in a situation where I have a *n-level taxonomy*. Clicking on any 
category will have to find all child articles, skipping child categories. 

-- 
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: Trouble with model associations and query.

2012-12-10 Thread MDay
I seem to have resolved this, but I don't think it's the most efficient 
query:

public function getStudents(){

$userId = $this->Auth->user('id');

 $endusers = $this->RoleUser->findAllByuser_id($userId, 
array('RoleUser.enduserid','RoleUser.user_id')); //Get the enduserid's for 
all the roles I have been assigned

foreach ($endusers as $enduser){ 

 $theusers[] = $this->User->findById($enduser['RoleUser']['enduserid']); 
//store each user to an array.

}

debug($theusers);

 Any ideas how I can get the same result by just querying the Users table 
and associated roles/userroles ? }

On Sunday, December 9, 2012 2:30:38 PM UTC-5, MDay wrote:
>
> I am having trouble returning a query.  I have the following setup
>
> Users - users class of all users in the system.
> Roles - roles class with a set of available roles.  E.g. teacher, student, 
> tutor
> RoleUsers - a mapping table between users and roles as a single user can 
> have multiple roles.
>
>
> My Users class has this
>
> public $hasAndBelongsToMany = array(
>
> 'Role' =>
>
> array(
>
> 'className'  => 'Role',
>
> 'joinTable'  => 'role_users',  //was 
> roles_users
>
> 'foreignKey' => 'user_id',
>
> 'associationForeignKey'  => 'role_id',
>
> 'unique' => true)
>
> );
>
>
> My RolesUser class has this
>
> public $belongsTo = array(
>
> 'User' =>
>
> array(
>
> 'className'  => 'User',
>
> 'joinTable'  => 'users',  
>
> 'foreignKey' => 'user_id',
>
> 'unique' => true),
>
>  'Role' =>
>
> array(
>
> 'className'  => 'Role',
>
> 'joinTable'  => 'roles',  
>
> 'foreignKey' => 'role_id',
>
> 'unique' => true)
>
>
> I am now trying to query the user table to determine the students 
> belonging to the logged in user (a teacher or tutor)
>
>
> public function getStudents(){
>
> $userId = $this->Auth->user('id'); 
>
> $conditions = array('conditions' => array (array('Role.id =' => 75),  //75 
> is the role for all students
>
> array ('RoleUser.id = ' => $userId)));  //this is the current logged in 
> user
>
> $result = $this->User->find('all',$conditions);
>
> debug($result);
>
>
> In the top of my UsersController, I have:
>
> public $uses = array('Role', 'RoleUser');
>
>
> When I run the function getStudents above, I am getting *Error: *Call to 
> a member function find() on a non-object
>
>
> );
>
>

-- 
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: Conditional Model Query

2012-12-10 Thread MDay
Thanks for the response.   You are correct - the enduserid field is in the 
RoleUser join table.

On Sunday, December 9, 2012 5:54:26 PM UTC-5, cricket wrote:
>
> You shouldn't need to use loadModel() if the associations are set up 
> correctly. 
>
> When you call $this->Auth->user() with no params you get an array with 
> all data. I don't recall how deeply that goes. Try this in your 
> login() action, or some other action that requires authentication: 
>
> die(debug($this->Auth->user())); 
>
> If Auth doesn't make the Role data available you could fetch it for 
> that User and then check the result. But it's not clear where this 
> enduserid column resides. It's in the join table? 
>
> On Sun, Dec 9, 2012 at 12:10 PM, Md > 
> wrote: 
> > Hi there, 
> > 
> > I have a small application that has three tables.  users, roles, and 
> > role_users.  The role_users table is a join table as a user can have 
> > multiple roles.   In my UsersController class I am trying to get a count 
> for 
> > the number of roles the current user has where there is a enduserid = 1. 
> > 
> > public function hasEndUser(){ 
> > 
> > $this->loadModel('RoleUser'); 
> > 
> > $userId = $this->Auth->user('id'); 
> > 
> > $conditions = array('RoleUser.user_id ='=>$userId,'RoleUser.enduserid 
> > ='=>1); 
> > 
> > $result = $this->RoleUser->find('count',$conditions); 
> > 
> > debug($result); 
> > 
> > } 
> > 
> > For whatever reason, this is the SQL that I am getting back: 
> > 
> > SELECT COUNT(*) AS `count` FROM `bridges`.`role_users` AS `RoleUser` 
> LEFT 
> > JOIN `bridges`.`users` AS `User` ON (`RoleUser`.`user_id` = `User`.`id`) 
> > LEFT JOIN `bridges`.`roles` AS `Role` ON (`RoleUser`.`role_id` = 
> > `Role`.`id`) WHERE 1 = 1 
> > 
> > 
> > As a result, I am also getting the wrong count. 
> > 
> > -- 
> > Like Us on FaceBook https://www.facebook.com/CakePHP 
> > Find us on Twitter http://twitter.com/CakePHP 
> > 
> > --- 
> > You received this message because you are subscribed to the Google 
> Groups 
> > "CakePHP" group. 
> > To post to this group, send email to cake...@googlegroups.com. 
>
> > To unsubscribe from this group, send email to 
> > cake-php+u...@googlegroups.com . 
> > Visit this group at http://groups.google.com/group/cake-php?hl=en. 
> > 
> > 
>

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

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




Re: Un-related models / functions

2012-12-10 Thread Piotr Beschel
read about Controller::requestAction(*string $url*, *array $options*) 
http://book.cakephp.org/2.0/en/controllers.html

W dniu poniedziałek, 10 grudnia 2012 03:35:05 UTC+1 użytkownik advantage+ 
napisał:
>
> I have a footer which has a featured product and recent news. 
>
> What is the best way to call these actions getFeatured(), and getNews() 
> when there is no related model to use as they are permanent "blocks" in the 
> footer in default.ctp layout?
>
>  
>
> Thanks,
>
> Dave
>

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

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




CakePhp 2.x Newbie

2012-12-10 Thread Maximum
Hello everyone!!!

I am a Php Junior developer. been recently employed tomaintained CakePhp 
Applications developed using 1.3.X version. I do the job very well. My 
problem is that now I am trying to learn to build cake applications from 
scratch using Cakephp 2.X.

the actual problem is when having done setting up mu enviroment, Cake gives 
me a "Missing controller" error. Say if I have named my app 
InventotySystem, cake will say "InventorySystemController missing please 
verify if created blah blah blah blah". I am not sure whether this is an 
expected behavior. if not, what should I do to proceed from this?

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