示例#1
0
 function showAssignSample()
 {
     $assignids = loadvar('assignid');
     $selurid = loadvar('selurid');
     if (sizeof($assignids) > 0 && ($selurid > 0 || $selurid == -1)) {
         //-1: back to sysadmin
         foreach ($assignids as $id) {
             //sysadmin mode: change on server 'only'
             $household = new Household($id);
             $household->setUrid($selurid);
             $household->saveChanges();
             $respondents = $household->getRespondents();
             foreach ($respondents as $respondent) {
                 $respondent->setUrid($selurid);
                 $respondent->saveChanges();
             }
             $communication = new Communication();
             $communication->assignHousehold($household, $selurid);
         }
         if (dbConfig::defaultPanel() == PANEL_HOUSEHOLD) {
             $message = Language::labelSupervisorHouseholdAssigned();
         } else {
             $message = Language::labelSupervisorRespondentAssigned();
         }
     } else {
         if (dbConfig::defaultPanel() == PANEL_HOUSEHOLD) {
             $message = Language::labelSupervisorHouseholdsNotAssigned();
         } else {
             $message = Language::labelSupervisorRespondentsNotAssigned();
         }
     }
     $display = new Display();
     return $this->showUnassignedSample($display->displayInfo($message));
 }