public function init()
 {
     YuiLib::load('base,tabview');
     require_once _lms_ . '/lib/lib.course.php';
     require_once _lms_ . '/lib/lib.subscribe.php';
     require_once _lms_ . '/lib/lib.levels.php';
     $this->cstatus = array(CST_PREPARATION => '_CST_PREPARATION', CST_AVAILABLE => '_CST_AVAILABLE', CST_EFFECTIVE => '_CST_CONFIRMED', CST_CONCLUDED => '_CST_CONCLUDED', CST_CANCELLED => '_CST_CANCELLED');
     $this->ustatus = array(_CUS_WAITING_LIST => '_WAITING', _CUS_CONFIRMED => '_T_USER_STATUS_CONFIRMED', _CUS_SUBSCRIBED => '_T_USER_STATUS_SUBS', _CUS_BEGIN => '_T_USER_STATUS_BEGIN', _CUS_END => '_T_USER_STATUS_END');
     $this->levels = CourseLevel::getLevels();
     $this->path_course = $GLOBALS['where_files_relative'] . '/appLms/' . Get::sett('pathcourse') . '/';
     $upd = new UpdatesLms();
     $this->info = $upd->courseUpdates();
 }
 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;
 }
 function _printTable_delay($type, &$element_to_print, $showed_cols = array())
 {
     if (!$type) {
         $type = 'html';
     }
     if (empty($element_to_print)) {
         cout($this->lang->def('_NO_USER_FOUND'), 'content');
     } else {
         require_once _lms_ . '/admin/modules/report/report_tableprinter.php';
         $buffer = new ReportTablePrinter($type);
         //ksort($element_to_print);
         foreach ($element_to_print as $id_course => $info) {
             $course_name = $info['name'];
             $header = array();
             foreach ($this->delay_columns as $delay_row) {
                 $index = $this->_check_delay_column($delay_row['key']);
                 //backward compatibility
                 if ($delay_row['select'] && in_array($index, $showed_cols) || !$delay_row['select']) {
                     $header[] = $delay_row['label'];
                 }
             }
             if ($this->use_mail) {
                 $header[] = array('style' => 'img-cell', 'value' => $this->_loadEmailIcon());
             }
             $title = Lang::t('_COURSE', 'standard') . ': "' . $course_name . '" (' . $info['code'] . ')';
             $buffer->openTable($title, $title);
             $buffer->openHeader();
             $buffer->addHeader($header);
             $buffer->closeHeader();
             $buffer->openBody();
             $user_levels_trans = false;
             $i = 0;
             foreach ($info['data'] as $user_info) {
                 $line = array();
                 foreach ($this->delay_columns as $delay_row) {
                     $index = $this->_check_delay_column($delay_row['key']);
                     //backward compatibility
                     if ($delay_row['select'] && in_array($index, $showed_cols) || !$delay_row['select']) {
                         switch ($index) {
                             case 'level':
                                 if ($user_levels_trans === false) {
                                     require_once _lms_ . '/lib/lib.levels.php';
                                     $clevels = new CourseLevel();
                                     $user_levels_trans = $clevels->getLevels();
                                     unset($clevels);
                                 }
                                 $line[] = array('style' => 'align-center', 'value' => $user_levels_trans[$user_info['level']]);
                                 break;
                             case 'status':
                                 $line[] = array('style' => 'align-center', 'value' => $this->status_u[$user_info['status']]);
                                 break;
                             case 'date_subscription':
                             case 'date_first_access':
                             case 'date_last_access':
                             case 'date_complete':
                                 if ($user_info[$index] == '0000-00-00 00:00:00' || $user_info[$index] == '') {
                                     $line[] = '';
                                 } else {
                                     $line[] = array('style' => 'align-center', 'value' => Format::date($user_info[$index], 'datetime'));
                                 }
                                 break;
                             case 'email':
                                 $line[] = trim($user_info['mail']);
                                 break;
                             default:
                                 $line[] = $user_info[$index];
                                 break;
                         }
                     }
                 }
                 if ($this->use_mail) {
                     $line[] = array('style' => 'img-cell', 'value' => '<div class="align_center">' . Form::getInputCheckbox('mail_' . $user_info['idUser'], 'mail_recipients[]', $user_info['idUser'], isset($_POST['select_all']), '') . '</div>');
                 }
                 $buffer->addLine($line);
             }
             $buffer->closeBody();
             $buffer->closeTable();
             $buffer->addBreak();
         }
         cout($buffer->get(), 'content');
     }
 }
