コード例 #1
0
ファイル: notes.php プロジェクト: abhinay100/forma_app
    function notes()
    {
        checkPerm('view');
        require_once _base_ . '/lib/lib.table.php';
        $lang =& DoceboLanguage::createInstance('notes', 'lms');
        $nav_bar = new NavBar('ini', Get::sett('visuItem'), 0);
        $ini = $nav_bar->getSelectedElement();
        $ord = importVar('ord');
        $inv = importVar('inv');
        switch ($ord) {
            case "tit":
                $ord = $order = 'title';
                if ($inv != 'y') {
                    $a_down = '&inv=y';
                } else {
                    $order .= ' DESC';
                    $a_down = '';
                }
                break;
            default:
                $ord = $order = 'data';
                if ($inv == 'y') {
                    $a_down = '';
                } else {
                    $order .= ' DESC';
                    $a_down = '&inv=y';
                }
        }
        $reNotes = sql_query("\r\n\tSELECT idNotes, data, title \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_notes \r\n\tWHERE owner ='" . getLogUserId() . "' AND idCourse='" . $_SESSION['idCourse'] . "' \r\n\tORDER BY {$order} \r\n\tLIMIT {$ini}," . Get::sett('visuItem'));
        list($num_notes) = sql_fetch_row(sql_query("SELECT COUNT(*) \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_notes \r\n\tWHERE owner ='" . getLogUserId() . "' AND idCourse='" . $_SESSION['idCourse'] . "' "));
        $nav_bar->setElementTotal($num_notes);
        $img_up = '<img class="valing-middle" src="' . getPathImage() . 'standard/up_arrow.png" alt="' . $lang->def('_UP') . '"/>';
        $img_down = '<img class="valing-middle" src="' . getPathImage() . 'standard/down_arrow.png" alt="' . $lang->def('_DOWN') . '"/>';
        $tb = new Table(Get::sett('visuItem'), $lang->def('_NOTES'), $lang->def('_NOTES'));
        $contentH = array(($ord == 'data' ? $inv == 'y' ? $img_up : $img_down : '') . '<a href="index.php?modname=notes&amp;op=notes' . $a_down . '"> ' . $lang->def('_DATE') . '</a>', ($ord == 'title' ? $inv == 'y' ? $img_up : $img_down : '') . '<a href="index.php?modname=notes&amp;op=notes&amp;ord=tit' . $a_down . '">' . $lang->def('_TITLE') . '</a>', '<img src="' . getPathImage() . 'standard/edit.png" title="' . $lang->def('_MOD') . '" alt="' . $lang->def('_MOD') . '" />', '<img src="' . getPathImage() . 'standard/delete.png" title="' . $lang->def('_DEL') . '" alt="' . $lang->def('_DEL') . '" />');
        $typeH = array('min-cell', '', 'image', 'image');
        $tb->setColsStyle($typeH);
        $tb->addHead($contentH);
        while (list($idNotes, $data, $title) = sql_fetch_row($reNotes)) {
            $content = array(Format::date($data), '<a href="index.php?modname=notes&amp;op=displaynotes&amp;idNotes=' . $idNotes . '" title="' . $lang->def('_MORET') . '">' . $title . '</a>', '<a href="index.php?modname=notes&amp;op=modnotes&amp;idNotes=' . $idNotes . '">
				<img src="' . getPathImage() . 'standard/edit.png" title="' . $lang->def('_MOD') . '" alt="' . $lang->def('_MOD') . '" /></a>', '<a id="delnotes_' . $idNotes . '"' . ' href="index.php?modname=notes&amp;op=delnotes&amp;idNotes=' . $idNotes . '"' . ' title="' . $lang->def('_TITLE') . ' : ' . strip_tags(str_replace(array('"', "'"), '', $title)) . '">
				<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . '" /></a>');
            $tb->addBody($content);
        }
        $tb->addActionAdd('<a href="index.php?modname=notes&amp;op=addnotes">' . '<img src="' . getPathImage() . 'standard/add.png" title="' . $lang->def('_ADD') . '" alt="' . $lang->def('_ADD') . '" /> ' . $lang->def('_ADD_NOTES') . '</a>');
        $GLOBALS['page']->add(getTitleArea(array($lang->def('_NOTES')), 'notes') . '<div class="std_block">', 'content');
        if (isset($_POST['result'])) {
            switch ($_POST['result']) {
                case "ok":
                    $GLOBALS['page']->add(getResultUi($lang->def('_OPERATION_SUCCESSFUL')), 'content');
                case "err":
                    $GLOBALS['page']->add(getErrorUi($lang->def('_OPERATION_FAILURE')), 'content');
            }
        }
        $GLOBALS['page']->add($tb->getTable() . $nav_bar->getNavBar($ini), 'content');
        require_once _base_ . '/lib/lib.dialog.php';
        setupHrefDialogBox('a[href*=delnotes]');
        $GLOBALS['page']->add('</div>', 'content');
    }
コード例 #2
0
function reportList()
{
    checkPerm('view');
    require_once _base_ . '/lib/lib.table.php';
    $lang =& DoceboLanguage::createInstance('report', 'framework');
    $_SESSION['report_tempdata'] = array();
    $can_mod = checkPerm('mod', true);
    $acl_man = Docebo::aclm();
    $public_admin_mod = true;
    $query = "SELECT t1.*, t2.userid \r\n\tFROM %lms_report_filter as t1 \r\n\t\tLEFT JOIN %adm_user as t2 ON t1.author=t2.idst\r\n\tWHERE t1.is_public = 1 OR t1.author = " . Docebo::user()->getId();
    $tb = new Table();
    $tb->initNavBar('ini', 'button');
    $col_type = array('', 'align_center', 'align_center', 'image');
    $col_content = array($lang->def('_NAME'), $lang->def('_TAB_REP_CREATOR', 'report', 'framework'), $lang->def('_CREATION_DATE'), '<img src="' . getPathImage() . 'standard/view.png" alt="' . $lang->def('REPORT_SHOW_RESULTS') . '" title="' . $lang->def('REPORT_SHOW_RESULTS') . '" />');
    if ($public_admin_mod && $can_mod) {
        $col_type[] = 'image';
        $col_content[] = '<img src="' . getPathImage() . 'standard/edit.png"  alt="' . $lang->def('_MOD') . '" title="' . $lang->def('_MOD') . '"/>';
        $col_type[] = 'image';
        $col_content[] = '<img src="' . getPathImage() . 'standard/delete.png"  alt="' . $lang->def('_DEL') . '" title="' . $lang->def('_DEL') . '"/>';
    }
    $tb->setColsStyle($col_type);
    $tb->addHead($col_content);
    $res = sql_query($query);
    if ($res) {
        while ($row = sql_fetch_assoc($res)) {
            $id = $row['id_filter'];
            $opn_link = '<a href="index.php?modname=public_report_admin&amp;op=view_report&amp;idrep=' . $id . '" ' . ' title="' . $lang->def('REPORT_SHOW_RESULTS', 'report', 'framework') . '">' . '<img src="' . getPathImage() . 'standard/view.png" alt="' . $lang->def('REPORT_SHOW_RESULTS', 'report', 'framework') . '" />' . '</a>';
            $tb_content = array($row['author'] == 0 ? $lang->def($row['filter_name']) : $row['filter_name'], $row['author'] == 0 ? '<div class="align_center">-</div>' : $acl_man->relativeId($row['userid']), Format::date($row['creation_date']), $opn_link);
            if ($public_admin_mod && $can_mod) {
                if ($row['author'] == Docebo::user()->getId()) {
                    $tb_content[] = '<a href="index.php?modname=public_report_admin&amp;op=modify_name&amp;modid=' . $id . '" ' . ' title="' . $lang->def('_MOD', 'report', 'framework') . '">' . '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD', 'report', 'framework') . '" />' . '</a>';
                } else {
                    $tb_content[] = '';
                }
                if ($row['author'] == Docebo::user()->getId()) {
                    $tb_content[] = '<a href="index.php?modname=public_report_admin&amp;op=del_public_report&amp;idrep=' . $id . '" ' . ' title="' . $lang->def('_DEL', 'report', 'framework') . '">' . '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL', 'report', 'framework') . '" />' . '</a>';
                } else {
                    $tb_content[] = '';
                }
            }
            $tb->addBody($tb_content);
        }
    }
    require_once _base_ . '/lib/lib.dialog.php';
    setupHrefDialogBox('a[href*=del_public_report]');
    if ($public_admin_mod && $can_mod) {
        $tb->addActionAdd('<a href="index.php?modname=public_report_admin&amp;op=create_name">' . '<img src="' . getPathImage() . 'standard/add.png" title="' . $lang->def('_NEW') . '" /> ' . $lang->def('_NEW') . '</a>');
    }
    cout(getTitleArea($lang->def('_REPORT')) . '<div class="std_block">' . $tb->getTable() . '</div>', 'content');
}
コード例 #3
0
ファイル: classevent.php プロジェクト: abhinay100/forma_app
function classEventMain()
{
    $res = "";
    $out =& $GLOBALS["page"];
    $out->setWorkingZone("content");
    $lang =& DoceboLanguage::createInstance("classevent", "lms");
    $back_ui_url = "index.php?modname=classevent&amp;op=main";
    $title_arr = array();
    $title_arr[$back_ui_url] = $lang->def("_CLASS_EVENT");
    $res .= getTitleArea($title_arr, "classevent");
    $res .= "<div class=\"std_block\">\n";
    require_once $GLOBALS["where_framework"] . "/lib/resources/lib.timetable.php";
    $tt = new TimeTable();
    $permissions = 2;
    $size = isset($_GET["size"]) ? $_GET["size"] : "max";
    addCss('windows');
    addCss('calendar_' . $size, "lms");
    //addAjaxJs();
    //addScriptaculousJs();
    YuiLib::load(array('my_window' => 'windows.js'));
    $GLOBALS['page']->add("\n" . '<script type="text/javascript" src="' . $GLOBALS['where_lms_relative'] . '/modules/calendar/calendar.js"></script>' . "\n", 'page_head');
    $GLOBALS['page']->add("\n" . '<script type="text/javascript" src="' . $GLOBALS['where_lms_relative'] . '/modules/calendar/calendar_helper.js"></script>' . "\n", 'page_head');
    require_once $GLOBALS["where_lms"] . "/lib/lib.classroom.php";
    $cm = new ClassroomManager();
    $class_arr = $cm->getClassroomArray();
    $GLOBALS['page']->add('<script type="text/javascript">' . ' setup_url(\'' . $GLOBALS['where_lms_relative'] . '/ajax.server.php?mn=calendar&\',\'lms_classroom\',\'lms_classroom\'); ' . ' setup_mode("edit",' . $permissions . ',"' . Docebo::user()->getUserId() . '"); ' . '</script>', 'page_head');
    $width = "90%";
    if ($size == "min") {
        $width = "200px";
    }
    $res .= "\n";
    $res .= "<div class=\"std_block\" style=\"margin:auto;width:" . $width . ";\">\n";
    $res .= "<p>" . $lang->def("_SELECT_CLASSROOM") . ": <select name=\"classroom_selected\" id=\"classroom_selected\"  onChange=\"updateCalendar(cal.date);\"><option value=\"\">(" . $lang->def("_SELECT_ALL") . ")</option>";
    while (list($key, $value) = each($class_arr)) {
        $res .= "<option value=\"" . htmlentities($key) . "\">" . htmlentities($value) . "</option>";
    }
    $res .= "</select></p>";
    $res .= "</div>\n";
    $res .= "\n" . '<div id="displayCalendar" style="margin: auto; clear: both; width:' . $width . '"></div>';
    $res .= "</div>\n";
    $out->add($res);
    require_once _base_ . '/lib/lib.dialog.php';
    setupHrefDialogBox('a[href*=del]');
}
コード例 #4
0
ファイル: infocourse.php プロジェクト: abhinay100/forma_app
 function loadMaterials($idCourse)
 {
     $mod_perm = checkPerm('mod', true);
     require_once _base_ . '/lib/lib.table.php';
     $lang =& DoceboLanguage::createInstance('course');
     $re_file = sql_query("\r\n\tSELECT id_file, title, path \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_course_file \r\n\tWHERE id_course='" . $idCourse . "'");
     if (!mysql_num_rows($re_file) && !$mod_perm) {
         return '';
     }
     $tb = new Table(0, $lang->def('_MATERIALS'), $lang->def('_MATERIALS_TABLE'));
     $cont_h = array($lang->def('_TITLE'));
     $type_h = array('');
     if ($mod_perm) {
         $cont_h[] = '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . '" />';
         $type_h[] = 'image';
         $cont_h[] = '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . '" />';
         $type_h[] = 'image';
     }
     //$tb->setTableStyle('');
     $tb->setColsStyle($type_h);
     $tb->addHead($cont_h);
     $html = '<div class="floating_box">';
     if (mysql_num_rows($re_file)) {
         while (list($idFile, $title, $file) = sql_fetch_row($re_file)) {
             $cont = array('<a href="index.php?modname=course&amp;op=downloadcourse&amp;id=' . $idFile . '">' . '<img src="' . getPathImage('fw') . mimeDetect($file) . '" alt="mime-type" />&nbsp;' . $title . '</a>');
             if ($mod_perm) {
                 $cont[] = '<a href="index.php?modname=course&amp;op=modfiles&amp;id_file=' . $idFile . '" title="' . $lang->def('_MOD') . ' : ' . $title . '">' . '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . ' : ' . $title . '" /></a>';
                 $cont[] = '<a href="index.php?modname=course&amp;op=remfiles&amp;id_file=' . $idFile . '" title="' . $lang->def('_DEL') . ' : ' . $title . '">' . '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . ' : ' . $title . '" /></a>';
             }
             $tb->addBody($cont);
         }
         $html .= $tb->getTable();
         require_once _base_ . '/lib/lib.dialog.php';
         setupHrefDialogBox('a[href*=remfiles]');
     }
     if ($mod_perm) {
         $html .= '<br/>' . '<a class="ico-wt-sprite subs_add" href="index.php?modname=course&amp;op=addfiles">' . '<span>' . $lang->def('_ADDFILE') . '</span></a>';
     }
     $html .= '</div>';
     return $html;
 }
コード例 #5
0
ファイル: lib.wiki.php プロジェクト: abhinay100/forma_app
 function getCourseWikiTable($can_mod = FALSE, $wiki_list = FALSE)
 {
     $um =& UrlManager::getInstance();
     // $course_id =$this->getCourseId();
     $res = "";
     if ($wiki_list === FALSE || !is_array($wiki_list)) {
         $wiki_list = $this->getCourseWikiList();
     }
     $where = "wiki_id IN (" . implode(",", $wiki_list["list"]) . ")";
     $source_platform = $this->getSourcePlatform();
     $data_info = $this->wikiManager->getWikiList(FALSE, FALSE, $where, $source_platform);
     $data_arr = $data_info["data_arr"];
     $db_tot = $data_info["data_tot"];
     $tot = count($data_arr);
     for ($i = 0; $i < $tot; $i++) {
         $id = $data_arr[$i]["wiki_id"];
         $rowcnt = array();
         $rowcnt[] = $data_arr[$i]["title"];
         $url = $um->getUrl("op=show&wiki_id=" . $id);
         $res .= '<div class="list_block">';
         $res .= '<h2 class="heading"><a href="' . $url . '">' . $data_arr[$i]["title"] . '</a></h2>' . "\n";
         $res .= '<p class="content">' . $data_arr[$i]["description"] . '</p>' . "\n";
         if ($can_mod) {
             $res .= '<div class="actions">' . '<ul class="link_list_inline">' . "\n";
             $url = $um->getUrl("op=editwiki&wiki_id=" . $id);
             $res .= '<li><a class="ico-wt-sprite subs_mod" href="' . $url . '">';
             $res .= '<span>' . $this->lang->def("_MOD") . '</span></a></li>';
             $url = $um->getUrl("op=setperm&wiki_id=" . $id);
             if ($data_arr[$i]["public"] == 1 && Get::cur_plat() != 'lms') {
                 $res .= '<li><a class="ico-wt-sprite subs_users" href="' . $url . '">';
                 $res .= '<span>' . $this->lang->def("_ALT_SETPERM") . '</span></a></li>';
             }
             if ($wiki_list["data"][$id]["is_owner"] == 1) {
                 $url = $um->getUrl("op=delwiki&wiki_id=" . $id);
                 $res .= '<li><a class="ico-wt-sprite subs_del" href="' . $url . '" title="' . $this->lang->def("_DEL") . ' : ' . strip_tags($data_arr[$i]["title"]) . '">';
                 $res .= '<span>' . $this->lang->def("_DEL") . '</span></a></li>';
             }
             $res .= "</ul></div>";
         }
         $res .= "</div>\n";
         // wiki_box
     }
     if ($can_mod) {
         $res .= '<div class="table-container-below">';
         $res .= '<ul class="link_list_inline">' . "\n";
         $url = $um->getUrl("op=addwiki");
         $res .= '<li><a class="ico-wt-sprite subs_add" href="' . $url . '">';
         $res .= '<span>' . $this->lang->def("_ADD_WIKI") . '</span></a></li>';
         $url = $um->getUrl("op=selectwiki");
         $res .= '<li><a class="ico-wt-sprite subs_import" href="' . $url . '">';
         $res .= '<span>' . $this->lang->def("_SELECT_WIKI") . '</span></a></li>';
         $res .= "</ul>\n";
         $res .= "</div>\n";
         // table-container-below
         require_once _base_ . '/lib/lib.dialog.php';
         setupHrefDialogBox('a[href*=delwiki]');
     }
     return $res;
 }
