public function presenceTask()
 {
     require_once _base_ . '/lib/lib.form.php';
     YuiLib::load();
     $user_date = $this->model->getUserDateForCourse(getLogUserId(), $_SESSION['idCourse']);
     $date_info = $this->model->getDateInfoForPublicPresence($user_date);
     if ($this->id_date == 0) {
         $this->id_date = isset($date_info[0]['id_date']) ? $date_info[0]['id_date'] : 0;
     }
     $this->model->setIdDate($this->id_date);
     if (isset($_POST['save'])) {
         $this->model->savePresence();
     }
     foreach ($date_info as $info_date) {
         $date_for_dropdown[$info_date['id_date']] = $info_date['code'] . ' - ' . $info_date['name'] . ' (' . Format::date($info_date['date_begin'], 'date') . ')';
     }
     if ($this->id_date == 0) {
         $this->render('presence_empty', array());
     } else {
         $params = array();
         $params['model'] = $this->model;
         $params['dropdown'] = $date_for_dropdown;
         $params['tb'] = $this->model->getPresenceTable();
         $params['test_type'] = $this->model->getTestType();
         $params['date_for_dropdown'] = $date_for_dropdown;
         $this->render('presence', $params);
     }
 }
 function getSubstitution()
 {
     $subs = array();
     $subs['[today]'] = Format::date(date("Y-m-d H:i:s"), 'date');
     $subs['[year]'] = date("Y");
     return $subs;
 }
 public function gettimeperiodslistTask()
 {
     //read input data (table parameters and filter)
     $startIndex = Get::req('startIndex', DOTY_INT, 0);
     $results = Get::req('results', DOTY_INT, Get::sett('visuItem'));
     $rowsPerPage = Get::req('rowsPerPage', DOTY_INT, $results);
     $sort = Get::req('sort', DOTY_STRING, "");
     $dir = Get::req('dir', DOTY_STRING, "asc");
     $filter_text = Get::req('filter_text', DOTY_STRING, '');
     $searchFilter = array('text' => $filter_text);
     //calculate total records to display
     $total = $this->model->getTimePeriodsTotal($searchFilter);
     if ($startIndex >= $total) {
         if ($total < $results) {
             $startIndex = 0;
         } else {
             $startIndex = $total - $results;
         }
     }
     //get records from DB and format data
     $list = $this->model->getTimePeriodsList($startIndex, $results, $sort, $dir, $searchFilter);
     $output_records = array();
     if (is_array($list) && count($list) > 0) {
         foreach ($list as $record) {
             $output_records[] = array('id' => (int) $record->id_period, 'title' => Layout::highlight($record->title, $filter_text), 'label' => Layout::highlight($record->label, $filter_text), 'start_date' => Format::date($record->start_date, "date"), 'end_date' => Format::date($record->end_date, "date"), 'mod' => 'ajax.adm_server.php?r=alms/timeperiods/mod&id=' . (int) $record->id_period, 'del' => 'ajax.adm_server.php?r=alms/timeperiods/del&id=' . (int) $record->id_period);
         }
     }
     //prepare the output for the datatable
     $output = array('totalRecords' => $total, 'startIndex' => $startIndex, 'sort' => $sort, 'dir' => $dir, 'rowsPerPage' => $rowsPerPage, 'results' => count($output_records), 'records' => $output_records);
     echo $this->json->encode($output);
 }
 public function getTransaction($start_index, $results, $sort, $dir, $filter = false)
 {
     $query = "SELECT t.id_trans, t.date_creation, t.date_activated, t.paid, SUM(ti.price) as price, u.userid, u.firstname, u.lastname" . " FROM %adm_transaction as t" . " JOIN %adm_transaction_info as ti ON t.id_trans = ti.id_trans" . " JOIN %adm_user as u ON t.id_user = u.idst" . " WHERE 1";
     $query .= " GROUP BY t.id_trans";
     switch ($sort) {
         case 'userid':
             $query .= " ORDER BY u.userid " . $dir;
             break;
         case 'firstname':
             $query .= " ORDER BY u.firstname " . $dir;
             break;
         case 'lastname':
             $query .= " ORDER BY u.lastname " . $dir;
             break;
         case 'date_creation':
             $query .= " ORDER BY t.date_creation " . $dir;
             break;
         case 'date_activated':
             $query .= " ORDER BY t.date_activated " . $dir;
             break;
     }
     $start_index === false ? '' : ($query .= " LIMIT " . $start_index . ", " . $results);
     $result = sql_query($query);
     $res = array();
     while ($row = sql_fetch_assoc($result)) {
         $row['userid'] = $this->acl_man->relativeId($row['userid']);
         $row['date_creation'] = Format::date($row['date_creation'], 'datetime');
         $row['date_activated'] = Format::date($row['date_activated'], 'datetime');
         $row['paid'] = $row['paid'] == 1 ? Get::img('standard/status_active.png', Lang::t('_ACTIVATED', 'transaction')) : Get::img('standard/status_deactive.png', Lang::t('_NOT_ACTIVATED', 'transaction'));
         $row['edit'] = '<a href="index.php?r=alms/transaction/mod&amp;id_trans=' . $row['id_trans'] . '" title="' . Lang::t('_MOD', 'transaction') . '">' . Get::img('standard/edit.png', Lang::t('_MOD', 'transaction')) . '</a>';
         $res[] = $row;
     }
     return $res;
 }
