예제 #1
0
 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&amp;op=twitter_login&amp;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&amp;op=linkedin_login&amp;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&amp;op=google_login&amp;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&amp;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&amp;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&amp;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&amp;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_ . '&amp;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 = '******'" . " 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'];
         $html .= '' . (isset($course_stats['cert_relesable']) && $tot_cert != 0 ? '<tr><th scope="row">' . $this->_lang->def('_CERT_RELESABLE') . ' :</th><td><a href="index.php?modname=mycertificate&amp;op=mycertificate">' . $tot_cert . '</a></td></tr>' : '') . ($pendent != 0 ? '<tr><th scope="row">' . $this->_lang->def('_FRIEND_PENDENT') . ' :</th><td><a href="index.php?modname=myfriends&amp;op=myfriends">' . $pendent . '</a></td></tr>' : '') . '</table>' . '</div>' . '</div>' . '</div>';
     }
     /*
     		$html = '<div class="user_presentation">'."\n"
     
     			.( $intest
     				? '<div class="mini_block">'."\n\t"
     						.'<h1>'."\n\t\t"
     							.$this->_lang->def('_WELCOME').'<br/>'."\n\t\t"
     							.'<span>'.$this->resolveUsername().'</span>'."\n\t"
     						.'</h1>'."\n\t"
     						.'<div class="spacer"></div>'."\n\t"
     					.'</div>'."\n"
     
     				: '' );
     
     		if($this->_user_profile->useAvatar()) {
     			$html .= '<div class="mini_block avatar_photo">'."\n\t";
     		}
     		if($this->_user_profile->useAvatar()) {
     
     			$html .= '<p>'."\n\t"
     						.( ($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').'" />' )."\n\t\t"
     						.'<br />'."\n\t\t"
     						.$this->_lang->def('_AVATAR')."\n\t\t"
     					.'</p>'."\n\t";
     		}
     		if($this->_user_profile->useAvatar()) {
     
     			$html .= '<div class="nofloat"></div>'."\n\t"
     					.'<div class="spacer"></div>'."\n"
     					.'</div>'."\n";
     		}
     
     		$html .= '<div class="mini_block">'."\n\t"
     				.'<p class="userinfo">'."\n\t\t"
     					.'<b>'.$this->_lang->def('_USERNAME').':</b> '.$this->acl_man->relativeId($this->user_info[ACL_INFO_USERID])
     				.'</p>'."\n\t"
     				.'<p class="userinfo">'."\n\t\t"
     					.'<b>'.$this->_lang->def('_EMAIL').':</b> '
     					.( $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')
     					)."\n\t"
     				.'</p>'."\n\t"
     			.'</div>'."\n"
     
     		.'</div>'."\n";
     */
     return $html;
 }
예제 #2
0
 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&amp;op=social') . '<span>' . Lang::t('_LOGIN_WITH', 'login') . ' </span>';
     if ($social->isActive('facebook')) {
         $res .= '<a href="index.php?modname=login&amp;op=facebook_login">' . Get::img('social/facebook-24.png') . '</a>';
     }
     if ($social->isActive('twitter')) {
         $res .= '<a href="index.php?modname=login&amp;op=twitter_login">' . Get::img('social/twitter-24.png') . '</a>';
     }
     if ($social->isActive('linkedin')) {
         $res .= '<a href="index.php?modname=login&amp;op=linkedin_login">' . Get::img('social/linkedin-24.png') . '</a>';
     }
     if ($social->isActive('google')) {
         $res .= '<a href="index.php?modname=login&amp;op=google_login">' . Get::img('social/google-24.png') . '</a>';
     }
     $res .= Form::closeForm();
     $res .= '</div>';
     return $res;
 }