Example #4
0
function dashmycourse(&$url, $lang, &$subscription, $cinfo, $index)
{
    require_once $GLOBALS['where_lms'] . '/lib/lib.levels.php';
    $lvl = CourseLevel::getLevels();
    $arr_status = array(_CUS_RESERVED => $lang->def('_T_USER_STATUS_RESERVED'), _CUS_WAITING_LIST => $lang->def('_WAITING_USERS'), _CUS_CONFIRMED => $lang->def('_T_USER_STATUS_CONFIRMED'), _CUS_SUBSCRIBED => $lang->def('_T_USER_STATUS_SUBS'), _CUS_BEGIN => $lang->def('_T_USER_STATUS_BEGIN'), _CUS_END => $lang->def('_T_USER_STATUS_END'));
    DoceboLanguage::createInstance('course', 'lms');
    $arr_coursestatus = array(CST_PREPARATION => $lang->def('_CST_PREPARATION', 'course', 'lms'), CST_AVAILABLE => $lang->def('_CST_AVAILABLE', 'course', 'lms'), CST_EFFECTIVE => $lang->def('_CST_CONFIRMED', 'course', 'lms'), CST_CONCLUDED => $lang->def('_CST_CONCLUDED', 'course', 'lms'), CST_CANCELLED => $lang->def('_CST_CANCELLED', 'course', 'lms'));
    $course_type = $cinfo['course_type'];
    $there_material = array();
    if ($cinfo['img_othermaterial'] != '') {
        $there_material[] = '&id_course=' . $cinfo['idCourse'];
    }
    // course title -----------------------------------------------------
    $cinfo = array_merge($cinfo, $subscription['course'][$cinfo['idCourse']]);
    // -----------------------------------------------------------------
    $courseuser_st = -10;
    $html = '';
    $intest = '';
    if (!isset($subscription['edition'][$cinfo['idCourse']])) {
        $access = Man_Course::canEnterCourse($cinfo);
        $lb_param = "";
        if ($cinfo['first_is_scorm'][0] != '' && $cinfo['first_is_scorm'][0] != '0') {
            $lb_param .= ";width=" . $cinfo['first_is_scorm'][0] . "";
        }
        if ($cinfo['first_is_scorm'][1] != '' && $cinfo['first_is_scorm'][1] != '0') {
            $lb_param .= ";height=" . $cinfo['first_is_scorm'][1] . "";
        }
        $intest .= '<h2>';
        if ($access['can']) {
            $intest .= '' . ($cinfo['lang_code'] && $cinfo['lang_code'] != 'none' ? '<img src="' . getPathImage('cms') . 'language/' . $cinfo['lang_code'] . '.png" alt="' . $cinfo['lang_code'] . '" /> ' : '') . '<a class="course_enter" href="index.php?modname=course&amp;op=aula&amp;idCourse=' . $cinfo['idCourse'] . '" ' . ($cinfo['direct_play'] == 1 && $cinfo['level'] <= 3 && $cinfo['first_is_scorm'] ? ' rel="shadowbox' . $lb_param . '" title="' . $cinfo['name'] . '"' : ' title="' . $lang->def('_ENTER') . '"') . '>' . $cinfo['name'] . '</a>';
        } else {
            $intest .= '<img class="image_lock" id="locked_' . $cinfo['idCourse'] . '" src="' . getPathImage() . 'course/lock.gif" alt="' . $lang->def('_NOENTER') . '" />' . ($cinfo['lang_code'] && $cinfo['lang_code'] != 'none' ? '<img src="' . getPathImage('cms') . 'language/' . $cinfo['lang_code'] . '.png" alt="' . $cinfo['lang_code'] . '" /> ' : '') . $cinfo['name'] . '';
        }
        $intest .= '</h2>';
        // not editon
        //if($cinfo['level'] >= 4) {
        $intest .= '<p class="course_support_info">' . str_replace(array('[course_type]', '[create_date]', '[enrolled]', '[course_status]'), array($course_type, createDateDistance($cinfo['create_date'], 'catalogue', true), isset($cinfo['enrolled'][0]) ? $cinfo['enrolled'][0] : 0, $arr_coursestatus[$cinfo['course_status']]), $lang->def('_COURSE_INTRO')) . ($cinfo['date_begin'] != '0000-00-00' || $cinfo['date_end'] != '0000-00-00' ? str_replace(array('[date_begin]', '[date_end]'), array(Format::date($cinfo['date_begin'], 'date'), Format::date($cinfo['date_end'], 'date')), $lang->def('_COURSE_DATE')) : '') . '</p>';
        //}
        if ($cinfo['classrooms'] != '') {
            $intest .= '<p class="course_support_info">' . str_replace(array('[classrooms_name]', '[classrooms_location]'), array($cinfo['classrooms']['classroom'], $cinfo['classrooms']['location']), $lang->def('_IN_THE_CLASSROOM')) . '</p>';
        }
        $intest .= '<p class="course_support_info">' . $arr_status[$cinfo['user_status']] . ($cinfo['level'] >= 4 ? str_replace('[level]', $lvl[$cinfo['level']], $lang->def('_USER_LVL')) . ' ' . (trim($cinfo['code']) != '' ? '<br />[' . $cinfo['code'] . '] ' : '') : '') . '</p>';
        if (isset($access['expiring_in']) && $access['expiring_in'] != false && $access['expiring_in'] < 30) {
            $intest .= '<p class="course_support_info">' . str_replace('[expiring_in]', $access['expiring_in'], $lang->def('_EXPIRING_IN')) . '</p>';
        }
        if ($cinfo['show_result'] && $cinfo['user_status'] > _CUS_SUBSCRIBED && $cinfo['user_status'] < _CUS_SUSPEND) {
            $intest .= '<p class="course_support_info show_results">' . '<a href="index.php?modname=course&amp;op=aula&amp;idCourse=' . $cinfo['idCourse'] . '&amp;showresult=1">' . $lang->def('_SHOW_RESULTS') . '</a>' . '</p>';
        }
        $courseuser_st = $cinfo['user_status'];
    } elseif (count($subscription['edition'][$cinfo['idCourse']]) == 1) {
        // edition unique--------------------------------------------------------------------------------
        list($ed_id, $sub_info) = each($subscription['edition'][$cinfo['idCourse']]);
        $ed_info =& $cinfo['edition_list'][$ed_id];
        $cinfo['date_begin'] = $ed_info['date_begin'];
        $cinfo['date_end'] = $ed_info['date_end'];
        $access = Man_Course::canEnterCourse($cinfo);
        if ($ed_info['date_begin'] == '0000-00-00') {
            $ed_info['date_begin'] = '';
        }
        if ($ed_info['date_end'] == '0000-00-00') {
            $ed_info['date_end'] = '';
        }
        $intest = '<h2>';
        if ($access['can']) {
            $intest .= '<a class="course_enter" href="index.php?modname=course&amp;op=aula&amp;idCourse=' . $cinfo['idCourse'] . '&amp;id_e=' . $ed_id . '" ' . 'title="' . $lang->def('_ENTER') . '">' . ($cinfo['lang_code'] && $cinfo['lang_code'] != 'none' ? '<img src="' . getPathImage('cms') . 'language/' . $cinfo['lang_code'] . '.png" alt="' . $cinfo['lang_code'] . '" /> ' : '') . $ed_info['name'] . ($ed_info['date_begin'] != '' || $ed_info['date_end'] != '' ? ' <span>( ' . Format::date($ed_info['date_begin'], 'date') . ' ' . Format::date($ed_info['date_end'], 'date') . ' )</span> ' : '') . '</a>';
        } else {
            $intest .= '<img id="locked_' . $cinfo['idCourse'] . '" src="' . getPathImage() . 'course/lock.gif" alt="' . $lang->def('_NOENTER') . '" />' . ($cinfo['lang_code'] && $cinfo['lang_code'] != 'none' ? '<img src="' . getPathImage('cms') . 'language/' . $cinfo['lang_code'] . '.png" alt="' . $cinfo['lang_code'] . '" /> ' : '') . (trim($ed_info['code']) != '' ? '[' . $ed_info['code'] . '] ' : '') . $ed_info['name'] . ($ed_info['date_begin'] != '' || $ed_info['date_end'] != '' ? ' <span>( ' . Format::date($ed_info['date_begin'], 'date') . ' ' . Format::date($ed_info['date_end'], 'date') . ' )</span> ' : '');
        }
        $intest .= '</h2>';
        //if($sub_info['level'] >= 4) {
        $intest .= '<p class="course_support_info">' . str_replace(array('[course_type]', '[create_date]', '[enrolled]', '[course_status]'), array($ed_info['edition_type'], createDateDistance($cinfo['create_date'], 'catalogue', true), $cinfo['enrolled'][$ed_id], $arr_coursestatus[$ed_info['status']]), $lang->def('_COURSE_INTRO')) . '</p>';
        //}
        if ($ed_info['classrooms'] != '') {
            $intest .= '<p class="course_support_info">' . str_replace(array('[classrooms_name]', '[classrooms_location]'), array($ed_info['classrooms']['classroom'], $ed_info['classrooms']['location']), $lang->def('_IN_THE_CLASSROOM')) . '</p>';
        }
        $intest .= '<p class="course_support_info">' . $arr_status[$sub_info['user_status']] . str_replace('[level]', $lvl[$sub_info['level']], $lang->def('_USER_LVL')) . ' ' . (trim($cinfo['code']) != '' && $sub_info['level'] >= 4 ? '<br />[' . $cinfo['code'] . '] ' : '') . '</p>';
        if ($access['expiring_in'] != false && $access['expiring_in'] < 30) {
            $intest .= '<p class="course_support_info">' . str_replace('[expiring_in]', $access['expiring_in'], $lang->def('_EXPIRING_IN')) . '</p>';
        }
        $courseuser_st = $sub_info['user_status'];
    } else {
        // more than one edition ------------------------------------------------------------------------
        foreach ($subscription['edition'][$cinfo['idCourse']] as $ed_id => $sub_info) {
            //list($ed_id, $sub_info)  = each($subscription['edition'][$cinfo['idCourse']]);
            $ed_info =& $cinfo['edition_list'][$ed_id];
            $cinfo['date_begin'] = $ed_info['date_begin'];
            $cinfo['date_end'] = $ed_info['date_end'];
            $access = Man_Course::canEnterCourse($cinfo);
            if ($ed_info['date_begin'] == '0000-00-00') {
                $ed_info['date_begin'] = '';
            }
            if ($ed_info['date_end'] == '0000-00-00') {
                $ed_info['date_end'] = '';
            }
            $intest .= '<h2>';
            if ($access['can']) {
                $intest .= '<a class="course_enter" href="index.php?modname=course&amp;op=aula&amp;idCourse=' . $cinfo['idCourse'] . '&amp;id_e=' . $ed_id . '" ' . 'title="' . $lang->def('_ENTER') . '">' . ($cinfo['lang_code'] && $cinfo['lang_code'] != 'none' ? '<img src="' . getPathImage('cms') . 'language/' . $cinfo['lang_code'] . '.png" alt="' . $cinfo['lang_code'] . '" /> ' : '') . $ed_info['name'] . ($ed_info['date_begin'] != '' || $ed_info['date_end'] != '' ? ' <span>( ' . Format::date($ed_info['date_begin'], 'date') . ' ' . Format::date($ed_info['date_end'], 'date') . ' )</span> ' : '') . '</a>';
            } else {
                $intest .= '<img id="locked_' . $cinfo['idCourse'] . '" src="' . getPathImage() . 'course/lock.gif" alt="' . $lang->def('_NOENTER') . '" />' . ($cinfo['lang_code'] && $cinfo['lang_code'] != 'none' ? '<img src="' . getPathImage('cms') . 'language/' . $cinfo['lang_code'] . '.png" alt="' . $cinfo['lang_code'] . '" /> ' : '') . (trim($ed_info['code']) != '' ? '[' . $ed_info['code'] . '] ' : '') . $ed_info['name'] . ($ed_info['date_begin'] != '' || $ed_info['date_end'] != '' ? ' <span>( ' . Format::date($ed_info['date_begin'], 'date') . ' ' . Format::date($ed_info['date_end'], 'date') . ' )</span> ' : '');
            }
            $intest .= '</h2>';
            //if($sub_info['level'] >= 4) {
            $intest .= '<p class="course_support_info">' . str_replace(array('[course_type]', '[create_date]', '[enrolled]', '[course_status]'), array($ed_info['edition_type'], createDateDistance($cinfo['create_date'], 'catalogue', true), $cinfo['enrolled'][$ed_id], $arr_coursestatus[$ed_info['status']]), $lang->def('_COURSE_INTRO')) . '</p>';
            //}
            if ($ed_info['classrooms'] != '') {
                $intest .= '<p class="course_support_info">' . str_replace(array('[classrooms_name]', '[classrooms_location]'), array($ed_info['classrooms']['classroom'], $ed_info['classrooms']['location']), $lang->def('_IN_THE_CLASSROOM')) . '</p>';
            }
            $intest .= '<p class="course_support_info">' . $arr_status[$sub_info['user_status']] . str_replace('[level]', $lvl[$sub_info['level']], $lang->def('_USER_LVL')) . (trim($cinfo['code']) != '' && $sub_info['level'] >= 4 ? '<br />[' . $cinfo['code'] . '] ' : '') . '</p>';
        }
        if ($access['expiring_in'] != false && $access['expiring_in'] < 30) {
            $intest .= '<p class="course_support_info">' . str_replace('[expiring_in]', $access['expiring_in'], $lang->def('_EXPIRING_IN')) . '</p>';
        }
        $courseuser_st = $courseuser_st < $sub_info['user_status'] ? $sub_info['user_status'] : $courseuser_st;
    }
    // -----------------------------------------------------------------------------------------
    $html = '<div class="course_container' . (Get::sett('use_social_courselist') == 'on' ? ' double_height' : '') . ($index == 0 ? ' course_container_first' : '') . ($courseuser_st == _CUS_SUBSCRIBED ? ' cc_inprogress' : '') . ($courseuser_st == _CUS_BEGIN ? ' cc_begin' : '') . '">';
    if ($cinfo['use_logo_in_courselist'] == '1' && $cinfo['img_course'] != '' || Get::sett('use_social_courselist') == 'on') {
        $html .= '<div class="course_info_container">';
    }
    if ($cinfo['use_logo_in_courselist'] == '1' && $cinfo['img_course'] != '') {
        $html .= '<ul class="course_score"><li>';
        $html .= '<img height="70" src="' . $GLOBALS['where_files_relative'] . '/doceboLms/' . Get::sett('pathcourse') . $cinfo['img_course'] . '" alt="' . $lang->def('_COURSE_LOGO') . '" />';
        $html .= '</li></ul>';
    }
    $html .= $intest;
    $li = '';
    $li .= '<li class="advice_to_read">' . '<img src="' . getPathImage('lms') . 'coursecatalogue/' . ($cinfo['to_read']['advice'] != 0 ? 'adv_advice' : 'no_advice') . '.jpg" ' . ' title="' . str_replace('[advice]', $cinfo['to_read']['advice'], $lang->def('_ADVERT_ADVICE')) . '" ' . ' alt="' . str_replace('[advice]', $cinfo['to_read']['advice'], $lang->def('_ADVERT_ADVICE')) . '" />' . '</li>';
    $li .= '<li class="forum_to_read">' . '<img src="' . getPathImage('lms') . 'coursecatalogue/' . ($cinfo['to_read']['forum'] != 0 ? 'adv_forum' : 'no_forum') . '.jpg" ' . ' title="' . str_replace('[forum]', $cinfo['to_read']['forum'], $lang->def('_ADVERT_FORUM')) . '" ' . ' alt="' . str_replace('[forum]', $cinfo['to_read']['forum'], $lang->def('_ADVERT_FORUM')) . '" />' . '</li>';
    $li .= '<li class="lobj_to_read">' . '<img src="' . getPathImage('lms') . 'coursecatalogue/' . ($cinfo['to_read']['lobj'] != 0 ? 'adv_lobj' : 'no_lobj') . '.jpg" ' . ' title="' . str_replace('[lobj]', $cinfo['to_read']['lobj'], $lang->def('_ADVERT_LOBJ')) . '" ' . ' alt="' . str_replace('[lobj]', $cinfo['to_read']['lobj'], $lang->def('_ADVERT_LOBJ')) . '" />' . '</li>';
    if ($li != '') {
        $html .= '<ul class="course_advertising">' . $li . '</ul>';
    }
    // course related extra option -------------------------------------------------------------
    if (Get::sett('use_social_courselist') == 'on' || !empty($there_material)) {
        $li = '';
        if (Get::sett('use_social_courselist') == 'on') {
            $li .= '<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)) {
            if (count($there_material) == 1) {
                // direct download of material -------------------------------------------------
                $li .= '<li class="course_materials">' . '<a href="' . $url->getUrl('op=donwloadmaterials' . array_pop($there_material)) . '">' . '<span>' . $lang->def('_MATERIALS') . '</span></a>' . '</li>';
            } else {
                // popup download of material --------------------------------------------------
                $li .= '<li class="course_materials">' . '<a href="javascript:;" onclick="openWindowWithAction(\'' . $cinfo['idCourse'] . '\', \'course_materials\'); return false;">' . '<span>' . $lang->def('_MATERIALS') . '</span></a>' . '</li>';
            }
        }
        if ($li != '') {
            $html .= '<ul class="course_related_actions">' . $li . '</ul>';
        }
    }
    /*if ($cinfo['direct_play'] == 1) {
    		$html .= '<p class="showresults">'
    			.'<a href="index.php?modname=course&amp;op=showresults&amp;id_course='.$cinfo['idCourse'].'">'
    			.'<span>'.$lang->def('_SHOW_RESULTS').'</span></a>'
    			.'</p>';
    	}*/
    // score and subscribe action ------------------------------------------------------------
    if (Get::sett('use_social_courselist') == 'on') {
        $html .= '<ul class="course_score">';
        $html .= '<li class="current_score"><span>' . $lang->def('_SCORE') . '</span><br />' . '<strong id="course_score_' . $cinfo['idCourse'] . '">' . $cinfo['course_vote'] . '</strong></li>';
        if ($cinfo['waiting'] == 0) {
            $html .= '<li class="score_it">' . '<a class="good" href="javascript:;" ' . 'onclick="course_vote(\'' . $cinfo['idCourse'] . '\', \'good\'); return false;" ' . 'title="' . $lang->def('_VOTE_GOOD_TITLE') . '">' . '<img id="score_image_good_' . $cinfo['idCourse'] . '" src="' . getPathImage() . 'coursecatalogue/good' . ($cinfo['user_score'] == '1' ? '_grey' : '') . '.png" alt="' . $lang->def('_VOTE_GOOD_ALT') . ' : ' . strip_tags($cinfo['name']) . '" />' . '</a> ' . '<a class="bad" href="javascript:;" ' . 'onclick="course_vote(\'' . $cinfo['idCourse'] . '\', \'bad\'); return false;" ' . 'title="' . $lang->def('_VOTE_BAD_TITLE') . '">' . '<img id="score_image_bad_' . $cinfo['idCourse'] . '" src="' . getPathImage() . 'coursecatalogue/bad' . ($cinfo['user_score'] == '-1' ? '_grey' : '') . '.png" alt="' . $lang->def('_VOTE_BAD_ALT') . ' : ' . strip_tags($cinfo['name']) . '" />' . '</a>' . '</li>';
        } else {
            $li .= '<li class="score_it" id="score_action_' . $cinfo['idCourse'] . '">' . '<img src="' . getPathImage() . 'coursecatalogue/good_grey.png" alt="' . $lang->def('_VOTE_GOOD_ALT') . ' : ' . strip_tags($cinfo['name']) . '" /> ' . '<img src="' . getPathImage() . 'coursecatalogue/bad_grey.png" alt="' . $lang->def('_VOTE_BAD_ALT') . ' : ' . strip_tags($cinfo['name']) . '" />' . '</li>';
        }
        $html .= '</ul>';
    }
    if ($cinfo['use_logo_in_courselist'] == '1' && $cinfo['img_course'] != '' || Get::sett('use_social_courselist') == 'on') {
        $html .= '</div>';
    }
    $html .= '</div>';
    return $html;
}
Example #5
0
function modCourse()
{
    checkPerm('mod');
    require_once _base_ . '/lib/lib.form.php';
    require_once _base_ . '/lib/lib.tab.php';
    //require_once(_i18n_.'/lib.lang.php');
    require_once _base_ . '/lib/lib.table.php';
    require_once $GLOBALS['where_lms'] . '/lib/lib.course.php';
    require_once dirname(__FILE__) . '/../category/category.php';
    require_once dirname(__FILE__) . '/../category/tree.category.php';
    require_once $GLOBALS['where_lms'] . '/lib/lib.manmenu.php';
    $form = new Form();
    $lang =& DoceboLanguage::CreateInstance('course', 'lms');
    $out =& $GLOBALS['page'];
    $out->setWorkingZone('content');
    $levels = CourseLevel::getLevels();
    $array_lang = Docebo::langManager()->getAllLangCode();
    $array_lang[] = 'none';
    $form = new Form();
    $out->setWorkingZone('content');
    if (isset($_POST['mod_course'])) {
        list($id_course) = each($_POST['mod_course']);
    } else {
        $id_course = Get::req('idCourse', DOTY_INT, 0);
    }
    // load from post the setting for the selected tab
    // retrive course info
    $query_course = "\r\n\tSELECT idCourse,idCategory, code, name, description, lang_code, status, level_show_user, subscribe_method,\r\n\t\tlinkSponsor, mediumTime, permCloseLO, userStatusOp, difficult,\r\n\t\tshow_progress, show_time,\r\n\r\n\t\tshow_who_online,\r\n\r\n\t\tshow_extra_info, show_rules, date_begin, date_end, hour_begin, hour_end, sub_start_date, sub_end_date, valid_time,\r\n\t\tmin_num_subscribe, max_num_subscribe, max_sms_budget,selling,prize,course_type,policy_point,point_to_all,course_edition,\r\n\t\timgSponsor, img_course, img_material, img_othermaterial, course_demo, course_quota, allow_overbooking,\r\n\t\tcan_subscribe, advance, autoregistration_code, direct_play, show_result\r\n\r\n\t\t, use_logo_in_courselist\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_course\r\n\tWHERE idCourse = '" . (int) $id_course . "'";
    $course = mysql_fetch_assoc(sql_query($query_course));
    $course['date_begin'] = Format::date($course['date_begin'], 'date');
    $course['date_end'] = Format::date($course['date_end'], 'date');
    $course['sub_start_date'] = Format::date($course['sub_start_date'], 'date');
    $course['sub_end_date'] = Format::date($course['sub_end_date'], 'date');
    $array_lang = Docebo::langManager()->getAllLangCode();
    $array_lang[] = 'none';
    $lang_code = array_search($course['lang_code'], $array_lang);
    // set page title ------------------------------------------------------------------
    $title_area = array('index.php?modname=course&amp;op=course_list' => $lang->def('_COURSE'), $lang->def('_MOD') . ' : ' . $course['name']);
    // print opern form ----------------------------------------------------------------
    $out->add(getTitleArea($title_area, 'configuration') . '<div class="std_block">' . getBackUi('index.php?modname=course&amp;op=course_list', $lang->def('_BACK')) . $form->openForm('upd_course', 'index.php?modname=course&amp;op=upd_course', false, false, 'multipart/form-data') . $form->getHidden('mod_course_' . $id_course, 'mod_course[' . $id_course . ']', $id_course), 'content');
    maskModCourse($course, false);
    $GLOBALS['page']->add($form->openButtonSpace() . $form->getButton('update_course', 'upd_course', $lang->def('_SAVE')) . $form->getButton('course_undo', 'course_undo', $lang->def('_UNDO')) . $form->closeButtonSpace() . $form->closeForm() . '</div>', 'content');
}
Example #6
0
function forumsearchmessage()
{
    checkPerm('view');
    $search_arg = $_SESSION['forum']['search_arg'];
    require_once _base_ . '/lib/lib.table.php';
    require_once _base_ . '/lib/lib.form.php';
    $lang =& DoceboLanguage::createInstance('forum', 'lms');
    $id_thread = importVar('idThread', true, 0);
    $ini_thread = importVar('ini_thread');
    $sema_perm = checkPerm('sema', true);
    $moderate = checkPerm('moderate', true);
    $mod_perm = checkPerm('mod', true);
    $acl_man =& Docebo::user()->getAclManager();
    $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&amp;op=searchmessage&amp;idThread=' . $id_thread . '&amp;ini_thread=' . $ini_thread);
    $ini = $tb->getSelectedElement();
    $ini_page = $tb->getSelectedPage();
    // Some info about forum and thread
    $thread_query = "\r\n\tSELECT idForum, title, num_post, locked, erased\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_forumthread\r\n\tWHERE idThread = '" . $id_thread . "'";
    list($id_forum, $thread_title, $tot_message, $locked_t, $erased_t) = 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&amp;op=forum' => $lang->def('_FORUM'), 'index.php?modname=forum&amp;op=search&amp;ini=' . $ini_thread => $thread_title, $lang->def('_SEARCH_RESULT_FOR') . ' : ' . $search_arg);
    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'];
        }
    }
    $authors_names =& $acl_man->getUsers($authors);
    $level_name = CourseLevel::getLevels();
    // Retriving level and number of post of th authors
    $re_num_post = sql_query("\r\n\tSELECT u.idUser, u.level, COUNT(*)\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_forummessage AS m, " . $GLOBALS['prefix_lms'] . "_courseuser AS u\r\n\tWHERE u.idCourse = '" . (int) $_SESSION['idCourse'] . "' AND m.author = u.idUser AND m.author IN ( " . implode($authors, ',') . " )\r\n\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]);
    }
    $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');
    while (list($id_message, $message_info) = each($messages)) {
        // 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]);
        }
        $sender = '<div class="forum_author">' . (isset($authors_names[$m_author]) ? $authors_names[$m_author][ACL_INFO_LASTNAME] . $authors_names[$m_author][ACL_INFO_FIRSTNAME] == '' ? $acl_man->relativeId($authors_names[$m_author][ACL_INFO_USERID]) : $authors_names[$m_author][ACL_INFO_LASTNAME] . ' ' . $authors_names[$m_author][ACL_INFO_FIRSTNAME] : $lang->def('_UNKNOWN_AUTHOR')) . '</div>' . '<div class="forum_level">' . $lang->def('_LEVEL') . ' : ' . $authors_info[$m_author]['level'] . '</div>' . (isset($authors_names[$m_author]) && $authors_names[$m_author][ACL_INFO_AVATAR] != '' ? '<img class="forum_avatar' . ($img_size[0] > 150 || $img_size[1] > 150 ? ' image_limit' : '') . '" src="' . $path . $authors_names[$m_author][ACL_INFO_AVATAR] . '" alt="' . $lang->def('_AVATAR') . '" />' : '') . '<div class="forum_numpost">' . $lang->def('_NUMPOST') . ' : ' . (isset($authors_info[$m_author]['num_post']) ? $authors_info[$m_author]['num_post'] : 0) . '</div>' . '<img src="' . getPathImage() . 'standard/identity.png" alt="&gt;" />&nbsp;' . '<a href="index.php?modname=forum&amp;op=viewprofile&amp;idMessage=' . $id_message . '&amp;ini=' . $ini_page . '&amp;idThread=' . $id_thread . '">' . $lang->def('_VIEW_PROFILE') . '</a>';
        // msg info
        $msgtext = '';
        $msgtext .= '<div class="forum_post_posted">' . $lang->def('_DATE') . ' : ' . Format::date($message_info['posted']) . ' ( ' . loadDistance($message_info['posted']) . ' )' . '</div>';
        if ($message_info['locked']) {
            $msgtext .= '<div class="forum_post_locked">' . $lang->def('_LOCKEDMESS') . '</div>';
        } else {
            if ($message_info['attach'] != '') {
                $msgtext .= '<div class="forum_post_attach">' . '<a href="index.php?modname=forum&amp;op=download&amp;id=' . $id_message . '">' . $lang->def('_ATTACHMENT') . ' : ' . '<img src="' . getPathImage() . mimeDetect($message_info['attach']) . '" alt="' . $lang->def('_ATTACHMENT') . '" /></a>' . '</div>';
            }
            $textof = str_replace('[quote]', '<blockquote class="forum_quote">', str_replace('[/quote]', '</blockquote>', $message_info['textof']));
            $msgtext .= '<div class="forum_post_title">' . $lang->def('_SUBJECT') . ' : ' . ($search_arg !== '' ? eregi_replace($search_arg, '<span class="filter_evidence">' . $search_arg . '</span>', $message_info['title']) : $message_info['title']) . '</div>';
            $msgtext .= '<div class="forum_post_text">' . ($search_arg !== '' ? eregi_replace($search_arg, '<span class="filter_evidence">' . $search_arg . '</span>', $textof) : $textof) . '</div>';
            if ($message_info['modified_by'] != 0) {
                $modify_by = $message_info['modified_by'];
                $msgtext .= '<div class="forum_post_modified_by">' . $lang->def('_MODIFY_BY') . ' : ' . (isset($authors_names[$modify_by]) ? $authors_names[$modify_by][ACL_INFO_LASTNAME] . $authors_names[$modify_by][ACL_INFO_FIRSTNAME] == '' ? $acl_man->relativeId($authors_names[$modify_by][ACL_INFO_USERID]) : $authors_names[$modify_by][ACL_INFO_LASTNAME] . ' ' . $authors_names[$modify_by][ACL_INFO_FIRSTNAME] : $lang->def('_UNKNOWN_AUTHOR')) . ' ' . $lang->def('_ON') . ' : ' . Format::date($message_info['modified_by_on']) . '</div>';
            }
            if (isset($authors_names[$m_author]) && $authors_names[$m_author][ACL_INFO_SIGNATURE] != '') {
                $msgtext .= '<div class="forum_post_sign_separator"></div>' . '<div class="forum_post_sign">' . $authors_names[$m_author][ACL_INFO_SIGNATURE] . '</div>';
            }
        }
        $content = array($sender, $msgtext);
        $tb->addBody($content);
        // some action that you can do with this message
        $action = '';
        if ($moderate || $mod_perm) {
            if ($message_info['locked']) {
                $action .= '<a href="index.php?modname=forum&amp;op=moderatemessage&amp;idMessage=' . $id_message . '&amp;ini=' . $ini_page . '" ' . 'title="' . $lang->def('_DEMODERATE') . ' : ' . strip_tags($message_info['title']) . '">' . '<img src="' . getPathImage() . 'standard/demoderate.png" alt="' . $lang->def('_DEMODERATE') . ' : ' . strip_tags($message_info['title']) . '" /> ' . $lang->def('_DEMODERATE') . '</a> ';
            } else {
                $action .= '<a href="index.php?modname=forum&amp;op=moderatemessage&amp;idMessage=' . $id_message . '&amp;ini=' . $ini_page . '" ' . 'title="' . $lang->def('_MODERATE') . ' : ' . strip_tags($message_info['title']) . '">' . '<img src="' . getPathImage() . 'standard/moderate.png" alt="' . $lang->def('_MODERATE') . ' : ' . strip_tags($message_info['title']) . '" /> ' . $lang->def('_MODERATE') . '</a> ';
            }
        }
        if (!$locked_t && !$locked_f || $mod_perm || $moderate) {
            $action .= '<a href="index.php?modname=forum&amp;op=addmessage&amp;idThread=' . $id_thread . '&amp;idMessage=' . $id_message . '&amp;ini=' . $ini_page . '" ' . 'title="' . $lang->def('_REPLY') . ' : ' . strip_tags($message_info['title']) . '">' . '<img src="' . getPathImage() . 'standard/reply.png" alt="' . $lang->def('_REPLY') . ' : ' . strip_tags($message_info['title']) . '" /> ' . $lang->def('_QUOTE') . '</a>';
        }
        if ($moderate || $mod_perm || $m_author == getLogUserId()) {
            $action .= '<a href="index.php?modname=forum&amp;op=modmessage&amp;idMessage=' . $id_message . '&amp;ini=' . $ini_page . '" ' . 'title="' . $lang->def('_MOD_MESSAGE') . ' : ' . strip_tags($message_info['title']) . '">' . '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . ' : ' . strip_tags($message_info['title']) . '" /> ' . $lang->def('_MOD') . '</a>' . '<a href="index.php?modname=forum&amp;op=delmessage&amp;idMessage=' . $id_message . '&amp;ini=' . $ini_page . '" ' . 'title="' . $lang->def('_DEL') . ' : ' . strip_tags($message_info['title']) . '">' . '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . ' : ' . strip_tags($message_info['title']) . '" /> ' . $lang->def('_DEL') . '</a> ';
        }
        $tb->addBodyExpanded($action, 'forum_action');
    }
    if (!$locked_t && !$locked_f || $mod_perm || $moderate) {
        $tb->addActionAdd('<a href="index.php?modname=forum&amp;op=addmessage&amp;idThread=' . $id_thread . '&amp;ini=' . $ini_page . '" title="' . $lang->def('_REPLY') . '">' . '<img src="' . getPathImage() . 'standard/add.png" alt="' . $lang->def('_ADD') . '" /> ' . $lang->def('_REPLY') . '</a>');
    }
    $GLOBALS['page']->add(getTitleArea($page_title, 'forum') . '<div class="std_block">' . Form::openForm('search_forum', 'index.php?modname=forum&amp;op=search&amp;idThread=' . $id_thread) . '<div class="quick_search_form">' . '<label for="search_arg">' . $lang->def('_SEARCH_LABEL') . '</label> ' . Form::getInputTextfield('search_t', 'search_arg', 'search_arg', $search_arg, $lang->def('_SEARCH'), 255, '') . '<input class="search_b" type="submit" id="search_button" name="search_button" value="' . $lang->def('_SEARCH') . '" />' . '</div>' . Form::closeForm(), 'content');
    if ($moderate || $mod_perm) {
        $GLOBALS['page']->add('<div class="forum_action_top">' . '<a href="index.php?modname=forum&amp;op=modstatusthread&amp;idThread=' . $id_thread . '&amp;ini=' . $ini_page . '">' . ($locked_t ? '<img src="' . getPathImage() . 'standard/msg_read.png" alt="' . $lang->def('_FREE') . '" /> ' . $lang->def('_FREETHREAD') : '<img src="' . getPathImage() . 'standard/locked.png" alt="' . $lang->def('_LOCKTHREAD') . '" /> ' . $lang->def('_LOCKTHREAD')) . '</a> ' . '<a href="index.php?modname=forum&amp;op=changeerased&amp;idThread=' . $id_thread . '&amp;ini=' . $ini_page . '">' . ($erased_t ? '<img src="' . getPathImage() . 'standard/msg_read.png" alt="' . $lang->def('_UNERASE') . '" /> ' . $lang->def('_UNERASE') : '<img src="' . getPathImage() . 'standard/moderate.png" alt="' . $lang->def('_MODERATE') . '" /> ' . $lang->def('_MODERATE')) . '</a>' . '</div>', 'content');
    }
    $GLOBALS['page']->add($tb->getTable(), 'content');
    if ($moderate || $mod_perm) {
        $GLOBALS['page']->add('<div class="forum_action_bottom">' . '<a href="index.php?modname=forum&amp;op=modstatusthread&amp;idThread=' . $id_thread . '&amp;ini=' . $ini_page . '">' . ($locked_t ? '<img src="' . getPathImage() . 'standard/msg_read.png" alt="' . $lang->def('_FREE') . '" /> ' . $lang->def('_FREETHREAD') : '<img src="' . getPathImage() . 'standard/locked.png" alt="' . $lang->def('_LOCKTHREAD') . '" /> ' . $lang->def('_LOCKTHREAD')) . '</a> ' . '<a href="index.php?modname=forum&amp;op=changeerased&amp;idThread=' . $id_thread . '&amp;ini=' . $ini_page . '">' . ($erased_t ? '<img src="' . getPathImage() . 'standard/msg_read.png" alt="' . $lang->def('_UNERASE') . '" /> ' . $lang->def('_UNERASE') : '<img src="' . getPathImage() . 'standard/moderate.png" alt="' . $lang->def('_MODERATE') . '" /> ' . $lang->def('_MODERATE')) . '</a>' . '</div>', 'content');
    }
    $GLOBALS['page']->add($tb->getNavBar($ini, $tot_message) . '</div>', 'content');
}
Example #7
0
 /**
  * Create the group of a course that represent the level
  * @param 	int 	$id_course 	the id of the course
  *
  * @return 	array	[lv] => idst, [lv] => idst
  */
 function createCourseLevel($id_course)
 {
     require_once $GLOBALS['where_lms'] . '/lib/lib.levels.php';
     $map = array();
     $levels = CourseLevel::getLevels();
     $acl_man =& Docebo::user()->getAclManager();
     $idst_main = $acl_man->registerGroup('/lms/course/' . $id_course . '/group/alluser', 'all the user of a course', true);
     foreach ($levels as $lv => $value) {
         $idst = $acl_man->registerGroup('/lms/course/' . $id_course . '/subscribed/' . $lv, 'for course subscription in lms', true);
         $map[$lv] = $idst;
     }
     foreach ($map as $k => $id_g) {
         $acl_man->addToGroup($idst_main, $id_g);
     }
     return $map;
 }
 function waitinguser()
 {
     if (!$this->permissions['moderate']) {
         die("You can't access");
     }
     require_once _lms_ . '/lib/lib.course.php';
     require_once _adm_ . '/lib/lib.field.php';
     require_once _base_ . '/lib/lib.form.php';
     require_once _base_ . '/lib/lib.table.php';
     require_once _base_ . '/lib/lib.user_profile.php';
     $id_course = Get::req('id_course', DOTY_INT, 0);
     $man_course = new Man_Course();
     $course_info = $man_course->getCourseInfo($id_course);
     $is_classroom = $course_info['course_type'] == 'classroom';
     $edition_id = Get::req('id_edition', DOTY_INT, 0);
     $ed_url_param = '&id_edition=' . $edition_id;
     $out =& $GLOBALS['page'];
     $lang =& DoceboLanguage::CreateInstance('course', 'lms');
     $lang =& DoceboLanguage::CreateInstance('subscribe', 'lms');
     $acl_man =& Docebo::user()->getAclManager();
     $levels = CourseLevel::getLevels();
     $waiting_users =& $man_course->getWaitingSubscribed($id_course, $edition_id);
     $users_name =& $acl_man->getUsers($waiting_users['all_users_id']);
     $arr_status = array(_CUS_WAITING_LIST => $lang->def('_WAITING_USERS'), _CUS_CONFIRMED => $lang->def('_USER_STATUS_CONFIRMED'), _CUS_SUBSCRIBED => $lang->def('_USER_STATUS_SUBS'), _CUS_BEGIN => $lang->def('_USER_STATUS_BEGIN'), _CUS_END => $lang->def('_USER_STATUS_END'), _CUS_SUSPEND => $lang->def('_SUSPENDED'));
     $page_title = array('index.php?r=' . $this->link_course . '/show' => Lang::t('_COURSES', 'course'), Lang::t('_USERWAITING', 'course') . ': ' . $course_info['name']);
     $GLOBALS['page']->add(getTitleArea($page_title, 'subscribe') . '<div class="std_block">' . Form::openForm('approve users', 'index.php?r=' . $this->link . '/approveusers') . Form::getHidden('id_course', 'id_course', $id_course) . Form::getHidden('edition_id', 'edition_id', $edition_id), 'content');
     $tb = new Table(0, $lang->def('_SELECT_WHO_CONFIRM'), $lang->def('_SUMMARY_SELECT_WHO_CONFIRM'));
     $type_h = array();
     $type_h[] = '';
     $type_h[] = '';
     $type_h[] = '';
     if ($is_classroom) {
         $type_h[] = '';
     }
     $type_h[] = '';
     $type_h[] = '';
     $type_h[] = 'image';
     $type_h[] = 'image';
     $type_h[] = 'image';
     $content_h = array();
     $content_h[] = $lang->def('_USERNAME');
     $content_h[] = $lang->def('_FULLNAME');
     $content_h[] = $lang->def('_LEVEL');
     if ($is_classroom) {
         $content_h[] = $lang->def('_CLASSROOM');
     }
     $content_h[] = $lang->def('_SUBSCRIBED_BY');
     $content_h[] = $lang->def('_STATUS');
     $content_h[] = $lang->def('_APPROVE');
     $content_h[] = $lang->def('_DENY');
     $content_h[] = $lang->def('_WAIT');
     $tb->addHead($content_h, $type_h);
     if (is_array($waiting_users['users_info'])) {
         reset($waiting_users['users_info']);
         while (list($id_user, $info) = each($waiting_users['users_info'])) {
             $id_sub_by = $info['subscribed_by'];
             $subscribed = $users_name[$id_sub_by][ACL_INFO_LASTNAME] . '' . $users_name[$id_sub_by][ACL_INFO_FIRSTNAME] != '' ? $users_name[$id_sub_by][ACL_INFO_LASTNAME] . ' ' . $users_name[$id_sub_by][ACL_INFO_FIRSTNAME] : $acl_man->relativeId($users_name[$id_sub_by][ACL_INFO_USERID]);
             $more = isset($_GET['id_user']) && $_GET['id_user'] == $id_user ? '<a href="index.php?r=' . $this->link . '/waitinguser&amp;id_course=' . $id_course . $ed_url_param . '"><img src="' . getPathImage() . 'standard/menu_open.png"></a> ' : '<a href="index.php?r=' . $this->link . '/waitinguser&amp;id_course=' . $id_course . $ed_url_param . '&amp;id_user='******'"><img src="' . getPathImage() . 'standard/menu_closed.png"></a> ';
             $is_overbooking = FALSE;
             if ($is_classroom) {
                 $is_overbooking = $info['overbooking'];
             } else {
                 $is_overbooking = FALSE;
                 //$info['status'] == _CUS_OVERBOOKING
             }
             $content = array();
             $content[] = $more . $acl_man->relativeId($users_name[$id_user][ACL_INFO_USERID]);
             $content[] = $users_name[$id_user][ACL_INFO_LASTNAME] . ' ' . $users_name[$id_user][ACL_INFO_FIRSTNAME];
             $content[] = $levels[$info['level']];
             if ($is_classroom) {
                 $content[] = ($info['code'] != '' ? '[' . $info['code'] . '] ' : '') . $info['name'];
             }
             $content[] = $subscribed . ' [' . $users_name[$id_sub_by][ACL_INFO_EMAIL] . ']';
             $content[] = $is_overbooking ? $lang->def('_OVERBOOKING') : $arr_status[$info['status']];
             if ($is_overbooking) {
                 $content[] = '';
                 $content[] = '';
                 $content[] = '';
             } else {
                 $content[] = Form::getInputRadio('waiting_user_0_' . $id_user, 'waiting_user[' . $id_user . ']', '0', false, '') . '<label class="access-only" for="waiting_user_0_' . $id_user . '">' . $users_name[$id_user][ACL_INFO_USERID] . '</label>';
                 $content[] = Form::getInputRadio('waiting_user_1_' . $id_user, 'waiting_user[' . $id_user . ']', '1', false, '') . '<label class="access-only" for="waiting_user_1_' . $id_user . '">' . $users_name[$id_user][ACL_INFO_USERID] . '</label>';
                 $content[] = Form::getInputRadio('waiting_user_2_' . $id_user, 'waiting_user[' . $id_user . ']', '2', true, '') . '<label class="access-only" for="waiting_user_1_' . $id_user . '">' . $users_name[$id_user][ACL_INFO_USERID] . '</label>';
             }
             $tb->addBody($content);
             if (isset($_GET['id_user']) && $id_user == $_GET['id_user']) {
                 $field = new FieldList();
                 $info = $field->playFieldsForUser($id_user, false, true);
                 $tb->addBodyExpanded($info != '' ? $info : $lang->def('_NO_EXTRAINFO_AVAILABLE'), 'user_specific_info');
             }
         }
     }
     $GLOBALS['page']->add($tb->getTable() . '<br />' . Form::openElementSpace() . Form::getSimpleTextarea($lang->def('_SUBSCRIBE_ACCEPT'), 'subscribe_accept', 'subscribe_accept') . Form::getSimpleTextarea($lang->def('_SUBSCRIBE_REFUSE'), 'subscribe_refuse', 'subscribe_refuse') . Form::closeElementSpace() . Form::openButtonSpace() . '<br />' . Form::getButton('subscribe', 'subscribe', $lang->def('_SAVE')) . Form::getButton('cancelselector', 'cancelselector', $lang->def('_UNDO')) . Form::closeButtonSpace() . Form::closeForm(), 'content');
     $GLOBALS['page']->add('</div>', 'content');
 }