Exemple #5
0
 function displaynotes()
 {
     checkPerm('view');
     require_once _base_ . '/lib/lib.table.php';
     $lang =& DoceboLanguage::createInstance('notes', 'lms');
     list($data, $title, $textof) = sql_fetch_row(sql_query("\r\n\tSELECT data,title,textof \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_notes \r\n\tWHERE idNotes='" . $_GET['idNotes'] . "' AND owner ='" . getLogUserid() . "' and idCourse='" . $_SESSION['idCourse'] . "'"));
     $page_title = array('index.php?modname=notes&amp;op=notes' => $lang->def('_NOTES'), $title);
     $GLOBALS['page']->add(getTitleArea($page_title, 'notes') . '<div class="std_block">' . getBackUi('index.php?modname=notes&amp;op=notes', $lang->def('_BACK')) . '<h2>' . $title . '</h2>' . '<div class="boxinfo_container">' . Format::date($data) . '<br /><br />' . '<b>' . $lang->def('_TEXTOF') . '</b><br />' . $textof . '</div>' . getBackUi('index.php?modname=notes&amp;op=notes', $lang->def('_BACK')) . '</div>', 'content');
 }
Exemple #6
0
 public static function setDefaultLogName($addName = '', $logKey = 'default', $runFileName = '')
 {
     if (empty($addName)) {
         $fileName = DIR_LOG . Format::date() . $addName . '.log';
     } else {
         $fileName = DIR_LOG . $addName . '.log';
     }
     FileSystem::createDirectory(DIR_LOG);
     self::$_fileNames[$logKey] = $fileName;
     self::$_runFileName = $runFileName;
 }
Exemple #7
0
 function export($value)
 {
     $config = $this->getConfiguration();
     if (!$value) {
         return '';
     } elseif ($config['gmt']) {
         return Format::userdate('Y-m-d H:i:s', $value);
     } else {
         return Format::date('Y-m-d H:i:s', $value);
     }
 }
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');
}
 /**
  * The news link for the home pages
  * @return <html>
  */
 public static function news($hnumber = 2)
 {
     $html = '<div id="news">';
     $textQuery = "\r\n\t\tSELECT idNews, publish_date, title, short_desc\r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_news\r\n\t\tWHERE language = '" . getLanguage() . "'\r\n\t\tORDER BY important DESC, publish_date DESC\r\n\t\tLIMIT 0," . Get::sett('visuNewsHomePage');
     //do query
     $result = sql_query($textQuery);
     if (sql_num_rows($hnumber)) {
         $html .= '<p>' . Lang::set('_NO_CONTENT', 'login') . '</p>';
     }
     while (list($idNews, $publish_date, $title, $short_desc) = sql_fetch_row($result)) {
         $html .= '<h' . $hnumber . '>' . '<a href="index.php?modname=login&amp;op=readnews&amp;idNews=' . $idNews . '">' . $title . '</a>' . '</h' . $hnumber . '>' . '<p class="news_textof">' . '<span class="news_data">' . Format::date($publish_date) . ' - </span>' . $short_desc . '</p>';
     }
     $html .= '</div>';
     return $html;
 }
