Пример #1
2
 public function init()
 {
     require_once _base_ . '/lib/lib.json.php';
     $this->db = DbConn::getInstance();
     $this->model = new ProfileLms();
     $this->json = new Services_JSON();
     $this->aclManager = Docebo::user()->getAClManager();
     $this->max_dim_avatar = 150;
 }
 public function init()
 {
     parent::init();
     require_once _base_ . '/lib/lib.json.php';
     $this->db = DbConn::getInstance();
     $this->model = new GroupmanagementAdm();
     $this->json = new Services_JSON();
     $this->permissions = array('view' => checkPerm('view', true, 'groupmanagement'), 'add' => checkPerm('add', true, 'groupmanagement'), 'mod' => checkPerm('mod', true, 'groupmanagement'), 'del' => checkPerm('del', true, 'groupmanagement'), 'associate_user' => checkPerm('associate_user', true, 'groupmanagement'));
 }
Пример #3
1
 public function getBbsInfo()
 {
     $sql = "select * from bbsinfo";
     $conn = DbConn::getInstance();
     $bbsInfo = $conn->query($sql);
     return $bbsInfo;
 }
Пример #4
1
 public function findAll($conditions, $params)
 {
     $db = DbConn::getInstance();
     $query = $db->query("SELECT c.idCourse, c.course_type, c.idCategory, c.code, c.name, c.description, c.difficult, c.status AS course_status, c.course_edition, " . "\tc.max_num_subscribe, c.create_date, " . "\tc.direct_play, c.img_othermaterial, c.course_demo, c.use_logo_in_courselist, c.img_course, c.lang_code, " . "\tc.course_vote, " . "\tc.date_begin, c.date_end, c.valid_time, c.show_result, c.userStatusOp, c.auto_unsubscribe, c.unsubscribe_date_limit, " . "\tcu.status AS user_status, cu.level, cu.date_inscr, cu.date_first_access, cu.date_complete, cu.waiting" . " FROM %lms_course AS c " . " JOIN %lms_courseuser AS cu ON (c.idCourse = cu.idCourse) " . " WHERE " . $this->compileWhere($conditions, $params) . ($_SESSION['id_common_label'] > 0 ? " AND c.idCourse IN (SELECT id_course FROM %lms_label_course WHERE id_common_label = '" . $_SESSION['id_common_label'] . "')" : "") . " ORDER BY " . $this->_resolveOrder(array('cu', 'c')));
     $result = array();
     $courses = array();
     while ($data = $db->fetch_assoc($query)) {
         $data['enrolled'] = 0;
         $data['numof_waiting'] = 0;
         $data['first_lo_type'] = FALSE;
         $courses[] = $data['idCourse'];
         $result[$data['idCourse']] = $data;
     }
     if (!empty($courses)) {
         // find subscriptions
         $re_enrolled = $db->query("SELECT c.idCourse, COUNT(*) as numof_associated, SUM(waiting) as numof_waiting" . " FROM %lms_course AS c " . " JOIN %lms_courseuser AS cu ON (c.idCourse = cu.idCourse) " . " WHERE c.idCourse IN (" . implode(',', $courses) . ") " . " GROUP BY c.idCourse");
         while ($data = $db->fetch_assoc($re_enrolled)) {
             $result[$data['idCourse']]['enrolled'] = $data['numof_associated'] - $data['numof_waiting'];
             $result[$data['idCourse']]['numof_waiting'] = $data['numof_waiting'];
         }
         // find first LO type
         $re_firstlo = $db->query("SELECT o.idOrg, o.idCourse, o.objectType FROM %lms_organization AS o " . " WHERE o.objectType != '' AND o.idCourse IN (" . implode(',', $courses) . ") " . " GROUP BY o.idCourse ORDER BY o.path");
         while ($data = $db->fetch_assoc($re_firstlo)) {
             $result[$data['idCourse']]['first_lo_type'] = $data['objectType'];
         }
     }
     return $result;
 }
Пример #5
0
 public static function getHotNews()
 {
     $sql = "select * from newsArticles a inner join newsTypes b on a.typeId=b.typeId order by hints desc limit 0,6";
     $conn = DbConn::getInstance();
     $hotNews = $conn->query($sql);
     return $hotNews;
 }
Пример #6
0
 public static function checkLogin($userName, $password)
 {
     $sql = "select * from manager where userName='******' and password='******'";
     $conn = DbConn::getInstance();
     $userInfo = $conn->queryOne($sql);
     return $userInfo;
 }
