Ejemplo n.º 1
0
 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);
     }
 }
Ejemplo n.º 2
0
 function init()
 {
     YuiLib::load(array('json' => 'json-min.js', 'container' => 'container_core-min.js', 'menu' => 'menu-min.js', 'button' => 'button-min.js', 'treeview' => 'treeview-min.js'), array('assets/skins/sam' => 'skin.css'));
     cout(Util::get_css('base-folder-tree.css'), 'page_head');
     cout(Util::get_js('appLms/lib/category/lib.categorytree.js'), 'page_head');
     Util::get_js(Get::rel_path('base') . '/lib/lib.elem_selector.js', true, true);
 }
Ejemplo n.º 3
0
function drawCalendar()
{
    checkPerm('view');
    $size = importVar('size', false, 'max');
    $width = "90%";
    if ($size == "min") {
        $width = "200px";
    }
    addCss('calendar_' . $size);
    YuiLib::load('base,dragdrop');
    Util::get_js(Get::rel_path('lms') . '/modules/calendar/calendar.js', true, true);
    Util::get_js(Get::rel_path('lms') . '/modules/calendar/calendar_helper.js', true, true);
    //permissions = permissions granted to the logged user according to his/her level and role
    //	2 => can create/delete/modify all events
    //	1 => can create/delete/modify only own events
    //	0 => can view only
    $permissions = 0;
    if (checkPerm('mod', true)) {
        $permissions = 2;
    } elseif (checkPerm('personal', true)) {
        $permissions = 1;
    }
    //mode="edit" => events can be added and edited according to given permissions
    //mode="view" => events can only be viewed regardless the permissions
    $GLOBALS['page']->add('<script type="text/javascript">' . '	setup_cal(	null, ' . '\'lms\', ' . '\'lms\', ' . '\'edit\', ' . '\'' . $permissions . '\', ' . '\'' . Docebo::user()->getIdSt() . '\' ' . ');' . '</script>', 'page_head');
    $GLOBALS['page']->add("\n" . getTitleArea(Lang::t('_CALENDAR', 'calendar'), 'calendar') . '<div class="std_block">' . '<div id="displayCalendar" style="clear: both; width:' . $width . '"></div>' . '<div class="nofloat"></div>' . '</div>', 'content');
}
Ejemplo n.º 4
0
    function setupJs($tags_id, $private_tags = '')
    {
        if (!$this->_use_tag) {
            return '';
        }
        $lang =& DoceboLanguage::createInstance('tags', 'framework');
        $this->tags_id = $tags_id;
        YuiLib::load(array('autocomplete' => 'autocomplete-min.js', 'selector' => 'selector-beta-min.js'), array('assets/skins/sam' => 'autocomplete.css'));
        Util::get_js(Get::rel_path('adm') . '/lib/lib.tags.js', true, true);
        // setup some thing that we need in the tag editor
        $GLOBALS['page']->add('<script type="text/javascript">' . "\n" . 'var tag_params ={
			resource_type: "' . $this->resource_type . '", 
			addr: "' . $GLOBALS['where_framework_relative'] . '/ajax.adm_server.php",
			query_append: "file=tags",
			query:"' . $tags_id . '",
			private_query:"' . $private_tags . '",
			popular_tags: "' . addslashes(implode(', ', $this->getPopularTag())) . '",
			user_tags: "' . addslashes(implode(', ', $this->getUserPopularTag(getLogUserId()))) . '", 
			lang: { tags: "' . addslashes($lang->def("_TAGS")) . '",
				tips: "' . addslashes($lang->def("_TAGS_TIPS")) . '",
				popular_tags: "' . addslashes($lang->def("_POPULAR")) . '",
				user_tags: "' . addslashes($lang->def("_YOURS")) . '",
				save: "' . addslashes($lang->def("_SAVE")) . '",
				undo: "' . addslashes($lang->def("_UNDO")) . '",
				add_tags: "' . addslashes($lang->def("_ADD_TAGS")) . '",
				update_tags: "' . addslashes($lang->def("_MOD")) . '"
			}
		};' . "\n" . '</script>', 'scripts');
    }
 public function init()
 {
     YuiLib::load('base,tabview');
     Lang::init('course');
     $this->model = new VideoconferenceLms(Docebo::user()->getIdSt());
     $upd = new UpdatesLms();
     $this->info = $upd->videoconferenceCounterUpdates();
 }
 public function init()
 {
     YuiLib::load('base,tabview');
     Lang::init('course');
     $this->json = new Services_JSON();
     $upd = new UpdatesLms();
     $this->info = $upd->communicationCounterUpdates();
 }
Ejemplo n.º 7
0
 public function init()
 {
     YuiLib::load('container,menu,button');
     Util::get_js(Get::rel_path('adm') . '/lib/user_selector/lib.common.js', true, true);
     Util::get_js(Get::rel_path('adm') . '/lib/user_selector/lib.dynamicuserfilter.js', true, true);
     if ($this->_use_other_fields) {
         Util::get_js(Get::rel_path('adm') . '/lib/user_selector/lib.otherfieldtypes.js', true, true);
     }
 }
Ejemplo n.º 8
0
 public function init()
 {
     YuiLib::load('base,tabview');
     Lang::init('course');
     $this->path_course = $GLOBALS['where_files_relative'] . '/appLms/' . Get::sett('pathcourse') . '/';
     $this->model = new CatalogLms();
     require_once _base_ . '/lib/lib.json.php';
     $this->json = new Services_JSON();
     $this->acl_man =& Docebo::user()->getAclManager();
 }
 public function init()
 {
     YuiLib::load('base,tabview');
     require_once _lms_ . '/lib/lib.course.php';
     require_once _lms_ . '/lib/lib.subscribe.php';
     require_once _lms_ . '/lib/lib.levels.php';
     $this->cstatus = array(CST_PREPARATION => '_CST_PREPARATION', CST_AVAILABLE => '_CST_AVAILABLE', CST_EFFECTIVE => '_CST_CONFIRMED', CST_CONCLUDED => '_CST_CONCLUDED', CST_CANCELLED => '_CST_CANCELLED');
     $this->ustatus = array(_CUS_CONFIRMED => '_T_USER_STATUS_CONFIRMED', _CUS_SUBSCRIBED => '_T_USER_STATUS_SUBS', _CUS_BEGIN => '_T_USER_STATUS_BEGIN', _CUS_END => '_T_USER_STATUS_END');
     $this->path_course = $GLOBALS['where_files_relative'] . '/appLms/' . Get::sett('pathcourse') . '/';
     $this->model = new CoursepathLms();
 }
 public function editTask()
 {
     YuiLib::load('colorpicker');
     $id = Get::req('id', DOTY_INT, -1);
     if ($id > 0) {
         $params = array('id' => $id, 'data' => $this->model->getTemplateData($id));
     } else {
         $params = array('error' => Lang::t('_INVALID_TEMPLATE', 'template'));
     }
     $this->render("edit", $params);
 }
