本文整理汇总了PHP中UserProfile::init方法的典型用法代码示例。如果您正苦于以下问题:PHP UserProfile::init方法的具体用法?PHP UserProfile::init怎么用?PHP UserProfile::init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserProfile
的用法示例。
在下文中一共展示了UserProfile::init方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: searchUser
function searchUser(&$url)
{
checkPerm('view');
require_once _base_ . '/lib/lib.form.php';
require_once $GLOBALS['where_framework'] . '/lib/lib.myfriends.php';
$lang =& DoceboLanguage::createInstance('myfriends', 'lms');
$my_fr = new MyFriends(getLogUserId());
$acl_man =& Docebo::user()->getAclManager();
$GLOBALS['page']->add(getTitleArea(array($url->getUrl() => $lang->def('_MY_FRIENDS'), $lang->def('_SEARCH_USER')), 'myfriends') . '<div class="std_block">', 'content');
if (isset($_POST['send'])) {
if ($my_fr->addFriend($_POST['id_friend'], MF_WAITING, $_POST['request'])) {
Util::jump_to($url->getUrl('result=ok_del'));
}
$GLOBALS['page']->add(getErrorUi($lang->def('_ERR_REMOVE_FRIEND')));
} elseif (isset($_GET['id_friend'])) {
$GLOBALS['page']->add(Form::openForm('send_request', $url->getUrl('op=searchuser')) . Form::getHidden('id_friend', 'id_friend', $_GET['id_friend']) . Form::openElementSpace() . Form::getTextarea($lang->def('_REQUEST_MESSAGE'), 'request', 'request') . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('send', 'send', $lang->def('_SEND_REQUEST')) . Form::getButton('back_search', 'back_search', $lang->def('_UNDO')) . Form::closeButtonSpace() . Form::closeForm() . '</div>', 'content');
return;
}
$GLOBALS['page']->add(Form::openForm('', $url->getUrl('op=searchuser')) . Form::getOpenFieldset($lang->def('_SEARCH_USER')) . Form::getTextfield($lang->def('_SEARCH_USERNAME'), 'username', 'username', 255, importVar('username', false, '')) . Form::openButtonSpace() . Form::getButton('search', 'search', $lang->def('_SEARCH')) . Form::getButton('undo', 'undo', $lang->def('_UNDO')) . Form::closeButtonSpace() . Form::getCloseFieldset() . Form::closeForm(), 'content');
if (isset($_POST['username'])) {
$finded_user = $acl_man->getUser(false, $acl_man->absoluteId($_POST['username']));
if ($finded_user === false) {
$GLOBALS['page']->add($lang->def('_NO_USER_FINDED'), 'content');
} else {
require_once _base_ . '/lib/lib.user_profile.php';
if (getLogUserId() != $finded_user[ACL_INFO_IDST]) {
$GLOBALS['page']->add('<p class="confirm_friend">' . '<a href="' . $url->getUrl('op=searchuser&id_friend=' . $finded_user[ACL_INFO_IDST] . '') . '">' . $lang->def('_ADD_TO_MY_FIREND') . '</a>' . '</p>', 'content');
}
$profile = new UserProfile($finded_user[ACL_INFO_IDST]);
$profile->init('profile', 'framework', 'modname=myfriends&op=searchuser', 'ap');
$GLOBALS['page']->add($profile->getUserInfo(), 'content');
}
}
$GLOBALS['page']->add('</div>', 'content');
}
示例2: mycourses
function mycourses(&$url)
{
checkPerm('view');
require_once _base_ . '/lib/lib.user_profile.php';
$lang =& DoceboLanguage::createInstance('catalogue');
require_once $GLOBALS['where_lms'] . '/lib/lib.middlearea.php';
$ma = new Man_MiddleArea();
$course_stats = userCourseList($url, $ma->currentCanAccessObj('lo_tab'));
$access_career = $ma->currentCanAccessObj('career');
$access_news = $ma->currentCanAccessObj('news');
$access_search_form = $ma->currentCanAccessObj('search_form');
$access_user_details_full = $ma->currentCanAccessObj('user_details_full');
$access_user_details_short = $ma->currentCanAccessObj('user_details_short');
$onecol = !$access_career && !$access_news && !$access_user_details_full && !$access_user_details_short;
require_once $GLOBALS['where_framework'] . '/lib/lib.myfriends.php';
$friends = new MyFriends(getLogUserId());
$pendent = count($friends->getPendentRequest());
$GLOBALS['page']->addStart('' . '<div id="mycourse_top">' . ($onecol ? '' : '<div class="mycourse_left">'), 'content');
// user_details_short ------------------------------------------------------------------------
if ($access_user_details_short) {
$profile = new UserProfile(getLogUserId());
$profile->init('profile', 'framework', 'index.php?r=' . _after_login_, 'ap');
$GLOBALS['page']->addStart($profile->userIdMailProfile('normal', false, false), 'content');
}
// user_details_full ------------------------------------------------------------------------
if ($access_user_details_full) {
$profile = new UserProfile(getLogUserId());
$profile->init('profile', 'framework', 'index.php?r=' . _after_login_, 'ap');
$GLOBALS['page']->addStart($profile->homeUserProfile('normal', false, false), 'content');
}
// career ------------------------------------------------------------------------
if ($access_career) {
$base_url = 'index.php?r=' . _after_login_ . '&filter=';
$end = 0;
if (isset($course_stats['with_ustatus'][_CUS_END]) && $course_stats['with_ustatus'][_CUS_END] != 0) {
$end = $course_stats['with_ustatus'][_CUS_END];
}
$GLOBALS['page']->addStart('' . '<div class="course_stat">' . '<table summary="">' . '<caption>' . $lang->def('_CAREER') . '</caption>' . '<tr><th scope="row">' . $lang->def('_TOTAL_COURSE') . ' :</th><td><a href="' . $base_url . 'nothing">' . ($course_stats['total'] - $end) . '</a></td></tr>' . (isset($course_stats['with_ustatus'][_CUS_END]) && $course_stats['with_ustatus'][_CUS_END] != 0 ? '<tr><th scope="row">' . $lang->def('_COURSE_END') . ' :</th><td><a href="' . $base_url . 'end">' . $course_stats['with_ustatus'][_CUS_END] . '</a></td></tr>' : '') . (isset($course_stats['expiring']) && $course_stats['expiring'] != 0 ? '<tr><th scope="row">' . $lang->def('_COURSE_EXPIRING') . ' :</th><td><a href="' . $base_url . 'expiring">' . $course_stats['expiring'] . '</a></td></tr>' : ''), 'content');
if (count($course_stats['with_ulevel']) > 1) {
require_once $GLOBALS['where_lms'] . '/lib/lib.levels.php';
$lvl = CourseLevel::getLevels();
foreach ($course_stats['with_ulevel'] as $lvl_num => $quantity) {
$GLOBALS['page']->addStart('' . '<tr><th scope="row">' . str_replace('[level]', $lvl[$lvl_num], $lang->def('_COURSE_AS')) . ' :</th><td><a href="' . $base_url . 'level&filter_on=' . $lvl_num . '">' . $quantity . '</a></td></tr>', 'content');
}
//end foreach
}
$query = "SELECT c.idMetaCertificate, m.idCertificate" . " FROM " . $GLOBALS['prefix_lms'] . "_certificate_meta_course as c" . " JOIN " . $GLOBALS['prefix_lms'] . "_certificate_meta as m ON c.idMetaCertificate = m.idMetaCertificate" . " WHERE c.idUser = '" . getLogUserId() . "'" . " GROUP BY c.idMetaCertificate" . " ORDER BY m.title, m.description";
$result = sql_query($query);
$num_meta_cert = mysql_num_rows($result);
while (list($id_meta, $id_certificate) = sql_fetch_row($result)) {
$query_released = "SELECT on_date" . " FROM " . $GLOBALS['prefix_lms'] . "_certificate_meta_assign" . " WHERE idUser = '" . getLogUserId() . "'" . " AND idMetaCertificate = '" . $id_meta . "'";
$result_released = sql_query($query_released);
$query = "SELECT user_release" . " FROM " . $GLOBALS['prefix_lms'] . "_certificate" . " WHERE id_certificate = '" . $id_certificate . "'";
list($user_release) = sql_fetch_row(sql_query($query));
if (mysql_num_rows($result_released)) {
} elseif ($user_release == 0) {
$num_meta_cert--;
} else {
$query = "SELECT idCourse" . " FROM " . $GLOBALS['prefix_lms'] . "_certificate_meta_course" . " WHERE idUser = '" . getLogUserId() . "'" . " AND idMetaCertificate = '" . $id_meta . "'";
$result_int = sql_query($query);
$control = true;
while (list($id_course) = sql_fetch_row($result_int)) {
$query = "SELECT COUNT(*)" . " FROM " . $GLOBALS['prefix_lms'] . "_courseuser" . " WHERE idCourse = '" . $id_course . "'" . " AND idUser = '" . getLogUserId() . "'" . " AND status = '" . _CUS_END . "'";
list($number) = sql_fetch_row(sql_query($query));
if (!$number) {
$control = false;
}
}
if (!$control) {
$num_meta_cert--;
}
}
}
$tot_cert = $num_meta_cert + $course_stats['cert_relesable'];
$GLOBALS['page']->addStart('' . (isset($course_stats['cert_relesable']) && $tot_cert != 0 ? '<tr><th scope="row">' . $lang->def('_CERT_RELESABLE') . ' :</th><td><a href="index.php?modname=mycertificate&op=mycertificate">' . $tot_cert . '</a></td></tr>' : '') . ($pendent != 0 ? '<tr><th scope="row">' . $lang->def('_FRIEND_PENDENT') . ' :</th><td><a href="index.php?modname=myfriends&op=myfriends">' . $pendent . '</a></td></tr>' : '') . '</table>' . '</div>', 'content');
}
// career ------------------------------------------------------------------------
if ($access_search_form) {
$year_array = array(0 => $lang->def('_ALL_YEAR'));
$query_year = "SELECT DISTINCT create_date" . " FROM " . $GLOBALS['prefix_lms'] . "_course";
$result = sql_query($query_year);
while (list($year) = sql_fetch_row($result)) {
$year_array[$year[0] . $year[1] . $year[2] . $year[3]] = $year[0] . $year[1] . $year[2] . $year[3];
}
if (isset($year_array['0000'])) {
unset($year_array['0000']);
}
$GLOBALS['page']->addStart('' . '<div class="course_search">' . '<h2>' . $lang->def('_SEARCH') . '</h2>' . Form::openForm('course_filter', 'index.php?modname=course&op=mycourses') . '<p>' . Form::getLabel('search', $lang->def('_WORD')) . '</p>' . Form::getInputTextfield('textfield_nowh', 'search', 'search', importVar('search'), $lang->def('_WORD'), '255', '') . '<br/>' . '<p>' . Form::getLabel('year', $lang->def('_YEAR')) . '</p>' . Form::getInputDropdown('dropdown_nowh', 'year', 'year', $year_array, importVar('year'), '') . Form::getButton('apply_filter', 'apply_filter', $lang->def('_SEARCH')) . Form::closeForm() . '</div>', 'content');
}
// news ------------------------------------------------------------------------
if ($access_news) {
$GLOBALS['page']->addStart('' . '<div class="course_news">' . '<h2>' . $lang->def('_NEWS') . '</h2>', 'content');
$user_level = Docebo::user()->getUserLevelId();
$user_assigned = Docebo::user()->getArrSt();
$query_news = "\r\n\t\tSELECT idNews, publish_date, title, short_desc, important, viewer\r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_news_internal\r\n\t\tWHERE language = '" . getLanguage() . "'\r\n\t\tORDER BY important DESC, publish_date DESC ";
$re_news = sql_query($query_news);
$displayed = 0;
while (list($id_news, $publish_date, $title, $short_desc, $impo, $viewer) = sql_fetch_row($re_news)) {
$viewer = is_string($viewer) && $viewer != false ? unserialize($viewer) : array();
$intersect = array_intersect($user_assigned, $viewer);
//.........这里部分代码省略.........
示例3: performAction
/**
* this function manage the entire profile, identify the action to perform and do the right sequence of action
* @return string the html to display
*/
function performAction($viewer = false, $start_action = false)
{
$this->setViewer($viewer);
if ($start_action === false) {
$start_action = 'profileview';
}
$ap = Get::req($this->_varname_action, DOTY_MIXED, $start_action);
if (isset($_POST['undo'])) {
$ap = 'profileview';
}
switch ($ap) {
case "goprofile":
$ext_prof = new UserProfile(Get::req('id_user', DOTY_INT, 0), false);
$ext_prof->init($this->_module_name, $this->_platform, $this->_std_query, $this->_varname_action);
return $ext_prof->getProfile();
break;
// display the mod info gui -------------------------------
// display the mod info gui -------------------------------
case "mod_profile":
return $this->getModUser();
break;
case "mod_password":
return $this->_up_viewer->getUserPwdModUi();
break;
case "mod_policy":
return $this->_up_viewer->modUserPolicyGui();
break;
// save modified info of the user -------------------------
// save modified info of the user -------------------------
case "save_policy":
if ($this->_up_data_man->setFieldAccessList($this->_id_user, $this->_up_viewer->getFilledPolicy())) {
// all ok --------------------------------------
$this->_up_viewer->unloadUserData();
if ($this->_end_url !== false) {
Util::jump_to($this->_end_url);
}
return getResultUi($this->_lang->def('_OPERATION_SUCCESSFULPOLICY')) . $this->getProfile();
} else {
// some error saving ---------------------------
return getErrorUi($this->_lang->def('_FAILSAVEPOLICY')) . $this->_up_viewer->modUserPolicyGui();
}
break;
// save modified info of the user -------------------------
// save modified info of the user -------------------------
case "saveinfo":
if (!$this->checkUserInfo()) {
// some error in data filling ------------------
return getErrorUi($this->_last_error) . $this->getModUser();
}
if ($this->saveUserInfo()) {
// all ok --------------------------------------
$this->_up_viewer->unloadUserData();
if ($this->_end_url !== false) {
Util::jump_to($this->_end_url);
}
if (isset($_GET['modname']) && $_GET['modname'] == 'reservation') {
require_once $GLOBALS['where_lms'] . '/lib/lib.reservation.php';
$id_event = Get::req('id_event', DOTY_INT, 0);
$man_res = new Man_Reservation();
$result = $man_res->addSubscription(getLogUserId(), $id_event);
Util::jump_to('index.php?modname=reservation&op=reservation');
} else {
return getResultUi($this->_lang->def('_OPERATION_SUCCESSFULPROFILE')) . $this->getProfile();
}
} else {
// some error saving ---------------------------
return getErrorUi($this->_lang->def('_OPERATION_FAILURE')) . $this->getModUser();
}
break;
// save password -----------------------------------------
// save password -----------------------------------------
case "savepwd":
$re = $this->_up_viewer->checkUserPwd();
if ($re !== true) {
// some error in data filling --------------------
return getErrorUi($re) . $this->_up_viewer->getUserPwdModUi();
}
if ($this->saveUserPwd()) {
// all ok ----------------------------------------
$this->_up_viewer->unloadUserData();
if ($this->_end_url !== false) {
Util::jump_to($this->_end_url);
}
$out = getResultUi($this->_lang->def('_OPERATION_SUCCESSFULPWD'));
if (Get::sett('profile_only_pwd') == 'on') {
// maybe is better if we display only the confirmation message if all is ok, but if you
// want something else add the code here
} else {
$out .= $this->getProfile();
}
return $out;
} else {
// some error saving ----------------------------
return getErrorUi($this->_lang->def('_OPERATION_FAILURE')) . $this->_up_viewer->getUserPwdModUi();
}
break;
//.........这里部分代码省略.........
示例4: checkPerm
function org_manageuser()
{
checkPerm('view_org_chart', false, 'directory', 'framework');
require_once _base_ . '/lib/lib.user_profile.php';
$lang =& DoceboLanguage::createInstance('profile', 'framework');
$profile = new UserProfile(importVar('id_user', true, 0));
$profile->init('profile', 'framework', 'modname=directory&op=org_manageuser&id_user=' . importVar('id_user', true, 0), 'ap');
$profile->enableGodMode();
$profile->setEndUrl('index.php?modname=directory&op=org_chart#user_row_' . importVar('id_user', true, 0));
$GLOBALS['page']->add($profile->getHead() . getBackUi('index.php?modname=directory&op=org_chart', $lang->def('_BACK')) . $profile->performAction() . $profile->getFooter(), 'content');
}
示例5: printOut
function printOut()
{
// addScriptaculousJs();
addJs($GLOBALS['where_lms_relative'] . '/modules/public_user_admin/', 'ajax.public_user_admin.js');
require_once _base_ . '/lib/lib.user_profile.php';
$profile = new UserProfile(getLogUserId());
$profile->init('profile', 'framework', 'modname=public_user_admin&op=org_chart', 'ap');
$profile->addStyleSheet('lms');
$GLOBALS['page']->add('<script type="text/javascript">' . ' setup_directory(\'' . $GLOBALS['where_lms_relative'] . '/modules/directory/ajax.public_user_admin.php\'); ' . '</script>', 'page_head');
$out = '';
if ($this->select_all) {
// This is not a beautiful position for this operation but at this point
// I'm sure that all filter was applied
$rs_all = $this->data->getAllRowsIdst();
if ($rs_all !== FALSE) {
$this->itemSelectedMulti = array();
while (list($all_idst) = sql_fetch_row($rs_all)) {
$this->itemSelectedMulti[] = $all_idst;
}
}
$this->itemSelected = $this->itemSelectedMulti;
}
require_once _base_ . '/lib/lib.form.php';
$ord = importVar('ord', false, 'trans');
$flip = importVar('flip', true, 0);
$filter = new Form();
$out .= $filter->getOpenFieldset($this->lang->def('_SEARCH'));
$out .= $filter->getHidden('ord', 'ord', $ord);
$out .= $filter->getHidden('flip', 'flip', $flip);
if ($this->lms_editions_filter === true) {
if (isset($GLOBALS['course_descriptor']) && $GLOBALS['course_descriptor']->hasEdition()) {
// add editions filter ============================================================
$ed_list = array();
if ($this->editions == false) {
$this->editions = $GLOBALS['course_descriptor']->getEditionsSimpleList(getLogUserId(), true);
}
$sel = isset($_POST[$this->id]['edition_filter']) ? (int) $_POST[$this->id]['edition_filter'] : $GLOBALS['course_descriptor']->getActualEditionsForUser(getLogUserId());
if (!empty($this->editions)) {
$out .= $filter->getDropdown($this->lang->def('_FILTER_BY_EDITION'), $this->id . '_edition_filter', $this->id . '[edition_filter]', $this->editions, $sel);
}
}
}
// end lms editions filter
if ($this->show_simple_filter === TRUE) {
// show simple filter ============================================================
$out .= $filter->getTextfield($this->lang->def('_SIMPLE_FILTER'), $this->id . '_simple_fulltext_search', $this->id . '[simple_fulltext_search]', 255, isset($_POST[$this->id]['simple_fulltext_search']) ? strip_tags(html_entity_decode($_POST[$this->id]['simple_fulltext_search'])) : '', strip_tags($this->lang->def('_SIMPLE_FILTER')));
$out .= '<div class="align_right">' . $filter->getButton($this->id . '_search', $this->id . '[search]', $this->lang->def('_SEARCH'), 'button_nowh') . '</div>';
} else {
// show complex filter ===========================================================
$out .= '<h2 id="customize_filter">' . $this->lang->def('_CUSTOMIZE_FILTERS') . '</h2>';
// --- print check box for flat mode
if ($this->show_flat_mode_flag) {
$out .= $filter->getCheckbox($this->lang->def('_DIRECTORY_FILTER_FLATMODE'), $this->id . '_flat_mode', $this->id . '[flat_mode]', 'flat_mode', $this->flat_mode, "onclick=\"window.document.forms['directory_org_chart'].submit();\"");
} else {
$out .= $filter->getHidden($this->id . '_flat_mode', $this->id . '[flat_mode]', $this->flat_mode ? 'flat_mode' : '');
}
// line for add a field filter
$out .= $filter->openFormLine();
foreach ($this->add_nat_fields as $nat_id => $nat_info) {
$local_arr_fields_translation[$nat_id] = $this->lang->def('_DIRECTORY_FILTER_' . $nat_id);
}
$filter_to_show = $this->arr_fields_translation;
if (is_array($this->arr_fields_filter)) {
foreach ($this->arr_fields_filter as $filter_info) {
if (isset($filter_info['fieldname'])) {
unset($filter_to_show[$filter_info['fieldname']]);
} else {
unset($filter_to_show[$filter_info[0]]);
}
}
}
if (is_array($filter_to_show) && !empty($filter_to_show)) {
$out .= $filter->getInputDropdown('new_filter', $this->id . '_add_field_filter', $this->id . '[add_field_filter]', $filter_to_show, '', '');
$out .= $filter->getButton($this->id . '_add_filter', $this->id . '[add_filter]', $this->lang->def('_NEW_FILTER'), 'button_nowh');
}
$out .= $filter->getButton($this->id . '_del_filter', $this->id . '[del_filter]', $this->lang->def('_RESET'), 'button_nowh');
$out .= $filter->closeFormLine();
if (is_array($this->arr_fields_filter)) {
foreach ($this->arr_fields_filter as $field_id => $field_prop) {
if (!isset($field_prop['fieldname'])) {
// custom field
$arr_field_info = $this->field_list->getBaseFieldInfo($field_prop[FIELD_INFO_TYPE]);
require_once $GLOBALS['where_framework'] . '/modules/field/' . $arr_field_info[FIELD_BASEINFO_FILE];
$field_obj = new $arr_field_info[FIELD_BASEINFO_CLASS]($field_id);
$del_spot = '<input type="image" class="cancel_filter" ' . ' src="' . getPathImage('framework') . 'standard/cancel.png"' . ' id="' . $this->id . '_del_filter_' . $field_id . '"' . ' name="' . $this->id . '[del_filter][' . $field_id . ']"' . ' title="' . $this->lang->def('_DEL') . '"' . ' alt="' . $this->lang->def('_DEL') . '" />';
$out .= $field_obj->play_filter($field_id, isset($field_prop['value']) ? $field_prop['value'] : false, $field_prop[FIELD_INFO_TRANSLATION], $this->id, $del_spot, '', $field_prop[FIELD_INFO_ID]);
//play_filter( $id_field, $value = FALSE, $label = FALSE, $field_prefix = FALSE, $other_after = '', $other_before = '', $field_special = FALSE )
} else {
// base field
$arr_field_info = $this->field_list->getBaseFieldInfo($field_prop['field_type']);
require_once $GLOBALS['where_framework'] . '/modules/field/' . $arr_field_info[FIELD_BASEINFO_FILE];
$field_obj = new $arr_field_info[FIELD_BASEINFO_CLASS](0);
$del_spot = '<input type="image" class="cancel_filter" ' . ' src="' . getPathImage('framework') . 'standard/cancel.png"' . ' id="' . $this->id . '_del_filter_' . $field_id . '"' . ' name="' . $this->id . '[del_filter][' . $field_id . ']"' . ' title="' . $this->lang->def('_DEL') . '"' . ' alt="' . $this->lang->def('_DEL') . '" />';
$out .= $field_obj->play_filter($field_id, isset($field_prop['value']) ? $field_prop['value'] : false, $this->lang->def('_DIRECTORY_FILTER_' . $field_prop['fieldname']), $this->id, $del_spot, '', '');
}
}
}
$out .= $filter->openButtonSpace();
$out .= $filter->getButton('search', 'search', $this->lang->def('_SEARCH'));
$out .= $filter->closeButtonSpace();
//.........这里部分代码省略.........
示例6: message
function message()
{
checkPerm('view');
require_once _base_ . '/lib/lib.table.php';
require_once _base_ . '/lib/lib.form.php';
require_once _base_ . '/lib/lib.user_profile.php';
require_once $GLOBALS['where_framework'] . '/lib/lib.tags.php';
$tags = new Tags('lms_forum');
$tags->setupJs('a[id^=handler-tags-]', 'a[id^=private-handler-tags-]');
require_once _base_ . '/lib/lib.dialog.php';
setupHrefDialogBox('a[href*=delmessage]');
$lang =& DoceboLanguage::createInstance('forum', 'lms');
$id_thread = importVar('idThread', true, 0);
$sema_perm = checkPerm('sema', true);
$moderate = checkPerm('moderate', true);
$mod_perm = checkPerm('mod', true);
$write_perm = checkPerm('write', true);
$acl_man =& Docebo::user()->getAclManager();
$profile_man = new UserProfile(0);
$profile_man->init('profile', 'framework', 'index.php?modname=forum&op=forum');
$tb = new Table(Get::sett('visuItem'), $lang->def('_CAPTION_FORUM_MESSAGE'), $lang->def('_CAPTION_FORUM_MESSAGE'));
$tb->initNavBar('ini', 'link');
$tb->setLink('index.php?modname=forum&op=message&idThread=' . $id_thread);
$ini = $tb->getSelectedElement();
$ini_page = $tb->getSelectedPage();
$first_unread_message = importVar('firstunread', true, 0);
$ini_first_unread_message = importVar('ini', true, 0);
$set_important = importVar('important', true, 0);
if ($set_important == 1) {
$query_set_important = "UPDATE " . $GLOBALS['prefix_lms'] . "_forumthread" . " SET rilevantForum = 1" . " WHERE idThread = '" . $id_thread . "'";
$result_set_important = sql_query($query_set_important);
}
if ($set_important == 2) {
$query_set_important = "UPDATE " . $GLOBALS['prefix_lms'] . "_forumthread" . " SET rilevantForum = 0" . " WHERE idThread = '" . $id_thread . "'";
$result_set_important = sql_query($query_set_important);
}
// Some info about forum and thread
$thread_query = "\r\n\tSELECT idForum, title, num_post, locked, erased, rilevantForum\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_forumthread\r\n\tWHERE idThread = '" . $id_thread . "'";
list($id_forum, $thread_title, $tot_message, $locked_t, $erased_t, $is_important) = sql_fetch_row(sql_query($thread_query));
$forum_query = "\r\n\tSELECT title, locked\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_forum\r\n\tWHERE idForum = '" . $id_forum . "'";
list($forum_title, $locked_f) = sql_fetch_row(sql_query($forum_query));
++$tot_message;
//set as readed if needed
if (isset($_SESSION['unreaded_forum'][$_SESSION['idCourse']][$id_forum][$id_thread])) {
unset($_SESSION['unreaded_forum'][$_SESSION['idCourse']][$id_forum][$id_thread]);
}
if ($ini == 0 && !isset($_GET['result'])) {
sql_query("\r\n\t\tUPDATE " . $GLOBALS['prefix_lms'] . "_forumthread\r\n\t\tSET num_view = num_view + 1\r\n\t\tWHERE idThread = '" . $id_thread . "'");
}
$page_title = array('index.php?modname=forum&op=forum' => $lang->def('_FORUM'), 'index.php?modname=forum&op=thread&idForum=' . $id_forum => $forum_title, $thread_title);
if ($erased_t && !$mod_perm && !$moderate) {
$GLOBALS['page']->add(getTitleArea($page_title, 'forum') . '<div class="std_block">' . $lang->def('_CANNOTENTER') . '</div>', 'content');
return;
}
// Who have semantic evaluation
$re_sema = sql_query("\r\n\tSELECT DISTINCT idmsg\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_forum_sema");
while (list($msg_sema) = sql_fetch_row($re_sema)) {
$forum_sema[$msg_sema] = 1;
}
// Find post
$messages = array();
$authors = array();
$authors_names = array();
$authors_info = array();
$re_message = sql_query("\r\n\tSELECT idMessage, posted, title, textof, attach, locked, author, modified_by, modified_by_on\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_forummessage\r\n\tWHERE idThread = '" . $id_thread . "'\r\n\tORDER BY posted\r\n\tLIMIT {$ini}, " . Get::sett('visuItem'));
while ($record = mysql_fetch_assoc($re_message)) {
$messages[$record['idMessage']] = $record;
$authors[$record['author']] = $record['author'];
if ($record['modified_by'] != 0) {
$authors[$record['modified_by']] = $record['modified_by'];
}
$tag_resource_list[] = $record['idMessage'];
}
$authors_names =& $acl_man->getUsers($authors);
$level_name = CourseLevel::getLevels();
//tags
$tags->loadResourcesTags($tag_resource_list);
// Retriving level and number of post of the authors
if (!empty($authors)) {
$re_num_post = sql_query("\r\n\t\tSELECT u.idUser, u.level, COUNT(*)\r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_forummessage AS m, " . $GLOBALS['prefix_lms'] . "_courseuser AS u\r\n\t\tWHERE u.idCourse = '" . (int) $_SESSION['idCourse'] . "' AND m.author = u.idUser AND m.author IN ( " . implode($authors, ',') . " )\r\n\t\tGROUP BY u.idUser, u.level");
while (list($id_u, $level_u, $num_post_a) = sql_fetch_row($re_num_post)) {
$authors_info[$id_u] = array('num_post' => $num_post_a, 'level' => $level_name[$level_u]);
}
$profile_man->setCahceForUsers($authors);
}
$type_h = array('forum_sender', 'forum_text');
$cont_h = array($lang->def('_AUTHOR'), $lang->def('_TEXTOF'));
$tb->setColsStyle($type_h);
$tb->addHead($cont_h);
// Compose messagges display
$path = $GLOBALS['where_files_relative'] . '/appCore/' . Get::sett('pathphoto');
$counter = 0;
while (list($id_message, $message_info) = each($messages)) {
$counter++;
// sender info
$m_author = $message_info['author'];
//if(isset($authors_names[$m_author]) && $authors_names[$m_author][ACL_INFO_AVATAR] != '') $img_size = @getimagesize($path.$authors_names[$m_author][ACL_INFO_AVATAR]);
$profile_man->setIdUser($m_author);
$author = $profile_man->getUserPanelData(false, 'normal');
$sender = '';
//.........这里部分代码省略.........
示例7: die
\ ======================================================================== */
/**
* @package course management
* @subpackage course catalogue
* @category ajax server
* @author Giovanni Derks
* @version $Id:$
*
*/
if (Docebo::user()->isAnonymous()) {
die('You can\'t access');
}
require_once $GLOBALS['where_framework'] . '/lib/lib.permission.php';
$op = Get::req('op', DOTY_ALPHANUM, '');
switch ($op) {
case "getuserprofile":
$lang =& DoceboLanguage::createInstance('standard', 'framework');
$lang->setGlobal();
require_once _base_ . '/lib/lib.user_profile.php';
$id_user = importVar('id_user', true, 0);
$profile = new UserProfile($id_user);
$profile->init('profile', 'framework', 'modname=directory&op=org_manageuser&id_user=' . $id_user, 'ap');
$profile->enableGodMode();
$profile->disableModViewerPolicy();
$value = array("content" => $profile->getUserInfo(), "id_user" => $id_user);
require_once _base_ . '/lib/lib.json.php';
$json = new Services_JSON();
$output = $json->encode($value);
aout($output);
break;
}
示例8: editprofile
public function editprofile()
{
//check permissions
if (!$this->permissions['mod_user']) {
$output = array('success' => false, 'message' => $this->_getErrorMessage('no permission'));
echo $this->json->encode($output);
return;
}
require_once _base_ . '/lib/lib.user_profile.php';
$id_user = Get::req('id_user', DOTY_INT, -1);
if ($id_user > 0) {
$profile = new UserProfile($id_user);
$profile->init('profile', 'framework', 'r=' . $this->link . '/editprofile&id_user=' . (int) $id_user, 'ap');
if (Docebo::user()->getUserLevelId() == ADMIN_GROUP_GODADMIN) {
$profile->enableGodMode();
}
echo '<br />' . '<div class="std_block">' . getBackUi('index.php?r=' . $this->link . '/show', Lang::t('_BACK', 'standard')) . $profile->performAction() . '</div>';
}
}
示例9: user_details_short
public function user_details_short($link)
{
require_once _lib_ . '/lib.user_profile.php';
$profile = new UserProfile(getLogUserId());
$profile->init('profile', 'framework', 'index.php?r=' . $link, 'ap');
echo $profile->userIdMailProfile('normal', false, false);
}
示例10: dashcourse
//.........这里部分代码省略.........
}
if ($ed_info['user_count'] != '' && $ed_info['date_end'] != '0000-00-00' || $ed_info['classrooms'] != '') {
$html .= '<br />';
}
// number of subscription not limited
/*if($ed_info['max_num_subscribe'] == 0) {
$html .= str_replace( array('[user_count]', '[waiting_count]', ' su [max_user]'),
array($ed_info['user_count'], $ed_info['waiting'], ''),
$lang->def('_USER_EDITION_SUBSCRIBE') );
} else {
// limited number of subscription
$html .= str_replace( array('[user_count]', '[max_subscribe]', '[waiting_count]'),
array($ed_info['user_count'], $ed_info['max_num_subscribe'], $ed_info['waiting']),
$lang->def('_USER_EDITION_SUBSCRIBE_WITH_MAX') );
if($ed_info['user_count'] >= $ed_info['max_num_subscribe'] && $ed_info['allow_overbooking'] == '1') {
// limited number of subscription reached
$html .= '<br/>'.$lang->def('_CAN_JOIN_WAITING_LIST');
}
}
if($ed_info['min_num_subscribe'] != 0) {
$html .= '<br/>'.str_replace('[min_subscribe]', $cinfo['min_num_subscribe'], $lang->def('_MIN_SUBSCRIBE_FOR_EDITION'));
}
$html .= '</p>';*/
// theacher list ----------------------------------------------------------
if (Get::sett('use_social_courselist') == 'on') {
if (isset($ed_info['theacher_list']) && is_array($ed_info['theacher_list']) && !empty($ed_info['theacher_list'])) {
$html .= '<h3 class="course_teacher_list">' . $lang->def('_THEACER_LIST') . '</h3>' . '<ul class="course_teacher_list">';
while (list(, $id_teach) = each($ed_info['theacher_list'])) {
$profile = new UserProfile($id_teach);
$profile->init('profile', 'framework', '', 'ap');
$html .= '<li class="the_course">' . '<a href="' . $url->getUrl('op=showprofile&id_course=' . $cinfo['idCourse'] . '&id_user=' . $id_teach) . '">' . $profile->getUserPhotoOrAvatar('micro') . ' ' . $profile->resolveUsername() . '</a></li>';
}
$html .= '</ul>';
}
}
$html .= '</li>';
}
$html .= '</ul>';
$html .= '<script type="text/javascript">
YAHOO.util.Dom.get(\'course_edition_' . $cinfo['idCourse'] . '\').style.display = \'none\';
YAHOO.util.Dom.get(\'course_edition_' . $cinfo['idCourse'] . '_close\').style.display = \'none\';
</script>';
} elseif (Get::sett('use_social_courselist') == 'on') {
// theacher list ----------------------------------------------------------
if (isset($cinfo['theacher_list']) && is_array($cinfo['theacher_list']) && !empty($cinfo['theacher_list'])) {
$html .= '<h3 class="course_teacher_list">' . $lang->def('_THEACER_LIST') . '</h3>' . '<ul class="course_teacher_list">';
while (list(, $id_teach) = each($cinfo['theacher_list'])) {
$profile = new UserProfile($id_teach);
$profile->init('profile', 'framework', '', 'ap');
$html .= '<li>' . '<a href="' . $url->getUrl('op=showprofile&id_course=' . $cinfo['idCourse'] . '&id_user=' . $id_teach) . '">' . $profile->getUserPhotoOrAvatar('micro') . ' ' . $profile->resolveUsername() . '</a></li>';
}
$html .= '</ul>';
}
}
// course related extra option ---------------------------------------------
if (Get::sett('use_social_courselist') == 'on' || !empty($there_material) || $cinfo['course_demo'] != '') {
$html .= '<ul class="course_related_actions">';
if (Get::sett('use_social_courselist') == 'on') {
$html .= '<li class="course_comment">' . '<a href="javascript:;" onclick="openComment(\'' . $cinfo['idCourse'] . '\'); return false;">' . '<span>' . $lang->def('_COMMENTS') . ' (' . (isset($cinfo['comment_count']) ? $cinfo['comment_count'] : '0') . ')</span></a></li>';
}
// the course material -----------------------------------------------------------------
if (!empty($there_material)) {