Esempio n. 1
0
function searchUser(&$url)
{
    checkPerm('view');
    require_once _base_ . '/lib/lib.form.php';
    require_once $GLOBALS['where_framework'] . '/lib/lib.myfriends.php';
    $lang =& DoceboLanguage::createInstance('myfriends', 'lms');
    $my_fr = new MyFriends(getLogUserId());
    $acl_man =& Docebo::user()->getAclManager();
    $GLOBALS['page']->add(getTitleArea(array($url->getUrl() => $lang->def('_MY_FRIENDS'), $lang->def('_SEARCH_USER')), 'myfriends') . '<div class="std_block">', 'content');
    if (isset($_POST['send'])) {
        if ($my_fr->addFriend($_POST['id_friend'], MF_WAITING, $_POST['request'])) {
            Util::jump_to($url->getUrl('result=ok_del'));
        }
        $GLOBALS['page']->add(getErrorUi($lang->def('_ERR_REMOVE_FRIEND')));
    } elseif (isset($_GET['id_friend'])) {
        $GLOBALS['page']->add(Form::openForm('send_request', $url->getUrl('op=searchuser')) . Form::getHidden('id_friend', 'id_friend', $_GET['id_friend']) . Form::openElementSpace() . Form::getTextarea($lang->def('_REQUEST_MESSAGE'), 'request', 'request') . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('send', 'send', $lang->def('_SEND_REQUEST')) . Form::getButton('back_search', 'back_search', $lang->def('_UNDO')) . Form::closeButtonSpace() . Form::closeForm() . '</div>', 'content');
        return;
    }
    $GLOBALS['page']->add(Form::openForm('', $url->getUrl('op=searchuser')) . Form::getOpenFieldset($lang->def('_SEARCH_USER')) . Form::getTextfield($lang->def('_SEARCH_USERNAME'), 'username', 'username', 255, importVar('username', false, '')) . Form::openButtonSpace() . Form::getButton('search', 'search', $lang->def('_SEARCH')) . Form::getButton('undo', 'undo', $lang->def('_UNDO')) . Form::closeButtonSpace() . Form::getCloseFieldset() . Form::closeForm(), 'content');
    if (isset($_POST['username'])) {
        $finded_user = $acl_man->getUser(false, $acl_man->absoluteId($_POST['username']));
        if ($finded_user === false) {
            $GLOBALS['page']->add($lang->def('_NO_USER_FINDED'), 'content');
        } else {
            require_once _base_ . '/lib/lib.user_profile.php';
            if (getLogUserId() != $finded_user[ACL_INFO_IDST]) {
                $GLOBALS['page']->add('<p class="confirm_friend">' . '<a href="' . $url->getUrl('op=searchuser&id_friend=' . $finded_user[ACL_INFO_IDST] . '') . '">' . $lang->def('_ADD_TO_MY_FIREND') . '</a>' . '</p>', 'content');
            }
            $profile = new UserProfile($finded_user[ACL_INFO_IDST]);
            $profile->init('profile', 'framework', 'modname=myfriends&op=searchuser', 'ap');
            $GLOBALS['page']->add($profile->getUserInfo(), 'content');
        }
    }
    $GLOBALS['page']->add('</div>', 'content');
}
Esempio n. 2
0
function mycourses(&$url)
{
    checkPerm('view');
    require_once _base_ . '/lib/lib.user_profile.php';
    $lang =& DoceboLanguage::createInstance('catalogue');
    require_once $GLOBALS['where_lms'] . '/lib/lib.middlearea.php';
    $ma = new Man_MiddleArea();
    $course_stats = userCourseList($url, $ma->currentCanAccessObj('lo_tab'));
    $access_career = $ma->currentCanAccessObj('career');
    $access_news = $ma->currentCanAccessObj('news');
    $access_search_form = $ma->currentCanAccessObj('search_form');
    $access_user_details_full = $ma->currentCanAccessObj('user_details_full');
    $access_user_details_short = $ma->currentCanAccessObj('user_details_short');
    $onecol = !$access_career && !$access_news && !$access_user_details_full && !$access_user_details_short;
    require_once $GLOBALS['where_framework'] . '/lib/lib.myfriends.php';
    $friends = new MyFriends(getLogUserId());
    $pendent = count($friends->getPendentRequest());
    $GLOBALS['page']->addStart('' . '<div id="mycourse_top">' . ($onecol ? '' : '<div class="mycourse_left">'), 'content');
    // user_details_short ------------------------------------------------------------------------
    if ($access_user_details_short) {
        $profile = new UserProfile(getLogUserId());
        $profile->init('profile', 'framework', 'index.php?r=' . _after_login_, 'ap');
        $GLOBALS['page']->addStart($profile->userIdMailProfile('normal', false, false), 'content');
    }
    // user_details_full ------------------------------------------------------------------------
    if ($access_user_details_full) {
        $profile = new UserProfile(getLogUserId());
        $profile->init('profile', 'framework', 'index.php?r=' . _after_login_, 'ap');
        $GLOBALS['page']->addStart($profile->homeUserProfile('normal', false, false), 'content');
    }
    // career ------------------------------------------------------------------------
    if ($access_career) {
        $base_url = 'index.php?r=' . _after_login_ . '&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];
        }
        $GLOBALS['page']->addStart('' . '<div class="course_stat">' . '<table summary="">' . '<caption>' . $lang->def('_CAREER') . '</caption>' . '<tr><th scope="row">' . $lang->def('_TOTAL_COURSE') . ' :</th><td><a href="' . $base_url . 'nothing">' . ($course_stats['total'] - $end) . '</a></td></tr>' . (isset($course_stats['with_ustatus'][_CUS_END]) && $course_stats['with_ustatus'][_CUS_END] != 0 ? '<tr><th scope="row">' . $lang->def('_COURSE_END') . ' :</th><td><a href="' . $base_url . 'end">' . $course_stats['with_ustatus'][_CUS_END] . '</a></td></tr>' : '') . (isset($course_stats['expiring']) && $course_stats['expiring'] != 0 ? '<tr><th scope="row">' . $lang->def('_COURSE_EXPIRING') . ' :</th><td><a href="' . $base_url . 'expiring">' . $course_stats['expiring'] . '</a></td></tr>' : ''), 'content');
        if (count($course_stats['with_ulevel']) > 1) {
            require_once $GLOBALS['where_lms'] . '/lib/lib.levels.php';
            $lvl = CourseLevel::getLevels();
            foreach ($course_stats['with_ulevel'] as $lvl_num => $quantity) {
                $GLOBALS['page']->addStart('' . '<tr><th scope="row">' . str_replace('[level]', $lvl[$lvl_num], $lang->def('_COURSE_AS')) . ' :</th><td><a href="' . $base_url . 'level&amp;filter_on=' . $lvl_num . '">' . $quantity . '</a></td></tr>', 'content');
            }
            //end foreach
        }
        $query = "SELECT c.idMetaCertificate, m.idCertificate" . " FROM " . $GLOBALS['prefix_lms'] . "_certificate_meta_course as c" . " JOIN " . $GLOBALS['prefix_lms'] . "_certificate_meta as m ON c.idMetaCertificate = m.idMetaCertificate" . " WHERE c.idUser = '******'" . " GROUP BY c.idMetaCertificate" . " ORDER BY m.title, m.description";
        $result = sql_query($query);
        $num_meta_cert = mysql_num_rows($result);
        while (list($id_meta, $id_certificate) = sql_fetch_row($result)) {
            $query_released = "SELECT on_date" . " FROM " . $GLOBALS['prefix_lms'] . "_certificate_meta_assign" . " WHERE idUser = '******'" . " AND idMetaCertificate = '" . $id_meta . "'";
            $result_released = sql_query($query_released);
            $query = "SELECT user_release" . " FROM " . $GLOBALS['prefix_lms'] . "_certificate" . " WHERE id_certificate = '" . $id_certificate . "'";
            list($user_release) = sql_fetch_row(sql_query($query));
            if (mysql_num_rows($result_released)) {
            } elseif ($user_release == 0) {
                $num_meta_cert--;
            } else {
                $query = "SELECT idCourse" . " FROM " . $GLOBALS['prefix_lms'] . "_certificate_meta_course" . " WHERE idUser = '******'" . " AND idMetaCertificate = '" . $id_meta . "'";
                $result_int = sql_query($query);
                $control = true;
                while (list($id_course) = sql_fetch_row($result_int)) {
                    $query = "SELECT COUNT(*)" . " FROM " . $GLOBALS['prefix_lms'] . "_courseuser" . " WHERE idCourse = '" . $id_course . "'" . " AND idUser = '******'" . " AND status = '" . _CUS_END . "'";
                    list($number) = sql_fetch_row(sql_query($query));
                    if (!$number) {
                        $control = false;
                    }
                }
                if (!$control) {
                    $num_meta_cert--;
                }
            }
        }
        $tot_cert = $num_meta_cert + $course_stats['cert_relesable'];
        $GLOBALS['page']->addStart('' . (isset($course_stats['cert_relesable']) && $tot_cert != 0 ? '<tr><th scope="row">' . $lang->def('_CERT_RELESABLE') . ' :</th><td><a href="index.php?modname=mycertificate&amp;op=mycertificate">' . $tot_cert . '</a></td></tr>' : '') . ($pendent != 0 ? '<tr><th scope="row">' . $lang->def('_FRIEND_PENDENT') . ' :</th><td><a href="index.php?modname=myfriends&amp;op=myfriends">' . $pendent . '</a></td></tr>' : '') . '</table>' . '</div>', 'content');
    }
    // career ------------------------------------------------------------------------
    if ($access_search_form) {
        $year_array = array(0 => $lang->def('_ALL_YEAR'));
        $query_year = "SELECT DISTINCT create_date" . " FROM " . $GLOBALS['prefix_lms'] . "_course";
        $result = sql_query($query_year);
        while (list($year) = sql_fetch_row($result)) {
            $year_array[$year[0] . $year[1] . $year[2] . $year[3]] = $year[0] . $year[1] . $year[2] . $year[3];
        }
        if (isset($year_array['0000'])) {
            unset($year_array['0000']);
        }
        $GLOBALS['page']->addStart('' . '<div class="course_search">' . '<h2>' . $lang->def('_SEARCH') . '</h2>' . Form::openForm('course_filter', 'index.php?modname=course&amp;op=mycourses') . '<p>' . Form::getLabel('search', $lang->def('_WORD')) . '</p>' . Form::getInputTextfield('textfield_nowh', 'search', 'search', importVar('search'), $lang->def('_WORD'), '255', '') . '<br/>' . '<p>' . Form::getLabel('year', $lang->def('_YEAR')) . '</p>' . Form::getInputDropdown('dropdown_nowh', 'year', 'year', $year_array, importVar('year'), '') . Form::getButton('apply_filter', 'apply_filter', $lang->def('_SEARCH')) . Form::closeForm() . '</div>', 'content');
    }
    // news ------------------------------------------------------------------------
    if ($access_news) {
        $GLOBALS['page']->addStart('' . '<div class="course_news">' . '<h2>' . $lang->def('_NEWS') . '</h2>', 'content');
        $user_level = Docebo::user()->getUserLevelId();
        $user_assigned = Docebo::user()->getArrSt();
        $query_news = "\r\n\t\tSELECT idNews, publish_date, title, short_desc, important, viewer\r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_news_internal\r\n\t\tWHERE language = '" . getLanguage() . "'\r\n\t\tORDER BY important DESC, publish_date DESC ";
        $re_news = sql_query($query_news);
        $displayed = 0;
        while (list($id_news, $publish_date, $title, $short_desc, $impo, $viewer) = sql_fetch_row($re_news)) {
            $viewer = is_string($viewer) && $viewer != false ? unserialize($viewer) : array();
            $intersect = array_intersect($user_assigned, $viewer);
            if (!empty($intersect) || empty($viewer)) {
                $GLOBALS['page']->addStart('<h3>' . $title . '</h3>' . '<div class="news_textof">' . '<span class="news_data">' . Format::date($publish_date, 'date') . ' - </span>' . $short_desc . '</div>', 'content');
                $displayed++;
            }
        }
        // end news display
        if (!$displayed) {
            $GLOBALS['page']->addStart($lang->def('_NO_CONTENT'), 'content');
        }
        $GLOBALS['page']->addStart('' . '</div>', 'content');
    }
    if (!$onecol) {
        $GLOBALS['page']->addStart('' . '</div>', 'content');
        $GLOBALS['page']->addStart('' . '<div id="mycourse_right">', 'content');
    }
    // ------------------------------------------------------------------------
    if (!$onecol) {
        $GLOBALS['page']->addEnd('' . '</div>' . '<div class="nofloat"></div>', 'content');
    }
    $GLOBALS['page']->addEnd('' . '</div>', 'content');
    if ($ma->currentCanAccessObj('lo_tab')) {
        $current_tab = importVar('current_tab', false, 'lo_plan');
        $GLOBALS['page']->addStart('<div class="lo_tab">' . '<h1>' . $lang->def('_WELCOME') . ': ' . '<span>' . Docebo::user()->getUserName() . '</span>' . '</h1>' . '<ul class="flat_tab">' . ($course_stats['with_ustatus'][_CUS_END] != $course_stats['total'] ? '<li ' . ($current_tab == 'lo_plan' ? 'class="now_selected"' : '') . '>' . '<a href="index.php?modname=course&amp;op=mycourses&amp;current_tab=lo_plan"><span>' . $lang->def('_COURSE') . '</span></a></li>' : '') . ($course_stats['with_ustatus'][_CUS_END] != 0 ? '<li ' . ($current_tab == 'lo_history' ? 'class="now_selected"' : '') . '>' . '<a href="index.php?modname=course&amp;op=mycourses&amp;current_tab=lo_history"><span>' . $lang->def('_COMPLETED') . '</span></a></li>' : '') . ($course_stats['with_wstatus'][_CUS_RESERVED] != 0 || $course_stats['with_wstatus'][_CUS_WAITING_LIST] != 0 ? '<li ' . ($current_tab == 'lo_waiting' ? 'class="now_selected"' : '') . '>' . '<a href="index.php?modname=course&amp;op=mycourses&amp;current_tab=lo_waiting"><span>' . $lang->def('_LO_WAITING') . '</span></a></li>' : '') . '</ul>' . '</div>', 'content');
    } else {
        $GLOBALS['page']->addStart('<div class="lo_tab">' . '<h1 class="no_tab">' . $lang->def('_WELCOME') . ': ' . '<span>' . Docebo::user()->getUserName() . '</span>' . '</h1>' . '</div>', 'content');
    }
}
Esempio n. 3
0
 /**
  * this function manage the entire profile, identify the action to perform and do the right sequence of action
  * @return string the html to display
  */
 function performAction($viewer = false, $start_action = false)
 {
     $this->setViewer($viewer);
     if ($start_action === false) {
         $start_action = 'profileview';
     }
     $ap = Get::req($this->_varname_action, DOTY_MIXED, $start_action);
     if (isset($_POST['undo'])) {
         $ap = 'profileview';
     }
     switch ($ap) {
         case "goprofile":
             $ext_prof = new UserProfile(Get::req('id_user', DOTY_INT, 0), false);
             $ext_prof->init($this->_module_name, $this->_platform, $this->_std_query, $this->_varname_action);
             return $ext_prof->getProfile();
             break;
             // display the mod info gui -------------------------------
         // display the mod info gui -------------------------------
         case "mod_profile":
             return $this->getModUser();
             break;
         case "mod_password":
             return $this->_up_viewer->getUserPwdModUi();
             break;
         case "mod_policy":
             return $this->_up_viewer->modUserPolicyGui();
             break;
             // save modified info of the user -------------------------
         // save modified info of the user -------------------------
         case "save_policy":
             if ($this->_up_data_man->setFieldAccessList($this->_id_user, $this->_up_viewer->getFilledPolicy())) {
                 // all ok --------------------------------------
                 $this->_up_viewer->unloadUserData();
                 if ($this->_end_url !== false) {
                     Util::jump_to($this->_end_url);
                 }
                 return getResultUi($this->_lang->def('_OPERATION_SUCCESSFULPOLICY')) . $this->getProfile();
             } else {
                 // some error saving ---------------------------
                 return getErrorUi($this->_lang->def('_FAILSAVEPOLICY')) . $this->_up_viewer->modUserPolicyGui();
             }
             break;
             // save modified info of the user -------------------------
         // save modified info of the user -------------------------
         case "saveinfo":
             if (!$this->checkUserInfo()) {
                 // some error in data filling ------------------
                 return getErrorUi($this->_last_error) . $this->getModUser();
             }
             if ($this->saveUserInfo()) {
                 // all ok --------------------------------------
                 $this->_up_viewer->unloadUserData();
                 if ($this->_end_url !== false) {
                     Util::jump_to($this->_end_url);
                 }
                 if (isset($_GET['modname']) && $_GET['modname'] == 'reservation') {
                     require_once $GLOBALS['where_lms'] . '/lib/lib.reservation.php';
                     $id_event = Get::req('id_event', DOTY_INT, 0);
                     $man_res = new Man_Reservation();
                     $result = $man_res->addSubscription(getLogUserId(), $id_event);
                     Util::jump_to('index.php?modname=reservation&op=reservation');
                 } else {
                     return getResultUi($this->_lang->def('_OPERATION_SUCCESSFULPROFILE')) . $this->getProfile();
                 }
             } else {
                 // some error saving ---------------------------
                 return getErrorUi($this->_lang->def('_OPERATION_FAILURE')) . $this->getModUser();
             }
             break;
             // save password -----------------------------------------
         // save password -----------------------------------------
         case "savepwd":
             $re = $this->_up_viewer->checkUserPwd();
             if ($re !== true) {
                 // some error in data filling --------------------
                 return getErrorUi($re) . $this->_up_viewer->getUserPwdModUi();
             }
             if ($this->saveUserPwd()) {
                 // all ok ----------------------------------------
                 $this->_up_viewer->unloadUserData();
                 if ($this->_end_url !== false) {
                     Util::jump_to($this->_end_url);
                 }
                 $out = getResultUi($this->_lang->def('_OPERATION_SUCCESSFULPWD'));
                 if (Get::sett('profile_only_pwd') == 'on') {
                     // maybe is better if we display only the confirmation message if all is ok, but if you
                     // want something else add the code here
                 } else {
                     $out .= $this->getProfile();
                 }
                 return $out;
             } else {
                 // some error saving ----------------------------
                 return getErrorUi($this->_lang->def('_OPERATION_FAILURE')) . $this->_up_viewer->getUserPwdModUi();
             }
             break;
         case "uploadavatar":
             return $this->_up_viewer->modAvatarGui();
             break;
         case "saveavatar":
             if ($this->saveUserAvatar()) {
                 // all ok --------------------------------------
                 $this->_up_viewer->unloadUserData();
                 if ($this->_end_url !== false) {
                     Util::jump_to($this->_end_url);
                 }
                 return getResultUi($this->_lang->def('_OPERATION_SUCCESSFULAVATAR')) . $this->getProfile();
             } else {
                 // some error saving ---------------------------
                 return getErrorUi($this->_lang->def('_OPERATION_FAILURE')) . $this->_up_viewer->modAvatarGui();
             }
             break;
             // teacher curriculum
         // teacher curriculum
         case "del_teach_curric":
             return $this->_up_viewer->delTeacherCurriculumGui();
             break;
         case "mod_teach_curric":
             return $this->_up_viewer->modTeacherCurriculumGui();
             break;
         case "save_teach_curric":
             if ($this->_up_data_man->saveTeacherCurriculumAndPublication($this->_id_user, $this->_up_viewer->getFilledCurriculum(), false)) {
                 // all ok --------------------------------------
                 $this->_up_viewer->unloadUserData();
                 if ($this->_end_url !== false) {
                     Util::jump_to($this->_end_url);
                 }
                 return getResultUi($this->_lang->def('_OPERATION_SUCCESSFULCURRICULUM')) . $this->getProfile();
             } else {
                 // some error saving ---------------------------
                 return getErrorUi($this->_lang->def('_OPERATION_FAILURE')) . $this->_up_viewer->modTeacherCurriculumGui();
             }
             break;
         case "mod_teach_publ":
             return $this->_up_viewer->modTeacherPublicationsGui();
             break;
         case "save_teach_publ":
             if ($this->_up_data_man->saveTeacherCurriculumAndPublication($this->_id_user, false, $this->_up_viewer->getFilledPublications())) {
                 // all ok --------------------------------------
                 $this->_up_viewer->unloadUserData();
                 if ($this->_end_url !== false) {
                     Util::jump_to($this->_end_url);
                 }
                 return getResultUi($this->_lang->def('_OPERATION_SUCCESSFULPUBLICATIONS')) . $this->getProfile();
             } else {
                 // some error saving ---------------------------
                 return getErrorUi($this->_lang->def('_FAILSAVEPUBLICATIONS')) . $this->_up_viewer->modTeacherPublicationsGui();
             }
             break;
             // display the profile ------------------------------------
         // display the profile ------------------------------------
         case "view_files":
             $this->_id_user = Get::req('id_user', DOTY_INT, getLogUserId());
             return $this->_up_viewer->getViewUserFiles();
             break;
         case "file_details":
             $this->_id_user = Get::req('id_user', DOTY_INT, getLogUserId());
             return $this->_up_viewer->getViewUserFileDetail();
             break;
         case "profileview":
         default:
             return $this->getProfile();
             break;
     }
 }