Ejemplo n.º 11
0
 /**
  * Include the required libraries in order to have all the things ready and working
  */
 public function initLibraries()
 {
     // load yui
     YuiLib::load(array('yahoo-dom-event' => 'yahoo-dom-event.js', 'connection' => 'connection-min.js', 'dragdrop' => 'dragdrop-min.js', 'element' => 'element-beta-min.js', 'animation' => 'animation-min.js', 'json' => 'json-min.js', 'container' => 'container_core-min.js', 'menu' => 'menu-min.js', 'button' => 'button-min.js', 'container' => 'container-min.js', 'button' => 'button-min.js', 'treeview' => 'treeview-min.js', 'resize' => 'resize-beta-min.js', 'selector' => 'selector-beta-min.js'), array('assets/skins/sam' => 'skin.css'));
     // Selector class
     Util::get_js(Get::rel_path('base') . '/lib/lib.elem_selector.js', true, true);
     // Commodities functions
     Util::get_js(Get::rel_path('base') . '/lib/js_utils.js', true, true);
     // The tableview main file
     Util::get_js(Get::rel_path('base') . '/lib/table_view/tableview.js', true, true);
     // Datatable css
     Util::get_css('../yui-skin/datatable.css', false, true);
 }
Ejemplo n.º 12
0
 public function initLibraries()
 {
     YuiLib::load(array('yahoo-dom-event' => 'yahoo-dom-event.js', 'connection' => 'connection-min.js', 'dragdrop' => 'dragdrop-min.js', 'element' => 'element-beta-min.js', 'animation' => 'animation-min.js', 'json' => 'json-min.js', 'container' => 'container_core-min.js', 'menu' => 'menu-min.js', 'button' => 'button-min.js', 'container' => 'container-min.js', 'button' => 'button-min.js', 'treeview' => 'treeview-min.js', 'resize' => 'resize-beta-min.js', 'selector' => 'selector-beta-min.js'), array('assets/skins/sam' => 'skin.css'));
     Util::get_js(Get::rel_path('base') . '/lib/lib.elem_selector.js', true, true);
     Util::get_js(Get::rel_path('base') . '/lib/js_utils.js', true, true);
     $js_path = Get::rel_path('base') . '/lib/folder_tree/';
     Util::get_js($js_path . 'ddnode.js', true, true);
     Util::get_js($js_path . 'foldernode.js', true, true);
     Util::get_js($js_path . 'foldertree.js', true, true);
     //addCss('folder_tree', 'framework');
     cout(Util::get_css('base-folder-tree.css'), 'page_head');
     foreach ($this->styleSheets as $sheet) {
         cout(Util::get_css($sheet . '.css'), 'page_head');
     }
 }
Ejemplo n.º 13
0
 /**
  * Initialize required libraries
  */
 public function init()
 {
     YuiLib::load('base,treeview,selector');
     Util::get_js(Get::rel_path('base') . '/lib/lib.elem_selector.js', true, true);
     Util::get_js(Get::rel_path('base') . '/lib/js_utils.js', true, true);
     Util::get_css('base-folder-tree.css', false, true);
     $js_path = Get::rel_path('base') . '/widget/tree/';
     if ($this->dragDrop) {
         Util::get_js($js_path . 'ddnode.js', true, true);
     }
     Util::get_js($js_path . 'foldernode.js', true, true);
     Util::get_js($js_path . 'foldertree.js', true, true);
     if ($this->treeClass != "FolderTree" && $this->treeFile) {
         Util::get_js($this->treeFile, true, true);
     }
 }
Ejemplo n.º 14
0
 public function init()
 {
     YuiLib::load('base,tabview');
     if (!isset($_SESSION['id_common_label'])) {
         $_SESSION['id_common_label'] = -1;
     }
     require_once _lms_ . '/lib/lib.course.php';
     require_once _lms_ . '/lib/lib.subscribe.php';
     require_once _lms_ . '/lib/lib.levels.php';
     $this->cstatus = array(CST_PREPARATION => '_CST_PREPARATION', CST_AVAILABLE => '_CST_AVAILABLE', CST_EFFECTIVE => '_CST_CONFIRMED', CST_CONCLUDED => '_CST_CONCLUDED', CST_CANCELLED => '_CST_CANCELLED');
     $this->ustatus = array(_CUS_WAITING_LIST => '_WAITING_USERS', _CUS_CONFIRMED => '_T_USER_STATUS_CONFIRMED', _CUS_SUBSCRIBED => '_T_USER_STATUS_SUBS', _CUS_BEGIN => '_T_USER_STATUS_BEGIN', _CUS_END => '_T_USER_STATUS_END');
     $this->levels = CourseLevel::getLevels();
     $this->path_course = $GLOBALS['where_files_relative'] . '/appLms/' . Get::sett('pathcourse') . '/';
     $upd = new UpdatesLms();
     $this->info = $upd->courseUpdates();
 }
