]> git.mjollnir.org Git - moodle.git/commitdiff
merged fixing empty <option/>
authortoyomoyo <toyomoyo>
Fri, 16 Mar 2007 02:33:28 +0000 (02:33 +0000)
committertoyomoyo <toyomoyo>
Fri, 16 Mar 2007 02:33:28 +0000 (02:33 +0000)
admin/roles/assign.html

index 44e1c94d666aed9387940a875a50264adeedb9ad..444b304cda2b618fd8110fcb3d856af4fa4e8122 100755 (executable)
                            getElementById('assignform').addselect.selectedIndex=-1;">
 
           <?php
-              foreach ($contextusers as $contextuser) {
-                  $fullname = fullname($contextuser, true);
-                  if ($contextuser->hidden) {
-                      $hidden=' ('.get_string('hiddenassign').') ';
-                  } else {
-                      $hidden="";
-                  }
-                  echo "<option value=\"$contextuser->id\">".$fullname.", ".$contextuser->email.$hidden."</option>\n";
-              }
+            $i = 0;
+            foreach ($contextusers as $contextuser) {
+                $fullname = fullname($contextuser, true);
+                if ($contextuser->hidden) {
+                    $hidden=' ('.get_string('hiddenassign').') ';
+                } else {
+                    $hidden="";
+                }
+                echo "<option value=\"$contextuser->id\">".$fullname.", ".$contextuser->email.$hidden."</option>\n";
+                $i++;    
+            }
+            if ($i==0) {
+                echo '<option/>'; // empty select breaks xhtml strict
+            }
           ?>
-          <option/>
+          
           </select></td>
       <td valign="top">
         <br />
                            getElementById('assignform').remove.disabled=true;
                            getElementById('assignform').removeselect.selectedIndex=-1;">
           <?php
+            $i=0;
+            if (!empty($searchtext)) {
+                echo "<optgroup label=\"$strsearchresults (" . $availableusers->_numOfRows . ")\">\n";
+                while ($user = rs_fetch_next_record($availableusers)) {
+                    if (!isset($contextusers[$user->id])) {
+                        $fullname = fullname($user, true);
+                        echo "<option value=\"$user->id\">".$fullname.", ".$user->email."</option>\n";
+                        $i++;
+                    }
+                }
+                echo "</optgroup>\n";
 
-              if (!empty($searchtext)) {
-                  echo "<optgroup label=\"$strsearchresults (" . $availableusers->_numOfRows . ")\">\n";
-                  while ($user = rs_fetch_next_record($availableusers)) {
-                      if (!isset($contextusers[$user->id])) {
-                          $fullname = fullname($user, true);
-                          echo "<option value=\"$user->id\">".$fullname.", ".$user->email."</option>\n";
-                      }
-                  }
-                  echo "</optgroup>\n";
-
-              } else {
-                  if ($usercount > MAX_USERS_PER_PAGE) {
-                      echo '<optgroup label="'.get_string('toomanytoshow').'"><option></option></optgroup>'."\n"
+            } else {
+                if ($usercount > MAX_USERS_PER_PAGE) {
+                    echo '<optgroup label="'.get_string('toomanytoshow').'"><option></option></optgroup>'."\n"
                           .'<optgroup label="'.get_string('trysearching').'"><option></option></optgroup>'."\n";
-                  } else {
-                      while ($user = rs_fetch_next_record($availableusers)) {
-                          if (!isset($contextusers[$user->id])) {
-                              $fullname = fullname($user, true);
-                              echo "<option value=\"$user->id\">".$fullname.", ".$user->email."</option>\n";
-                          }
-                      }
-                  }
-              }
+                } else {
+                    while ($user = rs_fetch_next_record($availableusers)) {
+                        if (!isset($contextusers[$user->id])) {
+                            $fullname = fullname($user, true);
+                            echo "<option value=\"$user->id\">".$fullname.", ".$user->email."</option>\n";
+                            $i++;
+                        }
+                    }
+                }
+            }
+            if ($i==0) {
+                echo '<option/>'; // empty select breaks xhtml strict
+            }
           ?>
-         <option/>
          </select>
          <br />
          <label for="searchtext" class="accesshide"><?php p($strsearch) ?></label>