本文整理汇总了PHP中Controller::byName方法的典型用法代码示例。如果您正苦于以下问题:PHP Controller::byName方法的具体用法?PHP Controller::byName怎么用?PHP Controller::byName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Controller
的用法示例。
在下文中一共展示了Controller::byName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dashboard
public function dashboard()
{
if (!User::isLoggedIn()) {
die('You must be logged in to view this page.');
}
//do we need to set a default?
if (!User::$me->get('dashboard_style')) {
User::$me->set('dashboard_style', 'large_thumbnails');
User::$me->save();
}
//okay, pull in our dashboard style.
$this->set('dashboard_style', User::$me->get('dashboard_style'));
//are there any apps requesting access?
$this->set('request_tokens', OAuthToken::getRequestTokensByIP()->getAll());
$this->addTemplate('bot_thumbnail_template', Controller::byName('bot')->renderTemplate('thumbnail'));
$this->addTemplate('bot_list_template', Controller::byName('bot')->renderTemplate('dashboard_list'));
$this->addTemplate('job_list_template', Controller::byName('job')->renderTemplate('job_list'));
$this->addScript('initial_data', "var initialData = " . Controller::byName('main')->renderView('dashboard_data'), "text/javascript");
$this->addScript("js/backbone.js");
}
示例2: forgotpass
public function forgotpass()
{
$this->setTitle("Retrieve Forgotten Password");
if ($this->args('submit')) {
$user = User::byEmail($this->args('email'));
if ($user->isHydrated()) {
//give them a pass hash.
$user->set('pass_reset_hash', sha1(mt_rand() . mt_rand() . mt_rand()));
$user->save();
$link = "http://" . SITE_HOSTNAME . $user->getUrl() . "/resetpass:" . $user->get('pass_reset_hash');
$text = Controller::byName('email')->renderView('lost_pass', array('user' => $user, 'link' => $link));
$html = Controller::byName('email')->renderView('lost_pass_html', array('user' => $user, 'link' => $link));
Activity::log("forgot his/her password. :P", $user);
Email::queue($user, "Password Reset", $text, $html);
$this->set('status', "We have sent a reset password confirmation email to '" . $this->args('email') . "'.");
} else {
$this->set('error', "We could not find an account with that email address.");
}
$this->setArg('email');
}
}
示例3: array
if ($status) {
?>
<?php
echo Controller::byName('htmltemplate')->renderView('statusbar', array('message' => $status));
?>
<?php
} elseif ($error) {
?>
<?php
echo Controller::byName('htmltemplate')->renderView('errorbar', array('message' => $error));
?>
<?php
} elseif ($user->get('force_password_change')) {
?>
<?php
echo Controller::byName('htmltemplate')->renderView('errorbar', array('message' => 'You are required to change your password before continuing.'));
?>
<?php
}
?>
<form method="post" autocomplete="off" action="/user:<?php
echo $user->id;
?>
/changepass">
<table class="BaseForm">
<tr>
<td valign="top"><b>Enter Password</b></td>
<td><input type="password" name="changepass1" class="input-medium"></td>
</tr>
<tr>
示例4: array
<?php
if ($megaerror) {
?>
<?php
echo Controller::byName('htmltemplate')->renderView('errorbar', array('message' => $megaerror));
} else {
?>
<form class="form-horizontal" method="post" autocomplete="off" action="<?php
echo $bot->getUrl();
?>
/delete">
<input type="hidden" name="submit" value="1">
<div class="alert alert-block">
<h4 class="alert-heading">Warning!</h4>
Are you sure you want to delete this bot? This is permanent and will remove all information about this bot, including any jobs it has been assigned or completed.<br/><br/>
<button type="submit" class="btn btn-primary">Delete Bot</button>
</div>
</form>
<?php
}
示例5: array
?>
:: <a href="/bots">see all</a>
</h3>
<?php
echo Controller::byName('bot')->renderView('draw_bots', array('bots' => $bots));
?>
</div>
</div>
<?php
if (!empty($errors)) {
?>
<div class="row">
<div class="span12">
<h3>Error Log</h3>
<?php
echo Controller::byName('main')->renderView('draw_error_log', array('errors' => $errors, 'hide' => 'user'));
?>
</div>
</div>
<?php
}
} else {
?>
<div class="hero-unit">
<h1>BotQueue has arrived!</h1>
<p>The open source, distributed fabrication software you've been dreaming about. Srsly.</p>
<p>
<img src="/img/botqueue.png" width="1013" height="403" align="center">
</p>
<h3>Okay, so what does that mean?</h3>
<p>
示例6: array
<?php
if ($megaerror) {
?>
<?php
echo Controller::byName('htmltemplate')->renderView('errorbar', array('message' => $megaerror));
} else {
?>
<?php
echo Controller::byName('browse')->renderView('pagination_info', array('collection' => $activities, 'word' => 'activity'));
?>
<?php
echo Controller::byName('main')->renderView('draw_activities', array('activities' => $activities->getAll(), 'user' => $user));
?>
<?php
echo Controller::byName('browse')->renderView('pagination', array('collection' => $activities, 'base_url' => '/user:' . $user->id . '/activity'));
}
示例7: array
:: <a href="/jobs/complete">see all</a>
<?php
}
?>
</h2>
<?php
echo Controller::byName('job')->renderView('draw_jobs_small', array('jobs' => $complete));
?>
</div>
<div class="span6">
<h2>
Failed Jobs
<?php
if ($failure_count) {
?>
:: 1-<?php
echo min(10, $failure_count);
?>
of <?php
echo $failure_count;
?>
:: <a href="/jobs/failure">see all</a>
<?php
}
?>
</h2>
<?php
echo Controller::byName('job')->renderView('draw_jobs_small', array('jobs' => $failure));
?>
</div>
</div>
示例8: define
This file is part of BotQueue.
BotQueue is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
BotQueue is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with BotQueue. If not, see <http://www.gnu.org/licenses/>.
*/
define("START_TIME", microtime(true));
include "../extensions/global.php";
//include(EXTENSIONS_DIR . "session.php");
//are we in the right place?
if ($_SERVER['HTTP_HOST'] != SITE_HOSTNAME) {
header("Location: http://" . SITE_HOSTNAME . $_SERVER['REQUEST_URI']);
}
// If page requires SSL, and we're not in SSL mode,
// redirect to the SSL version of the page
if (FORCE_SSL && $_SERVER['SERVER_PORT'] != 443) {
header("HTTP/1.1 301 Moved Permanently");
header("Location: https://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
exit;
}
Controller::byName('apiv1')->renderView('endpoint');
示例9: header
// If page requires SSL, and we're not in SSL mode,
// redirect to the SSL version of the page
if (FORCE_SSL && $_SERVER['SERVER_PORT'] != 443) {
header("HTTP/1.1 301 Moved Permanently");
header("Location: https://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
exit;
}
//get our stuff.
$mode = $_GET['mode'];
$controller = $_GET['controller'];
$view = $_GET['view'];
// What mode are we looking at, ajax or html
if (!$mode) {
$mode = 'html';
}
// The main controller is the default
if (!$controller) {
$controller = 'main';
}
if (!$view) {
throw new Exception("No view specified");
}
// load the content
$main = Controller::byName($controller);
// render the views
$content = $main->renderView($view);
// add in headers and footers for html, or nothing for ajax
echo Controller::byName("{$mode}Template")->renderView('main', array('content' => $content, 'title' => $main->get('title'), 'area' => $main->get('area')));
} catch (Exception $ex) {
echo "Something bad happened: " . $ex->getMessage();
}
示例10: foreach
<div class="row">
<?php
foreach ($bots as $row) {
?>
<?php
echo Controller::byName("bot")->renderView("thumbnail", array('size' => 3, 'bot' => $row['Bot'], 'job' => $row['Job']));
?>
<?php
}
?>
</div>
示例11: render
public function render()
{
return Controller::byName('wizard')->renderView('view', array('forms' => $this->forms, 'name' => $this->name, 'active' => $this->activeForm, 'wizardMode' => $this->wizardMode));
}
示例12: array
<?php
/**
* @package botqueue_job
* @var string $megaerror
* @var int $page
* @var int $per_page
* @var int $total
* @var array $jobs
* @var string $status
*/
if ($megaerror) {
?>
<?php
echo Controller::byName('htmltemplate')->renderView('errorbar', array('message' => $megaerror));
} else {
?>
<?php
echo Controller::byName('browse')->renderView('pagination_info', array('page' => $page, 'per_page' => $per_page, 'total' => $total, 'word' => 'job'));
?>
<?php
echo Controller::byName('job')->renderView('draw_jobs', array('jobs' => $jobs));
?>
<?php
echo Controller::byName('browse')->renderView('pagination', array('page' => $page, 'per_page' => $per_page, 'base_url' => "/jobs/{$status}", 'total' => $total));
}
示例13: array
<?php
if (!empty($errors)) {
?>
<?php
echo Controller::byName('htmltemplate')->renderView('errorbar', array('message' => 'There were errors creating your queue.'));
}
?>
<form class="form-horizontal" method="post" autocomplete="off" action="/queue/create">
<input type="hidden" name="submit" value="1">
<fieldset>
<div class="control-group <?php
echo $errorfields['name'];
?>
">
<label class="control-label" for="iname">Queue Name</label>
<div class="controls">
<input type="text" class="input-xlarge" id="iname" name="name" value="<?php
echo $name;
?>
">
<?php
if ($errors['name']) {
?>
<span class="help-inline"><?php
echo $errors['name'];
?>
</span>
<?php
}
示例14: render
public function render()
{
return Controller::byName('form')->renderView(strtolower(get_class($this)), array('field' => $this));
}
示例15: min
<div class="span6">
<h3>
On Deck Jobs
:: 1-<?php
echo min(5, $on_deck_count);
?>
of <?php
echo $on_deck_count;
?>
:: <a href="/jobs/available">see all</a>
</h3>
<?php
echo Controller::byName('job')->renderView('draw_on_deck_jobs', array('jobs' => $on_deck));
?>
</div>
<div class="span6">
<h3>
Finished Jobs
:: 1-<?php
echo min(5, $finished_count);
?>
of <?php
echo $finished_count;
?>
:: <a href="/jobs/complete">see all</a>
</h3>
<?php
echo Controller::byName('job')->renderView('draw_finished_jobs', array('jobs' => $finished));
?>
</div>
</div>