Пример #1
0
 function loadBody()
 {
     require_once $GLOBALS['where_framework'] . '/modules/' . $this->module_name . '/' . $this->module_name . '.php';
     $out =& $this->get_out();
     $lang =& $this->get_lang();
     if (isset($_GET['addconnector']) && !isset($_POST['cancel'])) {
         require_once $GLOBALS['where_framework'] . '/lib/lib.iotask.php';
         $connMgr =& $this->get_connMgr();
         $filename = key($_POST['file']);
         if ($connMgr->add_connector($filename)) {
             $out->add(getResultUi($lang->def('_OPERATION_SUCCESSFUL')));
         } else {
             $out->add(getErrorUi($lang->def('_OPERATION_FAILURE')) . $connMgr->get_last_error());
         }
     }
     if (isset($_GET['addconnectionok']) && !isset($_POST['cancel'])) {
         $out->add(getResultUi($lang->def('_OPERATION_SUCCESSFUL')));
     }
     if (isset($_GET['addtaskok']) && !isset($_POST['cancel'])) {
         $out->add(getResultUi($lang->def('_OPERATION_SUCCESSFUL')));
     }
     if (isset($_GET['deleteconnectionok']) && !isset($_POST['cancel'])) {
         $out->add(getResultUi($lang->def('_OPERATION_SUCCESSFUL')));
     } elseif (isset($_GET['deleteconnectionerror']) && !isset($_POST['cancel'])) {
         $out->add(getErrorUi($lang->def('_ERR_FAIL_DELETE_CONNECTOR')));
     }
     if (isset($_GET['deletetaskok']) && !isset($_POST['cancel'])) {
         $out->add(getResultUi($lang->def('_OPERATION_SUCCESSFUL')));
     } elseif (isset($_GET['deletetakserror']) && !isset($_POST['cancel'])) {
         $out->add(getErrorUi($lang->def('_ERR_FAIL_DELETE_TASK')));
     }
     if (isset($_POST['action'])) {
         switch (key($_POST['action'])) {
             case 'new_connector':
                 ioTask_UIConnectorNew($this);
                 break;
             case 'run_task':
                 ioTask_UITaskRun($this, current($_POST['action']), key($_POST['action']));
                 break;
             case 'new_task':
             case 'edit_task':
                 ioTask_UITaskNew($this, current($_POST['action']), key($_POST['action']));
                 break;
             case 'delete_task':
                 ioTask_UITaskDelete($this, current($_POST['action']), key($_POST['action']));
                 break;
             case 'new_connection':
             case 'edit_connection':
                 ioTask_UIConnectionNew($this, current($_POST['action']), key($_POST['action']));
                 break;
             case 'delete_connection':
                 ioTask_UIConnectionDelete($this, current($_POST['action']), key($_POST['action']));
                 break;
         }
     } elseif (isset($_GET['addconnection']) && !isset($_POST['cancel'])) {
         ioTask_UIConnectionNew($this, '', '');
     } else {
         ioTask_UITab($this, $GLOBALS['op']);
     }
 }
Пример #2
0
 function adminConf()
 {
     require_once _base_ . '/lib/lib.form.php';
     $lang =& DoceboLanguage::createInstance('admin_config', 'scs');
     $out =& $GLOBALS['page'];
     $out->setWorkingZone('content');
     $out->add(getTitleArea($lang->def('_ADMIN_CONF'), 'admin_conf') . '<div class="std_block">');
     if (isset($_POST['save'])) {
         $query_update = "UPDATE " . $GLOBALS['prefix_scs'] . "_rules_admin SET ";
         if (isset($_POST['rules'])) {
             while (list($var_name, $new_value) = each($_POST['rules'])) {
                 $query_update .= " {$var_name} = '" . $new_value . "',";
             }
             $re = sql_query(substr($query_update, 0, -1));
         }
         if ($re) {
             $out->add(getResultUi($lang->def('_MOD_OK')));
         } else {
             $out->add(getErrorUi($lang->def('_MOD_ERR')));
         }
     }
     $query_rules_admin = "\r\n\tSELECT server_status, \r\n\t\tenable_recording_function, enable_advice_insert, enable_write, enable_chat_recording, \r\n\t\tenable_private_subroom, enable_public_subroom, \r\n\t\tenable_drawboard_watch, enable_drawboard_write, \r\n\t\tenable_audio, enable_webcam, enable_stream_watch, enable_strem_write, enable_remote_desktop \r\n\tFROM " . $GLOBALS['prefix_scs'] . "_rules_admin";
     $re_rules_admin = sql_query($query_rules_admin);
     $rules = mysql_fetch_array($re_rules_admin);
     $out->add(Form::openForm('rules_admin', 'index.php?modname=admin_configuration&amp;op=conf') . Form::openElementSpace() . Form::getOpenCombo($lang->def('_SERVER_STATUS')) . Form::getInputRadio('rules_server_status_yes', 'rules[server_status]', 'yes', $rules['server_status'] == 'yes', '') . '&nbsp;' . Form::getLabel('', $lang->def('_YES'), 'label_padded') . '&nbsp;' . Form::getInputRadio('rules_server_status_no', 'rules[server_status]', 'no', $rules['server_status'] == 'no', '') . '&nbsp;' . Form::getLabel('', $lang->def('_NO'), 'label_padded') . '&nbsp;' . Form::getCloseCombo() . maskMultiple('enable_recording_function', $rules['enable_recording_function']) . maskMultiple('enable_advice_insert', $rules['enable_advice_insert']) . maskMultiple('enable_write', $rules['enable_write']) . maskMultiple('enable_chat_recording', $rules['enable_chat_recording']) . maskMultiple('enable_private_subroom', $rules['enable_private_subroom']) . maskMultiple('enable_public_subroom', $rules['enable_public_subroom']) . maskMultiple('enable_drawboard_watch', $rules['enable_drawboard_watch']) . maskMultiple('enable_drawboard_write', $rules['enable_drawboard_write']) . maskMultiple('enable_audio', $rules['enable_audio']) . maskMultiple('enable_webcam', $rules['enable_webcam']) . maskMultiple('enable_stream_watch', $rules['enable_stream_watch']) . maskMultiple('enable_strem_write', $rules['enable_strem_write']) . maskMultiple('enable_remote_desktop', $rules['enable_remote_desktop']) . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('save', 'save', $lang->def('_SAVE')) . Form::getButton('undo', 'undo', $lang->def('_UNDO')) . Form::closeButtonSpace() . Form::closeForm());
     $out->add('</div>');
 }
Пример #3
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');
    }