Пример #7
0
 /**
  * @param int 		$id_course the id of the course to be deleted
  *
  * @return bool 	true if success false otherwise
  */
 function deleteAllCourseAdvices($id_course)
 {
     //validate input
     if ((int) $id_course <= 0) {
         return false;
     }
     $db = DbConn::getInstance();
     $db->start_transaction();
     //get all existing advices for the course
     $arr_id_advice = array();
     $query = "SELECT idAdvice FROM %lms_advice WHERE idCourse = " . (int) $id_course;
     $res = $db->query($query);
     while (list($id_advice) = $db->fetch_row($res)) {
         $arr_id_advice[] = $id_advice;
     }
     //delete all adviceusers
     if (!empty($arr_id_advice)) {
         $query = "DELETE FROM %lms_adviceuser WHERE idAdvice IN (" . implode(",", $arr_id_advice) . ")";
         $res = $db->query($query);
         if (!res) {
             $db->rollback();
             return false;
         }
     }
     //delete course advices
     $query = "DELETE FROM %lms_advice WHERE idCourse = '" . (int) $id_course . "'";
     $res = $db->query($query);
     if (!$res) {
         $db->rollback();
         return false;
     }
     $db->commit();
     return true;
 }
Пример #8
0
 public function __construct()
 {
     require_once _lms_ . '/lib/lib.date.php';
     require_once _lms_ . '/lib/lib.course.php';
     $this->id_user = Docebo::user()->getIdst();
     $this->db = DbConn::getInstance();
 }
Пример #9
0
 public static function getNewsTypes()
 {
     $sql = "select * from newsTypes";
     $conn = DbConn::getInstance();
     $result = $conn->queryAll($sql);
     return $result;
 }
Пример #10
0
 public static function addReviews($articleId, $face, $content, $userName)
 {
     $sql = "insert into reviews(articleId,face,body,userName)values({$articleId},'{$face}','{$content}','{$userName}')";
     $conn = DbConn::getInstance();
     $row = $conn->exec($sql);
     return $row;
 }
Пример #11
0
 function connect()
 {
     $this->db = DbConn::getInstance();
     $this->org_chart = array();
     // Cache org_chart group
     $query = " SELECT oc.id_dir, oc.translation, oct.idst_oc, oct.idst_ocd " . " FROM %adm_org_chart AS oc " . "\tJOIN %adm_org_chart_tree AS oct " . "\t\tON (oc.id_dir = oct.idOrg) " . " WHERE lang_code = '" . Lang::get() . "'";
     $result = $this->db->query($query);
     while ($o = $this->db->fetch_obj($result)) {
         $name_index = strtolower(trim(addslashes($o->translation)));
         $this->org_chart[$name_index] = $o;
     }
     $tmp = $this->aclm->getGroup(false, '/oc_0');
     $this->root_oc = $tmp[0];
     $tmp = $this->aclm->getGroup(false, '/ocd_0');
     $this->root_ocd = $tmp[0];
     // Cache user levels
     $this->levels = $this->aclm->getAdminLevels();
     $this->preference = new AdminPreference();
     // Cache admin profiles
     $this->m_ar = new AdminrulesAdm();
     $tmp = $this->m_ar->getGroupForDropdown();
     unset($tmp[0]);
     $this->admin_profiles = array_flip($tmp);
     // Cache public admin profiles
     $this->m_ap = new PublicadminrulesAdm();
     $tmp = $this->m_ap->getGroupForDropdown();
     unset($tmp[0]);
     $this->public_profiles = array_flip($tmp);
     return true;
 }
Пример #12
0
 public static function getNewsTypes()
 {
     $sql = "select * from newsTypes";
     $conn = DbConn::getInstance();
     $newsTypes = $conn->query($sql);
     return $newsTypes;
 }
 public function init()
 {
     parent::init();
     require_once _base_ . '/lib/lib.json.php';
     $this->db = DbConn::getInstance();
     $this->model = new PrivacypolicyAdm();
     $this->json = new Services_JSON();
     $this->permissions = array('view' => checkPerm('view', true, 'privacypolicy'), 'add' => checkPerm('mod', true, 'privacypolicy'), 'mod' => checkPerm('mod', true, 'privacypolicy'), 'del' => checkPerm('del', true, 'privacypolicy'));
 }
Пример #14
0
 function connectToDb()
 {
     require_once _base_ . '/config.php';
     require_once _base_ . '/db/lib.docebodb.php';
     //		$db = mysql_connect($cfg['db_host'], $cfg['db_user'], $cfg['db_pass']);
     //		mysql_select_db($cfg['db_name']);
     $db =& DbConn::getInstance();
     return $db;
 }
