本文整理汇总了PHP中company::check_valid_department方法的典型用法代码示例。如果您正苦于以下问题:PHP company::check_valid_department方法的具体用法?PHP company::check_valid_department怎么用?PHP company::check_valid_department使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类company
的用法示例。
在下文中一共展示了company::check_valid_department方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: profile_save_data
} */
// Update mail bounces.
//useredit_update_bounces($user, $usernew);
// Update forum track preference.
// useredit_update_trackforums($user, $usernew);
// Save custom profile fields data.
profile_save_data($usernew);
// update user region and location as well as role type
// print_object($usernew);
// die;
if (!$usercreated) {
if (empty($usernew->userlocation) && $userlocation) {
$usernew->userlocation = $userlocation;
}
$userdept = $usernew->userlocation ? $usernew->userlocation : $usernew->userregion;
if (company::check_valid_department($companyid, $userdept)) {
$userlevel = $DB->get_record('company_users', array('userid' => $usernew->id));
$userlevel->managertype = $usernew->managertype;
$userlevel->departmentid = $userdept;
$DB->update_record('company_users', $userlevel);
}
if (isset($usernew->userdepartment) || isset($usernew->usertitle)) {
$department = isset($usernew->userdepartment) ? $usernew->userdepartment : 0;
$title = isset($usernew->usertitle) ? $usernew->usertitle : 0;
assign_department_and_title_to_user($companyid, $department, $title, $usernew->id);
}
}
// Reload from db.
$usernew = $DB->get_record('user', array('id' => $usernew->id));
// Trigger events.
if ($usercreated) {
示例2: admin_externalpage_setup
// Build the nav bar.
//company_admin_fix_breadcrumb($PAGE, $linktext, $linkurl);
require_once $CFG->libdir . '/adminlib.php';
admin_externalpage_setup('managecompanyusersetting');
// Print the page header.
$blockpage = new blockpage($PAGE, $OUTPUT, 'iomad_company_admin', 'block', 'company_edit_users_title');
$blockpage->setup();
// Set the companyid
$companyid = iomad::get_my_companyid($systemcontext);
require_login(null, false);
// Adds to $PAGE, creates $OUTPUT.
$baseurl = new moodle_url(basename(__FILE__), $params);
$returnurl = $baseurl;
$blockpage->display_header();
// GWL : Check the department is valid.
if (!empty($departmentid) && !company::check_valid_department($companyid, $departmentid)) {
print_error('invaliddepartment', 'block_iomad_company_admin');
}
// 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;
}
示例3: required_param
require_once 'lib.php';
global $SESSION, $PAGE;
$context = context_system::instance();
$region = required_param('regionid', PARAM_INT);
$resulttype = required_param('resulttype', PARAM_INT);
require_login();
$PAGE->set_context($context);
if (!empty($SESSION->currenteditingcompany)) {
$companyid = $SESSION->currenteditingcompany;
} else {
if (company_user::is_company_user()) {
$companyid = company_user::companyid();
}
}
$company = new company($companyid);
if (!empty($region) && !company::check_valid_department($company->id, $region)) {
print_error('invalidregion', 'block_iomad_company_admin');
}
//iomad::require_capability('block/iomad_company_admin:edit_departments', $context);
$locationlist = company::get_all_locations($region);
$regiondropdownhtml = '<option value="">' . get_string('choose') . '</option>';
$regionlisthtml = '';
$enablebutton = 0;
if (!empty($locationlist)) {
$regionlisthtml = "<p>" . get_string('locations', 'block_iomad_company_admin') . "</p>";
$locationcount = 0;
foreach ($locationlist as $location) {
$locationcount++;
if ($resulttype === 1) {
// Return the checkbox list of locations
$regionlisthtml .= '<input type = "checkbox" name = "locationids[]" value="' . $location->id . '" /> ' . $location->name . '</br>';