Example #1
0
 function modglossarygui($object_glos = NULL)
 {
     checkPerm('view', false, 'storage');
     $lang =& DoceboLanguage::createInstance('glossary');
     require_once _base_ . '/lib/lib.table.php';
     $tableGlossary = new Table(Get::sett('visuItem'), '', $lang->def('_GLOSSARY_SUMMARY'));
     $tableGlossary->initNavBar('ini', 'link');
     $ini = $tableGlossary->getSelectedElement();
     $back_coded = htmlentities(urlencode($object_glos->back_url));
     list($title) = sql_fetch_row(sql_query("\r\n\tSELECT title\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_glossary \r\n\tWHERE idGlossary = '" . $object_glos->getId() . "'"));
     $reTerm = sql_query("\r\n\tSELECT idTerm, term \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_glossaryterm \r\n\tWHERE idGlossary = '" . $object_glos->getId() . "' \r\n\tORDER BY term \r\n\tLIMIT {$ini}," . Get::sett('visuItem'));
     list($num_of_term) = sql_fetch_row(sql_query("\r\n\tSELECT COUNT(*) \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_glossaryterm\r\n\tWHERE idGlossary = '" . $object_glos->getId() . "'"));
     if ($title == '') {
         $_SESSION['last_error'] = $lang->def('_FILEUNSPECIFIED');
         Util::jump_to(Util::str_replace_once('&', '&', $object_glos->back_url) . '&create_result=0');
     }
     $GLOBALS['page']->add(getTitleArea($lang->def('_GLOSSARY'), 'glossary', $lang->def('_GLOSSARY')) . '<div class="std_block">' . getBackUi(Util::str_replace_once('&', '&amp;', $object_glos->back_url) . '&amp;mod_result=0', $lang->def('_BACK')) . '<b>' . $lang->def('_GLOSSARY') . ' : ' . $title . '</b><br /><br />' . '<div class="mod_container">' . '<a href="index.php?modname=glossary&amp;op=modglossary&amp;idGlossary=' . $object_glos->getId() . '&amp;back_url=' . $back_coded . '" title="' . $lang->def('_MOD_TITLE') . '">' . '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . '" /> ' . $lang->def('_MOD_TITLE') . '</a>' . '</div><br />', 'content');
     $contentArray = array($lang->def('_TERM'), '<img src="' . getPathImage() . 'standard/edit.png" title="' . $lang->def('_MOD') . '" alt="' . $lang->def('_MOD') . '" />', '<img src="' . getPathImage() . 'standard/delete.png" title="' . $lang->def('_DEL') . '" alt="' . $lang->def('_DEL') . '" />');
     $typeArray = array('', 'image', 'image');
     $GLOBALS['page']->add($tableGlossary->addHead($contentArray, $typeArray));
     while (list($idTerm, $term) = sql_fetch_row($reTerm)) {
         $content = array($term, '<a href="index.php?modname=glossary&amp;op=modterm&amp;idTerm=' . $idTerm . '&amp;back_url=' . $back_coded . '" title="' . $lang->def('_MOD') . '">' . '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . '" /></a>', '<a href="index.php?modname=glossary&amp;op=delterm&amp;idTerm=' . $idTerm . '&amp;back_url=' . $back_coded . '" title="' . $lang->def('_DEL') . '">' . '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . '" /></a>');
         $tableGlossary->addBody($content);
     }
     $tableGlossary->addActionAdd('<a href="index.php?modname=glossary&amp;op=addterm&amp;idGlossary=' . $object_glos->getId() . '&amp;back_url=' . $back_coded . '" title="' . $lang->def('_ADDTERM') . '">' . '<img src="' . getPathImage() . 'standard/add.png" alt="' . $lang->def('_ADD') . '" /> ' . $lang->def('_ADDTERM') . '</a>');
     $tableGlossary->setLink('index.php?modname=glossary&amp;op=modglossarygui' . '&amp;idGlossary=' . $object_glos->getId() . '&amp;back_url=' . $back_coded);
     $GLOBALS['page']->add($tableGlossary->getTable() . $tableGlossary->getNavBar($ini, $num_of_term) . '</div>', 'content');
 }
Example #2
0
    function notes()
    {
        checkPerm('view');
        require_once _base_ . '/lib/lib.table.php';
        $lang =& DoceboLanguage::createInstance('notes', 'lms');
        $nav_bar = new NavBar('ini', Get::sett('visuItem'), 0);
        $ini = $nav_bar->getSelectedElement();
        $ord = importVar('ord');
        $inv = importVar('inv');
        switch ($ord) {
            case "tit":
                $ord = $order = 'title';
                if ($inv != 'y') {
                    $a_down = '&amp;inv=y';
                } else {
                    $order .= ' DESC';
                    $a_down = '';
                }
                break;
            default:
                $ord = $order = 'data';
                if ($inv == 'y') {
                    $a_down = '';
                } else {
                    $order .= ' DESC';
                    $a_down = '&amp;inv=y';
                }
        }
        $reNotes = sql_query("\r\n\tSELECT idNotes, data, title \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_notes \r\n\tWHERE owner ='" . getLogUserId() . "' AND idCourse='" . $_SESSION['idCourse'] . "' \r\n\tORDER BY {$order} \r\n\tLIMIT {$ini}," . Get::sett('visuItem'));
        list($num_notes) = sql_fetch_row(sql_query("SELECT COUNT(*) \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_notes \r\n\tWHERE owner ='" . getLogUserId() . "' AND idCourse='" . $_SESSION['idCourse'] . "' "));
        $nav_bar->setElementTotal($num_notes);
        $img_up = '<img class="valing-middle" src="' . getPathImage() . 'standard/up_arrow.png" alt="' . $lang->def('_UP') . '"/>';
        $img_down = '<img class="valing-middle" src="' . getPathImage() . 'standard/down_arrow.png" alt="' . $lang->def('_DOWN') . '"/>';
        $tb = new Table(Get::sett('visuItem'), $lang->def('_NOTES'), $lang->def('_NOTES'));
        $contentH = array(($ord == 'data' ? $inv == 'y' ? $img_up : $img_down : '') . '<a href="index.php?modname=notes&amp;op=notes' . $a_down . '"> ' . $lang->def('_DATE') . '</a>', ($ord == 'title' ? $inv == 'y' ? $img_up : $img_down : '') . '<a href="index.php?modname=notes&amp;op=notes&amp;ord=tit' . $a_down . '">' . $lang->def('_TITLE') . '</a>', '<img src="' . getPathImage() . 'standard/edit.png" title="' . $lang->def('_MOD') . '" alt="' . $lang->def('_MOD') . '" />', '<img src="' . getPathImage() . 'standard/delete.png" title="' . $lang->def('_DEL') . '" alt="' . $lang->def('_DEL') . '" />');
        $typeH = array('min-cell', '', 'image', 'image');
        $tb->setColsStyle($typeH);
        $tb->addHead($contentH);
        while (list($idNotes, $data, $title) = sql_fetch_row($reNotes)) {
            $content = array(Format::date($data), '<a href="index.php?modname=notes&amp;op=displaynotes&amp;idNotes=' . $idNotes . '" title="' . $lang->def('_MORET') . '">' . $title . '</a>', '<a href="index.php?modname=notes&amp;op=modnotes&amp;idNotes=' . $idNotes . '">
				<img src="' . getPathImage() . 'standard/edit.png" title="' . $lang->def('_MOD') . '" alt="' . $lang->def('_MOD') . '" /></a>', '<a id="delnotes_' . $idNotes . '"' . ' href="index.php?modname=notes&amp;op=delnotes&amp;idNotes=' . $idNotes . '"' . ' title="' . $lang->def('_TITLE') . ' : ' . strip_tags(str_replace(array('"', "'"), '', $title)) . '">
				<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . '" /></a>');
            $tb->addBody($content);
        }
        $tb->addActionAdd('<a href="index.php?modname=notes&amp;op=addnotes">' . '<img src="' . getPathImage() . 'standard/add.png" title="' . $lang->def('_ADD') . '" alt="' . $lang->def('_ADD') . '" /> ' . $lang->def('_ADD_NOTES') . '</a>');
        $GLOBALS['page']->add(getTitleArea(array($lang->def('_NOTES')), 'notes') . '<div class="std_block">', 'content');
        if (isset($_POST['result'])) {
            switch ($_POST['result']) {
                case "ok":
                    $GLOBALS['page']->add(getResultUi($lang->def('_OPERATION_SUCCESSFUL')), 'content');
                case "err":
                    $GLOBALS['page']->add(getErrorUi($lang->def('_OPERATION_FAILURE')), 'content');
            }
        }
        $GLOBALS['page']->add($tb->getTable() . $nav_bar->getNavBar($ini), 'content');
        require_once _base_ . '/lib/lib.dialog.php';
        setupHrefDialogBox('a[href*=delnotes]');
        $GLOBALS['page']->add('</div>', 'content');
    }
Example #3
0
function fileList(&$url)
{
    checkPerm('view');
    require_once _base_ . '/lib/lib.tab.php';
    require_once _base_ . '/lib/lib.table.php';
    require_once _base_ . '/lib/lib.form.php';
    $file_man = new MyFile(getLogUserId());
    $tab_man = new TabView('myfiles', '');
    $lang =& DoceboLanguage::createInstance('myfiles');
    $areas = $file_man->getFilesAreas();
    while (list($id_page, $area_name) = each($areas)) {
        $new_tab = new TabElemDefault($id_page, $lang->def($area_name), getPathImage('fw') . 'myfiles/' . $id_page . '.gif');
        $tab_man->addTab($new_tab);
    }
    $tab_man->parseInput($_POST, $_SESSION);
    $active_tab = $tab_man->getActiveTab();
    if (!$active_tab) {
        $active_tab = importVar('working_area', false, $file_man->getDefaultArea());
        $tab_man->setActiveTab($active_tab);
    }
    $GLOBALS['page']->addStart(Form::openForm('tab_myfiles', $url->getUrl('op=myfiles')) . Form::getHidden('working_area', 'working_area', $active_tab) . $tab_man->printTabView_Begin('', false), 'content');
    $GLOBALS['page']->addEnd($tab_man->printTabView_End() . Form::closeForm(), 'content');
    $tb = new Table(0, $lang->def('_MYFILES_CAPTION'), $lang->def('_MYFILES_SUMMARY'));
    $cont_h = array($lang->def('_TITLE'), $lang->def('_FILE_POLICY'), '<img src="' . getPathImage() . 'standard/edit.png" title="' . $lang->def('_MOD') . '" alt="' . $lang->def('_MOD') . '" />', '<img src="' . getPathImage() . 'standard/delete.png" title="' . $lang->def('_REM_FILE') . '" alt="' . $lang->def('_DEL') . '" />');
    $type_h = array('', 'image nowrap', 'image', 'image');
    $tb->setColsStyle($type_h);
    $tb->addHead($cont_h);
    $re_files = $file_man->getFileList($active_tab, false, MYFILE_TITLE);
    while ($file_info = $file_man->fetch_row($re_files)) {
        $cont = array($file_info[MYFILE_TITLE]);
        switch ($file_info[MYFILE_POLICY]) {
            case MF_POLICY_FREE:
                $cont[] = $lang->def('_MF_POLICY_FREE');
                break;
            case MF_POLICY_TEACHER:
                $cont[] = $lang->def('_MF_POLICY_TEACHER');
                break;
            case MF_POLICY_FRIENDS:
                $cont[] = $lang->def('_MF_POLICY_FRIENDS');
                break;
            case MF_POLICY_TEACHER_AND_FRIENDS:
                $cont[] = $lang->def('_MF_POLICY_TEACHER_AND_FRIENDS');
                break;
            case MF_POLICY_NOONE:
                $cont[] = $lang->def('_MF_POLICY_NOONE');
                break;
        }
        $cont[] = '<a href="' . $url->getUrl('op=modfiles&working_area=' . $active_tab . '&id_file=' . $file_info[MYFILE_ID_FILE]) . '">' . '<img src="' . getPathImage() . 'standard/edit.png" title="' . $lang->def('_MOD') . ' : ' . $file_info[MYFILE_TITLE] . '" alt="' . $lang->def('_MOD') . '" />' . '</a>';
        $cont[] = '<a href="' . $url->getUrl('op=delfiles&id_file=' . $file_info[MYFILE_ID_FILE]) . '">' . '<img src="' . getPathImage() . 'standard/delete.png" title="' . $lang->def('_REM_FILE') . ' : ' . $file_info[MYFILE_TITLE] . '" alt="' . $lang->def('_DEL') . '" />' . '</a>';
        $tb->addBody($cont);
    }
    $tb->addActionAdd('<p class="new_elem_link"><a href="' . $url->getUrl('op=modfiles&working_area=' . $active_tab) . '">' . $lang->def('_ADD_' . $active_tab) . '</a></p>');
    $tb->addActionAdd('<p>' . '<a href="' . $url->getUrl('modname=profile&op=profile&id_user='******'&ap=view_files&type=' . $active_tab . '&from=1') . '">' . '<img src="' . getPathImage('fw') . 'myfiles/' . $active_tab . '.gif" title="' . $lang->def($active_tab) . '" alt="' . $lang->def('_VIEW_' . $active_tab) . '" />' . '</a>' . '<a href="' . $url->getUrl('modname=profile&op=profile&id_user='******'&ap=view_files&type=' . $active_tab . '&from=1') . '">' . $lang->def('_VIEW_' . $active_tab) . '</a></p>');
    $GLOBALS['page']->add($tb->getTable(), 'content');
}
 /**
  * Gets the corresponding table of a source
  *
  * @param $sourceId
  * @return null|Table
  */
 public static function getTableOf($sourceId)
 {
     try {
         $dataTableEntry = ipDb()->selectRow(self::DATA_TABLE_REPOSITORY, '*', array('sourceId' => $sourceId));
         if ($dataTableEntry == null) {
             return null;
         }
         return Table::getTable(json_decode($dataTableEntry['tableMetaData'], true));
     } catch (\Ip\Exception\Db $e) {
         ipLog()->error("Could not get table of {$sourceId}. Message:" . $e->getMessage());
     }
     return null;
 }
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');
}
Example #6
0
 function listroom()
 {
     require_once _base_ . '/lib/lib.table.php';
     $lang =& DoceboLanguage::createInstance('admin_config', 'scs');
     $out =& $GLOBALS['page'];
     $mod_perm = checkPerm('mod', true);
     $out->setWorkingZone('content');
     $out->add(getTitleArea($lang->def('_ROOM_MAN'), 'admin_conf') . '<div class="std_block">');
     $tb_room = new Table(0, $lang->def('_ALL_ROOMS'), $lang->def('_ALL_ROOMS_SUMMARY'));
     $cont_h = array($lang->def('_ROOM_NAME'), $lang->def('_ROOM_TYPE'));
     $type_h = array('', 'align_center');
     if ($mod_perm) {
         $cont_h[] = '<img src="' . getPathImage('fw') . 'standard/edit.png" alt="' . $lang->def('_MOD') . '" />';
         $type_h[] = 'image';
         $cont_h[] = '<img src="' . getPathImage('fw') . 'standard/delete.png" alt="' . $lang->def('_DEL') . '" />';
         $type_h[] = 'image';
     }
     $tb_room->setColsStyle($type_h);
     $tb_room->addHead($cont_h);
     $query_rooms = "\r\n\tSELECT id_room, room_name, room_type \r\n\tFROM " . $GLOBALS['prefix_scs'] . "_rules_room ";
     $re_rooms = sql_query($query_rooms);
     while (list($id_room, $room_name, $room_type) = sql_fetch_row($re_rooms)) {
         $cont = array($room_name);
         switch ($room_type) {
             case "course":
                 $cont[] = $lang->def('_COURSE');
                 break;
             case "private":
                 $cont[] = $lang->def('_PRIVATE');
                 break;
             case "public":
                 $cont[] = $lang->def('_PUBLIC');
                 break;
         }
         if ($mod_perm) {
             $cont[] = '<a href="index.php?modname=room&amp;op=modroom&amp;id_room=' . $id_room . '"' . ' title="' . $lang->def('_MOD') . ' : ' . $room_name . '">' . '<img src="' . getPathImage('fw') . 'standard/edit.png" alt="' . $lang->def('_MOD') . ' : ' . $room_name . '" /></a>';
             $cont[] = '<a href="index.php?modname=room&amp;op=delroom&amp;id_room=' . $id_room . '"' . ' title="' . $lang->def('_DEL') . ' : ' . $room_name . '">' . '<img src="' . getPathImage('fw') . 'standard/delete.png" alt="' . $lang->def('_DEL') . ' : ' . $room_name . '" /></a>';
         }
         $tb_room->addBody($cont);
     }
     if ($mod_perm) {
         $tb_room->addActionAdd('<a href="index.php?modname=room&amp;op=newroom">' . '<img src="' . getPathImage('fw') . 'standard/add.png" alt="' . $lang->def('_NEW_ROOM') . '" />' . '&nbsp;' . $lang->def('_NEW_ROOM') . '</a>');
     }
     $out->add($tb_room->getTable());
     $out->add('</div>');
 }
 /**
  * Changes an array of pagenames into a table with "edit", "view" and "delete" options
  */
 protected function createPageList($data)
 {
     $this->setState('CREATING_PAGE_LIST_TABLE');
     //Create new Table item
     $t = new Table();
     //Create new Table
     $t->createTable("Pagelist");
     //Sets that there is no heading row.
     $t->setHead(false);
     //Loop Through each page
     for ($i = 0; $i < count($data); $i++) {
         //Add Page data for each row.
         $t->addRow(array($data[$i], "<a href='?system=Editor&page=editor&active=" . $data[$i] . "'>" . $this->localize("Edit") . "</a>", "<a href='?page=" . $data[$i] . "'>" . $this->localize("View") . "</a>", "<a href='?system=Editor&page=delete&active=" . $data[$i] . "'>" . $this->localize("Delete") . "</a>"));
     }
     //Creates a table from inserted data
     $t->runTable();
     //Returns the created table.
     return $t->getTable();
 }
Example #8
0
function mycompetences(&$url)
{
    checkPerm('view');
    $html = "";
    $html .= getTitleArea(Lang::t('_COMPETENCES'), 'competences');
    $html .= '<div class="std_block">';
    $cmodel = new CompetencesAdm();
    $fmodel = new FunctionalrolesAdm();
    $id_user = getLogUserId();
    $ucomps = $cmodel->getUserCompetences($id_user);
    $rcomps = $fmodel->getUserRequiredCompetences($id_user);
    $ucomps_info = $cmodel->getCompetencesInfo(array_keys($ucomps));
    $language = getLanguage();
    $_typologies = $cmodel->getCompetenceTypologies();
    $_types = $cmodel->getCompetenceTypes();
    $icon_actv = '<span class="ico-sprite subs_actv"><span>' . Lang::t('_COMPETENCE_OBTAINED', 'competences') . '</span></span>';
    $icon_req = '<span class="ico-sprite subs_actv"><span>' . Lang::t('_MANDATORY', 'competences') . '</span></span>';
    //*******************
    require_once _base_ . '/lib/lib.table.php';
    $table = new Table(Get::sett('visuItem'), Lang::t('_COMPETENCES'), Lang::t('_COMPETENCES'));
    $style_h = array('', '', 'image', 'image', 'image', 'image', 'image');
    $label_h = array(Lang::t('_NAME', 'competences'), Lang::t('_TYPOLOGY', 'competences'), Lang::t('_TYPE', 'standard'), Lang::t('_SCORE', 'competences'), Lang::t('_DATE_LAST_COMPLETE', 'subscribe'), Lang::t('_COMPETENCES_REQUIRED', 'competences'));
    $table->addHead($label_h, $style_h);
    foreach ($ucomps_info as $id_competence => $cinfo) {
        $line = array();
        $line[] = $cinfo->langs[$language]['name'];
        $line[] = $_typologies[$cinfo->typology];
        $line[] = $_types[$cinfo->type];
        $line[] = $cinfo->type == 'score' ? '<b>' . $ucomps[$id_competence]->score_got . '</b>' : $icon_actv;
        $line[] = Format::date($ucomps[$id_competence]->last_assign_date, 'datetime');
        $line[] = array_key_exists($id_competence, $rcomps) ? $icon_req : '';
        $table->addBody($line);
    }
    $html .= $table->getTable();
    $html .= '</div>';
    $html .= Form::openForm('beck_url', 'index.php');
    $html .= Form::openButtonSpace();
    $html .= Form::getButton('close', 'close', Lang::t('_CLOSE', 'standard'));
    $html .= Form::closeButtonSpace();
    $html .= Form::closeform();
    cout($html, 'content');
}
Example #9
0
 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;
 }
 /**
  * Changes an array of pagenames into a table with "edit", "view" and "delete" options
  */
 protected function createUsersList($data)
 {
     // Set the state and tell plugins.
     $this->setState('CREATING_USER_TABLE');
     $this->notifyObservers();
     //Create new Table item
     $t = new Table();
     //Create new Table
     $t->createTable("Userslist");
     //Sets intial row as headings
     $t->setHead(false);
     //Loop Through each page
     for ($i = 0; $i < count($data); $i++) {
         //Add Page data for each row.
         $t->addRow(array($data[$i], "<a href='?system=Users&page=edit&active=" . $data[$i] . "'>" . $this->localize("Edit") . "</a>", "<a href='?system=Users&page=delete&active=" . $data[$i] . "'>" . $this->localize("Delete") . "</a>"));
     }
     //Creates a table from inserted data
     $t->runTable();
     //Returns the created table.
     return $t->getTable();
 }
