public function setup()
 {
     $photoTypeOptions = array();
     foreach (PhotoTypePeer::doSelect(new Criteria()) as $pt) {
         $photoTypeOptions[$pt->getName()] = $pt->getName();
     }
     $this->setWidgets(array('photo_type' => new sfWidgetFormChoiceMany(array("multiple" => true, "expanded" => true, "choices" => $photoTypeOptions)), 'ques1' => new sfWidgetFormTextarea(), 'ques2' => new sfWidgetFormTextarea(), 'other' => new sfWidgetFormTextarea(), 'ques3' => new sfWidgetFormTextarea()));
     $this->setValidators(array('photo_type' => new sfValidatorChoice(array("choices" => $photoTypeOptions, "required" => false, "multiple" => true)), 'ques1' => new sfValidatorString(array('required' => false)), 'ques2' => new sfValidatorString(array('required' => false)), 'other' => new sfValidatorString(array('required' => false)), 'ques3' => new sfValidatorString(array('required' => false))));
     $this->widgetSchema->setLabel('ques1', 'Please list specific photos you need, including, for group photos, number of groups and subjects in each.');
     $this->widgetSchema->setLabel('ques2', 'Please provide specific instructions for the photographer.');
     $this->widgetSchema->setLabel('ques3', 'Please describe in detail the event or story being photographed.');
     $this->widgetSchema->setNameFormat('job[%s]');
     $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);
     parent::setup();
 }
 public function setup()
 {
     $photoTypeOptions = array();
     foreach (PhotoTypePeer::doSelect(new Criteria()) as $pt) {
         $photoTypeOptions[$pt->getName()] = $pt->getName();
     }
     $this->setWidgets(array('id' => new sfWidgetFormInputHidden(), 'project_id' => new sfWidgetFormPropelChoice(array('model' => 'Project', 'add_empty' => true)), 'publication_id' => new sfWidgetFormPropelChoice(array('model' => 'Publication', 'add_empty' => true)), 'status_id' => new sfWidgetFormPropelChoice(array('model' => 'Status', 'add_empty' => true)), 'event' => new sfWidgetFormInput(), 'date' => new sfWidgetFormJQueryDate(), 'start_time' => new sfWidgetjQueryTimepickr(array(), array("size" => 7)), 'end_time' => new sfWidgetjQueryTimepickr(array(), array("size" => 7)), 'due_date' => new sfWidgetFormJQueryDate(), 'created_at' => new sfWidgetFormDateTime(), 'street' => new sfWidgetFormInput(), 'city' => new sfWidgetFormInput(), 'state' => new sfWidgetFormSelectUSState(), 'zip' => new sfWidgetFormInput(), 'contact_name' => new sfWidgetFormInput(), 'contact_email' => new sfWidgetFormInput(), 'contact_phone' => new sfWidgetFormInput(), 'estimate' => new sfWidgetFormInput(), 'photo_type' => new sfWidgetFormChoiceMany(array("multiple" => true, "choices" => $photoTypeOptions)), 'acct_num' => new sfWidgetFormInput(), 'dept_id' => new sfWidgetFormInput(), 'grant_id' => new sfWidgetFormInput(), 'other' => new sfWidgetFormInput(), 'ques1' => new sfWidgetFormTextarea(), 'ques2' => new sfWidgetFormTextarea(), 'ques3' => new sfWidgetFormTextarea(), 'slug' => new sfWidgetFormInput(), 'user_id' => new sfWidgetFormPropelChoice(array('model' => 'sfGuardUserProfile', 'add_empty' => true)), 'name' => new sfWidgetFormInput(), 'department' => new sfWidgetFormInput(), 'address' => new sfWidgetFormInput(), 'email' => new sfWidgetFormInput(), 'phone' => new sfWidgetFormInput(), 'clientId' => new sfWidgetFormInputHidden()));
     $this->widgetSchema->setLabel('publication_id', 'Publication');
     $this->widgetSchema->setLabel('project_id', 'Project');
     $this->widgetSchema->setLabel('dept_id', 'Department Id');
     $this->widgetSchema->setLabel('acct_num', 'Account Num');
     $this->widgetSchema->setLabel('ques1', 'Please list specific photos you need, including, for group photos, number of groups and subjects in each.');
     $this->widgetSchema->setLabel('ques2', 'Please provide specific instructions for the photographer.');
     $this->widgetSchema->setLabel('ques3', 'Please describe in detail the event or story being photographed.');
     $this->widgetSchema->setLabel('estimate', 'Shoot Fee');
     $this->widgetSchema->setLabel('contact_name', 'Contact Name<span class="required">*</span>');
     $this->widgetSchema->setLabel('contact_email', 'Contact Email<span class="required">*</span>');
     $this->widgetSchema->setLabel('contact_phone', 'Contact Phone<span class="required">*</span>');
     $this->widgetSchema->setLabel('event', 'Event/Subject<span class="required">*</span>');
     $this->widgetSchema->setLabel('street', 'Street<span class="required">*</span>');
     $this->widgetSchema->setLabel('city', 'City<span class="required">*</span>');
     $this->widgetSchema->setLabel('state', 'State<span class="required">*</span>');
     $this->widgetSchema->setLabel('zip', 'Zipcode<span class="required">*</span>');
     $this->widgetSchema->setLabel('photo_type', 'Photo Type<small>Select multiple with click+crtl</small>');
     $this->widgetSchema['state']->setDefault("MA");
     $this->widgetSchema['now'] = new sfWidgetFormInputHidden();
     $this->widgetSchema['now']->setDefault(time());
     $this->widgetSchema['clientId']->setDefault("-1");
     $this->setValidators(array('id' => new sfValidatorPropelChoice(array('model' => 'Job', 'column' => 'id', 'required' => false)), 'project_id' => new sfValidatorPropelChoice(array('model' => 'Project', 'column' => 'id', 'required' => false)), 'publication_id' => new sfValidatorPropelChoice(array('model' => 'Publication', 'column' => 'id', 'required' => false)), 'status_id' => new sfValidatorPropelChoice(array('model' => 'Status', 'column' => 'id', 'required' => false)), 'event' => new sfValidatorString(array('max_length' => 64, 'required' => false)), 'date' => new sfValidatorDate(array('required' => false)), 'start_time' => new sfValidatorDateTime(array('required' => false)), 'end_time' => new sfValidatorDateTime(array('required' => false)), 'due_date' => new sfValidatorDateTime(array('required' => false)), 'created_at' => new sfValidatorDateTime(array('required' => false)), 'street' => new sfValidatorString(array('max_length' => 64, 'required' => false)), 'city' => new sfValidatorString(array('max_length' => 64, 'required' => false)), 'state' => new sfValidatorString(array('max_length' => 64, 'required' => false)), 'zip' => new sfValidatorInteger(array('required' => false)), 'contact_name' => new sfValidatorString(array('max_length' => 45, 'required' => false)), 'contact_email' => new sfValidatorEmail(array('required' => true)), 'contact_phone' => new sfValidatorString(array('max_length' => 45, 'required' => false)), 'estimate' => new sfValidatorInteger(array('required' => false)), 'photo_type' => new sfValidatorChoice(array("choices" => $photoTypeOptions, "multiple" => true, "required" => false)), 'acct_num' => new sfValidatorString(array('max_length' => 32, 'required' => false)), 'dept_id' => new sfValidatorString(array('max_length' => 32, 'required' => false)), 'grant_id' => new sfValidatorString(array('max_length' => 32, 'required' => false)), 'other' => new sfValidatorString(array('max_length' => 255, 'required' => false)), 'ques1' => new sfValidatorString(array('required' => false)), 'ques2' => new sfValidatorString(array('required' => false)), 'ques3' => new sfValidatorString(array('required' => false)), 'slug' => new sfValidatorString(array('max_length' => 255, 'required' => false)), 'user_id' => new sfValidatorPropelChoice(array('model' => 'sfGuardUserProfile', 'column' => 'id', 'required' => false)), 'name' => new sfValidatorString(array('max_length' => 45, 'required' => false)), 'department' => new sfValidatorString(array('max_length' => 255, 'required' => false)), 'address' => new sfValidatorString(array('max_length' => 255, 'required' => false)), 'email' => new sfValidatorEmail(array('required' => false)), 'phone' => new sfValidatorString(array('max_length' => 32, 'required' => false)), 'clientId' => new sfValidatorNumber(array('required' => false))));
     $this->validatorSchema['now'] = new sfValidatorDate();
     $this->validatorSchema['event']->setOption('required', true);
     $this->validatorSchema['street']->setOption('required', true);
     $this->validatorSchema['city']->setOption('required', true);
     $this->validatorSchema['state']->setOption('required', true);
     $this->validatorSchema['zip']->setOption('required', true);
     $this->validatorSchema['contact_name']->setOption('required', true);
     $this->validatorSchema['contact_phone']->setOption('required', true);
     $this->validatorSchema['contact_phone']->setOption('min_length', 3);
     $this->validatorSchema['state'] = new sfValidatorChoice(array('choices' => sfWidgetFormSelectUSState::getStateAbbreviations()));
     $this->widgetSchema->setNameFormat('requestjob[%s]');
     $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);
     $this->validatorSchema->setPostValidator(new sfValidatorCallback(array('callback' => array($this, "checkJobTimes"))));
     parent::setup();
 }
Пример #3
0
 /**
  * Retrieve multiple objects by pkey.
  *
  * @param      array $pks List of primary keys
  * @param      PropelPDO $con the connection to use
  * @throws     PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function retrieveByPKs($pks, PropelPDO $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(PhotoTypePeer::DATABASE_NAME, Propel::CONNECTION_READ);
     }
     $objs = null;
     if (empty($pks)) {
         $objs = array();
     } else {
         $criteria = new Criteria(PhotoTypePeer::DATABASE_NAME);
         $criteria->add(PhotoTypePeer::ID, $pks, Criteria::IN);
         $objs = PhotoTypePeer::doSelect($criteria, $con);
     }
     return $objs;
 }