function newsletter()
{
    //access control
    //-TP// funAdminAccess('OP');
    checkPerm('view');
    require_once _base_ . '/lib/lib.form.php';
    $out =& $GLOBALS['page'];
    $out->setWorkingZone("content");
    $lang =& DoceboLanguage::createInstance('admin_newsletter', 'framework');
    YuiLib::load();
    addJs($GLOBALS['where_framework_relative'] . '/modules/newsletter/', 'newsletter.js');
    $form = new Form();
    $out->add(getTitleArea($lang->def("_NEWSLETTER"), "newsletter"));
    $p_size = intval(ini_get('post_max_size'));
    $u_size = intval(ini_get('upload_max_filesize'));
    $max_kb = $p_size < $u_size ? $p_size : $u_size;
    $max = ' (Max. ' . $max_kb . ' Mb) ';
    $out->add('<script>' . 'var _DEL=\'' . $lang->def('_DEL') . '\';' . 'var _ATTACHMENT=\'' . $lang->def('_ATTACHMENT') . '\';' . 'var _MAX=\'' . $max . '\';' . '</script>');
    $out->add("<div class=\"std_block\">\n");
    $acl_manager = Docebo::user()->getAclManager();
    $user_info = $acl_manager->getUser(Docebo::user()->getIdSt(), false);
    $myemail = $user_info[ACL_INFO_EMAIL];
    if (isset($err) && $err != "") {
        $out->add("<b><span class=\"fontRed\">{$err}</span><br />\n");
    }
    $out->add($form->openForm("newsletter_form", "index.php?modname=public_newsletter_admin&amp;op=initsend"));
    $out->add($form->openElementSpace());
    $out->add($form->getTextfield($lang->def("_SENDER"), "fromemail", "fromemail", 255, $myemail));
    $out->add($form->getTextfield($lang->def("_SUBJECT"), "sub", "sub", 255, ""));
    $out->add($form->getTextarea($lang->def("_DESCRIPTION"), "msg", "msg", ""));
    $lang_list = Docebo::langManager()->getAllLangCode();
    //array_unshift($lang_list, $lang->def("_DEFAULT"), $lang->def("_ALL"));
    $lang_list = array(_ANY_LANG_CODE => $lang->def("_ALL")) + $lang_list;
    $out->add('<div id="file">' . $form->getHidden('file_number', 'file_number', '1') . '<div id="div_file_1">' . $form->getFilefield($lang->def('_ATTACHMENT'), 'file_1', 'file_1', '', '', '<a href="#" onclick="delFile(\'1\'); return false;"><span id="rem_span">' . $lang->def('_DEL') . '</span><a>') . '</div>' . '</div>' . '<br/><a href="#" onclick="addFile(); return false;"><span id="add_span">' . $lang->def('_ADD') . '</span></a>');
    $out->add($form->getDropdown($lang->def("_LANGUAGE"), "sel_lang", "sel_lang", $lang_list));
    $out->add($form->getRadio($lang->def("_EMAIL"), "send_type_email", "send_type", "email", true));
    $out->add($form->getRadio($lang->def("_SEND_SMS"), "send_type_sms", "send_type", "sms", false));
    $out->add($form->closeElementSpace());
    $out->add($form->openButtonSpace());
    $out->add($form->getButton('send', 'send', $lang->def('_SEND')));
    $out->add($form->closeButtonSpace());
    $out->add($form->closeForm());
    $out->add("</div>\n");
}
Ejemplo n.º 16
0
function classEventMain()
{
    $res = "";
    $out =& $GLOBALS["page"];
    $out->setWorkingZone("content");
    $lang =& DoceboLanguage::createInstance("classevent", "lms");
    $back_ui_url = "index.php?modname=classevent&amp;op=main";
    $title_arr = array();
    $title_arr[$back_ui_url] = $lang->def("_CLASS_EVENT");
    $res .= getTitleArea($title_arr, "classevent");
    $res .= "<div class=\"std_block\">\n";
    require_once $GLOBALS["where_framework"] . "/lib/resources/lib.timetable.php";
    $tt = new TimeTable();
    $permissions = 2;
    $size = isset($_GET["size"]) ? $_GET["size"] : "max";
    addCss('windows');
    addCss('calendar_' . $size, "lms");
    //addAjaxJs();
    //addScriptaculousJs();
    YuiLib::load(array('my_window' => 'windows.js'));
    $GLOBALS['page']->add("\n" . '<script type="text/javascript" src="' . $GLOBALS['where_lms_relative'] . '/modules/calendar/calendar.js"></script>' . "\n", 'page_head');
    $GLOBALS['page']->add("\n" . '<script type="text/javascript" src="' . $GLOBALS['where_lms_relative'] . '/modules/calendar/calendar_helper.js"></script>' . "\n", 'page_head');
    require_once $GLOBALS["where_lms"] . "/lib/lib.classroom.php";
    $cm = new ClassroomManager();
    $class_arr = $cm->getClassroomArray();
    $GLOBALS['page']->add('<script type="text/javascript">' . ' setup_url(\'' . $GLOBALS['where_lms_relative'] . '/ajax.server.php?mn=calendar&\',\'lms_classroom\',\'lms_classroom\'); ' . ' setup_mode("edit",' . $permissions . ',"' . Docebo::user()->getUserId() . '"); ' . '</script>', 'page_head');
    $width = "90%";
    if ($size == "min") {
        $width = "200px";
    }
    $res .= "\n";
    $res .= "<div class=\"std_block\" style=\"margin:auto;width:" . $width . ";\">\n";
    $res .= "<p>" . $lang->def("_SELECT_CLASSROOM") . ": <select name=\"classroom_selected\" id=\"classroom_selected\"  onChange=\"updateCalendar(cal.date);\"><option value=\"\">(" . $lang->def("_SELECT_ALL") . ")</option>";
    while (list($key, $value) = each($class_arr)) {
        $res .= "<option value=\"" . htmlentities($key) . "\">" . htmlentities($value) . "</option>";
    }
    $res .= "</select></p>";
    $res .= "</div>\n";
    $res .= "\n" . '<div id="displayCalendar" style="margin: auto; clear: both; width:' . $width . '"></div>';
    $res .= "</div>\n";
    $out->add($res);
    require_once _base_ . '/lib/lib.dialog.php';
    setupHrefDialogBox('a[href*=del]');
}
Ejemplo n.º 17
0
 /**
  * Include the required libraries in order to have all the things ready and working
  */
 public function init()
 {
     $libs = 'base,table';
     if ($this->_useStdDeleteFormatter() || $this->_useStdModifyFormatter()) {
         $libs .= ',button,container,selector';
     }
     // load yui
     YuiLib::load($libs);
     // Selector class
     Util::get_js(Get::rel_path('base') . '/widget/dialog/dialog.js', true, true);
     // Selector class
     Util::get_js(Get::rel_path('base') . '/lib/lib.elem_selector.js', true, true);
     // Commodities functions
     Util::get_js(Get::rel_path('base') . '/lib/js_utils.js', true, true);
     // The tableview main file
     Util::get_js(Get::rel_path('base') . '/widget/table/table.js', true, true);
     // Datatable css
     Util::get_css('../yui-skin/datatable.css', false, true);
 }
Ejemplo n.º 18
0
/**
 * Called in loadHeader method of Block class include .js files if required
 *
 * @return string the code to be include(think to directly use PageWriter->append($string, 'head'))
 **/
