Re: how to edit multple rows in one view

2008-10-20 Thread hydra12

I'd recommend jquery instead of cake's ajax (personal preference, but
I think jquery is easier to understand than prototype).

Be careful setting all the grades to 0.  I don't know your exact
situation, but at the school where I work we give parents the ability
to see their student's grades online.  Parents get really grumpy when
their kids have a bunch of 0's for no apparent reason . . .

I've been playing with a similar concept.  I'm assuming that you have
a students table, and each student has many assignments, but also each
assignment has many students (you could also do a
hasAndBelongsToMany).  When the teacher adds an assignment, you could
loop through the students and add the assignment to each student with
a null or blank grade.  Now, you can look at a grid of grades (columns
for assignments, rows for students).  I'd use the jquery editable
plugin or something like it.  It works like this - you click on a
grade, add the grade, and it calls a cake action via jquery to update
that specific assignment grade for that specific student.

On Oct 20, 6:46 pm, teknoid <[EMAIL PROTECTED]> wrote:
> To save multiple records or multiple related models you can use
> saveAll().
>
> On Oct 20, 7:04 pm, "soldier.coder" <[EMAIL PROTECTED]>
> wrote:
>
> > On Oct 20, 3:49 pm, hydra12 <[EMAIL PROTECTED]> wrote:
>
> > > I asked about ajax because that actually makes things easier in some
> > > ways.  You can set each grade to save via ajax when the teacher moves
> > > on to the next grade.  It all happens transparently in the background,
> > > so no looping through the data.
>
> > That's pretty hot, actually.  Maybe I could add something to the code
> > that sets up weights that fills grades for categories with 0's so that
> > all changes to the grades would be edits, and then use ajax for the
> > grade edits.
>
> > Looks like I need to learn about cake's implementation of ajax.
>
> > Thanks for your insights.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: how to edit multple rows in one view

2008-10-20 Thread teknoid

To save multiple records or multiple related models you can use
saveAll().

On Oct 20, 7:04 pm, "soldier.coder" <[EMAIL PROTECTED]>
wrote:
> On Oct 20, 3:49 pm, hydra12 <[EMAIL PROTECTED]> wrote:
>
> > I asked about ajax because that actually makes things easier in some
> > ways.  You can set each grade to save via ajax when the teacher moves
> > on to the next grade.  It all happens transparently in the background,
> > so no looping through the data.
>
> That's pretty hot, actually.  Maybe I could add something to the code
> that sets up weights that fills grades for categories with 0's so that
> all changes to the grades would be edits, and then use ajax for the
> grade edits.
>
> Looks like I need to learn about cake's implementation of ajax.
>
> Thanks for your insights.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: how to edit multple rows in one view

2008-10-20 Thread soldier.coder



On Oct 20, 3:49 pm, hydra12 <[EMAIL PROTECTED]> wrote:

> I asked about ajax because that actually makes things easier in some
> ways.  You can set each grade to save via ajax when the teacher moves
> on to the next grade.  It all happens transparently in the background,
> so no looping through the data.

That's pretty hot, actually.  Maybe I could add something to the code
that sets up weights that fills grades for categories with 0's so that
all changes to the grades would be edits, and then use ajax for the
grade edits.

Looks like I need to learn about cake's implementation of ajax.


Thanks for your insights.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: how to edit multple rows in one view

2008-10-20 Thread hydra12

There isn't any built-in functionality.  When you submit your data,
debug $this->data to see what was sent in.  Then do loop through the
data and save each grade individually.  Here's the catch - you have to
set the id to null each time you save a new row, or each new row will
overwrite the last one.  Editing is a different ballgame.  Then you
just have to make sure you are using the correct id for each grade.

I asked about ajax because that actually makes things easier in some
ways.  You can set each grade to save via ajax when the teacher moves
on to the next grade.  It all happens transparently in the background,
so no looping through the data.

