1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
| <?php
/**
* Mastergeeks
*
* @author Goaper Loic
* @category Mastergeeks
* @package My_Application_Forms
* @subpackage System
* @version 1.0
*/
/**
* @category Mastergeeks
* @package My_Application_Forms
* @subpackage System
*/
class Form_Admin_Mail extends My_Zend_Form
{
public function init()
{
$this->setMethod('POST');
Zend_Debug::dump($this->coatchId); die(); // test de la vue de mon _getParam('coatchId') -> Zend Debug me retourne NULL alors qu il devrait me renvoyer '1'
$Model_Admin_Coatch = new Model_Admin_Coatch();
$Model_Admin_Coatch_Link = new Model_Admin_Coatch_Link();
$Model_Admin_Categories = new Model_Admin_Categories();
$Model_Admin_Categories_Link = new Model_Admin_Categories_Link();
$Model_Admin_User = new Model_Admin_User();
$My_Model_User_Accounts = new My_Model_User_Accounts(My_Lib_System_Db_Model_My_Abstract::getMasterAdapter());
$selectPlayer = $Model_Admin_Coatch->select()
->setIntegrityCheck(false)
->from(array('coatch' => $Model_Admin_Coatch->info('name')), array('coatch_id'))
->join(array('link' => $Model_Admin_Categories_Link->info('name')), 'coatch.coatch_id = link.coatch_id', array())
->join(array('cat' => $Model_Admin_Categories->info('name')), 'link.categorie_id = cat.categorie_id', array('name'))
->join(array('user' => $Model_Admin_User->info('name')), 'cat.categorie_id = user.categorie_id', array('last_name', 'first_name', 'user_id', 'mail'))
->join(array('acc' => $My_Model_User_Accounts->info('from')), 'coatch.account_id = acc.account_id', array('coatchLastName' => 'last_name', 'coatchFirstName' => 'first_name'))
->where('link.coatch_id IN (?)', '1')//obliger de l'ecrire en dur sinon sa ne fonctionne pas !
->order('user.categorie_id ASC');
$Model_Admin_Categories = new Model_Admin_Categories();
$row = $Model_Admin_Coatch->fetchAll($selectPlayer);
$multiOption = array();
foreach($row as $category)
{
$multiOption[$category->mail] = $category->last_name." ".$category->first_name;
}
$player = new Zend_Form_Element_MultiCheckbox('mail');
$player -> setLabel('Selectionne le ou les mails à envoyer')
->setMultiOptions($multiOption)
->setRequired(true);
$content = new Zend_Form_Element_Textarea('content');
$content ->setLabel('Contenu du mail')
->setRequired(true);
$submit = new Zend_Form_Element_Submit('Envoyer');
$this->addElements(array($player, $content, $submit));
}
} |
Partager