function loadHeaderHTMLEditor()
{
    $res = "";
    if (getAccessibilityStatus() === false) {
        $ht = Get::sett('hteditor');
    } else {
        $ht = 'accesseditor';
    }
    $relative_path = $GLOBALS['where_framework_relative'];
    $relative_path .= substr($GLOBALS['where_framework_relative'], -1) == '/' ? '' : '/';
    switch ($ht) {
        //using tiny_mce
        case 'tinymce':
            Util::get_js(Get::rel_path('base') . '/addons/tiny_mce/tiny_mce_gzip.js', true, true);
            $GLOBALS['page']->add('<script type="text/javascript">
									tinyMCE_GZ.init({
									plugins : "safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",
									themes : "tinymce_simple,tinymce_complex",
									languages : "en",
									disk_cache : true,
									debug : false
									});
								</script>', 'page_head');
            Util::get_js(Get::rel_path('base') . '/addons/tiny_mce/forma.js', true, true);
            break;
        case 'yui':
            $js = array('element' => 'element-beta-min.js', 'container' => 'container_core-min.js', 'menu' => 'menu-min.js', 'button' => 'button-min.js', 'editor' => 'editor-beta-min.js');
            YuiLib::load($js);
            $GLOBALS['page']->add('<link rel="stylesheet" type="text/css" href="' . $GLOBALS['where_framework_relative'] . '/addons/yui/assets/skins/sam/skin.css">', 'page_head');
            break;
            //using normal textarea
        //using normal textarea
        case 'accesseditor':
        default:
            break;
    }
    if (isset($GLOBALS['page'])) {
        $GLOBALS['page']->add($res, 'page_head');
    } else {
        echo $res;
    }
}
Ejemplo n.º 19
0
 public function show()
 {
     //if (!checkPerm('view', true)) return;
     YuiLib::load('tabview,charts');
     $charts_num_days = 7;
     //check if there are any problems with technical configuration of the server
     $php_conf = ini_get_all();
     //this
     $problem = false;
     if ($php_conf['register_globals']['local_value']) {
         $problem = true;
     }
     if (version_compare(phpversion(), "5.2.0", ">")) {
         if ($php_conf['allow_url_include']['local_value']) {
             $problem = true;
         }
     }
     $user_idst = Docebo::user()->getIdSt();
     $user_level = Docebo::user()->getUserLevelId();
     $acl_man = Docebo::user()->getAclManager();
     $where = "";
     if ($user_level != ADMIN_GROUP_GODADMIN) {
         $where .= "AND (author='" . $user_idst . "' OR is_public>0)";
     }
     $num_reports = 0;
     $query = "SELECT id_filter, filter_name, author, creation_date, is_public " . " FROM %lms_report_filter " . " WHERE (author>0 OR is_public>0) " . $where . " ORDER BY filter_name ASC " . ($num_reports > 0 ? " LIMIT 0," . (int) $num_reports : "");
     //creation_date DESC
     $res = sql_query($query);
     $arr_report = array();
     while (list($idrep, $name, $author, $creation_date, $is_public) = sql_fetch_row($res)) {
         $arr_report[$idrep] = $name;
     }
     //load date script for user creation and editing mask
     Form::loadDatefieldScript();
     //render view
     $this->render('show', array('diagnostic_problem' => $problem, 'lang_dir' => Lang::direction(), 'can_approve' => checkPerm('approve_waiting_user', true, 'directory', 'framework'), 'version' => $this->model->getVersionExternalInfo(), 'user_stats' => $this->model->getUsersStats(), 'course_stats' => $this->model->getCoursesStats(), 'course_months_stats' => $this->model->getCoursesMonthsStats(), 'userdata_accesses' => $this->json->encode($this->model->getUsersChartAccessData($charts_num_days)), 'userdata_registrations' => $this->json->encode($this->model->getUsersChartRegisterData($charts_num_days)), 'coursedata_subscriptions' => $this->json->encode($this->model->getCoursesChartSubscriptionData($charts_num_days)), 'coursedata_startattendings' => $this->json->encode($this->model->getCoursesChartStartAttendingData($charts_num_days)), 'coursedata_completed' => $this->json->encode($this->model->getCoursesChartCompletedData($charts_num_days)), 'permissions' => $this->permissions, 'reports' => $arr_report));
 }
Ejemplo n.º 20
0
function transaction()
{
    require_once _base_ . '/lib/lib.table.php';
    require_once _base_ . '/lib/lib.form.php';
    require_once _base_ . '/lib/lib.dialog.php';
    YuiLib::load();
    $lang =& DoceboLanguage::createInstance('transaction');
    $acl_man = Docebo::user()->getAclManager();
    $man_transaction = new Man_Transaction();
    cout(getTitleArea($lang->def('_TRANSACTION')) . '<div class="std_block">');
    $tb = new Table(Get::sett('visuItem'), $lang->def('_TRANSACTION_TABLE'), $lang->def('_TRANSACTION_TABLE'));
    $tb->initNavBar('ini', 'button');
    $tb->setLink('index.php?modname=transaction&amp;op=transaction');
    $page = ($tb->getSelectedPage() - 1) * Get::sett('visuItem');
    $status_filter = Get::req('payment_status', DOTY_INT, '-2');
    $course_filter = Get::req('course_status', DOTY_INT, '-2');
    $tran_filter = Get::req('tran', DOTY_MIXED, '');
    $display = false;
    if ($status_filter != -2) {
        $display = true;
    }
    if ($course_filter != -2) {
        $display = true;
    }
    $transactions = $man_transaction->getTransaction($page, $status_filter == '-2' ? false : $status_filter, $course_filter == '-2' ? false : $course_filter, $tran_filter);
    $tot_transaction = $man_transaction->getTotTransaction($status_filter == '-2' ? false : $status_filter, $course_filter == '-2' ? false : $course_filter, $tran_filter);
    if (count($transactions) > 0 || $display) {
        $mod_img = '<img src="' . getPathImage() . '/standard/edit.png" title="' . $lang->def('_MOD') . '" alt="' . $lang->def('_MOD') . '" />';
        $del_img = '<img src="' . getPathImage() . '/standard/delete.png" title="' . $lang->def('_DEL') . '" alt="' . $lang->def('_DEL') . '" />';
        $cont_h = array($lang->def('_USER'), $lang->def('_DATE'), $lang->def('_COURSE_PRIZE'), $lang->def('_PAYMENT_METHOD'), $lang->def('_PAYMENT_STATUS'), $lang->def('COURSE_STATUS'), $mod_img, $del_img);
        $type_h = array('', '', '', '', 'image', 'image', 'image', 'image');
        $tb->setColsStyle($type_h);
        $tb->addHead($cont_h);
        foreach ($transactions as $transaction_info) {
            if ($transaction_info['firstname'] !== '' && $transaction_info['lastname'] !== '') {
                $user = $transaction_info['firstname'] . ' ' . $transaction_info['lastname'] . ' (' . $acl_man->relativeId($transaction_info['userid']) . ')';
            } elseif ($transaction_info['firstname'] !== '') {
                $user = $transaction_info['firstname'] . ' (' . $acl_man->relativeId($transaction_info['userid']) . ')';
            } elseif ($transaction_info['lastname'] !== '') {
                $user = $transaction_info['lastname'] . ' (' . $acl_man->relativeId($transaction_info['userid']) . ')';
            } else {
                $user = $acl_man->relativeId($transaction_info['userid']);
            }
            switch ($transaction_info['payment_status']) {
                case '-1':
                    $payment_status = '<img src="' . getPathImage() . '/standard/dot_red.gif" alt="' . $lang->def('_CANCELLED') . '" title="' . $lang->def('_CANCELLED') . '" />';
                    break;
                case '0':
                    $payment_status = '<img src="' . getPathImage() . '/standard/dot_grey.gif" alt="' . $lang->def('_WAITING_PAYMENT') . '" title="' . $lang->def('_WAITING_PAYMENT') . '" />';
                    break;
                case '1':
                    $payment_status = '<img src="' . getPathImage() . '/standard/dot_yellow.gif" alt="' . $lang->def('_PARTIAL_PAID') . '" title="' . $lang->def('_PARTIAL_PAID') . '" />';
                    break;
                case '2':
                    $payment_status = '<img src="' . getPathImage() . '/standard/dot_green.gif" alt="' . $lang->def('_PAID') . '" title="' . $lang->def('_PAID') . '" />';
                    break;
            }
            switch ($transaction_info['course_status']) {
                case '-1':
                    $course_status = '<img src="' . getPathImage() . '/standard/dot_red.gif" alt="' . $lang->def('_CANCELLED') . '" title="' . $lang->def('_CANCELLED') . '" />';
                    break;
                case '0':
                    $course_status = '<img src="' . getPathImage() . '/standard/dot_grey.gif" alt="' . $lang->def('_NO_COURSE_ACTIVATED') . '" title="' . $lang->def('_NO_COURSE_ACTIVATED') . '" />';
                    break;
                case '1':
                    $course_status = '<img src="' . getPathImage() . '/standard/dot_yellow.gif" alt="' . $lang->def('_SOME_COURSE_ACTIVATED') . '" title="' . $lang->def('_SOME_COURSE_ACTIVATED') . '" />';
                    break;
                case '2':
                    $course_status = '<img src="' . getPathImage() . '/standard/dot_green.gif" alt="' . $lang->def('_ALL_COURSE_ACTIVATED') . '" title="' . $lang->def('_ALL_COURSE_ACTIVATED') . '" />';
                    break;
            }
            $tb->addBody(array($user, Format::date($transaction_info['date']), $transaction_info['price'], $lang->def('_' . strtoupper($transaction_info['method'])), $payment_status, $course_status, '<a href="index.php?modname=transaction&amp;op=mod&amp;id=' . $transaction_info['id_transaction'] . '">' . $mod_img . '</a>', '<a href="index.php?modname=transaction&amp;op=del&amp;id=' . $transaction_info['id_transaction'] . '">' . $del_img . '</a>'));
        }
        $array_payment_status = array('-2' => $lang->def('_ALL_STATUS'), '-1' => $lang->def('_CANCELLED'), '0' => $lang->def('_WAITING_PAYMENT'), '1' => $lang->def('_PARTIAL_PAID'), '2' => $lang->def('_PAID'));
        $array_course_status = array('-2' => $lang->def('_ALL_STATUS'), '-1' => $lang->def('_CANCELLED'), '0' => $lang->def('_NO_COURSE_ACTIVATED'), '1' => $lang->def('_SOME_COURSE_ACTIVATED'), '2' => $lang->def('_ALL_COURSE_ACTIVATED'));
        cout(Form::openForm('transaction_filter', 'index.php?modname=transaction&amp;op=transaction') . $tb->getNavBar($page, $tot_transaction) . '<div class="quick_search_form">' . Form::getInputTextfield('search_t', 'tran', 'tran', $tran_filter, '', 255, '') . Form::getButton("filter", "filter", $lang->def('_FILTER'), "search_b") . '<br />' . '<a class="advanced_search" href="javascript:;" onclick="( this.nextSibling.style.display != \'block\' ?  this.nextSibling.style.display = \'block\' : this.nextSibling.style.display = \'none\' );">' . $lang->def("_ADVANCED_SEARCH") . '</a>' . '<div class="overlay_menu" style="display:' . ($display ? 'block' : 'none') . '">' . Form::getDropdown($lang->def('_PAYMENT_STATUS_FILTER'), 'payment_status', 'payment_status', $array_payment_status, $status_filter) . Form::getDropdown($lang->def('_COURSE_STATUS_FILTER'), 'course_status', 'course_status', $array_course_status, $course_filter) . '</div>' . '</div>' . '<script type="text/javascript">' . 'var payment_status = YAHOO.util.Dom.get(\'payment_status\');' . 'var course_status = YAHOO.util.Dom.get(\'course_status\');' . 'var form = YAHOO.util.Dom.get(\'transaction_filter\');' . 'YAHOO.util.Event.on(payment_status, \'change\', function() { this.submit() } , form, true);' . 'YAHOO.util.Event.on(course_status, \'change\', function() { this.submit() } , form, true);' . '</script>' . $tb->getTable() . $tb->getNavBar($page, $tot_transaction) . Form::closeForm());
        setupHrefDialogBox('a[href*=del]');
    } else {
        cout(Lang::t('_NO_CONTENT', 'transaction'));
    }
    cout('</div>');
}
Ejemplo n.º 21
0
?>
		<!-- common stylesheet -->
		<link rel="stylesheet" type="text/css" href="<?php 
echo Layout::path();
?>
style/base.css" />
		<link rel="stylesheet" type="text/css" href="<?php 
echo Layout::path();
?>
style/lms-home.css" />
		<?php 
echo Layout::rtl();
?>
		<!-- specific stylesheet -->
		<?php 
YuiLib::load('base');
?>
		<!-- printer stylesheet-->
		<?php 
echo Layout::accessibility();
?>
		<!-- Page Head area -->
		<?php 
echo Layout::zone('page_head');
?>
	</head>
	<body class="yui-skin-docebo yui-skin-sam">

		<div class="header">
			<div class="select-language">
				<?php 
Ejemplo n.º 22
0
 public function standingsTask()
 {
     $id_game = Get::req('id_game', DOTY_INT, 0);
     $model = new GamesAlms();
     $game = $model->findByPk($id_game, Docebo::user()->getArrSt());
     YuiLib::load('base,charts');
     $this->render('standings', array('game' => $game, 'track' => $model->getUserStandings($game['id_game'], getLogUserId()), 'standings' => $model->getStandings($game['id_game'], 0, 30), 'chart_data' => $this->json->encode($model->getStandingsChartData($game['id_game']))));
 }
Ejemplo n.º 23
0
    public static function loadDatefieldScript($date_format = false)
    {
        if (defined("IS_AJAX")) {
            return;
        }
        //we can't print scripts in an ajax request
        if (!isset($GLOBALS['jscal_loaded']) || $GLOBALS['jscal_loaded'] == false) {
            YuiLib::load('calendar');
            if ($date_format == false) {
                $regset = Format::instance();
                $date_format = $regset->date_token;
            }
            $arr_months = array(Lang::t('_MONTH_01', 'calendar'), Lang::t('_MONTH_02', 'calendar'), Lang::t('_MONTH_03', 'calendar'), Lang::t('_MONTH_04', 'calendar'), Lang::t('_MONTH_05', 'calendar'), Lang::t('_MONTH_06', 'calendar'), Lang::t('_MONTH_07', 'calendar'), Lang::t('_MONTH_08', 'calendar'), Lang::t('_MONTH_09', 'calendar'), Lang::t('_MONTH_10', 'calendar'), Lang::t('_MONTH_11', 'calendar'), Lang::t('_MONTH_12', 'calendar'));
            $arr_months_short = array(Lang::t('_JAN', 'calendar'), Lang::t('_FEB', 'calendar'), Lang::t('_MAR', 'calendar'), Lang::t('_APR', 'calendar'), Lang::t('_MAY', 'calendar'), Lang::t('_JUN', 'calendar'), Lang::t('_JUL', 'calendar'), Lang::t('_AUG', 'calendar'), Lang::t('_SEP', 'calendar'), Lang::t('_OCT', 'calendar'), Lang::t('_NOV', 'calendar'), Lang::t('_DEC', 'calendar'));
            $arr_days = array(Lang::t('_SUNDAY', 'calendar'), Lang::t('_MONDAY', 'calendar'), Lang::t('_TUESDAY', 'calendar'), Lang::t('_WEDNESDAY', 'calendar'), Lang::t('_THURSDAY', 'calendar'), Lang::t('_FRIDAY', 'calendar'), Lang::t('_SATURDAY', 'calendar'));
            $arr_days_medium = array(Lang::t('_SUN', 'calendar'), Lang::t('_MON', 'calendar'), Lang::t('_TUE', 'calendar'), Lang::t('_WED', 'calendar'), Lang::t('_THU', 'calendar'), Lang::t('_FRI', 'calendar'), Lang::t('_SAT', 'calendar'));
            $arr_days_short = array();
            $arr_days_1char = array();
            foreach ($arr_days_medium as $day) {
                $arr_days_short[] = substr($day, 0, 2);
                $arr_days_1char[] = substr($day, 0, 1);
            }
            $script = '<script type="text/javascript">
					if (!YAHOO.dateInput) {
						YAHOO.namespace("dateInput");
						YAHOO.dateInput = {
							dateFormat: "' . $date_format . '",
							setCalendar: function(id, startdate, dateformat) {

									var getLocalDate = function(y, m, d) {
										var zfill = function(n, z) { n = n+""; while (n.length<z) n = "0"+n; return n; };
										var output = dateformat ? dateformat : this.dateFormat;
										output = output.replace("%d", zfill(d, 2));
										output = output.replace("%m", zfill(m, 2));
										output = output.replace("%Y", y);
										return output;
									};

									var calendarSelect = function(t, args) {
										var date = args[0][0];
										YAHOO.util.Dom.get(this.id).value = getLocalDate(date[0], date[1], date[2]);
										this.container.hide();
									};

									var insertAfter = function(new_node, ref_node) {
										var $D = YAHOO.util.Dom;
										var next = $D.getNextSibling(ref_node);
										if (next) {
											$D.get(ref_node).parentNode.insertBefore($D.get(new_node), next);
										} else {
											$D.get(ref_node).parentNode.appendChild($D.get(new_node));
										}
									};

									var elSpan = document.createElement("SPAN");
									elSpan.id = "calendar_button_"+id;
									elSpan.className = "yui-button";
									elSpan.innerHTML = \'<span class="first-child docebo_calendar"><button type="button"></button></span>\';

									var elDiv = document.createElement("DIV");
									elDiv.id = "calendar_menu_"+id;
									elDiv.innerHTML = \'<div id="calendar_container_\'+id+\'"></div>\';

									insertAfter(elDiv, id);
									insertAfter(elSpan, id);

									var oCalendarMenu = new YAHOO.widget.Overlay("calendar_menu_"+id, {visible: false});
									var oCalendarButton = new YAHOO.widget.Button("calendar_button_"+id, {
										label: "   ",
										type: "menu",
										menu: oCalendarMenu
									});
									var oCalendar = new YAHOO.widget.Calendar("calendar_"+id, "calendar_container_"+id);
									if (startdate) {
										oCalendar.cfg.setProperty("pagedate", startdate.substr(0, 2)+"/"+startdate.substr(6, 4));
										oCalendar.cfg.setProperty("selected", startdate);
									}
									oCalendar.cfg.setProperty("MONTHS_SHORT", ["' . implode('","', $arr_months_short) . '"]);
									oCalendar.cfg.setProperty("MONTHS_LONG", ["' . implode('","', $arr_months) . '"]);
									oCalendar.cfg.setProperty("WEEKDAYS_1CHAR", ["' . implode('","', $arr_days_1char) . '"]);
									oCalendar.cfg.setProperty("WEEKDAYS_SHORT", ["' . implode('","', $arr_days_short) . '"]);
									oCalendar.cfg.setProperty("WEEKDAYS_MEDIUM", ["' . implode('","', $arr_days_medium) . '"]);
									oCalendar.cfg.setProperty("WEEKDAYS_LONG", ["' . implode('","', $arr_days) . '"]);
									oCalendar.cfg.setProperty("start_weekday", 1);
									var oArgs = {id: id, container: oCalendarMenu};
									oCalendar.selectEvent.subscribe(calendarSelect, oArgs, true);
									oCalendar.render();

							}
						};
					}
				</script>';
            cout($script, 'scripts');
            $GLOBALS['jscal_loaded'] = true;
        }
    }
Ejemplo n.º 24
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');
}
Ejemplo n.º 25
0
 function get_LO_filter()
 {
     //addCss('style_filterbox');
     $back_url = $this->back_url;
     $jump_url = $this->jump_url;
     $next_url = $this->next_url;
     require_once _base_ . '/lib/lib.form.php';
     require_once _lms_ . '/lib/lib.course.php';
     $ref =& $_SESSION['report_tempdata']['columns_filter'];
     YuiLib::load();
     Util::get_js(Get::rel_path('lms') . '/admin/modules/report/courses_filter.js', true, true);
     //back to columns category selection
     if (isset($_POST['undo_filter'])) {
         //go back at the previous step
         Util::jump_to($back_url);
     }
     //set $_POST data in $_SESSION['report_tempdata']
     $selector = new Selector_Course();
     if (isset($_POST['update_tempdata'])) {
         $selector->parseForState($_POST);
         $temp = array('all_courses' => $_POST['all_courses'] == 1 ? true : false, 'selected_courses' => $selector->getSelection(), 'lo_types' => isset($_POST['lo_types']) ? $_POST['lo_types'] : array(), 'lo_milestones' => isset($_POST['lo_milestones']) ? $_POST['lo_milestones'] : array(), 'showed_columns' => isset($_POST['cols']) ? $_POST['cols'] : array(), 'custom_fields' => array(), 'order_by' => Get::req('order_by', DOTY_STRING, 'userid'), 'order_dir' => Get::req('order_dir', DOTY_STRING, 'asc'), 'show_suspended' => Get::req('show_suspended', DOTY_INT, 0) > 0);
         foreach ($ref['custom_fields'] as $val) {
             $temp['custom_fields'][] = array('id' => $val['id'], 'label' => $val['label'], 'selected' => isset($_POST['custom'][$val['id']]) ? true : false);
         }
         $_SESSION['report_tempdata']['columns_filter'] = $temp;
     } else {
         //first loading of this page -> prepare $_SESSION data structure
         //if (isset($_SESSION['report_update']) /* && is equal to id_report */) break;
         //get users' custom fields
         require_once _adm_ . '/lib/lib.field.php';
         $fman = new FieldList();
         $fields = $fman->getFlatAllFields();
         $custom = array();
         foreach ($fields as $key => $val) {
             $custom[] = array('id' => $key, 'label' => $val, 'selected' => false);
         }
         if (!isset($_SESSION['report_tempdata']['columns_filter'])) {
             $_SESSION['report_tempdata']['columns_filter'] = array('all_courses' => false, 'selected_courses' => $selector->getSelection(), 'lo_types' => array(), 'lo_milestones' => array(), 'showed_columns' => array(), 'custom_fields' => $custom, 'order_by' => 'userid', 'order_dir' => 'asc', 'show_suspended' => 'show_suspended');
         }
     }
     //filter setting done, go to next step
     if (isset($_POST['import_filter']) || isset($_POST['show_filter']) || isset($_POST['pre_filter'])) {
         $temp_url = $next_url;
         if (isset($_POST['pre_filter'])) {
             $temp_url .= '&show=1&nosave=1';
         }
         if (isset($_POST['show_filter'])) {
             $temp_url .= '&show=1';
         }
         Util::jump_to($temp_url);
     }
     cout(Form::getHidden('update_tempdata', 'update_tempdata', 1), 'content');
     $lang = $this->lang;
     //box for direct course selection
     $selection =& $ref['selected_courses'];
     $selector->parseForState($_POST);
     $selector->resetSelection($selection);
     $temp = count($selection);
     $box = new ReportBox('course_selector');
     $box->title = Lang::t('_REPORT_COURSE_SELECTION', 'report');
     $box->description = false;
     $box->body .= '<div class="fc_filter_line filter_corr">';
     $box->body .= '<input id="all_courses" name="all_courses" type="radio" value="1" ' . ($ref['all_courses'] ? 'checked="checked"' : '') . ' />';
     $box->body .= ' <label for="all_courses">' . $lang->def('_ALL_COURSES') . '</label>';
     $box->body .= ' <input id="sel_courses" name="all_courses" type="radio" value="0" ' . ($ref['all_courses'] ? '' : 'checked="checked"') . ' />';
     $box->body .= ' <label for="sel_courses">' . $lang->def('_SEL_COURSES') . '</label>';
     $box->body .= '</div>';
     $box->body .= '<div id="selector_container"' . ($ref['all_courses'] ? ' style="display:none"' : '') . '>';
     //$box->body .= Form::openElementSpace();
     $box->body .= $selector->loadCourseSelector(true);
     //$box->body .= Form::closeElementSpace();
     $box->body .= '<br /></div>';
     $box->footer = $lang->def('_CURRENT_SELECTION') . ':&nbsp;<span id="csel_foot">' . ($ref['all_courses'] ? Lang::t('_ALL', 'standard') : ($temp != '' ? $temp : '0')) . '</span>';
     //.'</div>';
     cout($box->get(), 'content');
     cout('<script type="text/javascript">courses_count=' . ($temp == '' ? '0' : $temp) . ';' . 'courses_all="' . Lang::t('_ALL', 'standard') . '";' . "\n" . 'YAHOO.util.Event.addListener(window, "load", courses_selector_init);</script>', 'page_head');
     $box = new ReportBox('lo_selection');
     $box->title = $lang->def('_SELECT_LO_OPTIONS');
     //LO columns selection
     $lo_trans = $this->getLOTypesTranslations();
     $box->body .= Form::getOpenFieldset(Lang::t('_RU_LO_TYPES', 'report'), 'lotypes_fieldset');
     $res = sql_query("SELECT * FROM %lms_lo_types");
     while ($row = mysql_fetch_assoc($res)) {
         $trans = isset($lo_trans[$row['objectType']]) ? $lo_trans[$row['objectType']] : "";
         $box->body .= Form::getCheckBox($trans, 'lo_type_' . $row['objectType'], 'lo_types[' . $row['objectType'] . ']', $row['objectType'], in_array($row['objectType'], $ref['lo_types']) ? true : false);
     }
     $box->body .= Form::getCloseFieldset();
     $box->body .= Form::getOpenFieldset($lang->def('_RU_LO_MILESTONES'), 'lomilestones_fieldset');
     $box->body .= Form::getCheckBox($lang->def('_NONE'), 'lo_milestone_0', 'lo_milestones[]', _MILESTONE_NONE, in_array(_MILESTONE_NONE, $ref['lo_milestones']) ? true : false);
     $box->body .= Form::getCheckBox($lang->def('_START'), 'lo_milestone_1', 'lo_milestones[]', _MILESTONE_START, in_array(_MILESTONE_START, $ref['lo_milestones']) ? true : false);
     $box->body .= Form::getCheckBox($lang->def('_END'), 'lo_milestone_2', 'lo_milestones[]', _MILESTONE_END, in_array(_MILESTONE_END, $ref['lo_milestones']) ? true : false);
     $box->body .= Form::getCloseFieldset();
     cout($box->get(), 'content');
     function is_showed($which)
     {
         if (isset($_SESSION['report_tempdata']['columns_filter'])) {
             return in_array($which, $_SESSION['report_tempdata']['columns_filter']['showed_columns']);
         } else {
             return false;
         }
     }
     //box for columns selection
     $arr_fieldset = array('user' => '', 'course' => '', 'lo' => '');
     $box = new ReportBox('columns_selection');
     $box->title = $lang->def('_SELECT_THE_DATA_COL_NEEDED');
     $box->description = false;
     //prepare fieldsets
     foreach ($this->LO_columns as $val) {
         if ($val['select']) {
             $line = Form::getCheckBox($val['label'], 'col_sel_' . $val['key'], 'cols[]', $val['key'], is_showed($val['key']));
             switch ($val['group']) {
                 case 'user':
                     $arr_fieldset['user'] .= $line;
                     break;
                 case 'course':
                     $arr_fieldset['course'] .= $line;
                     break;
                 case 'lo':
                     $arr_fieldset['lo'] .= $line;
                     break;
             }
         } else {
             if ($val['key'] == '_CUSTOM_FIELDS_') {
                 //custom fields
                 if (count($ref['custom_fields']) > 0) {
                     foreach ($ref['custom_fields'] as $key => $val) {
                         $arr_fieldset['user'] .= Form::getCheckBox($val['label'], 'col_custom_' . $val['id'], 'custom[' . $val['id'] . ']', $val['id'], $val['selected']);
                     }
                 }
             }
         }
     }
     //print fieldsets
     foreach ($arr_fieldset as $fid => $fieldset) {
         $ftitle = '';
         switch ($fid) {
             case 'user':
                 $ftitle = Lang::t('_USER_CUSTOM_FIELDS', 'report');
                 break;
             case 'course':
                 $ftitle = Lang::t('_COURSE_FIELDS', 'report');
                 break;
             case 'lo':
                 $ftitle = Lang::t('_LEARNING_OBJECTS', 'standard');
                 break;
         }
         $box->body .= Form::getOpenFieldset($ftitle, 'fieldset_' . $fid . '_fields');
         $box->body .= $fieldset;
         $box->body .= Form::getCloseFieldset();
     }
     cout($box->get(), 'content');
     //other options
     $box = new ReportBox('other_options');
     $box->title = Lang::t('_OTHER_OPTION', 'course');
     $box->description = false;
     $sort_list = array('userid' => Lang::t('_USERID', 'standard'), 'firstname' => Lang::t('_FIRSTNAME', 'standard'), 'lastname' => Lang::t('_LASTNAME', 'standard'), 'email' => Lang::t('_EMAIL', 'standard'), 'course_code' => Lang::t('_COURSE_CODE', 'standard'), 'course_name' => Lang::t('_COURSE_NAME', 'standard'), 'object_title' => Lang::t('_LEARNING_OBJECTS', 'standard'), 'object_type' => Lang::t('_RU_LO_TYPES', 'report'), 'first_attempt' => Lang::t('_LO_COL_FIRSTATT', 'report'), 'last_attempt' => Lang::t('_LO_COL_LASTATT', 'report'));
     $dir_list = array('asc' => Lang::t('_ORD_ASC_TITLE', 'standard'), 'desc' => Lang::t('_ORD_DESC_TITLE', 'standard'));
     $sort_selected = array_key_exists($ref['order_by'], $sort_list) ? $ref['order_by'] : 'userid';
     $dir_selected = array_key_exists($ref['order_dir'], $dir_list) ? $ref['order_dir'] : 'asc';
     $sort_dir_dropdown = Form::getInputDropdown('', 'order_dir', 'order_dir', $dir_list, $dir_selected, '');
     $box->body .= Form::getDropdown(Lang::t('_ORDER_BY', 'standard'), 'order_by', 'order_by', $sort_list, $sort_selected, $sort_dir_dropdown);
     $box->body .= Form::getCheckbox(Lang::t('_SHOW_SUSPENDED', 'organization_chart'), 'show_suspended', 'show_suspended', 1, (bool) $ref['show_suspended']);
     cout($box->get(), 'content');
 }
