本文整理汇总了PHP中Department::getDepartmentsAssocForUsername方法的典型用法代码示例。如果您正苦于以下问题:PHP Department::getDepartmentsAssocForUsername方法的具体用法?PHP Department::getDepartmentsAssocForUsername怎么用?PHP Department::getDepartmentsAssocForUsername使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Department
的用法示例。
在下文中一共展示了Department::getDepartmentsAssocForUsername方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
/**
* (non-PHPdoc)
* @see UI::display()
*/
public static function display()
{
// Get the list of departments the current user has access to
PHPWS_Core::initModClass('intern', 'Department.php');
$departments = Department::getDepartmentsAssocForUsername(Current_User::getUsername());
$renderedDepts = '';
foreach ($departments as $key => $val) {
$renderedDepts .= PHPWS_Template::process(array('ID' => $key, 'DEPT' => $val), 'intern', 'facultySelectOption.tpl');
}
$tpl = array();
$tpl['FACULTY_EDIT'] = javascriptMod('intern', 'facultyEdit', array('DEPTS' => $renderedDepts));
return PHPWS_Template::process($tpl, 'intern', 'editFaculty.tpl');
}
示例2: buildInternshipForm
//.........这里部分代码省略.........
/*****************************
* Undergrad Major Drop Down *
*/
if (isset($this->intern)) {
$majors = Major::getMajorsAssoc($this->intern->ugrad_major);
} else {
$majors = Major::getMajorsAssoc();
}
$this->form->addSelect('ugrad_major', $majors);
$this->form->setLabel('ugrad_major', 'Undergraduate Majors & Certificate Programs');
$this->form->addCssClass('ugrad_major', 'form-control');
/****************************
* Graduate Major Drop Down *
*/
if (isset($this->intern)) {
$progs = GradProgram::getGradProgsAssoc($this->intern->grad_prog);
} else {
$progs = GradProgram::getGradProgsAssoc();
}
$this->form->addSelect('grad_prog', $progs);
$this->form->setLabel('grad_prog', 'Graduate Majors & Certificate Programs');
$this->form->addCssClass('grad_prog', 'form-control');
/************************
* Department Drop Down *
*/
if (Current_User::isDeity()) {
if (!is_null($this->intern)) {
$depts = Department::getDepartmentsAssoc($this->intern->department_id);
} else {
$depts = Department::getDepartmentsAssoc();
}
} else {
if (!is_null($this->intern)) {
$depts = Department::getDepartmentsAssocForUsername(Current_User::getUsername(), $this->intern->department_id);
} else {
$depts = Department::getDepartmentsAssocForUsername(Current_User::getUsername());
}
}
$this->form->addSelect('department', $depts);
$this->form->setLabel('department', 'Department');
$this->form->addCssClass('department', 'form-control');
// If the user only has one department, select it for them
// sizeof($depts) == 2 because of the 'Select Deparmtnet' option
if (sizeof($depts) == 2) {
$keys = array_keys($depts);
$this->form->setMatch('department', $keys[1]);
}
/********************
* Faculty Member Dropdown
*
* The options for this drop down are provided through AJAX on page-load and
* when the user changes the department dropdown above.
*/
$this->form->addSelect('faculty', array(-1 => 'Select Faculty Advisor'));
$this->form->setExtra('faculty', 'disabled');
$this->form->setLabel('faculty', 'Faculty Advisor / Instructor of Record');
$this->form->addCssClass('faculty', 'form-control');
// Hidden field for selected faculty member
$this->form->addHidden('faculty_id');
/***************
* Agency info *
*/
$this->form->addText('agency_name');
$this->form->setLabel('agency_name', 'Agency Name');
$this->form->addCssClass('agency_name', 'form-control');
$this->form->addCheck('copy_address_agency');
示例3: display
public static function display()
{
PHPWS_Core::initModClass('intern', 'Term.php');
PHPWS_Core::initModClass('intern', 'Department.php');
PHPWS_Core::initModClass('intern', 'Major.php');
PHPWS_Core::initModClass('intern', 'GradProgram.php');
PHPWS_Core::initModClass('intern', 'Internship.php');
PHPWS_Core::initModClass('intern', 'Agency.php');
PHPWS_Core::initModClass('intern', 'Subject.php');
PHPWS_Core::initModClass('intern', 'WorkflowStateFactory.php');
// Set up search fields
$form = new PHPWS_Form();
$form->setMethod('get');
$form->addHidden('module', 'intern');
$form->addHidden('action', 'results');
$form->useRowRepeat();
$form->addText('name');
$form->setLabel('name', "Name or Banner ID");
$terms = Term::getTermsAssoc();
//$thisTerm = Term::timeToTerm(time());
$form->addSelect('term_select', $terms);
$form->setLabel('term_select', 'Term');
$form->setClass('term_select', 'form-control');
//$form->setMatch('term_select', $thisTerm);
// Deity can search for any department. Other users are restricted.
if (Current_User::isDeity()) {
$depts = Department::getDepartmentsAssoc();
} else {
$depts = Department::getDepartmentsAssocForUsername(Current_User::getUsername());
}
$form->addSelect('dept', $depts);
$form->setLabel('dept', 'Department');
//$form->setClass('', 'form-control');
$form->setClass('dept', 'form-control');
// If the user only has one department, select it for them
// sizeof($depts) == 2 because of the 'Select Deparmtnet' option
if (sizeof($depts) == 2) {
$keys = array_keys($depts);
$form->setMatch('dept', $keys[1]);
}
// Student level radio button
javascript('jquery');
javascriptMod('intern', 'majorSelector', array('form_id' => $form->id));
$levels = array('-1' => 'Any Level', 'ugrad' => 'Undergraduate', 'grad' => 'Graduate');
$form->addSelect('student_level', $levels);
$form->setLabel('student_level', 'Level');
$form->setClass('student_level', 'form-control');
// Student Major dummy box (gets replaced by dropdowns below using JS when student_level is selected)
$levels = array('-1' => 'Choose student level first');
$form->addDropBox('student_major', $levels);
$form->setLabel('student_major', 'Major / Program');
$form->addCssClass('student_major', 'form-control');
// Undergrad major drop down
if (isset($s)) {
$majors = Major::getMajorsAssoc($s->ugrad_major);
} else {
$majors = Major::getMajorsAssoc();
}
$form->addSelect('ugrad_major', $majors);
$form->setLabel('ugrad_major', 'Undergraduate Majors & Certificate Programs');
$form->setClass('ugrad_major', 'form-control');
// Graduate major drop down
if (isset($s)) {
$progs = GradProgram::getGradProgsAssoc($s->grad_prog);
} else {
$progs = GradProgram::getGradProgsAssoc();
}
$form->addSelect('grad_prog', $progs);
$form->setLabel('grad_prog', 'Graduate Majors & Certificate Programs');
$form->setClass('grad_prog', 'form-control');
// Campus
$campuses = array('main_campus' => 'Main Campus', 'distance_ed' => 'Distance Ed');
$form->addRadioAssoc('campus', $campuses);
/***************
* Course Info *
***************/
$subjects = Subject::getSubjects();
$form->addSelect('course_subj', $subjects);
$form->setLabel('course_subj', 'Subject');
$form->setClass('course_subj', 'form-control');
$form->addText('course_no');
$form->setLabel('course_no', 'Course Number');
$form->setSize('course_no', 6);
$form->setMaxSize('course_no', 4);
$form->setClass('course_no', 'form-control');
$form->addText('course_sect');
$form->setLabel('course_sect', 'Section');
$form->setSize('course_sect', 6);
$form->setMaxSize('course_sect', 4);
$form->setClass('course_sect', 'form-control');
// Internship types.
$types = Internship::getTypesAssoc();
$form->addRadioAssoc('type', $types);
// Location
$loc = array('domestic' => 'Domestic', 'internat' => 'International');
$form->addRadioAssoc('loc', $loc);
/* State search */
$db = new PHPWS_DB('intern_state');
$db->addWhere('active', 1);
$db->addColumn('abbr');
//.........这里部分代码省略.........