/**
  * 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);
 }
    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;
    }
 public function tabledataTask()
 {
     $this->_setTableStatus("filter", Get::req("filter", DOTY_STRING, ""));
     $startIndex = $this->_getTableStatus("startIndex", 0);
     $page_size = Get::sett('visuItem', 25);
     $sort = $this->_getTableStatus("sort", "name");
     $dir = $this->_getTableStatus("dir", "asc");
     $filter = $this->_getTableStatus("filter");
     $params = new stdClass();
     $params->startIndex = $startIndex;
     $params->results = $page_size;
     $params->sort = $sort;
     $params->dir = $dir;
     $params->filter = $filter;
     $templates = $this->model->getTemplates($params);
     $template_rows = array();
     if (is_array($templates)) {
         foreach ($templates as $template) {
             $template_rows[] = array('id' => $template->id_template, 'name' => highlightText($template->name, $filter), 'date_creation' => Format::date($template->date_creation, "datetime"), 'last_modify' => Format::date($template->last_modify, "datetime"), 'del' => 'ajax.adm_server.php?r=adm/templatelayout/delete&id=' . (int) $template->id_template);
         }
     }
     $output = array('startIndex' => $startIndex, 'recordsReturned' => count($templates), 'sort' => $sort, 'dir' => $dir, 'totalRecords' => $this->model->getTotalTemplates($filter), 'pageSize' => $page_size, 'records' => $template_rows);
     echo $this->json->encode($output);
 }
 public function getfncroletabledataTask()
 {
     $op = Get::req('op', DOTY_MIXED, false);
     switch ($op) {
         case "selectall":
             $this->_selectAllFncroles();
             return;
             break;
     }
     $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, "");
     $pagination = array('startIndex' => $startIndex, 'results' => $results, 'sort' => $sort, 'dir' => $dir);
     $list = $this->fncrole_model->getFunctionalRolesList($pagination, array('text' => $filter));
     //format models' data
     $records = array();
     $acl_man = Docebo::user()->getAclManager();
     if (is_array($list)) {
         foreach ($list as $record) {
             $_description = strip_tags($record->description);
             if (strlen($_description) > 100) {
                 $_description = substr($_description, 0, 97) . '...';
             }
             $records[] = array('id' => (int) $record->id_fncrole, 'name' => highlightText($record->name, $filter), 'group' => highlightText($record->group_name, $filter), 'description' => highlightText($_description, $filter), 'users' => $record->users);
         }
     }
     $output = array('startIndex' => $startIndex, 'recordsReturned' => count($records), 'sort' => $sort, 'dir' => $dir, 'totalRecords' => $this->fncrole_model->getFunctionalRolesTotal($filter), 'pageSize' => $rowsPerPage, 'records' => $records);
     echo $this->json->encode($output);
 }
Example #5
0
                            $searchData[$i]['text'] = $l_postQueued;
                        }
                    }
                    $searchResults .= <<<out
<table class="tbTransparent" style="width:100%"><tr><td class="tbTransparentCell">{$num}. <span class="txtSm"><strong>{$l_posted}</strong>: {$datetime} - <strong>{$searchData[$i]['forum_name']}</strong></span> / <strong><a href="{$main_url}/{$indexphp}action=search&amp;loc=1&amp;forum={$searchData[$i]['forum_id']}&amp;topic={$searchData[$i]['topic_id']}&amp;page={$searchData[$i]['post_id']}">{$topic_name}</a></strong><br />
&nbsp;&nbsp;&nbsp; <span class="txtNr">{$searchData[$i]['text']}&nbsp;</span>
</td></tr></table><br />
out;
                }
            }
        } elseif ($where == 1) {
            /* Simply search by topic titles. 1 request */
            if ($row = db_searchSelect(0, $Tt, 'topic_id, forum_id, topic_title, topic_time', $sqlStr, $makeLim, 'topic_id desc')) {
                $num = 1 + $page * $viewmaxsearch - (PAGE1_OFFSET + 1) * $viewmaxsearch;
                do {
                    $txt = highlightText($row[2], $phrase, $searchType);
                    $datetime = convert_date($row[3]);
                    $forum_name = isset($forums[$row[1]]) ? $forums[$row[1]] : 'N/A';
                    if (isset($preModerationType) and $preModerationType > 0 and isset($premodTopics) and in_array($row[0], $premodTopics)) {
                        $txt = $l_topicQueued;
                    }
                    if (isset($mod_rewrite) and $mod_rewrite) {
                        $furl = addTopicURLPage(genTopicURL($main_url, $row[1], $forum_name, $row[0], $row[2]), PAGE1_OFFSET + 1);
                    } else {
                        $furl = "{$main_url}/{$indexphp}action=vthread&amp;forum={$row[1]}&amp;topic={$row[0]}";
                    }
                    $searchResults .= <<<out
<table class="tbTransparent" style="width:100%"><tr><td class="tbTransparentCell">{$num}. <span class="txtSm"><strong>{$l_posted}</strong>: {$datetime} - <strong>{$forum_name}</strong></span> / <a href="{$furl}">{$txt}</a>
</td></tr></table><br />
out;
                    $num++;
Example #6
0
function view_report_certificate()
{
    checkPerm('view');
    require_once _lms_ . '/lib/lib.certificate.php';
    require_once _lms_ . '/lib/lib.course.php';
    $out =& $GLOBALS['page'];
    $out->setWorkingZone('content');
    $lang =& DoceboLanguage::createInstance('certificate', 'lms');
    $deletion = importVar('deletion', true, 0);
    if ($deletion) {
        switch ($deletion) {
            case 1:
                $out->add(getResultUi($lang->def('_OPERATION_SUCCESSFUL')));
                break;
            case 2:
                $out->add(getErrorUi($lang->def('_OPERATION_FAILURE')));
                break;
            case 3:
                $out->add(getErrorUi($lang->def('_OPERATION_FAILURE')));
                break;
        }
    }
    $certificate = new Certificate();
    $id_certificate = importVar('id_certificate', true, 0);
    $id_course = importVar('id_course', true, 0);
    $selection = importVar('selection', false, array());
    //all possible selected values
    $selected = importVar('selected', false, array());
    //effectively selected values with checkbox
    $sel = importVar('old_selection', false, '');
    //selected values from previous table pages
    if ($sel != '') {
        $total_selection = explode(',', $sel);
    } else {
        $total_selection = array();
    }
    //update total selection
    foreach ($selection as $key => $val) {
        if (in_array($val, $selected)) {
            if (!in_array($val, $total_selection)) {
                $total_selection[] = $val;
            }
        } else {
            $index = array_search($val, $total_selection);
            if ($index !== false) {
                array_splice($total_selection, $index, 1);
            }
        }
    }
    $search_filter = importVar('filter', false, '');
    $only_released = importVar('only_released', true, 0);
    //which command?
    if (importVar('search_button', false, false) !== false) {
    }
    if (importVar('reset_button', false, false) !== false) {
        $search_filter = '';
        $only_released = 0;
    }
    if (importVar('print_button', false, false) !== false) {
    }
    $numtablerows = $GLOBALS['framework']['visuItem'];
    $tb = new Table($numtablerows, $lang->def('_CERTIFICATE_VIEW_CAPTION'), $lang->def('_CERTIFICATE_VIEW_CAPTION'));
    $tb->initNavBar('ini', 'button');
    $ini = $tb->getSelectedElement();
    $tca = $GLOBALS['prefix_lms'] . "_certificate_assign as ca";
    $tcc = $GLOBALS['prefix_lms'] . "_certificate_course as cc";
    $tcu = $GLOBALS['prefix_lms'] . "_courseuser as cu";
    $tu = $GLOBALS['prefix_fw'] . "_user as u";
    $where = "";
    if ($search_filter != '') {
        $where .= " AND (u.userid LIKE '%" . $search_filter . "%' OR u.lastname LIKE '%" . $search_filter . "%' OR u.firstname LIKE '%" . $search_filter . "%') ";
    }
    if ($only_released > 0) {
        $where = " AND ca.on_date " . ($only_released == 1 ? "IS NOT" : "IS") . " NULL ";
    }
    //$where .= " AND ".$aval_status." ".($only_released==1 ? "<" : ">=")." cu.status ";
    list($aval_status) = sql_fetch_row(sql_query("SELECT available_for_status FROM " . $tcc . " " . " WHERE id_certificate='" . (int) $id_certificate . "' AND id_course='" . (int) $id_course . "'"));
    switch ($aval_status) {
        case AVS_ASSIGN_FOR_ALL_STATUS:
            $aval_status = " 1 ";
            break;
        case AVS_ASSIGN_FOR_STATUS_INCOURSE:
            $aval_status = " cu.status = " . _CUS_BEGIN . " ";
            break;
        case AVS_ASSIGN_FOR_STATUS_COMPLETED:
            $aval_status = " cu.status = " . _CUS_END . " ";
            break;
    }
    list($totalrows) = sql_fetch_row(sql_query("SELECT COUNT(*) " . " FROM ( " . $tu . " JOIN " . $tcu . " ON (u.idst = cu.idUser) ) LEFT JOIN " . $tca . " " . " ON ( ca.id_course = cu.idCourse AND ca.id_user=cu.idUser ) " . " WHERE (ca.id_certificate='" . (int) $id_certificate . "' OR ca.id_certificate IS NULL) AND " . $aval_status . " " . " AND cu.idCourse='" . (int) $id_course . "' " . $where));
    $query = "SELECT u.userid, u.firstname, u.lastname, cu.date_complete, ca.on_date, cu.idUser as id_user, cu.status " . " FROM ( " . $tu . " JOIN " . $tcu . " ON (u.idst = cu.idUser) ) LEFT JOIN " . $tca . " " . " ON ( ca.id_course = cu.idCourse AND ca.id_user=cu.idUser ) " . " WHERE (ca.id_certificate='" . (int) $id_certificate . "' OR ca.id_certificate IS NULL) AND " . $aval_status . " " . " AND cu.idCourse='" . (int) $id_course . "' " . $where . " ORDER BY u.userid LIMIT " . $ini . ", " . $numtablerows;
    $res = sql_query($query);
    $from = Get::req('from', DOTY_MIXED, '');
    $back_ui = getBackUi('index.php?r=lms/pcourse/certificate&amp;id_course=' . (int) $id_course, $lang->def('_BACK'));
    $out->add(getTitleArea(array('index.php?r=lms/pcourse/certificate&amp;id_course=' . (int) $id_course => $lang->def('_CERTIFICATE_ASSIGN_STATUS', 'course'), $lang->def('_CERTIFICATE_REPORT_COURSE_CERT')), 'certificate'));
    $out->add('<div class="std_block">' . $back_ui);
    $numrows = sql_num_rows($res);
    $downloadables = array();
    if ($numrows > 0) {
        $clang =& DoceboLanguage::CreateInstance('course', 'lms');
        $type_h = array('image', '', '', '', '', '', '', 'image', 'image');
        $cont_h = array('', $lang->def('_USERNAME'), $lang->def('_LASTNAME'), $lang->def('_FIRSTNAME'), $clang->def('_STATUS'), $lang->def('_DATE'), $lang->def('_RELASE_DATE'), Get::img('course/certificate.png', Lang::t('_TITLE_VIEW_CERT', 'certificate')), Get::img('standard/delete.png', Lang::t('_DEL', 'certificate')));
        $tb->setColsStyle($type_h);
        $tb->addHead($cont_h);
        $acl_man =& $GLOBALS['current_user']->getAclManager();
        $arr_status = array(_CUS_CONFIRMED => $clang->def('_USER_STATUS_CONFIRMED'), _CUS_SUBSCRIBED => $clang->def('_USER_STATUS_SUBS'), _CUS_BEGIN => $clang->def('_USER_STATUS_BEGIN'), _CUS_END => $clang->def('_USER_STATUS_END'), _CUS_SUSPEND => $clang->def('_USER_STATUS_SUSPEND'));
        //foreach($report_info as $info_report)
        while ($info = sql_fetch_assoc($res)) {
            $cont = array();
            $can_assign = (bool) ($info['on_date'] == '');
            $input_id = $info['id_user'];
            $sel_cell_content = '';
            $label_open = '';
            $label_close = '';
            if ($can_assign) {
                $input = '<input type="hidden" id="selection_' . $input_id . '" name="selection[' . $input_id . ']" value="' . $input_id . '"/> ';
                if (in_array($input_id, $total_selection)) {
                    $checked = ' checked="checked"';
                } else {
                    $checked = '';
                }
                $sel_cell_content .= $input . '<input type="checkbox" id="selected_' . $input_id . '" name="selected[' . $input_id . ']" value="' . $input_id . '"' . $checked . '/>';
                $label_open = '<label for="selected_' . $input_id . '">';
                $label_close = '</label>';
            }
            $userid = $acl_man->relativeId($info['userid']);
            $cont[] = $sel_cell_content;
            $cont[] = $label_open . ($search_filter != '' ? highlightText($userid, $search_filter) : $userid) . $label_close;
            $cont[] = $label_open . ($search_filter != '' ? highlightText($info['lastname'], $search_filter) : $info['lastname']) . $label_close;
            $cont[] = $label_open . ($search_filter != '' ? highlightText($info['firstname'], $search_filter) : $info['firstname']) . $label_close;
            $cont[] = $arr_status[$info['status']];
            $cont[] = $info['date_complete'];
            $cont[] = $info['on_date'];
            $url = 'index.php?modname=pcertificate&amp;certificate_id=' . $id_certificate . '&amp;course_id=' . $id_course . '&amp;user_id=' . $info['id_user'];
            $dl_url = $url . "&amp;op=send_certificate";
            if ($can_assign) {
                $downloadables[] = 'dl_single_' . $input_id;
            }
            $cont[] = '<a href="' . ($can_assign ? "javascript:;" : $dl_url) . '" id="dl_single_' . $input_id . '">' . Get::img('course/certificate.png', Lang::t('_TITLE_VIEW_CERT', 'certificate')) . ($can_assign ? $lang->def('_GENERATE') : $lang->def('_DOWNLOAD')) . '</a>';
            $cont[] = $can_assign ? "" : '<a href="' . $url . '&amp;op=del_report_certificate">' . Get::img('standard/delete.png', Lang::t('_DEL', 'certificate')) . '</a>';
            $tb->addBody($cont);
        }
        require_once _base_ . '/lib/lib.dialog.php';
        setupHrefDialogBox('a[href*=del_report_certificate]');
        $form = new Form();
        $form_url = "index.php?modname=pcertificate&amp;op=view_report_certificate&amp;id_certificate=" . (int) $id_certificate . "&amp;id_course=" . (int) $id_course;
        $out->add($form->openForm("certificates_emission", $form_url));
        $out->add($form->getHidden('old_selection', 'old_selection', implode(',', $total_selection)));
        //search filter ...
        $release_options = array($lang->def('_ALL') => 0, $lang->def('_ONLY_RELEASED') => 1, $lang->def('_ONLY_TO_RELEASE') => 2);
        /*
        		$out->add($form->getOpenFieldset($lang->def('_SEARCH_FILTER')));
        		$out->add($form->getTextfield($lang->def('_FILTER'), "filter", "filter", 255, $search_filter));
        		$out->add($form->getRadioSet($lang->def('_RELEASE_OPTIONS'), 'only_released', 'only_released', $release_options, $only_released).'<div class="no_float"></div>');
        		$out->add($form->openButtonSpace());
        		$out->add($form->getButton("search_button", "search_button", $lang->def('_SEARCH')));
        		$out->add($form->getButton("reset_button", "reset_button", $lang->def('_UNDO')));
        		$out->add($form->closeButtonSpace());
        		$out->add($form->getCloseFieldset());
        */
        $print_button_1 = '<div><a id="print_selected_button_1" href="javascript:;">' . Get::img('course/certificate.png', Lang::t('_GENERATE_ALL_SELECTED', 'certificate')) . Lang::t('_GENERATE_ALL_SELECTED', 'certificate') . '</a></div>';
        $print_button_2 = '<div><a id="print_selected_button_2" href="javascript:;">' . Get::img('course/certificate.png', Lang::t('_GENERATE_ALL_SELECTED', 'certificate')) . Lang::t('_GENERATE_ALL_SELECTED', 'certificate') . '</a></div>';
        cout('<div class="quick_search_form">' . Form::getInputTextfield("_FILTER", "filter", "filter", $search_filter, '', 255, '') . Form::getButton("search_button", "search_button", Lang::t('_SEARCH', 'standard'), "search_b") . Form::getButton("reset_button", "reset_button", Lang::t('_RESET', 'standard'), "reset_b") . '<br />' . '<br />' . $lang->def('_RELEASE_OPTIONS') . ': ' . Form::getInputRadio('only_released_0', 'only_released', '0', $only_released == 0, '') . ' <label class="label_normal" for="only_released_0">' . Lang::t('_ALL', 'certificate') . '</label>' . '&nbsp;&nbsp;&nbsp;&nbsp;' . Form::getInputRadio('only_released_1', 'only_released', '1', $only_released == 1, '') . ' <label class="label_normal" for="only_released_1">' . Lang::t('_ONLY_RELEASED', 'certificate') . '</label>' . '&nbsp;&nbsp;&nbsp;&nbsp;' . Form::getInputRadio('only_released_2', 'only_released', '2', $only_released == 2, '') . ' <label class="label_normal" for="only_released_2">' . Lang::t('_ONLY_TO_RELEASE', 'certificate') . '</label>' . Form::closeForm() . '</div>', 'content');
        $navbar = $tb->getNavBar($ini, $totalrows);
        $out->add($print_button_1 . '<br />' . $navbar . $tb->getTable() . $navbar . '<br />' . $print_button_2);
        $out->add($form->closeForm());
    } else {
        $out->add($lang->def('_NO_USER_FOR_CERTIFICATE'));
    }
    $out->add($back_ui . '</div>');
    addCss('style_menu', 'lms');
    Util::get_js(Get::rel_path('lms') . '/modules/pcertificate/pcertificate.js', true, true);
    $script = 'var ajax_url="ajax.server.php?plf=lms&mn=pcertificate"; var _STOP="' . $lang->def('_STOP') . '"; ' . 'var glob_id_certificate = ' . (int) $id_certificate . ', glob_id_course = ' . (int) $id_course . ';' . 'var single_list = [' . (count($downloadables) ? '"' . implode('","', $downloadables) . '"' : '') . ']; ' . 'var reload_url = "' . str_replace('&amp;', '&', isset($form_url) ? $form_url : '') . '", _ERROR_PARSE = "' . $lang->def('_OPERATION_FAILURE') . '", _SUCCESS = "' . $lang->def('_OPERATION_SUCCESSFUL') . '";';
    $out->add('<script type="text/javascript">' . $script . '</script>', 'page_head');
}
Example #7
0
function view_report_certificate()
{
    checkPerm('view');
    require_once _lms_ . '/lib/lib.certificate.php';
    require_once _lms_ . '/lib/lib.course.php';
    $out =& $GLOBALS['page'];
    $out->setWorkingZone('content');
    $lang =& DoceboLanguage::createInstance('certificate', 'lms');
    $deletion = importVar('deletion', true, 0);
    if ($deletion) {
        switch ($deletion) {
            case 1:
                $out->add(getResultUi($lang->def('_OPERATION_SUCCESSFUL')));
                break;
            case 2:
                $out->add(getErrorUi($lang->def('_OPERATION_FAILURE')));
                break;
            case 3:
                $out->add(getErrorUi($lang->def('_OPERATION_FAILURE')));
                break;
        }
    }
    $certificate = new Certificate();
    $id_certificate = importVar('id_certificate', true, 0);
    $id_course = importVar('id_course', true, 0);
    $selection = importVar('selection', false, array());
    //all possible selected values
    $selected = importVar('selected', false, array());
    //effectively selected values with checkbox
    $sel = importVar('old_selection', false, '');
    //selected values from previous table pages
    if ($sel != '') {
        $total_selection = explode(',', $sel);
    } else {
        $total_selection = array();
    }
    //update total selection
    foreach ($selection as $key => $val) {
        if (in_array($val, $selected)) {
            if (!in_array($val, $total_selection)) {
                $total_selection[] = $val;
            }
        } else {
            $index = array_search($val, $total_selection);
            if ($index !== false) {
                array_splice($total_selection, $index, 1);
            }
        }
    }
    $search_filter = importVar('filter', false, '');
    $only_released = importVar('only_released', true, 0);
    //which command?
    if (importVar('search_button', false, false) !== false) {
    }
    if (importVar('reset_button', false, false) !== false) {
        $search_filter = '';
        $only_released = 0;
    }
    if (importVar('print_button', false, false) !== false) {
    }
    $numtablerows = Get::sett('visuItem', 25);
    $tb = new Table($numtablerows, $lang->def('_CERTIFICATE_VIEW_CAPTION'), $lang->def('_CERTIFICATE_VIEW_CAPTION'));
    $tb->initNavBar('ini', 'button');
    $ini = $tb->getSelectedElement();
    $ini_param = Get::req('ini', DOTY_MIXED, array());
    //floor($ini / Get::sett('visuItem', 25));
    if (empty($ini_param)) {
        $ini_param = 1;
    } else {
        list($ini_param) = each($ini_param);
    }
    $tca = $GLOBALS['prefix_lms'] . "_certificate_assign as ca";
    $tcc = $GLOBALS['prefix_lms'] . "_certificate_course as cc";
    $tcu = $GLOBALS['prefix_lms'] . "_courseuser as cu";
    $tu = $GLOBALS['prefix_fw'] . "_user as u";
    $where = "";
    if ($search_filter != '') {
        $where .= " AND (u.userid LIKE '%" . $search_filter . "%' OR u.lastname LIKE '%" . $search_filter . "%' OR u.firstname LIKE '%" . $search_filter . "%') ";
    }
    if ($only_released > 0) {
        $where = " AND ca.on_date " . ($only_released == 1 ? "IS NOT" : "IS") . " NULL ";
    }
    //$where .= " AND ".$aval_status." ".($only_released==1 ? "<" : ">=")." cu.status ";
    list($aval_status) = sql_fetch_row(sql_query("SELECT available_for_status FROM " . $tcc . " " . " WHERE id_certificate='" . (int) $id_certificate . "' AND id_course='" . (int) $id_course . "'"));
    switch ($aval_status) {
        case AVS_ASSIGN_FOR_ALL_STATUS:
            $aval_status = " 1 ";
            break;
        case AVS_ASSIGN_FOR_STATUS_INCOURSE:
            $aval_status = " cu.status = " . _CUS_BEGIN . " ";
            break;
        case AVS_ASSIGN_FOR_STATUS_COMPLETED:
            $aval_status = " cu.status = " . _CUS_END . " ";
            break;
    }
    list($totalrows) = sql_fetch_row(sql_query("SELECT COUNT(*) " . " FROM ( " . $tu . " JOIN " . $tcu . " ON (u.idst = cu.idUser) ) LEFT JOIN " . $tca . " " . " ON ( ca.id_course = cu.idCourse AND ca.id_user=cu.idUser ) " . " WHERE (ca.id_certificate='" . (int) $id_certificate . "' OR ca.id_certificate IS NULL) AND " . $aval_status . " " . " AND cu.idCourse='" . (int) $id_course . "' " . $where));
    $query = "SELECT u.userid, u.firstname, u.lastname, cu.date_complete, ca.on_date, cu.idUser as id_user, cu.status " . " FROM ( " . $tu . " JOIN " . $tcu . " ON (u.idst = cu.idUser) ) LEFT JOIN " . $tca . " " . " ON ( ca.id_course = cu.idCourse AND ca.id_user=cu.idUser ) " . " WHERE (ca.id_certificate='" . (int) $id_certificate . "' OR ca.id_certificate IS NULL) AND " . $aval_status . " " . " AND cu.idCourse='" . (int) $id_course . "' " . $where . " ORDER BY u.userid LIMIT " . $ini . ", " . $numtablerows;
    //cout('<pre>'.print_r($_POST, true).'</pre>');
    //cout($query);
    $res = sql_query($query);
    $from = Get::req('from', DOTY_MIXED, '');
    if ($from === 'course') {
        $back_ui = getBackUi('index.php?r=alms/course/certificate&amp;id_course=' . (int) $id_course, $lang->def('_BACK'));
        $out->add(getTitleArea(array('index.php?r=alms/course/certificate&amp;id_course=' . (int) $id_course => $lang->def('_CERTIFICATE_ASSIGN_STATUS', 'course'), $lang->def('_COURSES')), 'certificate'));
    } else {
        $back_ui = getBackUi('index.php?modname=certificate&amp;op=report_certificate&amp;id_certificate=' . (int) $id_certificate, $lang->def('_BACK'));
        $out->add(getTitleArea(array('index.php?modname=certificate&amp;op=certificate' => $lang->def('_TITLE_CERTIFICATE'), 'index.php?modname=certificate&amp;op=report_certificate&amp;id_certificate=' . (int) $id_certificate => $lang->def('_COURSES'), $lang->def('_CERTIFICATE_VIEW_CAPTION')), 'certificate'));
    }
    $out->add('<div class="std_block">' . $back_ui);
    $numrows = sql_num_rows($res);
    $downloadables = array();
    if ($numrows > 0) {
        $clang =& DoceboLanguage::CreateInstance('course', 'lms');
        $type_h = array('image', '', '', '', '', '', '', 'image', 'image');
        $cont_h = array('', $lang->def('_USERNAME'), $lang->def('_LASTNAME'), $lang->def('_FIRSTNAME'), $clang->def('_STATUS'), $lang->def('_DATE'), $lang->def('_RELASE_DATE'), Get::sprite('subs_pdf', Lang::t('_TITLE_VIEW_CERT', 'certificate')), Get::sprite('subs_del', Lang::t('_DEL', 'certificate')));
        $tb->setColsStyle($type_h);
        $tb->addHead($cont_h);
        $acl_man =& $GLOBALS['current_user']->getAclManager();
        $arr_status = array(_CUS_CONFIRMED => $clang->def('_USER_STATUS_CONFIRMED'), _CUS_SUBSCRIBED => $clang->def('_USER_STATUS_SUBS'), _CUS_BEGIN => $clang->def('_USER_STATUS_BEGIN'), _CUS_END => $clang->def('_USER_STATUS_END'), _CUS_SUSPEND => $clang->def('_USER_STATUS_SUSPEND'));
        //foreach($report_info as $info_report)
        while ($info = sql_fetch_assoc($res)) {
            $cont = array();
            $can_assign = (bool) ($info['on_date'] == '');
            $input_id = $info['id_user'];
            $sel_cell_content = '';
            $label_open = '';
            $label_close = '';
            if ($can_assign) {
                $input = '<input type="hidden" id="selection_' . $input_id . '" name="selection[' . $input_id . ']" value="' . $input_id . '"/> ';
                if (in_array($input_id, $total_selection)) {
                    $checked = ' checked="checked"';
                } else {
                    $checked = '';
                }
                $sel_cell_content .= $input . '<input type="checkbox" id="selected_' . $input_id . '" name="selected[' . $input_id . ']" value="' . $input_id . '"' . $checked . '/>';
                $label_open = '<label for="selected_' . $input_id . '">';
                $label_close = '</label>';
            }
            $userid = $acl_man->relativeId($info['userid']);
            $cont[] = $sel_cell_content;
            $cont[] = $label_open . ($search_filter != '' ? highlightText($userid, $search_filter) : $userid) . $label_close;
            $cont[] = $label_open . ($search_filter != '' ? highlightText($info['lastname'], $search_filter) : $info['lastname']) . $label_close;
            $cont[] = $label_open . ($search_filter != '' ? highlightText($info['firstname'], $search_filter) : $info['firstname']) . $label_close;
            $cont[] = $arr_status[$info['status']];
            $cont[] = $info['date_complete'];
            $cont[] = $info['on_date'];
            $url = 'index.php?modname=certificate&amp;certificate_id=' . $id_certificate . '&amp;course_id=' . $id_course . '&amp;user_id=' . $info['id_user'];
            $dl_url = $url . "&amp;op=send_certificate";
            if ($can_assign) {
                $downloadables[] = 'dl_single_' . $input_id;
            }
            $cont[] = $can_assign ? '<a id="dl_single_' . $input_id . '" class="ico-wt-sprite subs_pdf" href="javascript:;" title="' . $lang->def('_GENERATE') . '"><span>' . $lang->def('_GENERATE') . '</span></a>' : '<a id="dl_single_' . $input_id . '" class="ico-wt-sprite subs_pdf" href="' . $dl_url . '" title="' . $lang->def('_DOWNLOAD') . '"><span>' . $lang->def('_DOWNLOAD') . '</span></a>';
            $cont[] = $can_assign ? '' : Get::sprite_link('subs_del', $url . '&amp;op=del_report_certificate', Lang::t('_DEL', 'certificate'));
            $tb->addBody($cont);
        }
        require_once _base_ . '/lib/lib.dialog.php';
        setupHrefDialogBox('a[href*=del_report_certificate]');
        //search filter ...
        $release_options = array($lang->def('_ALL') => 0, $lang->def('_RELEASED') => 1, $lang->def('_TO_RELEASE') => 2);
        //search and store all non-available certificates
        $all_selection = array();
        $query = "SELECT cu.idUser as id_user " . " FROM ( " . $tu . " JOIN " . $tcu . " ON (u.idst = cu.idUser) ) LEFT JOIN " . $tca . " " . " ON ( ca.id_course = cu.idCourse AND ca.id_user=cu.idUser ) " . " WHERE (ca.id_certificate='" . (int) $id_certificate . "' OR ca.id_certificate IS NULL) AND " . $aval_status . " " . " AND cu.idCourse='" . (int) $id_course . "' " . ($search_filter != '' ? " AND (u.userid LIKE '%" . $search_filter . "%' OR u.lastname LIKE '%" . $search_filter . "%' OR u.firstname LIKE '%" . $search_filter . "%') " : "") . " AND ca.on_date IS NULL ";
        $res = sql_query($query);
        while (list($id_user) = sql_fetch_row($res)) {
            $all_selection[] = $id_user;
        }
        //---
        $form = new Form();
        $submit_url = "index.php?modname=certificate&amp;op=view_report_certificate&amp;id_certificate=" . (int) $id_certificate . "&amp;id_course=" . (int) $id_course;
        $out->add($form->openForm("certificates_emission", $submit_url) . $form->getHidden('old_selection', 'old_selection', implode(',', $total_selection)) . $form->getHidden('all_selection', 'all_selection', implode(',', $all_selection)) . $form->getHidden('active_text_filter', 'active_text_filter', $search_filter) . $form->getHidden('active_only_released', 'active_only_released', $only_released) . $form->getHidden('active_ini', 'active_ini', $ini_param) . '<div class="quick_search_form">' . '<div class="simple_search_box">' . Form::getInputTextfield("search_t", "filter", "filter", $search_filter, '', 255, '') . Form::getButton("search_button", "search_button", Lang::t('_SEARCH', 'standard'), "search_b") . Form::getButton("reset_button", "reset_button", Lang::t('_RESET', 'standard'), "reset_b") . '</div>' . '<a id="advanced_search" class="advanced_search" href="javascript:;">' . Lang::t("_ADVANCED_SEARCH", 'standard') . '</a>' . '<div id="certificate_release_as" class="advanced_search_options" style="display: ' . ($only_released != 0 ? 'block' : 'none') . '">' . Form::getRadioHoriz(Lang::t('_FILTER', 'certificate'), 'only_released', 'only_released', $release_options, $only_released) . '</div>' . '</div>' . '<script type="text/javascript">' . 'YAHOO.util.Event.addListener("advanced_search", "click", function(e){
				var el = YAHOO.util.Dom.get("certificate_release_as");
				if (el.style.display != \'block\') el.style.display = \'block\';
				else el.style.display = \'none\';
			});' . '</script>', 'content');
        $delgen_url = 'index.php?modname=certificate&amp;op=del_gen_certificate' . '&amp;id_certificate=' . (int) $id_certificate . '&amp;id_course=' . (int) $id_course;
        $delgen_txt = Lang::t('_DELETE_ALL_GENERATED', 'certificate');
        $print_button_1 = '<div>' . '<a id="print_selected_button_1" href="javascript:;">' . Get::img('course/certificate.png', Lang::t('_GENERATE_ALL_SELECTED', 'certificate')) . Lang::t('_GENERATE_ALL_SELECTED', 'certificate') . '</a>' . '</div>';
        $print_button_2 = '<div><a id="print_selected_button_2" href="javascript:;">' . Get::img('course/certificate.png', Lang::t('_GENERATE_ALL_SELECTED', 'certificate')) . Lang::t('_GENERATE_ALL_SELECTED', 'certificate') . '</a>' . '</div>';
        $print_button_1 .= Lang::t('_SELECT', 'directory') . ': ';
        $print_button_2 .= Lang::t('_SELECT', 'directory') . ': ';
        /*	
        		$print_button_1 .= '&nbsp;&nbsp;&nbsp;<a href="javascript:;" id="select_page_1">'.Lang::t('_SELECT_PAGE', 'standard').'</a>';
        		$print_button_2 .= '&nbsp;&nbsp;&nbsp;<a href="javascript:;" id="select_page_2">'.Lang::t('_SELECT_PAGE', 'standard').'</a>';
        		$print_button_1 .= '&nbsp;&nbsp;&nbsp;<a href="javascript:;" id="unselect_page_1">'.Lang::t('_UNSELECT_PAGE', 'standard').'</a>';
        		$print_button_2 .= '&nbsp;&nbsp;&nbsp;<a href="javascript:;" id="unselect_page_2">'.Lang::t('_UNSELECT_PAGE', 'standard').'</a>';
        */
        $print_button_1 .= '&nbsp;&nbsp;&nbsp;<a href="javascript:;" id="select_all_1">' . Lang::t('_ALL_PAGES', 'directory') . '</a>';
        $print_button_2 .= '&nbsp;&nbsp;&nbsp;<a href="javascript:;" id="select_all_2">' . Lang::t('_ALL_PAGES', 'directory') . '</a>';
        $print_button_1 .= '&nbsp;&nbsp;&nbsp;<a href="javascript:;" id="unselect_all_1">' . Lang::t('_NONE', 'directory') . '</a>';
        $print_button_2 .= '&nbsp;&nbsp;&nbsp;<a href="javascript:;" id="unselect_all_2">' . Lang::t('_NONE', 'directory') . '</a>';
        $navbar = $tb->getNavBar($ini, $totalrows);
        $out->add($print_button_1 . '<br />' . $navbar . $tb->getTable() . $navbar . '<br />' . $print_button_2);
        $out->add($form->closeForm());
    } else {
        $out->add($lang->def('_NO_CONTENT'));
    }
    $out->add($back_ui . '</div>');
    addCss('style_menu', 'lms');
    Util::get_js(Get::rel_path('base') . '/widget/dialog/dialog.js', true, true);
    Util::get_js(Get::rel_path('lms') . '/admin/modules/certificate/certificate.js?rnd=' . time(), true, true);
    //addJs($GLOBALS['where_lms_relative'].'/admin/modules/certificate/', 'certificate.js');
    $script = 'var ajax_url="ajax.adm_server.php?plf=lms&mn=certificate"; var _STOP="' . $lang->def('_STOP') . '"; ' . 'var glob_id_certificate = ' . (int) $id_certificate . ', glob_id_course = ' . (int) $id_course . ';' . 'var single_list = [' . (count($downloadables) ? '"' . implode('","', $downloadables) . '"' : '') . ']; ' . 'var reload_url = "' . str_replace('&amp;', '&', isset($submit_url) ? $submit_url : '') . '", ' . '_ERROR_PARSE = "' . $lang->def('_OPERATION_FAILURE') . '", _SUCCESS = "' . $lang->def('_OPERATION_SUCCESSFUL') . '", ' . '_AREYOUSURE="' . Lang::t('_AREYOUSURE', 'standard') . '";';
    $out->add('<script type="text/javascript">' . $script . '</script>', 'page_head');
}
Example #8
0
                                     break;
                                 }
                             }
                             if ($found_date != $date) {
                                 echo "{$red}Date {$date} not found{$black}\n";
                             }
                         } else {
                             //time should be set
                             $found_time = false;
                             while ($found_time != $time) {
                                 if (!($msg = getPrevious($handle))) {
                                     break;
                                 }
                                 if (preg_match('/([a-zA-Z]+)\\s+([a-zA-Z]+)\\s+([0-9]+)\\s+([0-9]+):([0-9]+)/', $msg, $matches)) {
                                     $found_time = strtolower($matches[4] . ' ' . $matches[5]);
                                     echo highlightText($msg);
                                 } else {
                                     $msg = false;
                                     break;
                                 }
                             }
                             if ($found_time != $time) {
                                 echo "{$red}[{$found_time} != {$time}]Time {$time} not found{$black}\n";
                             }
                         }
                     }
                 }
             }
         }
     }
 }
