本文整理汇总了PHP中company::get_companies_select方法的典型用法代码示例。如果您正苦于以下问题:PHP company::get_companies_select方法的具体用法?PHP company::get_companies_select怎么用?PHP company::get_companies_select使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类company
的用法示例。
在下文中一共展示了company::get_companies_select方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_content
public function get_content()
{
global $USER, $CFG, $DB, $OUTPUT, $SESSION;
// Only display if you have the correct capability.
if (!iomad::has_capability('block/iomad_company_admin:company_add', context_system::instance())) {
return;
}
if ($this->content !== null) {
return $this->content;
}
$this->content = new stdClass();
$this->content->text = '';
$this->content->footer = '';
if (empty($this->instance)) {
return $this->content;
}
if (!isloggedin()) {
$this->content->text = get_string('pleaselogin', 'block_iomad_company_selector');
return $this->content;
}
// Check users session and profile settings to get the current editing company.
if (!empty($SESSION->currenteditingcompany)) {
$selectedcompany = $SESSION->currenteditingcompany;
} else {
if (!empty($USER->profile->company)) {
$usercompany = company::by_userid($USER->id);
$selectedcompany = $usercompany->id;
} else {
$selectedcompany = "";
}
}
// Get the company name if set.
if (!empty($selectedcompany)) {
$companyname = company::get_companyname_byid($selectedcompany);
} else {
$companyname = "";
}
// Get a list of companies.
$companylist = company::get_companies_select();
$select = new single_select(new moodle_url('/local/iomad_dashboard/index.php'), 'company', $companylist, $selectedcompany);
$select->label = get_string('selectacompany', 'block_iomad_company_selector');
$select->formid = 'choosecompany';
$fwselectoutput = html_writer::tag('div', $OUTPUT->render($select), array('id' => 'iomad_company_selector'));
$this->content->text = $OUTPUT->container_start('companyselect');
if (!empty($SESSION->currenteditingcompany)) {
$this->content->text .= '<h3>' . get_string('currentcompany', 'block_iomad_company_selector') . ' - ' . $companyname . '</h3>';
} else {
$this->content->text .= '<h3>' . get_string('nocurrentcompany', 'block_iomad_company_selector') . '</h3>';
}
$this->content->text .= $fwselectoutput;
$this->content->text .= $OUTPUT->container_end();
return $this->content;
}
示例2: definition
public function definition()
{
global $CFG;
$mform =& $this->_form;
$company = new company($this->selectedcompany);
//$departmentslist = company::get_all_departments($company->id);
$region = company::get_departmentbyid($this->departmentid);
$companieslist = company::get_companies_select();
// Then show the fields about where this block appears.
if ($this->action == 0) {
$mform->addElement('header', 'header', get_string('createregion', 'block_iomad_company_admin'));
} else {
$mform->addElement('header', 'header', get_string('editregion', 'block_iomad_company_admin'));
}
$mform->addElement('hidden', 'companyid', $this->selectedcompany);
$mform->setType('companyid', PARAM_INT);
$mform->addElement('hidden', 'action', $this->action);
$mform->setType('action', PARAM_INT);
$mform->addElement('hidden', 'departmentid', $this->departmentid);
$mform->setType('departmentid', PARAM_INT);
/* $mform->addElement('select', 'deptid', get_string('department', 'block_iomad_company_admin'), $companieslist);
$mform->disabledIf('deptid', 'action', 'eq', 1); */
$mform->addElement('text', 'fullname', get_string('fullnameregion', 'block_iomad_company_admin'), 'maxlength = "254" size = "50"');
$mform->addHelpButton('fullname', 'fullnameregion', 'block_iomad_company_admin');
$mform->addRule('fullname', get_string('missingfullnameregion', 'block_iomad_company_admin'), 'required', null, 'client');
$mform->setType('fullname', PARAM_MULTILANG);
$mform->addElement('text', 'shortname', get_string('shortnameregion', 'block_iomad_company_admin'), 'maxlength = "100" size = "20"');
$mform->addHelpButton('shortname', 'shortnameregion', 'block_iomad_company_admin');
$mform->addRule('shortname', get_string('missingshortnameregion', 'block_iomad_company_admin'), 'required', null, 'client');
$mform->setType('shortname', PARAM_MULTILANG);
//echo "departmentid".$this->departmentid;
if (!$this->departmentid) {
$mform->addElement('hidden', 'chosenid', $this->chosenid);
} else {
$mform->addElement('hidden', 'chosenid', $this->departmentid);
}
$mform->setType('chosenid', PARAM_INT);
$this->add_action_buttons();
}