Is there a way to get a slice of many tables?

2008-10-02 Thread Steveston
For example: a typical university project, I have users, user_courses (for instructors), user_enrolls (for students), courses, events (each course have one or more events), groups (each event has one or more groups), group_members (each group has 1+ members), etc It is very common for me to get d

A question about MVC

2007-12-13 Thread Steveston
Shall I put more database operations in model or in controller. For example, suppose I need to get all students (name and ID) who registers in course 101 but did not pay mandatory lab fee. It requires at least three tables, students, course_registration, and lab_fee_payment. I can do this in con

create and getLastInsertID

2007-12-11 Thread Steveston
If I call Model->create and then Model->getLastInsertID Will I get the last inserted Id or I must actually create a db record before calling getLastInsertID? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP"

How to make options selected by default?

2007-12-11 Thread Steveston
I have two list box (A and B), and I have two buttons to move list items (options) from this box to the other.I have a submit button to submit the form. I know how to move items from A to B by using Javascript, and I know how to use to select an item. However, how can I select an item after the

observeField and app_controller

2007-12-10 Thread Steveston
In my application, whenever users input, I need to check if some fields are duplicate frequently (for example, user name, email, course title, etc). I am using AJAX to do this. The problem is, I find I am repeating a method again and again in various controllers. Basically, in my view, I have so

Re: Why my observeField does not work properly?

2007-12-10 Thread Steveston
That's it! Thanks :) On Dec 10, 2:50 am, francky06l <[EMAIL PROTECTED]> wrote: > if (!empty($a)); //I also tried isset, isset & !empty > > Is the semi column here a typo ? If not this explains the origin of > your problem > > On Dec 10, 10:29 am, St

Why my observeField does not work properly?

