本文整理汇总了PHP中sfYaml类的典型用法代码示例。如果您正苦于以下问题:PHP sfYaml类的具体用法?PHP sfYaml怎么用?PHP sfYaml使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了sfYaml类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: executeRender
public function executeRender()
{
$this->user = $this->getUser();
$this->menu = array();
$this->menu = sfYaml::load(sfConfig::get('sf_app_config_dir') . '/' . sfConfig::get('app_menu_file'));
foreach ($this->menu as $navItemsLabel => $navItems) {
echo "{$navItemsLabel}:<br />";
foreach ($navItems as $navItemLabel => $navItem) {
if (!is_array($navItem)) {
echo "+{$navItemLabel}: {$navItem}<br />";
} else {
echo "+{$navItemLabel}:<br />";
foreach ($navItem as $childItemsLabel => $childItems) {
echo "++{$childItemsLabel}:<br />";
foreach ($childItems as $childItemLabel => $childItem) {
if (!is_array($childItem)) {
echo "+++{$childItemLabel}: {$childItem}<br />";
} else {
echo "+++{$childItemLabel}: <br />";
foreach ($childItem as $babyItemsLabel => $babyItems) {
echo "++++{$babyItemsLabel}: {$babyItems}<br />";
}
}
}
}
}
}
}
}
开发者ID:ner0tic,项目名称:scss,代码行数:29,代码来源:components.class.php
示例2: _init
private function _init()
{
$pluginsPath = sfConfig::get('sf_plugins_dir');
$directoryIterator = new DirectoryIterator($pluginsPath);
foreach ($directoryIterator as $fileInfo) {
if ($fileInfo->isDir()) {
$pluginName = $fileInfo->getFilename();
$configuraitonPath = $pluginsPath . '/' . $pluginName . '/config/action_extensions.yml';
if (is_file($configuraitonPath)) {
$configuraiton = sfYaml::load($configuraitonPath);
if (!is_array($configuraiton)) {
continue;
}
foreach ($configuraiton as $module => $extentionsForActions) {
if (!isset($this->preExecuteMethodStack[$module])) {
$this->preExecuteMethodStack[$module] = array();
}
if (!isset($this->postExecuteMethodStack[$module])) {
$this->postExecuteMethodStack[$module] = array();
}
foreach ($extentionsForActions as $action => $extentions) {
if (!isset($this->preExecuteMethodStack[$module][$action])) {
$this->preExecuteMethodStack[$module][$action] = array();
}
if (!isset($this->postExecuteMethodStack[$module][$action])) {
$this->postExecuteMethodStack[$module][$action] = array();
}
$this->preExecuteMethodStack[$module][$action] = array_merge($this->preExecuteMethodStack[$module][$action], $extentions['pre']);
$this->postExecuteMethodStack[$module][$action] = array_merge($this->postExecuteMethodStack[$module][$action], $extentions['post']);
}
}
}
}
}
}
开发者ID:lahirwisada,项目名称:orangehrm,代码行数:35,代码来源:PluginExecutionManager.php
示例3: addParameters
protected function addParameters()
{
if (!$this->container->getParameters()) {
return '';
}
return sfYaml::dump(array('parameters' => $this->prepareParameters($this->container->getParameters())), 2);
}
开发者ID:densem-2013,项目名称:exikom,代码行数:7,代码来源:Yaml.php
示例4: execute
protected function execute($arguments = array(), $options = array())
{
$file = sfConfig::get('sf_apps_dir') . '/' . $options['app'] . '/config/app.yml';
$config = file_exists($file) ? sfYaml::load($file) : array();
$config = $this->switchConfig($config, strtolower($options['option']), strtolower($options['status']));
file_put_contents($file, sfYaml::dump($config, 4));
}
开发者ID:noreiller,项目名称:sfPlopPlugin,代码行数:7,代码来源:sfPlopSwitchOptionTask.class.php
示例5: configure
/**
* Get the package configuration
*
* @param string $yaml Pathname of the YAML configuration file
* @return array
*/
function configure($yaml)
{
$cfg = \sfYaml::load($yaml);
$name = $cfg['name'];
$options = $cfg['options'];
if (!isset($options['filelistgenerator'])) {
$cfg['options']['filelistgenerator'] = 'file';
}
if (!isset($options['baseinstalldir'])) {
$cfg['options']['baseinstalldir'] = '/';
}
if (!isset($options['packagedirectory'])) {
$cfg['options']['packagedirectory'] = __DIR__;
}
// ignored files
$ignore = array('package.php', 'package.xml', 'package.xml.orig', 'package.yml', 'config.w32', "{$name}.dsp", "{$name}-*.tgz");
if (isset($options['ignore'])) {
$ignore = array_merge($ignore, $options['ignore']);
}
$cfg['options']['ignore'] = glob_values($ignore);
// directory roles
$dir_roles = array('examples' => 'data', 'manual' => 'doc', 'tests' => 'test');
if (isset($options['dir_roles'])) {
$dir_roles = array_merge($dir_roles, $options['dir_roles']);
}
$cfg['options']['dir_roles'] = $dir_roles;
// role exceptions
$exceptions = array('CREDITS' => 'doc', 'EXPERIMENTAL' => 'doc', 'LICENSE' => 'doc', 'README' => 'doc');
if (isset($options['exceptions'])) {
$exceptions = array_merge($exceptions, $options['exceptions']);
}
$cfg['options']['exceptions'] = glob_keys($exceptions);
return $cfg;
}
开发者ID:dong777,项目名称:qrcode,代码行数:40,代码来源:package.php
示例6: _init_
protected function _init_()
{
$data = sfYaml::load(sfConfig::get('sf_lib_dir') . '/task/RandomData.yml');
$this->series = SeriesTable::getChoicesForSelect();
$this->letters = $data['letters'];
$this->tags = $data['tags'];
$this->items = $data['short_texts'];
$this->terms = $data['long_texts'];
$this->companies = $data['company_names'];
$this->names = $data['names'];
$this->lastnames = $data['lastnames'];
$this->taxes = array();
foreach ($q = Doctrine_Query::create()->from('Tax t')->execute() as $tax) {
$this->taxes[] = $tax->getId();
}
$customers = array('name' => array(), 'email' => array(), 'id' => array(), 'company' => array());
for ($i = 0; $i < mt_rand(20, 100); $i++) {
$customers['id'][] = str_pad(mt_rand(11111, 99999) . mt_rand(11111, 99999), 10, '0', STR_PAD_LEFT) . $this->letters[array_rand($this->letters)];
$name = $this->names[array_rand($this->names)] . " " . $this->lastnames[array_rand($this->lastnames)];
$customers['name'][] = $name;
$customers['email'][] = str_replace(' ', '_', strtolower($name)) . '@example.com';
$customers['company'][] = $this->companies[array_rand($this->companies)];
}
$this->customers = $customers;
}
开发者ID:solutema,项目名称:siwapp-sf1,代码行数:25,代码来源:RandomDataLoadTask.class.php
示例7: executeImportSentences
public function executeImportSentences(dmWebRequest $request)
{
$catalogue = $this->getObjectOrForward404($request);
$form = new DmCatalogueImportForm();
sfContext::getInstance()->getConfiguration()->loadHelpers(array('Url'));
if ($request->isMethod('post') && $form->bindAndValid($request)) {
$file = $form->getValue('file');
$override = $form->getValue('override');
$dataFile = $file->getTempName();
$table = dmDb::table('DmTransUnit');
$existQuery = $table->createQuery('t')->select('t.id, t.source, t.target, t.created_at, t.updated_at')->where('t.dm_catalogue_id = ? AND t.source = ?');
$catalogueId = $catalogue->get('id');
$nbAdded = 0;
$nbUpdated = 0;
try {
if (!is_array($data = sfYaml::load(file_get_contents($dataFile)))) {
$this->getUser()->logError($this->getI18n()->__('Could not load file: %file%', array('%file%' => $file->getOriginalName())));
return $this->renderPartial('dmInterface/flash');
}
} catch (Exception $e) {
$this->getUser()->logError($this->getI18n()->__('Unable to parse file: %file%', array('%file%' => $file->getOriginalName())));
return $this->renderPartial('dmInterface/flash');
}
$addedTranslations = new Doctrine_Collection($table);
$line = 0;
foreach ($data as $source => $target) {
++$line;
if (!is_string($source) || !is_string($target)) {
$this->getUser()->logError($this->getI18n()->__('Error line %line%: %file%', array('%line%' => $line, '%file%' => $file->getOriginalName())));
return $this->renderPartial('dmInterface/flash');
} else {
$existing = $existQuery->fetchOneArray(array($catalogueId, $source));
if (!empty($existing) && $existing['source'] === $source) {
if ($existing['target'] !== $target) {
if ($override || $existing['created_at'] === $existing['updated_at']) {
$table->createQuery()->update('DmTransUnit')->set('target', '?', array($target))->where('id = ?', $existing['id'])->execute();
++$nbUpdated;
}
}
} elseif (empty($existing)) {
$addedTranslations->add(dmDb::create('DmTransUnit', array('dm_catalogue_id' => $catalogue->get('id'), 'source' => $source, 'target' => $target)));
++$nbAdded;
}
}
}
$addedTranslations->save();
if ($nbAdded) {
$this->getUser()->logInfo($this->getI18n()->__('%catalogue%: added %count% translation(s)', array('%catalogue%' => $catalogue->get('name'), '%count%' => $nbAdded)));
}
if ($nbUpdated) {
$this->getUser()->logInfo($this->getI18n()->__('%catalogue%: updated %count% translation(s)', array('%catalogue%' => $catalogue->get('name'), '%count%' => $nbUpdated)));
}
if (!$nbAdded && !$nbUpdated) {
$this->getUser()->logInfo($this->getI18n()->__('%catalogue%: nothing to add and update', array('%catalogue%' => $catalogue->get('name'))));
}
return $this->renderText(url_for1($this->getRouteArrayForAction('index')));
}
$action = url_for1($this->getRouteArrayForAction('importSentences', $catalogue));
return $this->renderText($form->render('.dm_form.list.little action="' . $action . '"'));
}
开发者ID:theolymp,项目名称:diem,代码行数:60,代码来源:actions.class.php
示例8: _init
private function _init()
{
$pluginsPath = sfConfig::get('sf_plugins_dir');
$directoryIterator = new DirectoryIterator($pluginsPath);
foreach ($directoryIterator as $fileInfo) {
if ($fileInfo->isDir()) {
$pluginName = $fileInfo->getFilename();
$configuraitonPath = $pluginsPath . '/' . $pluginName . '/config/external_configurations.yml';
if (is_file($configuraitonPath)) {
$configuraiton = sfYaml::load($configuraitonPath);
if (!is_array($configuraiton)) {
continue;
}
foreach ($configuraiton as $component => $configuraitonForComponent) {
if (!isset($this->externalConfigurations[$component])) {
$this->externalConfigurations[$component] = array();
}
foreach ($configuraitonForComponent as $property => $value) {
if (!isset($this->externalConfigurations[$component][$property])) {
$this->externalConfigurations[$component][$property] = array();
}
if (is_array($value)) {
foreach ($value as $k => $v) {
$this->externalConfigurations[$component][$property]["{$pluginName}_{$k}"] = $v;
}
} else {
$this->externalConfigurations[$component][$property][] = $value;
}
}
}
}
}
}
}
开发者ID:lahirwisada,项目名称:orangehrm,代码行数:34,代码来源:PluginConfigurationManager.php
示例9: execute
/**
* @see sfTask
*/
protected function execute($arguments = array(), $options = array())
{
$r = new ReflectionClass($arguments['model']);
if (!$r->isSubclassOf('Doctrine_Record')) {
throw new sfCommandException(sprintf('"%s" is not a Doctrine class.', $arguments['model']));
}
// create a route
$model = $arguments['model'];
$module = $arguments['module'];
$app = $arguments['application'];
$routing = sfConfig::get('sf_app_config_dir') . '/routing.yml';
$content = file_get_contents($routing);
$routesArray = sfYaml::load($content);
if (!isset($routesArray[$name])) {
$databaseManager = new sfDatabaseManager($this->configuration);
$primaryKey = Doctrine_Core::getTable($model)->getIdentifier();
$content = sprintf(<<<EOF
%s:
class: sfObjectRouteCollection
options:
model: %s
actions: [ create, delete, list, show, update ]
module: %s
column: %s
default_params:
sf_format: json
EOF
, $module, $model, $module, $primaryKey) . $content;
$this->logSection('file+', $routing);
file_put_contents($routing, $content);
}
return $this->generate($app, $module, $model);
}
开发者ID:Atyz,项目名称:sfDoctrineRestGeneratorPlugin,代码行数:37,代码来源:sfDoctrineRestGenerateModuleTask.class.php
示例10: setUp
protected function setUp()
{
$this->leaveRequestDao = new LeaveRequestDao();
$fixtureFile = sfConfig::get('sf_plugins_dir') . '/orangehrmCoreLeavePlugin/test/fixtures/LeaveRequestDao.yml';
TestDataService::populate($fixtureFile);
$this->fixture = sfYaml::load($fixtureFile);
}
开发者ID:THM068,项目名称:orangehrm,代码行数:7,代码来源:LeaveRequestDaoTest.php
示例11: createFromYaml
/**
* Create an instance of pmJSCookMenu from a yaml file.
*
* @param string $yaml_file The yaml file path
* @return pmJSCookMenu
*/
public static function createFromYaml($yaml_file)
{
$yaml = sfYaml::load($yaml_file);
$yaml = array_pop($yaml);
$root = new pmJSCookMenu();
$root_attrs = array("credentials", "description", "icon", "orientation", "target", "theme", "title", "url");
foreach ($root_attrs as $attr) {
if (isset($yaml[$attr])) {
$method = "set" . ucfirst($attr);
call_user_func(array($root, $method), $yaml[$attr]);
unset($yaml[$attr]);
}
}
if (isset($yaml["root"]) && $yaml["root"] == true) {
$root->setRoot();
unset($yaml["root"]);
}
$separator_count = 0;
foreach ($yaml as $name => $arr_menu) {
if ($name == "separator") {
$item = new pmJSCookMenuSeparator();
$root->addChild("{$name}{$separator_count}", $item);
$separator_count++;
} else {
$item = self::createMenu($arr_menu);
$root->addChild($name, $item);
}
}
return $root;
}
开发者ID:nvidela,项目名称:kimkelen,代码行数:36,代码来源:pmJSCookMenu.class.php
示例12: cross_app_link_to
/**
* a function that allows link_to between apps
* @param $app string the app we want to go to
* @param $route string the route in the app. Must be valid
* @param $args array the arguments required by the route. Optional
* @author Cf. http://ivanramirez.fr/2011/08/09/faire-un-lien-dune-application-a-une-autre/
*
*/
function cross_app_link_to($app, $route, $args = null)
{
/* get the host to build the absolute paths
needed because this menu lets switch between sf apps
*/
$host = sfContext::getInstance()->getRequest()->getHost();
/* get the current environment. Needed to switch between the apps preserving
the environment
*/
$env = sfConfig::get('sf_environment');
/* get the routing file
*/
$appRoutingFile = sfConfig::get('sf_root_dir') . DIRECTORY_SEPARATOR . 'apps' . DIRECTORY_SEPARATOR . $app . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'routing.yml';
/* get the route in the routing file */
/* first, substract the @ from the route name */
$route = substr($route, 1, strlen($route));
if (file_exists($appRoutingFile)) {
$yml = sfYaml::load($appRoutingFile);
$routeUrl = $yml[$route]['url'];
if ($args) {
foreach ($args as $k => $v) {
$routeUrl = str_replace(':' . $k, $v, $routeUrl);
}
}
if (strrpos($routeUrl, '*') == strlen($routeUrl) - 1) {
$routeUrl = substr($routeUrl, 0, strlen($routeUrl) - 2);
}
}
if ($env == 'dev') {
$path = '//' . $host . '/' . $app . '_dev.php' . $routeUrl;
} else {
$path = '//' . $host . $routeUrl;
}
return $path;
}
开发者ID:TheoJD,项目名称:portail,代码行数:43,代码来源:CrossLinkHelper.php
示例13: generateMenu
public function generateMenu()
{
$menu = new ioMenu();
if ($this->getCurrentApp() == Menu::FRONTEND_APP) {
$routings = sfYaml::load(sfConfig::get('sf_apps_dir') . '/' . Menu::FRONTEND_APP . '/config/routing.yml');
} else {
$routings = sfYaml::load(sfConfig::get('sf_apps_dir') . '/' . Menu::BACKEND_APP . '/config/routing.yml');
}
foreach ($this->getItems() as $item) {
foreach ($routings as $key => $routing) {
if ("@" . $key == $item->routing) {
if (!empty($item->section)) {
//Set class "active" if the item is a link to the current page
if ($menu->getChild($item->section, false) == null) {
$menu->addChild($item->section, $item->section_routing)->setLinkOptions(array('class' => 'link'));
}
$menu->getChild($item->section)->addChild($item->text, $item->routing)->setLinkOptions(array('class' => 'link large'));
} else {
//Set class "active" if the item is a link to the current page
$menu->addChild($item->text, $item->routing)->setLinkOptions(array('class' => 'link'));
}
}
}
}
return $menu;
}
开发者ID:nvieirafelipe,项目名称:graviola-project,代码行数:26,代码来源:Menu.class.php
示例14: executeRun
public function executeRun(sfWebRequest $request)
{
// Cargo definicion
$def = sfYaml::load($request->getParameter('definicion'));
// Extraigo nombre del patron y parametros
$patternClassName = key($def) . 'Pattern';
$params = $def[key($def)]['Params'];
// Instancio el patron
$ptn = new $patternClassName();
// Seteo parametros de entrada
foreach ($params as $key => $value) {
$ptn->setParameter($key, $value);
}
// Logica particular del patron antes de visualizar interfaz
$ptn->execute();
if ($ptn->hasTemplate()) {
// Con interfaz. Paso parametros a la interfaz
$this->include = $ptn->getTemplate();
$this->patternName = $ptn->getName();
// Tomo los datos del patron que van a la interfaz
foreach ($ptn->getTplParameters() as $name => $value) {
$this->{$name} = $value;
}
}
// Seteo instancia del patron en la sesion del usuario
// para leerlo cuando vuelva de la interfaz del patron
// y/o finalize.
$this->getUser()->setFlash('patron_class_test', $ptn);
// Si el patron no tiene interfaz, finalizo redireccionando al index.
if (!$ptn->hasTemplate()) {
$this->redirect('psdfTestPattern/index');
}
}
开发者ID:psdf,项目名称:psdfCorePlugin,代码行数:33,代码来源:actions.class.php
示例15: configure
public function configure()
{
$yamlConf = sfYaml::load(sfConfig::get('sf_apps_dir') . '/backend/config/app.yml');
$this->setWidget('fichier_source', new sfWidgetFormInputFileEditable(array('file_src' => $yamlConf['all']['document_upload_dir'] . $this->getObject()->getFichierSource(), 'with_delete' => false, 'edit_mode' => false)));
$this->validatorSchema['fichier_source'] = new sfValidatorFile(array('required' => false, 'path' => $yamlConf['all']['document_upload_dir']));
$this->validatorSchema['date_document'] = new sfValidatorDate(array('required' => false, 'date_format' => '~(?P<day>\\d{2})/(?P<month>\\d{2})/(?P<year>\\d{2})~'));
}
开发者ID:njch,项目名称:PatBati,代码行数:7,代码来源:DocumentsForm.class.php
示例16: ui_layout_configure_to
/**
* UI.Layout creates a 'page-layout' that has auto-sizing 'center pane'
* surrounded by up to four collapsible and resizable 'border panes'
* (north, south, east & west). It can also create multiple headers &
* footers inside each pane.
* @param string $layoutName The layout name
* @param string $selector jQuery Selector
* @param array() $configurations Array. See the options and events in
* http://layout.jquery-dev.net/documentation.html#Options
*/
function ui_layout_configure_to($layoutName, $selector, $configurations = array())
{
$configurations = get_default_widget_configuration('app_ys_jquery_ui_layout_defaults', $configurations);
if (isset($configurations['yml'])) {
$ymlItems = sfYaml::load($configurations['yml']);
$ymlIndex = isset($configurations['ymlKey']) ? $configurations['ymlKey'] : 'layout';
$ymlConfigurations = isset($ymlItems[$ymlIndex]) ? $ymlItems[$ymlIndex] : array();
$configurations = array_merge($ymlConfigurations, $configurations);
unset($configurations['yml'], $configurations['ymlKey']);
}
$support = core_init_javasacript_tag();
$support .= 'var ' . $layoutName . ';';
$pattern = ui_layout_pattern($configurations);
$utilityMethods = '';
if (!is_array($configurations) || !sizeof($configurations) > 0) {
$configurations = array('applyDefaultStyles' => true);
} else {
if (!isset($configurations['name'])) {
$configurations['name'] = $layoutName;
}
$utilityMethods = ui_layout_utility_methods_pattern($layoutName, $configurations);
}
if (isset($configurations['cache']) && $configurations['cache'] === true) {
echo add_jquery_support('window', 'unload', like_function("layoutState.save('{$layoutName}')"));
$pattern = "\$.extend( {$pattern} , layoutState.load('{$layoutName}'))";
}
$jsVar = like_function($layoutName . ' = ' . jquery_support($selector, 'layout', $pattern, true, $utilityMethods));
$support .= jquery_support($selector, 'ready', $jsVar);
echo $support .= core_end_javasacript_tag();
}
开发者ID:alexhandzhiev,项目名称:sifact,代码行数:40,代码来源:ysJQueryUILayoutHelper.php
示例17: setup
public function setup()
{
$this->dispatcher->connect('component.method_not_found', array('sfActionExtra', 'observeMethodNotFound'));
sfYaml::setSpecVersion('1.1');
// for compatibility / remove and enable only the plugins you want
$this->enablePlugins(array('sfDoctrinePlugin', 'sfDoctrineGuardPlugin', 'sfFormExtraPlugin', 'sfGoogleAnalyticsPlugin', 'sfTaskExtraPlugin', 'csDoctrineActAsSortablePlugin', 'sfThemeGeneratorPlugin', 'sfHadoriThemePlugin'));
}
开发者ID:robertsergio,项目名称:Hadori-Demo,代码行数:7,代码来源:ProjectConfiguration.class.php
示例18: __construct
/**
* Establece la conexion a la base de datos.
* Abre el fichero de configuracion '$fileConfig', o en su defecto config/config.yml
* y lee el nodo $conection donde se definen los parametros de conexion.
*
* En entorno de poducción los parámetros de conexión se fuerzan a:
*
* host = localhost
* user = $conection
* password= $conection
* dataBase= $conection
*
* Si la conexion es exitosa, getDblink() devolvera valor y si no getError() nos indica
* el error producido.
*
* @param mixed $conection Nombre de la conexion
* @param string $fileConfig Nombre del fichero de configuracion
*/
public function __construct($conection, $fileConfig = '')
{
if (is_array($conection)) {
$this->dbEngine = $conection['dbEngine'];
$this->host = $conection['host'];
$this->user = $conection['user'];
$this->password = $conection['password'];
$this->dataBase = $conection['database'];
$this->conecta();
} else {
if ($fileConfig == '') {
$fileConfig = $_SERVER['DOCUMENT_ROOT'] . $_SESSION['appPath'] . "/" . $this->file;
}
if (file_exists($fileConfig)) {
$yaml = sfYaml::load($fileConfig);
$params = $yaml['config']['conections'][$conection];
$this->dbEngine = $params['dbEngine'];
$this->host = $params['host'];
/**if ($_SESSION['EntornoDesarrollo']) {
$this->user = $conection;
$this->password = $conection;
$this->dataBase = $conection;
} else {*/
$this->user = $params['user'];
$this->password = $params['password'];
$this->dataBase = $params['database'];
//}
$this->conecta();
} else {
$this->error[] = "EntityManager []: ERROR AL LEER EL ARCHIVO DE CONFIGURACION. " . $fileConfig . " NO EXISTE\n";
}
}
}
开发者ID:albatronic,项目名称:hermes,代码行数:51,代码来源:xxEntityManager.class.php
示例19: execute
public function execute($request)
{
$head = sfYaml::load(sfConfig::get('sf_app_dir') . '/lib/list/seller_list.yml');
$sellerlist_headers = array($head['listSeller']['header1'], $head['listSeller']['header2'], $head['listSeller']['header3'], $head['listSeller']['header4']);
$columns = 'id,name,address,tp_hp';
$recordsLimit = 5;
//have to take from lists
if (!$request->hasParameter('pageNo')) {
$pageNo = 1;
} else {
$pageNo = $request->getParameter('pageNo', 1);
}
$pager = new SimplePager('Seller', $recordsLimit);
$pager->setPage($pageNo);
$pager->setNumResults($this->getSellerService()->countSellers());
$pager->init();
$offset = $pager->getOffset();
$offset = empty($offset) ? 0 : $offset;
$paramHolder = new sfParameterHolder();
$paramHolder->set('columns', $columns);
$paramHolder->set('offset', $offset);
$paramHolder->set('limit', $recordsLimit);
$sellerlist_data = $this->getSellerService()->getSellers($paramHolder);
$listContainer = new ListContainer();
$listContainer->setListName('SellerList');
$listContainer->setListHeaders($sellerlist_headers);
$listContainer->setListContent($sellerlist_data);
$listContainer->setRowLink("seller/showSeller?id=");
$listContainer->setPager($pager);
$this->listcontainer = $listContainer;
}
开发者ID:GarraouiMarwen,项目名称:open-stock-management,代码行数:31,代码来源:listSellerAction.class.php
示例20: addYamlFile
/**
* Adds a new yaml file to the dataset.
* @param string $yamlFile
*/
public function addYamlFile($yamlFile)
{
$data = sfYaml::load($yamlFile);
foreach ($data as $tableName => $rows)
{
if (!is_array($rows)) {
continue;
}
if (!array_key_exists($tableName, $this->tables))
{
$columns = count($rows) ? array_keys(current($rows)) : array();
$tableMetaData = new PHPUnit_Extensions_Database_DataSet_DefaultTableMetaData($tableName, $columns);
$this->tables[$tableName] = new PHPUnit_Extensions_Database_DataSet_DefaultTable($tableMetaData);
}
foreach ($rows as $row)
{
$this->tables[$tableName]->addRow($row);
}
}
}
开发者ID:schwarer2006,项目名称:wikia,代码行数:29,代码来源:YamlDataSet.php
注:本文中的sfYaml类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论