本文整理汇总了PHP中company::get_all_subdepartments方法的典型用法代码示例。如果您正苦于以下问题:PHP company::get_all_subdepartments方法的具体用法?PHP company::get_all_subdepartments怎么用?PHP company::get_all_subdepartments使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类company
的用法示例。
在下文中一共展示了company::get_all_subdepartments方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: definition_after_data
/**
* Form tweaks that depend on current data.
*/
public function definition_after_data()
{
global $USER, $SESSION;
$mform =& $this->_form;
$columns =& $this->_customdata;
foreach ($columns as $column) {
if ($mform->elementExists($column)) {
$mform->removeElement($column);
}
}
// Set the companyid to bypass the company select form if possible.
if (!empty($SESSION->currenteditingcompany)) {
$companyid = $SESSION->currenteditingcompany;
} else {
$companyid = company_user::companyid();
}
// Get the department list.
$parentlevel = company::get_company_parentnode($companyid);
if (iomad::has_capability('block/iomad_company_admin:edit_all_departments', context_system::instance())) {
$userhierarchylevel = $parentlevel->id;
} else {
$userlevel = company::get_userlevel($USER);
$userhierarchylevel = $userlevel->id;
}
$this->departmentid = $userhierarchylevel;
$subhierarchieslist = company::get_all_subdepartments($userhierarchylevel);
// Department drop down.
$mform->insertElementBefore($mform->createElement('select', 'userdepartment', get_string('department', 'block_iomad_company_admin'), $subhierarchieslist, $userhierarchylevel), 'uutypelabel');
$this->courseselector = $this->add_course_selector();
$this->add_action_buttons(true, get_string('uploadusers', 'tool_uploaduser'));
}
示例2: __construct
public function __construct($actionurl, $context, $companyid, $deptid, $roleid, $showothermanagers)
{
global $USER;
$this->selectedcompany = $companyid;
$this->context = $context;
$this->departmentid = $deptid;
$this->roletype = $roleid;
/* GWL : */
if (!iomad::has_capability('block/iomad_company_admin:company_add', context_system::instance())) {
$this->showothermanagers = false;
} else {
$this->showothermanagers = $showothermanagers;
}
$company = new company($this->selectedcompany);
$parentlevel = company::get_company_parentnode($company->id);
$this->companydepartment = $parentlevel->id;
if (iomad::has_capability('block/iomad_company_admin:edit_all_departments', context_system::instance())) {
$userhierarchylevel = $parentlevel->id;
} else {
$userlevel = company::get_userlevel($USER);
$userhierarchylevel = $userlevel->id;
}
$this->subhierarchieslist = company::get_all_subdepartments($userhierarchylevel);
if ($this->departmentid == 0) {
$departmentid = $userhierarchylevel;
} else {
$departmentid = $this->departmentid;
}
$options = array('context' => $this->context, 'companyid' => $this->selectedcompany, 'departmentid' => $departmentid, 'roletype' => $this->roletype, 'subdepartments' => $this->subhierarchieslist, 'parentdepartmentid' => $parentlevel, 'showothermanagers' => $this->showothermanagers);
$this->potentialusers = new potential_department_user_selector('potentialmanagers', $options);
$this->currentusers = new current_department_user_selector('currentmanagers', $options);
parent::__construct($actionurl);
}
示例3: __construct
public function __construct($actionurl, $companyid, $departmentid)
{
global $CFG, $USER;
$this->selectedcompany = $companyid;
$this->departmentid = $departmentid;
$company = new company($this->selectedcompany);
$parentlevel = company::get_company_parentnode($company->id);
$this->companydepartment = $parentlevel->id;
if (iomad::has_capability('block/iomad_company_admin:edit_all_departments', context_system::instance())) {
$userhierarchylevel = $parentlevel->id;
} else {
$userlevel = company::get_userlevel($USER);
$userhierarchylevel = $userlevel->id;
}
$this->subhierarchieslist = company::get_all_subdepartments($userhierarchylevel);
if ($this->departmentid == 0) {
$departmentid = $userhierarchylevel;
} else {
$departmentid = $this->departmentid;
}
$this->userdepartment = $userhierarchylevel;
$options = array('context' => $this->context, 'multiselect' => true, 'companyid' => $this->selectedcompany, 'departmentid' => $departmentid, 'subdepartments' => $this->subhierarchieslist, 'parentdepartmentid' => $parentlevel, 'showopenshared' => true, 'license' => false);
$this->currentcourses = new potential_subdepartment_course_selector('currentcourses', $options);
$this->currentcourses->set_rows(20);
$this->context = context_coursecat::instance($CFG->defaultrequestcategory);
parent::moodleform($actionurl);
}
示例4: __construct
public function __construct($actionurl, $context, $companyid, $departmentid)
{
global $USER;
$this->selectedcompany = $companyid;
$this->context = $context;
$this->departmentid = $departmentid;
$company = new company($this->selectedcompany);
$parentlevel = company::get_company_parentnode($company->id);
$this->companydepartment = $parentlevel->id;
$syscontext = context_system::instance();
if (iomad::has_capability('block/iomad_company_admin:edit_all_departments', $syscontext)) {
$userhierarchylevel = $parentlevel->id;
} else {
$userlevel = company::get_userlevel($USER);
$userhierarchylevel = $userlevel->id;
}
$this->subhierarchieslist = company::get_all_subdepartments($userhierarchylevel);
if ($this->departmentid == 0) {
$departmentid = $userhierarchylevel;
} else {
$departmentid = $this->departmentid;
}
$options = array('context' => $this->context, 'companyid' => $this->selectedcompany, 'departmentid' => $departmentid, 'subdepartments' => $this->subhierarchieslist, 'parentdepartmentid' => $parentlevel, 'shared' => false, 'partialshared' => true);
$this->potentialcourses = new potential_company_course_selector('potentialcourses', $options);
$this->currentcourses = new current_company_course_selector('currentcourses', $options);
parent::__construct($actionurl);
}
示例5: __construct
public function __construct($actionurl, $context, $companyid, $departmentid, $userid, $licenseid)
{
global $USER, $DB;
$this->selectedcompany = $companyid;
$this->context = $context;
$company = new company($this->selectedcompany);
$this->parentlevel = company::get_company_parentnode($company->id);
$this->companydepartment = $this->parentlevel->id;
$this->licenseid = $licenseid;
if (iomad::has_capability('block/iomad_company_admin:edit_all_departments', context_system::instance())) {
$userhierarchylevel = $this->parentlevel->id;
} else {
$userlevel = company::get_userlevel($USER);
$userhierarchylevel = $userlevel->id;
}
$this->subhierarchieslist = company::get_all_subdepartments($userhierarchylevel);
if ($departmentid == 0) {
$this->departmentid = $userhierarchylevel;
} else {
$this->departmentid = $departmentid;
}
$this->userid = $userid;
$this->user = $DB->get_record('user', array('id' => $this->userid));
parent::__construct($actionurl);
}
示例6: __construct
public function __construct($actionurl, $context, $companyid, $templateid, $templaterecord)
{
$this->templateid = $templateid;
$this->context = $context;
$this->templaterecord = $templaterecord;
$this->companyid = $companyid;
$department = company::get_company_parentnode($this->companyid);
$subhierarchieslist = company::get_all_subdepartments($department->id);
$options = array('context' => $this->context, 'multiselect' => false, 'companyid' => $this->companyid, 'departmentid' => $department->id, 'subdepartments' => $subhierarchieslist, 'parentdepartmentid' => $department);
$this->currentcourses = new current_company_course_selector('currentcourses', $options);
$this->currentcourses->set_rows(1);
parent::__construct($actionurl);
}
示例7: company
}
// Get the associated department id.
$company = new company($companyid);
$parentlevel = company::get_company_parentnode($company->id);
$companydepartment = $parentlevel->id;
if (iomad::has_capability('block/iomad_company_admin:edit_all_departments', context_system::instance())) {
$userhierarchylevel = $parentlevel->id;
} else {
$userlevel = company::get_userlevel($USER);
$userhierarchylevel = $userlevel->id;
}
if ($departmentid == 0) {
$departmentid = $userhierarchylevel;
}
// Get the appropriate list of departments.
$subhierarchieslist = company::get_all_subdepartments($userhierarchylevel);
$select = new single_select($baseurl, 'departmentid', $subhierarchieslist, $departmentid);
//GWL $select->label = get_string('department', 'block_iomad_company_admin');
$select->label = get_string('regionlocation', 'block_iomad_company_admin');
$select->formid = 'choosedepartment';
echo html_writer::tag('div', $OUTPUT->render($select), array('id' => 'iomad_department_selector'));
$fwselectoutput = html_writer::tag('div', $OUTPUT->render($select), array('id' => 'iomad_company_selector'));
if (!(iomad::has_capability('block/iomad_company_admin:editusers', $systemcontext) or iomad::has_capability('block/iomad_company_admin:editallusers', $systemcontext))) {
print_error('nopermissions', 'error', '', 'edit/delete users');
}
// Set up the filter form.
$mform = new iomad_user_filter_form(null, array('companyid' => $companyid));
$mform->set_data(array('departmentid' => $departmentid));
$mform->set_data($params);
// Display the user filter form.
$mform->display();
示例8: find_courses
public function find_courses($search)
{
global $DB, $SITE;
// By default wherecondition retrieves all courses except the deleted, not confirmed and guest.
list($wherecondition, $params) = $this->search_sql($search, 'c');
$params['companyid'] = $this->companyid;
$params['siteid'] = $SITE->id;
$fields = 'SELECT ' . $this->required_fields_sql('c');
$countfields = 'SELECT COUNT(1)';
$distinctfields = 'SELECT DISTINCT ' . $this->required_fields_sql('c');
$distinctcountfields = 'SELECT COUNT(DISTINCT c.id) ';
// Get appropriate department ids.
$departmentids = array_keys(company::get_all_subdepartments($this->departmentid));
// Check the top department.
$parentnode = company::get_company_parentnode($this->companyid);
if (!empty($departmentids)) {
if ($parentnode->id == $this->departmentid) {
$departmentselect = "AND cc.departmentid in (" . implode(',', $departmentids) . ") ";
} else {
$departmentselect = "AND cc.departmentid in (" . $parentnode->id . ',' . implode(',', $departmentids) . ") ";
}
} else {
$departmentselect = "AND cc.departmentid = " . $parentnode->id;
}
if (!$this->license) {
if (!($licensecourses = $DB->get_records('iomad_courses', array('licensed' => 1), null, 'courseid'))) {
$licensesql = "";
} else {
$licensesql = " AND c.id not in (" . implode(',', array_keys($licensecourses)) . ")";
}
} else {
$licensesql = "";
}
$sqldistinct = " FROM {course} c,\n {company_course} cc\n WHERE {$wherecondition}\n AND cc.courseid = c.id\n AND c.id != :siteid\n {$licensesql}\n {$departmentselect}";
$sql = " FROM {course} c\n WHERE {$wherecondition}\n AND c.id != :siteid\n AND NOT EXISTS (SELECT NULL FROM {company_course} WHERE courseid = c.id)";
if (!empty($this->showopenshared)) {
$sqlopenshared = " FROM {course} c,\n {iomad_courses} ic\n WHERE {$wherecondition}\n AND ic.courseid = c.id\n AND c.id != :siteid\n AND ic.shared = 1\n {$licensesql}";
}
$order = ' ORDER BY c.fullname ASC';
if (!$this->is_validating()) {
$potentialmemberscount = $DB->count_records_sql($countfields . $sql, $params) + $DB->count_records_sql($distinctcountfields . $sqldistinct, $params);
if ($potentialmemberscount > company_course_selector_base::MAX_COURSES_PER_PAGE) {
return $this->too_many_results($search, $potentialmemberscount);
}
}
$availablecourses = $DB->get_records_sql($fields . $sql . $order, $params) + $DB->get_records_sql($distinctfields . $sqldistinct . $order, $params);
if (!empty($this->showopenshared)) {
$availablecourses = $availablecourses + $DB->get_records_sql($distinctfields . $sqlopenshared . $order, $params);
}
if (empty($availablecourses)) {
return array();
}
$sanitisedcourses = array();
foreach ($availablecourses as $key => $availablecourse) {
$sanitisedcourses[$key] = $availablecourse;
}
// Have any of the courses got enrollments?
$this->process_enrollments($sanitisedcourses);
if ($search) {
$groupname = get_string('potcoursesmatching', 'block_iomad_company_admin', $search);
} else {
$groupname = get_string('potcourses', 'block_iomad_company_admin');
}
return array($groupname => $availablecourses);
}
示例9: get_user_course_completion_data
/**
* Get user completion info for a course
*
* Parameters - $departmentid = int;
* $courseid = int;
* $page = int;
* $perpade = int;
*
* Return array();
* */
public static function get_user_course_completion_data($searchinfo, $courseid, $page = 0, $perpage = 0, $completiontype = 0)
{
global $DB;
$completiondata = new stdclass();
// Create a temporary table to hold the userids.
$temptablename = 'tmp_ccomp_users_' . time();
$dbman = $DB->get_manager();
// Define table user to be created.
$table = new xmldb_table($temptablename);
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
$table->add_field('userid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null);
$table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
$dbman->create_temp_table($table);
// Populate it.
$alldepartments = company::get_all_subdepartments($searchinfo->departmentid);
if (count($alldepartments) > 0) {
$tempcreatesql = "INSERT INTO {" . $temptablename . "} (userid) SELECT userid from {company_users}\n WHERE departmentid IN (" . implode(',', array_keys($alldepartments)) . ")";
} else {
$tempcreatesql = "";
}
$DB->execute($tempcreatesql);
// Deal with completion types.
if (!empty($completiontype)) {
if ($completiontype == 1) {
$completionsql = " AND cc.timeenrolled > 0 AND cc.timestarted = 0 ";
} else {
if ($completiontype == 2) {
$completionsql = " AND cc.timestarted > 0 AND cc.timecompleted IS NULL ";
} else {
if ($completiontype == 3) {
$completionsql = " AND cc.timecompleted IS NOT NULL ";
}
}
}
} else {
$completionsql = "";
}
// Get the user details.
if ($vantagefield = $DB->get_record('user_info_field', array('shortname' => 'VANTAGE'))) {
$countsql = "SELECT u.id ";
$selectsql = "SELECT u.id,\n u.firstname AS firstname,\n u.lastname AS lastname,\n u.email AS email,\n cc.timeenrolled AS timeenrolled,\n cc.timestarted AS timestarted,\n cc.timecompleted AS timecompleted,\n d.name as department,\n gg.finalgrade as result,\n uid.data as vantage ";
$fromsql = " FROM {user} u, {course_completions} cc, {department} d, {company_users} du,\n {user_info_data} uid, {" . $temptablename . "} tt\n LEFT JOIN {grade_grades} gg ON ( gg.itemid = (\n SELECT id FROM {grade_items} WHERE courseid = {$courseid} AND itemtype='course'))\n\n WHERE {$searchinfo->sqlsearch}\n AND tt.userid = u.id\n AND cc.course = {$courseid}\n AND u.id = cc.userid\n AND du.userid = u.id\n AND d.id = du.departmentid\n AND gg.userid = u.id\n AND uid.userid = u.id\n AND uid.fieldid = {$vantagefield->id}\n {$completionsql}\n {$searchinfo->sqlsort} ";
} else {
$countsql = "SELECT u.id ";
$selectsql = "SELECT u.id,\n u.firstname AS firstname,\n u.lastname AS lastname,\n u.email AS email,\n cc.timeenrolled AS timeenrolled,\n cc.timestarted AS timestarted,\n cc.timecompleted AS timecompleted,\n d.name as department,\n gg.finalgrade as result ";
$fromsql = " FROM {user} u, {course_completions} cc, {department} d, {company_users} du, {" . $temptablename . "} tt\n LEFT JOIN {grade_grades} gg ON ( gg.itemid = (\n SELECT id FROM {grade_items} WHERE courseid = {$courseid} AND itemtype='course'))\n\n WHERE {$searchinfo->sqlsearch}\n AND tt.userid = u.id\n AND cc.course = {$courseid}\n AND u.id = cc.userid\n AND du.userid = u.id\n AND d.id = du.departmentid\n AND gg.userid = u.id\n {$completionsql}\n {$searchinfo->sqlsort} ";
}
$searchinfo->searchparams['courseid'] = $courseid;
$users = $DB->get_records_sql($selectsql . $fromsql, $searchinfo->searchparams, $page * $perpage, $perpage);
$countusers = $DB->get_records_sql($countsql . $fromsql, $searchinfo->searchparams);
$numusers = count($countusers);
$returnobj = new stdclass();
$returnobj->users = $users;
$returnobj->totalcount = $numusers;
return $returnobj;
}
示例10: find_users
public function find_users($search)
{
global $DB, $USER;
// By default wherecondition retrieves all users except the deleted, not confirmed and guest.
list($wherecondition, $params) = $this->search_sql($search, 'u');
$params['companyid'] = $this->companyid;
$fields = 'SELECT ' . $this->required_fields_sql('u') . ', u.email, d.shortname ';
$countfields = 'SELECT COUNT(1)';
$myusers = company::get_my_users($this->companyid);
$licenseusers = $this->get_license_user_ids();
if (count($licenseusers) > 0) {
$licenseuserids = implode(',', $licenseusers);
if ($licenseuserids != ',') {
$userfilter = " AND NOT u.id in ({$licenseuserids}) ";
} else {
$userfilter = "";
}
} else {
$userfilter = "";
}
// Add in a filter to return just the users beloning to the current USER.
if (!empty($myusers)) {
$userfilter .= " AND u.id in (" . implode(',', array_keys($myusers)) . ") ";
}
// Get the department ids for this license.
$departmentids = $this->get_license_department_ids();
// Add subdepartments to include their users.
foreach ($departmentids as $deptid) {
$departmentids += array_keys(company::get_all_subdepartments($deptid));
}
$deptids = implode(',', $departmentids);
if (!empty($deptids)) {
$departmentsql = "AND du.departmentid in ({$deptids})";
} else {
return array();
}
$sql = " FROM\n {user} u\n INNER JOIN {company_users} du ON du.userid = u.id\n INNER JOIN {department} d ON d.id = du.departmentid\n WHERE {$wherecondition} AND u.suspended = 0 \n {$departmentsql}\n {$userfilter}";
$order = ' ORDER BY u.lastname ASC, u.firstname ASC';
if (!$this->is_validating()) {
$potentialmemberscount = $DB->count_records_sql($countfields . $sql, $params);
if ($potentialmemberscount > company_user_selector_base::MAX_USERS_PER_PAGE) {
return $this->too_many_results($search, $potentialmemberscount);
}
}
$availableusers = $DB->get_records_sql($fields . $sql . $order, $params);
if (empty($availableusers)) {
return array();
}
$this->process_license_allocations($availableusers);
if ($search) {
$groupname = get_string('potusersmatching', 'block_iomad_company_admin', $search);
} else {
$groupname = get_string('potusers', 'block_iomad_company_admin');
}
return array($groupname => $availableusers);
}
示例11: definition
public function definition()
{
global $CFG, $USER;
$mform =& $this->_form;
$company = new company($this->selectedcompany);
if (!($parentnode = company::get_company_parentnode($company->id))) {
// Company has not been set up, possibly from before an upgrade.
company::initialise_departments($company->id);
}
if (!empty($this->departmentid)) {
$departmentslist = company::get_all_subdepartments($this->departmentid);
} else {
$departmentslist = company::get_all_departments($company->id);
}
if (!empty($this->departmentid)) {
$department = company::get_departmentbyid($this->departmentid);
} else {
$department = company::get_company_parentnode($this->selectedcompany);
}
/* GWL : Get Company Parent Node */
$parentnode = company::get_company_parentnode($this->selectedcompany);
$context = context_system::instance();
if (iomad::has_capability('block/iomad_company_admin:edit_all_departments', $context)) {
$userhierarchylevel = $parentnode->id;
} else {
$userlevel = company::get_userlevel($USER);
$userhierarchylevel = $userlevel->id;
}
$subdepartmentslist = company::get_subdepartments_list($department);
$subdepartments = company::get_subdepartments($department);
$regionlistarr = array('' => get_string('choose'));
$showregiondropdown = 1;
$showlocationdropdown = 1;
if ($parentnode->id == $userhierarchylevel) {
$regionlist = company::get_all_regions($company->id);
foreach ($regionlist as $region) {
$regionlistarr[$region->id] = $region->name;
}
} else {
$regionlist = company::get_my_region($userhierarchylevel);
if (!$regionlist) {
$showregiondropdown = 0;
} else {
$regionlistarr[$regionlist->id] = $regionlist->name;
}
}
// Create the sub department checkboxes html.
$subdepartmenthtml = "<div class='departments_container'></div>";
$locationlist = array('' => get_string('choose'));
if ($parentnode->id != $userhierarchylevel && empty($regionlist)) {
$mylocationlist = company::get_my_location($userhierarchylevel);
if ($mylocationlist) {
$locationlist[$mylocationlist->id] = $mylocationlist->name;
} else {
$showlocationdropdown = 0;
}
}
/* if (!empty($subdepartmentslist)) {
$subdepartmenthtml = "<p>" . get_string('subdepartments', 'block_iomad_company_admin') .
"</p>";
foreach ($subdepartmentslist as $key => $value) {
$subdepartmenthtml .= '<input type = "checkbox" name = "departmentids[]" value="' .
$key . '" /> ' . $value . '</br>';
}
} */
// Then show the fields about where this block appears.
$mform->addElement('header', 'header', get_string('companydepartment', 'block_iomad_company_admin') . $company->get_name());
if ($showregiondropdown) {
$mform->addElement('select', 'regionid', get_string('region', 'block_iomad_company_admin'), $regionlistarr, array('class' => 'companyregion'));
$mform->addRule('regionid', get_string('regionnotselect', 'block_iomad_company_admin'), 'required', null, 'client');
}
if ($showlocationdropdown) {
$mform->addElement('select', 'locationid', get_string('location', 'block_iomad_company_admin'), $locationlist, array('class' => 'companylocation'));
$mform->addRule('locationid', get_string('locationnotselect', 'block_iomad_company_admin'), 'required', null, 'client');
}
//$mform->addElement('html', $subdepartmenthtml);
$mform->addElement('select', 'deptid', get_string('department', 'block_iomad_company_admin'), $locationlist, array('class' => 'dept_container'));
$mform->addElement('html', $subdepartmenthtml);
$buttonarray = array();
$attr = array();
if (!$showlocationdropdown) {
$attr = array('disabled' => 'disabled');
}
$buttonarray[] = $mform->createElement('submit', 'create', get_string('createdepartment', 'block_iomad_company_admin'), $attr);
// if (!empty($subdepartmentslist)) {
$buttonarray[] = $mform->createElement('submit', 'edit', get_string('editdepartments', 'block_iomad_company_admin'), array('disabled' => 'disabled', 'class' => 'editdepart'));
$buttonarray[] = $mform->createElement('submit', 'delete', get_string('deletedepartment', 'block_iomad_company_admin'), array('disabled' => 'disabled'));
//}
$mform->addGroup($buttonarray, '', array(' '), ' ', false);
}
示例12: definition
public function definition()
{
global $CFG;
$mform =& $this->_form;
$company = new company($this->selectedcompany);
if (!empty($this->departmentid)) {
$departmentslist = company::get_all_subdepartments($this->departmentid);
} else {
$departmentslist = company::get_all_departments($company->id);
}
$department = company::get_departmentbyid($this->departmentid);
// Then show the fields about where this block appears.
if ($this->action == 0) {
$mform->addElement('header', 'header', get_string('createdepartment', 'block_iomad_company_admin'));
} else {
$mform->addElement('header', 'header', get_string('editdepartments', 'block_iomad_company_admin'));
}
$mform->addElement('hidden', 'departmentid', $this->departmentid);
$mform->setType('departmentid', PARAM_INT);
$mform->addElement('hidden', 'action', $this->action);
$mform->setType('action', PARAM_INT);
$mform->addElement('select', 'deptid', get_string('department', 'block_iomad_company_admin'), $departmentslist);
$mform->disabledIf('deptid', 'action', 'eq', 1);
$mform->addElement('text', 'fullname', get_string('fullnamedepartment', 'block_iomad_company_admin'), 'maxlength = "254" size = "50"');
$mform->addHelpButton('fullname', 'fullnamedepartment', 'block_iomad_company_admin');
$mform->addRule('fullname', get_string('missingfullnamedepartment', 'block_iomad_company_admin'), 'required', null, 'client');
$mform->setType('fullname', PARAM_MULTILANG);
$mform->addElement('text', 'shortname', get_string('shortnamedepartment', 'block_iomad_company_admin'), 'maxlength = "100" size = "20"');
$mform->addHelpButton('shortname', 'shortnamedepartment', 'block_iomad_company_admin');
$mform->addRule('shortname', get_string('missingshortnamedepartment', 'block_iomad_company_admin'), 'required', null, 'client');
$mform->setType('shortname', PARAM_MULTILANG);
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();
}