Changes between Version 70 and Version 71 of AjaxList


Ignore:
Timestamp:
2010-09-08T19:22:16Z (14 years ago)
Author:
Serge Okon
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • AjaxList

    v70 v71  
    227227==== Join Table Filters ====
    228228
    229 Join Table Filters
     229Join Table Filters are used to render a drop down menu, where the user can select from a list of item the specific category of items to display. For example, it is used in iPeer to allow instructors to select which courses to display students for. In this case, the $joinTable is:
     230{{{
     231#!php
     232// Set up the course list for Ajax List
     233$courseList = array();
     234// Add in the unassigned course entry:
     235$courseList{"!!!null"} = "-- Unassigned --";
     236foreach ($userCourseList as $id => $course) {
     237    $courseList{$id} = $course['course'];
     238}
     239
     240// The course to list for is the extra filter in this case
     241$joinTables =
     242    array(
     243        array(  // Define the GUI aspecs
     244            "id"            => "course_id",
     245            "description"   => "for Course:",
     246            // What are the choises and the default values?
     247            "list"  => $courseList,
     248            "default" => $this->rdAuth->courseId,
     249            // What table do we join to get these
     250            "joinTable"     => "user_enrols",
     251            "joinModel"     => "UserEnrol",
     252            "foreignKey"    => "user_id",
     253
     254            // Any show/hide features based on maps
     255            "dependsMap"    => "User.role",    // Look to this column
     256            "dependsValues" => array("S")  // Display only when this column is one of these values
     257        )
     258    );
     259
     260}}}
     261The above is a great example, because it shows all the features of the joinTables in one example.
     262
    230263
    231264Join Table filters are created by passing a few extra fields for each table joined in the $joinTables array.
    232265
    233    array( "joinTable" => "table_name", // -- Same format as above
     266{{{
     267#!php
     268$joinTables =
     269   array( "joinTable" => "table_name", // -- Same format as the last section
    234270          "joinModel" => "JoinModel",  //   "       "
    235271           "localKey" => "local_key",   //  "       "
    236272          "foreignKey"=>"foreign_key", //   "       "
    237273          "localModel" => "LocalModel", //  "       "
    238 
     274}}}
    239275==== Data Post Processing ====
    240276