Example #9
0
 function modcourseinfo()
 {
     checkPerm('mod');
     require_once _base_ . '/lib/lib.form.php';
     $lang_c =& DoceboLanguage::createInstance('course');
     $lang =& DoceboLanguage::createInstance('course');
     $out =& $GLOBALS['page'];
     $id_course = $_SESSION['idCourse'];
     $form = new Form();
     $levels = CourseLevel::getLevels();
     $array_lang = Docebo::langManager()->getAllLangCode();
     $difficult_lang = array('veryeasy' => $lang->def('_DIFFICULT_VERYEASY'), 'easy' => $lang->def('_DIFFICULT_EASY'), 'medium' => $lang->def('_DIFFICULT_MEDIUM'), 'difficult' => $lang->def('_DIFFICULT_DIFFICULT'), 'verydifficult' => $lang->def('_DIFFICULT_VERYDIFFICULT'));
     $query_course = "\r\n\tSELECT code, name, description, lang_code, status, level_show_user, subscribe_method, \r\n\t\tlinkSponsor, mediumTime, permCloseLO, userStatusOp, difficult, \r\n\t\tshow_progress, show_time, show_extra_info, show_rules, date_begin, date_end, valid_time \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_course\r\n\tWHERE idCourse = '" . $id_course . "'";
     $course = mysql_fetch_array(sql_query($query_course));
     $lang_code = array_search($course['lang_code'], $array_lang);
     $out->setWorkingZone('content');
     $out->add(getTitleArea($lang_c->def('_INFO'), 'infocourse') . '<div class="std_block">' . $form->openForm('course_modify', 'index.php?modname=course&amp;op=upcourseinfo') . $form->openElementSpace() . $form->getTextfield($lang->def('_CODE'), 'course_code', 'course_code', '50', $course['code']) . $form->getTextfield($lang->def('_COURSE_NAME'), 'course_name', 'course_name', '255', $course['name']) . $form->getDropdown($lang->def('_COURSE_LANG_METHOD'), 'course_lang', 'course_lang', $array_lang, $lang_code) . $form->getDropdown($lang->def('_DIFFICULTY'), 'course_difficult', 'course_difficult', $difficult_lang, $course['difficult']) . $form->getDropdown($lang->def('_STATUS'), 'course_status', 'course_status', array(CST_PREPARATION => Lang::t('_CST_PREPARATION', 'course'), CST_AVAILABLE => Lang::t('_CST_AVAILABLE', 'course'), CST_EFFECTIVE => Lang::t('_CST_CONFIRMED', 'course'), CST_CONCLUDED => Lang::t('_CST_CONCLUDED', 'course'), CST_CANCELLED => Lang::t('_CST_CANCELLED', 'course')), $course['status']) . $form->getTextarea($lang->def('_DESCRIPTION'), 'course_descr', 'course_descr', $course['description']) . $form->closeElementSpace() . $form->openButtonSpace() . $form->getButton('upd_course', 'upd_course', $lang->def('_SAVE')) . $form->getButton('course_undo', 'course_undo', $lang->def('_UNDO')) . $form->closeButtonSpace() . $form->openElementSpace());
     //-display-mode----------------------------------------------------
     $out->add($form->getOpenFieldset($lang->def('_COURSE_DISPLAY_MODE')) . $form->getOpenCombo($lang->def('_SHOW_USER_OF_LEVEL')));
     while (list($level, $level_name) = each($levels)) {
         $out->add($form->getCheckbox($level_name, 'course_show_level_' . $level, 'course_show_level[' . $level . ']', $level, $course['level_show_user'] & 1 << $level));
     }
     $out->add($form->getCloseCombo() . $form->getOpenCombo($lang->def('_WHERE_SHOW_COURSE')) . $form->getRadio($lang->def('_SC_EVERYWHERE'), 'course_show_rules_every', 'course_show_rules', '0', $course['show_rules'] == 0) . $form->getRadio($lang->def('_SC_ONLY_IN'), 'course_show_rules_only_in', 'course_show_rules', '1', $course['show_rules'] == 1) . $form->getRadio($lang->def('_SC_ONLYINSC_USER'), 'course_show_rules_onlyinsc_user', 'course_show_rules', '2', $course['show_rules'] == 2) . $form->getCloseCombo() . $form->getOpenCombo($lang->def('_WHAT_SHOW')) . $form->getCheckbox($lang->def('_SHOW_PROGRESS'), 'course_progress', 'course_progress', '1', $course['show_progress']) . $form->getCheckbox($lang->def('_SHOW_TIME'), 'course_time', 'course_time', '1', $course['show_time']) . $form->getCheckbox($lang->def('_SHOW_ADVANCED_INFO'), 'course_advanced', 'course_advanced', '1', $course['show_extra_info']) . $form->getCloseCombo() . $form->getCloseFieldset());
     //-user-interaction--------------------------------------------------
     $out->add($form->getOpenFieldset($lang->def('_USER_INTERACTION_OPTION')) . $form->getOpenCombo($lang->def('_COURSE_END_MODE')) . $form->getRadio($lang->def('_COURSE_EM_TEACHER'), 'course_em_manual', 'course_em', '1', $course['permCloseLO']) . $form->getRadio($lang->def('_COURSE_EM_LO'), 'course_em_lo', 'course_em', '0', !$course['permCloseLO']) . $form->getCloseCombo() . $form->getOpenCombo($lang->def('_COURSE_STATUS_CANNOT_ENTER')) . $form->getCheckbox($lang->def('_USER_STATUS_SUBS'), 'user_status_0', 'user_status[0]', 0, statusNoEnter($course['userStatusOp'], _CUS_SUBSCRIBED)) . $form->getCheckbox($lang->def('_USER_STATUS_BEGIN'), 'user_status_1', 'user_status[1]', 1, statusNoEnter($course['userStatusOp'], _CUS_BEGIN)) . $form->getCheckbox($lang->def('_USER_STATUS_END'), 'user_status_2', 'user_status[2]', 2, statusNoEnter($course['userStatusOp'], _CUS_END)) . $form->getCheckbox($lang->def('_SUSPENDED'), 'user_status_3', 'user_status[3]', 3, statusNoEnter($course['userStatusOp'], _CUS_SUSPEND)) . $form->getCloseCombo() . $form->getCloseFieldset());
     //-expiration---------------------------------------------------------
     $out->add($form->getOpenFieldset($lang->def('_COURSE_TIME_OPTION')) . $form->getTextfield($lang->def('_MEDIUM_TIME'), 'course_medium_time', 'course_medium_time', '10', '0', $course['mediumTime']) . $form->getCloseFieldset());
     //sponsor-and-logo----------------------------------------------------
     /*
     $out->add(
     	$form->getTextfield($lang->def('_SPONSOR_LINK'), 'course_sponsor_link', 'course_sponsor_link', '255', 
     		$course['linkSponsor'])
     	.$form->getFilefield($lang->def('_SPONSOR_LOGO'), 'course_sponsor_logo', 'course_sponsor_logo')
     	.$form->getFilefield($lang->def('_COURSE_LOGO'), 'course_logo', 'course_logo'));
     */
     $out->add($form->closeElementSpace() . $form->openButtonSpace() . $form->getButton('upd_course', 'upd_course', $lang->def('_SAVE')) . $form->getButton('course_undo', 'course_undo', $lang->def('_UNDO')) . $form->closeButtonSpace());
     $out->add($form->closeForm() . '</div>', 'content');
 }
