Ejemplo n.º 1
0
 function modglossarygui($object_glos = NULL)
 {
     checkPerm('view', false, 'storage');
     $lang =& DoceboLanguage::createInstance('glossary');
     require_once _base_ . '/lib/lib.table.php';
     $tableGlossary = new Table(Get::sett('visuItem'), '', $lang->def('_GLOSSARY_SUMMARY'));
     $tableGlossary->initNavBar('ini', 'link');
     $ini = $tableGlossary->getSelectedElement();
     $back_coded = htmlentities(urlencode($object_glos->back_url));
     list($title) = sql_fetch_row(sql_query("\r\n\tSELECT title\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_glossary \r\n\tWHERE idGlossary = '" . $object_glos->getId() . "'"));
     $reTerm = sql_query("\r\n\tSELECT idTerm, term \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_glossaryterm \r\n\tWHERE idGlossary = '" . $object_glos->getId() . "' \r\n\tORDER BY term \r\n\tLIMIT {$ini}," . Get::sett('visuItem'));
     list($num_of_term) = sql_fetch_row(sql_query("\r\n\tSELECT COUNT(*) \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_glossaryterm\r\n\tWHERE idGlossary = '" . $object_glos->getId() . "'"));
     if ($title == '') {
         $_SESSION['last_error'] = $lang->def('_FILEUNSPECIFIED');
         Util::jump_to(Util::str_replace_once('&', '&', $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('&', '&amp;', $object_glos->back_url) . '&amp;mod_result=0', $lang->def('_BACK')) . '<b>' . $lang->def('_GLOSSARY') . ' : ' . $title . '</b><br /><br />' . '<div class="mod_container">' . '<a href="index.php?modname=glossary&amp;op=modglossary&amp;idGlossary=' . $object_glos->getId() . '&amp;back_url=' . $back_coded . '" title="' . $lang->def('_MOD_TITLE') . '">' . '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . '" /> ' . $lang->def('_MOD_TITLE') . '</a>' . '</div><br />', 'content');
     $contentArray = array($lang->def('_TERM'), '<img src="' . getPathImage() . 'standard/edit.png" title="' . $lang->def('_MOD') . '" alt="' . $lang->def('_MOD') . '" />', '<img src="' . getPathImage() . 'standard/delete.png" title="' . $lang->def('_DEL') . '" alt="' . $lang->def('_DEL') . '" />');
     $typeArray = array('', 'image', 'image');
     $GLOBALS['page']->add($tableGlossary->addHead($contentArray, $typeArray));
     while (list($idTerm, $term) = sql_fetch_row($reTerm)) {
         $content = array($term, '<a href="index.php?modname=glossary&amp;op=modterm&amp;idTerm=' . $idTerm . '&amp;back_url=' . $back_coded . '" title="' . $lang->def('_MOD') . '">' . '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . '" /></a>', '<a href="index.php?modname=glossary&amp;op=delterm&amp;idTerm=' . $idTerm . '&amp;back_url=' . $back_coded . '" title="' . $lang->def('_DEL') . '">' . '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . '" /></a>');
         $tableGlossary->addBody($content);
     }
     $tableGlossary->addActionAdd('<a href="index.php?modname=glossary&amp;op=addterm&amp;idGlossary=' . $object_glos->getId() . '&amp;back_url=' . $back_coded . '" title="' . $lang->def('_ADDTERM') . '">' . '<img src="' . getPathImage() . 'standard/add.png" alt="' . $lang->def('_ADD') . '" /> ' . $lang->def('_ADDTERM') . '</a>');
     $tableGlossary->setLink('index.php?modname=glossary&amp;op=modglossarygui' . '&amp;idGlossary=' . $object_glos->getId() . '&amp;back_url=' . $back_coded);
     $GLOBALS['page']->add($tableGlossary->getTable() . $tableGlossary->getNavBar($ini, $num_of_term) . '</div>', 'content');
 }
Ejemplo n.º 2
0
function publicAdminManager_list()
{
    checkPerm('view');
    require_once _base_ . '/lib/lib.table.php';
    $lang =& DoceboLanguage::createInstance('adminrules', 'framework');
    $lang =& DoceboLanguage::createInstance('public_admin_manager', 'framework');
    $aclManager = new DoceboACLManager();
    // get users to show --------------------------------------------------
    $admin_group_idst = $aclManager->getGroupST(ADMIN_GROUP_PUBLICADMIN);
    $arr_admin_idst = $aclManager->getGroupUMembers($admin_group_idst);
    $arr_admin_id = array_flip($aclManager->getArrUserST($arr_admin_idst));
    $pm =& PlatformManager::createInstance();
    $lms_is_active = $pm->isLoaded("lms");
    /*$cms_is_active = $pm->isLoaded("cms");*/
    // print table --------------------------------------------------------
    $table = new Table(Get::sett('visuItem'), $lang->def('_PUBLIC_ADMIN_USER'), $lang->def('_PUBLIC_ADMIN_USER'));
    $table->initNavBar('ini', 'link');
    $table->setLink('index.php?modname=public_admin_manager&amp;op=view&amp;ini=');
    $ini = $table->getSelectedElement();
    $GLOBALS['page']->add(getTitleArea($lang->def('_ADMIN_MANAGMENT'), 'admin_managmer', $lang->def('_ADMIN_MANAGMENT')) . '<div class="std_block">', 'content');
    $contentH = array($lang->def('_USERNAME'), '<img src="' . getPathImage() . 'admin_manager/man_pref.gif" alt="' . $lang->def('_ADMIN_PREFERENCES_TITLE', 'adminrules') . '" ' . 'title="' . $lang->def('_ADMIN_PREFERENCES_TITLE', 'adminrules') . '" />', '<img src="' . getPathImage() . 'admin_manager/man_menu.gif" alt="' . $lang->def('_ASSIGN_USERS', 'adminrules') . '" ' . 'title="' . $lang->def('_ASSIGN_USERS', 'adminrules') . '" />', '<img src="' . getPathImage() . 'directory/tree.gif" alt="' . $lang->def('_ASSIGN_USERS', 'adminrules') . '" ' . 'title="' . $lang->def('_ASSIGN_USERS', 'adminrules') . '" />');
    $typeH = array('', 'image', 'image', 'image');
    if ($lms_is_active) {
        $contentH[] = '<img src="' . getPathImage() . 'admin_manager/man_course.gif" alt="' . $lang->def('_ASSIGN_USERS', 'adminrules') . '" ' . 'title="' . $lang->def('_ASSIGN_USERS', 'adminrules') . '" />';
        $typeH[] = 'image';
    }
    $table->setColsStyle($typeH);
    $table->addHead($contentH);
    $maxItem = count($arr_admin_id) < $ini + Get::sett('visuItem') ? count($arr_admin_id) : $ini + Get::sett('visuItem');
    for ($index = $ini; $index < $maxItem; $index++) {
        $admin_userid = substr($arr_admin_id[$arr_admin_idst[$index]], 1);
        $rowContent = array($admin_userid);
        // Edit preferences
        $rowContent[] = '<a href="index.php?modname=public_admin_manager&amp;op=edit_preferences&amp;adminidst=' . $arr_admin_idst[$index] . '"
						 title="' . $lang->def('_ADMIN_PREFERENCES_TITLE', 'adminrules') . ' : ' . $admin_userid . '">' . '<img src="' . getPathImage() . 'admin_manager/man_pref.gif"' . ' alt="' . $lang->def('_ADMIN_PREFERENCES_TITLE', 'adminrules') . ' : ' . $admin_userid . '" /></a>';
        // Edit menu
        $rowContent[] = '<a href="index.php?modname=public_admin_manager&amp;op=edit_menu&amp;adminidst=' . $arr_admin_idst[$index] . '"
						 title="' . $lang->def('_ASSIGN_USERS', 'adminrules') . ' : ' . $admin_userid . '">' . '<img src="' . getPathImage() . 'admin_manager/man_menu.gif"' . ' alt="' . $lang->def('_ASSIGN_USERS', 'adminrules') . ' : ' . $admin_userid . '" /></a>';
        // Edit user
        $rowContent[] = '<a href="index.php?modname=public_admin_manager&amp;op=assign_tree&amp;adminidst=' . $arr_admin_idst[$index] . '"
		 					title="' . $lang->def('_ASSIGN_USERS', 'adminrules') . ' : ' . $admin_userid . '">' . '<img src="' . getPathImage() . 'directory/tree.gif" ' . 'alt="' . $lang->def('_ASSIGN_USERS', 'adminrules') . ' : ' . $admin_userid . '" /></a>';
        // Edit course
        if ($lms_is_active) {
            $rowContent[] = '<a href="index.php?modname=public_admin_manager&amp;op=edit_course&amp;adminidst=' . $arr_admin_idst[$index] . '&amp;load=1"
								 title="' . $lang->def('_ASSIGN_USERS', 'adminrules') . ' : ' . $admin_userid . '">' . '<img src="' . getPathImage() . 'admin_manager/man_course.gif"' . ' alt="' . $lang->def('_ASSIGN_USERS', 'adminrules') . ' : ' . $admin_userid . '" /></a>';
        }
        $table->addBody($rowContent);
    }
    $GLOBALS['page']->add($table->getTable() . $table->getNavBar($ini, count($arr_admin_id)), 'content');
    $GLOBALS['page']->add('</div>', 'content');
}
Ejemplo n.º 3
0
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&amp;op=show">
					<em>' . Lang::t('_ACTIVE', 'conference') . '</em>
				</a>
			</li>
			<li class="selected">
				<a href="index.php?modname=conference&amp;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&amp;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&amp;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&amp;op=log&amp;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&amp;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&amp;op=list', $lang->def('_BACK')), 'content');
    }
    cout('<div class="nofloat"></div></div></div>', 'content');
}
Ejemplo n.º 4
0
 function classroom()
 {
     checkPerm('view');
     require_once _base_ . '/lib/lib.form.php';
     require_once _base_ . '/lib/lib.table.php';
     $mod_perm = true;
     // create a language istance for module admin_classroom
     $lang =& DoceboLanguage::createInstance('admin_classroom', 'lms');
     $out =& $GLOBALS['page'];
     $out->setWorkingZone('content');
     $tb = new Table(Get::sett('visuItem'), $lang->def('_CLASSROOM_CAPTION'), $lang->def('_CLASSROOM_SUMMARY'));
     $tb->initNavBar('ini', 'link');
     $tb->setLink('index.php?modname=reservation&amp;op=classroom&amp;id_course=' . $_SESSION['idCourse']);
     $ini = $tb->getSelectedElement();
     //search query of classrooms
     $query_classroom = "\r\n\t\tSELECT idClassroom, name, description\r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_classroom\r\n\t\tORDER BY name\r\n\t\tLIMIT {$ini}," . Get::sett('visuItem');
     $query_classroom_tot = "\r\n\t\tSELECT COUNT(*)\r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_classroom";
     $re_classroom = sql_query($query_classroom);
     list($tot_classroom) = sql_fetch_row(sql_query($query_classroom_tot));
     $type_h = array('', 'news_short_td', "image", "image");
     $cont_h = array($lang->def('_NAME'), $lang->def('_DESCRIPTION'));
     if ($mod_perm) {
         $cont_h[] = '<img src="' . getPathImage() . 'standard/edit.png" title="' . $lang->def('_TITLE_MOD_CLASSROOM') . '" ' . 'alt="' . $lang->def('_MOD') . '" />';
         $type_h[] = 'image';
         $cont_h[] = '<img src="' . getPathImage() . 'standard/delete.png" title="' . $lang->def('_DEL') . '" ' . 'alt="' . $lang->def('_DEL') . '"" />';
         $type_h[] = 'image';
     }
     $tb->setColsStyle($type_h);
     $tb->addHead($cont_h);
     while (list($idClassroom, $name, $descr) = sql_fetch_row($re_classroom)) {
         $cont = array($name, $descr);
         if ($mod_perm) {
             $cont[] = '<a href="index.php?modname=reservation&amp;op=modclassroom&amp;idClassroom=' . $idClassroom . '" ' . 'title="' . $lang->def('_TITLE_MOD_CLASSROOM') . ' : ' . $name . '">' . '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . ' : ' . $name . '" /></a>';
             $cont[] = '<a href="index.php?modname=reservation&amp;op=delclassroom&amp;idClassroom=' . $idClassroom . '" ' . 'title="' . $lang->def('_DEL') . ' : ' . $name . '">' . '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . ' : ' . $name . '" /></a>';
         }
         $tb->addBody($cont);
     }
     if ($mod_perm) {
         $tb->addActionAdd('<a href="index.php?modname=reservation&amp;op=addclassroom" title="' . $lang->def('_TITLE_NEW_CLASSROOM') . '">' . '<img src="' . getPathImage() . 'standard/add.png" alt="' . $lang->def('_ADD') . '" />' . $lang->def('_NEW_CLASSROOM') . '</a>');
     }
     $out->add(getTitleArea($lang->def('_TITLE_CLASSROOM'), 'classroom', $lang->def('_ALT_TITLE_CLASSROOM')) . '<div class="std_block">');
     if (isset($_GET['result'])) {
         switch ($_GET['result']) {
             case "ok":
                 $out->add(getResultUi($lang->def('_OPERATION_SUCCESSFUL')));
                 break;
             case "err":
                 $out->add(getErrorUi($lang->def('_OPERATION_FAILURE')));
                 break;
             case "err_del":
                 $out->add(getErrorUi($lang->def('_OPERATION_FAILURE')));
                 break;
         }
     }
     $out->add(getBackUi('index.php?modname=reservation&amp;op=reservation&amp;active_tab=subscribed_user', $lang->def('_BACK')));
     $out->add($tb->getTable() . $tb->getNavBar($ini, $tot_classroom) . '</div>');
 }
Ejemplo n.º 5
0
function classroomToEdition()
{
    require_once _base_ . '/lib/lib.form.php';
    //require_once(_i18n_.'/lib.lang.php');
    require_once _base_ . '/lib/lib.table.php';
    require_once $GLOBALS['where_lms'] . '/lib/lib.course.php';
    if (isset($_POST['classroom_to_edition'])) {
        list($edition_id) = each($_POST['classroom_to_edition']);
    } else {
        $edition_id = importVar('edition_id', true, 0);
    }
    $of_loc = importVar('of_loc', false, '');
    $of_name = importVar('of_name', false, '');
    $form = new Form();
    $query_course_name = "SELECT idCourse, name\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_course_edition\r\n\tWHERE idCourseEdition = '" . $edition_id . "'";
    list($idCourse, $edition_name) = sql_fetch_row(sql_query($query_course_name));
    $lang =& DoceboLanguage::CreateInstance('course', 'lms');
    $tb = new Table(Get::sett('visuItem'), $lang->def('_CLASSROOMTOCOURSE_CAPTION'), $lang->def('_CLASSROOMTOCOURSE_CAPTION'));
    $tb->initNavBar('ini', 'link');
    $tb->setLink("index.php?modname=course&amp;op=classroom_to_edition&amp;edition_id={$edition_id}" . '&amp;of_loc=' . $of_loc . '&amp;of_name=' . $of_name);
    $ini = $tb->getSelectedElement();
    $checked_class = checkAvailableClass($idCourse, $edition_id);
    $classroom_order = "l.location, c.name ";
    if ($of_loc == 'loc') {
        $classroom_order = "l.location, c.name ";
    }
    if ($of_loc == 'locd') {
        $classroom_order = "l.location DESC, c.name ";
    }
    if ($of_name == 'name') {
        $classroom_order = "c.name, l.location ";
    }
    if ($of_name == 'namec') {
        $classroom_order = "c.name DESC, l.location ";
    }
    if ($of_loc == '' && $of_name == '') {
        $of_loc = 'loc';
    }
    //search query of classrooms ---------------------------------
    $query_classroom = "\r\n\tSELECT c.idClassroom, c.name, c.description, l.location\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_classroom AS c\r\n\t\tJOIN " . $GLOBALS['prefix_lms'] . "_class_location AS l\r\n\tWHERE l.location_id = c.location_id\r\n\tORDER BY " . $classroom_order . "\r\n\tLIMIT {$ini}," . Get::sett('visuItem');
    $re_classroom = sql_query($query_classroom);
    // search classrooms assigned --------------------------------
    $query_class_assigned = "\r\n\tSELECT classrooms\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_course_edition\r\n\twhere idCourseEdition= " . $edition_id . "";
    list($assigned_classroom) = sql_fetch_row(sql_query($query_class_assigned));
    $query_classroom_tot = "\r\n\tSELECT COUNT(*)\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_classroom ";
    list($tot_classroom) = sql_fetch_row(sql_query($query_classroom_tot));
    // table intestation
    $type_h = array('', '', '', 'image');
    $cont_h = array('<a href="' . "index.php?modname=course&amp;op=classroom_to_edition&amp;edition_id=" . $edition_id . "&amp;of_loc=" . ($of_loc == 'loc' ? 'locd' : 'loc') . '">' . ($of_loc == 'loc' ? '<img src="' . getPathImage() . '/standard/1downarrow.png" alt="' . $lang->def('_DEF_DOWN') . '" />' : ($of_loc == 'locd' ? '<img src="' . getPathImage() . '/standard/1uparrow.png" alt="' . $lang->def('_DEF_UP') . '" />' : '<img src="' . getPathImage() . '/standard/sort.png" alt="' . $lang->def('_DEF_SORT') . '" />')) . $lang->def('_LOCATION') . '</a>', '<a href="' . "index.php?modname=course&amp;op=classroom_to_edition&amp;edition_id=" . $edition_id . "&amp;of_name=" . ($of_name == 'name' ? 'named' : 'name') . '">' . ($of_name == 'name' ? '<img src="' . getPathImage() . '/standard/1downarrow.png" alt="' . $lang->def('_DEF_DOWN') . '" />' : ($of_name == 'named' ? '<img src="' . getPathImage() . '/standard/1uparrow.png" alt="' . $lang->def('_DEF_UP') . '" />' : '<img src="' . getPathImage() . '/standard/sort.png" alt="' . $lang->def('_DEF_SORT') . '" />')) . $lang->def('_CLASSROOM', 'course') . '</a>', $lang->def('_STATUS'), $lang->def('_USETHIS'));
    $tb->setColsStyle($type_h);
    $tb->addHead($cont_h);
    $class_room_to_edition = array();
    while (list($idClassroom, $name, $descr, $location) = sql_fetch_row($re_classroom)) {
        $cont = array('<label for="class_room_to_edition_' . $idClassroom . '">' . $location . '</label>', '<label for="class_room_to_edition_' . $idClassroom . '">' . $name . '</label>');
        if (isset($checked_class[$idClassroom])) {
            $cont[] = $lang->def('_CLASSROOM_OCCUPATED_YES');
        } else {
            $cont[] = '';
        }
        $cont[] = $form->getRadio('', 'class_room_to_edition_' . $idClassroom . '', 'class_room_to_edition', $idClassroom, $assigned_classroom == $idClassroom);
        $tb->addBody($cont);
    }
    $page_title = array('index.php?modname=course&amp;op=course_list' => $lang->def('_CLASSROOM'), $edition_name);
    $GLOBALS['page']->add(getTitleArea($page_title, 'classroomtocourse', $lang->def('_CLASSROOM')) . '<div class="std_block">' . ($checked_class !== false ? getResultUi($lang->def('_CLASSROOM_OCCUPATED')) : '') . getBackUi('index.php?modname=course&amp;op=course_list', $lang->def('_BACK')) . $form->openForm('assignEditionClassroom', 'index.php?modname=course&amp;op=assignEditionClassroom', false, false, 'multipart/form-data') . $form->getHidden('edition_id', 'edition_id', $edition_id) . $form->getHidden('idCourse', 'idCourse', $idCourse) . $tb->getTable() . $tb->getNavBar($ini, $tot_classroom) . $form->openButtonSpace() . $form->getButton('assignEditionClassroom', 'assignEditionClassroom', $lang->def('_SAVE')) . $form->getButton('course_undo', 'course_undo', $lang->def('_UNDO')) . $form->closeButtonSpace() . $form->closeForm() . '</div>', 'content');
}
Ejemplo n.º 6
0
 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&amp;op=org_chart', "&lt;&lt;" . $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&amp;op=org_chart', "&lt;&lt;" . $lang->def('_BACK')));
     $out->add('</div>');
 }