Пример #15
0
 public function init()
 {
     require_once _base_ . '/lib/lib.json.php';
     $this->db = DbConn::getInstance();
     $this->model = new MessageLms();
     $this->json = new Services_JSON();
     $this->aclManager = Docebo::user()->getAClManager();
     $this->can_send = true;
     //checkPerm('send_all', true) || checkPerm('send_upper', true);
 }
Пример #16
0
/**
 * Return the ID of a custom menu searcing by a given menu name
 * @param string $name
 * @return integer 
 */
function getCustomMenuIdByName($name)
{
    $res = false;
    $query = "\r\n\t\tSELECT idCustom \r\n\t\tFROM %lms_menucustom\r\n\t\tWHERE title='" . $name . "' LIMIT 0,1";
    $re_custom = DbConn::getInstance()->query($query);
    if ($re_custom && DbConn::getInstance()->num_rows($re_custom)) {
        list($res) = DbConn::getInstance()->fetch_row($re_custom);
    }
    return $res;
}
 function Report_Aggregate()
 {
     $this->db = DbConn::getInstance();
     $this->lang =& DoceboLanguage::createInstance('report', 'framework');
     $this->_set_columns_category(_RA_CATEGORY_COURSES, Lang::t('_RU_CAT_COURSES', 'report'), 'get_courses_filter', 'show_report_courses', '_get_courses_query');
     $this->_set_columns_category(_RA_CATEGORY_COURSECATS, Lang::t('_RA_CAT_COURSECATS', 'report'), 'get_coursecategories_filter', 'show_report_coursecategories', '_get_coursecategories_query');
     $this->_set_columns_category(_RA_CATEGORY_TIME, Lang::t('_RA_CAT_TIME', 'report'), 'get_time_filter', 'show_report_time', '_get_time_query');
     $this->_set_columns_category(_RA_CATEGORY_COMMUNICATIONS, Lang::t('_RU_CAT_COMMUNICATIONS', 'report'), 'get_communications_filter', 'show_report_communications', '_get_communications_query');
     $this->_set_columns_category(_RA_CATEGORY_GAMES, Lang::t('_RU_CAT_GAMES', 'report'), 'get_games_filter', 'show_report_games', '_get_games_query');
 }
Пример #18
0
 /**
  * function learning_Object()
  * class constructor
  **/
 function Learning_Object($id = NULL, $environment = false)
 {
     $this->id = $id;
     $this->environment = $environment ? $environment : 'course_lo';
     $this->idAuthor = '';
     $this->title = '';
     $this->db = DbConn::getInstance();
     $this->aclManager = Docebo::user()->getAclManager();
     $this->table = '';
 }
Пример #19
0
 public function __construct($id_course = 0, $id_date = 0)
 {
     require_once _lms_ . '/lib/lib.date.php';
     require_once _lms_ . '/lib/lib.course.php';
     $this->id_course = $id_course;
     $this->id_date = $id_date;
     $this->db = DbConn::getInstance();
     $this->classroom_man = new DateManager();
     $this->course_man = new Man_Course();
     $this->acl_man =& Docebo::user()->getAclManager();
 }
Пример #20
0
 function Report($id_report, $report_name = false)
 {
     $this->id_report = $id_report;
     if ($report_name == false) {
         $this->_load();
     } else {
         $lang =& DoceboLanguage::createInstance('report', 'framework');
         $this->report_name = $lang->def($report_name);
         $this->report_descr = $lang->def($report_name);
     }
     $this->db = DbConn::getInstance();
 }
Пример #21
0
 public function __construct()
 {
     require_once _lms_ . '/lib/lib.subscribe.php';
     require_once _lms_ . '/lib/lib.course.php';
     $this->db = DbConn::getInstance();
     $this->edition_table = $GLOBALS['prefix_lms'] . '_course_editions';
     $this->edition_user = $GLOBALS['prefix_lms'] . '_course_editions_user';
     $this->course_table = $GLOBALS['prefix_lms'] . '_course';
     $this->courseuser_table = $GLOBALS['prefix_lms'] . '_courseuser';
     $this->user_table = $GLOBALS['prefix_fw'] . '_user';
     $this->acl_man = $acl_man =& Docebo::user()->getAclManager();
     $this->subscribe_man = new CourseSubscribe_Manager();
     $this->status_list = array(CST_PREPARATION => Lang::t('_CST_PREPARATION', 'course'), CST_AVAILABLE => Lang::t('_CST_AVAILABLE', 'course'), CST_EFFECTIVE => Lang::t('_CST_CONFIRMED', 'course'), CST_CONCLUDED => Lang::t('_CST_CONCLUDED', 'course'), CST_CANCELLED => Lang::t('_CST_CANCELLED', 'course'));
 }