Example #10
0
function &createPermForCoursebis($group_idst, $id_course, $id_principale)
{
    $base_perm = '/lms/course/private/' . $id_principale . '/';
    $map = array();
    $levels = CourseLevel::getLevels();
    $acl_man =& $GLOBALS['current_user']->getAclManager();
    $cut_at = strlen($base_perm);
    // find the idst of all the role of the selected module
    foreach ($levels as $lv => $name_level) {
        $map[$lv] = array();
        $all_idst = $acl_man->getRolesContainer($group_idst[$lv], true);
        foreach ($all_idst as $idst => $v) {
            $role_info = $acl_man->getRole($idst, false);
            if ($role_info !== FALSE && strpos($role_info[ACL_INFO_ROLEID], $base_perm) !== false) {
                $role_suffix = substr($role_info[ACL_INFO_ROLEID], $cut_at);
                $new_role = '/lms/course/private/' . $id_course . '/' . $role_suffix;
                $new_role_info = $acl_man->getRole(false, $new_role);
                if ($new_role_info === FALSE) {
                    $id_role = $acl_man->registerRole($new_role, '');
                } else {
                    $id_role = $new_role_info[0];
                }
                $map[$lv][$id_role] = $role_suffix;
            }
        }
    }
    return $map;
}
Example #11
0
function removeModule($id_module, $id_main, $id_course)
{
    $acl_man =& Docebo::user()->getAclManager();
    // Load module info
    $query_module = "\r\n\tSELECT module_name, default_name, file_name, class_name, default_op \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_module \r\n\tWHERE idModule = '" . $id_module . "'";
    list($module_name, $name_db, $file_name, $class_name, $def_op) = sql_fetch_row(sql_query($query_module));
    $module_obj =& createModule($module_name);
    $levels = CourseLevel::getLevels();
    $all_token = $module_obj->getAllToken();
    // corresponding of token -> idst role
    $map_idst_token =& getModuleRoleSt($module_name, $all_token);
    // corresponding of level -> idst level
    $map_idst_level =& getCourseLevelSt($id_course);
    // old permission of all module
    $actual_perm =& getAllModulesPermissionSt($map_idst_level, array_flip($map_idst_token));
    $re = true;
    foreach ($levels as $lv => $name_level) {
        $idlevel = $map_idst_level[$lv];
        foreach ($actual_perm[$lv] as $idrole => $v) {
            $acl_man->removeFromRole($idrole, $idlevel);
        }
    }
    if ($re) {
        $re = sql_query("\r\n\t\tDELETE FROM " . $GLOBALS['prefix_lms'] . "_menucourse_under \r\n\t\tWHERE idMain = '" . (int) $id_main . "' AND idModule = '" . (int) $id_module . "' AND idCourse = '" . $_SESSION['idCourse'] . "'");
    }
    return $re;
}
 public function coursemask($id_course = false)
 {
     $perm_requested = $id_course ? 'mod' : 'add';
     if (!$this->permissions[$perm_requested]) {
         $this->render('invalid', array('message' => $this->_getErrorMessage('no permission'), 'back_url' => 'index.php?r=' . $this->base_link_course . '/show'));
         return;
     }
     YuiLib::load();
     require_once _lms_ . '/lib/lib.levels.php';
     require_once _lms_ . '/admin/models/LabelAlms.php';
     $levels = CourseLevel::getLevels();
     $label_model = new LabelAlms();
     $array_lang = Docebo::langManager()->getAllLangCode();
     $array_lang[] = 'none';
     //status of course -----------------------------------------------------
     $status = array(CST_PREPARATION => Lang::t('_CST_PREPARATION', 'course'), CST_AVAILABLE => Lang::t('_CST_AVAILABLE', 'course'), CST_EFFECTIVE => Lang::t('_CST_CONFIRMED', 'course'), CST_CONCLUDED => Lang::t('_CST_CONCLUDED', 'course'), CST_CANCELLED => Lang::t('_CST_CANCELLED', 'course'));
     //difficult ------------------------------------------------------------
     $difficult_lang = array('veryeasy' => Lang::t('_DIFFICULT_VERYEASY', 'course'), 'easy' => Lang::t('_DIFFICULT_EASY', 'course'), 'medium' => Lang::t('_DIFFICULT_MEDIUM', 'course'), 'difficult' => Lang::t('_DIFFICULT_DIFFICULT', 'course'), 'verydifficult' => Lang::t('_DIFFICULT_VERYDIFFICULT', 'course'));
     //type of course -------------------------------------------------------
     $course_type = array('classroom' => Lang::t('_CLASSROOM', 'course'), 'elearning' => Lang::t('_COURSE_TYPE_ELEARNING', 'course'), 'edition' => Lang::t('_COURSE_TYPE_EDITION', 'course'));
     $show_who_online = array(0 => Lang::t('_DONT_SHOW', 'course'), _SHOW_COUNT => Lang::t('_SHOW_COUNT', 'course'), _SHOW_INSTMSG => Lang::t('_SHOW_INSTMSG', 'course'));
     $hours = array('-1' => '- -', '0' => '00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23');
     $quarter = array('-1' => '- -', '00' => '00', '15' => '15', '30' => '30', '45' => '45');
     $params = array('id_course' => $id_course, 'levels' => $levels, 'array_lang' => $array_lang, 'label_model' => $label_model, 'status' => $status, 'difficult_lang' => $difficult_lang, 'course_type' => $course_type, 'show_who_online' => $show_who_online, 'hours' => $hours, 'quarter' => $quarter, 'model' => $this->model);
     if ($id_course === false) {
         require_once $GLOBALS['where_lms'] . '/lib/lib.manmenu.php';
         $menu_custom = getAllCustom();
         list($sel_custom) = current($menu_custom);
         reset($menu_custom);
         $params['menu_custom'] = $menu_custom;
         $params['sel_custom'] = $sel_custom;
         $params['name_category'] = $this->model->getCategoryName($this->_getSessionTreeData('id_category', 0));
     }
     $params['course'] = $this->model->getCourseModDetails($id_course);
     //resolve edition flag into type
     if ($params['course']['course_edition'] == 1) {
         $params['course']['course_type'] = 'edition';
     }
     if ($id_course == false) {
         $params['has_editions_or_classrooms'] = false;
     } else {
         $params['has_editions_or_classrooms'] = $this->model->hasEditionsOrClassrooms($id_course);
     }
     if ($params['course']['hour_begin'] != '-1') {
         $hb_sel = (int) substr($params['course']['hour_begin'], 0, 2);
         $qb_sel = substr($params['course']['hour_begin'], 3, 2);
     } else {
         $hb_sel = $qb_sel = '-1';
     }
     if ($params['course']['hour_end'] != '-1') {
         $he_sel = (int) substr($params['course']['hour_end'], 0, 2);
         $qe_sel = substr($params['course']['hour_end'], 3, 2);
     } else {
         $he_sel = $qe_sel = '-1';
     }
     $params['hb_sel'] = $hb_sel;
     $params['qb_sel'] = $qb_sel;
     $params['he_sel'] = $he_sel;
     $params['qe_sel'] = $qe_sel;
     $params['base_link_course'] = $this->base_link_course;
     $params['use_unsubscribe_date_limit'] = (bool) ($params['course']['unsubscribe_date_limit'] != '');
     $params['unsubscribe_date_limit'] = $params['course']['unsubscribe_date_limit'] != '' && $params['course']['unsubscribe_date_limit'] != "0000-00-00 00:00:00" ? Format::date($params['course']['unsubscribe_date_limit'], 'date') : "";
     $this->render('maskcourse', $params);
 }