コード例 #6
0
ファイル: test.php プロジェクト: abhinay100/forma_app
function feedbackman()
{
    checkPerm('view', false, 'storage');
    $res = '';
    require_once _lms_ . '/lib/lib.questcategory.php';
    require_once _lms_ . '/lib/lib.assessment_rule.php';
    $id_test = Get::gReq('idTest', DOTY_INT, 0);
    $back_url = urldecode(Get::gReq('back_url', DOTY_STRING));
    $url_encode = htmlentities(urlencode($back_url));
    $back_link_url = 'index.php?modname=test&amp;op=modtestgui&amp;idTest=' . $id_test . '&amp;back_url=' . $url_encode;
    $url_base = 'index.php?modname=test&idTest=' . $id_test . '&back_url=' . $url_encode . '&op=';
    $categories = Questcategory::getTestQuestionsCategories($id_test);
    unset($categories[0]);
    $categories[0] = Lang::t('_TEST_TOTAL_SCORE', 'test');
    $res .= getTitleArea(array($back_link_url => Lang::t('_TEST_SECTION', 'test'), Lang::t('_FEEDBACK_MANAGEMENT', 'test')), 'test') . '<div class="std_block">' . getBackUi($back_link_url, Lang::t('_BACK'));
    if (empty($categories)) {
        $res .= Lang::t('_NO_CATEGORIES_AVAILABLE');
    } else {
        $asrule = new AssessmentRuleManager($id_test);
        $data = $asrule->getRules();
        $first = TRUE;
        foreach ($categories as $cat_id => $category) {
            if ($first) {
                $first = FALSE;
            } else {
                $res .= '<br /><br />';
            }
            $res .= '<p>' . ($cat_id > 0 ? Lang::t('_TEST_QUEST_CATEGORY', 'test') . ': ' : '') . '<b>' . $category . '</b></p>';
            if (isset($data[$cat_id])) {
                $tb = new Table(0, false);
                $tb->addHead(array(Lang::t('_SCORE', 'test'), Lang::t('_FEEDBACK_TEXT', 'test'), Get::sprite('subs_mod', Lang::t('_MOD', 'standard'), Lang::t('_MOD', 'standard')), Get::sprite('subs_del', Lang::t('_DEL', 'standard'), Lang::t('_DEL', 'standard'))), array('', '', 'image', 'image'));
                foreach ($data[$cat_id] as $row) {
                    $row_ln = array();
                    $row_ln[] = $row['from_score'] . ' - ' . $row['to_score'];
                    $row_ln[] = $row['feedback_txt'];
                    $row_ln[] = '<a class="ico-sprite subs_mod" href="' . $url_base . 'editfbkrule&item_id=' . $row['rule_id'] . '"><span></span></a>';
                    $row_ln[] = '<a id="del_rule_' . $row['rule_id'] . '" class="ico-sprite subs_del" href="' . $url_base . 'delfbkrule&item_id=' . $row['rule_id'] . '"><span></span></a>';
                    $tb->addBody($row_ln);
                }
                //$tb->addActionAdd('<a href="'.$url_base.'addfbkrule&cat_id='.$cat_id.'" class="ico-wt-sprite subs_add"><span>'.Lang::t('_ADD', 'test').'</span></a>');
                $res .= $tb->getTable();
            }
            $res .= '<div class="table-container-below">' . '<a href="' . $url_base . 'addfbkrule&cat_id=' . $cat_id . '" class="ico-wt-sprite subs_add"><span>' . Lang::t('_ADD', 'test') . '</span></a>' . '</div>';
        }
    }
    $res .= getBackUi($back_link_url, Lang::t('_BACK')) . '</div>';
    require_once _base_ . '/lib/lib.dialog.php';
    setupHrefDialogBox('a[id^=del_rule_]');
    $GLOBALS['page']->add($res, 'content');
}
コード例 #7
0
function modrule(&$url)
{
    checkPerm('mod');
    YuiLib::load(array('animation' => 'animation-min.js', 'dragdrop' => 'dragdrop-min.js', 'button' => 'button-min.js', 'container' => 'container-min.js', 'my_window' => 'windows.js'), array('container/assets/skins/sam' => 'container.css', 'button/assets/skins/sam' => 'button.css'));
    addJs($GLOBALS['where_lms_relative'] . '/admin/modules/preassessment/', 'ajax.preassessment.js');
    $id_assessment = importVar('id_assess', true, 0);
    require_once $GLOBALS['where_lms'] . '/lib/lib.course.php';
    $course_man = new Man_Course();
    require_once $GLOBALS['where_lms'] . '/lib/lib.coursepath.php';
    $coursepath_man = new CoursePath_Manager();
    require_once $GLOBALS['where_lms'] . '/lib/lib.preassessment.php';
    $assess_man = new AssessmentList();
    $rule_man = new AssessmentRule();
    $lang =& DoceboLanguage::createInstance('preassessment');
    // recover assessment
    $assessment = $assess_man->getAssessment($id_assessment);
    $rule_list = $rule_man->getAllRule($id_assessment);
    // recover new type one
    require_once _base_ . '/lib/lib.table.php';
    $tb = new Table(0, $lang->def('_CAPTION_PREASSESSMENT_RULE'), $lang->def('_SUMMARY_PREASSESSMENT_RULE'));
    // table header --------------------------------------------------------------------------------------------
    $cont_h = array($lang->def('_RULE_TEXT'), $lang->def('_RULE_ACTION'), '<img src="' . getPathImage('lms') . 'standard/modelem.png" alt="' . $lang->def('_ALT_ADD_EFFECT') . '" />', '<img src="' . getPathImage('lms') . 'standard/edit.png" alt="' . $lang->def('_MOD') . '" />', '<img src="' . getPathImage('lms') . 'standard/delete.png" alt="' . $lang->def('_DEL') . '" />');
    $type_h = array('nowrap', '', 'image', 'image', 'image');
    $usedef = 1;
    $tb->addHead($cont_h, $type_h);
    while ($rule = $rule_man->fetch_row($rule_list)) {
        $id = $rule[RULE_ID];
        if ($rule[RULE_TYPE] == RULE_DEFAULT) {
            $usedef = 0;
        }
        $rule_name = $rule_man->resolveRuleTypePhrase($lang, $rule);
        $cont = array($rule_name);
        $effect = '';
        $effects = $rule_man->parseEffects($rule[RULE_EFFECT]);
        if (count($effects['course']) > 0) {
            $effect .= $lang->def('_COURSES') . ': ' . $course_man->listCourseName($effects['course']);
        }
        if (count($effects['coursepath']) > 0) {
            if (count($effects['course']) > 0) {
                $effect .= '<br/>';
            }
            $path_list =& $coursepath_man->getNames($effects['coursepath']);
            $effect .= $lang->def('_COURSEPATH') . ': ' . implode(', ', $path_list);
        }
        if (count($effects['course']) == 0 && count($effects['coursepath']) == 0) {
            $effect = $lang->def('_DO_NOTHING');
        }
        $cont[] = $effect;
        $cont[] = '<a href="' . $url->getUrl('op=assignrule&id_rule=' . $id . '&load=1') . '" title=""' . $lang->def('_ADD_EFFECT') . '">' . '<img src="' . getPathImage('lms') . 'standard/modelem.png" alt="' . $lang->def('_ALT_ADD_EFFECT') . '" />' . '</a>';
        $cont[] = '<a href="' . $url->getUrl('op=modrulet&id_rule=' . $id) . '" title="' . $lang->def('_MOD_TITLE') . '"' . '" onclick="mod_rule_mask(\'' . $id_assessment . '\', \'' . $id . '\'); return false;"' . '>' . '<img src="' . getPathImage('lms') . 'standard/edit.png" alt="' . $lang->def('_MOD') . '" />' . '</a>';
        $cont[] = '<a href="' . $url->getUrl('op=delrule&id_rule=' . $id) . '" title="' . $lang->def('_DEL') . ': ' . $rule_name . '"' . '	onclick="del_assessment_rule(\'' . $id . '\', \'' . strip_tags($rule_name) . '\'); return false;"' . '>' . '<img src="' . getPathImage('lms') . 'standard/delete.png" alt="' . $lang->def('_DEL') . '" />' . '</a>';
        $tb->addBody($cont);
    }
    require_once _base_ . '/lib/lib.dialog.php';
    setupHrefDialogBox('a[href*=delrule]');
    $tb->addActionAdd('<a class="new_element_link" ' . ' 	onclick="add_rule_mask(\'' . $id_assessment . '\', \'' . $usedef . '\'); return false;"' . ' id="add_rule" ' . 'href="#" ' . '>' . $lang->def('_ADD_RULE') . '</a>');
    $GLOBALS['page']->add('<script type="text/javascript">' . 'YAHOO.util.Event.onDOMReady( function(e) {' . ' setup_assessment(); ' . ' YAHOO.util.Event.addListener("add_rule", "click", function(e) { add_rule_mask(\'' . $id_assessment . '\', \'' . $usedef . '\'); });' . '});' . '</script>', 'page_head');
    $GLOBALS['page']->add(getTitleArea(array($url->getUrl() => $lang->def('_ASSESSMENT'), $lang->def('_RULES') . ': ' . $assessment['name']), 'preassessment') . '<div class="std_block">' . getInfoUi($lang->def('_RULE_OVERLAPPED')), 'content');
    if (isset($_GET['result'])) {
        $GLOBALS['page']->add(guiResultStatus($lang, $_GET['result']), 'content');
    }
    $GLOBALS['page']->add($tb->getTable(), 'content');
    $GLOBALS['page']->add(getBackUi($url->getUrl(), $lang->def('_BACK')) . '</div>', 'content');
}
コード例 #8
0
ファイル: catalogue.php プロジェクト: abhinay100/forma_app
 function entrylist()
 {
     checkPerm('view');
     require_once _base_ . '/lib/lib.table.php';
     require_once _base_ . '/lib/lib.form.php';
     require_once $GLOBALS['where_lms'] . '/lib/lib.coursepath.php';
     require_once $GLOBALS['where_lms'] . '/lib/lib.course.php';
     $lang =& DoceboLanguage::createInstance('catalogue', 'lms');
     $out =& $GLOBALS['page'];
     $id_cat = Get::req('id', DOTY_INT, 0);
     $cat_name = getCatalogueName($id_cat);
     $mod_perm = checkPerm('mod', true);
     $title_area = array('index.php?modname=catalogue&amp;op=catlist' => $lang->def('_CATALOGUE'), $cat_name);
     $tb_entry = new Table();
     $query_entry = "\r\n\tSELECT idEntry, type_of_entry\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_catalogue_entry\r\n\tWHERE idCatalogue = '" . $id_cat . "'";
     $re_entry = sql_query($query_entry);
     $courses = array();
     $coursepath = array();
     while (list($id, $t_o_entry) = sql_fetch_row($re_entry)) {
         if ($t_o_entry == 'course') {
             $courses[$id] = $id;
         } else {
             $coursepath[$id] = $id;
         }
     }
     $coursepath_man = new CoursePath_Manager();
     $coursespath_name =& $coursepath_man->getNames($coursepath);
     $course_name =& getCoursesInfo($courses);
     $cont_h = array($lang->def('_CODE'), $lang->def('_NAME'), $lang->def('_TYPE'));
     $type_h = array('', '', '');
     if ($mod_perm) {
         $type_h[] = 'image';
         $cont_h[] = '<img src="' . getPathImage('fw') . 'standard/delete.png" alt="' . $lang->def('_DEL') . '" />';
     }
     $tb_entry->setColsStyle($type_h);
     $tb_entry->addHead($cont_h);
     $all_courses = true;
     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;
         } 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 Catalogue_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 (is_array($course_name)) {
         foreach ($course_name as $course) {
             $cont = array($course['code'], $course['name'], $lang->def('_COURSE'));
             if ($mod_perm) {
                 if (isset($admin_courses['course'][$course['id']]) || $all_courses) {
                     $cont[] = '<a href="index.php?modname=catalogue&amp;op=delentry&amp;id_cat=' . $id_cat . '&amp;type=course&amp;id_entry=' . $course['id'] . '" ' . 'title="' . $lang->def('_REMOVE_ENTRY') . ' : ' . strip_tags($course['name']) . '">' . '<img src="' . getPathImage('fw') . 'standard/delete.png" ' . 'alt="' . $lang->def('_DEL') . ' : ' . strip_tags($course['name']) . '" /></a>';
                 } else {
                     $cont[] = '';
                 }
             }
             $tb_entry->addBody($cont);
         }
     }
     if (is_array($coursespath_name)) {
         while (list($id, $coursepath) = each($coursespath_name)) {
             $cont = array($coursepath, $lang->def('_COURSEPATH'));
             // #bugfix 1141
             $tmp_code = $coursepath_man->getCoursepathInfo($id);
             $path_code = $tmp_code['path_code'];
             array_unshift($cont, $path_code);
             // end bugfix
             if ($mod_perm) {
                 if (isset($admin_courses['coursepath'][$id]) || $all_courses) {
                     $cont[] = '<a href="index.php?modname=catalogue&amp;op=delentry&amp;id_cat=' . $id_cat . '&amp;type=coursepath&amp;id_entry=' . $id . '" ' . 'title="' . $lang->def('_REMOVE_ENTRY') . ' : ' . strip_tags($coursepath) . '">' . '<img src="' . getPathImage('fw') . 'standard/delete.png" ' . 'alt="' . $lang->def('_DEL') . ' : ' . strip_tags($coursepath) . '" /></a>';
                 } else {
                     $cont[] = '';
                 }
             }
             $tb_entry->addBody($cont);
         }
     }
     $select_entry = array('course' => $lang->def('_COURSE'), 'coursepath' => $lang->def('_COURSEPATH'));
     if ($mod_perm) {
         $tb_entry->addActionAdd('<a href="index.php?modname=catalogue&amp;op=import&amp;id_cat=' . $id_cat . '&amp;load=1" class="ico-wt-sprite subs_import" ' . ' title="' . Lang::t('_IMPORT', 'catalogue') . '"><span>' . Lang::t('_IMPORT', 'catalogue') . '</span></a>');
     }
     switch (Get::req('result', DOTY_ALPHANUM, '')) {
         case "ok":
             UIFeedback::info(Lang::t('_OPERATION_SUCCESSFUL', 'standard'));
             break;
         case "err":
             UIFeedback::error(Lang::t('_OPERATION_ERROR', 'standard'));
             break;
     }
     $out->add(getTitleArea($title_area, 'catalogue') . '<div class="std_block">' . getBackUi('index.php?modname=catalogue&amp;op=catlist', $lang->def('_BACK')) . $tb_entry->getTable() . getBackUi('index.php?modname=catalogue&amp;op=catlist', $lang->def('_BACK')) . '</div>', 'content');
     if ($mod_perm) {
         require_once _base_ . '/lib/lib.dialog.php';
         setupHrefDialogBox('a[href*=delentry]');
     }
 }