Example #9
0
    //search news items
    $sql = "SELECT * FROM JournalEntries WHERE JournalEntryText LIKE '%" . $_GET["search_term"] . "%' OR JournalEntrySubject LIKE '%" . $_GET["search_term"] . "%'";
    $rs = mysql_query($sql) or die("ERROR: " . mysql_error() . "<br>SQL: " . $sql);
    writeSectionHeader("News and News Discussions");
    echo "<table border=\"0\" cellpadding=\"2\" cellspacing=\"2\" width=\"700\">";
    if (mysql_num_rows($rs) > 0) {
        $class = "evenCell";
        $count = 0;
        while ($row = mysql_fetch_array($rs)) {
            $class = $class == "evenCell" ? "oddCell" : "evenCell";
            //http://nerderydev.theirvins.net/view_news_item.php?j=8&e=211
            echo "<tr>" . "<td class=\"{$class}\"><b>" . ++$count . ".</b>&nbsp;" . "<a href=\"view_news_item.php?j=" . $row["JournalID"] . "&e=" . $row["JournalEntryID"] . "\">" . highlightText(strip_tags($row["JournalEntryText"]), $_GET["search_term"], true) . "</a>" . "</td>" . "</tr>";
        }
    } else {
        echo "<tr>" . "<td align=\"center\">" . "No news items matched your search." . "</td>" . "</tr>";
    }
    $sql = "SELECT C.*, E.*, J.* FROM Journals AS J, JournalEntries AS E, JournalEntryComments AS C WHERE CommentText LIKE '%" . $_GET["search_term"] . "%' AND J.JournalID=E.JournalID AND E.JournalEntryID=C.JournalEntryID";
    $rs = mysql_query($sql) or die("ERROR: " . mysql_error() . "<br>SQL: " . $sql);
    if (mysql_num_rows($rs) > 0) {
        $class = "evenCell";
        while ($row = mysql_fetch_array($rs)) {
            $class = $class == "evenCell" ? "oddCell" : "evenCell";
            //http://nerderydev.theirvins.net/view_news_item.php?j=8&e=211
            echo "<tr>" . "<td class=\"{$class}\"><b>" . ++$count . ".</b>&nbsp;" . "<a href=\"view_news_item.php?j=" . $row["JournalID"] . "&e=" . $row["JournalEntryID"] . "\">" . highlightText(strip_tags($row["CommentText"]), $_GET["search_term"], true) . "</a>" . "</td>" . "</tr>";
        }
    }
    echo "</table>";
}
echo "</div>";
WriteFooter();
$application->save();
     $course_list =& $man_courses->getCoursesRequest($startIndex, $results, $sort, $dir, $filter);
     require_once _lms_ . '/lib/lib.permission.php';
     if (Docebo::user()->getUserLevelId() == ADMIN_GROUP_PUBLICADMIN) {
         $moderate = checkPerm('moderate', true, 'public_course_admin', 'lms');
     } elseif (Docebo::user()->getUserLevelId() == ADMIN_GROUP_ADMIN) {
         $moderate = checkPerm('moderate', true, 'course', 'lms');
     } else {
         $moderate = true;
     }
     while ($row = sql_fetch_assoc($course_list)) {
         $row['status'] = $course_status[$row['status']];
         $highlight = false;
         if (isset($filter['c_filter']['value']) && $filter['c_filter']['value'] != '') {
             $highlight = true;
         }
         $courses[] = array('idCourse' => $row['idCourse'], 'code' => $highlight ? highlightText($row['code'], $filter['c_filter']['value']) : $row['code'], 'name' => $highlight ? highlightText($row['name'], $filter['c_filter']['value']) : $row['name'], 'status' => $row['status'], 'waiting' => $row['pending'] && $moderate ? '<a href="index.php?modname=' . (Docebo::user()->getUserLevelId() == ADMIN_GROUP_PUBLICADMIN ? 'public_subscribe_admin' : 'subscribe') . '&op=waitinguser&id_course=' . $row['idCourse'] . '">' . $row['pending'] . '</a>' : '', 'subscriptions' => $row['course_edition'] != 1 ? isset($row['subscriptions']) ? $row['subscriptions'] : 0 : '--', 'classroom' => $row['course_edition'] == 1 ? '<a href="index.php?r=' . (Docebo::user()->getUserLevelId() == ADMIN_GROUP_PUBLICADMIN ? '' : 'alms/') . 'edition/show&amp;id_course=' . $row['idCourse'] . '">' . (isset($num_edition[$row['idCourse']]) ? $num_edition[$row['idCourse']] : '0') . '</a>' : '', 'certificate' => true, 'competence' => true, 'menu' => true, 'dup' => '<a id="dup_' . $row['idCourse'] . '" href="index.php?modname=' . (Docebo::user()->getUserLevelId() == ADMIN_GROUP_PUBLICADMIN ? 'public_course_admin' : 'course') . '&amp;op=dup_course&id_course=' . $row['idCourse'] . '">' . Get::img('standard/dup.png', $lang->def('_MAKE_A_COPY')) . '</a>', 'mod' => true, 'del' => true);
     }
     $output = array('startIndex' => (int) $startIndex, 'recordsReturned' => count($courses), 'sort' => $sort, 'dir' => $dir, 'totalRecords' => (int) $man_courses->getCoursesCountFiltered($filter), 'pageSize' => (int) $results, 'records' => $courses);
     $json = new Services_JSON();
     aout($json->encode($output));
     break;
 case 'del_row':
     require_once _lms_ . '/lib/lib.course.php';
     $output = array('success' => false);
     $id_course = Get::req('idrow', DOTY_INT, -1);
     if ($id_course > 0) {
         $man_course = new Man_Course();
         $output['success'] = $man_course->deleteCourse($id_course);
     }
     $json = new Services_JSON();
     aout($json->encode($output));
 public function getdata()
 {
     $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->getTotalGroups($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->getGroupsList($pagination, $filter);
     //format models' data
     $records = array();
     $acl_man = Docebo::user()->getAclManager();
     if (is_array($list)) {
         foreach ($list as $record) {
             $_groupid = $acl_man->relativeId($record->groupid);
             $_description = $this->_formatDescription($record->description);
             $records[] = array('id' => (int) $record->idst, 'groupid' => highlightText($_groupid, $filter), 'description' => highlightText($_description, $filter), 'usercount' => $record->usercount, 'membercount' => $record->membercount, 'mod' => 'ajax.adm_server.php?r=adm/groupmanagement/mod&id=' . (int) $record->idst, 'del' => 'ajax.adm_server.php?r=adm/groupmanagement/del&id=' . (int) $record->idst);
         }
     }
     $output = array('startIndex' => $startIndex, 'recordsReturned' => count($records), 'sort' => $sort, 'dir' => $dir, 'totalRecords' => $total, 'pageSize' => $rowsPerPage, 'records' => $records);
     echo $this->json->encode($output);
 }
 public function fastadd()
 {
     if (!$this->permissions['subscribe_course']) {
         $output = array('success' => false, 'message' => $this->_getMessage("no permission"));
         echo $this->json->encode($output);
         return;
     }
     //Filter on user
     $filter = str_replace('?query=', '', Get::req('filter', DOTY_MIXED, ''));
     //$this->model->setCourseData($id_course, $id_edition, $id_date);
     $list = $this->model->getFastSubscribeList($filter);
     $output_data = array();
     foreach ($list as $value) {
         $userid = $this->acl_man->relativeId($value['userid']);
         $name = $userid . ' (' . $value['firstname'] . ' ' . $value['lastname'] . ')';
         $row = array();
         $row['id'] = $value['idst'];
         $row['userid'] = $userid;
         $row['name'] = highlightText($name, $filter);
         $output_data[] = $row;
     }
     $output = array();
     $output['succes'] = true;
     $output['count'] = count($output_data);
     //this may be useless ...
     $output['users'] = $output_data;
     echo $this->json->encode($output);
 }