Ejemplo n.º 7
0
function create()
{
    checkPerm('mod');
    require_once $GLOBALS['where_lms'] . '/lib/lib.course.php';
    require_once _base_ . '/lib/lib.table.php';
    require_once _base_ . '/lib/lib.form.php';
    $lang =& DoceboLanguage::createInstance('certificate', 'lms');
    $id_certificate = importVar('id_certificate', true, 0);
    $id_meta = array();
    $acl_man =& Docebo::user()->getAclManager();
    $first = true;
    $tot_element = 0;
    $out =& $GLOBALS['page'];
    $out->setWorkingZone('content');
    $tb = new Table(Get::sett('visuItem'), $lang->def('_META_CERTIFICATE_CREATE_CAPTION'), $lang->def('_META_CERTIFICATE_CREATE_CAPTION'));
    $tb->initNavBar('ini', 'button');
    $ini = $tb->getSelectedElement();
    $query = "SELECT idMetaCertificate" . " FROM " . $GLOBALS['prefix_lms'] . "_certificate_meta" . " WHERE idCertificate = '" . $id_certificate . "'";
    $result = sql_query($query);
    while (list($id_meta_temp) = sql_fetch_row($result)) {
        $id_meta[] = $id_meta_temp;
    }
    $query = "SELECT idCourse, idUser" . " FROM " . $GLOBALS['prefix_lms'] . "_courseuser" . " WHERE status = '" . _CUS_END . "'";
    $result = sql_query($query);
    $user_course_completed = array();
    while (list($id_course_t, $id_user_t) = sql_fetch_row($result)) {
        $user_course_completed[$id_user_t][$id_course_t] = $id_course_t;
    }
    $query = "SELECT idMetaCertificate, title" . " FROM " . $GLOBALS['prefix_lms'] . "_certificate_meta";
    $result = sql_query($query);
    $array_title = array();
    while (list($id_meta_t, $title_t) = sql_fetch_row($result)) {
        $array_title[$id_meta_t] = $title_t;
    }
    $query = "SELECT idUser, idMetaCertificate, COUNT(*)" . " FROM " . $GLOBALS['prefix_lms'] . "_certificate_meta_course" . " GROUP BY idUser, idMetaCertificate";
    $result = sql_query($query);
    $array_control = array();
    while (list($id_user_t, $id_meta_t, $control_t) = sql_fetch_row($result)) {
        $array_control[$id_user_t][$id_meta_t] = $control_t;
    }
    if (isset($_POST['undo_filter_create'])) {
        unset($_POST['filter_username']);
        unset($_POST['filter_firstname']);
        unset($_POST['filter_lastname']);
        unset($_POST['filter_release_status']);
    }
    $query = "SELECT m.idUser, u.lastname, u.firstname, u.userid" . " FROM " . $GLOBALS['prefix_lms'] . "_certificate_meta_course as m" . " JOIN " . $GLOBALS['prefix_fw'] . "_user as u ON u.idst = m.idUser" . " WHERE m.idMetaCertificate IN (" . implode(',', $id_meta) . ")" . (isset($_POST['filter_username']) ? "AND u.userid LIKE '%" . $_POST['filter_username'] . "%'" : '') . (isset($_POST['filter_firstname']) ? "AND u.firstname LIKE '%" . $_POST['filter_firstname'] . "%'" : '') . (isset($_POST['filter_lastname']) ? "AND u.lastname LIKE '%" . $_POST['filter_lastname'] . "%'" : '') . " GROUP BY m.idUser, u.lastname, u.firstname, u.userid" . " ORDER BY u.lastname, u.firstname, u.userid";
    $result = sql_query($query);
    while (list($id_user, $lastname, $firstname, $userid) = sql_fetch_row($result)) {
        foreach ($id_meta as $idmeta) {
            if (isset($array_control[$id_user][$idmeta]) && $array_control[$id_user][$idmeta]) {
                $title = strip_tags($array_title[$idmeta]);
                $query = "SELECT idCourse" . " FROM " . $GLOBALS['prefix_lms'] . "_certificate_meta_course" . " WHERE idUser = '******'" . " AND idMetaCertificate = '" . $idmeta . "'";
                $result_int = sql_query($query);
                $control = true;
                while (list($id_course) = sql_fetch_row($result_int)) {
                    if (!isset($user_course_completed[$id_user][$id_course])) {
                        $control = false;
                    }
                }
                if ($control) {
                    $tot_element++;
                    if ($tot_element > $ini && $tot_element <= $ini + Get::sett('visuItem')) {
                        list($is_released) = sql_fetch_row(sql_query("SELECT COUNT(*)" . " FROM " . $GLOBALS['prefix_lms'] . "_certificate_meta_assign" . " WHERE idUser = '******'" . " AND idMetaCertificate = '" . $idmeta . "'"));
                        if (!isset($_POST['filter_release_status']) || isset($_POST['filter_release_status']) && $_POST['filter_release_status'] == 0 || isset($_POST['filter_release_status']) && $_POST['filter_release_status'] == '1' && $is_released == 1 || isset($_POST['filter_release_status']) && $_POST['filter_release_status'] == '2' && $is_released == 0) {
                            if ($first) {
                                $first = false;
                                $type_h = array('', '', '', 'image', 'image', 'image');
                                $cont_h = array($lang->def('_FULLNAME'), $lang->def('_USERNAME'), $lang->def('_TITLE'), Get::img('standard/view.png', Lang::t('_PREVIEW', 'certificate')), Get::img('course/certificate.png', Lang::t('_TAKE_A_COPY', 'certificate')), '<img src="' . getPathImage('lms') . 'standard/delete.png" alt="' . $lang->def('_ALT_REM_META_CERT') . ' : ' . strip_tags($title) . '" />');
                                $tb->setColsStyle($type_h);
                                $tb->addHead($cont_h);
                            }
                            $cont = array();
                            $cont[] = $lastname . ' ' . $firstname;
                            $cont[] = $acl_man->relativeId($userid);
                            $cont[] = $title;
                            $cont[] = '<a href="index.php?modname=meta_certificate&amp;op=preview_cert&amp;id_certificate=' . $id_certificate . '&amp;idmeta=' . $idmeta . '&amp;iduser='******'">' . Get::img('standard/view.png', Lang::t('_PREVIEW', 'certificate') . ' : ' . strip_tags($title)) . '</a>';
                            $cont[] = '<a href="index.php?modname=meta_certificate&amp;op=release_cert&amp;id_certificate=' . $id_certificate . '&amp;idmeta=' . $idmeta . '&amp;iduser='******'">' . Get::img('course/certificate.png', Lang::t('_TAKE_A_COPY', 'certificate') . ' : ' . strip_tags($title)) . '</a>';
                            if ($is_released) {
                                $cont[] = '<a href="index.php?modname=meta_certificate&amp;op=del_released&amp;id_certificate=' . $id_certificate . '&amp;idmeta=' . $idmeta . '&amp;iduser='******'">' . '<img src="' . getPathImage('lms') . 'standard/delete.png" alt="' . $lang->def('_ALT_REM_META_CERT') . ' : ' . strip_tags($title) . '" /></a>';
                            } else {
                                $cont[] = '';
                            }
                            $tb->addBody($cont);
                        }
                    }
                }
            }
        }
    }
    require_once _base_ . '/lib/lib.dialog.php';
    setupHrefDialogBox('a[href*=del_released]');
    $array_release_status = array($lang->def('_ALL') => '0', $lang->def('_ONLY_RELEASED') => '1', $lang->def('_ONLY_NOT_RELEASED') => '2');
    if ($first) {
        $out->add(getTitleArea($lang->def('_TITLE_META_CERTIFICATE_CREATE'), 'certificate') . '<div class="std_block">');
        if (isset($_POST['filter'])) {
            $out->add(Form::openForm('meta_certificate_filter', 'index.php?modname=meta_certificate&op=create&id_certificate=' . $id_certificate) . Form::openElementSpace() . Form::getTextfield($lang->def('_USERNAME'), 'filter_username', 'filter_username', '255', isset($_POST['filter_username']) ? $_POST['filter_username'] : '') . Form::getTextfield($lang->def('_FIRSTNAME'), 'filter_firstname', 'filter_firstname', '255', isset($_POST['filter_firstname']) ? $_POST['filter_firstname'] : '') . Form::getTextfield($lang->def('_LASTNAME'), 'filter_lastname', 'filter_lastname', '255', isset($_POST['filter_lastname']) ? $_POST['filter_lastname'] : '') . Form::getRadioSet($lang->def('_RELEASE_STATUS_FILTER'), 'filter_release_status', 'filter_release_status', $array_release_status, isset($_POST['filter_release_status']) ? $_POST['filter_release_status'] : '0') . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('filter', 'filter', $lang->def('_FILTER')) . Form::getButton('undo_filter_create', 'undo_filter_create', $lang->def('_UNDO_FILTER')) . Form::closeButtonSpace() . Form::closeForm());
        }
        $out->add($lang->def('_NO_USER_FOUND') . getBackUi('index.php?modname=meta_certificate&amp;op=meta_certificate', $lang->def('_BACK')) . '</div>');
    } else {
        $out->add(getTitleArea($lang->def('_TITLE_META_CERTIFICATE_CREATE'), 'certificate') . '<div class="std_block">');
        if (isset($_GET['result'])) {
            switch ($_GET['result']) {
                case "ok":
                    $out->add(getResultUi($lang->def('_OPERATION_SUCCESSFUL')));
                    break;
                case "err_del_cert":
                    $out->add(getErrorUi($lang->def('_OPERATION_FAILURE')));
                    break;
            }
        }
        $out->add(Form::openForm('meta_certificate_filter', 'index.php?modname=meta_certificate&op=create&id_certificate=' . $id_certificate) . Form::openElementSpace() . Form::getTextfield($lang->def('_USERNAME'), 'filter_username', 'filter_username', '255', isset($_POST['filter_username']) ? $_POST['filter_username'] : '') . Form::getTextfield($lang->def('_FIRSTNAME'), 'filter_firstname', 'filter_firstname', '255', isset($_POST['filter_firstname']) ? $_POST['filter_firstname'] : '') . Form::getTextfield($lang->def('_LASTNAME'), 'filter_lastname', 'filter_lastname', '255', isset($_POST['filter_lastname']) ? $_POST['filter_lastname'] : '') . Form::getRadioSet($lang->def('_RELEASE_STATUS_FILTER'), 'filter_release_status', 'filter_release_status', $array_release_status, isset($_POST['filter_release_status']) ? $_POST['filter_release_status'] : '0') . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('filter', 'filter', $lang->def('_FILTER')) . Form::getButton('undo_filter_create', 'undo_filter_create', $lang->def('_UNDO_FILTER')) . Form::closeButtonSpace() . $tb->getTable() . $tb->getNavBar($ini, $tot_element) . Form::closeForm() . getBackUi('index.php?modname=meta_certificate&amp;op=meta_certificate', $lang->def('_BACK')) . '</div>');
    }
}
Ejemplo n.º 8
0
function view_report_certificate()
{
    checkPerm('view');
    require_once _lms_ . '/lib/lib.certificate.php';
    require_once _lms_ . '/lib/lib.course.php';
    $out =& $GLOBALS['page'];
    $out->setWorkingZone('content');
    $lang =& DoceboLanguage::createInstance('certificate', 'lms');
    $deletion = importVar('deletion', true, 0);
    if ($deletion) {
        switch ($deletion) {
            case 1:
                $out->add(getResultUi($lang->def('_OPERATION_SUCCESSFUL')));
                break;
            case 2:
                $out->add(getErrorUi($lang->def('_OPERATION_FAILURE')));
                break;
            case 3:
                $out->add(getErrorUi($lang->def('_OPERATION_FAILURE')));
                break;
        }
    }
    $certificate = new Certificate();
    $id_certificate = importVar('id_certificate', true, 0);
    $id_course = importVar('id_course', true, 0);
    $selection = importVar('selection', false, array());
    //all possible selected values
    $selected = importVar('selected', false, array());
    //effectively selected values with checkbox
    $sel = importVar('old_selection', false, '');
    //selected values from previous table pages
    if ($sel != '') {
        $total_selection = explode(',', $sel);
    } else {
        $total_selection = array();
    }
    //update total selection
    foreach ($selection as $key => $val) {
        if (in_array($val, $selected)) {
            if (!in_array($val, $total_selection)) {
                $total_selection[] = $val;
            }
        } else {
            $index = array_search($val, $total_selection);
            if ($index !== false) {
                array_splice($total_selection, $index, 1);
            }
        }
    }
    $search_filter = importVar('filter', false, '');
    $only_released = importVar('only_released', true, 0);
    //which command?
    if (importVar('search_button', false, false) !== false) {
    }
    if (importVar('reset_button', false, false) !== false) {
        $search_filter = '';
        $only_released = 0;
    }
    if (importVar('print_button', false, false) !== false) {
    }
    $numtablerows = $GLOBALS['framework']['visuItem'];
    $tb = new Table($numtablerows, $lang->def('_CERTIFICATE_VIEW_CAPTION'), $lang->def('_CERTIFICATE_VIEW_CAPTION'));
    $tb->initNavBar('ini', 'button');
    $ini = $tb->getSelectedElement();
    $tca = $GLOBALS['prefix_lms'] . "_certificate_assign as ca";
    $tcc = $GLOBALS['prefix_lms'] . "_certificate_course as cc";
    $tcu = $GLOBALS['prefix_lms'] . "_courseuser as cu";
    $tu = $GLOBALS['prefix_fw'] . "_user as u";
    $where = "";
    if ($search_filter != '') {
        $where .= " AND (u.userid LIKE '%" . $search_filter . "%' OR u.lastname LIKE '%" . $search_filter . "%' OR u.firstname LIKE '%" . $search_filter . "%') ";
    }
    if ($only_released > 0) {
        $where = " AND ca.on_date " . ($only_released == 1 ? "IS NOT" : "IS") . " NULL ";
    }
    //$where .= " AND ".$aval_status." ".($only_released==1 ? "<" : ">=")." cu.status ";
    list($aval_status) = sql_fetch_row(sql_query("SELECT available_for_status FROM " . $tcc . " " . " WHERE id_certificate='" . (int) $id_certificate . "' AND id_course='" . (int) $id_course . "'"));
    switch ($aval_status) {
        case AVS_ASSIGN_FOR_ALL_STATUS:
            $aval_status = " 1 ";
            break;
        case AVS_ASSIGN_FOR_STATUS_INCOURSE:
            $aval_status = " cu.status = " . _CUS_BEGIN . " ";
            break;
        case AVS_ASSIGN_FOR_STATUS_COMPLETED:
            $aval_status = " cu.status = " . _CUS_END . " ";
            break;
    }
    list($totalrows) = sql_fetch_row(sql_query("SELECT COUNT(*) " . " FROM ( " . $tu . " JOIN " . $tcu . " ON (u.idst = cu.idUser) ) LEFT JOIN " . $tca . " " . " ON ( ca.id_course = cu.idCourse AND ca.id_user=cu.idUser ) " . " WHERE (ca.id_certificate='" . (int) $id_certificate . "' OR ca.id_certificate IS NULL) AND " . $aval_status . " " . " AND cu.idCourse='" . (int) $id_course . "' " . $where));
    $query = "SELECT u.userid, u.firstname, u.lastname, cu.date_complete, ca.on_date, cu.idUser as id_user, cu.status " . " FROM ( " . $tu . " JOIN " . $tcu . " ON (u.idst = cu.idUser) ) LEFT JOIN " . $tca . " " . " ON ( ca.id_course = cu.idCourse AND ca.id_user=cu.idUser ) " . " WHERE (ca.id_certificate='" . (int) $id_certificate . "' OR ca.id_certificate IS NULL) AND " . $aval_status . " " . " AND cu.idCourse='" . (int) $id_course . "' " . $where . " ORDER BY u.userid LIMIT " . $ini . ", " . $numtablerows;
    $res = sql_query($query);
    $from = Get::req('from', DOTY_MIXED, '');
    $back_ui = getBackUi('index.php?r=lms/pcourse/certificate&amp;id_course=' . (int) $id_course, $lang->def('_BACK'));
    $out->add(getTitleArea(array('index.php?r=lms/pcourse/certificate&amp;id_course=' . (int) $id_course => $lang->def('_CERTIFICATE_ASSIGN_STATUS', 'course'), $lang->def('_CERTIFICATE_REPORT_COURSE_CERT')), 'certificate'));
    $out->add('<div class="std_block">' . $back_ui);
    $numrows = sql_num_rows($res);
    $downloadables = array();
    if ($numrows > 0) {
        $clang =& DoceboLanguage::CreateInstance('course', 'lms');
        $type_h = array('image', '', '', '', '', '', '', 'image', 'image');
        $cont_h = array('', $lang->def('_USERNAME'), $lang->def('_LASTNAME'), $lang->def('_FIRSTNAME'), $clang->def('_STATUS'), $lang->def('_DATE'), $lang->def('_RELASE_DATE'), Get::img('course/certificate.png', Lang::t('_TITLE_VIEW_CERT', 'certificate')), Get::img('standard/delete.png', Lang::t('_DEL', 'certificate')));
        $tb->setColsStyle($type_h);
        $tb->addHead($cont_h);
        $acl_man =& $GLOBALS['current_user']->getAclManager();
        $arr_status = array(_CUS_CONFIRMED => $clang->def('_USER_STATUS_CONFIRMED'), _CUS_SUBSCRIBED => $clang->def('_USER_STATUS_SUBS'), _CUS_BEGIN => $clang->def('_USER_STATUS_BEGIN'), _CUS_END => $clang->def('_USER_STATUS_END'), _CUS_SUSPEND => $clang->def('_USER_STATUS_SUSPEND'));
        //foreach($report_info as $info_report)
        while ($info = sql_fetch_assoc($res)) {
            $cont = array();
            $can_assign = (bool) ($info['on_date'] == '');
            $input_id = $info['id_user'];
            $sel_cell_content = '';
            $label_open = '';
            $label_close = '';
            if ($can_assign) {
                $input = '<input type="hidden" id="selection_' . $input_id . '" name="selection[' . $input_id . ']" value="' . $input_id . '"/> ';
                if (in_array($input_id, $total_selection)) {
                    $checked = ' checked="checked"';
                } else {
                    $checked = '';
                }
                $sel_cell_content .= $input . '<input type="checkbox" id="selected_' . $input_id . '" name="selected[' . $input_id . ']" value="' . $input_id . '"' . $checked . '/>';
                $label_open = '<label for="selected_' . $input_id . '">';
                $label_close = '</label>';
            }
            $userid = $acl_man->relativeId($info['userid']);
            $cont[] = $sel_cell_content;
            $cont[] = $label_open . ($search_filter != '' ? highlightText($userid, $search_filter) : $userid) . $label_close;
            $cont[] = $label_open . ($search_filter != '' ? highlightText($info['lastname'], $search_filter) : $info['lastname']) . $label_close;
            $cont[] = $label_open . ($search_filter != '' ? highlightText($info['firstname'], $search_filter) : $info['firstname']) . $label_close;
            $cont[] = $arr_status[$info['status']];
            $cont[] = $info['date_complete'];
            $cont[] = $info['on_date'];
            $url = 'index.php?modname=pcertificate&amp;certificate_id=' . $id_certificate . '&amp;course_id=' . $id_course . '&amp;user_id=' . $info['id_user'];
            $dl_url = $url . "&amp;op=send_certificate";
            if ($can_assign) {
                $downloadables[] = 'dl_single_' . $input_id;
            }
            $cont[] = '<a href="' . ($can_assign ? "javascript:;" : $dl_url) . '" id="dl_single_' . $input_id . '">' . Get::img('course/certificate.png', Lang::t('_TITLE_VIEW_CERT', 'certificate')) . ($can_assign ? $lang->def('_GENERATE') : $lang->def('_DOWNLOAD')) . '</a>';
            $cont[] = $can_assign ? "" : '<a href="' . $url . '&amp;op=del_report_certificate">' . Get::img('standard/delete.png', Lang::t('_DEL', 'certificate')) . '</a>';
            $tb->addBody($cont);
        }
        require_once _base_ . '/lib/lib.dialog.php';
        setupHrefDialogBox('a[href*=del_report_certificate]');
        $form = new Form();
        $form_url = "index.php?modname=pcertificate&amp;op=view_report_certificate&amp;id_certificate=" . (int) $id_certificate . "&amp;id_course=" . (int) $id_course;
        $out->add($form->openForm("certificates_emission", $form_url));
        $out->add($form->getHidden('old_selection', 'old_selection', implode(',', $total_selection)));
        //search filter ...
        $release_options = array($lang->def('_ALL') => 0, $lang->def('_ONLY_RELEASED') => 1, $lang->def('_ONLY_TO_RELEASE') => 2);
        /*
        		$out->add($form->getOpenFieldset($lang->def('_SEARCH_FILTER')));
        		$out->add($form->getTextfield($lang->def('_FILTER'), "filter", "filter", 255, $search_filter));
        		$out->add($form->getRadioSet($lang->def('_RELEASE_OPTIONS'), 'only_released', 'only_released', $release_options, $only_released).'<div class="no_float"></div>');
        		$out->add($form->openButtonSpace());
        		$out->add($form->getButton("search_button", "search_button", $lang->def('_SEARCH')));
        		$out->add($form->getButton("reset_button", "reset_button", $lang->def('_UNDO')));
        		$out->add($form->closeButtonSpace());
        		$out->add($form->getCloseFieldset());
        */
        $print_button_1 = '<div><a id="print_selected_button_1" href="javascript:;">' . Get::img('course/certificate.png', Lang::t('_GENERATE_ALL_SELECTED', 'certificate')) . Lang::t('_GENERATE_ALL_SELECTED', 'certificate') . '</a></div>';
        $print_button_2 = '<div><a id="print_selected_button_2" href="javascript:;">' . Get::img('course/certificate.png', Lang::t('_GENERATE_ALL_SELECTED', 'certificate')) . Lang::t('_GENERATE_ALL_SELECTED', 'certificate') . '</a></div>';
        cout('<div class="quick_search_form">' . Form::getInputTextfield("_FILTER", "filter", "filter", $search_filter, '', 255, '') . Form::getButton("search_button", "search_button", Lang::t('_SEARCH', 'standard'), "search_b") . Form::getButton("reset_button", "reset_button", Lang::t('_RESET', 'standard'), "reset_b") . '<br />' . '<br />' . $lang->def('_RELEASE_OPTIONS') . ': ' . Form::getInputRadio('only_released_0', 'only_released', '0', $only_released == 0, '') . ' <label class="label_normal" for="only_released_0">' . Lang::t('_ALL', 'certificate') . '</label>' . '&nbsp;&nbsp;&nbsp;&nbsp;' . Form::getInputRadio('only_released_1', 'only_released', '1', $only_released == 1, '') . ' <label class="label_normal" for="only_released_1">' . Lang::t('_ONLY_RELEASED', 'certificate') . '</label>' . '&nbsp;&nbsp;&nbsp;&nbsp;' . Form::getInputRadio('only_released_2', 'only_released', '2', $only_released == 2, '') . ' <label class="label_normal" for="only_released_2">' . Lang::t('_ONLY_TO_RELEASE', 'certificate') . '</label>' . Form::closeForm() . '</div>', 'content');
        $navbar = $tb->getNavBar($ini, $totalrows);
        $out->add($print_button_1 . '<br />' . $navbar . $tb->getTable() . $navbar . '<br />' . $print_button_2);
        $out->add($form->closeForm());
    } else {
        $out->add($lang->def('_NO_USER_FOR_CERTIFICATE'));
    }
    $out->add($back_ui . '</div>');
    addCss('style_menu', 'lms');
    Util::get_js(Get::rel_path('lms') . '/modules/pcertificate/pcertificate.js', true, true);
    $script = 'var ajax_url="ajax.server.php?plf=lms&mn=pcertificate"; var _STOP="' . $lang->def('_STOP') . '"; ' . 'var glob_id_certificate = ' . (int) $id_certificate . ', glob_id_course = ' . (int) $id_course . ';' . 'var single_list = [' . (count($downloadables) ? '"' . implode('","', $downloadables) . '"' : '') . ']; ' . 'var reload_url = "' . str_replace('&amp;', '&', isset($form_url) ? $form_url : '') . '", _ERROR_PARSE = "' . $lang->def('_OPERATION_FAILURE') . '", _SUCCESS = "' . $lang->def('_OPERATION_SUCCESSFUL') . '";';
    $out->add('<script type="text/javascript">' . $script . '</script>', 'page_head');
}
Ejemplo n.º 9
0
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&amp;op=searchmessage&amp;idThread=' . $id_thread . '&amp;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&amp;op=forum' => $lang->def('_FORUM'), 'index.php?modname=forum&amp;op=search&amp;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="&gt;" />&nbsp;' . '<a href="index.php?modname=forum&amp;op=viewprofile&amp;idMessage=' . $id_message . '&amp;ini=' . $ini_page . '&amp;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&amp;op=download&amp;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&amp;op=moderatemessage&amp;idMessage=' . $id_message . '&amp;ini=' . $ini_page . '" ' . 'title="' . $lang->def('_DEMODERATE') . ' : ' . strip_tags($message_info['title']) . '">' . '<img src="' . getPathImage() . 'standard/demoderate.png" alt="' . $lang->def('_DEMODERATE') . ' : ' . strip_tags($message_info['title']) . '" /> ' . $lang->def('_DEMODERATE') . '</a> ';
            } else {
                $action .= '<a href="index.php?modname=forum&amp;op=moderatemessage&amp;idMessage=' . $id_message . '&amp;ini=' . $ini_page . '" ' . 'title="' . $lang->def('_MODERATE') . ' : ' . strip_tags($message_info['title']) . '">' . '<img src="' . getPathImage() . 'standard/moderate.png" alt="' . $lang->def('_MODERATE') . ' : ' . strip_tags($message_info['title']) . '" /> ' . $lang->def('_MODERATE') . '</a> ';
            }
        }
        if (!$locked_t && !$locked_f || $mod_perm || $moderate) {
            $action .= '<a href="index.php?modname=forum&amp;op=addmessage&amp;idThread=' . $id_thread . '&amp;idMessage=' . $id_message . '&amp;ini=' . $ini_page . '" ' . 'title="' . $lang->def('_REPLY') . ' : ' . strip_tags($message_info['title']) . '">' . '<img src="' . getPathImage() . 'standard/reply.png" alt="' . $lang->def('_REPLY') . ' : ' . strip_tags($message_info['title']) . '" /> ' . $lang->def('_QUOTE') . '</a>';
        }
        if ($moderate || $mod_perm || $m_author == getLogUserId()) {
            $action .= '<a href="index.php?modname=forum&amp;op=modmessage&amp;idMessage=' . $id_message . '&amp;ini=' . $ini_page . '" ' . 'title="' . $lang->def('_MOD_MESSAGE') . ' : ' . strip_tags($message_info['title']) . '">' . '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . ' : ' . strip_tags($message_info['title']) . '" /> ' . $lang->def('_MOD') . '</a>' . '<a href="index.php?modname=forum&amp;op=delmessage&amp;idMessage=' . $id_message . '&amp;ini=' . $ini_page . '" ' . 'title="' . $lang->def('_DEL') . ' : ' . strip_tags($message_info['title']) . '">' . '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . ' : ' . strip_tags($message_info['title']) . '" /> ' . $lang->def('_DEL') . '</a> ';
        }
        $tb->addBodyExpanded($action, 'forum_action');
    }
    if (!$locked_t && !$locked_f || $mod_perm || $moderate) {
        $tb->addActionAdd('<a href="index.php?modname=forum&amp;op=addmessage&amp;idThread=' . $id_thread . '&amp;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&amp;op=search&amp;idThread=' . $id_thread) . '<div class="quick_search_form">' . '<label for="search_arg">' . $lang->def('_SEARCH_LABEL') . '</label> ' . Form::getInputTextfield('search_t', 'search_arg', 'search_arg', $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&amp;op=modstatusthread&amp;idThread=' . $id_thread . '&amp;ini=' . $ini_page . '">' . ($locked_t ? '<img src="' . getPathImage() . 'standard/msg_read.png" alt="' . $lang->def('_FREE') . '" /> ' . $lang->def('_FREETHREAD') : '<img src="' . getPathImage() . 'standard/locked.png" alt="' . $lang->def('_LOCKTHREAD') . '" /> ' . $lang->def('_LOCKTHREAD')) . '</a> ' . '<a href="index.php?modname=forum&amp;op=changeerased&amp;idThread=' . $id_thread . '&amp;ini=' . $ini_page . '">' . ($erased_t ? '<img src="' . getPathImage() . 'standard/msg_read.png" alt="' . $lang->def('_UNERASE') . '" /> ' . $lang->def('_UNERASE') : '<img src="' . getPathImage() . 'standard/moderate.png" alt="' . $lang->def('_MODERATE') . '" /> ' . $lang->def('_MODERATE')) . '</a>' . '</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&amp;op=modstatusthread&amp;idThread=' . $id_thread . '&amp;ini=' . $ini_page . '">' . ($locked_t ? '<img src="' . getPathImage() . 'standard/msg_read.png" alt="' . $lang->def('_FREE') . '" /> ' . $lang->def('_FREETHREAD') : '<img src="' . getPathImage() . 'standard/locked.png" alt="' . $lang->def('_LOCKTHREAD') . '" /> ' . $lang->def('_LOCKTHREAD')) . '</a> ' . '<a href="index.php?modname=forum&amp;op=changeerased&amp;idThread=' . $id_thread . '&amp;ini=' . $ini_page . '">' . ($erased_t ? '<img src="' . getPathImage() . 'standard/msg_read.png" alt="' . $lang->def('_UNERASE') . '" /> ' . $lang->def('_UNERASE') : '<img src="' . getPathImage() . 'standard/moderate.png" alt="' . $lang->def('_MODERATE') . '" /> ' . $lang->def('_MODERATE')) . '</a>' . '</div>', 'content');
    }
    $GLOBALS['page']->add($tb->getNavBar($ini, $tot_message) . '</div>', 'content');
}
Ejemplo n.º 10
0
function view_report_certificate()
{
    checkPerm('view');
    require_once _lms_ . '/lib/lib.certificate.php';
    require_once _lms_ . '/lib/lib.course.php';
    $out =& $GLOBALS['page'];
    $out->setWorkingZone('content');
    $lang =& DoceboLanguage::createInstance('certificate', 'lms');
    $deletion = importVar('deletion', true, 0);
    if ($deletion) {
        switch ($deletion) {
            case 1:
                $out->add(getResultUi($lang->def('_OPERATION_SUCCESSFUL')));
                break;
            case 2:
                $out->add(getErrorUi($lang->def('_OPERATION_FAILURE')));
                break;
            case 3:
                $out->add(getErrorUi($lang->def('_OPERATION_FAILURE')));
                break;
        }
    }
    $certificate = new Certificate();
    $id_certificate = importVar('id_certificate', true, 0);
    $id_course = importVar('id_course', true, 0);
    $selection = importVar('selection', false, array());
    //all possible selected values
    $selected = importVar('selected', false, array());
    //effectively selected values with checkbox
    $sel = importVar('old_selection', false, '');
    //selected values from previous table pages
    if ($sel != '') {
        $total_selection = explode(',', $sel);
    } else {
        $total_selection = array();
    }
    //update total selection
    foreach ($selection as $key => $val) {
        if (in_array($val, $selected)) {
            if (!in_array($val, $total_selection)) {
                $total_selection[] = $val;
            }
        } else {
            $index = array_search($val, $total_selection);
            if ($index !== false) {
                array_splice($total_selection, $index, 1);
            }
        }
    }
    $search_filter = importVar('filter', false, '');
    $only_released = importVar('only_released', true, 0);
    //which command?
    if (importVar('search_button', false, false) !== false) {
    }
    if (importVar('reset_button', false, false) !== false) {
        $search_filter = '';
        $only_released = 0;
    }
    if (importVar('print_button', false, false) !== false) {
    }
    $numtablerows = Get::sett('visuItem', 25);
    $tb = new Table($numtablerows, $lang->def('_CERTIFICATE_VIEW_CAPTION'), $lang->def('_CERTIFICATE_VIEW_CAPTION'));
    $tb->initNavBar('ini', 'button');
    $ini = $tb->getSelectedElement();
    $ini_param = Get::req('ini', DOTY_MIXED, array());
    //floor($ini / Get::sett('visuItem', 25));
    if (empty($ini_param)) {
        $ini_param = 1;
    } else {
        list($ini_param) = each($ini_param);
    }
    $tca = $GLOBALS['prefix_lms'] . "_certificate_assign as ca";
    $tcc = $GLOBALS['prefix_lms'] . "_certificate_course as cc";
    $tcu = $GLOBALS['prefix_lms'] . "_courseuser as cu";
    $tu = $GLOBALS['prefix_fw'] . "_user as u";
    $where = "";
    if ($search_filter != '') {
        $where .= " AND (u.userid LIKE '%" . $search_filter . "%' OR u.lastname LIKE '%" . $search_filter . "%' OR u.firstname LIKE '%" . $search_filter . "%') ";
    }
    if ($only_released > 0) {
        $where = " AND ca.on_date " . ($only_released == 1 ? "IS NOT" : "IS") . " NULL ";
    }
    //$where .= " AND ".$aval_status." ".($only_released==1 ? "<" : ">=")." cu.status ";
    list($aval_status) = sql_fetch_row(sql_query("SELECT available_for_status FROM " . $tcc . " " . " WHERE id_certificate='" . (int) $id_certificate . "' AND id_course='" . (int) $id_course . "'"));
    switch ($aval_status) {
        case AVS_ASSIGN_FOR_ALL_STATUS:
            $aval_status = " 1 ";
            break;
        case AVS_ASSIGN_FOR_STATUS_INCOURSE:
            $aval_status = " cu.status = " . _CUS_BEGIN . " ";
            break;
        case AVS_ASSIGN_FOR_STATUS_COMPLETED:
            $aval_status = " cu.status = " . _CUS_END . " ";
            break;
    }
    list($totalrows) = sql_fetch_row(sql_query("SELECT COUNT(*) " . " FROM ( " . $tu . " JOIN " . $tcu . " ON (u.idst = cu.idUser) ) LEFT JOIN " . $tca . " " . " ON ( ca.id_course = cu.idCourse AND ca.id_user=cu.idUser ) " . " WHERE (ca.id_certificate='" . (int) $id_certificate . "' OR ca.id_certificate IS NULL) AND " . $aval_status . " " . " AND cu.idCourse='" . (int) $id_course . "' " . $where));
    $query = "SELECT u.userid, u.firstname, u.lastname, cu.date_complete, ca.on_date, cu.idUser as id_user, cu.status " . " FROM ( " . $tu . " JOIN " . $tcu . " ON (u.idst = cu.idUser) ) LEFT JOIN " . $tca . " " . " ON ( ca.id_course = cu.idCourse AND ca.id_user=cu.idUser ) " . " WHERE (ca.id_certificate='" . (int) $id_certificate . "' OR ca.id_certificate IS NULL) AND " . $aval_status . " " . " AND cu.idCourse='" . (int) $id_course . "' " . $where . " ORDER BY u.userid LIMIT " . $ini . ", " . $numtablerows;
    //cout('<pre>'.print_r($_POST, true).'</pre>');
    //cout($query);
    $res = sql_query($query);
    $from = Get::req('from', DOTY_MIXED, '');
    if ($from === 'course') {
        $back_ui = getBackUi('index.php?r=alms/course/certificate&amp;id_course=' . (int) $id_course, $lang->def('_BACK'));
        $out->add(getTitleArea(array('index.php?r=alms/course/certificate&amp;id_course=' . (int) $id_course => $lang->def('_CERTIFICATE_ASSIGN_STATUS', 'course'), $lang->def('_COURSES')), 'certificate'));
    } else {
        $back_ui = getBackUi('index.php?modname=certificate&amp;op=report_certificate&amp;id_certificate=' . (int) $id_certificate, $lang->def('_BACK'));
        $out->add(getTitleArea(array('index.php?modname=certificate&amp;op=certificate' => $lang->def('_TITLE_CERTIFICATE'), 'index.php?modname=certificate&amp;op=report_certificate&amp;id_certificate=' . (int) $id_certificate => $lang->def('_COURSES'), $lang->def('_CERTIFICATE_VIEW_CAPTION')), 'certificate'));
    }
    $out->add('<div class="std_block">' . $back_ui);
    $numrows = sql_num_rows($res);
    $downloadables = array();
    if ($numrows > 0) {
        $clang =& DoceboLanguage::CreateInstance('course', 'lms');
        $type_h = array('image', '', '', '', '', '', '', 'image', 'image');
        $cont_h = array('', $lang->def('_USERNAME'), $lang->def('_LASTNAME'), $lang->def('_FIRSTNAME'), $clang->def('_STATUS'), $lang->def('_DATE'), $lang->def('_RELASE_DATE'), Get::sprite('subs_pdf', Lang::t('_TITLE_VIEW_CERT', 'certificate')), Get::sprite('subs_del', Lang::t('_DEL', 'certificate')));
        $tb->setColsStyle($type_h);
        $tb->addHead($cont_h);
        $acl_man =& $GLOBALS['current_user']->getAclManager();
        $arr_status = array(_CUS_CONFIRMED => $clang->def('_USER_STATUS_CONFIRMED'), _CUS_SUBSCRIBED => $clang->def('_USER_STATUS_SUBS'), _CUS_BEGIN => $clang->def('_USER_STATUS_BEGIN'), _CUS_END => $clang->def('_USER_STATUS_END'), _CUS_SUSPEND => $clang->def('_USER_STATUS_SUSPEND'));
        //foreach($report_info as $info_report)
        while ($info = sql_fetch_assoc($res)) {
            $cont = array();
            $can_assign = (bool) ($info['on_date'] == '');
            $input_id = $info['id_user'];
            $sel_cell_content = '';
            $label_open = '';
            $label_close = '';
            if ($can_assign) {
                $input = '<input type="hidden" id="selection_' . $input_id . '" name="selection[' . $input_id . ']" value="' . $input_id . '"/> ';
                if (in_array($input_id, $total_selection)) {
                    $checked = ' checked="checked"';
                } else {
                    $checked = '';
                }
                $sel_cell_content .= $input . '<input type="checkbox" id="selected_' . $input_id . '" name="selected[' . $input_id . ']" value="' . $input_id . '"' . $checked . '/>';
                $label_open = '<label for="selected_' . $input_id . '">';
                $label_close = '</label>';
            }
            $userid = $acl_man->relativeId($info['userid']);
            $cont[] = $sel_cell_content;
            $cont[] = $label_open . ($search_filter != '' ? highlightText($userid, $search_filter) : $userid) . $label_close;
            $cont[] = $label_open . ($search_filter != '' ? highlightText($info['lastname'], $search_filter) : $info['lastname']) . $label_close;
            $cont[] = $label_open . ($search_filter != '' ? highlightText($info['firstname'], $search_filter) : $info['firstname']) . $label_close;
            $cont[] = $arr_status[$info['status']];
            $cont[] = $info['date_complete'];
            $cont[] = $info['on_date'];
            $url = 'index.php?modname=certificate&amp;certificate_id=' . $id_certificate . '&amp;course_id=' . $id_course . '&amp;user_id=' . $info['id_user'];
            $dl_url = $url . "&amp;op=send_certificate";
            if ($can_assign) {
                $downloadables[] = 'dl_single_' . $input_id;
            }
            $cont[] = $can_assign ? '<a id="dl_single_' . $input_id . '" class="ico-wt-sprite subs_pdf" href="javascript:;" title="' . $lang->def('_GENERATE') . '"><span>' . $lang->def('_GENERATE') . '</span></a>' : '<a id="dl_single_' . $input_id . '" class="ico-wt-sprite subs_pdf" href="' . $dl_url . '" title="' . $lang->def('_DOWNLOAD') . '"><span>' . $lang->def('_DOWNLOAD') . '</span></a>';
            $cont[] = $can_assign ? '' : Get::sprite_link('subs_del', $url . '&amp;op=del_report_certificate', Lang::t('_DEL', 'certificate'));
            $tb->addBody($cont);
        }
        require_once _base_ . '/lib/lib.dialog.php';
        setupHrefDialogBox('a[href*=del_report_certificate]');
        //search filter ...
        $release_options = array($lang->def('_ALL') => 0, $lang->def('_RELEASED') => 1, $lang->def('_TO_RELEASE') => 2);
        //search and store all non-available certificates
        $all_selection = array();
        $query = "SELECT cu.idUser as id_user " . " FROM ( " . $tu . " JOIN " . $tcu . " ON (u.idst = cu.idUser) ) LEFT JOIN " . $tca . " " . " ON ( ca.id_course = cu.idCourse AND ca.id_user=cu.idUser ) " . " WHERE (ca.id_certificate='" . (int) $id_certificate . "' OR ca.id_certificate IS NULL) AND " . $aval_status . " " . " AND cu.idCourse='" . (int) $id_course . "' " . ($search_filter != '' ? " AND (u.userid LIKE '%" . $search_filter . "%' OR u.lastname LIKE '%" . $search_filter . "%' OR u.firstname LIKE '%" . $search_filter . "%') " : "") . " AND ca.on_date IS NULL ";
        $res = sql_query($query);
        while (list($id_user) = sql_fetch_row($res)) {
            $all_selection[] = $id_user;
        }
        //---
        $form = new Form();
        $submit_url = "index.php?modname=certificate&amp;op=view_report_certificate&amp;id_certificate=" . (int) $id_certificate . "&amp;id_course=" . (int) $id_course;
        $out->add($form->openForm("certificates_emission", $submit_url) . $form->getHidden('old_selection', 'old_selection', implode(',', $total_selection)) . $form->getHidden('all_selection', 'all_selection', implode(',', $all_selection)) . $form->getHidden('active_text_filter', 'active_text_filter', $search_filter) . $form->getHidden('active_only_released', 'active_only_released', $only_released) . $form->getHidden('active_ini', 'active_ini', $ini_param) . '<div class="quick_search_form">' . '<div class="simple_search_box">' . Form::getInputTextfield("search_t", "filter", "filter", $search_filter, '', 255, '') . Form::getButton("search_button", "search_button", Lang::t('_SEARCH', 'standard'), "search_b") . Form::getButton("reset_button", "reset_button", Lang::t('_RESET', 'standard'), "reset_b") . '</div>' . '<a id="advanced_search" class="advanced_search" href="javascript:;">' . Lang::t("_ADVANCED_SEARCH", 'standard') . '</a>' . '<div id="certificate_release_as" class="advanced_search_options" style="display: ' . ($only_released != 0 ? 'block' : 'none') . '">' . Form::getRadioHoriz(Lang::t('_FILTER', 'certificate'), 'only_released', 'only_released', $release_options, $only_released) . '</div>' . '</div>' . '<script type="text/javascript">' . 'YAHOO.util.Event.addListener("advanced_search", "click", function(e){
				var el = YAHOO.util.Dom.get("certificate_release_as");
				if (el.style.display != \'block\') el.style.display = \'block\';
				else el.style.display = \'none\';
			});' . '</script>', 'content');
        $delgen_url = 'index.php?modname=certificate&amp;op=del_gen_certificate' . '&amp;id_certificate=' . (int) $id_certificate . '&amp;id_course=' . (int) $id_course;
        $delgen_txt = Lang::t('_DELETE_ALL_GENERATED', 'certificate');
        $print_button_1 = '<div>' . '<a id="print_selected_button_1" href="javascript:;">' . Get::img('course/certificate.png', Lang::t('_GENERATE_ALL_SELECTED', 'certificate')) . Lang::t('_GENERATE_ALL_SELECTED', 'certificate') . '</a>' . '</div>';
        $print_button_2 = '<div><a id="print_selected_button_2" href="javascript:;">' . Get::img('course/certificate.png', Lang::t('_GENERATE_ALL_SELECTED', 'certificate')) . Lang::t('_GENERATE_ALL_SELECTED', 'certificate') . '</a>' . '</div>';
        $print_button_1 .= Lang::t('_SELECT', 'directory') . ': ';
        $print_button_2 .= Lang::t('_SELECT', 'directory') . ': ';
        /*	
        		$print_button_1 .= '&nbsp;&nbsp;&nbsp;<a href="javascript:;" id="select_page_1">'.Lang::t('_SELECT_PAGE', 'standard').'</a>';
        		$print_button_2 .= '&nbsp;&nbsp;&nbsp;<a href="javascript:;" id="select_page_2">'.Lang::t('_SELECT_PAGE', 'standard').'</a>';
        		$print_button_1 .= '&nbsp;&nbsp;&nbsp;<a href="javascript:;" id="unselect_page_1">'.Lang::t('_UNSELECT_PAGE', 'standard').'</a>';
        		$print_button_2 .= '&nbsp;&nbsp;&nbsp;<a href="javascript:;" id="unselect_page_2">'.Lang::t('_UNSELECT_PAGE', 'standard').'</a>';
        */
        $print_button_1 .= '&nbsp;&nbsp;&nbsp;<a href="javascript:;" id="select_all_1">' . Lang::t('_ALL_PAGES', 'directory') . '</a>';
        $print_button_2 .= '&nbsp;&nbsp;&nbsp;<a href="javascript:;" id="select_all_2">' . Lang::t('_ALL_PAGES', 'directory') . '</a>';
        $print_button_1 .= '&nbsp;&nbsp;&nbsp;<a href="javascript:;" id="unselect_all_1">' . Lang::t('_NONE', 'directory') . '</a>';
        $print_button_2 .= '&nbsp;&nbsp;&nbsp;<a href="javascript:;" id="unselect_all_2">' . Lang::t('_NONE', 'directory') . '</a>';
        $navbar = $tb->getNavBar($ini, $totalrows);
        $out->add($print_button_1 . '<br />' . $navbar . $tb->getTable() . $navbar . '<br />' . $print_button_2);
        $out->add($form->closeForm());
    } else {
        $out->add($lang->def('_NO_CONTENT'));
    }
    $out->add($back_ui . '</div>');
    addCss('style_menu', 'lms');
    Util::get_js(Get::rel_path('base') . '/widget/dialog/dialog.js', true, true);
    Util::get_js(Get::rel_path('lms') . '/admin/modules/certificate/certificate.js?rnd=' . time(), true, true);
    //addJs($GLOBALS['where_lms_relative'].'/admin/modules/certificate/', 'certificate.js');
    $script = 'var ajax_url="ajax.adm_server.php?plf=lms&mn=certificate"; var _STOP="' . $lang->def('_STOP') . '"; ' . 'var glob_id_certificate = ' . (int) $id_certificate . ', glob_id_course = ' . (int) $id_course . ';' . 'var single_list = [' . (count($downloadables) ? '"' . implode('","', $downloadables) . '"' : '') . ']; ' . 'var reload_url = "' . str_replace('&amp;', '&', isset($submit_url) ? $submit_url : '') . '", ' . '_ERROR_PARSE = "' . $lang->def('_OPERATION_FAILURE') . '", _SUCCESS = "' . $lang->def('_OPERATION_SUCCESSFUL') . '", ' . '_AREYOUSURE="' . Lang::t('_AREYOUSURE', 'standard') . '";';
    $out->add('<script type="text/javascript">' . $script . '</script>', 'page_head');
}
Ejemplo n.º 11
0
 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>' . '&nbsp;&nbsp;&nbsp;&nbsp;' . '</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);
     }
 }