Ejemplo n.º 26
0
function modBooking()
{
    require_once $GLOBALS['where_scs'] . '/lib/lib.booking.php';
    require_once _base_ . '/lib/lib.form.php';
    require_once _base_ . '/lib/lib.table.php';
    YuiLib::load(array('selector' => 'selector-beta-min.js'));
    $lang =& DoceboLanguage::createInstance('conference', 'lms');
    $room_id = Get::req('id', DOTY_INT, 0);
    $booking = new RoomBooking();
    $acl_man =& Docebo::user()->getAclManager();
    $user_booked = $booking->getRoomSubscriptions($room_id);
    if (isset($_POST['confirm'])) {
        foreach ($user_booked as $user) {
            $booking->setApproved($user['idUser'], $room_id, isset($_POST['user_' . $user['idUser']]) ? 1 : 0);
            Util::jump_to('index.php?modname=conference&op=list');
        }
    } else {
        cout(getTitleArea($lang->def('_MOD_BOOKING_TITLE')) . '<div class="std_block">');
        $conference = new Conference_Manager();
        $tb = new Table(0, $lang->def('_USER_BOOKED'), $lang->def('_USER_BOOKED'));
        $cont_h = array($lang->def('_FULLNAME'), $lang->def('_BOOKING_DATE'), '');
        $type_h = array('', 'align_center', 'align_center');
        $tb->setColsStyle($type_h);
        $tb->addHead($cont_h);
        $user_selected = 0;
        $max_user_selectable = $conference->getRoomMaxParticipants($room_id);
        $array_unchecked = array();
        cout(Form::openForm('user_booking_form', 'index.php?modname=conference&amp;op=modbooking&amp;id=' . $room_id));
        foreach ($user_booked as $user) {
            $user_info = $acl_man->getUser($user['idUser'], false);
            $cont = array();
            if ($user_info[ACL_INFO_FIRSTNAME] !== '' && $user_info[ACL_INFO_LASTNAME]) {
                $cont[] = $user_info[ACL_INFO_FIRSTNAME] . ' ' . $user_info[ACL_INFO_LASTNAME] . ' (' . $acl_man->relativeId($user_info[ACL_INFO_USERID]) . ')';
            } elseif ($user_info[ACL_INFO_FIRSTNAME] !== '') {
                $cont[] = $user_info[ACL_INFO_FIRSTNAME] . ' (' . $acl_man->relativeId($user_info[ACL_INFO_USERID]) . ')';
            } elseif ($user_info[ACL_INFO_LASTNAME] !== '') {
                $cont[] = $user_info[ACL_INFO_LASTNAME] . ' (' . $acl_man->relativeId($user_info[ACL_INFO_USERID]) . ')';
            } else {
                $cont[] = $acl_man->relativeId($user_info[ACL_INFO_USERID]);
            }
            $cont[] = Format::date($user['date'], 'datetime');
            $cont[] = '<div class="form_line_l"><input class="check" type="checkbox" id="user_' . $user['idUser'] . '" name="user_' . $user['idUser'] . '" value="1" ' . ($user['valid'] ? 'checked="checked"' : '') . '/></div>';
            if ($user['valid']) {
                $user_selected++;
            } else {
                $array_unchecked[] = 'user_' . $user['idUser'];
            }
            $tb->addBody($cont);
        }
        reset($user_booked);
        addJs($GLOBALS['where_lms_relative'] . '/modules/conference/', 'conference.js');
        cout('<script>' . "\n" . 'var num_checked = ' . $user_selected . ';' . "\n" . 'var max_checked =' . $max_user_selectable . ';' . "\n");
        cout('unchecked = new Array(');
        $first = true;
        foreach ($array_unchecked as $unchecked) {
            if ($first) {
                cout('"' . $unchecked . '"');
                $first = false;
            } else {
                cout(',"' . $unchecked . '"');
            }
        }
        cout(');' . "\n");
        cout('</script>' . "\n" . $tb->getTable() . Form::openButtonSpace() . Form::getButton('confirm', 'confirm', $lang->def('_CONFIRM')) . Form::getButton('undo', 'undo', $lang->def('_UNDO')) . Form::closeButtonSpace() . Form::closeForm());
        foreach ($user_booked as $user) {
            cout('<script>YAHOO.util.Event.addListener("user_' . $user['idUser'] . '", "click", onClick);</script>');
        }
        cout('<script>controlChecked();</script>');
        cout('</div>');
    }
}
Ejemplo n.º 27
0
 function getUserRelatedAction($selected, $with_file = true, $reduced = false)
 {
     $this->initAjax();
     $from = Get::req('from', DOTY_INT, 0);
     $viewer = $this->getViewer();
     YuiLib::load(array('animation' => 'animation-min.js', 'dragdrop' => 'dragdrop-min.js', 'button' => 'button-min.js', 'container' => 'container-min.js', 'my_window' => 'windows.js'), array('container/assets/skins/sam' => 'container.css', 'button/assets/skins/sam' => 'button.css'));
     //$pre = ( $reduced === true ? 'l_' : '' );
     $is_friend = $this->_up_data_man->isFriend($viewer, $this->_id_user, true);
     $is_online = $this->_up_data_man->isOnline($this->_id_user);
     //$send_msg 	= $this->_up_data_man->canSendMessage($this->_id_user, $viewer);
     $action = array();
     if ($with_file) {
         $files_info = $this->_up_data_man->getFileInfo($this->_id_user, $viewer);
         $id_thread = Get::req('idThread', DOTY_INT, 0);
         $file_type = array('image', 'video', 'audio', 'other');
         $id_thread = Get::req('idThread', DOTY_INT, 0);
         foreach ($file_type as $type) {
             if ($files_info[$type]) {
                 $action[] = '<li>' . '<a href="' . $this->_url_man->getUrl('id_user='******'&' . $this->_varname_action . '=view_files&type=' . $type . '&idThread=' . $id_thread . '&from=' . $from) . '" title="' . $this->_lang->def('_VIEW_USER_' . strtoupper($type)) . '">' . '<img src="' . getPathImage('fw') . 'profile/' . $pre . $type . '.png" alt="' . $this->_lang->def('_EN_USER_' . strtoupper($type) . '_ALT') . '" />' . '</a>' . '</li>';
             }
         }
         // end for
     }
     if ($is_online && $is_online !== 'unk') {
         $action[] = '<li>' . '<img src="' . getPathImage('fw') . 'standard/online.png" alt="' . $this->_lang->def('_USERONLINE') . '" /> ' . '</li>';
     } else {
         $action[] = '<li>' . '<img src="' . getPathImage('fw') . 'standard/offline.png" alt="' . $this->_lang->def('_UP_OFFLINE') . '" /> ' . '</li>';
     }
     // action with the user ---------------------------------------------------------------
     if (empty($action)) {
         return '';
     }
     $html = '<ul class="list_user_actions">' . implode('', $action) . '</ul>';
     return $html;
 }
