[symfony-users] Change multiple checkboxes to multiple integers as percentages

2010-08-25 Thread Mihai Rusoaie
Hello all!

I am collecting some demografic data with checkboxes right now:

0-4 years, 5-9 years, 10-14 years, etc.

The user checks which age ranges matches the demographic data.

Here is the schema:

bdn_location: - table with the locations

bdn_age:
  id:  ~
  age: { type: varchar(10) }

bdn_location_age:
  location_id: { type: integer, primaryKey: true,
foreignReference: id, foreignTable: bdn_location, onDelete: cascade,
onUpdate: cascade, required: true }
  age_id:  { type: integer, primaryKey: true,
foreignReference: id, foreignTable: bdn_age, onDelete: cascade,
onUpdate: cascade, required: true }

What I want is to add percentages to each entry in the
bdn_location_age object:

10% are between 0 and 4 years, 30% are between 10 and 14 years and 60
percent are between 20 and 24 years.

Is there any chance I can create the forms automatically just by
adding a percentage field to the bdn_location_age table? If yes, how
do I generate and process the form?

Is there another simpler way of doing this?

Thank you!

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups symfony users group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


Re: [symfony-users] edit id in admin

2010-05-22 Thread Mihai Rusoaie
Hello!

Thanks, Gabriel! I will try that!

Tom: we have a very twisted sales team :)

We send the sales guys in the field with pre-filled contracts to be signed.
We number these contracts each morning with consecutive numbers: 1,2,3,4 and
we insert them in the DB and associate with potential customers. When they
come back to the office in the evening we realise that customer with
contract 2 changed his mind and do not want to sign, so the sales guy
deletes it from the database. But the accounting cannot accept that a
contract is missing from the numbering. And the MySQL autoincrement does not
count that a number is missing so the next contract will have no. 5. Which
has to be changed by our back-office support to 2. There would be another
way not to use the id for contract number; but it's easier and more
intuitive...

Hope I was clear,

Mihai Rusoaie
+40 72 RUSOAIE
www.rusoaie.com