Пример #22
0
 /**
  * Return the menu for the pre-login pages
  * @return <string>
  */
 public static function external_page()
 {
     $db = DbConn::getInstance();
     $query = "\r\n\t\tSELECT idPages, title\r\n\t\tFROM %lms_webpages\r\n\t\tWHERE publish = '1' AND in_home='0' AND language = '" . getLanguage() . "'\r\n\t\tORDER BY sequence ";
     $result = $db->query($query);
     $numof = $db->num_rows($result);
     $numof--;
     $li = '';
     $ul = '<ul id="main_menu">';
     $i = 0;
     while (list($id_pages, $title) = sql_fetch_row($result)) {
         $li .= '<li' . ($i == $numof ? ' class="last"' : '') . '><a href="index.php?modname=login&amp;op=readwebpages&amp;idPages=' . $id_pages . '">' . $title . '</a></li>';
         $i++;
     }
     return $li != '' ? $ul . $li . '</ul>' : '';
 }
 public function init()
 {
     checkPerm('subscribe', false, 'pcourse', 'lms');
     require_once _base_ . '/lib/lib.json.php';
     //Course info
     $this->id_course = Get::req('id_course', DOTY_INT, 0);
     $this->id_edition = Get::req('id_edition', DOTY_INT, 0);
     $this->id_date = Get::req('id_date', DOTY_INT, 0);
     $this->model = new SubscriptionAlms($this->id_course, $this->id_edition, $this->id_date);
     $this->json = new Services_JSON();
     $this->acl_man = Docebo::user()->getAclManager();
     $this->db = DbConn::getInstance();
     $this->permissions = array('subscribe_course' => checkPerm('subscribe', true, 'pcourse', 'lms'), 'subscribe_coursepath' => false, 'moderate' => checkPerm('moderate', true, 'pcourse'));
     $this->link = 'lms/psubscription';
     $this->link_course = 'lms/pcourse';
     $this->link_edition = 'lms/pedition';
     $this->link_classroom = 'lms/pclassroom';
     $this->_mvc_name = 'subscription';
     $this->checkAdminLimit();
 }
Пример #24
0
 public function findAll($conditions, $params)
 {
     $db = DbConn::getInstance();
     $query = $db->query("SELECT c.idCourse, c.course_type, c.idCategory, c.code, c.name, c.description, c.difficult, c.status AS course_status, c.course_edition, " . "\tc.max_num_subscribe, c.create_date, " . "\tc.direct_play, c.img_othermaterial, c.course_demo, c.use_logo_in_courselist, c.img_course, c.lang_code, " . "\tc.course_vote, " . "\tc.date_begin, c.date_end, c.valid_time, c.show_result, c.userStatusOp," . "\tcu.status AS user_status, cu.level, cu.date_inscr, cu.date_first_access, cu.date_complete, cu.waiting" . " FROM %lms_course AS c " . " JOIN %lms_courseuser AS cu ON (c.idCourse = cu.idCourse) " . " JOIN %lms_assessment_user AS a ON (a.id_assessment = c.idCourse AND a.id_user = cu.idUser)" . " WHERE " . $this->compileWhere($conditions, $params) . (!isset($conditions['cu.status']) ? '' : " AND cu.status IN (" . _CUS_SUBSCRIBED . ", " . _CUS_BEGIN . ")") . " ORDER BY " . $this->_resolveOrder(array('cu', 'c')));
     $result = array();
     $courses = array();
     while ($data = $db->fetch_assoc($query)) {
         $data['enrolled'] = 0;
         $data['waiting'] = 0;
         $courses[] = $data['idCourse'];
         $result[$data['idCourse']] = $data;
     }
     // find subscriptions
     $re_enrolled = $db->query("SELECT c.idCourse, COUNT(*) as numof_associated, SUM(waiting) as numof_waiting" . " FROM %lms_course AS c " . " JOIN %lms_courseuser AS cu ON (c.idCourse = cu.idCourse) " . " WHERE c.idCourse IN (" . implode(',', $courses) . ") " . " GROUP BY c.idCourse");
     while ($data = $db->fetch_assoc($re_enrolled)) {
         $result[$data['idCourse']]['enrolled'] = $data['numof_associated'] - $data['numof_waiting'];
         $result[$data['idCourse']]['waiting'] = $data['numof_waiting'];
     }
     return $result;
 }