Пример #4
0
function groupCodeList()
{
    require_once _base_ . '/lib/lib.form.php';
    require_once _base_ . '/lib/lib.table.php';
    $lang =& DoceboLanguage::createInstance('code');
    $code_manager = new CodeManager();
    $tot_group_code = $code_manager->getCodeGroupNumber();
    cout(getTitleArea($lang->def('_CODE')) . '<div class="std_block">');
    $result = Get::req('result', DOTY_STRING, '');
    if (isset($_GET['activation'])) {
        $query = "UPDATE " . $GLOBALS['prefix_fw'] . "_setting" . " SET param_value = 'on'" . " WHERE param_name = 'use_code_module'";
        if (sql_query($query)) {
            Util::jump_to('index.php?modname=code&amp;op=list&result=ok');
        } else {
            Util::jump_to('index.php?modname=code&amp;op=list&result=err');
        }
    }
    if (Get::cfg('use_code_module') === 'off') {
        cout(getResultUi('<a href="index.php?modname=code&amp;op=list&amp;activation=true">' . $lang->def('_MODULE_NOT_ACTIVATED') . '</a>'));
    }
    switch ($result) {
        case 'ok':
            UIFeedback::info($lang->def('_OPERATION_SUCCESSFUL'));
            break;
        case 'err':
            UIFeedback::error($lang->def('_OPERATION_FAILURE'));
            break;
    }
    if ($tot_group_code) {
        $tb = new Table('20');
        $tb->initNavBar('ini', 'link');
        $ini = $tb->getSelectedElement();
        $cont_h = array($lang->def('_TITLE'), $lang->def('_DESCRIPTION'), $lang->def('_CODE_USED_NUMBER'), Get::sprite('subs_csv', Lang::t('_CODE', 'course')), Get::sprite('subs_add', Lang::t('_GENERATE_CODE', 'course')), Get::sprite('subs_import', Lang::t('_IMPORT', 'course')), Get::sprite('subs_elem', Lang::t('_COURSES', 'course')), Get::sprite('subs_users', Lang::t('_ASSIGN_USERS', 'course')), Get::sprite('subs_mod', Lang::t('_MOD', 'course')), Get::sprite('subs_del', Lang::t('_DEL', 'course')));
        $type_h = array('', '', 'min-cell', 'image', 'image', 'image', 'image', 'image', 'image', 'image');
        $tb->setColsStyle($type_h);
        $tb->addHead($cont_h);
        $array_group_code = $code_manager->getCodeGroupsList($ini);
        foreach ($array_group_code as $group_code_info) {
            $cont = array();
            $cont[] = $group_code_info['title'];
            $cont[] = $group_code_info['description'];
            $cont[] = $group_code_info['code_used'];
            $cont[] = '<a href="index.php?modname=code&amp;op=code_list&amp;id_code_group=' . $group_code_info['id_code_group'] . '">' . Get::sprite('subs_csv', Lang::t('_CODE', 'course')) . '</a>';
            $cont[] = '<a href="index.php?modname=code&amp;op=generate_code&amp;id_code_group=' . $group_code_info['id_code_group'] . '">' . Get::sprite('subs_add', Lang::t('_GENERATE_CODE', 'course')) . '</a>';
            $cont[] = '<a href="index.php?modname=code&amp;op=import_code&amp;id_code_group=' . $group_code_info['id_code_group'] . '">' . Get::sprite('subs_import', Lang::t('_IMPORT', 'course')) . '</a>';
            $cont[] = '<a href="index.php?modname=code&amp;op=assign_course&amp;id_code_group=' . $group_code_info['id_code_group'] . '">' . Get::sprite('subs_elem' . ($group_code_info['course_associated'] ? '' : '_grey'), Lang::t('_COURSES', 'course')) . '</a>';
            $cont[] = '<a href="index.php?modname=code&amp;op=assign_tree&amp;id_code_group=' . $group_code_info['id_code_group'] . '">' . Get::sprite('subs_users' . ($group_code_info['folder_associated'] ? '' : '_grey'), Lang::t('_ASSIGN_USERS', 'course')) . '</a>';
            $cont[] = '<a href="index.php?modname=code&amp;op=mod_group_code&amp;id_code_group=' . $group_code_info['id_code_group'] . '">' . Get::sprite('subs_mod', Lang::t('_MOD', 'course')) . '</a>';
            $cont[] = '<a href="index.php?modname=code&amp;op=del_group_code&amp;id_code_group=' . $group_code_info['id_code_group'] . '">' . Get::sprite('subs_del', Lang::t('_DEL', 'course')) . '</a>';
            $tb->addBody($cont);
        }
        $tb->addActionAdd('<a href="index.php?modname=code&amp;op=add_group_code">' . '<img src="' . getPathImage() . 'standard/add.png" alt="' . $lang->def('_ADD') . '" />' . $lang->def('_ADD') . '</a>');
        cout($tb->getTable() . $tb->getNavBar($ini, $tot_group_code));
        setupHrefDialogBox('a[href*=del_group_code]');
    } else {
        cout($lang->def('_NO_CONTENT') . '<br/>' . '<a href="index.php?modname=code&amp;op=add_group_code">' . '<img src="' . getPathImage() . 'standard/add.png" alt="' . $lang->def('_ADD') . '" />' . $lang->def('_ADD') . '</a>');
    }
    cout('</div>');
}
Пример #5
0
function showhtml()
{
    checkPerm('view');
    $lang =& DoceboLanguage::createInstance('htmlfront', 'lms');
    $query = "\r\n\tSELECT textof\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_htmlfront \r\n\tWHERE id_course = '" . $_SESSION['idCourse'] . "'";
    $re_htmlfront = sql_query($query);
    list($textof) = sql_fetch_row($re_htmlfront);
    $GLOBALS['page']->add(getTitleArea($lang->def('_HTMLFRONT'), 'htmlfront') . '<div class="std_block">' . (isset($_GET['saveok']) ? getResultUi($lang->def('_OPERATION_SUCCESSFUL')) : '') . '<div class="htmlfront_container">' . $textof . '</div>' . (checkPerm('mod', true) ? '<p class="table-container-below">' . '<a class="infomod" href="index.php?modname=htmlfront&amp;op=edithtml" title="' . $lang->def('_MOD') . '">' . '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . '" />&nbsp;' . $lang->def('_MOD') . '</a></p>' : '') . '</div>', 'content');
}
Пример #6
0
function config()
{
    checkPerm('view');
    require_once _base_ . '/lib/lib.tab.php';
    require_once _base_ . '/lib/lib.form.php';
    require_once _adm_ . '/class/class.conf.php';
    $lang =& DoceboLanguage::createInstance('configuration', 'framework');
    $active_tab = importVar('active_tab', false, 1);
    //instance class-------------------------------------------
    $conf = new Config_Framework();
    $groups = $conf->getRegroupUnit();
    cout(getTitleArea($lang->def('_CONFIGURATION')) . '<div class="std_block">');
    //save page if require
    if (isset($_POST['save_config'])) {
        if ($conf->saveElement($active_tab)) {
            cout(getResultUi($lang->def('_OPERATION_SUCCESSFUL')));
        } else {
            cout(getErrorUi($lang->def('_ERROR_IN_SAVE')));
        }
    }
    cout('<div id="global_conf" class="yui-navset">' . '<ul class="yui-nav">');
    while (list($id, $name) = each($groups)) {
        // print the tab list
        cout('<li' . ($id == $active_tab ? ' class="selected"' : '') . '><a href="#tab_g_' . $id . '"><em>' . $name['name'] . '</em></a></li>');
    }
    reset($groups);
    cout('</ul>' . '<div class="yui-content">');
    while (list($id, $name) = each($groups)) {
        // print the tab content
        cout('<div id="tab_g_' . $id . '">' . '<h2>' . $name['name'] . '</h2>' . '<p style="padding:4px">' . $name['descr'] . '</p>' . Form::openForm('conf_option_' . $id, 'index.php?modname=configuration&amp;op=config') . Form::openElementSpace() . Form::getHidden('active_tab_' . $id, 'active_tab', $id));
        switch ($id) {
            case SMS_GROUP:
                cout(show_sms_panel($lang) . '<br />');
                break;
            default:
                cout('<br />');
        }
        cout('' . $conf->getPageWithElement($id) . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('save_config_' . $id, 'save_config', $lang->def('_SAVE')) . Form::getButton('undo_' . $id, 'undo', $lang->def('_UNDO')) . Form::closeButtonSpace() . Form::CloseForm() . '<br />' . '</div>');
    }
    cout('<script type="text/javascript">
		var targets =  YAHOO.util.Selector.query("span[id^=tt_target]");
		new YAHOO.widget.Tooltip("tooltip_info",
			{ context:targets,
			effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.20}
		 });
		</script>', 'scripts');
    reset($groups);
    cout('</div>' . '<div style="clear:left">&nbsp;</div>' . '</div>' . '</div>');
    cout('<script type="text/javascript">' . "\tnew YAHOO.widget.TabView('global_conf', {orientation:'left'});" . '</script>', 'scripts');
}
Пример #7
0
 /**
  * Print list of user in org_chart pages
  **/
 function membersTree($groupid, &$treeView)
 {
     require_once _base_ . '/lib/lib.form.php';
     if (Get::sett('register_deleted_user') == 'on') {
         $lang =& DoceboLanguage::createInstance('profile', 'framework');
         $GLOBALS['page']->add('<br />' . '<a href="index.php?modname=directory&amp;op=view_deleted_user">' . $lang->def('_DELETED_USER_LIST') . '</a>');
     }
     $data =& $treeView->lv_data;
     $lv =& $treeView->lv_view;
     $lv->show_flat_mode_flag = TRUE;
     if ($groupid === FALSE) {
         return;
     }
     if ($groupid != '') {
         $arrGroup = $this->aclManager->getGroup(FALSE, $groupid);
         if ($arrGroup !== FALSE) {
             $idst = $arrGroup[0];
             $description = $arrGroup[2];
         }
     } else {
         $lv->show_flat_mode_flag = FALSE;
     }
     if ($lv->op == 'deleteperson') {
         $userid = $lv->getIdSelectedItem();
         $idst_user = $this->aclManager->getUserST($userid);
         $id_org = $treeView->getSelectedFolderId();
         $idst_group = $treeView->tdb->getGroupST($id_org);
         $this->aclManager->removeFromGroup($idst_group, $idst_user);
         $idst_group_desc = $treeView->tdb->getGroupDescendantsST($id_org);
         $this->aclManager->removeFromGroup($idst_group_desc, $idst_user);
     } elseif ($lv->op == 'suspendperson') {
         $userid = $lv->getIdSelectedItem();
         $idst_user = $this->aclManager->getUserST($userid);
         $this->aclManager->suspendUser($idst_user);
         $GLOBALS['page']->add(getResultUi($this->lang->def('_SUSPENDED')));
     } elseif ($lv->op == 'recoverperson') {
         $userid = $lv->getIdSelectedItem();
         $idst_user = $this->aclManager->getUserST($userid);
         $this->aclManager->recoverUser($idst_user);
         $GLOBALS['page']->add(getResultUi($this->lang->def('_REACTIVATED_USER')));
     }
     if ($groupid != '') {
         $data->setGroupFilter($idst, $lv->flat_mode);
     }
     $userlevelid = Docebo::user()->getUserLevelId();
     if ($userlevelid != ADMIN_GROUP_GODADMIN) {
         require_once $GLOBALS['where_framework'] . '/lib/lib.adminmanager.php';
         $adminManager = new AdminManager();
         $data->intersectGroupFilter($adminManager->getAdminTree(Docebo::user()->getIdSt()));
     }
     $GLOBALS['page']->add($lv->printOut(), 'content');
     //$this->selected = $lv->printedItems;
 }
Пример #8
0
function create()
{
    checkPerm('mod');
    require_once $GLOBALS['where_lms'] . '/lib/lib.course.php';
    require_once _base_ . '/lib/lib.table.php';
    require_once _base_ . '/lib/lib.form.php';
    $lang =& DoceboLanguage::createInstance('certificate', 'lms');
    $id_certificate = importVar('id_certificate', true, 0);
    $id_meta = array();
    $acl_man =& Docebo::user()->getAclManager();
    $first = true;
    $tot_element = 0;
    $out =& $GLOBALS['page'];
    $out->setWorkingZone('content');
    $tb = new Table(Get::sett('visuItem'), $lang->def('_META_CERTIFICATE_CREATE_CAPTION'), $lang->def('_META_CERTIFICATE_CREATE_CAPTION'));
    $tb->initNavBar('ini', 'button');
    $ini = $tb->getSelectedElement();
    $query = "SELECT idMetaCertificate" . " FROM " . $GLOBALS['prefix_lms'] . "_certificate_meta" . " WHERE idCertificate = '" . $id_certificate . "'";
    $result = sql_query($query);
    while (list($id_meta_temp) = sql_fetch_row($result)) {
        $id_meta[] = $id_meta_temp;
    }
    $query = "SELECT idCourse, idUser" . " FROM " . $GLOBALS['prefix_lms'] . "_courseuser" . " WHERE status = '" . _CUS_END . "'";
    $result = sql_query($query);
    $user_course_completed = array();
    while (list($id_course_t, $id_user_t) = sql_fetch_row($result)) {
        $user_course_completed[$id_user_t][$id_course_t] = $id_course_t;
    }
    $query = "SELECT idMetaCertificate, title" . " FROM " . $GLOBALS['prefix_lms'] . "_certificate_meta";
    $result = sql_query($query);
    $array_title = array();
    while (list($id_meta_t, $title_t) = sql_fetch_row($result)) {
        $array_title[$id_meta_t] = $title_t;
    }
    $query = "SELECT idUser, idMetaCertificate, COUNT(*)" . " FROM " . $GLOBALS['prefix_lms'] . "_certificate_meta_course" . " GROUP BY idUser, idMetaCertificate";
    $result = sql_query($query);
    $array_control = array();
    while (list($id_user_t, $id_meta_t, $control_t) = sql_fetch_row($result)) {
        $array_control[$id_user_t][$id_meta_t] = $control_t;
    }
    if (isset($_POST['undo_filter_create'])) {
        unset($_POST['filter_username']);
        unset($_POST['filter_firstname']);
        unset($_POST['filter_lastname']);
        unset($_POST['filter_release_status']);
    }
    $query = "SELECT m.idUser, u.lastname, u.firstname, u.userid" . " FROM " . $GLOBALS['prefix_lms'] . "_certificate_meta_course as m" . " JOIN " . $GLOBALS['prefix_fw'] . "_user as u ON u.idst = m.idUser" . " WHERE m.idMetaCertificate IN (" . implode(',', $id_meta) . ")" . (isset($_POST['filter_username']) ? "AND u.userid LIKE '%" . $_POST['filter_username'] . "%'" : '') . (isset($_POST['filter_firstname']) ? "AND u.firstname LIKE '%" . $_POST['filter_firstname'] . "%'" : '') . (isset($_POST['filter_lastname']) ? "AND u.lastname LIKE '%" . $_POST['filter_lastname'] . "%'" : '') . " GROUP BY m.idUser, u.lastname, u.firstname, u.userid" . " ORDER BY u.lastname, u.firstname, u.userid";
    $result = sql_query($query);
    while (list($id_user, $lastname, $firstname, $userid) = sql_fetch_row($result)) {
        foreach ($id_meta as $idmeta) {
            if (isset($array_control[$id_user][$idmeta]) && $array_control[$id_user][$idmeta]) {
                $title = strip_tags($array_title[$idmeta]);
                $query = "SELECT idCourse" . " FROM " . $GLOBALS['prefix_lms'] . "_certificate_meta_course" . " WHERE idUser = '******'" . " AND idMetaCertificate = '" . $idmeta . "'";
                $result_int = sql_query($query);
                $control = true;
                while (list($id_course) = sql_fetch_row($result_int)) {
                    if (!isset($user_course_completed[$id_user][$id_course])) {
                        $control = false;
                    }
                }
                if ($control) {
                    $tot_element++;
                    if ($tot_element > $ini && $tot_element <= $ini + Get::sett('visuItem')) {
                        list($is_released) = sql_fetch_row(sql_query("SELECT COUNT(*)" . " FROM " . $GLOBALS['prefix_lms'] . "_certificate_meta_assign" . " WHERE idUser = '******'" . " AND idMetaCertificate = '" . $idmeta . "'"));
                        if (!isset($_POST['filter_release_status']) || isset($_POST['filter_release_status']) && $_POST['filter_release_status'] == 0 || isset($_POST['filter_release_status']) && $_POST['filter_release_status'] == '1' && $is_released == 1 || isset($_POST['filter_release_status']) && $_POST['filter_release_status'] == '2' && $is_released == 0) {
                            if ($first) {
                                $first = false;
                                $type_h = array('', '', '', 'image', 'image', 'image');
                                $cont_h = array($lang->def('_FULLNAME'), $lang->def('_USERNAME'), $lang->def('_TITLE'), Get::img('standard/view.png', Lang::t('_PREVIEW', 'certificate')), Get::img('course/certificate.png', Lang::t('_TAKE_A_COPY', 'certificate')), '<img src="' . getPathImage('lms') . 'standard/delete.png" alt="' . $lang->def('_ALT_REM_META_CERT') . ' : ' . strip_tags($title) . '" />');
                                $tb->setColsStyle($type_h);
                                $tb->addHead($cont_h);
                            }
                            $cont = array();
                            $cont[] = $lastname . ' ' . $firstname;
                            $cont[] = $acl_man->relativeId($userid);
                            $cont[] = $title;
                            $cont[] = '<a href="index.php?modname=meta_certificate&amp;op=preview_cert&amp;id_certificate=' . $id_certificate . '&amp;idmeta=' . $idmeta . '&amp;iduser='******'">' . Get::img('standard/view.png', Lang::t('_PREVIEW', 'certificate') . ' : ' . strip_tags($title)) . '</a>';
                            $cont[] = '<a href="index.php?modname=meta_certificate&amp;op=release_cert&amp;id_certificate=' . $id_certificate . '&amp;idmeta=' . $idmeta . '&amp;iduser='******'">' . Get::img('course/certificate.png', Lang::t('_TAKE_A_COPY', 'certificate') . ' : ' . strip_tags($title)) . '</a>';
                            if ($is_released) {
                                $cont[] = '<a href="index.php?modname=meta_certificate&amp;op=del_released&amp;id_certificate=' . $id_certificate . '&amp;idmeta=' . $idmeta . '&amp;iduser='******'">' . '<img src="' . getPathImage('lms') . 'standard/delete.png" alt="' . $lang->def('_ALT_REM_META_CERT') . ' : ' . strip_tags($title) . '" /></a>';
                            } else {
                                $cont[] = '';
                            }
                            $tb->addBody($cont);
                        }
                    }
                }
            }
        }
    }
    require_once _base_ . '/lib/lib.dialog.php';
    setupHrefDialogBox('a[href*=del_released]');
    $array_release_status = array($lang->def('_ALL') => '0', $lang->def('_ONLY_RELEASED') => '1', $lang->def('_ONLY_NOT_RELEASED') => '2');
    if ($first) {
        $out->add(getTitleArea($lang->def('_TITLE_META_CERTIFICATE_CREATE'), 'certificate') . '<div class="std_block">');
        if (isset($_POST['filter'])) {
            $out->add(Form::openForm('meta_certificate_filter', 'index.php?modname=meta_certificate&op=create&id_certificate=' . $id_certificate) . Form::openElementSpace() . Form::getTextfield($lang->def('_USERNAME'), 'filter_username', 'filter_username', '255', isset($_POST['filter_username']) ? $_POST['filter_username'] : '') . Form::getTextfield($lang->def('_FIRSTNAME'), 'filter_firstname', 'filter_firstname', '255', isset($_POST['filter_firstname']) ? $_POST['filter_firstname'] : '') . Form::getTextfield($lang->def('_LASTNAME'), 'filter_lastname', 'filter_lastname', '255', isset($_POST['filter_lastname']) ? $_POST['filter_lastname'] : '') . Form::getRadioSet($lang->def('_RELEASE_STATUS_FILTER'), 'filter_release_status', 'filter_release_status', $array_release_status, isset($_POST['filter_release_status']) ? $_POST['filter_release_status'] : '0') . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('filter', 'filter', $lang->def('_FILTER')) . Form::getButton('undo_filter_create', 'undo_filter_create', $lang->def('_UNDO_FILTER')) . Form::closeButtonSpace() . Form::closeForm());
        }
        $out->add($lang->def('_NO_USER_FOUND') . getBackUi('index.php?modname=meta_certificate&amp;op=meta_certificate', $lang->def('_BACK')) . '</div>');
    } else {
        $out->add(getTitleArea($lang->def('_TITLE_META_CERTIFICATE_CREATE'), 'certificate') . '<div class="std_block">');
        if (isset($_GET['result'])) {
            switch ($_GET['result']) {
                case "ok":
                    $out->add(getResultUi($lang->def('_OPERATION_SUCCESSFUL')));
                    break;
                case "err_del_cert":
                    $out->add(getErrorUi($lang->def('_OPERATION_FAILURE')));
                    break;
            }
        }
        $out->add(Form::openForm('meta_certificate_filter', 'index.php?modname=meta_certificate&op=create&id_certificate=' . $id_certificate) . Form::openElementSpace() . Form::getTextfield($lang->def('_USERNAME'), 'filter_username', 'filter_username', '255', isset($_POST['filter_username']) ? $_POST['filter_username'] : '') . Form::getTextfield($lang->def('_FIRSTNAME'), 'filter_firstname', 'filter_firstname', '255', isset($_POST['filter_firstname']) ? $_POST['filter_firstname'] : '') . Form::getTextfield($lang->def('_LASTNAME'), 'filter_lastname', 'filter_lastname', '255', isset($_POST['filter_lastname']) ? $_POST['filter_lastname'] : '') . Form::getRadioSet($lang->def('_RELEASE_STATUS_FILTER'), 'filter_release_status', 'filter_release_status', $array_release_status, isset($_POST['filter_release_status']) ? $_POST['filter_release_status'] : '0') . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('filter', 'filter', $lang->def('_FILTER')) . Form::getButton('undo_filter_create', 'undo_filter_create', $lang->def('_UNDO_FILTER')) . Form::closeButtonSpace() . $tb->getTable() . $tb->getNavBar($ini, $tot_element) . Form::closeForm() . getBackUi('index.php?modname=meta_certificate&amp;op=meta_certificate', $lang->def('_BACK')) . '</div>');
    }
}
Пример #9
0
/**
 * COURSE PANEL
 * 
 * This module is a facilitator for the users re-training maded by the public administrators.
 * The public administrator will be informed of the users that are approching the expiration date for theirs
 * competences and allow the administrator to re-enroll them to courses that refresh those competences in order to keep
 * the final users up to date.
 */
function coursePanel()
{
    //check permissions
    checkPerm('view');
    $can_mod = checkPerm('mod', true);
    //required libraries
    require_once _base_ . '/lib/lib.form.php';
    require_once _base_ . '/lib/lib.table.php';
    require_once _adm_ . '/lib/lib.publicadminmanager.php';
    require_once _lms_ . '/lib/lib.course.php';
    require_once _lms_ . '/lib/lib.date.php';
    require_once _lms_ . '/lib/lib.competences.php';
    //back page link
    $lang =& DoceboLanguage::CreateInstance('public_coursepanel', 'lms');
    $back_ui = getBackUi('index.php', $lang->def('_BACK'));
    $db = DbConn::getInstance();
    $man_competences = new Competences_Manager();
    //check the admin level of the current user, if it's not an admin or the idst is invalid, return an error
    $id_pa = getLogUserId();
    if (!$id_pa) {
        //error: the user is invalid
        cout($back_ui . $lang->def('_INVALID_ADMIN') . $back_ui, 'content');
        return;
    }
    /*
    	//months considered
    	$this_month = (int)date("m");
    	$month_1 = ((int)$this_month-1+1) % 12; $month_1++;
    	$month_2 = ((int)$this_month-1+2) % 12; $month_2++;
    
    	$months = array(
    		$lang->def('MONTH_'.((int)$this_month<10 ? '0' : '').(int)$this_month),
    		$lang->def('MONTH_'.((int)$month_1<10 ? '0' : '').(int)$month_1),
    		$lang->def('MONTH_'.((int)$month_2<10 ? '0' : '').(int)$month_2)
    	);
    */
    $acl_man = Docebo::user()->getAclManager();
    $admin_manager = new PublicAdminManager();
    $array_users = array();
    $idst_associated = $admin_manager->getAdminTree($id_pa);
    $array_users =& $acl_man->getAllUsersFromIdst($idst_associated);
    $array_users = array_unique($array_users);
    if (empty($array_users)) {
        //error: no users to deal with
        cout($back_ui . $lang->def('_NO_USERS') . $back_ui, 'content');
        return;
    }
    //already selected competence and course, if exist
    $sel_competence = Get::req('sel_competence', DOTY_INT, false);
    $sel_course = Get::req('sel_course', DOTY_INT, false);
    //$lang_code = Get::req('language', DOTY_ALPHANUM, getLanguage());
    $comps_1 = array();
    $comps_2 = array();
    //retrieve competences list for dropdown menu -- two steps filter
    //retrieve competences by users
    $query_competences_1 = "SELECT c.id_competence, cu.id_user FROM " . " %lms_competence as c JOIN " . " %lms_competence_user as cu ON " . " (c.id_competence=cu.id_competence AND cu.id_user IN (" . implode(",", $array_users) . "))";
    $res_competences_1 = $db->query($query_competences_1);
    while (list($id_comp, $id_user) = $db->fetch_row($res_competences_1)) {
        $comps_1[$id_comp] = $id_user;
    }
    if (empty($comps_1)) {
        //error, no competences
        cout($back_ui . $lang->def('_NO_COMPETENCES') . $back_ui, 'content');
        return;
    }
    //get number of days in which check if a course or a edition is starting
    $course_check_time = Docebo::user()->preference->getAdminPreference('admin_rules.course_check_time');
    //days from today
    //retrieve competences by courses
    $courses_dropdown = array();
    $query_competences_2 = "(SELECT c.id_competence, t.idCourse, t.name, t.course_type, cc.retraining FROM " . " %lms_competence as c JOIN " . " %lms_competence_course as cc JOIN " . " %lms_course as t ON " . "(c.id_competence=cc.id_competence AND cc.id_course=t.idCourse) " . "WHERE t.course_type IN ('classroom', 'elearning') AND c.id_competence IN (" . implode(",", array_keys($comps_1)) . ")" . ")";
    /*." UNION (SELECT c.id_competence, t.idCourse, t.name, t.course_type, cc.retraining FROM ".
    		$GLOBALS['prefix_lms']."_competence as c JOIN ".
    		$GLOBALS['prefix_lms']."_competence_course as cc JOIN ".
    		$GLOBALS['prefix_lms']."_course as t ON ".
    		"(c.id_competence=cc.id_competence AND cc.id_course=t.idCourse) ".
    		"WHERE t.course_type IN ('classroom', 'elearning') AND c.id_competence IN (".implode(",", array_keys($comps_1)).")".
    		")";*/
    $res_competences_2 = $db->query($query_competences_2);
    while (list($id_comp, $id_course, $course_name, $c_type, $retraining) = $db->fetch_row($res_competences_2)) {
        $comps_2[$id_comp] = $id_course;
        if (!isset($courses_dropdown[$id_comp])) {
            $courses_dropdown[$id_comp] = array();
        }
        $courses_dropdown[$id_comp][$id_course] = $course_name . ' (' . $c_type . ')' . ($retraining > 0 ? ' [' . $lang->def('_RETRAINING') . ']' : '');
    }
    if (empty($comps_2)) {
        //error, no competences
        cout($back_ui . $lang->def('_NO_COMPETENCES') . $back_ui, 'content');
        return;
    }
    $comps = array_keys($comps_2);
    unset($comps_1);
    unset($comps_2);
    $comps_names = $man_competences->getCompetencesName($comps);
    //----------------------------------------------------------------------------
    //retrieve courses for competences
    //$courses_dropdown = array();
    //check if selection for competence and course is valid
    if (!$sel_competence || !array_key_exists($sel_competence, $comps)) {
        $arr = array_keys($courses_dropdown);
        $sel_competence = $arr[0];
        //$comps[0];
    }
    if (!$sel_course || !isset($courses_dropdown[$sel_competence][$sel_course])) {
        foreach ($courses_dropdown as $key => $val) {
            if (count($val) > 0) {
                $sel_competence = $key;
                $arr = array_keys($val);
                $sel_course = $arr[0];
                break;
            }
        }
    }
    //check the course type (base or retraining)
    $is_retraining = $man_competences->isRetrainingCourse($sel_course, $sel_competence);
    //make script for courses dropdown auto-updating
    require_once _base_ . '/lib/lib.json.php';
    $json = new Services_JSON();
    $var = array();
    foreach ($courses_dropdown as $id_comp => $courses_list) {
        $content = "{id_competence: " . (int) $id_comp . ", courses: [";
        $clist = array();
        foreach ($courses_list as $id_course => $name) {
            $clist[] = '{id_course: ' . (int) $id_course . ', name: ' . $json->encode($name) . '}';
        }
        $content .= implode(',', $clist) . "]}";
        $var[] = $content;
    }
    //addYahooJs(array('dom'=>'dom-min.js', 'event'=>'event-min.js', 'selector'=>'selector-beta-min.js'));
    YuiLib::load('selector');
    cout('<script type="text/javascript">
			var sel_options = [' . implode(',', $var) . '];
			YAHOO.util.Event.onDOMReady(function() {
				var s1 = YAHOO.util.Dom.get("competence_selector");
				var s2 = YAHOO.util.Dom.get("course_selector");
				YAHOO.util.Event.addListener(s1, "change", function(e) {
					var opt, id_comp = this.value;
					for (var i=0; i<sel_options.length; i++) {
						if (sel_options[i].id_competence == id_comp) {
							s2.innerHTML = "";
							for (var j=0; j<sel_options[i].courses.length; j++) {
								opt = new Option(sel_options[i].courses[j].name, sel_options[i].courses[j].id_course);
								s2.add(opt, null);
							}
							break;
						}
					}
				});
			});
		</script>', 'page_head');
    //----------------------------------------------------------------------------
    $table_head_style = array('', 'image', 'align_center');
    $table_head_content = array($lang->def('_USERNAME'), $lang->def('_MANDATORY'), $lang->def('_DATE_EXPIRE'));
    $man_course = new Man_Course();
    $date_man = new DateManager();
    $course_info = $man_course->getCourseInfo($sel_course);
    //echo '<pre>'.print_r($course_info, true).'</pre>';
    if ($course_info['course_type'] == 'elearning') {
        $editions[] = (int) $sel_course;
        $subscribed[$sel_course] = getSubscribed($sel_course);
        $table_head_content[] = $course_info['name'];
        $table_head_style[] = 'align_center';
    } elseif ($course_info['course_type'] == 'classroom') {
        //retrieve editions for table columns and subscribed users
        $subscribed = array();
        $editions = array();
        if ($course_check_time > 0) {
            $id_list = array();
            $query_begindates = "SELECT dy.id_date, MIN(dy.date_begin) as date_begin " . " FROM %lms_course_date as dt " . " JOIN %lms_course_date_day as dy ON (dy.id_date = dt.id_date) " . " WHERE dt.id_course='" . (int) $sel_course . "' GROUP BY dy.id_date ORDER BY dy.date_begin";
            $res = $db->query($query_begindates);
            while (list($id_date, $date_begin) = $db->fetch_row($res)) {
                if ($date_begin >= date("Y-m-d") && $date_begin <= date("Y-m-d", strtotime("+" . $course_check_time . " days"))) {
                    $id_list[] = $id_date;
                }
            }
            /*
            			$query_editions = "SELECT dt.id_date, dt.id_course, dt.code, dt.name, MIN(dy.date_begin) as min "
            				." FROM %lms_course_date as dt "
            				." JOIN %lms_course_date_day as dy ON (dy.id_date = dt.id_date) "
            				." WHERE dt.id_course='".(int)$sel_course."' AND dy.date_begin BETWEEN NOW() AND '"
            				.date("Y-m-d", strtotime("+".$course_check_time." days"))."' GROUP BY dt.id_date ORDER BY dy.date_begin";
            */
            $query_editions = "SELECT id_date, id_course, code, name FROM %lms_course_date WHERE " . (count($id_list) > 0 ? "id_date IN (" . implode(",", $id_list) . ") " : "0");
        } else {
            $query_editions = "SELECT id_date, id_course, code, name FROM %lms_course_date WHERE id_course='" . (int) $sel_course . "' ";
        }
        $res_editions = $db->query($query_editions);
        if (sql_num_rows($res_editions) > 0) {
            while (list($id_edition, $id_course, $code, $name) = $db->fetch_row($res_editions)) {
                $table_head_style[] = 'align_center';
                $date_info = $date_man->getDateInfo($id_edition);
                $table_head_content[] = $name . '<br />' . $lang->def('_DATE_BEGIN') . ': ' . Format::date($date_info['date_begin'], 'date') . '<br />' . $lang->def('_DATE_END') . ': ' . Format::date($date_info['date_end'], 'date') . '<br />' . $lang->def('_AVAIL_PLACES') . ': <span id="available_places_count_' . $id_edition . '">' . (int) ($date_info['max_par'] - $date_info['user_subscribed']) . '</span> (' . $date_info['max_par'] . ')';
                $editions[] = $id_edition;
                $subscribed[$id_edition] = $date_man->getDateSubscribed($id_edition);
            }
        } else {
        }
    }
    //retrieve expiration time for every user
    $expiries = array();
    $query_check = "SELECT id_user, date_expire " . " FROM %lms_competence_user " . " WHERE id_user IN (" . implode(",", $array_users) . ") AND id_competence='" . (int) $sel_competence . "'";
    $res_check = $db->query($query_check);
    while (list($id_user, $date_expire) = $db->fetch_row($res_check)) {
        $expiries[$id_user] = $date_expire;
    }
    //filter array of user ids by competence
    $filtered_users = array();
    //------------------------------------------------------------------------------
    $required_filter = Get::req('required_filter', DOTY_INT, 0);
    $expire_duration = $man_competences->getCompetenceExpirationCheckTime($id_comp);
    if ($is_retraining || $required_filter > 0) {
        $query_filter_time = "";
        if ($expire_duration > 0) {
            //if a time for checking expiration has been set, then filter on a time period
            $date_begin = date("Y-m-d", strtotime("-" . $expire_duration . " days"));
            $date_end = date("Y-m-d", strtotime("+" . $expire_duration . " days"));
            $query_filter_time = " AND date_expire>'" . $date_begin . "' AND date_expire<'" . $date_end . "'";
        }
        $query_filter = "SELECT id_user FROM %lms_competence_user WHERE id_user IN (" . implode(",", $array_users) . ") AND id_competence='" . (int) $sel_competence . "' " . $query_filter_time;
        $res_filter = $db->query($query_filter);
        while (list($idst) = $db->fetch_row($res_filter)) {
            $filtered_users[] = $idst;
        }
    }
    if (!$is_retraining || $required_filter > 0) {
        //get user with required competence which is not yet obtained
        $required_users = array();
        $req_data = $man_competences->GetCompetence($sel_competence);
        $already = array();
        $query = "SELECT id_user, score_init, score_got FROM %lms_competence_user WHERE id_competence='" . (int) $sel_competence . "'";
        $res = $db->query($query);
        while (list($id_user, $score_init, $score_got) = $db->fetch_row($res)) {
            if ($req_data['type'] == 'score') {
                //if the competence assignment exists in DB, but the total score is 0, then it's considered as non-assigned
                if ((int) $score_init + (int) $score_got > 0) {
                    $already[] = $id_user;
                }
            } else {
                $already[] = $id_user;
            }
        }
        $already = array_unique($already);
        $req_users = array_diff($array_users, $already);
        //get required competences not got from users
        $query = "";
        if ($req_data['type'] == 'score') {
            $query = "SELECT u.idst FROM %lms_competence_required as cr " . " JOIN %adm_user as u ON (cr.idst = u.idst)" . " WHERE cr.idst IN (" . implode(",", $req_users) . ") AND cr.id_competence=" . (int) $sel_competence . "";
        } else {
            $query = "SELECT u.idst FROM %lms_competence_required as cr " . " JOIN %adm_user as u ON (cr.idst = u.idst) " . " WHERE cr.idst IN (" . implode(",", $req_users) . ") AND cr.id_competence=" . (int) $sel_competence . "";
        }
        $res = $db->query($query);
        if (sql_num_rows($res) > 0) {
            while (list($idst) = $db->fetch_row($res)) {
                $required_users[] = $idst;
            }
        }
        //get users expired from too long time
        if ($expire_duration > 0) {
            $query = "SELECT id_user FROM %lms_competence_user " . " WHERE date_expire<'" . date("Y-m-d", strtotime("-" . $expire_duration . " days")) . "' AND date_expire<>'0000-00-00 00:00:00' " . " AND id_competence=" . (int) $sel_competence;
            $res = $db->query($query);
            while (list($idst) = $db->fetch_row($res)) {
                $required_users[] = $idst;
            }
        }
        //merge results
        if (count($required_users) > 0) {
            if (count($filtered_users) > 0) {
                $filtered_users = array_merge($filtered_users, $required_users);
            } else {
                $filtered_users = $required_users;
            }
        }
    }
    //------------------------------------------------------------------------------
    $filtered_users = array_unique($filtered_users);
    //draw table
    $table = new Table(0);
    $form = new Form();
    $table->addHead($table_head_content, $table_head_style);
    $totals = array();
    for ($i = 0; $i < count($editions); $i++) {
        $totals[$i] = 0;
    }
    //check the expiration time  of the current competence
    list($expiry_time) = $db->fetch_row($db->query("SELECT expiration FROM %lms_competence WHERE id_competence='" . (int) $sel_competence . "'"));
    if ($expiry_time === false) {
        //error, we need a number (it should never enter this branch though)
        //error, no competences
        cout($back_ui . $lang->def('_NO_EXPIRATION_TIME') . $back_ui, 'content');
        return;
    }
    $checkbox_list_script = array();
    foreach ($editions as $id_edition) {
        $checkbox_list_script[$id_edition] = array();
    }
    $expiring_users_count = 0;
    $req_count = 0;
    //filtered data to consider in saving operation
    $to_consider = array('users' => array(), 'editions' => array());
    for ($i = 0; $i < count($editions); $i++) {
        $to_consider['editions'][] = $editions[$i];
    }
    //retrieve users' data for table rows (little fast query)
    if (count($filtered_users) > 0) {
        $query_users = "SELECT idst, userid, lastname, firstname FROM %adm_user WHERE idst IN (" . implode(",", $filtered_users) . ") ORDER BY userid, lastname, firstname";
        $res_users = $db->query($query_users);
        //retrieve users with required competence
        $just_required = array();
        $query_req = "SELECT idst FROM %lms_competence_required " . " WHERE id_competence=" . (int) $sel_competence . " AND idst IN (" . implode(",", $filtered_users) . ")";
        $res_req = $db->query($query_req);
        while (list($idst) = $db->fetch_row($res_req)) {
            $just_required[] = $idst;
        }
        while (list($idst, $userid, $firstname, $lastname) = $db->fetch_row($res_users)) {
            $line = array();
            //filtered users to consider in saving operations
            $to_consider['users'][] = $idst;
            //check if the expiring date of the competence is less than 30 days from now or it's already expired (change bg color then)
            $user_expiring = false;
            $background = "";
            if ($expiry_time > 0) {
                if (isset($expiries[$idst])) {
                    //$time1 = fromDateTimeToTimestamp($expiries[$idst]) + $expiry_time * 24 * 3600;
                    //$time2 = time();
                    //if (($time2-$time1) < 2592000) $user_expiring = true;
                    if ($expiries[$idst] < date("Y-m-d H:i:s")) {
                        $user_expiring = true;
                    }
                }
            }
            if ($user_expiring) {
                $background .= 'bg_highlight';
                $expiring_users_count++;
            }
            $line[] = $acl_man->relativeId($userid) . "&nbsp;(" . $firstname . "&nbsp;" . $lastname . ")";
            //swap these
            $is_req = in_array($idst, $just_required);
            if ($is_req) {
                $req_count++;
            }
            $line[] = $is_req ? '<image src="' . getPathImage('framework') . 'standard/flag.gif" />' : '';
            $line[] = '<div class="' . $background . '">' . (isset($expiries[$idst]) ? Format::date($expiries[$idst], "date") : '-') . '</div>';
            for ($i = 0; $i < count($editions); $i++) {
                //check if the actual considered user is subscribed to this class' edition (then flag the checkbox)
                $is_subscribed = false;
                if (isset($subscribed[$editions[$i]][$idst])) {
                    $is_subscribed = true;
                    $totals[$i]++;
                    //update total subscriptions
                }
                if ($course_info['course_type'] == 'elearning') {
                    $line[] = '<div class="align_center">' . $form->getInputCheckbox('subscriptions_' . $idst, 'subscriptions[' . $idst . '][' . $editions[$i] . ']', 1, $is_subscribed, false) . '</div>';
                    $checkbox_list_script[$editions[$i]][] = '"subscriptions_' . $idst . '"';
                } elseif ($course_info['course_type'] == 'classroom') {
                    $line[] = '<div class="align_center">' . $form->getInputCheckbox('subscriptions_' . $idst . '_' . $editions[$i], 'subscriptions[' . $idst . '][' . $editions[$i] . ']', 1, $is_subscribed, false) . '</div>';
                    $checkbox_list_script[$editions[$i]][] = '"subscriptions_' . $idst . '_' . $editions[$i] . '"';
                }
            }
            $table->addBody($line);
        }
    }
    //totals line
    $line = array();
    $line[] = $lang->def('_TOTAL');
    $line[] = '<div class="align_center">' . (int) $req_count . '</div>';
    $line[] = '<div class="align_center">' . (int) $expiring_users_count . '</div>';
    for ($i = 0; $i < count($editions); $i++) {
        $line[] = '<div class="align_center">' . (int) $totals[$i] . '</div>';
    }
    $table->addFoot($line);
    //echo '<pre class="align_left">'.print_r($checkbox_list_script, true).'</pre>';
    //script to check available places in real-time
    $avail_script = '<script type="text/javascript">
			function setupAvailablePlaces() {';
    foreach ($editions as $id_edition) {
        $date_info = $date_man->getDateInfo($id_edition);
        $avail_script .= '
				YAHOO.util.Event.addListener([' . implode(',', $checkbox_list_script[$id_edition]) . '], "click", function(e, o) {
					max_avail_places_' . $id_edition . ' = ' . (int) ($date_info['max_par'] - $date_info['user_subscribed']) . ';
					var i, edition_boxes = YAHOO.util.Dom.get([' . implode(',', $checkbox_list_script[$id_edition]) . ']);
					var edition_count = 0, edition_max = ' . (int) $date_info['max_par'] . ';
					for (i=0; i<edition_boxes.length; i++) {
						if (edition_boxes[i].checked) edition_count++;
					}
					YAHOO.util.Dom.get("available_places_count_' . $id_edition . '").innerHTML = ""+(edition_max - edition_count);
					if (edition_count >= edition_max) {
						for (i=0; i<edition_boxes.length; i++) {
							if (!edition_boxes[i].checked) edition_boxes[i].disabled = true;
						}
					} else {
						for (i=0; i<edition_boxes.length; i++) {
							if (edition_boxes[i].disabled) edition_boxes[i].disabled = false;
						}
					}
				});';
    }
    $avail_script .= '}
			setupAvailablePlaces();
		</script>';
    cout($avail_script, 'page_head');
    //any error message from previous operations?
    $message = "";
    $err = Get::req('err', DOTY_MIXED, false);
    switch ($err) {
        case 'invalid':
            $message .= getErrorUi($lang->def('_ERROR_WHILE_SUBSCRIBING') . '.');
            break;
        case 'ok':
            $content = $lang->def('_SUBSCRIBE_SUCCESSFULL');
            $count = Get::req('count', DOTY_MIXED, false);
            if ($count !== false && is_numeric($count)) {
                $content .= "&nbsp;(" . $lang->def('_NUM_SUBSCRIBED') . ":&nbsp;" . $count . ")";
            }
            $message .= getResultUi($content);
            break;
    }
    //print page
    cout(getTitleArea($lang->def('_COURSEPANEL'), 'coursepanel') . '<div class="std_block">' . $message . $back_ui, 'content');
    cout('<link rel="stylesheet" type="text/css" href="' . Get::rel_path('base') . '/addons/yui/grids/grids-min.css">', 'page_head');
    $comps_list = $man_competences->GetCompetencesList();
    //write period of checking for expiration, from beginning date to ending date
    $date_1 = $expire_duration > 0 ? date("Y-m-d H:i:s", strtotime("-" . $expire_duration . " days")) : "";
    $date_2 = $expire_duration > 0 ? date("Y-m-d H:i:s", strtotime("+" . $expire_duration . " days")) : "";
    if ($date_1 != "" && $date_2 != "") {
        $date_period = Format::date($date_1, "date") . ' - ' . Format::date($date_2, "date");
    } else {
        $date_period = '(' . $lang->def('_ALL') . ')';
    }
    $selector = "";
    //$selector .= $form->openElementSpace();
    $selector .= '<div class="yui-g"><div id="select_1" class="yui-u first align_left">';
    $selector .= $form->openForm('action_panel', "index.php?modname=public_coursepanel&op=coursepanel");
    $selector .= $form->openElementSpace();
    $selector .= '<p class="align_left">' . $lang->def('_EXPIRING_USERS_FOR_PERIOD') . ':&nbsp;<b>' . $date_period . '</b>;</p>';
    //$selector .= $lang->def('_FOR_COMPETENCE').':&nbsp;';
    $selector .= $form->getDropDown($lang->def('_FOR_COMPETENCE') . ':&nbsp;', 'competence_selector', 'sel_competence', $comps_names, $sel_competence, '');
    $selector .= $form->getDropDown($lang->def('_FOR_COURSE') . ':&nbsp;', 'course_selector', 'sel_course', $courses_dropdown[$sel_competence], $sel_course, '');
    $selector .= $form->openButtonSpace();
    $selector .= $form->getButton('update', 'update', $lang->def('_UPDATE'));
    $selector .= $form->closeButtonSpace();
    $selector .= $form->closeElementSpace();
    $selector .= $form->closeForm();
    $selector .= '</div><div id="select_2" class="yui-u align_left">';
    //if (count($comps_list)>0) { ...
    $selector .= $form->openElementSpace();
    $selector .= $form->openForm('action_panel', "index.php?modname=public_coursepanel&op=expired");
    $selector .= $form->getHidden('expire_sel_competence', 'sel_competence', $sel_competence);
    $selector .= $form->getHidden('expire_sel_course', 'sel_course', $sel_course);
    $selector .= $form->getDropdown($lang->def('_CHOOSE_COMPETENCE_TO_SEE_EXPIRED'), 'expired_selector', 'expired_selector', $comps_list);
    $selector .= $form->openButtonSpace();
    $selector .= $form->getButton('update_expired', 'update_expired', $lang->def('_UPDATE'));
    $selector .= $form->closeButtonSpace();
    $selector .= $form->closeForm();
    $selector .= $form->getBreakRow();
    $selector .= $form->openForm('action_panel', "index.php?modname=public_coursepanel&op=required");
    $selector .= $form->getHidden('expire_sel_competence_req', 'sel_competence_req', $sel_competence);
    $selector .= $form->getHidden('expire_sel_course_req', 'sel_course_req', $sel_course);
    $selector .= $form->getDropDown($lang->def('_CHOOSE_REQUIRED_COMPETENCES'), 'required_selector', 'required_selector', $comps_list);
    $selector .= $form->openButtonSpace();
    $selector .= $form->getButton('update_required', 'update_required', $lang->def('_UPDATE'));
    $selector .= $form->closeButtonSpace();
    $selector .= $form->closeForm();
    $selector .= $form->closeElementSpace();
    $selector .= '</div></div><div class="no_float"></div>';
    //$selector .= $form->closeElementSpace();
    //legend which explains what highlighted users mean
    $legend = '<div class="align_left"><div style="display:inline-block;width:12px;height:12px;" class="bg_highlight"></div> = ' . $lang->def('_EXPIRED_COMPETENCE') . '</div>';
    cout('<div class="align_center">' . $selector . '</div>', 'content');
    cout($form->openForm('comp_panel', "index.php?modname=public_coursepanel&op=savepanel"), 'content');
    cout($form->getHidden('sel_competence', 'sel_competence', $sel_competence), 'content');
    cout($form->getHidden('sel_course', 'sel_course', $sel_course), 'content');
    cout($form->openElementSpace(), 'content');
    cout('<div class="align_left">', 'content');
    if ($is_retraining) {
        cout($form->getCheckbox($lang->def('_SHOW_REQUIRED'), 'required_filter', 'required_filter', 1, $required_filter), 'content');
    } else {
        cout($form->getCheckbox($lang->def('_SHOW_EXPIRED'), 'required_filter', 'required_filter', 1, $required_filter), 'content');
    }
    cout('</div>', 'content');
    cout($form->closeElementSpace(), 'content');
    cout('<div class="align_left">', 'content');
    cout('<p>' . ($is_retraining ? $lang->def('_IS_RETRAINING_COURSE') : $lang->def('_IS_TRAINING_COURSE')) . '</p>', 'content');
    if ($course_info['course_type'] == 'classroom' && $course_check_time > 0) {
        $check_date_1 = Format::date(date("Y-m-d"), "date");
        $check_date_2 = Format::date(date("Y-m-d H:i:s", strtotime("+" . $course_check_time . " days")), "date");
        cout('<p>' . $lang->def('_COURSE_CHECKING_PERIOD') . ': ' . $check_date_1 . ' - ' . $check_date_2 . '</p>', 'content');
    }
    cout('</div>', 'content');
    if (empty($editions)) {
        //no editions to display (it should have been pre-selected only courses with available editions)
        cout('<p>' . $lang->def('_NO_CONTENT') . '</p>', 'content');
    } else {
        cout($table->getTable(), 'content');
    }
    cout($legend, 'content');
    cout($form->getHidden('to_consider', 'to_consider', base64_encode($json->encode($to_consider))), 'content');
    cout($form->openButtonSpace() . $form->getButton('save', 'save', $lang->def('_SAVE')) . $form->getButton('undo', 'undo', $lang->def('_UNDO')) . $form->closeButtonSpace(), 'content');
    cout($form->closeForm() . $back_ui . '</div>', 'content');
    cout('<script type="text/javascript">
			YAHOO.util.Event.addListener("required_filter", "click", function(e) {
				var show_required = this.checked, comp_form = YAHOO.util.Dom.get("comp_panel");
				comp_form.action = comp_form.action.replace("&op=savepanel", "&op=coursepanel");
				comp_form.submit();
			});
		</script>', 'page_head');
}
Пример #10
0
function show_personal_media(&$out, &$lang)
{
    if (!canAccessPersonalMedia()) {
        die("You can't access!");
    }
    require_once _base_ . '/lib/lib.table.php';
    require_once _base_ . '/lib/lib.mimetype.php';
    require_once _base_ . '/lib/lib.multimedia.php';
    $url = getPopupBaseUrl();
    $tab = new Table();
    $user_id = (int) Docebo::user()->getIdSt();
    //if(Get::sett('hteditor') == 'tinymce') {
    $GLOBALS['page']->add('' . '<script type="text/javascript" type="text/javascript" src="' . Get::rel_path('base') . '/addons/tiny_mce/tiny_mce_popup.js"></script>', 'page_head');
    $GLOBALS['page']->add('<script type="text/javascript">' . 'var FileBrowserDialogue = {
		    init : function () {
		        // Here goes your code for setting your custom things onLoad.
				var allLinks = document.getElementsByTagName("link");
				allLinks[allLinks.length-1].parentNode.removeChild(allLinks[allLinks.length-1]);
		    },
		    mySubmit : function (url) {
		        var URL = url;
		        var win = tinyMCEPopup.getWindowArg("window");

		        // insert information now
		        win.document.getElementById(tinyMCEPopup.getWindowArg("input")).value = URL;

		        // for image browsers: update image dimensions
		        if(win.ImageDialog) {
			        if (win.ImageDialog.getImageData) win.ImageDialog.getImageData();
			        if (win.ImageDialog.showPreviewImage) win.ImageDialog.showPreviewImage(URL);
		        }
		        // close popup window
		        tinyMCEPopup.close();
		    }
		}
			tinyMCEPopup.onInit.add(FileBrowserDialogue.init, FileBrowserDialogue);
		' . '</script>', 'page_head');
    //}
    $head = array($lang->def("_PREVIEW"), $lang->def("_TYPE"), $lang->def("_FILENAME"));
    $head[] = "<img src=\"" . getPathImage() . "standard/download.png\" alt=\"" . $lang->def("_ATTACHMENT") . "\" title=\"" . $lang->def("_ATTACHMENT") . "\" />";
    $head[] = "<img src=\"" . getPathImage() . "standard/delete.png\" alt=\"" . $lang->def("_DEL") . "\" title=\"" . $lang->def("_DEL") . "\" />";
    $head_type = array('preview80', 'image', '', 'image', 'image');
    $tab->setColsStyle($head_type);
    $tab->addHead($head);
    $path = (strlen(dirname($_SERVER['PHP_SELF'])) != 1 ? dirname($_SERVER['PHP_SELF']) : '') . '/';
    $path .= $GLOBALS["where_files_relative"];
    $site_url = "http://" . $_SERVER['HTTP_HOST'] . $path . '/common/users/';
    $qtxt = "\r\n\tSELECT *\r\n\tFROM " . $GLOBALS["prefix_fw"] . "_user_file\r\n\tWHERE user_idst='" . $user_id . "'";
    $q = sql_query($qtxt);
    if ($q && mysql_num_rows($q) > 0) {
        while ($row = mysql_fetch_array($q)) {
            $rowcnt = array();
            if (!empty($row["media_url"])) {
                $rowcnt[] = "&nbsp;";
            } else {
                $file = _USER_FPATH . rawurlencode($row["real_fname"]);
                $rowcnt[] = "<div style=\"text-align: center;\">" . '<a href="#" onclick="javascript:window.open(\'' . $file . '\',\'\');return false;">' . "<img height=\"120\" src=\"" . $file . "\" alt=\"" . $row["fname"] . "\" title=\"" . $row["fname"] . "\" /></a></div>";
            }
            $img = "<img src=\"" . getPathImage('fw') . mimeDetect($file) . "\" alt=\"" . $row["fname"] . "\" title=\" ";
            $img .= $row["fname"] . "\" />\n";
            $rowcnt[] = $img;
            $rowcnt[] = $row["fname"];
            if (!empty($row["media_url"])) {
                $type = getMediaType($row["media_url"]);
            } else {
                $type = getMediaType($row["fname"]);
            }
            $sel_url = $url . "&amp;op=select&amp;from=personal&amp;type=" . $type . "&amp;item_id=" . $row["id"];
            $img = "<img src=\"" . getPathImage() . "standard/download.png\" alt=\"" . $lang->def("_ATTACHMENT") . "\" title=\"" . $lang->def("_ATTACHMENT") . "\" />\n";
            $rowcnt[] = '<a href="' . $sel_url . '" ' . (Get::sett('hteditor') == 'tinymce' ? 'onclick="FileBrowserDialogue.mySubmit(\'' . $site_url . $row["real_fname"] . '\'); return false;"' : '') . '>' . $img . "</a>\n";
            $img = "<img src=\"" . getPathImage('fw') . "standard/delete.png\" alt=\"" . $lang->def("_DEL") . "\" title=\"" . $lang->def("_DEL") . "\" />\n";
            $rowcnt[] = "<a href=\"" . $url . "&amp;op=delpersonal&amp;item_id=" . $row["id"] . "\">" . $img . "</a>\n";
            $tab->addBody($rowcnt);
        }
    }
    $url = getPopupBaseUrl() . "&amp;op=addpersonal";
    $tab->addActionAdd("<a href=\"" . $url . "\">" . $lang->def("_ADD") . "</a>");
    if (isset($_GET['result'])) {
        switch ($_GET['result']) {
            case "invalid_ext":
                $GLOBALS['page']->add(getErrorUi($lang->def('_INVALID_EXTENSION')));
                break;
            case "upload_err":
                $GLOBALS['page']->add(getErrorUi($lang->def('_ERROR_UPLOAD')));
                break;
            case "upload_ok":
                $GLOBALS['page']->add(getResultUi($lang->def('_OPERATION_SUCCESSFUL')));
                break;
        }
    }
    $GLOBALS['page']->add($tab->getTable());
}
Пример #11
0
 function show_report_LO($report_data = NULL, $other = '')
 {
     $jump_url = '';
     //show_report
     checkPerm('view');
     $lang =& DoceboLanguage::createInstance('report', 'framework');
     if (isset($_POST['send_mail_confirm'])) {
         $op = 'send_mail_confirm';
     } elseif (isset($_POST['send_mail'])) {
         $op = 'send_mail';
     } else {
         $op = 'show_result';
     }
     switch ($op) {
         case 'send_mail_confirm':
             $subject = importVar('mail_object', false, '[' . $lang->def('_SUBJECT') . ']');
             //'[No subject]');
             $body = importVar('mail_body', false, '');
             $acl_man = new DoceboACLManager();
             $user_info = $acl_man->getUser(getLogUserId(), false);
             if ($user_info) {
                 $sender = $user_info[ACL_INFO_EMAIL];
             }
             $mail_recipients = unserialize(urldecode(Get::req('mail_recipients', DOTY_STRING, '')));
             // prepare intestation for email
             $from = "From: " . $sender . $GLOBALS['mail_br'];
             $header = "MIME-Version: 1.0" . $GLOBALS['mail_br'] . "Content-type: text/html; charset=" . getUnicode() . $GLOBALS['mail_br'];
             $header .= "Return-Path: " . Get::sett('sender_event') . $GLOBALS['mail_br'];
             $header .= "Reply-To: " . Get::sett('sender_event') . $GLOBALS['mail_br'];
             $header .= "X-Sender: " . Get::sett('sender_event') . $GLOBALS['mail_br'];
             $header .= "X-Mailer: PHP/" . phpversion() . $GLOBALS['mail_br'];
             // send mail
             $arr_recipients = array();
             foreach ($mail_recipients as $recipient) {
                 $rec_data = $acl_man->getUser($recipient, false);
                 //mail($rec_data[ACL_INFO_EMAIL] , stripslashes($subject), stripslashes(nl2br($body)), $from.$header."\r\n");
                 $arr_recipients[] = $rec_data[ACL_INFO_EMAIL];
             }
             $mailer = DoceboMailer::getInstance();
             $mailer->SendMail($sender, $arr_recipients, stripslashes($subject), stripslashes(nl2br($body)));
             $result = getResultUi($lang->def('_OPERATION_SUCCESSFUL'));
             cout($this->_get_LO_query('html', NULL, $result));
             break;
         case 'send_mail':
             require_once _base_ . '/lib/lib.form.php';
             $mail_recipients = Get::req('mail_recipients', DOTY_MIXED, array());
             cout('' . Form::openElementSpace() . Form::getTextfield($lang->def('_SUBJECT'), 'mail_object', 'mail_object', 255) . Form::getTextarea($lang->def('_MAIL_BODY'), 'mail_body', 'mail_body') . Form::getHidden('mail_recipients', 'mail_recipients', urlencode(serialize($mail_recipients))) . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('send_mail_confirm', 'send_mail_confirm', $lang->def('_SEND_MAIL')) . Form::getButton('undo_mail', 'undo_mail', $lang->def('_UNDO')) . Form::closeButtonSpace() . '</div>', 'content');
             break;
         default:
             cout($this->_get_LO_query('html', $report_data, $other));
     }
 }
Пример #12
0
function testvote()
{
    checkPerm('mod');
    require_once $GLOBALS['where_lms'] . '/lib/lib.coursereport.php';
    require_once $GLOBALS['where_lms'] . '/lib/lib.test.php';
    require_once _base_ . '/lib/lib.form.php';
    require_once _base_ . '/lib/lib.table.php';
    require_once _base_ . '/lib/lib.json.php';
    // XXX: Initializaing
    $id_test = importVar('id_test', true, 0);
    $lang =& DoceboLanguage::createInstance('coursereport', 'lms');
    $out =& $GLOBALS['page'];
    $out->setWorkingZone('content');
    // XXX: Instance management
    $acl_man = Docebo::user()->getAclManager();
    $test_man = new GroupTestManagement();
    $report_man = new CourseReportManager();
    // XXX: Find students
    $type_filter = false;
    if (isset($_GET['type_filter']) && $_GET['type_filter'] != null) {
        $type_filter = $_GET['type_filter'];
    }
    $lev = $type_filter;
    $students = getSubscribed((int) $_SESSION['idCourse'], FALSE, $lev, TRUE, false, false, true);
    $id_students = array_keys($students);
    $students_info =& $acl_man->getUsers($id_students);
    // XXX: Find test
    $test_info =& $test_man->getTestInfo(array($id_test));
    // XXX: Write in output
    $page_title = array('index.php?modname=coursereport&amp;op=coursereport' => $lang->def('_COURSEREPORT', 'menu_course'), strip_tags($test_info[$id_test]['title']));
    $GLOBALS['page']->add(getTitleArea($page_title, 'coursereport') . '<div class="std_block">', 'content');
    //==========================================================================================
    // XXX: Reset track of user
    if (isset($_POST['reset_track'])) {
        $re = saveTestUpdate($id_test, $test_man);
        list($id_user, ) = each($_POST['reset_track']);
        $user_info = $acl_man->getUser($id_user, false);
        $GLOBALS['page']->add(Form::openForm('test_vote', 'index.php?modname=coursereport&amp;op=testvote') . Form::getHidden('id_test', 'id_test', $id_test) . Form::getHidden('id_user', 'id_user', $id_user) . getDeleteUi($lang->def('_AREYOUSURE'), '<span>' . $lang->def('_RESET') . ' : </span>' . strip_tags($test_info[$id_test]['title']) . '<br />' . '<span>' . $lang->def('_OF_USER') . ' : </span>' . ($user_info[ACL_INFO_LASTNAME] . $user_info[ACL_INFO_FIRSTNAME] ? $user_info[ACL_INFO_LASTNAME] . ' ' . $user_info[ACL_INFO_FIRSTNAME] : $acl_man->relativeId($user_info[ACL_INFO_USERID])), false, 'confirm_reset', 'undo_reset') . Form::closeForm() . '</div>', 'content');
        return;
    }
    if (isset($_POST['confirm_reset'])) {
        $id_user = importVar('id_user', true, 0);
        if ($test_man->deleteTestTrack($id_test, $id_user)) {
            $GLOBALS['page']->add(getResultUi($lang->def('_OPERATION_SUCCESSFUL')), 'content');
        } else {
            $GLOBALS['page']->add(getErrorUi($lang->def('_OPERATION_FAILURE')), 'content');
        }
    }
    //==========================================================================================
    if (isset($_POST['save'])) {
        $re = saveTestUpdate($id_test, $test_man);
        Util::jump_to('index.php?modname=coursereport&amp;op=coursereport&resul=' . ($re ? 'ok' : 'err'));
    }
    // retirive activity info
    $query_report = "\r\n\tSELECT id_report, title, max_score, required_score, weight, show_to_user, use_for_final, source_of, id_source\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_coursereport\r\n\tWHERE id_course = '" . $_SESSION['idCourse'] . "'\r\n\tAND source_of = 'test' AND id_source = '" . $id_test . "'";
    $info_report = sql_fetch_assoc(sql_query($query_report));
    $query = "SELECT question_random_number" . " FROM " . $GLOBALS['prefix_lms'] . "_test" . " WHERE idTest = '" . $id_test . "'";
    list($question_random_number) = sql_fetch_row(sql_query($query));
    $json = new Services_JSON();
    $chart_options = $json->decode($chart_options_json);
    if (!property_exists($chart_options, 'use_charts')) {
        $chart_options->use_charts = false;
    }
    if (!property_exists($chart_options, 'selected_chart')) {
        $chart_options->selected_chart = 'column';
    }
    if (!property_exists($chart_options, 'show_chart')) {
        $chart_options->show_chart = 'teacher';
    }
    /* XXX: scores */
    $tb = new Table(0, $lang->def('_STUDENTS_VOTE'), $lang->def('_STUDENTS_VOTE'));
    if ($chart_options->use_charts) {
        $type_h = array('', 'align-center', 'align-center', 'image', 'align-center', '', 'image');
        $cont_h = array($lang->def('_STUDENTS'), $lang->def('_SCORE'), $lang->def('_SHOW_ANSWER'), '<img src="' . getPathImage('lms') . 'standard/stats22.gif" alt="' . $lang->def('_SHOW_CHART') . '" title="' . $lang->def('_SHOW_CHART_TITLE') . '" />', $lang->def('_DATE'), $lang->def('_COMMENTS'), '<img src="' . getPathImage('lms') . 'standard/delete.png" alt="' . $lang->def('_RESET') . '" title="' . $lang->def('_RESET') . '" />');
    } else {
        $type_h = array('', 'align-center', 'align-center', 'align-center', '', 'image');
        $cont_h = array($lang->def('_STUDENTS'), $lang->def('_SCORE'), $lang->def('_SHOW_ANSWER'), $lang->def('_DATE'), $lang->def('_COMMENTS'), '<img src="' . getPathImage('lms') . 'standard/delete.png" alt="' . $lang->def('_RESET') . '" title="' . $lang->def('_RESET') . '" />');
    }
    $tb->setColsStyle($type_h);
    $tb->addHead($cont_h);
    $out->add(Form::openForm('test_vote', 'index.php?modname=coursereport&amp;op=testvote') . Form::getHidden('id_test', 'id_test', $id_test));
    $out->add(Form::openElementSpace() . Form::getOpenFieldSet($lang->def('_TEST_INFO')) . Form::getLinebox($lang->def('_TITLE_ACT'), strip_tags($test_info[$id_test]['title'])) . ($question_random_number ? Form::getTextfield($lang->def('_MAX_SCORE'), 'max_score', 'max_score', '11', $info_report['max_score']) : Form::getLinebox($lang->def('_MAX_SCORE'), $info_report['max_score'])) . Form::getLinebox($lang->def('_REQUIRED_SCORE'), $info_report['required_score']) . Form::getTextfield($lang->def('_WEIGHT'), 'weight', 'weight', '11', $info_report['weight']) . Form::getDropdown($lang->def('_SHOW_TO_USER'), 'show_to_user', 'show_to_user', array('true' => $lang->def('_YES'), 'false' => $lang->def('_NO')), $info_report['show_to_user']) . Form::getDropdown($lang->def('_USE_FOR_FINAL'), 'use_for_final', 'use_for_final', array('true' => $lang->def('_YES'), 'false' => $lang->def('_NO')), $info_report['use_for_final']) . Form::getCloseFieldSet() . Form::closeElementSpace());
    // XXX: retrive scores
    $tests_score =& $test_man->getTestsScores(array($id_test), $id_students);
    // XXX: Display user scores
    $i = 0;
    while (list($idst_user, $user_info) = each($students_info)) {
        $user_name = $user_info[ACL_INFO_LASTNAME] . $user_info[ACL_INFO_FIRSTNAME] ? $user_info[ACL_INFO_LASTNAME] . ' ' . $user_info[ACL_INFO_FIRSTNAME] : $acl_man->relativeId($user_info[ACL_INFO_USERID]);
        $cont = array(Form::getLabel('user_score_' . $idst_user, $user_name));
        $id_test = $info_report['id_source'];
        if (isset($tests_score[$id_test][$idst_user])) {
            switch ($tests_score[$id_test][$idst_user]['score_status']) {
                case "not_complete":
                    $cont[] = '-';
                    break;
                case "not_checked":
                    $cont[] = '<span class="cr_not_check">' . $lang->def('_NOT_CHECKED') . '</span><br />' . Form::getInputTextfield('textfield_nowh', 'user_score_' . $idst_user, 'user_score[' . $idst_user . ']', $tests_score[$id_test][$idst_user]['score'], strip_tags($lang->def('_SCORE')), '8', ' tabindex="' . $i++ . '" ');
                    break;
                case "not_passed":
                case "passed":
                    /*
                    					$cont[] = Form::getInputDropdown(	'dropdown',
                    'user_score',
                    'user_score',
                    array('passed' => $lang->def('_PASSED'), 'not_passed' => $lang->def('_NOT_PASSED')),
                    $tests_score[$id_test][$idst_user]['score_status'],
                    '');
                    */
                    $cont[] = Form::getInputTextfield('textfield_nowh', 'user_score_' . $idst_user, 'user_score[' . $idst_user . ']', $tests_score[$id_test][$idst_user]['score'], strip_tags($lang->def('_SCORE')), '8', ' tabindex="' . $i++ . '" ');
                    break;
                case "valid":
                    $cont[] = Form::getInputTextfield('textfield_nowh', 'user_score_' . $idst_user, 'user_score[' . $idst_user . ']', $tests_score[$id_test][$idst_user]['score'], strip_tags($lang->def('_SCORE')), '8', ' tabindex="' . $i++ . '" ');
                    break;
                default:
                    $cont[] = '-';
            }
            if ($tests_score[$id_test][$idst_user]['score_status'] != 'not_comlete') {
                $cont[] = Form::getButton('view_anser_' . $idst_user, 'view_answer[' . $idst_user . ']', $lang->def('_SHOW_ANSWER'), 'button_nowh');
                if ($chart_options->use_charts) {
                    $img = '<img src="' . getPathImage('lms') . 'standard/stats22.gif" alt="' . $lang->def('_SHOW_CHART') . '" title="' . $lang->def('_SHOW_CHART_TITLE') . '" />';
                    $url = 'index.php?modname=coursereport&op=showchart&id_test=' . (int) $id_test . '&id_user='******'&chart_type=' . $chart_options->selected_chart;
                    $cont[] = '<a href="' . $url . '">' . $img . '</a>';
                }
                $cont[] = Form::getInputDatefield('textfield_nowh', 'date_attempt_' . $idst_user, 'date_attempt[' . $idst_user . ']', Format::date($tests_score[$id_test][$idst_user]['date_attempt']));
                $cont[] = Form::getInputTextarea('comment_' . $idst_user, 'comment[' . $idst_user . ']', $tests_score[$id_test][$idst_user]['comment'], 'textarea_wh_full', 2);
                $cont[] = '<input 	class="reset_track"
									type="image"
									src="' . getPathImage('lms') . 'standard/delete.png"
									alt="' . $lang->def('_RESET') . '"
									id="reset_track_' . $idst_user . '"
									name="reset_track[' . $idst_user . ']"
									title="' . $lang->def('_RESET') . '" />';
            }
        } else {
            $cont[] = '-';
            //...
            $cont[] = '-';
            $cont[] = '-';
            $cont[] = '-';
            $cont[] = '-';
            // $cont[] = '-';
        }
        $tb->addBody($cont);
    }
    $out->add(Form::openButtonSpace() . Form::getButton('save_top', 'save', $lang->def('_SAVE')) . Form::getButton('undo_top', 'undo', $lang->def('_UNDO')) . Form::closeButtonSpace() . $tb->getTable() . Form::openButtonSpace() . Form::getButton('save', 'save', $lang->def('_SAVE')) . Form::getButton('undo', 'undo', $lang->def('_UNDO')) . Form::closeButtonSpace() . Form::closeForm() . '</div>');
}
Пример #13
0
 function classroom()
 {
     checkPerm('view');
     require_once _base_ . '/lib/lib.form.php';
     require_once _base_ . '/lib/lib.table.php';
     $mod_perm = true;
     // create a language istance for module admin_classroom
     $lang =& DoceboLanguage::createInstance('admin_classroom', 'lms');
     $out =& $GLOBALS['page'];
     $out->setWorkingZone('content');
     $tb = new Table(Get::sett('visuItem'), $lang->def('_CLASSROOM_CAPTION'), $lang->def('_CLASSROOM_SUMMARY'));
     $tb->initNavBar('ini', 'link');
     $tb->setLink('index.php?modname=reservation&amp;op=classroom&amp;id_course=' . $_SESSION['idCourse']);
     $ini = $tb->getSelectedElement();
     //search query of classrooms
     $query_classroom = "\r\n\t\tSELECT idClassroom, name, description\r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_classroom\r\n\t\tORDER BY name\r\n\t\tLIMIT {$ini}," . Get::sett('visuItem');
     $query_classroom_tot = "\r\n\t\tSELECT COUNT(*)\r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_classroom";
     $re_classroom = sql_query($query_classroom);
     list($tot_classroom) = sql_fetch_row(sql_query($query_classroom_tot));
     $type_h = array('', 'news_short_td', "image", "image");
     $cont_h = array($lang->def('_NAME'), $lang->def('_DESCRIPTION'));
     if ($mod_perm) {
         $cont_h[] = '<img src="' . getPathImage() . 'standard/edit.png" title="' . $lang->def('_TITLE_MOD_CLASSROOM') . '" ' . 'alt="' . $lang->def('_MOD') . '" />';
         $type_h[] = 'image';
         $cont_h[] = '<img src="' . getPathImage() . 'standard/delete.png" title="' . $lang->def('_DEL') . '" ' . 'alt="' . $lang->def('_DEL') . '"" />';
         $type_h[] = 'image';
     }
     $tb->setColsStyle($type_h);
     $tb->addHead($cont_h);
     while (list($idClassroom, $name, $descr) = sql_fetch_row($re_classroom)) {
         $cont = array($name, $descr);
         if ($mod_perm) {
             $cont[] = '<a href="index.php?modname=reservation&amp;op=modclassroom&amp;idClassroom=' . $idClassroom . '" ' . 'title="' . $lang->def('_TITLE_MOD_CLASSROOM') . ' : ' . $name . '">' . '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . ' : ' . $name . '" /></a>';
             $cont[] = '<a href="index.php?modname=reservation&amp;op=delclassroom&amp;idClassroom=' . $idClassroom . '" ' . 'title="' . $lang->def('_DEL') . ' : ' . $name . '">' . '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . ' : ' . $name . '" /></a>';
         }
         $tb->addBody($cont);
     }
     if ($mod_perm) {
         $tb->addActionAdd('<a href="index.php?modname=reservation&amp;op=addclassroom" title="' . $lang->def('_TITLE_NEW_CLASSROOM') . '">' . '<img src="' . getPathImage() . 'standard/add.png" alt="' . $lang->def('_ADD') . '" />' . $lang->def('_NEW_CLASSROOM') . '</a>');
     }
     $out->add(getTitleArea($lang->def('_TITLE_CLASSROOM'), 'classroom', $lang->def('_ALT_TITLE_CLASSROOM')) . '<div class="std_block">');
     if (isset($_GET['result'])) {
         switch ($_GET['result']) {
             case "ok":
                 $out->add(getResultUi($lang->def('_OPERATION_SUCCESSFUL')));
                 break;
             case "err":
                 $out->add(getErrorUi($lang->def('_OPERATION_FAILURE')));
                 break;
             case "err_del":
                 $out->add(getErrorUi($lang->def('_OPERATION_FAILURE')));
                 break;
         }
     }
     $out->add(getBackUi('index.php?modname=reservation&amp;op=reservation&amp;active_tab=subscribed_user', $lang->def('_BACK')));
     $out->add($tb->getTable() . $tb->getNavBar($ini, $tot_classroom) . '</div>');
 }
Пример #14
0
function manmodule()
{
    checkPerm('view');
    require_once _base_ . '/lib/lib.table.php';
    $out =& $GLOBALS['page'];
    $lang =& DoceboLanguage::createInstance('manmenu', 'framework');
    $mo_lang =& DoceboLanguage::createInstance('menu', 'lms');
    $menu_lang =& DoceboLanguage::createInstance('menu_course', 'lms');
    $mod_perm = checkPerm('mod', true);
    // Find main voice info
    $id_main = Get::req('id_main', DOTY_INT, 0);
    $query_custom = "\r\n\tSELECT name \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_menucourse_main \r\n\tWHERE idMain = '" . (int) $id_main . "'";
    list($title_main) = sql_fetch_row(sql_query($query_custom));
    // Find all modules in this voice
    $query_module = "\r\n\tSELECT module.idModule, module.default_name, menu.my_name, menu.sequence, module.module_name\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_menucourse_under AS menu JOIN\r\n\t\t" . $GLOBALS['prefix_lms'] . "_module AS module\r\n\tWHERE module.idModule = menu.idModule AND menu.idMain = '" . (int) $id_main . "' \r\n\tORDER BY menu.sequence";
    $re_module = sql_query($query_module);
    $tot_module = mysql_num_rows($re_module);
    $used_module = '';
    $query_used_module = "\r\n\tSELECT module.idModule \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_menucourse_under AS menu JOIN \r\n\t\t" . $GLOBALS['prefix_lms'] . "_module AS module \r\n\tWHERE module.idModule = menu.idModule AND \r\n\t\t( menu.idCourse = '" . $_SESSION['idCourse'] . "' OR menu.idCourse = 0 )";
    $re_used_module = sql_query($query_used_module);
    while (list($id_mod_used) = sql_fetch_row($re_used_module)) {
        $used_module .= $id_mod_used . ',';
    }
    $query_free_module = "\r\n\tSELECT idModule, default_name \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_module AS module \r\n\tWHERE module_info = '' AND idModule NOT IN ( " . substr($used_module, 0, -1) . " )";
    $re_free_module = sql_query($query_free_module);
    $tb = new Table(0, $lang->def('_TB_MANMODULE_CAPTION'), $lang->def('_TB_MANMODULE_SUMMARY'));
    $content_h = array($lang->def('_ORDER'), $lang->def('_TITLE_MODULE'), '<img src="' . getPathImage() . 'standard/down.png" title="' . $lang->def('_MOVE_DOWN') . '" alt="' . $lang->def('_DOWN') . '" />', '<img src="' . getPathImage() . 'standard/up.png" title="' . $lang->def('_MOVE_UP') . '" alt="' . $lang->def('_UP') . '" />');
    $type_h = array('image', '', 'image', 'image');
    if ($mod_perm) {
        $content_h[] = '<img src="' . getPathImage() . 'standard/edit.png" title="' . $lang->def('_EDIT_SETTINGS') . '"' . ' alt="' . $lang->def('_MOD') . '" />';
        $type_h[] = 'image';
        $content_h[] = $lang->def('_DEL');
        $type_h[] = 'image';
    }
    $tb->setColsStyle($type_h);
    $tb->addHead($content_h);
    $i = 0;
    while (list($id_mod, $name_db, $my_name, $sequence, $module_name) = sql_fetch_row($re_module)) {
        $name = $my_name != '' ? $my_name : $menu_lang->def($name_db);
        $strip_name = strip_tags($name);
        $content = array($sequence, $name);
        $content[] = $i != $tot_module - 1 ? '<a href="index.php?modname=manmenu&amp;op=mdmodule&amp;id_main=' . $id_main . '&amp;id_module=' . $id_mod . '"' . ' title="' . $lang->def('_MOVE_DOWN') . ' : ' . $strip_name . '">' . '<img src="' . getPathImage() . 'standard/down.png" alt="' . $lang->def('_DOWN') . '" /></a>' : '';
        $content[] = $i != 0 ? '<a href="index.php?modname=manmenu&amp;op=mumodule&amp;id_main=' . $id_main . '&amp;id_module=' . $id_mod . '"' . ' title="' . $lang->def('_MOVE_UP') . ' : ' . $strip_name . '">' . '<img src="' . getPathImage() . 'standard/up.png" alt="' . $lang->def('_UP') . '" /></a>' : '';
        if ($mod_perm) {
            $content[] = '<a href="index.php?modname=manmenu&amp;op=modmodule&amp;id_main=' . $id_main . '&amp;id_module=' . $id_mod . '"' . ' title="' . $lang->def('_EDIT_SETTINGS') . ' : ' . $strip_name . '">' . '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . '" /></a>';
            if ($module_name != 'manmenu') {
                $content[] = '<a href="index.php?modname=manmenu&amp;op=delmodule&amp;id_main=' . $id_main . '&amp;id_module=' . $id_mod . '"' . ' title="' . $lang->def('_DEL') . ' : ' . $strip_name . '">' . $lang->def('_DEL') . '</a>';
            } else {
                $content[] = '';
            }
        }
        $tb->addBody($content);
        $i++;
    }
    if ($mod_perm) {
        require_once _base_ . '/lib/lib.dialog.php';
        setupHrefDialogBox('a[href*=delmodule]');
    }
    $tb_free = new Table(0, $lang->def('_TB_FREE_MANMODULE_CAPTION'), $lang->def('_NOT_ASSIGNED'));
    $c_free_h = array($lang->def('_TITLE_MODULE'));
    $t_free_h = array('');
    if ($mod_perm) {
        $c_free_h[] = $lang->def('_ASSIGN');
        $t_free_h[] = 'image';
    }
    $tb_free->setColsStyle($t_free_h);
    $tb_free->addHead($c_free_h);
    while (list($id_import_mod, $name_db) = sql_fetch_row($re_free_module)) {
        $name = $menu_lang->def($name_db);
        $strip_name = strip_tags($name);
        $content = array($name);
        if ($mod_perm) {
            $content[] = '<a href="index.php?modname=manmenu&amp;op=addmodule&amp;id_main=' . $id_main . '&amp;id_module=' . $id_import_mod . '"' . ' title="' . $lang->def('_TITLE_GRABMODULE') . ' : ' . $strip_name . '">' . $lang->def('_ASSIGN') . '</a>';
        }
        $tb_free->addBody($content);
    }
    // print out
    $out->setWorkingZone('content');
    $page_title = array('index.php?modname=manmenu&amp;op=manmenu' => $lang->def('_TITLE_MANMENU'), Lang::t($title_main, 'menu', false, false, $title_main));
    $out->add(getTitleArea($page_title, 'manmenu') . '<div class="std_block">' . getBackUi('index.php?modname=manmenu&amp;op=manmenu', $lang->def('_BACK')));
    if (isset($_GET['result'])) {
        switch ($_GET['result']) {
            case 0:
                $out->add(getResultUi($lang->def('_OPERATION_FAILURE')));
                break;
            case 1:
                $out->add(getResultUi($lang->def('_OPERATION_SUCCESSFUL')));
                break;
        }
    }
    $out->add($tb->getTable() . '[ <a href="index.php?modname=manmenu&amp;op=fixmodule&amp;id_main=' . $id_main . '" ' . 'title="' . $lang->def('_FIX_SEQUENCE') . '">' . $lang->def('_FIX_SEQUENCE') . '</a> ]' . '<br /><br />' . (mysql_num_rows($re_free_module) != false ? $tb_free->getTable() : '') . '</div>');
}
Пример #15
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');
}
Пример #16
0
function message()
{
    checkPerm('view');
    require_once _base_ . '/lib/lib.table.php';
    require_once _base_ . '/lib/lib.form.php';
    require_once _base_ . '/lib/lib.user_profile.php';
    require_once $GLOBALS['where_framework'] . '/lib/lib.tags.php';
    $tags = new Tags('lms_forum');
    $tags->setupJs('a[id^=handler-tags-]', 'a[id^=private-handler-tags-]');
    require_once _base_ . '/lib/lib.dialog.php';
    setupHrefDialogBox('a[href*=delmessage]');
    $lang =& DoceboLanguage::createInstance('forum', 'lms');
    $id_thread = importVar('idThread', true, 0);
    $sema_perm = checkPerm('sema', true);
    $moderate = checkPerm('moderate', true);
    $mod_perm = checkPerm('mod', true);
    $write_perm = checkPerm('write', true);
    $acl_man =& Docebo::user()->getAclManager();
    $profile_man = new UserProfile(0);
    $profile_man->init('profile', 'framework', 'index.php?modname=forum&op=forum');
    $tb = new Table(Get::sett('visuItem'), $lang->def('_CAPTION_FORUM_MESSAGE'), $lang->def('_CAPTION_FORUM_MESSAGE'));
    $tb->initNavBar('ini', 'link');
    $tb->setLink('index.php?modname=forum&amp;op=message&amp;idThread=' . $id_thread);
    $ini = $tb->getSelectedElement();
    $ini_page = $tb->getSelectedPage();
    $first_unread_message = importVar('firstunread', true, 0);
    $ini_first_unread_message = importVar('ini', true, 0);
    $set_important = importVar('important', true, 0);
    if ($set_important == 1) {
        $query_set_important = "UPDATE " . $GLOBALS['prefix_lms'] . "_forumthread" . " SET rilevantForum = 1" . " WHERE idThread = '" . $id_thread . "'";
        $result_set_important = sql_query($query_set_important);
    }
    if ($set_important == 2) {
        $query_set_important = "UPDATE " . $GLOBALS['prefix_lms'] . "_forumthread" . " SET rilevantForum = 0" . " WHERE idThread = '" . $id_thread . "'";
        $result_set_important = sql_query($query_set_important);
    }
    // Some info about forum and thread
    $thread_query = "\r\n\tSELECT idForum, title, num_post, locked, erased, rilevantForum\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_forumthread\r\n\tWHERE idThread = '" . $id_thread . "'";
    list($id_forum, $thread_title, $tot_message, $locked_t, $erased_t, $is_important) = sql_fetch_row(sql_query($thread_query));
    $forum_query = "\r\n\tSELECT title, locked\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_forum\r\n\tWHERE idForum = '" . $id_forum . "'";
    list($forum_title, $locked_f) = sql_fetch_row(sql_query($forum_query));
    ++$tot_message;
    //set as readed if needed
    if (isset($_SESSION['unreaded_forum'][$_SESSION['idCourse']][$id_forum][$id_thread])) {
        unset($_SESSION['unreaded_forum'][$_SESSION['idCourse']][$id_forum][$id_thread]);
    }
    if ($ini == 0 && !isset($_GET['result'])) {
        sql_query("\r\n\t\tUPDATE " . $GLOBALS['prefix_lms'] . "_forumthread\r\n\t\tSET num_view = num_view + 1\r\n\t\tWHERE idThread = '" . $id_thread . "'");
    }
    $page_title = array('index.php?modname=forum&amp;op=forum' => $lang->def('_FORUM'), 'index.php?modname=forum&amp;op=thread&amp;idForum=' . $id_forum => $forum_title, $thread_title);
    if ($erased_t && !$mod_perm && !$moderate) {
        $GLOBALS['page']->add(getTitleArea($page_title, 'forum') . '<div class="std_block">' . $lang->def('_CANNOTENTER') . '</div>', 'content');
        return;
    }
    // Who have semantic evaluation
    $re_sema = sql_query("\r\n\tSELECT DISTINCT idmsg\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_forum_sema");
    while (list($msg_sema) = sql_fetch_row($re_sema)) {
        $forum_sema[$msg_sema] = 1;
    }
    // Find post
    $messages = array();
    $authors = array();
    $authors_names = array();
    $authors_info = array();
    $re_message = sql_query("\r\n\tSELECT idMessage, posted, title, textof, attach, locked, author, modified_by, modified_by_on\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_forummessage\r\n\tWHERE idThread = '" . $id_thread . "'\r\n\tORDER BY posted\r\n\tLIMIT {$ini}, " . Get::sett('visuItem'));
    while ($record = mysql_fetch_assoc($re_message)) {
        $messages[$record['idMessage']] = $record;
        $authors[$record['author']] = $record['author'];
        if ($record['modified_by'] != 0) {
            $authors[$record['modified_by']] = $record['modified_by'];
        }
        $tag_resource_list[] = $record['idMessage'];
    }
    $authors_names =& $acl_man->getUsers($authors);
    $level_name = CourseLevel::getLevels();
    //tags
    $tags->loadResourcesTags($tag_resource_list);
    // Retriving level and number of post of the authors
    if (!empty($authors)) {
        $re_num_post = sql_query("\r\n\t\tSELECT u.idUser, u.level, COUNT(*)\r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_forummessage AS m, " . $GLOBALS['prefix_lms'] . "_courseuser AS u\r\n\t\tWHERE u.idCourse = '" . (int) $_SESSION['idCourse'] . "' AND m.author = u.idUser AND m.author IN ( " . implode($authors, ',') . " )\r\n\t\tGROUP BY u.idUser, u.level");
        while (list($id_u, $level_u, $num_post_a) = sql_fetch_row($re_num_post)) {
            $authors_info[$id_u] = array('num_post' => $num_post_a, 'level' => $level_name[$level_u]);
        }
        $profile_man->setCahceForUsers($authors);
    }
    $type_h = array('forum_sender', 'forum_text');
    $cont_h = array($lang->def('_AUTHOR'), $lang->def('_TEXTOF'));
    $tb->setColsStyle($type_h);
    $tb->addHead($cont_h);
    // Compose messagges display
    $path = $GLOBALS['where_files_relative'] . '/appCore/' . Get::sett('pathphoto');
    $counter = 0;
    while (list($id_message, $message_info) = each($messages)) {
        $counter++;
        // sender info
        $m_author = $message_info['author'];
        //if(isset($authors_names[$m_author]) && $authors_names[$m_author][ACL_INFO_AVATAR] != '') $img_size = @getimagesize($path.$authors_names[$m_author][ACL_INFO_AVATAR]);
        $profile_man->setIdUser($m_author);
        $author = $profile_man->getUserPanelData(false, 'normal');
        $sender = '';
        $sender = '<div class="forum_author">';
        $sender .= $author['actions'] . $author['display_name'] . (isset($authors_info[$m_author]) ? '<div class="forum_level">' . $authors_info[$m_author]['level'] . '</div>' : '') . '<br/>' . $author['avatar'] . '<div class="forum_numpost">' . $lang->def('_NUMPOST') . ' : ' . (isset($authors_info[$m_author]['num_post']) ? $authors_info[$m_author]['num_post'] : 0) . '</div>' . '<a class="ico-wt-sprite subs_user" href="index.php?modname=forum&amp;op=viewprofile&amp;idMessage=' . $id_message . '&amp;ini=' . $ini_page . '&amp;idThread=' . $id_thread . '">' . '<span>' . $lang->def('_VIEW_PROFILE') . '</span></a>';
        /*.( isset($authors_names[$m_author]) && $authors_names[$m_author][ACL_INFO_AVATAR] != ''
        		? '<img class="forum_avatar'.( $img_size[0] > 150 || $img_size[1] > 150 ? ' image_limit' : '' ).'" src="'.$path.$authors_names[$m_author][ACL_INFO_AVATAR].'" alt="'.$lang->def('_AVATAR').'" />'
        		: '' )*/
        /*
        .( isset($authors_names[$m_author])
        	?( $authors_names[$m_author][ACL_INFO_LASTNAME].$authors_names[$m_author][ACL_INFO_FIRSTNAME] == '' ?
        		$acl_man->relativeId($authors_names[$m_author][ACL_INFO_USERID]) :
        		$authors_names[$m_author][ACL_INFO_LASTNAME].' '.$authors_names[$m_author][ACL_INFO_FIRSTNAME] )
        	: $lang->def('_UNKNOWN_AUTHOR') )
        */
        /*.'<img src="'.getPathImage().'standard/identity.png" alt="&gt;" />&nbsp;'
        			.'<a href="index.php?modname=forum&amp;op=viewprofile&amp;idMessage='.$id_message.'&amp;ini='.$ini_page.'">'.$lang->def('_VIEW_PROFILE').'</a>';
        		*/
        // msg info
        $msgtext = '';
        if ($counter == $first_unread_message) {
            $msgtext .= '<a name="firstunread"></a><div class="forum_post_posted">';
        } else {
            $msgtext .= '<div class="forum_post_posted">';
        }
        $msgtext .= '<a id="' . $id_message . '" name="' . $id_message . '"></a>';
        $msgtext .= $lang->def('_DATE') . ' : ' . Format::date($message_info['posted']) . ' ( ' . loadDistance($message_info['posted']) . ' )' . '</div>';
        if ($message_info['locked']) {
            $msgtext .= '<div class="forum_post_locked">' . $lang->def('_LOCKEDMESS') . '</div>';
        } else {
            if ($message_info['attach'] != '') {
                $msgtext .= '<div class="forum_post_attach">' . '<a href="index.php?modname=forum&amp;op=download&amp;id=' . $id_message . '">' . $lang->def('_ATTACHMENT') . ' : ' . '<img src="' . getPathImage() . mimeDetect($message_info['attach']) . '" alt="' . $lang->def('_ATTACHMENT') . '" /></a>' . '</div>';
            }
            $msgtext .= '<div class="forum_post_title">' . $lang->def('_SUBJECT') . ' : ' . $message_info['title'] . '</div>';
            $msgtext .= '<div class="forum_post_text">' . str_replace('[quote]', '<blockquote class="forum_quote">', str_replace('[/quote]', '</blockquote>', $message_info['textof'])) . '</div>';
            if ($message_info['modified_by'] != 0) {
                $modify_by = $message_info['modified_by'];
                $msgtext .= '<div class="forum_post_modified_by">' . $lang->def('_MODIFY_BY') . ' : ' . (isset($authors_names[$m_author]) ? $authors_names[$modify_by][ACL_INFO_LASTNAME] . $authors_names[$modify_by][ACL_INFO_FIRSTNAME] == '' ? $acl_man->relativeId($authors_names[$modify_by][ACL_INFO_USERID]) : $authors_names[$modify_by][ACL_INFO_LASTNAME] . ' ' . $authors_names[$modify_by][ACL_INFO_FIRSTNAME] : $lang->def('_UNKNOWN_AUTHOR')) . ' ' . $lang->def('_ON') . ' : ' . Format::date($message_info['modified_by_on']) . '</div>';
            }
            if (isset($authors_names[$m_author]) && $authors_names[$m_author][ACL_INFO_SIGNATURE] != '') {
                $msgtext .= '<div class="forum_post_sign_separator"></div>' . '<div class="forum_post_sign">' . $authors_names[$m_author][ACL_INFO_SIGNATURE] . '</div>';
            }
            $strip_text = strip_tags($message_info['textof']);
            $msgtext .= '<div class="tags align-right">' . $tags->showTags($id_message, 'tags-', $message_info['title'], substr($strip_text, 0, 200) . (strlen($strip_text) > 200 ? '...' : ''), 'index.php?modname=forum&op=message&idThread=' . $id_thread . '&ini=' . $ini_page . '#' . $id_message) . '</div>';
        }
        $content = array($sender, $msgtext);
        $tb->addBody($content);
        // some action that you can do with this message
        $action = '';
        /*if($sema_perm) {
        			if(isset($forum_sema[$id_message])) $img_sema = 'sema_check';
        			else $img_sema = 'sema';
        			$action .= '<a href="index.php?modname=forum&amp;op=editsema&amp;idMessage='.$id_message.'&amp;ini='.$ini_page.'" '
        					.'title="'.$lang->def('_MOD').' : '.strip_tags($message_info['title']).'">'
        				.'<img src="'.getPathImage().'forum/'.$img_sema.'.gif" alt="'.$lang->def('_MOD').' : '.strip_tags($message_info['title']).'" /> '
        				.$lang->def('_SEMATAG').'</a> ';
        		}*/
        if ($moderate || $mod_perm) {
            if ($message_info['locked']) {
                $action .= '<a href="index.php?modname=forum&amp;op=moderatemessage&amp;idMessage=' . $id_message . '&amp;ini=' . $ini_page . '" ' . 'title="' . $lang->def('_DEMODERATE') . ' : ' . strip_tags($message_info['title']) . '">' . '<img src="' . getPathImage() . 'standard/demoderate.png" alt="' . $lang->def('_DEMODERATE') . ' : ' . strip_tags($message_info['title']) . '" /> ' . $lang->def('_DEMODERATE') . '</a> ';
            } else {
                $action .= '<a href="index.php?modname=forum&amp;op=moderatemessage&amp;idMessage=' . $id_message . '&amp;ini=' . $ini_page . '" ' . 'title="' . $lang->def('_MODERATE') . ' : ' . strip_tags($message_info['title']) . '">' . '<img src="' . getPathImage() . 'standard/moderate.png" alt="' . $lang->def('_MODERATE') . ' : ' . strip_tags($message_info['title']) . '" /> ' . $lang->def('_MODERATE') . '</a> ';
            }
        }
        if (!$locked_t && !$locked_f && !$message_info['locked'] && $write_perm) {
            $action .= '<a href="index.php?modname=forum&amp;op=addmessage&amp;idThread=' . $id_thread . '&amp;idMessage=' . $id_message . '&amp;ini=' . $ini_page . '" ' . 'title="' . $lang->def('_REPLY') . ' : ' . strip_tags($message_info['title']) . '">' . '<img src="' . getPathImage() . 'standard/reply.png" alt="' . $lang->def('_REPLY') . ' : ' . strip_tags($message_info['title']) . '" /> ' . $lang->def('_QUOTE') . '</a>';
        }
        if ($moderate || $mod_perm || $m_author == getLogUserId()) {
            $action .= '<a href="index.php?modname=forum&amp;op=modmessage&amp;idMessage=' . $id_message . '&amp;ini=' . $ini_page . '" ' . 'title="' . $lang->def('_MOD_MESSAGE') . ' : ' . strip_tags($message_info['title']) . '">' . '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . ' : ' . strip_tags($message_info['title']) . '" /> ' . $lang->def('_MOD') . '</a>' . '<a href="index.php?modname=forum&amp;op=delmessage&amp;idMessage=' . $id_message . '&amp;ini=' . $ini_page . '" ' . 'title="' . $lang->def('_DEL') . ' : ' . strip_tags($message_info['title']) . '">' . '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . ' : ' . strip_tags($message_info['title']) . '" /> ' . $lang->def('_DEL') . '</a> ';
        }
        $tb->addBodyExpanded($action, 'forum_action');
    }
    $GLOBALS['page']->add(getTitleArea($page_title, 'forum') . '<div class="std_block">' . Form::openForm('search_forum', 'index.php?modname=forum&amp;op=search&amp;idThread=' . $id_thread) . '<div class="quick_search_form">' . '<label for="search_arg">' . $lang->def('_SEARCH_LABEL') . '</label> ' . Form::getInputTextfield('search_t', 'search_arg', 'search_arg', '', $lang->def('_SEARCH'), 255, '') . '<input class="search_b" type="submit" id="search_button" name="search_button" value="' . $lang->def('_SEARCH') . '" />' . '</div>' . Form::closeForm(), 'content');
    // NOTE: If notify request register it
    require_once $GLOBALS['where_framework'] . '/lib/lib.usernotifier.php';
    $can_notify = usernotifier_getUserEventStatus(getLogUserId(), 'ForumNewResponse');
    if (isset($_GET['notify']) && $can_notify) {
        if (issetNotify('thread', $id_thread, getLogUserId())) {
            $re = unsetNotify('thread', $id_thread, getLogUserId());
            $is_notify = !$re;
        } else {
            $re = setNotify('thread', $id_thread, getLogUserId());
            $is_notify = $re;
        }
        if ($re) {
            $GLOBALS['page']->add(getResultUi($lang->def('_NOTIFY_CHANGE_STATUS_CORRECT')), 'content');
        } else {
            $GLOBALS['page']->add(getErrorUi($lang->def('_NOTIFY_CHANGE_STATUS_FAILED')), 'content');
        }
    } elseif ($can_notify) {
        $is_notify = issetNotify('thread', $id_thread, getLogUserId());
    }
    $text_inner = '';
    if (!$locked_t && !$locked_f && $write_perm) {
        $text_inner .= '<a href="index.php?modname=forum&amp;op=addmessage&amp;idThread=' . $id_thread . '&amp;ini=' . $ini_page . '" title="' . $lang->def('_REPLY') . '" class="ico-wt-sprite subs_add">' . '<span>' . $lang->def('_REPLY') . '</span></a>';
    }
    if ($can_notify) {
        $text_inner .= '<a href="index.php?modname=forum&amp;op=message&amp;notify=1&amp;idThread=' . $id_thread . '&amp;ini=' . $ini_page . '" ' . (!$is_notify ? 'class="ico-wt-sprite fd_notice"><span>' . $lang->def('_NOTIFY_ME_FORUM') . '</span></a> ' : 'class="ico-wt-sprite fd_error"><span>' . $lang->def('_UNNOTIFY_ME_FORUM') . '</span></a> ') . '';
    }
    if ($moderate) {
        $text_inner .= ' <a href="index.php?modname=forum&amp;op=modstatusthread&amp;idThread=' . $id_thread . '&amp;ini=' . $ini_page . '">' . ($locked_t ? '<img src="' . getPathImage() . 'standard/msg_read.png" alt="' . $lang->def('_FREE') . '" /> ' . $lang->def('_FREETHREAD') : '<img src="' . getPathImage() . 'standard/locked.png" alt="' . $lang->def('_LOCKTHREAD') . '" /> ' . $lang->def('_LOCKTHREAD')) . '</a>';
    }
    if ($mod_perm) {
        $text_inner .= ' <a href="index.php?modname=forum&amp;op=changeerased&amp;idThread=' . $id_thread . '&amp;ini=' . $ini_page . '">' . ($erased_t ? '<img src="' . getPathImage() . 'standard/msg_read.png" alt="' . $lang->def('_UNERASE') . '" /> ' . $lang->def('_UNERASE') : '<img src="' . getPathImage() . 'standard/moderate.png" alt="' . $lang->def('_MODERATE') . '" /> ' . $lang->def('_MODERATE')) . '</a>';
    }
    if (checkPerm('moderate', true) || checkPerm('mod', true)) {
        if ($is_important) {
            $text_inner .= ' <a href="index.php?modname=forum&op=message&amp;idThread=' . $id_thread . '&amp;ini=' . $ini_page . '&amp;important=2"><img src="' . getPathImage() . 'standard/notimportant.png" alt="' . $lang->def('_SET_NOT_IMPORTANT_THREAD') . '" /> ' . $lang->def('_SET_NOT_IMPORTANT_THREAD') . '</a>';
        } else {
            $text_inner .= ' <a href="index.php?modname=forum&op=message&amp;idThread=' . $id_thread . '&amp;ini=' . $ini_page . '&amp;important=1"><img src="' . getPathImage() . 'standard/important.png" alt="' . $lang->def('_MARK_AS_IMPORTANT') . '" /> ' . $lang->def('_MARK_AS_IMPORTANT') . '</a>';
        }
    }
    if ($text_inner != '') {
        $tb->addActionAdd($text_inner);
    }
    $GLOBALS['page']->add($tb->getNavBar($ini, $tot_message), 'content');
    $GLOBALS['page']->add($tb->getTable(), 'content');
    $GLOBALS['page']->add($tb->getNavBar($ini, $tot_message) . '</div>', 'content');
}
Пример #17
0
function chooselevel()
{
    checkPerm('subscribe', false, 'course');
    require_once $GLOBALS['where_lms'] . '/lib/lib.course.php';
    require_once _base_ . '/lib/lib.form.php';
    require_once _base_ . '/lib/lib.table.php';
    require_once _base_ . '/lib/lib.userselector.php';
    $id_course = importVar('id_course', true, 0);
    $course_info = Man_Course::getCourseInfo($id_course);
    $edition_id = getCourseEditionId();
    if ($edition_id > 0) {
        $edition_info = Man_Course::getEditionInfo($edition_id, $id_course);
        $course_info = $edition_info + $course_info;
    }
    $out =& $GLOBALS['page'];
    $acl_man =& Docebo::user()->getAclManager();
    $lang =& DoceboLanguage::CreateInstance('subscribe', 'lms');
    $levels = CourseLevel::getLevels();
    // Find limitation
    $can_subscribe = true;
    $max_num_subscribe = $course_info['max_num_subscribe'];
    $subscribe_method = $course_info['subscribe_method'];
    if (Docebo::user()->getUserLevelId() != ADMIN_GROUP_GODADMIN) {
        $limited_subscribe = Docebo::user()->preference->getAdminPreference('admin_rules.limit_course_subscribe');
        $max_subscribe = Docebo::user()->preference->getAdminPreference('admin_rules.max_course_subscribe');
        $direct_subscribe = Docebo::user()->preference->getAdminPreference('admin_rules.direct_course_subscribe');
        if ($limited_subscribe == 'on') {
            $limited_subscribe = true;
        } else {
            $limited_subscribe = false;
        }
        if ($direct_subscribe == 'on') {
            $direct_subscribe = true;
        } else {
            $direct_subscribe = false;
        }
    } else {
        $limited_subscribe = false;
        $max_subscribe = 0;
        $direct_subscribe = true;
    }
    // Print page
    $page_title = array('index.php?modname=course&amp;op=course_list' => $lang->def('_COURSES'), $lang->def('_SUBSCRIBE'), $course_info['name']);
    $GLOBALS['page']->add(getTitleArea($page_title, 'subscribe') . '<div class="std_block">' . getBackUi('index.php?modname=course&amp;op=course_list', $lang->def('_BACK')), 'content');
    // User selected
    $user_alredy_subscribed = getSubscribed($id_course, FALSE, FALSE, FALSE, $edition_id);
    $num_all_user = count($user_alredy_subscribed);
    if (!isset($_POST['user_level_sel'])) {
        $user_select = new UserSelector();
        $entity_selected = $user_select->getSelection($_POST);
        // convert to user only
        $user_selected =& $acl_man->getAllUsersFromIdst($entity_selected);
        $user_selected = array_diff($user_selected, $user_alredy_subscribed);
        $num_selected = count($user_selected);
    } else {
        $num_selected = 0;
        $user_selected = array();
        while (list($id_user, $lv) = each($_POST['user_level_sel'])) {
            $user_selected[$id_user] = $id_user;
            if ($lv != 0) {
                $num_selected++;
            }
        }
        reset($_POST['user_level_sel']);
    }
    $user_selected_info =& $acl_man->getUsers($user_selected);
    if ($num_selected == 0) {
        $GLOBALS['page']->add($lang->def('_EMPTY_SELECTION') . '</div>', 'content');
        return;
    }
    if ($subscribe_method != 3 && !$direct_subscribe) {
        $GLOBALS['page']->add(getResultUi($lang->def('_BEFORE_THIS_APPROVE') . '<br />'), 'content');
    }
    if (isset($_POST['subscribe']) && $can_subscribe) {
        // do subscription
        //retrive id of group of the course for the varioud level
        $level_idst =& getCourseLevel($id_course);
        if (count($level_idst) == 0) {
            //if the group doesn't exists create it
            $level_idst =& DoceboCourse::createCourseLevel($id_course);
        }
        // Subscirbing user
        $waiting = 0;
        $user_subscribed = array();
        $user_waiting = array();
        if ($subscribe_method != 3 && !$direct_subscribe) {
            $waiting = 1;
        }
        while (list($id_user, $lv_sel) = each($_POST['user_level_sel'])) {
            if (!$limited_subscribe || $max_subscribe) {
                if ($lv_sel != 0) {
                    // Add in group for permission
                    $acl_man->addToGroup($level_idst[$lv_sel], $id_user);
                    // Add to edition group
                    if ($edition_id > 0) {
                        $group = '/lms/course_edition/' . $edition_id . '/subscribed';
                        $group_idst = $acl_man->getGroupST($group);
                        if ($group_idst === FALSE) {
                            $group_idst = $acl_man->registerGroup($group, 'all the user of a course edition', true, "course");
                        }
                        $acl_man->addToGroup($group_idst, $id_user);
                    }
                    // Add in table
                    $re = sql_query("\r\n\t\t\t\t\tINSERT INTO " . $GLOBALS['prefix_lms'] . "_courseuser\r\n\t\t\t\t\t( idUser, idCourse, edition_id, level, waiting, subscribed_by, date_inscr )\r\n\t\t\t\t\tVALUES\r\n\t\t\t\t\t( '" . $id_user . "', '" . $id_course . "', '" . $edition_id . "', '" . $lv_sel . "', '" . $waiting . "', '" . getLogUserId() . "', '" . date("Y-m-d H:i:s") . "' )\t");
                    if ($re) {
                        if ($waiting) {
                            $user_waiting[] = $id_user;
                        } else {
                            $user_subscribed[] = $id_user;
                        }
                        addUserToTimeTable($id_user, $id_course, $edition_id);
                    }
                }
                $max_subscribe--;
            }
        }
        //end while
        Docebo::user()->loadUserSectionST('/lms/course/private/');
        Docebo::user()->SaveInSession();
        require_once _base_ . '/lib/lib.eventmanager.php';
        $array_subst = array('[url]' => Get::sett('url'), '[course]' => $course_info['name'], '[medium_time]' => $course_info['mediumTime'], '[course_name]' => $course_info['name'], '[course_code]' => $course['code']);
        if (!empty($user_subscribed)) {
            // message to user subscribed
            $msg_composer = new EventMessageComposer();
            $msg_composer->setSubjectLangText('email', '_NEW_USER_SUBSCRIBED_SUBJECT', false);
            $msg_composer->setBodyLangText('email', '_NEW_USER_SUBSCRIBED_TEXT', $array_subst);
            $msg_composer->setBodyLangText('sms', '_NEW_USER_SUBSCRIBED_TEXT_SMS', $array_subst);
            // send message to the user subscribed
            createNewAlert('UserCourseInserted', 'subscribe', 'insert', '1', 'User subscribed', $user_subscribed, $msg_composer);
        }
        if (!empty($user_waiting)) {
            // message to user that is waiting
            $msg_composer = new EventMessageComposer();
            $msg_composer->setSubjectLangText('email', '_NEW_USER_SUBS_WAITING_SUBJECT', false);
            $msg_composer->setBodyLangText('email', '_NEW_USER_SUBS_WAITING_TEXT', $array_subst);
            $msg_composer->setBodyLangText('sms', '_NEW_USER_SUBS_WAITING_TEXT_SMS', $array_subst);
            // send message to the user subscribed
            createNewAlert('UserCourseInsertModerate', 'subscribe', 'insert', '1', 'User subscribed with moderation', $user_waiting, $msg_composer);
        }
        if (Docebo::user()->getUserLevelId() != ADMIN_GROUP_GODADMIN) {
            Docebo::user()->preference->setPreference('admin_rules.max_course_subscribe', $max_subscribe);
        }
        backcourse('ok_subs');
    }
    $GLOBALS['page']->add(Form::openForm('levelselection', 'index.php?modname=subscribe&amp;op=chooselevel') . Form::getHidden('id_course', 'id_course', $id_course) . Form::getHidden('edition_id', 'edition_id', $edition_id), 'content');
    $tb = new Table(0, $lang->def('_CAPTION_SELECT_LEVELS'), $lang->def('_SUMMARY_SELECT_LEVEL'));
    $type_h = array('image', '', '');
    $img = '<img src="' . getPathImage('fw') . 'standard/warning_triangle.png" ';
    $img .= 'alt="' . $lang->def("_USER_IS_BUSY") . '" title="' . $lang->def("_USER_IS_BUSY") . '" />';
    $content_h = array($img, $lang->def('_USERNAME'), $lang->def('_FULLNAME'));
    foreach ($levels as $lv => $lv_name) {
        $type_h[] = 'image';
        $content_h[] = '<a href="javascript:SelAll(\'' . $lv . '\');">' . $lv_name . '</a>';
    }
    $type_h[] = 'image';
    $content_h[] = $lang->def('_CANCEL');
    $tb->addHead($content_h, $type_h);
    if ($course_info["course_type"] === "elearning") {
        $busy_users = array();
    } else {
        require_once $GLOBALS['where_framework'] . "/lib/resources/lib.timetable.php";
        $tt = new TimeTable();
        $busy_users = $tt->getResourcesInUse("user", $course_info["date_begin"], $course_info["date_end"], TRUE);
    }
    $num_user_sel = 0;
    $enought_credit = true;
    reset($user_selected_info);
    $jsArr = "var elementi = new Array(";
    $i = 0;
    while ((list($id_user, $user_info) = each($user_selected_info)) && $enought_credit) {
        if ($i != 0) {
            $jsArr .= ",";
        }
        $i++;
        $jsArr .= "'" . $id_user . "'";
        // if the user isn't alredy subscribed to the course
        if (!isset($user_alredy_subscribed[$id_user])) {
            if (in_array($id_user, $busy_users)) {
                $img = '<img src="' . getPathImage('fw') . 'standard/warning_triangle.png" ';
                $img .= 'alt="' . $lang->def("_USER_IS_BUSY") . '" title="' . $lang->def("_USER_IS_BUSY") . '" />';
                $msg = $lang->def("_USER_IS_BUSY_MSG");
                $is_user_busy = $img;
                //."</a>";
            } else {
                $is_user_busy = "&nbsp;";
            }
            $content = array($is_user_busy, substr($user_info[ACL_INFO_USERID], 1), $user_info[ACL_INFO_LASTNAME] . ' ' . $user_info[ACL_INFO_FIRSTNAME]);
            foreach ($levels as $lv => $lv_name) {
                $content[] = Form::getInputRadio('user_level_sel_' . $id_user . '_' . $lv, 'user_level_sel[' . $id_user . ']', $lv, isset($_POST['user_level_sel']) ? $lv == $_POST['user_level_sel'][$id_user] : $lv == 3, '') . '<label class="access-only" for="user_level_sel_' . $id_user . '_' . $lv . '">' . $lv_name . '</label>';
            }
            $content[] = Form::getInputRadio('user_level_sel_' . $id_user . '_0', 'user_level_sel[' . $id_user . ']', 0, isset($_POST['user_level_sel']) ? 0 == $_POST['user_level_sel'][$id_user] : false, '') . '<label class="access-only" for="user_level_sel_' . $id_user . '_0">' . $lang->def('_CANCEL') . '</label>';
            $tb->addBody($content);
            $num_user_sel++;
        }
    }
    $GLOBALS['page']->add($tb->getTable(), 'content');
    $GLOBALS['page']->add(Form::openButtonSpace() . '<br />' . Form::getButton('subscribe', 'subscribe', $lang->def('_SUBSCRIBE')) . Form::getButton('cancelselector', 'cancelselector', $lang->def('_UNDO')) . Form::closeButtonSpace() . Form::closeForm(), 'content');
    $GLOBALS['page']->add('</div>', 'content');
    $GLOBALS['page']->add('
<script>
' . $jsArr . ');
function SelAll (lvl)
{
        var nb;
        ne = elementi.length;
        mod = document.getElementById(\'levelselection\');
        for (var i=0;i<ne;i++)
        {
                elem = \'user_level_sel_\'+elementi[i]+\'_\'+lvl;
                var e = document.getElementById(elem);
                e.checked = 1;
        }
}
</script>');
}
Пример #18
0
/**
 * Only for input. Special function.
 **/
function event_special_view($op)
{
    checkPerm('view_event_manager');
    require_once _base_ . '/lib/lib.table.php';
    //require_once(_i18n_.'/lib.lang.php');
    require_once _base_ . '/lib/lib.form.php';
    $lang =& DoceboLanguage::createInstance('event_manager', 'framework');
    $out =& $GLOBALS['page'];
    $form = new Form();
    $out->setWorkingZone('content');
    $out->add(getTitleArea($lang->def('_EVENT_MANAGER'), 'event_manager'));
    $out->add('<div class="std_block">');
    if ($op == 'special_save') {
        $arr_platform = $_POST['platform'];
        $arr_class = $_POST['class'];
        $arr_description = $_POST['description'];
        $arr_recipients = $_POST['recipients'];
        $arr_show_level = $_POST['show_level'];
        $idClass = 0;
        foreach ($arr_platform as $key => $platform) {
            if ($key == 0) {
                if ($platform != '') {
                    $result1 = sql_query("INSERT INTO " . $GLOBALS['prefix_fw'] . "_event_class " . " (platform,class,description) VALUES " . " ('" . $platform . "','" . $arr_class[$key] . "','" . $arr_description[$key] . "') ");
                    if ($result1 === FALSE) {
                        break;
                    }
                    $idClass = mysql_insert_id();
                    DoceboEventManager::registerEventConsumer(array($arr_class[$key]), 'DoceboUserNotifier', $GLOBALS['where_framework'] . '/lib/lib.usernotifier.php');
                    $result1 = sql_query("INSERT INTO " . $GLOBALS['prefix_fw'] . "_event_manager " . " (idClass,recipients,show_level) VALUES " . " ('" . $idClass . "','" . $arr_recipients[$key] . "','" . $arr_show_level[$key] . "') ");
                }
            } else {
                $result1 = sql_query("UPDATE " . $GLOBALS['prefix_fw'] . "_event_class " . "   SET platform='" . $platform . "'," . "       class='" . $arr_class[$key] . "'," . "       description='" . $arr_description[$key] . "'" . " WHERE idClass = '" . (int) $key . "'");
            }
            if ($result1 === FALSE) {
                break;
            }
        }
        foreach ($arr_recipients as $key => $recipients) {
            if ($key == 0) {
                // do nothing
            } else {
                $result2 = sql_query("UPDATE " . $GLOBALS['prefix_fw'] . "_event_manager " . "   SET recipients='" . $recipients . "'," . "       show_level='" . $arr_show_level[$key] . "'" . " WHERE idEventMgr = '" . (int) $key . "'");
            }
            if ($result1 === FALSE) {
                break;
            }
        }
        if ($result1 && $result2) {
            $out->add(getResultUi($lang->def('_OPERATION_SUCCESSFUL')));
        } else {
            $out->add(getErrorUi($lang->def('_ERROR_IN_SAVE')));
        }
    }
    $out->add($form->openForm('event_special_insert', 'index.php?modname=event_manager&amp;op=special_save'));
    $out->add($form->openElementSpace());
    $tb_event_classes = new Table(400, $lang->def('_EVENT_SETTINGS'), $lang->def('_EVENT_SETTINGS'));
    $content_h = array($lang->def('_EVENT_PLATFORM'), $lang->def('_NAME'), $lang->def('_DESCRIPTION'), $lang->def('_RECIPIENTS'), 'show_level');
    $type_h = array('', '', '', 'image', 'image', 'image', 'image', 'image', '');
    $tb_event_classes->setColsStyle($type_h);
    $tb_event_classes->addHead($content_h);
    $rs = sql_query("SELECT ec.idClass, class, platform, description, idEventMgr, recipients, show_level" . " FROM " . $GLOBALS['prefix_fw'] . "_event_class as ec" . " JOIN " . $GLOBALS['prefix_fw'] . "_event_manager as em" . " WHERE ec.idClass = em.idClass" . " ORDER BY ec.idClass");
    while (list($idClass, $class, $platform, $description, $idEventMgr, $recipients, $show_level) = sql_fetch_row($rs)) {
        $cont = array();
        $cont[] = $form->getInputTextfield('', 'platform_' . $idClass, 'platform[' . $idClass . ']', $platform, '', 50, '');
        $cont[] = $form->getInputTextfield('', 'class_' . $idClass, 'class[' . $idClass . ']', $class, '', 50, '');
        $cont[] = $form->getInputTextfield('', 'description_' . $idClass, 'description[' . $idClass . ']', $description, '', 50, '');
        $cont[] = $form->getInputTextfield('', 'recipients_' . $idEventMgr, 'recipients[' . $idEventMgr . ']', $recipients, '', 50, '');
        $cont[] = $form->getInputTextfield('', 'show_level_' . $idEventMgr, 'show_level[' . $idEventMgr . ']', $show_level, '', 50, '');
        $tb_event_classes->addBody($cont);
    }
    $cont = array();
    $cont[] = $form->getInputTextfield('', 'platform_0', 'platform[0]', '', '', 50, '');
    $cont[] = $form->getInputTextfield('', 'class_0', 'class[0]', '', '', 50, '');
    $cont[] = $form->getInputTextfield('', 'description_0', 'description[0]', '', '', 50, '');
    $cont[] = $form->getInputTextfield('', 'recipients_0', 'recipients[0]', '', '', 50, '');
    $cont[] = $form->getInputTextfield('', 'show_level_0', 'show_level[0]', '', '', 50, '');
    $tb_event_classes->addBody($cont);
    $out->add($tb_event_classes->getTable());
    $out->add($form->closeElementSpace());
    $out->add($form->openButtonSpace());
    $out->add($form->getButton('save', 'save', $lang->def('_SAVE')));
    $out->add($form->closeButtonSpace());
    $out->add($form->closeForm());
    $out->add('</div>');
}
Пример #19
0
function webpages()
{
    checkPerm('view');
    require_once _base_ . '/lib/lib.table.php';
    require_once _base_ . '/lib/lib.form.php';
    $mod_perm = checkPerm('mod', true);
    $lang =& DoceboLanguage::createInstance('admin_webpages', 'lms');
    $out =& $GLOBALS['page'];
    $out->setWorkingZone('content');
    $tb = new Table(0, $lang->def('_WEBPAGES_CAPTION'));
    $nav_bar = new NavBar('ini', Get::sett('visuItem'), 0, 'button');
    $ini = $nav_bar->getSelectedElement();
    //search query
    $query_pages = "\r\n\tSELECT idPages, title, publish, in_home, sequence \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_webpages \r\n\tORDER BY sequence \r\n\tLIMIT {$ini}," . Get::sett('visuItem');
    $num_query_pages = "\r\n\tSELECT COUNT(*) \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_webpages ";
    //do query
    $re_pages = sql_query($query_pages);
    list($tot_pages) = sql_fetch_row(sql_query($num_query_pages));
    $nav_bar->setElementTotal($tot_pages);
    //-Table---------------------------------------------------------
    $cont_h = array($lang->def('_TITLE'), '<img src="' . getPathImage() . 'webpages/home.png" alt="' . $lang->def('_ALT_HOME') . '" title="' . $lang->def('_TITLE_HOME') . '" />', '<img src="' . getPathImage() . 'standard/publish.png" alt="' . $lang->def('_PUBLISH') . '" title="' . $lang->def('_STATUS') . '" />');
    $type_h = array('', 'image', 'image', 'image');
    if ($mod_perm) {
        $cont_h[] = '<img src="' . getPathImage() . 'standard/down.png" alt="' . $lang->def('_DOWN') . '" title="' . $lang->def('_MOVE_DOWN') . '" />';
        $type_h[] = 'image';
        $cont_h[] = '<img src="' . getPathImage() . 'standard/up.png" alt="' . $lang->def('_UP') . '" title="' . $lang->def('_MOVE_UP') . '" />';
        $type_h[] = 'image';
        $cont_h[] = '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . '" title="' . $lang->def('_MOD') . '" />';
        $type_h[] = 'image';
        $cont_h[] = '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . '" title="' . $lang->def('_DEL') . '" />';
        $type_h[] = 'image';
    }
    $tb->setColsStyle($type_h);
    $tb->addHead($cont_h);
    $i = 1;
    while (list($id, $title, $publish, $in_home) = sql_fetch_row($re_pages)) {
        $cont = array($title, $in_home ? '<img src="' . getPathImage() . 'webpages/home.png" alt="' . $lang->def('_ALT_HOME') . '" title="' . $lang->def('_TITLE_HOME') . '" />' : '');
        if ($publish) {
            $cont[] = '<a href="index.php?modname=webpages&amp;op=unpublish&amp;id_page=' . $id . '" title="' . $lang->def('_PUBLISH') . ' : ' . $title . '">' . '<img src="' . getPathImage() . 'standard/publish.png" alt="' . $lang->def('_PUBLISH') . ' : ' . $title . '" /></a>';
        } else {
            $cont[] = '<a href="index.php?modname=webpages&amp;op=publish&amp;id_page=' . $id . '" title="' . $lang->def('_UNPUBLISH') . ' : ' . $title . '">' . '<img src="' . getPathImage() . 'standard/unpublish.png" alt="' . $lang->def('_UNPUBLISH') . ' : ' . $title . '" /></a>';
        }
        if ($mod_perm) {
            if ($i != $tot_pages - $ini * Get::sett('visuItem')) {
                $cont[] = '<a href="index.php?modname=webpages&amp;op=movedown&amp;id_page=' . $id . '" title="' . $lang->def('_MOVE_DOWN') . ' : ' . $title . '">' . '<img src="' . getPathImage() . 'standard/down.png" alt="' . $lang->def('_DOWN') . ' : ' . $title . '" /></a>';
            } else {
                $cont[] = '&nbsp;';
            }
            if ($i != 1 || $ini != 0) {
                $cont[] = '<a href="index.php?modname=webpages&amp;op=moveup&amp;id_page=' . $id . '" title="' . $lang->def('_MOVE_UP') . ' : ' . $title . '">' . '<img src="' . getPathImage() . 'standard/up.png" alt="' . $lang->def('_UP') . ' : ' . $title . '" /></a>';
            } else {
                $cont[] = '&nbsp;';
            }
            $cont[] = '<a href="index.php?modname=webpages&amp;op=modpages&amp;id_page=' . $id . '" title="' . $lang->def('_MOD') . ' : ' . $title . '">' . '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . ' : ' . $title . '" /></a>';
            $cont[] = '<a href="index.php?modname=webpages&amp;op=delpages&amp;id_page=' . $id . '" title="' . $lang->def('_DEL') . ' : ' . $title . '">' . '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . ' : ' . $title . '" /></a>';
        }
        $tb->addBody($cont);
        ++$i;
    }
    if ($mod_perm) {
        $tb->addActionAdd('<a class="ico-wt-sprite subs_add" href="index.php?modname=webpages&amp;op=addpages" title="' . Lang::t('_ADD', 'webpages') . '"><span>' . Lang::t('_ADD', 'webpages') . '</span></a>');
    }
    //visualize result
    $out->add(getTitleArea($lang->def('_TITLE_WEBPAGES'), 'webpages') . '<div class="std_block">');
    if (isset($_GET['result'])) {
        switch ($_GET['result']) {
            case "ok":
                $out->add(getResultUi($lang->def('_OPERATION_SUCCESSFUL')));
                break;
            case "err":
                $out->add(getErrorUi($lang->def('_OPERATION_FAILURE')));
                break;
            case "err_del":
                $out->add(getErrorUi($lang->def('_OPERATION_FAILURE')));
                break;
        }
    }
    $out->add($tb->getTable() . Form::openForm('nav_webpages', 'index.php?modname=webpages&amp;op=webpages') . $nav_bar->getNavBar($ini) . Form::closeForm() . '</div>');
    if ($mod_perm) {
        require_once _base_ . '/lib/lib.dialog.php';
        setupHrefDialogBox('a[href*=delpages]');
    }
}
Пример #20
0
function archiveList()
{
    require_once _base_ . '/lib/lib.table.php';
    $lang =& DoceboLanguage::createInstance('advice');
    $mod_perm = checkPerm('mod', true);
    $out = $GLOBALS['page'];
    $out->setWorkingZone('content');
    $nav_bar = new NavBar('ini', Get::sett('visuItem'), 0, 'button');
    $ini = $nav_bar->getSelectedElement();
    $query_my_arch_advice = "\r\n\t\tSELECT DISTINCT idAdvice\r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_adviceuser\r\n\t\tWHERE idUser = '******' AND archivied = '1'";
    $re_my_arch_advice = sql_query($query_my_arch_advice);
    while (list($id) = sql_fetch_row($re_my_arch_advice)) {
        $advice_arch[] = $id;
    }
    if (!empty($advice_arch)) {
        $query_advice = "\r\n\t\t\tSELECT idAdvice, posted, title, description, important, author\r\n\t\t\tFROM " . $GLOBALS['prefix_lms'] . "_advice\r\n\t\t\tWHERE idCourse='" . $_SESSION['idCourse'] . "' AND idAdvice IN ( " . implode($advice_arch, ',') . " )\r\n\t\t\tORDER BY posted DESC\r\n\t\t\tLIMIT {$ini}," . Get::sett('visuItem');
        $re_advice = sql_query($query_advice);
        list($numofadvice) = sql_fetch_row(sql_query("\r\n\t\t\tSELECT COUNT(DISTINCT idAdvice)\r\n\t\t\tFROM " . $GLOBALS['prefix_lms'] . "_advice\r\n\t\t\tWHERE idCourse='" . $_SESSION['idCourse'] . "' AND idAdvice IN ( " . implode($advice_arch, ',') . " )"));
        $nav_bar->setElementTotal($numofadvice);
        if (isset($_GET['result'])) {
            switch ($_GET['result']) {
                case "ok":
                    $out->add(getResultUi($lang->def('_OPERATION_SUCCESSFUL')));
                    break;
                case "err":
                    $out->add(getErrorUi($lang->def('_ERR_INSERT')));
                    break;
                case "err_user":
                    $out->add(getErrorUi($lang->def('_OPERATION_FAILURE')));
                    break;
            }
        }
        while (list($idA, $posted, $title, $description, $impo, $author) = sql_fetch_row($re_advice)) {
            $out->add('<div class="list_block">' . '<h2 class="heading">');
            if ($impo) {
                $out->add('<img src="' . getPathImage() . 'standard/important.png" alt="' . $lang->def('_IMPORTANT') . '" /> ');
            } else {
                $out->add('');
            }
            $out->add($title . '</h2>' . '<div class="content"><p class="publish-date">' . Format::date($posted) . '</p>' . $description . '</div>' . '<div class="actions">');
            if ($mod_perm) {
                $out->add('<ul class="link_list_inline">' . '<li><a class="ico-wt-sprite subs_users" href="index.php?modname=advice&amp;op=modreader&amp;id_advice=' . $idA . '&amp;load=1" title="' . $lang->def('_VIEW_PERMISSION') . ' : ' . $title . '">' . '<span>' . $lang->def('_MOD') . '</span></a></li>' . '<li><a class="ico-wt-sprite subs_mod" href="index.php?modname=advice&amp;op=modadvice&amp;idAdvice=' . $idA . '" title="' . $lang->def('_MOD') . ' : ' . $title . '">' . '<span>' . $lang->def('_MOD') . '</span></a></li>' . '<li><a class="ico-wt-sprite subs_del" href="index.php?modname=advice&amp;op=deladvice&amp;idAdvice=' . $idA . '" title="' . $lang->def('_DEL') . ' : ' . $title . '">' . '<span>' . $lang->def('_DEL') . '</span></a></li>' . '</ul>');
                require_once _base_ . '/lib/lib.dialog.php';
                setupHrefDialogBox('a[href*=deladvice]');
            }
            $out->add('</div>' . '</div><br />');
        }
    }
    $form = new Form();
    $out->add($form->getHidden('archive_status', 'archive_status', '1') . $nav_bar->getNavBar($ini));
}
Пример #21
0
function classroomToEdition()
{
    require_once _base_ . '/lib/lib.form.php';
    //require_once(_i18n_.'/lib.lang.php');
    require_once _base_ . '/lib/lib.table.php';
    require_once $GLOBALS['where_lms'] . '/lib/lib.course.php';
    if (isset($_POST['classroom_to_edition'])) {
        list($edition_id) = each($_POST['classroom_to_edition']);
    } else {
        $edition_id = importVar('edition_id', true, 0);
    }
    $of_loc = importVar('of_loc', false, '');
    $of_name = importVar('of_name', false, '');
    $form = new Form();
    $query_course_name = "SELECT idCourse, name\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_course_edition\r\n\tWHERE idCourseEdition = '" . $edition_id . "'";
    list($idCourse, $edition_name) = sql_fetch_row(sql_query($query_course_name));
    $lang =& DoceboLanguage::CreateInstance('course', 'lms');
    $tb = new Table(Get::sett('visuItem'), $lang->def('_CLASSROOMTOCOURSE_CAPTION'), $lang->def('_CLASSROOMTOCOURSE_CAPTION'));
    $tb->initNavBar('ini', 'link');
    $tb->setLink("index.php?modname=course&amp;op=classroom_to_edition&amp;edition_id={$edition_id}" . '&amp;of_loc=' . $of_loc . '&amp;of_name=' . $of_name);
    $ini = $tb->getSelectedElement();
    $checked_class = checkAvailableClass($idCourse, $edition_id);
    $classroom_order = "l.location, c.name ";
    if ($of_loc == 'loc') {
        $classroom_order = "l.location, c.name ";
    }
    if ($of_loc == 'locd') {
        $classroom_order = "l.location DESC, c.name ";
    }
    if ($of_name == 'name') {
        $classroom_order = "c.name, l.location ";
    }
    if ($of_name == 'namec') {
        $classroom_order = "c.name DESC, l.location ";
    }
    if ($of_loc == '' && $of_name == '') {
        $of_loc = 'loc';
    }
    //search query of classrooms ---------------------------------
    $query_classroom = "\r\n\tSELECT c.idClassroom, c.name, c.description, l.location\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_classroom AS c\r\n\t\tJOIN " . $GLOBALS['prefix_lms'] . "_class_location AS l\r\n\tWHERE l.location_id = c.location_id\r\n\tORDER BY " . $classroom_order . "\r\n\tLIMIT {$ini}," . Get::sett('visuItem');
    $re_classroom = sql_query($query_classroom);
    // search classrooms assigned --------------------------------
    $query_class_assigned = "\r\n\tSELECT classrooms\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_course_edition\r\n\twhere idCourseEdition= " . $edition_id . "";
    list($assigned_classroom) = sql_fetch_row(sql_query($query_class_assigned));
    $query_classroom_tot = "\r\n\tSELECT COUNT(*)\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_classroom ";
    list($tot_classroom) = sql_fetch_row(sql_query($query_classroom_tot));
    // table intestation
    $type_h = array('', '', '', 'image');
    $cont_h = array('<a href="' . "index.php?modname=course&amp;op=classroom_to_edition&amp;edition_id=" . $edition_id . "&amp;of_loc=" . ($of_loc == 'loc' ? 'locd' : 'loc') . '">' . ($of_loc == 'loc' ? '<img src="' . getPathImage() . '/standard/1downarrow.png" alt="' . $lang->def('_DEF_DOWN') . '" />' : ($of_loc == 'locd' ? '<img src="' . getPathImage() . '/standard/1uparrow.png" alt="' . $lang->def('_DEF_UP') . '" />' : '<img src="' . getPathImage() . '/standard/sort.png" alt="' . $lang->def('_DEF_SORT') . '" />')) . $lang->def('_LOCATION') . '</a>', '<a href="' . "index.php?modname=course&amp;op=classroom_to_edition&amp;edition_id=" . $edition_id . "&amp;of_name=" . ($of_name == 'name' ? 'named' : 'name') . '">' . ($of_name == 'name' ? '<img src="' . getPathImage() . '/standard/1downarrow.png" alt="' . $lang->def('_DEF_DOWN') . '" />' : ($of_name == 'named' ? '<img src="' . getPathImage() . '/standard/1uparrow.png" alt="' . $lang->def('_DEF_UP') . '" />' : '<img src="' . getPathImage() . '/standard/sort.png" alt="' . $lang->def('_DEF_SORT') . '" />')) . $lang->def('_CLASSROOM', 'course') . '</a>', $lang->def('_STATUS'), $lang->def('_USETHIS'));
    $tb->setColsStyle($type_h);
    $tb->addHead($cont_h);
    $class_room_to_edition = array();
    while (list($idClassroom, $name, $descr, $location) = sql_fetch_row($re_classroom)) {
        $cont = array('<label for="class_room_to_edition_' . $idClassroom . '">' . $location . '</label>', '<label for="class_room_to_edition_' . $idClassroom . '">' . $name . '</label>');
        if (isset($checked_class[$idClassroom])) {
            $cont[] = $lang->def('_CLASSROOM_OCCUPATED_YES');
        } else {
            $cont[] = '';
        }
        $cont[] = $form->getRadio('', 'class_room_to_edition_' . $idClassroom . '', 'class_room_to_edition', $idClassroom, $assigned_classroom == $idClassroom);
        $tb->addBody($cont);
    }
    $page_title = array('index.php?modname=course&amp;op=course_list' => $lang->def('_CLASSROOM'), $edition_name);
    $GLOBALS['page']->add(getTitleArea($page_title, 'classroomtocourse', $lang->def('_CLASSROOM')) . '<div class="std_block">' . ($checked_class !== false ? getResultUi($lang->def('_CLASSROOM_OCCUPATED')) : '') . getBackUi('index.php?modname=course&amp;op=course_list', $lang->def('_BACK')) . $form->openForm('assignEditionClassroom', 'index.php?modname=course&amp;op=assignEditionClassroom', false, false, 'multipart/form-data') . $form->getHidden('edition_id', 'edition_id', $edition_id) . $form->getHidden('idCourse', 'idCourse', $idCourse) . $tb->getTable() . $tb->getNavBar($ini, $tot_classroom) . $form->openButtonSpace() . $form->getButton('assignEditionClassroom', 'assignEditionClassroom', $lang->def('_SAVE')) . $form->getButton('course_undo', 'course_undo', $lang->def('_UNDO')) . $form->closeButtonSpace() . $form->closeForm() . '</div>', 'content');
}
Пример #22
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');
}
Пример #23
0
function news()
{
    checkPerm('view');
    require_once _base_ . '/lib/lib.form.php';
    require_once _base_ . '/lib/lib.table.php';
    require_once _base_ . '/lib/lib.navbar.php';
    $mod_perm = checkPerm('mod', true);
    $lang =& DoceboLanguage::createInstance('admin_news', 'lms');
    $out =& $GLOBALS['page'];
    $out->setWorkingZone('content');
    $tb = new Table(Get::sett('visuItem'), $lang->def('_NEWS'), $lang->def('_NEWS_SUMMARY'));
    $nav_bar = new NavBar('ini', Get::sett('visuItem'), 0, 'link');
    $ini = $nav_bar->getSelectedElement();
    //search query
    $query_news = "\r\n\tSELECT idNews, publish_date, title, short_desc, important\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_news_internal\r\n\tORDER BY important DESC, publish_date DESC\r\n\tLIMIT {$ini}," . Get::sett('visuItem');
    $query_news_tot = "\r\n\tSELECT COUNT(*)\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_news_internal ";
    $re_news = sql_query($query_news);
    list($tot_news) = sql_fetch_row(sql_query($query_news_tot));
    $nav_bar->setElementTotal($tot_news);
    $impo_gif = '<img src="' . getPathImage('lms') . 'standard/important.png" ' . 'title="' . $lang->def('_TITLE_IMPORTANT') . '" ' . 'alt="' . $lang->def('_IMPORTANT') . '" />';
    $type_h = array('image', '', '', 'news_short_td');
    $cont_h = array($impo_gif, $lang->def('_DATE'), $lang->def('_TITLE'), $lang->def('_SHORTDESC'));
    if ($mod_perm) {
        $cont_h[] = '<img src="' . getPathImage() . 'standard/moduser.png" title="' . $lang->def('_RECIPIENTS') . '" ' . 'alt="' . $lang->def('_RECIPIENTS') . '" />';
        $type_h[] = 'image';
        $cont_h[] = '<img src="' . getPathImage() . 'standard/edit.png" title="' . $lang->def('_MOD') . '" ' . 'alt="' . $lang->def('_MOD') . '" />';
        $type_h[] = 'image';
        $cont_h[] = '<img src="' . getPathImage() . 'standard/delete.png" title="' . $lang->def('_DEL') . '" ' . 'alt="' . $lang->def('_DEL') . '"" />';
        $type_h[] = 'image';
    }
    $tb->setColsStyle($type_h);
    $tb->addHead($cont_h);
    while (list($id_news, $publish_date, $title, $short_desc, $impo) = sql_fetch_row($re_news)) {
        $cont = array($impo ? $impo_gif : '', Format::date($publish_date), $title, Util::cut($short_desc));
        if ($mod_perm) {
            $cont[] = '<a href="index.php?modname=internal_news&amp;op=editviewer&amp;load=1&amp;id_news=' . $id_news . '" ' . 'title="' . $lang->def('_RECIPIENTS') . ' : ' . $title . '">' . '<img src="' . getPathImage() . 'standard/moduser.png" alt="' . $lang->def('_RECIPIENTS') . ' : ' . $title . '" /></a>';
            $cont[] = '<a href="index.php?modname=internal_news&amp;op=modnews&amp;id_news=' . $id_news . '" ' . 'title="' . $lang->def('_MOD') . ' : ' . $title . '">' . '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . ' : ' . $title . '" /></a>';
            $cont[] = '<a href="index.php?modname=internal_news&amp;op=delnews&amp;id_news=' . $id_news . '" ' . 'title="' . $lang->def('_DEL') . ' : ' . $title . '">' . '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . ' : ' . $title . '" /></a>';
        }
        $tb->addBody($cont);
    }
    require_once _base_ . '/lib/lib.dialog.php';
    setupHrefDialogBox('a[href*=delnews]');
    if ($mod_perm) {
        $tb->addActionAdd('<a href="index.php?modname=internal_news&amp;op=addnews" title="' . $lang->def('_NEW') . '">' . '<img src="' . getPathImage() . 'standard/add.png" alt="' . $lang->def('_ADD') . '" />' . $lang->def('_NEW') . '</a>');
    }
    $out->add(getTitleArea($lang->def('_NEWS'), 'news') . '<div class="std_block">');
    if (isset($_GET['result'])) {
        switch ($_GET['result']) {
            case "ok":
                $out->add(getResultUi($lang->def('_OPERATION_SUCCESSFUL')));
                break;
            case "err":
                $out->add(getErrorUi($lang->def('_OPERATION_FAILURE')));
                break;
            case "err_del":
                $out->add(getErrorUi($lang->def('_OPERATION_FAILURE')));
                break;
        }
    }
    if ($mod_perm) {
        $form = new Form();
        $how_much = Get::sett('visuNewsHomePage');
        if (isset($_POST['save_homepage'])) {
            $query_how_news = "\r\n\t\t\tUPDATE " . $GLOBALS['prefix_lms'] . "_setting\r\n\t\t\tSET param_value = '" . abs((int) $_POST['howmuch']) . "'\r\n\t\t\tWHERE param_name = 'visuNewsHomePage'";
            if (sql_query($query_how_news)) {
                $how_much = abs((int) $_POST['howmuch']);
            }
        }
    }
    $out->add($tb->getTable() . $nav_bar->getNavBar($ini) . '</div>');
}
Пример #24
0
function field_list()
{
    checkPerm('view');
    require_once _base_ . '/lib/lib.form.php';
    require_once _base_ . '/lib/lib.table.php';
    //require_once(_i18n_.'/lib.lang.php');
    $back_coded = htmlentities(urlencode('index.php?modname=field_manager&op=field_list'));
    $std_lang =& DoceboLanguage::createInstance('standard', 'framework');
    $lang =& DoceboLanguage::createInstance('field', 'framework');
    $out =& $GLOBALS['page'];
    $filter = new Form();
    //find available field type
    $re_field = sql_query("\r\n\tSELECT type_field FROM " . $GLOBALS['prefix_fw'] . "_field_type ORDER BY type_field");
    $field_av = array();
    $field_select = array('all_field' => $lang->def('_ALL_FIELD_TYPE'));
    while (list($type_field) = sql_fetch_row($re_field)) {
        $field_av[] = $type_field;
        $field_select[] = $lang->def('_' . strtoupper($type_field));
    }
    $out->setWorkingZone('content');
    $out->add(getTitleArea($lang->def('_FIELD_MANAGER'), 'field_manager'));
    $out->add('<div class="std_block">');
    //catch possible operation result
    if (isset($_GET['result'])) {
        if ($_GET['result'] == 'success') {
            $out->add(getResultUi($lang->def('_OPERATION_SUCCESSFUL')));
        }
        if ($_GET['result'] == 'fail') {
            $out->add(getErrorUi($lang->def('_OPERATION_FAILURE')));
        }
    }
    $ord = importVar('ord', false, 'trans');
    $flip = importVar('flip', true, 0);
    //filter------------------------------------------------------------
    $filter_type_field = importVar('filter_type_field', false, 'all_field');
    $filter_name_field = importVar('filter_name_field', false, $lang->def('_SEARCH'));
    $out->add($filter->openForm('field_filter', 'index.php?modname=field_manager&amp;op=field_list') . $filter->getOpenFieldset($lang->def('_SEARCH')) . $filter->getHidden('ord', 'ord', $ord) . $filter->getHidden('flip', 'flip', $flip) . $filter->getDropdown($lang->def('_FIELD_TYPE'), 'filter_type_field', 'filter_type_field', $field_select, $filter_type_field) . $filter->getTextfield($lang->def('_NAME'), 'filter_name_field', 'filter_name_field', '255', $filter_name_field) . $filter->openButtonSpace() . $filter->getButton('search', 'search', $std_lang->def('_SEARCH')) . $filter->closeButtonSpace() . $filter->getCloseFieldset() . $filter->closeForm());
    //display inserted field--------------------------------------------
    $tb_field = new Table(Get::sett('visuItem'));
    $query_field_display = "\r\n\tSELECT id_common, type_field, translation\r\n\tFROM " . $GLOBALS['prefix_fw'] . "_field\r\n\tWHERE lang_code = '" . getLanguage() . "'\r\n\t\t" . (isset($_POST['filter_type_field']) && $_POST['filter_type_field'] != 'all_field' ? " AND type_field = '" . $field_av[$_POST['filter_type_field']] . "' " : "") . "\r\n\t\t" . (isset($_POST['filter_name_field']) && $_POST['filter_name_field'] != $lang->def('_SEARCH') ? " AND translation LIKE '%" . $filter_name_field . "%'" : "") . "\r\n\tORDER BY sequence";
    $re_field_display = sql_query($query_field_display);
    $all_fields = mysql_num_rows($re_field_display);
    $img_up = '<img class="valing-middle" src="' . getPathImage() . 'standard/up.png" alt="' . $std_lang->def('_MOVE_UP') . '" />';
    $img_down = '<img class="valing-middle" src="' . getPathImage() . 'standard/down.png" alt="' . $std_lang->def('_MOVE_DOWN') . '" />';
    $content_h = array('<a href="index.php?modname=field_manager&amp;op=field_list">' . $lang->def('_FIELD_NAME') . '</a>', '<a href="index.php?modname=field_manager&amp;op=field_list">' . $lang->def('_FIELD_TYPE') . '</a>');
    $type_h = array('', 'align_center');
    $mod_perm = checkPerm('mod', true);
    $del_perm = checkPerm('del', true);
    if ($mod_perm) {
        $content_h[] = $img_down;
        $content_h[] = $img_up;
        $content_h[] = '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $std_lang->def('_MOD') . '" />';
        $type_h[] = 'image';
        $type_h[] = 'image';
        $type_h[] = 'image';
    }
    if ($del_perm) {
        $content_h[] = '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $std_lang->def('_DEL') . '" />';
        $type_h[] = 'image';
    }
    $tb_field->setColsStyle($type_h);
    $tb_field->addHead($content_h);
    $lat_type = 'textfield';
    $i = 1;
    while (list($id_common, $type_field, $translation) = sql_fetch_row($re_field_display)) {
        $cont = array($translation, $lang->def('_' . strtoupper($type_field)));
        if ($mod_perm) {
            if ($i != $all_fields) {
                $cont[] = '<a href="index.php?modname=field_manager&amp;op=movedown&amp;type_field=' . $type_field . '&amp;id_common=' . $id_common . '&amp;back=' . $back_coded . '"' . ' title="' . $lang->def('_MOVE_DOWN') . '">' . $img_down . '</a>';
            } else {
                $cont[] = '';
            }
            if ($i != 1) {
                $cont[] = '<a href="index.php?modname=field_manager&amp;op=moveup&amp;type_field=' . $type_field . '&amp;id_common=' . $id_common . '&amp;back=' . $back_coded . '"' . ' title="' . $lang->def('_MOVE_UP') . '">' . $img_up . '</a>';
            } else {
                $cont[] = '';
            }
            $cont[] = '<a href="index.php?modname=field&amp;op=manage&amp;fo=edit&amp;type_field=' . $type_field . '&amp;id_common=' . $id_common . '&amp;back=' . $back_coded . '"' . ' title="' . $lang->def('_MOD') . '">' . '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $std_lang->def('_MOD') . '" /></a>';
        }
        if ($del_perm) {
            /*
            $cont[] = '<a href="index.php?modname=field_manager&amp;op=field_del&amp;id_common='.$id_common.'"'
            	.' title="'.$lang->def('_DEL').'">'
            	.'<img src="'.getPathImage().'standard/delete.png" alt="'.$std_lang->def('_DEL').'" /></a>';
            */
            $cont[] = '<a href="index.php?modname=field&amp;op=manage&amp;fo=del&amp;type_field=' . $type_field . '&amp;id_common=' . $id_common . '&amp;back=index.php%3Fmodname%3Dfield_manager%26op%3Dfield_list"' . ' title="' . $lang->def('_DEL') . ' : ' . $translation . '">' . '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $std_lang->def('_DEL') . '" /></a>';
        }
        $tb_field->addBody($cont);
        $lat_type = $type_field;
        $i++;
    }
    $create_form = new Form();
    $select = '';
    foreach ($field_av as $k => $type_field) {
        $select .= '<option value="' . $type_field . '"' . ($type_field == $lat_type ? ' selected="selected"' : '') . '>' . $lang->def('_' . strtoupper($type_field)) . '</option>';
    }
    if ($del_perm) {
        require_once _base_ . '/lib/lib.dialog.php';
        setupHrefDialogBox('a[href*=fo=del]');
    }
    //add form----------------------------------------------------------
    if (checkPerm('add', true)) {
        $tb_field->addActionAdd($create_form->openForm('field_add', 'index.php?modname=field&amp;op=manage&amp;fo=create') . $create_form->getHidden('back', 'back', $back_coded) . '<label for="type_field">' . '<img class="valing-middle" src="' . getPathImage() . 'standard/add.png" alt="' . $std_lang->def('_ADD') . '" />' . ' ' . $lang->def('_ADD_NEW_FIELD') . '</label> ' . '<select id="type_field" name="type_field">' . $select . '</select> ' . $filter->getButton('new_field', 'new_field', $std_lang->def('_CREATE'), 'button_nowh') . $filter->closeForm());
    }
    $out->add($tb_field->getTable());
    $out->add('<a href="index.php?modname=field_manager&amp;op=fixsequence&amp;back=' . $back_coded . '"' . ' title="' . $lang->def('_FIX_SEQUENCE') . '">' . $lang->def('_FIX_SEQUENCE') . '</a>');
    $out->add('</div>');
}
Пример #25
0
function groups()
{
    checkPerm('view');
    require_once _base_ . '/lib/lib.table.php';
    $lang =& DoceboLanguage::createInstance('groups', 'lms');
    $acl_man =& Docebo::user()->getAclManager();
    $mod_perm = checkPerm('mod', true);
    $subs_perm = checkPerm('subscribe', true);
    // Retrive groups
    $acl_man->setContext('/lms/course/' . $_SESSION['idCourse'] . '/group');
    $id_groups = $acl_man->getGroupsIdstFromBasePath('/lms/course/' . $_SESSION['idCourse'] . '/group', array('course'));
    if (!empty($id_groups)) {
        $groups = $acl_man->getGroups($id_groups);
    } else {
        $groups = array();
    }
    // compose table
    $tb = new Table(0, $lang->def('_GROUP_CAPTION'), $lang->def('_GROUP_CAPTION'));
    $type_h = array('', '');
    $cont_h = array($lang->def('_NAME'), $lang->def('_DESCRIPTION'));
    if ($subs_perm) {
        $type_h[] = 'image';
        $cont_h[] = '<img src="' . getPathImage() . 'standard/moduser.png" alt="' . $lang->def('_ALT_SUBSCRIBE') . '" ' . 'title="' . $lang->def('_SUBSCRIBE_USER') . '" />';
    }
    if ($mod_perm) {
        $type_h[] = 'image';
        $type_h[] = 'image';
        $cont_h[] = '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . '" ' . 'title="' . $lang->def('_MOD') . '" />';
        $cont_h[] = '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . '" ' . 'title="' . $lang->def('_DEL') . '" />';
    }
    $tb->setColsStyle($type_h);
    $tb->addHead($cont_h);
    if (!empty($groups)) {
        while (list(, $group) = each($groups)) {
            $id_group = $group[ACL_INFO_IDST];
            $group_id = $acl_man->relativeId($group[ACL_INFO_GROUPID]);
            if ($group_id != 'alluser') {
                $cont = array($group_id, $group[ACL_INFO_GROUPDESCRIPTION]);
                if ($subs_perm) {
                    $cont[] = '<a href="index.php?modname=groups&amp;op=subscribe&amp;id_group=' . $id_group . '&amp;load=1" ' . 'title="' . $lang->def('_ASSIGN_USERS') . ' : ' . strip_tags($group_id) . '">' . '<img src="' . getPathImage() . 'standard/moduser.png" alt="' . $lang->def('_ASSIGN_USERS') . '"  /></a>';
                }
                if ($mod_perm) {
                    $cont[] = '<a href="index.php?modname=groups&amp;op=editgroup&amp;id_group=' . $id_group . '" ' . 'title="' . $lang->def('_MOD') . ' : ' . strip_tags($group_id) . '">' . '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . '"  /></a>';
                    $cont[] = '<a href="index.php?modname=groups&amp;op=delgroup&amp;id_group=' . $id_group . '" ' . 'title="' . $lang->def('_DEL') . ' : ' . strip_tags($group_id) . '">' . '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . '" /></a>';
                }
                $tb->addBody($cont);
            }
        }
    }
    if ($mod_perm) {
        require_once _base_ . '/lib/lib.dialog.php';
        setupHrefDialogBox('a[href*=delgroup]');
        $tb->addActionAdd('<a href="index.php?modname=groups&amp;op=editgroup">' . '<img src="' . getPathImage() . 'standard/add.png" alt="' . $lang->def('_ADD') . '"  /> ' . $lang->def('_NEW') . '</a>');
    }
    // output
    $GLOBALS['page']->add(getTitleArea($lang->def('_GROUPS'), 'groups') . '<div class="std_block">', 'content');
    if (isset($_GET['result'])) {
        switch ($_GET['result']) {
            case "ok":
                $GLOBALS['page']->add(getResultUi($lang->def('_OPERATION_SUCCESSFUL')), 'content');
                break;
            case "err":
                $GLOBALS['page']->add(getErrorUi($lang->def('_OPERATION_FAILURE')), 'content');
                break;
        }
    }
    $GLOBALS['page']->add($tb->getTable() . '</div>', 'content');
}
Пример #26
0
function reportlist()
{
    checkPerm('view');
    require_once _lms_ . '/admin/modules/report/class.report.php';
    //reportbox class
    require_once _lms_ . '/admin/modules/report/report_schedule.php';
    require_once _base_ . '/lib/lib.form.php';
    require_once _lms_ . '/lib/lib.report.php';
    if ($action = Get::req('action', DOTY_STRING, false)) {
        switch ($action) {
            case 'sched_rem':
                report_delete_schedulation(Get::req('id_sched', DOTY_INT, false));
                break;
        }
    }
    unload_filter(true);
    $lang =& DoceboLanguage::createInstance('report');
    cout(getTitleArea($lang->def('_REPORT'), 'report'));
    cout('<div class="std_block">');
    //cout(get_report_steplist($step_index));
    switch (Get::req('saverep', DOTY_STRING, false)) {
        case 'true':
            cout(getResultUi($lang->def('_SAVE_REPORT_OK')));
            break;
        case 'false':
            cout(getErrorUi($lang->def('_SAVE_REPORT_FAIL')));
            break;
    }
    switch (Get::req('modrep', DOTY_STRING, false)) {
        case 'true':
            cout(getResultUi($lang->def('_OPERATION_SUCCESSFUL')));
            break;
        case 'false':
            cout(getErrorUi($lang->def('_MOD_REPORT_FAIL')));
            break;
    }
    cout(get_report_table('index.php?modname=report&op=report_open_filter'));
    cout('</div>', 'content');
    //std_block div
}
Пример #27
0
 /**
  * this function manage the entire profile, identify the action to perform and do the right sequence of action
  * @return string the html to display
  */
 function performAction($viewer = false, $start_action = false)
 {
     $this->setViewer($viewer);
     if ($start_action === false) {
         $start_action = 'profileview';
     }
     $ap = Get::req($this->_varname_action, DOTY_MIXED, $start_action);
     if (isset($_POST['undo'])) {
         $ap = 'profileview';
     }
     switch ($ap) {
         case "goprofile":
             $ext_prof = new UserProfile(Get::req('id_user', DOTY_INT, 0), false);
             $ext_prof->init($this->_module_name, $this->_platform, $this->_std_query, $this->_varname_action);
             return $ext_prof->getProfile();
             break;
             // display the mod info gui -------------------------------
         // display the mod info gui -------------------------------
         case "mod_profile":
             return $this->getModUser();
             break;
         case "mod_password":
             return $this->_up_viewer->getUserPwdModUi();
             break;
         case "mod_policy":
             return $this->_up_viewer->modUserPolicyGui();
             break;
             // save modified info of the user -------------------------
         // save modified info of the user -------------------------
         case "save_policy":
             if ($this->_up_data_man->setFieldAccessList($this->_id_user, $this->_up_viewer->getFilledPolicy())) {
                 // all ok --------------------------------------
                 $this->_up_viewer->unloadUserData();
                 if ($this->_end_url !== false) {
                     Util::jump_to($this->_end_url);
                 }
                 return getResultUi($this->_lang->def('_OPERATION_SUCCESSFULPOLICY')) . $this->getProfile();
             } else {
                 // some error saving ---------------------------
                 return getErrorUi($this->_lang->def('_FAILSAVEPOLICY')) . $this->_up_viewer->modUserPolicyGui();
             }
             break;
             // save modified info of the user -------------------------
         // save modified info of the user -------------------------
         case "saveinfo":
             if (!$this->checkUserInfo()) {
                 // some error in data filling ------------------
                 return getErrorUi($this->_last_error) . $this->getModUser();
             }
             if ($this->saveUserInfo()) {
                 // all ok --------------------------------------
                 $this->_up_viewer->unloadUserData();
                 if ($this->_end_url !== false) {
                     Util::jump_to($this->_end_url);
                 }
                 if (isset($_GET['modname']) && $_GET['modname'] == 'reservation') {
                     require_once $GLOBALS['where_lms'] . '/lib/lib.reservation.php';
                     $id_event = Get::req('id_event', DOTY_INT, 0);
                     $man_res = new Man_Reservation();
                     $result = $man_res->addSubscription(getLogUserId(), $id_event);
                     Util::jump_to('index.php?modname=reservation&op=reservation');
                 } else {
                     return getResultUi($this->_lang->def('_OPERATION_SUCCESSFULPROFILE')) . $this->getProfile();
                 }
             } else {
                 // some error saving ---------------------------
                 return getErrorUi($this->_lang->def('_OPERATION_FAILURE')) . $this->getModUser();
             }
             break;
             // save password -----------------------------------------
         // save password -----------------------------------------
         case "savepwd":
             $re = $this->_up_viewer->checkUserPwd();
             if ($re !== true) {
                 // some error in data filling --------------------
                 return getErrorUi($re) . $this->_up_viewer->getUserPwdModUi();
             }
             if ($this->saveUserPwd()) {
                 // all ok ----------------------------------------
                 $this->_up_viewer->unloadUserData();
                 if ($this->_end_url !== false) {
                     Util::jump_to($this->_end_url);
                 }
                 $out = getResultUi($this->_lang->def('_OPERATION_SUCCESSFULPWD'));
                 if (Get::sett('profile_only_pwd') == 'on') {
                     // maybe is better if we display only the confirmation message if all is ok, but if you
                     // want something else add the code here
                 } else {
                     $out .= $this->getProfile();
                 }
                 return $out;
             } else {
                 // some error saving ----------------------------
                 return getErrorUi($this->_lang->def('_OPERATION_FAILURE')) . $this->_up_viewer->getUserPwdModUi();
             }
             break;
         case "uploadavatar":
             return $this->_up_viewer->modAvatarGui();
             break;
         case "saveavatar":
             if ($this->saveUserAvatar()) {
                 // all ok --------------------------------------
                 $this->_up_viewer->unloadUserData();
                 if ($this->_end_url !== false) {
                     Util::jump_to($this->_end_url);
                 }
                 return getResultUi($this->_lang->def('_OPERATION_SUCCESSFULAVATAR')) . $this->getProfile();
             } else {
                 // some error saving ---------------------------
                 return getErrorUi($this->_lang->def('_OPERATION_FAILURE')) . $this->_up_viewer->modAvatarGui();
             }
             break;
             // teacher curriculum
         // teacher curriculum
         case "del_teach_curric":
             return $this->_up_viewer->delTeacherCurriculumGui();
             break;
         case "mod_teach_curric":
             return $this->_up_viewer->modTeacherCurriculumGui();
             break;
         case "save_teach_curric":
             if ($this->_up_data_man->saveTeacherCurriculumAndPublication($this->_id_user, $this->_up_viewer->getFilledCurriculum(), false)) {
                 // all ok --------------------------------------
                 $this->_up_viewer->unloadUserData();
                 if ($this->_end_url !== false) {
                     Util::jump_to($this->_end_url);
                 }
                 return getResultUi($this->_lang->def('_OPERATION_SUCCESSFULCURRICULUM')) . $this->getProfile();
             } else {
                 // some error saving ---------------------------
                 return getErrorUi($this->_lang->def('_OPERATION_FAILURE')) . $this->_up_viewer->modTeacherCurriculumGui();
             }
             break;
         case "mod_teach_publ":
             return $this->_up_viewer->modTeacherPublicationsGui();
             break;
         case "save_teach_publ":
             if ($this->_up_data_man->saveTeacherCurriculumAndPublication($this->_id_user, false, $this->_up_viewer->getFilledPublications())) {
                 // all ok --------------------------------------
                 $this->_up_viewer->unloadUserData();
                 if ($this->_end_url !== false) {
                     Util::jump_to($this->_end_url);
                 }
                 return getResultUi($this->_lang->def('_OPERATION_SUCCESSFULPUBLICATIONS')) . $this->getProfile();
             } else {
                 // some error saving ---------------------------
                 return getErrorUi($this->_lang->def('_FAILSAVEPUBLICATIONS')) . $this->_up_viewer->modTeacherPublicationsGui();
             }
             break;
             // display the profile ------------------------------------
         // display the profile ------------------------------------
         case "view_files":
             $this->_id_user = Get::req('id_user', DOTY_INT, getLogUserId());
             return $this->_up_viewer->getViewUserFiles();
             break;
         case "file_details":
             $this->_id_user = Get::req('id_user', DOTY_INT, getLogUserId());
             return $this->_up_viewer->getViewUserFileDetail();
             break;
         case "profileview":
         default:
             return $this->getProfile();
             break;
     }
 }
Пример #28
0
function modtestgui($object_test)
{
    checkPerm('view', false, 'storage');
    $lang =& DoceboLanguage::createInstance('test');
    YuiLib::load('table');
    Util::get_js(_folder_lms_ . '/modules/quest_bank/ajax.quest_bank.js', true, true);
    // ----------------------------------------------------------------------------------------
    if (!is_a($object_test, 'Learning_Test')) {
        $_SESSION['last_error'] = $lang->def('_OPERATION_FAILURE');
        Util::jump_to('' . $object_test->back_url . '&amp;create_result=0');
    }
    require_once _base_ . '/lib/lib.table.php';
    require_once _base_ . '/lib/lib.form.php';
    $url_encode = htmlentities(urlencode($object_test->back_url));
    list($test_title) = sql_fetch_row(sql_query("\r\n\tSELECT title \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_test \r\n\tWHERE idTest = '" . $object_test->getId() . "'"));
    $re_quest = sql_query("\r\n\tSELECT idQuest, type_quest, title_quest, sequence, page \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_testquest \r\n\tWHERE idTest = '" . $object_test->getId() . "'\r\n\tORDER BY sequence");
    $num_quest = mysql_num_rows($re_quest);
    list($num_page) = sql_fetch_row(sql_query("\r\n\tSELECT MAX(page) \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_testquest \r\n\tWHERE idTest = '" . $object_test->getId() . "'"));
    $num_page = (int) $num_page;
    $GLOBALS['page']->add(getTitleArea($lang->def('_TEST_SECTION'), 'test') . '<div class="std_block yui-skin-docebo yui-skin-sam">' . getBackUi(Util::str_replace_once('&', '&amp;', $object_test->back_url), $lang->def('_BACK')), 'content');
    if (isset($_GET['mod_operation'])) {
        if ($_GET['mod_operation']) {
            $GLOBALS['page']->add(getResultUi($lang->def('_OPERATION_SUCCESSFUL')), 'content');
        } else {
            $GLOBALS['page']->add(getResultUi($lang->def('_QUEST_ERR_MODIFY')), 'content');
        }
    }
    //other areas
    $GLOBALS['page']->add('<b>' . $lang->def('_TITLE') . ' :</b> ' . '<a href="index.php?modname=test&amp;op=modtest&amp;idTest=' . $object_test->getId() . '&amp;back_url=' . $url_encode . '"' . ' class="ico-wt-sprite subs_mod" title="' . $lang->def('_MOD_TITLE', 'standard') . '"><span>' . $test_title . '</span></a><br /><br />', 'content');
    $GLOBALS['page']->add('<ul class="link_list_inline">
		<li>' . '<a href="index.php?modname=test&amp;op=defmodality&amp;idTest=' . $object_test->getId() . '&amp;back_url=' . $url_encode . '" title="' . $lang->def('_TEST_MODALITY') . '">' . $lang->def('_TEST_MODALITY') . '</a>' . '</li>
		<li>' . '<a href="index.php?modname=test&amp;op=deftime&amp;idTest=' . $object_test->getId() . '&amp;back_url=' . $url_encode . '" title="' . $lang->def('_TEST_COMPILE_TIME') . '">' . $lang->def('_TEST_COMPILE_TIME') . '</a>' . '</li>
		<li>' . '<a href="index.php?modname=test&amp;op=defpoint&amp;idTest=' . $object_test->getId() . '&amp;back_url=' . $url_encode . '" title="' . $lang->def('_TEST_POINT_ASSIGNEMENT') . '">' . $lang->def('_TEST_POINT_ASSIGNEMENT') . '</a>' . '</li>
		<li>' . '<a href="index.php?modname=test&amp;op=feedbackman&amp;idTest=' . $object_test->getId() . '&amp;back_url=' . $url_encode . '" title="' . $lang->def('_FEEDBACK_MANAGEMENT') . '">' . $lang->def('_FEEDBACK_MANAGEMENT') . '</a>' . '</li>
	</ul>', 'content');
    $caption = str_replace('%tot_page%', $num_page, str_replace('%tot_element%', $num_quest, $lang->def('_TEST_CAPTION')));
    $tab = new Table(0, $caption, $lang->def('_TEST_SUMMARY'));
    $tab->setColsStyle(array('image', 'image', '', 'image', 'image', 'image', 'image', 'image'));
    $tab->addHead(array($lang->def('_QUEST'), $lang->def('_TYPE'), $lang->def('_QUESTION'), $lang->def('_TEST_QUEST_ORDER'), '<img src="' . getPathImage() . 'standard/down.png" alt="' . $lang->def('_DOWN') . '" longdesc="' . $lang->def('_MOVE_DOWN') . '" />', '<img src="' . getPathImage() . 'standard/up.png" alt="' . $lang->def('_UP') . '" longdesc="' . $lang->def('_MOVE_UP') . '" />', '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . '" />', '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . '" />'));
    $i = 0;
    $correct_sequence = 1;
    $seq_error_detected = false;
    $quest_num = 1;
    $title_num = 1;
    $last_type = '';
    $uri_back = '&amp;back_url=' . $url_encode;
    while (list($id_quest, $type, $title, $sequence, $page) = sql_fetch_row($re_quest)) {
        $last_type = $type;
        $content = array($type != 'break_page' && $type != 'title' ? '<span class="text_bold">' . $quest_num++ . '</span>' : '', $lang->def('_QUEST_ACRN_' . strtoupper($type)), $title, $sequence, $i != $num_quest - 1 ? '<a href="index.php?modname=test&amp;op=movedown&amp;idQuest=' . $id_quest . $uri_back . '" title="' . $lang->def('_MOVE_DOWN') . '">' . '<img src="' . getPathImage() . 'standard/down.png" alt="' . $lang->def('_DOWN') . ' : ' . $lang->def('_ROW') . ' ' . ($i + 1) . '" /></a>' : '', $i != 0 ? '<a href="index.php?modname=test&amp;op=moveup&amp;idQuest=' . $id_quest . $uri_back . '" title="' . $lang->def('_MOVE_UP') . '">' . '<img src="' . getPathImage() . 'standard/up.png" alt="' . $lang->def('_UP') . ' : ' . $lang->def('_ROW') . ' ' . ($i + 1) . '" /></a>' : '', $type != 'break_page' ? '<a href="index.php?modname=test&amp;op=modquest&amp;idQuest=' . $id_quest . $uri_back . '" title="' . $lang->def('_MOD') . '">' . '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . ' : ' . $lang->def('_ROW') . ' ' . ($i + 1) . '" /></a>' : '', '<a href="index.php?modname=test&amp;op=delquest&amp;idQuest=' . $id_quest . $uri_back . '" title="' . $lang->def('_DEL') . '">' . '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . ' : ' . $lang->def('_ROW') . ' ' . ($i + 1) . '" /></a>');
        $tab->addBody($content);
        if ($sequence != $correct_sequence) {
            $seq_error_detected = true;
        }
        $correct_sequence++;
        ++$i;
    }
    //------------------------------------------------------------------
    $move_quest = "";
    if ($num_quest > 1) {
        $move_quest = '<form class="align_right" method="post" action="index.php?modname=test&amp;op=movequest">' . '<div>' . '<input type="hidden" id="authentic_request_test" name="authentic_request" value="' . Util::getSignature() . '" />' . '<input type="hidden" name="back_url" value="' . $url_encode . '" />' . '<input type="hidden" name="idTest" value="' . $object_test->getId() . '" />';
        $move_quest .= '<label class="text_bold" for="source_quest">' . $lang->def('_MOVE') . '</label>&nbsp;' . '<select id="source_quest" name="source_quest">';
        for ($opt = 1; $opt <= $i; $opt++) {
            $move_quest .= '<option value="' . $opt . '"' . ($opt == 1 ? ' selected="selected"' : '') . '>' . $lang->def('_TEST_MOVEQUEST') . ' ' . $opt . '</option>';
        }
        $move_quest .= '</select>';
        $move_quest .= '<label class="text_bold" for="dest_quest"> ' . $lang->def('_TO') . '</label>&nbsp;' . '<select id="dest_quest" name="dest_quest">' . '<option value="1" selected="selected">' . $lang->def('_TEST_FIRST_QUEST') . '</option>';
        for ($opt = 1; $opt < $i; $opt++) {
            $move_quest .= '<option value="' . ($opt + 1) . '">' . $lang->def('_TEST_AFTER_QUEST') . ' ' . $opt . '</option>';
        }
        $move_quest .= '<option value="' . ($i + 1) . '">' . $lang->def('_TEST_LAST_QUEST') . '</option>';
        $move_quest .= '</select>';
        $move_quest .= '&nbsp;<input class="button_nowh" type="submit" id="move_quest" name="move_quest" value="' . $lang->def('_MOVE') . '" />' . '</div>' . '</form>';
        //$tab->addActionAdd( $move_quest );
    }
    //------------------------------------------------------------------
    /*	$re_type = sql_query("
    	SELECT type_quest 
    	FROM ".$GLOBALS['prefix_lms']."_quest_type
    	ORDER BY sequence");
    	$add_quest = '<form method="post" action="index.php?modname=test&amp;op=addquest">'
    		.'<div>'
    		.'<input type="hidden" id="authentic_request_test" name="authentic_request" value="'.Util::getSignature().'" />'
    		.'<input type="hidden" name="back_url" value="'.$url_encode.'" />'
    		.'<input type="hidden" name="idTest" value="'.$object_test->getId().'" />';
    	$add_quest .= '<label class="text_bold" for="add_test_quest">'.$lang->def('_TEST_ADDQUEST').'</label>&nbsp;'
    		.'<select id="add_test_quest" name="add_test_quest">';
    	while(list($type_quest) = sql_fetch_row($re_type)) {
    		$add_quest .= '<option value="'.$type_quest.'"'
    		.( $last_type == $type_quest ? ' selected="selected"' : '' ).'>'
    		.$lang->def('_QUEST_ACRN_'.strtoupper($type_quest)).' - '.$lang->def('_QUEST_'.strtoupper($type_quest)).'</option>';
    	}
    	$add_quest .= '</select>';
    	$add_quest .= '&nbsp;<input class="button_nowh" type="submit" name="add_quest" value="'.$lang->def('_ADD').'" />'
    		.'</div>'
    		.'</form>';*/
    $re_type = sql_query("\r\n\tSELECT type_quest \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_quest_type\r\n\tORDER BY sequence");
    $add_quest = '<form method="post" action="index.php?modname=test&amp;op=addquest">' . '<input type="hidden" id="authentic_request_test" name="authentic_request" value="' . Util::getSignature() . '" />' . '<input type="hidden" name="back_url" value="' . $url_encode . '" />' . '<input type="hidden" name="idTest" value="' . $object_test->getId() . '" />' . '<input type="submit" id="add_quest" name="add_quest" value="' . $lang->def('_TEST_ADDQUEST') . '">
		<select id="add_test_quest" name="add_test_quest">';
    while (list($type_quest) = sql_fetch_row($re_type)) {
        $add_quest .= '<option value="' . $type_quest . '">' . $lang->def('_QUEST_ACRN_' . strtoupper($type_quest)) . ' - ' . $lang->def('_QUEST_' . strtoupper($type_quest)) . '</option>';
    }
    $add_quest .= '</select>' . '</form>';
    //------------------------------------------------------------------
    //$tab->addActionAdd( $add_quest, '' );
    $GLOBALS['page']->add($tab->getTable() . '<div class="table-container-below">' . $move_quest . '</div>' . $add_quest . getBackUi(Util::str_replace_once('&', '&amp;', $object_test->back_url), $lang->def('_BACK')), 'content');
    /*
    $GLOBALS['page']->add(
    	Form::openForm('add_question', 'index.php?modname=test&amp;op=importquest', false, false, 'multipart/form-data')
    	
    	.Form::openElementSpace()
    	.Form::getOpenFieldset($lang->def('_IMPORT_FROM_XML'))
    	.Form::getHidden('back_url', 'back_url', $url_encode)
    	.Form::getHidden('idTest', 'idTest', $object_test->getId())
    	.Form::getFilefield($lang->def('_FILE'), 'xml_file', 'xml_file')
    	.Form::getCloseFieldset()
    	.Form::closeElementSpace()
    	
    	.Form::openButtonSpace()
    	.form::getButton('import', 'import', $lang->def('_IMPORT'))
    	.Form::closeButtonSpace()
    	
    	.Form::closeForm()
    , 'content');
    */
    if ($seq_error_detected) {
        $GLOBALS['page']->add(' <a href="index.php?modname=test&amp;op=fixsequence&amp;idTest=' . $object_test->getId() . $uri_back . '" title="' . $lang->def('_FIX_SEQUENCE') . '">' . $lang->def('_FIX_SEQUENCE') . '</a>', 'content');
    }
    require_once $GLOBALS['where_lms'] . '/lib/lib.quest_bank.php';
    $qb_man = new QuestBankMan();
    $supported_format = $qb_man->supported_format();
    $GLOBALS['page']->add('<form method="post" action="index.php?modname=test&amp;op=modtestgui">' . '<input type="hidden" id="authentic_request_test" name="authentic_request" value="' . Util::getSignature() . '" />' . '<input type="hidden" name="back_url" value="' . $url_encode . '" />' . '<input type="hidden" name="idTest" value="' . $object_test->getId() . '" />' . '<div class="align_right">
			<input type="submit" id="export_quest" name="export_quest" value="' . $lang->def('_EXPORT') . '">
			<select id="export_quest_select" name="export_quest_select">', 'content');
    foreach ($supported_format as $id_exp => $def) {
        cout('<option value="' . $id_exp . '">' . $def . '</option>', 'content');
    }
    cout('<option value="5">' . Lang::t('_QUEST_BANK', 'menu_course') . '</option>', 'content');
    cout('</select>' . Form::getButton('import_quest', 'import_quest', $lang->def('_IMPORT')) . '</div>' . '</form>', 'content');
    $GLOBALS['page']->add('
	<script type="text/javascript">
	YAHOO.util.Event.addListener(window, "load", function() {
		var oSplitExport = new YAHOO.widget.Button("export_quest", { type: "menu", menu: "export_quest_select" });
		//var oPushImport = new YAHOO.widget.Button("import_quest");
		var oMoveQuest = new YAHOO.widget.Button("move_quest");
		var oSplitAddQuest = new YAHOO.widget.Button("add_quest", { type: "menu", menu: "add_test_quest" });
	});
	</script>', 'content');
    $GLOBALS['page']->add('</div>', 'content');
    //fixPageSequence($object_test->getId());
}
Пример #29
0
/**
 * @param string 	$text 	the result identifier it must be (err_'int' or ok_'int'),
 *							this function search for the specified _RESULT_'int' as constant to use for message diaply
 *
 * @return string with the html
 */
function guiResultStatus(&$lang, $text)
{
    $numeric_code = substr($text, strrpos($text, '_') + 1);
    if (strpos($text, 'ok') !== false) {
        if (!defined('_SUCCESS_' . $numeric_code)) {
            return getResultUi('_SUCCESS_' . $numeric_code);
        } else {
            return getResultUi($lang->def(constant('_SUCCESS_' . $numeric_code)));
        }
    } elseif (strpos($text, 'err') !== false) {
        if (!defined('_FAIL_' . $numeric_code)) {
            return getErrorUi('_FAIL_' . $numeric_code);
        } else {
            return getErrorUi($lang->def(constant('_FAIL_' . $numeric_code)));
        }
    }
}
 public function show_usersTask()
 {
     $id_group = Get::req('id', DOTY_INT, 0);
     if ($id_group <= 0) {
         return;
     }
     $res = Get::req('res', DOTY_STRING, '');
     switch ($res) {
         case 'ok_assignuser':
             $message = getResultUi(Lang::t('_OPERATION_SUCCESSFUL', 'admin_directory'));
             break;
         case 'err_assignuser':
             $message = getErrorUi(Lang::t('_GROUP_USERASSIGN_ERROR', 'admin_directory'));
             break;
         default:
             $message = "";
     }
     $group = $this->model->getGroupInfo($id_group, true);
     $this->render('show_users', array('id_group' => $id_group, 'groupid' => Docebo::aclm()->relativeId($group->groupid), 'filter_text' => "", 'result_message' => $message, 'permissions' => $this->permissions));
 }