Esempio n. 4
0
 function org_manageuser()
 {
     checkPerm('view_org_chart', false, 'directory', 'framework');
     require_once _base_ . '/lib/lib.user_profile.php';
     $lang =& DoceboLanguage::createInstance('profile', 'framework');
     $profile = new UserProfile(importVar('id_user', true, 0));
     $profile->init('profile', 'framework', 'modname=directory&op=org_manageuser&id_user='******'id_user', true, 0), 'ap');
     $profile->enableGodMode();
     $profile->setEndUrl('index.php?modname=directory&op=org_chart#user_row_' . importVar('id_user', true, 0));
     $GLOBALS['page']->add($profile->getHead() . getBackUi('index.php?modname=directory&amp;op=org_chart', $lang->def('_BACK')) . $profile->performAction() . $profile->getFooter(), 'content');
 }
 function printOut()
 {
     //		addScriptaculousJs();
     addJs($GLOBALS['where_lms_relative'] . '/modules/public_user_admin/', 'ajax.public_user_admin.js');
     require_once _base_ . '/lib/lib.user_profile.php';
     $profile = new UserProfile(getLogUserId());
     $profile->init('profile', 'framework', 'modname=public_user_admin&op=org_chart', 'ap');
     $profile->addStyleSheet('lms');
     $GLOBALS['page']->add('<script type="text/javascript">' . ' setup_directory(\'' . $GLOBALS['where_lms_relative'] . '/modules/directory/ajax.public_user_admin.php\'); ' . '</script>', 'page_head');
     $out = '';
     if ($this->select_all) {
         // This is not a beautiful position for this operation but at this point
         // I'm sure that all filter was applied
         $rs_all = $this->data->getAllRowsIdst();
         if ($rs_all !== FALSE) {
             $this->itemSelectedMulti = array();
             while (list($all_idst) = sql_fetch_row($rs_all)) {
                 $this->itemSelectedMulti[] = $all_idst;
             }
         }
         $this->itemSelected = $this->itemSelectedMulti;
     }
     require_once _base_ . '/lib/lib.form.php';
     $ord = importVar('ord', false, 'trans');
     $flip = importVar('flip', true, 0);
     $filter = new Form();
     $out .= $filter->getOpenFieldset($this->lang->def('_SEARCH'));
     $out .= $filter->getHidden('ord', 'ord', $ord);
     $out .= $filter->getHidden('flip', 'flip', $flip);
     if ($this->lms_editions_filter === true) {
         if (isset($GLOBALS['course_descriptor']) && $GLOBALS['course_descriptor']->hasEdition()) {
             // add editions filter ============================================================
             $ed_list = array();
             if ($this->editions == false) {
                 $this->editions = $GLOBALS['course_descriptor']->getEditionsSimpleList(getLogUserId(), true);
             }
             $sel = isset($_POST[$this->id]['edition_filter']) ? (int) $_POST[$this->id]['edition_filter'] : $GLOBALS['course_descriptor']->getActualEditionsForUser(getLogUserId());
             if (!empty($this->editions)) {
                 $out .= $filter->getDropdown($this->lang->def('_FILTER_BY_EDITION'), $this->id . '_edition_filter', $this->id . '[edition_filter]', $this->editions, $sel);
             }
         }
     }
     // end lms editions filter
     if ($this->show_simple_filter === TRUE) {
         // show simple filter ============================================================
         $out .= $filter->getTextfield($this->lang->def('_SIMPLE_FILTER'), $this->id . '_simple_fulltext_search', $this->id . '[simple_fulltext_search]', 255, isset($_POST[$this->id]['simple_fulltext_search']) ? strip_tags(html_entity_decode($_POST[$this->id]['simple_fulltext_search'])) : '', strip_tags($this->lang->def('_SIMPLE_FILTER')));
         $out .= '<div class="align_right">' . $filter->getButton($this->id . '_search', $this->id . '[search]', $this->lang->def('_SEARCH'), 'button_nowh') . '</div>';
     } else {
         // show complex filter ===========================================================
         $out .= '<h2 id="customize_filter">' . $this->lang->def('_CUSTOMIZE_FILTERS') . '</h2>';
         // --- print check box for flat mode
         if ($this->show_flat_mode_flag) {
             $out .= $filter->getCheckbox($this->lang->def('_DIRECTORY_FILTER_FLATMODE'), $this->id . '_flat_mode', $this->id . '[flat_mode]', 'flat_mode', $this->flat_mode, "onclick=\"window.document.forms['directory_org_chart'].submit();\"");
         } else {
             $out .= $filter->getHidden($this->id . '_flat_mode', $this->id . '[flat_mode]', $this->flat_mode ? 'flat_mode' : '');
         }
         // line for add a field filter
         $out .= $filter->openFormLine();
         foreach ($this->add_nat_fields as $nat_id => $nat_info) {
             $local_arr_fields_translation[$nat_id] = $this->lang->def('_DIRECTORY_FILTER_' . $nat_id);
         }
         $filter_to_show = $this->arr_fields_translation;
         if (is_array($this->arr_fields_filter)) {
             foreach ($this->arr_fields_filter as $filter_info) {
                 if (isset($filter_info['fieldname'])) {
                     unset($filter_to_show[$filter_info['fieldname']]);
                 } else {
                     unset($filter_to_show[$filter_info[0]]);
                 }
             }
         }
         if (is_array($filter_to_show) && !empty($filter_to_show)) {
             $out .= $filter->getInputDropdown('new_filter', $this->id . '_add_field_filter', $this->id . '[add_field_filter]', $filter_to_show, '', '');
             $out .= $filter->getButton($this->id . '_add_filter', $this->id . '[add_filter]', $this->lang->def('_NEW_FILTER'), 'button_nowh');
         }
         $out .= $filter->getButton($this->id . '_del_filter', $this->id . '[del_filter]', $this->lang->def('_RESET'), 'button_nowh');
         $out .= $filter->closeFormLine();
         if (is_array($this->arr_fields_filter)) {
             foreach ($this->arr_fields_filter as $field_id => $field_prop) {
                 if (!isset($field_prop['fieldname'])) {
                     // custom field
                     $arr_field_info = $this->field_list->getBaseFieldInfo($field_prop[FIELD_INFO_TYPE]);
                     require_once $GLOBALS['where_framework'] . '/modules/field/' . $arr_field_info[FIELD_BASEINFO_FILE];
                     $field_obj = new $arr_field_info[FIELD_BASEINFO_CLASS]($field_id);
                     $del_spot = '<input type="image" class="cancel_filter" ' . ' src="' . getPathImage('framework') . 'standard/cancel.png"' . ' id="' . $this->id . '_del_filter_' . $field_id . '"' . ' name="' . $this->id . '[del_filter][' . $field_id . ']"' . ' title="' . $this->lang->def('_DEL') . '"' . ' alt="' . $this->lang->def('_DEL') . '" />';
                     $out .= $field_obj->play_filter($field_id, isset($field_prop['value']) ? $field_prop['value'] : false, $field_prop[FIELD_INFO_TRANSLATION], $this->id, $del_spot, '', $field_prop[FIELD_INFO_ID]);
                     //play_filter( $id_field, $value = FALSE, $label = FALSE, $field_prefix = FALSE, $other_after = '', $other_before = '', $field_special = FALSE )
                 } else {
                     // base field
                     $arr_field_info = $this->field_list->getBaseFieldInfo($field_prop['field_type']);
                     require_once $GLOBALS['where_framework'] . '/modules/field/' . $arr_field_info[FIELD_BASEINFO_FILE];
                     $field_obj = new $arr_field_info[FIELD_BASEINFO_CLASS](0);
                     $del_spot = '<input type="image" class="cancel_filter" ' . ' src="' . getPathImage('framework') . 'standard/cancel.png"' . ' id="' . $this->id . '_del_filter_' . $field_id . '"' . ' name="' . $this->id . '[del_filter][' . $field_id . ']"' . ' title="' . $this->lang->def('_DEL') . '"' . ' alt="' . $this->lang->def('_DEL') . '" />';
                     $out .= $field_obj->play_filter($field_id, isset($field_prop['value']) ? $field_prop['value'] : false, $this->lang->def('_DIRECTORY_FILTER_' . $field_prop['fieldname']), $this->id, $del_spot, '', '');
                 }
             }
         }
         $out .= $filter->openButtonSpace();
         $out .= $filter->getButton('search', 'search', $this->lang->def('_SEARCH'));
         $out .= $filter->closeButtonSpace();
     }
     // end else for filter
     $out .= $filter->getCloseFieldset();
     // ---------------------------------------------------------------------------------------
     // set order rows
     if (is_array($this->arr_fields_order)) {
         foreach ($this->arr_fields_order as $ordFieldName => $isDesc) {
             $this->data->setOrderCol($ordFieldName, $isDesc);
         }
     }
     $this->getRows($this->_getStartRow(), $this->_getRowsPage());
     $totRow = $this->getTotalRows();
     if ($totRow == -1) {
         $totRow = $this->getLoadedRows();
     }
     $colInfo = $this->_getCols();
     $colData = $colInfo;
     $this->rend->setCaption($this->_getTitle());
     $type_h = array();
     $cont_h = array();
     while (list($key, $contentCell) = each($colInfo)) {
         if ($contentCell['toDisplay']) {
             $type_h[] = $contentCell['hClass'];
             $cont_h[] = $contentCell['hLabel'];
         }
     }
     reset($colInfo);
     $this->rend->addHead($cont_h, $type_h);
     while ($values = $this->fetchRecord()) {
         $colData = array();
         foreach ($colInfo as $key => $fieldInfo) {
             $colData[] = $values[$colInfo[$key]['data']];
         }
         $this->rend->addBody($colData, false, false, 'user_row_' . $values['idst']);
         if ($this->_expand_user == $values['idst']) {
             // extra user info if requested
             $this->rend->addBodyExpanded($this->userExtraData($this->_expand_user), 'user_more_info');
         }
     }
     if ($this->insNew) {
         $this->rend->addActionAdd('<input type="submit" class="transparent_add_button"' . ' id="' . $this->id . '_' . $this->_getOpCreateItemId() . '" ' . ' name="' . $this->id . '[' . $this->_getOpCreateItemId() . '][0]" ' . ' value="' . $this->lang->def('_ADD') . '"' . ' title="' . $this->_getCreateLabel() . '" ' . ' alt="' . $this->_getCreateAlt() . '" />');
     }
     $this->rend->initNavBar($this->_getIdInitRowId(), 'button');
     $out .= $this->rend->getTable() . $this->rend->getNavBar($this->_getStartRow(), $totRow) . $this->printState();
     // ---------------------------------------------------------------------------------------
     if ($this->select_all) {
         $arr_notPrint = array_diff($this->itemSelectedMulti, $this->printedItems);
         foreach ($arr_notPrint as $id_notPrint) {
             $out .= '<input type="checkbox" ' . ' id="' . DIRECTORY_ID . DIRECTORY_OP_SELECTITEM . '_' . $id_notPrint . '" ' . 'name="' . DIRECTORY_ID . '[' . DIRECTORY_OP_SELECTITEM . '][' . $id_notPrint . ']" ' . 'value="" checked="checked" style="display:none;" />';
         }
     }
     return $out;
 }
