public function show_select_hall() { /* if(!Current_User::allow('hms', 'email_hall')){ return PHPWS_Template::process($tpl, 'hms', 'admin/permission_denied.tpl'); } */ PHPWS_Core::initModClass('hms', 'HMS_Residence_Hall.php'); $tpl = array(); if (Current_User::allow('hms', 'email_all')) { $halls = HMS_Residence_Hall::get_halls(HMS_Term::get_selected_term()); $form = new PHPWS_Form('select_halls_to_email'); foreach ($halls as $hall) { if ($hall->is_online != 1) { continue; } else { $form->addCheck('hall[' . $hall->id . ']', $hall->id); $form->setLabel('hall[' . $hall->id . ']', $hall->hall_name); } } $form->addHidden('type', 'notification'); $form->addHidden('op', 'edit'); $form->addSubmit('Continue'); $i = 0; $elements = $form->getTemplate(); foreach ($elements as $row) { //put the first and last elements directly into the template, not the row repeat because they are form tags if ($i == 0) { $tpl['START_FORM'] = $row; $i++; continue; } elseif ($i == sizeof($elements) - 1) { $tpl['END_FORM'] = $row; break; } //even numbered rows are checkboxes, odd are labels if ($i % 2 == 1) { $tpl['halls_list'][$i + 1]['LABEL'] = $row; } else { $tpl['halls_list'][$i]['SELECT'] = $row; } $i++; } } else { $tpl['SELECT'] = HMS_Residence_Hall::show_select_residence_hall('Select recipient Hall', 'notification', 'edit'); } return PHPWS_Template::process($tpl, 'hms', 'admin/messages.tpl'); }