本文整理汇总了PHP中sfContext类的典型用法代码示例。如果您正苦于以下问题:PHP sfContext类的具体用法?PHP sfContext怎么用?PHP sfContext使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了sfContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setGaufretteService
public function setGaufretteService(sfContext $context)
{
$gaufrette = new sfGaufretteFactory($this->configuration->getConfigCache());
// to finish, add it to the current context
$context->set('gaufrette', $gaufrette);
return $gaufrette;
}
示例2: decomposeURL
public static function decomposeURL(sfContext $context, sfRequest $request)
{
$module = $context->getModuleName();
$action = $context->getActionName();
$parameters = $request->getParameterHolder()->getAll();
return array("module" => $module, "action" => $action, "parameters" => $parameters);
}
示例3: __construct
public function __construct(sfContext $context, sfEventDispatcher $dispatcher)
{
$this->mailer = $context->getMailer();
$this->dispatcher = $dispatcher;
$this->serviceContainer = $context->getServiceContainer();
$this->initialize();
}
示例4: initialize
/**
* Initializes this view.
*
* @param sfContext $context The current application context
* @param string $moduleName The module name for this view
* @param string $actionName The action name for this view
* @param string $viewName The view name
*
* @return bool true, if initialization completes successfully, otherwise false
*/
public function initialize($context, $moduleName, $actionName, $viewName)
{
$this->moduleName = $moduleName;
$this->actionName = $actionName;
$this->viewName = $viewName;
$this->context = $context;
$this->dispatcher = $context->getEventDispatcher();
sfOutputEscaper::markClassesAsSafe(array('sfForm', 'sfModelGeneratorHelper'));
$this->attributeHolder = $this->initializeAttributeHolder();
$this->parameterHolder = new sfParameterHolder();
$this->parameterHolder->add(sfConfig::get('mod_' . strtolower($moduleName) . '_view_param', array()));
$request = $context->getRequest();
$format = $request->getRequestFormat();
if (null !== $format) {
if ('html' != $format) {
$this->setExtension('.' . $format . $this->getExtension());
}
if ($mimeType = $request->getMimeType($format)) {
$this->context->getResponse()->setContentType($mimeType);
if ('html' != $format) {
$this->setDecorator(false);
}
}
}
$this->dispatcher->notify(new sfEvent($this, 'view.configure_format', array('format' => $format, 'response' => $context->getResponse(), 'request' => $context->getRequest())));
// include view configuration
$this->configure();
return true;
}
示例5: initialize
/**
* Initializes this view.
*
* @param sfContext $context The current application context
* @param string $moduleName The module name for this view
* @param string $actionName The action name for this view
* @param string $viewName The view name
*
* @return bool true, if initialization completes successfully, otherwise false
*/
public function initialize($context, $moduleName, $actionName, $viewName)
{
$this->moduleName = $moduleName;
$this->actionName = $actionName;
$this->viewName = $viewName;
$this->context = $context;
$this->dispatcher = $context->getEventDispatcher();
if (sfConfig::get('sf_logging_enabled')) {
$this->dispatcher->notify(new sfEvent($this, 'application.log', array(sprintf('Initialize view for "%s/%s"', $moduleName, $actionName))));
}
sfOutputEscaper::markClassAsSafe('sfForm');
$this->attributeHolder = $this->initializeAttributeHolder();
$this->parameterHolder = new sfParameterHolder();
$this->parameterHolder->add(sfConfig::get('mod_' . strtolower($moduleName) . '_view_param', array()));
$request = $context->getRequest();
if (!is_null($format = $request->getRequestFormat())) {
if ('html' != $format) {
$this->setExtension('.' . $format . $this->getExtension());
}
if ($mimeType = $request->getMimeType($format)) {
$this->context->getResponse()->setContentType($mimeType);
$this->setDecorator(false);
}
$this->dispatcher->notify(new sfEvent($this, 'view.configure_format', array('format' => $format, 'response' => $context->getResponse(), 'request' => $context->getRequest())));
}
// include view configuration
$this->configure();
return true;
}
示例6: initialize
/**
* Initializes this Filter.
*
* @param sfContext $context The current application context
* @param array $parameters An associative array of initialization parameters
*
* @return boolean true
*/
public function initialize($context, $parameters = array())
{
$this->request = $context->getRequest();
$this->response = $context->getResponse();
$this->user = $context->getUser();
return parent::initialize($context, $parameters);
}
示例7: initialize
/**
* Initializes this controller.
*
* @param sfContext $context A sfContext implementation instance
*/
public function initialize($context)
{
$this->context = $context;
$this->dispatcher = $context->getEventDispatcher();
// set max forwards
$this->maxForwards = sfConfig::get('sf_max_forwards');
}
示例8: buildUserColumns
/**
* Function builds the data for the Extjs Grid, to change the order
* of circulation overview Columns.
*
* @param array $data
* @param sfContext, Context symfony object
* @return array $data, resultset
*/
public function buildUserColumns(array $data, sfContext $context) {
for($a = 0;$a<count($data);$a++) {
$data[$a]['column'] = $data[$a]['columntext'];
$data[$a]['columntext'] = $context->getI18N()->__($data[$a]['columntext'],null,'systemsetting');
}
return $data;
}
示例9: initialize
/**
* Initializes this component.
*
* @param sfContext $context The current application context
*
* @return boolean true, if initialization completes successfully, otherwise false
*/
public function initialize($context)
{
$this->context = $context;
$this->varHolder = new sfParameterHolder();
$this->request = $context->getRequest();
$this->response = $context->getResponse();
$this->requestParameterHolder = $this->request->getParameterHolder();
return true;
}
示例10: initialize
/**
* Initializes this controller.
*
* @param sfContext $context A sfContext implementation instance
*/
public function initialize($context)
{
$this->context = $context;
$this->dispatcher = $context->getEventDispatcher();
if (sfConfig::get('sf_logging_enabled')) {
$this->dispatcher->notify(new sfEvent($this, 'application.log', array('Initialization')));
}
// set max forwards
$this->maxForwards = sfConfig::get('sf_max_forwards');
}
示例11: initialize
/**
* Initializes this component.
*
* @param sfContext $context The current application context.
* @param string $moduleName The module name.
* @param string $actionName The action name.
*
* @return boolean true, if initialization completes successfully, otherwise false
*/
public function initialize($context, $moduleName, $actionName)
{
$this->moduleName = $moduleName;
$this->actionName = $actionName;
$this->context = $context;
$this->dispatcher = $context->getEventDispatcher();
$this->varHolder = new sfParameterHolder();
$this->request = $context->getRequest();
$this->response = $context->getResponse();
$this->requestParameterHolder = $this->request->getParameterHolder();
}
示例12: initialize
/**
* Initializes the cache manager.
*
* @param sfContext $context Current application context
* @param sfCache $cache An sfCache instance
*/
public function initialize($context, sfCache $cache)
{
$this->context = $context;
$this->dispatcher = $context->getEventDispatcher();
$this->controller = $context->getController();
// empty configuration
$this->cacheConfig = array();
// cache instance
$this->cache = $cache;
// routing instance
$this->routing = $context->getRouting();
}
示例13: __construct
/**
*
* @param int $versionId, id of the current workflow
* @param String $text, the text to replace
* @param String $culture, the language
* @param sfContext $context , context object
*/
public function __construct($versionId, $text, $culture, $context = false) {
if($context == false) {
sfLoader::loadHelpers('Date');
}
else {
$context->getConfiguration()->loadHelpers('Date');
}
$this->setWorkflow($versionId);
$this->setWorkflowVersion($versionId);
$this->culture = $culture;
$this->theSender = new UserMailSettings($this->workflow['sender_id']);
$this->newText = $this->replacePlaceholder($text);
}
示例14: buildField
/**
* Prepare data for displaxing in grid
*
* @param Doctrine_Collection $data, data from database
* @param sfContext $context
* @return array $result
*/
public function buildField(Doctrine_Collection $data, sfContext $context) {
$result = array();
$a = 0;
foreach($data as $item) {
$result[$a]['#'] = $a+1;
$result[$a]['id'] = $item->getId();
$result[$a]['title'] = $item->getTitle();
$result[$a]['type'] = $context->getI18N()->__($item->getType(),null,'field');
$write = $item->getWriteprotected() == 1 ? 'yes' : 'no';
$result[$a++]['writeprotected'] = $context->getI18N()->__($write,null,'field');
}
return $result;
}
示例15: buildAllText
/**
* Function creates data for displaying all additional textes in datagrid
*
* @param Doctrine_Collection $data, all records for grid
* @param sfContext $context, context object
* @return array $resultset, resultset.
*/
public function buildAllText(Doctrine_Collection $data, sfContext $context) {
$a = 0;
$result = array();
foreach($data as $item) {
$result[$a]['#'] = $a+1;
$result[$a]['title'] = $item->getTitle();
$result[$a]['contenttype'] = $context->getI18N()->__($item->getContenttype(),null,'additionaltext');
$result[$a]['rawcontenttype'] = $item->getContenttype();
$result[$a]['content'] = $item->getContent();
$result[$a]['isactive'] = $item->getIsactive();
$result[$a++]['id'] = $item->getId();
}
return $result;
}