Esempio n. 6
0
function message()
{
    checkPerm('view');
    require_once _base_ . '/lib/lib.table.php';
    require_once _base_ . '/lib/lib.form.php';
    require_once _base_ . '/lib/lib.user_profile.php';
    require_once $GLOBALS['where_framework'] . '/lib/lib.tags.php';
    $tags = new Tags('lms_forum');
    $tags->setupJs('a[id^=handler-tags-]', 'a[id^=private-handler-tags-]');
    require_once _base_ . '/lib/lib.dialog.php';
    setupHrefDialogBox('a[href*=delmessage]');
    $lang =& DoceboLanguage::createInstance('forum', 'lms');
    $id_thread = importVar('idThread', true, 0);
    $sema_perm = checkPerm('sema', true);
    $moderate = checkPerm('moderate', true);
    $mod_perm = checkPerm('mod', true);
    $write_perm = checkPerm('write', true);
    $acl_man =& Docebo::user()->getAclManager();
    $profile_man = new UserProfile(0);
    $profile_man->init('profile', 'framework', 'index.php?modname=forum&op=forum');
    $tb = new Table(Get::sett('visuItem'), $lang->def('_CAPTION_FORUM_MESSAGE'), $lang->def('_CAPTION_FORUM_MESSAGE'));
    $tb->initNavBar('ini', 'link');
    $tb->setLink('index.php?modname=forum&amp;op=message&amp;idThread=' . $id_thread);
    $ini = $tb->getSelectedElement();
    $ini_page = $tb->getSelectedPage();
    $first_unread_message = importVar('firstunread', true, 0);
    $ini_first_unread_message = importVar('ini', true, 0);
    $set_important = importVar('important', true, 0);
    if ($set_important == 1) {
        $query_set_important = "UPDATE " . $GLOBALS['prefix_lms'] . "_forumthread" . " SET rilevantForum = 1" . " WHERE idThread = '" . $id_thread . "'";
        $result_set_important = sql_query($query_set_important);
    }
    if ($set_important == 2) {
        $query_set_important = "UPDATE " . $GLOBALS['prefix_lms'] . "_forumthread" . " SET rilevantForum = 0" . " WHERE idThread = '" . $id_thread . "'";
        $result_set_important = sql_query($query_set_important);
    }
    // Some info about forum and thread
    $thread_query = "\r\n\tSELECT idForum, title, num_post, locked, erased, rilevantForum\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_forumthread\r\n\tWHERE idThread = '" . $id_thread . "'";
    list($id_forum, $thread_title, $tot_message, $locked_t, $erased_t, $is_important) = sql_fetch_row(sql_query($thread_query));
    $forum_query = "\r\n\tSELECT title, locked\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_forum\r\n\tWHERE idForum = '" . $id_forum . "'";
    list($forum_title, $locked_f) = sql_fetch_row(sql_query($forum_query));
    ++$tot_message;
    //set as readed if needed
    if (isset($_SESSION['unreaded_forum'][$_SESSION['idCourse']][$id_forum][$id_thread])) {
        unset($_SESSION['unreaded_forum'][$_SESSION['idCourse']][$id_forum][$id_thread]);
    }
    if ($ini == 0 && !isset($_GET['result'])) {
        sql_query("\r\n\t\tUPDATE " . $GLOBALS['prefix_lms'] . "_forumthread\r\n\t\tSET num_view = num_view + 1\r\n\t\tWHERE idThread = '" . $id_thread . "'");
    }
    $page_title = array('index.php?modname=forum&amp;op=forum' => $lang->def('_FORUM'), 'index.php?modname=forum&amp;op=thread&amp;idForum=' . $id_forum => $forum_title, $thread_title);
    if ($erased_t && !$mod_perm && !$moderate) {
        $GLOBALS['page']->add(getTitleArea($page_title, 'forum') . '<div class="std_block">' . $lang->def('_CANNOTENTER') . '</div>', 'content');
        return;
    }
    // Who have semantic evaluation
    $re_sema = sql_query("\r\n\tSELECT DISTINCT idmsg\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_forum_sema");
    while (list($msg_sema) = sql_fetch_row($re_sema)) {
        $forum_sema[$msg_sema] = 1;
    }
    // Find post
    $messages = array();
    $authors = array();
    $authors_names = array();
    $authors_info = array();
    $re_message = sql_query("\r\n\tSELECT idMessage, posted, title, textof, attach, locked, author, modified_by, modified_by_on\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_forummessage\r\n\tWHERE idThread = '" . $id_thread . "'\r\n\tORDER BY posted\r\n\tLIMIT {$ini}, " . Get::sett('visuItem'));
    while ($record = mysql_fetch_assoc($re_message)) {
        $messages[$record['idMessage']] = $record;
        $authors[$record['author']] = $record['author'];
        if ($record['modified_by'] != 0) {
            $authors[$record['modified_by']] = $record['modified_by'];
        }
        $tag_resource_list[] = $record['idMessage'];
    }
    $authors_names =& $acl_man->getUsers($authors);
    $level_name = CourseLevel::getLevels();
    //tags
    $tags->loadResourcesTags($tag_resource_list);
    // Retriving level and number of post of the authors
    if (!empty($authors)) {
        $re_num_post = sql_query("\r\n\t\tSELECT u.idUser, u.level, COUNT(*)\r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_forummessage AS m, " . $GLOBALS['prefix_lms'] . "_courseuser AS u\r\n\t\tWHERE u.idCourse = '" . (int) $_SESSION['idCourse'] . "' AND m.author = u.idUser AND m.author IN ( " . implode($authors, ',') . " )\r\n\t\tGROUP BY u.idUser, u.level");
        while (list($id_u, $level_u, $num_post_a) = sql_fetch_row($re_num_post)) {
            $authors_info[$id_u] = array('num_post' => $num_post_a, 'level' => $level_name[$level_u]);
        }
        $profile_man->setCahceForUsers($authors);
    }
    $type_h = array('forum_sender', 'forum_text');
    $cont_h = array($lang->def('_AUTHOR'), $lang->def('_TEXTOF'));
    $tb->setColsStyle($type_h);
    $tb->addHead($cont_h);
    // Compose messagges display
    $path = $GLOBALS['where_files_relative'] . '/appCore/' . Get::sett('pathphoto');
    $counter = 0;
    while (list($id_message, $message_info) = each($messages)) {
        $counter++;
        // sender info
        $m_author = $message_info['author'];
        //if(isset($authors_names[$m_author]) && $authors_names[$m_author][ACL_INFO_AVATAR] != '') $img_size = @getimagesize($path.$authors_names[$m_author][ACL_INFO_AVATAR]);
        $profile_man->setIdUser($m_author);
        $author = $profile_man->getUserPanelData(false, 'normal');
        $sender = '';
        $sender = '<div class="forum_author">';
        $sender .= $author['actions'] . $author['display_name'] . (isset($authors_info[$m_author]) ? '<div class="forum_level">' . $authors_info[$m_author]['level'] . '</div>' : '') . '<br/>' . $author['avatar'] . '<div class="forum_numpost">' . $lang->def('_NUMPOST') . ' : ' . (isset($authors_info[$m_author]['num_post']) ? $authors_info[$m_author]['num_post'] : 0) . '</div>' . '<a class="ico-wt-sprite subs_user" href="index.php?modname=forum&amp;op=viewprofile&amp;idMessage=' . $id_message . '&amp;ini=' . $ini_page . '&amp;idThread=' . $id_thread . '">' . '<span>' . $lang->def('_VIEW_PROFILE') . '</span></a>';
        /*.( 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').'" />'
        		: '' )*/
        /*
        .( 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') )
        */
        /*.'<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.'">'.$lang->def('_VIEW_PROFILE').'</a>';
        		*/
        // msg info
        $msgtext = '';
        if ($counter == $first_unread_message) {
            $msgtext .= '<a name="firstunread"></a><div class="forum_post_posted">';
        } else {
            $msgtext .= '<div class="forum_post_posted">';
        }
        $msgtext .= '<a id="' . $id_message . '" name="' . $id_message . '"></a>';
        $msgtext .= $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>';
            }
            $msgtext .= '<div class="forum_post_title">' . $lang->def('_SUBJECT') . ' : ' . $message_info['title'] . '</div>';
            $msgtext .= '<div class="forum_post_text">' . str_replace('[quote]', '<blockquote class="forum_quote">', str_replace('[/quote]', '</blockquote>', $message_info['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[$m_author]) ? $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>';
            }
            $strip_text = strip_tags($message_info['textof']);
            $msgtext .= '<div class="tags align-right">' . $tags->showTags($id_message, 'tags-', $message_info['title'], substr($strip_text, 0, 200) . (strlen($strip_text) > 200 ? '...' : ''), 'index.php?modname=forum&op=message&idThread=' . $id_thread . '&ini=' . $ini_page . '#' . $id_message) . '</div>';
        }
        $content = array($sender, $msgtext);
        $tb->addBody($content);
        // some action that you can do with this message
        $action = '';
        /*if($sema_perm) {
        			if(isset($forum_sema[$id_message])) $img_sema = 'sema_check';
        			else $img_sema = 'sema';
        			$action .= '<a href="index.php?modname=forum&amp;op=editsema&amp;idMessage='.$id_message.'&amp;ini='.$ini_page.'" '
        					.'title="'.$lang->def('_MOD').' : '.strip_tags($message_info['title']).'">'
        				.'<img src="'.getPathImage().'forum/'.$img_sema.'.gif" alt="'.$lang->def('_MOD').' : '.strip_tags($message_info['title']).'" /> '
        				.$lang->def('_SEMATAG').'</a> ';
        		}*/
        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 && !$message_info['locked'] && $write_perm) {
            $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');
    }
    $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', '', $lang->def('_SEARCH'), 255, '') . '<input class="search_b" type="submit" id="search_button" name="search_button" value="' . $lang->def('_SEARCH') . '" />' . '</div>' . Form::closeForm(), 'content');
    // NOTE: If notify request register it
    require_once $GLOBALS['where_framework'] . '/lib/lib.usernotifier.php';
    $can_notify = usernotifier_getUserEventStatus(getLogUserId(), 'ForumNewResponse');
    if (isset($_GET['notify']) && $can_notify) {
        if (issetNotify('thread', $id_thread, getLogUserId())) {
            $re = unsetNotify('thread', $id_thread, getLogUserId());
            $is_notify = !$re;
        } else {
            $re = setNotify('thread', $id_thread, getLogUserId());
            $is_notify = $re;
        }
        if ($re) {
            $GLOBALS['page']->add(getResultUi($lang->def('_NOTIFY_CHANGE_STATUS_CORRECT')), 'content');
        } else {
            $GLOBALS['page']->add(getErrorUi($lang->def('_NOTIFY_CHANGE_STATUS_FAILED')), 'content');
        }
    } elseif ($can_notify) {
        $is_notify = issetNotify('thread', $id_thread, getLogUserId());
    }
    $text_inner = '';
    if (!$locked_t && !$locked_f && $write_perm) {
        $text_inner .= '<a href="index.php?modname=forum&amp;op=addmessage&amp;idThread=' . $id_thread . '&amp;ini=' . $ini_page . '" title="' . $lang->def('_REPLY') . '" class="ico-wt-sprite subs_add">' . '<span>' . $lang->def('_REPLY') . '</span></a>';
    }
    if ($can_notify) {
        $text_inner .= '<a href="index.php?modname=forum&amp;op=message&amp;notify=1&amp;idThread=' . $id_thread . '&amp;ini=' . $ini_page . '" ' . (!$is_notify ? 'class="ico-wt-sprite fd_notice"><span>' . $lang->def('_NOTIFY_ME_FORUM') . '</span></a> ' : 'class="ico-wt-sprite fd_error"><span>' . $lang->def('_UNNOTIFY_ME_FORUM') . '</span></a> ') . '';
    }
    if ($moderate) {
        $text_inner .= ' <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>';
    }
    if ($mod_perm) {
        $text_inner .= ' <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>';
    }
    if (checkPerm('moderate', true) || checkPerm('mod', true)) {
        if ($is_important) {
            $text_inner .= ' <a href="index.php?modname=forum&op=message&amp;idThread=' . $id_thread . '&amp;ini=' . $ini_page . '&amp;important=2"><img src="' . getPathImage() . 'standard/notimportant.png" alt="' . $lang->def('_SET_NOT_IMPORTANT_THREAD') . '" /> ' . $lang->def('_SET_NOT_IMPORTANT_THREAD') . '</a>';
        } else {
            $text_inner .= ' <a href="index.php?modname=forum&op=message&amp;idThread=' . $id_thread . '&amp;ini=' . $ini_page . '&amp;important=1"><img src="' . getPathImage() . 'standard/important.png" alt="' . $lang->def('_MARK_AS_IMPORTANT') . '" /> ' . $lang->def('_MARK_AS_IMPORTANT') . '</a>';
        }
    }
    if ($text_inner != '') {
        $tb->addActionAdd($text_inner);
    }
    $GLOBALS['page']->add($tb->getNavBar($ini, $tot_message), 'content');
    $GLOBALS['page']->add($tb->getTable(), 'content');
    $GLOBALS['page']->add($tb->getNavBar($ini, $tot_message) . '</div>', 'content');
}
Esempio n. 7
0
\ ======================================================================== */
/**
 * @package course management
 * @subpackage course catalogue
 * @category ajax server
 * @author Giovanni Derks
 * @version $Id:$
 *
 */
