예제 #1
0
function loadMenu()
{
    $lang = DoceboLanguage::createInstance('login');
    $query = "\r\n\tSELECT idPages, title \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_webpages \r\n\tWHERE publish = '1' AND language = '" . getLanguage() . "'\r\n\t";
    //if(Get::sett('home_course_catalogue') == 'off') {
    if (Get::sett('home_course_catalogue', 'off')) {
        $query .= "  AND in_home = '0' ";
    }
    $query .= " ORDER BY sequence ";
    $result = sql_query($query);
    $out = '<div class="login_menu_box">' . "\n" . '<ul class="log_list">' . "\n" . '<li class="first_row"><a class="voice" href="index.php">' . $lang->def('_HOMEPAGE') . '</a></li>';
    while (list($idPages, $title) = sql_fetch_row($result)) {
        $out .= '<li>' . '<a class="voice" href="index.php?modname=login&amp;op=readwebpages&amp;idPages=' . $idPages . '">' . $title . '</a></li>';
    }
    //if(Get::sett('activeNews') == 'link') {
    if (Get::sett('activeNews', '')) {
        $out .= '<li><a class="voice" href="index.php?modname=login&amp;op=news">' . $lang->def('_NEWS') . '</a></li>';
    }
    $lang = DoceboLanguage::createInstance('course', 'lms');
    if (Get::sett('course_block', 'on') == 'on' && Get::sett('home_course_catalogue', 'off') == 'off') {
        $out .= '<li><a class="voice" href="index.php?modname=login&amp;op=courselist">' . $lang->def('_COURSE_LIST') . '</a></li>';
    }
    $out .= '</ul>' . "\n" . '</div>' . "\n";
    return $out;
}
예제 #2
0
function tagslist()
{
    require_once _base_ . '/lib/lib.table.php';
    require_once $GLOBALS['where_framework'] . '/lib/lib.tags.php';
    $lang =& DoceboLanguage::createInstance('tags', 'framework');
    $id_tag = Get::req('id_tag', DOTY_INT, 0);
    $tag_name = Get::req('tag', DOTY_STRING, '');
    $filter = Get::req('filter', DOTY_STRING, '');
    $nav_bar = new NavBar('ini', Get::sett('visuItem'), 0);
    $nav_bar->setLink('index.php?modname=tags&amp;op=tags&amp;id_tag=' . $id_tag);
    $ini = $nav_bar->getSelectedElement();
    $tags = new Tags('*');
    $resources = $tags->getResourceByTags($id_tag, false, false, $ini, Get::sett('visuItem'));
    $GLOBALS['page']->add(getTitleArea(array($lang->def('_TAGS')), 'tags') . '<div class="std_block">' . '<div class="tag_list">', 'content');
    while (list(, $res) = each($resources['list'])) {
        $link = $res['permalink'];
        $delim = strpos($link, '?') === false ? '?' : '&';
        if (strpos($link, '#') === false) {
            $link = $link . $delim . 'sop=setcourse&sop_idc=' . $res['id_course'];
        } else {
            $link = str_replace('#', $delim . 'sop=setcourse&sop_idc=' . $res['id_course'] . '#', $link);
        }
        $GLOBALS['page']->add('' . '<h2>' . '<a href="' . $link . '">' . $res['title'] . '</a>' . '</h2>' . '<p>' . $res['sample_text'] . '</p>' . '<div class="tag_cloud">' . '<span>' . $lang->def('_TAGS') . ' : </span>' . '<ul><li>' . implode('</li><li>', $res['related_tags']) . '</li></ul>' . '</div>' . '<br />', 'content');
    }
    $GLOBALS['page']->add('</div>' . $nav_bar->getNavBar($ini, $resources['count']) . '</div>', 'content');
}
 /**
  * extract the data to load into policiess table
  */
 public function gettabledataTask()
 {
     $startIndex = Get::req('startIndex', DOTY_INT, 0);
     $results = Get::req('results', DOTY_INT, Get::sett('visuItem'));
     $rowsPerPage = Get::req('rowsPerPage', DOTY_INT, $results);
     $sort = Get::req('sort', DOTY_STRING, "");
     $dir = Get::req('dir', DOTY_STRING, "asc");
     $filter = Get::req('filter', DOTY_STRING, "");
     //get total from database and validate the results count
     $total = $this->model->getPoliciesTotal($filter);
     if ($startIndex >= $total) {
         if ($total < $results) {
             $startIndex = 0;
         } else {
             $startIndex = $total - $results;
         }
     }
     $pagination = array('startIndex' => $startIndex, 'results' => $results, 'sort' => $sort, 'dir' => $dir);
     $list = $this->model->getPoliciesList($pagination, $filter);
     //format models' data
     $records = array();
     if (is_array($list)) {
         foreach ($list as $record) {
             $records[] = array('id' => (int) $record->id_policy, 'name' => highlightText($record->name, $filter), 'is_assigned' => $record->is_assigned, 'mod' => 'ajax.adm_server.php?r=adm/privacypolicy/mod&id=' . (int) $record->id_policy, 'del' => 'ajax.adm_server.php?r=adm/privacypolicy/del&id=' . (int) $record->id_policy);
         }
     }
     if (is_array($records)) {
         $output = array('startIndex' => $startIndex, 'recordsReturned' => count($records), 'sort' => $sort, 'dir' => $dir, 'totalRecords' => $total, 'pageSize' => $rowsPerPage, 'records' => $records);
     } else {
         $output['success'] = false;
     }
     echo $this->json->encode($output);
 }