/**
 * Convert the array with the permission of a module from idst to token_code
 * @param 	array 	$map_idst_roles	[lv] => ( [idst] => 0, [idst] => 1)
 * @param 	array 	$token			[idst] => token_code, [idst] => token_code
 *
 * @return 	array	an array where the idst of the first array is substituded with 
 *					the token_code indicated in the second array
 */
function &fromStToToken(&$map_idst_roles, &$token)
{
    $convert = array();
    $levels = CourseLevel::getLevels();
    foreach ($levels as $lv => $name_level) {
        if (is_array($map_idst_roles[$lv])) {
            foreach ($map_idst_roles[$lv] as $idst => $v) {
                $convert[$lv][$token[$idst]] = $v;
            }
        }
    }
    return $convert;
}
Example #14
0
 function getSelectedPermission($module_op)
 {
     $tokens = $this->getAllToken($module_op);
     $levels = CourseLevel::getLevels();
     $perm = array();
     while (list($lv, $levelname) = each($levels)) {
         $perm[$lv] = array();
         foreach ($tokens as $k => $token) {
             if (isset($_POST['perm'][$lv][$token['code']])) {
                 $perm[$lv][$token['code']] = 1;
             }
         }
     }
     return $perm;
 }
Example #15
0
function subscribeFromCourse()
{
    require_once _base_ . '/lib/lib.form.php';
    require_once $GLOBALS['where_framework'] . '/lib/lib.directory.php';
    require_once _base_ . '/lib/lib.userselector.php';
    require_once $GLOBALS['where_lms'] . '/lib/lib.course.php';
    require_once $GLOBALS['where_lms'] . '/lib/lib.course_managment.php';
    $lang =& DoceboLanguage::CreateInstance('subscribe', 'lms');
    $back_url = 'index.php?modname=course&op=course_list';
    $acl_man =& Docebo::user()->getAclManager();
    $out =& $GLOBALS['page'];
    $out->setWorkingZone('content');
    $id_course = Get::req('id_course', DOTY_INT, 0);
    $edition_id = Get::req('edition_id', DOTY_INT, 0);
    $alert = Get::req('alert', DOTY_INT, 0);
    $delete_prev = Get::req('delete_from_prev', DOTY_INT, 0);
    $sel = new Course_Manager();
    if (isset($_POST['subscribe_import'])) {
        $course_info = Man_Course::getCourseInfo($id_course);
        $level_idst =& getCourseLevel($id_course);
        if (count($level_idst) == 0) {
            $level_idst =& DoceboCourse::createCourseLevel($id_course);
        }
        $course_selected = $sel->getCourseSelection($_POST);
        if (empty($course_selected)) {
            Util::jump_to('index.php?modname=course&op=course_list&result=err');
        }
        $id_course = Get::req('id_course', DOTY_INT, 0);
        $level = Get::req('level', DOTY_INT, 0);
        $status = Get::req('status', DOTY_INT, 0);
        $gsel = array();
        foreach ($course_selected as $trash => $id) {
            $gsel[$id] = getCourseLevel($id);
        }
        $query = "SELECT idUser, idCourse, level" . " FROM " . $GLOBALS['prefix_lms'] . "_courseuser" . " WHERE idCourse IN (" . implode(',', $course_selected) . ")";
        if ($level) {
            $query .= " AND level = '" . $level . "'";
        }
        if ($status != '-2') {
            $query .= " AND status = '" . $status . "'";
        }
        $result = sql_query($query);
        $array_user = array();
        $user_subscribed = array();
        while (list($id_user, $id_prev_course, $lv_sel) = sql_fetch_row($result)) {
            if ($delete_prev) {
                removeSubscription($id_prev_course, $id_user, $gsel[$id_prev_course][$lv_sel]);
            }
            // Add in group for permission
            $acl_man->addToGroup($level_idst[$lv_sel], $id_user);
            // Add in table
            $re = sql_query("\r\n\t\t\tINSERT INTO " . $GLOBALS['prefix_lms'] . "_courseuser\r\n\t\t\t( idUser, idCourse, edition_id, level, waiting, subscribed_by, date_inscr )\r\n\t\t\tVALUES\r\n\t\t\t( '" . $id_user . "', '" . $id_course . "', '" . $edition_id . "', '" . $lv_sel . "', '0', '" . getLogUserId() . "', '" . date("Y-m-d H:i:s") . "' )\t");
            if ($re) {
                $user_subscribed[] = $id_user;
                addUserToTimeTable($id_user, $id_course, $edition_id);
            }
        }
        Docebo::user()->loadUserSectionST('/lms/course/private/');
        Docebo::user()->SaveInSession();
        require_once _base_ . '/lib/lib.eventmanager.php';
        $array_subst = array('[url]' => Get::sett('url'), '[course]' => $course_info['name'], '[medium_time]' => $course_info['mediumTime'], '[course_name]' => $course_info['name'], '[course_code]' => $course['code']);
        if (!empty($user_subscribed) && $alert) {
            // message to user that is subscribed
            $msg_composer = new EventMessageComposer();
            $msg_composer->setSubjectLangText('email', '_NEW_USER_SUBSCRIBED_SUBJECT', false);
            $msg_composer->setBodyLangText('email', '_NEW_USER_SUBSCRIBED_TEXT', $array_subst);
            $msg_composer->setBodyLangText('sms', '_NEW_USER_SUBSCRIBED_TEXT_SMS', $array_subst);
            // send message to the user subscribed
            createNewAlert('UserCourseInserted', 'subscribe', 'insert', '1', 'User subscribed', $user_subscribed, $msg_composer);
        }
        Util::jump_to('index.php?modname=course&op=course_list&result=ok');
    }
    $sel->setLink('index.php?modname=meta_certificate&amp;op=new_assign');
    $sel->show_coursepath_selector = false;
    $sel->show_catalogue_selector = false;
    $array_level = CourseLevel::getLevels();
    $array_level['0'] = $lang->def('_ALL');
    $arr_status = array('-2' => $lang->def('_ALL'), _CUS_CONFIRMED => $lang->def('_USER_STATUS_CONFIRMED'), _CUS_SUBSCRIBED => $lang->def('_USER_STATUS_SUBS'), _CUS_BEGIN => $lang->def('_USER_STATUS_BEGIN'), _CUS_END => $lang->def('_USER_STATUS_END'), _CUS_SUSPEND => $lang->def('_SUSPENDED'), _CUS_CANCELLED => $lang->def('_USER_STATUS_CANCELLED'));
    $out->add(getTitleArea($lang->def('_IMPORT_FROM_COURSE')) . '<div class="std_block">' . Form::openForm('course_selection', 'index.php?modname=subscribe&amp;op=subscribe_from_course') . Form::openElementSpace() . Form::getDropdown($lang->def('_LEVEL_TO_IMPORT'), 'level', 'level', $array_level, isset($_POST['level']) ? $_POST['level'] : '0') . Form::getDropdown($lang->def('_STATUS_TO_IMPORT'), 'status', 'status', $arr_status, isset($_POST['status']) ? $_POST['status'] : '-2') . Form::getCheckbox($lang->def('_SEND_ALERT'), 'alert', 'alert', '1', $delete_prev) . Form::getCheckbox($lang->def('_DELETE'), 'delete_from_prev', 'delete_from_prev', '1', $delete_prev) . Form::closeElementSpace());
    $sel->loadSelector(false);
    $out->add(Form::getHidden('id_course', 'id_course', $id_course) . Form::getHidden('edition_id', 'edition_id', $edition_id) . Form::openButtonSpace() . Form::getBreakRow() . Form::getButton('subscribe_import', 'subscribe_import', $lang->def('_SUBSCRIBE')) . Form::getButton('undo_course', 'undo_course', $lang->def('_UNDO')) . Form::closeButtonSpace() . Form::closeForm() . '</div>');
}
Example #16
0
 function &getCourseLevelSt($id_course)
 {
     $map = array();
     $levels = CourseLevel::getLevels();
     $acl_man =& $GLOBALS['current_user']->getAclManager();
     // find all the group created for this menu custom for permission management
     foreach ($levels as $lv => $name_level) {
         $group_info = $acl_man->getGroup(FALSE, '/lms/course/' . $id_course . '/subscribed/' . $lv);
         $map[$lv] = $group_info[ACL_INFO_IDST];
     }
     return $map;
 }
