本文整理汇总了PHP中dm::getI18n方法的典型用法代码示例。如果您正苦于以下问题:PHP dm::getI18n方法的具体用法?PHP dm::getI18n怎么用?PHP dm::getI18n使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dm
的用法示例。
在下文中一共展示了dm::getI18n方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setup
public function setup()
{
$this->setWidgets(array('post_id' => new sfWidgetFormDoctrineChoice(array('model' => 'DmTestPost', 'add_empty' => true)), 'author' => new sfWidgetFormFilterInput(), 'body' => new sfWidgetFormFilterInput(), 'is_active' => new sfWidgetFormChoice(array('choices' => array('' => dm::getI18n()->__('yes or no', array(), 'dm'), 1 => dm::getI18n()->__('yes', array(), 'dm'), 0 => dm::getI18n()->__('no', array(), 'dm')))), 'created_at' => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormInputText(array(), array("class" => "datepicker_me")), 'to_date' => new sfWidgetFormInputText(array(), array("class" => "datepicker_me")), 'with_empty' => false)), 'updated_at' => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormInputText(array(), array("class" => "datepicker_me")), 'to_date' => new sfWidgetFormInputText(array(), array("class" => "datepicker_me")), 'with_empty' => false)), 'version' => new sfWidgetFormFilterInput()));
$this->setValidators(array('post_id' => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Post'), 'column' => 'id')), 'author' => new sfValidatorPass(array('required' => false)), 'body' => new sfValidatorPass(array('required' => false)), 'is_active' => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))), 'created_at' => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))), 'updated_at' => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))), 'version' => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false)))));
$this->widgetSchema->setNameFormat('dm_test_comment_filters[%s]');
$this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);
$this->setupInheritance();
parent::setup();
}
示例2: setup
public function setup()
{
$this->setWidgets(array('slug' => new sfWidgetFormFilterInput(), 'name' => new sfWidgetFormFilterInput(), 'title' => new sfWidgetFormFilterInput(), 'h1' => new sfWidgetFormFilterInput(), 'description' => new sfWidgetFormFilterInput(), 'keywords' => new sfWidgetFormFilterInput(), 'auto_mod' => new sfWidgetFormFilterInput(), 'is_active' => new sfWidgetFormChoice(array('choices' => array('' => dm::getI18n()->__('yes or no', array(), 'dm'), 1 => dm::getI18n()->__('yes', array(), 'dm'), 0 => dm::getI18n()->__('no', array(), 'dm')))), 'is_secure' => new sfWidgetFormChoice(array('choices' => array('' => dm::getI18n()->__('yes or no', array(), 'dm'), 1 => dm::getI18n()->__('yes', array(), 'dm'), 0 => dm::getI18n()->__('no', array(), 'dm')))), 'is_indexable' => new sfWidgetFormChoice(array('choices' => array('' => dm::getI18n()->__('yes or no', array(), 'dm'), 1 => dm::getI18n()->__('yes', array(), 'dm'), 0 => dm::getI18n()->__('no', array(), 'dm'))))));
$this->setValidators(array('slug' => new sfValidatorPass(array('required' => false)), 'name' => new sfValidatorPass(array('required' => false)), 'title' => new sfValidatorPass(array('required' => false)), 'h1' => new sfValidatorPass(array('required' => false)), 'description' => new sfValidatorPass(array('required' => false)), 'keywords' => new sfValidatorPass(array('required' => false)), 'auto_mod' => new sfValidatorPass(array('required' => false)), 'is_active' => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))), 'is_secure' => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))), 'is_indexable' => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0)))));
$this->widgetSchema->setNameFormat('dm_page_translation_filters[%s]');
$this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);
$this->setupInheritance();
parent::setup();
}
示例3: setup
public function setup()
{
$this->setWidgets(array('title' => new sfWidgetFormFilterInput(), 'excerpt' => new sfWidgetFormFilterInput(), 'body' => new sfWidgetFormFilterInput(), 'url' => new sfWidgetFormFilterInput(), 'is_active' => new sfWidgetFormChoice(array('choices' => array('' => dm::getI18n()->__('yes or no', array(), 'dm'), 1 => dm::getI18n()->__('yes', array(), 'dm'), 0 => dm::getI18n()->__('no', array(), 'dm'))))));
$this->setValidators(array('title' => new sfValidatorPass(array('required' => false)), 'excerpt' => new sfValidatorPass(array('required' => false)), 'body' => new sfValidatorPass(array('required' => false)), 'url' => new sfValidatorPass(array('required' => false)), 'is_active' => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0)))));
$this->widgetSchema->setNameFormat('dm_test_post_translation_version_filters[%s]');
$this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);
$this->setupInheritance();
parent::setup();
}
示例4: setup
public function setup()
{
$this->setWidgets(array('username' => new sfWidgetFormFilterInput(), 'email' => new sfWidgetFormFilterInput(), 'algorithm' => new sfWidgetFormFilterInput(), 'salt' => new sfWidgetFormFilterInput(), 'password' => new sfWidgetFormFilterInput(), 'is_active' => new sfWidgetFormChoice(array('choices' => array('' => dm::getI18n()->__('yes or no', array(), 'dm'), 1 => dm::getI18n()->__('yes', array(), 'dm'), 0 => dm::getI18n()->__('no', array(), 'dm')))), 'is_super_admin' => new sfWidgetFormChoice(array('choices' => array('' => dm::getI18n()->__('yes or no', array(), 'dm'), 1 => dm::getI18n()->__('yes', array(), 'dm'), 0 => dm::getI18n()->__('no', array(), 'dm')))), 'last_login' => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormInputText(array(), array("class" => "datepicker_me")), 'to_date' => new sfWidgetFormInputText(array(), array("class" => "datepicker_me")), 'with_empty' => true)), 'created_at' => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormInputText(array(), array("class" => "datepicker_me")), 'to_date' => new sfWidgetFormInputText(array(), array("class" => "datepicker_me")), 'with_empty' => false)), 'updated_at' => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormInputText(array(), array("class" => "datepicker_me")), 'to_date' => new sfWidgetFormInputText(array(), array("class" => "datepicker_me")), 'with_empty' => false)), 'groups_list' => new sfWidgetFormDoctrineChoice(array('multiple' => true, 'model' => 'DmGroup')), 'permissions_list' => new sfWidgetFormDoctrineChoice(array('multiple' => true, 'model' => 'DmPermission'))));
$this->setValidators(array('username' => new sfValidatorPass(array('required' => false)), 'email' => new sfValidatorPass(array('required' => false)), 'algorithm' => new sfValidatorPass(array('required' => false)), 'salt' => new sfValidatorPass(array('required' => false)), 'password' => new sfValidatorPass(array('required' => false)), 'is_active' => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))), 'is_super_admin' => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))), 'last_login' => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))), 'created_at' => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))), 'updated_at' => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))), 'groups_list' => new sfValidatorDoctrineChoice(array('multiple' => true, 'model' => 'DmGroup', 'required' => false)), 'permissions_list' => new sfValidatorDoctrineChoice(array('multiple' => true, 'model' => 'DmPermission', 'required' => false))));
$this->widgetSchema->setNameFormat('dm_user_filters[%s]');
$this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);
$this->setupInheritance();
parent::setup();
}
示例5: setup
public function setup()
{
$this->setWidgets(array('title' => new sfWidgetFormFilterInput(), 'is_active' => new sfWidgetFormChoice(array('choices' => array('' => dm::getI18n()->__('yes or no', array(), 'dm'), 1 => dm::getI18n()->__('yes', array(), 'dm'), 0 => dm::getI18n()->__('no', array(), 'dm')))), 'created_by' => new sfWidgetFormDoctrineChoice(array('model' => 'DmUser', 'add_empty' => true)), 'updated_by' => new sfWidgetFormDoctrineChoice(array('model' => 'DmUser', 'add_empty' => true))));
$this->setValidators(array('title' => new sfValidatorPass(array('required' => false)), 'is_active' => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))), 'created_by' => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('CreatedBy'), 'column' => 'id')), 'updated_by' => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('UpdatedBy'), 'column' => 'id'))));
$this->widgetSchema->setNameFormat('dm_test_domain_translation_filters[%s]');
$this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);
$this->setupInheritance();
parent::setup();
}
示例6: setup
public function setup()
{
$this->setWidgets(array('name' => new sfWidgetFormFilterInput(), 'description' => new sfWidgetFormFilterInput(), 'media_id' => new sfWidgetFormDoctrineChoice(array('model' => 'DmMedia', 'add_empty' => true)), 'is_visible' => new sfWidgetFormChoice(array('choices' => array('' => dm::getI18n()->__('yes or no', array(), 'dm'), 1 => dm::getI18n()->__('yes', array(), 'dm'), 0 => dm::getI18n()->__('no', array(), 'dm'))))));
$this->setValidators(array('name' => new sfValidatorPass(array('required' => false)), 'description' => new sfValidatorPass(array('required' => false)), 'media_id' => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Media'), 'column' => 'id')), 'is_visible' => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0)))));
$this->widgetSchema->setNameFormat('dm_test_user_filters[%s]');
$this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);
$this->setupInheritance();
parent::setup();
}
示例7: configure
/**
* Configures the current validator.
*
* Available options:
*
* * date_format: A regular expression that dates must match
* * with_time: true if the validator must return a time, false otherwise
* * date_output: The format to use when returning a date (default to Y-m-d)
* * datetime_output: The format to use when returning a date with time (default to Y-m-d H:i:s)
* * date_format_error: The date format to use when displaying an error for a bad_format error (use date_format if not provided)
* * max: The maximum date allowed (as a timestamp)
* * min: The minimum date allowed (as a timestamp)
* * date_format_range_error: The date format to use when displaying an error for min/max (default to d/m/Y H:i:s)
*
* Available error codes:
*
* * bad_format
* * min
* * max
*
* @param array $options An array of options
* @param array $messages An array of error messages
*
* @see sfValidatorBase
*/
protected function configure($options = array(), $messages = array())
{
parent::configure($options, $messages);
$i18n = dm::getI18n();
$this->addMessage('bad_format', '"%value%" ' . $i18n->__('does not match the date format') . ' (%date_format%).');
$this->addMessage('max', $i18n->__('The date must be before') . ' %max%.');
$this->addMessage('min', $i18n->__('The date must be after') . ' %min%.');
// $this->addOption('date_format', $this->getDateFormat(dm::getUser()->getCulture()));
$this->addOption('context', dmContext::getInstance());
}
示例8: checkSlug
public function checkSlug($validator, $values)
{
if (!empty($values['slug'])) {
$values['slug'] = dmString::urlize($values['slug'], true);
$existingPageName = dmDb::query('DmPageTranslation t')->where('t.lang = ? AND t.slug = ?', array($this->object->lang, $values['slug']))->select('t.name')->fetchValue();
if ($existingPageName) {
$error = new sfValidatorError($validator, dm::getI18n()->__('The page "%1%" uses this slug', array('%1%' => $existingPageName)));
// throw an error bound to the password field
throw new sfValidatorErrorSchema($validator, array('slug' => $error));
}
}
return $values;
}
示例9: sortZones
protected function sortZones(array $zoneList)
{
$zones = array();
foreach ($zoneList as $position => $zoneId) {
$zones[$zoneId] = $position + 1;
}
try {
dmDb::table('DmZone')->doSort($zones);
} catch (Exception $e) {
if ($this->getUser()->can('system')) {
throw $e;
}
$this->getUser()->logError(dm::getI18n()->__('A problem occured when sorting the items'));
}
}
示例10: checkModuleAction
public function checkModuleAction($validator, $values)
{
if (!empty($values['module']) && !empty($values['action'])) {
foreach (array('module', 'action') as $key) {
$values[$key] = dmString::modulize(str_replace('-', '_', dmString::slugify(dmString::underscore($values[$key]))));
}
$existingPage = dmDb::query('DmPage p')->where('p.module = ? AND p.action = ? and p.record_id = ? AND p.id != ?', array($values['module'], $values['action'], $this->object->record_id, $this->object->id))->fetchRecord();
if ($existingPage) {
$error = new sfValidatorError($validator, dm::getI18n()->__('The page "%1%" uses this module.action', array('%1%' => $existingPage->name)));
// throw an error bound to the password field
throw new sfValidatorErrorSchema($validator, array('action' => $error));
}
}
return $values;
}
示例11: generateRow
protected function generateRow(myDoctrineRecord $record)
{
$row = array();
foreach ($this->fields as $field => $fieldName) {
try {
$cell = $this->generateCell($field, $record);
} catch (Exception $e) {
$cell = dm::getI18n()->__('Error');
if (sfConfig::get('sf_debug')) {
throw $e;
$cell .= ' ' . $e->getMessage();
}
}
$row[] = $cell;
}
return $row;
}
示例12: executeSaveSortReferers
public function executeSaveSortReferers(sfWebRequest $request)
{
$this->forward404Unless($module = $this->context->getModuleManager()->getModuleOrNull($request->getParameter('dm_module')));
$this->forward404Unless($refererModule = $this->context->getModuleManager()->getModuleOrNull($request->getParameter('dm_referer_module')));
$elements = $request->getParameter('dm_sort_element');
$currentPosition = 1;
foreach ($elements as $elementId => $position) {
$elements[$elementId] = $currentPosition++;
}
try {
$refererModule->getTable()->doSort($elements);
} catch (Exception $e) {
if ($this->getUser()->can('system')) {
throw $e;
}
$this->getUser()->logError(dm::getI18n()->__('A problem occured when sorting the items'), array(), true);
}
$this->getUser()->logInfo(dm::getI18n()->__('The items have been sorted successfully'), array(), true);
return $this->redirectBack();
}
示例13: doExport
protected function doExport(array $options)
{
/*
* get data in an array
*/
$exportClass = $options['exportClass'];
$export = new $exportClass($options['module']->getTable());
$data = $export->generate($options['format']);
/*
* transform into downloadable data
*/
switch ($options['extension']) {
default:
$csv = new dmCsvWriter(',', '"');
$csv->setCharset($options['encoding']);
$data = $csv->convert($data);
$mime = 'text/csv';
}
$this->download($data, array('file_name' => sprintf('%s-%s_%s.%s', dmConfig::get('site_name'), dm::getI18n()->__($options['module']->getName()), date('Y-m-d'), $options['extension']), 'mime_type' => sprintf('%s; charset=%s', $mime, $options['encoding'])));
}