Exemple #10
0
function loadNewsBlock()
{
    $lang = DoceboLanguage::createInstance('login');
    $textQuery = "\r\n\tSELECT idNews, publish_date, title, short_desc \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_news \r\n\tWHERE language = '" . getLanguage() . "'\r\n\tORDER BY important DESC, publish_date DESC";
    $result = sql_query($textQuery);
    $html = '<div class="home_news_block">' . '<h1>' . $lang->def('_NEWS') . '</h1>';
    while (list($idNews, $publish_date, $title, $short_desc) = sql_fetch_row($result)) {
        $html .= '<h2>' . '<a href="index.php?modname=login&amp;op=readnews&amp;idNews=' . $idNews . '">' . $title . '</a></h2>' . '<p><span class="news_data">' . $lang->def('_DATE') . ' ' . Format::date($publish_date, 'date') . ': </span>' . $short_desc . '</p>';
    }
    if (mysql_num_rows($result) == 0) {
        $html .= $lang->def('_NO_CONTENT');
    }
    $html .= '</div>';
    return $html;
}
Exemple #11
0
 public function public_get_one()
 {
     $total = $this->comment_check_db->count();
     $comment_check_data = $this->comment_check_db->order('id desc')->limit('19,1')->select();
     $comment_check_data = $comment_check_data[0];
     $r = array();
     if (is_array($comment_check_data) && !empty($comment_check_data)) {
         $this->comment_data_db->table_name($comment_check_data['tableid']);
         $r = $this->comment_data_db->getby_id($comment_check_data['comment_data_id']);
         $r['creat_at'] = Format::date($r['creat_at'], 1);
         if (CHARSET == 'gbk') {
             foreach ($r as $k => $v) {
                 $r[$k] = iconv('gbk', 'utf-8', $v);
             }
         }
     }
     echo json_encode(array('total' => $total, 'data' => $r));
 }
