当前位置: 首页>>代码示例>>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;未经允许,请勿转载。