Ejemplo n.º 12
0
    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&amp;op=del_registration&amp;id_user='******'&amp;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&amp;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&amp;op=excel&amp;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&amp;op=view_registration', $lang->def('_BACK')), 'content');
        $out->add('</div>', 'content');
    }
Ejemplo n.º 13
0
 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[] = "&nbsp;";
     //$img;
     $img = "<img src=\"" . getPathImage('fw') . "standard/edit.png\" alt=\"" . $this->lang->def("_MOD") . "\" ";
     $img .= "title=\"" . $this->lang->def("_MOD") . "\" />";
     $head[] = "&nbsp;";
     //$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;
 }
Ejemplo n.º 14
0
 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');
     }
 }
Ejemplo n.º 15
0
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&amp;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&amp;op=code_list&amp;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&amp;op=code_list&amp;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&amp;op=mod_code&amp;id_code_group=' . $id_code_group . '&amp;code=' . $code_info['code'] . '">' . '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . '" />';
            }
            $cont[] = '<a href="index.php?modname=code&amp;op=del_code&amp;id_code_group=' . $id_code_group . '&amp;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&amp;op=add_code&amp;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&amp;op=export&amp;id_code_group=' . $id_code_group . '&amp;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&amp;op=export&amp;id_code_group=' . $id_code_group . '&amp;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&amp;op=add_code&amp;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&amp;op=list', $lang->def('_BACK')) . '</div>');
}
Ejemplo n.º 16
0
 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');
     }
 }
