/** * This constructor require the source file name * @param array $params the array of params * - 'filename' => name of the file (required) * - 'first_row_header' => bool TRUE if first row is header (Optional, default = TRUE ) * - 'separator' => string a char with the fields separator (Optional, default = ,) **/ function __construct($params) { if ($params !== NULL) { $this->set_config($params); } $this->aclm = Docebo::aclm(); $this->cols_descriptor = array(array(DOCEBOIMPORT_COLNAME => Lang::t('_TYPE'), DOCEBOIMPORT_COLID => 'admin_type', DOCEBOIMPORT_COLMANDATORY => true, DOCEBOIMPORT_DATATYPE => 'text', DOCEBOIMPORT_DEFAULT => ''), array(DOCEBOIMPORT_COLNAME => Lang::t('_PROFILE'), DOCEBOIMPORT_COLID => 'profile', DOCEBOIMPORT_COLMANDATORY => true, DOCEBOIMPORT_DATATYPE => 'text', DOCEBOIMPORT_DEFAULT => ''), array(DOCEBOIMPORT_COLNAME => Lang::t('_USERNAME'), DOCEBOIMPORT_COLID => 'username', DOCEBOIMPORT_COLMANDATORY => true, DOCEBOIMPORT_DATATYPE => 'text', DOCEBOIMPORT_DEFAULT => ''), array(DOCEBOIMPORT_COLNAME => Lang::t('_FOLDER_NAME'), DOCEBOIMPORT_COLID => 'folder_name', DOCEBOIMPORT_COLMANDATORY => false, DOCEBOIMPORT_DATATYPE => 'text', DOCEBOIMPORT_DEFAULT => 'root'), array(DOCEBOIMPORT_COLNAME => Lang::t('courses'), DOCEBOIMPORT_COLID => 'courses', DOCEBOIMPORT_COLMANDATORY => false, DOCEBOIMPORT_DATATYPE => 'text', DOCEBOIMPORT_DEFAULT => 'root')); }
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&op=view_report&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&op=modify_name&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&op=del_public_report&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&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'); }
public function applyRulesMultiLang($log_action, $arr_users, $id_org, $id_entity = false, $user_temp = false) { $ent = array(); if ($id_org != false) { $acl_man = Docebo::aclm(); $oc_sn = $acl_man->getGroupST('oc_' . $id_org); $um_adm = new UsermanagementAdm(); $ancestor = $um_adm->getAncestorInfoFolders($id_org); $ancestor['idst_ocd'][] = $oc_sn; $ent = $ancestor['idst_ocd']; } if ($id_entity != false) { $ent[] = $id_entity; } if (empty($ent)) { return false; } // FORMA: if we have the user_temp param we have to use user_temp table $user_table = "%adm_user"; if ($user_temp) { $user_table = "%adm_user_temp"; } $query = "SELECT DISTINCT u.idst, us.value " . " FROM " . $user_table . " AS u " . " LEFT JOIN %adm_setting_user AS us " . " ON ( u.idst = us.id_user AND us.path_name = 'ui.language' ) " . " WHERE u.idst IN ( " . implode(",", $arr_users) . " )"; // END FORMA $re_query = $this->db->query($query); if (!$re_query) { return false; } $arr_users = array(); $langs = array(); $default_lang = getDefaultLanguage(); while (list($idst_user, $value) = $this->db->fetch_row($re_query)) { if ($value == '') { $value = $default_lang; } $langs[$value] = $value; $arr_users[$value][] = $idst_user; } // find rules for evry language in the array require_once _lms_ . '/lib/lib.subscribe.php'; $cs = new CourseSubscribe_Management(); $applicable = $this->getApplicableRuleForEntityMultiLang($ent); $course_list = $applicable['course_list']; if (!isset($course_list['all'])) { $course_list['all'] = array(); } $this->db->start_transaction(); // create a entry log $id_log = $this->addLogEntry($log_action, $applicable['rules']); if (!$id_log) { return false; } foreach ($langs as $i => $lang_code) { if (!empty($course_list[$lang_code])) { $courses = array_unique(array_merge($course_list['all'], $course_list[$lang_code])); } else { $courses = array_unique($course_list['all']); } if (!empty($arr_users[$lang_code]) && !empty($courses)) { $re = $cs->multipleSubscribe($arr_users[$lang_code], $courses, 3, $id_log); } } $this->db->commit(); return $re; }
function _get_delay_query($type = 'html', $report_data = NULL, $other = '') { if ($report_data == NULL) { $report_data =& $_SESSION['report_tempdata']; } $rdata =& $report_data['rows_filter']; $cdata =& $report_data['columns_filter']; $acl_man = new DoceboACLManager(); $acl_man->include_suspended = TRUE; $course_man = new Man_Course(); $alluser = $rdata['all_users']; $jump_url = ''; $org_chart_subdivision = isset($cdata['org_chart_subdivision']) ? $cdata['org_chart_subdivision'] : false; $day_from_subscription = $cdata['day_from_subscription'] != "" ? $cdata['day_from_subscription'] : false; $day_until_course_end = $cdata['day_until_course_end'] != "" ? $cdata['day_until_course_end'] : false; $date_until_course_end = $cdata['date_until_course_end'] != "" ? $cdata['date_until_course_end'] : false; $report_type_completed = isset($cdata['report_type_completed']) ? $cdata['report_type_completed'] : false; $report_type_started = isset($cdata['report_type_started']) ? $cdata['report_type_started'] : false; $course_selected = $cdata['selected_courses']; $all_courses = $cdata['all_courses']; $order_by = isset($cdata['order_by']) ? $cdata['order_by'] : 'userid'; $order_dir = isset($cdata['order_dir']) ? $cdata['order_dir'] : 'asc'; $show_suspended = isset($cdata['show_suspended']) ? (bool) $cdata['show_suspended'] : false; if (!$alluser) { $user_selected =& $acl_man->getAllUsersFromIdst($rdata['users']); } else { $user_selected =& $acl_man->getAllUsersIdst(); } $lang =& DoceboLanguage::createInstance('report', 'framework'); $lang_u =& DoceboLanguage::CreateInstance('stats', 'lms'); if (empty($user_selected)) { return $lang->def('_NULL_SELECTION'); } if (empty($course_selected) && !$all_courses) { return $lang->def('_NULL_COURSE_SELECTION'); } if (1 == 1) { $date_now = Format::date(date("Y-m-d H:i:s")); //set query suspended users condition $query_show_suspended = "u.valid = 1"; //default condition switch ($show_suspended) { case "all": $query_show_suspended = ""; break; case "suspended_only": $query_show_suspended = " AND u.valid = 0 "; break; case "active_only": $query_show_suspended = " AND u.valid = 1 "; break; } //set query order by param $_dir = "ASC"; switch ($order_dir) { case "desc": $_dir = "DESC"; break; } $query_order_by = "u.lastname, u.firstname, u.userid"; switch ($order_by) { case 'firstname': $query_order_by = "u.firstname " . $_dir . ", u.userid " . $_dir; break; case 'lastname': $query_order_by = "u.lastname " . $_dir . ", u.userid " . $_dir; break; case 'email': $query_order_by = "u.email " . $_dir . ", u.userid " . $_dir; break; case 'status': $query_order_by = "cu.status " . $_dir . ", u.userid " . $_dir . ", u.lastname " . $_dir; break; //case 'level': $query_order_by = "cu.level ".$_dir.", u.userid ".$_dir.", c.code ".$_dir.""; break; //case 'level': $query_order_by = "cu.level ".$_dir.", u.userid ".$_dir.", c.code ".$_dir.""; break; case 'date_subscription': $query_order_by = "cu.date_inscr " . $_dir . ", u.userid " . $_dir . ", u.lastname " . $_dir; break; case 'date_first_access': $query_order_by = "cu.date_first_access " . $_dir . ", u.userid " . $_dir . ", u.lastname " . $_dir; break; case 'date_last_access': $query_order_by = "cu.date_last_access " . $_dir . ", u.userid " . $_dir . ", u.lastname " . $_dir; break; case 'date_complete': $query_order_by = "cu.date_complete " . $_dir . ", u.userid " . $_dir . ", u.lastname " . $_dir; break; } $query_course_user = "******" . $GLOBALS['prefix_lms'] . "_courseuser AS cu " . " JOIN " . $GLOBALS['prefix_fw'] . "_user as u ON cu.idUser = u.idst\r\n\t\t\t\tWHERE cu.idCourse > 0 " . $query_show_suspended . ($alluser ? "" : " AND cu.idUser IN ( " . implode(',', $user_selected) . " ) ") . ($all_courses ? '' : " AND cu.idCourse IN (" . implode(',', $course_selected) . ")") . " ORDER BY " . $query_order_by; $re_course_user = sql_query($query_course_user); $element_to_print = array(); $courses_codes = array(); while (list($id_u, $id_c, $id_e, $date_inscr, $date_first_access, $date_complete, $status, $level, $date_last_access, $u_userid, $u_firstname, $u_lastname, $u_email, $u_valid) = sql_fetch_row($re_course_user)) { if ($level == '3') { //$report_type === 'course_started' && $level == '3') { $user_check = false; $now_timestamp = mktime('0', '0', '0', date('m'), date('d'), date('Y')); //check the condition on status (course started and/or completed) $status_condition = $status != _CUS_END; //&& $status != _CUS_SUSPEND; if ($report_type_completed && !$report_type_started) { $status_condition = $status_condition && $status == _CUS_BEGIN; } if ($report_type_started && !$report_type_completed) { $status_condition = $status_condition && $status != _CUS_BEGIN; } if ($day_from_subscription) { if ($status_condition) { $user_timestamp = mktime('0', '0', '0', $date_inscr[5] . $date_inscr[6], $date_inscr[8] . $date_inscr[9] + $day_from_subscription, $date_inscr[0] . $date_inscr[1] . $date_inscr[2] . $date_inscr[3]); if ($user_timestamp < $now_timestamp) { $user_check = true; } } } if ($day_until_course_end) { if ($status_condition) { if ($id_e > 0) { $query = "SELECT date_end" . " FROM " . $GLOBALS['prefix_lms'] . "_course_edition" . " WHERE idCourseEdition = '" . $id_e . "'"; list($date_end) = sql_fetch_row(sql_query($query)); $user_timestamp = mktime('0', '0', '0', $date_end[5] . $date_end[6], $date_end[8] . $date_end[9] - $day_until_course_end, $date_end[0] . $date_end[1] . $date_end[2] . $date_end[3]); if ($user_timestamp < $now_timestamp) { $user_check = true; } } else { $query = "SELECT date_end" . " FROM " . $GLOBALS['prefix_lms'] . "_course" . " WHERE idCourse = '" . $id_c . "'"; list($date_end) = sql_fetch_row(sql_query($query)); $user_timestamp = mktime('0', '0', '0', $date_end[5] . $date_end[6], $date_end[8] . $date_end[9] - $day_until_course_end, $date_end[0] . $date_end[1] . $date_end[2] . $date_end[3]); if ($user_timestamp < $now_timestamp) { $user_check = true; } } } } if ($date_until_course_end) { if ($status_condition) { if ($id_e > 0) { $query = "SELECT COUNT(*)" . " FROM " . $GLOBALS['prefix_lms'] . "_course_edition" . " WHERE idCourseEdition = '" . $id_e . "'" . " AND date_end < '" . Format::dateDb($date_until_course_end, 'date') . "'"; list($control) = sql_fetch_row(sql_query($query)); if ($control) { $user_check = true; } } else { $query = "SELECT COUNT(*)" . " FROM " . $GLOBALS['prefix_lms'] . "_course" . " WHERE idCourse = '" . $id_c . "'" . " AND date_end < '" . Format::dateDb($date_until_course_end, 'date') . "'"; list($control) = sql_fetch_row(sql_query($query)); if ($control) { $user_check = true; } } } } if (!$date_until_course_end && !$day_from_subscription && !$date_until_course_end) { if ($status_condition) { $user_check = true; } } if ($user_check) { $course_info = $course_man->getCourseInfo($id_c); //$user_detail = $acl_man->getUser($id_u, false); $element_to_print[$id_c]['name'] = $course_info['name']; $element_to_print[$id_c]['code'] = $course_info['code']; $element_to_print[$id_c]['data'][] = array('idUser' => $id_u, 'idCourse' => $id_c, 'idCourseEdition' => $id_e, 'status' => $status, 'level' => $level, 'userid' => Docebo::aclm()->relativeId($u_userid), 'firstname' => $u_firstname, 'lastname' => $u_lastname, 'mail' => $u_email, 'suspended' => $u_valid <= 0, 'date_subscription' => $date_inscr, 'date_first_access' => $date_first_access, 'date_completed' => $date_complete, 'date_last_access' => $date_last_access); } } } //backward compatibility $showed_columns = array(); foreach ($cdata['showed_columns'] as $_column_key) { $showed_columns[] = $this->_check_delay_column($_column_key); } //print course table $this->_printTable_delay($type, $element_to_print, $showed_columns); if ($this->use_mail) { $this->_loadEmailActions(); } } }
public function getAdminAllSett($id_admin, $idst_field_name) { $acl_man = Docebo::aclm(); $admin_tree = $this->getAdminTree($id_admin); // separate the users and the groups $admin_users = $acl_man->getUsersFromMixedIdst($admin_tree); $admin_groups = $acl_man->getGroupsFromMixedIdst($admin_tree); $tree = array('users' => $admin_users, 'groups' => $admin_groups); // retrive parent groups $tmp_admin_groups = array(); foreach ($admin_groups as $id_group) { $tmp_admin_groups = array_merge($tmp_admin_groups, $acl_man->getGroupGDescendants($id_group)); } $admin_groups = array_merge($admin_groups, $tmp_admin_groups); //$admin_groups = $tmp_admin_groups; $admin_userlist = array_merge($admin_users, $acl_man->getGroupUMembers($admin_groups)); if (!empty($admin_users)) { $arr_query[] = " {$idst_field_name} IN (" . implode(',', $admin_userlist) . ") "; } if (!empty($admin_groups)) { $arr_query[] = " {$idst_field_name} IN ( SELECT idstMember FROM %adm_group_members WHERE idst IN (" . implode(',', $admin_groups) . ") ) "; } if (!empty($arr_query)) { $query = "( " . implode($arr_query, 'OR') . " )"; } else { $query = " 0 "; } return array('tree' => $tree, 'users' => $admin_userlist, 'groups' => $admin_groups, 'query' => $query); }
function getReportRecipients($id_rep) { //get month, day $arr_days = array(); $arr_months = array(); $output = array(); //check for daily $recipients = array(); $qry = "SELECT * FROM %lms_report_schedule WHERE period LIKE '%day%' AND id_report_filter={$id_rep} AND enabled = 1"; $res = sql_query($qry); while ($row = sql_fetch_assoc($res)) { $qry2 = "SELECT id_user FROM %lms_report_schedule_recipient WHERE id_report_schedule=" . $row['id_report_schedule']; $res2 = sql_query($qry2); while (list($recipient) = sql_fetch_row($res2)) { $recipients[] = $recipient; //idst of the recipients } $recipients_flat = Docebo::aclm()->getAllUsersFromSelection($recipients); if (!empty($recipients_flat)) { $qry3 = "SELECT email FROM %adm_user WHERE idst IN (" . implode(',', $recipients_flat) . ") AND email<>'' AND valid = 1"; $res3 = sql_query($qry3); while (list($email) = sql_fetch_row($res3)) { $output[] = $email; } } } //check for weekly $daynumber = date('w'); $recipients = array(); $qry = "SELECT * FROM %lms_report_schedule WHERE period LIKE '%week,{$daynumber}%' AND id_report_filter={$id_rep} AND enabled = 1"; $res = sql_query($qry); while ($row = sql_fetch_assoc($res)) { $qry2 = "SELECT id_user FROM %lms_report_schedule_recipient WHERE id_report_schedule=" . $row['id_report_schedule']; $res2 = sql_query($qry2); while (list($recipient) = sql_fetch_row($res2)) { $recipients[] = $recipient; } $recipients_flat = Docebo::aclm()->getAllUsersFromSelection($recipients); if (!empty($recipients_flat)) { $qry3 = "SELECT email FROM %adm_user WHERE idst IN (" . implode(',', $recipients_flat) . ") AND email<>'' AND valid = 1"; $res3 = sql_query($qry3); while (list($email) = sql_fetch_row($res3)) { $output[] = $email; } } } //check for monthly $monthdaynumber = date('j'); //today's day of the month, 1-31 $monthdays = date('t'); //amount of days in current month 28-31 $recipients = array(); $options = array(); if ($monthdays < 31 && $monthdaynumber == $monthdays) { //if it's the last day of tehe month for ($i = 31; $i >= $monthdays; $i--) { $options[] = "'month,{$i}'"; } } else { $options[] = "'month,{$monthdaynumber}'"; } $qry = "SELECT * FROM %lms_report_schedule WHERE period IN (" . implode(',', $options) . ") AND id_report_filter={$id_rep} AND enabled = 1"; $res = sql_query($qry); while ($row = sql_fetch_assoc($res)) { $qry2 = "SELECT id_user FROM %lms_report_schedule_recipient WHERE id_report_schedule=" . $row['id_report_schedule']; $res2 = sql_query($qry2); while (list($recipient) = sql_fetch_row($res2)) { $recipients[] = $recipient; } $recipients_flat = Docebo::aclm()->getAllUsersFromSelection($recipients); if (!empty($recipients_flat)) { $qry3 = "SELECT email FROM %adm_user WHERE idst IN (" . implode(',', $recipients_flat) . ") AND email<>'' AND valid = 1"; $res3 = sql_query($qry3); while (list($email) = sql_fetch_row($res3)) { $output[] = $email; } } } //die(print_r($output, true)); //prepare output return array_unique($output); }
/** * Find the idst of the group of a course that represent the level * @param int $id_course the id of the course * * @return array [lv] => idst, [lv] => idst */ function getCourseLevel($id_course, $also_waiting = false) { require_once _lms_ . '/lib/lib.subscribe.php'; $subscribe_man = new CourseSubscribe_Manager(); $map = array(); $levels = $subscribe_man->getUserLevel(); //CourseLevel::getLevels(); $acl_man =& Docebo::user()->getAclManager(); // find all the group created for this menu custom for permission management $arr_groupid = array(); foreach ($levels as $lv => $name_level) { $arr_groupid[$lv] = '/lms/course/' . $id_course . '/subscribed/' . $lv; } $arr_idst = Docebo::aclm()->getArrGroupST($arr_groupid); $map = array(); $flip = array_flip($arr_groupid); foreach ($arr_idst as $groupid => $idst) { $lv = $flip[$groupid]; $map[$lv] = (int) $idst; } return $map; }
/** * @param array data to insert; is an array with keys the names of cols and * values the data * @return TRUE if the row was succesfully inserted, FALSE otherwise **/ function add_row($row) { $acl =& Docebo::user()->getACL(); $acl_manager = Docebo::aclm(); foreach ($row as $k => $v) { if ($row[$k] !== false) { $row[$k] = trim($v); } } $userid = strtolower(addslashes($this->_convert_char($row['userid']))); $firstname = ucfirst(strtolower(addslashes($this->_convert_char($row['firstname'])))); $lastname = ucfirst(strtolower(addslashes($this->_convert_char($row['lastname'])))); $pass = addslashes($this->_convert_char($row['pass'])); $email = addslashes($this->_convert_char($row['email'])); $force_change = ''; switch ($this->pwd_force_change_policy) { case "by_setting": $force_change = Get::sett('pass_change_first_login', 'off') == 'on' ? 1 : 0; break; case "true": $force_change = 1; break; case 'false': $force_change = 0; break; } $idst = false; $is_an_update = false; if ($this->insert_update) { // check if we need to update alredy existent users $idst = $acl_manager->getUserST($userid); if ($idst !== false) { $result = $acl_manager->updateUser($idst, $userid, $firstname, $lastname, $pass, $email, FALSE, FALSE, FALSE, TRUE, $force_change, FALSE, FALSE, FALSE, FALSE); $is_an_update = true; // the user exist but the update query fails if (!$result) { $this->last_error = 'Error on update user'; return FALSE; } } } if ($idst === FALSE) { // create a new user $idst = $acl_manager->registerUser($userid, $firstname, $lastname, $pass, $email, '', '', FALSE, FALSE, '', $force_change, FALSE, FALSE, FALSE, FALSE); } if ($idst !== false) { $result = TRUE; $this->idst_imported[$idst] = $idst; if (!$is_an_update) { // -- Add user to registered users group if not importing into root --- $acl_manager->addToGroup($this->idst_oc, $idst); $acl_manager->addToGroup($this->idst_ocd, $idst); // -- add to group level ---------------------------------------------- $acl_manager->addToGroup($this->userlevel, $idst); } // -------------------------------------------------------------------- if (isset($row['tree_name']) && $row['tree_name'] != '') { $row['tree_name'] = strtolower($row['tree_name']); if (isset($this->orgchart[$row['tree_name']])) { $f = $this->orgchart[$row['tree_name']]; $acl_manager->addToGroup($f->idst_oc, $idst); $acl_manager->addToGroup($f->idst_ocd, $idst); // apply enroll rules $enrollrules = new EnrollrulesAlms(); $enrollrules->newRules('_NEW_IMPORTED_USER', array($idst), 'all', $f->idOrg); } } elseif ($this->idst_group != $this->idst_oc) { $acl_manager->addToGroup($this->idst_group, $idst); $acl_manager->addToGroup($this->idst_desc, $idst); } $array_subst = array('[url]' => Get::sett('url'), '[userid]' => $userid, '[password]' => $pass); //send email alert if ($this->send_alert) { $e_msg = new EventMessageComposer(); $e_msg->setSubjectLangText('email', '_REGISTERED_USER_SBJ', false); $e_msg->setBodyLangText('email', '_REGISTERED_USER_TEXT', $array_subst); $e_msg->setBodyLangText('sms', '_REGISTERED_USER_TEXT_SMS', $array_subst); $recipients = array($idst); createNewAlert('UserNew', 'directory', 'edit', '1', 'New user created', $recipients, $e_msg, true); } //-save extra field------------------------------------------ /* $arr_idst_all = $acl->getArrSTGroupsST(array($this->idst_group,$this->idst_desc)); $arr_fields = $this->fl->getFieldsFromIdst($arr_idst_all); $arr_fields_toset = array(); foreach( $arr_fields as $field_id => $field_info) if(isset($row[$field_id]) && $row[$field_id] !== false) $arr_fields_toset[$field_id] = addslashes($this->_convert_char($row[$field_id])); */ foreach ($row as $field_id => $field_value) { if (isset($this->arr_fields[$field_id])) { $arr_fields_toset[$field_id] = addslashes($this->_convert_char($field_value)); } } if (count($arr_fields_toset) > 0) { $result = $this->fl->storeDirectFieldsForUser($idst, $arr_fields_toset, false); } //----------------------------------------------------------- if (!$result) { $this->last_error = Lang::t('_ORG_IMPORT_ERR_STORECUSTOMFIELDS') . ' : <b>' . $userid . '</b>'; } return $result; } else { $this->last_error = Lang::t('_OPERATION_FAILURE') . ' : <b>' . $userid . '</b>'; return FALSE; } }
?> <br/> <?php echo Lang::t('_NUM_ATTEMPTS', 'standard') . ': ' . $track['num_attempts']; ?> <br/> </p> <div class="nofloat"></div> <br/> <h3><?php echo Lang::t('_FIRST_PLACES', 'standard'); ?> </h3> <?php $tb = new Table(30); $tb->addHead(array(Lang::t('_POSITION', 'games'), Lang::t('_USERNAME', 'standard'), Lang::t('_FULLNAME', 'standard'), Lang::t('_CURRENT_SCORE', 'standard'), Lang::t('_MAX_SCORE', 'standard')), array('image', '', '', 'image', 'image')); $i = 1; foreach ($standings as $row) { $tb->addBody(array($i++, Docebo::aclm()->relativeID($row['userid']), $row['lastname'] . ' ' . $row['firstname'], $row['current_score'], $row['max_score'])); } echo $tb->getTable(); ?> <div class="nofloat"></div> </div> </div> </div> <?php // close the tab structure $lmstab->endWidget(); ?> </div>
function connect() { require_once _base_ . '/lib/lib.userselector.php'; require_once _adm_ . '/modules/org_chart/tree.org_chart.php'; $this->directory = new UserSelector(); //$this->tree_view = $this->directory->getTreeView_OrgView(); $orgDb = new TreeDb_OrgDb($GLOBALS['prefix_fw'] . '_org_chart_tree'); $this->tree_view = new TreeView_OrgView($orgDb, 'organization_chart', Get::sett('title_organigram_chart')); $this->tree_view->aclManager =& Docebo::aclm(); list($this->tree_desc) = $this->tree_view->tdb->getDescendantsSTFromST(array($this->tree)); require_once $GLOBALS['where_framework'] . '/lib/lib.field.php'; // load language for fields names $lang_dir = DoceboLanguage::createInstance('admin_directory', 'framework'); $fl = new FieldList(); $fl->setGroupFieldsTable($GLOBALS['prefix_fw'] . ORGCHAR_FIELDTABLE); $arr_fields = $fl->getAllFields(); $this->cols_descriptor = NULL; if ($this->dbconn === NULL) { $this->dbconn = $GLOBALS['dbConn']; } $table_fields = array(array('Field' => 'idOrg', 'Type' => 'text'), array('Field' => 'idParent', 'Type' => 'text'), array('Field' => 'path', 'Type' => 'text'), array('Field' => 'level', 'Type' => 'text')); $this->cols_descriptor = array(); foreach ($table_fields as $field_info) { if (!in_array($field_info['Field'], $this->ignore_cols)) { $mandatory = in_array($field_info['Field'], $this->mandatory_cols); if (isset($this->default_cols[$field_info['Field']])) { $this->cols_descriptor[] = array(DOCEBOIMPORT_COLNAME => $lang_dir->def('_DIRECTORY_FILTER_' . $field_info['Field']), DOCEBOIMPORT_COLID => $field_info['Field'], DOCEBOIMPORT_COLMANDATORY => $mandatory, DOCEBOIMPORT_DATATYPE => $field_info['Type'], DOCEBOIMPORT_DEFAULT => $this->default_cols[$field_info['Field']]); } else { $this->cols_descriptor[] = array(DOCEBOIMPORT_COLNAME => $lang_dir->def('_DIRECTORY_FILTER_' . $field_info['Field']), DOCEBOIMPORT_COLID => $field_info['Field'], DOCEBOIMPORT_COLMANDATORY => $mandatory, DOCEBOIMPORT_DATATYPE => $field_info['Type']); } } } foreach ($arr_fields as $field_id => $field_info) { if (in_array($field_info[FIELD_INFO_TYPE], $this->valid_filed_type)) { $this->cols_descriptor[] = array(DOCEBOIMPORT_COLNAME => $field_info[FIELD_INFO_TRANSLATION], DOCEBOIMPORT_COLID => $field_id, DOCEBOIMPORT_COLMANDATORY => FALSE, DOCEBOIMPORT_DATATYPE => 'text'); } } $this->tree_view->tdb->setFolderLang($this->default_lang); $arr_foldersid = $this->tree_view->tdb->getFoldersIdFromIdst(array($this->tree)); $folderid = $arr_foldersid[$this->tree]; $root_folder = $this->tree_view->tdb->getFolderById($folderid); $arr_id = $this->tree_view->tdb->getDescendantsId($root_folder); $this->arr_folders = array(); if ($arr_id !== FALSE) { $coll_folders = $this->tree_view->tdb->getFoldersCollection($arr_id); // make the new structure $curr_path = array(); while (($folder = $coll_folders->getNext()) !== FALSE) { $curr_path = array_slice($curr_path, 0, $folder->level - $root_folder->level - 1); $curr_path[] = $folder->otherValues[ORGDB_POS_TRANSLATION]; $this->arr_folders[implode('/', $curr_path)] = array('id' => $folder->id, 'inserted' => FALSE); } } return TRUE; }
function _special_field($options, $platform, $opt_link) { $lang =& DoceboLanguage::createInstance('register', $platform); // Check for error $out = ''; $error = $this->_checkField($_POST, $options, $platform, false); if ($error['error']) { $this->error = true; $out .= '<div class="reg_err_data">' . $error['msg'] . '</div>'; return $out; } // if the user had enter a code we must check if there are folder related to it and // add the folder's field $registration_code_type = Get::sett('registration_code_type', '0'); $code_is_mandatory = Get::sett('mandatory_code', 'off'); $reg_code = Get::req('reg_code', DOTY_MIXED, ''); if ($registration_code_type === 'custom') { $reg_code = 'change_by_custom_operation'; } $array_folder = false; $folder_group = false; $uma = new UsermanagementAdm(); if ($reg_code != '') { switch ($registration_code_type) { case "0": //nothin to do break; case "tree_course": //a mixed code, let's cut the tree part and go on with the tree_man $reg_code = substr(str_replace('-', '', $reg_code), 0, 10); //procced with tree_man //procced with tree_man case "tree_man": // resolving the tree_man $uma = new UsermanagementAdm(); $array_folder = $uma->getFoldersFromCode($reg_code); break; case "code_module": require_once _adm_ . '/lib/lib.code.php'; $code_manager = new CodeManager(); $valid_code = $code_manager->controlCodeValidity($reg_code); if ($valid_code == 1) { $array_folder = $code_manager->getOrgAssociateWithCode($reg_code); } break; case "tree_drop": // from the dropdown we will recive the id of the folder // then we get the oc and ocd $array_folder = $uma->getFolderGroups($reg_code); break; case "custom": //Custom code require_once _adm_ . '/lib/lib.field.php'; $field_man = new FieldList(); $id_common_filed_1 = $field_man->getFieldIdCommonFromTranslation('Filiale'); $id_common_filed_2 = $field_man->getFieldIdCommonFromTranslation('Codice Concessionario'); $query = "SELECT `translation`" . " FROM core_field_son" . " WHERE id_common_son = " . (int) $_POST['field_dropdown'][$id_common_filed_1] . " AND lang_code = '" . getLanguage() . "'"; list($filed_1_translation) = sql_fetch_row(sql_query($query)); $code_part = substr($filed_1_translation, 1, 1); $reg_code = strtoupper($code_part . '_' . $_POST['field_textfield'][$id_common_filed_2]); // resolving the tree_man $array_folder = $uma->getFoldersFromCode($reg_code); break; } } if ($array_folder !== false) { if ($folder_group === false) { $folder_group = array(); } foreach ($array_folder as $id_org_folder) { $folder_group[] = Docebo::aclm()->getGroupST('/oc_' . $id_org_folder); } } // find all the related extra field $extra_field = new FieldList(); $play_field = $extra_field->playFieldsForUser(0, isset($_POST['group_sel']) ? $_POST['group_sel'] : (isset($_POST['group_sel_implode']) ? explode(',', $_POST['group_sel_implode']) : $array_folder), false, true); if ($play_field === false) { return $this->_opt_in($options, $platform, $opt_link); } $mand_sym = '<span class="mandatory">*</span>'; $out .= '<div class="reg_note">' . $lang->def('_GROUPS_FIELDS') . '<ul class="reg_instruction">' . '<li>' . str_replace('[mandatory]', $mand_sym, $lang->def('_REG_MANDATORY')) . '</li>' . '</ul>' . '</div>'; $out .= Form::getHidden('next_step', 'next_step', 'opt_in') . Form::getHidden('register_userid', 'register[userid]', $_POST['register']['userid']) . Form::getHidden('register_email', 'register[email]', $_POST['register']['email']) . Form::getHidden('register_firstname', 'register[firstname]', $_POST['register']['firstname']) . Form::getHidden('register_lastname', 'register[lastname]', $_POST['register']['lastname']) . Form::getHidden('register_pwd', 'register[pwd]', $_POST['register']['pwd']) . Form::getHidden('register_pwd_retype', 'register[pwd_retype]', $_POST['register']['pwd_retype']) . Form::getHidden('register_privacy', 'register[privacy]', 'ok'); if (!empty($_POST['group_sel'])) { //&& !empty($_POST['group_sel_implode'])) { $out .= Form::getHidden('group_sel_implode', 'group_sel_implode', isset($_POST['group_sel']) ? implode(',', $_POST['group_sel']) : (isset($_POST['group_sel_implode']) ? $_POST['group_sel_implode'] : '')); } $out .= ($reg_code != '' ? Form::getHidden('reg_code', 'reg_code', $reg_code) : '') . $play_field . Form::getBreakRow() . Form::closeElementSpace() . Form::openButtonSpace('reg_form_button') . Form::getButton('reg_button', 'reg_button', $lang->def('_REGISTER')) . Form::closeButtonSpace(); return $out; }
public function show_usersTask() { $id_group = Get::req('id', DOTY_INT, 0); if ($id_group <= 0) { return; } $res = Get::req('res', DOTY_STRING, ''); switch ($res) { case 'ok_assignuser': $message = getResultUi(Lang::t('_OPERATION_SUCCESSFUL', 'admin_directory')); break; case 'err_assignuser': $message = getErrorUi(Lang::t('_GROUP_USERASSIGN_ERROR', 'admin_directory')); break; default: $message = ""; } $group = $this->model->getGroupInfo($id_group, true); $this->render('show_users', array('id_group' => $id_group, 'groupid' => Docebo::aclm()->relativeId($group->groupid), 'filter_text' => "", 'result_message' => $message, 'permissions' => $this->permissions)); }
function &getCourseLevelSt($id_course) { $map = array(); $levels = CourseLevel::getLevels(); // find all the group created for this menu custom for permission management foreach ($levels as $lv => $name_level) { $group_info = Docebo::aclm()->getGroup(FALSE, '/lms/course/' . $id_course . '/subscribed/' . $lv); $map[$lv] = $group_info[ACL_INFO_IDST]; } return $map; }
public function fastsubscribe() { if (!$this->permissions['subscribe_course']) { $output = array('success' => false, 'message' => $this->_getMessage("no permission")); echo $this->json->encode($output); return; } else { if (!$this->checkAdminLimit()) { $output = array('success' => false, 'message' => Lang::t('_SUBSCRIBE_LIMIT_REACHED', 'subscribe')); echo $this->json->encode($output); return; } } $id_user = Get::req('idst', DOTY_INT, 0); //user idst $userid = Get::req('userid', DOTY_STRING, ''); //user username $result = false; if (Docebo::user()->getUserLevelId() != ADMIN_GROUP_GODADMIN) { require_once _base_ . '/lib/lib.preference.php'; $adminManager = new AdminPreference(); $admin_users = $adminManager->getAdminUsers(Docebo::user()->getIdST()); $is_admin = true; } //adjust idst to subscribe if ($id_user <= 0) { $id_user = false; if ($userid != '') { $id_user = Docebo::aclm()->getUserST($userid); } } if ($id_user <= 0) { $output = array('success' => false, 'message' => $this->_getMessage("invalid user")); echo $this->json->encode($output); return; } if (isset($admin_users) && array_search($id_user, $admin_users) == false && Docebo::user()->getUserLevelId() != ADMIN_GROUP_GODADMIN) { $output = array('success' => true); echo $this->json->encode($output); } elseif ($id_user) { $level = 3; //student level $waiting = false; $result = $this->model->subscribeUser($id_user, $level, $waiting); if ($result) { require_once _lms_ . '/lib/lib.course.php'; $docebo_course = new DoceboCourse($this->id_course); $level_idst =& $docebo_course->getCourseLevel($this->model->getIdCourse()); if (count($level_idst) == 0 || $level_idst[1] == '') { $level_idst =& $docebo_course->createCourseLevel($this->id_course); } //$this->acl_man->addToGroup($level_idst[$level], $id_user); $this->_addToCourseGroup($level_idst[$level], $id_user); // Save limit preference for admin if (Docebo::user()->getUserLevelId() != ADMIN_GROUP_GODADMIN) { $admin_pref = new AdminPreference(); $pref = $admin_pref->getAdminRules(Docebo::user()->getIdSt()); if ($pref['admin_rules.limit_course_subscribe'] == 'on') { $user_pref = new UserPreferences(Docebo::user()->getIdSt()); $subscribed_count = $user_pref->getPreference('user_subscribed_count'); $user_pref->setPreference('user_subscribed_count', $subscribed_count + 1); } } //check if we have selected send alert checkbox $send_alert = Get::req('send_alert', DOTY_INT, 0) > 0; if ($send_alert) { require_once _base_ . '/lib/lib.eventmanager.php'; $uinfo = Docebo::aclm()->getUser($id_user, false); $course_info = $docebo_course->getAllInfo(); $array_subst = array('[url]' => Get::sett('url'), '[course]' => $course_info['name'], '[medium_time]' => $course_info['mediumTime'], '[firstname]' => $uinfo[ACL_INFO_FIRSTNAME], '[lastname]' => $uinfo[ACL_INFO_LASTNAME], '[username]' => Docebo::aclm()->relativeId($uinfo[ACL_INFO_USERID])); // message to user that is waiting $msg_composer = new EventMessageComposer(); $msg_composer->setSubjectLangText('email', '_NEW_USER_SUBSCRIBED_SUBJECT', false); $msg_composer->setBodyLangText('email', '_NEW_USER_SUBSCRIBED_TEXT', $array_subst); $msg_composer->setBodyLangText('sms', '_NEW_USER_SUBSCRIBED_TEXT_SMS', $array_subst); // send message to the user subscribed $users = array($id_user); createNewAlert('UserCourseInserted', 'subscribe', 'insert', '1', 'User subscribed', $users, $msg_composer, $send_alert, true); } } $output = array('success' => $result); echo $this->json->encode($output); } }
public function delCourse($id_course) { if ((int) $id_course <= 0) { return false; } require_once _lms_ . '/lib/lib.course.php'; require_once _base_ . '/lib/lib.upload.php'; $course_man = new Man_Course(); //remove course subscribed------------------------------------------ $levels =& $course_man->getCourseIdstGroupLevel($id_course); foreach ($levels as $lv => $idst) { Docebo::aclm()->deleteGroup($idst); } $alluser = getIDGroupAlluser($id_course); Docebo::aclm()->deleteGroup($alluser); $course_man->removeCourseRole($id_course); $course_man->removeCourseMenu($id_course); $query = "DELETE FROM %lms_courseuser WHERE idCourse = '" . (int) $id_course . "'"; $qres = sql_query($query); if (!$qres) { return false; } //--- remove course data --------------------------------------------------- $query_course = "SELECT imgSponsor, img_course, img_material, img_othermaterial, course_demo, course_type, has_editions\n\t\t\tFROM %lms_course\n\t\t\tWHERE idCourse = '" . (int) $id_course . "'"; $qres = sql_query($query_course); list($file_sponsor, $file_logo, $file_material, $file_othermaterial, $file_demo, $course_type, $course_edition) = sql_fetch_row($qres); require_once _base_ . '/lib/lib.upload.php'; $path = '/appLms/' . Get::sett('pathcourse'); if (substr($path, -1) != '/' && substr($path, -1) != '\\') { $path .= '/'; } sl_open_fileoperations(); if ($file_sponsor != '') { sl_unlink($path . $file_sponsor); } if ($file_logo != '') { sl_unlink($path . $file_logo); } if ($file_material != '') { sl_unlink($path . $file_material); } if ($file_othermaterial != '') { sl_unlink($path . $file_othermaterial); } if ($file_demo != '') { sl_unlink($path . $file_demo); } sl_close_fileoperations(); //if the scs exist delete course rooms if ($GLOBALS['where_scs'] !== false) { require_once _scs_ . '/lib/lib.room.php'; $re = deleteRoom(false, 'course', $id_course); } //--- delete classroom or editions ----------------------------------------- if ($course_type == 'classroom') { require_once _lms_ . '/admin/model/ClassroomAlms.php'; $classroom_model = new ClassroomAlms($id_course); $classroom = $classroom_model->classroom_man->getDateIdForCourse($id_course); foreach ($classroom as $id_date) { if (!$classroom_model->classroom_man->delDate($id_date)) { return false; } } } elseif ($course_edition == 1) { require_once _lms_ . '/admin/model/EditionAlms.php'; $edition_model = new EditionAlms($id_course); $editions = $edition_model->classroom_man->getEditionIdFromCourse($id_course); foreach ($editions as $id_edition) { if (!$edition_model->edition_man->delEdition($id_edition)) { return false; } } } //--- end classrooms or editions ------------------------------------------- //--- clear LOs ------------------------------------------------------------ require_once _lms_ . '/lib/lib.module.php'; require_once _lms_ . '/lib/lib.param.php'; require_once _lms_ . '/class.module/track.object.php'; $arr_lo_param = array(); $arr_lo_track = array(); $arr_org_access = array(); $query = "SELECT * FROM %lms_organization WHERE idCourse = " . (int) $id_course; $ores = sql_query($query); while ($obj = sql_fetch_object($ores)) { $deleted = true; if ($obj->idResource != 0 && $obj->objectType != "") { $lo = createLO($obj->objectType); $deleted = $lo->del($obj->idResource); //delete learning object } if ($deleted) { $arr_lo_track[] = $obj->idOrg; $arr_org_access[] = $obj->idOrg; //collect org access ids $arr_lo_param[] = $obj->idParam; //collect idParams ids } } //delete all organizations references for the course $query = "DELETE FROM %lms_organization WHERE idCourse = " . (int) $id_course; $res = sql_query($query); //delete LOs trackings if (!empty($arr_lo_track)) { $track_object = new Track_Object(false, 'course_lo'); $track_object->delIdTrackFromCommon($arr_lo_track); } //delete org accesses if (!empty($arr_org_access)) { $query = "DELETE FROM %lms_organization_access\n\t\t\t\tWHERE idOrgAccess IN (" . implode(",", $arr_org_access) . ")"; $res = sql_query($query); } //delete lo params if (!empty($arr_lo_param)) { $query = "DELETE FROM %lms_lo_param\n\t\t\t\tWHERE idParam IN (" . implode(",", $arr_lo_param) . ")"; } //--- end LOs -------------------------------------------------------------- //--- clear coursepath references ------------------------------------------ require_once _lms_ . '/lib/lib.coursepath.php'; $cman = new CoursePath_Manager(); $cman->deleteCourseFromCoursePaths($id_course); //--- end coursepath references -------------------------------------------- //--- clear certificates assignments --------------------------------------- require_once _lms_ . '/lib/lib.certificate.php'; $cman = new Certificate(); $cman->deleteCourseCertificateAssignments($id_course); //--- end certificates assignments ----------------------------------------- //--- clear labels --------------------------------------------------------- $lmodel = new LabelAlms(); $lmodel->clearCourseLabel($id_course); //--- end labels ----------------------------------------------------------- //--- clear advices -------------------------------------------------------- require_once _lms_ . '/lib/lib.advice.php'; $aman = new Man_Advice(); $aman->deleteAllCourseAdvices($id_course); //--- end advices ---------------------------------------------------------- //--- clear coursereports -------------------------------------------------- require_once _lms_ . '/lib/lib.coursereport.php'; $cman = new CourseReportManager(); $cman->deleteAllReports($id_course); //--- end coursereports ---------------------------------------------------- //--- clear competences ---------------------------------------------------- $cmodel = new CompetencesAdm(); $cmodel->deleteAllCourseCompetences($id_course); //--- end competences ------------------------------------------------------ //--- finally delete course from courses table ----------------------------- if (!sql_query("DELETE FROM %lms_course WHERE idCourse = '" . $id_course . "'")) { return false; } return true; }
function delete_all_notinserted() { $this->people_view->data->resetFieldFilter(); $this->people_view->data->resetCustomFilter(); $this->people_view->addFieldFilters(array(array('fieldname' => 'valid', 'value' => '1', 'field_type' => 'text'))); $this->people_view->data->addNotFilter($this->arr_idst_inserted); $idst_rs = $this->people_view->data->getAllRowsIdst(); $counter = 0; if ($idst_rs !== FALSE) { while (list($id_st) = sql_fetch_row($idst_rs)) { if ($this->canceled == '1') { Docebo::aclm()->suspendUser($id_st); } else { Docebo::aclm()->deleteUser($id_st); } $counter++; } } return $counter; }
function selSendTo() { checkPerm('view'); // [TODO] check write or mod. permissions // http://127.0.0.1:82/claudio/lms_cvs/appCore/index.php?modname=public_newsletter_admin&op=selsendto&id_send=1 if (isset($_GET["id_send"]) && $_GET["id_send"] > 0) { $id_send = $_GET["id_send"]; } else { die("Newsletter setup error."); } require_once $GLOBALS['where_lms'] . "/class.module/class.public_user_admin.php"; $mdir = new Module_Public_User_Admin(); require_once _base_ . '/lib/lib.preference.php'; $adminManager = new AdminPreference(); $admin_tree = $adminManager->getAdminTree(Docebo::user()->getIdST()); $admin_users = $acl_man->getAllUsersFromIdst($admin_tree); $mdir->setUserFilter('user', $admin_users); $mdir->setUserFilter('group', $admin_tree); $out =& $GLOBALS['page']; $out->setWorkingZone("content"); $lang =& DoceboLanguage::createInstance('admin_newsletter', 'framework'); $back_url = "index.php?modname=public_newsletter_admin&op=selsendto&id_send=" . $id_send; if (isset($_POST['okselector'])) { $arr_selection = $mdir->getSelection($_POST); $send_to_idst = array(); foreach ($arr_selection as $idstMember) { $arr = Docebo::aclm()->getGroupAllUser($idstMember); if (is_array($arr) && count($arr) > 0) { $send_to_idst = array_merge($arr, $send_to_idst); $send_to_idst = array_unique($send_to_idst); } else { $send_to_idst[] = $idstMember; } $send_to_idst = array_intersect($send_to_idst, $admin_users); } foreach ($send_to_idst as $key => $val) { $qtxt = "INSERT INTO " . $GLOBALS["prefix_fw"] . "_newsletter_sendto (id_send, idst, stime) "; $qtxt .= "VALUES ('" . (int) $id_send . "', '" . (int) $val . "', NOW())"; $q = sql_query($qtxt); } $qtxt = "SELECT language FROM " . $GLOBALS["prefix_fw"] . "_newsletter WHERE id='" . $id_send . "'"; $q = sql_query($qtxt); list($lang) = sql_fetch_row($q); if ($lang != _ANY_LANG_CODE) { $tot = count(Docebo::aclm()->getUsersIdstByLanguage($lang, $send_to_idst)); } else { $tot = count($send_to_idst); } $qtxt = "UPDATE " . $GLOBALS["prefix_fw"] . "_newsletter SET tot='" . $tot . "' WHERE id='{$id_send}'"; $q = sql_query($qtxt); $back_url = "index.php?modname=public_newsletter_admin&op=summary&tot=" . $tot . "&id_send=" . $id_send; Util::jump_to(str_replace("&", "&", $back_url)); } else { if (isset($_POST['cancelselector'])) { $info = get_send_info($id_send); $file = $info['file']; $path = '/appCore/newsletter/'; require_once _base_ . '/lib/lib.upload.php'; if ($file != '') { sl_open_fileoperations(); sl_unlink($path . $file); sl_close_fileoperations(); } Util::jump_to('index.php?modname=newsletter&op=newsletter'); } else { if (isset($_GET['load'])) { $mdir->resetSelection(array()); } $url = "index.php?modname=public_newsletter_admin&op=selsendto&id_send=" . $id_send . "&stayon=1"; $mdir->show_user_selector = TRUE; $mdir->show_group_selector = TRUE; if (Get::sett('use_org_chart') == '1') { $mdir->show_orgchart_selector = TRUE; $mdir->show_orgchart_simple_selector = TRUE; } else { $mdir->show_orgchart_selector = FALSE; } $acl_manager =& Docebo::user()->getAclManager(); if (defined("IN_LMS")) { $id_course = (int) $_SESSION['idCourse']; $arr_idstGroup = $acl_manager->getGroupsIdstFromBasePath('/lms/course/' . $id_course . '/subscribed/'); $mdir->setUserFilter('group', $arr_idstGroup); $mdir->setGroupFilter('path', '/lms/course/' . $id_course . '/group'); $mdir->show_orgchart_selector = FALSE; } // Exclude anonymous user! $mdir->setUserFilter('exclude', array($acl_manager->getAnonymousId())); $mdir->loadSelector($url, array(Lang::t('_NEWSLETTER', 'admin_newsletter'), Lang::t('_RECIPIENTS', 'admin_newsletter')), "", TRUE); } } }
<?php Get::title(array('index.php?r=alms/enrollrules/show' => Lang::t('_ENROLLRULES', 'enrollrules'), 'index.php?r=alms/enrollrules/showlog' => Lang::t('_SHOW_LOGS', 'enrollrules'), Lang::t('_DETAILS', 'enrollrules'))); ?> <div class="std_block"> <?php $tb = new Table(); $tb->addHead(array(Lang::t('_USERNAME', 'enrollrules'), Lang::t('_LASTNAME', 'enrollrules'), Lang::t('_FIRSTNAME', 'enrollrules'), Lang::t('_CODE', 'enrollrules'), Lang::t('_COURSE_NAME', 'enrollrules')), array('min-cell', '', '', 'min-cell', '')); while (list(, $obj) = each($data)) { $row = array(Docebo::aclm()->relativeId($obj->userid), $obj->lastname, $obj->firstname, $obj->code, $obj->name); $tb->addBody($row); } echo $tb->getTable(); ?> </div>
if (!empty($list)) { $tb = new Table(); $tb->addHead(array(Lang::t('_USERNAME', 'standard'), Lang::t('_FULLNAME', 'standard')), array('', '')); foreach ($list as $key => $value) { $tb->addBody(array(Docebo::aclm()->relativeId($value->name), trim($value->value1 . ' ' . $value->value2))); } $tables[] = $tb->getTable(); unset($tb); } break; case 'groups': if (!empty($list)) { $tb = new Table(); $tb->addHead(array(Lang::t('_GROUPUSER_groupid', 'organization_chart')), array('')); foreach ($list as $key => $value) { $tb->addBody(array(Docebo::aclm()->relativeId($value->name))); } $tables[] = $tb->getTable(); unset($tb); } break; case 'folders': if (!empty($list)) { $tb = new Table(); $tb->addHead(array(Lang::t('_ORGFOLDERNAME', 'storage')), array('')); foreach ($list as $key => $value) { $is_descendants = strpos($obj->value1, 'ocd') !== false; $tb->addBody(array($value->name . ($is_descendants ? " (+ " . Lang::t('_INHERIT', 'standard') . ")" : ""))); } $tables[] = $tb->getTable(); unset($tb);