Re: How many Plug-ins Is Too many

2013-05-22 Thread jodator
As always it depends;).

Look at it from maintainance point of view and separation of code / 
reusability (so hint for packaging functionalities in plugins).

If its separate I would put in plugin (obviously ContentManager, 
GalerryManager,etc.) some common/base functionalities can be packaged as 
one plugin (lets say: sluggable, cacheable, utils behaviors, ets in one, 
compresors in second).

If speed is your concern: use APC and caching, integrate loose assets to 
one (CSS, JS), etc.

Comparing Plugin site to One bag - I think that there will be some overhead 
for loading plugins, so One bag has a small +, but anyway all your 
functionalities will be divided in separate classes/files so still overhead 
for loading associated files for helpers,models etc will be comparable.

Its from my point of view and I don't remember now how it is internally 
handled by Cake and how big is plugin overhead.


On Wednesday, May 22, 2013 8:57:50 AM UTC+2, advantage+ wrote:

 I guess the question already will depend on the size / scale of the site. 

 But with everything moving towards packaging components / helper and such 
 as plugins is there a better way or does it really matter?

  

 Bootstrap / facebook / twitter / js compressor / css compressor / 
 UserManger / ContentManger / SeoManager / ContactManager / GalleryManager / 
 BritaPurifirer / LESS / Sluggable / Cacheable

  

 Just seems like a lot to load. Then on demand ones like Upload / Cropper / 
 Publisher………I can go on all night.

  

 Is there a best practice? Most of these run universally and required 
 everywhere so it's not so much a pick and choose when to load them.

  

 But if you created a site with no plugins for example and have say the 
 mentioned above ones as straight controllers / models in the respective 
 directories would it be the same thing?(would not do that obviously)

 Is there an overhead to deal with or does Cake treat it as if was a 
 regular model / controller as if it was sitting in the model / controller 
 folders? 


-- 
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: Paginate with drag / drop

2013-03-12 Thread jodator
You can:
a) create virtual 'basket' to drop items while paginating (items in basket 
are stored between paging),
b) add menu on right-click, button, move to position: user enters position

After moving item to new position (either from basket (a) or by command) 
you should refresh current page so user can see new paginated results.

If you insist on dragdrop you could add 'display all on one page' 
link/page to let user freely reorder list without pagination (well if the 
list is reasonably long)

On Monday, March 11, 2013 11:54:42 PM UTC+1, advantage+ wrote:

 I have a site where the paginated results need to have the ability to sort 
 / re-order as the admin likes. Problem is how do you get something from 
 page 2 back to page 1 since you can't drag / drop it in a list that you 
 cannot see.

  

 I was hoping there was a way to offset the pagination so for example 
 (offset by 1) so last record and first record get repeated so the option of 
 moving to another page is an option.

 page 1 shows 1 - 11

 page 2 shows 11 - 21

 page 3 shows 21 - 31

  

 So in theory you could take record 21 drag to 11 spot go to page 1 and 
 still see it so you overlap the records by 1 or whatever number.

  

 Or any other ideas?

  

 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 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: What happeened to the API Documentation on CakePHP.org?

2013-02-28 Thread jodator
That was a quick fix. Nice job :)