Exemple #12
0
function loadNews()
{
    if (Get::sett('visuNewsHomePage') == '0') {
        return;
    }
    if (Get::sett('activeNews') == 'off') {
        return;
    }
    $textQuery = "\r\n\tSELECT idNews, publish_date, title, short_desc\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_news\r\n\tWHERE language = '" . getLanguage() . "'\r\n\tORDER BY important DESC, publish_date DESC\r\n\tLIMIT 0," . Get::sett('visuNewsHomePage');
    $lang = DoceboLanguage::createInstance('login');
    $GLOBALS['page']->add('<li><a href="#home_page">' . $lang->def('_JUMP_TO') . ' : ' . $lang->def('_NEWS') . '</a></li>', 'blind_navigation');
    $GLOBALS['page']->add('<div class="news_block">' . '<h1>' . $lang->def('_NEWS') . '</h1>' . '<div class="news_list">', 'content');
    //do query
    $result = sql_query($textQuery);
    while (list($idNews, $publish_date, $title, $short_desc) = sql_fetch_row($result)) {
        $GLOBALS['page']->add('<h2><a href="index.php?modname=login&amp;op=readnews&amp;idNews=' . $idNews . '">' . $title . '</a></h2>' . '<p class="news_textof">' . '<span class="news_data">' . $lang->def('_DATE') . ' ' . Format::date($publish_date) . ' - </span>' . $short_desc . '</p>', 'content');
    }
    $GLOBALS['page']->add('</div>' . '</div>', 'content');
}
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');
}
Exemple #14
0
 function Header()
 {
     global $cfg;
     //Common header
     $logo = $this->getLogoFile();
     $this->Image($logo, null, $this->tMargin, 0, 20);
     if (strpos($logo, INCLUDE_DIR) === false) {
         unlink($logo);
     }
     $this->SetFont('Times', 'B', 16);
     $this->SetY($this->tMargin + 20);
     $this->SetX($this->lMargin);
     $this->Cell(0, 0, '', "B", 2, 'L');
     $this->Ln(1);
     $this->SetFont('Arial', 'B', 10);
     $this->Cell(0, 5, $cfg->getTitle(), 0, 0, 'L');
     $this->SetFont('Arial', 'I', 10);
     $this->Cell(0, 5, Format::date($cfg->getDateTimeFormat(), Misc::gmtime(), $_SESSION['TZ_OFFSET'], $_SESSION['TZ_DST']) . ' GMT ' . $_SESSION['TZ_OFFSET'], 0, 1, 'R');
     $this->Ln(5);
 }
 function Header()
 {
     global $cfg;
     //Common header
     $this->Ln(2);
     $this->SetFont('Times', 'B', 16);
     $this->Image(FPDF_DIR . 'print-logo.png', null, 10, 0, 20);
     $this->SetX(200, 15);
     $this->Cell(0, 15, "Support Ticket System", 0, 1, 'R', 0);
     //$this->SetY(40);
     $this->SetXY(60, 25);
     $this->SetFont('Arial', 'B', 16);
     $this->Cell(0, 3, 'Ticket #' . $this->getTicket()->getExtId(), 0, 2, 'L');
     $this->SetX($this->lMargin);
     $this->Cell(0, 3, '', "B", 2, 'L');
     $this->SetFont('Arial', 'I', 10);
     $this->Cell(0, 5, 'Generated on ' . Format::date($cfg->getDateTimeFormat(), Misc::gmtime(), $_SESSION['TZ_OFFSET'], $_SESSION['TZ_DST']), 0, 0, 'L');
     $this->Cell(0, 5, 'Date & Time based on GMT ' . $_SESSION['TZ_OFFSET'], 0, 1, 'R');
     $this->Ln(10);
 }
 public function gettabledata()
 {
     $start_index = Get::req('startIndex', DOTY_INT, 0);
     $results = Get::req('results', DOTY_MIXED, Get::sett('visuItem', 25));
     $sort = Get::req('sort', DOTY_MIXED, 'title');
     $dir = Get::req('dir', DOTY_MIXED, 'asc');
     $model = new GamesAlms();
     $games = $model->findAllUnread(0, 0, 'start_date', 'DESC', Docebo::user()->getId(), array('viewer' => Docebo::user()->getArrSt()));
     while (list($id, $game) = each($games)) {
         $game['start_date'] = Format::date($game['start_date'], 'date');
         $game['end_date'] = Format::date($game['end_date'], 'date');
         if ($game['type_of'] == "scorm" and ($game['status'] == "" or $game['status'] != "completed" and $game['status'] != "passed")) {
             $games[$id]['play'] = '<a class="ico-wt-sprite subs_play" rel="lightbox" href="index.php?r=games/play&amp;id_game=' . $game['id_game'] . '" title="' . $game['title'] . '"><span>' . Lang::t('_PLAY', 'games') . '</span></a>';
         } else {
             $games[$id]['play'] = "";
         }
         $games[$id]['standings'] = '<a href="index.php?r=lms/games/standings&amp;id_game=' . $game['id_game'] . '" title="' . Lang::t('_STANDINGS', 'games') . ': ' . $game['title'] . '"><span>' . Lang::t('_STANDINGS', 'games') . '</span></a>';
     }
     $result = array('totalRecords' => count($games), 'startIndex' => $start_index, 'sort' => $sort, 'dir' => $dir, 'rowsPerPage' => $results, 'results' => count($games), 'records' => $games);
     $this->data = $this->json->encode($result);
     echo $this->data;
 }
 public function tabledataTask()
 {
     $this->_setTableStatus("filter", Get::req("filter", DOTY_STRING, ""));
     $startIndex = $this->_getTableStatus("startIndex", 0);
     $page_size = Get::sett('visuItem', 25);
     $sort = $this->_getTableStatus("sort", "name");
     $dir = $this->_getTableStatus("dir", "asc");
     $filter = $this->_getTableStatus("filter");
     $params = new stdClass();
     $params->startIndex = $startIndex;
     $params->results = $page_size;
     $params->sort = $sort;
     $params->dir = $dir;
     $params->filter = $filter;
     $templates = $this->model->getTemplates($params);
     $template_rows = array();
     if (is_array($templates)) {
         foreach ($templates as $template) {
             $template_rows[] = array('id' => $template->id_template, 'name' => highlightText($template->name, $filter), 'date_creation' => Format::date($template->date_creation, "datetime"), 'last_modify' => Format::date($template->last_modify, "datetime"), 'del' => 'ajax.adm_server.php?r=adm/templatelayout/delete&id=' . (int) $template->id_template);
         }
     }
     $output = array('startIndex' => $startIndex, 'recordsReturned' => count($templates), 'sort' => $sort, 'dir' => $dir, 'totalRecords' => $this->model->getTotalTemplates($filter), 'pageSize' => $page_size, 'records' => $template_rows);
     echo $this->json->encode($output);
 }