コード例 #9
0
ファイル: groups.php プロジェクト: abhinay100/forma_app
function groups()
{
    checkPerm('view');
    require_once _base_ . '/lib/lib.table.php';
    $lang =& DoceboLanguage::createInstance('groups', 'lms');
    $acl_man =& Docebo::user()->getAclManager();
    $mod_perm = checkPerm('mod', true);
    $subs_perm = checkPerm('subscribe', true);
    // Retrive groups
    $acl_man->setContext('/lms/course/' . $_SESSION['idCourse'] . '/group');
    $id_groups = $acl_man->getGroupsIdstFromBasePath('/lms/course/' . $_SESSION['idCourse'] . '/group', array('course'));
    if (!empty($id_groups)) {
        $groups = $acl_man->getGroups($id_groups);
    } else {
        $groups = array();
    }
    // compose table
    $tb = new Table(0, $lang->def('_GROUP_CAPTION'), $lang->def('_GROUP_CAPTION'));
    $type_h = array('', '');
    $cont_h = array($lang->def('_NAME'), $lang->def('_DESCRIPTION'));
    if ($subs_perm) {
        $type_h[] = 'image';
        $cont_h[] = '<img src="' . getPathImage() . 'standard/moduser.png" alt="' . $lang->def('_ALT_SUBSCRIBE') . '" ' . 'title="' . $lang->def('_SUBSCRIBE_USER') . '" />';
    }
    if ($mod_perm) {
        $type_h[] = 'image';
        $type_h[] = 'image';
        $cont_h[] = '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . '" ' . 'title="' . $lang->def('_MOD') . '" />';
        $cont_h[] = '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . '" ' . 'title="' . $lang->def('_DEL') . '" />';
    }
    $tb->setColsStyle($type_h);
    $tb->addHead($cont_h);
    if (!empty($groups)) {
        while (list(, $group) = each($groups)) {
            $id_group = $group[ACL_INFO_IDST];
            $group_id = $acl_man->relativeId($group[ACL_INFO_GROUPID]);
            if ($group_id != 'alluser') {
                $cont = array($group_id, $group[ACL_INFO_GROUPDESCRIPTION]);
                if ($subs_perm) {
                    $cont[] = '<a href="index.php?modname=groups&amp;op=subscribe&amp;id_group=' . $id_group . '&amp;load=1" ' . 'title="' . $lang->def('_ASSIGN_USERS') . ' : ' . strip_tags($group_id) . '">' . '<img src="' . getPathImage() . 'standard/moduser.png" alt="' . $lang->def('_ASSIGN_USERS') . '"  /></a>';
                }
                if ($mod_perm) {
                    $cont[] = '<a href="index.php?modname=groups&amp;op=editgroup&amp;id_group=' . $id_group . '" ' . 'title="' . $lang->def('_MOD') . ' : ' . strip_tags($group_id) . '">' . '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . '"  /></a>';
                    $cont[] = '<a href="index.php?modname=groups&amp;op=delgroup&amp;id_group=' . $id_group . '" ' . 'title="' . $lang->def('_DEL') . ' : ' . strip_tags($group_id) . '">' . '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . '" /></a>';
                }
                $tb->addBody($cont);
            }
        }
    }
    if ($mod_perm) {
        require_once _base_ . '/lib/lib.dialog.php';
        setupHrefDialogBox('a[href*=delgroup]');
        $tb->addActionAdd('<a href="index.php?modname=groups&amp;op=editgroup">' . '<img src="' . getPathImage() . 'standard/add.png" alt="' . $lang->def('_ADD') . '"  /> ' . $lang->def('_NEW') . '</a>');
    }
    // output
    $GLOBALS['page']->add(getTitleArea($lang->def('_GROUPS'), 'groups') . '<div class="std_block">', 'content');
    if (isset($_GET['result'])) {
        switch ($_GET['result']) {
            case "ok":
                $GLOBALS['page']->add(getResultUi($lang->def('_OPERATION_SUCCESSFUL')), 'content');
                break;
            case "err":
                $GLOBALS['page']->add(getErrorUi($lang->def('_OPERATION_FAILURE')), 'content');
                break;
        }
    }
    $GLOBALS['page']->add($tb->getTable() . '</div>', 'content');
}
コード例 #10
0
ファイル: reservation.php プロジェクト: abhinay100/forma_app
 function viewCategoy()
 {
     checkPerm('view');
     require_once _base_ . '/lib/lib.form.php';
     require_once _base_ . '/lib/lib.table.php';
     $lang =& DoceboLanguage::createInstance('reservation');
     $mod_perm = checkPerm('mod', true);
     $out = $GLOBALS['page'];
     $out->setWorkingZone('content');
     $man_res = new Man_Reservation();
     $category = array();
     $category = $man_res->viewCategory();
     $out->add(getTitleArea($lang->def('_CATEGORY')) . '<div class="std_block">', 'content');
     $error = importVar('error', false, '');
     if ($error !== '') {
         switch ($error) {
             case 'del_category':
                 $out->add(getErrorUi($lang->def('_DEL_CATEGORY_ERROR')));
                 break;
         }
     }
     $tb = new Table(10, $lang->def('_CATEGORY_CAPTION'), $lang->def('_CATEGORY_CAPTION'));
     $tb->initNavBar('ini', 'button');
     $ini = $tb->getSelectedElement();
     $cont_h = array($lang->def('_NAME'), $lang->def('_DESCRIPTION'));
     $type_h = array('', '');
     if ($mod_perm) {
         $type_h = array('', '', 'image', 'image');
         $cont_h = array($lang->def('_NAME'), $lang->def('_DESCRIPTION'), '<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') . '" />');
     }
     $tb->setColsStyle($type_h);
     $tb->addHead($cont_h);
     if ($category) {
         foreach ($category as $categ) {
             $count = array();
             $count[] = $categ[CATEGORY_NAME];
             if ($categ[CATEGORY_MAX_SUBSCRIPTION]) {
                 $count[] = $categ[CATEGORY_MAX_SUBSCRIPTION];
             } else {
                 $count[] = $lang->def('_UNLIMITED_SUBSCRIPTION');
             }
             if ($mod_perm) {
                 $count[] = '<a href="index.php?modname=reservation&amp;op=mod_category&amp;id_category=' . $categ[CATEGORY_ID] . '"><img src="' . getPathImage() . '/standard/edit.png" title="' . $lang->def('_MOD') . '" alt="' . $lang->def('_MOD') . '" /></a>';
                 $count[] = '<a href="index.php?modname=reservation&amp;op=del_category&amp;id_category=' . $categ[CATEGORY_ID] . '"><img src="' . getPathImage() . '/standard/delete.png" title="' . $lang->def('_DEL') . '" alt="' . $lang->def('_DEL') . '" /></a>';
             }
             $tb->addBody($count);
         }
         require_once _base_ . '/lib/lib.dialog.php';
         setupHrefDialogBox('a[href*=del_category]');
     }
     if ($mod_perm) {
         $tb->addActionAdd('<a class="ico-wt-sprite subs_add" href="index.php?modname=reservation&amp;op=add_category" title="' . $lang->def('_ADD') . '">' . '<span>' . $lang->def('_ADD') . '</span></a>');
     }
     $out->add($tb->getTable() . $tb->getNavBar($ini, count($category)) . '</div>');
 }