On Thursday, February 28, 2013 5:46:01 PM UTC+1, José Lorenzo wrote:

 Issues have been fixed now, you can revisit the site and have an overview 
 of all the classes. :)

 On Thursday, February 28, 2013 2:56:38 PM UTC+1, Renan Gonçalves wrote:

 There are some issues that are preventing us to have the full API 
 featured on the website.

 Check those: https://github.com/cakephp/cakephp-api-docs/issues

 On Thursday, February 28, 2013 10:55:54 AM UTC+1, senser wrote:

 I cannot agree. The new view of API is terrible for me. 
 I liked to browse classes without typing their names and really loved 
 all classes visible on single page.
 Another annoying change is the order of class methods - it's not 
 alphabetical anymore, but why ?!? How to find a particular method in class 
 - I have to scroll and read (eventually) all class methods to find what I'm 
 looking for.
 And finally - I've never been interested of cake packages, I've always 
 looked for classes. Now while reading HtmlHelperClass (for example) on 
 the left panel I can select other similar helpers, but what if I want to 
 read CakeResponse class. I have to use search box on the top, or must know 
 the package that CakeResponse belongs to, and explore the package.

 27 февруари 2013, сряда, 08:55:04 UTC+2, jodator написа:

 Hi there,

 they've changed the API yesterday, and i found it quite good.

 Here is 1.3 debugger: http://api.cakephp.org/1.3/class-Debugger.html

 I've found it by using the search box (it has a very nice autocomplete).

 Just remember to choose CakePHP version.


 On Tuesday, February 26, 2013 7:52:10 PM UTC+1, kdubya wrote:

 Exactly. When I used to go there I could choose to see the ALL the 
 classes and choose from an alphabetical list. Now it shows a structure 
 off 
 to the left but when I try to find something like Debugger it is nowhere 
 I 
 can find.

 When I go to the 2.0 version of the API (http://api.cakephp.org/2.0) 
 to the left there is a structure that makes some sense. Debugger is found 
 under Utilities. Not so under 1.3.

 Is there still some work going on here that the structure is not 
 complete?

 Ken

 On Tuesday, February 26, 2013 1:26:43 PM UTC-5, kdubya wrote:

 I can't find the classes anymore. I was specifically looking for the 
 Debugger class in 1.3. The structure that used to be there until 
 recently 
 is gone. What happened? Did I miss something?

 Ken



-- 
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: Viewing 2 or more elements in the same view in Cakephp

2013-02-27 Thread jodator
The elements are children to current view or a building blocks of your view.

There's no problem with displaying multiple element in one view.

Try it with simple elements:
# elem.ctp:
divelem test/div

#elem2.ctp:
divelem 2/div

# view.ctp:
h1My elments/h1
?php echo $this-element('elem'); ?
?php echo $this-element('elem2'); ?
?php echo $this-element('elem'); ?
?php echo $this-element('elem2'); ?

But, if you're using some elements with JavaScript maybe they are 
not initialized properly. Do you check HTML output or debug the page in 
Firebug or Chrome Dev Tools?

Also check your names, you could have some typo. Enable debug mode and 
check errors.


On Wednesday, February 27, 2013 8:53:44 AM UTC+1, Victor Musvibe wrote:

 I am using Google API for displaying charts on my app. I am trying to view 
 more than two elements on the same view page (index.ctp). Meaning i am 
 trying to have more than 2 Charts on the same view page. The index page is 
 only showing the policies_accessible2012.ctp element. 

 Here is how i am calling the elements in my index.ctp

 body
 table width=100% border=0 cellspacing=2 cellpadding=2
 tr
 tddiv?php echo 
 $this-element('SurveyResults/2011/policies_accessible2011'); ?/div/td
 td/td
 tddiv?php echo 
 $this-element('SurveyResults/2012/policies_accessible2012'); ?/div/td
 /tr
 /table
 /body

 I do understand that if i have the following code, this will result in 
 SurveyResults/2012/policies_accessible2012 rendered as the parent view to 
 the current view

 ?php echo 
 $this-element('SurveyResults/2011/policies_accessible2011'); ?
 ?php echo 
 $this-element('SurveyResults/2012/policies_accessible2012'); ?

 I am just wondering if they is a way to show the 2 or more elements on the 
 same view. Thank you in advance


-- 
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: What happeened to the API Documentation on CakePHP.org?

2013-02-26 Thread jodator
Hi there,

they've changed the API yesterday, and i found it quite good.

Here is 1.3 debugger: http://api.cakephp.org/1.3/class-Debugger.html

I've found it by using the search box (it has a very nice autocomplete).

Just remember to choose CakePHP version.


On Tuesday, February 26, 2013 7:52:10 PM UTC+1, kdubya wrote:

 Exactly. When I used to go there I could choose to see the ALL the classes 
 and choose from an alphabetical list. Now it shows a structure off to the 
 left but when I try to find something like Debugger it is nowhere I can 
 find.

 When I go to the 2.0 version of the API (http://api.cakephp.org/2.0) to 
 the left there is a structure that makes some sense. Debugger is found 
 under Utilities. Not so under 1.3.

 Is there still some work going on here that the structure is not complete?

 Ken

 On Tuesday, February 26, 2013 1:26:43 PM UTC-5, kdubya wrote:

 I can't find the classes anymore. I was specifically looking for the 
 Debugger class in 1.3. The structure that used to be there until recently 
 is gone. What happened? Did I miss something?

 Ken



-- 
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 Validation Error Message

2013-01-19 Thread jodator
You can:

   - Add a massege by Model::invalidate function or even add a message to 
   validation error messages field (Controller::validationErrors)
   - Add client side validation (there a neat jQuery validation plugin with 
   minimal configuration



On Friday, January 18, 2013 11:35:56 PM UTC+1, Michael wrote:

 So because of how I am dynamically creating my form inputs/save data, the 
 standard rule validation msg isnt being displayed on the input when the 
 save rule returns false. How do I manually trigger the msg to appear on a 
 given input? Thanks


 ~Michael


-- 
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:br'
 )
);
echo $this-Form-input('User.password', array(
  'label' = 'Pass:br' 
 )
);
echo $this-Form-input('UsersInfos.first_name', array(
  'label' = 'First Name:br'
 )
);
echo $this-Form-input('UsersInfos.last_name', array(
  'label' = 'Last Name:br'
 )
);
echo $this-Form-input('UsersInfos.email', array(
  'label' = 'Email:br'
 )
); 
echo $this-Form-input('UsersInfos.age', array(
  'type' = 'select',
  'options' = array_combine(range(14,100), range(14,100)),
  'label' = 'Select Your Age:br',
  'empty' = 'Your Age'
 )
);
echo $this-Form-input('UsersInfos.sex', array(
  'type' = 'select',
  'options' = array(
   'm' = 'Male',
   's' = 'Female'
  ),
  'label' = 'Select Your Sex:br',
  'empty' = 'Your Sex'
 )
);
  

Re: Category HABTM Post, find results by selected category and show related posts and paginate by posts?

2012-12-07 Thread jodator
Just do it: 
http://api21.cakephp.org/class/paginator-component#method-PaginatorComponentpaginate
look what you can pass as $object Param (i.e: Category.Post).
in $scope set proper conditions (like 'Post.category_id' = $id).

Hafe fun reading docs : 
http://book.cakephp.org/2.0/en/core-libraries/components/pagination.html

On Friday, December 7, 2012 2:58:07 PM UTC+1, Salines wrote:

 *Category HABTM Post, find results by  selected category and show related 
 posts and paginate by posts?*

 Another day, another problem.
 When Selecting one category, output will show properly related posts.

 But the post results need to use pagination.
 How?

 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: Cake Bake on nginx

2012-11-30 Thread jodator
Do you enabled pdo module for cli? I think that you can have different 
php.ini for cli / web (fpm).

On Friday, November 30, 2012 4:29:11 PM UTC+1, advantage+ wrote:

 I just installed Cake from the command line 

  

 When I run the cake bake command 

 Welcome to CakePHP v2.2.3 Console

 ---

 App : app

 Path: /var/www/app/

 ---

 Interactive Bake Shell

 ---

 [D]atabase Configuration

 [M]odel

 [V]iew

 [C]ontroller

 [P]roject

 [F]ixture

 [T]est case

 [Q]uit

 What would you like to Bake? (D/M/V/C/P/F/T/Q)

  

 Select M and this is the result.

  

 Error: Database connection Mysql is missing, or could not be created.

 #0 /usr/share/php/Cake/Model/ConnectionManager.php(101): 
 DboSource-__construct(Array)

 #1 /usr/share/php/Cake/Console/Command/Task/ModelTask.php(908): 
 ConnectionManager::getDataSource('default')

 #2 /usr/share/php/Cake/Console/Command/Task/ModelTask.php(845): 
 ModelTask-getAllTables (NULL)

 #3 /usr/share/php/Cake/Console/Command/Task/ModelTask.php(934): 
 ModelTask-listAll(NULL )

 #4 /usr/share/php/Cake/Console/Command/Task/ModelTask.php(204): 
 ModelTask-getName()

 #5 /usr/share/php/Cake/Console/Command/Task/ModelTask.php(92): 
 ModelTask-_interactive()

 #6 /usr/share/php/Cake/Console/Command/BakeShell.php(107): 
 ModelTask-execute()

 #7 /usr/share/php/Cake/Console/Shell.php(393): BakeShell-main()

 #8 /usr/share/php/Cake/Console/ShellDispatcher.php(201): 
 Shell-runCommand(NULL, Array)

 #9 /usr/share/php/Cake/Console/ShellDispatcher.php(69): 
 ShellDispatcher-dispatch()

 #10 /usr/bin/cake.php(43): ShellDispatcher::run(Array)

 #11 {main}

  

 The site is running on the server I just need to bake new models / 
 controllers.

  

 I did install php-pdo module but that did nothing.

  

 Any nginx users out there who came across same issue?

  

 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: forn create with ID

2012-10-03 Thread jodator
this one will be more consistent with URL routing:

?php echo $this-Form-create('Message', array('action' = array('action' 
= 'compose', $user_obj['User']['id'] ))); ?

Same array syntax as for html-url();

On Wednesday, October 3, 2012 12:26:06 PM UTC+2, Chris wrote:

 Thank you Marcus !! it works, 
 actually I have tried that, but couldn't think of that  /  right after 
 compose... 

 Thanks again,... 


 On Wednesday, October 3, 2012 1:10:52 AM UTC-7, marco metal wrote:

 Hi Chris

 Try this 

 ?php echo $this-Form-create('Message', array('action' = 
 'compose/'.$user_obj['User']['id'] )); ? 





 Enjoy,

 Marcus



-- 
Like Us on FacekBook 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: Choose what field show when depth level is 2

2012-07-31 Thread jodator
You can use Containable behavior and write something like this:

$Office-find('all', array(
   ...
   'contain' = array(//or 'contains' - check manual ;)
'Company' = array('fields' = array('name')),
'Person' = array(
'fields' = array('mail'),
'OfficePersonTask' = array( )
 'Office' = array('fields' = 'name'),
 'Task' = array('fields' = 'name'),
),
   ),
   ...
));

Or try setting the fields names in $hasMany, $hasOne, etc array 
http://book.cakephp.org/2.0/en/models/associations-linking-models-together.html#hasone

On Tuesday, July 31, 2012 12:16:38 PM UTC+2, Mariano C. wrote:

 In CakePHP 2.1 I have prepared a Json webservice. This is an excerpt of 
 what I get:

 {
Offices:[
   {
  Office:{
 id:1,
 Company:{
id:1,
name:ABC Software
 }
  },
  Person:{
 mail:s...@saass.it,
 OfficePersonTask:[
{
   office_id:1,
   person_id:1,
   task_id:1
}
 ]
  }
   }
]
 } 


 What I want is the possibility to show only some field from relative 
 database, so the method that query the database have `$options['fields']` 
 properly setting, so if I want to show person's mail I write:

 $options['fields'] = array(Person.mail);


 but what if I want to show company's id or company's name whice is one 
 level deeper?


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


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


Re: Problems with menu_builder

2012-03-20 Thread jodator
change your urls to something like this:

'url' = array(*'plugin' = null*, 'controller' = 'rooms', 'action' = ''),

And links should stay without plugin prefix.

On Tuesday, March 20, 2012 10:40:41 AM UTC+1, Thomas wrote:

 Now that I finally managed to get the menu builder helper plugin ( see 
 https://github.com/torifat/cake-menu_builder) working I stumbled across 
 the next problem.

 I defined the following menu in the beforefilter of appcontroller.php:

 function beforeFilter() {

 // Define your menu
 $menu = array(
 'main-menu' = array(
 array(
 'title' = 'Management',
 'url' = array('controller' = 'management', 
 'action' = 'view'),
 'children' = array(
 array(
 'title' = 'Requests',
 'url' = array('controller' = 
 'managerequests', 'action' = 'view'),
 ),
 array(
 'title' = 'Rooms',
 'url' = array('controller' = 
 'managerooms', 'action' = 'view'),
 ),
 array(
 'title' = 'Mailing',
 'url' = array('controller' = 
 'managemail', 'action' = 'view'),
 ),
 )
 ),
 array(
 'title' = 'Reporting',
 'url' = array('controller' = 'reporting', 
 'action' = 'view'),
 'children' = array(
 array(
 'title' = 'Requests',
 'url' = array('controller' = 
 'reportrequests', 'action' = 'view'),
 ),
 array(
 'title' = 'Rooms',
 'url' = array('controller' = 
 'reportrooms', 'action' = 'view'),
 ),
 array(
 'title' = 'Billing',
 'url' = array('controller' = 'billing', 
 'action' = 'view'),
 ),
 )
 ),
 array(
 'title' = 'Administration',
 'url' = array('controller' = 'administation', 
 'action' = 'view'),
 'children' = array(
 array(
 'title' = 'Rooms',
 'url' = array('controller' = 'rooms', 
 'action' = ''),
 ),
 array(
 'title' = 'Catering',
 'url' = array('controller' = 
 'admincatering', 'action' = 'view'),
 ),
 array(
 'title' = 'Location',
 'url' = array('controller' = 
 'adminlocation', 'action' = 'view'),
 ),
 array(
 'title' = 'Email',
 'url' = array('controller' = 
 'adminlocation', 'action' = 'view'),
 ),
 array(
'title' = 'User management dashboard',
'url' = '/dashboard',
 ),
 )
 ),
 array(
 'title' = 'Logout',
 'url' = '/logout',
 ),
 ),
 );

 The menu shows up nicely, but when I go to the user management dashboard 
 page, suddenly all menu entry links are prefixed with usermin, which is 
 the controller of the user management plugin.

 So when I eg. try to go to the rooms management instead of calling 
 localhost/cakephp/rooms, it calls localhost/cakephp/usermin/rooms, which 
 does not exists - *Error: * *Usermin.RoomsController* could not be 
 found.

 Thomas


-- 
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: The evil of Cache.check = true

2011-09-07 Thread jodator
@ mark_story
Thanks for pointing it out. I do have many small cached elements - I
forgot about that.
I thinking about reorginizing my view caching.

@Teddy Zenny
That's a good idea. I haven't heard of RabbitMQ before.

@ O.J. Tibi
I hope so as soon as possible (but that requires more income from my
webpage; ;) ).
I think that solution could help. thanks!

On Sep 7, 3:53 am, O.J. Tibi ojt...@gmail.com wrote:
 Looks like my suggestion will not fit your situation, but I still want to
 ask if you have any plans to go dedicated? If you're working with a large
 number of small temporary files in your cache directory, then maybe you
 could place your app/tmp directory on an EXT4 or BTRFS partition? I heard
 that these have improvements on file seeks.

 Sorry if I'm not much of a help.

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


The evil of Cache.check = true

2011-09-06 Thread jodator
Hi,

I've just spend 40+ hours on deep debug my app, because all
Model::save actions where stupidly slow.

For instance:
I had one action that copied some model's data with some associated
data and saved it as new instances.
Time with Cache.check = true - 130 seconds
Time with Cache.check = false - 0.6 second...

The problem is execution time of glob() function inside clear_cache()
function from besics.php.

I've left Cache.check set to true, when I was testing this
functionality, but my app doesn't use full view caching.

I'm using cakphp1.2.*. My server is Debian (nginx, php-fpm, mysql)
running on VPS with Xen virtualization.

Hope that helps someone...

ps.: anyone have any idea why clear_cache is so slow?

-- 
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: 'Site under maintenance' option

2011-09-06 Thread jodator
Why a secret url?
It could be just check if it's maintenance and if user is logged in.
If not, redirect to login action.

If your login action is too secret:
You also need an maintenance switch (which should be also in DB, if
you're switching to maintenance by editing files then you can edit
secret url also ;) ) so you have to have some Config/Setting model (or
just implement/google one).

Something like this: 
http://bakery.cakephp.org/articles/iamcam/2008/10/26/simply-storing-config-values-in-the-db
or anyone that suits your needs.

Your routes.php can have:
Router::connect(Configure::read('Secret.url'),
array('controller' = 'users', 'action' = 'secret_login'));
- or -
Router::connect(ClassRegistry::init('Config')-field('value',
array('key' = 'secret_url')),
array('controller' = 'users', 'action' = 'secret_login'));


On Sep 5, 9:45 pm, Xoubaman xouba...@gmail.com wrote:
 I'm trying to implement a system to disable the site temporaly for
 maintenance purposes or whatever. If the site is disabled, only logged users
 can navigate through it, non-logged users are redirected to a Site under
 maintenance layout.

 Currently (o As of now), my approach is to allow a secret url that will
 lead to the login form, check in AppController::beforefilter if the current
 url is the allowed one and, if it isn't, set the maintenance layout. Trying
 to figure out how to allow only one url to log in, I came to define it as a
 constant in bootstrap and add the route in config/routes pointing to
 UsersController::login.

 It would be nice to save the secret url into the database and change it
 without editing bootstrap.php, though.

 Any suggestion?

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

2011-06-11 Thread jodator
Hi, I had similar problems and I think that you can set session is to
your uploadify settings. Then check it in your upload controller and
create session
in beforeFilter.


On 10 Cze, 17:32, Niels steni...@gmail.com wrote:
 Hey everybody,

 I followed the Cuploadify tutorial (http://www.am05.com/2011/01/06/
 using-uploadify-in-cakephp/).
 And everything worked out great, until I start implementing it in my
 app.

 My app uses the Auth component of cakephp and like I experienced
 before with the Swfuploader.
 It is a f***ing mess, to get it working . Now I hope that anybody here
 can give me some advise.

 The only way I could get i working was to $this-Auth-

 allow('upload');

 But when I enabled this anybody unauthorized could add new files, that
 isn't good ;).

 Could anybody share his/her experiences  how I could avoid this
 problem ?

 Thanks a lot in advance

 Niels

-- 
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: Server Preference?

2011-01-16 Thread jodator
I've noticed that output code formatting could depends on the ?php ?
tags
and it's line up with other html tags.
If you want to make your output code cleaner and more compressed you
can use
mod_pagespeed from google or write an after_render action in
app_controller
to remove unnecessary spaces from HTML output - but you'll lose pretty
formating
on HTML output.

On Jan 15, 1:10 am, Dave Maharaj m...@davemaharaj.com wrote:
 Ohh yes that’s what I do. I just flipped a view  source and noticed it. I
 don’t usually look at the rendered code thru browser. Developer tools for
 each browser for that stuff.

 Just something I noticed.

 Thanks,,
 Dave

 -Original Message-
 From: gremlin [mailto:abba.bry...@gmail.com]
 Sent: Friday, January 14, 2011 8:30 PM
 To: CakePHP
 Subject: Re: Server Preference?

 Use firebug / Safari inspector / Chrome inspector
 View source is the tool of last resort - I honestly haven't hit view
 source in a decent browser for years now.

 On Jan 14, 12:05 pm, Dave Maharaj m...@davemaharaj.com wrote:
  Thanks Miles.

  I am sure any of the servers would work fine but each has its strengths,
  weaknesses and depending on the app and its functionality I figured there
  would be a better to go with one over another.

  The site is still being built so I am testing it on different server
 builds
  to test thing out. Currently on nginx fpm-php with APC and Memcache
  installed. I been testing the pages that would get the most hits
 repeatedly
  over and over and its slower than Apache. Im still playing / messing
 around
  so just seeing what others use. The plan is 25K+ a day but that’s
  hoping...reality could be more / lesswho knows.

  My biggest problem is caching the views. Data no problem but views are
  killing me. I need to come up with some way to save more data in cache /
  memory.

  Side note: Is there an output setting for code to be cleaned / properly
  lined up? My view code is well tabbed / structured yet in the browser view
  source it’s a complete mess. 5 or 6 empty lines before and after lists.
 Just
  weird ugly formatting.

  Thanks,

  Dave

  -Original Message-
  From: Miles J [mailto:mileswjohn...@gmail.com]
  Sent: Friday, January 14, 2011 2:53 PM
  To: CakePHP
  Subject: Re: Server Preference?

  Nginx is fast in general, who ever said it was for static content? I
  use Nginx with memcache/apc and get a good 10k hits a day with no
  speed penalty.

  Want kind of traffic are you expecting where none of these would
  suffice? Even the largest of sites use apache.

  On Jan 14, 2:29 am, Dave Maharaj m...@davemaharaj.com wrote:
   I am trying to get the best suited server going for my app I am building
  and
   so far

   From what I read:

   .         Apache seems to be the dead horse / big and clumsy

   .         Lighttpd is not as supported / updated as it once was

   .         Nginx is fast with static content

   .         Cherokee leaves me wondering.

   The site im working on has maybe 5 - 10 static nothing changing
 pages(just
   welcome / register / login / contact)  but once you login everything is
  per
   user since there are a lot of custom settings so caching pages / parts
  seems
   like not the best solution for nginx (sure Apache backend but if 95%
 would
   be processed thru Apache whats the point for nginx for the few pages
   really?)

   All my data / queries  are cached for dynamic pages since each users
 page
   consists of various modules that constantly changing entire view caching
  is
   impossible.

   So that basically leaves me with Cherokee left to try. Anyone use it?
   Reviews? Good bad?

   I just installed nginx and tuned it up tried this and that, APC,
 Memcache
   but its not much faster pushing out my the dynamic content over Apache
 so
  I
   was thinking of giving Cherokee a go and just looking for opinions /
   feedback?

   Thanks,

   Dave

  Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp 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
 athttp://groups.google.com/group/cake-php?hl=en

 Check out the new CakePHP Questions sitehttp://cakeqs.organd help others
 with their CakePHP related questions.

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



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

You received this message because you are subscribed to the Google Groups 
CakePHP 

Re: IDE

2010-12-21 Thread jodator
+1 for Netbeans. I was using eclipse but it was so slow...

On Dec 21, 5:26 pm, LipeDjow liped...@gmail.com wrote:
 I've been using NetBeans too, but someone may say it's slow.. for these,
 there is a lightweight option:

 http://www.geany.org/

 On Tuesday, December 21, 2010 1:11:46 PM UTC-2, Felipe Roman wrote:

  Hi Kristofer,

  I've been using NetBeans PHP[1] IDE, there are all IDE common features like
  code auto-complete, support SVN integration and also other Control Version
  tools.

  1. php.netbeans.org

  On Tue, Dec 21, 2010 at 12:57 PM, Kristofer krish...@gmail.com wrote:

  What IDE do people typically use with CakePHP?  I've been doing stuff
  from the Linux command line using vim for so long.  I'd like something
  more graphical that (hopefully) supports SVN.  Looking for more point-
  and-click.  :)

  Check out the new CakePHP Questions sitehttp://cakeqs.organd help
  others with their CakePHP related questions.

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

  --
  Best Regards,
  Felipe Roman
  Phone 55 51 8454 8110
  LinkedInhttp://au.linkedin.com/in/feliperoman

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: Change model behavior in controller

