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

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

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 option ... selected to select an item. However, how can I

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

Why my observeField does not work properly?

2007-12-10 Thread Steveston
In view: ?php echo $html-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'); ? div id=err ?php echo

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, Steveston [EMAIL PROTECTED] wrote

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

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

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

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

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 current database: 1. CourseComment 2. CourseInstructor

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

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

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

Re: left right codes in ACL

2007-11-09 Thread Steveston
, Steveston [EMAIL PROTECTED] wrote: 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

Re: left right codes in ACL

2007-11-09 Thread Steveston
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 explanation on manual about it. On Nov 9, 11:07 am, [EMAIL PROTECTED] [EMAIL

Re: left right codes in ACL

2007-11-09 Thread Steveston
://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, Steveston [EMAIL PROTECTED] wrote: No standard web pages containing all your search terms were found. Your search

Re: How a Cake app is executed?

2007-11-08 Thread Steveston
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. When visitors go to my website, what is the sequence for my cake app

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 sequence for my cake app executed

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

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

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

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. users Users is the parent table

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

2007-10-30 Thread Steveston
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 repeated from a view page. The problem now is that it will produce page header

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

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

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

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:

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

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

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) ?php

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 pre$a/pre; 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

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

$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: ?php if (!empty($access['COURSE'])) { $courseSysFunc =

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] wrote: Hi there, I am working

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']=$this-

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;

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! the method in controller

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