On Fri, May 21, 2010 at 9:14 PM, Tom Haskins-Vaughan 
t...@templestreetmedia.com wrote:

 I'm intrigued...why would you want to change the id?

 On Fri, May 21, 2010 at 1:51 PM, Mihai Rusoaie mi...@rusoaie.com wrote:
  Hello!
 
  When I insert an new object in the database, I want the id to be
  assigned automatically (autoincrement).
 
  In the edit form, however, I want to be able to change the id.
 
  I tried to override the BaseForm class widget and validator with:
 
 $this-widgetSchema['id'] = new sfWidgetFormInputText();
 $this-validatorSchema['id'] = new sfValidatorString();
 
   but with no success (I could see field 'id' in my form, but symfony
  won't write it in the DB).
 
  Thank you!
 
  Mihai
 
  --
  If you want to report a vulnerability issue on symfony, please send it to
 security at symfony-project.com
 
  You received this message because you are subscribed to the Google
  Groups symfony users group.
  To post to this group, send email to symfony-users@googlegroups.com
  To unsubscribe from this group, send email to
  symfony-users+unsubscr...@googlegroups.comsymfony-users%2bunsubscr...@googlegroups.com
  For more options, visit this group at
  http://groups.google.com/group/symfony-users?hl=en
 

 --
 If you want to report a vulnerability issue on symfony, please send it to
 security at symfony-project.com

 You received this message because you are subscribed to the Google
 Groups symfony users group.
 To post to this group, send email to symfony-users@googlegroups.com
 To unsubscribe from this group, send email to
 symfony-users+unsubscr...@googlegroups.comsymfony-users%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/symfony-users?hl=en


-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups symfony users group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


[symfony-users] edit id in admin

2010-05-21 Thread Mihai Rusoaie
Hello!

When I insert an new object in the database, I want the id to be
assigned automatically (autoincrement).

In the edit form, however, I want to be able to change the id.

I tried to override the BaseForm class widget and validator with:

$this-widgetSchema['id'] = new sfWidgetFormInputText();
$this-validatorSchema['id'] = new sfValidatorString();

 but with no success (I could see field 'id' in my form, but symfony
won't write it in the DB).

Thank you!

Mihai

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups symfony users group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


[symfony-users] embedded form - save an extra relation

2010-04-08 Thread Mihai Rusoaie
Hello!

I am trying to embed an user profile in a company form. My question is
where can I save the relation between the UserProfile and the Client
(this is stored in an extra table). Also my UserProfile form does not
save (I think it has something to do with the fact that the embedded
form is not saving as sfGuardUserProfile, but as BdnClientContactForm.
How can I debug this?

//BdnClientForm.class.php
public function addClientContact($num) {
$client_contact = new sfGuardUserProfile();
$client_contact_form = new
sfGuardUserProfileForm($client_contact);
$this-embeddedForms['client_contacts']-embedForm($num,
$client_contact_form);
$this-embedForm('client_contacts', $this-
embeddedForms['client_contacts']);
}

public function addClientContactForm($key) {
$client_contacts = new sfGuardUserProfile();
$this-embeddedForms['client_contacts']-embedForm($key, new
sfGuardUserProfileForm($client_contacts));
$this-embedForm('client_contacts', $this-
embeddedForms['client_contacts']);
}

public function bind(array $taintedValues = null, array
$taintedFiles = null) {
if(isset($taintedValues['client_contacts']))
foreach($taintedValues['client_contacts'] as $key=$form)
{
if (false === $this-embeddedForms['client_contacts']-
offsetExists($key)) {
$this-addClientContactForm($key);
}
}
parent::bind($taintedValues, $taintedFiles);
}

public function configure() {
$client_contacts_forms = new sfForm();
$this-embedForm('client_contacts', $client_contacts_forms);
$this-widgetSchema['client_contacts']-setLabel('Contact
persons ');
..}


//actions.class.php
   public function executeAddClientContactForm(sfWebRequest $request)
{
$this-forward404Unless($request-isXmlHttpRequest());
if ($client = BdnClientPeer::retrieveByPk($request-
getParameter('id'))) {
$form = new BdnClientForm($client);
}
else {
$form = new BdnClientForm();
}
$number = $request-getParameter('num')+1;
$key = 'client_contact'.$number;
$form-addClientContactForm($key);
return $this-
renderPartial('addClientContactForm',array('field' =
$form['client_contacts'][$key], 'num' = $number));
}

Thank you!

Mihai Rusoaie
+40 72 RUSOAIE
www.rusoaie.com

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups symfony users group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

To unsubscribe, reply using remove me as the subject.


Re: [symfony-users] access object from validator

2010-04-07 Thread Mihai Rusoaie
Hello Cristophe!

Thanks for the hint, it was very useful! I managed to pass some of the
object's variables from the Form Class to the Validator Class through its
constructor. It works just fine:

// in the form class
$this-mergePostValidator(
new
ClientStatusValidatorSchema($this-getObject()-getUserId(),
$this-getObject()-getAvailability(),
$this-getObject()-countBdnClientContacts())
);

// in the validator class
class ClientStatusValidatorSchema extends sfValidatorSchema {

public function __construct($_current_user, $_availability,
$_contact_persons)
{
 $this-current_user = $_current_user;
 $this-contact_persons = $_contact_persons;
 $this-availability = $_availability;
}

private $current_user;
private $availability;
private $contact_persons;

protected function doClean($values) {

$errorSchema = new sfValidatorErrorSchema($this);

if(($this-current_user !=
sfContext::getInstance()-getUser()-getGuardUser()-getId())
($this-current_user != 0))
$errorSchema-addError(new sfValidatorError($this, 'This is not
your client!'), 'user_id');
//...



Regards,

Mihai Rusoaie
+40 72 RUSOAIE
www.rusoaie.com


On Tue, Apr 6, 2010 at 1:11 PM, NOOVEO - Christophe Brun
c.b...@nooveo.frwrote:

 Hi. I'm #far# from mastering Symfony but here are my two cents. I would say
 that validators are not intented to know anything else than the bunch of
 values to clean and validate, hence I don't see any way for them to know the
 form's object. But the form has access to all the values you need : tainted
 values, cleaned values, his object. Hence, I suppose that you should process
 your comparisons somewhere in the form's method, maybe doBind() or
 doUpdateObject().


 -Message d'origine-
 De : symfony-users@googlegroups.com [mailto:symfony-us...@googlegroups.com]
 De la part de Mihai Rusoaie
 Envoyé : jeudi 1 avril 2010 10:44
 À : symfony users
 Objet : [symfony-users] access object from validator

 Hello, all!

 Is there any way to access my object (the one before the form post) from a
 sfValidatorSchema ?

 When I had my validator inside the Form.class.php file, I could access the
 object with $this-getObject(), but from the sfValidatorSchema class I
 cannot access it like this.

 I need to compare the submitted values from a form with the previous
 values. Is there any other way to do this than to access the original object
 from the validator?

 Thank you!

 --
 If you want to report a vulnerability issue on symfony, please send it to
 security at symfony-project.com

 You received this message because you are subscribed to the Google Groups
 symfony users group.
 To post to this group, send email to symfony-users@googlegroups.com To
 unsubscribe from this group, send email to
 symfony-users+unsubscr...@googlegroups.comsymfony-users%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/symfony-users?hl=en

 To unsubscribe, reply using remove me as the subject.


 --
 If you want to report a vulnerability issue on symfony, please send it to
 security at symfony-project.com

 You received this message because you are subscribed to the Google
 Groups symfony users group.
 To post to this group, send email to symfony-users@googlegroups.com
 To unsubscribe from this group, send email to
 symfony-users+unsubscr...@googlegroups.comsymfony-users%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/symfony-users?hl=en


-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups symfony users group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


[symfony-users] access object from validator

2010-04-01 Thread Mihai Rusoaie
Hello, all!

Is there any way to access my object (the one before the form post)
from a sfValidatorSchema ?

When I had my validator inside the Form.class.php file, I could access
the object with $this-getObject(), but from the sfValidatorSchema
class I cannot access it like this.

I need to compare the submitted values from a form with the previous
values. Is there any other way to do this than to access the original
object from the validator?

Thank you!

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups symfony users group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

To unsubscribe, reply using remove me as the subject.


[symfony-users] Adding a relationship field in a form

2010-03-23 Thread Mihai Rusoaie
Hello!

I have 3 models: client, person and client_person:

  person:
id: ~
name:   { type: varchar(100), required: true, index:
unique }
...

  client:
id: ~
name: { type: varchar(255) }


  client_person:
client_id:  { type: integer, foreignTable: client,
foreignReference: id, required: true }
person_id:{ type: integer, foreignTable: person,
foreignReference: id, required: true}

What I want: in the admin generator, when I edit the person to include
a field client and then when saving (in doSave) to update both
tables (person and client_person) in order to create the person-client
relationship automatically, without the user having to input a row in
the client_person module. Any hints on how I can do this?

Thank you!

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups symfony users group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

To unsubscribe from this group, send email to 
symfony-users+unsubscribegooglegroups.com or reply to this email with the words 
REMOVE ME as the subject.


[symfony-users] foreign key relations in admin generator

2010-03-17 Thread Mihai Rusoaie
Hello, all!

Can you give me a hint on how can I display a name from a foreign
table in the list display view in a generated backend. To be more
precise, here is the schema:

client:
   id:   ~
   name: { type: varchar(255), required: true, index:
unique }

contract:
   id: ~
   client_id:  { type: integer, foreignTable: client,
foreignReference: id, required: true }

In the contract generated admin list view I want to display the name
of the client:

  list:
title: Lista contracte
display: [id, client_id, =client_name, sign_date, start_date]


In order to do this, I can create a partial client_name.php, but I
don't have access to the Client object from here...

Can you please give me a hint how else I can do this?

Thank you,

Mihai

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups symfony users group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en


[symfony-users] Backend Ajax interface to insert related database entries

2009-09-22 Thread Mihai Rusoaie

Hello!

I am using 3 tables/models: company, contact_persons,
company_contact_persons.

- company contains companies
- contact_persons contains people and their contact details (phone,
email, etc)
- company_contact_persons relates a company to one or several contact
persons

Is it possible, in the backend, to integrate the contact_persons and
the company_contact_persons modules as ajax modules in the company
module?

To be more specific, what I want is a simpler interface for the users:
when they introduce a company, they can add as many people they want
and connect them to the company profile from the backend company
module.

Thank you,

Mihai Rusoaie
+40 72 RUSOAIE
mi...@rusoaie.com
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
symfony users group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~--~~~~--~~--~--~---



[symfony-users] Re: static pages module

2009-09-14 Thread Mihai RUSOAIE

Hello!

Thanks for the quick reply. How can I generate a module without a model?

-bash-3.2$ ./symfony propel:generate-module frontend static


  The execution of task propel:generate-module failed.
  - Not enough arguments.


symfony propel:generate-module [--theme=...] [--generate-in-cache] 
[--non-verbose-templates] [--with-show] [--singular=...] [--plural=...] 
[--route-prefix=...] [--with-propel-route] [--env=...] application 
module model


Mihai Rusoaie
e-Business Consultant
Mobile: +40 72 RUSOAIE
Web: http://mihai.rusoaie.com
- Original Message - 
From: Gábor Fási maerl...@gmail.com
To: symfony-users@googlegroups.com
Sent: Sunday, September 13, 2009 9:50 PM
Subject: [symfony-users] Re: static pages module



Just like any other module: your modules need not represent your
models. Just create a new module, and don't use any models there :)

Gábor

On Sun, Sep 13, 2009 at 18:47, Mihai Rusoaie mi...@rusoaie.com wrote:

 Hello!

 I am following the tutorial for creating static pages at
 http://trac.symfony-project.org/wiki/HowtoServeStaticContent

 My question is: how can I generate a module without a model (for the
 static module I don't need a model, do I)?

 Thank you!

 Mihai Rusoaie
 e-Business Consultant
 Mobile: +40 72 RUSOAIE
 Web: http://mihai.rusoaie.com
 





--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
symfony users group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~--~~~~--~~--~--~---



[symfony-users] sfGuardUser restrict access only to certain modules

2009-09-14 Thread Mihai RUSOAIE
Hello!

I am trying to restrict access based on user login to the modules 'clients' and 
'contracts' and allow free access to 'static' module which has action 'index' 
and content 'about' and 'clients'.

From the documentation of sfGuard I can see that I can restrict acces to an 
action with credentials:

index:
  is_secure:  on
  credentials:  selling_team

My users are ordered by groups in my application.

I would like to restrict access like this:

module static: do not require login
modules clients and contracts: require login and the user must be in the group 
selling_team

Also, can I restrict module actions to certain groups of users ? Like the 
selling team to be able to edit customer's infromation, and production team to 
be able only to view it?

Could someone point me in the documentation where user group access to modules 
is explained?

Thank you!

Mihai Rusoaie
e-Business Consultant
Mobile: +40 72 RUSOAIE
Web: http://mihai.rusoaie.com
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
symfony users group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~--~~~~--~~--~--~---



[symfony-users] sfGuard backend/admin module for managing users

2009-09-14 Thread Mihai RUSOAIE
Hello!

(Thanks to Alecs for the prompt reply to my previous question regarding sfGuard)

I have followed the instructions at 
http://trac.symfony-project.org/wiki/sfGuardPluginExtraDocumentation

Is there any way to keep all the information in the same form/module: user, 
password, group and profile?

Before I inserted the additional profile fields, I could subscribe the user to 
several groups directly from the backend sf_guard_user module. Now I can edit 
the username, password and all the additional profile data I added, but I 
cannot edit the group membership.

Thank you!

Mihai Rusoaie
e-Business Consultant
Mobile: +40 72 RUSOAIE
Web: http://mihai.rusoaie.com
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
symfony users group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~--~~~~--~~--~--~---



[symfony-users] static pages module

2009-09-13 Thread Mihai Rusoaie

Hello!

I am following the tutorial for creating static pages at
http://trac.symfony-project.org/wiki/HowtoServeStaticContent

My question is: how can I generate a module without a model (for the
static module I don't need a model, do I)?

Thank you!

Mihai Rusoaie
e-Business Consultant
Mobile: +40 72 RUSOAIE
Web: http://mihai.rusoaie.com
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
symfony users group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~--~~~~--~~--~--~---



[symfony-users] generate static pages

2009-09-13 Thread Mihai RUSOAIE
Hello!

I am following the tutorial for creating static pages at 
http://trac.symfony-project.org/wiki/HowtoServeStaticContent

My question is: how can I generate a module without a model (for the static 
module I don't need a model, do I)?

Thank you!

Mihai Rusoaie
e-Business Consultant
Mobile: +40 72 RUSOAIE
Web: http://mihai.rusoaie.com
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
symfony users group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~--~~~~--~~--~--~---



[symfony-users] generated admin module with default template

2009-09-01 Thread Mihai Rusoaie

Hello!

How can I generate an admin module, but keep the default template (the
one that appears in the modules generated with generate-admin)

Thank you!

Mihai Rusoaie
e-Business Consultant
Mobile: +40 72 RUSOAIE
Web: http://mihai.rusoaie.com
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
symfony users group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~--~~~~--~~--~--~---



[symfony-users] date picker

2009-08-28 Thread Mihai RUSOAIE

Hello all!

Can I use sfWidgetFormJQueryDate from sfFormExtraPlugin directly in the 
template? And maybe disable clicking on some of the days?

I need a date picker, but restricted on some days. Is that possible with 
some plugin/widget, or I have to write one myself?

Thank you,

Mihai Rusoaie
e-Business Consultant
Mobile: +40 72 RUSOAIE
Web: http://mihai.rusoaie.com 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
symfony users group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~--~~~~--~~--~--~---



[symfony-users] multiple select in a single DB field

2009-08-27 Thread Mihai Rusoaie

Hello!

Can I store a multiple select in a single database field?

I don't need too many fields in the multiple select (about 5).

Is there any way to do this using sfWidgetFormChoice and
sfValidatorChoice in Symfony 1.2?

If yes, what should be the schema field type and what objects to use?

Thank you!

Mihai

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
symfony users group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~--~~~~--~~--~--~---