Example #11
0
 function modlinkgui($object_link)
 {
     checkPerm('view', false, 'storage');
     $lang =& DoceboLanguage::createInstance('link');
     require_once _base_ . '/lib/lib.table.php';
     $del_perm = checkPerm('view', false, 'storage');
     $back_coded = htmlentities(urlencode($object_link->back_url));
     $textQuery = "\r\n\tSELECT idLink, title, link_address, sequence \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_link \r\n\tWHERE idCategory = '" . $object_link->getId() . "' \r\n\tORDER BY sequence";
     $result = sql_query($textQuery);
     $num_link = mysql_num_rows($result);
     list($title_cat) = sql_fetch_row(sql_query("\r\n\tSELECT title\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_link_cat \r\n\tWHERE idCategory = '" . $object_link->getId() . "'"));
     $GLOBALS['page']->add(getTitleArea($lang->def('_SECT_LINK'), 'link') . '<div class="std_block">' . getBackUi(Util::str_replace_once('&', '&amp;', $object_link->back_url) . '&amp;mod_result=0', $lang->def('_BACK')) . '<b>' . $lang->def('_TITLE') . ' : ' . $title_cat . '</b><br /><br />' . '<div class="mod_container">' . '<a href="index.php?modname=link&amp;op=modlinkcat&amp;idCategory=' . $object_link->getId() . '&amp;back_url=' . $back_coded . '" title="' . $lang->def('_MOD_TITLE') . '">' . '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . '" /> ' . $lang->def('_MOD_TITLE') . '</a>' . '</div><br />', 'content');
     $tableCat = new Table(0, '', $lang->def('_SUMMARY_LINK'));
     $contentH = array($lang->def('_QUESTION'), $lang->def('_URL'), '<img src="' . getPathImage() . 'standard/down.png" alt="' . $lang->def('_DOWN') . '" title="' . $lang->def('_MOVE_DOWN') . '" />', '<img src="' . getPathImage() . 'standard/up.png" alt="' . $lang->def('_UP') . '" title="' . $lang->def('_MOVE_UP') . '" />', '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . '" title="' . $lang->def('_MOD') . '" />', '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . '" title="' . $lang->def('_DEL') . '" />');
     $typeH = array('', 'image', 'image', 'image', 'image', 'image');
     $tableCat->setColsStyle($typeH);
     $tableCat->addHead($contentH);
     $i = 1;
     while (list($idLink, $title, $link_address, $seq) = sql_fetch_row($result)) {
         $rowContent = array($seq . ') ' . $title, $link_address);
         if ($i != $num_link) {
             $rowContent[] = '<a href="index.php?modname=link&amp;op=movedown&amp;idLink=' . $idLink . '&amp;back_url=' . $back_coded . '">' . '<img src="' . getPathImage() . 'standard/down.png" alt="' . $lang->def('_DOWN') . '" title="' . $lang->def('_MOVE_DOWN') . '" /></a>';
         } else {
             $rowContent[] = '&nbsp;';
         }
         if ($i != 1) {
             $rowContent[] = '<a href="index.php?modname=link&amp;op=moveup&amp;idLink=' . $idLink . '&amp;back_url=' . $back_coded . '">' . '<img src="' . getPathImage() . 'standard/up.png" alt="' . $lang->def('_UP') . '" title="' . $lang->def('_MOVE_UP') . '" /></a>';
         } else {
             $rowContent[] = '&nbsp;';
         }
         $rowContent[] = '<a href="index.php?modname=link&amp;op=modlink&amp;idLink=' . $idLink . '&amp;back_url=' . $back_coded . '">' . '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . '" title="' . $lang->def('_MOD') . '" /></a>';
         $rowContent[] = '<a href="index.php?modname=link&amp;op=dellink&amp;idLink=' . $idLink . '&amp;back_url=' . $back_coded . '">' . '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . '" title="' . $lang->def('_DEL') . '" /></a>';
         $tableCat->addBody($rowContent);
         ++$i;
     }
     $tableCat->addActionAdd('<a href="index.php?modname=link&amp;op=newlink&amp;idCategory=' . $object_link->getId() . '&amp;back_url=' . $back_coded . '" title="' . $lang->def('_ADDLINKT') . '">' . '<img src="' . getPathImage() . 'standard/add.png" alt="' . $lang->def('_ADD') . '" /> ' . $lang->def('_ADDLINK') . '</a>');
     $GLOBALS['page']->add($tableCat->getTable() . '<span class="text_bold text_little">[ ' . '<a href="index.php?modname=link&amp;op=fixsequence&amp;idCategory=' . $object_link->getId() . '&amp;back_url=' . $back_coded . '">' . $lang->def('_FIX_SEQUENCE') . '</a>' . ' ]</span>' . '</div>', 'content');
 }
Example #12
0
 function action()
 {
     $where = " WHERE 1";
     if (isset($_POST['b1']) && $_POST['b1'] == "Удалить" && isset($_REQUEST['id_check'])) {
         foreach ($_REQUEST['id_check'] as $k => $v) {
             DB::query("DELETE FROM `" . $this->table_name . "` WHERE `id` = '" . $v . "'");
         }
     }
     $a = array();
     $a['login'] = array('Логин', '20%', true);
     $a['email'] = array('Email', '20%', true);
     $a['passwd'] = array('Пароль', '10%', true);
     $a['status'] = array('Статус', '10%', true);
     $btn = array();
     $btn[] = "Удалить";
     if (isset($_GET['user_id'])) {
         $where .= " && `id` = '" . DB::escape($_GET['user_id']) . "'";
     }
     if (isset($_GET['key'])) {
         $where .= " && (\n\t\t\t`id` = '" . DB::escape($_GET['key']) . "' || \n\t\t\t`email` = '" . DB::escape($_GET['key']) . "' || \n\t\t\t`phone` = '" . DB::escape($_GET['key']) . "' \n\t\t\t)";
     }
     $oTable = new Table("admin.php?act=" . str_replace('action', '', __FUNCTION__) . "&page=");
     return $this->InIndex('Пользователи', $oTable->getTable($this, $this->class_name, $this->table_name, $a, $this->links_per_page, $btn, $where . " ORDER BY `id` DESC"));
 }
Example #13
0
 function loadCatalogueSelector($noprint = false)
 {
     require_once _base_ . '/lib/lib.table.php';
     require_once _base_ . '/lib/lib.form.php';
     $lang =& DoceboLanguage::createInstance('catalogue', 'lms');
     // Filter
     $this->filter['catalogue_name'] = isset($_POST['cat_filter_name']) ? $_POST['cat_filter_name'] : '';
     if ($this->show_filter === true) {
         $form = new Form();
         /*$GLOBALS['page']->add(
         			$form->getOpenFieldset($lang->def('_SEARCH'))
         			.Form::getTextfield($lang->def('_NAME'), 'cat_filter_name', 'cat_filter_name', '255',
         				( isset($_POST['cat_filter_name']) ? $_POST['cat_filter_name'] : '' ))
         			.$form->openButtonSpace()
         			.$form->getButton('catalogue_filter', 'catalogue_filter', $lang->def('_SEARCH'))
         			.$form->closeButtonSpace()
         			.$form->getCloseFieldset()
         		, 'content');
         		*/
         cout('<div class="quick_search_form">' . '<div>' . Form::getInputTextfield("search_t", "cat_filter_name", "cat_filter_name", Get::req('cat_filter_name', DOTY_MIXED, ''), '', 255, '') . Form::getButton("catalogue_filter", "catalogue_filter", Lang::t('_SEARCH', 'standard'), "search_b") . '</div>' . '</div>', 'content');
     }
     // End Filter
     $tb = new Table(Get::sett('visuItem'), $lang->def('_CATALOGUE'), $lang->def('_CATALOGUE_SUMMARY'));
     $tb->initNavBar('ini_cat', 'button');
     $ini = $tb->getSelectedElement();
     $select = "\r\n\t\tSELECT c.idCatalogue, c.name, c.description";
     $query_catalogue = "\r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_catalogue AS c\r\n\t\tWHERE 1";
     // Retriving data
     if (Docebo::user()->getUserLevelId() != ADMIN_GROUP_GODADMIN) {
         $all_courses = false;
         require_once _base_ . '/lib/lib.preference.php';
         $adminManager = new AdminPreference();
         $admin_courses = $adminManager->getAdminCourse(Docebo::user()->getIdST());
         if (isset($admin_courses['course'][0])) {
             $all_courses = true;
         }
         if (isset($admin_courses['course'][-1])) {
             require_once _lms_ . '/lib/lib.catalogue.php';
             $cat_man = new Catalogue_Manager();
             $admin_courses['catalogue'] = $cat_man->getUserAllCatalogueId(Docebo::user()->getIdSt());
             if (count($admin_courses['catalogue']) == 0 && Get::sett('on_catalogue_empty', 'off') == 'on') {
                 $all_courses = true;
             }
         }
         if (!$all_courses) {
             if (empty($admin_courses['catalogue'])) {
                 $query_catalogue .= " AND 0 ";
             } else {
                 $query_catalogue .= " AND c.idCatalogue IN (0," . implode(',', $admin_courses['catalogue']) . ") ";
             }
         }
     }
     if ($this->filter['catalogue_name'] != '') {
         $query_catalogue .= " AND c.name LIKE '%" . $this->filter['catalogue_name'] . "%'";
     }
     list($tot_catalogue) = sql_fetch_row(sql_query("SELECT COUNT(*) " . $query_catalogue));
     $query_catalogue .= " ORDER BY c.name\r\n\t\t\t\t\t\t\tLIMIT " . $ini . "," . (int) Get::sett('visuItem');
     $re_catalogue = sql_query($select . $query_catalogue);
     $type_h = array('image', '', '', '');
     $cont_h = array('<span class="access-only">' . $lang->def('_CATALOGUE_SELECTION') . '</span>', $lang->def('_NAME'), $lang->def('_DESCRIPTION'));
     $tb->setColsStyle($type_h);
     $tb->addHead($cont_h);
     while (list($id_catalogue, $name, $descr) = sql_fetch_row($re_catalogue)) {
         $tb_content = array(Form::getInputCheckbox('new_catalogue_selected_' . $id_catalogue, 'new_catalogue_selected[' . $id_catalogue . ']', $id_catalogue, isset($this->current_selection[$id_catalogue]), ''), '<label for="new_catalogue_selected_' . $id_catalogue . '">' . $name . '</label>', '<label for="new_catalogue_selected_' . $id_catalogue . '">' . $descr . '</label>');
         $tb->addBody($tb_content);
         if (isset($this->current_selection[$id_catalogue])) {
             unset($this->current_selection[$id_catalogue]);
         }
     }
     $output = $tb->getTable() . $tb->getNavBar($ini, $tot_catalogue) . $this->stateSelection();
     if ($noprint) {
         return $output;
     } else {
         cout($output, 'content');
     }
 }
Example #14
0
function modTransaction()
{
    require_once _base_ . '/lib/lib.table.php';
    require_once _base_ . '/lib/lib.form.php';
    require_once _base_ . '/lib/lib.dialog.php';
    require_once _lms_ . '/lib/lib.course.php';
    require_once _lms_ . '/lib/lib.date.php';
    $lang =& DoceboLanguage::createInstance('transaction');
    $acl_man = Docebo::user()->getAclManager();
    $man_transaction = new Man_Transaction();
    $course_man = new Man_Course();
    $date_man = new DateManager();
    $id_transaction = Get::req('id', DOTY_INT, 0);
    $transaction_info = $man_transaction->getTransactionInfo($id_transaction);
    if (isset($_POST['update'])) {
        $payment_status = Get::req('payment_status', DOTY_INT, 0);
        $course_status = Get::req('course_status', DOTY_INT, 0);
        $note = Get::req('note', DOTY_MIXED, '');
        if ($man_transaction->updateTransaction($id_transaction, $payment_status, $course_status, $note)) {
            if (isset($_POST['confirm'])) {
                $activations = array();
                foreach ($_POST['confirm'] as $id => $n) {
                    list($id_course, $id_date) = explode('_', $id);
                    if ($id_date != 0) {
                        $activations[$id_course]['dates'][$id_date] = $id_date;
                    } else {
                        $activations[$id_course] = $id_course;
                    }
                }
                if ($man_transaction->activateCourses($id_transaction, $transaction_info['id_user'], $activations)) {
                    Util::jump_to('index.php?modname=transaction&op=transaction&res=ok');
                }
            } else {
                Util::jump_to('index.php?modname=transaction&op=transaction&res=ok');
            }
        }
        Util::jump_to('index.php?modname=transaction&op=transaction&res=err_up');
    }
    $array_title = array('index.php?modname=transaction&amp;op=transaction' => $lang->def('_TRANSACTION'), $lang->def('_MOD_TRANSACTION'));
    //Status info & note
    $array_payment_status = array('-1' => $lang->def('_CANCELLED'), '0' => $lang->def('_WAITING_PAYMENT'), '1' => $lang->def('_PARTIAL_PAID'), '2' => $lang->def('_PAID'));
    $array_course_status = array('-1' => $lang->def('_CANCELLED'), '0' => $lang->def('_NO_COURSE_ACTIVATED'), '1' => $lang->def('_SOME_COURSE_ACTIVATED'), '2' => $lang->def('_ALL_COURSE_ACTIVATED'));
    cout(getTitleArea($array_title) . '<div class="std_block">' . Form::openForm('transaction_info', 'index.php?modname=transaction&amp;op=mod&amp;id=' . $id_transaction) . Form::openElementSpace() . Form::getDropdown($lang->def('_PAYMENT_STATUS_FILTER'), 'payment_status', 'payment_status', $array_payment_status, $transaction_info['payment_status']) . Form::getDropdown($lang->def('_COURSE_STATUS_FILTER'), 'course_status', 'course_status', $array_course_status, $transaction_info['course_status']) . Form::getSimpleTextarea($lang->def('_NOTES'), 'note', 'note', $transaction_info['note']) . Form::closeElementSpace());
    //User info
    $user_info = $acl_man->getUser($transaction_info['id_user'], false);
    $tb_user = new Table(0, $lang->def('_USER_INFO'), $lang->def('_USER_INFO'));
    $cont_h = array($lang->def('_USERNAME'), $lang->def('_FIRSTNAME'), $lang->def('_LASTNAME'), $lang->def('_EMAIL'));
    $type_h = array('', '', '', '');
    $tb_user->setColsStyle($type_h);
    $tb_user->addHead($cont_h);
    $tb_user->addBody(array($acl_man->relativeId($user_info[ACL_INFO_USERID]), $user_info[ACL_INFO_FIRSTNAME], $user_info[ACL_INFO_LASTNAME], $user_info[ACL_INFO_EMAIL]));
    cout('<br />' . $tb_user->getTable());
    //Payment info if we need it
    //Product info
    $tb_product = new Table(0, $lang->def('_PRODUCT_INFO'), $lang->def('_PRODUCT_INFO'));
    $cont_h = array($lang->def('_CODE'), $lang->def('_NAME'), $lang->def('_DATE_BEGIN'), $lang->def('_DATE_END'), $lang->def('_COURSE_PRIZE'), $lang->def('_CONFIRM_COURSE'));
    $type_h = array('', '', '', '', '', '');
    $tb_product->setColsStyle($type_h);
    $tb_product->addHead($cont_h);
    $transaction_course = $man_transaction->getTransactionCourses($id_transaction);
    foreach ($transaction_course as $id_course => $details) {
        if (is_array($details)) {
            foreach ($details['dates'] as $id_date) {
                $date_info = $date_man->getDateInfo($id_date);
                $checked = false;
                $other = '';
                if ($man_transaction->controlActivation($id_transaction, $id_course, $id_date)) {
                    $checked = true;
                    $other = 'disabled="disabled"';
                }
                $tb_product->addBody(array($date_info['code'], $date_info['name'], Format::date($date_info['date_begin']), Format::date($date_info['date_end']), $date_info['price'], Form::getInputCheckbox($id_course . '_' . $id_date, 'confirm[' . $id_course . '_' . $id_date . ']', 1, $checked, $other)));
            }
        } else {
            $course_info = $course_man->getCourseInfo($id_course);
            $checked = false;
            $other = '';
            if ($man_transaction->controlActivation($id_transaction, $id_course)) {
                $checked = true;
                $other = 'disabled="disabled"';
            }
            $tb_product->addBody(array($course_info['code'], $course_info['name'], $course_info['date_begin'] !== '0000-00-00' ? Format::date($course_info['date_begin'], 'date') . ($course_info['hour_begin'] !== '-1' ? $course_info['hour_begin'] : '') : '', $course_info['date_end'] !== '0000-00-00' ? Format::date($course_info['date_end'], 'date') . ($course_info['hour_end'] !== '-1' ? $course_info['hour_end'] : '') : '', $course_info['prize'] == '' ? '0' : $course_info['prize'], Form::getInputCheckbox($id_course . '_0', 'confirm[' . $id_course . '_0]', 1, $checked, $other)));
        }
    }
    cout('<br />' . $tb_product->getTable() . Form::openButtonSpace() . Form::getButton('update', 'update', $lang->def('_UPDATE')) . Form::getButton('back_mod', 'back_mod', $lang->def('_BACK')) . Form::closeButtonSpace() . Form::closeForm());
    cout('</div>');
}
Example #15
0
<?php

Get::title(array('index.php?r=alms/enrollrules/show' => Lang::t('_ENROLLRULES', 'enrollrules'), 'index.php?r=alms/enrollrules/showlog' => Lang::t('_SHOW_LOGS', 'enrollrules'), Lang::t('_DETAILS', 'enrollrules')));
?>
<div class="std_block">
<?php 
$tb = new Table();
$tb->addHead(array(Lang::t('_USERNAME', 'enrollrules'), Lang::t('_LASTNAME', 'enrollrules'), Lang::t('_FIRSTNAME', 'enrollrules'), Lang::t('_CODE', 'enrollrules'), Lang::t('_COURSE_NAME', 'enrollrules')), array('min-cell', '', '', 'min-cell', ''));
while (list(, $obj) = each($data)) {
    $row = array(Docebo::aclm()->relativeId($obj->userid), $obj->lastname, $obj->firstname, $obj->code, $obj->name);
    $tb->addBody($row);
}
echo $tb->getTable();
?>
</div>
Example #16
0
 function courses_instances_list($file_action, $file_back, $field_list_ar, $courses_instances_ha, $courses_names_ha, $key, $id_student)
 {
     $dh = $GLOBALS['dh'];
     $http_root_dir = $GLOBALS['http_root_dir'];
     // inizializzazione variabili
     $val = "";
     $val2 = "";
     $val3 = "";
     $str = "";
     $data = array();
     $titolo = "";
     // courses instances number from database query
     $n = count($courses_instances_ha);
     // LISTA istanze corsi
     if ($n > 0) {
         // creazione della tabella
         $tb = new Table();
         // setting delle caratteristiche della tabella
         $tb->initTable('1', 'center', '0', '1', '', '', '', '', '', '1', '1');
         // Syntax: $border,$align,$cellspacing,$cellpadding,$width,$col1, $bcol1,$col2, $bcol2
         // $caption = "<strong>".translateFN("Corsi ai quali sei iscritt*")."</strong>";
         $i = 0;
         foreach ($courses_instances_ha as $courses_instance) {
             $id_corso = $courses_instance[1];
             $keys = array_keys($courses_names_ha);
             if (in_array($id_corso, $keys)) {
                 $titolo = "<a href='{$http_root_dir}/info.php?id_course={$id_corso}'>" . $courses_names_ha[$id_corso] . "</a>";
                 $id_instance = $courses_instance[0];
                 // TUTOR non mostrato qui
                 //$tutor_id =  $dh->course_instance_tutor_get($id_instance);
                 //if (!empty($tutor_id)){
                 //   $tutor = $dh->get_tutor($tutor_id);
                 //  $tutor_uname = $tutor['username'];
                 //} else {
                 //   $tutor_uname = translateFN("Non assegnato");
                 // }
                 $j = 1;
                 // reset dei valori
                 $val = "";
                 // reset dei valori
                 if ($courses_instance[2] == 0) {
                     $val[0] = translateFN("Non iniziato");
                 } else {
                     $val[0] = date("d-m-Y", $courses_instance[2]) . " ";
                 }
                 $val[1] = $courses_instance[3] . " ";
                 if ($courses_instance[4] == 0) {
                     $val[2] = translateFN("Non previsto");
                 } else {
                     $val[2] = date("d-m-Y", $courses_instance[4]) . " ";
                 }
                 $i++;
                 // links per le azioni
                 //  $zoom_img_link = "<a href='$http_root_dir/info.php?id_course=$id_corso'><img src='img/zoom.png' alt='zoom in' border=0></a>";
                 $subscribe_img_link = "<a href=\"{$http_root_dir}/iscrizione/student_course_instance_subscribe.php?id_instance={$id_instance}&id_student={$id_student}&back_url={$file_back}\"><img src=\"img/edit.png\" alt=\"iscriviti\" border=\"0\"></a>";
                 $unsubscribe_img_link = "<a href=\"{$http_root_dir}/iscrizione/student_course_instance_unsubscribe.php?id_instance={$id_instance}&id_student={$id_student}&back_url={$file_back}\"><img src=\"img/delete.png\" alt=\"elimina iscrizione\" border=\"0\"></a>";
                 // controlla se lo studente e' gia'iscritto o preiscritto alla istanza del corso
                 $iscr = $dh->get_subscription($id_student, $id_instance);
                 // courses_instances[2] is the start date of the course instance
                 $now = time();
                 if ($courses_instance[4] == 0 || $courses_instance[4] > 0 && $courses_instance[4] > $now) {
                     if ($iscr['tipo'] == 0) {
                         $val3 = $subscribe_img_link;
                     } else {
                         $val3 = $unsubscribe_img_link;
                     }
                 } else {
                     if ($iscr['tipo'] == 0) {
                         $val3 = '';
                     } else {
                         $val3 = $unsubscribe_img_link;
                     }
                 }
                 $val[3] = "{$zoom_img_link} {$val3}";
                 $data[] = array(translateFN("corso") => $titolo, translateFN("durata") => $val[1], translateFN("inizio previsto") => $val[2], translateFN("iniziato") => $val[0], translateFN("azioni") => $val[3]);
             }
         }
         $tb->setTable($data, $caption = translateFN("Lista corsi"), $summary = translateFN("Tabella"));
         $str .= $tb->getTable();
         // Search Form
         $str .= "<br>";
         if (!empty($file_action)) {
             // FORM di ricerca
             $fields["add"][] = "key";
             $names["add"][] = translateFN("Cerca per argomento");
             $edittypes["add"][] = "text";
             $necessary["add"][] = "true";
             $values["add"][] = "{$key}";
             $options["add"][] = "";
             $maxsize["add"][] = 12;
             // creazione del form di ricerca corsi
             $str .= MakeForm($fields, $names, $edittypes, $necessary, $values, $options, $maxsize, $file_action, "add", false, true);
         }
     } else {
         $str = $this->info(translateFN("Nessun risultato"));
     }
     // scrittura stringa back
     // $str .= $this->go_file_back($file_back,translateFN("Home degli studenti"));
     return $str;
 }
Example #17
0
 function loadCoursepathSelector($noprint = false)
 {
     require_once _base_ . '/lib/lib.table.php';
     require_once _base_ . '/lib/lib.form.php';
     $lang =& DoceboLanguage::createInstance('coursepath', 'lms');
     $output = '';
     // Filter
     $this->filter['coursepath_name'] = isset($_POST['coursepath_filter_name']) ? $_POST['coursepath_filter_name'] : '';
     if ($this->show_filter === true) {
         /*
         			$form = new Form();
         			$output .= $form->getOpenFieldset($lang->def('_COURSEPATH_FILTER'))
         				.Form::getTextfield($lang->def('_NAME'), 'coursepath_filter_name', 'coursepath_filter_name', '255',
         					( isset($_POST['coursepath_filter_name']) ? $_POST['coursepath_filter_name'] : '' ))
         				.$form->openButtonSpace()
         				.$form->getButton('coursepath_filter', 'coursepath_filter', $lang->def('_SEARCH'))
         				.$form->closeButtonSpace()
         				.$form->getCloseFieldset();*/
         $output .= '<div class="quick_search_form">' . '<div>' . Form::getInputTextfield("search_t", "coursepath_filter_name", "coursepath_filter_name", Get::req('coursepath_filter_name', DOTY_MIXED, ''), '', 255, '') . Form::getButton("coursepath_filter", "coursepath_filter", Lang::t('_SEARCH', 'standard'), "search_b") . '</div>' . '</div>';
     }
     // End Filter
     $tb = new Table(Get::sett('visuItem'), $lang->def('_COURSE_PATH_CAPTION'), $lang->def('_COURSE_PATH_SUMMARY'));
     $tb->initNavBar('ini_cpath', 'button');
     $ini = $tb->getSelectedElement();
     $select = "\r\n\t\tSELECT id_path, path_name, path_descr ";
     $query_coursepath = "\r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_coursepath\r\n\t\tWHERE 1 ";
     if (Docebo::user()->getUserLevelId() != ADMIN_GROUP_GODADMIN) {
         $all_courses = false;
         require_once _base_ . '/lib/lib.preference.php';
         $adminManager = new AdminPreference();
         $admin_courses = $adminManager->getAdminCourse(Docebo::user()->getIdST());
         if (isset($admin_courses['course'][0])) {
             $all_courses = true;
         }
         if (isset($admin_courses['course'][-1])) {
             $query = "SELECT id_path" . " FROM %lms_coursepath_user" . " WHERE idUser = '******'";
             $result = sql_query($query);
             $admin_courses['coursepath'] = array();
             while (list($id_path) = sql_fetch_row($result)) {
                 $admin_courses['coursepath'][$id_path] = $id_path;
             }
             if (!empty($admin_courses['coursepath']) && Get::sett('on_catalogue_empty', 'off') == 'on') {
                 $all_courses = true;
             }
         }
         if (!$all_courses) {
             if (empty($admin_courses['coursepath'])) {
                 $query_coursepath .= " AND 0 ";
             } else {
                 $query_coursepath .= " AND id_path IN (" . implode(',', $admin_courses['coursepath']) . ") ";
             }
         }
     }
     if ($this->filter['coursepath_name'] != '') {
         $query_coursepath .= " AND path_name LIKE '%" . $this->filter['coursepath_name'] . "%'";
     }
     list($tot_coursepath) = sql_fetch_row(sql_query("SELECT COUNT(*) " . $query_coursepath));
     $query_coursepath .= "\r\n\t\tORDER BY path_name\r\n\t\tLIMIT " . $ini . "," . (int) Get::sett('visuItem');
     $re_coursepath = sql_query($select . $query_coursepath);
     $type_h = array('image', '', '', '');
     $cont_h = array('<span class="access-only">' . $lang->def('_SELECT') . '</span>', $lang->def('_NAME'), $lang->def('_DESCRIPTION'));
     $tb->setColsStyle($type_h);
     $tb->addHead($cont_h);
     while (list($id_path, $name, $descr) = sql_fetch_row($re_coursepath)) {
         $tb_content = array(Form::getInputCheckbox('new_coursepath_selected_' . $id_path, 'new_coursepath_selected[' . $id_path . ']', $id_path, isset($this->current_selection[$id_path]), ''), '<label for="new_coursepath_selected_' . $id_path . '">' . $name . '</label>', '<label for="new_coursepath_selected_' . $id_path . '">' . $descr . '</label>');
         $tb->addBody($tb_content);
         if (isset($this->current_selection[$id_path])) {
             unset($this->current_selection[$id_path]);
         }
     }
     $output .= $tb->getTable() . $tb->getNavBar($ini, $tot_coursepath) . $this->stateSelection();
     if ($noprint) {
         return $output;
     } else {
         cout($output, 'content');
     }
 }
function _get_course_instance_info($id_course, $id_course_instance)
{
    $common_dh = $GLOBALS['common_dh'];
    $dh = $GLOBALS['dh'];
    $sess_id_user = $_SESSION['sess_id_user'];
    $userObj = $_SESSION['sess_userObj'];
    $course_dataHa = $common_dh->get_service_info_from_course($id_course);
    $service_title = $course_dataHa[1];
    $service_level = $course_dataHa[3];
    //..
    $provider_dataHa = $common_dh->get_tester_info_from_id_course($id_course);
    if (!AMA_DataHandler::isError($provider_dataHa)) {
        $provider_pointer = $provider_dataHa['puntatore'];
        $provider_name = $provider_dataHa['nome'];
        $provider_dsn = Multiport::getDSN($provider_pointer);
        if ($provider_dsn != null) {
            $provider_dh = AMA_DataHandler::instance($provider_dsn);
            $sub_courses = $provider_dh->get_subscription($sess_id_user, $id_course_instance);
            // if (!AMA_DataHandler::isError($sub_courses)&&$sub_courses['tipo'] == 2) { // introducing status 3 (suspended) and 5 (completed)
            if (!AMA_DataHandler::isError($sub_courses)) {
                // introducing status 3 (suspended) and 5 (completed)
                $info_dataHa = array();
                $id_tutor = $dh->course_instance_tutor_get($id_course_instance);
                // vito, 27 may 2009
                if ($id_tutor !== false) {
                    $tutor = $dh->get_tutor($id_tutor);
                    // vito, 27 may 2009
                    if (!AMA_DataHandler::isError($tutor) && is_array($tutor)) {
                        $tutor_name = $tutor['nome'] . " " . $tutor['cognome'];
                        if (empty($tutor_name)) {
                            $tutor_info = translateFN('Non assegnato');
                        } else {
                            //  if (isset($sess_id_user)){
                            // $tutor_info = "<a href=\"$http_root_dir/admin/zoom_tutor.php?id=$id_tutor\">$tutor_name</a>";
                            // } else{
                            $tutor_info = $tutor_name;
                            //  }
                        }
                    }
                } else {
                    $tutor_info = translateFN('Non assegnato');
                }
                $start_date = ts2dFN($sub_courses['istanza_ha']['data_inizio']);
                // messaggi
                $messages_list = "";
                // FIXME
                // appuntamenti
                $msgs_ha = MultiPort::getUserAgenda($userObj);
                if (AMA_DataHandler::isError($msgs_ha)) {
                    $errObj = new ADA_Error($msgs_ha, translateFN('Errore in lettura appuntamenti'));
                }
                $testers_dataAr = MultiPort::getTestersPointersAndIds();
                $meeting_List = CommunicationModuleHtmlLib::getAgendaAsForm($dataAr, $testers_dataAr);
                //  $label_provider = translateFN('Fornitore');
                //  $label_title = translateFN('Titolo');
                $label_date = translateFN('Data di inizio');
                $label_tutor = translateFN('Tutor');
                $label_meeting = translateFN('Appuntamenti');
                $label_messages = translateFN('Messaggi');
                $row = array("<img src=\"img/flag.png\" border=0> " . $label_date => $start_date, $label_tutor => $tutor_info, $label_meeting => $meeting_list, $label_messages => $messages_list);
                array_push($info_dataHa, $row);
                $tObj = new Table();
                $tObj->initTable('1', 'center', '0', '1', '100%', '', '', '', '', 1, 1);
                $caption = "<strong>" . translateFN("Storico del servizio") . "</strong>";
                $summary = translateFN("Storico del servizio");
                $tObj->setTable($info_dataHa, $caption, $summary);
                $requested_service_data = $tObj->getTable();
            } else {
                $requested_service_data = translateFN("Nessun'informazione disponibile sul servizio {$id_course_instance}.");
            }
        } else {
            $requested_service_data = translateFN("Nessun'informazione disponibile sul servizio {$id_course_instance}.");
        }
    } else {
        $requested_service_data = translateFN("Nessun'informazione disponibile sul servizio {$id_course_instance}.");
    }
    return $requested_service_data;
}
Example #19
0
function adminManager_list()
{
    checkPerm('view');
    require_once _base_ . '/lib/lib.table.php';
    $lang =& DoceboLanguage::createInstance('adminrules', 'framework');
    $aclManager = new DoceboACLManager();
    // get users to show --------------------------------------------------
    $admin_group_idst = $aclManager->getGroupST(ADMIN_GROUP_ADMIN);
    $arr_admin_idst = $aclManager->getGroupUMembers($admin_group_idst);
    $arr_admin_id = array_flip($aclManager->getArrUserST($arr_admin_idst));
    $usres_info =& $aclManager->getUsers($arr_admin_idst);
    $pm =& PlatformManager::createInstance();
    $lms_is_active = $pm->isLoaded("lms");
    $cms_is_active = $pm->isLoaded("cms");
    // print table --------------------------------------------------------
    $table = new Table(Get::sett('visuItem'), $lang->def('_ADMIN_USER'), $lang->def('_ADMIN_USER'));
    $table->initNavBar('ini', 'link');
    $table->setLink('index.php?modname=admin_manager&amp;op=view&amp;ini=');
    $ini = $table->getSelectedElement();
    $GLOBALS['page']->add(getTitleArea($lang->def('_ADMIN_MANAGMENT'), 'admin_managmer', $lang->def('_ADMIN_MANAGMENT')) . '<div class="std_block">', 'content');
    $contentH = array($lang->def('_USERNAME'), $lang->def('_EMAIL'), '<img src="' . getPathImage() . 'admin_manager/man_pref.gif" alt="' . $lang->def('_ADMIN_PREFERENCES_TITLE') . '" ' . 'title="' . $lang->def('_ADMIN_PREFERENCES_TITLE') . '" />', '<img src="' . getPathImage() . 'admin_manager/man_menu.gif" alt="' . $lang->def('_ASSIGN_USERS') . '" ' . 'title="' . $lang->def('_ADMIN_MENU_TITLE') . '" />', '<img src="' . getPathImage() . 'directory/tree.gif" alt="' . $lang->def('_ASSIGN_USERS') . '" ' . 'title="' . $lang->def('_ASSIGN_USERS') . '" />', '<img src="' . getPathImage() . 'admin_manager/lang_lang.gif" alt="' . $lang->def('_ASSIGN_USERS') . '" ' . 'title="' . $lang->def('_ASSIGN_USERS') . '" />');
    $typeH = array('', '', 'image', 'image', 'image', 'image');
    if ($lms_is_active) {
        $contentH[] = '<img src="' . getPathImage() . 'admin_manager/man_course.gif" alt="' . $lang->def('_ASSIGN_USERS') . '" ' . 'title="' . $lang->def('_ASSIGN_USERS') . '" />';
        $typeH[] = 'image';
    }
    if ($cms_is_active) {
        // Cms Pages
        $contentH[] = '<img src="' . getPathImage() . 'admin_manager/pagetree.png" alt="' . $lang->def('_ASSIGN_CMS_PAGES') . '" ' . 'title="' . $lang->def('_ASSIGN_CMS_PAGES') . '" />';
        $typeH[] = 'image';
        // Cms News
        $contentH[] = '<img src="' . getPathImage() . 'admin_manager/newstree.png" alt="' . $lang->def('_NEWS') . '" ' . 'title="' . $lang->def('_NEWS') . '" />';
        $typeH[] = 'image';
        // Cms Documents
        $contentH[] = '<img src="' . getPathImage() . 'admin_manager/docstree.png" alt="' . $lang->def('_ASSIGN_CMS_DOCS') . '" ' . 'title="' . $lang->def('_ASSIGN_CMS_DOCS') . '" />';
        $typeH[] = 'image';
        // Cms Media
        $contentH[] = '<img src="' . getPathImage() . 'admin_manager/mediatree.png" alt="' . $lang->def('_ASSIGN_CMS_MEDIA') . '" ' . 'title="' . $lang->def('_ASSIGN_CMS_MEDIA') . '" />';
        $typeH[] = 'image';
        // Cms Contents
        $contentH[] = '<img src="' . getPathImage() . 'admin_manager/contenttree.png" alt="' . $lang->def('_ASSIGN_CMS_CONTENT') . '" ' . 'title="' . $lang->def('_ASSIGN_CMS_CONTENT') . '" />';
        $typeH[] = 'image';
    }
    $table->setColsStyle($typeH);
    $table->addHead($contentH);
    $maxItem = count($arr_admin_id) < $ini + Get::sett('visuItem') ? count($arr_admin_id) : $ini + Get::sett('visuItem');
    for ($index = $ini; $index < $maxItem; $index++) {
        $admin_userid = substr($arr_admin_id[$arr_admin_idst[$index]], 1);
        $rowContent = array($admin_userid, $usres_info[$arr_admin_idst[$index]][ACL_INFO_EMAIL]);
        // Edit preferences
        $rowContent[] = '<a href="index.php?modname=admin_manager&amp;op=edit_preferences&amp;adminidst=' . $arr_admin_idst[$index] . '"
						 title="' . $lang->def('_ADMIN_PREFERENCES_TITLE') . ' : ' . $admin_userid . '">' . '<img src="' . getPathImage() . 'admin_manager/man_pref.gif"' . ' alt="' . $lang->def('_ADMIN_PREFERENCES_TITLE') . ' : ' . $admin_userid . '" /></a>';
        // Edit menu
        $rowContent[] = '<a href="index.php?modname=admin_manager&amp;op=edit_menu&amp;adminidst=' . $arr_admin_idst[$index] . '"
						 title="' . $lang->def('_ADMIN_MENU_TITLE') . ' : ' . $admin_userid . '">' . '<img src="' . getPathImage() . 'admin_manager/man_menu.gif"' . ' alt="' . $lang->def('_ADMIN_MENU_TITLE') . ' : ' . $admin_userid . '" /></a>';
        // Edit user
        $rowContent[] = '<a href="index.php?modname=admin_manager&amp;op=assign_tree&amp;adminidst=' . $arr_admin_idst[$index] . '"
		 					title="' . $lang->def('_ASSIGN_USERS') . ' : ' . $admin_userid . '">' . '<img src="' . getPathImage() . 'directory/tree.gif" ' . 'alt="' . $lang->def('_ASSIGN_USERS') . ' : ' . $admin_userid . '" /></a>';
        // Edit lang
        $rowContent[] = '<a href="index.php?modname=admin_manager&amp;op=edit_lang&amp;adminidst=' . $arr_admin_idst[$index] . '"
						 	title="' . $lang->def('_ASSIGN_USERS') . ' : ' . $admin_userid . '">' . '<img src="' . getPathImage() . 'admin_manager/lang_lang.gif"' . ' alt="' . $lang->def('_ASSIGN_USERS') . ' : ' . $admin_userid . '" /></a>';
        // Edit course
        if ($lms_is_active) {
            $rowContent[] = '<a href="index.php?modname=admin_manager&amp;op=edit_course&amp;adminidst=' . $arr_admin_idst[$index] . '&amp;load=1"
								 title="' . $lang->def('_ASSIGN_USERS') . ' : ' . $admin_userid . '">' . '<img src="' . getPathImage() . 'admin_manager/man_course.gif"' . ' alt="' . $lang->def('_ASSIGN_USERS') . ' : ' . $admin_userid . '" /></a>';
        }
        // Assign cms trees permissions
        if ($cms_is_active) {
            // Cms Pages
            $img = "<img src=\"" . getPathImage() . "admin_manager/pagetree.png\" alt=\"" . $lang->def("_ASSIGN_CMS_PAGES") . "\" ";
            $img .= "title=\"" . $lang->def("_ASSIGN_CMS_PAGES") . "\" />";
            $url = "index.php?modname=admin_manager&amp;op=assign_cmspag&amp;adminidst=" . $arr_admin_idst[$index];
            $rowContent[] = "<a href=\"" . $url . "\">" . $img . "</a>\n";
            // Cms News
            $img = "<img src=\"" . getPathImage() . "admin_manager/newstree.png\" alt=\"" . $lang->def("_NEWS") . "\" ";
            $img .= "title=\"" . $lang->def("_NEWS") . "\" />";
            $url = "index.php?modname=admin_manager&amp;op=assign_cmsnews&amp;adminidst=" . $arr_admin_idst[$index];
            $rowContent[] = "<a href=\"" . $url . "\">" . $img . "</a>\n";
            // Cms Documents
            $img = "<img src=\"" . getPathImage() . "admin_manager/docstree.png\" alt=\"" . $lang->def("_ASSIGN_CMS_DOCS") . "\" ";
            $img .= "title=\"" . $lang->def("_ASSIGN_CMS_DOCS") . "\" />";
            $url = "index.php?modname=admin_manager&amp;op=assign_cmsdocs&amp;adminidst=" . $arr_admin_idst[$index];
            $rowContent[] = "<a href=\"" . $url . "\">" . $img . "</a>\n";
            // Cms Media
            $img = "<img src=\"" . getPathImage() . "admin_manager/mediatree.png\" alt=\"" . $lang->def("_ASSIGN_CMS_MEDIA") . "\" ";
            $img .= "title=\"" . $lang->def("_ASSIGN_CMS_MEDIA") . "\" />";
            $url = "index.php?modname=admin_manager&amp;op=assign_cmsmedia&amp;adminidst=" . $arr_admin_idst[$index];
            $rowContent[] = "<a href=\"" . $url . "\">" . $img . "</a>\n";
            // Cms Contents
            $img = "<img src=\"" . getPathImage() . "admin_manager/contenttree.png\" alt=\"" . $lang->def("_ASSIGN_CMS_CONTENT") . "\" ";
            $img .= "title=\"" . $lang->def("_ASSIGN_CMS_CONTENT") . "\" />";
            $url = "index.php?modname=admin_manager&amp;op=assign_cmscontent&amp;adminidst=" . $arr_admin_idst[$index];
            $rowContent[] = "<a href=\"" . $url . "\">" . $img . "</a>\n";
        }
        $table->addBody($rowContent);
    }
    $GLOBALS['page']->add($table->getTable() . $table->getNavBar($ini, count($arr_admin_id)), 'content');
    $GLOBALS['page']->add('</div>', 'content');
}
Example #20
0
/**
 * The UI that list all the task
 * @param Module $module the caller module
 **/
function ioTask_UITaskList(&$module)
{
    checkPerm('view');
    require_once _base_ . '/lib/lib.table.php';
    require_once _base_ . '/lib/lib.form.php';
    $connMgr =& $module->get_connMgr();
    $lang =& $module->get_lang();
    $out =& $module->get_out();
    $form = new Form();
    $tb_tasks = new Table(Get::sett('visuItem'), $lang->def('_TASKS'), $lang->def('_TASKS'));
    $content_h = array($lang->def('_NAME'), $lang->def('_DESCRIPTION'), $lang->def('_SOURCE'), $lang->def('_DESTINATION'), $lang->def('_SCHEDULE'), $lang->def('_LAST_EXECUTION'), '<img src="' . getPathImage() . '/standard/play.png" alt="' . $lang->def('_TASK_RUN') . '" title="' . $lang->def('_TASK_RUN') . '"/>', '<img src="' . getPathImage() . '/standard/edit.png" alt="' . $lang->def('_MOD') . '" title="' . $lang->def('_MOD') . '"/>', '<img src="' . getPathImage() . '/standard/cancel.png" alt="' . $lang->def('_TASK_DEL') . '" title="' . $lang->def('_DEL') . '"/>');
    $type_h = array('', '', '', '', '', '', 'image', 'image', 'image');
    $tb_tasks->setColsStyle($type_h);
    $tb_tasks->addHead($content_h);
    $conn = $connMgr->get_first_task();
    while ($conn) {
        $cont = array();
        $cont[] = $conn[CONNMGR_TASK_NAME];
        $cont[] = $conn[CONNMGR_TASK_DESCRIPTION];
        $cont[] = $conn[CONNMGR_TASK_SOURCE];
        $cont[] = $conn[CONNMGR_TASK_DESTINATION];
        if ($conn[CONNMGR_TASK_SCHEDTYPE] == 'at') {
            $cont[] = str_replace('%time%', $conn[CONNMGR_TASK_SCHEDULE]['qt'], $lang->def('_SCHEDULE_TYPE_AT_DATA'));
        } else {
            if ($conn[CONNMGR_TASK_SCHEDULE]['um'] == 'hour') {
                $conn[CONNMGR_TASK_SCHEDULE]['um'] = $lang->def('_HOUR');
            } elseif ($conn[CONNMGR_TASK_SCHEDULE]['um'] == 'day') {
                $conn[CONNMGR_TASK_SCHEDULE]['um'] = $lang->def('_DAY');
            }
            $cont[] = str_replace(array('%interval%', '%unit%'), array_values($conn[CONNMGR_TASK_SCHEDULE]), $lang->def('_SCHEDULE_TYPE_INTERVAL_DATA'));
        }
        if ($conn[CONNMGR_TASK_LAST_EXECUTION] !== null) {
            //$last_execution = strtotime($conn[CONNMGR_TASK_LAST_EXECUTION]);
            $cont[] = $conn[CONNMGR_TASK_LAST_EXECUTION];
        } else {
            $cont[] = '';
        }
        $cont[] = '<input type="image" ' . 'id="run_' . $conn[CONNMGR_TASK_NAME] . '" ' . 'name="action[run_task][' . $conn[CONNMGR_TASK_NAME] . ']" ' . 'src="' . getPathImage() . '/standard/play.png"' . 'alt="' . $lang->def('_TASK_RUN') . '"' . 'title="' . $lang->def('_TASK_RUN') . ': ' . $conn[CONNMGR_TASK_NAME] . '" />';
        $cont[] = '<input type="image" ' . 'id="modifiy_' . $conn[CONNMGR_TASK_NAME] . '" ' . 'name="action[edit_task][' . $conn[CONNMGR_TASK_NAME] . ']" ' . 'src="' . getPathImage() . '/standard/edit.png"' . 'alt="' . $lang->def('_MOD') . '"' . 'title="' . $lang->def('_MOD') . ': ' . $conn[CONNMGR_TASK_NAME] . '" />';
        $cont[] = '<input type="image" ' . 'id="delete_' . $conn[CONNMGR_TASK_NAME] . '" ' . 'name="action[delete_task][' . $conn[CONNMGR_TASK_NAME] . ']" ' . 'src="' . getPathImage() . '/standard/cancel.png"' . 'alt="' . $lang->def('_TASK_DEL') . '"' . 'title="' . $lang->def('_TASK_DEL') . ': ' . $conn[CONNMGR_TASK_NAME] . '" />';
        $tb_tasks->addBody($cont);
        $conn = $connMgr->get_next_task();
    }
    $tb_tasks->addActionAdd('<label for="new_task">' . '<img class="valing-middle" src="' . getPathImage() . 'standard/add.png" alt="' . $lang->def('_ADD') . '" />' . ' ' . $lang->def('_ADD_NEW_TASK') . '</label> ' . $form->getButton('new_task', 'action[new_task]', $lang->def('_CREATE'), 'button_nowh'));
    $out->add($tb_tasks->getTable());
}
            $line = array();
            if ($first) {
                $line[] = array('rowspan' => count($courses), 'value' => $cinfo_content_1, 'style' => 'yui-dt-rs-' . ($rs_counter % 2 > 0 ? 'odd' : 'even'));
                $line[] = array('rowspan' => count($courses), 'value' => $cinfo_content_2, 'style' => 'img-cell yui-dt-rs-' . ($rs_counter % 2 > 0 ? 'odd' : 'even'));
                $line[] = array('rowspan' => count($courses), 'value' => $cinfo_content_3, 'style' => 'img-cell yui-dt-rs-' . ($rs_counter % 2 > 0 ? 'odd' : 'even'));
                $line[] = array('rowspan' => count($courses), 'value' => $cinfo_content_4, 'style' => 'img-cell yui-dt-rs-' . ($rs_counter % 2 > 0 ? 'odd' : 'even'));
                $rs_counter++;
            }
            $line[] = $course['name'];
            $line[] = array('style' => 'img-cell', 'value' => $cinfo->type == 'score' ? '<b>' . (int) $course['score'] . '</b>' : '-');
            $table->addBody($line, $first ? 'borded-top' : false);
            $first = false;
        }
    } else {
        $line = array();
        $line[] = array('rowspan' => 1, 'value' => $cinfo_content_1, 'style' => 'yui-dt-rs-' . ($rs_counter % 2 > 0 ? 'odd' : 'even'));
        $line[] = array('rowspan' => 1, 'value' => $cinfo_content_2, 'style' => 'img-cell yui-dt-rs-' . ($rs_counter % 2 > 0 ? 'odd' : 'even'));
        $line[] = array('rowspan' => 1, 'value' => $cinfo_content_3, 'style' => 'img-cell yui-dt-rs-' . ($rs_counter % 2 > 0 ? 'odd' : 'even'));
        $line[] = array('rowspan' => 1, 'value' => $cinfo_content_4, 'style' => 'img-cell yui-dt-rs-' . ($rs_counter % 2 > 0 ? 'odd' : 'even'));
        $line[] = '<i>(' . Lang::t('_NO_COURSES_FOR_COMPETENCE', 'fncroles') . ')</i>';
        $line[] = array('style' => 'img-cell', 'value' => '<span class="ico-sprite fd_notice"><span></span></span>');
        $table->addBody($line, 'borded-top');
        $rs_counter++;
    }
}
echo '<br />';
echo $table->getTable();
echo '<br />';
echo getBackUi('index.php?r=adm/functionalroles/show', Lang::t('_BACK', 'standard'));
?>
</div>
 /**
  * Shows installed plugins.
  */
 public function showPlugins($data)
 {
     $this->setState('START_SHOWING_PLUGINS');
     //Get the text for above the table of plugins
     $out = $this->openFile("core/fragments/listTop.phtml");
     $out = $this->setTabActive(2, $out);
     //Create new Table item
     $t = new Table();
     //Create new Table
     $t->createTable("Modules");
     $t->addID("moduleTable");
     //Sets intial row as headings
     $t->setHead(true);
     $titles = array($this->localize("Module Name"), $this->localize("Change Status"), $this->localize("Updates"), $this->localize("Uninstall"));
     //Adds a row as titles.
     $t->addRow($titles);
     //Loop Through each page
     for ($i = 0; $i < count($data); $i++) {
         $link = "";
         $uninstall = "";
         //Ensure the disabling of plugin is allowed.
         if (!$data[$i][2]) {
             $link = "<a href='index.php?system=Modules&page=deactivate&req=" . $data[$i][0] . "'>" . $this->localize("Deactivate") . "</a>";
         }
         if (!$data[$i][1]) {
             $link = "<a href='index.php?system=ModulesInstall&page=activate&active=" . $data[$i][0] . "'>" . $this->localize("Activate") . "</a>";
         }
         if ($this->getController()->getModel()->checkModForUpdates($data[$i][0])) {
             $update = "<a style='color: red;' href='index.php?system=Modules&page=updateCheck&req=" . $data[$i][0] . "'>" . $this->localize("Updates Available") . "</a>";
         } else {
             $update = "<a style='color: green;' href='index.php?system=Modules&page=updateCheck&req=" . $data[$i][0] . "'>" . $this->localize("Up to Date") . "</a>";
         }
         if (!$data[$i][2]) {
             $uninstall = "<a href='index.php?system=Modules&page=uninstall&req=" . $data[$i][0] . "'>" . $this->localize("Uninstall") . "</a>";
         }
         //Create a row
         $row = array($this->localize($data[$i][0]), $link, $update, $uninstall);
         //Add Page data for each row.
         $t->addRow($row);
     }
     //Creates a table from inserted data
     $t->runTable();
     //Returns the created table.
     $out .= $t->getTable();
     //Sets the generated content as output
     $this->setContent($out);
     //Localise Title
     $this->setContentTitle($this->localize("Module Manager"));
     $this->setState('END_SHOWING_PLUGINS');
 }
