public function displayList() { $id_lang = $this->context->language->id; $id_shop = $this->context->shop->id; MyFriends::displaySlide(); $limit_per_page = intval($this->conf['list_limit_page']); $current_page = isset($_GET['p']) && is_numeric($_GET['p']) ? intval($_GET['p']) : 1; $start = ($current_page - 1) * $limit_per_page; $list = FriendsInfo::getFriends(); $listFriends = array(); if (isset($list) && is_array($list) && count($list)) { /** pagination * */ // $nb_pages = ceil($nb_articles / $limit_per_page); // $next = $current_page > 1 ? true : false; //articles plus recents // $back = $current_page >= 1 && ($current_page < $nb_pages) ? true : false; //articles precedents $i = 0; foreach ($list as $cat) { $media = FriendsImage::getImageByFriend($cat['id_friend']); $cat['media'] = $media; $listFriends[] = $cat; } // echo '<pre>'; // print_r($listCategories); // echo '</pre>'; $this->context->smarty->assign(array('list_friends' => $listFriends, 'img_friend_dir' => _THEME_FRIEND_DIR_)); } $this->setTemplate('list.tpl'); }
function delfriend(&$url) { checkPerm('view'); require_once $GLOBALS['where_framework'] . '/lib/lib.myfriends.php'; $lang =& DoceboLanguage::createInstance('myfriends', 'lms'); $my_fr = new MyFriends(getLogUserId()); $id_friend = importVar('id_friend', true, 0); $GLOBALS['page']->add(getTitleArea(array($url->getUrl() => $lang->def('_MY_FRIENDS'), $lang->def('_REMOVE_FRIEND')), 'myfriends') . '<div class="std_block">', 'content'); if (isset($_GET['confirm'])) { if ($my_fr->delFriend($id_friend)) { Util::jump_to($url->getUrl('result=ok_del')); } $GLOBALS['page']->add(getErrorUi($lang->def('_ERR_REMOVE_FRIEND'))); } $ui = $my_fr->getFriendsInfo(array($id_friend)); if ($ui == false) { $GLOBALS['page']->add(getErrorUi($lang->def('_INVALID_FRIEND'))); } else { $acl_man =& Docebo::user()->getAclManager(); $ui = current($ui); $GLOBALS['page']->add(getDeleteUi($lang->def('_AREYOUSURE'), '<span>' . $lang->def('_USERNAME') . ' : </span>' . $acl_man->relativeId($ui[ACL_INFO_USERID]) . '<br />' . '<span>' . $lang->def('_USERCOMPLETENAME') . ' : </span>' . $ui[ACL_INFO_LASTNAME] . ($ui[ACL_INFO_LASTNAME] != '' ? ' ' : '') . $ui[ACL_INFO_FIRSTNAME], true, $url->getUrl('op=delfriend&id_friend=' . $id_friend . '&confirm=1'), $url->getUrl()), 'content'); } $GLOBALS['page']->add('</div>', 'content'); }
/** * check if a check_user is firend of id_user with a direct query, ignore cahced data */ function isFriendNoCache($id_user, $check_user, $also_waiting = false) { if ($id_user == $check_user) { return true; } require_once $GLOBALS['where_framework'] . '/lib/lib.myfriends.php'; $mf = new MyFriends($id_user); return $mf->isFriend($check_user, $also_waiting); }
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 = '******'" . " 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 = '******'" . " 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 = '******'" . " 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 = '******'" . " 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); if (!empty($intersect) || empty($viewer)) { $GLOBALS['page']->addStart('<h3>' . $title . '</h3>' . '<div class="news_textof">' . '<span class="news_data">' . Format::date($publish_date, 'date') . ' - </span>' . $short_desc . '</div>', 'content'); $displayed++; } } // end news display if (!$displayed) { $GLOBALS['page']->addStart($lang->def('_NO_CONTENT'), 'content'); } $GLOBALS['page']->addStart('' . '</div>', 'content'); } if (!$onecol) { $GLOBALS['page']->addStart('' . '</div>', 'content'); $GLOBALS['page']->addStart('' . '<div id="mycourse_right">', 'content'); } // ------------------------------------------------------------------------ if (!$onecol) { $GLOBALS['page']->addEnd('' . '</div>' . '<div class="nofloat"></div>', 'content'); } $GLOBALS['page']->addEnd('' . '</div>', 'content'); if ($ma->currentCanAccessObj('lo_tab')) { $current_tab = importVar('current_tab', false, 'lo_plan'); $GLOBALS['page']->addStart('<div class="lo_tab">' . '<h1>' . $lang->def('_WELCOME') . ': ' . '<span>' . Docebo::user()->getUserName() . '</span>' . '</h1>' . '<ul class="flat_tab">' . ($course_stats['with_ustatus'][_CUS_END] != $course_stats['total'] ? '<li ' . ($current_tab == 'lo_plan' ? 'class="now_selected"' : '') . '>' . '<a href="index.php?modname=course&op=mycourses&current_tab=lo_plan"><span>' . $lang->def('_COURSE') . '</span></a></li>' : '') . ($course_stats['with_ustatus'][_CUS_END] != 0 ? '<li ' . ($current_tab == 'lo_history' ? 'class="now_selected"' : '') . '>' . '<a href="index.php?modname=course&op=mycourses&current_tab=lo_history"><span>' . $lang->def('_COMPLETED') . '</span></a></li>' : '') . ($course_stats['with_wstatus'][_CUS_RESERVED] != 0 || $course_stats['with_wstatus'][_CUS_WAITING_LIST] != 0 ? '<li ' . ($current_tab == 'lo_waiting' ? 'class="now_selected"' : '') . '>' . '<a href="index.php?modname=course&op=mycourses&current_tab=lo_waiting"><span>' . $lang->def('_LO_WAITING') . '</span></a></li>' : '') . '</ul>' . '</div>', 'content'); } else { $GLOBALS['page']->addStart('<div class="lo_tab">' . '<h1 class="no_tab">' . $lang->def('_WELCOME') . ': ' . '<span>' . Docebo::user()->getUserName() . '</span>' . '</h1>' . '</div>', 'content'); } }
function isViewerFriend() { if ($this->_viewer_friend != NULL) { return $this->_viewer_friend; } require_once $GLOBALS['where_framework'] . '/lib/lib.myfriends.php'; $mf = new MyFriends($this->_id_user); $this->_viewer_friend = $mf->isFriend($this->_viewer); return $this->_viewer_friend; }
$tab2 = new Tab(); $tab2->class_name = "AdminFriendsImage"; $tab2->module = "myfriends"; $tab2->id_parent = $blog_tab_id; foreach ($langs as $l) { $tab2->name[$l['id_lang']] = $this->l('Friends Images/Videos'); } $tab2->save(); /* * * RIGHTS MANAGEMENT ** */ Db::getInstance()->Execute('DELETE FROM ' . _DB_PREFIX_ . 'access WHERE `id_tab` = ' . (int) $tab0->id . ' OR `id_tab` = ' . (int) $tab1->id . '
$value = array('_SEND' => $lang->def('_SEND'), '_UNDO' => $lang->def('_UNDO'), '_SUBJECT' => $lang->def('_SUBJECT'), '_MESSAGE_TEXT' => $lang->def('_MESSAGE_TEXT'), '_OPERATION_SUCCESSFUL' => $lang->def('_OPERATION_SUCCESSFUL'), '_OPERATION_FAILURE' => $lang->def('_OPERATION_FAILURE')); require_once _base_ . '/lib/lib.json.php'; $json = new Services_JSON(); $output = $json->encode($value); aout($output); break; case "send_ask_friend": require_once $GLOBALS['where_framework'] . '/lib/lib.myfriends.php'; $module_name = Get::req('module_name', DOTY_ALPHANUM, ''); $platform = Get::req('platform', DOTY_ALPHANUM, ''); $id_friend = importVar('id_friend'); $message_request = importVar('message_request'); $lang =& DoceboLanguage::createInstance('standard', 'framework'); $lang->setGlobal(); $lang =& DoceboLanguage::createInstance($module_name, $platform); $my_fr = new MyFriends(getLogUserId()); if ($my_fr->addFriend($id_friend, MF_WAITING, $message_request)) { $value = array('re' => true); } else { $value = array('re' => false); } require_once _base_ . '/lib/lib.json.php'; $json = new Services_JSON(); $output = $json->encode($value); aout($output); break; case "send_message": require_once $GLOBALS['where_framework'] . '/lib/lib.message.php'; $module_name = importVar('module_name'); $platform = importVar('platform'); $recipient = importVar('send_to');