本文整理汇总了PHP中api_get_person_name函数的典型用法代码示例。如果您正苦于以下问题:PHP api_get_person_name函数的具体用法?PHP api_get_person_name怎么用?PHP api_get_person_name使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了api_get_person_name函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: search_users
function search_users($needle, $type)
{
global $_configuration, $tbl_access_url_rel_user, $tbl_user, $user_anonymous, $current_user_id, $user_id;
$xajax_response = new XajaxResponse();
$return = '';
if (!empty($needle) && !empty($type)) {
// xajax send utf8 datas... datas in db can be non-utf8 datas
$charset = api_get_system_encoding();
$needle = api_convert_encoding($needle, $charset, 'utf-8');
$assigned_users_to_hrm = UserManager::get_users_followed_by_drh($user_id);
$assigned_users_id = array_keys($assigned_users_to_hrm);
$without_assigned_users = '';
if (count($assigned_users_id) > 0) {
$without_assigned_users = " AND user.user_id NOT IN(" . implode(',', $assigned_users_id) . ")";
}
if ($_configuration['multiple_access_urls']) {
$sql = "SELECT user.user_id, username, lastname, firstname FROM {$tbl_user} user LEFT JOIN {$tbl_access_url_rel_user} au ON (au.user_id = user.user_id)\n\t\t\tWHERE " . (api_sort_by_first_name() ? 'firstname' : 'lastname') . " LIKE '{$needle}%' AND status NOT IN(" . DRH . ", " . SESSIONADMIN . ") AND user.user_id NOT IN ({$user_anonymous}, {$current_user_id}, {$user_id}) {$without_assigned_users} AND access_url_id = " . api_get_current_access_url_id() . "";
} else {
$sql = "SELECT user_id, username, lastname, firstname FROM {$tbl_user} user\n\t\t\tWHERE " . (api_sort_by_first_name() ? 'firstname' : 'lastname') . " LIKE '{$needle}%' AND status NOT IN(" . DRH . ", " . SESSIONADMIN . ") AND user_id NOT IN ({$user_anonymous}, {$current_user_id}, {$user_id}) {$without_assigned_users}";
}
$rs = Database::query($sql);
$return .= '<select id="origin" name="NoAssignedUsersList[]" multiple="multiple" size="20" style="width:340px;">';
while ($user = Database::fetch_array($rs)) {
$person_name = api_get_person_name($user['firstname'], $user['lastname']);
$return .= '<option value="' . $user['user_id'] . '" title="' . htmlspecialchars($person_name, ENT_QUOTES) . '">' . $person_name . ' (' . $user['username'] . ')</option>';
}
$return .= '</select>';
$xajax_response->addAssign('ajax_list_users_multiple', 'innerHTML', api_utf8_encode($return));
}
return $xajax_response;
}
示例2: search_users
/**
* Search users by username, firstname or lastname, based on the given
* search string
* @param string Search string
* @param int Deprecated param
* @return string Xajax response block
* @assert () === false
*/
public static function search_users($needle, $id)
{
global $tbl_user, $tbl_access_url_rel_user;
$xajax_response = new XajaxResponse();
$return = '';
if (!empty($needle)) {
// xajax send utf8 datas... datas in db can be non-utf8 datas
$charset = api_get_system_encoding();
$needle = api_convert_encoding($needle, $charset, 'utf-8');
$needle = Database::escape_string($needle);
// search users where username or firstname or lastname begins likes $needle
$order_clause = api_sort_by_first_name() ? ' ORDER BY firstname, lastname, username' : ' ORDER BY lastname, firstname, username';
$sql = 'SELECT u.user_id, username, lastname, firstname FROM ' . $tbl_user . ' u ' . ' WHERE (username LIKE "' . $needle . '%" ' . ' OR firstname LIKE "' . $needle . '%" ' . ' OR lastname LIKE "' . $needle . '%") ' . $order_clause . ' LIMIT 11';
$rs = Database::query($sql);
$i = 0;
while ($user = Database::fetch_array($rs)) {
$i++;
if ($i <= 10) {
$return .= '<a href="javascript: void(0);" onclick="javascript: add_user_to_url(\'' . addslashes($user['user_id']) . '\',\'' . api_get_person_name(addslashes($user['firstname']), addslashes($user['lastname'])) . ' (' . addslashes($user['username']) . ')' . '\')">' . api_get_person_name($user['firstname'], $user['lastname']) . ' (' . $user['username'] . ')</a><br />';
} else {
$return .= '...<br />';
}
}
}
$xajax_response->addAssign('ajax_list_users', 'innerHTML', api_utf8_encode($return));
return $xajax_response;
}
示例3: __construct
/**
* Constructor (generates a connection to the API)
* @param string Clockworksms API key required to use the plugin
* @return void
*/
public function __construct($apiKey = null)
{
$plugin = ClockworksmsPlugin::create();
$clockWorkSMSPlugin = $plugin->get('tool_enable');
if (empty($apiKey)) {
$clockWorkSMSApiKey = $plugin->get('api_key');
} else {
$clockWorkSMSApiKey = $apiKey;
}
$this->table = Database::get_main_table('user_field_values');
if ($clockWorkSMSPlugin == true) {
$this->apiKey = $clockWorkSMSApiKey;
// Setting Clockworksms api
if (!defined('CONFIG_SECURITY_API_KEY')) {
define('CONFIG_SECURITY_API_KEY', $this->apiKey);
}
$trimmedApiKey = trim(CONFIG_SECURITY_API_KEY);
if (!empty($trimmedApiKey)) {
$this->api = new Clockwork(CONFIG_SECURITY_API_KEY);
} else {
$this->api = new Clockwork(' ');
$recipient_name = api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'), null, PERSON_NAME_EMAIL_ADDRESS);
$email_form = api_get_setting('emailAdministrator');
$emailsubject = 'Clockworksms error';
$emailbody = 'Key cannot be blank';
$sender_name = $recipient_name;
$email_admin = $email_form;
api_mail_html($recipient_name, $email_form, $emailsubject, $emailbody, $sender_name, $email_admin);
}
$this->plugin_enabled = true;
}
}
示例4: mdo_generate_default_xml_metadata
function mdo_generate_default_xml_metadata()
{
global $iso639_2_code, $ieee_xml;
$xhtDoc = new xhtdoc($ieee_xml);
$_user = api_get_user_info();
if ($xhtDoc->htt_error) {
give_up('IEEE XML (metadata/md_funcs): ' . $xhtDoc->htt_error);
}
$xhtDoc->xht_get_lang = 'get_lang';
$xhtDoc->xht_xmldoc = new xmddoc('');
if ($xhtDoc->xht_xmldoc->error) {
give_up($xhtDoc->xht_xmldoc->error);
}
$xhtDoc->xht_param['siteUri'] = make_uri();
$xhtDoc->xht_param['entry'] = $this->mdo_course['sysCode'] . '.Link.' . $this->mdo_id;
// 2005-05-30: path->sysCode
$xhtDoc->xht_param['location'] = $this->mdo_url . '';
$xhtDoc->xht_param['mdlang'] = strtolower($iso639_2_code);
$xhtDoc->xht_param['lang'] = strtolower($iso639_2_code);
$xhtDoc->xht_param['title'] = $this->mdo_title ? $this->mdo_title : get_lang('MdTitle');
if ($d = $this->mdo_description) {
if ($keywords = $this->_find_keywords($d)) {
$d = array_pop($keywords);
}
$xhtDoc->xht_param['description'] = $d;
} else {
$xhtDoc->xht_param['description'] = get_lang('MdDescription');
}
$xhtDoc->xht_param['coverage'] = $this->mdo_category_title ? $this->mdo_category_title : get_lang('MdCoverage');
if (isset($_user)) {
$xhtDoc->xht_param['author'] = "BEGIN:VCARD\\nFN:" . api_get_person_name($_user['firstName'], $_user['lastName'], null, PERSON_NAME_EMAIL_ADDRESS) . "\\nEMAIL:" . $_user['mail'] . "\\nEND:VCARD\\n";
}
$xhtDoc->xht_param['dateTime'] = date('Y-m-d');
$xhtDoc->xht_param['format'] = '';
$xhtDoc->xht_param['size'] = '0';
if (count($keywords)) {
$xd = new xmddoc(explode("\n", $mdt = $xhtDoc->xht_fill_template('XML')));
if ($xd->error) {
return $mdt;
}
// and worry later
$this->_add_keywords($xd, $keywords);
return $xd->xmd_xml();
}
return $xhtDoc->xht_fill_template('XML');
}
示例5: search_coachs
function search_coachs($needle)
{
$tbl_user = Database::get_main_table(TABLE_MAIN_USER);
$xajax_response = new xajaxResponse();
$return = '';
if (!empty($needle)) {
$order_clause = api_sort_by_first_name() ? ' ORDER BY firstname, lastname, username' : ' ORDER BY lastname, firstname, username';
// search users where username or firstname or lastname begins likes $needle
$sql = 'SELECT username, lastname, firstname
FROM ' . $tbl_user . ' user
WHERE (username LIKE "' . $needle . '%"
OR firstname LIKE "' . $needle . '%"
OR lastname LIKE "' . $needle . '%")
AND status=1' . $order_clause . ' LIMIT 10';
if (api_is_multiple_url_enabled()) {
$tbl_user_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$access_url_id = api_get_current_access_url_id();
if ($access_url_id != -1) {
$sql = 'SELECT username, lastname, firstname
FROM ' . $tbl_user . ' user
INNER JOIN ' . $tbl_user_rel_access_url . ' url_user
ON (url_user.user_id=user.user_id)
WHERE
access_url_id = ' . $access_url_id . ' AND
(
username LIKE "' . $needle . '%" OR
firstname LIKE "' . $needle . '%" OR
lastname LIKE "' . $needle . '%"
)
AND status=1' . $order_clause . '
LIMIT 10';
}
}
$rs = Database::query($sql);
while ($user = Database::fetch_array($rs)) {
$return .= '<a href="javascript: void(0);" onclick="javascript: fill_coach_field(\'' . $user['username'] . '\')">' . api_get_person_name($user['firstname'], $user['lastname']) . ' (' . $user['username'] . ')</a><br />';
}
}
$xajax_response->addAssign('ajax_list_coachs', 'innerHTML', api_utf8_encode($return));
return $xajax_response;
}
示例6: get_information
/**
* Get document information
*/
private function get_information($course_id, $doc_id)
{
$course_information = api_get_course_info($course_id);
$course_id = $course_information['real_id'];
$course_path = $course_information['path'];
if (!empty($course_information)) {
$item_property_table = Database::get_course_table(TABLE_ITEM_PROPERTY);
$doc_table = Database::get_course_table(TABLE_DOCUMENT);
$doc_id = Database::escape_string($doc_id);
$sql = "SELECT * FROM {$doc_table}\n WHERE {$doc_table}.id = {$doc_id} AND c_id = {$course_id}\n LIMIT 1";
$dk_result = Database::query($sql);
$sql = "SELECT insert_user_id FROM {$item_property_table}\n WHERE ref = {$doc_id} AND tool = '" . TOOL_DOCUMENT . "' AND c_id = {$course_id}\n LIMIT 1";
$name = '';
if ($row = Database::fetch_array($dk_result)) {
$name = $row['title'];
$url = api_get_path(WEB_PATH) . 'courses/%s/document%s';
$url = sprintf($url, $course_path, $row['path']);
// Get the image path
$icon = FileManager::choose_image(basename($row['path']));
$thumbnail = api_get_path(WEB_IMG_PATH) . $icon;
$image = $thumbnail;
//FIXME: use big images
// get author
$author = '';
$item_result = Database::query($sql);
if ($row = Database::fetch_array($item_result)) {
$user_data = api_get_user_info($row['insert_user_id']);
$author = api_get_person_name($user_data['firstName'], $user_data['lastName']);
}
}
return array($thumbnail, $image, $name, $author, $url);
// FIXME: is it posible to get an author here?
} else {
return array();
}
}
示例7: mdo_generate_default_xml_metadata
function mdo_generate_default_xml_metadata()
{
global $iso639_2_code, $ieee_xml;
$xhtDoc = new xhtdoc($ieee_xml);
$_user = api_get_user_info();
if ($xhtDoc->htt_error) {
give_up('IEEE XML (metadata/md_funcs): ' . $xhtDoc->htt_error);
}
$xhtDoc->xht_get_lang = 'get_lang';
$xhtDoc->xht_xmldoc = new xmddoc('');
if ($xhtDoc->xht_xmldoc->error) {
give_up($xhtDoc->xht_xmldoc->error);
}
$xhtDoc->xht_param['siteUri'] = make_uri();
$xhtDoc->xht_param['entry'] = $this->mdo_course['sysCode'] . '.Document.' . $this->mdo_id;
// 2005-05-30: path->sysCode
$xhtDoc->xht_param['location'] = api_get_path(WEB_PATH) . 'main/metadata/openobject.php?cidReq=' . urlencode($this->mdo_course['sysCode']) . '&eid=' . urlencode($this->mdo_eid);
$xhtDoc->xht_param['mdlang'] = strtolower($iso639_2_code);
$xhtDoc->xht_param['lang'] = strtolower($iso639_2_code);
$xhtDoc->xht_param['title'] = $this->mdo_title ? $this->mdo_title : ($this->mdo_path ? $this->mdo_path : get_lang('MdTitle', ''));
$xhtDoc->xht_param['description'] = $this->mdo_comment ? $this->mdo_comment : get_lang('MdDescription', '');
$xhtDoc->xht_param['coverage'] = get_lang('MdCoverage', '');
if (isset($_user)) {
$xhtDoc->xht_param['author'] = "BEGIN:VCARD\\nFN:" . api_get_person_name($_user['firstName'], $_user['lastName'], null, PERSON_NAME_EMAIL_ADDRESS) . "\\nEMAIL:" . $_user['mail'] . "\\nEND:VCARD\\n";
}
$xhtDoc->xht_param['dateTime'] = date('Y-m-d');
if ($this->mdo_filetype == 'folder') {
$format = "inode/directory";
} else {
require_once api_get_path(LIBRARY_PATH) . 'document.lib.php';
$format = DocumentManager::file_get_mime_type($this->mdo_path);
}
$xhtDoc->xht_param['format'] = $format;
$xhtDoc->xht_param['size'] = ($s = filesize(get_course_path() . $this->mdo_course['path'] . '/document' . $this->mdo_path)) ? $s : '0';
return $xhtDoc->xht_fill_template('XML');
}
示例8: count
$count_pending_invitations = count($pending_invitations);
}
if (!empty($production_list) || !empty($file_list) || $count_pending_invitations > 0) {
//Pending invitations
if (!isset($_GET['u']) || isset($_GET['u']) && $_GET['u'] == api_get_user_id()) {
if ($count_pending_invitations > 0) {
$invitations = '<div><h3>' . get_lang('PendingInvitations') . '</h3></div>';
for ($i = 0; $i < $count_pending_invitations; $i++) {
$user_invitation_id = $pending_invitations[$i]['user_sender_id'];
$invitations .= '<div id="dpending_' . $user_invitation_id . '" class="friend_invitations">';
$invitations .= '<div style="float:left;width:60px;" >';
$invitations .= '<img style="margin-bottom:5px;"' . ' src="' . $list_get_path_web[$i]['dir'] . '/' . $list_get_path_web[$i]['file'] . '"' . ' width="60px">';
$invitations .= '</div>';
$invitations .= '<div style="padding-left:70px;">';
$user_invitation_info = api_get_user_info($user_invitation_id);
$invitations .= '<a href="' . api_get_path(WEB_PATH) . 'main/social/profile.php' . '?u=' . $user_invitation_id . '">' . api_get_person_name($user_invitation_info['firstname'], $user_invitation_info['lastname']) . '</a>';
$invitations .= '<br />';
$invitations .= Security::remove_XSS(cut($pending_invitations[$i]['content'], 50), STUDENT, true);
$invitations .= '<br />';
$invitations .= '<a id="btn_accepted_' . $user_invitation_id . '"' . ' class="btn btn-default" onclick="register_friend(this)" href="javascript:void(0)">' . get_lang('SocialAddToFriends') . '</a>';
$invitations .= '<div id="id_response"></div>';
$invitations .= '</div>';
$invitations .= '</div>';
}
$socialRightInformation .= SocialManager::social_wrapper_div($invitations, 4);
}
}
// Productions
$production_list = UserManager::build_production_list($user_id);
$product_content = '';
if (!empty($production_list)) {
示例9: array
$possible_users = array();
$userGroup = new UserGroup();
if (!empty($complete_user_list)) {
usort($complete_user_list, 'sort_users');
foreach ($complete_user_list as $index => $user) {
$officialCode = !empty($user['official_code']) ? ' - ' . $user['official_code'] : null;
$groups = $userGroup->getUserGroupListByUser($user['user_id']);
$groupNameListToString = '';
if (!empty($groups)) {
$groupNameList = array_column($groups, 'name');
$groupNameListToString = ' - [' . implode(', ', $groupNameList) . ']';
}
$name = api_get_person_name($user['firstname'], $user['lastname']) . ' (' . $user['username'] . ')' . $officialCode;
if ($orderUserListByOfficialCode === 'true') {
$officialCode = !empty($user['official_code']) ? $user['official_code'] . " - " : '? - ';
$name = $officialCode . " " . api_get_person_name($user['firstname'], $user['lastname']) . ' (' . $user['username'] . ')';
}
$possible_users[$user['user_id']] = $name . $groupNameListToString;
}
}
// Group members
$group_member_list = GroupManager::get_subscribed_users($current_group['id']);
$selected_users = array();
if (!empty($group_member_list)) {
foreach ($group_member_list as $index => $user) {
$selected_users[] = $user['user_id'];
}
}
$group_members_element = $form->addElement('advmultiselect', 'group_members', get_lang('GroupMembers'), $possible_users, 'style="width: 280px;"');
$form->addFormRule('check_group_members');
// submit button
示例10: foreach
?>
</option>
<?php
foreach ($coaches as $enreg) {
?>
<option value="<?php
echo $enreg['user_id'];
?>
" <?php
if (is_array($arr_infos) && in_array($enreg['user_id'], $arr_infos)) {
echo 'selected="selected"';
}
?>
>
<?php
echo api_get_person_name($enreg['firstname'], $enreg['lastname']) . ' (' . $enreg['username'] . ')';
?>
</option>
<?php
}
unset($coaches);
?>
</select>
<div class="control">
<button class="btn btn-success" type="submit" name="name" value="<?php
echo get_lang('AssignCoach');
?>
">
<em class="fa fa-plus"></em>
<?php
echo get_lang('AssignCoach');
示例11: get_lang
?>
</th>
<th width="160px"><?php
echo get_lang('Date');
?>
</th>
</tr>
<?php
$sql = "SELECT *, quiz_question.question, firstname, lastname\n FROM {$TBL_TRACK_ATTEMPT_RECORDING} t, {$TBL_USER}, {$TBL_EXERCICES_QUESTION} quiz_question\n\t\tWHERE quiz_question.id = question_id AND\n user_id = author AND\n exe_id = '" . (int) $_GET['exe_id'] . "'\n ORDER BY position";
$query = Database::query($sql);
while ($row = Database::fetch_array($query)) {
echo '<tr';
if ($i % 2 == 0) {
echo 'class="row_odd"';
} else {
echo 'class="row_even"';
}
echo '>';
echo '<td>' . $row['question'] . '</td>';
echo '<td>' . $row['marks'] . '</td>';
if (!empty($row['teacher_comment'])) {
echo '<td>' . $row['teacher_comment'] . '</td>';
} else {
echo '<td>' . get_lang('WithoutComment') . '</td>';
}
echo '<td>' . (empty($row['firstname']) && empty($row['lastname']) ? '<i>' . get_lang('OriginalValue') . '</i>' : api_get_person_name($row['firstname'], $row['lastname'])) . '</td>';
echo '<td>' . api_convert_and_format_date($row['insert_date'], DATE_TIME_FORMAT_LONG) . '</td>';
echo '</tr>';
}
echo '</table>';
Display::display_footer();
示例12: api_get_self
$url = api_get_self() . '?action=delete_all_certificates' . '&' . api_get_cidReq() . '&cat_id=' . $cat_id . '&filter=' . $filterOfficialCode;
echo Display::url(get_lang('DeleteAllCertificates'), $url, array('class' => 'btn btn-default'));
$hideCertificateExport = api_get_setting('hide_certificate_export_link');
if (count($certificate_list) > 0 && $hideCertificateExport !== 'true') {
$url = api_get_self() . '?action=export_all_certificates' . '&' . api_get_cidReq() . '&cat_id=' . $cat_id . '&filter=' . $filterOfficialCode;
echo Display::url(get_lang('ExportAllCertificatesToPDF'), $url, array('class' => 'btn btn-default'));
}
echo '</div>';
echo $filterForm;
if (count($certificate_list) == 0) {
echo Display::display_warning_message(get_lang('NoResultsAvailable'));
} else {
echo '<br /><br /><table class="data_table">';
foreach ($certificate_list as $index => $value) {
echo '<tr>
<td width="100%" class="actions">' . get_lang('Student') . ' : ' . api_get_person_name($value['firstname'], $value['lastname']) . ' (' . $value['username'] . ')</td>';
echo '</tr>';
echo '<tr><td>
<table class="data_table">';
$list_certificate = GradebookUtils::get_list_gradebook_certificates_by_user_id($value['user_id'], $cat_id);
foreach ($list_certificate as $value_certificate) {
echo '<tr>';
echo '<td width="50%">' . get_lang('Score') . ' : ' . $value_certificate['score_certificate'] . '</td>';
echo '<td width="30%">' . get_lang('Date') . ' : ' . api_convert_and_format_date($value_certificate['created_at']) . '</td>';
echo '<td width="20%">';
$url = api_get_path(WEB_PATH) . 'certificates/index.php?id=' . $value_certificate['id'];
$certificates = Display::url(get_lang('Certificate'), $url, array('target' => '_blank', 'class' => 'btn btn-default'));
echo $certificates;
echo '<a onclick="return confirmation();" href="gradebook_display_certificate.php?sec_token=' . $token . '&cidReq=' . $course_code . '&action=delete&cat_id=' . $cat_id . '&certificate_id=' . $value_certificate['id'] . '">
' . Display::return_icon('delete.png', get_lang('Delete')) . '
</a>';
示例13: WSCreateCourseByTitle
function WSCreateCourseByTitle($params)
{
global $firstExpirationDelay, $_configuration;
if (!WSHelperVerifyKey($params)) {
return return_error(WS_ERROR_SECRET_KEY);
}
$table_course = Database::get_main_table(TABLE_MAIN_COURSE);
$courses_params = $params['courses'];
$results = array();
$orig_course_id_value = array();
foreach ($courses_params as $course_param) {
$title = $course_param['title'];
$category_code = 'LANG';
// TODO: A hard-coded value.
$wanted_code = '';
$tutor_firstname = api_get_setting('administratorName');
$tutor_lastname = api_get_setting('administratorSurname');
$course_language = 'spanish';
// TODO: Incorrect default value, it should 'english'.
if (!empty($course_param['course_language'])) {
$course_language = $course_param['course_language'];
}
$tutor_name = api_get_person_name($tutor_firstname, $tutor_lastname, null, null, $course_language);
if (!empty($course_param['tutor_name'])) {
$tutor_name = $course_param['tutor_name'];
}
$original_course_id_name = $course_param['original_course_id_name'];
$original_course_id_value = $course_param['original_course_id_value'];
$orig_course_id_value[] = $course_param['original_course_id_value'];
$extra_list = $course_param['extra'];
// Ensure the database prefix + database name do not get over 40 characters
$maxlength = 40;
if (empty($wanted_code)) {
$wanted_code = CourseManager::generate_course_code(substr($title, 0, $maxlength));
}
$courseInfo = CourseManager::getCourseInfoFromOriginalId($original_course_id_value, $original_course_id_name);
if (!empty($courseInfo)) {
if ($courseInfo['visibility'] != 0) {
$sql = "UPDATE {$table_course} SET\n course_language='" . Database::escape_string($course_language) . "',\n title='" . Database::escape_string($title) . "',\n category_code='" . Database::escape_string($category_code) . "',\n tutor_name='" . Database::escape_string($tutor_name) . "',\n visual_code='" . Database::escape_string($wanted_code) . "',\n visibility = '3'\n WHERE id ='" . $courseInfo['real_id'] . "'";
Database::query($sql);
$results[] = $courseInfo['real_id'];
continue;
} else {
$results[] = 0;
continue;
}
}
// Set default values.
if (isset($_user['language']) && $_user['language'] != '') {
$values['course_language'] = $_user['language'];
} else {
$values['course_language'] = api_get_setting('platformLanguage');
}
$values['tutor_name'] = api_get_person_name($_user['firstName'], $_user['lastName'], null, null, $values['course_language']);
$keys = AddCourse::define_course_keys($wanted_code, '', $_configuration['db_prefix']);
$sql_check = sprintf('SELECT * FROM ' . $table_course . ' WHERE visual_code = "%s"', Database::escape_string($wanted_code));
$result_check = Database::query($sql_check);
// I don't know why this api function doesn't work...
if (Database::num_rows($result_check) < 1) {
$params = array();
$params['title'] = $title;
$params['wanted_code'] = $wanted_code;
$params['category_code'] = $category_code;
$params['tutor_name'] = $tutor_name;
$params['course_language'] = $course_language;
$params['user_id'] = api_get_user_id();
//$params['visibility'] = $visibility;
$course_info = CourseManager::create_course($params);
if (!empty($course_info)) {
$course_code = $course_info['code'];
// Save new fieldlabel into course_field table.
CourseManager::create_course_extra_field($original_course_id_name, 1, $original_course_id_name, '');
// Save the external system's id into user_field_value table.
CourseManager::update_course_extra_field_value($course_code, $original_course_id_name, $original_course_id_value);
if (is_array($extra_list) && count($extra_list) > 0) {
foreach ($extra_list as $extra) {
$extra_field_name = $extra['field_name'];
$extra_field_value = $extra['field_value'];
// Save new fieldlabel into course_field table.
CourseManager::create_course_extra_field($extra_field_name, 1, $extra_field_name, '');
// Save the external system's id into course_field_value table.
CourseManager::update_course_extra_field_value($course_code, $extra_field_name, $extra_field_value);
}
}
}
$results[] = $course_code;
continue;
} else {
$results[] = 0;
continue;
}
}
// end principal foreach
$count_results = count($results);
$output = array();
for ($i = 0; $i < $count_results; $i++) {
$output[] = array('original_course_id_value' => $orig_course_id_value[$i], 'result' => $results[$i]);
}
return $output;
}
示例14: get_lang
$newPost = $iconEmpty;
}
}
$html .= '<div class="col-md-6">';
$html .= '<div class="row">';
$html .= '<div class="col-md-2">';
$html .= Display::return_icon('post-forum.png', get_lang('Forum'), null, ICON_SIZE_SMALL);
$html .= ' ' . $number_threads . '<br>' . $newPost . '</div>';
$html .= '<div class="col-md-6">';
// The last post in the forum.
if ($forum['last_poster_name'] != '') {
$name = $forum['last_poster_name'];
$poster_id = 0;
$username = "";
} else {
$name = api_get_person_name($forum['last_poster_firstname'], $forum['last_poster_lastname']);
$poster_id = $forum['last_poster_id'];
$userinfo = api_get_user_info($poster_id);
$username = sprintf(get_lang('LoginX'), $userinfo['username']);
}
if (!empty($forum['last_post_id'])) {
$html .= Display::return_icon('post-item.png', null, null, ICON_SIZE_TINY) . ' ' . api_convert_and_format_date($forum['last_post_date']) . '<br /> ' . get_lang('By') . ' ' . display_user_link($poster_id, $name, '', $username);
}
$html .= '</div>';
$html .= '<div class="col-md-4">';
if (api_is_allowed_to_edit(false, true) && !($forum['session_id'] == 0 && intval($sessionId) != 0)) {
$html .= '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&action=edit&content=forum&id=' . $forum['forum_id'] . '">' . Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL) . '</a>';
$html .= '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&action=delete&content=forum&id=' . $forum['forum_id'] . "\" onclick=\"javascript:if(!confirm('" . addslashes(api_htmlentities(get_lang('DeleteForum'), ENT_QUOTES)) . "')) return false;\">" . Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL) . '</a>';
$html .= return_visible_invisible_icon('forum', $forum['forum_id'], $forum['visibility']);
$html .= return_lock_unlock_icon('forum', $forum['forum_id'], $forum['locked']);
$html .= return_up_down_icon('forum', $forum['forum_id'], $forumsInCategory);
示例15: get_lang
if ($affected_rows) {
$msg = get_lang('AssignedSessionsHaveBeenUpdatedSuccessfully');
}
}
// display header
Display::display_header($tool_name);
// actions
echo '<div class="actions">';
if ($user_info['status'] != SESSIONADMIN) {
echo '<span style="float: right;margin:0px;padding:0px;">
<a href="dashboard_add_users_to_user.php?user=' . $user_id . '">' . Display::return_icon('add_user_big.gif', get_lang('AssignUsers'), array('style' => 'vertical-align:middle')) . ' ' . get_lang('AssignUsers') . '</a>
<a href="dashboard_add_courses_to_user.php?user=' . $user_id . '">' . Display::return_icon('course_add.gif', get_lang('AssignCourses'), array('style' => 'vertical-align:middle')) . ' ' . get_lang('AssignCourses') . '</a>
</span>';
}
echo '</div>';
echo Display::page_header(sprintf(get_lang('AssignSessionsToX'), api_get_person_name($user_info['firstname'], $user_info['lastname'])));
$assigned_sessions_to_hrm = SessionManager::get_sessions_followed_by_drh($user_id);
$assigned_sessions_id = array_keys($assigned_sessions_to_hrm);
$without_assigned_sessions = '';
if (count($assigned_sessions_id) > 0) {
$without_assigned_sessions = " AND s.id NOT IN(" . implode(',', $assigned_sessions_id) . ")";
}
$needle = '%';
if (isset($_POST['firstLetterSession'])) {
$needle = Database::escape_string($_POST['firstLetterSession']);
$needle = "{$needle}%";
}
if ($_configuration['multiple_access_urls']) {
$sql = " SELECT s.id, s.name FROM {$tbl_session} s LEFT JOIN {$tbl_session_rel_access_url} a ON (s.id = a.session_id)\n\t\t\t\tWHERE s.name LIKE '{$needle}%' {$without_assigned_sessions} AND access_url_id = " . api_get_current_access_url_id() . "\n ORDER BY s.name";
} else {
$sql = " SELECT s.id, s.name FROM {$tbl_session} s\n\t\t\t\tWHERE s.name LIKE '{$needle}%' {$without_assigned_sessions}\n ORDER BY s.name\n ";