Exemplo n.º 1
0
 /**
  * Returns current Sales Organisation
  *
  * @return MyApp_SalesOrganisation_Model_Sales_Organisation
  */
 public static function getSalesOrganisation()
 {
     if (self::$_salesOrganisation == null) {
         self::$_salesOrganisation = Mage::getModel('myappsalesorganisation/salesorganisation')->load(Mage::app()->getWebsite()->getData('sales_organisation_id'));
     }
     return self::$_salesOrganisation;
 }
Exemplo n.º 2
0
    function render()
    {
        //得到属性的值
        $name = $this->_extract('name');
        $catch_id = 'Dy_menu' . $name;
        //读取缓存
        $rowSet = Q::cache($catch_id);
        //读取失败
        if (!$rowSet) {
            $rowSet = Sysmenu::find()->order('parent_id ASC, order_pos ASC')->asArray()->getAll();
            //写缓存
            Q::writeCache($catch_id, $rowSet);
        }
        /**
         * 验证不能访问的菜单
         */
        $app = MyApp::instance();
        foreach ($rowSet as $offset => $row) {
            if ($row['controller'] == '') {
                continue;
            }
            $udi = "{$row['controller']}/{$row['action']}";
            //权限判断
            if (!$app->authorizedUDI($app->currentUserRoles(), $udi)) {
                //删除没有权限访问的菜单
                unset($rowSet[$offset]);
            } else {
                $args = array();
                parse_str($row['args'], $args);
                $rowSet[$offset]['url'] = url($udi, $args);
            }
        }
        //数组转换成树
        $menu = Helper_Array::toTree($rowSet, 'menu_id', 'parent_id', 'submenu');
        //	 $mainMenu = & new Helper_Menu($menu) ;
        $mainMenu = new Helper_Menu($menu);
        $output = "var {$name} = ";
        $output .= $mainMenu->returnJsArray(true);
        $output .= ";\n";
        echo <<<EOT

<div id="mainMenuBar"></div>

<link href="js/ThemeOffice/theme.css" rel="stylesheet" type="text/css" />
<script language="javascript" type="text/javascript" src="js/JSCookMenu.js"></script>
<script language="javascript" type="text/javascript" src="js/ThemeOffice/theme.js"></script>

<script language="javascript" type="text/javascript">
{{$output}}

cmDraw ('mainMenuBar', myMenu, 'hbr', cmThemeOffice);
</script>

EOT;
    }
Exemplo n.º 3
0
 function render()
 {
     $currentUser = MyApp::instance()->currentUser();
     $category = array();
     if ($currentUser['group_id'] == 1) {
         $category = Category::find('enabled=1')->order('weight desc')->getAll();
     } else {
         $user = Users::find()->getById($currentUser['id']);
         $category = $user->group->categorys;
     }
     $this->_view['title'] = $this->title;
     $this->_view['category'] = $category;
     return $this->_fetchView(dirname(__FILE__) . '/category_view');
 }
Exemplo n.º 4
0
<?php

/**
 * Thin is a swift Framework for PHP 5.4+
 *
 * @package    Thin
 * @version    1.0
 * @author     Gerald Plusquellec
 * @license    BSD License
 * @copyright  1996 - 2015 Gerald Plusquellec
 * @link       http://github.com/schpill/thin
 */
namespace Thin;

$ini = parse_ini_file(__DIR__ . '/../.env');
defined('FRAMEWORK_DIR') || define('FRAMEWORK_DIR', isset($ini['FRAMEWORK_DIR']) ? $ini['FRAMEWORK_DIR'] : __DIR__ . DIRECTORY_SEPARATOR . '../fwk');
defined('APPLICATION_ENV') || define('APPLICATION_ENV', isset($ini['APPLICATION_ENV']) ? $ini['APPLICATION_ENV'] : 'production');
defined('SITE_NAME') || define('SITE_NAME', isset($ini['SITE_NAME']) ? $ini['SITE_NAME'] : 'project');
defined('LOCAL_DIR') || define('LOCAL_DIR', isset($ini['LOCAL_DIR']) ? $ini['LOCAL_DIR'] : '');
defined('STORAGE_DIR') || define('STORAGE_DIR', isset($ini['STORAGE_DIR']) ? $ini['STORAGE_DIR'] : __DIR__ . '/../app/storage');
require_once FRAMEWORK_DIR . DIRECTORY_SEPARATOR . 'public/init.php';
require_once APPLICATION_PATH . DS . 'Bootstrap.php';
require_once __DIR__ . DS . '../vendor/autoload.php';
require_once __DIR__ . DS . '../app' . DS . 'Bootstrap.php';
Timer::start();
Bootstrap::cli(true);
if (!session_id()) {
    session_start();
}
MyApp::run();
Exemplo n.º 5
0
        } else {
            // render the html directly
            return $twig->render('base.twig', array('header' => $twig->render('header.twig', array()), 'content' => $twig->render($template . '.twig', array()), 'footer' => $twig->render('footer.twig', array())));
        }
    }
}
$checkSPF = function (Request $request, MyApp $app) {
    if ($request->query->get('spf') === 'navigate') {
        // must return json-wrapped html fragments
        $app->isSpfRequest = true;
    } else {
        // must return the full html page
        $app->isSpfRequest = false;
    }
};
$app = new MyApp();
$app['debug'] = true;
// set up twig
$app->register(new Silex\Provider\TwigServiceProvider(), array('twig.path' => __DIR__ . '/views'));
### ------
### ROUTES
### ------
# INDEX
$app->get('/', function () use($app) {
    // index is always full html
    return $app['twig']->render('base.twig', array('header' => $app['twig']->render('header.twig', array()), 'content' => $app['twig']->render('index.twig', array()), 'footer' => $app['twig']->render('footer.twig', array())));
});
# PHOTOS
$app->get('/photos', function () use($app) {
    return SpfResponse::render('photos', $app['twig'], $app->isSpfRequest);
})->before($checkSPF);
Exemplo n.º 6
0
<?php

