本文整理汇总了PHP中hierarchy::get_assignedcostcenters方法的典型用法代码示例。如果您正苦于以下问题:PHP hierarchy::get_assignedcostcenters方法的具体用法?PHP hierarchy::get_assignedcostcenters怎么用?PHP hierarchy::get_assignedcostcenters使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hierarchy
的用法示例。
在下文中一共展示了hierarchy::get_assignedcostcenters方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: user_download_xls
function user_download_xls($fields) {
$hier = new hierarchy();
$costcenters = $hier->get_assignedcostcenters();
global $CFG, $DB;
require_once("$CFG->libdir/excellib.class.php");
$filename = clean_filename('Users.xls');
$workbook = new MoodleExcelWorkbook('-');
$workbook->send($filename);
$worksheet = array();
$worksheet[0] = $workbook->add_worksheet('');
$col = 0;
foreach ($fields as $fieldname) {
$worksheet[0]->write(0, $col, $fieldname);
$col++;
}
$sheetrow = 1;
$myuser = users::getInstance();
$users = $DB->get_records_sql("SELECT u.id, u.username, u.email, u.firstname, u.lastname, u.city, u.country,
u.lastaccess, u.confirmed, u.mnethostid, u.suspended FROM {user} u, {local_users} lu
WHERE lu.userid = u.id ");
foreach ($users as $user) {
$rid = $myuser->get_rolename($user->id);
$post = new stdclass();
$post->firstname = $user->firstname;
$post->lastname = $user->lastname;
$post->email = $user->email;
$post->costcentername = $myuser->get_costcenternames($user);
$post->roleid = $myuser->get_rolename($user->id);
$col = 0;
foreach ($fields as $fieldname) {
$worksheet[0]->write($sheetrow, $col, $post->$fieldname);
$col++;
}
$sheetrow++;
}
$workbook->close();
die;
}
示例2: hierarchy
}
echo $OUTPUT->footer();
die;
}
$currentuser = ($user->id == $id);
$context = $usercontext = context_user::instance($id, MUST_EXIST);
$currentcss = '/local/users/css/styles.css';
$PAGE->requires->css($currentcss);
echo $OUTPUT->header();
echo $OUTPUT->heading(fullname($user));
$hierarchy = new hierarchy();
$costcenterlist = $hierarchy->get_assignedcostcenters();
if (is_siteadmin()) {
$costcenterlist = $hierarchy->get_costcenter_items();
}
$costcenterlist = $hierarchy->get_costcenter_parent($costcenterlist, '', false, false);
$costcenterlist = array_keys($costcenterlist);
list($usql, $params) = $DB->get_in_or_equal($costcenterlist);
$params = array_merge(array($id), $params);
$sql = "SELECT * FROM {local_userdata} WHERE userid = ? AND costcenterid $usql";
$userdata = $DB->get_records_sql($sql, $params); //Assume student enrolled to only one costcenter.
$_count = sizeof($userdata);
$myuser = users::getInstance();