Re: Star Rating Help

2009-05-21 Thread Faza
I'd start with removing DB connection related settings and replace all querying to Cake functions - they all look like basic selects/inserts. Also you could divide whole this code into some controller functions to tidy it up. Or read the code, understand it, and make a helper from scratch in

Re: New cakephp site - feedback pls!

2009-05-19 Thread Faza
Nice :) I like the plain design, all seems to work smoothly. Altho, the grayish text in the Times table is a bit hard to read. Marcus Silva pisze: Hi folks, Been a while since i last posted in the group, but I have just put one of my websites online which was developed using cake...

Re: Launched a new cake app

2009-05-17 Thread Faza
Nice job! Awesome design! Made the graphics/layout yourself or you have an artist to do the artwork? Miles J pisze: I redid one of my old sites in CakePHP, it can be found here: http://www.sc2armory.com/ Another app of mine is: http://www.gamesync.com/

Re: retrieving data from another table

2009-05-17 Thread Faza
Check the Containable behavior. Helped me alot when I was dealing with complex relations on different depths. http://book.cakephp.org/view/474/Containable justclint pisze: Im pulling the data successfully but Im trying to get the name value as opposed to the id value in a separate table.

Re: last_login update

2009-05-16 Thread Faza
This is the code I'm using, works 100%. function login() { $this-layout = 'login'; if ($this-Auth-user()) { $this-User-id = $this-Auth-user('id'); $this-User-saveField('last_visit', 'now()'); $gr =

Re: Problems with belongTo and hasMany

2009-05-16 Thread Faza
or try using containable behavior: http://book.cakephp.org/view/474/Containable hahmadi82 pisze: bump --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to

Re: Check user session