Example #17
0
    }
    ?>
		</h2>
		<p class="course_support_info">
			<?php 
    echo Lang::t($this->ustatus[$course['user_status']], 'course') . '' . Lang::t('_USER_LVL', 'course', array('[level]' => '<b>' . $this->levels[$course['level']] . '</b>'));
    ?>
		</p>
		<?php 
    $acl_man = Docebo::user()->getAclManager();
    $levels = CourseLevel::getLevels();
    while (list($num_lv, $name_level) = each($levels)) {
        if (CourseLevel::isTeacher($num_lv)) {
        }
        if ($course['level_show_user'] & 1 << $num_lv) {
            if (CourseLevel::isTeacher($num_lv)) {
                echo "&nbsp;" . $name_level . ":&nbsp;";
                $users =& $acl_man->getUsers(Man_Course::getIdUserOfLevel($course['idCourse'], $num_lv, $course['course_edition']));
                if (!empty($users)) {
                    $first = true;
                    while (list($id_user, $user_info) = each($users)) {
                        if ($first) {
                            $first = false;
                        } else {
                            echo ', ';
                        }
                        //								echo '<a href="index.php?modname=course&amp;op=viewprofile&amp;id_user='******'">' . $acl_man->getConvertedUserName($user_info) . '</a>';
                        echo '<b>' . $acl_man->getConvertedUserName($user_info) . '</b>';
                    }
                    // end while
                }