예제 #4
0
 function modglossarygui($object_glos = NULL)
 {
     checkPerm('view', false, 'storage');
     $lang =& DoceboLanguage::createInstance('glossary');
     require_once _base_ . '/lib/lib.table.php';
     $tableGlossary = new Table(Get::sett('visuItem'), '', $lang->def('_GLOSSARY_SUMMARY'));
     $tableGlossary->initNavBar('ini', 'link');
     $ini = $tableGlossary->getSelectedElement();
     $back_coded = htmlentities(urlencode($object_glos->back_url));
     list($title) = sql_fetch_row(sql_query("\r\n\tSELECT title\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_glossary \r\n\tWHERE idGlossary = '" . $object_glos->getId() . "'"));
     $reTerm = sql_query("\r\n\tSELECT idTerm, term \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_glossaryterm \r\n\tWHERE idGlossary = '" . $object_glos->getId() . "' \r\n\tORDER BY term \r\n\tLIMIT {$ini}," . Get::sett('visuItem'));
     list($num_of_term) = sql_fetch_row(sql_query("\r\n\tSELECT COUNT(*) \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_glossaryterm\r\n\tWHERE idGlossary = '" . $object_glos->getId() . "'"));
     if ($title == '') {
         $_SESSION['last_error'] = $lang->def('_FILEUNSPECIFIED');
         Util::jump_to(Util::str_replace_once('&', '&amp;', $object_glos->back_url) . '&amp;create_result=0');
     }
     $GLOBALS['page']->add(getTitleArea($lang->def('_GLOSSARY'), 'glossary', $lang->def('_GLOSSARY')) . '<div class="std_block">' . getBackUi(Util::str_replace_once('&', '&amp;', $object_glos->back_url) . '&amp;mod_result=0', $lang->def('_BACK')) . '<b>' . $lang->def('_GLOSSARY') . ' : ' . $title . '</b><br /><br />' . '<div class="mod_container">' . '<a href="index.php?modname=glossary&amp;op=modglossary&amp;idGlossary=' . $object_glos->getId() . '&amp;back_url=' . $back_coded . '" title="' . $lang->def('_MOD_TITLE') . '">' . '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . '" /> ' . $lang->def('_MOD_TITLE') . '</a>' . '</div><br />', 'content');
     $contentArray = array($lang->def('_TERM'), '<img src="' . getPathImage() . 'standard/edit.png" title="' . $lang->def('_MOD') . '" alt="' . $lang->def('_MOD') . '" />', '<img src="' . getPathImage() . 'standard/delete.png" title="' . $lang->def('_DEL') . '" alt="' . $lang->def('_DEL') . '" />');
     $typeArray = array('', 'image', 'image');
     $GLOBALS['page']->add($tableGlossary->addHead($contentArray, $typeArray));
     while (list($idTerm, $term) = sql_fetch_row($reTerm)) {
         $content = array($term, '<a href="index.php?modname=glossary&amp;op=modterm&amp;idTerm=' . $idTerm . '&amp;back_url=' . $back_coded . '" title="' . $lang->def('_MOD') . '">' . '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . '" /></a>', '<a href="index.php?modname=glossary&amp;op=delterm&amp;idTerm=' . $idTerm . '&amp;back_url=' . $back_coded . '" title="' . $lang->def('_DEL') . '">' . '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . '" /></a>');
         $tableGlossary->addBody($content);
     }
     $tableGlossary->addActionAdd('<a href="index.php?modname=glossary&amp;op=addterm&amp;idGlossary=' . $object_glos->getId() . '&amp;back_url=' . $back_coded . '" title="' . $lang->def('_ADDTERM') . '">' . '<img src="' . getPathImage() . 'standard/add.png" alt="' . $lang->def('_ADD') . '" /> ' . $lang->def('_ADDTERM') . '</a>');
     $tableGlossary->setLink('index.php?modname=glossary&amp;op=modglossarygui' . '&amp;idGlossary=' . $object_glos->getId() . '&amp;back_url=' . $back_coded);
     $GLOBALS['page']->add($tableGlossary->getTable() . $tableGlossary->getNavBar($ini, $num_of_term) . '</div>', 'content');
 }
예제 #5
0
 /**
  * This function return the correct order to use when you wish to diplay the a
  * course list for the user.
  * @param <array> $t_name the table name to use as a prefix for the field, if false is passed no prefix will e used
  *							we need a prefix for the course user rows and a prefix for the course table
  *							array('u', 'c')
  * @return <string> the order to use in a ORDER BY clausole
  */
 protected function _resolveOrder($t_name = array('', ''))
 {
     // read order for the course from database
     if ($this->_t_order == false) {
         $t_order = Get::sett('tablist_mycourses', false);
         if ($t_order != false) {
             $arr_order_course = explode(',', $t_order);
             $arr_temp = array();
             foreach ($arr_order_course as $key => $value) {
                 switch ($value) {
                     case 'status':
                         $arr_temp[] = ' ?u.status ';
                         break;
                     case 'code':
                         $arr_temp[] = ' ?c.code ';
                         break;
                     case 'name':
                         $arr_temp[] = ' ?c.name ';
                         break;
                 }
             }
             $t_order = implode(', ', $arr_temp);
         } else {
             $t_order = '?u.status, ?c.name';
         }
         // save a class copy of the resolved list
         $this->_t_order = $t_order;
     }
     foreach ($t_name as $key => $value) {
         if ($value != '') {
             $t_name[$key] = $value . '.';
         }
     }
     return str_replace(array('?u.', '?c.'), $t_name, $this->_t_order);
 }
 public function gethistorydata()
 {
     $start_index = Get::req('startIndex', DOTY_INT, 0);
     $results = Get::req('results', DOTY_MIXED, Get::sett('visuItem', 25));
     $sort = Get::req('sort', DOTY_MIXED, 'title');
     $dir = Get::req('dir', DOTY_MIXED, 'asc');
     $model = new CommunicationAlms();
     $communications = $model->findAllReaded(0, 0, 'publish_date', 'DESC', Docebo::user()->getId(), array('viewer' => Docebo::user()->getArrSt()));
     while (list($id, $comm) = each($communications)) {
         //$communications[$id]['publish_date'] = Format::dateDistance($comm['publish_date']);
         switch ($comm['type_of']) {
             case "none":
                 $communications[$id]['play'] = '<a class="ico-wt-sprite subs_unread" href="index.php?r=communication/play&amp;id_comm=' . $comm['id_comm'] . '"><span>' . Lang::t('_MARK_AS_READ', 'communication') . '</span></a>';
                 break;
             case "file":
                 $communications[$id]['play'] = '<a class="ico-wt-sprite subs_download" href="index.php?r=communication/play&amp;id_comm=' . $comm['id_comm'] . '"><span>' . Lang::t('_DOWNLOAD', 'communication') . '</span></a>';
                 break;
             case "scorm":
                 $communications[$id]['play'] = '<a class="ico-wt-sprite subs_play" rel="lightbox" href="index.php?r=communication/play&amp;id_comm=' . $comm['id_comm'] . '" title="' . $comm['title'] . '"><span>' . Lang::t('_PLAY', 'communication') . '</span></a>';
                 break;
         }
     }
     $result = array('totalRecords' => count($communications), 'startIndex' => $start_index, 'sort' => $sort, 'dir' => $dir, 'rowsPerPage' => $results, 'results' => count($communications), 'records' => $communications);
     $this->data = $this->json->encode($result);
     echo $this->data;
 }
예제 #7
0
 public function getLabelsTask()
 {
     $start_index = Get::req('startIndex', DOTY_INT, 0);
     $results = Get::req('results', DOTY_MIXED, Get::sett('visuItem', 25));
     $sort = Get::req('sort', DOTY_MIXED, 'title');
     $dir = Get::req('dir', DOTY_MIXED, 'asc');
     $labels = $this->model->getLabels($start_index, $results, $sort, $dir);
     $total_label = $this->model->getTotalLabelsCount();
     $list = array();
     $first = true;
     $count = count($labels);
     $counter = 0;
     foreach ($labels as $value) {
         $position = "";
         if ($first) {
             $position .= 'first';
             $first = false;
         }
         $counter++;
         if ($counter == $count) {
             $position .= 'last';
         }
         $list[] = array('id_common_label' => $value[LABEL_ID_COMMON], 'title' => $value[LABEL_TITLE], 'description' => $this->_formatDescription($value[LABEL_DESCRIPTION], 100), 'position' => $position, 'sequence' => $value[LABEL_SEQUENCE], 'mod' => '<a href="index.php?r=alms/label/mod&amp;id_common_label=' . $value[LABEL_ID_COMMON] . '" title="' . Lang::t('_MOD', 'label') . '">' . Get::img('standard/edit.png', Lang::t('_MOD', 'label')) . '</a>', 'del' => 'ajax.adm_server.php?r=alms/label/dellabel&id_common_label=' . $value[LABEL_ID_COMMON]);
     }
     $result = array('totalRecords' => $total_label, 'startIndex' => $start_index, 'sort' => $sort, 'dir' => $dir, 'rowsPerPage' => $results, 'results' => count($list), 'records' => $list);
     echo $this->json->encode($result);
 }
 function getBoxContent()
 {
     $html = array();
     if (!checkPerm('view_org_chart', true, 'directory', 'framework')) {
         return $html;
     }
     require_once _base_ . '/lib/lib.userselector.php';
     $user_dir = new UserSelector();
     $user_stats = $user_dir->getUsersStats();
     $lang =& DoceboLanguage::createInstance('dashboard', 'framework');
     if (Get::sett('welcome_use_feed') == 'on') {
         require_once _base_ . '/lib/lib.fsock_wrapper.php';
         $fp = new Fsock();
         $released_version = $fp->send_request('http://www.formalms.org/versions/release.txt');
         if (!$fp) {
             $released_version = '<strong class="old_release">' . $lang->def('_UNKNOWN_RELEASE') . '</strong>';
         } else {
             if ($released_version == false) {
                 $released_version = '<strong class="ok_release">' . $lang->def('_UNKNOWN_RELEASE') . '</strong>';
             }
             if ($released_version == Get::sett('core_version')) {
                 $released_version = '<strong class="ok_release">' . $released_version . '</strong>';
             } else {
                 $released_version = '<strong class="old_release">' . $released_version . ' (' . $lang->def('_NEW_RELEASE_AVAILABLE') . ')</strong>';
             }
         }
     }
     $html[] = '<h2 class="inline">' . $lang->def('_USERS_PANEL') . '</h2>' . '<p>' . $lang->def('_TOTAL_USER') . ': <b>' . ($user_stats['all'] - 1) . '</b>;<br />' . $lang->def('_SUSPENDED') . ': <b>' . $user_stats['suspended'] . '</b>;<br />' . (checkPerm('approve_waiting_user', true, 'directory', 'framework') ? $lang->def('_WAITING_USERS') . ': <b>' . $user_stats['waiting'] . '</b>;' : '') . '</p><p>' . $lang->def('_SUPERADMIN_USER') . ': <b>' . $user_stats['superadmin'] . '</b>;<br />' . $lang->def('_ADMIN_USER') . ': <b>' . $user_stats['admin'] . '</b>;<br />' . $lang->def('_PUBLIC_ADMIN_USER') . ': <b>' . $user_stats['public_admin'] . '</b>;' . '</p><p>' . $lang->def('_REG_TODAY') . ': <b>' . $user_stats['register_today'] . '</b>;<br />' . $lang->def('_REG_YESTERDAY') . ': <b>' . $user_stats['register_yesterday'] . '</b>;<br />' . $lang->def('_REG_LASTSEVENDAYS') . ': <b>' . $user_stats['register_7d'] . '</b>;' . '</p><p>' . $lang->def('_INACTIVE_USER') . ': <b>' . $user_stats['inactive_30d'] . '</b>;<br />' . $lang->def('_ONLINE_USER') . ': <b>' . $user_stats['now_online'] . '</b>;' . '</p><p>' . $lang->def('_CORE_VERSION') . ': <b>' . Get::sett('core_version') . '</b>;<br />' . (Get::sett('welcome_use_feed') == 'on' ? $lang->def('_LAST_RELEASED') . ': ' . $released_version . ';' : '') . '</p>';
     return $html;
 }
 public function gettimeperiodslistTask()
 {
     //read input data (table parameters and filter)
     $startIndex = Get::req('startIndex', DOTY_INT, 0);
     $results = Get::req('results', DOTY_INT, Get::sett('visuItem'));
     $rowsPerPage = Get::req('rowsPerPage', DOTY_INT, $results);
     $sort = Get::req('sort', DOTY_STRING, "");
     $dir = Get::req('dir', DOTY_STRING, "asc");
     $filter_text = Get::req('filter_text', DOTY_STRING, '');
     $searchFilter = array('text' => $filter_text);
     //calculate total records to display
     $total = $this->model->getTimePeriodsTotal($searchFilter);
     if ($startIndex >= $total) {
         if ($total < $results) {
             $startIndex = 0;
         } else {
             $startIndex = $total - $results;
         }
     }
     //get records from DB and format data
     $list = $this->model->getTimePeriodsList($startIndex, $results, $sort, $dir, $searchFilter);
     $output_records = array();
     if (is_array($list) && count($list) > 0) {
         foreach ($list as $record) {
             $output_records[] = array('id' => (int) $record->id_period, 'title' => Layout::highlight($record->title, $filter_text), 'label' => Layout::highlight($record->label, $filter_text), 'start_date' => Format::date($record->start_date, "date"), 'end_date' => Format::date($record->end_date, "date"), 'mod' => 'ajax.adm_server.php?r=alms/timeperiods/mod&id=' . (int) $record->id_period, 'del' => 'ajax.adm_server.php?r=alms/timeperiods/del&id=' . (int) $record->id_period);
         }
     }
     //prepare the output for the datatable
     $output = array('totalRecords' => $total, 'startIndex' => $startIndex, 'sort' => $sort, 'dir' => $dir, 'rowsPerPage' => $rowsPerPage, 'results' => count($output_records), 'records' => $output_records);
     echo $this->json->encode($output);
 }
예제 #10
0
    function notes()
    {
        checkPerm('view');
        require_once _base_ . '/lib/lib.table.php';
        $lang =& DoceboLanguage::createInstance('notes', 'lms');
        $nav_bar = new NavBar('ini', Get::sett('visuItem'), 0);
        $ini = $nav_bar->getSelectedElement();
        $ord = importVar('ord');
        $inv = importVar('inv');
        switch ($ord) {
            case "tit":
                $ord = $order = 'title';
                if ($inv != 'y') {
                    $a_down = '&amp;inv=y';
                } else {
                    $order .= ' DESC';
                    $a_down = '';
                }
                break;
            default:
                $ord = $order = 'data';
                if ($inv == 'y') {
                    $a_down = '';
                } else {
                    $order .= ' DESC';
                    $a_down = '&amp;inv=y';
                }
        }
        $reNotes = sql_query("\r\n\tSELECT idNotes, data, title \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_notes \r\n\tWHERE owner ='" . getLogUserId() . "' AND idCourse='" . $_SESSION['idCourse'] . "' \r\n\tORDER BY {$order} \r\n\tLIMIT {$ini}," . Get::sett('visuItem'));
        list($num_notes) = sql_fetch_row(sql_query("SELECT COUNT(*) \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_notes \r\n\tWHERE owner ='" . getLogUserId() . "' AND idCourse='" . $_SESSION['idCourse'] . "' "));
        $nav_bar->setElementTotal($num_notes);
        $img_up = '<img class="valing-middle" src="' . getPathImage() . 'standard/up_arrow.png" alt="' . $lang->def('_UP') . '"/>';
        $img_down = '<img class="valing-middle" src="' . getPathImage() . 'standard/down_arrow.png" alt="' . $lang->def('_DOWN') . '"/>';
        $tb = new Table(Get::sett('visuItem'), $lang->def('_NOTES'), $lang->def('_NOTES'));
        $contentH = array(($ord == 'data' ? $inv == 'y' ? $img_up : $img_down : '') . '<a href="index.php?modname=notes&amp;op=notes' . $a_down . '"> ' . $lang->def('_DATE') . '</a>', ($ord == 'title' ? $inv == 'y' ? $img_up : $img_down : '') . '<a href="index.php?modname=notes&amp;op=notes&amp;ord=tit' . $a_down . '">' . $lang->def('_TITLE') . '</a>', '<img src="' . getPathImage() . 'standard/edit.png" title="' . $lang->def('_MOD') . '" alt="' . $lang->def('_MOD') . '" />', '<img src="' . getPathImage() . 'standard/delete.png" title="' . $lang->def('_DEL') . '" alt="' . $lang->def('_DEL') . '" />');
        $typeH = array('min-cell', '', 'image', 'image');
        $tb->setColsStyle($typeH);
        $tb->addHead($contentH);
        while (list($idNotes, $data, $title) = sql_fetch_row($reNotes)) {
            $content = array(Format::date($data), '<a href="index.php?modname=notes&amp;op=displaynotes&amp;idNotes=' . $idNotes . '" title="' . $lang->def('_MORET') . '">' . $title . '</a>', '<a href="index.php?modname=notes&amp;op=modnotes&amp;idNotes=' . $idNotes . '">
				<img src="' . getPathImage() . 'standard/edit.png" title="' . $lang->def('_MOD') . '" alt="' . $lang->def('_MOD') . '" /></a>', '<a id="delnotes_' . $idNotes . '"' . ' href="index.php?modname=notes&amp;op=delnotes&amp;idNotes=' . $idNotes . '"' . ' title="' . $lang->def('_TITLE') . ' : ' . strip_tags(str_replace(array('"', "'"), '', $title)) . '">
				<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . '" /></a>');
            $tb->addBody($content);
        }
        $tb->addActionAdd('<a href="index.php?modname=notes&amp;op=addnotes">' . '<img src="' . getPathImage() . 'standard/add.png" title="' . $lang->def('_ADD') . '" alt="' . $lang->def('_ADD') . '" /> ' . $lang->def('_ADD_NOTES') . '</a>');
        $GLOBALS['page']->add(getTitleArea(array($lang->def('_NOTES')), 'notes') . '<div class="std_block">', 'content');
        if (isset($_POST['result'])) {
            switch ($_POST['result']) {
                case "ok":
                    $GLOBALS['page']->add(getResultUi($lang->def('_OPERATION_SUCCESSFUL')), 'content');
                case "err":
                    $GLOBALS['page']->add(getErrorUi($lang->def('_OPERATION_FAILURE')), 'content');
            }
        }
        $GLOBALS['page']->add($tb->getTable() . $nav_bar->getNavBar($ini), 'content');
        require_once _base_ . '/lib/lib.dialog.php';
        setupHrefDialogBox('a[href*=delnotes]');
        $GLOBALS['page']->add('</div>', 'content');
    }
예제 #11
0
 function _query($query)
 {
     $re = sql_query($query);
     if (Get::sett('do_debug') == 'on' && isset($GLOBALS['page'])) {
         $GLOBALS['page']->add('<!-- ' . $query . ' :: ' . mysql_error() . ' -->', 'debug');
     }
     return $re;
 }
    public function getlist()
    {
        $id_category = Get::req('id_category', DOTY_INT, 0);
        $show_descendants = Get::req('descendants', DOTY_INT, 0) > 0;
        $start_index = Get::req('startIndex', DOTY_INT, 0);
        $results = Get::req('results', DOTY_MIXED, Get::sett('visuItem', 25));
        $sort = Get::req('sort', DOTY_MIXED, 'title');
        $dir = Get::req('dir', DOTY_MIXED, 'asc');
        $filter_text = Get::req('filter_text', DOTY_STRING, "");
        $filter = array('text' => $filter_text);
        $total_comm = $this->model->total($filter, $id_category, $show_descendants);
        $array_comm = $this->model->findAll($start_index, $results, $sort, $dir, $filter, $id_category, $show_descendants);
        $comm_id_arr = array();
        foreach ($array_comm as $key => $value) {
            $type = $array_comm[$key]['type_of'];
            if ($type == 'file') {
                $comm_id_arr[] = $value['id_comm'];
            }
        }
        require_once _lms_ . '/lib/lib.kbres.php';
        $kbres = new KbRes();
        $categorized_file_items = $kbres->getCategorizedResources($comm_id_arr, "file", "communication", true);
        $categorized_file_items_id = !empty($categorized_file_items) ? array_keys($categorized_file_items) : array();
        $list = array();
        foreach ($array_comm as $key => $value) {
            $array_comm[$key]['id'] = $value['id_comm'];
            if ($filter_text) {
                $array_comm[$key]['title'] = highlightText($value['title'], $filter_text);
                $array_comm[$key]['description'] = highlightText($value['description'], $filter_text);
            }
            $array_comm[$key]['publish_date'] = Format::date($value['publish_date'], 'date');
            $type = $array_comm[$key]['type_of'];
            if ($type == 'file' || $type == 'scorm') {
                if ($type == 'scorm' || in_array($value['id_comm'], $categorized_file_items_id)) {
                    $array_comm[$key]['categorize'] = '<a class="ico-sprite subs_categorize" title="' . Lang::t('_CATEGORIZE', 'kb') . '"
						href="index.php?r=alms/communication/categorize&id_comm=' . $value['id_comm'] . '"><span>' . Lang::t('_CATEGORIZE', 'kb') . '</span></a>';
                } else {
                    $array_comm[$key]['categorize'] = '<a class="ico-sprite fd_notice" title="' . Lang::t('_NOT_CATEGORIZED', 'kb') . '"
						href="index.php?r=alms/communication/categorize&id_comm=' . $value['id_comm'] . '"><span>' . Lang::t('_NOT_CATEGORIZED', 'kb') . '</span></a>';
                }
            } else {
                $array_comm[$key]['categorize'] = '';
            }
            if ($value['access_entity']) {
                $array_comm[$key]['user'] = '******' . Lang::t('_ASSIGN_USERS', 'communication') . '"
					href="index.php?r=alms/communication/mod_user&id_comm=' . $value['id_comm'] . '&load=1"><span>' . Lang::t('_ASSIGN_USERS', 'communication') . '</span></a>';
            } else {
                $array_comm[$key]['user'] = '******' . Lang::t('_NO_USER_SELECTED', 'communication') . '"
					href="index.php?r=alms/communication/mod_user&id_comm=' . $value['id_comm'] . '&load=1"><span>' . Lang::t('_ASSIGN_USERS', 'communication') . '</span></a>';
            }
            $array_comm[$key]['edit'] = '<a class="ico-sprite subs_mod" href="index.php?r=alms/communication/edit&id_comm=' . $value['id_comm'] . '"><span>' . Lang::t('_MOD', 'communication') . '</span></a>';
            $array_comm[$key]['del'] = 'ajax.adm_server.php?r=alms/communication/del&id_comm=' . $value['id_comm'];
        }
        $result = array('totalRecords' => $total_comm, 'startIndex' => $start_index, 'sort' => $sort, 'dir' => $dir, 'rowsPerPage' => $results, 'results' => count($array_comm), 'records' => $array_comm);
        $this->data = $this->json->encode($result);
        echo $this->data;
    }
예제 #13
0
function regional_settings()
{
    checkPerm('view');
    /*funAdminAccess('lang','OP');
    	$newPerm = funAdminAccess('addlang', 'NEW', true);
    	$modPerm = funAdminAccess('modlang', 'MOD', true);
    	$remPerm = funAdminAccess('dellang', 'REM', true);*/
    $write_perm = true;
    $mod_perm = true;
    $rem_perm = true;
    require_once _base_ . "/lib/lib.table.php";
    $out =& $GLOBALS['page'];
    $lang =& DoceboLanguage::createInstance('admin_regset', 'framework');
    $regset = new RegionalSettingsManager();
    $out->setWorkingZone("content");
    $out->add(getTitleArea($lang->def("_REGIONAL_SETTINGS"), "regset"));
    $out->add("<div class=\"std_block\">\n");
    $ini = importVar("ini", true, 0);
    $arr = $regset->getAllRegions();
    $table = new Table(Get::sett('visuItem'));
    $out->add($table->OpenTable(""));
    $head = array($lang->def("_REGION_CODE"), $lang->def("_DESCRIPTION"), '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def("_MOD") . '" title="' . $lang->def("_MOD") . '" />', '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def("_DEL") . '" title="' . $lang->def("_DEL") . '" />');
    $head_type = array('', '', 'img', 'img');
    $out->add($table->WriteHeader($head, $head_type));
    $tot = count($arr) < $ini + Get::sett('visuItem') ? count($arr) : $ini + Get::sett('visuItem');
    for ($i = $ini; $i < $tot; $i++) {
        $rowcnt = array();
        $rowcnt[] = $arr[$i];
        $rowcnt[] = $regset->getRegionInfo($arr[$i], "description");
        if ($mod_perm) {
            $btn = "<a href=\"index.php?modname=regional_settings&amp;op=editregion&amp;id=" . $arr[$i] . "\">";
            $btn .= "<img src=\"" . getPathImage() . "standard/edit.png\" ";
            $btn .= "alt=\"" . $lang->def("_MOD") . "\" title=\"" . $lang->def("_MOD") . " " . $arr[$i] . "\" />";
            $btn .= "</a>\n";
            $rowcnt[] = $btn;
        } else {
            $rowcnt[] = "&nbsp;";
        }
        if ($rem_perm && !$regset->getRegionInfo($arr[$i], "default")) {
            $btn = "<a href=\"\">";
            $btn .= "<img src=\"" . getPathImage() . "standard/delete.png\" ";
            $btn .= "alt=\"" . $lang->def("_DEL") . "\" title=\"" . $lang->def("_DEL") . " " . $arr[$i] . "\" />";
            $btn .= "</a>\n";
            $rowcnt[] = $btn;
        } else {
            $rowcnt[] = "&nbsp;";
        }
        $out->add($table->writeRow($rowcnt));
    }
    if ($write_perm) {
        $out->add($table->WriteAddRow('<a href="index.php?modname=regional_settings&amp;op=addregion">
		 <img src="' . getPathImage() . 'standard/add.png" title="' . $lang->def('_ADD') . '" alt="' . $lang->def('_ADD') . '" /> ' . $lang->def('_ADD') . '</a>'));
    }
    $out->add($table->CloseTable());
    $out->add($table->WriteNavBar('', 'index.php?modname=regional_settings&amp;op=regset&amp;ini=', $ini, count($arr)));
    $out->add("</div>\n");
}
예제 #14
0
 public function compileRequired()
 {
     $check_privacy_policy = Get::sett('request_mandatory_fields_compilation', 'off') != 'off';
     $id_user = Docebo::user()->getIdSt();
     $policy_checked = $this->getAcceptingPolicy($id_user);
     require_once _adm_ . '/lib/lib.field.php';
     $fieldlist = new FieldList();
     $fields_checked = $fieldlist->checkUserMandatoryFields($id_user);
     return !$policy_checked && $check_privacy_policy || !$fields_checked;
 }
 public function show()
 {
     $model = new ClassroomLms();
     if (Get::sett('on_usercourse_empty') === 'on') {
         $conditions_t = array('cu.iduser = :id_user');
         $params_t = array(':id_user' => (int) Docebo::user()->getId());
         $cp_courses = $model->getUserCoursePathCourses(Docebo::user()->getIdst());
         if (!empty($cp_courses)) {
             $conditions_t[] = "cu.idCourse NOT IN (" . implode(",", $cp_courses) . ")";
         }
         $courselist_t = $model->findAll($conditions_t, $params_t);
         if (empty($courselist_t)) {
             Util::jump_to('index.php?r=lms/catalog/show&sop=unregistercourse');
         }
     }
     require_once _lms_ . '/lib/lib.middlearea.php';
     $ma = new Man_MiddleArea();
     $block_list = array();
     if ($ma->currentCanAccessObj('user_details_short')) {
         $block_list['user_details_short'] = true;
     }
     if ($ma->currentCanAccessObj('user_details_full')) {
         $block_list['user_details_full'] = true;
     }
     if ($ma->currentCanAccessObj('credits')) {
         $block_list['credits'] = true;
     }
     if ($ma->currentCanAccessObj('news')) {
         $block_list['news'] = true;
     }
     $tb_label = $ma->currentCanAccessObj('tb_label');
     if (!$tb_label) {
         $_SESSION['id_common_label'] = 0;
     } else {
         $id_common_label = Get::req('id_common_label', DOTY_INT, -1);
         if ($id_common_label >= 0) {
             $_SESSION['id_common_label'] = $id_common_label;
         } elseif ($id_common_label == -2) {
             $_SESSION['id_common_label'] = -1;
         }
         $block_list['labels'] = true;
     }
     if ($tb_label && $_SESSION['id_common_label'] == -1) {
         require_once _lms_ . '/admin/models/LabelAlms.php';
         $label_model = new LabelAlms();
         $user_label = $label_model->getLabelForUser(Docebo::user()->getId());
         $this->render('_labels', array('block_list' => $block_list, 'label' => $user_label));
     } else {
         if (!empty($block_list)) {
             $this->render('_tabs_block', array('block_list' => $block_list));
         } else {
             $this->render('_tabs', array());
         }
     }
 }
 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_CONFIRMED => '_T_USER_STATUS_CONFIRMED', _CUS_SUBSCRIBED => '_T_USER_STATUS_SUBS', _CUS_BEGIN => '_T_USER_STATUS_BEGIN', _CUS_END => '_T_USER_STATUS_END');
     $this->path_course = $GLOBALS['where_files_relative'] . '/appLms/' . Get::sett('pathcourse') . '/';
     $this->model = new CoursepathLms();
 }
예제 #17
0
 public function gethistorydata()
 {
     $start_index = Get::req('startIndex', DOTY_INT, 0);
     $results = Get::req('results', DOTY_MIXED, Get::sett('visuItem', 25));
     $sort = Get::req('sort', DOTY_MIXED, 'title');
     $dir = Get::req('dir', DOTY_MIXED, 'asc');
     $model = new GamesAlms();
     $games = $model->findAllReaded(0, 0, 'start_date', 'DESC', Docebo::user()->getId(), array('viewer' => Docebo::user()->getArrSt()));
     $result = array('totalRecords' => count($games), 'startIndex' => $start_index, 'sort' => $sort, 'dir' => $dir, 'rowsPerPage' => $results, 'results' => count($games), 'records' => $games);
     $this->data = $this->json->encode($result);
     echo $this->data;
 }
 public function getTransactionData()
 {
     //Datatable info
     $start_index = Get::req('startIndex', DOTY_INT, 0);
     $results = Get::req('results', DOTY_MIXED, Get::sett('visuItem', 25));
     $sort = Get::req('sort', DOTY_MIXED, 'date_creation');
     $dir = Get::req('dir', DOTY_MIXED, 'desc');
     $total_transaction = $this->model->getTotalTransaction();
     $array_transaction = $this->model->getTransaction($start_index, $results, $sort, $dir);
     $result = array('totalRecords' => $total_transaction, 'startIndex' => $start_index, 'sort' => $sort, 'dir' => $dir, 'rowsPerPage' => $results, 'results' => count($array_transaction), 'records' => $array_transaction);
     echo $this->json->encode($result);
 }
예제 #19
0
 public static function mod_rewrite()
 {
     if (Get::cfg('use_mod_rewrite', '') == "on") {
         $base = Get::sett('url');
         if (preg_match("/127.0.0.1/", $base)) {
             $base = preg_replace("/127.0.0.1[^\\d\\/][:]?([^\\/]*)/", $_SERVER["HTTP_HOST"], $base);
         }
         if (preg_match("/" . $_SERVER["HTTP_HOST"] . "/", $base)) {
             return '<base href="' . $base . '" />' . "\n";
         }
     }
 }
예제 #20
0
 function setActionTrack($id_user, $id_course, $mod_name, $mode)
 {
     if (isset($_SESSION['is_ghost']) && $_SESSION['is_ghost'] === true) {
         return;
     }
     $now = date("Y-m-d H:i:s");
     sql_query("\r\n\t\tUPDATE " . $GLOBALS['prefix_lms'] . "_tracksession \r\n\t\tSET numOp = numOp+1, \r\n\t\t\tlastFunction = '" . $mod_name . "', \r\n\t\t\tlastOp = '" . $mode . "', \r\n\t\t\tlastTime = '" . $now . "',\r\n\t\t\tip_address = '" . $_SERVER['REMOTE_ADDR'] . "'\r\n\t\tWHERE idEnter = '" . $_SESSION['id_enter_course'] . "' " . "AND idCourse = '" . $id_course . "' AND idUser = '******'");
     if (Get::sett('tracking') == 'on' && $_SESSION['levelCourse'] != '2') {
         $query_track = "\r\n\t\t\tINSERT INTO " . $GLOBALS['prefix_lms'] . "_trackingeneral\r\n\t\t\t( idUser, idEnter, idCourse, function, type, timeof, session_id, ip ) VALUES (\r\n\t\t\t\t'" . $id_user . "',\r\n\t\t\t\t'" . $_SESSION['id_enter_course'] . "',\r\n\t\t\t\t'" . $id_course . "',\r\n\t\t\t\t'" . $mod_name . "',\r\n\t\t\t\t'" . $mode . "',\r\n\t\t\t\t'" . $now . "',\r\n\t\t\t\t'" . '' . "',\r\n\t\t\t\t'" . $_SERVER['REMOTE_ADDR'] . "' )";
         sql_query($query_track);
     }
 }
예제 #21
0
 public function getQuestCategoriesList($pagination, $filter)
 {
     //validate pagination data
     if (!is_array($pagination)) {
         $pagination = array();
     }
     $_startIndex = isset($pagination['startIndex']) ? (int) $pagination['startIndex'] : 0;
     $_results = isset($pagination['results']) ? (int) $pagination['results'] : Get::sett('visuItem', 25);
     $_sort = 'name';
     $_dir = 'ASC';
     if (isset($pagination['dir'])) {
         switch (strtoupper($pagination['dir'])) {
             case 'YUI-DT-ASC':
                 $_dir = 'ASC';
                 break;
             case 'YUI-DT-DESC':
                 $_dir = 'DESC';
                 break;
             case 'ASC':
                 $_dir = 'ASC';
                 break;
             case 'DESC':
                 $_dir = 'DESC';
                 break;
         }
     }
     if (isset($pagination['sort'])) {
         switch ($pagination['sort']) {
             case 'description':
                 $_sort = 'description';
                 break;
         }
     }
     //validate filter data and create query conditions if any
     $_filter = "";
     if (is_array($filter)) {
         if (isset($filter['text']) && $filter['text'] != '') {
             $_filter .= " WHERE (name LIKE '%" . $filter['text'] . "%' " . " OR textof LIKE '%" . $filter['text'] . "%') ";
         }
     }
     //mount query
     $query = "SELECT idCategory, name, textof as description, author " . " FROM %lms_quest_category " . $_filter . " ORDER BY " . $_sort . " " . $_dir . " " . " LIMIT " . (int) $_startIndex . ", " . (int) $_results;
     $res = $this->db->query($query);
     //extract records from database
     $output = array();
     if ($res && $this->db->num_rows($res) > 0) {
         while ($obj = $this->db->fetch_obj($res)) {
             $output[] = $obj;
         }
     }
     return $output;
 }
예제 #22
0
function publicAdminManager_list()
{
    checkPerm('view');
    require_once _base_ . '/lib/lib.table.php';
    $lang =& DoceboLanguage::createInstance('adminrules', 'framework');
    $lang =& DoceboLanguage::createInstance('public_admin_manager', 'framework');
    $aclManager = new DoceboACLManager();
    // get users to show --------------------------------------------------
    $admin_group_idst = $aclManager->getGroupST(ADMIN_GROUP_PUBLICADMIN);
    $arr_admin_idst = $aclManager->getGroupUMembers($admin_group_idst);
    $arr_admin_id = array_flip($aclManager->getArrUserST($arr_admin_idst));
    $pm =& PlatformManager::createInstance();
    $lms_is_active = $pm->isLoaded("lms");
    /*$cms_is_active = $pm->isLoaded("cms");*/
    // print table --------------------------------------------------------
    $table = new Table(Get::sett('visuItem'), $lang->def('_PUBLIC_ADMIN_USER'), $lang->def('_PUBLIC_ADMIN_USER'));
    $table->initNavBar('ini', 'link');
    $table->setLink('index.php?modname=public_admin_manager&amp;op=view&amp;ini=');
    $ini = $table->getSelectedElement();
    $GLOBALS['page']->add(getTitleArea($lang->def('_ADMIN_MANAGMENT'), 'admin_managmer', $lang->def('_ADMIN_MANAGMENT')) . '<div class="std_block">', 'content');
    $contentH = array($lang->def('_USERNAME'), '<img src="' . getPathImage() . 'admin_manager/man_pref.gif" alt="' . $lang->def('_ADMIN_PREFERENCES_TITLE', 'adminrules') . '" ' . 'title="' . $lang->def('_ADMIN_PREFERENCES_TITLE', 'adminrules') . '" />', '<img src="' . getPathImage() . 'admin_manager/man_menu.gif" alt="' . $lang->def('_ASSIGN_USERS', 'adminrules') . '" ' . 'title="' . $lang->def('_ASSIGN_USERS', 'adminrules') . '" />', '<img src="' . getPathImage() . 'directory/tree.gif" alt="' . $lang->def('_ASSIGN_USERS', 'adminrules') . '" ' . 'title="' . $lang->def('_ASSIGN_USERS', 'adminrules') . '" />');
    $typeH = array('', 'image', 'image', 'image');
    if ($lms_is_active) {
        $contentH[] = '<img src="' . getPathImage() . 'admin_manager/man_course.gif" alt="' . $lang->def('_ASSIGN_USERS', 'adminrules') . '" ' . 'title="' . $lang->def('_ASSIGN_USERS', 'adminrules') . '" />';
        $typeH[] = 'image';
    }
    $table->setColsStyle($typeH);
    $table->addHead($contentH);
    $maxItem = count($arr_admin_id) < $ini + Get::sett('visuItem') ? count($arr_admin_id) : $ini + Get::sett('visuItem');
    for ($index = $ini; $index < $maxItem; $index++) {
        $admin_userid = substr($arr_admin_id[$arr_admin_idst[$index]], 1);
        $rowContent = array($admin_userid);
        // Edit preferences
        $rowContent[] = '<a href="index.php?modname=public_admin_manager&amp;op=edit_preferences&amp;adminidst=' . $arr_admin_idst[$index] . '"
						 title="' . $lang->def('_ADMIN_PREFERENCES_TITLE', 'adminrules') . ' : ' . $admin_userid . '">' . '<img src="' . getPathImage() . 'admin_manager/man_pref.gif"' . ' alt="' . $lang->def('_ADMIN_PREFERENCES_TITLE', 'adminrules') . ' : ' . $admin_userid . '" /></a>';
        // Edit menu
        $rowContent[] = '<a href="index.php?modname=public_admin_manager&amp;op=edit_menu&amp;adminidst=' . $arr_admin_idst[$index] . '"
						 title="' . $lang->def('_ASSIGN_USERS', 'adminrules') . ' : ' . $admin_userid . '">' . '<img src="' . getPathImage() . 'admin_manager/man_menu.gif"' . ' alt="' . $lang->def('_ASSIGN_USERS', 'adminrules') . ' : ' . $admin_userid . '" /></a>';
        // Edit user
        $rowContent[] = '<a href="index.php?modname=public_admin_manager&amp;op=assign_tree&amp;adminidst=' . $arr_admin_idst[$index] . '"
		 					title="' . $lang->def('_ASSIGN_USERS', 'adminrules') . ' : ' . $admin_userid . '">' . '<img src="' . getPathImage() . 'directory/tree.gif" ' . 'alt="' . $lang->def('_ASSIGN_USERS', 'adminrules') . ' : ' . $admin_userid . '" /></a>';
        // Edit course
        if ($lms_is_active) {
            $rowContent[] = '<a href="index.php?modname=public_admin_manager&amp;op=edit_course&amp;adminidst=' . $arr_admin_idst[$index] . '&amp;load=1"
								 title="' . $lang->def('_ASSIGN_USERS', 'adminrules') . ' : ' . $admin_userid . '">' . '<img src="' . getPathImage() . 'admin_manager/man_course.gif"' . ' alt="' . $lang->def('_ASSIGN_USERS', 'adminrules') . ' : ' . $admin_userid . '" /></a>';
        }
        $table->addBody($rowContent);
    }
    $GLOBALS['page']->add($table->getTable() . $table->getNavBar($ini, count($arr_admin_id)), 'content');
    $GLOBALS['page']->add('</div>', 'content');
}
 public function gettabledataTask()
 {
     //read from input and prepare filter and pagination variables
     $startIndex = Get::req('startIndex', DOTY_INT, 0);
     $results = Get::req('results', DOTY_INT, Get::sett('visuItem', 25));
     $rowsPerPage = Get::req('rowsPerPage', DOTY_INT, $results);
     $sort = Get::req('sort', DOTY_STRING, "");
     $dir = Get::req('dir', DOTY_STRING, "asc");
     $filter_text = Get::req('filter_text', DOTY_STRING, '');
     $searchFilter = array('text' => $filter_text);
     //get total from database and validate the results count
     $total = $this->model->getQuestCategoriesTotal($searchFilter);
     if ($startIndex >= $total) {
         if ($total < $results) {
             $startIndex = 0;
         } else {
             $startIndex = $total - $rowsPerPage;
         }
     }
     //set pagination argument
     $pagination = array('startIndex' => $startIndex, 'results' => $rowsPerPage, 'sort' => $sort, 'dir' => $dir);
     //read records from database
     $list = $this->model->getQuestCategoriesList($pagination, $searchFilter);
     //prepare the data for sending
     $output_results = array();
     if (is_array($list) && count($list) > 0) {
         //check if categories are used in any test or poll
         $id_list = array();
         foreach ($list as $record) {
             $id_list[] = $record->idCategory;
         }
         $used_test_arr = $this->model->getUsedInTests($id_list);
         $used_poll_arr = $this->model->getUsedInPolls($id_list);
         foreach ($list as $record) {
             //format description field
             $description = strip_tags($record->description);
             if (strlen($description) > 100) {
                 $description = substr($description, 0, 97) . '...';
             }
             $used_test = isset($used_test_arr[$record->idCategory]) ? $used_test_arr[$record->idCategory] : 0;
             $used_poll = isset($used_poll_arr[$record->idCategory]) ? $used_poll_arr[$record->idCategory] : 0;
             $can_mod = $this->permissions['mod'];
             $can_del = $used_test <= 0 && $used_poll <= 0 && $this->permissions['del'];
             //prepare output record
             $output_results[] = array('id' => $record->idCategory, 'name' => Layout::highlight($record->name, $filter_text), 'description' => Layout::highlight($description, $filter_text), 'used_test' => (int) $used_test, 'used_poll' => (int) $used_poll, 'mod' => $can_mod ? 'ajax.adm_server.php?r=alms/questcategory/edit&id=' . (int) $record->idCategory : false, 'del' => $can_del ? 'ajax.adm_server.php?r=alms/questcategory/delete&id=' . (int) $record->idCategory : false);
         }
     }
     $output = array('totalRecords' => $total, 'startIndex' => $startIndex, 'sort' => $sort, 'dir' => $dir, 'rowsPerPage' => $rowsPerPage, 'results' => count($list), 'records' => $output_results);
     echo $this->json->encode($output);
 }
예제 #24
0
 /**
  * The news link for the home pages
  * @return <html>
  */
 public static function news($hnumber = 2)
 {
     $html = '<div id="news">';
     $textQuery = "\r\n\t\tSELECT idNews, publish_date, title, short_desc\r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_news\r\n\t\tWHERE language = '" . getLanguage() . "'\r\n\t\tORDER BY important DESC, publish_date DESC\r\n\t\tLIMIT 0," . Get::sett('visuNewsHomePage');
     //do query
     $result = sql_query($textQuery);
     if (sql_num_rows($hnumber)) {
         $html .= '<p>' . Lang::set('_NO_CONTENT', 'login') . '</p>';
     }
     while (list($idNews, $publish_date, $title, $short_desc) = sql_fetch_row($result)) {
         $html .= '<h' . $hnumber . '>' . '<a href="index.php?modname=login&amp;op=readnews&amp;idNews=' . $idNews . '">' . $title . '</a>' . '</h' . $hnumber . '>' . '<p class="news_textof">' . '<span class="news_data">' . Format::date($publish_date) . ' - </span>' . $short_desc . '</p>';
     }
     $html .= '</div>';
     return $html;
 }
 protected function getclassroomedition()
 {
     //Course info
     $id_course = Get::req('id_course', DOTY_INT, 0);
     //Datatable info
     $start_index = Get::req('startIndex', DOTY_INT, 0);
     $results = Get::req('results', DOTY_MIXED, Get::sett('visuItem', 25));
     $sort = Get::req('sort', DOTY_MIXED, 'userid');
     $dir = Get::req('dir', DOTY_MIXED, 'asc');
     $model = new ClassroomAlms($id_course);
     $total_course = $model->getCourseEditionNumber();
     $array_edition = $model->loadCourseEdition($start_index, $results, $sort, $dir);
     $result = array('totalRecords' => $total_course, 'startIndex' => $start_index, 'sort' => $sort, 'dir' => $dir, 'rowsPerPage' => $results, 'results' => count($array_edition), 'records' => $array_edition);
     $this->data = $this->json->encode($result);
     echo $this->data;
 }
예제 #26
0
function profile()
{
    checkPerm('view');
    require_once $GLOBALS['where_lms'] . '/lib/lib.lms_user_profile.php';
    $lang =& DoceboLanguage::createInstance('profile', 'framework');
    $profile = new LmsUserProfile(getLogUserId());
    $profile->init('profile', 'framework', 'modname=profile&op=profile&id_user='******'ap');
    if (checkPerm('mod', true)) {
        $profile->enableEditMode();
    }
    if (Get::sett('profile_only_pwd') == 'on') {
        $GLOBALS['page']->add($profile->getTitleArea() . $profile->getHead() . $profile->performAction(false, 'mod_password') . profileBackUrl() . $profile->getFooter(), 'content');
    } else {
        $GLOBALS['page']->add($profile->getTitleArea() . $profile->getHead() . $profile->performAction() . profileBackUrl() . $profile->getFooter(), 'content');
    }
}
예제 #27
0
function reg_with_fb()
{
    $_SESSION['fb_from'] = "register";
    $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'
    $authUrl = $facebookService->getAuthorizationUri();
    header('Location: ' . $authUrl);
    die;
}
예제 #28
0
function sl_upload($srcFile, $dstFile)
{
    $uploadType = Get::cfg('uploadType');
    // check if the mime type is allowed by the whitelist
    // if the whitelist is empty all types are accepted
    require_once _lib_ . '/lib.mimetype.php';
    $upload_whitelist = Get::sett('file_upload_whitelist', 'zip,jpg,gif,png,txt,csv,rtf,xml,doc,docx,xls,xlsx,ppt,pptx,odt,ods,odp,pdf,xps,mp4,mp3,flv,swf,mov,wav,ogg,flac,wma,wmv');
    $upload_whitelist_arr = explode(',', trim($upload_whitelist, ','));
    if (!empty($upload_whitelist_arr)) {
        $valid_ext = false;
        $file_ext = strtolower(substr(strrchr($dstFile, "."), 1));
        foreach ($upload_whitelist_arr as $k => $v) {
            // remove extra spaces and set lower case
            $ext = trim(strtolower($v));
            $mt = mimetype($ext);
            if ($mt) {
                $mimetype_arr[] = $mt;
            }
            getOtherMime($ext, $mimetype_arr);
            if ($ext == $file_ext) {
                $valid_ext = true;
            }
        }
        $mimetype_arr = array_unique($mimetype_arr);
        if (class_exists('file') && method_exists('finfo', 'file')) {
            $finfo = new finfo(FILEINFO_MIME_TYPE);
            $file_mime_type = $finfo->file($srcFile);
        } else {
            $file_mime_type = mime_content_type($srcFile);
        }
        if (!$valid_ext || !in_array($file_mime_type, $mimetype_arr)) {
            return false;
        }
    }
    $dstFile = stripslashes($dstFile);
    if ($uploadType == "ftp") {
        return sl_upload_ftp($srcFile, $dstFile);
    } elseif ($uploadType == "cgi") {
        return sl_upload_cgi($srcFile, $dstFile);
    } else {
        return sl_upload_fs($srcFile, $dstFile);
    }
}
예제 #29
0
function play($idResource, $idParams, $back_url)
{
    //if(!checkPerm('view', true, 'organization') && !checkPerm('view', true, 'storage')) die("You can't access");
    //echo ("idResource = ".$idResource."; idParams = ".$idParams."; back_url = ".$back_url);
    list($file) = sql_fetch_row(sql_query("SELECT path" . " FROM " . $GLOBALS['prefix_lms'] . "_materials_lesson" . " WHERE idLesson = '" . $idResource . "'"));
    //recognize mime type
    $expFileName = explode('.', $file);
    $totPart = count($expFileName) - 1;
    require_once $GLOBALS['where_lms'] . '/lib/lib.param.php';
    $idReference = getLOParam($idParams, 'idReference');
    // NOTE: Track only if $idReference is present
    if ($idReference !== FALSE) {
        require_once $GLOBALS['where_lms'] . '/class.module/track.item.php';
        list($exist, $idTrack) = Track_Item::getIdTrack($idReference, getLogUserId(), $idResource, TRUE);
        if ($exist) {
            $ti = new Track_Item($idTrack);
            $ti->setDate(date('Y-m-d H:i:s'));
            $ti->status = 'completed';
            $ti->update();
        } else {
            $ti = new Track_Item(false);
            $ti->createTrack($idReference, $idTrack, getLogUserId(), date('Y-m-d H:i:s'), 'completed', 'item');
        }
    }
    if ($_SESSION['direct_play'] == 1) {
        if (isset($_SESSION['idCourse'])) {
            TrackUser::closeSessionCourseTrack();
            unset($_SESSION['idCourse']);
            unset($_SESSION['idEdition']);
        }
        if (isset($_SESSION['test_assessment'])) {
            unset($_SESSION['test_assessment']);
        }
        if (isset($_SESSION['cp_assessment_effect'])) {
            unset($_SESSION['cp_assessment_effect']);
        }
        $_SESSION['current_main_menu'] = '1';
        $_SESSION['sel_module_id'] = '1';
        $_SESSION['is_ghost'] = false;
    }
    //send file
    sendFile('/appLms/' . Get::sett('pathlesson'), $file, $expFileName[$totPart]);
}
예제 #30
0
function mycompetences(&$url)
{
    checkPerm('view');
    $html = "";
    $html .= getTitleArea(Lang::t('_COMPETENCES'), 'competences');
    $html .= '<div class="std_block">';
    $cmodel = new CompetencesAdm();
    $fmodel = new FunctionalrolesAdm();
    $id_user = getLogUserId();
    $ucomps = $cmodel->getUserCompetences($id_user);
    $rcomps = $fmodel->getUserRequiredCompetences($id_user);
    $ucomps_info = $cmodel->getCompetencesInfo(array_keys($ucomps));
    $language = getLanguage();
    $_typologies = $cmodel->getCompetenceTypologies();
    $_types = $cmodel->getCompetenceTypes();
    $icon_actv = '<span class="ico-sprite subs_actv"><span>' . Lang::t('_COMPETENCE_OBTAINED', 'competences') . '</span></span>';
    $icon_req = '<span class="ico-sprite subs_actv"><span>' . Lang::t('_MANDATORY', 'competences') . '</span></span>';
    //*******************
    require_once _base_ . '/lib/lib.table.php';
    $table = new Table(Get::sett('visuItem'), Lang::t('_COMPETENCES'), Lang::t('_COMPETENCES'));
    $style_h = array('', '', 'image', 'image', 'image', 'image', 'image');
    $label_h = array(Lang::t('_NAME', 'competences'), Lang::t('_TYPOLOGY', 'competences'), Lang::t('_TYPE', 'standard'), Lang::t('_SCORE', 'competences'), Lang::t('_DATE_LAST_COMPLETE', 'subscribe'), Lang::t('_COMPETENCES_REQUIRED', 'competences'));
    $table->addHead($label_h, $style_h);
    foreach ($ucomps_info as $id_competence => $cinfo) {
        $line = array();
        $line[] = $cinfo->langs[$language]['name'];
        $line[] = $_typologies[$cinfo->typology];
        $line[] = $_types[$cinfo->type];
        $line[] = $cinfo->type == 'score' ? '<b>' . $ucomps[$id_competence]->score_got . '</b>' : $icon_actv;
        $line[] = Format::date($ucomps[$id_competence]->last_assign_date, 'datetime');
        $line[] = array_key_exists($id_competence, $rcomps) ? $icon_req : '';
        $table->addBody($line);
    }
    $html .= $table->getTable();
    $html .= '</div>';
    $html .= Form::openForm('beck_url', 'index.php');
    $html .= Form::openButtonSpace();
    $html .= Form::getButton('close', 'close', Lang::t('_CLOSE', 'standard'));
    $html .= Form::closeButtonSpace();
    $html .= Form::closeform();
    cout($html, 'content');
}