本文整理汇总了PHP中Controller类的典型用法代码示例。如果您正苦于以下问题:PHP Controller类的具体用法?PHP Controller怎么用?PHP Controller使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Controller类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: Select
public function Select($nombre, $obs, $fecha)
{
$Controller = new Controller();
$arr1 = array("NOMBRE_RETIRO_CUSTODIA", "OBSERVACION_RETIRO_CUSTODIA", "FECHA_RETIRO_CUSTODIA");
$arr2 = array("'{$nombre}'", "'{$obs}'", "'{$fecha}'");
return $Controller->Select2($this->_tabla, $arr1, $arr2);
}
开发者ID:robertoesteban,项目名称:Sistema-de-Bodega,代码行数:7,代码来源:retiros_custodia.php
示例2: __construct
/**
* @param Controller $controller
* @param Job $job (optional)
*/
public function __construct($controller, $job = null)
{
if ($job) {
$fields = $job->getFields();
$required = $job->getValidator();
} else {
$fields = singleton('Job')->getFields();
$required = singleton('Job')->getValidator();
}
$fields->merge(new FieldList(new LiteralField('Conditions', $controller->TermsAndConditionsText), new HiddenField('BackURL', '', $controller->Link('thanks')), new HiddenField('EmailFrom', '', $controller->getJobEmailFromAddress()), new HiddenField('EmailSubject', '', $controller->getJobEmailSubject()), $jobId = new HiddenField('JobID')));
if ($job) {
$jobId->setValue($job->ID);
$actions = new FieldList(new FormAction('doEditJob', _t('Jobboard.EDITLISTING', 'Edit Listing')));
} else {
$actions = new FieldList(new FormAction('doAddJob', _t('JobBoard.CONFIRM', 'Confirm')));
}
parent::__construct($controller, 'AddJobForm', $fields, $actions, $required);
$this->setFormAction('JobBoardFormProcessor/doJobForm');
$this->setFormMethod('POST');
if ($job) {
$this->loadDataFrom($job);
} else {
$this->enableSpamProtection();
}
}
开发者ID:helpfulrobot,项目名称:fullscreeninteractive-silverstripe-jobboard,代码行数:29,代码来源:JobBoardForm.php
示例3: render
public function render($action, $params = [], $cacheTime = null)
{
if (empty($action)) {
return '';
}
$path = explode(':', $action);
$params = ['data' => $params, 'module' => $this->controller->params['module'], 'controller' => $this->controller->params['controller']];
switch (count($path)) {
case 1:
$params['action'] = $path[0];
break;
case 2:
$params['controller'] = $path[0];
$params['action'] = $path[1];
break;
default:
$params['module'] = $path[0];
$params['controller'] = $path[1];
$params['action'] = $path[2];
}
try {
if ($params['controller'] == $this->controller->params['controller'] && $params['module'] == $this->controller->params['module']) {
return $this->controller->run($params);
}
return $this->controller->app->runController($params, $cacheTime);
} catch (\Exception $e) {
if ('dev' == $this->controller->app->conf['env']) {
return $e;
}
return '';
}
}
开发者ID:yagrysha,项目名称:mvc,代码行数:32,代码来源:TwigExtension.php
示例4: get_numeric_identifier
/**
* Utility static to avoid repetition.
*
* @param Controller $controller
* @param string $identifier e.g. 'ParentID' or 'ID'
* @retun number
*/
public static function get_numeric_identifier($controller, $identifier = 'ID')
{
// Deal-to all types of incoming data
if (!$controller->hasMethod('currentPageID')) {
return 0;
}
// Use native SS logic to deal with an identifier of 'ID'
if ($identifier == 'ID') {
$useId = $controller->currentPageID();
// Otherwise it's custom
} else {
$params = $controller->getRequest()->requestVars();
$idFromFunc = function () use($controller, $params, $identifier) {
if (!isset($params[$identifier])) {
if (!isset($controller->urlParams[$identifier])) {
return 0;
}
return $controller->urlParams[$identifier];
}
return $params[$identifier];
};
$useId = $idFromFunc();
}
// We may have a padded string e.g. "1217 ". Without first truncating, we'd return 0 and pass tests...
$id = (int) trim($useId);
return !empty($id) && is_numeric($id) ? $id : 0;
}
开发者ID:deviateltd,项目名称:silverstripe-advancedassets,代码行数:34,代码来源:SecuredFilesystem.php
示例5: onNotFound
public function onNotFound(\Event $event)
{
$controller = new \Controller(\App::getInstance());
$page = $controller->twigInit()->render(\Config::get('view::notfound_page'));
$response = new \Response($page, 404);
\Container::getInstance()->setResponse($response);
}
开发者ID:fucongcong,项目名称:framework,代码行数:7,代码来源:NotFoundListener.php
示例6: errors
function errors($msg)
{
$controller = new Controller($this->request);
$controller->Session = new Session();
// print_r($controller);
$controller->e404($msg);
}
开发者ID:ronaldodia,项目名称:backend_al,代码行数:7,代码来源:Dispatcher.php
示例7: startup
/**
* startup
* called after Controller::beforeFilter()
*
* @param object $controller instance of controller
* @return void
* @access public
*/
public function startup(Controller $controller)
{
// Maintenance mode OFF but on offline page -> redirect to root url
if (!$this->isOn() && strpos($controller->here, Configure::read('Maintenance.site_offline_url')) !== false) {
$controller->redirect(Router::url('/', true));
return;
}
// Maintenance mode ON user logoout allowed
if ($this->isOn() && strpos($controller->here, 'users/logout') !== false) {
return;
}
// Maintenance mode ON but not in offline page requested - > redirect to offline page
if ($this->isOn() && strpos($controller->here, Configure::read('Maintenance.site_offline_url')) === false) {
// All users auto logged off if setting is true
if (Configure::read('Maintenance.offline_destroy_session')) {
$this->Session->destroy();
}
$controller->redirect(Router::url(Configure::read('Maintenance.site_offline_url'), true));
return;
}
// Maintenance mode scheduled show message!!
if ($this->hasSchedule()) {
$this->Flash->maintenance(__('This application will be on maintenance mode at %s ', Configure::read('Maintenance.start')));
}
}
开发者ID:felix-koehler,项目名称:phkapa,代码行数:33,代码来源:MaintenanceComponent.php
示例8: beforeRender
public function beforeRender(Controller $controller)
{
if ($this->isBrwPanel) {
$controller->set(array('companyName' => Configure::read('brwSettings.companyName'), 'brwHideMenu' => $controller->Session->read('brw.hideMenu')));
}
$this->controller->set('brwSettings', Configure::read('brwSettings'));
}
开发者ID:maniekx1984,项目名称:new_va_dev_copy_GITHUB,代码行数:7,代码来源:BrwPanelComponent.php
示例9: main
function main()
{
$controller = new Controller();
$response = null;
switch ($_POST["cmd"]) {
case "RPC":
$username = $_POST["user"];
if ($username == null) {
$username = $_SESSION['user'];
}
$pw = $_POST["pw"];
$plantname = $_POST["plant"];
$code = $_POST["code"];
$plantid = $_POST["id"];
$response = $controller->HandleRemoteProcedureCall($_POST["func"], $username, $pw, $plantname, $code, $plantid);
break;
case "ContentRequest":
if ($controller->IsLoggedIn() != "false") {
$response = new ContentMessage($_POST["content"], $_POST["plantid"]);
} else {
$func = "function() { this.showLoginDialog(); this.showMessage('Sie sind nicht eingeloggt bitte einloggen', 'error'); }";
$response = new RemoteProcedureCall($func);
}
break;
default:
$response = new Message('error', 'unknown Command');
break;
}
if ($response != null) {
$response->send();
} else {
echo "Error! no response was generated";
}
}
开发者ID:nomeata,项目名称:L-seed,代码行数:34,代码来源:Communication.php
示例10: startup
public function startup(Controller $controller)
{
if (isset($controller->request->params['prefix']) && $controller->request->params['prefix'] == 'admin' && !$this->isLoggedIn()) {
$this->Session->setFlash(__d('micro_auth', 'You need to login to access this page'));
$controller->redirect($this->config['loginAction']);
}
}
开发者ID:Onasusweb,项目名称:MicroAuth,代码行数:7,代码来源:MicroAuthComponent.php
示例11: setController
/**
* Attach Recaptcha helper to Controller.
*
* @param Controller $controller Controller.
*
* @return void
*/
public function setController($controller)
{
// Add the helper on the fly
if (!in_array('Recaptcha.Recaptcha', $controller->viewBuilder()->helpers())) {
$controller->viewBuilder()->helpers(['Recaptcha.Recaptcha'], true);
}
}
开发者ID:cakephp-fr,项目名称:recaptcha,代码行数:14,代码来源:RecaptchaComponent.php
示例12: preRequest
public function preRequest(SS_HTTPRequest $request, Session $session, DataModel $model)
{
// Bootstrap session so that Session::get() accesses the right instance
$dummyController = new Controller();
$dummyController->setSession($session);
$dummyController->setRequest($request);
$dummyController->pushCurrent();
// Block non-authenticated users from setting the stage mode
if (!Versioned::can_choose_site_stage($request)) {
$permissionMessage = sprintf(_t("ContentController.DRAFT_SITE_ACCESS_RESTRICTION", 'You must log in with your CMS password in order to view the draft or archived content. ' . '<a href="%s">Click here to go back to the published site.</a>'), Controller::join_links(Director::baseURL(), $request->getURL(), "?stage=Live"));
// Force output since RequestFilter::preRequest doesn't support response overriding
$response = Security::permissionFailure($dummyController, $permissionMessage);
$session->inst_save();
$dummyController->popCurrent();
// Prevent output in testing
if (class_exists('SapphireTest', false) && SapphireTest::is_running_test()) {
throw new SS_HTTPResponse_Exception($response);
}
$response->output();
die;
}
Versioned::choose_site_stage();
$dummyController->popCurrent();
return true;
}
开发者ID:jacobbuck,项目名称:silverstripe-framework,代码行数:25,代码来源:VersionedRequestFilter.php
示例13: setController
/**
* @param Controller $controller
* @param bool $stopPropagation
* @return $this
*/
public function setController(Controller $controller, $stopPropagation = false)
{
if (!$stopPropagation) {
$controller->addMethod($this, true);
}
$this->controller = $controller;
return $this;
}
开发者ID:saxulum,项目名称:saxulum-controller-provider,代码行数:13,代码来源:Method.php
示例14: GetMayor
public function GetMayor()
{
$Controller = new Controller();
$sql = "select max(ID_MERMA) as mayor from " . $this->tabla;
$result = $Controller->ejecute($sql);
$row = mysql_fetch_array($result);
return $row["mayor"];
}
开发者ID:robertoesteban,项目名称:Sistema-de-Bodega,代码行数:8,代码来源:merma.php
示例15: handler
/**
* @access public
* @since 1.0.0-alpha
* @version 1.0.0-alpha
*/
public function handler()
{
header('HTTP/1.0 ' . $this->sHeaderContent);
$oController = new Controller();
$oView = View::factory('base/error_pages/' . $this->iHttpCode);
echo $oController->independentResponse($oView);
exit;
}
开发者ID:ktrzos,项目名称:plethora,代码行数:13,代码来源:Exception.php
示例16: error
function error($message)
{
header("HTTP/1.0 404 Not Found");
$controller = new Controller($this->request);
$controller->set('message', $message);
$controller->render('/errors/404');
die;
}
开发者ID:IAntoineCI,项目名称:WebProject,代码行数:8,代码来源:Dispatcher.php
示例17: process
/**
* Executes the main functionality of the output processor
*
* @param \Controller $controller The relevant SilverStripe controller
* @param mixed $result The result from the input processor
* @return \SS_HTTPResponse
*/
public function process(\Controller $controller, $result = null)
{
$response = $controller->getResponse();
$response->setStatusCode(200);
$response->addHeader('Content-Type', 'application/json');
$response->setBody(json_encode(['success' => (bool) $result]));
return $response;
}
开发者ID:heyday,项目名称:heystack-ecommerce-locationdetectionmanager,代码行数:15,代码来源:SetCountryOutputProcessor.php
示例18: findPage
public static function findPage(Controller $oController)
{
if (self::$currentPageID > 0) {
return;
}
if ($oController->indexPage()) {
$oPage = new Page();
if ($oPage->loadIndexPage()) {
if (Controller::getInstance()->controllerExists($oPage["Link"])) {
$oController->route[self::$level] = $oPage["Link"];
}
self::$level = 1;
self::$page = $oPage;
self::$currentPageID = $oPage->PageID;
}
} else {
$db = MySQL::getInstance();
$db->query("SELECT PageID, StaticPath, Level, LeftKey, RightKey, Link\n\t\t\t\tFROM `page` WHERE\n\t\t\t\t\tWebsiteID = " . $db->escape(WEBSITE_ID) . "\n\t\t\t\t\tAND StaticPath IN (" . implode(", ", $db->escape($oController->route)) . ")\n\t\t\t\t\tAND LanguageCode = " . $db->escape(LANG) . "\n\t\t\t\t\tAND Level > 1\n\t\t\t\tORDER BY LeftKey");
self::$level = 0;
$moduleFound = false;
$currentPageID = null;
while ($row = $db->fetchRow()) {
if ($row["StaticPath"] == $oController->route[0] && $row["Level"] == 2) {
$currentPageID = $row["PageID"];
self::$currentLeftKey = $row["LeftKey"];
self::$currentRightKey = $row["RightKey"];
if ($moduleFound = Controller::getInstance()->controllerExists($row["Link"])) {
$oController->route[0] = $row["Link"];
break;
}
self::$level++;
continue;
}
if (!is_null($currentPageID) && count($oController->route) > self::$level) {
if ($row["StaticPath"] == $oController->route[self::$level] && $row["LeftKey"] > self::$currentLeftKey && $row["RightKey"] < self::$currentRightKey) {
$currentPageID = $row["PageID"];
self::$currentLeftKey = $row["LeftKey"];
self::$currentRightKey = $row["RightKey"];
if ($moduleFound = Controller::getInstance()->controllerExists($row["Link"])) {
$oController->route[self::$level] = $row["Link"];
break;
}
self::$level++;
}
}
}
if (self::$level == count($oController->route) || $moduleFound != false) {
$oPage = new Page();
if ($oPage->loadByID($currentPageID)) {
self::$page = $oPage;
self::$currentPageID = $oPage->PageID;
}
}
}
for ($i = 0; $i < self::$level; $i++) {
array_shift($oController->route);
}
}
开发者ID:kizz66,项目名称:meat,代码行数:58,代码来源:Handler.php
示例19: setUp
/**
* setUp method
*
* @access public
* @return void
*/
public function setUp()
{
$this->Controller = new ArticlesTestController();
$this->Controller->constructClasses();
$this->Controller->params = array('named' => array(), 'pass' => array(), 'url' => array());
$this->Controller->modelClass = 'Article';
$this->Controller->Archive = new ArchiveComponent($this->Controller->Components);
$this->Controller->Archive->startup($this->Controller);
}
开发者ID:tetsuo111,项目名称:cakephp,代码行数:15,代码来源:ArchiveComponentTest.php
示例20: verificarAcao
private function verificarAcao($ch_modulo, $ch_controller, $ch_action)
{
$modulo = new Modulo();
$controller = new Controller();
$action = new Action();
$id_modulo = $modulo->getIdModuloByCh($ch_modulo);
$id_controller = $controller->getIdControllerByCh($ch_controller);
$action->verificarAcao($id_modulo, $id_controller, $ch_action);
}
开发者ID:powman,项目名称:zfpadrao,代码行数:9,代码来源:HasAction.php
注:本文中的Controller类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论