2010-12-20 Thread jodator
In most cases look at book.cakephp.org:
http://book.cakephp.org/view/1072/Using-Behaviors

On 20 Gru, 15:31, Dobrogor alexc...@gmail.com wrote:
 Hi all! I want to change my model behavior, when program is running.
 For example, I have in my model behavior variable like this
 var $actsAs = array('i18n' = array('fields'=array('header',
 'preview', 'content')));

 But I want change this to null or to delete in some controllers. :)
 Is this possible?
 Thanks

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: i18n - __() function and variable content

2010-11-14 Thread jodator
If you have to put some variable in i18n function:
echo sprintf(__(Add as %s, true), $content);

But, $content var should be already translated, so it's up to you how
you do it, because I don't know the rest of your code ;-)

On Nov 15, 12:19 am, Mariano C. mariano.calan...@gmail.com wrote:
 I have a code like:

 echo Add as .$content;

 I have to internationzalize this snippet of code,  i need to put in
 i18n process even the $content variable, how can I do that?

 Best Regards

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: How to install custom application under a sub-domain having cakephp in main domain

2010-11-10 Thread jodator
It's not really a CakePHP problem, but your webserver configuration
and/or dns.

Configuration depends on type of your hosting (shared vs. private/
VPS).

On shared hosting you should be able to point subdomain to different
directory than your main cakephp app. Most shared hosting providres
have FAQ or help, so you should check them how to do it.

