コード例 #1
0
ファイル: doandget_export.php プロジェクト: Killerfun/galette
 $fields = array();
 $headers = array();
 foreach ($members_fields as $k => $f) {
     if ($k !== 'mdp_adh' && $export_fields === null || is_array($export_fields) && in_array($k, $export_fields)) {
         if ($visibles[$k] == FieldsConfig::VISIBLE) {
             $fields[] = $k;
             $labels[] = $f['label'];
         } else {
             if (($login->isAdmin() || $login->isStaff() || $login->isSuperAdmin()) && $visibles[$k] == FieldsConfig::ADMIN) {
                 $fields[] = $k;
                 $labels[] = $f['label'];
             }
         }
     }
 }
 $members = new Members($filters);
 $members_list = $members->getArrayList($filters->selected, null, false, false, $fields, true);
 $s = new Status();
 $statuses = $s->getList();
 $t = new Titles();
 $titles = $t->getList($zdb);
 foreach ($members_list as &$member) {
     if (isset($member->id_statut)) {
         //add textual status
         $member->id_statut = $statuses[$member->id_statut];
     }
     if (isset($member->titre_adh)) {
         //add textuel title
         $member->titre_adh = $titles[$member->titre_adh]->short;
     }
     //handle dates
コード例 #2
0
ファイル: ajax_recipients.php プロジェクト: Killerfun/galette
 * @author    Johan Cwiklinski <*****@*****.**>
 * @copyright 2011-2014 The Galette Team
 * @license   http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version
 * @version   SVN: $Id$
 * @link      http://galette.tuxfamily.org
 * @since     Available since 0.7dev - 2011-09-13
 */
use Analog\Analog;
use Galette\Repository\Members;
require_once 'includes/galette.inc.php';
if (!$login->isLogged() || !$login->isAdmin() && !$login->isStaff()) {
    Analog::log('Trying to display ajax_recipients.php without appropriate permissions', Analog::INFO);
    die;
}
$mailing = unserialize($session['mailing']);
$m = new Members();
$members = $m->getArrayList($_POST['recipients'], null, false, true, null, false, false, true);
$mailing->setRecipients($members);
$session['mailing'] = serialize($mailing);
//let's generate html for return
$html = '';
if (count($mailing->recipients) > 0) {
    $html = '<p id="recipients_count">' . preg_replace('/%s/', count($mailing->recipients), _T("You are about to send an e-mail to <strong>%s members</strong>")) . '</p>';
    if (count($mailing->unreachables)) {
        $html .= '<p id="unreachables_count"><strong>' . count($mailing->unreachables) . ' ' . (count($mailing->unreachables) != 1 ? _T("unreachable members:") : _T("unreachable member:")) . '</strong><br/>' . _T("Some members you have selected have no e-mail address. However, you can generate envelope labels to contact them by snail mail.") . '<br/><a id="btnlabels" class="button" href="etiquettes_adherents.php?from=mailing">' . _T("Generate labels") . '</a></p>';
    }
} else {
    if (count($mailing->unreachables)) {
        $html .= '<p id="recipients_count"><strong>' . _T("None of the selected members has an email address.") . '</strong></p>';
    } else {
        $html .= '<p id="recipients_count"><strong>' . _T("No member selected (yet).") . '</strong></p>';
コード例 #3
0
 *
 * You should have received a copy of the GNU General Public License
 * along with Galette. If not, see <http://www.gnu.org/licenses/>.
 *
 * @category  Plugins
 * @package   Galette
 * @author    Johan Cwiklinski <*****@*****.**>
 * @copyright 2011-2014 The Galette Team
 * @license   http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version
 * @version   SVN: $Id$
 * @link      http://galette.tuxfamily.org
 * @since     Available since 0.7dev - 2011-10-29
 */
use Analog\Analog;
use Galette\Repository\Members;
require_once 'includes/galette.inc.php';
$ids = $_POST['persons'];
$mode = $_POST['person_mode'];
if (!$ids || !$mode) {
    Analog::log('Trying to display ajax_group_members.php without persons or mode specified', Analog::INFO);
    die;
}
if (!$login->isLogged() || !$login->isAdmin() && !$login->isStaff()) {
    Analog::log('Trying to display ajax_group_members.php without appropriate permissions', Analog::INFO);
    die;
}
$m = new Members();
$persons = $m->getArrayList($ids);
$tpl->assign('persons', $persons);
$tpl->assign('person_mode', $mode);
$tpl->display('group_persons.tpl');
コード例 #4
0
} elseif (isset($session['filters']['members'])) {
    $filters = unserialize($session['filters']['members']);
} else {
    $filters = new MembersList();
}
if (isset($_GET['from']) && $_GET['from'] === 'mailing') {
    //if we're from mailing, we have to retrieve its unreachables members for labels
    $mailing = unserialize($session['mailing']);
    $members = $mailing->unreachables;
} else {
    if (count($filters->selected) == 0) {
        Analog::log('No member selected to generate labels', Analog::INFO);
        header('location:gestion_adherents.php');
        die;
    }
    $m = new Members();
    $members = $m->getArrayList($filters->selected, array('nom_adh', 'prenom_adh'), false, true, null, false, false, true);
}
if (!is_array($members) || count($members) < 1) {
    die;
}
$doc_title = _T("Member's Labels");
$doc_subject = _T("Generated by Galette");
$doc_keywords = _T("Labels");
// Create new PDF document
$pdf = new Pdf($preferences);
// Set document information
$pdf->SetTitle($doc_title);
$pdf->SetSubject($doc_subject);
$pdf->SetKeywords($doc_keywords);
// No hearders and footers
コード例 #5
0
ファイル: ajax_members.php プロジェクト: Killerfun/galette
            if (!isset($_POST['members'])) {
                $group = new Group((int) $_POST['gid']);
                $selected_members = array();
                if (!isset($_POST['mode']) || $_POST['mode'] == 'members') {
                    $selected_members = $group->getMembers();
                } else {
                    if ($_POST['mode'] == 'managers') {
                        $selected_members = $group->getManagers();
                    } else {
                        Analog::log('Trying to list group members with unknown mode', Analog::ERROR);
                        throw new Exception('Unknown mode.');
                        exit(0);
                    }
                }
            } else {
                $m = new Members();
                $selected_members = $m->getArrayList($_POST['members']);
            }
            break;
        case 'attach':
            if (!isset($_POST['id_adh'])) {
                throw new \RuntimeException('Current selected member must be excluded while attaching!');
                exit(0);
            } else {
                $tpl->assign('excluded', $_POST['id_adh']);
            }
            break;
    }
}
$tpl->assign('ajax', $ajax);
$tpl->assign('multiple', $multiple);
コード例 #6
0
$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);
$tpl->assign('pref_membership_ext', $cotis_extension ? $preferences->pref_membership_ext : '');
//TODO: remove and replace with $contrib specific property
// - declare dynamic fields for display
$dynamic_fields = $dyn_fields->prepareForDisplay('contrib', $contribution['dyn'], array(), 1);
コード例 #7
0
ファイル: Reminders.php プロジェクト: Killerfun/galette
 /**
  * Get the list of reminders
  *
  * @param Db      $zdb    Database instance
  * @param boolean $nomail Get reminders for members who do not have email address
  *
  * @return array
  */
 public function getList($zdb, $nomail = false)
 {
     $this->_types = array();
     $this->_reminders = array();
     $types = array();
     foreach ($this->_selected as $s) {
         $this->_loadToRemind($zdb, $s);
         if (count($this->_toremind) > 0) {
             //and then get list
             $m = new Members();
             $members = $m->getArrayList($this->_toremind, null, false, true, null, false, true);
             $this->_types[$s] = $members;
         }
     }
     if (is_array($this->_types)) {
         foreach ($this->_types as $type => $members) {
             //load message
             if (is_array($members)) {
                 foreach ($members as $member) {
                     $reminder = new Reminder();
                     $reminder->type = $type;
                     $reminder->dest = $member;
                     $this->_reminders[] = $reminder;
                 }
             }
         }
     }
     return $this->_reminders;
 }