Example #23
0
 public function printPageWithElement($id, $idst)
 {
     $adm_old_perm = $this->preference->getAdminPerm($idst);
     $array_image = array('add_category' => 'ico-sprite subs_view', 'mod_category' => 'ico-sprite subs_view', 'del_category' => 'ico-sprite subs_view', 'view' => 'ico-sprite subs_view', 'add' => 'ico-sprite subs_add', 'mod' => 'ico-sprite subs_mod', 'del' => 'ico-sprite subs_del', 'associate_user' => 'ico-sprite subs_users', 'approve_waiting_user' => 'ico-sprite subs_user', 'subscribe' => 'ico-sprite subs_users', 'moderate' => 'ico-sprite subs_user');
     switch ($id) {
         case 'framework':
             require_once _base_ . '/lib/lib.table.php';
             $query = "SELECT idMenu, name, collapse" . " FROM %adm_menu" . " ORDER BY sequence";
             $result = sql_query($query);
             while (list($id_menu, $name, $collapse) = sql_fetch_row($result)) {
                 $query = "SELECT module_name, default_name, class_file, class_name, mvc_path" . " FROM %adm_menu_under" . " WHERE idMenu = '" . $id_menu . "'";
                 $result_under = sql_query($query);
                 if (sql_num_rows($result_under) > 0) {
                     $tb = new Table(NULL);
                     $th = array(Lang::t($name, 'menu'));
                     $ts = array('');
                     $total_perm = array();
                     $module_perm = array();
                     while (list($module_name, $default_name, $class_file, $class_name, $mvc_path) = sql_fetch_row($result_under)) {
                         if ($mvc_path !== '') {
                             $tmp = explode('/', $mvc_path);
                             $mvc_name = ucwords($tmp[1]);
                             $perm_path = '/framework/admin/' . strtolower($mvc_name) . '/';
                             require_once _adm_ . '/models/' . $mvc_name . 'Adm.php';
                             $class_name = $mvc_name . 'Adm';
                             $tmp_class = new $class_name();
                             $perm = $tmp_class->getPerm();
                             if (!empty($perm)) {
                                 foreach ($perm as $perm_name => $img) {
                                     if (array_search($perm_name, array_keys($total_perm)) == false) {
                                         $total_perm[$perm_name] = $img;
                                         if ($collapse === 'true') {
                                             $th = array(Lang::t($default_name, 'menu'));
                                         }
                                     }
                                     list($perm_idst) = sql_fetch_row(sql_query("SELECT idst FROM %adm_role WHERE roleid = '" . $perm_path . $perm_name . "'"));
                                     $module_perm[$mvc_name][$perm_name] = $perm_idst;
                                 }
                             }
                         } else {
                             require_once _adm_ . '/class.module/' . $class_file;
                             $tmp_class = new $class_name();
                             $perm_path = '/framework/admin/' . strtolower($module_name) . '/';
                             $perm = $tmp_class->getAllToken('lang');
                             if (!empty($perm)) {
                                 foreach ($perm as $perm_name => $info) {
                                     if (array_search($perm_name, array_keys($total_perm)) == false) {
                                         $total_perm[$perm_name] = $info['image'];
                                         if ($collapse === 'true') {
                                             $th = array(Lang::t($default_name, 'menu'));
                                         }
                                     }
                                     list($perm_idst) = sql_fetch_row(sql_query("SELECT idst FROM %adm_role WHERE roleid = '" . $perm_path . $perm_name . "'"));
                                     $module_perm[$class_name][$perm_name] = $perm_idst;
                                 }
                             }
                         }
                     }
                     //End while 1
                     if (!empty($total_perm)) {
                         foreach ($total_perm as $perm => $img) {
                             $classname = isset($array_image[$perm]) ? $array_image[$perm] : "ico-sprite";
                             $th[] = '<span class="' . $classname . '" title="' . Lang::t('_' . strtoupper($perm), 'menu') . '"><span>' . Lang::t('_' . strtoupper($perm), 'menu') . '</span></span>';
                             $ts[] = 'image';
                         }
                         $tb->addHead($th);
                         $tb->setColsStyle($ts);
                         $result_under = sql_query($query);
                         while (list($module_name, $default_name, $class_file, $class_name, $mvc_path) = sql_fetch_row($result_under)) {
                             if ($mvc_path !== '') {
                                 $tmp = explode('/', $mvc_path);
                                 $mvc_name = ucwords($tmp[1]);
                                 $content = array(Lang::t($default_name, 'menu'));
                                 foreach ($total_perm as $perm => $img) {
                                     if (isset($module_perm[$mvc_name][$perm])) {
                                         $content[] = Form::getInputCheckbox('adm_perm_' . $module_perm[$mvc_name][$perm], 'adm_perm[' . $module_perm[$mvc_name][$perm] . ']', '1', isset($adm_old_perm[$module_perm[$mvc_name][$perm]]), '');
                                     } else {
                                         $content[] = '';
                                     }
                                 }
                                 reset($total_perm);
                                 $tb->addBody($content);
                             } else {
                                 $content = array(Lang::t($default_name, 'menu'));
                                 foreach ($total_perm as $perm => $img) {
                                     if (isset($module_perm[$class_name][$perm])) {
                                         $content[] = Form::getInputCheckbox('adm_perm_' . $module_perm[$class_name][$perm], 'adm_perm[' . $module_perm[$class_name][$perm] . ']', '1', isset($adm_old_perm[$module_perm[$class_name][$perm]]), '');
                                     } else {
                                         $content[] = '';
                                     }
                                 }
                                 reset($total_perm);
                                 $tb->addBody($content);
                             }
                         }
                         //End while 2
                         echo $tb->getTable() . '<br/><br/>';
                     }
                 }
             }
             //End while
             break;
         case 'lms':
             require_once _base_ . '/lib/lib.table.php';
             $query = "SELECT idMenu, name, collapse" . " FROM %lms_menu" . " ORDER BY sequence";
             $result = sql_query($query);
             while (list($id_menu, $name, $collapse) = sql_fetch_row($result)) {
                 $query = "SELECT module_name, default_name, class_file, class_name, mvc_path" . " FROM %lms_menu_under" . " WHERE idMenu = '" . $id_menu . "'";
                 $result_under = sql_query($query);
                 if (sql_num_rows($result_under) > 0) {
                     $tb = new Table(NULL);
                     $th = array(Lang::t($name, 'menu'));
                     $ts = array('');
                     $total_perm = array();
                     $module_perm = array();
                     while (list($module_name, $default_name, $class_file, $class_name, $mvc_path) = sql_fetch_row($result_under)) {
                         if ($mvc_path !== '') {
                             $tmp = explode('/', $mvc_path);
                             $mvc_name = ucwords($tmp[1]);
                             $perm_path = '/lms/admin/' . strtolower($mvc_name) . '/';
                             require_once _lms_ . '/admin/models/' . $mvc_name . 'Alms.php';
                             $class_name = $mvc_name . 'Alms';
                             $tmp_class = new $class_name();
                             $perm = $tmp_class->getPerm();
                             if (!empty($perm)) {
                                 foreach ($perm as $perm_name => $img) {
                                     if (array_search($perm_name, array_keys($total_perm)) == false) {
                                         $total_perm[$perm_name] = $img;
                                         if ($collapse === 'true') {
                                             $th = array(Lang::t($default_name, 'menu'));
                                         }
                                     }
                                     list($perm_idst) = sql_fetch_row(sql_query("SELECT idst FROM %adm_role WHERE roleid = '" . $perm_path . $perm_name . "'"));
                                     $module_perm[$mvc_name][$perm_name] = $perm_idst;
                                 }
                             }
                         } else {
                             require_once _lms_ . '/admin/class.module/' . $class_file;
                             $tmp_class = new $class_name();
                             $perm_path = '/lms/admin/' . strtolower($module_name) . '/';
                             $perm = $tmp_class->getAllToken('lang');
                             if (!empty($perm)) {
                                 foreach ($perm as $perm_name => $info) {
                                     if (array_search($perm_name, array_keys($total_perm)) == false) {
                                         $total_perm[$perm_name] = $info['image'];
                                         if ($collapse === 'true') {
                                             $th = array(Lang::t($default_name, 'menu'));
                                         }
                                     }
                                     list($perm_idst) = sql_fetch_row(sql_query("SELECT idst FROM %adm_role WHERE roleid = '" . $perm_path . $perm_name . "'"));
                                     $module_perm[$class_name][$perm_name] = $perm_idst;
                                 }
                             }
                         }
                     }
                     //End while 1
                     if (!empty($total_perm)) {
                         foreach ($total_perm as $perm => $img) {
                             $th[] = '<span class="' . $array_image[$perm] . '" title="' . Lang::t('_' . strtoupper($perm), 'menu') . '"><span>' . Lang::t('_' . strtoupper($perm), 'menu') . '</span></span>';
                             $ts[] = 'image';
                         }
                         $tb->addHead($th);
                         $tb->setColsStyle($ts);
                         $result_under = sql_query($query);
                         while (list($module_name, $default_name, $class_file, $class_name, $mvc_path) = sql_fetch_row($result_under)) {
                             if ($mvc_path !== '') {
                                 $tmp = explode('/', $mvc_path);
                                 $mvc_name = ucwords($tmp[1]);
                                 $content = array(Lang::t($default_name, 'menu'));
                                 foreach ($total_perm as $perm => $img) {
                                     if (isset($module_perm[$mvc_name][$perm])) {
                                         $content[] = Form::getInputCheckbox('adm_perm_' . $module_perm[$mvc_name][$perm], 'adm_perm[' . $module_perm[$mvc_name][$perm] . ']', '1', isset($adm_old_perm[$module_perm[$mvc_name][$perm]]), '');
                                     } else {
                                         $content[] = '';
                                     }
                                 }
                                 reset($total_perm);
                                 $tb->addBody($content);
                             } else {
                                 $content = array(Lang::t($default_name, 'menu'));
                                 foreach ($total_perm as $perm => $img) {
                                     if (isset($module_perm[$class_name][$perm])) {
                                         $content[] = Form::getInputCheckbox('adm_perm_' . $module_perm[$class_name][$perm], 'adm_perm[' . $module_perm[$class_name][$perm] . ']', '1', isset($adm_old_perm[$module_perm[$class_name][$perm]]), '');
                                     } else {
                                         $content[] = '';
                                     }
                                 }
                                 reset($total_perm);
                                 $tb->addBody($content);
                             }
                         }
                         //End while 2
                         echo $tb->getTable() . '<br/><br/>';
                     }
                 }
             }
             //End while
             break;
         case 'scs':
             echo 'scs';
             break;
         case 'cms':
             require_once _base_ . '/lib/lib.table.php';
             $query = "SELECT idMenu, name, collapse" . " FROM %cms_menu" . " ORDER BY sequence";
             $result = sql_query($query);
             while (list($id_menu, $name, $collapse) = sql_fetch_row($result)) {
                 $query = "SELECT module_name, default_name, class_file, class_name, mvc_path" . " FROM %cms_menu_under" . " WHERE idMenu = '" . $id_menu . "'";
                 $result_under = sql_query($query);
                 if (sql_num_rows($result_under) > 0) {
                     $tb = new Table(NULL);
                     $th = array(Lang::t($name, 'adminrules'));
                     $ts = array('');
                     $total_perm = array();
                     $module_perm = array();
                     while (list($module_name, $default_name, $class_file, $class_name, $mvc_path) = sql_fetch_row($result_under)) {
                         if ($mvc_path !== '') {
                             $tmp = explode('/', $mvc_path);
                             $mvc_name = ucwords($tmp[1]);
                             $perm_path = '/cms/admin/' . strtolower($mvc_name) . '/';
                             require_once _cms_ . '/admin/models/' . $mvc_name . '.php';
                             $class_name = $mvc_name . '';
                             $tmp_class = new $class_name();
                             $perm = $tmp_class->getPerm();
                             if (!empty($perm)) {
                                 foreach ($perm as $perm_name => $img) {
                                     if (array_search($perm_name, array_keys($total_perm)) == false) {
                                         $total_perm[$perm_name] = $img;
                                         if ($collapse === 'true') {
                                             $th = array(Lang::t($default_name, 'adminrules'));
                                         }
                                     }
                                     list($perm_idst) = sql_fetch_row(sql_query("SELECT idst FROM %adm_role WHERE roleid = '" . $perm_path . $perm_name . "'"));
                                     $module_perm[$mvc_name][$perm_name] = $perm_idst;
                                 }
                             }
                         } else {
                             require_once _cms_ . '/class.module/' . $class_file;
                             $tmp_class = new $class_name();
                             $perm_path = '/cms/admin/' . strtolower($module_name) . '/';
                             $perm = $tmp_class->getAllToken('lang');
                             if (!empty($perm)) {
                                 foreach ($perm as $perm_name => $info) {
                                     if (array_search($perm_name, array_keys($total_perm)) == false) {
                                         $total_perm[$perm_name] = $info['image'];
                                         if ($collapse === 'true') {
                                             $th = array(Lang::t($default_name, 'adminrules'));
                                         }
                                     }
                                     list($perm_idst) = sql_fetch_row(sql_query("SELECT idst FROM %adm_role WHERE roleid = '" . $perm_path . $perm_name . "'"));
                                     $module_perm[$class_name][$perm_name] = $perm_idst;
                                 }
                             }
                         }
                     }
                     //End while 1
                     foreach ($total_perm as $perm => $img) {
                         $th[] = '<span class="' . $array_image[$perm] . '" title="' . Lang::t('_' . strtoupper($perm), 'menu') . '"><span>' . Lang::t('_' . strtoupper($perm), 'menu') . '</span></span>';
                         $ts[] = 'image';
                     }
                     $tb->addHead($th);
                     $tb->setColsStyle($ts);
                     $result_under = sql_query($query);
                     while (list($module_name, $default_name, $class_file, $class_name, $mvc_path) = sql_fetch_row($result_under)) {
                         if ($mvc_path !== '') {
                             $tmp = explode('/', $mvc_path);
                             $mvc_name = ucwords($tmp[1]);
                             $content = array(Lang::t($default_name, 'adminrules'));
                             foreach ($total_perm as $perm => $img) {
                                 if (isset($module_perm[$mvc_name][$perm])) {
                                     $content[] = Form::getInputCheckbox('adm_perm_' . $module_perm[$mvc_name][$perm], 'adm_perm[' . $module_perm[$mvc_name][$perm] . ']', '1', isset($adm_old_perm[$module_perm[$mvc_name][$perm]]), '');
                                 } else {
                                     $content[] = '';
                                 }
                             }
                             reset($total_perm);
                             $tb->addBody($content);
                         } else {
                             $content = array(Lang::t($default_name, 'adminrules'));
                             foreach ($total_perm as $perm => $img) {
                                 if (isset($module_perm[$class_name][$perm])) {
                                     $content[] = Form::getInputCheckbox('adm_perm_' . $module_perm[$class_name][$perm], 'adm_perm[' . $module_perm[$class_name][$perm] . ']', '1', isset($adm_old_perm[$module_perm[$class_name][$perm]]), '');
                                 } else {
                                     $content[] = '';
                                 }
                             }
                             reset($total_perm);
                             $tb->addBody($content);
                         }
                     }
                     //End while 2
                     echo $tb->getTable() . '<br/><br/>';
                 }
             }
             //End while
             break;
         case 'ecom':
             echo 'ecom';
             break;
     }
 }