On Oct 20, 2:40 pm, "soldier.coder" <[EMAIL PROTECTED]>
wrote:
> This doesn't have to be ajax or have any fancy transitions.  Just a
> save button would be fine.  I guess more than anything I am asking is
> there any built-in facility for saving more than one record at a time?
>
> Investigation into the grades_controller reveals
> if (!empty($this->data) {
>    $this->Grade->save($this->data);
>
> so based on that and given the grades array, can i just iterate over
> the array and change $this->data and then call
>    $this->Grade->save($this->data);
> ??
>
> On Oct 20, 1:47 pm, hydra12 <[EMAIL PROTECTED]> wrote:
>
> > This can get complicated VERY fast.  First, do you want the changes to
> > be made immediately, or does the teacher have to click a submit/save
> > button to save changes?  Second, is ajax an option?
>
> > hydra12
>
> > On Oct 20, 10:27 am, "soldier.coder"
>
> > <[EMAIL PROTECTED]> wrote:
> > > Hello coders!
>
> > > I'm trying to build a nice gradebook app, so teachers can keep of
> > > students grades.
> > > Right now, scaffolding has given me enough to enter one grade for one
> > > grade category for one student.
>
> > > The way my code is set up, teachers choose categories (like writing
> > > assignments, oral presentations, lab assignments, etc), then decide a
> > > weight for those categories, then decide a number of assignments for
> > > those categories.  This is all set up so teachers can figure out
> > > current and final grades which can either be emailed to the individual
> > > students or they can login to the website and see their grades.
>
> > > Anyway, I'd like to set up a teacher view that lets them do mass input
> > > of grades.  So after logging in, and picking the class they want to
> > > work on, it should show a table (for editing)  with one student per
> > > row and then grades for each category across the rows
>
> > > Can someone please point me toward how to set that sort of thing up?
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: how to edit multple rows in one view

2008-10-20 Thread soldier.coder

This doesn't have to be ajax or have any fancy transitions.  Just a
save button would be fine.  I guess more than anything I am asking is
there any built-in facility for saving more than one record at a time?

Investigation into the grades_controller reveals
if (!empty($this->data) {
   $this->Grade->save($this->data);

so based on that and given the grades array, can i just iterate over
the array and change $this->data and then call
   $this->Grade->save($this->data);
??


On Oct 20, 1:47 pm, hydra12 <[EMAIL PROTECTED]> wrote:
> This can get complicated VERY fast.  First, do you want the changes to
> be made immediately, or does the teacher have to click a submit/save
> button to save changes?  Second, is ajax an option?
>
> hydra12
>
> On Oct 20, 10:27 am, "soldier.coder"
>
> <[EMAIL PROTECTED]> wrote:
> > Hello coders!
>
> > I'm trying to build a nice gradebook app, so teachers can keep of
> > students grades.
> > Right now, scaffolding has given me enough to enter one grade for one
> > grade category for one student.
>
> > The way my code is set up, teachers choose categories (like writing
> > assignments, oral presentations, lab assignments, etc), then decide a
> > weight for those categories, then decide a number of assignments for
> > those categories.  This is all set up so teachers can figure out
> > current and final grades which can either be emailed to the individual
> > students or they can login to the website and see their grades.
>
> > Anyway, I'd like to set up a teacher view that lets them do mass input
> > of grades.  So after logging in, and picking the class they want to
> > work on, it should show a table (for editing)  with one student per
> > row and then grades for each category across the rows
>
> > Can someone please point me toward how to set that sort of thing up?
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: how to edit multple rows in one view

2008-10-20 Thread hydra12

This can get complicated VERY fast.  First, do you want the changes to
be made immediately, or does the teacher have to click a submit/save
button to save changes?  Second, is ajax an option?

hydra12

On Oct 20, 10:27 am, "soldier.coder"
<[EMAIL PROTECTED]> wrote:
> Hello coders!
>
> I'm trying to build a nice gradebook app, so teachers can keep of
> students grades.
> Right now, scaffolding has given me enough to enter one grade for one
> grade category for one student.
>
> The way my code is set up, teachers choose categories (like writing
> assignments, oral presentations, lab assignments, etc), then decide a
> weight for those categories, then decide a number of assignments for
> those categories.  This is all set up so teachers can figure out
> current and final grades which can either be emailed to the individual
> students or they can login to the website and see their grades.
>
> Anyway, I'd like to set up a teacher view that lets them do mass input
> of grades.  So after logging in, and picking the class they want to
> work on, it should show a table (for editing)  with one student per
> row and then grades for each category across the rows
>
> Can someone please point me toward how to set that sort of thing up?
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---