當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。