コード例 #8
0
ファイル: Picture.php プロジェクト: Killerfun/galette
 /**
  * Check for missing images in database
  *
  * @param Db $zdb Database instance
  *
  * @return void
  */
 public function missingInDb(Db $zdb)
 {
     $existing_disk = array();
     //retrieve files on disk
     if ($handle = opendir($this->store_path)) {
         while (false !== ($entry = readdir($handle))) {
             $reg = "/^(\\d+)\\.(" . implode('|', $this->allowed_extensions) . ")\$/i";
             if (preg_match($reg, $entry, $matches)) {
                 $id = $matches[1];
                 $extension = strtolower($matches[2]);
                 if ($extension == 'jpeg') {
                     //jpeg is an allowed extension,
                     //but we change it to jpg to reduce further tests :)
                     $extension = 'jpg';
                 }
                 $existing_disk[$id] = array('name' => $entry, 'id' => $id, 'ext' => $extension);
             }
         }
         closedir($handle);
         if (count($existing_disk) === 0) {
             //no image on disk, nothing to do :)
             return;
         }
         //retrieve files in database
         $class = get_class($this);
         $select = $zdb->select($this->tbl_prefix . $class::TABLE);
         $select->columns(array(self::PK))->where->in(self::PK, array_keys($existing_disk));
         $results = $zdb->execute($select);
         $existing_db = array();
         foreach ($results as $result) {
             $existing_db[] = (int) $result[self::PK];
         }
         $existing_diff = array_diff(array_keys($existing_disk), $existing_db);
         //retrieve valid members ids
         $members = new Members();
         $valids = $members->getArrayList($existing_diff, null, false, false, array(self::PK));
         foreach ($valids as $valid) {
             $file = $existing_disk[$valid->id_adh];
             $this->_storeInDb($zdb, $file['id'], $this->store_path . $file['id'] . '.' . $file['ext'], $file['ext']);
         }
     } else {
         Analog::log('Something went wrong opening images directory ' . $this->store_path, Analog::ERROR);
     }
 }
