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


PHP DBFactory::get方法代码示例

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


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

示例1: getLanguage

 public function getLanguage()
 {
     if (!$this->language instanceof Language && is_numeric($this->language)) {
         $this->language = DBFactory::get('languages')->get($this->language);
     }
     return $this->language;
 }
开发者ID:ben33,项目名称:framework,代码行数:7,代码来源:AdminCore.php

示例2: getAdmin

 public function getAdmin()
 {
     if (is_null($this->admin)) {
         $this->admin = DBFactory::get('admins')->get($this->getSessionParam('admin'));
     }
     return $this->admin;
 }
开发者ID:ben33,项目名称:framework,代码行数:7,代码来源:BackofficeController.php

示例3: updateAction

 public function updateAction()
 {
     if (empty($_GET['id']) || !($language = DBFactory::get($this->module)->get($_GET['id'])) instanceof Language) {
         Header::location(UrlFactory::module($this->module));
     }
     $this->valid($language, $_POST);
     $view = $this->getView('Form');
     $view->language = $language;
     $layout = $this->getLayout('Default', $view);
     $layout->addBreadcrumbsLink(new Link(Translator::get('module_languages'), UrlFactory::module($this->module)));
     $layout->addBreadcrumbsLink(new Link($language->name, UrlFactory::update($this->module, $language)));
     $layout->addBreadcrumbsLink(new Link(Translator::get('module_update')));
 }
开发者ID:ben33,项目名称:framework,代码行数:13,代码来源:LanguagesController.php

示例4: loginAction

 public function loginAction()
 {
     if (!empty($_POST)) {
         unset($_SESSION['admin']);
         $admin = DBFactory::get($this->module)->getForConnection($_POST);
         if ($admin instanceof Admin) {
             $_SESSION['admin'] = $admin->id;
             $_SESSION['last_connection'] = $admin->last_connection;
             DBFactory::get($this->module)->updateLastConnection($admin);
             $this->response->location = UrlFactory::module('home');
         }
     }
     require_once MODEL . 'Admin.php';
     $admin = new Admin();
     $view = $this->getView('Login');
     $view->admin = $admin;
     $layout = $this->getLayout('Default', $view);
     $layout->navigation = false;
     $layout->breadcrumbs = false;
     $layout->sidebar = false;
     $layout->addBodyClass('login');
 }
开发者ID:ben33,项目名称:framework,代码行数:22,代码来源:AdminsController.php

示例5: delete

 public function delete()
 {
     return DBFactory::get('translations')->delete($this);
 }
开发者ID:ben33,项目名称:framework,代码行数:4,代码来源:Translation.php

示例6: define

                }
            }
        }
    }
}
$request->langue = $response->langue = $userLangue;
define('LANGUE', $request->langue->code);
define('BASE_URL_LANGUE', BASE_URL . $request->langue->code . '/');
ini_set('default_charset', CHARSET);
setlocale(LC_TIME, $request->langue->locale . '.' . mb_strtolower(CHARSET));
if (in_array('translations', $backoModules) && file_exists(ROOT . 'traductions.inc.php')) {
    Translator::init($request->langue->code, DEFAULT_LANG);
}
require_once APPLICATION_ROOT . 'UrlFactory.php';
UrlSingleton::init(new UrlFactory(), $request->langue);
if (in_array('admins', $allowedModules) && (empty($_SESSION['admin']) || !($admin = DBFactory::get('admins')->get($_SESSION['admin'])) instanceof Admin) && $request->url != UrlFactory::module('admins', 'login') && $request->url != UrlFactory::module('admins', 'init')) {
    Header::location(UrlFactory::module('admins', 'login'));
}
try {
    if (!file_exists($file = APPLICATION_MODULES . $request->module . DS . $request->controller . '.php')) {
        throw new Error404Exception($response);
    }
    require $file;
    $controller = new $request->controller($response);
    Logger::addPhpLog($request);
    if (!method_exists($controller, $request->method)) {
        throw new Error404Exception($response);
    }
    $controller->handleRequest($request);
} catch (Error404Exception $exception) {
    require APPLICATION_MODULES . 'errors' . DS . 'ErrorsController.php';
开发者ID:ben33,项目名称:framework,代码行数:31,代码来源:index.php

示例7: generate

 private function generate()
 {
     $translations = DBFactory::get($this->module)->getAll();
     $tab = array();
     $export = array();
     $languages = DBFactory::get('languages')->getEnabled();
     $content = '<?php' . "\n";
     if (!empty($translations)) {
         foreach ($translations as $translation) {
             foreach ($languages as $language) {
                 if ($language->code == DEFAULT_LANG || !empty($traduction->get($langue))) {
                     $export[$language->code][$translation->variable] = $translation->get($language);
                 }
             }
         }
         ob_start();
         var_export($export);
         $tab = ob_get_contents();
         ob_end_clean();
     }
     $content .= '$traductions = ' . $tab . ';';
     file_put_contents(ROOT . 'traductions.inc.php', $content);
 }
开发者ID:ben33,项目名称:framework,代码行数:23,代码来源:TranslationsController.php


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