On VPS you should know how to configure Virtual Hosts (it depends on
webserver you're using), so I'm guessing that you don't have one...

On Apache you can copy paste your mywebsite.com config above
and change server name to myapp.mywebsite.com and change the directory
it is pointing to.


On Nov 9, 3:43 am, dkr deepakj...@gmail.com wrote:
 Hello All,

 I have a website developed in cakephp, now I want to create a sub-domain
 under it and install a custom made application which does not uses Cakephp,
 say mywebsite.com is developed in cakephp and myapp is custom made php
 application, so how to change cakephp so that it can run under
 myapp.mywebsite.com

 Please help me out.

 Thank you
 DKR
 --
 View this message in 
 context:http://cakephp.1045679.n5.nabble.com/How-to-install-custom-applicatio...
 Sent from the CakePHP mailing list archive at Nabble.com.

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: 2 database, 1 models and controllers, many views

2010-10-28 Thread jodator
Sure, no problem.

Just use 2 db configs and set the $default db config on runtime:

file app/config/database.php

class DATABASE_CONFIG {

  var $default = null;

var $dev = array(
'driver' = 'mysql',
'persistent' = false,
'host' = 'localhost',
'login' = 'root',
'password' = secret1'',
'database' = 'db1',
'prefix' = '',
'encoding' = 'utf8',
);

  var $prod = array(
'driver' = 'mysql',
'persistent' = false,
'host' = 'localhost',
'login' = 'root',
'password' = 'secret2',
'database' = 'db2',
'prefix' = '',
'encoding' = 'utf8',
);
/**
 * @link 
http://edwardawebb.com/web-development/cakephp/automatically-choose-database-connections-cakephp
 */
  function __construct() {
//check to see if server name is set
if(isset($_SERVER['SERVER_NAME'])) {
  switch($_SERVER['SERVER_NAME']) {
case 'example1.pl':
case 'www.example1.pl':
  $this-default = $this-prod;
  break;
default:
  $this-default = $this-dev;
  break;
  }
}
else {
// we are likely baking, use our local db
  $this-default = $this-dev;
}
  }
}

The code above was taken from @link in comment. The dev is my laptop
with XAMPP, the prod is my production sever, both have MySQL server on
localhost.
I use it to automatically change db configs without editing config
file.

On Oct 28, 3:16 pm, Dmitry Shevchenko dmitr...@gmail.com wrote:
 I wanted to create 2 separated web site which will use same models and
 controllers.

 main aim - run 2 sites which will use almost the same logic but it
 will be build with different design.
 I wanted to use same models and controllers, because I want to support
 only one version.

 so database structure, models, controllers will be the same
 differents - views (design) and domains.

 On Oct 28, 2:54 pm, Zaky Katalan-Ezra procsh...@gmail.com wrote:



  What is your goal?

  On Thu, Oct 28, 2010 at 12:31 PM, Dmitry Shevchenko 
  dmitr...@gmail.comwrote:

   Hi.
   Is it possibly for cake to have 2 different database, which is use
   same models and controllers and different views.

   I need this to create a almost copy of website, so system logic will
   be the same, I will only have separated DB and views.

   Seems this could be done by switching config on config.php and maybe
   dispatcher.php... but I'm not sure.

   Is someone do something similar ?

   Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp 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.comcake-php%2bunsubscr...@googlegroups.c
omFor more options, visit this group at
  http://groups.google.com/group/cake-php?hl=en

  --
  Regards,
  Zaky Katalan-Ezra
  QA Administratorwww.IGeneriX.com
  Sites.IGeneriX.com
  054-7762312

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: password field gets md5-hashed values

2010-09-06 Thread jodator
Instead of 'password' use 'new_password' and hash it manually in
controller's register action:

$this-data['User']['password'] = Security::hash(
$this-data['User']['new_password'],
 null, true);

Then you should save data with option 'validate' = first
if ($this-User-saveAll($this-data, array('validate' = 'first')))
{ /* it validates */} else { unset $this-data['User']
['new_password']; }

And you validate unexisting in db field 'new_password' insted of
password,
so in UserModel :

  var $validate = array(
'new_password' = array(
  'between' = array(
'rule' = array('between', 6, 20),
'message' = 'Hasło musi mieć od 6 do 20 znaków'
  ),
  'notEmpty' = array(
'rule' = 'notEmpty',
'message' = 'Podaj hasło'
  )
),
);

I think there should be also in $validate array, option to validate
only on create, ('on' = 'create') but check it in book

On Sep 5, 10:11 pm, Simon m...@simonopsomer.be wrote:
 In my register-form I have a passwordfield and i use Auth-component.
 If I fill in an incorrrect form and press 'submit', there are some
 validation errors who are nicely shown. That's perfectly great but my
 passwordfield gets the value of the hashed string who was filled in.
 It looks like Auth hashes the field and then puts this data back into
 the value-atribute. Is there some way to prevent that?

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: Caching Local vs. Server

2010-07-08 Thread jodator
I've read your post twice and if it's creating DB rows and the problem
is only with refreshing of page contents it's probably because
your browser did not checking the url after redirect but it reads from
cache.
add the $this-cachDisable(); in beforeFilter() action in your:
- AppController (whole site)
- PluginNameAppController
- YourController

The cacheDisable() action simply tells your browser not to cache
generated HTML and re-download it each time.
There are some good tips on CakePHP performance (debug:0, APC caching,
better server, etc) and i dont't think that cacheDisable is the slow
down factor.

Hope it helps.


On Jul 7, 6:32 pm, dtemes dte...@gmail.com wrote:
 I had some issues while deploying a site to a production server
 becouse I also copied the cache files from the test server, if this is
 the case for you you might try deleting the cache files from the app/
 tmp/cache folder and subfolders or set debug to 1 or 2 for a while in
 the production server.

 On 7 jul, 18:20, echo419r richardkaleh...@gmail.com wrote:

  I am working on a staff site for my company where users must log in
  and submit reports. An admin must create each new user account before
  that user is able to log in to the site.

  Everything seems to be working perfectly fine when testing on my local
  environment, but when I test it out on the live server, I seem to have
  some caching problem(s). Local: When I add a new user account,
  everything works as expected.
  Server: When I add a new user account, it takes me back to the index
  page but the new account doesn't appear. I have to do a hard refresh
  before the $session-flash(); message and the new account appear.

  My Setup
  I haven't changed anything with the core.php file except change the
  debug line
  Local: Configure::write('debug', 2);
  Server:  Configure::write('debug', 0);

  My Work-around
  For each page where this poses a problem, I have added $this-

  disableCache(); to the function:

  function index() {
          $this-disableCache();
          .
          .
          .}

  This seems to cause the new account/flash messages to appear the first
  time without having to do a hard refresh. But I've had to add this to
  almost every function on my site. And since this is disabling the
  cache for each of these pages, it causes the site to run very slowly.

  I have read, re-read, and re-read every section on Caching there is on
  the CakePHP manual, but I can't seem to figure it out. I've done
  literally hundreds of Google searches trying to figure this out, but
  they only come up with instructions on how to add Caching to my site
  or redirect me back to the CakePHP manual. I'm not sure if my problems
  are being caused by CakePHP or my server.

  I am using CakePHP version 1.2.7
  I am using MAMP for my local testing
  My server is a Mac OS X Server 10.5.8

  Any assistance would be greatly appreciated.

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: ACL customization

2010-07-06 Thread jodator
1  2 - custom login action

3 - well basically the same as 1  2. You can do it all in one login
action in users_controller:

  function login() {

if ($this-Session-read('Auth.User')) {
  //Is acc enabled?
  $emailAuhtenticated = $this-Session-
read('Auth.User.email_authenticated');
  if (!$emailAuhtenticated) {
$this-Session-setFlash('Konto oczekuje na potwierdzenie
email', 'default', array(), 'auth');
$this-Auth-logout();
  }
  //Redirect to admin dashboard
  if ($this-Session-read('Auth.User.group_id') == 1) {
$this-redirect(array('controller' = 'configs', 'admin' =
true));
  } else {
  $this-redirect('/');
  }
}
// Show the login form
$this-Session-write('login.refer', $this-referer('/'));
  }

ps.: This is my login action and it works ;) So you should be able to
expand it to your needs

best regards

On Jul 6, 8:25 am, mirfan m.irfa...@gmail.com wrote:
 Hi dear cake developers,
 I am using cake ACL and Auth component which i want to customize my
 requirements are:

 1. User should not looged in until his account is being verified by
 admin

 2. If he is not verified and try to login he may be redirected to a
 page informing about his status

 3. I have three groups Admin, Publisher and Advertiser if anyone of
 them login they may be redirected to their relevant dashboard.

 Please help me.

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: Which is the best hosting server for CakePHP?

2010-06-30 Thread jodator
I have similar thoughts on VPS after switching to one.
It's not as easy as shared hosting, but you can find tons of tutorials
online.

Btw, Big THX for the linode.com link. I was searching a affordable VPS
in US and these one is just sweet!

On Jun 29, 7:33 pm, Jon Bennett jmbenn...@gmail.com wrote:
  It's actually pretty cheap now to get your own VPS, and set it up
  exactly how you want to.

 I second that suggestion, after switching to VPSs I'd never switch back.

 In the UK I likewww.bytemark.co.uk
 In the euwww.linode.comhave US and uk data centres
 Also in the US iswww.slicehost.com

 I have sites with bytemark and slidehost, linode were lacking a backup
 solution but they now have that in place.

 Hth,

 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: sending activation link after registration

2010-06-21 Thread jodator
Hi, look at the Bakery source code:

https://cakeforge.org/projects/bakery/

You have to create an account to browse SVN repository here:
https://svn.cakeforge.org/svn/bakery/ (you can do it with your web
browser)

