當前位置: 首頁>>代碼示例>>PHP>>正文


PHP DatabaseFactory::getFactory方法代碼示例

本文整理匯總了PHP中DatabaseFactory::getFactory方法的典型用法代碼示例。如果您正苦於以下問題:PHP DatabaseFactory::getFactory方法的具體用法?PHP DatabaseFactory::getFactory怎麽用?PHP DatabaseFactory::getFactory使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在DatabaseFactory的用法示例。


在下文中一共展示了DatabaseFactory::getFactory方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: selectgen

 public static function selectgen($name, $label, $table, $required = null, $selected = null)
 {
     if ($required != null) {
         $required = 'required';
     }
     $s = '';
     $s .= '<div class="form-group">
         <label>' . $label . '</label>
         <select class="form-control" name="' . $name . '" required >';
     $s .= '<option value=""    > Select </option>';
     $pdo = DatabaseFactory::getFactory()->getConnection();
     $sql = "SELECT id, name FROM  " . $table;
     $query = $pdo->prepare($sql);
     $query->execute();
     $options = $query->fetchAll();
     foreach ($options as $k => $v) {
         $s .= '<option value="' . $v->id . '" ';
         if ($v->id == $selected) {
             $s .= ' selected ';
         }
         $s .= '    >' . $v->name . '</option>';
     }
     $s .= '</select>
     </div>';
     return $s;
 }
開發者ID:bribrink,項目名稱:crudkiller,代碼行數:26,代碼來源:Fields.php

示例2: get

 public static function get($key)
 {
     $database = DatabaseFactory::getFactory()->getConnection();
     $query = $database->prepare("SELECT `value` FROM `settings` WHERE `setting` = :key LIMIT 1");
     $query->execute(array(':key' => $key));
     $fetched = json_decode(json_encode($query->fetch(PDO::FETCH_ASSOC)), true);
     return $fetched['value'];
 }
開發者ID:BuzzyOG,項目名稱:PC-Track,代碼行數:8,代碼來源:Config.php

示例3: getCardsInSet

 public static function getCardsInSet($setcode)
 {
     $database = DatabaseFactory::getFactory()->getConnection();
     $sql = "SELECT name, setcode, multiverseid, id FROM cards WHERE setcode = '{$setcode}' LIMIT 20";
     $query = $database->prepare($sql);
     $query->execute();
     return $query->fetchAll();
 }
開發者ID:vradinolfi,項目名稱:Transmute-v5,代碼行數:8,代碼來源:SetModel.php

示例4: log

 /**
  * create a new log entry
  * @param $user_id , add user_id to log
  * @param string $action , create-comment-close-undo
  * @param string $param , addtional parameters that can be stored. (JSON)
  * @return bool feedback
  */
 public static function log($user_id, $action, $param)
 {
     $db = DatabaseFactory::getFactory()->fluentPDO();
     $values = array('ENTRY_ID' => time(), 'action' => $action, 'user_id' => $user_id, 'param' => json_encode($param));
     $query = $db->insertInto('log', $values);
     $query->execute();
     return true;
 }
開發者ID:queer1,項目名稱:PC-Track,代碼行數:15,代碼來源:LogModel.php

示例5: load

 public function load($area, $subject, $longBR, $latBR, $longTL, $latTL)
 {
     $geodatabase = DatabaseFactory::getFactory()->getGeoConnection();
     $table_name = $area . "_" . $subject;
     /*
     if ($area == "city") 
         { 
            $table_name = $subject;
            
         }
     if ($area == "county") 
         { 
            $table_name = "oc_" . $subject;
            
         }
     */
     $collection = $geodatabase->{$table_name};
     /*
         if(!empty($latTL) && !empty($longTL) && !empty($latBR) && !empty($longBR)){
     
            //$query = GeoQuery::findbybox(-117.91733264923096,33.676568503347546,-117.90239810943604,33.68606772497501);
           $query = GeoQuery::findbybox($longBR,  $latBR,  $longTL, $latTL);
           $count_ = $collection->count($query);
         }
        else {
            // in case of not box coordinate provide, will find all record
            $query=null;
            $count_ = $collection->count();
        }
     */
     $query = GeoQuery::findbybox($longBR, $latBR, $longTL, $latTL);
     $count_ = $collection->count($query);
     // $count_ = $collection->getSize();
     $_max_row_count = Config::get('Max_Row_Count');
     if ($count_ > 0 and $count_ < $_max_row_count) {
         if (!empty($latTL) && !empty($longTL) && !empty($latBR) && !empty($longBR)) {
             $cursor = $collection->find($query);
         } else {
             $cursor = $collection->find();
         }
         // iterate through the results
         $result = "{ \"type\": \"FeatureCollection\",\"features\": [";
         foreach ($cursor as $document) {
             //echo $document["properties"] . "\n";
             //print_r($document);
             //echo json_encode($document);
             $result = $result . json_encode($document) . ",";
         }
         $result = substr($result, 0, -1);
         $result = $result . "]}";
         echo $result;
     } else {
         echo $count_;
     }
     //else
 }
