コード例 #1
0
}
$tpl->assign('page_title', $title);
$tpl->assign('required', $required);
$tpl->assign('disabled', $disabled);
$tpl->assign('data', $contribution);
//TODO: remove
$tpl->assign('contribution', $contrib);
$tpl->assign('error_detected', $error_detected);
$tpl->assign('warning_detected', $warning_detected);
$tpl->assign('type_selected', $type_selected);
$tpl->assign('adh_selected', $id_adh);
if (isset($head_redirect)) {
    $tpl->assign('head_redirect', $head_redirect);
}
// contribution types
$ct = new ContributionsTypes();
$type_cotis_options = $ct->getList($type_selected == 1 && $id_adh != '' ? $contrib->isCotis() : null);
$tpl->assign('type_cotis_options', $type_cotis_options);
// members
$m = new Members();
$required_fields = array('id_adh', 'nom_adh', 'prenom_adh');
$members = $m->getList(false, $required_fields);
if (count($members) > 0) {
    foreach ($members as $member) {
        $pk = Adherent::PK;
        $sname = mb_strtoupper($member->nom_adh, 'UTF-8') . ' ' . ucwords(mb_strtolower($member->prenom_adh, 'UTF-8'));
        $adh_options[$member->{$pk}] = $sname;
    }
    $tpl->assign('adh_options', $adh_options);
}
$tpl->assign('require_calendar', true);
コード例 #2
0
 /**
  * Global setter method
  *
  * @param string $name  name of the property we want to assign a value to
  * @param object $value a relevant value for the property
  *
  * @return void
  */
 public function __set($name, $value)
 {
     if (in_array($name, $this->pagination_fields) || in_array($name, $this->memberslist_fields)) {
         parent::__set($name, $value);
     } else {
         Analog::log('[AdvancedMembersList] Setting property `' . $name . '`', Analog::DEBUG);
         $prop = '_' . $name;
         switch ($name) {
             case 'creation_date_begin':
             case 'creation_date_end':
             case 'modif_date_begin':
             case 'modif_date_end':
             case 'due_date_begin':
             case 'due_date_end':
             case 'birth_date_begin':
             case 'birth_date_end':
             case 'contrib_creation_date_begin':
             case 'contrib_creation_date_end':
             case 'contrib_begin_date_begin':
             case 'contrib_begin_date_end':
             case 'contrib_end_date_begin':
             case 'contrib_end_date_end':
                 if ($value !== null && trim($value) !== '') {
                     try {
                         $d = \DateTime::createFromFormat(_T("Y-m-d"), $value);
                         if ($d === false) {
                             throw new \Exception('Incorrect format');
                         }
                         $this->{$prop} = $d->format('Y-m-d');
                     } catch (\Exception $e) {
                         Analog::log('Incorrect date format for ' . $name . '! was: ' . $value, Analog::WARNING);
                     }
                 }
                 break;
             case 'contrib_min_amount':
             case 'contrib_max_amount':
                 if (is_float($value)) {
                     $this->{$prop} = $value;
                 } else {
                     if ($value !== null) {
                         Analog::log('Incorrect amount for ' . $name . '! ' . 'Should be a float (' . gettype($value) . ' given)', Analog::WARNING);
                     }
                 }
                 break;
             case 'show_public_infos':
                 if (is_numeric($value)) {
                     $this->{$prop} = $value;
                 } else {
                     Analog::log('[AdvancedMembersList] Value for property `' . $name . '` should be an integer (' . gettype($value) . ' given)', Analog::WARNING);
                 }
                 break;
             case 'status':
                 if (!is_array($value)) {
                     $value = array($value);
                 }
                 $this->_status = array();
                 foreach ($value as $v) {
                     if (is_numeric($v)) {
                         //check status existence
                         $s = new Status();
                         $res = $s->get($v);
                         if ($res !== false) {
                             $this->_status[] = $v;
                         } else {
                             Analog::log('Status #' . $v . ' does not exists!', Analog::WARNING);
                         }
                     } else {
                         Analog::log('[AdvancedMembersList] Value for status filter should be an ' . 'integer (' . gettype($v) . ' given', Analog::WARNING);
                     }
                 }
                 break;
             case 'contributions_types':
                 if (!is_array($value)) {
                     $value = array($value);
                 }
                 $this->_contributions_types = array();
                 foreach ($value as $v) {
                     if (is_numeric($v)) {
                         //check type existence
                         $s = new ContributionsTypes();
                         $res = $s->get($v);
                         if ($res !== false) {
                             $this->_contributions_types[] = $v;
                         } else {
                             Analog::log('Contribution type #' . $v . ' does not exists!', Analog::WARNING);
                         }
                     } else {
                         Analog::log('[AdvancedMembersList] Value for contribution type ' . 'filter should be an integer (' . gettype($v) . ' given', Analog::WARNING);
                     }
                 }
                 break;
             case 'payments_types':
                 if (!is_array($value)) {
                     $value = array($value);
                 }
                 $this->_payments_types = array();
                 foreach ($value as $v) {
                     if (is_numeric($v)) {
                         if ($v == Contribution::PAYMENT_OTHER || $v == Contribution::PAYMENT_CASH || $v == Contribution::PAYMENT_CREDITCARD || $v == Contribution::PAYMENT_CHECK || $v == Contribution::PAYMENT_TRANSFER || $v == Contribution::PAYMENT_PAYPAL) {
                             $this->_payments_types[] = $v;
                         } else {
                             Analog::log('Payment type #' . $v . ' does not exists!', Analog::WARNING);
                         }
                     } else {
                         Analog::log('[AdvancedMembersList] Value for payment type filter should be an ' . 'integer (' . gettype($v) . ' given', Analog::WARNING);
                     }
                 }
                 break;
             case 'free_search':
                 if (isset($this->_free_search['empty'])) {
                     unset($this->_free_search['empty']);
                 }
                 if (is_array($value)) {
                     if (isset($value['field']) && isset($value['search']) && isset($value['log_op']) && isset($value['qry_op']) && isset($value['idx'])) {
                         $id = $value['idx'];
                         unset($value['idx']);
                         $this->_free_search[$id] = $value;
                     } else {
                         Analog::log('[AdvancedMembersList] bad construct for free filter', Analog::WARNING);
                     }
                 } else {
                     Analog::log('[AdvancedMembersList] Value for free filter should be an ' . 'array (' . gettype($value) . ' given', Analog::WARNING);
                 }
                 break;
             default:
                 if (substr($name, 0, 4) === 'cds_' || substr($name, 0, 5) === 'cdsc_') {
                     if (is_array($value) || trim($value) !== '') {
                         if (isset($this->_contrib_dynamic['empty'])) {
                             unset($this->_contrib_dynamic['empty']);
                         }
                         $id = null;
                         if (substr($name, 0, 5) === 'cdsc_') {
                             $id = substr($name, 5, strlen($name));
                         } else {
                             $id = substr($name, 4, strlen($name));
                         }
                         $this->_contrib_dynamic[$id] = $value;
                     }
                 } else {
                     Analog::log('[AdvancedMembersList] Unable to set proprety `' . $name . '`', Analog::WARNING);
                 }
                 break;
         }
     }
 }