// $Id: generate.php 895 2010-03-23 05:36:29Z thinkgem $
/**
 * 命令行代码生成器的入口文件
 */
if (!isset($argv)) {
    echo <<<EOT
ERR: PHP running command line without \$argv.

EOT;
    exit;
}
$app_config = (require dirname(dirname(__FILE__)) . '/config/boot.php');
require $app_config['QEEPHP_DIR'] . '/library/q.php';
require $app_config['APP_DIR'] . '/myapp.php';
MyApp::instance($app_config);
require $app_config['QEEPHP_DIR'] . '/commands/cli/generator.php';
array_shift($argv);
$generator = new CliGenerator($app_config, $argv);
$generator->generating();
Exemplo n.º 7
0
/**
 * Created by IntelliJ IDEA.
 * User: ggibeau
 * Date: 11-03-24
 * Time: 10:46 AM
 * To change this template use File | Settings | File Templates.
 */
require_once '../logger/Logger.php';
class MyApp
{
    private $logger;
    public function __construct()
    {
        $this->logger = Logger::getLogger('WS');
        $this->logger->debug('Hello!');
        $this->logger->error('Uh oh');
    }
    public function doSomething()
    {
        $this->logger->info("Entering application.");
        $bar = new Bar();
        $bar->doIt();
        echo "<p>done</p>";
        $this->logger->info("Exiting application.");
    }
}
// Set up a simple configuration that logs on the console.
Logger::configure('myconfiguration.properties');
echo "<p>start</p>";
$myapp = new MyApp();
$myapp->doSomething();
Exemplo n.º 8
0
<?php

// $Id: websetup.php 11 2012-02-08 06:05:02Z zys4416@gmail.com $
/**
 * @file
 * Web 界面代码生成器的入口文件
 *
 * @ingroup script
 *
 * @{
 */
$app_config = (require dirname(dirname(dirname(__FILE__))) . '/_code/config/boot.php');
require $app_config['QEEPHP_DIR'] . '/library/q.php';
require $app_config['APP_DIR'] . '/myapp.php';
require $app_config['QEEPHP_DIR'] . '/commands/websetup/run.php';
$websetup = Websetup::instance($app_config, MyApp::loadConfigFiles($app_config));
$websetup->run();
Exemplo n.º 9
0
        $this->registerRoutes();
    }
    public function registerRoutes()
    {
        $this->get('/', function () {
            return '
                    <html>
                    <head><title>Demo</title></head>
                    <body>
                        <form method="post" action="foo">
                            <input type="text" name="v">
                            <input type="submit">
                        </form>
                    </body>
                    </html>
                ';
        });
        $this->post('/foo', function (Request $request) {
            $v = $request->getPostParameter('v');
            if (null === $v) {
                throw new BadRequestException('parameter "v" missing');
            }
            $response = new JsonResponse(201);
            $response->setBody(array('status' => 'ok'));
            return $response;
        });
    }
}
// run the app and send the response
$m = new MyApp();
$m->run()->send();
Exemplo n.º 10
0
<?php

$result = 420;
$resultstring = "Enhance your calm";
require dirname(__FILE__) . '/inc/cfg.php';
$dberror = false;
$dbconnect = db_connect(DBHOST, DBUSER, DBPASS) or $dberror = true;
if (!$dberror) {
    db_select(DB_NAME, $dbconnect) or $dberror = true;
    if (!$dberror) {
        $result = MyApp::tableExists("status");
        if ($result) {
            // Database: OK
            $result = 200;
            $resultstring = "OK";
        } else {
            // Database: The status table doesn't exist
            $result = 501;
            $resultstring = "Not Implemented";
        }
        db_close($dbconnect);
    } else {
        // Database: DB Selection Failure
        $result = 503;
        $resultstring = "Service Unavailable";
    }
} else {
    // Database: Connection Failure
    $result = 504;
    $resultstring = "Gateway Timeout";
}
Exemplo n.º 11
0
<?php
require '../src/App/MyApp.php';

$application = new MyApp();
$application->hello();
Exemplo n.º 12
0
<?php

