Re: Saving related table data
Your problem lies in this part: [Rate] = Array ( [s1_title] = title 1 [s1_day] = day 1 [s1_week] = [s1_month] = [extra_info] = ) I assume that this information was at first retrieved from the database and presented to the user. The user then changed something and saved. The above information lacks the Rate.id information - without which CakePHP assumes that you are saving a new record in the Rate model. You have to add the Rate.id as a hidden field in the view (worst solution) or get it from somewhere else. Hope this will help you on the way, John On Feb 10, 8:09 pm, koala kid alexhob...@gmail.com wrote: Hi, I'm still struggling with saving information to related tables. I have a form which updates info about a rental property and I have an associated Rates table which holds data about the rental rates for the property. I've defined my relationship as : Rental - hasOne Rate - belongsTo My save action looks like this: $this-Rental-saveAll($this-data); However this save action is creating a new entry in the Rates table rather than updating the existing one. I'm pretty sure my form data is in the correct format: Array ( [Rental] = Array ( [id] = 45 [rental_code] = PDSSerena [location_id] = 19 [rental_agent] = [rental_meta_url] = [rental_meta_title] = [rental_meta_desc] = [rental_meta_tags] = ) [Rate] = Array ( [s1_title] = title 1 [s1_day] = day 1 [s1_week] = [s1_month] = [extra_info] = ) ) Do I need to explicitly set the rental_id in my Rate form data, such as: [Rate] = Array ( [rental_id] = 45 ) 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: Access Global Function in CakePHP
Not everything has to be OOP. Im still confused at what your trying to achieve. On Feb 10, 11:39 pm, Martin Westin martin.westin...@gmail.com wrote: I can not imagine why you would use a localized variable variable. Anyway... $temp_var = __('String',true); echo {${$temp_var}}; On Feb 11, 8:14 am, Mukhamad Ikhsan ikhsan.o...@gmail.com wrote: global function like __() is break the OOP concept, in some cases i need the function bind to an object case: echo {${$someobject-__('String')}} // This will work echo {${__('String')}} // this will not work because curly syntax after ${ is looking the variable object not a function, even in php manual this should work but i have tried and it's not worked but because __() is a global function, i don't know how to bind that function into a variable/object -- Mukhamad Ikhsan Y!id:ikhsan_only 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: Retrieve data in table cells - how to avoid line breaks?
You need to set a css style for th Ie th { whitespace:nowrap} which will stop the lines breaking on spaces. Mike Karthauser Brightstorm limited Tel: 07939252144 On 11 Feb 2010, at 07:19, sebb86 kahlc...@googlemail.com wrote: Hello, when i retrieve my data in table-cells, how can i avoid line breaks, for example in the table header? [retrieve-code] !-- table- (column-) captions -- table tr th?php echo $paginator-sort(array('asc' ='id v', 'desc' ='id ^'), 'id'); ?/th th.../th ... /tr !-- table content -- ?php foreach ($hardware_units as $hardware_unit): ? tr td?php echo $hardware_unit['HardwareUnit']['id']; ?/td td?php echo $hardware_unit['HardwareUnit']['...']; ?/ td ... [/retrieve-code] Thanks if someone can help! :) Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Access Global Function in CakePHP
$temp_var = __('String', true); $temp_var is not a function just a returned value, if a i calling many function __() with different value it can't be implemented like this i created javascript helper that intensively using string manipulation so curly string syntax is making easier and make a cleaner code. so now i'm facing a problem when combining curly syntax and __() function that was a global function. On Thu, Feb 11, 2010 at 3:18 PM, Miles J mileswjohn...@gmail.com wrote: Not everything has to be OOP. Im still confused at what your trying to achieve. On Feb 10, 11:39 pm, Martin Westin martin.westin...@gmail.com wrote: I can not imagine why you would use a localized variable variable. Anyway... $temp_var = __('String',true); echo {${$temp_var}}; On Feb 11, 8:14 am, Mukhamad Ikhsan ikhsan.o...@gmail.com wrote: global function like __() is break the OOP concept, in some cases i need the function bind to an object case: echo {${$someobject-__('String')}} // This will work echo {${__('String')}} // this will not work because curly syntax after ${ is looking the variable object not a function, even in php manual this should work but i have tried and it's not worked but because __() is a global function, i don't know how to bind that function into a variable/object -- Mukhamad Ikhsan Y!id:ikhsan_only 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.comcake-php%2bunsubscr...@googlegroups.comFor more options, visit this group at http://groups.google.com/group/cake-php?hl=en -- Mukhamad Ikhsan Y!id:ikhsan_only http://www.diodachi.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: Can someone explain ORM
Now people keep telling me that I am wrong here, but I have always had problems with deep belongsTo associations not being fetched with recursive alone. In your instance LocalInfo belongsTo Subcat which belongsTo Cat which belongsTo Location and your find recursive stops after the first belongsTo only finding LocalInfo and Subcat. There are a few things you can do. 1. Force a join from LocalInfo to Cat by doing the following in the controller before the find $this-LocalInfo-bindModel(array('belongsTo'=array( 'Cat'=array( 'foreignKey'=false, 'type'='INNER', 'conditions'=array('Subcat.cat_id = Cat.id') ) )), true); The last condition defaults to true so you dont actually need to pass it, but if your paginating results needs to be set to true to make the bind persistent otherwise the bind only exists for the first find that follows it. If you need also need data from Location you would need to bind that too as follows: $this-LocalInfo-bindModel(array('belongsTo'=array( 'Cat'=array( 'foreignKey'=false, 'type'='INNER', 'conditions'=array('Subcat.cat_id = Cat.id') ), 'Location'=array( 'foreignKey'=false, 'type'='INNER', 'conditions'=array('Cat.location_id = Location.id') ) )), true); 2. The 2nd option is to use containable, which I use all the time and is great as long as you're not needing to place any conditions on the deep tables, in which case you must do the above. http://book.cakephp.org/view/474/Containable HTH Paul. 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
sql expression in CAKE?
Hi, how can I pass a MATH operation into SQL via cake?? I try to do this..but cake always quotes the '+ 1' as well, and sql then treat it as a string... array('Section.rght' = 'Section.lft + 1') is there any trick?? Thanks Tomas 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: Question about use ACL with paginate
Something I don't see clear from this approach is, how can I have permissions on 'create' for a document that's not been yet created?, When I see this method I can only see 'documents' as a 'resource' an 'interface' or in the current context, as a 'controller', setting permits on documents treated as 'files' or 'rows' in a db, I can only think of a system file permissions (read, write or edit and delete in this example, execute) But I am not versed in sql either ;) anl On Thu, Feb 11, 2010 at 2:08 AM, guille1983 mansil...@gmail.com wrote: Oh... I see the data got lost The tables look like this: id: 1 document_id: 9 user_id: null group_id: 1 create: 0 read: 1 update: 0 delele: 0 On 10 feb, 21:04, Guillermo Mansilla mansil...@gmail.com wrote: I think about this: Have a table (with its model) named documents_permissions with the following fields id, document_id, user_id, group_id, read, create, update, delete this model belongs To: User, Group, Document Since a user may be part of many groups and some times you may have cases like this: user gmansilla (user_id 7) belongs to groups: teachers (group_id 4) and administrators (group_id 1), and document taxes (document_id 9) may be read only by administrators. You will have to feed the table with this data: id|document_id | user_id | group_id | create | read | update |delete | 19null 101 0 0 In case this document may be read by teachers and administrator but may not be read my gmansilla you will feed the table with this data id|document_id | user_id | group_id | create | read | update |delete | 19null 101 0 0 29null 4 01 0 0 397null 00 0 0 Basically you fill the table with the permits and the explicit denies, then Then in your Controller place a function that checks if a user has permision or not, something like function __hasPermission($document_id, $user_id, $group_id, $action){ switch ($action) { case 'read': return ($this-theNewModel-find('count', array('contionds' = array('read' = 1, 'group_id' = $group_id, 'document_id' = $document_id))) 0 $this-theNewModel-find('count', array('contionds' = array('read ' = 0, 'user_id' = $user_id, 'document_id' = $document_id))) == 0 ) //I am counting results in find queries where my group has permission (1) and I am not denied (0) ); brake; case and so on } } Then you can call you function passing the required parameters, example: Lets say I am user_id = 3 and I belong to groups = 5 and 7, and I want to read document_id = 9 Now I want to check if the User has permission: $this-__hasPermision(9, 3, array('5', '7'), 'read') All of this Is to only check permissions... To display What documents Can I read I would use the containable behavior or just bindModel setting the conditions You need. I hope it helps you On 10 February 2010 16:54, marco.rizze...@gmail.com marco.rizze...@gmail.com wrote: I try to explain better. I have users that belongs to groups (a user can belong to many group and a group can have many users) Then I have documents. I must manage permissions on documents. Permissions are : read a document, edit a document etc... Permission can be defined in raltion to groups or to users So there are documents can be accessed by all user in a group and there are other documents can be accessed by only some users. I ask what is the best pattern to manage this situation To manage this is better have a HABTM relation between User and Document with a permission field ( more simple but I have to use more and more space). In this way when I set that a document can be access by a group I must insert in HABTM relation all the users of the group. or I use ACL (very very complex to use in this situation(I have to manage also that a user can belong to many groups) or I ask if exist another method? I hope that now my problem is more understandable. On 10 Feb, 17:46, anl hp anle...@gmail.com wrote: Forgive me, but I'm making a mess, now you're saying: I must find all users that belong to the group and
Re: Form always validates on 1.3 beta
Yeah, that's it. :) Now I feel kind of ashamed for making this thread, but I guess it was the only way to figure this out. I was searching too deep. Thank you. On 10 Lut, 05:05, Dr. Loboto drlob...@gmail.com wrote: Check this model filename. Should be post_comment.php. This model may be not loaded at all if you named it wrong. In this case $this-PostComment in controller will be of class AppModel and won't have your validation rules, of course. On Feb 9, 9:54 pm, Tomek Mazur tmazu...@gmail.com wrote: Nope. I tried this with other rules: minLength, maxLength and it always validates. It seems like the rules are simply ignored. It occours only in this one specific model. Don't know what's behind this... On 9 Lut, 15:49, Céryl c.a.h.wilt...@student.tue.nl wrote: Not sure but is there a chance that the username is an empty string like or has a stray space perhaps? And therefore not considered empty? If not... Beats me! :D On 8 feb, 17:31, Tomek Mazur tmazu...@gmail.com wrote: Hi, I have this weird problem. I set up validation rules but cake seems to ignore them. Here is my model and controller:http://bin.cakephp.org/view/309506151 I supply this data: Array ( [PostComment] = Array ( [username] = [email] = [message] = [post_id] = 31 ) ) which obviously sould not validate, yet the first debug returns 'true'. This is driving me crazy, my controller is kind of 'nasty', because I was trying to debug the problem. 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: New Facebook Plugin with Facebook Connect
@nurvzy sounds great, will have to give 1.3 another go (tried it when first released and went back to 1.2x for current project). 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: sql expression in CAKE?
Check the test case for this new feature: http://github.com/cakephp/cakephp1x/commit/02330b2d9c292110240c606e976e182c973897e9#diff-1 Some people says this kind of things breaks the MVC pattern. I should be something like 1) get Section lft. 2) add 1 to this 3) save the result in Section rght. Hope this helps. MARTIN On 02/11/2010 06:19 AM, toka...@gmail.com wrote: Hi, how can I pass a MATH operation into SQL via cake?? I try to do this..but cake always quotes the '+ 1' as well, and sql then treat it as a string... array('Section.rght' = 'Section.lft + 1') is there any trick?? Thanks Tomas Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Retrieve data in table cells - how to avoid line breaks?
Addition: It also would be nice, if the cell width would fit to the cell content. 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
address bar contain database names
Hello everyone.. actually i'm totally new for the cakephp and i employed to develop huge website accomplished by cakephp everything is ok so far ... but i've noticed some variables passed in the address bar contain database names especially when i'm using forms to filter or search somethings like so: http://www.mywebsite.com/controller/search?data%5BHospital%5D%5BcountryID%5D=13data%5BHospital%5D%5BcityID%5D=226data%5BHospital%5D%5BhospFID%5D=27data%5BHospital%5D%5BhospitalName%5D=tyutyutyulang=ar we can see here many database columns names like (cityID, hospFID, etc) how could i encapsulate this variables... 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: Retrieve data in table cells - how to avoid line breaks?
Thanks. Furthermore, is it possible to create only a horizotal line under each complete data-row? 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: Retrieve data in table cells - how to avoid line breaks?
Thanks! That works for me: [code] style type=text/css th { white-space:nowrap; } /style [/code] Furthermore, is it possible to create only a horizontal line under each complete data row? 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: Retrieve data in table cells - how to avoid line breaks?
Thanks, that works. Furthermore, is it possible to create only a horizontal line under each complete data-row? On 11 Feb., 09:21, mike karthauser mi...@brightstorm.co.uk wrote: You need to set a css style for th Ie th { whitespace:nowrap} which will stop the lines breaking on spaces. Mike Karthauser Brightstorm limited Tel: 07939252144 On 11 Feb 2010, at 07:19, sebb86 kahlc...@googlemail.com wrote: Hello, when i retrieve my data in table-cells, how can i avoid line breaks, for example in the table header? [retrieve-code] !-- table- (column-) captions -- table tr th?php echo $paginator-sort(array('asc' ='id v', 'desc' ='id ^'), 'id'); ?/th th.../th ... /tr !-- table content -- ?php foreach ($hardware_units as $hardware_unit): ? tr td?php echo $hardware_unit['HardwareUnit']['id']; ?/td td?php echo $hardware_unit['HardwareUnit']['...']; ?/ td ... [/retrieve-code] Thanks if someone can help! :) 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 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 include a button which links to a view?
Something like this: echo $html-link( $html-image(recipes/6.jpg, array(alt = Brownies)), recipes/view/6, array('escape'=false) ); or echo $html-image(recipes/6.jpg, array( alt = Brownies, 'url' = array('controller' = 'recipes', 'action' = 'view', 6) )); See: http://book.cakephp.org/view/836/link and http://book.cakephp.org/view/835/image Jeremy Burns jeremybu...@me.com On 11 Feb 2010, at 09:36, sebb86 wrote: Hello, how can i create a button in a view, which links to another view? This is my code with a simple text link, but how can i this as a button? [code] !-- add link -- ?php echo $html-link('add a hardware unit', array('controller' = 'hardware_units', 'action' = 'add')) ? [\code] Thanks a lot if someone can help!!! :) Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
model links, question from noob.
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: How to include a button which links to a view?
Jeremy Thanks for your answer. But actually i'd like to create a button (not a button-picture), which links to a view. I don't want to add a picture, because every button would have an other description. So is this possible to realize or must i create lots of pictures? ;-) 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: Question about use ACL with paginate
Yes, you are right, forget the create field. My mistake. You should have only 3 fields regarding to permissions: Read, Update, Delete, so you can still implement my idea On 11 February 2010 06:00, anl hp anle...@gmail.com wrote: Something I don't see clear from this approach is, how can I have permissions on 'create' for a document that's not been yet created?, When I see this method I can only see 'documents' as a 'resource' an 'interface' or in the current context, as a 'controller', setting permits on documents treated as 'files' or 'rows' in a db, I can only think of a system file permissions (read, write or edit and delete in this example, execute) But I am not versed in sql either ;) anl On Thu, Feb 11, 2010 at 2:08 AM, guille1983 mansil...@gmail.com wrote: Oh... I see the data got lost The tables look like this: id: 1 document_id: 9 user_id: null group_id: 1 create: 0 read: 1 update: 0 delele: 0 On 10 feb, 21:04, Guillermo Mansilla mansil...@gmail.com wrote: I think about this: Have a table (with its model) named documents_permissions with the following fields id, document_id, user_id, group_id, read, create, update, delete this model belongs To: User, Group, Document Since a user may be part of many groups and some times you may have cases like this: user gmansilla (user_id 7) belongs to groups: teachers (group_id 4) and administrators (group_id 1), and document taxes (document_id 9) may be read only by administrators. You will have to feed the table with this data: id|document_id | user_id | group_id | create | read | update |delete | 19null 101 0 0 In case this document may be read by teachers and administrator but may not be read my gmansilla you will feed the table with this data id|document_id | user_id | group_id | create | read | update |delete | 19null 101 0 0 29null 4 01 0 0 397null 00 0 0 Basically you fill the table with the permits and the explicit denies, then Then in your Controller place a function that checks if a user has permision or not, something like function __hasPermission($document_id, $user_id, $group_id, $action){ switch ($action) { case 'read': return ($this-theNewModel-find('count', array('contionds' = array('read' = 1, 'group_id' = $group_id, 'document_id' = $document_id))) 0 $this-theNewModel-find('count', array('contionds' = array('read ' = 0, 'user_id' = $user_id, 'document_id' = $document_id))) == 0 ) //I am counting results in find queries where my group has permission (1) and I am not denied (0) ); brake; case and so on } } Then you can call you function passing the required parameters, example: Lets say I am user_id = 3 and I belong to groups = 5 and 7, and I want to read document_id = 9 Now I want to check if the User has permission: $this-__hasPermision(9, 3, array('5', '7'), 'read') All of this Is to only check permissions... To display What documents Can I read I would use the containable behavior or just bindModel setting the conditions You need. I hope it helps you On 10 February 2010 16:54, marco.rizze...@gmail.com marco.rizze...@gmail.com wrote: I try to explain better. I have users that belongs to groups (a user can belong to many group and a group can have many users) Then I have documents. I must manage permissions on documents. Permissions are : read a document, edit a document etc... Permission can be defined in raltion to groups or to users So there are documents can be accessed by all user in a group and there are other documents can be accessed by only some users. I ask what is the best pattern to manage this situation To manage this is better have a HABTM relation between User and Document with a permission field ( more simple but I have to use more and more space). In this way when I set that a document can be access by a group I must insert in HABTM relation all the users of the group. or I use ACL (very very complex to use in this situation(I have to manage also that a user can belong to many groups) or I ask if exist
Re: How to include a button which links to a view?
You have to create your button and lock it inside a form which points to a controller action that renders a view. in your view echo $form-create('MyForm', array('controller'='foo', 'action' = 'bar')); echo $form-end('My button'); in your foo_controller: function bar(){ $this-render('theViewYouWantToRender'); } On 11 February 2010 09:17, sebb86 kahlc...@googlemail.com wrote: Jeremy Thanks for your answer. But actually i'd like to create a button (not a button-picture), which links to a view. I don't want to add a picture, because every button would have an other description. So is this possible to realize or must i create lots of pictures? ;-) 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.comcake-php%2bunsubscr...@googlegroups.comFor more options, visit this group at http://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: How to include a button which links to a view?
Why you want to use a button? Buttons must be used when your sending a post request to the server (and this request should change something in the app) When what you want is just do a get request, you should use links (you can style it as a button if you want) anl On Thu, Feb 11, 2010 at 3:02 PM, Guillermo Mansilla mansil...@gmail.comwrote: You have to create your button and lock it inside a form which points to a controller action that renders a view. in your view echo $form-create('MyForm', array('controller'='foo', 'action' = 'bar')); echo $form-end('My button'); in your foo_controller: function bar(){ $this-render('theViewYouWantToRender'); } On 11 February 2010 09:17, sebb86 kahlc...@googlemail.com wrote: Jeremy Thanks for your answer. But actually i'd like to create a button (not a button-picture), which links to a view. I don't want to add a picture, because every button would have an other description. So is this possible to realize or must i create lots of pictures? ;-) 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.comcake-php%2bunsubscr...@googlegroups.comFor more options, visit this group at http://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.comcake-php%2bunsubscr...@googlegroups.comFor more options, visit this group at http://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: How to include a button which links to a view?
Yes you are right, but since he said he needed a button I told him how to use it to achieve what he wanted. But in theory you are right he should use a link and apply some style, however that link will have to point to a controller function which renders a desired view, just like I told him. ;-) On 11 February 2010 09:39, anl hp anle...@gmail.com wrote: Why you want to use a button? Buttons must be used when your sending a post request to the server (and this request should change something in the app) When what you want is just do a get request, you should use links (you can style it as a button if you want) anl On Thu, Feb 11, 2010 at 3:02 PM, Guillermo Mansilla mansil...@gmail.comwrote: You have to create your button and lock it inside a form which points to a controller action that renders a view. in your view echo $form-create('MyForm', array('controller'='foo', 'action' = 'bar')); echo $form-end('My button'); in your foo_controller: function bar(){ $this-render('theViewYouWantToRender'); } On 11 February 2010 09:17, sebb86 kahlc...@googlemail.com wrote: Jeremy Thanks for your answer. But actually i'd like to create a button (not a button-picture), which links to a view. I don't want to add a picture, because every button would have an other description. So is this possible to realize or must i create lots of pictures? ;-) 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.comcake-php%2bunsubscr...@googlegroups.comFor more options, visit this group at http://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.comcake-php%2bunsubscr...@googlegroups.comFor more options, visit this group at http://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.comcake-php%2bunsubscr...@googlegroups.comFor more options, visit this group at http://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: How to include a button which links to a view?
@Guillermo: Sorry, the message was for him! what you say is the correct way of do it no matter what ^^ anl On Thu, Feb 11, 2010 at 3:13 PM, Guillermo Mansilla mansil...@gmail.comwrote: Yes you are right, but since he said he needed a button I told him how to use it to achieve what he wanted. But in theory you are right he should use a link and apply some style, however that link will have to point to a controller function which renders a desired view, just like I told him. ;-) On 11 February 2010 09:39, anl hp anle...@gmail.com wrote: Why you want to use a button? Buttons must be used when your sending a post request to the server (and this request should change something in the app) When what you want is just do a get request, you should use links (you can style it as a button if you want) anl On Thu, Feb 11, 2010 at 3:02 PM, Guillermo Mansilla mansil...@gmail.comwrote: You have to create your button and lock it inside a form which points to a controller action that renders a view. in your view echo $form-create('MyForm', array('controller'='foo', 'action' = 'bar')); echo $form-end('My button'); in your foo_controller: function bar(){ $this-render('theViewYouWantToRender'); } On 11 February 2010 09:17, sebb86 kahlc...@googlemail.com wrote: Jeremy Thanks for your answer. But actually i'd like to create a button (not a button-picture), which links to a view. I don't want to add a picture, because every button would have an other description. So is this possible to realize or must i create lots of pictures? ;-) 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.comcake-php%2bunsubscr...@googlegroups.comFor more options, visit this group at http://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.comcake-php%2bunsubscr...@googlegroups.comFor more options, visit this group at http://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.comcake-php%2bunsubscr...@googlegroups.comFor more options, visit this group at http://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.comcake-php%2bunsubscr...@googlegroups.comFor more options, visit this group at http://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: How to include a button which links to a view?
@sebb86: You should read something about RESTful applications, will help you how to think about the correct way of send or get data from the server ;) anl On Thu, Feb 11, 2010 at 3:16 PM, mike karthauser mi...@brightstorm.co.ukwrote: even simpler would be to use a standard ?php echo $html-link('foo',array('controller'='some controller', 'action'='some action')); ? and just style the anchor in css. ie a { border:1px solid #000; padding:5px} its a bit epic to have to create forms to make buttons considering you are not passing any data to the pages and just need to affect the presentation of the link. On Thu, 2010-02-11 at 09:32 -0430, Guillermo Mansilla wrote: You have to create your button and lock it inside a form which points to a controller action that renders a view. in your view echo $form-create('MyForm', array('controller'='foo', 'action' = 'bar')); echo $form-end('My button'); in your foo_controller: function bar(){ $this-render('theViewYouWantToRender'); } On 11 February 2010 09:17, sebb86 kahlc...@googlemail.com wrote: Jeremy Thanks for your answer. But actually i'd like to create a button (not a button-picture), which links to a view. I don't want to add a picture, because every button would have an other description. So is this possible to realize or must i create lots of pictures? ;-) 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.comcake-php%2bunsubscr...@googlegroups.comFor more options, visit this group at http://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.comcake-php%2bunsubscr...@googlegroups.comFor more options, visit this group at http://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
https links not working
Hi I'd like to access my cakephp based web site also using https, but I always get an error saying that the requested url is not found on the server. Note that apache is configured to serve also https requests and it works with other pages... is there anything to set somewhere? thanks in advance Lorenzo -- Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.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: model links, question from noob.
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: How to include a button which links to a view?
Hello all, thanks for all your answers. After reading all your answers, i've decided to use a image, which links to a page. Could someone help me to add a warning-message, e.g. when i delete something??? Here is my image/link code from the view: [code] ?php echo $html-image(delete.png, array(alt = delete, 'url' = array('controller' = 'hardware_units', 'action' = 'delete', 'id' = $hardware_unit['HardwareUnit']['id'])));? [\code] And my delete function in the controller: [code] function delete($id) { $this-HardwareUnit-del($id); $this-Session-setFlash('hardware unit with id: '.$id.' has been deleted'); $this-redirect(array ('action' = 'index')); } [\code] 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 include a button which links to a view?
you already did with this line $this-Session-setFlash('hardware unit with id: '.$id.' has been deleted'); make sure you have set up the session messages var in your layout On 11 February 2010 11:25, sebb86 kahlc...@googlemail.com wrote: Hello all, thanks for all your answers. After reading all your answers, i've decided to use a image, which links to a page. Could someone help me to add a warning-message, e.g. when i delete something??? Here is my image/link code from the view: [code] ?php echo $html-image(delete.png, array(alt = delete, 'url' = array('controller' = 'hardware_units', 'action' = 'delete', 'id' = $hardware_unit['HardwareUnit']['id'])));? [\code] And my delete function in the controller: [code] function delete($id) { $this-HardwareUnit-del($id); $this-Session-setFlash('hardware unit with id: '.$id.' has been deleted'); $this-redirect(array ('action' = 'index')); } [\code] Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: How to include a button which links to a view?
I struggled with this for while as I don't like relying on java being switched on. Here's an article I put together that borrows heavily from other contributors here. It might help. http://www.jeremy-burns.co.uk/2009/12/cakephp-adding-a-delete-confirm-function/ Jeremy Burns jeremybu...@me.com On 11 Feb 2010, at 15:55, sebb86 wrote: Hello all, thanks for all your answers. After reading all your answers, i've decided to use a image, which links to a page. Could someone help me to add a warning-message, e.g. when i delete something??? Here is my image/link code from the view: [code] ?php echo $html-image(delete.png, array(alt = delete, 'url' = array('controller' = 'hardware_units', 'action' = 'delete', 'id' = $hardware_unit['HardwareUnit']['id'])));? [\code] And my delete function in the controller: [code] function delete($id) { $this-HardwareUnit-del($id); $this-Session-setFlash('hardware unit with id: '.$id.' has been deleted'); $this-redirect(array ('action' = 'index')); } [\code] Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: inflector - class methods - slug ????
Case Solved!! Thank you everyone!! On 11 Fev, 07:33, Martin Westin martin.westin...@gmail.com wrote: Just my personal opinion: Making changes to the core has really not been a problem for me since I put Cake into a Git repo. I just have a branch with my changes in it and Git takes care of the merging. On Feb 10, 11:20 pm, jodator joda...@gmail.com wrote: 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
sanitize and redirect
Hello, Just a doubt. It looks like Cake takes care of sanitizing data in save and find, ie. Do I need to sanitize $id when using $this-redirect(array('action'='edit','id'=$id)); Or is there some cleaning happening inside redirect? Thanks nicolas * * * * * * * * * C O N S T A N T V Z W 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
Forge Activity Percentile
What refer Activity Percentile in Cake Forge ? SVN activities ? Wiki Activities ? Downloads ? If a project hasn't been updated since 2007 but there's a lot of download.. is it possible that the Activity Percentile is very high ? 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: sanitize and redirect
Not you don't ... because you should not worry about that, if an id is invalid and you want handle the situation elegant, you could do something like this: if (!is_numeric($id)) { $this-setFlash('ooopss, dont do that!'); $this-redirect(); } anl On Thu, Feb 11, 2010 at 7:05 PM, Nicolas Maleve nico...@constantvzw.comwrote: Hello, Just a doubt. It looks like Cake takes care of sanitizing data in save and find, ie. Do I need to sanitize $id when using $this-redirect(array('action'='edit','id'=$id)); Or is there some cleaning happening inside redirect? Thanks nicolas * * * * * * * * * C O N S T A N T V Z W 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.comcake-php%2bunsubscr...@googlegroups.comFor more options, visit this group at http://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
ajax request using default.ctp instead of ajax.ctp
The below ajax request works well, but it's using default.ctp as layout file instad of ajax.ctp. How can I tell it to use ajax.ctp as layout file? thanks ? $options = array( 'url'=array( 'controller'='items', 'action'='view', 'before'='startLoading()', $item['Item']['id'] ), 'update'='item_view'); ? ? echo $ajax-link('Show the details now','/items/ view/'.$item['Item']['id'],$options);? 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: ajax request using default.ctp instead of ajax.ctp
In your items controller, you have to set the layout, when you detect that it is an AJAX request that you are processing. See how to detect this at http://book.cakephp.org/view/350/Obtaining-Request-Information And here for the layout http://book.cakephp.org/view/51/Controller-Attributes#Page-related-Attributes-layout-and-pageTitle-54 Enjoy, John On Feb 11, 9:22 pm, NickPick dickreu...@yahoo.com wrote: The below ajax request works well, but it's using default.ctp as layout file instad of ajax.ctp. How can I tell it to use ajax.ctp as layout file? thanks ? $options = array( 'url'=array( 'controller'='items', 'action'='view', 'before'='startLoading()', $item['Item']['id'] ), 'update'='item_view'); ? ? echo $ajax-link('Show the details now','/items/ view/'.$item['Item']['id'],$options);? 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
All tests report Fatal error: Call to undefined method stdClass::find() in /var/www/...
I just got done baking my Models and test cases, and have not altered any of the files generated by the bake. When I run the test cases for my models, I get the above error message. Any ideas? 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.
Great, you saved me a lot of time! And to answer your question, well i just missed it, yes, it's more logical to name that field category_id On 11 фев, 19:41, jodator joda...@gmail.com wrote: 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
Caching isn't working in controller
Hello, I've got a weird problem. I'm trying to cache a action: class UsersController extends AppController { var $name = 'Users'; var $components = array('Email', 'Recaptcha', 'Country'); var $helpers = array('Cache'); var $cacheAction = array('xmlForSwift/' = '100'); The 100 is only a test - but it isn't working. Caching is activated and for elements it is working but not for actions. Do you have any ideas? Thank you! -Bennet 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 isn't working in controller
I have the same problem. I have activated caching in core.php, I have created the tmp/* folders for cache, the folders are writtable, but for some reason, it just won't work. I have tested it on Cake 1.2.5 and 1.2.6 On Feb 11, 9:57 pm, Bennet Jeutter bennet.jeut...@gmail.com wrote: Hello, I've got a weird problem. I'm trying to cache a action: class UsersController extends AppController { var $name = 'Users'; var $components = array('Email', 'Recaptcha', 'Country'); var $helpers = array('Cache'); var $cacheAction = array('xmlForSwift/' = '100'); The 100 is only a test - but it isn't working. Caching is activated and for elements it is working but not for actions. Do you have any ideas? Thank you! -Bennet 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 include a button which links to a view?
Guillermo No, i'd like something like a pop-up warning window, which says: are you sure?. On 11 Feb., 16:57, Guillermo Mansilla mansil...@gmail.com wrote: you already did with this line $this-Session-setFlash('hardware unit with id: '.$id.' has been deleted'); make sure you have set up the session messages var in your layout On 11 February 2010 11:25, sebb86 kahlc...@googlemail.com wrote: Hello all, thanks for all your answers. After reading all your answers, i've decided to use a image, which links to a page. Could someone help me to add a warning-message, e.g. when i delete something??? Here is my image/link code from the view: [code] ?php echo $html-image(delete.png, array(alt = delete, 'url' = array('controller' = 'hardware_units', 'action' = 'delete', 'id' = $hardware_unit['HardwareUnit']['id'])));? [\code] And my delete function in the controller: [code] function delete($id) { $this-HardwareUnit-del($id); $this-Session-setFlash('hardware unit with id: '.$id.' has been deleted'); $this-redirect(array ('action' = 'index')); } [\code] 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 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 include a button which links to a view?
Addition: this works with the $hrml-link but not with $html-image. :-( [code] ?php echo $html-link('Delete', array('action' = 'delete', 'id' = $hardware_unit['HardwareUnit']['id']), null, 'Sind sie sicher?'); ? [/code] 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
Getting values from drop down select
I want to get value from a table to be populated in drop down select in a form. Here's the table and the fields for example: States fields:id, name In add function in StatesController, I add this piece of code (as I learnt from the tutorial): $state = $this-State-find('list'); $this-set('states',$state); and I add this code in my view: echo $form-select('state', array($states)); when I debug the value of state drop down select, what I get is the id of state, not the name...what I want is the name, not the id..How can I do that ? Any help would be appreciated.. Thanks... -- View this message in context: http://old.nabble.com/Getting-values-from-drop-down-select-tp27557819p27557819.html 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: Powered by CakePHP logos?
Still wondering if anyone knows of any collections or uses any different cake icons... 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: ajax request using default.ctp instead of ajax.ctp
thanks. that worked. On Feb 11, 7:38 pm, John Andersen j.andersen...@gmail.com wrote: In your items controller, you have to set the layout, when you detect that it is an AJAX request that you are processing. See how to detect this athttp://book.cakephp.org/view/350/Obtaining-Request-Information And here for the layouthttp://book.cakephp.org/view/51/Controller-Attributes#Page-related-At... Enjoy, John On Feb 11, 9:22 pm, NickPick dickreu...@yahoo.com wrote: The below ajax request works well, but it's using default.ctp as layout file instad of ajax.ctp. How can I tell it to use ajax.ctp as layout file? thanks ? $options = array( 'url'=array( 'controller'='items', 'action'='view', 'before'='startLoading()', $item['Item']['id'] ), 'update'='item_view'); ? ? echo $ajax-link('Show the details now','/items/ view/'.$item['Item']['id'],$options);? 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: ajax request using default.ctp instead of ajax.ctp
Simple include of RequestHandler component will do all automagically. On Feb 12, 9:17 am, NickPick dickreu...@yahoo.com wrote: thanks. that worked. On Feb 11, 7:38 pm, John Andersen j.andersen...@gmail.com wrote: In your items controller, you have to set the layout, when you detect that it is an AJAX request that you are processing. See how to detect this athttp://book.cakephp.org/view/350/Obtaining-Request-Information And here for the layouthttp://book.cakephp.org/view/51/Controller-Attributes#Page-related-At... Enjoy, John On Feb 11, 9:22 pm, NickPick dickreu...@yahoo.com wrote: The below ajax request works well, but it's using default.ctp as layout file instad of ajax.ctp. How can I tell it to use ajax.ctp as layout file? thanks ? $options = array( 'url'=array( 'controller'='items', 'action'='view', 'before'='startLoading()', $item['Item']['id'] ), 'update'='item_view'); ? ? echo $ajax-link('Show the details now','/items/ view/'.$item['Item']['id'],$options);? 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: Getting values from drop down select
$states = $this-State-find('list', array ('fields' = array ('name', 'name'))); $form-select('state'); On Feb 12, 8:18 am, aveev nashrullah_a...@yahoo.com wrote: I want to get value from a table to be populated in drop down select in a form. Here's the table and the fields for example: States fields:id, name In add function in StatesController, I add this piece of code (as I learnt from the tutorial): $state = $this-State-find('list'); $this-set('states',$state); and I add this code in my view: echo $form-select('state', array($states)); when I debug the value of state drop down select, what I get is the id of state, not the name...what I want is the name, not the id..How can I do that ? Any help would be appreciated.. Thanks... -- View this message in context:http://old.nabble.com/Getting-values-from-drop-down-select-tp27557819... 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: Getting values from drop down select
it works.. thanks dr loboto Dr. Loboto wrote: $states = $this-State-find('list', array ('fields' = array ('name', 'name'))); $form-select('state'); On Feb 12, 8:18 am, aveev nashrullah_a...@yahoo.com wrote: I want to get value from a table to be populated in drop down select in a form. Here's the table and the fields for example: States fields:id, name In add function in StatesController, I add this piece of code (as I learnt from the tutorial): $state = $this-State-find('list'); $this-set('states',$state); and I add this code in my view: echo $form-select('state', array($states)); when I debug the value of state drop down select, what I get is the id of state, not the name...what I want is the name, not the id..How can I do that ? Any help would be appreciated.. Thanks... -- View this message in context:http://old.nabble.com/Getting-values-from-drop-down-select-tp27557819... 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 -- View this message in context: http://old.nabble.com/Getting-values-from-drop-down-select-tp27557819p27558790.html 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
SSL and https
I am using the security component from app_controller. In some controllers I have this in my beforeFilter: if (in_array($this-params['action'], $action)): $this-Security-blackHoleCallback = 'forceSSL'; $this-Security-requireSecure(); else: $this-Security-blackHoleCallback = 'unforceSSL'; endif; I have these two functions in app_controller: function forceSSL() { $this-redirect('https://' . env('SERVER_NAME') . $this-here); } function unforceSSL() { $this-redirect('http://' . env('SERVER_NAME') . $this-here); } This is working in the sense that the right actions in the right controllers are being redirected to https. But once I am in https, I stay there. My question is: how do I get the site to go back to http for those controller actions that do not require https? 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
Information
Sir/Madam Here i would like to inform you that Orangesharkteam.com is always sending some unwanted mails using my mail id without my knowledge. so i kindly request you that if you receive those mails please ignore that. sorry for this inconvenience. -- Thanks with Regards, M.Karthik MCA 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
Metadata plugin for CakePHP 1.3+
all, if you have ever needed a way to store arbitrary non-schema data for your models, then i have made a solution for you. i'd like to introduce my new plugin for cakephp 1.3+: Metadata Plugin. to learn more about what it can do and how it works, take a look at http://jmcneese.wordpress.com/2010/02/11/whats-this-data-about-data/ happy baking! joshua mcneese 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