開發者ID:hoogw,項目名稱:civilgis_php_1,代碼行數:56,代碼來源:DB_PostgisController.php

示例6: resetUserSession

 /**
  * Kicks the selected user out of the system instantly by resetting the user's session.
  * This means, the user will be "logged out".
  *
  * @param $userId
  * @return bool
  */
 private static function resetUserSession($userId)
 {
     $database = DatabaseFactory::getFactory()->getConnection();
     $query = $database->prepare("UPDATE users SET session_id = :session_id  WHERE user_id = :user_id LIMIT 1");
     $query->execute(array(':session_id' => null, ':user_id' => $userId));
     if ($query->rowCount() == 1) {
         Session::add('feedback_positive', Text::get('FEEDBACK_ACCOUNT_USER_SUCCESSFULLY_KICKED'));
         return true;
     }
 }
開發者ID:evdevgit,項目名稱:huge,代碼行數:17,代碼來源:AdminModel.php

示例7: getItemInventory

 public static function getItemInventory($productname)
 {
     $database = DatabaseFactory::getFactory()->getConnection();
     $sql = "SELECT * FROM products WHERE product_name LIKE '%{$productname}%'";
     $sql .= " ORDER BY product_price DESC";
     $sql .= " LIMIT 20";
     $query = $database->prepare($sql);
     $query->execute(array(':item' => $item));
     return $query->fetchAll();
 }
開發者ID:vradinolfi,項目名稱:Transmute-v5,代碼行數:10,代碼來源:SearchModel.php

示例8: removePerm

 /**
  * @param $user_id
  * @param $removed_perm
  */
 public static function removePerm($user_id, $removed_perm)
 {
     $original = UserRoleModel::getPerms($user_id);
     $being_removed = array_search($removed_perm, $original);
     unset($original[$being_removed]);
     $database = DatabaseFactory::getFactory()->getConnection();
     $sql = "UPDATE users SET perms = :new WHERE user_id = :user_id";
     $query = $database->prepare($sql);
     $query->execute(array(':new' => json_encode($original), ':user_id' => $user_id));
 }
開發者ID:BuzzyOG,項目名稱:PC-Track,代碼行數:14,代碼來源:UserRoleModel.php

示例9: set

 /**
  * Set a Config option in the Database
  * @param $key
  * @param $setting
  */
 public static function set($key, $setting)
 {
     if (Cache::has($key)) {
         Cache::forget($key);
     }
     if (self::$setQuery === null) {
         self::$setQuery = DatabaseFactory::getFactory()->getConnection()->prepare("UPDATE settings SET `value` = :setting WHERE `key` = :key");
     }
     self::$setQuery->execute(array(':key' => $key, ':setting' => $setting));
 }
開發者ID:queer1,項目名稱:PC-Track,代碼行數:15,代碼來源:Config.php

示例10: removePerm

 /**
  * Remove A user permission
  * @param $user_id
  * @param $removed_perm
  */
 public static function removePerm($user_id, $removed_perm)
 {
     if (self::$removePermQuery === null) {
         self::$removePermQuery = DatabaseFactory::getFactory()->getConnection()->prepare("UPDATE users SET perms = :new WHERE user_id = :user_id");
     }
     $original = UserRoleModel::getPerms($user_id);
     $being_removed = array_search($removed_perm, $original);
     unset($original[$being_removed]);
     self::$removePermQuery->execute(array(':new' => json_encode($original), ':user_id' => $user_id));
     Session::add('feedback_positive', 'Removed that permission!');
 }
開發者ID:queer1,項目名稱:PC-Track,代碼行數:16,代碼來源:UserRoleModel.php