2009-05-16 Thread Faza
maybe try this: function login() { if (($this-Auth-user() ) !($this-Session-read('Auth.User.online'))){ $this-Session-write('Auth.User.online', true); $this-Session-write('Auth.User.host', {function of your choice});

Re: No ID returning from the model when inserting new record

2009-05-13 Thread Faza
It's a bit weird, especially that calling the same function to edit the record returns the proper id. i use the same property with such syntax: if ($this-Design-saveAll($this-data)) { $this-notify(2,$this-Design-id);

ClassRegistry::init('ModelName') problem

2009-05-11 Thread Faza
Hi all, I've run into a weird problem. I have two models, not directly related, but I need data from model A to modify model B find results using ModelB::afterFind(); In model B, i use this: $myModelA = ClassRegistry::init('ModelA'); this returns no error. but when I do $values =

Re: ClassRegistry::init('ModelName') problem

2009-05-11 Thread Faza
','modelnameB'); 2009/5/11 Faza f...@ansi.pl Hi all, I've run into a weird problem. I have two models, not directly related, but I need data from model A to modify model B find results using ModelB::afterFind(); In model B, i use this: $myModelA = ClassRegistry::init('ModelA'); this returns

Re: ClassRegistry::init('ModelName') problem

2009-05-11 Thread Faza
Thanks for the reply, I've misunderstood the concept of model, which is only the schema layer. I wanted the model to act as controller... After reviewing the relations, I've added some containable and now I have acheived the result the proper MVC way. Flipflops pisze: Hi Faza I don't

Re: Change layout of static pages

2009-05-09 Thread Faza
Hi! Have all your .ctp layouts in app/views/layouts, and add this in your AppController: $layout = 'my_site_wide_layout'; //notice no .ctp in the value. Works for me. remember that each layout must have a $content_for_layout variable so cake will be able to parse views into this layout. For

Re: Default value of INT NOT NULL fields

2009-05-08 Thread Faza
could you post debug($this-data) from the controller after the form is submitted? Usually when I need defaults, I set them at DB-level, never bothered to have Cake set defaults for me. WebbedIT pisze: Here is my data array ... as you can see a lot of fields that a user would have to enter

Re: Auth Component require login in every page

2009-04-30 Thread Faza
I think you have forgotten to add this to controller beforeFilter(): function beforeFilter() { parent::beforeFilter(); $this-Auth-allowedActions = array('logout', 'initDB'); } http://book.cakephp.org/view/643/Preparing-to-Add-Auth also, I'm not sure but I've read

Comparing arrays

2009-04-29 Thread Faza
Hi guys, I'm curious if there is a built-in method to get an array which is a result of comparing two other arrays with the same structure? Like $a = array('k1' = 'v1', 'k2' = 'v2', 'k3' = '') $b = array('k1' = '', 'k2' = 'v2', 'k3' = 'yo momma') comparison of the two would give $c =

Re: ACL from View

2009-04-29 Thread Faza
Although not a best way to achieve this, but so far this is my method: login function stores users ACL group in Auth.user.group: $gr = $this-User-Group-findById($this-Auth-user('group_id')); $this-Session-write('Auth.User.group', $gr['Group']['name']); in view i put this: (yes, I

Re: Comparing arrays

2009-04-29 Thread Faza
Makes sense, I'll give it a try. Thanks! Brendon Kozlowski pisze: I *think* you're looking for array_diff_uassoc -- http://php.net/array_diff_uassoc On Apr 29, 2:15 pm, Faza f...@ansi.pl wrote: Hi guys, I'm curious if there is a built-in method to get an array which is a result

Re: ACL from View

2009-04-29 Thread Faza
Okay, when you remove the right, the checking function will just not return true, so in the end the expected result is achieved. Care to write up some example? sdc53 pisze: Thanks Faza - but that doesn't work because that makes the assumption in the view that the group would always have

Re: MVC PHP Framework

2009-04-29 Thread Faza
LOL their models require you to actually type the SQL queries by hand... I vote spam of the quarter... Dardo Sordi Bogado pisze: We should start giving prices like Spam of the month On Wed, Apr 29, 2009 at 6:35 AM, celeroo celeroo.analyt...@gmail.com wrote: Hi, Here is a nice simple

Re: Value from Key

2009-04-29 Thread Faza
$array[key] ?? Dave Maharaj :: WidePixels.com pisze: How can i get the value of a key? the array is from debug($requests); for example my array is: Array ( [0] = jkl [1] = ii [2] = yyy ) thanks, Dave --~--~-~--~~~---~--~~

Re: Tips for cutting queries and load time?

2009-04-25 Thread Faza
You set-up a view in your database, and then add the model as for any other table in CakePHP. Dunno about other DB's, but since few releases PostgreSQL allows INSERT/UPDATE of views. Pretty neat feature, because - if keyed correctly - you can make all relations DB-side. brian pisze: On Fri,

Re: Merge results of model-findAll with an array returned by function

2009-04-24 Thread Faza
/4/23 Faza f...@ansi.pl: Hi all, more newbie questions on the way. I have few models related (mostly $belongsTo), and one of them requires a level 3 recursion, which is not-a-very-good practice. Especially that enabling lvl 3 recursion gathers much more data from the model than I really need

Set::extract and Set::combine - help needed

2009-04-24 Thread Faza
Hello again, this is the array I'm working on: Array ( [0] = Array ( [Design] = Array ( [id] = 39 [design_no] = 1 [job_title] = gjgfjyjgyjf [expected_date] = 2009-04-14

Re: How to install cakephp

2009-04-24 Thread Faza
Hello there! I did my first install following the below tutorials: http://book.cakephp.org/view/29/Installation-Preparation http://book.cakephp.org/view/32/Installation (NB it's for Linux) Don't have any experience with CakePHP installed on Windows, so probably someone could provide a link for

Re: Set::extract and Set::combine - help needed

2009-04-24 Thread Faza
'] = $statusHistory; } Job done! hth grigri On Apr 24, 9:16 am, Faza f...@ansi.pl wrote: Hello again, this is the array I'm working on: Array (     [0] = Array         (             [Design] = Array                 (                     [id] = 39                     [design_no] = 1

Re: Tips for cutting queries and load time?

2009-04-24 Thread Faza
I use database views, at least for the view pages, if possible. It's faster to perform joins db-side, and then return just a simple view to CakePHP. My 0.02USD Dave Maharaj :: WidePixels.com pisze: I was hoping to get some general tips on how to speed up load time and cut down on the

Re: CakePHP not working - cake.generic.css not found

2009-04-24 Thread Faza
Make sure that the directory is chown to www server's user. e.g. in my Debian I did: chown -R www-data:www-data /path/to/cake/ chmod -R 755 /path/to/cake chmod -R 777 /path/to/cake/tmp Never had any permission-related issues. Nature Lover pisze: Hi! I have downloaded CakePHP latest stable

Merge results of model-findAll with an array returned by function

2009-04-23 Thread Faza
Hi all, more newbie questions on the way. I have few models related (mostly $belongsTo), and one of them requires a level 3 recursion, which is not-a-very-good practice. Especially that enabling lvl 3 recursion gathers much more data from the model than I really need. Therefore I thought

Re: Merge results of model-findAll with an array returned by function

2009-04-23 Thread Faza
Shit, i've made mistake on describing the resulting array. Of course all arrays (new, assigned, editing) are sub-arrays of [0]. sorry for the mixup Faza pisze: Hi all, more newbie questions on the way. I have few models related (mostly $belongsTo), and one of them requires a level 3

Re: Updating fields based upon a field in another table

2009-04-23 Thread Faza
want to do it using Cake or just plain good ol' SQL? Also, is it a one-timer, or is it a part of your site logic? smithtrev...@googlemail.com pisze: Hi, I have a question, if I wanted to update a foreignkey field in a table, based on a date range in another table (eg. it has an id,

Re: how can i generate a static html page with cakephp

2009-04-20 Thread Faza
First, create a model with the $useTable = false declaration: app/models/mypage.php ?php class MyPage extends AppModel { var $useTable = false; } ? Then, define an empty action in a controller, like app/controller/mypage_controller.php ?php class MyPageController extends AppController {

Selecting fields saved to Session by Auth

2009-04-07 Thread Faza
Hello! I've noticed, that by default, Auth loads and saves to Session every field from the users model, except the field designated as the one with password. In my case, the user model contains fields which I don't want to be stored in session. I've read the AuthComponent API, but so far it

Re: Using ACL in View?

2009-04-07 Thread Faza
-check(your acl info)) { $this-set('admin', true); } Then in your view you would simple check the $admin variable: if ($admin) { You html content. } Hope that helps. On Apr 6, 4:20 am, Faza f...@ansi.pl wrote: Hello all, just happily finished setup of group-based ACL in my

AJAX pop-up form - where should a newbie start?

2009-04-07 Thread Faza
Hello, this is the scenario: - I have a rather large form with some production details, blahblah. One of the inputs can contain value from over 1300 available (more to be exact, because it's ID, dimensions and layout - 5 to 7 fields each) - as it would be silly and resource-hungry to parse

Re: AJAX pop-up form - where should a newbie start?

2009-04-07 Thread faza
, 9:32 pm, Faza f...@ansi.pl wrote: Hello, this is the scenario: - I have a rather large form with some production details, blahblah. One of the inputs can contain value from over 1300 available (more to be exact, because it's ID, dimensions and layout - 5 to 7 fields each) - as it would

Re: special i18n problem

2009-04-07 Thread faza
If your database supports it, I'd suggest using views. It's much faster than re-filtering the results in Cake, especially that you can create views using SQL code on-the-fly. This way you could still use a single model but change the $uses value dynamically. (A theory, haven't tested it) Still,

Using ACL in View?

2009-04-06 Thread Faza
Hello all, just happily finished setup of group-based ACL in my app, thanks to brilliant tutorial on Cake site. Nevertheless, despite looking around I haven't found any way (known to a noob like me) to use a function similiar to $this-Acl-check() in View, for, say, hiding certain sections of