if (Docebo::user()->isAnonymous()) {
    die('You can\'t access');
}
require_once $GLOBALS['where_framework'] . '/lib/lib.permission.php';
$op = Get::req('op', DOTY_ALPHANUM, '');
switch ($op) {
    case "getuserprofile":
        $lang =& DoceboLanguage::createInstance('standard', 'framework');
        $lang->setGlobal();
        require_once _base_ . '/lib/lib.user_profile.php';
        $id_user = importVar('id_user', true, 0);
        $profile = new UserProfile($id_user);
        $profile->init('profile', 'framework', 'modname=directory&op=org_manageuser&id_user='******'ap');
        $profile->enableGodMode();
        $profile->disableModViewerPolicy();
        $value = array("content" => $profile->getUserInfo(), "id_user" => $id_user);
        require_once _base_ . '/lib/lib.json.php';
        $json = new Services_JSON();
        $output = $json->encode($value);
        aout($output);
        break;
}
 public function editprofile()
 {
     //check permissions
     if (!$this->permissions['mod_user']) {
         $output = array('success' => false, 'message' => $this->_getErrorMessage('no permission'));
         echo $this->json->encode($output);
         return;
     }
     require_once _base_ . '/lib/lib.user_profile.php';
     $id_user = Get::req('id_user', DOTY_INT, -1);
     if ($id_user > 0) {
         $profile = new UserProfile($id_user);
         $profile->init('profile', 'framework', 'r=' . $this->link . '/editprofile&id_user='******'ap');
         if (Docebo::user()->getUserLevelId() == ADMIN_GROUP_GODADMIN) {
             $profile->enableGodMode();
         }
         echo '<br />' . '<div class="std_block">' . getBackUi('index.php?r=' . $this->link . '/show', Lang::t('_BACK', 'standard')) . $profile->performAction() . '</div>';
     }
 }