Ejemplo n.º 28
0
function login_coursecatalogueJsSetup()
{
    YuiLib::load(array('animation' => 'animation-min.js', 'dragdrop' => 'dragdrop-min.js', 'button' => 'button-min.js', 'container' => 'container-min.js', 'my_window' => 'windows.js'), array('container/assets/skins/sam' => 'container.css', 'button/assets/skins/sam' => 'button.css'));
    addCss('style_course_list', 'lms');
    addJs($GLOBALS['where_lms_relative'] . '/modules/coursecatalogue/', 'ajax.coursecatalogue.js');
    //addCss('style_yui_docebo', 'lms');
    $GLOBALS['page']->add('<script type="text/javascript"> server_location = "' . $GLOBALS['where_lms_relative'] . '/"; </script>', 'content');
}
Ejemplo n.º 29
0
<?php

YuiLib::load(array('animation' => 'my_animation', 'container' => 'container-min', 'container' => 'container_core-min'));
cout(Util::get_js(Get::rel_path('lms') . '/views/catalog/catalog.js', true), 'page_head');
require_once _lms_ . '/lib/lib.middlearea.php';
$ma = new Man_MiddleArea();
?>
<script type="text/javascript">
	YAHOO.util.Event.onDOMReady(function() {
		initialize("<?php 
echo Lang::t('_UNDO', 'standard');
?>
");
	});
</script>
<div id="global_conf" class="yui-navset yui-navset-top">
	<ul class="yui-nav">
		<li class="<?php 
echo $active_tab == 'all' ? 'selected' : '';
?>
 first">
			<a href="index.php?r=catalog/allCourse">
				<em><?php 
echo Lang::t('_ALL_COURSES', 'catalogue');
?>
</em>
			</a>
		</li>
		<li class="<?php 
echo $active_tab == 'new' ? 'selected' : '';
?>
Ejemplo n.º 30
0
 public function init()
 {
     require_once _base_ . '/lib/lib.userselector.php';
     $this->util = new UserSelectorUtil();
     $this->json = new Services_JSON();
     YuiLib::load('base,tabview,tree,datatable,selector');
     Util::get_js(Get::rel_path('base') . '/lib/lib.elem_selector.js', true, true);
     Util::get_js(Get::rel_path('base') . '/lib/js_utils.js', true, true);
     Util::get_css('base-folder-tree.css', false, true);
     $js_path = Get::rel_path('base') . '/widget/tree/';
     Util::get_js($js_path . 'foldernode.js', true, true);
     Util::get_js($js_path . 'foldertree.js', true, true);
     Util::get_js($js_path . 'selectortree.js', true, true);
     $js_path = Get::rel_path('base') . '/widget/userselector/';
     Util::get_js($js_path . 'userselector.js', true, true);
 }