コード例 #9
0
$dynamic_fields = $dyn_fields->prepareForDisplay('adh', $adherent['dyn'], $disabled['dyn'], 1);
// template variable declaration
$title = _T("Member Profile");
if ($member->id != '') {
    $title .= ' (' . _T("modification") . ')';
} else {
    $title .= ' (' . _T("creation") . ')';
}
$navigate = array();
if (isset($session['filters']['members'])) {
    $filters = unserialize($session['filters']['members']);
} else {
    $filters = new MembersList();
}
if (($login->isAdmin() || $login->isStaff()) && count($filters) > 0) {
    $m = new Members();
    $ids = $m->getList(false, array(Adherent::PK, 'nom_adh', 'prenom_adh'));
    $ids = $ids->toArray();
    foreach ($ids as $k => $m) {
        if ($m['id_adh'] == $member->id) {
            $navigate = array('cur' => $m['id_adh'], 'count' => count($ids), 'pos' => $k + 1);
            if ($k > 0) {
                $navigate['prev'] = $ids[$k - 1]['id_adh'];
            }
            if ($k < count($ids) - 1) {
                $navigate['next'] = $ids[$k + 1]['id_adh'];
            }
            break;
        }
    }
}
コード例 #10
0
}
if (!$login->isAdmin() && !$login->isStaff() && !$login->isGroupManager()) {
    header("location: voir_adherent.php");
    die;
}
if (isset($session['filters']['members'])) {
    $filters = unserialize($session['filters']['members']);
} else {
    $filters = new MembersList();
}
if (count($filters->selected) == 0) {
    Analog::log('No member selected to generate attendance sheet', Analog::INFO);
    header('location:gestion_adherents.php');
    die;
}
$m = new Members();
$members = $m->getArrayList($filters->selected, array('nom_adh', 'prenom_adh'), true);
if (!is_array($members) || count($members) < 1) {
    die;
}
//with or without images?
$_wimages = false;
if (isset($_POST['sheet_photos']) && $_POST['sheet_photos'] === '1') {
    $_wimages = true;
}
define('SHEET_FONT', Pdf::FONT_SIZE - 2);
/**
 * PDF attendence sheet list
 *
 * @name      SheetPdf
 * @category  Classes
コード例 #11
0
ファイル: carte_adherent.php プロジェクト: Killerfun/galette
            die;
        } else {
            header('location:voir_adherent.php');
            die;
        }
        die;
    }
}
// Fill array $mailing_adh with selected ids
$mailing_adh = array();
if (isset($unique) && $unique) {
    $mailing_adh[] = $unique;
} else {
    $mailing_adh = $filters->selected;
}
$m = new Members();
$members = $m->getArrayList($mailing_adh, array('nom_adh', 'prenom_adh'), true);
if (!is_array($members) || count($members) < 1) {
    Analog::log('An error has occured, unable to get members list.', Analog::ERROR);
    die;
}
// Set PDF headings
$doc_title = _T("Member's Cards");
$doc_subject = _T("Generated by Galette");
$doc_keywords = _T("Cards");
// Get fixed data from preferences
// and convert strings to utf-8 for tcpdf
$an_cot = '<strong>' . $preferences->pref_card_year . '</strong>';
$abrev = '<strong>' . $preferences->pref_card_abrev . '</strong>';
$print_logo = new Galette\Core\PrintLogo();
if ($logo->hasPicture()) {
コード例 #12
0
ファイル: reminder.php プロジェクト: Killerfun/galette
            }
        }
        if (count($error_detected) > 0) {
            array_unshift($error_detected, _T("Reminder has not been sent:"));
        }
        if (count($success_detected) > 0) {
            array_unshift($success_detected, _T("Sent reminders:"));
        }
    }
}
if (!$login->isCron()) {
    $previews = array('impending' => $texts->getTexts('impendingduedate', $preferences->pref_lang), 'late' => $texts->getTexts('lateduedate', $preferences->pref_lang));
    $tpl->assign('page_title', _T("Reminders"));
    $tpl->assign('previews', $previews);
    $tpl->assign('require_dialog', true);
    $members = new Members();
    $reminders = $members->getRemindersCount();
    $tpl->assign('count_impending', $reminders['impending']);
    $tpl->assign('count_impending_nomail', $reminders['nomail']['impending']);
    $tpl->assign('count_late', $reminders['late']);
    $tpl->assign('count_late_nomail', $reminders['nomail']['late']);
    $tpl->assign('error_detected', $error_detected);
    $tpl->assign('warning_detected', $warning_detected);
    $tpl->assign('success_detected', $success_detected);
    $content = $tpl->fetch('reminder.tpl');
    $tpl->assign('content', $content);
    $tpl->display('page.tpl');
} else {
    //called from a cron. warning and errors has been stored into history
    //and probably logged
    if (count($error_detected) > 0) {
コード例 #13
0
        $filters->email_filter = (int) $_GET['email_filter'];
    }
    //group filter
    if (isset($_GET['group_filter']) && $_GET['group_filter'] > 0) {
        $filters->group_filter = (int) $_GET['group_filter'];
    }
}
//numbers of rows to display
if (isset($_GET['nbshow']) && is_numeric($_GET['nbshow'])) {
    $filters->show = $_GET['nbshow'];
}
// Sorting
if (isset($_GET['tri'])) {
    $filters->orderby = $_GET['tri'];
}
$members = new Members($filters);
//delete members
if (isset($_GET['sup']) || isset($_POST['delete'])) {
    $del = false;
    if (isset($_GET['sup'])) {
        $del = $members->removeMembers($_GET['sup']);
    } else {
        if (isset($_POST['member_sel'])) {
            $del = $members->removeMembers($_POST['member_sel']);
        }
    }
    if ($del === false) {
        if (count($members->getErrors()) > 0) {
            foreach ($members->getErrors() as $error) {
                $error_detected[] = $error;
            }
コード例 #14
0
             $filters->reinit();
             $filters->membership_filter = Members::MEMBERSHIP_LATE;
             $filters->account_status_filter = Members::ACTIVE_ACCOUNT;
             $m = new Members($filters);
             $members = $m->getList(true);
             $mailing = new Core\Mailing($members !== false ? $members : null);
         } else {
             if (count($filters->selected) == 0 && !isset($_GET['mailing_new']) && !isset($_GET['reminder'])) {
                 Analog::log('[mailing_adherents.php] No member selected for mailing', Analog::WARNING);
                 if (isset($profiler)) {
                     $profiler->stop();
                 }
                 header('location:gestion_adherents.php');
                 die;
             }
             $m = new Members();
             $members = $m->getArrayList($filters->selected, null, false, true, null, false, false, true);
             $mailing = new Core\Mailing($members !== false ? $members : null);
         }
     }
 }
 if (isset($_POST['mailing_go']) || isset($_POST['mailing_reset']) || isset($_POST['mailing_confirm']) || isset($_POST['mailing_save'])) {
     if (trim($_POST['mailing_objet']) == '') {
         $error_detected[] = _T("Please type an object for the message.");
     } else {
         $mailing->subject = $_POST['mailing_objet'];
     }
     if (trim($_POST['mailing_corps']) == '') {
         $error_detected[] = _T("Please enter a message.");
     } else {
         $mailing->message = $_POST['mailing_corps'];
コード例 #15
0
ファイル: gestion_groupes.php プロジェクト: Killerfun/galette
         if ($_POST['parent_group'] === '' && $group->getId() != null) {
             $group->detach();
         }
     }
 } catch (Exception $e) {
     $error_detected[] = $e->getMessage();
 }
 $new = false;
 if ($group->getId() == '') {
     $new = true;
 }
 $managers_id = array();
 if (isset($_POST['managers'])) {
     $managers_id = $_POST['managers'];
 }
 $m = new Members();
 $managers = $m->getArrayList($managers_id);
 $members_id = array();
 if (isset($_POST['members'])) {
     $members_id = $_POST['members'];
 }
 $members = $m->getArrayList($members_id);
 $group->setManagers($managers);
 $group->setMembers($members);
 if (count($error_detected) == 0) {
     $store = $group->store();
     if ($store === true) {
         $success_detected[] = preg_replace('/%groupname/', $group->getName(), _T("Group `%groupname` has been successfully saved."));
     } else {
         //something went wrong :'(
         $error_detected[] = _T("An error occured while storing the group.");
コード例 #16
0
ファイル: trombinoscope.php プロジェクト: Killerfun/galette
 * @category  PublicPages
 * @package   Galette
 *
 * @author    Alexandre 'laotseu' DE DOMMELIN <*****@*****.**>
 * @author    Johan Cwiklinski <*****@*****.**>
 * @copyright 2006-2014 The Galette Team
 * @license   http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version
 * @version   SVN: $Id$
 * @link      http://galette.tuxfamily.org
 * @since     Available since 0.62
 */
use Galette\Core\Picture;
use Galette\Repository\Members;
define('GALETTE_BASE_PATH', '../');
require_once GALETTE_BASE_PATH . 'includes/galette.inc.php';
if (!$preferences->showPublicPages($login)) {
    //public pages are not actives
    header('location:' . GALETTE_BASE_PATH . 'index.php');
    die;
}
$pic = new Picture();
$pic->missingInDb($zdb);
$m = new Members();
$members = $m->getPublicList(true, null);
$tpl->assign('page_title', _T("Trombinoscope"));
$tpl->assign('additionnal_html_class', 'trombinoscope');
$tpl->assign('members', $members);
$tpl->assign('time', time());
$content = $tpl->fetch('trombinoscope.tpl');
$tpl->assign('content', $content);
$tpl->display('public_page.tpl');