229 | | Join Table Filters |
| 229 | Join 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 --"; |
| 236 | foreach ($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 | }}} |
| 261 | The above is a great example, because it shows all the features of the joinTables in one example. |
| 262 | |