In https://svn.cakeforge.org/svn/bakery/branches/plugins/users/controllers/
you have an users controller with everything you need.

In short reply to your question:
you can create three fields in db
email_token - you store the activation key
email_token_expires - how long the activation key should be valid
email_confirmed - the user successfully confirmed an email

In verify action you have to search for the activation key in db,
check if user still can validate an email and set email_confirmed to
true, email_token and email_token_expires to null on success.

the  rest you can read from bakery source code :)

On Jun 20, 12:18 pm, Tomfox Wiranata tomfox.wiran...@gmail.com
wrote:
 dear community,

 this is my first post and i am happy to finally finding a big cake
 community :)

 well i am a total newbie  and i started coding the registration. it
 works fine. even the sending email process works. but: i cant get the
 activation link together and the function that is necessary to
 actually activate the user: now this is my controller:

 [CODE]
 ?php
 class UsersController extends AppController
 {
     var $name = 'Users';
     var $components = array('Auth', 'Recaptcha', 'Email');

     function beforeFilter()
     {

         $this-Recaptcha-publickey = xxx;
            $this-Recaptcha-privatekey = xxx;
         $this-Auth-fields = array('username' = 'nickname',
 'password' = 'password');
         $this-Auth-allow('register', 'recaptcha', 'thankyou');
     }

     function register()
     {
         if ( !empty( $this-data ) ){
              if ($this-data['User']['password'] ==
                  $this-Auth-password($this-data['User']
 ['password_confirm'])) {
                     if($this-Recaptcha-valid($this-params['form']))
 {

                         $this-User-create();
                         if ( $this-User-save($this-data) ){

                          #$this-__sendActivationEmail($this-User-

 getLastInsertID());

                         }
                     } else {
                         $this-Session-setFlash('Captcha
 Verifizierung fehlgeschlagen');
                     }
             } else {
                 $this-Session-setFlash('Deine Passwörter stimmen
 nicht überein');
             }
         }
     }

       function __sendActivationEmail($id)
       {

              $this-Email-smtpOptions = array(
               'port'='25',
               'timeout'='30',
               'host' = '127.0.0.1',
               'username'='xxx',
               'password'='xxx',
               'client' = 'xxx'
               );

           $User = $this-User-read(null,$id);
           $this-Email-to = $User['User']['email'];
           $this-Email-subject = 'Herzlich willkommen bei test';
          $this-Email-from = 'nore...@test.com';
           $this-Email-sendAs = 'html';
           //$this-Email-template = 'user_confirm';
           $this-set('User', $User);
           $this-Email-send();
       }

 }

 ?
 [/CODE]

 and this is the model:
 [CODE]
 ?php
 class User extends AppModel
 {
     var $name = 'User';
     var $validate = array
     (
     'nickname' = array(
             'exists' = array(
                     'rule' = array( 'checkUnique', 'nickname' ),
                     'message' = 'Der Benutzername ist bereits
 vergeben.'
             ),
             'minLength' = array(
                     'rule' = array('minLength', 3),
                     'message' = 'Der Benutzername muss mind. 3
 Zeichen lang sein.'
             )
         ),

         'email' = array (
             'email' = array(
                 'rule' = 'email',
                 'message' = 'Die E-Mail-Adresse ist ungültig.'
             ),
             'exists' = array(
                  'rule' = array( 'checkUnique', 'email' ),
                  'message' = 'Die E-Mail-Adresse ist bereits
 registriert.'
             )
         ),

         'password' = array(
             'mingLength' = array(
                 'rule' = array('minLength', '6'),
                 'message' = 'Das Passwort muss mind. 6 Zeichen lang
 sein.'
             )
         ),
     );

     function checkUnique( $data, $fieldName ) {
         $valid = false;
         if(isset($fieldName)  $this-hasField($fieldName)) {
             $valid = $this-isUnique(array($fieldName = $data));
         }
         return $valid;
     }

 }

 ?
 [/CODE]

 i know that i need a logic to create a unique activation key and put
 it into the link (preferably in the function sendActivationEmail()).
 also i need a function within the controller to activate the user
 after he clicked the link.

 do i need an extra field in my table? i created an attribute
 activation_key in my DB.

 well i tried lots of things. i got tons of errors and i need a fresh
 start 

Re: Email Component and Model

2010-06-16 Thread jodator
I had the same issue ;) Fastest: rename model or component.

Or you could try use email model in controller like this (I havn't
tested it before):

$uses = array('MyOtherModel');