Exemple #18
0
?>
</h6>
	 <input type="text" name="data[author]" value="" size="30">
	<h6> <?php 
echo L('islink');
?>
</h6>
	 <input type="text" name="linkurl" id="linkurl" value="" size="30" maxlength="255" disabled> <input name="info[islink]" type="checkbox" id="islink" value="1" onclick="ruselinkurl();" > <font color="red"><?php 
echo L('islink');
?>
</font>
	<h6> <?php 
echo L('inputtime');
?>
</h6> <?php 
echo Form::date('info[inputtime]', Format::date(TIME, 1), 1);
?>
	<h6> <?php 
echo L('template_style');
?>
</h6> <?php 
echo Form::select($template_list, $style, 'name="data[style]" id="style" onchange="load_file_list(this.value)"', L('please_select'));
?>
	<h6> <?php 
echo L('show_template');
?>
</h6> <span id="show_template"><script type="text/javascript">$.getJSON('?app=admin&controller=category&action=public_tpl_file_list&style=<?php 
echo $style;
?>
&application=special&templates=show&id=<?php 
echo $show_template;
echo Format::date($config['datetime_format'], $gmtime, $config['timezone_offset'], $config['enable_daylight_saving']);
?>
</i>
            </td>
        </tr>
        <tr><th>Day, Date &amp; Time Format:</th>
            <td><input type="text" name="daydatetime_format" value="<?php 
echo $config['daydatetime_format'];
?>
">
                        &nbsp;<font class="error">*&nbsp;<?php 
echo $errors['daydatetime_format'];
?>
</font>
                        <i><?php 
echo Format::date($config['daydatetime_format'], $gmtime, $config['timezone_offset'], $config['enable_daylight_saving']);
?>
</i>
            </td>
        </tr>
        <tr><th>Default Timezone:</th>
            <td>
                <select name="timezone_offset">
                    <?php 
$gmoffset = date("Z") / 3600;
//Server's offset.
echo "<option value=\"{$gmoffset}\">Server Time (GMT {$gmoffset}:00)</option>";
//Default if all fails.
$timezones = db_query('SELECT offset,timezone FROM ' . TIMEZONE_TABLE);
while (list($offset, $tz) = db_fetch_row($timezones)) {
    $selected = $config['timezone_offset'] == $offset ? 'SELECTED' : '';
Exemple #20
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>');
}
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');
}
Exemple #22
0
							yField: "y_axis",
							xAxis: xAxis,
							yAxis: yAxis,
							wmode: "opaque",
							style: {
								yAxis: {labelDistance:0,titleRotation:-90}
							}
						});
					</script>
				</div>
				<h2><?php 
