コード例 #1
0
ファイル: query.php プロジェクト: rlm80/Archive--glue-orm
 public function __construct($entity_name, &$set)
 {
     $entity = glue::entity($entity_name);
     $this->root = new Glue_Command_Load($entity);
     $set = $this->create_set($entity, $this->root);
     // Switch active command to current command :
     $this->active_command = $this->root;
 }
コード例 #2
0
ファイル: glue.php プロジェクト: rlm80/Archive--glue-orm
 public function action_relationship($entity, $relationship)
 {
     if (Kohana::config('glue')->debug) {
         $this->request->response = View::factory('glue_template')->set('title', ucfirst($entity) . '->' . $relationship . ' relationship')->set('content', glue::relationship($entity, $relationship)->debug());
     } else {
         $this->request->status = 404;
     }
 }
コード例 #3
0
ファイル: entity.php プロジェクト: rlm80/Archive--glue-orm
 public function proxy_load_relationship($object, $relationship)
 {
     // Build query :
     $query = glue::qselect($this->name, $set);
     foreach ($this->object_pk($object) as $f => $val) {
         $query->where($f, '=', $val);
         $query->fields($f);
     }
     $query->with($set, Inflector::singular($relationship));
     // Execute query :
     $query->execute();
 }
コード例 #4
0
ファイル: index.php プロジェクト: nsystem1/ZeeJong
require_once dirname(__FILE__) . '/core/controller/AdminUsers.php';
require_once dirname(__FILE__) . '/core/controller/Search.php';
require_once dirname(__FILE__) . '/core/controller/AdminUpdateBets.php';
require_once dirname(__FILE__) . '/core/controller/AdminAddMatch.php';
//Create database
try {
    $database = new Database();
} catch (exception $e) {
    echo '<h2>Database Error</h2>';
    die;
}
$urls = array('ERROR' => 'Controller\\Error', INSTALL_DIR . 'player/(\\d+)' => 'Controller\\Player', INSTALL_DIR . 'register' => 'Controller\\Register', INSTALL_DIR => 'Controller\\Home', INSTALL_DIR . 'login/?(\\?.*)?' => 'Controller\\Login', INSTALL_DIR . 'coach/(\\d+)' => 'Controller\\Coach', INSTALL_DIR . 'team/(\\d+)' => 'Controller\\Team', INSTALL_DIR . 'competition/(\\d+)' => 'Controller\\Competition', INSTALL_DIR . 'match/(\\d+)' => 'Controller\\Match', INSTALL_DIR . 'referee/(\\d+)' => 'Controller\\Referee', INSTALL_DIR . 'tournament/(\\d+)' => 'Controller\\Tournament', INSTALL_DIR . 'news' => 'Controller\\News', INSTALL_DIR . 'config-panel' => 'Controller\\UserConfigPanel', INSTALL_DIR . 'bets' => 'Controller\\Bets', INSTALL_DIR . 'place-bet/(\\d+)' => 'Controller\\placeBet', INSTALL_DIR . 'events' => 'Controller\\Events', INSTALL_DIR . 'player(\\?.*)?' => 'Controller\\TopPlayers', INSTALL_DIR . 'create-group' => 'Controller\\CreateGroup', INSTALL_DIR . 'country/(\\d+)' => 'Controller\\Country', INSTALL_DIR . 'group/(\\S+)' => 'Controller\\Group', INSTALL_DIR . 'invite-user' => 'Controller\\InviteUser', INSTALL_DIR . 'invites' => 'Controller\\Invites', INSTALL_DIR . 'page/(\\d+)' => 'Controller\\Page', INSTALL_DIR . 'page/(\\d+)/edit' => 'Controller\\PageEdit', INSTALL_DIR . 'admin' => 'Controller\\Admin', INSTALL_DIR . 'admin/dashboard' => 'Controller\\AdminDashboard', INSTALL_DIR . 'admin/matches' => 'Controller\\AdminMatches', INSTALL_DIR . 'admin/match/(\\d+)/(\\S+)' => 'Controller\\AdminMatch', INSTALL_DIR . 'admin/match/(\\d+)/(\\S+)/(\\d+)' => 'Controller\\AdminMatch', INSTALL_DIR . 'admin/match/add' => 'Controller\\AdminAddMatch', INSTALL_DIR . 'admin/pages' => 'Controller\\AdminPages', INSTALL_DIR . 'admin/pages/analytics' => 'Controller\\AdminPages', INSTALL_DIR . 'admin/pages/delete/(\\d+)' => 'Controller\\AdminPages', INSTALL_DIR . 'admin/users' => 'Controller\\AdminUsers', INSTALL_DIR . 'search' => 'Controller\\Search', INSTALL_DIR . 'admin/update-bets' => 'Controller\\AdminUpdateBets');
//The controller manages everything
//and handles all possible database errors
try {
    $controller = glue::stick($urls);
} catch (exception $e) {
    $controller = new \Controller\Error();
}
//Load the header controller
try {
    //Make navigator controller
    $navigator = new Controller\Navigator();
    //Make header controller
    $header = new \Controller\Header();
    //Include the header template
    include dirname(__FILE__) . '/theme/header.php';
    //Include the theme part
    $controller->template();
    //Include the footer template
    include dirname(__FILE__) . '/theme/footer.php';
コード例 #5
0
ファイル: index.php プロジェクト: aleguisf/fvdev1
<?php

if (!headers_sent()) {
    header('Content-Type: text/html; charset=UTF-8');
}
require_once __DIR__ . '/../../../autoload.php';
if (file_exists(__DIR__ . '/../sandbox/c3.php')) {
    require __DIR__ . '/../sandbox/c3.php';
} else {
    require __DIR__ . '/../claypit/c3.php';
}
require_once 'glue.php';
require_once 'data.php';
require_once 'controllers.php';
$urls = array('/' => 'index', '/info' => 'info', '/cookies' => 'cookies', '/cookies2' => 'cookiesHeader', '/search.*' => 'search', '/login' => 'login', '/redirect' => 'redirect', '/redirect2' => 'redirect2', '/redirect3' => 'redirect3', '/redirect4' => 'redirect4', '/facebook\\??.*' => 'facebookController', '/form/(.*?)(#|\\?.*?)?' => 'form', '/articles\\??.*' => 'articles', '/auth' => 'httpAuth');
glue::stick($urls);
コード例 #6
0
 protected function default_type()
 {
     // Guess src and trg cardinality from pk :
     $src_multiple = false;
     $trg_multiple = false;
     foreach ($this->joins as $trg_entity => $arr1) {
         foreach ($arr1 as $src_entity => $arr2) {
             // Check trg cardinality :
             if (!$trg_multiple) {
                 $fields = array_keys($arr2);
                 $pk = glue::entity($trg_entity)->pk();
                 if (count($pk) !== count($fields) || count(array_diff($fields, $pk)) !== 0) {
                     $trg_multiple = true;
                 }
             }
             // Check src cardinality :
             if (!$src_multiple) {
                 $fields = array_values($arr2);
                 $pk = glue::entity($src_entity)->pk();
                 if (count($pk) !== count($fields) || count(array_diff($fields, $pk)) !== 0) {
                     $src_multiple = true;
                 }
             }
         }
     }
     // Compute relationship type :
     if ($src_multiple) {
         if ($trg_multiple) {
             $type = self::MANY_TO_MANY;
         } else {
             $type = self::MANY_TO_ONE;
         }
     } else {
         if ($trg_multiple) {
             $type = self::ONE_TO_MANY;
         } else {
             $type = self::ONE_TO_ONE;
         }
     }
     return $type;
 }
コード例 #7
0
ファイル: glue.php プロジェクト: rlm80/Archive--glue-orm
 public static function auto_load($class)
 {
     if (preg_match("/^Glue_Proxy_(.*)\$/", $class, $matches) > 0) {
         glue::entity($matches[1])->proxy_load_class();
     }
 }
コード例 #8
0
ファイル: init.php プロジェクト: andrew-ayers/php
<?php

namespace MyFramework;

require_once 'config/config.php';
require_once 'libs/glue.php';
require_once 'libs/base.php';
require_once 'libs/filters.php';
try {
    session_start();
    glue::stick($routes);
} catch (\Exception $e) {
    die('ERROR: ' . $e->getMessage() . ' in [' . $e->getFile() . '] @ line ' . $e->getLine());
}