本文整理汇总了PHP中Services::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Services::get方法的具体用法?PHP Services::get怎么用?PHP Services::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Services
的用法示例。
在下文中一共展示了Services::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: login
public function login($email = false, $passwd = false)
{
$email || ($email = $this->getPost('email'));
$passwd || ($passwd = $this->getPost('passwd'));
$orbit = new Orbit();
$client = $orbit->get('client/login', 1, 1, array('email' => $email, 'passwd' => $passwd));
if ($client['status'] == 200) {
$phones = $orbit->get('client/phones/' . $client['uid']['id']);
UID::set($client['uid']);
UID::set('phones', $phones['phones']);
$orbit = new Orbit();
$favRequest = $orbit->get('client/countfav', 1, 1, array('id' => UID::get('id')));
$favs = $favRequest['fav'];
$cartRequest = $orbit->get('client/countcart', 1, 1, array('id' => UID::get('id')));
$carts = $cartRequest['cart'];
$this->commitReplace($carts, '#cartitems');
$this->commitReplace($favs, '#favitems');
$product_id = $this->getQueryString('product_id');
if ($product_id) {
$productPage = Services::get('products');
$productPage->setId($product_id);
$productPage->viewProduct();
return;
}
$home = Services::get('home');
$home->homePage();
return;
}
$this->commitReplace('O e-mail e senha não foram encontrados', '#loginmsg');
$this->commitShow('#loginmsg');
}
示例2: indexAction
public function indexAction()
{
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$defaultItems = array($this->view->serverUrl() . BASEDIR => '1.00000', $this->view->serverUrl() . BASEDIR . '/fale-conosco' => '0.80000', $this->view->serverUrl() . BASEDIR . '/quem-somos' => '0.80000', $this->view->serverUrl() . BASEDIR . '/imoveis/listagem?oportunidades=Sim&e=oportunidades' => '0.80000', $this->view->serverUrl() . BASEDIR . 'imoveis/listagem?lancamento=Sim&e=lancamentos' => '0.80000', $this->view->serverUrl() . BASEDIR . 'bairros/listagem' => '0.80000');
$xml = new SimpleXMLElement('<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"></urlset>');
foreach ($defaultItems as $urlItem => $priority) {
$url = $xml->addChild('url');
$url->addChild('loc', htmlentities($urlItem));
$url->addChild('lastmod', date('Y-m-dTh:i:s+00:00'));
$url->addChild('changefreq', 'monthly');
$url->addChild('priority', $priority);
}
$vista = Services::get('vista_rest');
$totalPages = 2;
for ($page = 1; $page < $totalPages; $page++) {
$vista->setPaginationParam($page, 50);
$vista->buscaImoveis(array());
$totalPages = intval($vista->getTotalPages());
$result = $vista->getResult();
foreach ($result as $row) {
$url = $xml->addChild('url');
$url->addChild('loc', $this->view->serverUrl() . BASEDIR . '/imoveis/detalhes/codigo/' . $row['Codigo'] . '/' . $row['Categoria'] . '/' . $row['Bairro'] . (intval($row['Dormitorios']) > 0 ? '-' . $row['Dormitorios'] : '') . '/Zona+Sul-Porto+Alegre');
$url->addChild('lastmod', date('Y-m-dTh:i:s+00:00'));
$url->addChild('changefreq', 'monthly');
$url->addChild('priority', '0.90000');
}
}
file_put_contents(APPLICATION_PATH . '/../public/sitemap.xml', $xml->asXML());
}
示例3: indexAction
public function indexAction()
{
$this->view->bodyClass = 'pg-interna';
$vista = Services::get('vista_rest');
$this->view->listas = $vista->getListasBusca();
$form = new Site_Form_FaleConoscoForm();
$this->view->form = $form;
$params = $this->_request->getParams();
$this->view->headScript()->appendFile($this->view->serverUrl() . BASEDIR . '/res/js/quem-somos.js');
$vista = Services::get('vista_rest');
$users = $vista->getDadosUsuarios();
$grouped = array();
$groups = array();
array_walk($users, function ($user) use(&$grouped, &$groups) {
$group = String::RemoveIndex($user['Equipesite']);
$groups[] = strtolower($group);
$grouped[$group][] = $user;
});
$title = 'Equipe AG3 Imóveis';
$filterGroup = $this->getRequest()->getParam('t');
if (in_array($filterGroup, $groups)) {
$title = ucwords($filterGroup);
$grouped = array($title => $grouped[$title]);
}
$this->view->showGroups = !in_array($filterGroup, $groups);
$this->view->title = $title;
$this->view->users = $grouped;
}
示例4: indexAction
public function indexAction()
{
$form = new Application_Form_FaleConoscoForm();
$this->view->form = $form;
$params = $this->_request->getParams();
if ($this->_request->isPost() && $form->isValid($params)) {
try {
$vista = Services::get('vista_rest');
$vista->getAuthEmail();
$smtpData = $vista->getResult();
$config = array('auth' => 'login', 'username' => $smtpData['user'], 'password' => $smtpData['pass'], 'port' => $smtpData['port']);
$transport = new Zend_Mail_Transport_Smtp($smtpData['smtp'], $config);
Zend_Mail::setDefaultTransport($transport);
$html = new Zend_View();
$html->setScriptPath(APPLICATION_PATH . '/views/scripts/fale-conosco/');
$html->data = $params;
$emailBody = $html->render('email-body.phtml');
$mail = new Zend_Mail();
$mail->setBodyHtml($emailBody);
$mail->setFrom('atendimento@esselence.com.br', $params['nome']);
$mail->addTo('atendimento@esselence.com.br', 'Esselence');
$mail->setSubject("Contato pelo Site {$params['nome']}");
$mail->send();
$this->view->success = true;
} catch (Exception $e) {
print_r($e->getMessage());
exit;
}
}
}
示例5: listagemAction
public function listagemAction()
{
$this->view->bodyClass = 'pg-interna';
$vista = Services::get('vista_rest');
$this->view->listas = $vista->getListasBusca();
$bairros = Gravi_Service_ImochatService::getBairros();
$this->view->bairros = $bairros['hoods'];
}
示例6: __construct
/**
* Constructor
*
* Sets up the client
*/
public function __construct()
{
$this->restClient = Services::get('restclient');
$this->restClient->addHeader('Accept', 'application/json');
$this->restClient->setFormat('json');
$this->loadConfig();
$this->restClient->setUrl($this->getURL());
$this->restClient->addParam('key', $this->getConfig('key'));
}
示例7: resolveFacadeInstance
/**
* Löst die Facade gegen die eigentliche Implementierung auf.
* Hierbei ist zu beachten, dass eine Facade-Instanz als Accessor
* auch direkt eine Klasse zurückgeben kann!
*
* @param $name
* @return mixed
*/
protected static function resolveFacadeInstance($name)
{
if (is_object($name)) {
return $name;
}
if (isset(static::$resolvedInstances[$name])) {
return static::$resolvedInstances[$name];
}
return static::$resolvedInstances[$name] = Services::get($name);
}
示例8: detalhesAction
public function detalhesAction()
{
$this->view->headScript()->appendFile($this->view->serverUrl() . BASEDIR . '/res/js/detalhes.js');
$imoCodigo = $this->_request->getParam('codigo');
if (empty($imoCodigo)) {
//TODO -- Criar tela de imovel não encontrado
}
$vista = Services::get('vista_rest');
$vista->getDadosImovel($imoCodigo);
$dadosImovel = $vista->getResult();
if (empty($dadosImovel)) {
//TODO -- Criar tela de imovel não encontrado
}
$form = new Application_Form_FaleConoscoForm();
$this->view->form = $form;
$this->view->imovel = $dadosImovel;
}
示例9: testRegisterService
function testRegisterService()
{
Services::unregisterAllServices();
Services::registerServiceFactory("test/service", new CachedInstanceServiceFactory(new MyService()));
$this->assertTrue(Services::is_registered("test/service"), "Il servizio non e' stato registrato!!");
$this->assertTrue(Services::get("test/service") instanceof MyService, "Il servizio non corrisponde alla classe registrata!!");
$all_services = Services::get_all_registered_services();
$this->assertEqual(count($all_services), 1, "Il numero dei servizi registrati non corrisponde!!");
$this->assertEqual($all_services[0], "test/service", "Il nome del servizio registrato non corrisponde!!");
Services::registerServiceFactory("test/service2", new NewInstanceServiceFactory("MyService2"));
$this->assertTrue(Services::is_registered("test/service2"), "Il servizio non e' stato registrato!!");
$this->assertTrue(Services::get("test/service2") instanceof MyService2, "Il servizio non corrisponde alla classe registrata!!");
$all_services = Services::get_all_registered_services();
$this->assertEqual(count($all_services), 2, "Il numero dei servizi registrati non corrisponde!!");
Services::unregisterAllServices();
$all_services = Services::get_all_registered_services();
$this->assertEqual(count($all_services), 0, "Il numero dei servizi registrati non corrisponde!!");
}
示例10: respond
public function respond()
{
header("Content-type: {$this->content_type}; charset={$this->charset}");
http_response_code($this->status_code);
if ($this->content_type === 'application/json') {
return $this->encode_json($this->data);
} else {
if (substr($this->content_type, 0, 5) === 'image') {
return file_get_contents($this->data);
} else {
if ($this->content_type === 'text/html') {
if (isset($this->view)) {
$te = Services::get('TemplateEngine');
return $te->display($this->view, $this->data);
} else {
return $this->data;
}
} else {
return $this->data;
}
}
}
}
示例11: indexAction
public function indexAction()
{
$vista = Services::get('vista_rest');
$vista->getListasBusca();
$this->view->listas = $vista->getResult();
$vista->reset();
$filtroBanner = array('SuperDestaqueWeb' => 'Sim');
$pagination = array('pagina' => 1, 'quantidade' => 5);
$vista->buscaImoveis($filtroBanner, $pagination);
$this->view->banners = $vista->getResult();
$vista->reset();
$filtroWidget1 = array('EmDestaque' => 'Sim');
$vista->buscaImoveis($filtroWidget1);
$this->view->widget1 = $vista->getResult();
$this->view->widget1Title = 'Destaques';
// $vista->reset();
//
// $filtroWidget2 = array(
// 'Categoria' => 'Casa'
// );
//
// $vista->buscaImoveis($filtroWidget2);
// $this->view->widget2 = $vista->getResult();
}
示例12: indexAction
public function indexAction()
{
$this->view->headScript()->appendFile($this->view->serverUrl() . BASEDIR . '/res/js/imoveis.js');
$this->view->headScript()->appendFile($this->view->serverUrl() . BASEDIR . '/res/js/index.js');
$vista = Services::get('vista_rest');
$this->view->listas = $vista->getListasBusca();
$vista->reset();
$pagination = array('pagina' => 1, 'quantidade' => 4);
$banners = Gravi_Service_ImochatService::getBanners();
$this->view->banners = $banners['banners'];
$filtroWidget1 = array('Destinacao' => 'ALUGUEL', 'EmDestaque' => 'Sim');
$order = array('DataCadastro' => 'desc');
$vista->buscaImoveis($filtroWidget1, $pagination, $order);
$this->view->widget1 = $vista->getResult();
$vista->reset();
$filtroWidget2 = array('Destinacao' => 'VENDA', 'EmDestaque' => 'Sim');
$pagination = array('pagina' => 1, 'quantidade' => 4);
$vista->buscaImoveis($filtroWidget2, $pagination, $order);
$this->view->widget2 = $vista->getResult();
$filtroWidget3 = array('Destinacao' => 'VENDA', 'Lancamento' => 'Sim');
$pagination = array('pagina' => 1, 'quantidade' => 8);
$vista->buscaImoveis($filtroWidget3, $pagination, $order);
$this->view->widget3 = $vista->getResult();
}
示例13: addFavourite
public function addFavourite()
{
if (!UID::isLoggedIn()) {
$client = Services::get('client');
$client->register();
return;
}
$orbit = new Orbit();
$favs = $orbit->post('client/favourites/' . UID::get('id'), array('product_id' => $this->getQueryString('id')));
#debug($favs);
$favRequest = $orbit->get('client/countfav', 1, 1, array('id' => UID::get('id')));
$countfavs = $favRequest['fav'];
$this->commitReplace(intval($countfavs), '#favitems');
$this->view()->loadTemplate('favlink');
$this->commitReplace($this->view()->render(), '#addfav');
}
示例14: indexAction
public function indexAction()
{
$this->view->bodyClass = 'pg-interna';
$vista = Services::get('vista_rest');
$this->view->listas = $vista->getListasBusca();
}
示例15: getSemelhantes
private function getSemelhantes($imovel)
{
$vista = Services::get('vista_rest');
$vista->reset();
$similarFields = array('Categoria', 'Bairro', 'Status');
$filters = array();
array_walk($similarFields, function ($item) use(&$filters, $imovel) {
!isset($imovel[$item]) || ($filters[$item] = $imovel[$item]);
});
if ($imovel['Dormitorios'] > 0) {
$filters['Dormitorios'] = array('>=', $imovel['Dormitorios']);
}
if ($imovel['Vagas'] > 0) {
$filters['Vagas'] = array('>=', $imovel['Vagas']);
}
$min = intval($imovel['ValorVenda']) - intval($imovel['ValorVenda']) * 20 / 100;
$max = intval($imovel['ValorVenda']) + intval($imovel['ValorVenda']) * 20 / 100;
$filters['ValorVenda'] = array($min, $max);
$filters['Codigo'] = array('!=', $imovel['Codigo']);
$vista->setPaginationParam(1, 4);
$vista->buscaImoveis($filters);
$sem_filters = array('tipo' => $filters['Categoria'], 'bairros' => $filters['Bairro'], 'valor_min' => $filters['ValorVenda'][0], 'valor_max' => $filters['ValorVenda'][1], 'codigo' => $filters['Codigo']);
!isset($filters['Dormitorios']) || ($sem_filters['dormitorios'] = $filters['Dormitorios']);
!isset($filters['Vagas']) || ($sem_filters['vagas'] = $filters['Vagas']);
$this->view->filter_semelhantes = $sem_filters;
return $vista->getResult();
}