当前位置: 首页>>代码示例>>PHP>>正文


PHP DbConn::getInstance方法代码示例

本文整理汇总了PHP中DbConn::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP DbConn::getInstance方法的具体用法?PHP DbConn::getInstance怎么用?PHP DbConn::getInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DbConn的用法示例。


在下文中一共展示了DbConn::getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: init

 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;
 }
开发者ID:abhinay100,项目名称:forma_app,代码行数:9,代码来源:ProfileLmsController.php

示例2: init

 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'));
 }
开发者ID:abhinay100,项目名称:forma_app,代码行数:9,代码来源:GroupmanagementAdmController.php

示例3: getBbsInfo

 public function getBbsInfo()
 {
     $sql = "select * from bbsinfo";
     $conn = DbConn::getInstance();
     $bbsInfo = $conn->query($sql);
     return $bbsInfo;
 }
开发者ID:denson7,项目名称:phpstudy,代码行数:7,代码来源:BbsInfoModel.php

示例4: findAll

 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;
 }
开发者ID:abhinay100,项目名称:forma_app,代码行数:28,代码来源:CourseLms.php

示例5: getHotNews

 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;
 }
开发者ID:denson7,项目名称:phpstudy,代码行数:7,代码来源:NewsArticles.php

示例6: checkLogin

 public static function checkLogin($userName, $password)
 {
     $sql = "select * from manager where userName='{$userName}' and password='{$password}'";
     $conn = DbConn::getInstance();
     $userInfo = $conn->queryOne($sql);
     return $userInfo;
 }
开发者ID:denson7,项目名称:phpstudy,代码行数:7,代码来源:Manager.php

示例7: deleteAllCourseAdvices

 /**
  * @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;
 }
开发者ID:abhinay100,项目名称:forma_app,代码行数:39,代码来源:lib.advice.php

示例8: __construct

 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();
 }
开发者ID:abhinay100,项目名称:forma_app,代码行数:7,代码来源:UpdatesLms.php

示例9: getNewsTypes

 public static function getNewsTypes()
 {
     $sql = "select * from newsTypes";
     $conn = DbConn::getInstance();
     $result = $conn->queryAll($sql);
     return $result;
 }
开发者ID:Minionstim,项目名称:DayNews,代码行数:7,代码来源:NewsTypes.php

示例10: addReviews

 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;
 }
开发者ID:denson7,项目名称:phpstudy,代码行数:7,代码来源:Reviews.php

示例11: connect

 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;
 }
开发者ID:abhinay100,项目名称:forma_app,代码行数:30,代码来源:connector.doceboadmin.php

示例12: getNewsTypes

 public static function getNewsTypes()
 {
     $sql = "select * from newsTypes";
     $conn = DbConn::getInstance();
     $newsTypes = $conn->query($sql);
     return $newsTypes;
 }
开发者ID:denson7,项目名称:phpstudy,代码行数:7,代码来源:NewsTypes.php

示例13: init

 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'));
 }
开发者ID:abhinay100,项目名称:forma_app,代码行数:9,代码来源:PrivacypolicyAdmController.php

示例14: connectToDb

 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;
 }
开发者ID:abhinay100,项目名称:forma_app,代码行数:9,代码来源:Step6Controller.php

示例15: init

 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);
 }
开发者ID:abhinay100,项目名称:forma_app,代码行数:10,代码来源:MessageLmsController.php


注:本文中的DbConn::getInstance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。