Beispiel #1
0
 /**
  * @method  check_loginuser_registrar_admin
  * @todo to display school list based logged in user (registrar, admin)     * 
  * @param boolean $schoolids_in_formofstring (used to get schoolids in the form of string)    
  * @return based on condition it returns array of objects or string type of data
  */
 public function check_loginuser_registrar_admin($schoolids_in_formofstring = false) {
     global $DB, $USER, $CFG;
     $hier1 = new hierarchy();
     //  checking of login user is admin..
     if (is_siteadmin($USER->id)) {
         $schoolid = $DB->get_records('local_school', array('visible' => 1));
        
     } else {
         //------------if registrar not assigned to any school it throws exception    
         $users = $hier1->get_manager();
         $schoolid = $hier1->get_assignedschools();
         
     } // end of else
     if (empty($schoolid)) {
         throw new schoolnotfound_exception();
     }
     if ($schoolids_in_formofstring) {
         foreach ($schoolid as $sid) {
             $temp[] = $sid->id;
         }
         $school_id = implode(',', $temp);
         return $school_id;
     } else
         return $schoolid;
 }
Beispiel #2
0
    $table->head = array(
        get_string('schoolname', 'local_collegestructure'), get_string('username', 'local_collegestructure'));
}

$table->size = array('40%', '40%', '20%');
$table->align = array('left', 'left', 'left', 'center');
$table->width = '99%';
$table->data = $data;
echo html_writer::table($table);

echo '<br/><br/>';
echo $OUTPUT->box(get_string('assignregistrartxt', 'local_collegestructure'));


$hierarchy = new hierarchy();
$users = $hierarchy->get_manager();
$PAGE->requires->js('/local/collegestructure/js/school.js');
if (!$users) {
    echo $OUTPUT->heading(get_string("nousersyet", 'local_collegestructure'));
} else {
    echo '<form id="movemodules" action="assignusers.php" method="post"><div>';
    echo '<input type="hidden" name="sesskey" value="' . sesskey() . '" />';
    echo '<table border="0" cellspacing="2" width="50%" cellpadding="4" class="generalbox boxaligncenter"><tr>';
    echo '<th class="header" align="left">' . get_string('username', 'local_collegestructure') . '</th>';
    echo '<th class="header" scope="col" align="center">' . get_string('select') . '</th>';
    echo '</tr>';

    $count = 0;
    $abletomoveusers = false;
    /* ---for now--- */