本文整理汇总了PHP中Application::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP Application::getInstance方法的具体用法?PHP Application::getInstance怎么用?PHP Application::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Application
的用法示例。
在下文中一共展示了Application::getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getResourceRouting
public function getResourceRouting()
{
$admin_app = Application::getInstance('admin');
$resource_routing = $admin_app->getResourceRouting();
array_unshift($resource_routing['default'], 'applications/cli');
return $resource_routing;
}
示例2: csrf
/**
* Returns a Csrf instance
*
* @return Csrf
*/
public function csrf()
{
if (!$this->csrf) {
$this->csrf = \Dependency::resolve('security.csrf', array($this->config, \Application::getInstance()->getSession()));
}
return $this->csrf;
}
示例3: actionIndex
public function actionIndex()
{
$poll = Application::getInstance()->fetchers->poll->getByOpenAttribute();
$questions = Application::getInstance()->fetchers->questions->getByPollId($poll['id']);
$answers = Application::getInstance()->fetchers->answers->getByPollId($poll['id']);
$this->render('index', array('poll' => $poll, 'questions' => $questions, 'answers' => $answers));
}
示例4: __construct
/**
* @param Product $product
* @param integer $qtd
*/
public function __construct(Product $product, $qtd)
{
parent::__construct();
$resourceBundle = Application::getInstance()->getBundle();
$idProduct = $product->getIdProduct();
$moneyformat = $resourceBundle->getString('MONEY_FORMAT');
$productName = $product->getProductName();
$productDescription = $product->getProductDescription();
$productPrice = $product->getProductPrice();
$form = $this->addChild(new Form('/?c=cart&a=change&p=' . $idProduct));
//Imagem do produto
$form->addChild(new Image($product->getProductImage(), $productName))->setTitle($productName)->setAttribute('width', 80)->setAttribute('height', 80);
//Nome e descrição do produto
$form->addChild(new Span())->addStyle('name')->addChild(new Text($productName));
$form->addChild(new Span())->addStyle('desc')->addChild(new Text($productDescription));
//Input com a quantidade de itens
$form->addChild(new Label(new Text($resourceBundle->getString('QUANTITY'))))->addChild(new Input('qtd'))->setValue($qtd);
//Preço unitário
$form->addChild(new Span())->addStyle('price')->addChild(new Text(money_format($moneyformat, $productPrice)));
//Preço total
$form->addChild(new Span())->addStyle('total')->addChild(new Text(money_format($moneyformat, $qtd * $productPrice)));
//Botões para edição e exclusão do item do carrinho
$form->addChild(new Input('save', Input::SUBMIT))->setValue($resourceBundle->getString('SAVE'));
$form->addChild(new Input('del', Input::SUBMIT))->setValue($resourceBundle->getString('DELETE'));
}
示例5: __construct
public function __construct()
{
$this->session = Application::getInstance('Session');
if (!isset($this->session->{self::KEY})) {
$this->session->{self::KEY} = array();
}
}
示例6: testAdd
/**
* @covers QueueController::Add
* @todo Implement testAdd().
*/
public function testAdd()
{
$person = Person::factory('adult');
$person->name = 'Poehavshiy';
$person->add();
$store = Store::factory('Grocery');
$store->name = 'Prison';
$store->add();
$product = new Product();
$product->name = 'Sladkiy hleb';
$product->add();
$request = Application::getInstance()->request;
$request->setParams(array('storeId' => $store->id, 'personId' => $person->id, 'product_' . $product->id => 'on'));
$personId = $request->p('personId');
$storeId = $request->p('storeId');
$store = Store::get($storeId);
$person = Person::get($personId);
$store->queue->add($person);
$person->basket->drop();
$name = 'product_' . $product->id;
$value = $product;
if (preg_match_all('/^product_(\\d+)$/', $name, $matches)) {
$person->basket->add(Product::get($matches[1][0]));
}
}
示例7: __construct
private function __construct()
{
$this->_viewPath = Application::getInstance()->getConfig()->app['views'];
if ($this->_viewPath == null) {
$this->_viewPath = realpath('../Views/');
}
}
示例8: testStore
/**
* @covers AssortmentController::Store
* @todo Implement testStore().
*/
public function testStore()
{
$request = Application::getInstance()->request;
$request->setParam('storeId', '6');
$c = new AssortmentController();
$result = $c->Store();
}
示例9: actionDelete
public function actionDelete()
{
$questions = Application::getInstance()->fetchers->questions->getById($_GET['id']);
Application::getInstance()->fetchers->questions->delete($_GET['id']);
$poll_id = $questions['poll_id'];
header("Location: /index.php?r=adminQuestion/index&poll_id={$poll_id}");
}
示例10: __callStatic
public static function __callStatic($func, ...$args)
{
if (!in_array($func, self::FUNC_ALLOWED)) {
throw new \Exception("method {$func} not found");
}
$obj = Application::getInstance()->produce('router');
return call_user_func_array([$obj, $func], ...$args);
}
示例11: getInstance
/**
* {@inheritdoc}
*/
public static function getInstance()
{
// get the current session via the active request instance
if ($request = \Request::getInstance()) {
return $request->getApplication()->getSession();
}
return Application::getInstance()->getSession();
}
示例12: saveText
private function saveText($question)
{
foreach ($_POST['answers'] as $answers) {
if (!empty($answers)) {
Application::getInstance()->fetchers->answers->addSting($answers, $_GET['question_id'], $question);
}
}
}
示例13: getFromDomain
public static function getFromDomain($domain)
{
$db =& Application::getInstance()->db;
$s = $db->prepare("select " . School::fieldList . " from School where domain=:d");
$s->bindParam(':d', $domain);
$s->execute();
return $s->fetchObject();
}
示例14: add
public static function add($moduleName)
{
$con = Application::getDbConnection();
$con->queryExecute("INSERT INTO b_module(ID) VALUES('" . $con->getSqlHelper()->forSql($moduleName) . "')");
self::$installedModules = array();
$cacheManager = Application::getInstance()->getManagedCache();
$cacheManager->clean("b_module");
}
示例15: __construct
public function __construct()
{
$registry = Registry::getInstance();
if (!$registry->has('pdo')) {
$resourceBundle = Application::getInstance()->getBundle();
$registry->set('pdo', new PDO($resourceBundle->getString('MYSQL_DSN'), $resourceBundle->getString('MYSQL_USER'), $resourceBundle->getString('MYSQL_PSWD')));
}
}