...
function mail_me($id) {
$emailModel = ClassRegistry::init('Model');
$emailField = $emailModel-find('email', array('id' = 666) );

// or

$emailField = ClassRegistry::init('Model')-find('email', array('id'
= 666) );

$this-email-to = emailField;

//I don't know how to dinamically load components

}


On Jun 16, 1:20 pm, Andrei Mita andrei.m...@gmail.com wrote:
 Hello,

 I have a model Email that conflicts with the component when I try to send
 emails. I have researched the group and saw that other people had the same
 issue but did not find a solution. Is there a standard way to deal with the
 problem or do I have to rename my model, controller and view folder?

 Thanks,
 Andrei

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 html link helper to create absolute urls

2010-06-07 Thread jodator
http://api12.cakephp.org/class/html-helper#method-HtmlHelperurl

You can add the array('action' = 'view', 5) parameter and it will be
compatible with custom routes (look here:
http://api12.cakephp.org/view_source/html-helper/#line-278)

On Jun 7, 7:33 am, Andras Kende and...@kende.com wrote:
 Hello,

 Is it possible for cakephp html link helper to create absolute urls?

 I saw this could be done with html-url() something like :

 ?php echo $html-link('TEST LINK', $html-url('/advances/forward', true)); ?

 but not sure how compatible that with custom routes etc...

 Thanks,

 Andras

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 Core on standalone server?

2010-02-24 Thread jodator
Well, as far as I can tell you have everything you need on that
hosting.
That is PHP5 + MySQL, so you have to just copy the cakePHP to your web
root folder.
CakePHP is just group of normal PHP files, so it should work on every
hosting with PHP enabled.

On Feb 23, 7:13 pm, brutalt.se timmy...@gmail.com wrote:
 Hello, i have one.com as webhost unfortunately they dont support
 frameworks.
 So im trying to figure out a way to get around this, is it possible to
 have cakephp-core on one server ( got a server of my own ). and then
 have the cakeapp at one.com?

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: How do I add custom validation in controller?

2010-02-23 Thread jodator
Do it in a model (not controller) - cake flow:

var $validate = array(
'accept_terms' = array(
  'notEmpty' = array(
  'rule' = array('comparison', '!=', 0),
  'required' = true,
  'message' = 'Musisz zaakceptować regulamin',
  'on' = 'create',
   ),
),
);

ps.: (there is no accept_terms in my database table of course.

and add to it custom validation rules (links in WebbedIT post)

On Feb 23, 11:35 am, Zac Tolley zac.tol...@gmail.com wrote:
 I have created a form with the html and form helpers and setup
 validation rules in my model and this seems to work pretty well
 (anyone got this integrated with jquery?)

 I have a question though, in my form I have a couple of extra fields,
 one is a checkbox to accept terms and conditions, and another is a
 password validation field (they type in new password twice).

 Now, I can easily put some logic into the controller to check these
 things when the form is submitted, but is there any way I can do this
 in such a way that it fits into the cake flow, so if one of my checks
 fails it go back to the form and puts up a messing below the filed in
 the same style, or am I going to do this manually?

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: 1.2.6 strtotime error

2010-02-18 Thread jodator
I can confirm that is the PHP 5.3 issue, due to change:
5.3.0Now throws E_WARNING rather then E_STRICT.

Fix from cake 1.2.x app/core.php file:

/**
 * If you are on PHP 5.3 uncomment this line and correct your server
timezone
 * to fix the date  time related errors.
 */
date_default_timezone_set('Europe/Warsaw');

On Feb 18, 11:41 am, Martin Westin martin.westin...@gmail.com wrote:
 That should not be a Cake 1.2.6 problem but a php 5.3 problem. (or
 even possibly 5.2.10 or something)

 I had this error notice way before 1.2.6... and the fix is exactly
 what you paste... to set the default timezone so that php is happy.
 One small problem is that the PHP manual lists a lot of timezones you
 can set that PHP doesn't actually support :)

 /Martin

 On Feb 17, 8:56 pm, Selino seli...@gmail.com wrote:

  :PHP Warning:  strtotime(): It is not safe to rely on the system's
  timezone settings. You are *required* to use the date.timezone setting
  or the date_default_timezone_set() function. In case you used any of
  those methods and you are still getting this warning, you most likely
  misspelled the timezone identifier. We selected 'America/Los_Angeles'
  for '-8.0/no DST' instead in C:\xampp\htdocs\cake_1_2\cake\libs
  \cache.php on line 429:

  I only get this when I try to use bake in a new cakephp 1.2.6 app. If
  I run bake in the default app folder (the one that comes with the cake
  build) it does this. If I run bake from my old 1.2.5 project (cake_1_2/
  myapp) it works fine.

  Is anyone else having this issue with CakePHP 1.2.6 projects?

  It's not a PHP problem because then it would be consistent with any
  time functions I tried.

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: model links, question from noob.

2010-02-11 Thread jodator
Add containable behavior (http://book.cakephp.org/view/474/
Containable)

then:

$this-Fest-find('first',
  array(
   'conditions' = array(
 'Fest.id' = $id,
   ),
   'contain' = array(
  'Linup' = array(
'order' = array('Lineup),
//other stuff
  ),
  //'Category' is not fetched
),
  )
);

ps.; why do you have:

'foreignKey' = 'category' // not 'category_id' ??

On Feb 11, 2:41 pm, johnbl4ck unknw...@gmail.com wrote:
 Hi all!

 I love this feature of cakephp, however i have some questions.

 this is my model:

 class Fest extends AppModel {
         var $name = 'Fest';
         var $useTable = 'fests';

         var $belongsTo = array(
                 'Category' = array(
                         'className' = 'Category',
                         'foreignKey' = 'category'
                 )
         );

         var $hasMany = array(
                 'Lineup' = array(
                         'className' = 'Lineup',
                         'foreignKey' = 'fest_id'
                 )
         );

 }

 as you can see it defines hasMany link, so when i do $this-Fest-

 find('all') it pulls Lineup for each item of Fest.

 The question is:
 Lineup is also linked to Artist by belongsTo bond. Is it possible to
 fetch all required data (Fest-Lineup-Artist) in one single Fest
 call? That would be awesome but i don't know how to do that and stick
 to

                 $f = $this-Fest-find($id);
                 $l = $this-Lineup-find('all', array('conditions'= 
 array('fest_id'
 = $id), 'order' = 'Lineup.status DESC'));

 which i think is not the best solution.

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: inflector - class methods - slug ????

2010-02-10 Thread jodator
Psst, don't do that ;-) I think I saw a ticket about it and id would
not be fixed in 1.2 branch, but in 1.3 there should be an option to
add custom chars mapping.

Don't hack your core either, because it could cause problems when
upgrading, doing new stuff from fresh cake, etc. Make your own class,
or make new function in your app_model/app_controller/app_helper and
use it $this-mySlug();

I had the same issue with polish letters and I make copypaste from
core as one of my models' function.

On Feb 10, 5:17 pm, PaulMan pho...@gmail.com wrote:
 Thank you both!!!
 I used the patch you gave, and used mb_* functions to set string to
 lowercase ( i was having problems with chars like Ó and Á )

 Martin what do you mean by:
 I will let you post the ticket though.
 Sorry im not a expert on CAKEPHP , yet 

 On 10 Fev, 14:37, Martin Westin martin.westin...@gmail.com wrote:

  Cake only supports conversion of a specified list of characters to
  their root a or o.
  You need to patch the Inflector class (and post it back to the
  tracker).

  line 496 of inflector.php is where the action starts. It is quite
  obvious where to add your additional characters. Actually I added
  those three to this version if you want the quick fix:

 http://bin.cakephp.org/view/1955811171

  I will let you post the ticket though.

  On Feb 10, 2:02 pm, PaulMan pho...@gmail.com wrote:

   hello,

   echo Inflector::slug(' ã õ ï ö ä ë ö ü á í é ó ú à è ì ò ù â ê î ô û
   ç );
   what i want is to have the next result
   a_o_i_oe_ae_e_oe_ue_a_i_e_o_u_a_e_i_o_u_a_e_i_o_u_c

   but the result is
   _õ_ _oe_ae_e_oe_ue_a_i_e_o_u_a_e_i_o_u_a_e_i_o_u_c

   ã should be = a
   õ should be = o

   On 10 Fev, 12:41, anler anle...@gmail.com wrote:

You want to keep the url with your letters as they are? if that is the
case, google by IDNA (International Domain Names ... or something, or
the package Net_IDNA in pear.php.net)

On Feb 10, 1:35 pm, PaulMan pho...@gmail.com wrote:

 echo Inflector::slug(' ã õ ï ö ä ë ö ü á í é ó ú à è ì ò ù â ê î ô û ç
 ');

 results:
 _õ_ _oe_ae_e_oe_ue_a_i_e_o_u_a_e_i_o_u_a_e_i_o_u_c

 the first three chars do not work, the first and second are used many
 times in Portuguese language...

 is this a bug? does anybody have a solution?

 best regards,



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: Cake is BASTARD

2010-02-08 Thread jodator
Hi,

try to clear all the ARO-ACO nodes from table and create new ones with
automated tool form cake book.
So clear the acos_aros table and acos table

then run the code from the book.cakephp.org to create ACO's (http://
book.cakephp.org/view/647/An-Automated-tool-for-creating-ACOs)
nodes and then ARO-ACO associations. That works for me.

(ps.: do it when with $this-Auth-allowedActions = array('*'); in
appController beforFilter() function, so you don't get acl node lookup
error ;-) )

On Feb 8, 3:17 pm, lacenaepro...@gmail.com lacenaepro...@gmail.com
wrote:
 HI,

 I'm developing a quite complex application using cake. I developed an
 acl system following the directives of cake official site.

 All right until yesterday, when suddenly the acl system brake down.

 It gives the infamous error: acl node lookup.

 EVERY PAGE CONTROLLED BY THE ACL does not show, but the others do.

 You can say that I was working on some controller, but I was working
 only on views. I also tried to restore an old working version, but the
 problem was not solved.

 I AM DEPRESSED. Cake is making laugh of me.

 IS THERE A POSSIBLE SOLUTION? I'm thing of giving up with the cake
 framework.

 Thanks!!

 )

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: cake book offline pdf version!!

2009-12-21 Thread jodator
Hi,

thnx for finding this :)