echo $game['title'];
?>
</h2>
				<p><?php 
echo Lang::t('_START_DATE', 'standard') . ': ' . Format::date($game['start_date']) . ' - ' . Format::date($game['end_date']);
?>
</p>
				<br />
				<h3><?php 
echo Lang::t('_YOUR_RESULT', 'standard');
?>
</h3>
				<p>
					<?php 
echo Lang::t('_LAST_PLAY', 'standard') . ': ' . $track['dateAttempt'];
?>
<br/>
					<?php 
echo Lang::t('_CURRENT_SCORE', 'standard') . ': ' . $track['current_score'];
?>
Exemple #23
0
		<?php 
echo Layout::zone('feedback');
?>
		<!-- container -->
		<div id="container">
		<!-- header -->
		<div id="header" class="layout_header">
			<div class="user_panel">
				<p><?php 
if (!Docebo::user()->isAnonymous()) {
    echo '<b><span>' . Lang::t('_WELCOME', 'profile') . ', </span>' . Docebo::user()->getUserName() . '</b>';
}
?>
<br />
					<?php 
echo Format::date(date("Y-m-d H:i:s"));
?>
<br />
					<span class="select-language"><?php 
echo Layout::change_lang();
?>
</span>
				</p>
				<?php 
if (!Docebo::user()->isAnonymous()) {
    ?>
				<ul>
					<li><a class="identity" href="index.php?r=profile/show">
						<!-- <img src="<?php 
    echo Layout::path();
    ?>
Exemple #24
0
 public static function getInputDatefield($css_field, $id, $name, $value = '', $date_format = FALSE, $sel_time = FALSE, $alt_name = '', $other_param = '')
 {
     $value = $value == '00-00-0000' ? '' : $value;
     if ($date_format == false) {
         $regset = Format::instance();
         $date_format = $regset->date_token;
     }
     if ($css_field == false) {
         $css_field = 'textfield';
     }
     Form::loadDatefieldScript($date_format);
     $date = "";
     $iso = Format::dateDb($value, 'date');
     if ($value != '' && $value != '0000-00-00 00:00:00') {
         $timestamp = mktime(0, 0, 0, (int) substr($iso, 5, 2), (int) substr($iso, 8, 2), (int) substr($iso, 0, 4));
         $date = date("m/d/Y", $timestamp);
     }
     $other_after_b = '<span id="calendar_button_' . $id . '" class="yui-button"><span class="first-child docebo_calendar">' . '<button type="button"></button></span></span>' . '<div id="calendar_menu_' . $id . '"><div id="calendar_container_' . $id . '"></div></div>';
     if (defined("IS_AJAX")) {
         if (!isset($GLOBALS['date_inputs'])) {
             $GLOBALS['date_inputs'] = array();
         }
         $GLOBALS['date_inputs'][] = array($id, $date, $date_format);
     } else {
         $script = '<script type="text/javascript">' . 'YAHOO.util.Event.onDOMReady(function() {' . '	YAHOO.dateInput.setCalendar("' . $id . '", "' . $date . '", "' . $date_format . '");' . '});</script>';
         cout($script, 'scripts');
         //script in the scripts page section, this ensure to have it after the YAHOO.dateInput declaration
     }
     return Form::getInputTextfield($css_field, $id, $name, Format::date($iso, 'date'), $alt_name, '30', '');
 }
Exemple #25
0
 <?php 
if (is_array($list)) {
    $amount = $point = 0;
    foreach ($list as $info) {
        ?>
	<tr>
	<td width="10%" align="center"><?php 
        echo $info['username'];
        ?>
</td>
	<td width="20%" align="center"><?php 
        echo $info['msg'];
        ?>
</td>
	<td  width="15%" align="center"><?php 
        echo Format::date($info['creat_at'], 1);
        ?>
</td>
	<td width="9%" align="center"><?php 
        if (!empty($info['op_userid'])) {
            echo $info['op_username'];
        } else {
            echo L('self');
        }
        ?>
</td>
	<td width="8%" align="center"><?php 
        if ($info['type'] == 1) {
            echo L('money');
        } elseif ($info['type'] == 2) {
            echo L('point');
Exemple #26
0
                 //TO DO: optimization, do not put queries in iterations
                 if ($course_type == 'elearning' && $course_edition > 0) {
                     $record['has_editions'] = true;
                     $_arr = array();
                     $_editions = $ed_man->getEdition($id_course);
                     foreach ($_editions as $_edition) {
                         $_arr[] = array('id' => $_edition['id_edition'], 'code' => $_edition['code'], 'name' => $_edition['name'], 'date_begin' => $_edition['date_begin'], 'date_end' => $_edition['date_end'], 'display_name' => '[' . $_edition['code'] . '] ' . $_edition['name'] . ' (' . Format::date($_edition['date_begin'], 'date') . ' - ' . Format::date($_edition['date_end'], 'date') . ')');
                     }
                     $record['editions'] = $_arr;
                 }
                 if ($course_type == 'classroom') {
                     $record['has_classrooms'] = true;
                     $_arr = array();
                     $_dates = $dt_man->getCourseDate($id_course);
                     foreach ($_dates as $_date) {
                         $_arr[] = array('id' => $_date['id_date'], 'code' => $_date['code'], 'name' => $_date['name'], 'date_begin' => $_date['date_begin'], 'date_end' => $_date['date_end'], 'display_name' => '[' . $_date['code'] . '] ' . $_date['name'] . ' (' . Format::date($_date['date_begin'], 'date') . ' - ' . Format::date($_date['date_end'], 'date') . ')');
                     }
                     $record['classrooms'] = $_arr;
                 }
                 $output['courses'][] = $record;
             }
         }
     }
     aout($json->encode($output));
     break;
 case "dup_course":
     require_once _base_ . '/lib/lib.json.php';
     $json = new Services_JSON();
     $res = duplicateCourse();
     $output = array('success' => $res);
     if (!$res) {
 public function getusertabledataTask()
 {
     $op = Get::req('op', DOTY_MIXED, false);
     switch ($op) {
         case "selectall":
             $this->_selectAllUsers();
             return;
             break;
     }
     $idOrg = 0;
     //Get::req('id_org', DOTY_INT, 0);
     $descendants = false;
     //(Get::req('descendants', DOTY_INT, 0) > 0 ? true : false);
     $startIndex = Get::req('startIndex', DOTY_INT, 0);
     $results = Get::req('results', DOTY_INT, Get::sett('visuItem', 25));
     $rowsPerPage = Get::req('rowsPerPage', DOTY_INT, $results);
     $sort = Get::req('sort', DOTY_STRING, "");
     $dir = Get::req('dir', DOTY_STRING, "asc");
     $learning_filter = Get::req('learning_filter', DOTY_STRING, 'none');
     $var_fields = Get::req('_dyn_field', DOTY_MIXED, array());
     if (stristr($sort, '_dyn_field_') !== false) {
         $index = str_replace('_dyn_field_', '', $sort);
         $sort = $var_fields[(int) $index];
     }
     $filter_text = Get::req('filter_text', DOTY_STRING, '');
     $searchFilter = array('text' => $filter_text, 'suspended' => Get::req('suspended', DOTY_INT, 1) > 0 ? true : false);
     $dyn_filter = $this->_getDynamicFilter(Get::req('dyn_filter', DOTY_STRING, ''));
     if ($dyn_filter !== false) {
         $searchFilter['dyn_filter'] = $dyn_filter;
     }
     $total = $this->user_model->getTotalUsers($idOrg, $descendants, $searchFilter, true, $learning_filter);
     if ($startIndex >= $total) {
         if ($total < $results) {
             $startIndex = 0;
         } else {
             $startIndex = $total - $results;
         }
     }
     $pagination = array('startIndex' => $startIndex, 'results' => $results, 'sort' => $sort, 'dir' => $dir);
     $list = $this->user_model->getUsersList($idOrg, $descendants, $pagination, $searchFilter, true, $learning_filter);
     //prepare the data for sending
     require_once _adm_ . '/lib/lib.field.php';
     $fman = new FieldList();
     $date_fields = $fman->getFieldsByType("date");
     $acl_man = Docebo::user()->getAclManager();
     $idst_org = $acl_man->getGroupST('/oc_' . (int) $idOrg);
     $output_results = array();
     if (is_array($list) && count($list) > 0) {
         foreach ($list as $idst => $record) {
             $record_row = array('id' => (int) $record['idst'], 'userid' => Layout::highlight($acl_man->relativeId($record['userid']), $filter_text), 'firstname' => Layout::highlight($record['firstname'], $filter_text), 'lastname' => Layout::highlight($record['lastname'], $filter_text), 'email' => Layout::highlight($record['email'], $filter_text), 'register_date' => Format::date($record['register_date'], "datetime"), 'lastenter' => Format::date($record['lastenter'], "datetime"), 'unassoc' => $idOrg > 0 ? $record['is_descendant'] ? 0 : 1 : -1, 'valid' => $record['valid'], 'mod' => 'ajax.adm_server.php?r=adm/usermanagement/moduser&id=' . (int) $idst, 'del' => 'ajax.adm_server.php?r=adm/usermanagement/deluser&id=' . (int) $idst);
             foreach ($var_fields as $i => $value) {
                 if (is_numeric($value)) {
                     $name = '_custom_' . $value;
                 } else {
                     $name = $value;
                 }
                 //check if we must perform some post-format on retrieved field values
                 $content = isset($record[$name]) ? $record[$name] : '';
                 if ($name == 'register_date') {
                     $content = Format::date($content, 'datetime');
                 }
                 if ($name == 'lastenter') {
                     $content = Format::date($content, 'datetime');
                 }
                 if ($name == 'level' && $content != '') {
                     $content = Lang::t('_DIRECTORY_' . $content, 'admin_directory');
                 }
                 if (!empty($date_fields) && in_array($value, $date_fields)) {
                     $content = Format::date(substr($content, 0, 10), 'date');
                 }
                 $record_row['_dyn_field_' . $i] = $content;
             }
             $output_results[] = $record_row;
         }
     }
     $output = array('totalRecords' => $total, 'startIndex' => $startIndex, 'sort' => $sort, 'dir' => $dir, 'rowsPerPage' => $rowsPerPage, 'results' => count($output_results), 'records' => $output_results);
     echo $this->json->encode($output);
 }
Exemple #28
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');
}
Exemple #29
0
        echo $v['id'];
        ?>
"><?php 
        echo direction($v['direction']);
        ?>
 <?php 
        echo $v['username'];
        ?>
 (<?php 
        echo $v['ip'];
        ?>
) <?php 
        echo L('chez');
        ?>
 <?php 
        echo Format::date($v['creat_at'], 1);
        ?>
 <?php 
        echo L('release');
        ?>
 <?php 
        echo L('support');
        ?>
:<?php 
        echo $v['support'];
        ?>
</h5>
    <div class="content">
    	<pre><?php 
        echo $v['content'];
        ?>
        echo strtolower($T['source']);
        ?>
Ticket" title="<?php 
        echo $T['user__default_email__address'];
        ?>
"
                    href="tickets.php?id=<?php 
        echo $T['ticket_id'];
        ?>
"><?php 
        echo $ticketNumber;
        ?>
</a>
                </td>
                <td>&nbsp;<?php 
        echo Format::date($T['created']);
        ?>
</td>
                <td>&nbsp;<?php 
        echo $status;
        ?>
</td>
                <td>
                    <div style="max-height: 1.2em; max-width: 320px;" class="link truncate" href="tickets.php?id=<?php 
        echo $T['ticket_id'];
        ?>
"><?php 
        echo $subject;
        ?>
</div>
                </td>