当前位置: 首页>>代码示例>>PHP>>正文


PHP People::getTypes方法代码示例

本文整理汇总了PHP中People::getTypes方法的典型用法代码示例。如果您正苦于以下问题:PHP People::getTypes方法的具体用法?PHP People::getTypes怎么用?PHP People::getTypes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在People的用法示例。


在下文中一共展示了People::getTypes方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: configure

 public function configure()
 {
     $this->useFields(array('is_physical', 'family_name', 'activity_date_to', 'activity_date_from'));
     $this->addPagerItems();
     $this->widgetSchema['family_name'] = new sfWidgetFormInput();
     $this->widgetSchema['is_physical'] = new sfWidgetFormInputHidden();
     $this->setDefault('is_physical', true);
     $yearsKeyVal = range(intval(sfConfig::get('dw_yearRangeMin')), intval(sfConfig::get('dw_yearRangeMax')));
     $minDate = new FuzzyDateTime(strval(min($yearsKeyVal) . '/01/01'));
     $maxDate = new FuzzyDateTime(strval(max($yearsKeyVal) . '/12/31'));
     $dateLowerBound = new FuzzyDateTime(sfConfig::get('dw_dateLowerBound'));
     $dateUpperBound = new FuzzyDateTime(sfConfig::get('dw_dateUpperBound'));
     $maxDate->setStart(false);
     $this->widgetSchema['activity_date_from'] = new widgetFormJQueryFuzzyDate($this->getDateItemOptions(), array('class' => 'from_date'));
     $this->widgetSchema['activity_date_to'] = new widgetFormJQueryFuzzyDate($this->getDateItemOptions(), array('class' => 'to_date'));
     $this->validatorSchema['activity_date_from'] = new fuzzyDateValidator(array('required' => false, 'from_date' => true, 'min' => $minDate, 'max' => $maxDate, 'empty_value' => $dateLowerBound), array('invalid' => 'Date provided is not valid'));
     $this->validatorSchema['activity_date_to'] = new fuzzyDateValidator(array('required' => false, 'from_date' => false, 'min' => $minDate, 'max' => $maxDate, 'empty_value' => $dateUpperBound), array('invalid' => 'Date provided is not valid'));
     $people_types = array('' => '');
     $types = People::getTypes();
     foreach ($types as $flag => $name) {
         $people_types[strval($flag)] = $name;
     }
     $this->widgetSchema['people_type'] = new sfWidgetFormChoice(array('choices' => $people_types));
     $this->widgetSchema['people_type']->setLabel('Role');
     $this->validatorSchema['people_type'] = new sfValidatorChoice(array('required' => false, 'choices' => array_keys($people_types)));
     $this->validatorSchema->setPostValidator(new sfValidatorSchemaCompare('activity_date_from', '<=', 'activity_date_to', array('throw_global_error' => true), array('invalid' => 'The to date cannot be above the "end" date.')));
 }
开发者ID:naturalsciences,项目名称:Darwin,代码行数:27,代码来源:PeopleFormFilter.class.php

示例2: executeView

 public function executeView(sfWebRequest $request)
 {
     $this->people = Doctrine::getTable('People')->find($request->getParameter('id'));
     $this->forward404Unless($this->people, 'People not Found');
     $this->form = new PeopleForm($this->people);
     $this->types = People::getTypes();
     $this->loadWidgets();
 }
开发者ID:naturalsciences,项目名称:Darwin,代码行数:8,代码来源:actions.class.php

示例3: dirname

<?php

include dirname(__FILE__) . '/../../bootstrap/Doctrine.php';
$t = new lime_test(20, new lime_output_color());
$p = new People();
$p->setFormatedName('Mr Poilux Duchesne');
$t->info('Test "__toString" method to get formated name of given person');
$t->is($p->__toString(), 'Mr Poilux Duchesne', 'to string get "FormatedName": "Mr Poilux Duchesne"');
$t->info('Get static list of people types');
$types = People::getTypes();
$t->is($types['identifier'], 'Identifier', 'We have "Identifier" as Type');
$t->is($types['collector'], 'Collector', 'We have "Collector" as Type');
$t->info('DB people types tests');
$p->setBirthDate('05/12/1908');
$t->is($p->getBirthDate(), array('year' => '', 'month' => '', 'day' => '', 'hour' => '', 'minute' => '', 'second' => ''), 'We have set a null birth date');
$p->setBirthDate(new FuzzyDateTime('1975/02/24 13:12:11', 48));
$t->is($p->getBirthDate(), array('year' => '1975', 'month' => '02', 'day' => '', 'hour' => '', 'minute' => '', 'second' => ''), 'We have set a birth date');
$t->is($p->getBirthDateObject()->format('y/M'), '75/Feb', 'We get a birth date object');
$t->is($p->getBirthDateMasked(), '<em>24</em>/02/1975', 'We get a birth date masked');
$p->setBirthDate('1900/05/2');
$t->is($p->getBirthDate(), array('year' => '1900', 'month' => '05', 'day' => '', 'hour' => '', 'minute' => '', 'second' => ''), 'We have set a End date');
$p->setEndDate(new FuzzyDateTime('1975/03/24 13:12:11', 48));
$t->is($p->getEndDate(), array('year' => '1975', 'month' => '03', 'day' => '', 'hour' => '', 'minute' => '', 'second' => ''), 'We have set a End date');
$t->is($p->getEndDateObject()->format('y/M'), '75/Mar', 'We get a End date object');
$t->is($p->getEndDateMasked(), '<em>24</em>/03/1975', 'We get a End date masked');
$p->setEndDate('1975/05/2');
$t->is($p->getEndDate(), array('year' => '1975', 'month' => '05', 'day' => '', 'hour' => '', 'minute' => '', 'second' => ''), 'We have set a End date');
$p->setActivityDateFrom(new FuzzyDateTime('1975/04/24 13:12:11', 48));
$t->is($p->getActivityDateFrom(), array('year' => '1975', 'month' => '04', 'day' => '', 'hour' => '', 'minute' => '', 'second' => ''), 'We have set a activity from date');
$t->is($p->getActivityDateFromObject()->format('y/M'), '75/Apr', 'We get a activity from date object');
$t->is($p->getActivityDateFromMasked(), '<em>24</em>/04/1975', 'We get a activity from date masked');
开发者ID:naturalsciences,项目名称:Darwin,代码行数:31,代码来源:PeopleTest.php


注:本文中的People::getTypes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。