global $g_boot_time;
$g_boot_time = microtime(true);
$app_config = (require dirname(__FILE__) . '/../config/boot.php');
require $app_config['ROOT_DIR'] . '/app/myapp.php';
MyApp::instance($app_config)->run();
Exemplo n.º 13
0
<?php

define('DS', DIRECTORY_SEPARATOR);
require_once '..' . DS . 'vendor' . DS . 'autoload.php';
$myApp = new \MyApp();
// di
$di = new \Halva\Application\ModuleHandler\DI();
$di->setMetadata(require_once dirname(__DIR__) . DS . 'configs' . DS . 'di_metadata.php');
$myApp->attachModuleHandler($di);
// builder
$builder = new \Halva\Application\ModuleHandler\Builder();
$myApp->attachModuleHandler($builder);
// duplicator
$duplicator = new \Halva\Application\ModuleHandler\Duplicator();
$duplicator->setMetadata(require_once dirname(__DIR__) . DS . 'configs' . DS . 'duplicator_metadata.php');
$myApp->attachModuleHandler($duplicator);
require_once dirname(__DIR__) . '/view/index.html';
Exemplo n.º 14
0
<?php

header('Content-type: text/html; charset=utf-8');
define('PATH_CONTROLLER', 'controller/');
define('PATH_VIEW', 'view/');
include 'include/mysql.php';
include 'include/app.php';
$app = new MyApp();
if ($app->connect()) {
    $app->db->query('SET NAMES utf8');
    /*session_start();
    	if(isset($_SESSION['time'])&&(time()-$_SESSION['time'])>$app->maxlifetime)
     	{
            session_destroy();
    	}*/
    $app->Run();
}
Exemplo n.º 15
0
 * mu-webapp
 * 
 * LICENSE
 * 
 * The BSD 2-Clause License is applied on this source-file. For
 * further information please refer to
 * http://www.opensource.org/licenses/BSD-2-Clause or send an
 * email to andre.moelle@gmail.com.
 */
include '../classes/Transfer.php';
include '../classes/Template.php';
include '../classes/Dispatcher.php';
include '../classes/Application.php';
include '../application/code/MyApp.php';
header('X-Powered-By: mu-webapp 0.1.3-dev');
if (!isset($_SESSION)) {
    session_start();
}
$self = dirname($_SERVER['PHP_SELF']);
$uri = $_SERVER['REQUEST_URI'];
if (($pos = strpos($uri, '?')) !== false) {
    $uri = substr($uri, 0, $pos);
}
$uri = $self == '/' ? $uri : substr($uri, strlen($self));
$app = new MyApp('../application/', new Transfer());
$app->getTransfer()->setSession($_SESSION)->setCookies($_COOKIE)->setGet($_GET)->setPost($_POST)->setServer($_SERVER);
$transfer = $app->run($uri == '/' ? '/index' : $uri);
if (!$transfer->wasDispatched()) {
    $transfer = $app->run('/error/404');
}
$_SESSION = $transfer->getSession();
Exemplo n.º 16
0
<?php

// $Id: index.php 11 2012-02-08 06:05:02Z zys4416@gmail.com $
/**
 * 应用程序启动脚本
 */
global $g_boot_time;
$g_boot_time = microtime(true);
$app_config = (require dirname(__FILE__) . '/../config/boot.php');
require $app_config['QEEPHP_DIR'] . '/library/q.php';
require $app_config['APP_DIR'] . '/myapp.php';
$ret = MyApp::instance($app_config)->dispatching();
if (is_string($ret)) {
    echo $ret;
}
return $ret;
Exemplo n.º 17
0
<?php

namespace Thin;

set_time_limit(false);
$ini = parse_ini_file(__DIR__ . '/../../.env');
defined('FRAMEWORK_DIR') || define('FRAMEWORK_DIR', isset($ini['FRAMEWORK_DIR']) ? $ini['FRAMEWORK_DIR'] : __DIR__ . '/../../fwk');
defined('APPLICATION_ENV') || define('APPLICATION_ENV', isset($ini['APPLICATION_ENV']) ? $ini['APPLICATION_ENV'] : 'production');
defined('SITE_NAME') || define('SITE_NAME', isset($ini['SITE_NAME']) ? $ini['SITE_NAME'] : 'project');
defined('LOCAL_DIR') || define('LOCAL_DIR', isset($ini['LOCAL_DIR']) ? $ini['LOCAL_DIR'] : '');
defined('STORAGE_DIR') || define('STORAGE_DIR', isset($ini['STORAGE_DIR']) ? $ini['STORAGE_DIR'] : __DIR__ . '/../../app/storage');
require_once FRAMEWORK_DIR . '/public/init.php';
require_once APPLICATION_PATH . '/Bootstrap.php';
require_once __DIR__ . DS . '../../vendor/autoload.php';
require_once __DIR__ . '/../../app/Bootstrap.php';
Config::set('directory.store', STORAGE_PATH);
Bootstrap::cli();
MyApp::cli();