示例11: setRequestDetails

 /**
  * @function setRequestDetails
  * @public
  * @static
  * @returns NONE
  * @desc
  * @param {string} foo Use the 'foo' param for bar.
  * @example NONE
  */
 public static function setRequestDetails($recordID, $tableNo, $subj, $subSubj, $tutName)
 {
     $database = DatabaseFactory::getFactory()->getConnection();
     // to do = update according to the settings needed given func's params/args.
     $query = $database->prepare("UPDATE users SET user_deleted = :user_deleted  WHERE user_id = :user_id LIMIT 1");
     $query->execute(array(':user_deleted' => $delete, ':user_id' => $userId));
     // to do = determine if needed below if-statement
     if ($query->rowCount() == 1) {
         Session::add('feedback_positive', Text::get('FEEDBACK_ACCOUNT_SUSPENSION_DELETION_STATUS'));
         return true;
     }
 }
開發者ID:NRWB,項目名稱:TutorQueue,代碼行數:21,代碼來源:GreeterModel.php

示例12: getUserLanguage

 /**
  * Get the user language (if they are logged in)
  * @param null $userID
  * @return mixed|null
  */
 public static function getUserLanguage($userID = null)
 {
     if ($userID === null) {
         return null;
     } else {
         if (self::$userLangQuery === null) {
             self::$userLangQuery = DatabaseFactory::getFactory()->getConnection()->prepare('SELECT user_lang FROM users WHERE user_id = :user_id');
         }
         self::$userLangQuery->execute(array('user_id' => Session::get('user_id')));
         return self::$userLangQuery->fetch();
     }
 }
開發者ID:queer1,項目名稱:PC-Track,代碼行數:17,代碼來源:Language.php

示例13: unlock

 public static function unlock()
 {
     $db = DatabaseFactory::getFactory()->fluentPDO();
     $values = array('user_id' => Session::get('user_id'), 'user_name' => Session::get('user_name'));
     $query = $db->from('user_lock')->where($values);
     $query->execute();
     $result = $query->fetch();
     Session::set('locked', false);
     // dirty manner to turn stdclass to array
     $refer = json_decode(json_encode($result), true);
     $db->deleteFrom('user_lock', Session::get('user_id'));
     // needs to be fixed. currently it can make it end up at: http://HOST.COM/inventory/http://HOST.COM/inventory/login/showProfile
     Redirect::to($refer['refer_page']);
 }
開發者ID:queer1,項目名稱:PC-Track,代碼行數:14,代碼來源:LockModel.php

示例14: confirmTutorCode

 /**
  * @function confirmTutorCode
  * @public
  * @static
  * @returns {boolean} True if successful.
  * @desc Created to look up a tutors input code, to see if the input number is a valid tutor code for accessing the tutor view. Logs in as a tutor if the code found is a success.
  * @param NONE
  * @example NONE
  */
 public static function confirmTutorCode()
 {
     $database = DatabaseFactory::getFactory()->getConnection();
     $tut_code = Request::post('input_tutor_text_code');
     //    $query = $database->prepare("SELECT * FROM qscTutorList.tblAllTutors WHERE tutcode = :the_tutor_code LIMIT 1");
     $query = $database->prepare("SELECT * FROM qscTutorList.tblAllTutors WHERE tutCode = :the_tutor_code LIMIT 1");
     $query->execute(array(':the_tutor_code' => $tut_code));
     if ($query->rowCount() == 1) {
         Session::set('tmp_tutor_code', $tut_code);
         return true;
     } else {
         return false;
     }
 }
開發者ID:NRWB,項目名稱:TutorQueue,代碼行數:23,代碼來源:TutorModel.php

示例15: saveRoleToDatabase

 /**
  * Writes the new account type marker to the database and to the session
  *
  * @param $type
  *
  * @return bool
  */
 public static function saveRoleToDatabase($type)
 {
     // if $type is not 1 or 2
     if (!in_array($type, [1, 2])) {
         return false;
     }
     $database = DatabaseFactory::getFactory()->getConnection();
     $query = $database->prepare("UPDATE users SET user_account_type = :new_type WHERE user_id = :user_id LIMIT 1");
     $query->execute(array(':new_type' => $type, ':user_id' => Session::get('user_id')));
     if ($query->rowCount() == 1) {
         // set account type in session
         Session::set('user_account_type', $type);
         return true;
     }
     return false;
 }
開發者ID:panique,項目名稱:huge,代碼行數:23,代碼來源:UserRoleModel.php


注:本文中的DatabaseFactory::getFactory方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。