Ejemplo n.º 17
0
/**
 * 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&amp;op=statcourse', $lang->def('_BACK')));
    $out->add($form->openForm('orgshow', 'index.php?modname=stats&amp;op=statitem&amp;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&amp;op=statoneuseroneitem&amp;idUser='******'&amp;idItem=' . $idItem . '" >' . $aclManager->relativeId($user_info[ACL_INFO_USERID]) . '</a>', $user_info[ACL_INFO_LASTNAME] . '&nbsp;' . $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");
}
Ejemplo n.º 18
0
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&amp;op=view&amp;ini=');
    $ini = $table->getSelectedElement();
    $GLOBALS['page']->add(getTitleArea($lang->def('_ADMIN_MANAGMENT'), 'admin_managmer', $lang->def('_ADMIN_MANAGMENT')) . '<div class="std_block">', 'content');
    $contentH = array($lang->def('_USERNAME'), $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&amp;op=edit_preferences&amp;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&amp;op=edit_menu&amp;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&amp;op=assign_tree&amp;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&amp;op=edit_lang&amp;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&amp;op=edit_course&amp;adminidst=' . $arr_admin_idst[$index] . '&amp;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&amp;op=assign_cmspag&amp;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&amp;op=assign_cmsnews&amp;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&amp;op=assign_cmsdocs&amp;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&amp;op=assign_cmsmedia&amp;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&amp;op=assign_cmscontent&amp;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');
}
Ejemplo n.º 19
0
 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[] = '&nbsp;';
         }
         $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');
     }
 }