本文整理汇总了PHP中sfContext::getConfiguration方法的典型用法代码示例。如果您正苦于以下问题:PHP sfContext::getConfiguration方法的具体用法?PHP sfContext::getConfiguration怎么用?PHP sfContext::getConfiguration使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sfContext
的用法示例。
在下文中一共展示了sfContext::getConfiguration方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __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);
}
示例2: getRouteFromItem
/**
* extracts the sfRoute from the item if exists
*
* @param array $item
* @return mixed
*/
protected function getRouteFromItem(&$item)
{
$config = $this->context->getConfiguration();
$routing = $this->context->getRouting();
$routeName = $item['route'];
$routeName = self::replaceConstants($routeName);
$item['route'] = $routeName;
if (strpos($item['route'], '://') || strpos($item['route'], 'ww.') || strpos($item['route'], '#') !== false) {
return false;
} elseif (strpos($routeName, '/')) {
$config = $routing->parse($routeName);
return $config['_sf_route'];
} else {
$routeName = str_replace('@', '', $routeName);
if (strpos($routeName, '?')) {
$routeName = substr($routeName, 0, strpos($routeName, '?'));
}
$routes = $routing->getRoutes();
return isset($routes[$routeName]) ? $routes[$routeName] : false;
}
}
示例3: createInstance
/**
* Create a new sfSympalContext instance for a given sfContext and sfSympalConfiguration instance
*
* @param sfContext $symfonyContext
* @param sfSympalConfiguration $sympalConfiguration
* @return sfSympalContext $sympalContext
*/
public static function createInstance(sfContext $symfonyContext, sfSympalConfiguration $sympalConfiguration)
{
$name = $symfonyContext->getConfiguration()->getApplication();
$instance = new self($sympalConfiguration, $symfonyContext);
self::$_instances[$name] = $instance;
self::$_current = $instance;
return self::$_instances[$name];
}
示例4: createLoader
/**
* Создание и предварительное конфигурирование лоадера
*
* @return Twig_LoaderInterface
*/
protected function createLoader()
{
return new Twig_Loader_Chain([new sfTwigLoaderDirect(sfConfig::get('sf_app_dir')), new sfTwigLoaderDirect(sfConfig::get('sf_plugins_dir')), new sfTwigLoaderNamespace($this->sfContext->getConfiguration())]);
}
示例5: loadSfExtension
/**
* Загрузка старнадтного helper'a symfony
*/
public function loadSfExtension()
{
$this->sfContext->getConfiguration()->loadHelpers(func_get_args(), $this->sfContext->getModuleName());
}
示例6: checkConfiguration
/**
* Checks that the current project context is suitable to use sfDynamics.
*
* @return void
*/
public static function checkConfiguration(sfContext $context)
{
if ($context->getConfiguration() instanceof sfApplicationConfiguration) {
$enabledModules = sfConfig::get('sf_enabled_modules');
if (!in_array('sfDynamics', $enabledModules)) {
throw new sfDynamicsConfigurationException("sfDynamics module is not enabled in current application.\n\nTo be able to load an sfDynamicsManager instance (which is required to load a sfDynamics package), you must enable it under the enabled_modules list in your application's settings.yml.");
}
}
}
示例7: doGeneratePdf
protected function doGeneratePdf(sfContext $context, $chartBuilder, $file)
{
// definition of chart builder class
$this->setChartBuilder($chartBuilder);
// creation of a context
$context->getConfiguration()->loadHelpers('Partial');
$context->getRequest()->setRequestFormat('html');
$config = sfTCPDFPluginConfigHandler::loadConfig();
sfTCPDFPluginConfigHandler::includeLangFile($context->getUser()->getCulture());
$doc_title = $this->getName() . " Report";
$doc_subject = $this->getName() . " Report generated by Otokou";
$doc_keywords = "report, otokou";
//create new PDF document (document units are set by default to millimeters)
$pdf = new sfTCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true);
// set document information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor(PDF_AUTHOR);
$pdf->SetTitle($doc_title);
$pdf->SetSubject($doc_subject);
$pdf->SetKeywords($doc_keywords);
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING);
//set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
//set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set image scale factor
$pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
//initialize document
$pdf->AliasNbPages();
// report informations
$pdf->AddPage();
$html = get_partial('report/general_info', array('report' => $this));
$pdf->writeHTML($html, true, false, true, false, '');
// vehicles overall performances
$html = '<h1>Vehicles performances</h1>' . '<p>The values presented below are calculated overall the entire life period of the vehicle(s).</p>' . get_partial('report/vehicles_performances', array('vehicles' => $this->getVehicles()));
$pdf->writeHTML($html, true, false, true, false, '');
// charts
$pdf->AddPage();
$html = '<h1>Costs</h1>';
$pdf->writeHTML($html, true, false, true, false, '');
$counter = 0;
$options = array();
$attributes = array('absolute' => true);
$charts = $this->defineCharts($options, $attributes);
$nc = count($charts);
foreach ($charts as $c) {
$counter++;
//$html = get_partial('report/chart', array('chart' => $c));
//$pdf->writeHTML($html, true, false, true, false, '');
$html = '<h2>' . $c['title'] . '</h2><p>' . $c['comment'] . '</p>';
$pdf->writeHTML($html);
$c['chart']->generate();
$pdf->Image($c['chart']->getChartFileSystemPath());
if ($counter < $nc) {
$pdf->AddPage();
}
}
// Close and output PDF document
$pdf->Output($file, 'F');
}