本文整理汇总了PHP中View::create方法的典型用法代码示例。如果您正苦于以下问题:PHP View::create方法的具体用法?PHP View::create怎么用?PHP View::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类View
的用法示例。
在下文中一共展示了View::create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: installation
public static function installation()
{
if (!is_installed()) {
echo View::create('intro')->render();
exit(0);
}
}
示例2: indexAction
public function indexAction()
{
$elements = array();
$elements[] = Bootstrap::row()->add(12, Bootstrap::h(1, 'Internet providers'));
$elements[] = BootstrapUI::tableRemote()->title('List of providers')->column('name', 'provider name')->column('total', 'count', 70)->column('action', '', 30)->sortableColumns(array('name', 'total'))->searchable()->sortField('name', 'asc');
return View::create('base')->with('title', 'Internet providers')->with('content', $elements);
}
示例3: indexAction
public function indexAction()
{
$elements = array();
$elements[] = Bootstrap::row()->add(12, Bootstrap::h(1, 'Stack traces')->secondaryText('This is list of collected stack trace summaries'));
$table = BootstrapUI::tableRemote()->title('List of stack trace summaries')->searchable()->column('id')->column('summary')->column('total', 'count', 70)->sortableColumns(array('id', 'total'))->sortField('id', 'desc');
$elements[] = $table;
return View::create('base')->with('title', 'Stack traces')->with('content', $elements);
}
示例4: send
public function send()
{
if (Config::db('profiling')) {
$profile = View::create('profile', array('profile' => DB::profile()))->render();
$this->output = preg_replace('#</body>#', $profile . '</body>', $this->output);
}
return parent::send();
}
示例5: print_error
/**
* Printed out the errors to the error view
*/
public function print_error()
{
//check if there was no failure in the template, render it, print out failure.
//If we have errors in the template, then render the error-view without a template
if (strpos($this->m_code, 'TEMPLATE') !== false) {
View::create('error')->bind_by_name('s_error_message', $this->message)->bind_by_name('s_error_code', $this->m_code)->render(false);
} else {
View::create('error')->bind_by_name('s_error_message', $this->message)->bind_by_name('s_error_code', $this->m_code)->bind_by_name('s_error_file', $this->file)->bind_by_name('s_error_line', $this->line)->render();
}
exit(1);
}
示例6: is_session_expired
/**
*
*/
private function is_session_expired()
{
$a_return_values = array();
$b_session_valid = true;
$o_session = \Session::get_session();
if (!$o_session->is_session_valid()) {
$s_message = \View::create('message')->render(false, true);
$b_session_valid = false;
$o_session->create_new_session();
$a_return_values['message'] = $s_message;
}
$a_return_values['session_valid'] = $b_session_valid;
echo json_encode($a_return_values);
}
示例7: Request
/**
* Constructor
*/
function __construct()
{
// Merge GET and POST params
$oRequest = new Request(array_merge($_GET, $_POST));
// Create main view
$this->oMainView = new View('gabarit');
$this->oMainView->addData('title', Config::get('sitetitle'));
try {
// Create associated controller
$this->createController($oRequest);
// Execute controller
$this->oController->procede();
$this->oMainView->addData('menuItems', $this->createMenu());
$this->oMainView->addData('login', $this->oController->getCurrentUser()->getLogin());
$this->oMainView->addData('body', $this->oController->getView());
$this->oMainView->addData('script', $this->oController->getJS());
} catch (Error $e) {
$this->oMainView->addAlert($e, 'danger');
} finally {
// Create the main view
$this->oMainView->create();
}
}
示例8: putDocumentAction
/**
* Handle article PUT
*/
public function putDocumentAction(Request $request, $id)
{
$path = '/' . $id;
$data = $request->request->all();
$session = $this->registry->getConnection($this->name);
$node = $session->getNode($path);
if (empty($node)) {
throw new ResourceNotFoundException($path . ' not found');
}
$this->fromJsonLD($node, $data);
$session->save();
// return the updated version
$view = View::create($this->toJsonLd($node))->setFormat('json');
return $this->viewHandler->handle($view, $request);
}
示例9: stackTracesAction
public function stackTracesAction()
{
$osVersionId = (int) Url::getVar('os_version_id');
if ($osVersionId <= 0) {
Application::throwError(400, 'Bad request');
}
$osVersion = Version::fetchOne($osVersionId);
if ($osVersion === false) {
Application::throwError(404, 'Can not find os_version');
}
$title = "Stack traces for {$osVersion->os} {$osVersion->name}";
$elements = array();
$elements[] = Bootstrap::row()->add(12, Bootstrap::h(1, $title)->secondaryText("Total {$osVersion->total} reports"));
$elements[] = Bootstrap::row()->add(12, BootstrapUI::tableRemote()->title('Most common stack traces')->column('total', 'count', 80)->column('summary', 'stack trace summary')->column('action', '', 30)->sortableColumns(array('summary', 'total'))->sortField('total', 'desc')->extraParam('os_version_id', $osVersionId));
return View::create('base')->with('title', $title)->with('content', $elements);
}
示例10: processForm
/**
* @param User $user
*
* @return Response
*/
protected function processForm(User $user)
{
$statusCode = $user->isNew() ? 201 : 204;
$form = $this->createForm(new UserType(), $user);
$form->handleRequest($this->getRequest());
if ($form->isValid()) {
$user->save();
$response = new Response();
$response->setStatusCode($statusCode);
// set the `Location` header only when creating new resources
if (201 === $statusCode) {
$response->headers->set('Location', $this->generateUrl('acme_demo_user_get', array('id' => $user->getId()), true));
}
return $response;
}
return View::create($form, 400);
}
示例11: editAction
/**
* PATCH Route annotation.
* @Rest\Patch("/users/edit/{id}.{_format}")
* @Rest\View
* @return array
*/
public function editAction(Request $request, $id)
{
$em = $this->getDoctrine()->getManager();
$user = $em->getRepository('AppBundle:User')->find($id);
if (!$user) {
throw $this->createNotFoundException('User not found!');
}
$form = $this->createForm(new \ApiBundle\Form\Type\RegistrationFormType(), $user, array('method' => 'PATCH'));
$form->handleRequest($request);
if ($form->isValid()) {
$em = $this->getDoctrine()->getManager();
$em->persist($user);
$em->flush();
return array('user' => $user);
}
return View::create($form, 400);
}
示例12: versionsAction
public function versionsAction()
{
$packageId = (int) Url::getVar('package_id');
if ($packageId <= 0) {
Application::throwError(400, 'Bad request');
}
$package = Package::fetchOne($packageId);
if ($package === false) {
Application::throwError(404, 'Can not find package');
}
$last = Url::getVar('last');
$title = 'Package versions for ' . $package->name;
$elements = array();
$elements[] = Bootstrap::row()->add(12, Bootstrap::h(1, $title));
$elements[] = Bootstrap::row()->add(12, Bootstrap::buttonGroup()->add(Bootstrap::anchor('Last 12 hours', Url::href('packages', 'versions', array('package_id' => $packageId, 'last' => '12-hour')))->asButton()->color($last == '12-hour' ? 'blue' : 'default'))->add(Bootstrap::anchor('Last day', Url::href('packages', 'versions', array('package_id' => $packageId, 'last' => 'day')))->asButton()->color($last == 'day' ? 'blue' : 'default'))->add(Bootstrap::anchor('Last week', Url::href('packages', 'versions', array('package_id' => $packageId, 'last' => 'week')))->asButton()->color($last == 'week' ? 'blue' : 'default'))->add(Bootstrap::anchor('Last 2 weeks', Url::href('packages', 'versions', array('package_id' => $packageId, 'last' => '2-weeks')))->asButton()->color($last == '2-weeks' ? 'blue' : 'default'))->add(Bootstrap::anchor('Last month', Url::href('packages', 'versions', array('package_id' => $packageId, 'last' => 'month')))->asButton()->color($last == 'month' ? 'blue' : 'default'))->add(Bootstrap::anchor('Last 2 months', Url::href('packages', 'versions', array('package_id' => $packageId, 'last' => '2-months')))->asButton()->color($last == '2-months' ? 'blue' : 'default'))->add(Bootstrap::anchor('All', Url::href('packages', 'versions', array('package_id' => $packageId)))->asButton()->color($last == null ? 'blue' : 'default'))->setAttribute('style', 'margin-bottom: 10px'));
$elements[] = BootstrapUI::tableRemote()->title('Most common versions')->column('total', 'count', 80)->column('name', 'package version')->column('action', '', 30)->sortableColumns(array('name', 'total'))->sortField('total', 'desc')->extraParam('package_id', $packageId)->extraParam('last', $last);
return View::create('base')->with('title', $title)->with('content', $elements);
}
示例13: __construct
/**
* the constructor of this installer-class.
* it initialize all needed values and set the hidden fields for the template
*/
public function __construct()
{
//Initialize the installer with the current-needed POST and Session values
$this->init();
//set a common title
$this->s_step_title = __('install_common_title', 'install');
//set the hidden fields, which we don't need for the installation
\Replacer::set_hidden_fields(array('character', 'online', 'more'));
if ($this->check_dbconfig_file() !== array()) {
\Replacer::page_header($this->s_step_title);
$message = __('Probleme mit der ".dbconfig.default' . EXT . '". <br>Folgende Konstanten haben andere Werte als die ursprüngliche Datei');
throw new \LOGD_Exception($message);
}
//switch/case for the step and go to the right method
switch ($this->i_step) {
case 0:
$this->step_0();
break;
}
//set the page header and render the install view
\Replacer::page_header($this->s_step_title);
\View::create('install')->bind_by_value('i_step', $this->i_step)->render();
}
示例14: createAddPopup
/**
* Créer la Popup d'ajout d'un utilisateur
* @param \Rank $p_aRanks Rangs possibles
* @return string
*/
private function createAddPopup($p_aRanks)
{
$oPopupAdd = new View('popup');
$oPopupAdd->addData('id', 'adduser');
$oPopupAdd->addData('buttonstyle', 'btn-success');
$oPopupAdd->addData('buttonicon', 'fa-plus');
$oPopupAdd->addData('buttontext', 'Ajouter');
$oPopupAdd->addData('title', 'Ajouter un utilisateur');
$oFormAdd = new FormGenerator();
$oFormAdd->setAction('index.php?p=adminusers');
$oFormAdd->addInput('Identifiant', 'login', true, false, 'text', 'Identifiant ...');
$oFormAdd->addInput('Password', 'password', true, false, 'password', 'Password ...');
$oFormAdd->addInput('Confirmation', 'confirmation', true, false, 'password', 'Confirmation ...');
$oFormAdd->addInput('Email', 'mail', true, false, 'text', 'Email ...');
$oFormAdd->addSelect('Rang', 'rank', $p_aRanks, Rank::getDefaultRank()->getId());
$oFormAdd->create();
$oPopupAdd->addData('content', $oFormAdd->getCode());
$oPopupAdd->create();
return $oPopupAdd->getCode();
}
示例15: addUserAction
/**
* Show the page to add new user
*/
public function addUserAction()
{
$title = 'Add new user';
$content = array(Bootstrap::row()->add(8, \Bootstrap::h(1, $title), 2));
$content[] = Bootstrap::row()->add(8, Bootstrap::panel('New user', $this->getUserForm())->color('blue'), 2);
return View::create('base')->with('title', $title)->with('content', $content);
}