2007-12-10 Thread Steveston
In view: input('User/username', array('id'=>'username', 'size'=>'50')); echo $html->tagErrorMsg('User/username', 'User name must unique and contain at least 5 and no more than 8 chars'); ?> observeField('username', array('update'=>'err', 'url'=>"/users/c

Dynamic list in Cakephp, how to do?

2007-12-06 Thread Steveston
I have a list and I need to populate it either with $array1 or $array2. Both $array1 and $array2 are returned db query results. I want to have a check box. So that when I ticket the checkbox, the list will be populated with $array1; otherwise, use $array2 to populate the list. I think it is somet

$params['controller'] changes after Dispatcher->_invoke method, why?

2007-12-06 Thread Steveston
I need to use $params['controller'] in my app. Everything works fine except for one controller. It is supposed to be 'users' but it turns out to be 'courses'. I did a debug and find its call back route is: index.php -> Dispatch->dispatch -> Dispatch->_invoke -> Controller->render -> ... ... $par

Re: Error: Cake bake to generate model

2007-12-04 Thread Steveston
On Dec 4, 4:26 am, AD7six <[EMAIL PROTECTED]> wrote: > On Dec 4, 9:49 am, Steveston <[EMAIL PROTECTED]> wrote: > > > > > I am using the latest pre-beta 1.2.x version. When trying to bake > > models, get this error: > > > Possible Models based on your

Error: Cake bake to generate model

2007-12-04 Thread Steveston
I am using the latest pre-beta 1.2.x version. When trying to bake models, get this error: Possible Models based on your current database: 1. CourseComment 2. CourseInstructor 3. Course 4. Instructor 5. Source 6. TextbookComment 7. Textbook 8. User 9. UsersTextbook Enter a number from the list abo

Question about $aro->del($id=null, $cascade=true)

2007-11-14 Thread Steveston
Confused about acl. Please help, thanks a lot. When calling this method, I need to pass the id for the aro record I want to delete, right? This id is not user's id in user table, right? Shall I call this method as $aro->del(field('id','user_id=111', true)? If cascade is set to be true, other tha

How to delete an aro

2007-11-14 Thread Steveston
Can I set referential rules in database that once a user is deleted, corresponding aro's in aro table are also deleted? Or I must call $aro->del(user_id)? Thanks, --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ca

Re: left & right codes in ACL

2007-11-09 Thread Steveston
n google. > > Also, checkout another great article from a cake > perspective:http://www.ad7six.com/MiBlog/Blogs/view/Trees > > Essentially, the left and right values are what defines the tree and > the parent / child relationships. > > simon > > On Nov 9, 10:02 pm, Steve

Re: left & right codes in ACL

2007-11-09 Thread Steveston
l the Tree values for you. > > Alternatively, learn how MPTT works, and spend a lot of time doing it > all yourself. > > On Nov 9, 8:18 pm, Steveston <[EMAIL PROTECTED]> wrote: > > > If lft & right values are required, I am very surprised to see that > > there is no any

Re: left & right codes in ACL

2007-11-09 Thread Steveston
forthcoming cake > 1.2 manual... when I get round to it - sorry John!) > > Simon > > On Nov 9, 6:42 pm, Steveston <[EMAIL PROTECTED]> wrote: > > > Default values for lft & right codes in aco & aro are NULL. > > > If I do not provide lft & right val

left & right codes in ACL

2007-11-09 Thread Steveston
Default values for lft & right codes in aco & aro are NULL. If I do not provide lft & right value (just use default NULL), will ACL still work correctly? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" g

How to set this with ACL?

2007-11-08 Thread Steveston
A user can only modify his own content Admin can modify anybody's How to set this permission with ACL? group-all: Deny all group-admin: Allow all group-user: ??? Thanks, --~--~-~--~~~---~--~~ You received this message because you are subscribed to th

Re: How a Cake app is executed?

2007-11-08 Thread Steveston
Inheritance is part of Objects .. > hope this helps > > On Nov 9, 12:09 am, Steveston <[EMAIL PROTECTED]> wrote: > > > Hi there, > > > Say I have a cake app, and I have my own custom app_controller and > > app_model. I also have some components, say A,B,C. >

Re: How a Cake app is executed?

2007-11-08 Thread Steveston
1 shall be webroot/index.php On Nov 8, 3:09 pm, Steveston <[EMAIL PROTECTED]> wrote: > Hi there, > > Say I have a cake app, and I have my own custom app_controller and > app_model. I also have some components, say A,B,C. > > When visitors go to my website, what is the

How a Cake app is executed?

2007-11-08 Thread Steveston
Hi there, Say I have a cake app, and I have my own custom app_controller and app_model. I also have some components, say A,B,C. When visitors go to my website, what is the sequence for my cake app executed? I did a debug and it seems the the sequence may be: 1. webroot/app 2. dispatcher.php 3.

Re: Cannot set up referential relationship in MySQL

2007-11-04 Thread Steveston
Never mind. I found the problem. It is because I have some course_id in groups which do not exist in courses. On Nov 4, 3:50 pm, Steveston <[EMAIL PROTECTED]> wrote: > I have 6 tables > 1. course > 2. groups > 3. group_members > 4. group_events > 5. events > 6. user

Cannot set up referential relationship in MySQL

2007-11-04 Thread Steveston
I have 6 tables 1. course 2. groups 3. group_members 4. group_events 5. events 6. users "Users" is the parent table for group_members "Courses" is the parent table for groups "events" is the parent table for group_events "groups" is the parent table for group_members and group_events (Parent tab

Re: How to render one element several times in the same page without rendering multiple headers/footers ?

2007-10-29 Thread Steveston
g to do, and > why it isn't working for you. > > On Oct 30, 9:04 am, Steveston <[EMAIL PROTECTED]> wrote: > > > I have an element that I want to render repeatedly. As I cannot render > > elements directly from controller, I have to render this element > > repe

How to render one element several times in the same page without rendering multiple headers/footers ?

2007-10-29 Thread Steveston
I have an element that I want to render repeatedly. As I cannot render elements directly from controller, I have to render this element repeated from a view page. The problem now is that it will produce page header and footer repeatedly as well. How can I render an element within a page without r

How to display error (when saving data)?

2007-10-26 Thread Steveston
Hello! When saving data via a form, I can use $html->tagErrorMsg (along with invalidate function & model validation) to display error message. However, if I am not saving data via a form, how shall I display error message? For example, instead of adding one by form, I am adding many records by

cake 1.1 and 1.2

2007-10-26 Thread Steveston
Does cake 1.2 support backward compatibility for cake 1.1? Can I just download latest 1.2, extract it, copy its cake folder, delete my old cake folder, and paste the new cake folder to make my app run on the top of cake 1.2? I tried, but did not go through. Thanks, --~--~-~--~~---

1.2.0.5875 pre-beta error

2007-10-26 Thread Steveston
Just replace my old cake library with 1.2.0.5875 pre-beta's new library, got this error: Parse error: syntax error, unexpected '.', expecting '(' in C: \apache224\htdocs\cake\libs\view\helpers\ajax.php on line 723 Checked ajax.php, no syntax error, though. Any idea why? Thanks --~--~

Weird missing action error

2007-10-22 Thread Steveston
Everything worked properly last week. I did some changes and, for somehow, the application did not work properly anymore. I have two forms in my view page: echo $html->formTag("/users/listUsers"); echo $html->formTag("/users/searchUsers"); Consequently, I have two methods in the controller: fu

ob_start and Controller::render

2007-10-10 Thread Steveston
I am confused by how to make ob_start and Controller:render work together. For example, in my controller User, I have one function: addOneRecord($oneUser) { ... if ($this->User->save($this->data['User'])) $this->render('userSummary'); ... } userSummary is a HTML table

Put repeatedly rendered view in a single page

2007-10-10 Thread Steveston
I am rendering a view through $this->render('Summary'); (That view is a html table). After rendering, I will get a complete HTML page. Now, I want to render that view multiple times (i.e.: many similar tables with different contents). However, I want to put all those tables in a single complete H

Model:invalidates does not work

2007-09-27 Thread Steveston
It takes me much time to figure out why but I run out of luck. Check manual and API carefully and still cannot make it work. My codes: (in controller) if ($this->User->findByUsername($this->data['User']['username']) ) $this->User->invalidate('username'); (in view) input('User/use

How to write codes in Vendor to save time?

2007-08-17 Thread Steveston
Very frequently, I need to use codes like this to see output clearly: $a=print_r($var,true); echo "$a"; How can convert this piece of code to a program in Vendor so that I can reuse it? Thanks, --~--~-~--~~~---~--~~ You received this message because you are sub

How to pass and rephrase MySQL error (Is there a mysql_error counterpart in Cake?)

2007-08-03 Thread Steveston
My Question (Short version) Can anybody tell me how to capture MySQL error and pass it to end users? Is there something like $this->set('db_error', some-built-in-function- to-get-db-error-msg-as-a-string) in Cake? PHP has mysql_error function, which returns mysql error msg as a string. Is ther

Re: $access, what does it mean?

2007-07-31 Thread Steveston
correction: this code snippet is from /app/views/default.phtml On Jul 31, 12:32 pm, francky06l <[EMAIL PROTECTED]> wrote: > are you sure you are not using something else (that you should > mentionned) with cake ? > > On Jul 31, 5:57 pm, Steveston <[EMAIL PROTECTED]&g

$access, what does it mean?

2007-07-31 Thread Steveston
Hi there, I am working on a cake app. I find there are many instances of $access['SOME_CAPITAL_WORD'] in the /view/default.phtml Can anybody suggest me what does it mean? Thanks, The following is a piece of code: params['controller'] == 'courses' || $this->params['control

Problem with save method

2007-07-24 Thread Steveston
Please first take a look at the piece of code below: if (isset($this->data['availableInstructors'])) foreach ($this->data['availableInstructors'] as $key=> $value) { $this->UserCourse->data['user_id']=$key; $this->UserCourse->data['course_id']=$t

Validating data always fails, why?

2007-07-06 Thread Steveston
in model: var $validate = array ( //'username' => '/[0-9]{8}$/', //'student_no'=> '/[0-9]{8,9}$/', 'last_name' => '/[a-zA-Z]$/', 'first_name'=> '/[a-zA-Z]$/', //'password'=>'/^.{5,8}/', 'email'=>VALID_EMAIL ); in controller: if ($this->User->vali

Re: Help: Why I cannot save changes??

2007-07-06 Thread Steveston
Follow-up: Got it worked. On Jul 6, 9:51 am, Steveston <[EMAIL PROTECTED]> wrote: > Hi folks, > > I want to edit user's profile and save changes. It is supposed not to > be a hard task, however, I do not know why I cannot make it work. Any > help? Many thanks! >

Help: Why I cannot save changes??

2007-07-06 Thread Steveston
Hi folks, I want to edit user's profile and save changes. It is supposed not to be a hard task, however, I do not know why I cannot make it work. Any help? Many thanks! the method in controller is: function editProfile() { $id = $this->rdAuth->id; $ifChangePassword=false;