Esempio n. 9
0
 public function user_details_short($link)
 {
     require_once _lib_ . '/lib.user_profile.php';
     $profile = new UserProfile(getLogUserId());
     $profile->init('profile', 'framework', 'index.php?r=' . $link, 'ap');
     echo $profile->userIdMailProfile('normal', false, false);
 }
Esempio n. 10
0
/**
 * this course simply print the course box, we need to provide all the information ,
 * this function only display the information collected by other function
 * @param array $cinfo it must containt [ idCourse, code, name, description, create_date,
 * 						number_of_subscription, type_of, materials, demo, teacher_list, score, if_user_alredy_scored_this,
 * 						 prize, is_sell, alredy_subscribed, type_of_subscription
 *
 * 						idCourse, course_type, idCategory, code, name, description, lang_code, difficult,
 *						subscribe_method, date_begin, date_end, max_num_subscribe,
 *						selling, prize, create_date, course_status, course_edition,
 *						classrooms, course_demo, course_vote, enrolled
 *
 * @param int $index the number of object visualized
 */
function dashcourse(&$url, &$lang, &$cinfo, $uc_status, $index, $enable_actions = true, $h_number = 2)
{
    $has_edition = $cinfo['course_edition'];
    YuiLib::load(array('animation' => 'my_animation'));
    $course_type = $cinfo['course_type'];
    $action = relationWithCourse($cinfo['idCourse'], $cinfo, $uc_status, false);
    $there_material = array();
    $lang_c =& DoceboLanguage::createInstance('course', 'lms');
    if (!defined("_ECOM_CURRENCY")) {
        $currency_label = getPLSetting("ecom", "currency_label", "");
        define("_ECOM_CURRENCY", $currency_label);
    }
    $cs = array(CST_PREPARATION => $lang_c->def('_CST_PREPARATION', 'course', 'lms'), CST_AVAILABLE => $lang_c->def('_CST_AVAILABLE', 'course', 'lms'), CST_EFFECTIVE => $lang_c->def('_CST_CONFIRMED', 'course', 'lms'), CST_CONCLUDED => $lang_c->def('_CST_CONCLUDED', 'course', 'lms'), CST_CANCELLED => $lang_c->def('_CST_CANCELLED', 'course', 'lms'));
    if ($cinfo['img_material'] != '') {
        $there_material[] = '&id_course=' . $cinfo['idCourse'];
    }
    $html = '<div class="course_container' . (Get::sett('use_social_courselist') == 'on' ? ' double_height' : ' normal_height') . ($index == 0 ? ' course_container_first' : '') . '">';
    $html .= '<div class="course_info_container">' . '<h' . $h_number . '>' . ($cinfo['lang_code'] ? '<img src="' . getPathImage('cms') . 'language/' . $cinfo['lang_code'] . '.png" alt="' . $cinfo['lang_code'] . '" /> ' : '') . $cinfo['name'] . '</h' . $h_number . '>';
    if ($cinfo['classrooms'] != '') {
        $html .= str_replace(array('[classrooms_name]', '[classrooms_location]'), array($cinfo['classrooms']['classroom'], $cinfo['classrooms']['location']), $lang->def('_IN_THE_CLASSROOM'));
    }
    // -----------------------------------------------------------------
    if (!$has_edition) {
        $html .= '<p class="course_support_info">';
        // number of subscription not limited
        if ($cinfo['max_num_subscribe'] == 0) {
            $html .= str_replace(array('[course_type]', '[create_date]', '[enrolled]', '[course_status]'), array($course_type, createDateDistance($cinfo['create_date'], 'catalogue', true), $cinfo['enrolled'], $cs[$cinfo['course_status']]), $lang->def('_COURSE_INTRO')) . ' [' . $cinfo['code'] . '] ';
        } else {
            // limited number of subscription
            $html .= str_replace(array('[course_type]', '[create_date]', '[enrolled]', '[course_status]', '[max_subscribe]'), array($course_type, createDateDistance($cinfo['create_date'], 'catalogue', true), $cinfo['enrolled'], $cs[$cinfo['course_status']], $cinfo['max_num_subscribe']), $lang->def('_COURSE_INTRO_WITH_MAX'));
            if ($cinfo['enrolled'] >= $cinfo['max_num_subscribe'] && $cinfo['allow_overbooking'] == '1') {
                // limited number of subscription reached
                $html .= '<br/>' . $lang->def('_CAN_JOIN_WAITING_LIST');
            }
        }
        if ($cinfo['min_num_subscribe'] != 0) {
            $html .= '<br/>' . str_replace('[min_subscribe]', $cinfo['min_num_subscribe'], $lang->def('_MIN_SUBSCRIBE_FOR_COURSE'));
        }
        $html .= '</p>';
    }
    // --------------------
    if (trim($cinfo['description']) == '') {
        $html .= '';
    } elseif (strpos($cinfo['description'], '<p') === false) {
        $html .= '<p class="course_description">' . $cinfo['description'] . '</p>';
    } else {
        $html .= '<div class="course_description">' . $cinfo['description'] . '</div>';
    }
    if (empty($cinfo['edition_list']) && $has_edition) {
        $html .= '<img src="' . getPathImage('lms') . 'coursecatalogue/editions.png" alt="' . $lang->def('_EDITIONs') . '" /> ' . $lang->def('_NO_CONTENT');
    } elseif ($has_edition) {
        // edition list actions ---------------------------------------------------
        $html .= '<p class="editions_actions">';
        $html .= '<img src="' . getPathImage('lms') . 'coursecatalogue/editions.png" alt="' . $lang->def('_EDITIONs') . '" /> ';
        $html .= '<a id="course_edition_' . $cinfo['idCourse'] . '_open" class="course_editions_expand" href="javascript:;" onclick="
			YAHOO.Animation.BlindIn(\'course_edition_' . $cinfo['idCourse'] . '\', \'\');
			YAHOO.util.Dom.get(\'course_edition_' . $cinfo['idCourse'] . '_open\').style.display = \'none\';
			YAHOO.util.Dom.get(\'course_edition_' . $cinfo['idCourse'] . '_close\').style.display = \'inline\';
			return false;">' . str_replace(array('[edition_count]', '[edition_available]'), array(count($cinfo['edition_list']), $cinfo['edition_available']), $lang->def('_SHOW_COURSE_EDITION')) . '</a>';
        $html .= '<a id="course_edition_' . $cinfo['idCourse'] . '_close" class="course_editions_collapse" href="javascript:;" onclick="
			YAHOO.Animation.BlindOut(\'course_edition_' . $cinfo['idCourse'] . '\');
			YAHOO.util.Dom.get(\'course_edition_' . $cinfo['idCourse'] . '_close\').style.display = \'none\';
			YAHOO.util.Dom.get(\'course_edition_' . $cinfo['idCourse'] . '_open\').style.display = \'inline\';
			return false;">' . $lang->def('_HIDE_COURSE_EDITION') . '</a>' . '</p>';
        // edition list show -------------------------------------------------------------------------
        $html .= '<ul id="course_edition_' . $cinfo['idCourse'] . '" class="course_editions">';
        while (list($id_edition, $ed_info) = each($cinfo['edition_list'])) {
            if ($ed_info['img_material'] != '') {
                $there_material[] = '&id_course=' . $cinfo['idCourse'] . '&edition_id' . $ed_info['idCourseEdition'];
            }
            $html .= '<li><b class="course_title">[' . $ed_info['code'] . '] ' . $ed_info['name'] . '</b><p>';
            if ($ed_info['date_begin'] != '0000-00-00' && $ed_info['date_end'] != '0000-00-00' || $ed_info['classrooms'] != '') {
                $html .= $lang->def('_EDITIONS');
            }
            if ($ed_info['date_begin'] != '0000-00-00' && $ed_info['date_end'] != '0000-00-00') {
                $html .= ' ' . str_replace(array('[date_begin]', '[date_end]'), array(Format::date($ed_info['date_begin'], 'date'), Format::date($ed_info['date_end'], 'date')), $lang->def('_EDTION_TIME'));
            }
            if ($ed_info['classrooms'] != '') {
                $html .= str_replace(array('[classrooms_name]', '[classrooms_location]'), array($ed_info['classrooms']['classroom'], $ed_info['classrooms']['location']), $lang->def('_IN_THE_CLASSROOM'));
            }
            if ($ed_info['date_begin'] != '0000-00-00' && $ed_info['date_end'] != '0000-00-00' || $ed_info['classrooms'] != '') {
                $html .= '<br />';
            }
            if ($ed_info['max_num_subscribe'] == 0) {
                $html .= str_replace(array('[user_count]', '[waiting_count]', ' su [max_user]'), array($ed_info['user_count'], $ed_info['waiting'], ''), $lang->def('_USER_EDITION_SUBSCRIBE')) . '</p>';
            } else {
                $html .= str_replace(array('[user_count]', '[waiting_count]', '[max_user]'), array($ed_info['user_count'], $ed_info['waiting'], $ed_info['max_num_subscribe']), $lang->def('_USER_EDITION_SUBSCRIBE')) . '</p>';
            }
            if ($ed_info['user_count'] != '' && $ed_info['date_end'] != '0000-00-00' || $ed_info['classrooms'] != '') {
                $html .= '<br />';
            }
            // number of subscription not limited
            /*if($ed_info['max_num_subscribe'] == 0) {
            
            				$html .= str_replace(	array('[user_count]', '[waiting_count]', ' su [max_user]'),
            										array($ed_info['user_count'], $ed_info['waiting'], ''),
            										$lang->def('_USER_EDITION_SUBSCRIBE') );
            			} else {
            
            				// limited number of subscription
            				$html .= str_replace(	array('[user_count]', '[max_subscribe]', '[waiting_count]'),
            										array($ed_info['user_count'], $ed_info['max_num_subscribe'], $ed_info['waiting']),
            										$lang->def('_USER_EDITION_SUBSCRIBE_WITH_MAX') );
            
            				if($ed_info['user_count'] >= $ed_info['max_num_subscribe'] && $ed_info['allow_overbooking'] == '1') {
            
            					// limited number of subscription reached
            					$html .= '<br/>'.$lang->def('_CAN_JOIN_WAITING_LIST');
            				}
            			}
            			if($ed_info['min_num_subscribe'] != 0) {
            				$html .= '<br/>'.str_replace('[min_subscribe]', $cinfo['min_num_subscribe'], $lang->def('_MIN_SUBSCRIBE_FOR_EDITION'));
            			}
            			$html .= '</p>';*/
            // theacher list ----------------------------------------------------------
            if (Get::sett('use_social_courselist') == 'on') {
                if (isset($ed_info['theacher_list']) && is_array($ed_info['theacher_list']) && !empty($ed_info['theacher_list'])) {
                    $html .= '<h3 class="course_teacher_list">' . $lang->def('_THEACER_LIST') . '</h3>' . '<ul class="course_teacher_list">';
                    while (list(, $id_teach) = each($ed_info['theacher_list'])) {
                        $profile = new UserProfile($id_teach);
                        $profile->init('profile', 'framework', '', 'ap');
                        $html .= '<li class="the_course">' . '<a href="' . $url->getUrl('op=showprofile&id_course=' . $cinfo['idCourse'] . '&id_user='******'">' . $profile->getUserPhotoOrAvatar('micro') . ' ' . $profile->resolveUsername() . '</a></li>';
                    }
                    $html .= '</ul>';
                }
            }
            $html .= '</li>';
        }
        $html .= '</ul>';
        $html .= '<script type="text/javascript">
			YAHOO.util.Dom.get(\'course_edition_' . $cinfo['idCourse'] . '\').style.display = \'none\';
			YAHOO.util.Dom.get(\'course_edition_' . $cinfo['idCourse'] . '_close\').style.display = \'none\';
		</script>';
    } elseif (Get::sett('use_social_courselist') == 'on') {
        // theacher list ----------------------------------------------------------
        if (isset($cinfo['theacher_list']) && is_array($cinfo['theacher_list']) && !empty($cinfo['theacher_list'])) {
            $html .= '<h3 class="course_teacher_list">' . $lang->def('_THEACER_LIST') . '</h3>' . '<ul class="course_teacher_list">';
            while (list(, $id_teach) = each($cinfo['theacher_list'])) {
                $profile = new UserProfile($id_teach);
                $profile->init('profile', 'framework', '', 'ap');
                $html .= '<li>' . '<a href="' . $url->getUrl('op=showprofile&id_course=' . $cinfo['idCourse'] . '&id_user='******'">' . $profile->getUserPhotoOrAvatar('micro') . ' ' . $profile->resolveUsername() . '</a></li>';
            }
            $html .= '</ul>';
        }
    }
    // course related extra option ---------------------------------------------
    if (Get::sett('use_social_courselist') == 'on' || !empty($there_material) || $cinfo['course_demo'] != '') {
        $html .= '<ul class="course_related_actions">';
        if (Get::sett('use_social_courselist') == 'on') {
            $html .= '<li class="course_comment">' . '<a href="javascript:;" onclick="openComment(\'' . $cinfo['idCourse'] . '\'); return false;">' . '<span>' . $lang->def('_COMMENTS') . ' (' . (isset($cinfo['comment_count']) ? $cinfo['comment_count'] : '0') . ')</span></a></li>';
        }
        // the course material -----------------------------------------------------------------
        if (!empty($there_material)) {
            if (count($there_material) == 1) {
                // direct download of material -------------------------------------------------
                $html .= '<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 --------------------------------------------------
                $html .= '<li class="course_materials">' . '<a href="javascript:;" onclick="openWindowWithAction(\'' . $cinfo['idCourse'] . '\', \'course_materials\'); return false;">' . '<span>' . $lang->def('_MATERIALS') . '</span></a></li>';
            }
        }
        // the course demo link ----------------------------------------------------------------
        if ($cinfo['course_demo'] != '') {
            require_once _base_ . '/lib/lib.multimedia.php';
            $ext = end(explode('.', $cinfo['course_demo']));
            if (isPossibleEmbedPlay('/appLms/' . Get::sett('pathcourse'), $cinfo['course_demo'], $ext)) {
                // play demo in popup ---------------------------------------------------------
                $html .= '<li class="course_demo">' . '<a href="javascript:;" onclick="openWindowWithAction(\'' . $cinfo['idCourse'] . '\', \'play_demo\'); return false;">' . '<span>' . $lang->def('_DEMO') . '</span></a></li>';
            } else {
                // download demo --------------------------------------------------------------
                $html .= '<li class="course_demo">' . '<a href="' . $url->getUrl('op=showdemo&id_course=' . $cinfo['idCourse']) . '">' . '<span>' . $lang->def('_DEMO') . '</span></a></li>';
            }
        }
        $html .= '</ul>';
    }
    $html .= '</div>';
    // score and subscribe action ----------------------------------------------
    $html .= '<ul class="course_score">';
    if ($enable_actions) {
        if ($has_edition) {
            list($edition_for_enter) = sql_fetch_row(sql_query("SELECT edition_id" . " FROM " . $GLOBALS['prefix_lms'] . "_courseuser" . " WHERE idUser = '******'" . " AND idCourse = '" . $cinfo['idCourse'] . "'" . " ORDER BY edition_id DESC" . " LIMIT 0,1"));
        }
        if ($cinfo['first_is_scorm'] != false && $cinfo['direct_play']) {
            $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] . "";
            }
        }
        if ($action[0] == 'subscribed') {
            $access = Man_Course::canEnterCourse($cinfo);
        }
        $html .= '<li id="action_of_' . $cinfo['idCourse'] . '" class="third_action ' . $action[0] . '">' . ($action[1] != false ? '<a href="javascript:;"' . ' onclick="openWindowWithAction(\'' . $cinfo['idCourse'] . '\', \'course_action_confirm' . ($has_edition ? '_edition' : '') . '\'); return false;">' : '') . ($action[0] == 'subscribed' && $access['can'] ? '<a href="index.php?modname=course&op=aula&idCourse=' . $cinfo['idCourse'] . ($has_edition ? '&amp;id_e=' . $edition_for_enter : '') . '"' . ($cinfo['direct_play'] == 1 && $cinfo['level'] <= 3 && $cinfo['first_is_scorm'] ? ' rel="shadowbox' . $lb_param . '" title="' . $cinfo['name'] . '"' : ' title="' . $lang->def('_ENTER') . '"') . '>' . $lang->def('_ENTER') . '</a>' : $lang->def('_' . strtoupper($action[0])) . '<br />');
        switch ($action[0]) {
            case "can_buy":
            case "can_reserve":
                $html .= $cinfo['prize'] . ' ' . _ECOM_CURRENCY;
                break;
        }
        $html .= ($action[2] != false ? '<img src="' . getPathImage() . 'coursecatalogue/' . $action[2] . '" ' . 'alt="' . $lang->def('_ALT_' . strtoupper($action[0])) . '"/>' : '') . ($action[1] != false ? '</a>' : '') . '</li>';
    }
    if (Get::sett('use_social_courselist') == 'on') {
        $html .= '<li class="current_score"><span>' . $lang->def('_SCORE') . '</span><br />' . '<strong id="course_score_' . $cinfo['idCourse'] . '">' . $cinfo['course_vote'] . '</strong></li>';
        if ($uc_status != false && $uc_status['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 {
            $html .= '<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>';
    $html .= '</div>';
    return $html;
}