本文整理汇总了PHP中Social::enabled方法的典型用法代码示例。如果您正苦于以下问题:PHP Social::enabled方法的具体用法?PHP Social::enabled怎么用?PHP Social::enabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Social
的用法示例。
在下文中一共展示了Social::enabled方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: homeUserProfile
function homeUserProfile($picture = false, $viewer = false, $intest = false)
{
$this->loadUserData($this->getViewer());
$acl_man =& Docebo::user()->getAclManager();
list($class_picture, $this->max_dim_avatar) = $this->getPhotoLimit($picture);
$html = '<div class="up_dashboard"><div class="content">';
$html .= '<p class="logo">' . ($this->user_info[ACL_INFO_AVATAR] != "" ? $this->getPASrc($this->user_info[ACL_INFO_AVATAR], $this->_lang->def('_AVATAR'), 'boxed') : '<img class="boxed" src="' . getPathImage() . 'standard/user.png" alt="' . $this->_lang->def('_NOAVATAR') . '" />') . '</p>';
$html .= '' . '<p class="userinfo">' . '<b>' . $this->_lang->def('_USERNAME') . '</b><br/> ' . $this->acl_man->relativeId($this->user_info[ACL_INFO_USERID]) . '</p>' . '<p class="userinfo">' . '<b>' . $this->_lang->def('_LASTNAME') . '</b><br/> ' . $this->acl_man->relativeId($this->user_info[ACL_INFO_LASTNAME]) . '</p>' . '<p class="userinfo">' . '<b>' . $this->_lang->def('_FIRSTNAME') . '</b><br/> ' . $this->acl_man->relativeId($this->user_info[ACL_INFO_FIRSTNAME]) . '</p>' . '<p class="userinfo">' . '<b>' . $this->_lang->def('_EMAIL') . '</b><br/> ' . ($this->user_info[ACL_INFO_EMAIL] !== false ? '<a href="mailto:' . $this->user_info[ACL_INFO_EMAIL] . '">' . $this->user_info[ACL_INFO_EMAIL] . '</a>' : $this->_lang->def('_HIDDEN')) . '</p>' . '<div class="nofloat"></div>';
$social = new Social();
if ($social->enabled()) {
if (!$social->allConnected()) {
$html .= '<b class="social-accounts-title">' . Lang::t('_CONNECT_YOUR_ACCOUNT_WITH', 'social') . '</b>';
$html .= '<ul class="social-accounts">';
if ($social->isActive('facebook') && !$social->connectedToUser('facebook')) {
$social = new Social();
$social->includeFacebookLib();
$client_id = Get::sett('social_fb_api');
$client_secret = Get::sett('social_fb_secret');
$redirect_uri = Get::sett('url') . 'index.php?modname=login&op=facebook_login';
$serviceFactory = new \OAuth\ServiceFactory();
$storage = new Session();
$credentials = new Credentials($client_id, $client_secret, $redirect_uri);
$facebookService = $serviceFactory->createService('facebook', $credentials, $storage, array());
//, 'userinfo_profile'
$loginUrl = $facebookService->getAuthorizationUri();
$html .= '<li><a href="' . $loginUrl . '" ' . 'title="' . Lang::t('_CONNECT', 'social') . ': ' . Lang::t('_FACEBOOK', 'social') . '"><span>' . Get::img('social/facebook.png', Lang::t('_FACEBOOK', 'social')) . '</span></a></li>';
}
if ($social->isActive('twitter') && !$social->connectedToUser('twitter')) {
$html .= '<li><a href="' . Get::sett('url') . 'index.php?modname=login&op=twitter_login&connect=1" ' . 'title="' . Lang::t('_CONNECT', 'social') . ': ' . Lang::t('_TWITTER', 'social') . '"><span>' . Get::img('social/twitter.png', Lang::t('_TWITTER', 'social')) . '</span></a></li>';
}
if ($social->isActive('linkedin') && !$social->connectedToUser('linkedin')) {
$html .= '<li><a href="' . Get::sett('url') . 'index.php?modname=login&op=linkedin_login&connect=1" ' . 'title="' . Lang::t('_CONNECT', 'social') . ': ' . Lang::t('_LINKEDIN', 'social') . '"><span>' . Get::img('social/linkedin.png', Lang::t('_LINKEDIN', 'social')) . '</span></a></li>';
}
if ($social->isActive('google') && !$social->connectedToUser('google')) {
$html .= '<li><a href="' . Get::sett('url') . 'index.php?modname=login&op=google_login&connect=1" ' . 'title="' . Lang::t('_CONNECT', 'social') . ': ' . Lang::t('_GOOGLE', 'social') . '"><span>' . Get::img('social/google.png', $this->user_info[ACL_INFO_GOOGLE_ID]) . '</span></a></li>';
}
$html .= '</ul><br/>';
}
if ($social->someConnected()) {
$html .= '<b class="social-accounts-title">' . Lang::t('_CONNECTED_ACCOUNTS', 'social') . '</b>';
$html .= '<ul class="social-accounts">';
if ($social->connectedToUser('facebook')) {
$html .= '<li><a id="disconnect_facebook" href="index.php?r=SocialConnect/disconnect&network=facebook" ' . 'title="' . Lang::t('_DISCONNECT', 'social') . ': ' . Lang::t('_FACEBOOK', 'social') . '"><span>' . Get::img('social/facebook.png', Lang::t('_FACEBOOK', 'social')) . '</span></a></li>';
}
if ($social->connectedToUser('twitter')) {
$html .= '<li><a id="disconnect_twitter" href="index.php?r=SocialConnect/disconnect&network=twitter" ' . 'title="' . Lang::t('_DISCONNECT', 'social') . ': ' . Lang::t('_TWITTER', 'social') . '"><span>' . Get::img('social/twitter.png', Lang::t('_TWITTER', 'social')) . '</span></a></li>';
}
if ($social->connectedToUser('linkedin')) {
$html .= '<li><a id="disconnect_linkedin" href="index.php?r=SocialConnect/disconnect&network=linkedin" ' . 'title="' . Lang::t('_DISCONNECT', 'social') . ': ' . Lang::t('_LINKEDIN', 'social') . '"><span>' . Get::img('social/linkedin.png', Lang::t('_LINKEDIN', 'social')) . '</span></a></li>';
}
if ($social->connectedToUser('google')) {
$html .= '<li><a id="disconnect_google" href="index.php?r=SocialConnect/disconnect&network=google" ' . 'title="' . Lang::t('_DISCONNECT', 'social') . ': ' . Lang::t('_GOOGLE', 'social') . '"><span>' . Get::img('social/google.png', $this->user_info[ACL_INFO_GOOGLE_ID]) . '</span></a></li>';
}
$html .= '</ul>';
}
/* $html.=Util::widget('dialog', array(
'id' => 'confirm_disconnect',
'dynamicContent' => false,
'body'=>'mm',
'directSubmit'=>true,
'ajaxUrl' => '"ajax.adm_server.php?r=alms/enrollrules/add"',
'dynamicAjaxUrl' => true,
'callback' => 'function() {
this.destroy();
}',
'callEvents' => array(
array('caller' => 'disconnect_facebook', 'event' => 'click'),
array('caller' => 'disconnect_twitter', 'event' => 'click'),
array('caller' => 'disconnect_linkedin', 'event' => 'click'),
array('caller' => 'disconnect_google', 'event' => 'click'),
)
), true); */
}
$html .= '</div></div>';
// box carriera
require_once $GLOBALS['where_lms'] . '/lib/lib.middlearea.php';
require_once $GLOBALS['where_lms'] . '/modules/course/course.php';
$ma = new Man_MiddleArea();
$access_career = $ma->currentCanAccessObj('career');
//if($this->acl_man->relativeId($this->user_info[ACL_INFO_USERID]) == 'alberto' && $access_career) {
if ($access_career) {
$url = $this->_url_man;
$course_stats = userCourseList($url, false, false);
//TODO: review this call . use course list to compute carreer
$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];
}
$html .= '<div class="inline_block">' . '<h2 class="heading">' . $this->_lang->def('_CAREER') . '</h2>' . '<div class="content">' . '<div class="course_stat">' . '<table summary="">' . '<tr><th scope="row">' . $this->_lang->def('_TOTAL_COURSE') . ' :</th><td>' . ($course_stats['total'] - $end) . '</td></tr>' . (isset($course_stats['with_ustatus'][_CUS_END]) && $course_stats['with_ustatus'][_CUS_END] != 0 ? '<tr><th scope="row">' . $this->_lang->def('_COURSE_END') . ' :</th><td>' . $course_stats['with_ustatus'][_CUS_END] . '</td></tr>' : '') . (isset($course_stats['expiring']) && $course_stats['expiring'] != 0 ? '<tr><th scope="row">' . $this->_lang->def('_COURSE_EXPIRING') . ' :</th><td>' . $course_stats['expiring'] . '</td></tr>' : '');
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) {
$html .= '' . '<tr><th scope="row">' . str_replace('[level]', $lvl[$lvl_num], $this->_lang->def('_COURSE_AS')) . ' :</th><td>' . $quantity . '</td></tr>';
}
//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);
//.........这里部分代码省略.........
示例2: social_login
public function social_login()
{
$res = '';
$social = new Social();
if (!$social->enabled()) {
// we don't show the box if there is nothing enabled..
return $res;
}
$res .= '<div id="social_login">';
$res .= Form::openForm('social_form', Get::rel_path('lms') . '/index.php?modname=login&op=social') . '<span>' . Lang::t('_LOGIN_WITH', 'login') . ' </span>';
if ($social->isActive('facebook')) {
$res .= '<a href="index.php?modname=login&op=facebook_login">' . Get::img('social/facebook-24.png') . '</a>';
}
if ($social->isActive('twitter')) {
$res .= '<a href="index.php?modname=login&op=twitter_login">' . Get::img('social/twitter-24.png') . '</a>';
}
if ($social->isActive('linkedin')) {
$res .= '<a href="index.php?modname=login&op=linkedin_login">' . Get::img('social/linkedin-24.png') . '</a>';
}
if ($social->isActive('google')) {
$res .= '<a href="index.php?modname=login&op=google_login">' . Get::img('social/google-24.png') . '</a>';
}
$res .= Form::closeForm();
$res .= '</div>';
return $res;
}