コード例 #11
0
ファイル: project.php プロジェクト: abhinay100/forma_app
function show_prj()
{
    checkPerm('view');
    $out =& $GLOBALS['page'];
    $out->setWorkingZone('content');
    $lang =& DoceboLanguage::createInstance('project', "lms");
    global $pathprj;
    require_once _base_ . '/lib/lib.table.php';
    // Controllo che l'utente non cerchi di entrare in progetti a cui non e' iscritto.
    $id = $_GET["id"];
    $myprj = user_projects(Docebo::user()->getIdSt());
    if (!in_array($id, $myprj)) {
        die("You can't access");
    }
    $modimg = '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def("_MOD") . '" />';
    $query = sql_query("SELECT * FROM " . $GLOBALS["prefix_lms"] . "_prj WHERE id='{$id}';");
    if ($query && mysql_num_rows($query) > 0) {
        $row = mysql_fetch_array($query);
    }
    $ta_array = array();
    $ta_array["index.php?modname=project&amp;op=project"] = $lang->def("_PROJECT_MANAGER");
    $ta_array[] = $row["ptitle"];
    $out->add(getTitleArea($ta_array, "project"));
    $out->add('<div class="std_block">');
    /*	$out->add('<div class="alignRight">'
    		.'<a class="back_comand" href="index.php?modname=project&amp;op=project">'.$lang->def("_BACK").'</a></div><br />'); */
    $url = "index.php?modname=project&amp;op=project";
    $out->add(getBackUi($url, $lang->def('_BACK')));
    $show_something = false;
    $out->add("<table class=\"prjcontainer\">\n");
    $out->add("<tr>\n");
    $out->add("<td width=\"60%\">\n");
    //=TASKS==============
    if ($row["pstasks"]) {
        show_task($id, $row, $modimg);
        $show_something = true;
    }
    //=FILES==============
    if ($row["psfiles"]) {
        show_files($id, $row, $modimg);
        $show_something = true;
    }
    $out->add("</td>\n");
    $out->add("<td>");
    //=NEWS==============
    if ($row["psnews"]) {
        show_news($id, $row, $modimg);
        $show_something = true;
    }
    //=TODO==============
    if ($row["pstodo"]) {
        show_todo($id, $row, $modimg);
        $show_something = true;
    }
    $out->add("</td>\n");
    $out->add("</tr>\n");
    $out->add("</table><br />\n");
    require_once _base_ . '/lib/lib.dialog.php';
    setupHrefDialogBox('a[href*=prjdelitem]');
    //=MSG======================================================
    if ($row["psmsg"]) {
        $show_something = true;
        require_once $GLOBALS["where_framework"] . "/lib/lib.sysforum.php";
        $out->add('<h3 class="prjmsg_title">' . $lang->def("_MESSAGES") . '</h3>' . "\n");
        $out =& $GLOBALS['page'];
        $out->setWorkingZone('content');
        //$lang=DoceboLanguage::createInstance("sysforum", "lms");
        $sf = new sys_forum("lms", "project_message", $id);
        $sf->setPrefix($GLOBALS["prefix_lms"]);
        $sf->can_write = true;
        $sf->can_moderate = (bool) (is_owner(Docebo::user()->getIdSt(), $id) || is_admin(Docebo::user()->getIdSt(), $id));
        $sf->can_upload = true;
        $sf->use_realname = true;
        $sf->url = "index.php?modname=project&amp;op=showprj&amp;id=" . $id;
        $out->add($sf->show());
        // Change with sysforum class
    }
    if (!$show_something) {
        $out->add("<h3>" . $lang->def("_NOTHINGTOSEE") . "</h3>\n");
    }
    $out->add('</div>');
}
コード例 #12
0
ファイル: report.php プロジェクト: abhinay100/forma_app
function get_report_table($url = '')
{
    checkPerm('view');
    $can_mod = checkPerm('mod', true);
    require_once _base_ . '/lib/lib.table.php';
    require_once _base_ . '/lib/lib.form.php';
    $acl_man =& Docebo::user()->getACLManager();
    $level = Docebo::user()->getUserLevelId(Docebo::user()->getIdst());
    $lang =& DoceboLanguage::createInstance('report');
    $output = '';
    $is_admin = $level == ADMIN_GROUP_GODADMIN || $level == ADMIN_GROUP_ADMIN ? true : false;
    if ($is_admin || $can_mod) {
        //if ($can_mod) {
        cout('<script type="text/javascript">
		var _FAILURE = "error";
		var ajax_path = "' . Get::rel_path('lms') . '/ajax.adm_server.php?mn=report&plf=lms";

		function public_report(o, id_rep) {
			o.disabled=true; //no more operations allowed on the checkbox while ajaxing

			var val_el=document.getElementById("enable_value_"+id_rep);
			var value=val_el.value;

			var data = "&op=public_rep&id="+id_rep+"&val="+value;
			var objAjax = YAHOO.util.Connect.asyncRequest("POST", ajax_path+data, {
			success:function(t) {
				var temp=o.src;
				if (value==1)	{ o.src=temp.replace("unpublish.png", "publish.png"); val_el.value=0; }
				if (value==0)	{ o.src=temp.replace("publish.png", "unpublish.png"); val_el.value=1; }
					o.disabled=false;
				},
			failure:function(t) {
					o.disabled=false;
					alert(_FAILURE); //...
				} });
			}

			function setReportFilter() {
				var el = document.createElement("INPUT");
				el.type = "hidden";
				el.name = "search";
				el.value = "1";
				var form = YAHOO.util.Dom.get("report_searchbox_form");
				if (form) {
					form.appendChild(el);
					form.submit();
				}
			}
		</script>', 'page_head');
    }
    //filter by author
    YuiLib::load();
    $current_user = $acl_man->getUser(Docebo::user()->getIdst(), false);
    //dropdown data arrays
    $authors = array(0 => '(' . $lang->def('_ALL') . ')', $current_user[ACL_INFO_IDST] => $acl_man->relativeId($current_user[ACL_INFO_USERID]));
    $query = "SELECT u.idst, u.userid FROM %lms_report_filter as r JOIN %adm_user as u ON (r.author=u.idst) WHERE u.idst<>" . Docebo::user()->getIdst() . " ORDER BY u.userid";
    $res = sql_query($query);
    while ($row = sql_fetch_assoc($res)) {
        $authors[$row['idst']] = $acl_man->relativeId($row['userid']);
    }
    $arr_report_types = array(0 => '(' . $lang->def('_ALL') . ')');
    //initializa session variable for filters
    if (!isset($_SESSION['report_admin_filter'])) {
        $_SESSION['report_admin_filter'] = array('author' => 0, 'name' => '', 'type' => 0);
    }
    if (Get::req('search', DOTY_MIXED, false) !== false) {
        $_SESSION['report_admin_filter']['author'] = Get::req('filter_author', DOTY_INT, (int) $_SESSION['report_admin_filter']['author']);
        $_SESSION['report_admin_filter']['name'] = Get::req('filter_name', DOTY_STRING, $_SESSION['report_admin_filter']['name']);
        $_SESSION['report_admin_filter']['type'] = Get::req('filter_type', DOTY_INT, (int) $_SESSION['report_admin_filter']['type']);
    }
    if (Get::req('reset', DOTY_MIXED, false) !== false) {
        $_SESSION['report_admin_filter']['author'] = 0;
        $_SESSION['report_admin_filter']['name'] = '';
        $_SESSION['report_admin_filter']['type'] = 0;
    }
    $dropdown_onclick = 'onchange="javascript:setReportFilter();"';
    $output .= Form::openForm('report_searchbox_form', 'index.php?modname=report&op=reportlist&of_platform=lms', false, 'POST');
    $output .= Form::getHidden('op', 'op', 'reportlist');
    $output .= Form::getHidden('modname', 'modname', 'report');
    $output .= '<div class="quick_search_form">
			<div>
				<div class="simple_search_box" id="report_searchbox_simple_filter_options" style="display: block;">' . Form::getInputDropdown('dropdown', 'report_searchbox_filter_author', 'filter_author', $authors, $_SESSION['report_admin_filter']['author'], $dropdown_onclick) . "&nbsp;&nbsp;&nbsp;" . Form::getInputTextfield("search_t", "report_searchbox_filter_name", "filter_name", $_SESSION['report_admin_filter']['name'], '', 255, '') . Form::getButton("report_searchbox_filter_set", "search", Lang::t('_SEARCH', 'standard'), "search_b") . Form::getButton("report_searchbox_filter_reset", "reset", Lang::t('_RESET', 'standard'), "reset_b") . '</div>
			</div>
		</div>';
    $output .= Form::closeForm();
    //end filter
    //compose search query
    $qconds = array();
    $query = "SELECT t1.*, t2.userid FROM %lms_report_filter as t1 LEFT JOIN %adm_user as t2 ON t1.author=t2.idst ";
    switch ($level) {
        case ADMIN_GROUP_GODADMIN:
            if ($_SESSION['report_admin_filter']['author'] > 0) {
                $qconds[] = " t1.author = " . $_SESSION['report_admin_filter']['author'] . " ";
            }
            break;
        case ADMIN_GROUP_ADMIN:
        case ADMIN_GROUP_PUBLICADMIN:
        case ADMIN_GROUP_USER:
        default:
            if ($_SESSION['report_admin_filter']['author'] > 0) {
                $qconds[] = " ( t1.author = " . $_SESSION['report_admin_filter']['author'] . " AND t1.is_public = 1 ) ";
            } else {
                $qconds[] = " ( t1.author = " . Docebo::user()->getIdst() . " OR t1.is_public = 1 ) ";
            }
            break;
    }
    if (trim($_SESSION['report_admin_filter']['name']) != "") {
        $qconds[] = " t1.filter_name LIKE '%" . $_SESSION['report_admin_filter']['name'] . "%' ";
    }
    if (trim($_SESSION['report_admin_filter']['type']) > 0) {
        //$qconds[] = " t1.filter_name LIKE '".$_SESSION['report_admin_filter']['name']."' ";
    }
    if (!empty($qconds)) {
        $query .= " WHERE " . implode(" AND ", $qconds);
    }
    //$_SESSION['report_admin_filter']['type']
    //end query
    $tb = new Table(Get::sett('visu_course'));
    $tb->initNavBar('ini', 'button');
    $col_type = array('', '', 'align_center', 'image', 'image', 'img-cell', 'img-cell', 'image');
    //,'image','image');
    $col_content = array($lang->def('_NAME'), $lang->def('_TAB_REP_CREATOR'), $lang->def('_CREATION_DATE'), $lang->def('_TAB_REP_PUBLIC'), '<img src="' . getPathImage() . 'standard/view.png" alt="' . $lang->def('_VIEW') . '" title="' . $lang->def('_VIEW') . '" />', '<span class="ico-sprite subs_csv"><span>' . Lang::t('_EXPORT_CSV', 'report') . '</span></span>', '<span class="ico-sprite subs_xls"><span>' . Lang::t('_EXPORT_XLS', 'report') . '</span></span>', '<img src="' . getPathImage() . 'standard/wait_alarm.png" alt="' . $lang->def('_SCHEDULE') . '" title="' . $lang->def('_SCHEDULE') . '" />');
    if ($is_admin || $can_mod) {
        $col_type[] = 'image';
        $col_type[] = 'image';
        $col_content[] = '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . '" title="' . $lang->def('_MOD') . '" />';
        $col_content[] = '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . '" title="' . $lang->def('_DEL') . '" />';
    }
    $tb->setColsStyle($col_type);
    $tb->addHead($col_content);
    if ($res = sql_query($query)) {
        while ($row = sql_fetch_assoc($res)) {
            $id = $row['id_filter'];
            $opn_link = '<a href="index.php?modname=report&amp;op=show_results&amp;idrep=' . $id . '" ' . ' title="' . $lang->def('_VIEW') . '">' . '<img src="' . getPathImage() . 'standard/view.png" alt="' . $lang->def('_VIEW') . '" />' . '</a>';
            $sch_link = '<a href="index.php?modname=report&amp;op=schedulelist&amp;idrep=' . $id . '" ' . ' title="' . $lang->def('_SCHEDULE') . '">' . '<img src="' . getPathImage() . 'standard/wait_alarm.png" alt="' . $lang->def('_SCHEDULE') . '" />' . '</a>';
            $mod_link = '<a href="' . $url . '&amp;action=modify&amp;idrep=' . $id . '" ' . ' title="' . $lang->def('_MOD') . '">' . '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . '" />' . '</a>';
            $rem_link = '<a href="' . $url . '&amp;action=delete&amp;idrep=' . $id . '" ' . ' title="' . $lang->def('_DEL') . ' : ' . ($row['author'] == 0 ? $lang->def($row['filter_name']) : $row['filter_name']) . '">' . '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . '" />';
            //.
            '</a>';
            $can_public = $can_mod ? true : ($is_admin && $row['author'] == Docebo::user()->getIdst() ? true : false);
            $public = '<image ' . ($can_public ? 'class="handover"' : '') . ' src="' . getPathImage('lms') . 'standard/' . ($row['is_public'] == 1 ? '' : 'un') . 'publish.png' . '" ' . ($is_admin || $can_mod ? 'onclick="public_report(this, ' . $row['id_filter'] . ');" ' : '') . ' />' . '<input type="hidden" id="enable_value_' . $row['id_filter'] . '" ' . 'value="' . ($row['is_public'] == 1 ? '0' : '1') . '" />';
            $export_url = 'index.php?modname=report&op=show_results&idrep=' . (int) $id;
            $export_link_csv = '<a class="ico-sprite subs_csv" href="' . $export_url . '&dl=csv" title="' . Lang::t('_EXPORT_CSV', 'report') . '"><span></span>' . Lang::t('_EXPORT_CSV', 'report') . '</a>';
            $export_link_xls = '<a class="ico-sprite subs_xls" href="' . $export_url . '&dl=xls" title="' . Lang::t('_EXPORT_XLS', 'report') . '"><span></span>' . Lang::t('_EXPORT_XLS', 'report') . '</a>';
            $_name = $row['author'] == 0 ? $lang->def($row['filter_name']) : $row['filter_name'];
            if (trim($_SESSION['report_admin_filter']['name']) != "") {
                $_name = Layout::highlight($_name, $_SESSION['report_admin_filter']['name']);
            }
            $tb_content = array(_REP_KEY_NAME => $_name, _REP_KEY_CREATOR => $row['author'] == 0 ? '<div class="align_center">-</div>' : $acl_man->relativeId($row['userid']), _REP_KEY_CREATION => Format::date($row['creation_date']), _REP_KEY_PUBLIC => $public, _REP_KEY_OPEN => $opn_link, $export_link_csv, $export_link_xls, _REP_KEY_SCHED => $sch_link);
            if ($is_admin || $can_mod) {
                if ($row['author'] == Docebo::user()->getIdst() || $can_mod) {
                    $tb_content[_REP_KEY_MOD] = $mod_link;
                    $tb_content[_REP_KEY_REM] = $rem_link;
                } else {
                    $tb_content[_REP_KEY_MOD] = '&nbsp;';
                    $tb_content[_REP_KEY_REM] = '&nbsp;';
                }
            }
            $tb->addBody($tb_content);
        }
    }
    if ($is_admin || $can_mod) {
        //if ($can_mod) {
        $tb->addActionAdd('
			<a href="index.php?modname=report&amp;op=report_category">' . '<img src="' . getPathImage() . 'standard/add.png" ' . 'title="' . $lang->def('_NEW') . '" /> ' . $lang->def('_NEW') . '</a>');
    }
    $output .= $tb->getTable();
    require_once _base_ . '/lib/lib.dialog.php';
    setupHrefDialogBox('a[href*=delete]');
    return $output;
}
コード例 #13
0
ファイル: manmenu.php プロジェクト: abhinay100/forma_app
function manmodule()
{
    checkPerm('view');
    require_once _base_ . '/lib/lib.table.php';
    $out =& $GLOBALS['page'];
    $lang =& DoceboLanguage::createInstance('manmenu', 'framework');
    $mo_lang =& DoceboLanguage::createInstance('menu', 'lms');
    $menu_lang =& DoceboLanguage::createInstance('menu_course', 'lms');
    $mod_perm = checkPerm('mod', true);
    // Find main voice info
    $id_main = Get::req('id_main', DOTY_INT, 0);
    $query_custom = "\r\n\tSELECT name \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_menucourse_main \r\n\tWHERE idMain = '" . (int) $id_main . "'";
    list($title_main) = sql_fetch_row(sql_query($query_custom));
    // Find all modules in this voice
    $query_module = "\r\n\tSELECT module.idModule, module.default_name, menu.my_name, menu.sequence, module.module_name\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_menucourse_under AS menu JOIN\r\n\t\t" . $GLOBALS['prefix_lms'] . "_module AS module\r\n\tWHERE module.idModule = menu.idModule AND menu.idMain = '" . (int) $id_main . "' \r\n\tORDER BY menu.sequence";
    $re_module = sql_query($query_module);
    $tot_module = mysql_num_rows($re_module);
    $used_module = '';
    $query_used_module = "\r\n\tSELECT module.idModule \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_menucourse_under AS menu JOIN \r\n\t\t" . $GLOBALS['prefix_lms'] . "_module AS module \r\n\tWHERE module.idModule = menu.idModule AND \r\n\t\t( menu.idCourse = '" . $_SESSION['idCourse'] . "' OR menu.idCourse = 0 )";
    $re_used_module = sql_query($query_used_module);
    while (list($id_mod_used) = sql_fetch_row($re_used_module)) {
        $used_module .= $id_mod_used . ',';
    }
    $query_free_module = "\r\n\tSELECT idModule, default_name \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_module AS module \r\n\tWHERE module_info = '' AND idModule NOT IN ( " . substr($used_module, 0, -1) . " )";
    $re_free_module = sql_query($query_free_module);
    $tb = new Table(0, $lang->def('_TB_MANMODULE_CAPTION'), $lang->def('_TB_MANMODULE_SUMMARY'));
    $content_h = array($lang->def('_ORDER'), $lang->def('_TITLE_MODULE'), '<img src="' . getPathImage() . 'standard/down.png" title="' . $lang->def('_MOVE_DOWN') . '" alt="' . $lang->def('_DOWN') . '" />', '<img src="' . getPathImage() . 'standard/up.png" title="' . $lang->def('_MOVE_UP') . '" alt="' . $lang->def('_UP') . '" />');
    $type_h = array('image', '', 'image', 'image');
    if ($mod_perm) {
        $content_h[] = '<img src="' . getPathImage() . 'standard/edit.png" title="' . $lang->def('_EDIT_SETTINGS') . '"' . ' alt="' . $lang->def('_MOD') . '" />';
        $type_h[] = 'image';
        $content_h[] = $lang->def('_DEL');
        $type_h[] = 'image';
    }
    $tb->setColsStyle($type_h);
    $tb->addHead($content_h);
    $i = 0;
    while (list($id_mod, $name_db, $my_name, $sequence, $module_name) = sql_fetch_row($re_module)) {
        $name = $my_name != '' ? $my_name : $menu_lang->def($name_db);
        $strip_name = strip_tags($name);
        $content = array($sequence, $name);
        $content[] = $i != $tot_module - 1 ? '<a href="index.php?modname=manmenu&amp;op=mdmodule&amp;id_main=' . $id_main . '&amp;id_module=' . $id_mod . '"' . ' title="' . $lang->def('_MOVE_DOWN') . ' : ' . $strip_name . '">' . '<img src="' . getPathImage() . 'standard/down.png" alt="' . $lang->def('_DOWN') . '" /></a>' : '';
        $content[] = $i != 0 ? '<a href="index.php?modname=manmenu&amp;op=mumodule&amp;id_main=' . $id_main . '&amp;id_module=' . $id_mod . '"' . ' title="' . $lang->def('_MOVE_UP') . ' : ' . $strip_name . '">' . '<img src="' . getPathImage() . 'standard/up.png" alt="' . $lang->def('_UP') . '" /></a>' : '';
        if ($mod_perm) {
            $content[] = '<a href="index.php?modname=manmenu&amp;op=modmodule&amp;id_main=' . $id_main . '&amp;id_module=' . $id_mod . '"' . ' title="' . $lang->def('_EDIT_SETTINGS') . ' : ' . $strip_name . '">' . '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . '" /></a>';
            if ($module_name != 'manmenu') {
                $content[] = '<a href="index.php?modname=manmenu&amp;op=delmodule&amp;id_main=' . $id_main . '&amp;id_module=' . $id_mod . '"' . ' title="' . $lang->def('_DEL') . ' : ' . $strip_name . '">' . $lang->def('_DEL') . '</a>';
            } else {
                $content[] = '';
            }
        }
        $tb->addBody($content);
        $i++;
    }
    if ($mod_perm) {
        require_once _base_ . '/lib/lib.dialog.php';
        setupHrefDialogBox('a[href*=delmodule]');
    }
    $tb_free = new Table(0, $lang->def('_TB_FREE_MANMODULE_CAPTION'), $lang->def('_NOT_ASSIGNED'));
    $c_free_h = array($lang->def('_TITLE_MODULE'));
    $t_free_h = array('');
    if ($mod_perm) {
        $c_free_h[] = $lang->def('_ASSIGN');
        $t_free_h[] = 'image';
    }
    $tb_free->setColsStyle($t_free_h);
    $tb_free->addHead($c_free_h);
    while (list($id_import_mod, $name_db) = sql_fetch_row($re_free_module)) {
        $name = $menu_lang->def($name_db);
        $strip_name = strip_tags($name);
        $content = array($name);
        if ($mod_perm) {
            $content[] = '<a href="index.php?modname=manmenu&amp;op=addmodule&amp;id_main=' . $id_main . '&amp;id_module=' . $id_import_mod . '"' . ' title="' . $lang->def('_TITLE_GRABMODULE') . ' : ' . $strip_name . '">' . $lang->def('_ASSIGN') . '</a>';
        }
        $tb_free->addBody($content);
    }
    // print out
    $out->setWorkingZone('content');
    $page_title = array('index.php?modname=manmenu&amp;op=manmenu' => $lang->def('_TITLE_MANMENU'), Lang::t($title_main, 'menu', false, false, $title_main));
    $out->add(getTitleArea($page_title, 'manmenu') . '<div class="std_block">' . getBackUi('index.php?modname=manmenu&amp;op=manmenu', $lang->def('_BACK')));
    if (isset($_GET['result'])) {
        switch ($_GET['result']) {
            case 0:
                $out->add(getResultUi($lang->def('_OPERATION_FAILURE')));
                break;
            case 1:
                $out->add(getResultUi($lang->def('_OPERATION_SUCCESSFUL')));
                break;
        }
    }
    $out->add($tb->getTable() . '[ <a href="index.php?modname=manmenu&amp;op=fixmodule&amp;id_main=' . $id_main . '" ' . 'title="' . $lang->def('_FIX_SEQUENCE') . '">' . $lang->def('_FIX_SEQUENCE') . '</a> ]' . '<br /><br />' . (mysql_num_rows($re_free_module) != false ? $tb_free->getTable() : '') . '</div>');
}
コード例 #14
0
ファイル: light_repo.php プロジェクト: abhinay100/forma_app
function repoUserDetails(&$url, $passed_repo = 0)
{
    checkPerm('view');
    require_once _base_ . '/lib/lib.table.php';
    $lang =& DoceboLanguage::createInstance('light_repo');
    $file_man = new LightRepoManager(getLogUserId(), $_SESSION['idCourse']);
    $acl_man =& Docebo::user()->getAclManager();
    $id_repo = importVar('id_repo', true, $passed_repo);
    $of_user = importVar('id_user', true, 0);
    // recovering file repository information
    $repo = $file_man->getRepoDetails($id_repo);
    if (checkPerm('mod', true)) {
        $page_title = array($url->getUrl() => $lang->def('_TITLE_LIGHT_REPO'), $url->getUrl('op=repo_manager_details&id_repo=' . $id_repo) => $repo[LR_TITLE], $acl_man->getUserName($of_user));
    } else {
        $of_user = getLogUserId();
        $page_title = array($url->getUrl() => $lang->def('_TITLE_LIGHT_REPO'), $repo[LR_TITLE]);
    }
    $file_list = $file_man->getRepoFileListOfAuthor($id_repo, $of_user);
    cout(getTitleArea($page_title, 'light_repo') . '<div class="std_block">', 'content');
    $table = new Table(0, $lang->def('_CAPTION_USER_FILE_LIST'), $lang->def('_SUMMARY_USER_FILE_LIST'));
    $content_h = array($lang->def('_FILENAME'), $lang->def('_DESCRIPTION'), $lang->def('_DATE'), '<img src="' . getPathImage() . 'standard/download.png" alt="' . $lang->def('_DOWNLOAD') . '" />', '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . '" />');
    $type_h = array('', '', '', 'image', 'image');
    $table->addHead($content_h, $type_h);
    $url->addToStdQuery('id_repo=' . $id_repo);
    while ($file = sql_fetch_row($file_list)) {
        $content = array();
        $content[] = implode('_', array_slice(explode('_', $file[LR_FILE_NAME]), 3));
        $content[] = $file[LR_FILE_DESCR];
        $content[] = Format::date($file[LR_FILE_POSTDATE], 'datetime');
        //$content[] = $file[LR_FILE_DESCR];
        $content[] = '' . '<a href="' . $url->getUrl('op=download_file&id_file=' . $file[LR_FILE_ID]) . '" title="' . $lang->def('_DOWNLOAD') . '' . strip_tags($file[LR_FILE_NAME]) . '">' . '<img src="' . getPathImage() . 'standard/download.png" alt="' . $lang->def('_DOWNLOAD') . '' . strip_tags($file[LR_FILE_NAME]) . '" />' . '</a>';
        $content[] = '' . '<a href="' . $url->getUrl('op=del_file&id_repo=' . $id_repo . '&id_file=' . $file[LR_FILE_ID]) . '"' . ' title="' . $lang->def('_DEL') . '' . strip_tags($file[LR_FILE_NAME]) . '">' . '<img src="' . getPathImage('fw') . 'standard/delete.png" alt="' . $lang->def('_DEL') . ' : ' . strip_tags($file[LR_FILE_NAME]) . '" />' . '</a>';
        $table->addBody($content);
    }
    cout($table->getTable(), 'content');
    require_once _base_ . '/lib/lib.dialog.php';
    setupHrefDialogBox('a[href*=del_file]');
    cout('</div>', 'content');
}
コード例 #15
0
function field_list()
{
    checkPerm('view');
    require_once _base_ . '/lib/lib.form.php';
    require_once _base_ . '/lib/lib.table.php';
    //require_once(_i18n_.'/lib.lang.php');
    $back_coded = htmlentities(urlencode('index.php?modname=field_manager&op=field_list'));
    $std_lang =& DoceboLanguage::createInstance('standard', 'framework');
    $lang =& DoceboLanguage::createInstance('field', 'framework');
    $out =& $GLOBALS['page'];
    $filter = new Form();
    //find available field type
    $re_field = sql_query("\r\n\tSELECT type_field FROM " . $GLOBALS['prefix_fw'] . "_field_type ORDER BY type_field");
    $field_av = array();
    $field_select = array('all_field' => $lang->def('_ALL_FIELD_TYPE'));
    while (list($type_field) = sql_fetch_row($re_field)) {
        $field_av[] = $type_field;
        $field_select[] = $lang->def('_' . strtoupper($type_field));
    }
    $out->setWorkingZone('content');
    $out->add(getTitleArea($lang->def('_FIELD_MANAGER'), 'field_manager'));
    $out->add('<div class="std_block">');
    //catch possible operation result
    if (isset($_GET['result'])) {
        if ($_GET['result'] == 'success') {
            $out->add(getResultUi($lang->def('_OPERATION_SUCCESSFUL')));
        }
        if ($_GET['result'] == 'fail') {
            $out->add(getErrorUi($lang->def('_OPERATION_FAILURE')));
        }
    }
    $ord = importVar('ord', false, 'trans');
    $flip = importVar('flip', true, 0);
    //filter------------------------------------------------------------
    $filter_type_field = importVar('filter_type_field', false, 'all_field');
    $filter_name_field = importVar('filter_name_field', false, $lang->def('_SEARCH'));
    $out->add($filter->openForm('field_filter', 'index.php?modname=field_manager&amp;op=field_list') . $filter->getOpenFieldset($lang->def('_SEARCH')) . $filter->getHidden('ord', 'ord', $ord) . $filter->getHidden('flip', 'flip', $flip) . $filter->getDropdown($lang->def('_FIELD_TYPE'), 'filter_type_field', 'filter_type_field', $field_select, $filter_type_field) . $filter->getTextfield($lang->def('_NAME'), 'filter_name_field', 'filter_name_field', '255', $filter_name_field) . $filter->openButtonSpace() . $filter->getButton('search', 'search', $std_lang->def('_SEARCH')) . $filter->closeButtonSpace() . $filter->getCloseFieldset() . $filter->closeForm());
    //display inserted field--------------------------------------------
    $tb_field = new Table(Get::sett('visuItem'));
    $query_field_display = "\r\n\tSELECT id_common, type_field, translation\r\n\tFROM " . $GLOBALS['prefix_fw'] . "_field\r\n\tWHERE lang_code = '" . getLanguage() . "'\r\n\t\t" . (isset($_POST['filter_type_field']) && $_POST['filter_type_field'] != 'all_field' ? " AND type_field = '" . $field_av[$_POST['filter_type_field']] . "' " : "") . "\r\n\t\t" . (isset($_POST['filter_name_field']) && $_POST['filter_name_field'] != $lang->def('_SEARCH') ? " AND translation LIKE '%" . $filter_name_field . "%'" : "") . "\r\n\tORDER BY sequence";
    $re_field_display = sql_query($query_field_display);
    $all_fields = mysql_num_rows($re_field_display);
    $img_up = '<img class="valing-middle" src="' . getPathImage() . 'standard/up.png" alt="' . $std_lang->def('_MOVE_UP') . '" />';
    $img_down = '<img class="valing-middle" src="' . getPathImage() . 'standard/down.png" alt="' . $std_lang->def('_MOVE_DOWN') . '" />';
    $content_h = array('<a href="index.php?modname=field_manager&amp;op=field_list">' . $lang->def('_FIELD_NAME') . '</a>', '<a href="index.php?modname=field_manager&amp;op=field_list">' . $lang->def('_FIELD_TYPE') . '</a>');
    $type_h = array('', 'align_center');
    $mod_perm = checkPerm('mod', true);
    $del_perm = checkPerm('del', true);
    if ($mod_perm) {
        $content_h[] = $img_down;
        $content_h[] = $img_up;
        $content_h[] = '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $std_lang->def('_MOD') . '" />';
        $type_h[] = 'image';
        $type_h[] = 'image';
        $type_h[] = 'image';
    }
    if ($del_perm) {
        $content_h[] = '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $std_lang->def('_DEL') . '" />';
        $type_h[] = 'image';
    }
    $tb_field->setColsStyle($type_h);
    $tb_field->addHead($content_h);
    $lat_type = 'textfield';
    $i = 1;
    while (list($id_common, $type_field, $translation) = sql_fetch_row($re_field_display)) {
        $cont = array($translation, $lang->def('_' . strtoupper($type_field)));
        if ($mod_perm) {
            if ($i != $all_fields) {
                $cont[] = '<a href="index.php?modname=field_manager&amp;op=movedown&amp;type_field=' . $type_field . '&amp;id_common=' . $id_common . '&amp;back=' . $back_coded . '"' . ' title="' . $lang->def('_MOVE_DOWN') . '">' . $img_down . '</a>';
            } else {
                $cont[] = '';
            }
            if ($i != 1) {
                $cont[] = '<a href="index.php?modname=field_manager&amp;op=moveup&amp;type_field=' . $type_field . '&amp;id_common=' . $id_common . '&amp;back=' . $back_coded . '"' . ' title="' . $lang->def('_MOVE_UP') . '">' . $img_up . '</a>';
            } else {
                $cont[] = '';
            }
            $cont[] = '<a href="index.php?modname=field&amp;op=manage&amp;fo=edit&amp;type_field=' . $type_field . '&amp;id_common=' . $id_common . '&amp;back=' . $back_coded . '"' . ' title="' . $lang->def('_MOD') . '">' . '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $std_lang->def('_MOD') . '" /></a>';
        }
        if ($del_perm) {
            /*
            $cont[] = '<a href="index.php?modname=field_manager&amp;op=field_del&amp;id_common='.$id_common.'"'
            	.' title="'.$lang->def('_DEL').'">'
            	.'<img src="'.getPathImage().'standard/delete.png" alt="'.$std_lang->def('_DEL').'" /></a>';
            */
            $cont[] = '<a href="index.php?modname=field&amp;op=manage&amp;fo=del&amp;type_field=' . $type_field . '&amp;id_common=' . $id_common . '&amp;back=index.php%3Fmodname%3Dfield_manager%26op%3Dfield_list"' . ' title="' . $lang->def('_DEL') . ' : ' . $translation . '">' . '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $std_lang->def('_DEL') . '" /></a>';
        }
        $tb_field->addBody($cont);
        $lat_type = $type_field;
        $i++;
    }
    $create_form = new Form();
    $select = '';
    foreach ($field_av as $k => $type_field) {
        $select .= '<option value="' . $type_field . '"' . ($type_field == $lat_type ? ' selected="selected"' : '') . '>' . $lang->def('_' . strtoupper($type_field)) . '</option>';
    }
    if ($del_perm) {
        require_once _base_ . '/lib/lib.dialog.php';
        setupHrefDialogBox('a[href*=fo=del]');
    }
    //add form----------------------------------------------------------
    if (checkPerm('add', true)) {
        $tb_field->addActionAdd($create_form->openForm('field_add', 'index.php?modname=field&amp;op=manage&amp;fo=create') . $create_form->getHidden('back', 'back', $back_coded) . '<label for="type_field">' . '<img class="valing-middle" src="' . getPathImage() . 'standard/add.png" alt="' . $std_lang->def('_ADD') . '" />' . ' ' . $lang->def('_ADD_NEW_FIELD') . '</label> ' . '<select id="type_field" name="type_field">' . $select . '</select> ' . $filter->getButton('new_field', 'new_field', $std_lang->def('_CREATE'), 'button_nowh') . $filter->closeForm());
    }
    $out->add($tb_field->getTable());
    $out->add('<a href="index.php?modname=field_manager&amp;op=fixsequence&amp;back=' . $back_coded . '"' . ' title="' . $lang->def('_FIX_SEQUENCE') . '">' . $lang->def('_FIX_SEQUENCE') . '</a>');
    $out->add('</div>');
}
コード例 #16
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>');
    }
}
コード例 #17
0
ファイル: webpages.php プロジェクト: abhinay100/forma_app
function webpages()
{
    checkPerm('view');
    require_once _base_ . '/lib/lib.table.php';
    require_once _base_ . '/lib/lib.form.php';
    $mod_perm = checkPerm('mod', true);
    $lang =& DoceboLanguage::createInstance('admin_webpages', 'lms');
    $out =& $GLOBALS['page'];
    $out->setWorkingZone('content');
    $tb = new Table(0, $lang->def('_WEBPAGES_CAPTION'));
    $nav_bar = new NavBar('ini', Get::sett('visuItem'), 0, 'button');
    $ini = $nav_bar->getSelectedElement();
    //search query
    $query_pages = "\r\n\tSELECT idPages, title, publish, in_home, sequence \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_webpages \r\n\tORDER BY sequence \r\n\tLIMIT {$ini}," . Get::sett('visuItem');
    $num_query_pages = "\r\n\tSELECT COUNT(*) \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_webpages ";
    //do query
    $re_pages = sql_query($query_pages);
    list($tot_pages) = sql_fetch_row(sql_query($num_query_pages));
    $nav_bar->setElementTotal($tot_pages);
    //-Table---------------------------------------------------------
    $cont_h = array($lang->def('_TITLE'), '<img src="' . getPathImage() . 'webpages/home.png" alt="' . $lang->def('_ALT_HOME') . '" title="' . $lang->def('_TITLE_HOME') . '" />', '<img src="' . getPathImage() . 'standard/publish.png" alt="' . $lang->def('_PUBLISH') . '" title="' . $lang->def('_STATUS') . '" />');
    $type_h = array('', 'image', 'image', 'image');
    if ($mod_perm) {
        $cont_h[] = '<img src="' . getPathImage() . 'standard/down.png" alt="' . $lang->def('_DOWN') . '" title="' . $lang->def('_MOVE_DOWN') . '" />';
        $type_h[] = 'image';
        $cont_h[] = '<img src="' . getPathImage() . 'standard/up.png" alt="' . $lang->def('_UP') . '" title="' . $lang->def('_MOVE_UP') . '" />';
        $type_h[] = 'image';
        $cont_h[] = '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . '" title="' . $lang->def('_MOD') . '" />';
        $type_h[] = 'image';
        $cont_h[] = '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . '" title="' . $lang->def('_DEL') . '" />';
        $type_h[] = 'image';
    }
    $tb->setColsStyle($type_h);
    $tb->addHead($cont_h);
    $i = 1;
    while (list($id, $title, $publish, $in_home) = sql_fetch_row($re_pages)) {
        $cont = array($title, $in_home ? '<img src="' . getPathImage() . 'webpages/home.png" alt="' . $lang->def('_ALT_HOME') . '" title="' . $lang->def('_TITLE_HOME') . '" />' : '');
        if ($publish) {
            $cont[] = '<a href="index.php?modname=webpages&amp;op=unpublish&amp;id_page=' . $id . '" title="' . $lang->def('_PUBLISH') . ' : ' . $title . '">' . '<img src="' . getPathImage() . 'standard/publish.png" alt="' . $lang->def('_PUBLISH') . ' : ' . $title . '" /></a>';
        } else {
            $cont[] = '<a href="index.php?modname=webpages&amp;op=publish&amp;id_page=' . $id . '" title="' . $lang->def('_UNPUBLISH') . ' : ' . $title . '">' . '<img src="' . getPathImage() . 'standard/unpublish.png" alt="' . $lang->def('_UNPUBLISH') . ' : ' . $title . '" /></a>';
        }
        if ($mod_perm) {
            if ($i != $tot_pages - $ini * Get::sett('visuItem')) {
                $cont[] = '<a href="index.php?modname=webpages&amp;op=movedown&amp;id_page=' . $id . '" title="' . $lang->def('_MOVE_DOWN') . ' : ' . $title . '">' . '<img src="' . getPathImage() . 'standard/down.png" alt="' . $lang->def('_DOWN') . ' : ' . $title . '" /></a>';
            } else {
                $cont[] = '&nbsp;';
            }
            if ($i != 1 || $ini != 0) {
                $cont[] = '<a href="index.php?modname=webpages&amp;op=moveup&amp;id_page=' . $id . '" title="' . $lang->def('_MOVE_UP') . ' : ' . $title . '">' . '<img src="' . getPathImage() . 'standard/up.png" alt="' . $lang->def('_UP') . ' : ' . $title . '" /></a>';
            } else {
                $cont[] = '&nbsp;';
            }
            $cont[] = '<a href="index.php?modname=webpages&amp;op=modpages&amp;id_page=' . $id . '" title="' . $lang->def('_MOD') . ' : ' . $title . '">' . '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . ' : ' . $title . '" /></a>';
            $cont[] = '<a href="index.php?modname=webpages&amp;op=delpages&amp;id_page=' . $id . '" title="' . $lang->def('_DEL') . ' : ' . $title . '">' . '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . ' : ' . $title . '" /></a>';
        }
        $tb->addBody($cont);
        ++$i;
    }
    if ($mod_perm) {
        $tb->addActionAdd('<a class="ico-wt-sprite subs_add" href="index.php?modname=webpages&amp;op=addpages" title="' . Lang::t('_ADD', 'webpages') . '"><span>' . Lang::t('_ADD', 'webpages') . '</span></a>');
    }
    //visualize result
    $out->add(getTitleArea($lang->def('_TITLE_WEBPAGES'), 'webpages') . '<div class="std_block">');
    if (isset($_GET['result'])) {
        switch ($_GET['result']) {
            case "ok":
                $out->add(getResultUi($lang->def('_OPERATION_SUCCESSFUL')));
                break;
            case "err":
                $out->add(getErrorUi($lang->def('_OPERATION_FAILURE')));
                break;
            case "err_del":
                $out->add(getErrorUi($lang->def('_OPERATION_FAILURE')));
                break;
        }
    }
    $out->add($tb->getTable() . Form::openForm('nav_webpages', 'index.php?modname=webpages&amp;op=webpages') . $nav_bar->getNavBar($ini) . Form::closeForm() . '</div>');
    if ($mod_perm) {
        require_once _base_ . '/lib/lib.dialog.php';
        setupHrefDialogBox('a[href*=delpages]');
    }
}
コード例 #18
0
ファイル: forum.php プロジェクト: abhinay100/forma_app
function message()
{
    checkPerm('view');
    require_once _base_ . '/lib/lib.table.php';
    require_once _base_ . '/lib/lib.form.php';
    require_once _base_ . '/lib/lib.user_profile.php';
    require_once $GLOBALS['where_framework'] . '/lib/lib.tags.php';
    $tags = new Tags('lms_forum');
    $tags->setupJs('a[id^=handler-tags-]', 'a[id^=private-handler-tags-]');
    require_once _base_ . '/lib/lib.dialog.php';
    setupHrefDialogBox('a[href*=delmessage]');
    $lang =& DoceboLanguage::createInstance('forum', 'lms');
    $id_thread = importVar('idThread', true, 0);
    $sema_perm = checkPerm('sema', true);
    $moderate = checkPerm('moderate', true);
    $mod_perm = checkPerm('mod', true);
    $write_perm = checkPerm('write', true);
    $acl_man =& Docebo::user()->getAclManager();
    $profile_man = new UserProfile(0);
    $profile_man->init('profile', 'framework', 'index.php?modname=forum&op=forum');
    $tb = new Table(Get::sett('visuItem'), $lang->def('_CAPTION_FORUM_MESSAGE'), $lang->def('_CAPTION_FORUM_MESSAGE'));
    $tb->initNavBar('ini', 'link');
    $tb->setLink('index.php?modname=forum&amp;op=message&amp;idThread=' . $id_thread);
    $ini = $tb->getSelectedElement();
    $ini_page = $tb->getSelectedPage();
    $first_unread_message = importVar('firstunread', true, 0);
    $ini_first_unread_message = importVar('ini', true, 0);
    $set_important = importVar('important', true, 0);
    if ($set_important == 1) {
        $query_set_important = "UPDATE " . $GLOBALS['prefix_lms'] . "_forumthread" . " SET rilevantForum = 1" . " WHERE idThread = '" . $id_thread . "'";
        $result_set_important = sql_query($query_set_important);
    }
    if ($set_important == 2) {
        $query_set_important = "UPDATE " . $GLOBALS['prefix_lms'] . "_forumthread" . " SET rilevantForum = 0" . " WHERE idThread = '" . $id_thread . "'";
        $result_set_important = sql_query($query_set_important);
    }
    // Some info about forum and thread
    $thread_query = "\r\n\tSELECT idForum, title, num_post, locked, erased, rilevantForum\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_forumthread\r\n\tWHERE idThread = '" . $id_thread . "'";
    list($id_forum, $thread_title, $tot_message, $locked_t, $erased_t, $is_important) = sql_fetch_row(sql_query($thread_query));
    $forum_query = "\r\n\tSELECT title, locked\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_forum\r\n\tWHERE idForum = '" . $id_forum . "'";
    list($forum_title, $locked_f) = sql_fetch_row(sql_query($forum_query));
    ++$tot_message;
    //set as readed if needed
    if (isset($_SESSION['unreaded_forum'][$_SESSION['idCourse']][$id_forum][$id_thread])) {
        unset($_SESSION['unreaded_forum'][$_SESSION['idCourse']][$id_forum][$id_thread]);
    }
    if ($ini == 0 && !isset($_GET['result'])) {
        sql_query("\r\n\t\tUPDATE " . $GLOBALS['prefix_lms'] . "_forumthread\r\n\t\tSET num_view = num_view + 1\r\n\t\tWHERE idThread = '" . $id_thread . "'");
    }
    $page_title = array('index.php?modname=forum&amp;op=forum' => $lang->def('_FORUM'), 'index.php?modname=forum&amp;op=thread&amp;idForum=' . $id_forum => $forum_title, $thread_title);
    if ($erased_t && !$mod_perm && !$moderate) {
        $GLOBALS['page']->add(getTitleArea($page_title, 'forum') . '<div class="std_block">' . $lang->def('_CANNOTENTER') . '</div>', 'content');
        return;
    }
    // Who have semantic evaluation
    $re_sema = sql_query("\r\n\tSELECT DISTINCT idmsg\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_forum_sema");
    while (list($msg_sema) = sql_fetch_row($re_sema)) {
        $forum_sema[$msg_sema] = 1;
    }
    // Find post
    $messages = array();
    $authors = array();
    $authors_names = array();
    $authors_info = array();
    $re_message = sql_query("\r\n\tSELECT idMessage, posted, title, textof, attach, locked, author, modified_by, modified_by_on\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_forummessage\r\n\tWHERE idThread = '" . $id_thread . "'\r\n\tORDER BY posted\r\n\tLIMIT {$ini}, " . Get::sett('visuItem'));
    while ($record = mysql_fetch_assoc($re_message)) {
        $messages[$record['idMessage']] = $record;
        $authors[$record['author']] = $record['author'];
        if ($record['modified_by'] != 0) {
            $authors[$record['modified_by']] = $record['modified_by'];
        }
        $tag_resource_list[] = $record['idMessage'];
    }
    $authors_names =& $acl_man->getUsers($authors);
    $level_name = CourseLevel::getLevels();
    //tags
    $tags->loadResourcesTags($tag_resource_list);
    // Retriving level and number of post of the authors
    if (!empty($authors)) {
        $re_num_post = sql_query("\r\n\t\tSELECT u.idUser, u.level, COUNT(*)\r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_forummessage AS m, " . $GLOBALS['prefix_lms'] . "_courseuser AS u\r\n\t\tWHERE u.idCourse = '" . (int) $_SESSION['idCourse'] . "' AND m.author = u.idUser AND m.author IN ( " . implode($authors, ',') . " )\r\n\t\tGROUP BY u.idUser, u.level");
        while (list($id_u, $level_u, $num_post_a) = sql_fetch_row($re_num_post)) {
            $authors_info[$id_u] = array('num_post' => $num_post_a, 'level' => $level_name[$level_u]);
        }
        $profile_man->setCahceForUsers($authors);
    }
    $type_h = array('forum_sender', 'forum_text');
    $cont_h = array($lang->def('_AUTHOR'), $lang->def('_TEXTOF'));
    $tb->setColsStyle($type_h);
    $tb->addHead($cont_h);
    // Compose messagges display
    $path = $GLOBALS['where_files_relative'] . '/appCore/' . Get::sett('pathphoto');
    $counter = 0;
    while (list($id_message, $message_info) = each($messages)) {
        $counter++;
        // sender info
        $m_author = $message_info['author'];
        //if(isset($authors_names[$m_author]) && $authors_names[$m_author][ACL_INFO_AVATAR] != '') $img_size = @getimagesize($path.$authors_names[$m_author][ACL_INFO_AVATAR]);
        $profile_man->setIdUser($m_author);
        $author = $profile_man->getUserPanelData(false, 'normal');
        $sender = '';
        $sender = '<div class="forum_author">';
        $sender .= $author['actions'] . $author['display_name'] . (isset($authors_info[$m_author]) ? '<div class="forum_level">' . $authors_info[$m_author]['level'] . '</div>' : '') . '<br/>' . $author['avatar'] . '<div class="forum_numpost">' . $lang->def('_NUMPOST') . ' : ' . (isset($authors_info[$m_author]['num_post']) ? $authors_info[$m_author]['num_post'] : 0) . '</div>' . '<a class="ico-wt-sprite subs_user" href="index.php?modname=forum&amp;op=viewprofile&amp;idMessage=' . $id_message . '&amp;ini=' . $ini_page . '&amp;idThread=' . $id_thread . '">' . '<span>' . $lang->def('_VIEW_PROFILE') . '</span></a>';
        /*.( isset($authors_names[$m_author]) && $authors_names[$m_author][ACL_INFO_AVATAR] != ''
        		? '<img class="forum_avatar'.( $img_size[0] > 150 || $img_size[1] > 150 ? ' image_limit' : '' ).'" src="'.$path.$authors_names[$m_author][ACL_INFO_AVATAR].'" alt="'.$lang->def('_AVATAR').'" />'
        		: '' )*/
        /*
        .( isset($authors_names[$m_author])
        	?( $authors_names[$m_author][ACL_INFO_LASTNAME].$authors_names[$m_author][ACL_INFO_FIRSTNAME] == '' ?
        		$acl_man->relativeId($authors_names[$m_author][ACL_INFO_USERID]) :
        		$authors_names[$m_author][ACL_INFO_LASTNAME].' '.$authors_names[$m_author][ACL_INFO_FIRSTNAME] )
        	: $lang->def('_UNKNOWN_AUTHOR') )
        */
        /*.'<img src="'.getPathImage().'standard/identity.png" alt="&gt;" />&nbsp;'
        			.'<a href="index.php?modname=forum&amp;op=viewprofile&amp;idMessage='.$id_message.'&amp;ini='.$ini_page.'">'.$lang->def('_VIEW_PROFILE').'</a>';
        		*/
        // msg info
        $msgtext = '';
        if ($counter == $first_unread_message) {
            $msgtext .= '<a name="firstunread"></a><div class="forum_post_posted">';
        } else {
            $msgtext .= '<div class="forum_post_posted">';
        }
        $msgtext .= '<a id="' . $id_message . '" name="' . $id_message . '"></a>';
        $msgtext .= $lang->def('_DATE') . ' : ' . Format::date($message_info['posted']) . ' ( ' . loadDistance($message_info['posted']) . ' )' . '</div>';
        if ($message_info['locked']) {
            $msgtext .= '<div class="forum_post_locked">' . $lang->def('_LOCKEDMESS') . '</div>';
        } else {
            if ($message_info['attach'] != '') {
                $msgtext .= '<div class="forum_post_attach">' . '<a href="index.php?modname=forum&amp;op=download&amp;id=' . $id_message . '">' . $lang->def('_ATTACHMENT') . ' : ' . '<img src="' . getPathImage() . mimeDetect($message_info['attach']) . '" alt="' . $lang->def('_ATTACHMENT') . '" /></a>' . '</div>';
            }
            $msgtext .= '<div class="forum_post_title">' . $lang->def('_SUBJECT') . ' : ' . $message_info['title'] . '</div>';
            $msgtext .= '<div class="forum_post_text">' . str_replace('[quote]', '<blockquote class="forum_quote">', str_replace('[/quote]', '</blockquote>', $message_info['textof'])) . '</div>';
            if ($message_info['modified_by'] != 0) {
                $modify_by = $message_info['modified_by'];
                $msgtext .= '<div class="forum_post_modified_by">' . $lang->def('_MODIFY_BY') . ' : ' . (isset($authors_names[$m_author]) ? $authors_names[$modify_by][ACL_INFO_LASTNAME] . $authors_names[$modify_by][ACL_INFO_FIRSTNAME] == '' ? $acl_man->relativeId($authors_names[$modify_by][ACL_INFO_USERID]) : $authors_names[$modify_by][ACL_INFO_LASTNAME] . ' ' . $authors_names[$modify_by][ACL_INFO_FIRSTNAME] : $lang->def('_UNKNOWN_AUTHOR')) . ' ' . $lang->def('_ON') . ' : ' . Format::date($message_info['modified_by_on']) . '</div>';
            }
            if (isset($authors_names[$m_author]) && $authors_names[$m_author][ACL_INFO_SIGNATURE] != '') {
                $msgtext .= '<div class="forum_post_sign_separator"></div>' . '<div class="forum_post_sign">' . $authors_names[$m_author][ACL_INFO_SIGNATURE] . '</div>';
            }
            $strip_text = strip_tags($message_info['textof']);
            $msgtext .= '<div class="tags align-right">' . $tags->showTags($id_message, 'tags-', $message_info['title'], substr($strip_text, 0, 200) . (strlen($strip_text) > 200 ? '...' : ''), 'index.php?modname=forum&op=message&idThread=' . $id_thread . '&ini=' . $ini_page . '#' . $id_message) . '</div>';
        }
        $content = array($sender, $msgtext);
        $tb->addBody($content);
        // some action that you can do with this message
        $action = '';
        /*if($sema_perm) {
        			if(isset($forum_sema[$id_message])) $img_sema = 'sema_check';
        			else $img_sema = 'sema';
        			$action .= '<a href="index.php?modname=forum&amp;op=editsema&amp;idMessage='.$id_message.'&amp;ini='.$ini_page.'" '
        					.'title="'.$lang->def('_MOD').' : '.strip_tags($message_info['title']).'">'
        				.'<img src="'.getPathImage().'forum/'.$img_sema.'.gif" alt="'.$lang->def('_MOD').' : '.strip_tags($message_info['title']).'" /> '
        				.$lang->def('_SEMATAG').'</a> ';
        		}*/
        if ($moderate || $mod_perm) {
            if ($message_info['locked']) {
                $action .= '<a href="index.php?modname=forum&amp;op=moderatemessage&amp;idMessage=' . $id_message . '&amp;ini=' . $ini_page . '" ' . 'title="' . $lang->def('_DEMODERATE') . ' : ' . strip_tags($message_info['title']) . '">' . '<img src="' . getPathImage() . 'standard/demoderate.png" alt="' . $lang->def('_DEMODERATE') . ' : ' . strip_tags($message_info['title']) . '" /> ' . $lang->def('_DEMODERATE') . '</a> ';
            } else {
                $action .= '<a href="index.php?modname=forum&amp;op=moderatemessage&amp;idMessage=' . $id_message . '&amp;ini=' . $ini_page . '" ' . 'title="' . $lang->def('_MODERATE') . ' : ' . strip_tags($message_info['title']) . '">' . '<img src="' . getPathImage() . 'standard/moderate.png" alt="' . $lang->def('_MODERATE') . ' : ' . strip_tags($message_info['title']) . '" /> ' . $lang->def('_MODERATE') . '</a> ';
            }
        }
        if (!$locked_t && !$locked_f && !$message_info['locked'] && $write_perm) {
            $action .= '<a href="index.php?modname=forum&amp;op=addmessage&amp;idThread=' . $id_thread . '&amp;idMessage=' . $id_message . '&amp;ini=' . $ini_page . '" ' . 'title="' . $lang->def('_REPLY') . ' : ' . strip_tags($message_info['title']) . '">' . '<img src="' . getPathImage() . 'standard/reply.png" alt="' . $lang->def('_REPLY') . ' : ' . strip_tags($message_info['title']) . '" /> ' . $lang->def('_QUOTE') . '</a>';
        }
        if ($moderate || $mod_perm || $m_author == getLogUserId()) {
            $action .= '<a href="index.php?modname=forum&amp;op=modmessage&amp;idMessage=' . $id_message . '&amp;ini=' . $ini_page . '" ' . 'title="' . $lang->def('_MOD_MESSAGE') . ' : ' . strip_tags($message_info['title']) . '">' . '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . ' : ' . strip_tags($message_info['title']) . '" /> ' . $lang->def('_MOD') . '</a>' . '<a href="index.php?modname=forum&amp;op=delmessage&amp;idMessage=' . $id_message . '&amp;ini=' . $ini_page . '" ' . 'title="' . $lang->def('_DEL') . ' : ' . strip_tags($message_info['title']) . '">' . '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . ' : ' . strip_tags($message_info['title']) . '" /> ' . $lang->def('_DEL') . '</a> ';
        }
        $tb->addBodyExpanded($action, 'forum_action');
    }
    $GLOBALS['page']->add(getTitleArea($page_title, 'forum') . '<div class="std_block">' . Form::openForm('search_forum', 'index.php?modname=forum&amp;op=search&amp;idThread=' . $id_thread) . '<div class="quick_search_form">' . '<label for="search_arg">' . $lang->def('_SEARCH_LABEL') . '</label> ' . Form::getInputTextfield('search_t', 'search_arg', 'search_arg', '', $lang->def('_SEARCH'), 255, '') . '<input class="search_b" type="submit" id="search_button" name="search_button" value="' . $lang->def('_SEARCH') . '" />' . '</div>' . Form::closeForm(), 'content');
    // NOTE: If notify request register it
    require_once $GLOBALS['where_framework'] . '/lib/lib.usernotifier.php';
    $can_notify = usernotifier_getUserEventStatus(getLogUserId(), 'ForumNewResponse');
    if (isset($_GET['notify']) && $can_notify) {
        if (issetNotify('thread', $id_thread, getLogUserId())) {
            $re = unsetNotify('thread', $id_thread, getLogUserId());
            $is_notify = !$re;
        } else {
            $re = setNotify('thread', $id_thread, getLogUserId());
            $is_notify = $re;
        }
        if ($re) {
            $GLOBALS['page']->add(getResultUi($lang->def('_NOTIFY_CHANGE_STATUS_CORRECT')), 'content');
        } else {
            $GLOBALS['page']->add(getErrorUi($lang->def('_NOTIFY_CHANGE_STATUS_FAILED')), 'content');
        }
    } elseif ($can_notify) {
        $is_notify = issetNotify('thread', $id_thread, getLogUserId());
    }
    $text_inner = '';
    if (!$locked_t && !$locked_f && $write_perm) {
        $text_inner .= '<a href="index.php?modname=forum&amp;op=addmessage&amp;idThread=' . $id_thread . '&amp;ini=' . $ini_page . '" title="' . $lang->def('_REPLY') . '" class="ico-wt-sprite subs_add">' . '<span>' . $lang->def('_REPLY') . '</span></a>';
    }
    if ($can_notify) {
        $text_inner .= '<a href="index.php?modname=forum&amp;op=message&amp;notify=1&amp;idThread=' . $id_thread . '&amp;ini=' . $ini_page . '" ' . (!$is_notify ? 'class="ico-wt-sprite fd_notice"><span>' . $lang->def('_NOTIFY_ME_FORUM') . '</span></a> ' : 'class="ico-wt-sprite fd_error"><span>' . $lang->def('_UNNOTIFY_ME_FORUM') . '</span></a> ') . '';
    }
    if ($moderate) {
        $text_inner .= ' <a href="index.php?modname=forum&amp;op=modstatusthread&amp;idThread=' . $id_thread . '&amp;ini=' . $ini_page . '">' . ($locked_t ? '<img src="' . getPathImage() . 'standard/msg_read.png" alt="' . $lang->def('_FREE') . '" /> ' . $lang->def('_FREETHREAD') : '<img src="' . getPathImage() . 'standard/locked.png" alt="' . $lang->def('_LOCKTHREAD') . '" /> ' . $lang->def('_LOCKTHREAD')) . '</a>';
    }
    if ($mod_perm) {
        $text_inner .= ' <a href="index.php?modname=forum&amp;op=changeerased&amp;idThread=' . $id_thread . '&amp;ini=' . $ini_page . '">' . ($erased_t ? '<img src="' . getPathImage() . 'standard/msg_read.png" alt="' . $lang->def('_UNERASE') . '" /> ' . $lang->def('_UNERASE') : '<img src="' . getPathImage() . 'standard/moderate.png" alt="' . $lang->def('_MODERATE') . '" /> ' . $lang->def('_MODERATE')) . '</a>';
    }
    if (checkPerm('moderate', true) || checkPerm('mod', true)) {
        if ($is_important) {
            $text_inner .= ' <a href="index.php?modname=forum&op=message&amp;idThread=' . $id_thread . '&amp;ini=' . $ini_page . '&amp;important=2"><img src="' . getPathImage() . 'standard/notimportant.png" alt="' . $lang->def('_SET_NOT_IMPORTANT_THREAD') . '" /> ' . $lang->def('_SET_NOT_IMPORTANT_THREAD') . '</a>';
        } else {
            $text_inner .= ' <a href="index.php?modname=forum&op=message&amp;idThread=' . $id_thread . '&amp;ini=' . $ini_page . '&amp;important=1"><img src="' . getPathImage() . 'standard/important.png" alt="' . $lang->def('_MARK_AS_IMPORTANT') . '" /> ' . $lang->def('_MARK_AS_IMPORTANT') . '</a>';
        }
    }
    if ($text_inner != '') {
        $tb->addActionAdd($text_inner);
    }
    $GLOBALS['page']->add($tb->getNavBar($ini, $tot_message), 'content');
    $GLOBALS['page']->add($tb->getTable(), 'content');
    $GLOBALS['page']->add($tb->getNavBar($ini, $tot_message) . '</div>', 'content');
}
コード例 #19
0
function news()
{
    checkPerm('view');
    require_once _base_ . '/lib/lib.form.php';
    require_once _base_ . '/lib/lib.table.php';
    require_once _base_ . '/lib/lib.navbar.php';
    $mod_perm = checkPerm('mod', true);
    $lang =& DoceboLanguage::createInstance('admin_news', 'lms');
    $out =& $GLOBALS['page'];
    $out->setWorkingZone('content');
    $tb = new Table(Get::sett('visuItem'), $lang->def('_NEWS'), $lang->def('_NEWS_SUMMARY'));
    $nav_bar = new NavBar('ini', Get::sett('visuItem'), 0, 'link');
    $ini = $nav_bar->getSelectedElement();
    //search query
    $query_news = "\r\n\tSELECT idNews, publish_date, title, short_desc, important\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_news_internal\r\n\tORDER BY important DESC, publish_date DESC\r\n\tLIMIT {$ini}," . Get::sett('visuItem');
    $query_news_tot = "\r\n\tSELECT COUNT(*)\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_news_internal ";
    $re_news = sql_query($query_news);
    list($tot_news) = sql_fetch_row(sql_query($query_news_tot));
    $nav_bar->setElementTotal($tot_news);
    $impo_gif = '<img src="' . getPathImage('lms') . 'standard/important.png" ' . 'title="' . $lang->def('_TITLE_IMPORTANT') . '" ' . 'alt="' . $lang->def('_IMPORTANT') . '" />';
    $type_h = array('image', '', '', 'news_short_td');
    $cont_h = array($impo_gif, $lang->def('_DATE'), $lang->def('_TITLE'), $lang->def('_SHORTDESC'));
    if ($mod_perm) {
        $cont_h[] = '<img src="' . getPathImage() . 'standard/moduser.png" title="' . $lang->def('_RECIPIENTS') . '" ' . 'alt="' . $lang->def('_RECIPIENTS') . '" />';
        $type_h[] = 'image';
        $cont_h[] = '<img src="' . getPathImage() . 'standard/edit.png" title="' . $lang->def('_MOD') . '" ' . 'alt="' . $lang->def('_MOD') . '" />';
        $type_h[] = 'image';
        $cont_h[] = '<img src="' . getPathImage() . 'standard/delete.png" title="' . $lang->def('_DEL') . '" ' . 'alt="' . $lang->def('_DEL') . '"" />';
        $type_h[] = 'image';
    }
    $tb->setColsStyle($type_h);
    $tb->addHead($cont_h);
    while (list($id_news, $publish_date, $title, $short_desc, $impo) = sql_fetch_row($re_news)) {
        $cont = array($impo ? $impo_gif : '', Format::date($publish_date), $title, Util::cut($short_desc));
        if ($mod_perm) {
            $cont[] = '<a href="index.php?modname=internal_news&amp;op=editviewer&amp;load=1&amp;id_news=' . $id_news . '" ' . 'title="' . $lang->def('_RECIPIENTS') . ' : ' . $title . '">' . '<img src="' . getPathImage() . 'standard/moduser.png" alt="' . $lang->def('_RECIPIENTS') . ' : ' . $title . '" /></a>';
            $cont[] = '<a href="index.php?modname=internal_news&amp;op=modnews&amp;id_news=' . $id_news . '" ' . 'title="' . $lang->def('_MOD') . ' : ' . $title . '">' . '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . ' : ' . $title . '" /></a>';
            $cont[] = '<a href="index.php?modname=internal_news&amp;op=delnews&amp;id_news=' . $id_news . '" ' . 'title="' . $lang->def('_DEL') . ' : ' . $title . '">' . '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . ' : ' . $title . '" /></a>';
        }
        $tb->addBody($cont);
    }
    require_once _base_ . '/lib/lib.dialog.php';
    setupHrefDialogBox('a[href*=delnews]');
    if ($mod_perm) {
        $tb->addActionAdd('<a href="index.php?modname=internal_news&amp;op=addnews" title="' . $lang->def('_NEW') . '">' . '<img src="' . getPathImage() . 'standard/add.png" alt="' . $lang->def('_ADD') . '" />' . $lang->def('_NEW') . '</a>');
    }
    $out->add(getTitleArea($lang->def('_NEWS'), 'news') . '<div class="std_block">');
    if (isset($_GET['result'])) {
        switch ($_GET['result']) {
            case "ok":
                $out->add(getResultUi($lang->def('_OPERATION_SUCCESSFUL')));
                break;
            case "err":
                $out->add(getErrorUi($lang->def('_OPERATION_FAILURE')));
                break;
            case "err_del":
                $out->add(getErrorUi($lang->def('_OPERATION_FAILURE')));
                break;
        }
    }
    if ($mod_perm) {
        $form = new Form();
        $how_much = Get::sett('visuNewsHomePage');
        if (isset($_POST['save_homepage'])) {
            $query_how_news = "\r\n\t\t\tUPDATE " . $GLOBALS['prefix_lms'] . "_setting\r\n\t\t\tSET param_value = '" . abs((int) $_POST['howmuch']) . "'\r\n\t\t\tWHERE param_name = 'visuNewsHomePage'";
            if (sql_query($query_how_news)) {
                $how_much = abs((int) $_POST['howmuch']);
            }
        }
    }
    $out->add($tb->getTable() . $nav_bar->getNavBar($ini) . '</div>');
}
コード例 #20
0
ファイル: certificate.php プロジェクト: abhinay100/forma_app
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');
}
コード例 #21
0
ファイル: conference.php プロジェクト: abhinay100/forma_app
function conference_list(&$url)
{
    checkPerm('view');
    //$mod_perm = checkPerm('mod');
    $lang =& DoceboLanguage::createInstance('conference', 'lms');
    require_once _base_ . '/lib/lib.table.php';
    require_once $GLOBALS['where_scs'] . '/lib/lib.booking.php';
    $idCourse = $_SESSION['idCourse'];
    $conference = new Conference_Manager();
    $re_room = $conference->roomActive($_SESSION['idCourse'], fromDatetimeToTimestamp(date("Y-m-d H:i:s")));
    $room_number = $conference->totalRoom($re_room);
    if (checkPerm('mod', true)) {
        cout('<div class="yui-navset yui-navset-top tab_block">
			<ul class="yui-nav">
				<li class="first selected">
					<a href="index.php?modname=conference&amp;op=show">
						<em>' . Lang::t('_ACTIVE', 'conference') . '</em>
					</a>
				</li>
				<li>
					<a href="index.php?modname=conference&amp;op=history">
						<em>' . Lang::t('_HISTORY', 'conference') . '</em>
					</a>
				</li>
			</ul>
			<div class="yui-content">', 'content');
    } else {
        cout(getTitleArea($lang->def('_VIDEOCONFERENCE'), 'conference') . '<div class="std_block">', 'content');
    }
    if ($room_number == 0) {
        // no rooms
        $GLOBALS['page']->add('<b id="noroom">' . $lang->def('_NO_ROOM_AVAILABLE') . '</b>', 'content');
    } else {
        // list rooms active in this moment
        $tb = new Table(0, $lang->def('_ROOMS_AVAILABLE'), $lang->def('_SUMMARY_ROOM_AVAILABLE'));
        $cont_h = array($lang->def('_VIDEOCONFERENCE'), $lang->def('_START_DATE'), $lang->def('_MEETING_HOURS'), $lang->def('_ENTER'));
        $type_h = array('table_main_colum', 'align_center nowrap', 'align_center nowrap', 'align_center');
        if (checkPerm('mod', true)) {
            /*$cont_h[] = '';
            			$type_h[] = 'image';
            */
            $cont_h[] = '';
            $type_h[] = 'image';
            $cont_h[] = '';
            $type_h[] = 'image';
        }
        $tb->setColsStyle($type_h);
        $tb->addHead($cont_h);
        $acl_manager =& Docebo::user()->getAclManager();
        $display_name = Docebo::user()->getUserName();
        $u_info = $acl_manager->getUser(getLogUserId(), false);
        $user_email = $u_info[ACL_INFO_EMAIL];
        while ($room = $conference->nextRow($re_room)) {
            $room_id = $room["id"];
            $cont = array();
            $cont[] = $room["name"] . " (" . $room["room_type"] . ")";
            $start_date = Format::date(date("Y-m-d H:i:s", $room["starttime"]), 'datetime');
            $cont[] = $start_date;
            $cont[] = $room["meetinghours"];
            $now = time();
            /*$booking = new RoomBooking();
            
            			$user_booked = $booking->userIsBooked(getLogUserId(), $room["id"]);
            			$user_valid = $booking->userIsValid(getLogUserId(), $room["id"]);
            			$room_full = $booking->roomIsFull($room["id"]);
            
            			if ($room["endtime"]>=$now && $room["starttime"]<=$now && $user_booked && $user_valid)
            				$cont[]=$conference->getUrl($room["id"],$room["room_type"]);
            			elseif($user_booked && $user_valid)
            				$cont[] = $lang->def('_WAITING_START');
            			elseif($room_full)
            				$cont[] = $lang->def('_ROOM_FULL');
            			elseif($user_booked && !$user_valid)
            				$cont[] = $lang->def('_PENDING_VALIDATION');
            			elseif($room['bookable'])
            				$cont[]='<a href="index.php?modname=conference&amp;op=booking&id='.$room["id"].'">'.$lang->def('_BOOKING_CONFERENCE').'</a>';
            			elseif ($room["endtime"]>=$now && $room["starttime"]<=$now)
            				$cont[]=$conference->getUrl($room["id"],$room["room_type"]);
            			else
            				$cont[] = $lang->def('_WAITING_START');
            */
            $cont[] = $conference->getUrl($room["id"], $room["room_type"]);
            if (checkPerm('mod', true)) {
                if (getLogUserId() == $room["idSt"] && $room["room_type"] == 'teleskill') {
                    $cont[] = '<a href="index.php?modname=conference&amp;op=modconf&amp;id=' . $room["id"] . '" ' . 'title="' . $lang->def('_MOD') . ' : ' . strip_tags($room["name"]) . '"><img src="' . getPathImage() . '/standard/edit.png' . '" /></a>';
                } else {
                    $cont[] = '';
                }
                /*
                				if (getLogUserId()==$room["idSt"])
                					$cont[] =	'<a href="index.php?modname=conference&amp;op=modbooking&amp;id='.$room["id"].'" title="'.$lang->def('_MOD_BOOKING').' : '.strip_tags($room["name"]).'">'
                								.'<img src="'.getPathImage().'/standard/modadmin.gif" alt="'.$lang->def('_MOD_BOOKING').' : '.strip_tags($room["name"]).'">'
                								.'</a>';
                				else
                					$cont[] = '';
                */
                if (getLogUserId() == $room["idSt"]) {
                    $cont[] = '<a href="index.php?modname=conference&amp;op=delconf&id=' . $room["id"] . '" ' . 'title="' . $lang->def('_DEL') . ' : ' . strip_tags($room["name"]) . '"><img src="' . getPathImage() . '/standard/delete.png' . '" /></a>';
                } else {
                    $cont[] = '';
                }
            }
            $tb->addBody($cont);
        }
        // end while
        require_once _base_ . '/lib/lib.dialog.php';
        setupHrefDialogBox('a[href*=delconf]');
        $GLOBALS['page']->add($tb->getTable(), 'content');
    }
    // TODO : support for BBB is experimental - must be refined
    if (checkPerm('mod', true)) {
        cout('<br/><div class="table-container-below">', 'content');
        if (Get::sett('code_teleskill') or Get::sett('dimdim_server') and Get::sett('dimdim_user') and Get::sett('dimdim_password') or Get::sett('bbb_server') and Get::sett('bbb_user') and Get::sett('bbb_salt') and Get::sett('bbb_password_moderator') and Get::sett('bbb_password_viewer')) {
            if ($conference->can_create_user_limit(getLogUserId(), $idCourse, time())) {
                cout('<a class="ico-wt-sprite subs_add" href="' . $url->getUrl('op=startnewconf') . '"><span>' . $lang->def('_CREATE') . '</span></a>', 'content');
            } else {
                cout('<b>' . $lang->def('_NO_MORE_ROOM') . '</b>', 'content');
            }
        }
        cout('</div>', 'content');
    }
    if (checkPerm('mod', true)) {
        cout('<div class="nofloat"></div></div></div>', 'content');
    } else {
        cout('</div>', 'content');
    }
}
コード例 #22
0
ファイル: advice.php プロジェクト: abhinay100/forma_app
function archiveList()
{
    require_once _base_ . '/lib/lib.table.php';
    $lang =& DoceboLanguage::createInstance('advice');
    $mod_perm = checkPerm('mod', true);
    $out = $GLOBALS['page'];
    $out->setWorkingZone('content');
    $nav_bar = new NavBar('ini', Get::sett('visuItem'), 0, 'button');
    $ini = $nav_bar->getSelectedElement();
    $query_my_arch_advice = "\r\n\t\tSELECT DISTINCT idAdvice\r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_adviceuser\r\n\t\tWHERE idUser = '******' AND archivied = '1'";
    $re_my_arch_advice = sql_query($query_my_arch_advice);
    while (list($id) = sql_fetch_row($re_my_arch_advice)) {
        $advice_arch[] = $id;
    }
    if (!empty($advice_arch)) {
        $query_advice = "\r\n\t\t\tSELECT idAdvice, posted, title, description, important, author\r\n\t\t\tFROM " . $GLOBALS['prefix_lms'] . "_advice\r\n\t\t\tWHERE idCourse='" . $_SESSION['idCourse'] . "' AND idAdvice IN ( " . implode($advice_arch, ',') . " )\r\n\t\t\tORDER BY posted DESC\r\n\t\t\tLIMIT {$ini}," . Get::sett('visuItem');
        $re_advice = sql_query($query_advice);
        list($numofadvice) = sql_fetch_row(sql_query("\r\n\t\t\tSELECT COUNT(DISTINCT idAdvice)\r\n\t\t\tFROM " . $GLOBALS['prefix_lms'] . "_advice\r\n\t\t\tWHERE idCourse='" . $_SESSION['idCourse'] . "' AND idAdvice IN ( " . implode($advice_arch, ',') . " )"));
        $nav_bar->setElementTotal($numofadvice);
        if (isset($_GET['result'])) {
            switch ($_GET['result']) {
                case "ok":
                    $out->add(getResultUi($lang->def('_OPERATION_SUCCESSFUL')));
                    break;
                case "err":
                    $out->add(getErrorUi($lang->def('_ERR_INSERT')));
                    break;
                case "err_user":
                    $out->add(getErrorUi($lang->def('_OPERATION_FAILURE')));
                    break;
            }
        }
        while (list($idA, $posted, $title, $description, $impo, $author) = sql_fetch_row($re_advice)) {
            $out->add('<div class="list_block">' . '<h2 class="heading">');
            if ($impo) {
                $out->add('<img src="' . getPathImage() . 'standard/important.png" alt="' . $lang->def('_IMPORTANT') . '" /> ');
            } else {
                $out->add('');
            }
            $out->add($title . '</h2>' . '<div class="content"><p class="publish-date">' . Format::date($posted) . '</p>' . $description . '</div>' . '<div class="actions">');
            if ($mod_perm) {
                $out->add('<ul class="link_list_inline">' . '<li><a class="ico-wt-sprite subs_users" href="index.php?modname=advice&amp;op=modreader&amp;id_advice=' . $idA . '&amp;load=1" title="' . $lang->def('_VIEW_PERMISSION') . ' : ' . $title . '">' . '<span>' . $lang->def('_MOD') . '</span></a></li>' . '<li><a class="ico-wt-sprite subs_mod" href="index.php?modname=advice&amp;op=modadvice&amp;idAdvice=' . $idA . '" title="' . $lang->def('_MOD') . ' : ' . $title . '">' . '<span>' . $lang->def('_MOD') . '</span></a></li>' . '<li><a class="ico-wt-sprite subs_del" href="index.php?modname=advice&amp;op=deladvice&amp;idAdvice=' . $idA . '" title="' . $lang->def('_DEL') . ' : ' . $title . '">' . '<span>' . $lang->def('_DEL') . '</span></a></li>' . '</ul>');
                require_once _base_ . '/lib/lib.dialog.php';
                setupHrefDialogBox('a[href*=deladvice]');
            }
            $out->add('</div>' . '</div><br />');
        }
    }
    $form = new Form();
    $out->add($form->getHidden('archive_status', 'archive_status', '1') . $nav_bar->getNavBar($ini));
}
コード例 #23
0
ファイル: pcertificate.php プロジェクト: abhinay100/forma_app
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');
}
コード例 #24
0
ファイル: code.php プロジェクト: abhinay100/forma_app
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>');
}
コード例 #25
0
ファイル: transaction.php プロジェクト: abhinay100/forma_app
function transaction()
{
    require_once _base_ . '/lib/lib.table.php';
    require_once _base_ . '/lib/lib.form.php';
    require_once _base_ . '/lib/lib.dialog.php';
    YuiLib::load();
    $lang =& DoceboLanguage::createInstance('transaction');
    $acl_man = Docebo::user()->getAclManager();
    $man_transaction = new Man_Transaction();
    cout(getTitleArea($lang->def('_TRANSACTION')) . '<div class="std_block">');
    $tb = new Table(Get::sett('visuItem'), $lang->def('_TRANSACTION_TABLE'), $lang->def('_TRANSACTION_TABLE'));
    $tb->initNavBar('ini', 'button');
    $tb->setLink('index.php?modname=transaction&amp;op=transaction');
    $page = ($tb->getSelectedPage() - 1) * Get::sett('visuItem');
    $status_filter = Get::req('payment_status', DOTY_INT, '-2');
    $course_filter = Get::req('course_status', DOTY_INT, '-2');
    $tran_filter = Get::req('tran', DOTY_MIXED, '');
    $display = false;
    if ($status_filter != -2) {
        $display = true;
    }
    if ($course_filter != -2) {
        $display = true;
    }
    $transactions = $man_transaction->getTransaction($page, $status_filter == '-2' ? false : $status_filter, $course_filter == '-2' ? false : $course_filter, $tran_filter);
    $tot_transaction = $man_transaction->getTotTransaction($status_filter == '-2' ? false : $status_filter, $course_filter == '-2' ? false : $course_filter, $tran_filter);
    if (count($transactions) > 0 || $display) {
        $mod_img = '<img src="' . getPathImage() . '/standard/edit.png" title="' . $lang->def('_MOD') . '" alt="' . $lang->def('_MOD') . '" />';
        $del_img = '<img src="' . getPathImage() . '/standard/delete.png" title="' . $lang->def('_DEL') . '" alt="' . $lang->def('_DEL') . '" />';
        $cont_h = array($lang->def('_USER'), $lang->def('_DATE'), $lang->def('_COURSE_PRIZE'), $lang->def('_PAYMENT_METHOD'), $lang->def('_PAYMENT_STATUS'), $lang->def('COURSE_STATUS'), $mod_img, $del_img);
        $type_h = array('', '', '', '', 'image', 'image', 'image', 'image');
        $tb->setColsStyle($type_h);
        $tb->addHead($cont_h);
        foreach ($transactions as $transaction_info) {
            if ($transaction_info['firstname'] !== '' && $transaction_info['lastname'] !== '') {
                $user = $transaction_info['firstname'] . ' ' . $transaction_info['lastname'] . ' (' . $acl_man->relativeId($transaction_info['userid']) . ')';
            } elseif ($transaction_info['firstname'] !== '') {
                $user = $transaction_info['firstname'] . ' (' . $acl_man->relativeId($transaction_info['userid']) . ')';
            } elseif ($transaction_info['lastname'] !== '') {
                $user = $transaction_info['lastname'] . ' (' . $acl_man->relativeId($transaction_info['userid']) . ')';
            } else {
                $user = $acl_man->relativeId($transaction_info['userid']);
            }
            switch ($transaction_info['payment_status']) {
                case '-1':
                    $payment_status = '<img src="' . getPathImage() . '/standard/dot_red.gif" alt="' . $lang->def('_CANCELLED') . '" title="' . $lang->def('_CANCELLED') . '" />';
                    break;
                case '0':
                    $payment_status = '<img src="' . getPathImage() . '/standard/dot_grey.gif" alt="' . $lang->def('_WAITING_PAYMENT') . '" title="' . $lang->def('_WAITING_PAYMENT') . '" />';
                    break;
                case '1':
                    $payment_status = '<img src="' . getPathImage() . '/standard/dot_yellow.gif" alt="' . $lang->def('_PARTIAL_PAID') . '" title="' . $lang->def('_PARTIAL_PAID') . '" />';
                    break;
                case '2':
                    $payment_status = '<img src="' . getPathImage() . '/standard/dot_green.gif" alt="' . $lang->def('_PAID') . '" title="' . $lang->def('_PAID') . '" />';
                    break;
            }
            switch ($transaction_info['course_status']) {
                case '-1':
                    $course_status = '<img src="' . getPathImage() . '/standard/dot_red.gif" alt="' . $lang->def('_CANCELLED') . '" title="' . $lang->def('_CANCELLED') . '" />';
                    break;
                case '0':
                    $course_status = '<img src="' . getPathImage() . '/standard/dot_grey.gif" alt="' . $lang->def('_NO_COURSE_ACTIVATED') . '" title="' . $lang->def('_NO_COURSE_ACTIVATED') . '" />';
                    break;
                case '1':
                    $course_status = '<img src="' . getPathImage() . '/standard/dot_yellow.gif" alt="' . $lang->def('_SOME_COURSE_ACTIVATED') . '" title="' . $lang->def('_SOME_COURSE_ACTIVATED') . '" />';
                    break;
                case '2':
                    $course_status = '<img src="' . getPathImage() . '/standard/dot_green.gif" alt="' . $lang->def('_ALL_COURSE_ACTIVATED') . '" title="' . $lang->def('_ALL_COURSE_ACTIVATED') . '" />';
                    break;
            }
            $tb->addBody(array($user, Format::date($transaction_info['date']), $transaction_info['price'], $lang->def('_' . strtoupper($transaction_info['method'])), $payment_status, $course_status, '<a href="index.php?modname=transaction&amp;op=mod&amp;id=' . $transaction_info['id_transaction'] . '">' . $mod_img . '</a>', '<a href="index.php?modname=transaction&amp;op=del&amp;id=' . $transaction_info['id_transaction'] . '">' . $del_img . '</a>'));
        }
        $array_payment_status = array('-2' => $lang->def('_ALL_STATUS'), '-1' => $lang->def('_CANCELLED'), '0' => $lang->def('_WAITING_PAYMENT'), '1' => $lang->def('_PARTIAL_PAID'), '2' => $lang->def('_PAID'));
        $array_course_status = array('-2' => $lang->def('_ALL_STATUS'), '-1' => $lang->def('_CANCELLED'), '0' => $lang->def('_NO_COURSE_ACTIVATED'), '1' => $lang->def('_SOME_COURSE_ACTIVATED'), '2' => $lang->def('_ALL_COURSE_ACTIVATED'));
        cout(Form::openForm('transaction_filter', 'index.php?modname=transaction&amp;op=transaction') . $tb->getNavBar($page, $tot_transaction) . '<div class="quick_search_form">' . Form::getInputTextfield('search_t', 'tran', 'tran', $tran_filter, '', 255, '') . Form::getButton("filter", "filter", $lang->def('_FILTER'), "search_b") . '<br />' . '<a class="advanced_search" href="javascript:;" onclick="( this.nextSibling.style.display != \'block\' ?  this.nextSibling.style.display = \'block\' : this.nextSibling.style.display = \'none\' );">' . $lang->def("_ADVANCED_SEARCH") . '</a>' . '<div class="overlay_menu" style="display:' . ($display ? 'block' : 'none') . '">' . Form::getDropdown($lang->def('_PAYMENT_STATUS_FILTER'), 'payment_status', 'payment_status', $array_payment_status, $status_filter) . Form::getDropdown($lang->def('_COURSE_STATUS_FILTER'), 'course_status', 'course_status', $array_course_status, $course_filter) . '</div>' . '</div>' . '<script type="text/javascript">' . 'var payment_status = YAHOO.util.Dom.get(\'payment_status\');' . 'var course_status = YAHOO.util.Dom.get(\'course_status\');' . 'var form = YAHOO.util.Dom.get(\'transaction_filter\');' . 'YAHOO.util.Event.on(payment_status, \'change\', function() { this.submit() } , form, true);' . 'YAHOO.util.Event.on(course_status, \'change\', function() { this.submit() } , form, true);' . '</script>' . $tb->getTable() . $tb->getNavBar($page, $tot_transaction) . Form::closeForm());
        setupHrefDialogBox('a[href*=del]');
    } else {
        cout(Lang::t('_NO_CONTENT', 'transaction'));
    }
    cout('</div>');
}
コード例 #26
0
ファイル: coursepath.php プロジェクト: abhinay100/forma_app
 function pathlist()
 {
     checkPerm('view');
     require_once _base_ . '/lib/lib.table.php';
     $out =& $GLOBALS['page'];
     $lang =& DoceboLanguage::createInstance('coursepath', 'lms');
     $acl_man =& Docebo::user()->getAclManager();
     $subscribe_perm = checkPerm('subscribe', true);
     $mod_perm = checkPerm('mod', true);
     $del_perm = checkPerm('mod', true);
     if (Get::cfg('demo_mode')) {
         $del_perm = false;
     }
     $query_pathlist = "\r\n\tSELECT id_path, path_code, path_name, path_descr\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_coursepath ";
     if (Docebo::user()->getUserLevelId() != ADMIN_GROUP_GODADMIN) {
         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;
         }
         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;
             }
         } else {
             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_coursepath = $cat_man->getCatalogueCoursepath($id_cat, true);
                     $admin_courses['coursepath'] = array_merge($admin_courses['coursepath'], $catalogue_coursepath);
                 }
             }
         }
         if ($all_courses) {
             $query_pathlist .= "WHERE 1 ";
         } elseif (empty($admin_courses['coursepath'])) {
             $query_pathlist = "WHERE 0";
         } else {
             $query_pathlist .= "WHERE id_path IN (" . implode(',', $admin_courses['coursepath']) . ") ";
         }
     }
     $query_pathlist .= " ORDER BY path_name ";
     $re_pathlist = sql_query($query_pathlist);
     // find subscriptions
     $subscriptions = array();
     $query_subcription = "\r\n\tSELECT id_path, COUNT(idUser), SUM(waiting)\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_coursepath_user\r\n\tGROUP BY id_path";
     if (Docebo::user()->getUserLevelId() != ADMIN_GROUP_GODADMIN) {
         require_once _base_ . '/lib/lib.preference.php';
         $adminManager = new AdminPreference();
         $admin_tree = $adminManager->getAdminTree(Docebo::user()->getIdST());
         $admin_users = $acl_man->getAllUsersFromIdst($admin_tree);
         if (!empty($admin_users)) {
             $query_subcription .= " AND idUser IN (" . implode(',', $admin_users) . ")";
         } else {
             $query_subcription .= " AND idUser = 0";
         }
     }
     $re_subscription = sql_query($query_subcription);
     while (list($id_path, $users, $waitings) = sql_fetch_row($re_subscription)) {
         $subscriptions[$id_path]['users'] = $users - $waitings;
         $subscriptions[$id_path]['waiting'] = $waitings;
     }
     $out->setWorkingZone('content');
     $out->add(getTitleArea($lang->def('_COURSEPATH'), 'coursepath') . '<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;
         }
     }
     $tb_path = new Table(0, $lang->def('_COURSE_PATH_CAPTION'), $lang->def('_COURSE_PATH_CAPTION'));
     $cont_h = array($lang->def('_CODE'), $lang->def('_NAME'), $lang->def('_DESCRIPTION'));
     $type_h = array('course_code', '', '');
     // $subscribe_perm = false;
     $cont_h[] = '<img src="' . getPathImage() . 'standard/moduser.png" alt="' . $lang->def('_SUBSCRIBE') . '" />';
     $type_h[] = 'image';
     $cont_h[] = '<img src="' . getPathImage() . 'standard/modelem.png" alt="' . $lang->def('_COURSES') . '" />';
     $type_h[] = 'image';
     if ($mod_perm) {
         $cont_h[] = '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . '" />';
         $type_h[] = 'image';
     }
     if ($del_perm) {
         $cont_h[] = '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . '" />';
         $type_h[] = 'image';
     }
     $tb_path->setColsStyle($type_h);
     $tb_path->addHead($cont_h);
     while (list($id_path, $path_code, $path_name, $path_descr) = sql_fetch_row($re_pathlist)) {
         $cont = array($path_code, $path_name, $path_descr);
         if ($subscribe_perm) {
             $url_subscribe = 'index.php?r=alms/subscription/show_coursepath&id_path=' . (int) $id_path;
             $cont[] = '<a href="' . $url_subscribe . '" ' . 'title="' . $lang->def('_SUBSCRIBE') . ' : ' . $path_name . '">' . (isset($subscriptions[$id_path]['users']) ? $subscriptions[$id_path]['users'] . ' ' : '') . '<img src="' . getPathImage() . 'standard/moduser.png" alt="' . $lang->def('_SUBSCRIBE') . ' : ' . $path_name . '" /></a>';
             $cont[] = '<a href="index.php?modname=coursepath&amp;op=pathelem&amp;id_path=' . $id_path . '" ' . 'title="' . $lang->def('_MOD') . ' : ' . $path_name . '">' . '<img src="' . getPathImage() . 'standard/modelem.png" alt="' . $lang->def('_COURSES') . ' : ' . $path_name . '" /></a>';
         } else {
             $cont[] = isset($subscriptions[$id_path]['users']) ? $subscriptions[$id_path]['users'] . ' ' : '';
             $cont[] = '<a href="index.php?modname=coursepath&amp;op=pathelem&amp;id_path=' . $id_path . '" ' . 'title="' . $lang->def('_MOD') . ' : ' . $path_name . '">' . '<img src="' . getPathImage() . 'standard/modelem.png" alt="' . $lang->def('_MOD') . ' : ' . $path_name . '" /></a>';
         }
         if ($mod_perm) {
             $cont[] = '<a href="index.php?modname=coursepath&amp;op=modcoursepath&amp;id_path=' . $id_path . '" ' . 'title="' . $lang->def('_MOD') . ' : ' . $path_name . '">' . '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . ' : ' . $path_name . '" /></a>';
         }
         if ($del_perm) {
             $cont[] = '<a href="index.php?modname=coursepath&amp;op=deletepath&amp;id_path=' . $id_path . '" ' . 'title="' . $lang->def('_DEL') . ' : ' . $path_name . '">' . '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . ' : ' . $path_name . '" /></a>';
         }
         $tb_path->addBody($cont);
     }
     require_once _base_ . '/lib/lib.dialog.php';
     setupHrefDialogBox('a[href*=deletepath]');
     if ($mod_perm) {
         $tb_path->addActionAdd('<a href="index.php?modname=coursepath&amp;op=newcoursepath" title="' . $lang->def('_ADD') . '">' . '<img src="' . getPathimage() . 'standard/add.png" alt="' . $lang->def('_ADD') . '" />' . $lang->def('_ADD') . '</a>');
     }
     $out->add($tb_path->getTable());
     $out->add('</div>');
 }