Пример #25
0
 /**
  * Return a idTrack for this object, internal or external
  * @param <int> $id_reference
  * @param <int> $id_user
  * @param <int> $id_resource
  * @param <bool> $createOnFail create a new entry if not found
  */
 public function getIdTrack($id_reference, $id_user, $id_resource, $createOnFail = FALSE)
 {
     $db = DbConn::getInstance();
     $query = "SELECT idTrack " . "FROM %lms_materials_track " . "WHERE idReference = " . (int) $id_reference . " " . "   AND idUser = "******" " . "   AND idResource = " . (int) $id_resource . " ";
     $rs = $db->query($query);
     if ($db->num_rows($rs) > 0) {
         list($idTrack) = $db->fetch_row($rs);
         return array(TRUE, $idTrack);
     } else {
         if ($createOnFail) {
             $query = "INSERT INTO %lms_materials_track " . "( idResource, idReference, idUser ) VALUES " . "( " . (int) $id_resource . ", " . (int) $id_reference . " , " . (int) $id_user . " ) ";
             if (!$db->query($query)) {
                 return false;
             }
             $idTrack = $db->insert_id();
             return array(FALSE, $idTrack);
         }
     }
     return FALSE;
 }
Пример #26
0
 /**
  * create a DoceboACLUtil for given user
  * and load all ST stored in session
  **/
 public function __construct($userid, $sprefix = 'public_area')
 {
     $this->userid = $userid;
     $this->sprefix = $sprefix;
     $this->db = DbConn::getInstance();
     $this->acl = new DoceboACL();
     $this->aclManager =& $this->acl->getACLManager();
     if (isset($_SESSION[$sprefix . '_idst'])) {
         $this->idst = $_SESSION[$sprefix . '_idst'];
     } else {
         $this->idst = $this->acl->getUserST($userid);
     }
     if (isset($_SESSION[$sprefix . '_stlist'])) {
         require_once _base_ . '/lib/lib.json.php';
         $json = new Services_JSON();
         $this->arrst = $json->decode($_SESSION[$sprefix . '_stlist']);
     }
     $this->preference = new UserPreferences($this->idst);
     $this->load_user_role();
     $aclManager =& $this->acl->getACLManager();
     $arr_levels_id = array_flip($aclManager->getAdminLevels());
     $arr_levels_idst = array_keys($arr_levels_id);
     $level_st = array_intersect($arr_levels_idst, $this->arrst);
     if (count($level_st) == 0) {
         $this->user_level = false;
     }
     $lvl = current($level_st);
     $query = "SELECT idst FROM %adm_group_members WHERE idstMember=" . (int) $this->idst . " AND idst IN (" . implode(",", $arr_levels_idst) . ")";
     $res = $this->db->query($query);
     if ($res && $this->db->num_rows($res) > 0) {
         list($lvl) = $this->db->fetch_row($res);
     }
     if (isset($arr_levels_id[$lvl])) {
         $this->user_level = $arr_levels_id[$lvl];
     } else {
         $this->user_level = array_search(ADMIN_GROUP_USER, $arr_levels_id);
     }
 }
Пример #27
0
 public function __construct()
 {
     $this->db = DbConn::getInstance();
 }
Пример #28
0
 public function disconnectAccount($network, $user_idst = false)
 {
     $res = false;
     $user_idst = $user_idst > 0 ? $user_idst : getLogUserId();
     switch ($network) {
         case "facebook":
             $field = 'facebook_id';
             break;
         case "twitter":
             $field = 'twitter_id';
             break;
         case "linkedin":
             $field = 'linkedin_id';
             break;
         case "google":
             $field = 'google_id';
             break;
     }
     if (!empty($field)) {
         $db = DbConn::getInstance();
         $qtxt = "UPDATE %adm_user SET " . $field . " = NULL WHERE idst=" . $user_idst . " LIMIT 1";
         $res = $db->query($qtxt);
     }
     return $res;
 }
Пример #29
0
 public function __construct()
 {
     $this->db = DbConn::getInstance();
     $this->error = false;
     $this->pmodel = new PrivacypolicyAdm();
 }
Пример #30
0
 public function __construct($id_course = 0, $id_date = 0)
 {
     $this->db = DbConn::getInstance();
 }