Example #24
0
function sessiondetails()
{
    checkPerm('view');
    require_once _base_ . '/lib/lib.table.php';
    $idst_user = importVar('id', true, 0);
    $id_enter = importVar('id_enter', true, 0);
    $p_ini = importVar('p_ini');
    $link = 'index.php?modname=statistic&amp;op=sessiondetails&amp;id=' . $idst_user . '&amp;id_enter=' . $id_enter;
    $nav_bar = new NavBar('ini', Get::sett('visuItem'), 0, 'link');
    $nav_bar->setLink($link . '&amp;p_ini=' . $p_ini);
    $ini = $nav_bar->getSelectedElement();
    $lang =& DoceboLanguage::createInstance('statistic', 'lms');
    $acl_man = Docebo::user()->getAclManager();
    $user_info =& $acl_man->getUser($idst_user, false);
    $query_track = "\r\n\tSELECT g.function, g.type, g.timeof, UNIX_TIMESTAMP(g.timeof) AS unix_time \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_trackingeneral AS g\r\n\tWHERE g.idCourse = '" . (int) $_SESSION['idCourse'] . "' AND g.idUser = '******' AND " . " ( g.idEnter = '" . $id_enter . "' OR (  g.idEnter = 0 AND g.session_id = '" . importVar('sid') . "' ) ) " . " ORDER BY g.timeof \r\n\tLIMIT " . $ini . ", " . Get::sett('visuItem');
    $re_tracks = sql_query($query_track);
    $query_tot_track = "\r\n\tSELECT COUNT(*) \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_trackingeneral \r\n\tWHERE idCourse = '" . (int) $_SESSION['idCourse'] . "' AND idUser = '******' AND idEnter = '" . $id_enter . "'";
    list($tot_elem) = sql_fetch_row(sql_query($query_tot_track));
    $nav_bar->setElementTotal($tot_elem);
    // Find modulename -> name int his course
    require_once $GLOBALS['where_lms'] . '/lib/lib.course.php';
    $course_man = new Man_Course();
    $mods_names =& $course_man->getModulesName($_SESSION['idCourse']);
    $page_title = array('index.php?modname=statistic&amp;op=statistic' => $lang->def('_STATISTICS'), 'index.php?modname=statistic&amp;op=userdetails&amp;id=' . $idst_user . '&amp;p_ini=' . $p_ini => $user_info[ACL_INFO_LASTNAME] . $user_info[ACL_INFO_FIRSTNAME] ? $user_info[ACL_INFO_LASTNAME] . ' ' . $user_info[ACL_INFO_FIRSTNAME] : $acl_man->relativeId($user_info[ACL_INFO_USERID]), $lang->def('_VIEW_SESSION_DETAILS'));
    $GLOBALS['page']->add(getTitleArea($page_title, 'statistic') . '<div class="std_block">' . getBackUi('index.php?modname=statistic&amp;op=userdetails&amp;id=' . $idst_user . '&amp;p_ini=' . $p_ini, $lang->def('_BACK')), 'content');
    $tb = new Table(0, $lang->def('_VIEW_SESSION_DETAILS'), $lang->def('_VIEW_SESSION_DETAILS'));
    $type_h = array('', '', '');
    $cont_h = array($lang->def('_DATE'), $lang->def('_TYPE_OF_OPERATION'), $lang->def('_TIME_IN'));
    $tb->setColsStyle($type_h);
    $tb->addHead($cont_h);
    $type_h[2] = 'align_right';
    $tb->setColsStyle($type_h);
    $total_sec = 0;
    $read_previous = false;
    while ($read = mysql_fetch_assoc($re_tracks)) {
        if ($read_previous !== false) {
            $time_in = $read['unix_time'] - $read_previous['unix_time'];
            $hours = (int) ($time_in / 3600);
            $minutes = (int) ($time_in % 3600 / 60);
            $seconds = (int) ($time_in % 60);
            if ($minutes < 10) {
                $minutes = '0' . $minutes;
            }
            if ($seconds < 10) {
                $seconds = '0' . $seconds;
            }
            $readable = $hours . 'h ' . $minutes . 'm ' . $seconds . 's ';
            $cont = array(Format::date($read_previous['timeof'], false, true), '<span class="text_bold">' . (isset($mods_names[$read_previous['function']]) ? $mods_names[$read_previous['function']] : $read_previous['function']) . '</span> [' . $read_previous['type'] . ']', $readable);
            $tb->addBody($cont);
        }
        $read_previous = $read;
    }
    $query_last_track = "\r\n\tSELECT g.function, g.type, g.timeof, UNIX_TIMESTAMP(g.timeof) AS unix_time \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_trackingeneral AS g\r\n\tWHERE g.idCourse = '" . (int) $_SESSION['idCourse'] . "' AND g.idUser = '******' AND g.idEnter = '" . $id_enter . "' \r\n\tLIMIT " . ($ini + Get::sett('visuItem')) . ", 1";
    $re_track = sql_query($query_last_track);
    if (mysql_num_rows($re_track) > 0) {
        $read = mysql_fetch_assoc($re_track);
        $time_in = $read['unix_time'] - $read_previous['unix_time'];
        $hours = (int) ($time_in / 3600);
        $minutes = (int) ($time_in % 3600 / 60);
        $seconds = (int) ($time_in % 60);
        if ($minutes < 10) {
            $minutes = '0' . $minutes;
        }
        if ($seconds < 10) {
            $seconds = '0' . $seconds;
        }
        $readable = $hours . 'h ' . $minutes . 'm ' . $seconds . 's ';
    } else {
        $readable = '';
    }
    $cont = array(Format::date($read_previous['timeof']), '<span class="text_bold">' . (isset($mods_names[$read_previous['function']]) ? $mods_names[$read_previous['function']] : $read_previous['function']) . '</span> [' . $read_previous['type'] . ']', $readable);
    $tb->addBody($cont);
    $GLOBALS['page']->add($tb->getTable() . $nav_bar->getNavBar() . getBackUi('index.php?modname=statistic&amp;op=userdetails&amp;id=' . $idst_user . '&amp;p_ini=' . $p_ini, $lang->def('_BACK')) . '</div>', 'content');
}
Example #25
0
function get_student_dataFN($id_student, $id_instance)
{
    $dh = $GLOBALS['dh'];
    $http_root_dir = $GLOBALS['http_root_dir'];
    $student_info_ha = $dh->_get_user_info($id_student);
    // Get info of each student
    if (AMA_DataHandler::isError($student_info_ha)) {
        $msg = $student_info_ha->getMessage();
        return $msg;
        break;
    }
    $instance_course_ha = $dh->course_instance_get($id_instance);
    // Get the instance courses data
    if (AMA_DataHandler::isError($instance_course_ha)) {
        $msg = $instance_course_ha->getMessage();
        return $msg;
        break;
    }
    $id_course = $instance_course_ha['id_corso'];
    $start_date = AMA_DataHandler::ts_to_date($instance_course_ha['data_inizio'], ADA_DATE_FORMAT);
    $info_course = $dh->get_course($id_course);
    // Get title course
    if (AMA_DataHandler::isError($info_course)) {
        $msg = $info_course->getMessage();
        return $msg;
        break;
    }
    $course_title = $info_course['titolo'];
    /*
        global $debug;$debug=1;
        mydebug(__LINE__,__FILE__,$student_info_ha);
        $debug = 0;
    */
    $name = $student_info_ha['nome'];
    $name_desc = "<B>" . translateFN("Nome") . "</B>";
    $surname = $student_info_ha['cognome'];
    $surname_desc = "<B>" . translateFN("Cognome") . "</B>";
    $email = $student_info_ha['email'];
    $email_desc = "<B>" . translateFN("Email") . "</B>";
    $phone_n = $student_info_ha['telefono'];
    $phone_desc = "<B>" . translateFN("Telefono") . "</B>";
    $user = $student_info_ha['username'];
    $user_desc = "<B>" . translateFN("User Name") . "</B>";
    $course_desc = "<B>" . translateFN("Titolo del Corso") . "</B>";
    $start_desc = "<B>" . translateFN("Data di inizio") . "</B>";
    $dati_stude[0]['name_desc'] = $name_desc;
    $dati_stude[0]['name'] = $name;
    $dati_stude[1]['surname_desc'] = $surname_desc;
    $dati_stude[1]['surname'] = $surname;
    $dati_stude[2]['email_desc'] = $email_desc;
    $dati_stude[2]['email'] = $email;
    $dati_stude[3]['phone_desc'] = $phone_desc;
    $dati_stude[3]['phone'] = $phone_n;
    $dati_stude[4]['user_desc'] = $user_desc;
    $dati_stude[4]['user'] = $user;
    $dati_stude[5]['course_desc'] = $course_desc;
    $dati_stude[5]['course'] = $course_title;
    $dati_stude[6]['start_desc'] = $start_desc;
    $dati_stude[6]['start'] = $start_date;
    $tObj = new Table();
    // $tObj->initTable('0','center','0','1','100%','black','white','black','white');
    $tObj->initTable('1', 'center', '0', '1', '', '', '', '', '', '1');
    // Syntax: $border,$align,$cellspacing,$cellpadding,$width,$col1, $bcol1,$col2, $bcol2
    $caption = translateFN("Studente selezionato: <B>") . $id_student . "</B> ";
    // $summary = translateFN("Elenco dei corsi monitorati");
    $summary = "";
    // $tObj->setTable($dati_stude,$caption,$summary);
    $tObj->setTable($dati_stude, $caption, $summary);
    $student_info = $tObj->getTable();
    return $student_info;
}
function publicAdminManager_edit_menu()
{
    checkPerm('view');
    require_once _base_ . '/lib/lib.form.php';
    require_once _base_ . '/lib/lib.table.php';
    require_once $GLOBALS['where_framework'] . '/lib/lib.publicadminmanager.php';
    $lang =& DoceboLanguage::createInstance('public_admin_manager', 'framework');
    $aclManager =& Docebo::user()->getAclManager();
    $adminidst = importVar('adminidst', true, 0);
    $out =& $GLOBALS['page'];
    $admin_manager = new PublicAdminManager();
    $role_list = $admin_manager->getPublicUserAdminRole();
    $out->setWorkingZone('content');
    $out->add(getTitleArea($lang->def('_ADMIN_MANAGMENT'), 'admin_managmer', $lang->def('_ADMIN_MANAGMENT')) . '<div class="std_block">' . Form::openForm('admin_menu_editing', '') . Form::getHidden('adminidst', 'adminidst', $adminidst));
    $table = new Table(0, $lang->def('_ADMIN_MANAGMENT'), $lang->def('_ADMIN_MANAGMENT'));
    $head = array('', $lang->def('_ACTION'));
    $style = array('image', '');
    $table->addHead($head, $style);
    foreach ($role_list as $role) {
        if (isset($_POST['save_permission'])) {
            if (isset($_POST[$role['roleid']]) && $_POST[$role['roleid']] == $role['idst']) {
                if (!$admin_manager->controlPublicUserAdminRole($adminidst, $role['idst'])) {
                    $admin_manager->addPublicAdminRole($adminidst, $role['idst']);
                }
            } else {
                if ($admin_manager->controlPublicUserAdminRole($adminidst, $role['idst'])) {
                    $admin_manager->delPublicAdminRole($adminidst, $role['idst']);
                }
            }
        }
        $lang_string = $role['roleid'];
        $lang_string = str_replace('/lms/course/public/public_user_admin/', '_USER_', $lang_string);
        $lang_string = str_replace('/lms/course/public/public_course_admin/', '_COURSE_', $lang_string);
        $lang_string = str_replace('/lms/course/public/public_subscribe_admin/', '_SUBSCRIBE_', $lang_string);
        $lang_string = str_replace('/lms/course/public/public_report_admin/', '_REPORT_', $lang_string);
        $lang_string = str_replace('/lms/course/public/public_newsletter_admin/', '_NEWSLETTER_', $lang_string);
        $lang_string = str_replace('/lms/course/public/public_certificate_release/', '_CERTIFICATES_', $lang_string);
        $lang_string = str_replace('/lms/course/public/public_coursepanel/', '_COURSEPANEL_COMPETENCES', $lang_string);
        $lang_string = strtoupper($lang_string);
        $content = array();
        $content[] = '<input class="check" type="checkbox" ' . 'id="' . $role['roleid'] . '" ' . 'name="' . $role['roleid'] . '" value="' . $role['idst'] . '"' . ($admin_manager->controlPublicUserAdminRole($adminidst, $role['idst']) ? ' checked="checked"' : '') . ' />';
        $content[] = $lang->def($lang_string);
        $table->addBody($content);
    }
    $out->add($table->getTable() . Form::openButtonSpace() . Form::getButton('save_permission', 'save_permission', $lang->def('_SAVE')) . Form::getButton('undo_pref', 'undo_pref', $lang->def('_UNDO')) . Form::closeButtonSpace() . Form::closeForm() . '</div>');
}
Example #27
0
function mycertificate(&$url)
{
    checkPerm('view');
    require_once _lms_ . '/lib/lib.course.php';
    require_once _base_ . '/lib/lib.table.php';
    $lang =& DoceboLanguage::createInstance('profile', 'framework');
    $lang =& DoceboLanguage::createInstance('course', 'lms');
    $lang =& DoceboLanguage::createInstance('certificate', 'lms');
    $admin_level = Docebo::user()->getUserLevelId();
    $show_preview = true;
    //($admin_level == ADMIN_GROUP_ADMIN || $admin_level == ADMIN_GROUP_GODADMIN);
    $title = $lang->def('_MY_CERTIFICATE', 'certificate');
    $html = getTitleArea($title, 'mycertificate') . '<div class="std_block">';
    //--- draw time periods dropdown ---------------------------------------------
    $period_start = '';
    $period_end = '';
    //extract checking period
    $p_model = new TimeperiodsAlms();
    $year = date("Y");
    $p_list = array("0" => $lang->def('_ALL'));
    $p_selected = Get::req('selected_period', DOTY_INT, 0);
    $p_data = $p_model->getTimePeriods('', true);
    if (count($p_data) > 0) {
        foreach ($p_data as $obj) {
            $p_list[$obj->id_period] = Format::date($obj->start_date, 'date') . ' - ' . Format::date($obj->end_date, 'date');
            if ($p_selected == $obj->id_period) {
                $period_start = $obj->start_date;
                $period_end = $obj->end_date;
            }
        }
    }
    if (!array_key_exists($p_selected, $p_list)) {
        $p_selected = 0;
        $period_start = '';
        $period_end = '';
    }
    //date dropdown
    $onchange = ' onchange="javascript:this.form.submit();"';
    $html_filter_cert = '' . Form::openForm('selected_period_form_cert', $url->getUrl()) . Form::openElementSpace() . Form::getDropdown(Lang::t('_TIME_PERIODS', 'menu'), 'selected_period_cert', 'selected_period', $p_list, $p_selected, '', '', $onchange) . Form::closeElementSpace() . Form::getHidden('current_tab_cert', 'current_tab', Get::req('current_tab', DOTY_STRING, 'cert')) . Form::getHidden('is_filtering_cert', 'is_filtering_cert', 1) . Form::closeForm();
    $html_filter_meta = '' . Form::openForm('selected_period_form_meta', $url->getUrl()) . Form::openElementSpace() . Form::getDropdown(Lang::t('_TIME_PERIODS', 'menu'), 'selected_period_meta', 'selected_period', $p_list, $p_selected, '', '', $onchange) . Form::closeElementSpace() . Form::getHidden('current_tab_meta', 'current_tab', Get::req('current_tab', DOTY_STRING, 'meta')) . Form::getHidden('is_filtering_meta', 'is_filtering_meta', 1) . Form::closeForm();
    //----------------------------------------------------------------------------
    $cert = new Certificate();
    /*
     * Print certificates tables, subdivided by year and course type
     */
    $html_cert = '';
    $tb_cert = new Table(0);
    $cont_h = array($lang->def('_YEAR', 'standard'), $lang->def('_COURSE_CODE', 'course'), $lang->def('_COURSE', 'course'), $lang->def('_CERTIFICATE_NAME', 'course'), $lang->def('_DATE_END', 'course'));
    //if ($show_preview) $cont_h[] = '<img src="'.getPathImage('lms').'certificate/preview.gif" alt="'.$lang->def('_PREVIEW').'" />';
    //$cont_h[] = '<img src="'.getPathImage('lms').'certificate/certificate.gif" alt="'.$lang->def('_ALT_TAKE_A_COPY').'" />';
    if ($show_preview) {
        $cont_h[] = '<span class="ico-sprite subs_view"><span>' . $lang->def('_PREVIEW') . '"</span></span>';
    }
    $cont_h[] = '<span class="ico-sprite subs_pdf"><span>' . $lang->def('_ALT_TAKE_A_COPY') . '</span></span>';
    $type_h = array('img-cell', '', '', 'align-center', 'align-center', 'img-cell', 'img-cell');
    if ($show_preview) {
        $type_h[] = 'nowarp';
    }
    $type_h[] = 'nowarp';
    $tb_cert->setColsStyle($type_h);
    $tb_cert->addHead($cont_h);
    $available_cert = $cert->certificateForCourses(false, false);
    $released = $cert->certificateReleased(Docebo::user()->getIdST());
    $query_courses = "" . " SELECT c.idCourse, c.code, c.name, u.status AS user_status, c.course_type, c.permCloseLO " . " FROM %lms_course AS c JOIN %lms_courseuser AS u ON (c.idCourse = u.idCourse) " . " WHERE u.idUser = '******' " . ($period_start != '' ? " AND u.date_complete >= '" . $period_start . "' " : "") . ($period_end != '' ? " AND u.date_complete <= '" . $period_end . "' " : "") . " ORDER BY u.date_complete DESC, u.status DESC ";
    $course_list = sql_query($query_courses);
    $arr_courses = array();
    $arr_courses_ids = array();
    while ($obj = sql_fetch_object($course_list)) {
        $arr_courses[$obj->course_type][] = array($obj->idCourse, $obj->code, $obj->name, $obj->user_status, $obj->permCloseLO);
        $arr_courses_ids[] = $obj->idCourse;
    }
    $arr_course_types = getCourseTypes();
    $table_displayed = false;
    //extract certificates details and availability by courses ids
    $arr_courses_ids = array_unique($arr_courses_ids);
    $arr_certificates_availability = array();
    $arr_certificates_details = array();
    if (count($arr_courses_ids) > 0) {
        $query = "SELECT id_certificate, id_course, available_for_status " . " FROM " . $GLOBALS['prefix_lms'] . "_certificate_course" . " WHERE id_course IN (" . implode(",", $arr_courses_ids) . ")";
        //." WHERE id_certificate = '".$id_cert."'"
        //." AND id_course IN (".implode(",", $arr_courses_ids).")";
        $res = sql_query($query);
        while (list($id_certificate, $id_course, $available_for_status) = sql_fetch_row($res)) {
            $arr_certificates_availability[$id_course][$id_certificate] = $available_for_status;
        }
        $cont = array();
        $query = "SELECT idCourse, date_inscr, date_first_access, date_complete, status" . " FROM %lms_courseuser WHERE idUser = '******'" . " AND idCourse IN (" . implode(",", $arr_courses_ids) . ") " . ($period_start != '' ? " AND date_complete >= '" . $period_start . "' " : "") . ($period_end != '' ? " AND date_complete <= '" . $period_end . "' " : "");
        $res = sql_query($query);
        while (list($id_course, $date_inscr, $date_begin, $date_end, $status) = sql_fetch_row($res)) {
            $arr_certificate_details[$id_course] = array($date_inscr, $date_begin, $date_end, $status);
        }
    }
    //order arr_courses by key
    ksort($arr_courses);
    $years = array();
    foreach ($arr_courses as $course_type => $course_data) {
        if (in_array($course_type, array_keys($arr_course_types))) {
            //$html .= '';
            $tb = new Table(0);
            $tb->setColsStyle($type_h);
            $tb->addHead($cont_h);
            //filter and organize data to display
            $display_data = array();
            foreach ($course_data as $k => $value) {
                list($id_course, $code, $name, $user_status, $perm_close_lo) = $value;
                if (isset($available_cert[$id_course])) {
                    $can_rel_exceptional = false;
                    while (list($id_cert, $certificate) = each($available_cert[$id_course])) {
                        if ($cert->certificateAvailableForUser($id_cert, $id_course, getLogUserId())) {
                            if ($certificate[CERT_AV_POINT_REQUIRED] > 0) {
                                $course_score_final = false;
                                if ($perm_close_lo == 0) {
                                    require_once $GLOBALS['where_lms'] . '/lib/lib.orgchart.php';
                                    $org_man = new OrganizationManagement(false);
                                    $score_final = $org_man->getFinalObjectScore(array(getLogUserId()), array($id_course));
                                    if (isset($score_final[$id_course][getLogUserId()]) && $score_final[$id_course][getLogUserId()]['max_score']) {
                                        $course_score_final = $score_final[$id_course][getLogUserId()]['score'];
                                        $course_score_final_max = $score_final[$id_course][getLogUserId()]['max_score'];
                                    }
                                } else {
                                    require_once $GLOBALS['where_lms'] . '/lib/lib.coursereport.php';
                                    $rep_man = new CourseReportManager();
                                    $score_course = $rep_man->getUserFinalScore(array(getLogUserId()), array($id_course));
                                    if (!empty($score_course)) {
                                        $course_score_final = isset($score_course[getLogUserId()][$id_course]) ? $score_course[getLogUserId()][$id_course]['score'] : false;
                                        $course_score_final_max = isset($score_course[getLogUserId()][$id_course]) ? $score_course[getLogUserId()][$id_course]['max_score'] : false;
                                    }
                                }
                                if ($course_score_final >= $certificate[CERT_AV_POINT_REQUIRED]) {
                                    $can_rel_exceptional = true;
                                }
                            }
                        }
                    }
                    reset($available_cert[$id_course]);
                    //count years for rowspans
                    while (list($id_cert, $certificate) = each($available_cert[$id_course])) {
                        //(aggiunto if prima dell'or)
                        if ($cert->certificateAvailableForUser($id_cert, $id_course, getLogUserId())) {
                            //$value[4] = $id_cert;
                            list($available_for_status) = $arr_certificates_availability[$id_course][$id_cert];
                            list($date_inscr, $date_begin, $date_end, $status) = $arr_certificate_details[$id_course];
                            if ($available_for_status == 3 && $status == 2 || $available_for_status == 2 && $status == 1 || $available_for_status == 1) {
                                //$year = substr($date_end, 0, 4);
                                switch ($available_for_status) {
                                    case 3:
                                        $cur_year = substr($date_end, 0, 4);
                                        break;
                                    case 2:
                                        $cur_year = substr($date_begin, 0, 4);
                                        break;
                                    case 1:
                                        $cur_year = substr($date_inscr, 0, 4);
                                        break;
                                    default:
                                        $cur_year = '-';
                                }
                                // (mi ricreo l'array value perchè manca di date_* BUG FIX)
                                $value = array($id_course, $code, $name, $date_begin, $date_end, $user_status, $perm_close_lo);
                                $value[6] = $id_cert;
                                $query = "SELECT name " . " FROM " . $GLOBALS['prefix_lms'] . "_certificate" . " WHERE id_certificate = " . $id_cert;
                                $res = sql_query($query);
                                list($cname) = sql_fetch_row($res);
                                $value[7] = $cname;
                                if ($can_rel_exceptional && $certificate[CERT_AV_POINT_REQUIRED] > 0) {
                                    if (isset($years[$course_type][$cur_year])) {
                                        $years[$course_type][$cur_year]++;
                                    } else {
                                        $years[$course_type][$cur_year] = 1;
                                    }
                                    $display_data[$cur_year][] = $value;
                                } elseif (!$can_rel_exceptional && $certificate[CERT_AV_POINT_REQUIRED] == 0) {
                                    if (isset($years[$course_type][$cur_year])) {
                                        $years[$course_type][$cur_year]++;
                                    } else {
                                        $years[$course_type][$cur_year] = 1;
                                    }
                                    $display_data[$cur_year][] = $value;
                                }
                            }
                        }
                    }
                }
            }
            if (count($display_data) > 0) {
                krsort($display_data);
            }
            $av_cert = 0;
            $prev_year = false;
            $rowspan_counter = 0;
            require_once $GLOBALS['where_lms'] . '/lib/lib.orgchart.php';
            $org_man = new OrganizationManagement(false);
            foreach ($display_data as $year => $rows) {
                $first = true;
                foreach ($rows as $row) {
                    // list($id_course, $code, $name, $user_status, $id_cert) = $row;
                    list($id_course, $code, $name, $date_begin, $date_end, $user_status, $id_cert, $cname) = $row;
                    $cont = array();
                    if ($first) {
                        $cont[] = array('rowspan' => isset($years[$course_type][$year]) ? $years[$course_type][$year] : 1, 'value' => $year, 'style' => $type_h[0] . ' mycertificate_rowspan' . ($rowspan_counter % 2 > 0 ? '_odd' : ''));
                        $rowspan_counter++;
                        $first = false;
                    }
                    // 2 - the code of the course
                    $cont[] = array('value' => $code, 'style' => $type_h[1]);
                    // 3 - the name of the course
                    $cont[] = array('value' => $name, 'style' => $type_h[2]);
                    // sostituito date_begin con certificate name
                    // 4 - starting date
                    //					$cont[] = array(
                    //						'value' => Format::date($date_begin, 'datetime'),
                    //						'style' => $type_h[3]
                    //					);
                    $cont[] = array('value' => $cname, 'style' => $type_h[3]);
                    // 5 - complete date
                    $cont[] = array('value' => Format::date($date_end, 'datetime'), 'style' => $type_h[4]);
                    //-- scores --
                    $score_start = $org_man->getStartObjectScore(array(Docebo::user()->getIdST()), array($id_course));
                    $score_final = $org_man->getFinalObjectScore(array(Docebo::user()->getIdST()), array($id_course));
                    $_value1 = isset($score_start[$id_course][Docebo::user()->getIdST()]) && $score_start[$id_course][Docebo::user()->getIdST()]['max_score'] ? $score_start[$id_course][Docebo::user()->getIdST()]['score'] . ' / ' . $score_start[$id_course][Docebo::user()->getIdST()]['max_score'] : '';
                    $_value2 = isset($score_final[$id_course][Docebo::user()->getIdST()]) && $score_final[$id_course][Docebo::user()->getIdST()]['max_score'] ? $score_final[$id_course][Docebo::user()->getIdST()]['score'] . ' / ' . $score_final[$id_course][Docebo::user()->getIdST()]['max_score'] : '';
                    /* hide course scores - remove comment to show
                    					// 6 - init score
                    					$cont[] = array(
                    						'value' => $_value1,
                    						'style' => $type_h[5]
                    					);
                    
                    					// 7 - end score
                    					$cont[] = array(
                    						'value' => $_value2,
                    						'style' => $type_h[6]
                    					);
                    					*/
                    if (isset($released[$id_course][$id_cert])) {
                        $av_cert++;
                        if ($show_preview) {
                            $cont[] = array('value' => '', 'style' => $type_h[7]);
                        }
                        $_value = '<a class="ico-wt-sprite subs_pdf" href="' . $url->getUrl('op=release_cert&id_certificate=' . $id_cert . '&id_course=' . $id_course) . '" ' . ' title="' . $lang->def('_TAKE_A_COPY') . '"><span>' . $lang->def('_TAKE_A_COPY') . '</span></a>';
                        $cont[] = array('value' => $_value, 'style' => $type_h[$show_preview ? 8 : 7]);
                    } else {
                        $av_cert++;
                        if ($show_preview) {
                            $_value = '<a class="ico-wt-sprite subs_view" href="' . $url->getUrl('op=preview_cert&id_certificate=' . $id_cert . '&id_course=' . $id_course) . '" ' . ' title="' . $lang->def('_PREVIEW') . '"><span>' . $lang->def('_PREVIEW') . '</span></a>';
                            $cont[] = array('value' => $_value, 'style' => $type_h[7]);
                        }
                        $_value = '<a class="ico-wt-sprite subs_pdf" href="' . $url->getUrl('op=release_cert&id_certificate=' . $id_cert . '&id_course=' . $id_course) . '" ' . ' title="' . $lang->def('_NEW_CERTIFICATE') . '"><span>' . $lang->def('_NEW_CERTIFICATE') . '</span></a>';
                        $cont[] = array('value' => $_value, 'style' => $type_h[$show_preview ? 8 : 7]);
                    }
                    $tb->addBody($cont);
                }
            }
            if ($av_cert > 0) {
                $table_displayed = true;
                $html_cert .= '<h2 class="mycertificate_title">' . $arr_course_types[$course_type] . '</h2>';
                $html_cert .= $tb->getTable();
            }
        }
    }
    //end course_type foreach
    if (!$table_displayed) {
        $is_filtering = Get::req('is_filtering_cert', DOTY_INT, 0);
        $html_cert .= '<p>' . ($is_filtering ? $html_filter_cert : '') . $lang->def('_NO_CONTENT') . '</p>';
    } else {
        $html_cert = $html_filter_cert . $html_cert;
    }
    //-------------------------------------------------------------------------------------------
    /*
     * Print meta-certificates table
     */
    $html_meta = '';
    $tb_meta_cert = new Table(0);
    $cont_h = array();
    $cont_h[] = $lang->def('_CODE');
    $cont_h[] = $lang->def('_NAME');
    $cont_h[] = $lang->def('_COURSE_LIST');
    //if ($show_preview) $cont_h[] = '<img src="'.getPathImage('lms').'certificate/preview.gif" alt="'.$lang->def('_PREVIEW').'" />';
    //$cont_h[] = '<img src="'.getPathImage('lms').'certificate/certificate.gif" alt="'.$lang->def('_ALT_TAKE_A_COPY').'" />';
    if ($show_preview) {
        $cont_h[] = '<span class="ico-sprite subs_view"><span>' . $lang->def('_PREVIEW') . '"</span></span>';
    }
    $cont_h[] = '<span class="ico-sprite subs_pdf"><span>' . $lang->def('_ALT_TAKE_A_COPY') . '</span></span>';
    $type_h = array();
    $type_h[] = '';
    $type_h[] = '';
    $type_h[] = '';
    if ($show_preview) {
        $type_h[] = 'img-cell';
    }
    //'nowrap';
    $type_h[] = 'img-cell';
    //'nowrap';
    $tb_meta_cert->setColsStyle($type_h);
    $tb_meta_cert->addHead($cont_h);
    $query = "SELECT c.idMetaCertificate, m.title, m.description, m.idCertificate" . " FROM %lms_certificate_meta_course as c" . " JOIN %lms_certificate_meta as m ON c.idMetaCertificate = m.idMetaCertificate" . " WHERE c.idUser = '******'" . " GROUP BY c.idMetaCertificate" . " ORDER BY m.title, m.description";
    $result = sql_query($query);
    $av_meta_cert = sql_num_rows($result);
    $cert_meta_html = '';
    while (list($id_meta, $name, $description, $id_certificate) = sql_fetch_row($result)) {
        $cont = array();
        $query = "SELECT code, name" . " FROM %lms_certificate" . " WHERE id_certificate = " . " (" . " SELECT idCertificate" . " FROM %lms_certificate_meta" . " WHERE idMetaCertificate = '" . $id_meta . "'" . " )";
        list($code, $name) = sql_fetch_row(sql_query($query));
        $cont[] = $code;
        $cont[] = $name;
        $query_released = "SELECT on_date" . " FROM %lms_certificate_meta_assign" . " WHERE idUser = '******'" . " AND idMetaCertificate = '" . $id_meta . "'";
        $result_released = sql_query($query_released);
        $query = "SELECT user_release" . " FROM %lms_certificate" . " WHERE id_certificate = '" . $id_certificate . "'";
        list($user_release) = sql_fetch_row(sql_query($query));
        if (sql_num_rows($result_released)) {
            $course_list = '';
            $first = true;
            $query_course = "SELECT code, name" . " FROM %lms_course" . " WHERE idCourse IN " . "(" . "SELECT idCourse" . " FROM " . $GLOBALS['prefix_lms'] . "_certificate_meta_course" . " WHERE idUser = '******'" . " AND idMetaCertificate = '" . $id_meta . "'" . ")";
            $result_course = sql_query($query_course);
            while (list($code, $name) = sql_fetch_row($result_course)) {
                if ($first) {
                    $first = false;
                } else {
                    $course_list .= '<br/>';
                }
                $course_list .= '(' . $code . ') - ' . $name;
            }
            $cont[] = $course_list;
            if ($show_preview) {
                $cont[] = '';
            }
            list($date) = sql_fetch_row($result_released);
            $cont[] = '<a class="ico-wt-sprite subs_pdf" href="' . $url->getUrl('op=release_cert&id_certificate=' . $id_certificate . '&idmeta=' . $id_meta) . '" ' . ' title="' . $lang->def('_TAKE_A_COPY') . '"><span>' . $lang->def('_TAKE_A_COPY') . '</span></a>';
            $tb_meta_cert->addBody($cont);
        } elseif ($user_release == 0) {
            $av_meta_cert--;
        } else {
            $query = "SELECT idCourse" . " FROM %lms_certificate_meta_course" . " WHERE idUser = '******'" . " AND idMetaCertificate = '" . $id_meta . "'";
            $result_int = sql_query($query);
            $control = true;
            while (list($id_course) = sql_fetch_row($result_int)) {
                $query = "SELECT COUNT(*)" . " FROM %lms_courseuser" . " WHERE idCourse = '" . $id_course . "'" . " AND idUser = '******'" . " AND status = '" . _CUS_END . "'";
                list($number) = sql_fetch_row(sql_query($query));
                if (!$number) {
                    $control = false;
                }
            }
            if ($control) {
                $course_list = '';
                $first = true;
                $query_course = "SELECT code, name" . " FROM %lms_course" . " WHERE idCourse IN " . "(" . "SELECT idCourse" . " FROM " . $GLOBALS['prefix_lms'] . "_certificate_meta_course" . " WHERE idUser = '******'" . " AND idMetaCertificate = '" . $id_meta . "'" . ")";
                $result_course = sql_query($query_course);
                while (list($code, $name) = sql_fetch_row($result_course)) {
                    if ($first) {
                        $first = false;
                    } else {
                        $course_list .= '<br/>';
                    }
                    $course_list .= '(' . $code . ') - ' . $name;
                }
                $cont[] = $course_list;
                if ($show_preview) {
                    $cont[] = '<a class="ico-wt-sprite subs_view" href="' . $url->getUrl('op=preview_cert&id_certificate=' . $id_certificate . '&idmeta=' . $id_meta) . '" ' . ' title="' . $lang->def('_PREVIEW') . '"><span>' . $lang->def('_PREVIEW') . '</span></a>';
                }
                $cont[] = '<a class="ico-wt-sprite subs_pdf" href="' . $url->getUrl('op=release_cert&id_certificate=' . $id_certificate . '&idmeta=' . $id_meta) . '" ' . ' title="' . $lang->def('_NEW_CERTIFICATE') . '"><span>' . $lang->def('_NEW_CERTIFICATE') . '</span></a>';
                $tb_meta_cert->addBody($cont);
            } else {
                $av_meta_cert--;
            }
        }
    }
    if ($av_meta_cert) {
        $html_meta .= $tb_meta_cert->getTable() . '<br/><br/>';
    } else {
        //$is_filtering = Get::req('is_filtering_meta', DOTY_INT, 0);
        //$html_meta .= '<p>'.($is_filtering>0 ? $html_filter_meta : '').$lang->def('_NO_CONTENT').'</p>';
        $html_meta .= '<p>' . $lang->def('_NO_CONTENT') . '</p>';
    }
    //-----------------------------------------------------------------------------
    $selected_tab = Get::req('current_tab', DOTY_STRING, 'cert');
    $html .= '<div id="mycertificate_tabs" class="yui-navset">
			<ul class="yui-nav">
					<li' . ($selected_tab == 'cert' ? ' class="selected"' : '') . '><a href="#cert"><em>' . Lang::t('_CERTIFICATE', 'menu') . '</em></a></li>
					<li' . ($selected_tab == 'meta' ? ' class="selected"' : '') . '><a href="#meta"><em>' . Lang::t('_TITLE_META_CERTIFICATE', 'certificate') . '</em></a></li>
			</ul>
			<div class="yui-content">
					<div>' . $html_cert . '</div>
					<div>' . $html_meta . '</div>
			</div>
		</div>';
    $html .= '</div>';
    //close std_block div
    cout($html, 'content');
    YuiLib::load('tabs');
    cout('<script type="text/javascript">var myTabs = new YAHOO.widget.TabView("mycertificate_tabs");</script>', 'scripts');
}
Example #28
0
 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]');
     }
 }
 /**
  *
  */
 public function reporte($institucion_id, $assignedform_id = 1)
 {
     $this->loadModel('Assignedform');
     if (!$this->Assignedform->exists($assignedform_id)) {
         throw new NotFoundException(__('Invalid form'));
     }
     $this->Paginator->paginate = 0;
     $fields = array('Assignedform.implementation', 'Assignedform.form_id');
     $conditions = array('Assignedform.institucion_id' => $institucion_id, 'Assignedform.id' => $assignedform_id);
     $options = array('fields' => $fields, 'conditions' => $conditions);
     $assignedform = $this->Assignedform->find('first', $options);
     $form_id = $assignedform['Assignedform']['form_id'];
     $options = array('conditions' => array('Form.' . $this->Form->primaryKey => $form_id));
     $form = $this->Form->find('first', $options);
     $this->set('form', $form);
     $form['Assignedform']['implementation'] = $assignedform['Assignedform']['implementation'];
     $this->loadModel('Institucion');
     $this->Paginator->paginate = 0;
     $fields = array('Institucion.id', 'Institucion.name');
     $conditions = array('Institucion.id' => $institucion_id);
     $options = array('fields' => $fields, 'conditions' => $conditions);
     $institucion = $this->Institucion->find('first', $options);
     $form['Institucion'] = $institucion['Institucion'];
     $this->loadModel('Answer');
     $this->Auth->recursive = 0;
     $fields = array('Question.id', 'COUNT(Answer.answer) AS total');
     $conditions = array('Answer.assignedform_id' => $assignedform_id);
     $joins = array(array('table' => 'questions', 'alias' => 'Questions', 'type' => 'INNER', 'conditions' => array('Questions.id = Answer.question_id')));
     $group = array('Answer.question_id');
     $options = array('fields' => $fields, 'conditions' => $conditions, 'group' => $group);
     $options['conditions']['Answer.answer'] = 1;
     $tmp_1 = $this->Answer->find('all', $options);
     $options['conditions']['Answer.answer'] = 2;
     $tmp_2 = $this->Answer->find('all', $options);
     $options['conditions']['Answer.answer'] = 3;
     $tmp_3 = $this->Answer->find('all', $options);
     $options['conditions']['Answer.answer'] = 4;
     $tmp_4 = $this->Answer->find('all', $options);
     $options['conditions']['Answer.answer'] = 5;
     $tmp_5 = $this->Answer->find('all', $options);
     $options['conditions']['Answer.answer'] = 6;
     $tmp_6 = $this->Answer->find('all', $options);
     $options['conditions']['Answer.answer'] = 7;
     $tmp_7 = $this->Answer->find('all', $options);
     $options['conditions']['Answer.answer'] = 8;
     $tmp_8 = $this->Answer->find('all', $options);
     $options['conditions']['Answer.answer'] = 9;
     $tmp_9 = $this->Answer->find('all', $options);
     $options['conditions']['Answer.answer'] = 10;
     $tmp_10 = $this->Answer->find('all', $options);
     foreach ($tmp_1 as $item) {
         $res_1[$item['Question']['id']] = $item[0]['total'];
     }
     foreach ($tmp_2 as $item) {
         $res_2[$item['Question']['id']] = $item[0]['total'];
     }
     foreach ($tmp_3 as $item) {
         $res_3[$item['Question']['id']] = $item[0]['total'];
     }
     foreach ($tmp_4 as $item) {
         $res_4[$item['Question']['id']] = $item[0]['total'];
     }
     foreach ($tmp_5 as $item) {
         $res_5[$item['Question']['id']] = $item[0]['total'];
     }
     foreach ($tmp_6 as $item) {
         $res_6[$item['Question']['id']] = $item[0]['total'];
     }
     foreach ($tmp_7 as $item) {
         $res_7[$item['Question']['id']] = $item[0]['total'];
     }
     foreach ($tmp_8 as $item) {
         $res_8[$item['Question']['id']] = $item[0]['total'];
     }
     foreach ($tmp_9 as $item) {
         $res_9[$item['Question']['id']] = $item[0]['total'];
     }
     foreach ($tmp_10 as $item) {
         $res_10[$item['Question']['id']] = $item[0]['total'];
     }
     $total = count($form['Question']);
     for ($i = 0; $i < $total; $i++) {
         $form['Question'][$i]['1'] = 0;
         if (isset($res_1[$form['Question'][$i]['id']])) {
             $form['Question'][$i]['1'] = $res_1[$form['Question'][$i]['id']];
         }
         $form['Question'][$i]['2'] = 0;
         if (isset($res_2[$form['Question'][$i]['id']])) {
             $form['Question'][$i]['2'] = $res_2[$form['Question'][$i]['id']];
         }
         $form['Question'][$i]['3'] = 0;
         if (isset($res_3[$form['Question'][$i]['id']])) {
             $form['Question'][$i]['3'] = $res_3[$form['Question'][$i]['id']];
         }
         $form['Question'][$i]['4'] = 0;
         if (isset($res_4[$form['Question'][$i]['id']])) {
             $form['Question'][$i]['4'] = $res_4[$form['Question'][$i]['id']];
         }
         $form['Question'][$i]['5'] = 0;
         if (isset($res_5[$form['Question'][$i]['id']])) {
             $form['Question'][$i]['5'] = $res_5[$form['Question'][$i]['id']];
         }
         $form['Question'][$i]['6'] = 0;
         if (isset($res_6[$form['Question'][$i]['id']])) {
             $form['Question'][$i]['6'] = $res_6[$form['Question'][$i]['id']];
         }
         $form['Question'][$i]['7'] = 0;
         if (isset($res_7[$form['Question'][$i]['id']])) {
             $form['Question'][$i]['7'] = $res_7[$form['Question'][$i]['id']];
         }
         $form['Question'][$i]['8'] = 0;
         if (isset($res_8[$form['Question'][$i]['id']])) {
             $form['Question'][$i]['8'] = $res_8[$form['Question'][$i]['id']];
         }
         $form['Question'][$i]['9'] = 0;
         if (isset($res_9[$form['Question'][$i]['id']])) {
             $form['Question'][$i]['9'] = $res_9[$form['Question'][$i]['id']];
         }
         $form['Question'][$i]['10'] = 0;
         if (isset($res_10[$form['Question'][$i]['id']])) {
             $form['Question'][$i]['10'] = $res_10[$form['Question'][$i]['id']];
         }
         $total_tmp = $form['Question'][$i]['1'] + $form['Question'][$i]['2'] + $form['Question'][$i]['3'] + $form['Question'][$i]['4'] + $form['Question'][$i]['5'] + $form['Question'][$i]['6'] + $form['Question'][$i]['7'] + $form['Question'][$i]['8'] + $form['Question'][$i]['9'] + $form['Question'][$i]['10'];
         if (0 == $total_tmp) {
             $total_tmp = 1;
         }
         $form['Question'][$i]['1'] = $form['Question'][$i]['1'] / $total_tmp * 100;
         $form['Question'][$i]['2'] = $form['Question'][$i]['2'] / $total_tmp * 100;
         $form['Question'][$i]['3'] = $form['Question'][$i]['3'] / $total_tmp * 100;
         $form['Question'][$i]['4'] = $form['Question'][$i]['4'] / $total_tmp * 100;
         $form['Question'][$i]['5'] = $form['Question'][$i]['5'] / $total_tmp * 100;
         $form['Question'][$i]['6'] = $form['Question'][$i]['6'] / $total_tmp * 100;
         $form['Question'][$i]['7'] = $form['Question'][$i]['7'] / $total_tmp * 100;
         $form['Question'][$i]['8'] = $form['Question'][$i]['8'] / $total_tmp * 100;
         $form['Question'][$i]['9'] = $form['Question'][$i]['9'] / $total_tmp * 100;
         $form['Question'][$i]['10'] = $form['Question'][$i]['10'] / $total_tmp * 100;
     }
     $this->set('form', $form);
     // Reporte LaTeX
     include 'Component/latex-report/lib/LaTeX.php';
     include 'Component/latex-report/lib/Table.php';
     $latex = new LaTeX();
     $latex->setDocumentclass('letterpaper');
     $latex->usepackage('utf8', 'inputenc');
     $latex->usepackage('spanish,mexico', 'babel');
     $latex->usepackage('pdftex', 'graphicx');
     $latex->usepackage('left=2cm, right=2cm, top=3cm, bottom=5.5cm', 'geometry');
     $latex->usepackage('', 'supertabular');
     $latex->usepackage('', 'fancyhdr');
     $latex->usepackage('light,math', 'kurier');
     $dir = $this->getDirLaTeX('sistema');
     $encabezado = '\\begin{Huge}\\textbf{' . $form['Institucion']['name'] . '}\\end{Huge}' . '\\\\ ~ \\\\ \\begin{Large}\\textbf{Reporte de Evaluación}\\end{Large}';
     $latex->head('C', $encabezado);
     $latex->foot('C', '');
     /**
      * Begin document
      */
     $latex->write('\\pagenumbering{gobble}');
     /**
      * Begin table
      */
     $tabla = new Table();
     #$tabla->setColumn('p{1cm}');
     $tabla->setColumn('p{12.5cm}');
     #$tabla->setColumn('p{1cm}');
     #$tabla->setColumn('p{1cm}');
     #$tabla->addTitle('Id');
     $tabla->addTitle('Pregunta');
     foreach ($form['Question'] as $item) {
         $tabla->newRow();
         #$tabla->addCol($item['id']);
         $tabla->addCol($item['name']);
         $tabla->addRow();
         if ($item['kind'] == 0) {
             $tabla->newRow();
             $tabla->addCol('Si ' . round($item['1'], 2) . ' \\%');
             $tabla->addRow();
             $tabla->newRow();
             $tabla->addCol('No ' . round($item['2'], 2) . ' \\%');
             $tabla->addRow();
         }
         if ($item['kind'] == 1) {
             $tabla->newRow();
             $tabla->addCol('Excelente ' . round($item['1'], 2) . ' \\%');
             $tabla->addRow();
             $tabla->newRow();
             $tabla->addCol('Muy bueno ' . round($item['2'], 2) . ' \\%');
             $tabla->addRow();
             $tabla->newRow();
             $tabla->addCol('Bueno ' . round($item['3'], 2) . ' \\%');
             $tabla->addRow();
             $tabla->newRow();
             $tabla->addCol('Malo ' . round($item['4'], 2) . ' \\%');
             $tabla->addRow();
             $tabla->newRow();
             $tabla->addCol('Muy malo ' . round($item['5'], 2) . ' \\%');
             $tabla->addRow();
         }
         if ($item['kind'] == 2) {
             $tabla->newRow();
             $tabla->addCol('1- ' . round($item['1'], 2) . ' \\%');
             $tabla->addRow();
             $tabla->newRow();
             $tabla->addCol('2- ' . round($item['2'], 2) . ' \\%');
             $tabla->addRow();
             $tabla->newRow();
             $tabla->addCol('3- ' . round($item['3'], 2) . ' \\%');
             $tabla->addRow();
             $tabla->newRow();
             $tabla->addCol('4- ' . round($item['4'], 2) . ' \\%');
             $tabla->addRow();
             $tabla->newRow();
             $tabla->addCol('5- ' . round($item['5'], 2) . ' \\%');
             $tabla->addRow();
             $tabla->newRow();
             $tabla->addCol('6- ' . round($item['6'], 2) . ' \\%');
             $tabla->addRow();
             $tabla->newRow();
             $tabla->addCol('7- ' . round($item['7'], 2) . ' \\%');
             $tabla->addRow();
             $tabla->newRow();
             $tabla->addCol('8- ' . round($item['8'], 2) . ' \\%');
             $tabla->addRow();
             $tabla->newRow();
             $tabla->addCol('9- ' . round($item['9'], 2) . ' \\%');
             $tabla->addRow();
             $tabla->newRow();
             $tabla->addCol('10- ' . round($item['10'], 2) . ' \\%');
             $tabla->addRow();
         }
     }
     $latex->write('');
     $latex->write('Nombre del formulario: \\textbf{' . $form['Form']['name'] . '}');
     $latex->write($tabla->getTable());
     $latex->write('');
     $latex->write('');
     $latex->write('\\begin{flushright}El Salvador \\today \\begin{flushright}');
     /**
      * End table
      */
     /**
      * End document
      */
     $archivo = $this->Auth->user('institucion_id');
     $documento = $latex->getLaTeX($dir, $archivo);
     $this->set('dir', $dir);
     $this->set('archivo', $archivo);
 }