On Dec 21, 11:33 am, cherif_Gsoul cherif.sahel...@gmail.com wrote:
 hi dave, first iam not who did this coversion so iam not felix, you
 must have scribd account to download it it's free and easy to create
 one if you dont have.

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: ACL - aco/aro creation help

2009-12-08 Thread jodator
From: http://book.cakephp.org/view/648/Setting-up-permissions

$group = $this-User-Group;
//Allow superadmins to everything
$group-id = 1; //if superadmins have $id = 1;
$this-Acl-allow($group, 'controllers');

//allow admins
$group-id = 2;
$this-Acl-allow($group, 'controllers');
$this-Acl-deny($group, 'controllers/Users/new_admin');


//allow users to only add and edit on posts and widgets
$group-id = 3;
$this-Acl-deny($group, 'controllers');
$this-Acl-allow($group, 'controllers/YourController/
new_dealer');
$this-Acl-allow($group, 'controllers/YourController/
add_review');
 and so on

All actions accessible by all users should be defined in beforeFilter
in each controller:

$this-Auht-allow('search', ... );

Hope this helps

On Dec 8, 8:05 am, gautam lakum lakum7...@gmail.com wrote:
 Hi all,

 I am using ACL with my cakePHP application. I want to assign
 permissions to the users. I have groups table, in which I have 3 types
 of groups called
 1. superadmin
 2. admin
 3. member

 The permissions are like superadmin can access all the controllers
 actions, admin can also access all the actions but can't access
 new_admin action. new_admin can be accessed only by super admin.
 members can't access admin actions. They can access only login,
 logout, search, profile, new_dealer, add_review actions.

 So please help me, what should be there in aros and acos table. and
 also aros_acos table. I am too much confused. If possible, please
 reply with some easy example. I found some e.g. but they were
 confusing me.

 Thank you.

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: HABTM questions

2009-12-03 Thread jodator
From something,I'm currently working on (I've changed my Models to
yours, but only names)

//paginator variable:
  $this-paginate = array('Asset' = array(
'limit' = 10,
'order' = array('Asset.promoted DESC', 'Asset.name ASC'),
'conditions' = array(
  'Asset.accepted' = 1,
),
//@todo 'fields' = array(),
'joins' = array(
  array(
'table' = 'assets_containers',
'alias' = 'AssetsContainer',
'type' = 'INNER',
'conditions' = array(
  'AssetsContainer.asset_id = Asset.id'
)
  ),
  array(
'table' = 'containers',
'alias' = 'Container',
'type' = 'INNER',
'conditions' = array(
  'Container.id = AssetsContainer.container_id',
  'Container.link_name' = $parameters // just
Container_id = $id form function params
)
  ),
),
  ));
  $assets = $this-paginate('Asset');
  $this-set('assets', $assets);

This is in index action of assets_controller, but it will (should?)
work in Container, with proper settings.

I found this way very easy to paginate HABTM models (after fighting
with nasty bindModel and found the 'joins' savior).

But for the other question, i have no clue now... how to work with
three models on one _id field. (easiest would be creating three
fields, in assets table: photo_id, profile_id and blog_id - but i
guess it's not nicest way... just an idea to make it work
automatically loads photo, profile or blog data - the only thing is
that you have ensure that only one id is set - photo, blog or
profile).

On Dec 3, 12:07 pm, Martin Westin martin.westin...@gmail.com wrote:
 About the pagination:http://book.cakephp.org/view/83/hasAndBelongsToMany-HABTM
 Look at the bottom. The last examples abut binding can be used to let
 paginator deal with your habtm.

 When it comes to finding related data find is better than read. But
 probably find('first') in this case since it does more or less the
 same as read. Use Containable to specify what and how deep you want
 your data returned. That should do it...

 On Dec 3, 4:02 am, Alan Asher a...@asteriskpound.com wrote:

  I've been scouring the web for a while trying to figure this out.  My brain
  is fried, so I need some help.

  I have a model called Containers, a model called Assets and HABTM table
  called AssetsContainer.

  So a container can have many assets.

  The first question I have is when I'm doing this operation

  $this-Container-read(null,$id);

  How do I paginate the assets.  right now I am only testing so there's only 2
  assets linked to the container.  Am I assuming right that there would be an
  endless number of assets?  If not, still, how do I paginate this data?

  Next question is, each asset can be one of three different tables, Photos,
  Profiles, Blogs.  Each of these models has a hasOne relationship of asset_id
  in each model.  How do I get the read() function to retrieve this data
  automatically?  My first instinct is to put a nominal field for each
  potential table of photo_id, profile_id and blog_id and update the model for
  Asset with the hasOne of each.. This way it will grab the data right?

  Also, is this an instance where instead of read, I use find('all') instead?

  Many thanks,

  Alan

  Example of my Container-read below

  Array
  (
      [Container] = Array
          (
              [id] = 1
              [user_id] = 1
              [title] = Default
              [total_items] =
              [mime_type] = image
              [photo_id] = 1
              [created] = 2009-12-02 11:53:21
              [modified] = 2009-12-02 11:53:21
              [is_fan_club] = 0
              [fan_club_requirements] =
              [nsfw] = 0
              [ordering] =
              [active] =
              [deleted] =
          )

      [User] = Array
          (
              [id] = 1
              [user_type_id] = 2
              [user_group_id] = 3
              [username] = user
              [email] =
              [name] =
              [gender_id] = 1
              [password] =
              [salt] =
              [birthday] = 1991-11-23
              [created] = 2009-11-23 21:41:24
              [modified] = 2009-11-24 15:24:59
          )

      [Photo] = Array
          (
              [id] = 1
              [user_id] = 1
              [asset_id] = 15
              [created] = 1259625133
              [modified] = 1259625133
              [title] =
              [deleted] =
              [file_name] = c0a80aa6-5aab-f111.jpg
              [rel_path] = users/1/2009/11
              [caption] =
              [server_id] = 1
              [is_featured] =
          )

      [Asset] = Array
          (
              [0] = Array
                  (
                      [id] = 1
                      [asset_type_id] =
                      [user_id] =
                 

Re: not 1 person knows?

2009-12-03 Thread jodator
I've checked my DB for records created with handy functions from
simple ACL app tutorial from Cake Book
http://book.cakephp.org/view/647/An-Automated-tool-for-creating-ACOs
(here copy-pasta from phpMyAdmin):

EditDelete  23  19  NULLNULLadmin_add   
43  44
EditDelete  24  19  NULLNULLadmin_edit  45  
46

So, I suppose, that it should be
$this-Acl-allow($role, 'controllers/Posts/manage_index');

plz try it out and give feedback if it works :)

On Dec 3, 6:55 pm, Dave make.cake.b...@gmail.com wrote:
 Just seeing if anyone knows since nobody replied to the question.

 When setting up the initDB() function for routing do you set it up as
 function name or url?

 $this-Acl-allow($role, 'controllers/Posts/manage_index');

 or

 $this-Acl-allow($role, 'controllers/Posts/manage/index');

 assuming manage is the admin routing prefix which is correct for the posts

 function manage_index () ?

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: How use AUTH for two sections (admin eshop, client admin)

2009-12-01 Thread jodator
If I get it right you want Admin section and Client section?

If so:

If you try to use ACL based app (http://book.cakephp.org/view/641/
Simple-Acl-controlled-Application),
your create two tables: users and groups (plus rest from ACL component
- http://book.cakephp.org/view/641/Simple-Acl-controlled-Application).
Each user belongs to some group, so you could have simply two groups:
admins
clients

Now, you have to define ARO - ACO association (http://book.cakephp.org/
view/648/Setting-up-permissions):

$group = $this-User-Group;
//Allow admins to everything
$group-id = 1;
$this-Acl-allow($group, 'controllers');

//allow clients to shop
$group-id = 2;
$this-Acl-deny($group, 'controllers');
$this-Acl-allow($group, 'controllers/ShoppingCarts/
edit');
$this-Acl-allow($group, 'controllers/ShoppingCarts/add');
 and so on

Actions visible for everyone (no logged in) are defined in
beforeFilter action in each controller,

function beforeFilter(){
  parent::beforFilter(); //see Cake Book tutorial for explenation of
this
  $this-Auth-allowedActions('index', 'view');
}

Some actions (defined by you) will be then served only when someone is
logged in. All actions with prefix admin_ will be served only to
admin.

Very helpful tool for automated ACO's (simply controllers' and
plugins' actions): 
http://book.cakephp.org/view/647/An-Automated-tool-for-creating-ACOs

Add to it Tip about prefix routing and You should have nice urls for
logged in users.


On Nov 25, 1:19 am, Petr Vytlačil petr.vytla...@gmail.com wrote:
 Hi,
 is any idea. How use AUTH for two admin sections?
 First: Admin section, when user log. can add new products, and other
 informations.
 Second: Client admin: user log. can shopping, do order, check
 order

 I must use ACL or role in user and how i can do, when client login can
 view only views for orders, ... and admin user can use add products,
 kind.. but cant shopping..

 THX

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: web based Application software development with cakephp

2009-11-26 Thread jodator
I think that you are looking for plugins: 
http://book.cakephp.org/view/114/Plugins

Then:
-cake
-config
-app
-controllers
-views
-plugins
--ems(module name)
--app
--views
--controller
--scms(module name)
--app
--views
--controller

and rest is in the books ;-)

On Nov 26, 12:24 pm, Pallab mr.pallabgh...@gmail.com wrote:
 I am tring to build a web based application software with cakephp.
 My application has 7 to 10 modules.
 Its like a erp software

 My Application has modules like
 1. General ledger
 2. Supply Chain Management system
 3. Employee management system
 .
 .
 .
 and many more

 These all modules are very large in size.I have already developped it
 using php, mysql.
 but now i want to develop it with cake.

 My problem is I want to use separate folder or directories for each
 module.
 like for general ledger  gledger
 for Employee management system  ems
 and want to store the controller,module and views under the folders
 ( e.g. ems).
 and i want to use general library and config file for all these
 modules.
 for maintainable issues.
 I am tring to give the directory structure below

 erpprojectname(main project folder name)
 -cake(library)
 -config(configuration files)
 -ems(module name)
 -app
 -views
 -controller
 -scms(module name)
 -app
 -views
 -controller

 I want to access the programme with url like 
 thiswww.example.com/ems/controller_name/action_name/param1...
 orwww.example.com/scms/controller_name/action_name/param1...
 orwww.example.com/admin/controller_name/action_name/param1...

 can any one help me???

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: Reading data within a controller

2009-11-19 Thread jodator
Or you can access this data in controller's action by:
$this-viewVars['variable'];

This could Be helpful, id you want to acces data set in beforeFilter
action (for instance in app_controller beforeFilter action

On Nov 19, 6:51 am, jburns jeremybu...@me.com wrote:
 Perfect - thanks. Here's how I've implemented it:

 $variable = $this-Controller-read(null, $id);
 $this-set('path', $this-Controller-AssociatedController-getpath
 ($variable['AssociatedController']['id'], 'id, name'));
 $this-set(compact('variable'));

 What this allows me to do is show the hierarchical path of a related
 field up to the root of the tree in the view. For example, for a
 business unit based in a location (which has the tree behaviour) I can
 show the path from the location where this business unit is based and
 it's parents all the way to the top of the tree.

 Thanks.

 On Nov 19, 5:38 am, Erik nedwi...@lighthouseitc.com wrote:

  Jeremy,

  $variable will be how you access it in the view template (ctp) file.
  If you still need it in the controller you should do:
  $variable = $this-Controller-read(null, $id);
  // Do some work with $variable.
  $this-set(compact('variable'));

  On Nov 19, 12:30 am, jburns jeremybu...@me.com wrote:

   Once I have executed this...

   $this-set('variable', $this-Controller-read(null, $id));

   ...within the view function of a controller, how can I access the
   contents of 'variable'? I want to extract one or more field values of
   the current row. I have tried using $variable, but it is not
   recognised.



--

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




Re: CakePHP convert quotes.

2009-11-18 Thread jodator
I'm trying to understand what you want to get with class=
{mask:'9', type:'repeat'} ?

class name in HTML should be alfanumerical (strting from a letter), so
I don't see a point in this statement (maybe I'm wront ;-) ).

Anyhow cakePHP escapes attributes with h() function, try to add
escape = false to options:

?php echo $form-text('Controller.input', array(class =
{mask:'9', type:'repeat'}, escape = false )); ?

But again, I don't think that is good way of using the class
parameter, wchich should be used to define classes of form element in
(x)HTML.

Best Regards,
Maciej Gołaszewski

On Nov 18, 1:14 pm, Caio Tarifa caiotar...@gmail.com wrote:
 Hi.

 CakePHP is converting my quotes for ASCII decimal. Look the example:

 Input:
 ?php echo $form-text('Controller.input', array(class =
 {mask:'9', type:'repeat'})); ?

 Output:
 input name=data[Controller][input] type=text
 class={mask:#039;9#039;, type:#039;repeat#039;} value=
 id=ControllerInput /

 Please, help me to solve my problem?

 Regards,
 Caio Tarifa

--

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




Re: Stuck with GoogleMap vs. CakePHP

2009-11-17 Thread jodator
Well, this one below is working for me (on localhost, so my key is
abdedfg ;) ):

div id=map_canvas style=width: 500px; height: 300px/div
script src=http://maps.google.com/maps?
file=apiv=2key=abcdefgsensor=true
type=text/javascript
/script
script type=text/javascript
function initialize() {
if (GBrowserIsCompatible()) {
  var map = new GMap2(document.getElementById(map_canvas));
  map.setCenter(new GLatLng(?php echo $specialPage['SpecialPage']
['GoogleLatitude']; ?, ?php echo $specialPage['SpecialPage']
['GoogleLongitude']; ?), 12);
}
  }

$(document).ready(function() {
initialize();
});/* document ready */
/script

Those should be changed with numerical values:
$specialPage['SpecialPage']['GoogleLatitude'];
$specialPage['SpecialPage']['GoogleLongitude'];

This is just copy paste from Google API, but always work ;)
Btw, as you can see you can use javasrcript('google.js', true); so
it's inline

Below is jQuery standard function called when document is ready (page
loads).

$(document).ready(function() {
initialize();
});/* document ready */

If you're not using jQuery, you should have call to initialize() here:
body onload=initialize() onunload=GUnload()


On Nov 17, 5:19 am, Lance Willett nano...@gmail.com wrote:
 Hi Julia,
 When you are using $javascript-link you will generally want the
 script to be called in the head of the document (not inline). Which
 means adding false as the second parameter: 
 seehttp://api.cakephp.org/class/javascript-helper#method-JavascriptHelpe

 Calling the Google Maps script inline could be causing the issue.

 On Nov 16, 5:04 pm, Julia julia...@yahoo.com wrote:

  Hi,

  I have been fighting with GoogleMap vs. CakePHP for a few hours.
  I have a layout in which I call:-

  $url = 'http://maps.google.com/maps?file=apiv=2key=MYKEY';
  echo $javascript-link($url);

  when I attempt to display a page using this layout, the brower hangs
  displaying Read maps.gstatic.com in the status bar.

  I cannto see any error in Firebug,

  What's more, if I call http://maps.google.com/maps?
  file=apiv=2key=MYKEY in my browser window, it displays well.

  Any help wouold be greatly appreciated.



--

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