function modglossarygui($object_glos = NULL) { checkPerm('view', false, 'storage'); $lang =& DoceboLanguage::createInstance('glossary'); require_once _base_ . '/lib/lib.table.php'; $tableGlossary = new Table(Get::sett('visuItem'), '', $lang->def('_GLOSSARY_SUMMARY')); $tableGlossary->initNavBar('ini', 'link'); $ini = $tableGlossary->getSelectedElement(); $back_coded = htmlentities(urlencode($object_glos->back_url)); list($title) = sql_fetch_row(sql_query("\r\n\tSELECT title\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_glossary \r\n\tWHERE idGlossary = '" . $object_glos->getId() . "'")); $reTerm = sql_query("\r\n\tSELECT idTerm, term \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_glossaryterm \r\n\tWHERE idGlossary = '" . $object_glos->getId() . "' \r\n\tORDER BY term \r\n\tLIMIT {$ini}," . Get::sett('visuItem')); list($num_of_term) = sql_fetch_row(sql_query("\r\n\tSELECT COUNT(*) \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_glossaryterm\r\n\tWHERE idGlossary = '" . $object_glos->getId() . "'")); if ($title == '') { $_SESSION['last_error'] = $lang->def('_FILEUNSPECIFIED'); Util::jump_to(Util::str_replace_once('&', '&', $object_glos->back_url) . '&create_result=0'); } $GLOBALS['page']->add(getTitleArea($lang->def('_GLOSSARY'), 'glossary', $lang->def('_GLOSSARY')) . '<div class="std_block">' . getBackUi(Util::str_replace_once('&', '&', $object_glos->back_url) . '&mod_result=0', $lang->def('_BACK')) . '<b>' . $lang->def('_GLOSSARY') . ' : ' . $title . '</b><br /><br />' . '<div class="mod_container">' . '<a href="index.php?modname=glossary&op=modglossary&idGlossary=' . $object_glos->getId() . '&back_url=' . $back_coded . '" title="' . $lang->def('_MOD_TITLE') . '">' . '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . '" /> ' . $lang->def('_MOD_TITLE') . '</a>' . '</div><br />', 'content'); $contentArray = array($lang->def('_TERM'), '<img src="' . getPathImage() . 'standard/edit.png" title="' . $lang->def('_MOD') . '" alt="' . $lang->def('_MOD') . '" />', '<img src="' . getPathImage() . 'standard/delete.png" title="' . $lang->def('_DEL') . '" alt="' . $lang->def('_DEL') . '" />'); $typeArray = array('', 'image', 'image'); $GLOBALS['page']->add($tableGlossary->addHead($contentArray, $typeArray)); while (list($idTerm, $term) = sql_fetch_row($reTerm)) { $content = array($term, '<a href="index.php?modname=glossary&op=modterm&idTerm=' . $idTerm . '&back_url=' . $back_coded . '" title="' . $lang->def('_MOD') . '">' . '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . '" /></a>', '<a href="index.php?modname=glossary&op=delterm&idTerm=' . $idTerm . '&back_url=' . $back_coded . '" title="' . $lang->def('_DEL') . '">' . '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . '" /></a>'); $tableGlossary->addBody($content); } $tableGlossary->addActionAdd('<a href="index.php?modname=glossary&op=addterm&idGlossary=' . $object_glos->getId() . '&back_url=' . $back_coded . '" title="' . $lang->def('_ADDTERM') . '">' . '<img src="' . getPathImage() . 'standard/add.png" alt="' . $lang->def('_ADD') . '" /> ' . $lang->def('_ADDTERM') . '</a>'); $tableGlossary->setLink('index.php?modname=glossary&op=modglossarygui' . '&idGlossary=' . $object_glos->getId() . '&back_url=' . $back_coded); $GLOBALS['page']->add($tableGlossary->getTable() . $tableGlossary->getNavBar($ini, $num_of_term) . '</div>', 'content'); }
function publicAdminManager_list() { checkPerm('view'); require_once _base_ . '/lib/lib.table.php'; $lang =& DoceboLanguage::createInstance('adminrules', 'framework'); $lang =& DoceboLanguage::createInstance('public_admin_manager', 'framework'); $aclManager = new DoceboACLManager(); // get users to show -------------------------------------------------- $admin_group_idst = $aclManager->getGroupST(ADMIN_GROUP_PUBLICADMIN); $arr_admin_idst = $aclManager->getGroupUMembers($admin_group_idst); $arr_admin_id = array_flip($aclManager->getArrUserST($arr_admin_idst)); $pm =& PlatformManager::createInstance(); $lms_is_active = $pm->isLoaded("lms"); /*$cms_is_active = $pm->isLoaded("cms");*/ // print table -------------------------------------------------------- $table = new Table(Get::sett('visuItem'), $lang->def('_PUBLIC_ADMIN_USER'), $lang->def('_PUBLIC_ADMIN_USER')); $table->initNavBar('ini', 'link'); $table->setLink('index.php?modname=public_admin_manager&op=view&ini='); $ini = $table->getSelectedElement(); $GLOBALS['page']->add(getTitleArea($lang->def('_ADMIN_MANAGMENT'), 'admin_managmer', $lang->def('_ADMIN_MANAGMENT')) . '<div class="std_block">', 'content'); $contentH = array($lang->def('_USERNAME'), '<img src="' . getPathImage() . 'admin_manager/man_pref.gif" alt="' . $lang->def('_ADMIN_PREFERENCES_TITLE', 'adminrules') . '" ' . 'title="' . $lang->def('_ADMIN_PREFERENCES_TITLE', 'adminrules') . '" />', '<img src="' . getPathImage() . 'admin_manager/man_menu.gif" alt="' . $lang->def('_ASSIGN_USERS', 'adminrules') . '" ' . 'title="' . $lang->def('_ASSIGN_USERS', 'adminrules') . '" />', '<img src="' . getPathImage() . 'directory/tree.gif" alt="' . $lang->def('_ASSIGN_USERS', 'adminrules') . '" ' . 'title="' . $lang->def('_ASSIGN_USERS', 'adminrules') . '" />'); $typeH = array('', 'image', 'image', 'image'); if ($lms_is_active) { $contentH[] = '<img src="' . getPathImage() . 'admin_manager/man_course.gif" alt="' . $lang->def('_ASSIGN_USERS', 'adminrules') . '" ' . 'title="' . $lang->def('_ASSIGN_USERS', 'adminrules') . '" />'; $typeH[] = 'image'; } $table->setColsStyle($typeH); $table->addHead($contentH); $maxItem = count($arr_admin_id) < $ini + Get::sett('visuItem') ? count($arr_admin_id) : $ini + Get::sett('visuItem'); for ($index = $ini; $index < $maxItem; $index++) { $admin_userid = substr($arr_admin_id[$arr_admin_idst[$index]], 1); $rowContent = array($admin_userid); // Edit preferences $rowContent[] = '<a href="index.php?modname=public_admin_manager&op=edit_preferences&adminidst=' . $arr_admin_idst[$index] . '" title="' . $lang->def('_ADMIN_PREFERENCES_TITLE', 'adminrules') . ' : ' . $admin_userid . '">' . '<img src="' . getPathImage() . 'admin_manager/man_pref.gif"' . ' alt="' . $lang->def('_ADMIN_PREFERENCES_TITLE', 'adminrules') . ' : ' . $admin_userid . '" /></a>'; // Edit menu $rowContent[] = '<a href="index.php?modname=public_admin_manager&op=edit_menu&adminidst=' . $arr_admin_idst[$index] . '" title="' . $lang->def('_ASSIGN_USERS', 'adminrules') . ' : ' . $admin_userid . '">' . '<img src="' . getPathImage() . 'admin_manager/man_menu.gif"' . ' alt="' . $lang->def('_ASSIGN_USERS', 'adminrules') . ' : ' . $admin_userid . '" /></a>'; // Edit user $rowContent[] = '<a href="index.php?modname=public_admin_manager&op=assign_tree&adminidst=' . $arr_admin_idst[$index] . '" title="' . $lang->def('_ASSIGN_USERS', 'adminrules') . ' : ' . $admin_userid . '">' . '<img src="' . getPathImage() . 'directory/tree.gif" ' . 'alt="' . $lang->def('_ASSIGN_USERS', 'adminrules') . ' : ' . $admin_userid . '" /></a>'; // Edit course if ($lms_is_active) { $rowContent[] = '<a href="index.php?modname=public_admin_manager&op=edit_course&adminidst=' . $arr_admin_idst[$index] . '&load=1" title="' . $lang->def('_ASSIGN_USERS', 'adminrules') . ' : ' . $admin_userid . '">' . '<img src="' . getPathImage() . 'admin_manager/man_course.gif"' . ' alt="' . $lang->def('_ASSIGN_USERS', 'adminrules') . ' : ' . $admin_userid . '" /></a>'; } $table->addBody($rowContent); } $GLOBALS['page']->add($table->getTable() . $table->getNavBar($ini, count($arr_admin_id)), 'content'); $GLOBALS['page']->add('</div>', 'content'); }
function reportList() { checkPerm('view'); require_once _base_ . '/lib/lib.table.php'; $lang =& DoceboLanguage::createInstance('report', 'framework'); $_SESSION['report_tempdata'] = array(); $can_mod = checkPerm('mod', true); $acl_man = Docebo::aclm(); $public_admin_mod = true; $query = "SELECT t1.*, t2.userid \r\n\tFROM %lms_report_filter as t1 \r\n\t\tLEFT JOIN %adm_user as t2 ON t1.author=t2.idst\r\n\tWHERE t1.is_public = 1 OR t1.author = " . Docebo::user()->getId(); $tb = new Table(); $tb->initNavBar('ini', 'button'); $col_type = array('', 'align_center', 'align_center', 'image'); $col_content = array($lang->def('_NAME'), $lang->def('_TAB_REP_CREATOR', 'report', 'framework'), $lang->def('_CREATION_DATE'), '<img src="' . getPathImage() . 'standard/view.png" alt="' . $lang->def('REPORT_SHOW_RESULTS') . '" title="' . $lang->def('REPORT_SHOW_RESULTS') . '" />'); if ($public_admin_mod && $can_mod) { $col_type[] = 'image'; $col_content[] = '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . '" title="' . $lang->def('_MOD') . '"/>'; $col_type[] = 'image'; $col_content[] = '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . '" title="' . $lang->def('_DEL') . '"/>'; } $tb->setColsStyle($col_type); $tb->addHead($col_content); $res = sql_query($query); if ($res) { while ($row = sql_fetch_assoc($res)) { $id = $row['id_filter']; $opn_link = '<a href="index.php?modname=public_report_admin&op=view_report&idrep=' . $id . '" ' . ' title="' . $lang->def('REPORT_SHOW_RESULTS', 'report', 'framework') . '">' . '<img src="' . getPathImage() . 'standard/view.png" alt="' . $lang->def('REPORT_SHOW_RESULTS', 'report', 'framework') . '" />' . '</a>'; $tb_content = array($row['author'] == 0 ? $lang->def($row['filter_name']) : $row['filter_name'], $row['author'] == 0 ? '<div class="align_center">-</div>' : $acl_man->relativeId($row['userid']), Format::date($row['creation_date']), $opn_link); if ($public_admin_mod && $can_mod) { if ($row['author'] == Docebo::user()->getId()) { $tb_content[] = '<a href="index.php?modname=public_report_admin&op=modify_name&modid=' . $id . '" ' . ' title="' . $lang->def('_MOD', 'report', 'framework') . '">' . '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD', 'report', 'framework') . '" />' . '</a>'; } else { $tb_content[] = ''; } if ($row['author'] == Docebo::user()->getId()) { $tb_content[] = '<a href="index.php?modname=public_report_admin&op=del_public_report&idrep=' . $id . '" ' . ' title="' . $lang->def('_DEL', 'report', 'framework') . '">' . '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL', 'report', 'framework') . '" />' . '</a>'; } else { $tb_content[] = ''; } } $tb->addBody($tb_content); } } require_once _base_ . '/lib/lib.dialog.php'; setupHrefDialogBox('a[href*=del_public_report]'); if ($public_admin_mod && $can_mod) { $tb->addActionAdd('<a href="index.php?modname=public_report_admin&op=create_name">' . '<img src="' . getPathImage() . 'standard/add.png" title="' . $lang->def('_NEW') . '" /> ' . $lang->def('_NEW') . '</a>'); } cout(getTitleArea($lang->def('_REPORT')) . '<div class="std_block">' . $tb->getTable() . '</div>', 'content'); }
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&op=classroom_to_edition&edition_id={$edition_id}" . '&of_loc=' . $of_loc . '&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&op=classroom_to_edition&edition_id=" . $edition_id . "&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&op=classroom_to_edition&edition_id=" . $edition_id . "&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&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&op=course_list', $lang->def('_BACK')) . $form->openForm('assignEditionClassroom', 'index.php?modname=course&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'); }
function get_schedulations_table($idrep = false) { checkPerm('view'); $can_mod = checkPerm('mod', true); require_once _base_ . '/lib/lib.table.php'; Util::get_js(Get::rel_path('base') . '/widget/dialog/dialog.js', true, true); YuiLib::load('selector'); $acl_man =& Docebo::user()->getACLManager(); $level = Docebo::user()->getUserLevelId(getLogUserId()); $admin_cond = ''; switch ($level) { case ADMIN_GROUP_GODADMIN: case ADMIN_GROUP_ADMIN: break; case ADMIN_GROUP_PUBLICADMIN: case ADMIN_GROUP_USER: default: $admin_cond .= " AND t1.id_creator=" . getLogUserId(); break; } $query = "SELECT t1.*, t3.userid as report_owner, t2.filter_name as report_name, " . "COUNT(t4.id_user) as num_users FROM " . $GLOBALS['prefix_lms'] . "_report_schedule as t1, " . $GLOBALS['prefix_lms'] . "_report_filter as t2, " . $GLOBALS['prefix_fw'] . "_user as t3, " . $GLOBALS['prefix_lms'] . "_report_schedule_recipient as t4 " . "WHERE t1.id_report_filter=t2.id_filter AND t3.idst=t1.id_creator " . "AND t4.id_report_schedule=t1.id_report_schedule " . $admin_cond . " " . ($idrep ? "AND t1.id_report_filter={$idrep} " : '') . "GROUP BY t1.id_report_schedule"; $lang =& DoceboLanguage::createInstance('report', 'framework'); $output = ''; $tb = new Table(Get::sett('visu_course')); $tb->initNavBar('ini', 'button'); $col_type = array('align_center', 'align_center', 'align_center', 'align_center', 'align_center', 'align_center'); //,'image','image'); $col_content = array($lang->def('_NAME'), $lang->def('_TAB_REP_CREATOR'), $lang->def('_CREATION_DATE'), $lang->def('_SEND'), $lang->def('_RECIPIENTS'), $lang->def('_ACTIVE')); if ($can_mod) { $col_type[] = 'image'; $col_type[] = 'image'; $col_content[] = '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD', 'standard') . '" title="' . $lang->def('_MOD') . '" />'; $col_content[] = '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL', 'standard') . '" title="' . $lang->def('_DEL') . '" />'; } $tb->setColsStyle($col_type); $tb->addHead($col_content); $res = sql_query($query); if ($res) { while ($row = mysql_fetch_assoc($res)) { $id = $row['id_report_schedule']; $recipients_link = "ajax.adm_server.php?mn=report&plf=lms&op=show_recipients_window&idsched=" . $id; $mod_link = '<a href="index.php?modname=report&op=sched_mod&id_sched=' . $id . '&idrep=' . $idrep . '" ' . ' title="' . $lang->def('_MOD') . '">' . '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . '" />' . '</a>'; $rem_link = '<a href="index.php?modname=report&op=schedulelist&idrep=' . $idrep . '&action=sched_rem&id_sched=' . $id . '" ' . ' title="' . $lang->def('_DEL') . '">' . '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . '" />' . '</a>'; $enabled = '<image class="handover" src="' . getPathImage('lms') . 'standard/' . ($row['enabled'] == 1 ? 'publish.png' : 'unpublish.png') . '" ' . 'onclick="enable_schedulation(this, ' . $row['id_report_schedule'] . ');" />' . '<input type="hidden" id="enable_value_' . $row['id_report_schedule'] . '" ' . 'value="' . ($row['enabled'] == 1 ? '0' : '1') . '" />'; $num_users = '<a href="' . $recipients_link . '" title="' . $lang->def('_RECIPIENTS') . '" ' . 'class="" id="show_recipients_' . $id . '">' . $row['num_users'] . '</a>'; $tb_content = array(_SCHED_KEY_NAME => $row['name'], _SCHED_KEY_CREATOR => $acl_man->relativeId($row['report_owner']), _SCHED_KEY_CREATION => Format::date($row['creation_date']), _SCHED_KEY_PERIOD => get_period_text($row['period']), _SCHED_KEY_NUMUSER => $num_users, _SCHED_KEY_ENABLED => $enabled); if ($can_mod) { $tb_content[_SCHED_KEY_MOD] = $mod_link; $tb_content[_SCHED_KEY_REM] = $rem_link; } $tb->addBody($tb_content); } } $tb->addActionAdd(' <a href="index.php?modname=report&op=report_schedule&idrep=' . $idrep . '">' . '<img src="' . getPathImage() . 'standard/add.png" ' . 'title="' . $lang->def('_ADD') . '" /> ' . $lang->def('_ADD') . '</a>'); $output .= $tb->getTable(); $output .= '<script type="text/javascript"> YAHOO.util.Event.onDOMReady(function() { var links = YAHOO.util.Selector.query("a[id^=show_recipients_]"); YAHOO.util.Event.addListener(links, "click", function(e) { CreateDialog("show_recipients_dialog", { width: "600px", modal: true, close: true, visible: false, fixedcenter: false, constraintoviewport: false, draggable: true, hideaftersubmit: true, isDynamic: true, confirmOnly: true, ajaxUrl: this.href }).call(this, e); }); }); </script>'; return $output; }
function viewDeletedUser() { require_once _base_ . '/lib/lib.table.php'; $lang =& DoceboLanguage::createInstance('profile', 'framework'); $out =& $GLOBALS['page']; $out->setWorkingZone('content'); $acl_man =& Docebo::user()->getAclManager(); $max_row = 10; $tb = new Table($max_row); $tb->initNavBar('ini', 'link'); $ini = $tb->getSelectedElement(); $query = "SELECT * FROM " . $this->_getTableDeletedUser() . ""; $result = sql_query($query); $num_rows = mysql_num_rows($result); //print_r($ini); if ($ini) { $limit = $ini; } else { $limit = 0; } $query = "SELECT d.idst, d.userid, d.firstname, d.lastname, d.email, d.lastenter, d.deletion_date, d.deleted_by, u.userid, u.firstname, u.lastname" . " FROM " . $this->_getTableDeletedUser() . " AS d JOIN" . " " . $this->_getTableUser() . " AS u ON d.deleted_by = u.idst" . " LIMIT " . $limit . ", " . $max_row . ""; $result = sql_query($query); $out->add(getTitleArea($lang->def('_DELETED_USER_LIST')) . '<div class="std_block">'); $out->add(getBackUi('index.php?modname=directory&op=org_chart', "<<" . $lang->def('_BACK'))); if ($num_rows) { $cont_h = array($lang->def('_IDST_DELETED_USER'), $lang->def('_USERNAME'), $lang->def('_FIRSTNAME'), $lang->def('_LASTNAME'), $lang->def('_EMAIL'), $lang->def('_DELETION_DATE'), $lang->def('_USERID_DELETER'), $lang->def('_FIRSTNAME_DELETER'), $lang->def('_LASTNAME_DELETER')); $type_h = array('', '', '', '', '', '', '', '', '', '', ''); $tb->setColsStyle($type_h); $tb->addHead($cont_h); while (list($idst_deleted, $userid_deleted, $firstname_deleted, $lastname_deleted, $email_deleted, $last_enter_deleted, $deletion_date, $idst_deleter, $userid_deleter, $firstname_deleter, $lastname_deleter) = sql_fetch_row($result)) { $count = array(); $count[] = $idst_deleted; $count[] = $acl_man->relativeId($userid_deleted); $count[] = $firstname_deleted; $count[] = $lastname_deleted; $count[] = $email_deleted; $count[] = Format::date($deletion_date); $count[] = $acl_man->relativeId($userid_deleter); $count[] = $firstname_deleter; $count[] = $lastname_deleter; $tb->addBody($count); } $out->add($tb->getTable() . $tb->getNavBar($ini, $num_rows) . '</div>'); } else { $out->add($lang->def('_EMPTY_SELECTION')); } $out->add(getBackUi('index.php?modname=directory&op=org_chart', "<<" . $lang->def('_BACK'))); $out->add('</div>'); }
function transaction() { require_once _base_ . '/lib/lib.table.php'; require_once _base_ . '/lib/lib.form.php'; require_once _base_ . '/lib/lib.dialog.php'; YuiLib::load(); $lang =& DoceboLanguage::createInstance('transaction'); $acl_man = Docebo::user()->getAclManager(); $man_transaction = new Man_Transaction(); cout(getTitleArea($lang->def('_TRANSACTION')) . '<div class="std_block">'); $tb = new Table(Get::sett('visuItem'), $lang->def('_TRANSACTION_TABLE'), $lang->def('_TRANSACTION_TABLE')); $tb->initNavBar('ini', 'button'); $tb->setLink('index.php?modname=transaction&op=transaction'); $page = ($tb->getSelectedPage() - 1) * Get::sett('visuItem'); $status_filter = Get::req('payment_status', DOTY_INT, '-2'); $course_filter = Get::req('course_status', DOTY_INT, '-2'); $tran_filter = Get::req('tran', DOTY_MIXED, ''); $display = false; if ($status_filter != -2) { $display = true; } if ($course_filter != -2) { $display = true; } $transactions = $man_transaction->getTransaction($page, $status_filter == '-2' ? false : $status_filter, $course_filter == '-2' ? false : $course_filter, $tran_filter); $tot_transaction = $man_transaction->getTotTransaction($status_filter == '-2' ? false : $status_filter, $course_filter == '-2' ? false : $course_filter, $tran_filter); if (count($transactions) > 0 || $display) { $mod_img = '<img src="' . getPathImage() . '/standard/edit.png" title="' . $lang->def('_MOD') . '" alt="' . $lang->def('_MOD') . '" />'; $del_img = '<img src="' . getPathImage() . '/standard/delete.png" title="' . $lang->def('_DEL') . '" alt="' . $lang->def('_DEL') . '" />'; $cont_h = array($lang->def('_USER'), $lang->def('_DATE'), $lang->def('_COURSE_PRIZE'), $lang->def('_PAYMENT_METHOD'), $lang->def('_PAYMENT_STATUS'), $lang->def('COURSE_STATUS'), $mod_img, $del_img); $type_h = array('', '', '', '', 'image', 'image', 'image', 'image'); $tb->setColsStyle($type_h); $tb->addHead($cont_h); foreach ($transactions as $transaction_info) { if ($transaction_info['firstname'] !== '' && $transaction_info['lastname'] !== '') { $user = $transaction_info['firstname'] . ' ' . $transaction_info['lastname'] . ' (' . $acl_man->relativeId($transaction_info['userid']) . ')'; } elseif ($transaction_info['firstname'] !== '') { $user = $transaction_info['firstname'] . ' (' . $acl_man->relativeId($transaction_info['userid']) . ')'; } elseif ($transaction_info['lastname'] !== '') { $user = $transaction_info['lastname'] . ' (' . $acl_man->relativeId($transaction_info['userid']) . ')'; } else { $user = $acl_man->relativeId($transaction_info['userid']); } switch ($transaction_info['payment_status']) { case '-1': $payment_status = '<img src="' . getPathImage() . '/standard/dot_red.gif" alt="' . $lang->def('_CANCELLED') . '" title="' . $lang->def('_CANCELLED') . '" />'; break; case '0': $payment_status = '<img src="' . getPathImage() . '/standard/dot_grey.gif" alt="' . $lang->def('_WAITING_PAYMENT') . '" title="' . $lang->def('_WAITING_PAYMENT') . '" />'; break; case '1': $payment_status = '<img src="' . getPathImage() . '/standard/dot_yellow.gif" alt="' . $lang->def('_PARTIAL_PAID') . '" title="' . $lang->def('_PARTIAL_PAID') . '" />'; break; case '2': $payment_status = '<img src="' . getPathImage() . '/standard/dot_green.gif" alt="' . $lang->def('_PAID') . '" title="' . $lang->def('_PAID') . '" />'; break; } switch ($transaction_info['course_status']) { case '-1': $course_status = '<img src="' . getPathImage() . '/standard/dot_red.gif" alt="' . $lang->def('_CANCELLED') . '" title="' . $lang->def('_CANCELLED') . '" />'; break; case '0': $course_status = '<img src="' . getPathImage() . '/standard/dot_grey.gif" alt="' . $lang->def('_NO_COURSE_ACTIVATED') . '" title="' . $lang->def('_NO_COURSE_ACTIVATED') . '" />'; break; case '1': $course_status = '<img src="' . getPathImage() . '/standard/dot_yellow.gif" alt="' . $lang->def('_SOME_COURSE_ACTIVATED') . '" title="' . $lang->def('_SOME_COURSE_ACTIVATED') . '" />'; break; case '2': $course_status = '<img src="' . getPathImage() . '/standard/dot_green.gif" alt="' . $lang->def('_ALL_COURSE_ACTIVATED') . '" title="' . $lang->def('_ALL_COURSE_ACTIVATED') . '" />'; break; } $tb->addBody(array($user, Format::date($transaction_info['date']), $transaction_info['price'], $lang->def('_' . strtoupper($transaction_info['method'])), $payment_status, $course_status, '<a href="index.php?modname=transaction&op=mod&id=' . $transaction_info['id_transaction'] . '">' . $mod_img . '</a>', '<a href="index.php?modname=transaction&op=del&id=' . $transaction_info['id_transaction'] . '">' . $del_img . '</a>')); } $array_payment_status = array('-2' => $lang->def('_ALL_STATUS'), '-1' => $lang->def('_CANCELLED'), '0' => $lang->def('_WAITING_PAYMENT'), '1' => $lang->def('_PARTIAL_PAID'), '2' => $lang->def('_PAID')); $array_course_status = array('-2' => $lang->def('_ALL_STATUS'), '-1' => $lang->def('_CANCELLED'), '0' => $lang->def('_NO_COURSE_ACTIVATED'), '1' => $lang->def('_SOME_COURSE_ACTIVATED'), '2' => $lang->def('_ALL_COURSE_ACTIVATED')); cout(Form::openForm('transaction_filter', 'index.php?modname=transaction&op=transaction') . $tb->getNavBar($page, $tot_transaction) . '<div class="quick_search_form">' . Form::getInputTextfield('search_t', 'tran', 'tran', $tran_filter, '', 255, '') . Form::getButton("filter", "filter", $lang->def('_FILTER'), "search_b") . '<br />' . '<a class="advanced_search" href="javascript:;" onclick="( this.nextSibling.style.display != \'block\' ? this.nextSibling.style.display = \'block\' : this.nextSibling.style.display = \'none\' );">' . $lang->def("_ADVANCED_SEARCH") . '</a>' . '<div class="overlay_menu" style="display:' . ($display ? 'block' : 'none') . '">' . Form::getDropdown($lang->def('_PAYMENT_STATUS_FILTER'), 'payment_status', 'payment_status', $array_payment_status, $status_filter) . Form::getDropdown($lang->def('_COURSE_STATUS_FILTER'), 'course_status', 'course_status', $array_course_status, $course_filter) . '</div>' . '</div>' . '<script type="text/javascript">' . 'var payment_status = YAHOO.util.Dom.get(\'payment_status\');' . 'var course_status = YAHOO.util.Dom.get(\'course_status\');' . 'var form = YAHOO.util.Dom.get(\'transaction_filter\');' . 'YAHOO.util.Event.on(payment_status, \'change\', function() { this.submit() } , form, true);' . 'YAHOO.util.Event.on(course_status, \'change\', function() { this.submit() } , form, true);' . '</script>' . $tb->getTable() . $tb->getNavBar($page, $tot_transaction) . Form::closeForm()); setupHrefDialogBox('a[href*=del]'); } else { cout(Lang::t('_NO_CONTENT', 'transaction')); } cout('</div>'); }
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&id_course=' . (int) $id_course, $lang->def('_BACK')); $out->add(getTitleArea(array('index.php?r=alms/course/certificate&id_course=' . (int) $id_course => $lang->def('_CERTIFICATE_ASSIGN_STATUS', 'course'), $lang->def('_COURSES')), 'certificate')); } else { $back_ui = getBackUi('index.php?modname=certificate&op=report_certificate&id_certificate=' . (int) $id_certificate, $lang->def('_BACK')); $out->add(getTitleArea(array('index.php?modname=certificate&op=certificate' => $lang->def('_TITLE_CERTIFICATE'), 'index.php?modname=certificate&op=report_certificate&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&certificate_id=' . $id_certificate . '&course_id=' . $id_course . '&user_id=' . $info['id_user']; $dl_url = $url . "&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 . '&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&op=view_report_certificate&id_certificate=" . (int) $id_certificate . "&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&op=del_gen_certificate' . '&id_certificate=' . (int) $id_certificate . '&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 .= ' <a href="javascript:;" id="select_page_1">'.Lang::t('_SELECT_PAGE', 'standard').'</a>'; $print_button_2 .= ' <a href="javascript:;" id="select_page_2">'.Lang::t('_SELECT_PAGE', 'standard').'</a>'; $print_button_1 .= ' <a href="javascript:;" id="unselect_page_1">'.Lang::t('_UNSELECT_PAGE', 'standard').'</a>'; $print_button_2 .= ' <a href="javascript:;" id="unselect_page_2">'.Lang::t('_UNSELECT_PAGE', 'standard').'</a>'; */ $print_button_1 .= ' <a href="javascript:;" id="select_all_1">' . Lang::t('_ALL_PAGES', 'directory') . '</a>'; $print_button_2 .= ' <a href="javascript:;" id="select_all_2">' . Lang::t('_ALL_PAGES', 'directory') . '</a>'; $print_button_1 .= ' <a href="javascript:;" id="unselect_all_1">' . Lang::t('_NONE', 'directory') . '</a>'; $print_button_2 .= ' <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('&', '&', 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'); }
function loadCourseSelector($noprint = false, $with_assesment = false) { require_once _base_ . '/lib/lib.table.php'; require_once _base_ . '/lib/lib.form.php'; $lang =& DoceboLanguage::createInstance('course', 'lms'); $output = ''; $output .= $this->treeview->load(); // Filter $this->filter['course_flat'] = isset($_POST['c_flatview']); //$this->filter['course_code'] = ( isset($_POST['c_filter_code']) ? $_POST['c_filter_code'] : '' ); $this->filter['course_name'] = isset($_POST['c_filter_name']) ? $_POST['c_filter_name'] : ''; if ($this->show_filter === true) { $output .= '<div class="quick_search_form">' . '<div class="common_options">' . Form::getInputCheckbox('c_flatview', 'c_flatview', '1', Get::req('c_flatview', DOTY_INT, '0') == '1' ? true : false, ' onclick="submit();" ') . ' <label class="label_normal" for="c_flatview">' . Lang::t('_DIRECTORY_FILTER_FLATMODE', 'admin_directory') . '</label>' . ' ' . '</div>' . '<div>' . Form::getInputTextfield("search_t", "c_filter_name", "c_filter_name", Get::req('c_filter_name', DOTY_ALPHANUM, ''), '', 255, '') . Form::getButton("c_filter_set", "c_filter_set", Lang::t('_SEARCH', 'standard'), "search_b") . '</div>' . '</div>'; } // End Filter $tb = new Table(Get::sett('visu_course'), $lang->def('_COURSE_LIST'), $lang->def('_COURSE_LIST_SUMMARY')); $tb->initNavBar('ini', 'button'); $ini = $tb->getSelectedElement(); $category_selected = $this->treeview->getSelectedFolderId(); if ($this->filter['course_flat']) { $id_categories = $this->treeDB->getDescendantsId($this->treeDB->getFolderById($category_selected)); $id_categories[] = $category_selected; } $select = "\r\n\t\tSELECT c.idCourse, c.code, c.name, c.description, c.status, c.difficult,\r\n\t\t\tc.subscribe_method, c.permCloseLo, c.show_rules, c.max_num_subscribe "; $query_course = "\r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_course AS c\r\n\t\tWHERE " . ($with_assesment ? '1' : "c.course_type <> 'assessment'") . " AND c.idCategory IN ( " . (!$this->filter['course_flat'] ? $category_selected : implode(",", $id_categories)) . " )"; if (Docebo::user()->getUserLevelId() != ADMIN_GROUP_GODADMIN) { $all_courses = false; require_once _base_ . '/lib/lib.preference.php'; $adminManager = new AdminPreference(); $admin_courses = $adminManager->getAdminCourse(Docebo::user()->getIdST()); $all_courses = false; if (isset($admin_courses['course'][0])) { $all_courses = true; } elseif (isset($admin_courses['course'][-1])) { require_once _lms_ . '/lib/lib.catalogue.php'; $cat_man = new Catalogue_Manager(); $user_catalogue = $cat_man->getUserAllCatalogueId(Docebo::user()->getIdSt()); if (count($user_catalogue) > 0) { $courses = array(0); foreach ($user_catalogue as $id_cat) { $catalogue_course =& $cat_man->getCatalogueCourse($id_cat, true); $courses = array_merge($courses, $catalogue_course); } foreach ($courses as $id_course) { if ($id_course != 0) { $admin_courses['course'][$id_course] = $id_course; } } } elseif (Get::sett('on_catalogue_empty', 'off') == 'on') { $all_courses = true; } } else { $array_courses = array(); $array_courses = array_merge($array_courses, $admin_courses['course']); if (!empty($admin_courses['coursepath'])) { require_once _lms_ . '/lib/lib.coursepath.php'; $path_man = new CoursePath_Manager(); $coursepath_course =& $path_man->getAllCourses($admin_courses['coursepath']); $array_courses = array_merge($array_courses, $coursepath_course); } if (!empty($admin_courses['catalogue'])) { require_once _lms_ . '/lib/lib.catalogue.php'; $cat_man = new Catalogue_Manager(); foreach ($admin_courses['catalogue'] as $id_cat) { $catalogue_course =& $cat_man->getCatalogueCourse($id_cat, true); $array_courses = array_merge($array_courses, $catalogue_course); } } $admin_courses['course'] = array_merge($admin_courses['course'], $array_courses); } if (!$all_courses) { if (empty($admin_courses['course'])) { $query_course .= " AND 0 "; } else { $query_course .= " AND c.idCourse IN (" . implode(',', $admin_courses['course']) . ") "; } } } /* if($this->filter['course_code'] != '') { $query_course .= " AND c.code LIKE '%".$this->filter['course_code']."%'"; }*/ if ($this->filter['course_name'] != '') { $query_course .= " AND ( c.code LIKE '%" . $this->filter['course_name'] . "%' OR c.name LIKE '%" . $this->filter['course_name'] . "%' ) "; } list($tot_course) = sql_fetch_row(sql_query("SELECT COUNT(*) " . $query_course)); $query_course .= " ORDER BY c.name\r\n\t\t\t\t\t\t\tLIMIT " . $ini . "," . (int) Get::sett('visuItem', 25); $re_course = sql_query($select . $query_course); $type_h = array('image', '', '', ''); $cont_h = array('<span class="access-only">' . $lang->def('_COURSE_SELECTION') . '</span>', $lang->def('_CODE'), $lang->def('_COURSE_NAME'), $lang->def('_STATUS')); $tb->setColsStyle($type_h); $tb->addHead($cont_h); $status_array = array(CST_PREPARATION => Lang::t('_CST_PREPARATION', 'course'), CST_AVAILABLE => Lang::t('_CST_AVAILABLE', 'course'), CST_EFFECTIVE => Lang::t('_CST_CONFIRMED', 'course'), CST_CONCLUDED => Lang::t('_CST_CONCLUDED', 'course'), CST_CANCELLED => Lang::t('_CST_CANCELLED', 'course')); while (list($id_course, $code, $name, $desc, $status, $difficult, $auto_sub, $end_mode, $show_rules, $max_user_sub) = sql_fetch_row($re_course)) { $tb_content = array(Form::getInputCheckbox('new_course_selected_' . $id_course, 'new_course_selected[' . $id_course . ']', $id_course, isset($this->current_selection[$id_course]), ''), '<label for="new_course_selected_' . $id_course . '">' . $code . '</label>', '<label for="new_course_selected_' . $id_course . '">' . $name . '</label>'); $tb_content[] = $status_array[$status]; $tb->addBody($tb_content); if (isset($this->current_selection[$id_course])) { unset($this->current_selection[$id_course]); } } $output .= $tb->getTable() . $tb->getNavBar($ini, $tot_course) . $this->stateSelection(); //, 'content'); if ($noprint) { return $output; } else { cout($output); } }
function forumsearchmessage() { checkPerm('view'); $search_arg = $_SESSION['forum']['search_arg']; require_once _base_ . '/lib/lib.table.php'; require_once _base_ . '/lib/lib.form.php'; $lang =& DoceboLanguage::createInstance('forum', 'lms'); $id_thread = importVar('idThread', true, 0); $ini_thread = importVar('ini_thread'); $sema_perm = checkPerm('sema', true); $moderate = checkPerm('moderate', true); $mod_perm = checkPerm('mod', true); $acl_man =& Docebo::user()->getAclManager(); $tb = new Table(Get::sett('visuItem'), $lang->def('_CAPTION_FORUM_MESSAGE'), $lang->def('_CAPTION_FORUM_MESSAGE')); $tb->initNavBar('ini', 'link'); $tb->setLink('index.php?modname=forum&op=searchmessage&idThread=' . $id_thread . '&ini_thread=' . $ini_thread); $ini = $tb->getSelectedElement(); $ini_page = $tb->getSelectedPage(); // Some info about forum and thread $thread_query = "\r\n\tSELECT idForum, title, num_post, locked, erased\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_forumthread\r\n\tWHERE idThread = '" . $id_thread . "'"; list($id_forum, $thread_title, $tot_message, $locked_t, $erased_t) = sql_fetch_row(sql_query($thread_query)); $forum_query = "\r\n\tSELECT title, locked\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_forum\r\n\tWHERE idForum = '" . $id_forum . "'"; list($forum_title, $locked_f) = sql_fetch_row(sql_query($forum_query)); ++$tot_message; //set as readed if needed if (isset($_SESSION['unreaded_forum'][$_SESSION['idCourse']][$id_forum][$id_thread])) { unset($_SESSION['unreaded_forum'][$_SESSION['idCourse']][$id_forum][$id_thread]); } if ($ini == 0 && !isset($_GET['result'])) { sql_query("\r\n\t\tUPDATE " . $GLOBALS['prefix_lms'] . "_forumthread\r\n\t\tSET num_view = num_view + 1\r\n\t\tWHERE idThread = '" . $id_thread . "'"); } $page_title = array('index.php?modname=forum&op=forum' => $lang->def('_FORUM'), 'index.php?modname=forum&op=search&ini=' . $ini_thread => $thread_title, $lang->def('_SEARCH_RESULT_FOR') . ' : ' . $search_arg); if ($erased_t && !$mod_perm && !$moderate) { $GLOBALS['page']->add(getTitleArea($page_title, 'forum') . '<div class="std_block">' . $lang->def('_CANNOTENTER') . '</div>', 'content'); return; } // Who have semantic evaluation $re_sema = sql_query("\r\n\tSELECT DISTINCT idmsg\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_forum_sema"); while (list($msg_sema) = sql_fetch_row($re_sema)) { $forum_sema[$msg_sema] = 1; } // Find post $messages = array(); $authors = array(); $authors_names = array(); $authors_info = array(); $re_message = sql_query("\r\n\tSELECT idMessage, posted, title, textof, attach, locked, author, modified_by, modified_by_on\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_forummessage\r\n\tWHERE idThread = '" . $id_thread . "'\r\n\tORDER BY posted\r\n\tLIMIT {$ini}, " . Get::sett('visuItem')); while ($record = mysql_fetch_assoc($re_message)) { $messages[$record['idMessage']] = $record; $authors[$record['author']] = $record['author']; if ($record['modified_by'] != 0) { $authors[$record['modified_by']] = $record['modified_by']; } } $authors_names =& $acl_man->getUsers($authors); $level_name = CourseLevel::getLevels(); // Retriving level and number of post of th authors $re_num_post = sql_query("\r\n\tSELECT u.idUser, u.level, COUNT(*)\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_forummessage AS m, " . $GLOBALS['prefix_lms'] . "_courseuser AS u\r\n\tWHERE u.idCourse = '" . (int) $_SESSION['idCourse'] . "' AND m.author = u.idUser AND m.author IN ( " . implode($authors, ',') . " )\r\n\tGROUP BY u.idUser, u.level"); while (list($id_u, $level_u, $num_post_a) = sql_fetch_row($re_num_post)) { $authors_info[$id_u] = array('num_post' => $num_post_a, 'level' => $level_name[$level_u]); } $type_h = array('forum_sender', 'forum_text'); $cont_h = array($lang->def('_AUTHOR'), $lang->def('_TEXTOF')); $tb->setColsStyle($type_h); $tb->addHead($cont_h); // Compose messagges display $path = $GLOBALS['where_files_relative'] . '/appCore/' . Get::sett('pathphoto'); while (list($id_message, $message_info) = each($messages)) { // sender info $m_author = $message_info['author']; if (isset($authors_names[$m_author]) && $authors_names[$m_author][ACL_INFO_AVATAR] != '') { $img_size = @getimagesize($path . $authors_names[$m_author][ACL_INFO_AVATAR]); } $sender = '<div class="forum_author">' . (isset($authors_names[$m_author]) ? $authors_names[$m_author][ACL_INFO_LASTNAME] . $authors_names[$m_author][ACL_INFO_FIRSTNAME] == '' ? $acl_man->relativeId($authors_names[$m_author][ACL_INFO_USERID]) : $authors_names[$m_author][ACL_INFO_LASTNAME] . ' ' . $authors_names[$m_author][ACL_INFO_FIRSTNAME] : $lang->def('_UNKNOWN_AUTHOR')) . '</div>' . '<div class="forum_level">' . $lang->def('_LEVEL') . ' : ' . $authors_info[$m_author]['level'] . '</div>' . (isset($authors_names[$m_author]) && $authors_names[$m_author][ACL_INFO_AVATAR] != '' ? '<img class="forum_avatar' . ($img_size[0] > 150 || $img_size[1] > 150 ? ' image_limit' : '') . '" src="' . $path . $authors_names[$m_author][ACL_INFO_AVATAR] . '" alt="' . $lang->def('_AVATAR') . '" />' : '') . '<div class="forum_numpost">' . $lang->def('_NUMPOST') . ' : ' . (isset($authors_info[$m_author]['num_post']) ? $authors_info[$m_author]['num_post'] : 0) . '</div>' . '<img src="' . getPathImage() . 'standard/identity.png" alt=">" /> ' . '<a href="index.php?modname=forum&op=viewprofile&idMessage=' . $id_message . '&ini=' . $ini_page . '&idThread=' . $id_thread . '">' . $lang->def('_VIEW_PROFILE') . '</a>'; // msg info $msgtext = ''; $msgtext .= '<div class="forum_post_posted">' . $lang->def('_DATE') . ' : ' . Format::date($message_info['posted']) . ' ( ' . loadDistance($message_info['posted']) . ' )' . '</div>'; if ($message_info['locked']) { $msgtext .= '<div class="forum_post_locked">' . $lang->def('_LOCKEDMESS') . '</div>'; } else { if ($message_info['attach'] != '') { $msgtext .= '<div class="forum_post_attach">' . '<a href="index.php?modname=forum&op=download&id=' . $id_message . '">' . $lang->def('_ATTACHMENT') . ' : ' . '<img src="' . getPathImage() . mimeDetect($message_info['attach']) . '" alt="' . $lang->def('_ATTACHMENT') . '" /></a>' . '</div>'; } $textof = str_replace('[quote]', '<blockquote class="forum_quote">', str_replace('[/quote]', '</blockquote>', $message_info['textof'])); $msgtext .= '<div class="forum_post_title">' . $lang->def('_SUBJECT') . ' : ' . ($search_arg !== '' ? eregi_replace($search_arg, '<span class="filter_evidence">' . $search_arg . '</span>', $message_info['title']) : $message_info['title']) . '</div>'; $msgtext .= '<div class="forum_post_text">' . ($search_arg !== '' ? eregi_replace($search_arg, '<span class="filter_evidence">' . $search_arg . '</span>', $textof) : $textof) . '</div>'; if ($message_info['modified_by'] != 0) { $modify_by = $message_info['modified_by']; $msgtext .= '<div class="forum_post_modified_by">' . $lang->def('_MODIFY_BY') . ' : ' . (isset($authors_names[$modify_by]) ? $authors_names[$modify_by][ACL_INFO_LASTNAME] . $authors_names[$modify_by][ACL_INFO_FIRSTNAME] == '' ? $acl_man->relativeId($authors_names[$modify_by][ACL_INFO_USERID]) : $authors_names[$modify_by][ACL_INFO_LASTNAME] . ' ' . $authors_names[$modify_by][ACL_INFO_FIRSTNAME] : $lang->def('_UNKNOWN_AUTHOR')) . ' ' . $lang->def('_ON') . ' : ' . Format::date($message_info['modified_by_on']) . '</div>'; } if (isset($authors_names[$m_author]) && $authors_names[$m_author][ACL_INFO_SIGNATURE] != '') { $msgtext .= '<div class="forum_post_sign_separator"></div>' . '<div class="forum_post_sign">' . $authors_names[$m_author][ACL_INFO_SIGNATURE] . '</div>'; } } $content = array($sender, $msgtext); $tb->addBody($content); // some action that you can do with this message $action = ''; if ($moderate || $mod_perm) { if ($message_info['locked']) { $action .= '<a href="index.php?modname=forum&op=moderatemessage&idMessage=' . $id_message . '&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&op=moderatemessage&idMessage=' . $id_message . '&ini=' . $ini_page . '" ' . 'title="' . $lang->def('_MODERATE') . ' : ' . strip_tags($message_info['title']) . '">' . '<img src="' . getPathImage() . 'standard/moderate.png" alt="' . $lang->def('_MODERATE') . ' : ' . strip_tags($message_info['title']) . '" /> ' . $lang->def('_MODERATE') . '</a> '; } } if (!$locked_t && !$locked_f || $mod_perm || $moderate) { $action .= '<a href="index.php?modname=forum&op=addmessage&idThread=' . $id_thread . '&idMessage=' . $id_message . '&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&op=modmessage&idMessage=' . $id_message . '&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&op=delmessage&idMessage=' . $id_message . '&ini=' . $ini_page . '" ' . 'title="' . $lang->def('_DEL') . ' : ' . strip_tags($message_info['title']) . '">' . '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . ' : ' . strip_tags($message_info['title']) . '" /> ' . $lang->def('_DEL') . '</a> '; } $tb->addBodyExpanded($action, 'forum_action'); } if (!$locked_t && !$locked_f || $mod_perm || $moderate) { $tb->addActionAdd('<a href="index.php?modname=forum&op=addmessage&idThread=' . $id_thread . '&ini=' . $ini_page . '" title="' . $lang->def('_REPLY') . '">' . '<img src="' . getPathImage() . 'standard/add.png" alt="' . $lang->def('_ADD') . '" /> ' . $lang->def('_REPLY') . '</a>'); } $GLOBALS['page']->add(getTitleArea($page_title, 'forum') . '<div class="std_block">' . Form::openForm('search_forum', 'index.php?modname=forum&op=search&idThread=' . $id_thread) . '<div class="quick_search_form">' . '<label for="search_arg">' . $lang->def('_SEARCH_LABEL') . '</label> ' . Form::getInputTextfield('search_t', 'search_arg', 'search_arg', $search_arg, $lang->def('_SEARCH'), 255, '') . '<input class="search_b" type="submit" id="search_button" name="search_button" value="' . $lang->def('_SEARCH') . '" />' . '</div>' . Form::closeForm(), 'content'); if ($moderate || $mod_perm) { $GLOBALS['page']->add('<div class="forum_action_top">' . '<a href="index.php?modname=forum&op=modstatusthread&idThread=' . $id_thread . '&ini=' . $ini_page . '">' . ($locked_t ? '<img src="' . getPathImage() . 'standard/msg_read.png" alt="' . $lang->def('_FREE') . '" /> ' . $lang->def('_FREETHREAD') : '<img src="' . getPathImage() . 'standard/locked.png" alt="' . $lang->def('_LOCKTHREAD') . '" /> ' . $lang->def('_LOCKTHREAD')) . '</a> ' . '<a href="index.php?modname=forum&op=changeerased&idThread=' . $id_thread . '&ini=' . $ini_page . '">' . ($erased_t ? '<img src="' . getPathImage() . 'standard/msg_read.png" alt="' . $lang->def('_UNERASE') . '" /> ' . $lang->def('_UNERASE') : '<img src="' . getPathImage() . 'standard/moderate.png" alt="' . $lang->def('_MODERATE') . '" /> ' . $lang->def('_MODERATE')) . '</a>' . '</div>', 'content'); } $GLOBALS['page']->add($tb->getTable(), 'content'); if ($moderate || $mod_perm) { $GLOBALS['page']->add('<div class="forum_action_bottom">' . '<a href="index.php?modname=forum&op=modstatusthread&idThread=' . $id_thread . '&ini=' . $ini_page . '">' . ($locked_t ? '<img src="' . getPathImage() . 'standard/msg_read.png" alt="' . $lang->def('_FREE') . '" /> ' . $lang->def('_FREETHREAD') : '<img src="' . getPathImage() . 'standard/locked.png" alt="' . $lang->def('_LOCKTHREAD') . '" /> ' . $lang->def('_LOCKTHREAD')) . '</a> ' . '<a href="index.php?modname=forum&op=changeerased&idThread=' . $id_thread . '&ini=' . $ini_page . '">' . ($erased_t ? '<img src="' . getPathImage() . 'standard/msg_read.png" alt="' . $lang->def('_UNERASE') . '" /> ' . $lang->def('_UNERASE') : '<img src="' . getPathImage() . 'standard/moderate.png" alt="' . $lang->def('_MODERATE') . '" /> ' . $lang->def('_MODERATE')) . '</a>' . '</div>', 'content'); } $GLOBALS['page']->add($tb->getNavBar($ini, $tot_message) . '</div>', 'content'); }
function viewUserEvent() { checkPerm('view'); require_once _base_ . '/lib/lib.navbar.php'; require_once _base_ . '/lib/lib.table.php'; $lang =& DoceboLanguage::createInstance('reservation'); $id_event = importVar('id_event', true, 0); $mod_perm = checkPerm('mod', true); $out = $GLOBALS['page']; $out->setWorkingZone('content'); $man_res = new Man_Reservation(); $acl =& Docebo::user()->getAcl(); $acl_man =& Docebo::user()->getAclManager(); $user_idst = getLogUserId(); $user_subscribed = array(); $user_sunscribed = $man_res->getSubscribedUserIdst($id_event); $user_info = array(); $user_info =& $acl_man->getUsers($user_sunscribed); $out->add(getTitleArea($lang->def('_VIEW_EVENT_USER'), '', $lang->def('_EVENT')) . '<div class="std_block">'); $error = importVar('error', false, ''); if ($error !== '') { switch ($error) { case 'del_registration': $out->add(getErrorUi($lang->def('_DEL_REGISTRATION_ERROR'))); break; } } if ($user_info) { $tb = new Table(10, $lang->def('_RESERVATION_CAPTION'), $lang->def('_RESERVATION_SUMMARY')); $tb->initNavBar('ini', 'button'); $ini = $tb->getSelectedElement(); $cont_h = array($lang->def('_USERNAME'), $lang->def('_FIRSTNAME'), $lang->def('_LASTNAME'), $lang->def('_EMAIL')); $type_h = array('', '', '', ''); if ($mod_perm) { $cont_h = array($lang->def('_USERNAME'), $lang->def('_FIRSTNAME'), $lang->def('_LASTNAME'), $lang->def('_EMAIL'), '<img src="' . getPathImage() . '/standard/delete.png" title="' . $lang->def('_REM_USER') . '" alt="' . $lang->def('_REM_USER') . '" />'); $type_h = array('', '', '', '', 'img'); } $tb->setColsStyle($type_h); $tb->addHead($cont_h); if ($user_info) { foreach ($user_info as $info_user) { $count = array(); $count[] = $acl_man->relativeId($info_user[ACL_INFO_USERID]); $count[] = $info_user[ACL_INFO_FIRSTNAME]; $count[] = $info_user[ACL_INFO_LASTNAME]; $count[] = $info_user[ACL_INFO_EMAIL]; $count[] = '<a href="index.php?modname=reservation&op=del_registration&id_user='******'&id_event=' . $id_event . '"><img src="' . getPathImage() . '/standard/delete.png" title="' . $lang->def('_REM_USER') . '" alt="' . $lang->def('_REM_USER') . '" /></a>'; $tb->addBody($count); } } if ($mod_perm) { $tb->addActionAdd('<a href="index.php?modname=reservation&op=add_event"> <img src="' . getPathImage() . 'standard/add.png" title="' . $lang->def('_NEW_EVENT') . '" alt="' . $lang->def('_NEW_EVENT') . '" /> ' . $lang->def('_NEW_EVENT') . '</a>'); } $out->add($tb->getTable() . $tb->getNavBar($ini, count($user_info))); $out->add('<a href="index.php?modname=reservation&op=excel&id_event=' . $id_event . '" target="_blank">' . $lang->def('_EXPORT_XLS') . '</a>', 'content'); } else { $out->add($lang->def('_NO_USERS_FOUND'), 'content'); } $out->add(getBackUi('index.php?modname=reservation&op=view_registration', $lang->def('_BACK')), 'content'); $out->add('</div>', 'content'); }
function get_report_table($url = '') { checkPerm('view'); $can_mod = checkPerm('mod', true); require_once _base_ . '/lib/lib.table.php'; require_once _base_ . '/lib/lib.form.php'; $acl_man =& Docebo::user()->getACLManager(); $level = Docebo::user()->getUserLevelId(Docebo::user()->getIdst()); $lang =& DoceboLanguage::createInstance('report'); $output = ''; $is_admin = $level == ADMIN_GROUP_GODADMIN || $level == ADMIN_GROUP_ADMIN ? true : false; if ($is_admin || $can_mod) { //if ($can_mod) { cout('<script type="text/javascript"> var _FAILURE = "error"; var ajax_path = "' . Get::rel_path('lms') . '/ajax.adm_server.php?mn=report&plf=lms"; function public_report(o, id_rep) { o.disabled=true; //no more operations allowed on the checkbox while ajaxing var val_el=document.getElementById("enable_value_"+id_rep); var value=val_el.value; var data = "&op=public_rep&id="+id_rep+"&val="+value; var objAjax = YAHOO.util.Connect.asyncRequest("POST", ajax_path+data, { success:function(t) { var temp=o.src; if (value==1) { o.src=temp.replace("unpublish.png", "publish.png"); val_el.value=0; } if (value==0) { o.src=temp.replace("publish.png", "unpublish.png"); val_el.value=1; } o.disabled=false; }, failure:function(t) { o.disabled=false; alert(_FAILURE); //... } }); } function setReportFilter() { var el = document.createElement("INPUT"); el.type = "hidden"; el.name = "search"; el.value = "1"; var form = YAHOO.util.Dom.get("report_searchbox_form"); if (form) { form.appendChild(el); form.submit(); } } </script>', 'page_head'); } //filter by author YuiLib::load(); $current_user = $acl_man->getUser(Docebo::user()->getIdst(), false); //dropdown data arrays $authors = array(0 => '(' . $lang->def('_ALL') . ')', $current_user[ACL_INFO_IDST] => $acl_man->relativeId($current_user[ACL_INFO_USERID])); $query = "SELECT u.idst, u.userid FROM %lms_report_filter as r JOIN %adm_user as u ON (r.author=u.idst) WHERE u.idst<>" . Docebo::user()->getIdst() . " ORDER BY u.userid"; $res = sql_query($query); while ($row = sql_fetch_assoc($res)) { $authors[$row['idst']] = $acl_man->relativeId($row['userid']); } $arr_report_types = array(0 => '(' . $lang->def('_ALL') . ')'); //initializa session variable for filters if (!isset($_SESSION['report_admin_filter'])) { $_SESSION['report_admin_filter'] = array('author' => 0, 'name' => '', 'type' => 0); } if (Get::req('search', DOTY_MIXED, false) !== false) { $_SESSION['report_admin_filter']['author'] = Get::req('filter_author', DOTY_INT, (int) $_SESSION['report_admin_filter']['author']); $_SESSION['report_admin_filter']['name'] = Get::req('filter_name', DOTY_STRING, $_SESSION['report_admin_filter']['name']); $_SESSION['report_admin_filter']['type'] = Get::req('filter_type', DOTY_INT, (int) $_SESSION['report_admin_filter']['type']); } if (Get::req('reset', DOTY_MIXED, false) !== false) { $_SESSION['report_admin_filter']['author'] = 0; $_SESSION['report_admin_filter']['name'] = ''; $_SESSION['report_admin_filter']['type'] = 0; } $dropdown_onclick = 'onchange="javascript:setReportFilter();"'; $output .= Form::openForm('report_searchbox_form', 'index.php?modname=report&op=reportlist&of_platform=lms', false, 'POST'); $output .= Form::getHidden('op', 'op', 'reportlist'); $output .= Form::getHidden('modname', 'modname', 'report'); $output .= '<div class="quick_search_form"> <div> <div class="simple_search_box" id="report_searchbox_simple_filter_options" style="display: block;">' . Form::getInputDropdown('dropdown', 'report_searchbox_filter_author', 'filter_author', $authors, $_SESSION['report_admin_filter']['author'], $dropdown_onclick) . " " . Form::getInputTextfield("search_t", "report_searchbox_filter_name", "filter_name", $_SESSION['report_admin_filter']['name'], '', 255, '') . Form::getButton("report_searchbox_filter_set", "search", Lang::t('_SEARCH', 'standard'), "search_b") . Form::getButton("report_searchbox_filter_reset", "reset", Lang::t('_RESET', 'standard'), "reset_b") . '</div> </div> </div>'; $output .= Form::closeForm(); //end filter //compose search query $qconds = array(); $query = "SELECT t1.*, t2.userid FROM %lms_report_filter as t1 LEFT JOIN %adm_user as t2 ON t1.author=t2.idst "; switch ($level) { case ADMIN_GROUP_GODADMIN: if ($_SESSION['report_admin_filter']['author'] > 0) { $qconds[] = " t1.author = " . $_SESSION['report_admin_filter']['author'] . " "; } break; case ADMIN_GROUP_ADMIN: case ADMIN_GROUP_PUBLICADMIN: case ADMIN_GROUP_USER: default: if ($_SESSION['report_admin_filter']['author'] > 0) { $qconds[] = " ( t1.author = " . $_SESSION['report_admin_filter']['author'] . " AND t1.is_public = 1 ) "; } else { $qconds[] = " ( t1.author = " . Docebo::user()->getIdst() . " OR t1.is_public = 1 ) "; } break; } if (trim($_SESSION['report_admin_filter']['name']) != "") { $qconds[] = " t1.filter_name LIKE '%" . $_SESSION['report_admin_filter']['name'] . "%' "; } if (trim($_SESSION['report_admin_filter']['type']) > 0) { //$qconds[] = " t1.filter_name LIKE '".$_SESSION['report_admin_filter']['name']."' "; } if (!empty($qconds)) { $query .= " WHERE " . implode(" AND ", $qconds); } //$_SESSION['report_admin_filter']['type'] //end query $tb = new Table(Get::sett('visu_course')); $tb->initNavBar('ini', 'button'); $col_type = array('', '', 'align_center', 'image', 'image', 'img-cell', 'img-cell', 'image'); //,'image','image'); $col_content = array($lang->def('_NAME'), $lang->def('_TAB_REP_CREATOR'), $lang->def('_CREATION_DATE'), $lang->def('_TAB_REP_PUBLIC'), '<img src="' . getPathImage() . 'standard/view.png" alt="' . $lang->def('_VIEW') . '" title="' . $lang->def('_VIEW') . '" />', '<span class="ico-sprite subs_csv"><span>' . Lang::t('_EXPORT_CSV', 'report') . '</span></span>', '<span class="ico-sprite subs_xls"><span>' . Lang::t('_EXPORT_XLS', 'report') . '</span></span>', '<img src="' . getPathImage() . 'standard/wait_alarm.png" alt="' . $lang->def('_SCHEDULE') . '" title="' . $lang->def('_SCHEDULE') . '" />'); if ($is_admin || $can_mod) { $col_type[] = 'image'; $col_type[] = 'image'; $col_content[] = '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . '" title="' . $lang->def('_MOD') . '" />'; $col_content[] = '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . '" title="' . $lang->def('_DEL') . '" />'; } $tb->setColsStyle($col_type); $tb->addHead($col_content); if ($res = sql_query($query)) { while ($row = sql_fetch_assoc($res)) { $id = $row['id_filter']; $opn_link = '<a href="index.php?modname=report&op=show_results&idrep=' . $id . '" ' . ' title="' . $lang->def('_VIEW') . '">' . '<img src="' . getPathImage() . 'standard/view.png" alt="' . $lang->def('_VIEW') . '" />' . '</a>'; $sch_link = '<a href="index.php?modname=report&op=schedulelist&idrep=' . $id . '" ' . ' title="' . $lang->def('_SCHEDULE') . '">' . '<img src="' . getPathImage() . 'standard/wait_alarm.png" alt="' . $lang->def('_SCHEDULE') . '" />' . '</a>'; $mod_link = '<a href="' . $url . '&action=modify&idrep=' . $id . '" ' . ' title="' . $lang->def('_MOD') . '">' . '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . '" />' . '</a>'; $rem_link = '<a href="' . $url . '&action=delete&idrep=' . $id . '" ' . ' title="' . $lang->def('_DEL') . ' : ' . ($row['author'] == 0 ? $lang->def($row['filter_name']) : $row['filter_name']) . '">' . '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . '" />'; //. '</a>'; $can_public = $can_mod ? true : ($is_admin && $row['author'] == Docebo::user()->getIdst() ? true : false); $public = '<image ' . ($can_public ? 'class="handover"' : '') . ' src="' . getPathImage('lms') . 'standard/' . ($row['is_public'] == 1 ? '' : 'un') . 'publish.png' . '" ' . ($is_admin || $can_mod ? 'onclick="public_report(this, ' . $row['id_filter'] . ');" ' : '') . ' />' . '<input type="hidden" id="enable_value_' . $row['id_filter'] . '" ' . 'value="' . ($row['is_public'] == 1 ? '0' : '1') . '" />'; $export_url = 'index.php?modname=report&op=show_results&idrep=' . (int) $id; $export_link_csv = '<a class="ico-sprite subs_csv" href="' . $export_url . '&dl=csv" title="' . Lang::t('_EXPORT_CSV', 'report') . '"><span></span>' . Lang::t('_EXPORT_CSV', 'report') . '</a>'; $export_link_xls = '<a class="ico-sprite subs_xls" href="' . $export_url . '&dl=xls" title="' . Lang::t('_EXPORT_XLS', 'report') . '"><span></span>' . Lang::t('_EXPORT_XLS', 'report') . '</a>'; $_name = $row['author'] == 0 ? $lang->def($row['filter_name']) : $row['filter_name']; if (trim($_SESSION['report_admin_filter']['name']) != "") { $_name = Layout::highlight($_name, $_SESSION['report_admin_filter']['name']); } $tb_content = array(_REP_KEY_NAME => $_name, _REP_KEY_CREATOR => $row['author'] == 0 ? '<div class="align_center">-</div>' : $acl_man->relativeId($row['userid']), _REP_KEY_CREATION => Format::date($row['creation_date']), _REP_KEY_PUBLIC => $public, _REP_KEY_OPEN => $opn_link, $export_link_csv, $export_link_xls, _REP_KEY_SCHED => $sch_link); if ($is_admin || $can_mod) { if ($row['author'] == Docebo::user()->getIdst() || $can_mod) { $tb_content[_REP_KEY_MOD] = $mod_link; $tb_content[_REP_KEY_REM] = $rem_link; } else { $tb_content[_REP_KEY_MOD] = ' '; $tb_content[_REP_KEY_REM] = ' '; } } $tb->addBody($tb_content); } } if ($is_admin || $can_mod) { //if ($can_mod) { $tb->addActionAdd(' <a href="index.php?modname=report&op=report_category">' . '<img src="' . getPathImage() . 'standard/add.png" ' . 'title="' . $lang->def('_NEW') . '" /> ' . $lang->def('_NEW') . '</a>'); } $output .= $tb->getTable(); require_once _base_ . '/lib/lib.dialog.php'; setupHrefDialogBox('a[href*=delete]'); return $output; }
function wikiPageHistory($vis_item = FALSE) { require_once _base_ . '/lib/lib.table.php'; require_once $GLOBALS["where_framework"] . "/lib/lib.wiki_revision.php"; require_once _base_ . "/lib/lib.form.php"; $res = ""; $wiki_id = $this->getWikiId(); $page_code = $this->getPageCode(); $wiki_lang = $this->getWikiLanguage(); $page_info = $this->wikiManager->getPageInfo($wiki_id, $wiki_lang, $page_code); $wiki_lang = $this->getWikiLanguage(); $form = new Form(); $rev = new WikiRevisionManager(array($wiki_id, $page_info["page_id"], $wiki_lang)); if ($vis_item === FALSE) { $vis_item = Get::sett('visuItem'); } $table_caption = $this->lang->def("_HISTORY"); $table_summary = $this->lang->def("_HISTORY"); $um =& UrlManager::getInstance(); $tab = new Table($vis_item, $table_caption, $table_summary); $head = array($this->lang->def("_VERSION")); $head[] = $this->lang->def("_AUTHOR"); $head[] = $this->lang->def("_DATE"); $img = "<img src=\"" . getPathImage('fw') . "wiki/show.png\" alt=\"" . $this->lang->def("_ALT_VIEW_REVISION") . "\" "; $img .= "title=\"" . $this->lang->def("_ALT_VIEW_REVISION") . "\" />"; $head[] = " "; //$img; $img = "<img src=\"" . getPathImage('fw') . "standard/edit.png\" alt=\"" . $this->lang->def("_MOD") . "\" "; $img .= "title=\"" . $this->lang->def("_MOD") . "\" />"; $head[] = " "; //$img; $head_type = array("", "", "", "image", "image"); $tab->setColsStyle($head_type); $tab->addHead($head); $tab->initNavBar('ini', 'link'); $tab->setLink($um->getUrl()); $ini = $tab->getSelectedElement(); $data_info = $rev->getRevisionList($ini, $vis_item); $data_arr = $data_info["data_arr"]; $tot = count($data_arr); if ($tot != 0) { $user_arr = $data_info["user"]; } $db_tot = $data_info["data_tot"]; for ($i = 0; $i < $tot; $i++) { $rowcnt = array(); $version = $data_arr[$i]["version"]; //rc// $rowcnt[]=$form->getRadio("", "previous_ver_".$version, "previous_ver", $version); //rc// $rowcnt[]=$form->getRadio("", "current_ver_".$version, "current_ver", $version);; $rowcnt[] = $version; $user_idst = $data_arr[$i]["author"]; $rowcnt[] = $user_arr[$user_idst]; $rowcnt[] = Format::date($data_arr[$i]["rev_date"]); $img = "<img src=\"" . getPathImage('fw') . "wiki/show.png\" alt=\"" . $this->lang->def("_ALT_VIEW_REVISION") . "\" "; $img .= "title=\"" . $this->lang->def("_ALT_VIEW_REVISION") . "\" />"; $url = $um->getUrl("page=" . $page_code . "&version=" . $version); $rowcnt[] = "<a href=\"" . $url . "\">" . $img . "</a>\n"; $img = "<img src=\"" . getPathImage('fw') . "standard/edit.png\" alt=\"" . $this->lang->def("_MOD") . "\" "; $img .= "title=\"" . $this->lang->def("_MOD") . "\" />"; $url = $um->getUrl("op=edit&page=" . $page_code . "&version=" . $version); $rowcnt[] = "<a href=\"" . $url . "\">" . $img . "</a>\n"; $tab->addBody($rowcnt); } $url = $um->getUrl("op=history&page=" . $page_code); //rc// $res.=$form->openForm("main_form", $url); $tab->setLink($url); $res .= $tab->getTable() . $tab->getNavBar($ini, $db_tot); //rc// $res.=$form->openButtonSpace(); //rc// $res.=$form->getButton("compare", "compare", $this->lang->def("_COMPARE_SEL_VER")); //rc// $res.=$form->closeButtonSpace(); //rc// $res.=$form->closeForm(); return $res; }
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&op=classroom&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&op=modclassroom&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&op=delclassroom&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&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&op=reservation&active_tab=subscribed_user', $lang->def('_BACK'))); $out->add($tb->getTable() . $tb->getNavBar($ini, $tot_classroom) . '</div>'); }
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&id_course=' . (int) $id_course, $lang->def('_BACK')); $out->add(getTitleArea(array('index.php?r=lms/pcourse/certificate&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&certificate_id=' . $id_certificate . '&course_id=' . $id_course . '&user_id=' . $info['id_user']; $dl_url = $url . "&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 . '&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&op=view_report_certificate&id_certificate=" . (int) $id_certificate . "&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>' . ' ' . 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>' . ' ' . 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('&', '&', 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'); }
function showHistory() { checkPerm('mod'); require_once _base_ . '/lib/lib.form.php'; require_once _base_ . '/lib/lib.table.php'; $lang =& DoceboLanguage::createInstance('conference', 'lms'); $conference = new Conference_Manager(); cout('<div class="yui-navset yui-navset-top tab_block"> <ul class="yui-nav"> <li class="first"> <a href="index.php?modname=conference&op=show"> <em>' . Lang::t('_ACTIVE', 'conference') . '</em> </a> </li> <li class="selected"> <a href="index.php?modname=conference&op=history"> <em>' . Lang::t('_HISTORY', 'conference') . '</em> </a> </li> </ul> <div class="yui-content">', 'content'); $tb = new Table(10, $lang->def('_OLD_ROOMS'), $lang->def('_OLD_ROOM')); $tb->initNavBar('ini', 'button'); $ini = $tb->getSelectedElement(); if (isset($_POST['unset_filter'])) { unset($_POST['filter_date']); } $date_filter = Get::req('filter_date', DOTY_MIXED, ''); $rooms = $conference->getOldRoom($_SESSION['idCourse'], $ini); $rooms_number = $conference->getOldRoomNumber($_SESSION['idCourse']); if ($rooms_number == 0) { $GLOBALS['page']->add(Form::openForm('history_table', 'index.php?modname=conference&op=history') . Form::openElementSpace() . Form::getDatefield($lang->def('_DATE'), 'filter_date', 'filter_date', $date_filter) . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('filter', 'filter', $lang->def('_FILTER')) . Form::getButton('unset_filter', 'unset_filter', $lang->def('_UNDO')) . Form::closeElementSpace() . Form::closeForm() . '<strong id="noroom">' . $lang->def('_NO_ROOM_AVAILABLE') . '</strong>' . '<br/>' . getBackUi('index.php?modname=conference&op=list', $lang->def('_BACK')), 'content'); } else { $cont_h = array($lang->def('_VIDEOCONFERENCE'), $lang->def('_START_DATE'), $lang->def('_MEETING_HOURS'), ''); $type_h = array('table_main_colum', 'align_center nowrap', 'align_center nowrap', 'image'); $tb->setColsStyle($type_h); $tb->addHead($cont_h); foreach ($rooms as $room_info) { $room_id = $room_info['id']; $cont = array(); $cont[] = $room_info['name'] . " (" . $room_info['room_type'] . ")"; $cont[] = Format::date(date('Y-m-d H:i:s', $room_info['starttime']), 'datetime'); $cont[] = $room_info['meetinghours']; $now = time(); if ($room_info['room_type'] == 'teleskill') { $cont[] = '<a href="index.php?modname=conference&op=log&id=' . $room_info['id'] . '" ' . 'title="' . $lang->def('_LOG') . ' : ' . strip_tags($room_info['name']) . '"><img src="' . getPathImage() . '/standard/edit.png' . '" /></a>'; } else { $cont[] = ''; } $tb->addBody($cont); } cout(Form::openForm('history_table', 'index.php?modname=conference&op=history') . Form::openElementSpace() . Form::getDatefield($lang->def('_DATE'), 'filter_date', 'filter_date', $date_filter) . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('filter', 'filter', $lang->def('_FILTER')) . Form::getButton('unset_filter', 'unset_filter', $lang->def('_UNDO')) . Form::closeElementSpace() . Form::closeForm() . $tb->getTable() . $tb->getNavBar($ini, $rooms_number) . '<br/>' . getBackUi('index.php?modname=conference&op=list', $lang->def('_BACK')), 'content'); } cout('<div class="nofloat"></div></div></div>', 'content'); }
function codeList() { require_once _base_ . '/lib/lib.form.php'; require_once _base_ . '/lib/lib.table.php'; $lang =& DoceboLanguage::createInstance('code'); $id_code_group = Get::req('id_code_group', DOTY_INT, '0'); $code_manager = new CodeManager(); $acl_man = Docebo::user()->getAclManager(); cout(getTitleArea(array('index.php?modname=code&op=list' => $lang->def('_CODE'), $lang->def('_CODE_LIST'))) . '<div class="std_block">'); if (isset($_POST['undo_filter'])) { unset($_POST['code_filter']); } cout('<div class="quick_search_form">' . Form::openForm('code_list_filter', 'index.php?modname=code&op=code_list&id_code_group=' . $id_code_group) . Form::getInputTextfield("search_t", "code_filter", "code_filter", isset($_POST['code_filter']) ? $_POST['code_filter'] : '', '', 255, '') . Form::getButton("filter", "filter", Lang::t('_SEARCH', 'standard'), "search_b") . Form::getButton("undo_filter", "undo_filter", Lang::t('_RESET', 'standard'), "reset_b") . Form::closeForm() . '</div>'); $result = Get::req('result', DOTY_STRING, ''); switch ($result) { case 'ok': UIFeedback::info($lang->def('_OPERATION_SUCCESSFUL')); break; case 'err': UIFeedback::error($lang->def('_OPERATION_FAILURE')); break; case 'err_dup': UIFeedback::error($lang->def('_DUPLICATED_CODE')); break; } $tot_code = $code_manager->getCodeNumber($id_code_group, isset($_POST['undo_filter']) ? $_POST['undo_filter'] : false); if ($tot_code) { $tb = new Table('20'); $tb->initNavBar('ini', 'link'); $tb->setLink('index.php?modname=code&op=code_list&id_code_group=' . $id_code_group); $ini = $tb->getSelectedElement(); $cont_h = array($lang->def('_CODE'), $lang->def('_USED'), $lang->def('_USERNAME'), $lang->def('_UNLIMITED_USE'), '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . '" />', '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . '" />'); $type_h = array('', 'image', '', 'image', 'image', 'image'); $tb->setColsStyle($type_h); $tb->addHead($cont_h); $array_code = $code_manager->getCodeList($id_code_group, $ini); foreach ($array_code as $code_info) { $cont = array(); $cont[] = $code_info['code']; if ($code_info['used']) { $cont[] = '<img src="' . getPathImage() . 'standard/status_active.png" alt="' . $lang->def('_USED') . '" />'; $user_info = $acl_man->getUser($code_info['id_user'], false); if ($user_info) { $cont[] = $acl_man->relativeId($user_info[ACL_INFO_USERID]); } else { $user_info = $acl_man->getTempUserInfo($code_info['id_user'], false); $cont[] = $acl_man->relativeId($user_info['userid']); } if ($code_info['unlimited_use'] == '1') { $cont[] = '<img src="' . getPathImage() . 'standard/status_active.png" alt="' . $lang->def('_UNLIMITED_USE') . '" />'; } else { $cont[] = '-'; } $cont[] = '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . '" />'; } else { $cont[] = '-'; $cont[] = $lang->def('_NONE'); if ($code_info['unlimited_use'] == '1') { $cont[] = '<img src="' . getPathImage() . 'standard/status_active.png" alt="' . $lang->def('_UNLIMITED_USE') . '" />'; } else { $cont[] = '-'; } $cont[] = '<a href="index.php?modname=code&op=mod_code&id_code_group=' . $id_code_group . '&code=' . $code_info['code'] . '">' . '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . '" />'; } $cont[] = '<a href="index.php?modname=code&op=del_code&id_code_group=' . $id_code_group . '&code=' . $code_info['code'] . '">' . '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . '" />'; $tb->addBody($cont); } $tb->addActionAdd('<a href="index.php?modname=code&op=add_code&id_code_group=' . $id_code_group . '">' . '<img src="' . getPathImage() . 'standard/add.png" alt="' . $lang->def('_ADD') . '" />' . $lang->def('_ADD') . '</a>'); $tb->addActionAdd('<a class="ico-wt-sprite subs_xls" title="' . Lang::t('_EXPORT_XLS', 'report') . '" ' . 'href="index.php?modname=code&op=export&id_code_group=' . $id_code_group . '&format=xls">' . '<span>' . Lang::t('_EXPORT_XLS', 'report') . '</span></a>'); $tb->addActionAdd('<a class="ico-wt-sprite subs_csv" title="' . Lang::t('_EXPORT_CSV', 'report') . '" ' . 'href="index.php?modname=code&op=export&id_code_group=' . $id_code_group . '&format=csv">' . '<span>' . Lang::t('_EXPORT_CSV', 'report') . '</span></a>'); cout($tb->getTable() . $tb->getNavBar($ini, $tot_code)); setupHrefDialogBox('a[href*=del_code]'); } else { cout($lang->def('_NO_CODE_FOUND') . '<br/>' . '<a href="index.php?modname=code&op=add_code&id_code_group=' . $id_code_group . '">' . '<img src="' . getPathImage() . 'standard/add.png" alt="' . $lang->def('_ADD') . '" />' . $lang->def('_ADD') . '</a>'); } cout('<br/><br/>' . getBackUi('index.php?modname=code&op=list', $lang->def('_BACK')) . '</div>'); }
function loadCoursepathSelector($noprint = false) { require_once _base_ . '/lib/lib.table.php'; require_once _base_ . '/lib/lib.form.php'; $lang =& DoceboLanguage::createInstance('coursepath', 'lms'); $output = ''; // Filter $this->filter['coursepath_name'] = isset($_POST['coursepath_filter_name']) ? $_POST['coursepath_filter_name'] : ''; if ($this->show_filter === true) { /* $form = new Form(); $output .= $form->getOpenFieldset($lang->def('_COURSEPATH_FILTER')) .Form::getTextfield($lang->def('_NAME'), 'coursepath_filter_name', 'coursepath_filter_name', '255', ( isset($_POST['coursepath_filter_name']) ? $_POST['coursepath_filter_name'] : '' )) .$form->openButtonSpace() .$form->getButton('coursepath_filter', 'coursepath_filter', $lang->def('_SEARCH')) .$form->closeButtonSpace() .$form->getCloseFieldset();*/ $output .= '<div class="quick_search_form">' . '<div>' . Form::getInputTextfield("search_t", "coursepath_filter_name", "coursepath_filter_name", Get::req('coursepath_filter_name', DOTY_MIXED, ''), '', 255, '') . Form::getButton("coursepath_filter", "coursepath_filter", Lang::t('_SEARCH', 'standard'), "search_b") . '</div>' . '</div>'; } // End Filter $tb = new Table(Get::sett('visuItem'), $lang->def('_COURSE_PATH_CAPTION'), $lang->def('_COURSE_PATH_SUMMARY')); $tb->initNavBar('ini_cpath', 'button'); $ini = $tb->getSelectedElement(); $select = "\r\n\t\tSELECT id_path, path_name, path_descr "; $query_coursepath = "\r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_coursepath\r\n\t\tWHERE 1 "; if (Docebo::user()->getUserLevelId() != ADMIN_GROUP_GODADMIN) { $all_courses = false; require_once _base_ . '/lib/lib.preference.php'; $adminManager = new AdminPreference(); $admin_courses = $adminManager->getAdminCourse(Docebo::user()->getIdST()); if (isset($admin_courses['course'][0])) { $all_courses = true; } if (isset($admin_courses['course'][-1])) { $query = "SELECT id_path" . " FROM %lms_coursepath_user" . " WHERE idUser = '******'"; $result = sql_query($query); $admin_courses['coursepath'] = array(); while (list($id_path) = sql_fetch_row($result)) { $admin_courses['coursepath'][$id_path] = $id_path; } if (!empty($admin_courses['coursepath']) && Get::sett('on_catalogue_empty', 'off') == 'on') { $all_courses = true; } } if (!$all_courses) { if (empty($admin_courses['coursepath'])) { $query_coursepath .= " AND 0 "; } else { $query_coursepath .= " AND id_path IN (" . implode(',', $admin_courses['coursepath']) . ") "; } } } if ($this->filter['coursepath_name'] != '') { $query_coursepath .= " AND path_name LIKE '%" . $this->filter['coursepath_name'] . "%'"; } list($tot_coursepath) = sql_fetch_row(sql_query("SELECT COUNT(*) " . $query_coursepath)); $query_coursepath .= "\r\n\t\tORDER BY path_name\r\n\t\tLIMIT " . $ini . "," . (int) Get::sett('visuItem'); $re_coursepath = sql_query($select . $query_coursepath); $type_h = array('image', '', '', ''); $cont_h = array('<span class="access-only">' . $lang->def('_SELECT') . '</span>', $lang->def('_NAME'), $lang->def('_DESCRIPTION')); $tb->setColsStyle($type_h); $tb->addHead($cont_h); while (list($id_path, $name, $descr) = sql_fetch_row($re_coursepath)) { $tb_content = array(Form::getInputCheckbox('new_coursepath_selected_' . $id_path, 'new_coursepath_selected[' . $id_path . ']', $id_path, isset($this->current_selection[$id_path]), ''), '<label for="new_coursepath_selected_' . $id_path . '">' . $name . '</label>', '<label for="new_coursepath_selected_' . $id_path . '">' . $descr . '</label>'); $tb->addBody($tb_content); if (isset($this->current_selection[$id_path])) { unset($this->current_selection[$id_path]); } } $output .= $tb->getTable() . $tb->getNavBar($ini, $tot_coursepath) . $this->stateSelection(); if ($noprint) { return $output; } else { cout($output, 'content'); } }
/** * Print statistic on one item * **/ function statitem() { require_once _lms_ . '/class.module/track.object.php'; require_once _base_ . '/lib/lib.form.php'; require_once _base_ . '/lib/lib.table.php'; require_once _lms_ . '/lib/lib.subscribe.php'; $cs = new CourseSubscribe_Manager(); $lang =& DoceboLanguage::createInstance('stats', 'lms'); $out =& $GLOBALS['page']; $form = new Form(); $aclManager =& Docebo::user()->getACLManager(); $acl =& Docebo::user()->getACL(); $idItem = (int) $_GET['idItem']; $group_filter = Get::req('group_filter', DOTY_INT, -1); $status_filter = Get::req('status_filter', DOTY_INT, -1); $user_filter = Get::req('user_filter', DOTY_MIXED, ''); $tabStat = new Table(Get::sett('visuItem'), $lang->def('_STATSITEM') . $titleLO, $lang->def('_STATSITEM') . $titleLO); $tabStat->initNavBar('ini', 'button'); $limit = $tabStat->getSelectedElement(); list($titleLO, $objectType) = sql_fetch_row(sql_query("SELECT title, objectType FROM " . $GLOBALS['prefix_lms'] . "_organization" . " WHERE idOrg='" . $idItem . "'")); $lev = false; $group_all_members = false; if ($group_filter != '-1') { $group_all_members = $aclManager->getGroupAllUser($group_filter); } $students = getSubscribedInfo((int) $_SESSION['idCourse'], false, $lev, true, $status_filter != -1 ? $status_filter : false, $editions_filter != -1 ? $editions_filter : false, true, $user_filter, $group_all_members, $limit); $query = "SELECT COUNT(*)" . " FROM %lms_courseuser AS cu" . ($user_filter !== '' ? " JOIN " . $GLOBALS['prefix_fw'] . "_user AS u ON u.idst = cu.idUser" : '') . " WHERE cu.idCourse = " . (int) $_SESSION['idCourse'] . ($status_filter != -1 ? " AND cu.status = '" . $status_filter . "'" : '') . ($user_filter !== '' ? " AND (u.firstname LIKE '%" . $user_filter . "%' OR u.lastname LIKE '%" . $user_filter . "%' OR u.userid LIKE '%" . $user_filter . "%')" : '') . ($group_all_members !== false ? " AND c.idUser IN (" . implode(',', $group_all_members) . ")" : ''); list($total_user) = sql_fetch_row(sql_query($query)); // get idst of the access in item $query = "SELECT value FROM " . $GLOBALS['prefix_lms'] . "_organization_access" . " WHERE idOrgAccess = '" . $idItem . "'"; if (($rs = sql_query($query)) === FALSE) { UiFeedback::error("Error on query to load item access"); return; } $arr_access = array(); while (list($value) = sql_fetch_row($rs)) { $arr_access[] = $value; } $out->setWorkingZone('content'); $out->add(getTitleArea($lang->def('_STATSITEM') . $titleLO, 'stats')); $out->add('<div class="std_block">' . getBackUi('index.php?modname=stats&op=statcourse', $lang->def('_BACK'))); $out->add($form->openForm('orgshow', 'index.php?modname=stats&op=statitem&idItem=' . $idItem)); if (isset($_POST['view_open_quest'])) { $query_resource = "SELECT idResource" . " FROM " . $GLOBALS['prefix_lms'] . "_organization" . " WHERE idOrg = '" . $idItem . "'"; list($id_poll) = sql_fetch_row(sql_query($query_resource)); $query_quest = "SELECT id_quest, title_quest" . " FROM " . $GLOBALS['prefix_lms'] . "_pollquest" . " WHERE id_poll = '" . $id_poll . "'" . " AND type_quest = 'extended_text'"; $result_quest = sql_query($query_quest); $type_h = array(''); $cont_h = array($lang->def('_ANSWER')); while (list($id_quest, $title_quest) = sql_fetch_row($result_quest)) { $tb = new Table(400, $title_quest); $tb->setColsStyle($type_h); $tb->addHead($cont_h); $query_answer = "SELECT more_info" . " FROM " . $GLOBALS['prefix_lms'] . "_polltrack_answer" . " WHERE id_quest = '" . $id_quest . "'"; $result_answer = sql_query($query_answer); while (list($answer) = sql_fetch_row($result_answer)) { $cont = array(); $cont[] = $answer; $tb->addBody($cont); } $out->add($tb->getTable() . '<br/>'); } $out->add($form->openButtonSpace() . $form->getButton('back', 'back', $lang->def('_BACK')) . $form->closeButtonSpace()); } else { $arr_idst = $aclManager->getBasePathGroupST('/lms/course/' . (int) $_SESSION['idCourse'] . '/group'); $arr_result_groups = $aclManager->getGroups($arr_idst); $std_content = $aclManager->getContext(); $aclManager->setContext('/lms/course/' . (int) $_SESSION['idCourse'] . '/group'); $arr_groups = array(-1 => $lang->def('_ALL')); foreach ($arr_result_groups as $idst_group => $info_group) { if (!$info_group[ACL_INFO_GROUPHIDDEN]) { $arr_groups[$idst_group] = $aclManager->relativeId($info_group[ACL_INFO_GROUPID]); } } $aclManager->setContext($std_content); $out->add(Form::getTextField(Lang::t('_FULLNAME', 'standard'), 'user_filter', 'user_filter', 255, $user_filter)); $out->add($form->getDropdown($lang->def('_GROUPS'), 'group_filter', 'group_filter', $arr_groups, $group_filter)); // ------ Filter on status $arr_status = array(-1 => $lang->def('_FILTERSTATUSSELECTONEOPTION'), _CUS_SUBSCRIBED => $lang->def('_USER_STATUS_SUBS'), _CUS_BEGIN => $lang->def('_USER_STATUS_BEGIN'), _CUS_END => $lang->def('_END'), _CUS_SUSPEND => $lang->def('_SUSPENDED')); $out->add($form->getDropdown($lang->def('_STATUS'), 'status_filter', 'status_filter', $arr_status, $status_filter)); $out->add($form->getButton('gofilter', 'gofilter', $lang->def('_SEARCH'))); //----------------------------------------- $content_h = array($lang->def('_USERNAME'), $lang->def('_STATS_FULLNAME'), $lang->def('_STATUS'), $lang->def('_PROGRESS')); $type_h = array('', '', 'image', 'image', ''); $tabStat->setColsStyle($type_h); $tabStat->addHead($content_h); //----------------------------------------- foreach ($students as $idst => $user_course_info) { $user_info = $aclManager->getUser($idst, FALSE); if ($user_info != false) { $arr_allst = $acl->getUserAllST($user_info[ACL_INFO_USERID]); if (count($arr_access) === 0 || count(array_intersect($arr_access, $arr_allst)) > 0) { $status = Track_Object::getStatusFromId($idItem, $idst); // NOTE: How to get stat_status for users? $stat_status = $cs->getUserStatusTr($user_course_info['status']); $tabStat->addBody(array('<a href="index.php?modname=stats&op=statoneuseroneitem&idUser='******'&idItem=' . $idItem . '" >' . $aclManager->relativeId($user_info[ACL_INFO_USERID]) . '</a>', $user_info[ACL_INFO_LASTNAME] . ' ' . $user_info[ACL_INFO_FIRSTNAME], $stat_status, printReport($status, TRUE))); } } } $out->add($tabStat->getTable()); $out->add($tabStat->getNavBar($limit, $total_user)); $query = "SELECT idResource" . " FROM " . $GLOBALS['prefix_lms'] . "_organization" . " WHERE idOrg = '" . $idItem . "'"; list($id_poll) = sql_fetch_row(sql_query($query)); $query = "SELECT id_quest" . " FROM " . $GLOBALS['prefix_lms'] . "_pollquest" . " WHERE id_poll = '" . $id_poll . "'" . " AND type_quest = 'extended_text'"; $result = sql_query($query); if (sql_num_rows($result) && $objectType == 'poll') { $out->add($form->openButtonSpace() . '<br/>' . $form->getButton('view_open_quest', 'view_open_quest', $lang->def('_VIEW_OPEN_QUEST')) . $form->closeButtonSpace()); } } $out->add($form->closeForm()); $out->add('</div>' . "\n"); }
function loadCatalogueSelector($noprint = false) { require_once _base_ . '/lib/lib.table.php'; require_once _base_ . '/lib/lib.form.php'; $lang =& DoceboLanguage::createInstance('catalogue', 'lms'); // Filter $this->filter['catalogue_name'] = isset($_POST['cat_filter_name']) ? $_POST['cat_filter_name'] : ''; if ($this->show_filter === true) { $form = new Form(); /*$GLOBALS['page']->add( $form->getOpenFieldset($lang->def('_SEARCH')) .Form::getTextfield($lang->def('_NAME'), 'cat_filter_name', 'cat_filter_name', '255', ( isset($_POST['cat_filter_name']) ? $_POST['cat_filter_name'] : '' )) .$form->openButtonSpace() .$form->getButton('catalogue_filter', 'catalogue_filter', $lang->def('_SEARCH')) .$form->closeButtonSpace() .$form->getCloseFieldset() , 'content'); */ cout('<div class="quick_search_form">' . '<div>' . Form::getInputTextfield("search_t", "cat_filter_name", "cat_filter_name", Get::req('cat_filter_name', DOTY_MIXED, ''), '', 255, '') . Form::getButton("catalogue_filter", "catalogue_filter", Lang::t('_SEARCH', 'standard'), "search_b") . '</div>' . '</div>', 'content'); } // End Filter $tb = new Table(Get::sett('visuItem'), $lang->def('_CATALOGUE'), $lang->def('_CATALOGUE_SUMMARY')); $tb->initNavBar('ini_cat', 'button'); $ini = $tb->getSelectedElement(); $select = "\r\n\t\tSELECT c.idCatalogue, c.name, c.description"; $query_catalogue = "\r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_catalogue AS c\r\n\t\tWHERE 1"; // Retriving data if (Docebo::user()->getUserLevelId() != ADMIN_GROUP_GODADMIN) { $all_courses = false; require_once _base_ . '/lib/lib.preference.php'; $adminManager = new AdminPreference(); $admin_courses = $adminManager->getAdminCourse(Docebo::user()->getIdST()); if (isset($admin_courses['course'][0])) { $all_courses = true; } if (isset($admin_courses['course'][-1])) { require_once _lms_ . '/lib/lib.catalogue.php'; $cat_man = new Catalogue_Manager(); $admin_courses['catalogue'] = $cat_man->getUserAllCatalogueId(Docebo::user()->getIdSt()); if (count($admin_courses['catalogue']) == 0 && Get::sett('on_catalogue_empty', 'off') == 'on') { $all_courses = true; } } if (!$all_courses) { if (empty($admin_courses['catalogue'])) { $query_catalogue .= " AND 0 "; } else { $query_catalogue .= " AND c.idCatalogue IN (0," . implode(',', $admin_courses['catalogue']) . ") "; } } } if ($this->filter['catalogue_name'] != '') { $query_catalogue .= " AND c.name LIKE '%" . $this->filter['catalogue_name'] . "%'"; } list($tot_catalogue) = sql_fetch_row(sql_query("SELECT COUNT(*) " . $query_catalogue)); $query_catalogue .= " ORDER BY c.name\r\n\t\t\t\t\t\t\tLIMIT " . $ini . "," . (int) Get::sett('visuItem'); $re_catalogue = sql_query($select . $query_catalogue); $type_h = array('image', '', '', ''); $cont_h = array('<span class="access-only">' . $lang->def('_CATALOGUE_SELECTION') . '</span>', $lang->def('_NAME'), $lang->def('_DESCRIPTION')); $tb->setColsStyle($type_h); $tb->addHead($cont_h); while (list($id_catalogue, $name, $descr) = sql_fetch_row($re_catalogue)) { $tb_content = array(Form::getInputCheckbox('new_catalogue_selected_' . $id_catalogue, 'new_catalogue_selected[' . $id_catalogue . ']', $id_catalogue, isset($this->current_selection[$id_catalogue]), ''), '<label for="new_catalogue_selected_' . $id_catalogue . '">' . $name . '</label>', '<label for="new_catalogue_selected_' . $id_catalogue . '">' . $descr . '</label>'); $tb->addBody($tb_content); if (isset($this->current_selection[$id_catalogue])) { unset($this->current_selection[$id_catalogue]); } } $output = $tb->getTable() . $tb->getNavBar($ini, $tot_catalogue) . $this->stateSelection(); if ($noprint) { return $output; } else { cout($output, 'content'); } }
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&op=preview_cert&id_certificate=' . $id_certificate . '&idmeta=' . $idmeta . '&iduser='******'">' . Get::img('standard/view.png', Lang::t('_PREVIEW', 'certificate') . ' : ' . strip_tags($title)) . '</a>'; $cont[] = '<a href="index.php?modname=meta_certificate&op=release_cert&id_certificate=' . $id_certificate . '&idmeta=' . $idmeta . '&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&op=del_released&id_certificate=' . $id_certificate . '&idmeta=' . $idmeta . '&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&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&op=meta_certificate', $lang->def('_BACK')) . '</div>'); } }
function adminManager_list() { checkPerm('view'); require_once _base_ . '/lib/lib.table.php'; $lang =& DoceboLanguage::createInstance('adminrules', 'framework'); $aclManager = new DoceboACLManager(); // get users to show -------------------------------------------------- $admin_group_idst = $aclManager->getGroupST(ADMIN_GROUP_ADMIN); $arr_admin_idst = $aclManager->getGroupUMembers($admin_group_idst); $arr_admin_id = array_flip($aclManager->getArrUserST($arr_admin_idst)); $usres_info =& $aclManager->getUsers($arr_admin_idst); $pm =& PlatformManager::createInstance(); $lms_is_active = $pm->isLoaded("lms"); $cms_is_active = $pm->isLoaded("cms"); // print table -------------------------------------------------------- $table = new Table(Get::sett('visuItem'), $lang->def('_ADMIN_USER'), $lang->def('_ADMIN_USER')); $table->initNavBar('ini', 'link'); $table->setLink('index.php?modname=admin_manager&op=view&ini='); $ini = $table->getSelectedElement(); $GLOBALS['page']->add(getTitleArea($lang->def('_ADMIN_MANAGMENT'), 'admin_managmer', $lang->def('_ADMIN_MANAGMENT')) . '<div class="std_block">', 'content'); $contentH = array($lang->def('_USERNAME'), $lang->def('_EMAIL'), '<img src="' . getPathImage() . 'admin_manager/man_pref.gif" alt="' . $lang->def('_ADMIN_PREFERENCES_TITLE') . '" ' . 'title="' . $lang->def('_ADMIN_PREFERENCES_TITLE') . '" />', '<img src="' . getPathImage() . 'admin_manager/man_menu.gif" alt="' . $lang->def('_ASSIGN_USERS') . '" ' . 'title="' . $lang->def('_ADMIN_MENU_TITLE') . '" />', '<img src="' . getPathImage() . 'directory/tree.gif" alt="' . $lang->def('_ASSIGN_USERS') . '" ' . 'title="' . $lang->def('_ASSIGN_USERS') . '" />', '<img src="' . getPathImage() . 'admin_manager/lang_lang.gif" alt="' . $lang->def('_ASSIGN_USERS') . '" ' . 'title="' . $lang->def('_ASSIGN_USERS') . '" />'); $typeH = array('', '', 'image', 'image', 'image', 'image'); if ($lms_is_active) { $contentH[] = '<img src="' . getPathImage() . 'admin_manager/man_course.gif" alt="' . $lang->def('_ASSIGN_USERS') . '" ' . 'title="' . $lang->def('_ASSIGN_USERS') . '" />'; $typeH[] = 'image'; } if ($cms_is_active) { // Cms Pages $contentH[] = '<img src="' . getPathImage() . 'admin_manager/pagetree.png" alt="' . $lang->def('_ASSIGN_CMS_PAGES') . '" ' . 'title="' . $lang->def('_ASSIGN_CMS_PAGES') . '" />'; $typeH[] = 'image'; // Cms News $contentH[] = '<img src="' . getPathImage() . 'admin_manager/newstree.png" alt="' . $lang->def('_NEWS') . '" ' . 'title="' . $lang->def('_NEWS') . '" />'; $typeH[] = 'image'; // Cms Documents $contentH[] = '<img src="' . getPathImage() . 'admin_manager/docstree.png" alt="' . $lang->def('_ASSIGN_CMS_DOCS') . '" ' . 'title="' . $lang->def('_ASSIGN_CMS_DOCS') . '" />'; $typeH[] = 'image'; // Cms Media $contentH[] = '<img src="' . getPathImage() . 'admin_manager/mediatree.png" alt="' . $lang->def('_ASSIGN_CMS_MEDIA') . '" ' . 'title="' . $lang->def('_ASSIGN_CMS_MEDIA') . '" />'; $typeH[] = 'image'; // Cms Contents $contentH[] = '<img src="' . getPathImage() . 'admin_manager/contenttree.png" alt="' . $lang->def('_ASSIGN_CMS_CONTENT') . '" ' . 'title="' . $lang->def('_ASSIGN_CMS_CONTENT') . '" />'; $typeH[] = 'image'; } $table->setColsStyle($typeH); $table->addHead($contentH); $maxItem = count($arr_admin_id) < $ini + Get::sett('visuItem') ? count($arr_admin_id) : $ini + Get::sett('visuItem'); for ($index = $ini; $index < $maxItem; $index++) { $admin_userid = substr($arr_admin_id[$arr_admin_idst[$index]], 1); $rowContent = array($admin_userid, $usres_info[$arr_admin_idst[$index]][ACL_INFO_EMAIL]); // Edit preferences $rowContent[] = '<a href="index.php?modname=admin_manager&op=edit_preferences&adminidst=' . $arr_admin_idst[$index] . '" title="' . $lang->def('_ADMIN_PREFERENCES_TITLE') . ' : ' . $admin_userid . '">' . '<img src="' . getPathImage() . 'admin_manager/man_pref.gif"' . ' alt="' . $lang->def('_ADMIN_PREFERENCES_TITLE') . ' : ' . $admin_userid . '" /></a>'; // Edit menu $rowContent[] = '<a href="index.php?modname=admin_manager&op=edit_menu&adminidst=' . $arr_admin_idst[$index] . '" title="' . $lang->def('_ADMIN_MENU_TITLE') . ' : ' . $admin_userid . '">' . '<img src="' . getPathImage() . 'admin_manager/man_menu.gif"' . ' alt="' . $lang->def('_ADMIN_MENU_TITLE') . ' : ' . $admin_userid . '" /></a>'; // Edit user $rowContent[] = '<a href="index.php?modname=admin_manager&op=assign_tree&adminidst=' . $arr_admin_idst[$index] . '" title="' . $lang->def('_ASSIGN_USERS') . ' : ' . $admin_userid . '">' . '<img src="' . getPathImage() . 'directory/tree.gif" ' . 'alt="' . $lang->def('_ASSIGN_USERS') . ' : ' . $admin_userid . '" /></a>'; // Edit lang $rowContent[] = '<a href="index.php?modname=admin_manager&op=edit_lang&adminidst=' . $arr_admin_idst[$index] . '" title="' . $lang->def('_ASSIGN_USERS') . ' : ' . $admin_userid . '">' . '<img src="' . getPathImage() . 'admin_manager/lang_lang.gif"' . ' alt="' . $lang->def('_ASSIGN_USERS') . ' : ' . $admin_userid . '" /></a>'; // Edit course if ($lms_is_active) { $rowContent[] = '<a href="index.php?modname=admin_manager&op=edit_course&adminidst=' . $arr_admin_idst[$index] . '&load=1" title="' . $lang->def('_ASSIGN_USERS') . ' : ' . $admin_userid . '">' . '<img src="' . getPathImage() . 'admin_manager/man_course.gif"' . ' alt="' . $lang->def('_ASSIGN_USERS') . ' : ' . $admin_userid . '" /></a>'; } // Assign cms trees permissions if ($cms_is_active) { // Cms Pages $img = "<img src=\"" . getPathImage() . "admin_manager/pagetree.png\" alt=\"" . $lang->def("_ASSIGN_CMS_PAGES") . "\" "; $img .= "title=\"" . $lang->def("_ASSIGN_CMS_PAGES") . "\" />"; $url = "index.php?modname=admin_manager&op=assign_cmspag&adminidst=" . $arr_admin_idst[$index]; $rowContent[] = "<a href=\"" . $url . "\">" . $img . "</a>\n"; // Cms News $img = "<img src=\"" . getPathImage() . "admin_manager/newstree.png\" alt=\"" . $lang->def("_NEWS") . "\" "; $img .= "title=\"" . $lang->def("_NEWS") . "\" />"; $url = "index.php?modname=admin_manager&op=assign_cmsnews&adminidst=" . $arr_admin_idst[$index]; $rowContent[] = "<a href=\"" . $url . "\">" . $img . "</a>\n"; // Cms Documents $img = "<img src=\"" . getPathImage() . "admin_manager/docstree.png\" alt=\"" . $lang->def("_ASSIGN_CMS_DOCS") . "\" "; $img .= "title=\"" . $lang->def("_ASSIGN_CMS_DOCS") . "\" />"; $url = "index.php?modname=admin_manager&op=assign_cmsdocs&adminidst=" . $arr_admin_idst[$index]; $rowContent[] = "<a href=\"" . $url . "\">" . $img . "</a>\n"; // Cms Media $img = "<img src=\"" . getPathImage() . "admin_manager/mediatree.png\" alt=\"" . $lang->def("_ASSIGN_CMS_MEDIA") . "\" "; $img .= "title=\"" . $lang->def("_ASSIGN_CMS_MEDIA") . "\" />"; $url = "index.php?modname=admin_manager&op=assign_cmsmedia&adminidst=" . $arr_admin_idst[$index]; $rowContent[] = "<a href=\"" . $url . "\">" . $img . "</a>\n"; // Cms Contents $img = "<img src=\"" . getPathImage() . "admin_manager/contenttree.png\" alt=\"" . $lang->def("_ASSIGN_CMS_CONTENT") . "\" "; $img .= "title=\"" . $lang->def("_ASSIGN_CMS_CONTENT") . "\" />"; $url = "index.php?modname=admin_manager&op=assign_cmscontent&adminidst=" . $arr_admin_idst[$index]; $rowContent[] = "<a href=\"" . $url . "\">" . $img . "</a>\n"; } $table->addBody($rowContent); } $GLOBALS['page']->add($table->getTable() . $table->getNavBar($ini, count($arr_admin_id)), 'content'); $GLOBALS['page']->add('</div>', 'content'); }
function outbox(&$course_list, $noprint = false) { require_once _base_ . '/lib/lib.table.php'; //if(!checkPerm('send_all', true) && !checkPerm('send_upper', true)) die("You can't access"); $lang =& DoceboLanguage::createInstance('message', 'lms'); $out = $GLOBALS['page']; $out->setWorkingZone('content'); $um =& UrlManager::getInstance("message"); $acl_man =& Docebo::user()->getAclManager(); $tb = new Table(Get::sett('visuItem', 25)); $tb->initNavBar('iniout', 'button'); $ini = $tb->getSelectedElement('iniout'); $acl_man =& Docebo::user()->getAclManager(); $query = "\r\n\t\tSELECT m.idMessage, m.posted, m.attach, m.title, m.priority\r\n\t\tFROM %adm_message AS m JOIN\r\n\t\t\t%adm_message_user AS user\r\n\t\tWHERE m.idMessage = user.idMessage AND\r\n\t\t\tuser.idUser = '******' AND\r\n\t\t\tm.sender = '" . getLogUserId() . "' AND\r\n\t\t\tuser.deleted = '" . _MESSAGE_VALID . "'"; /*if(isset($_POST['msg_course_filter']) && ($_POST['msg_course_filter'] != false)) { $query .= " AND m.idCourse = '".$_POST['msg_course_filter']."'"; }*/ $_filter = Get::req('msg_course_filter_outbox', DOTY_INT, 0); if ($_filter != '' && $_filter != 0) { $res = $acl_man->getGroupsIdstFromBasePath('/lms/course/' . $_filter . '/subscribed/'); $res = $acl_man->getAllUsersFromIdst($res); $query .= " AND user.idMessage IN ( SELECT idMessage FROM %adm_message_user as user WHERE user.idUser IN (" . implode(",", $res) . ") AND user.idUser <> " . (int) Docebo::user()->getIdSt() . ") "; } else { if (isset($_SESSION['idCourse']) && $_filter == '') { $_filter = $_SESSION['idCourse']; $res = $acl_man->getGroupsIdstFromBasePath('/lms/course/' . $_filter . '/subscribed/'); $res = $acl_man->getAllUsersFromIdst($res); $query .= " AND user.idMessage IN ( SELECT idMessage FROM %adm_message_user as user WHERE user.idUser IN (" . implode(",", $res) . ") AND user.idUser <> " . (int) Docebo::user()->getIdSt() . ") "; } } $query .= "\tORDER BY "; if (isset($_POST['ord'])) { switch ($_POST['ord']) { case "pry": $query .= "m.priority DESC,"; break; case "sen": $query .= "m.sender,"; break; case "tit": $query .= "m.title,"; break; case "ath": $query .= "m.attach DESC,"; break; } } $query .= "m.posted DESC LIMIT {$ini}," . Get::sett('visuItem', 25); $re_message = $this->db->query($query); $query = "\r\n\t\tSELECT COUNT(*)\r\n\t\tFROM %adm_message AS m JOIN\r\n\t\t\t%adm_message_user AS user\r\n\t\tWHERE m.idMessage = user.idMessage AND\r\n\t\t\tuser.idUser = '******' AND\r\n\t\t\tm.sender = '" . getLogUserId() . "' AND\r\n\t\t\tuser.deleted = '" . _MESSAGE_VALID . "'"; if ($_filter != '' && $_filter != false) { $query .= " AND m.idCourse = '" . $_filter . "'"; } list($tot_message) = $this->db->fetch_row($this->db->query($query)); $cont_h = array('<img src="' . getPathImage() . 'standard/notimportant.png" title="' . Lang::t('_PRIORITY', 'message') . '" alt="' . Lang::t('_PRIORITY', 'message') . '" />', Lang::t('_TITLE'), '<img src="' . getPathImage() . 'standard/attach.png" title="' . Lang::t('_ATTACH_TITLE') . '" alt="' . Lang::t('_ATTACHMENT') . '" />', Lang::t('_DATE'), Lang::t('_RECIPIENTS'), '<span class="ico-sprite subs_del"><span>' . Lang::t('_DEL', 'standard') . '</span></span>'); $type_h = array('image', '', 'image', 'message_posted', 'message_posted', 'image'); $tb->setColsStyle($type_h); $tb->addHead($cont_h); while (list($id_mess, $posted, $attach, $title, $priority) = $this->db->fetch_row($re_message)) { list($img_priority, $text_priority) = self::decodePriority($priority); $cont = array(); $cont[] = '<img src="' . getPathImage() . 'standard/' . $img_priority . '" ' . 'title="' . $text_priority . '" ' . 'alt="' . $text_priority . '" />'; $read_url = $this->mvc_urls ? "index.php?r=message/read&id_message=" . $id_mess : $um->getUrl("op=readmessage&id_message=" . $id_mess); $cont[] = '<a id="_title_outbox_' . $id_mess . '" href="' . $read_url . '" ' . 'title="' . Lang::t('_READ_MESS') . '">' . $title . '</a>'; if ($attach != '') { $cont[] = '<img src="' . getPathImage('fw') . mimeDetect($attach) . '" alt="' . Lang::t('_MIME') . '" />'; } else { $cont[] = ' '; } $cont[] = Format::date($posted); $sql_receiver = "\r\n\t\t\t\tSELECT user.idUser\r\n\t\t\t\tFROM %adm_message_user AS user\r\n\t\t\t\tWHERE user.idMessage = '" . $id_mess . "' AND\r\n\t\t\t\t\tuser.idUser != '" . getLogUserId() . "'"; $result_receiver = $this->db->query($sql_receiver); $counter_receiver = 0; $cont_temp = ""; while ($receiver = $this->db->fetch_array($result_receiver)) { if ($counter_receiver == 0) { $message_user = $acl_man->getUser($receiver[0], false); $username = $acl_man->relativeId($message_user[ACL_INFO_USERID]); $cont_temp = $username; } else { $message_user = $acl_man->getUser($receiver[0], false); $username = $acl_man->relativeId($message_user[ACL_INFO_USERID]); $cont_temp .= ", " . $username; } $counter_receiver++; } $cont[] = $cont_temp; //$cont[] = '<a href="'.$um->getUrl("op=delmessage&id_message=".$id_mess.'&out=out').'">' $add_filter = ''; if ($_filter != '' && $_filter != false) { $add_filter = "&msg_course_filter=" . $_filter; } /*$cont[] = '<a href="'.$um->getUrl("op=delmessage&id_message=".$id_mess.'&out=out'.$add_filter).'">' .'<img src="'.getPathImage().'/standard/rem.gif" ' .'title="'.Lang::t('_DEL').' : '.strip_tags($title).'" ' .'alt="'.Lang::t('_DEL').' : '.strip_tags($title).'" /></a>';*/ $del_url = $this->mvc_urls ? "ajax.server.php?r=message/delete_message&id=" . $id_mess : $um->getUrl("op=delmessage&id_message=" . $id_mess . '&out=out' . $add_filter); $cont[] = '<a id="_del_outbox_' . $id_mess . '" href="' . $del_url . '" class="ico-sprite subs_del" title=""><span></span></a>'; $tb->addBody($cont); } //if(checkPerm('send_all', true) || checkPerm('send_upper', true)) { $add_url = $this->mvc_urls ? "index.php?r=message/add" : $um->getUrl("op=addmessage"); $tb->addActionAdd('<a class="ico-wt-sprite subs_add" href="' . $add_url . '" title="' . Lang::t('_SEND') . '">' . '<span>' . Lang::t('_SEND') . '</span></a>'); //} $output = ""; $output .= '<div class="std_block">'; if (isset($_GET['result'])) { switch ($_GET['result']) { case "ok": $output .= getResultUi(Lang::t('_OPERATION_SUCCESSFUL')); break; case "ok_del": $output .= getResultUi(Lang::t('_OPERATION_SUCCESSFUL')); break; case "err": $output .= getErrorUi(Lang::t('_SEND_FAIL')); break; } } $output .= Form::getHidden('active_tab', 'active_tab', 'outbox') . $tb->getTable() . $tb->getNavBar($ini, $tot_message) . '</div>'; if ($noprint) { return $output; } else { cout($output, 'content'); } }