Example #30
0
 function getPermissionUi($form_name, $perm, $module_op)
 {
     require_once _base_ . '/lib/lib.table.php';
     $lang =& DoceboLanguage::createInstance('manmenu', 'framework');
     $lang_perm =& DoceboLanguage::createInstance('permission', 'framework');
     $tokens = $this->getAllToken($module_op);
     $levels = CourseLevel::getLevels();
     $tb = new Table(0, $lang->def('_VIEW_PERMISSION'), $lang->def('_EDIT_SETTINGS'));
     $c_head = array($lang->def('_LEVELS'));
     $t_head = array('');
     foreach ($tokens as $k => $token) {
         if (isset($token['image'])) {
             $c_head[] = '<img src="' . getPathImage() . $token['image'] . '" alt="' . $lang_perm->def($token['name']) . '"' . ' title="' . $lang_perm->def($token['name']) . '" />';
         } else {
             $c_head[] = $lang_perm->def($token['name']);
         }
         $t_head[] = 'image';
     }
     if (count($tokens) > 1) {
         $c_head[] = '<img src="' . getPathImage() . 'standard/checkall.png" alt="' . $lang->def('_CHECKALL') . '" />';
         $c_head[] = '<img src="' . getPathImage() . 'standard/uncheckall.png" alt="' . $lang->def('_UNCHECKALL') . '" />';
         $t_head[] = 'image';
         $t_head[] = 'image';
     }
     $tb->setColsStyle($t_head);
     $tb->addHead($c_head);
     while (list($lv, $levelname) = each($levels)) {
         $c_body = array($levelname);
         foreach ($tokens as $k => $token) {
             $c_body[] = '<input class="check" type="checkbox" ' . 'id="perm_' . $lv . '_' . $token['code'] . '" ' . 'name="perm[' . $lv . '][' . $token['code'] . ']" value="1"' . (isset($perm[$lv][$token['code']]) ? ' checked="checked"' : '') . ' />' . '<label class="access-only" for="perm_' . $lv . '_' . $token['code'] . '">' . $lang_perm->def($token['name']) . '</label>' . "\n";
         }
         if (count($tokens) > 1) {
             $c_body[] = '<img class="handover"' . ' onclick="checkall(\'' . $form_name . '\', \'perm[' . $lv . ']\', true); return false;"' . ' src="' . getPathImage() . 'standard/checkall.png" alt="' . $lang->def('_CHECKALL') . '" />';
             $c_body[] = '<img class="handover"' . ' onclick="checkall(\'' . $form_name . '\', \'perm[' . $lv . ']\', false); return false;"' . ' src="' . getPathImage() . 'standard/uncheckall.png" alt="' . $lang->def('_UNCHECKALL') . '" />';
         }
         $tb->addBody($c_body);
     }
     $c_select_all = array('');
     foreach ($tokens as $k => $token) {
         $c_select_all[] = '<img class="handover"' . ' onclick="checkall_fromback(\'' . $form_name . '\', \'[' . $token['code'] . ']\', true); return false;"' . ' src="' . getPathImage() . 'standard/checkall.png" alt="' . $lang->def('_CHECKALL') . '" />' . '<img class="handover"' . ' onclick="checkall_fromback(\'' . $form_name . '\', \'[' . $token['code'] . ']\', false); return false;"' . ' src="' . getPathImage() . 'standard/uncheckall.png" alt="' . $lang->def('_UNCHECKALL') . '" />';
     }
     if (count($tokens) > 1) {
         $c_select_all[] = '';
         $c_select_all[] = '';
     }
     $tb->addBody($c_select_all);
     return $tb->getTable();
 }