示例#1
0
 * @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');
示例#2
0
 /**
  * Default constructor.
  */
 public function __construct()
 {
     parent::__construct($this->id);
 }
示例#3
0
 /**
  * Remove specified members
  *
  * @param integer|array $ids Members identifiers to delete
  *
  * @return boolean
  */
 public function removeMembers($ids)
 {
     global $zdb, $hist;
     $list = array();
     if (is_numeric($ids)) {
         //we've got only one identifier
         $list[] = $ids;
     } else {
         $list = $ids;
     }
     if (is_array($list)) {
         try {
             $zdb->connection->beginTransaction();
             //Retrieve some informations
             $select = $zdb->select(self::TABLE);
             $select->columns(array(self::PK, 'nom_adh', 'prenom_adh'))->where->in(self::PK, $list);
             $results = $zdb->execute($select);
             $infos = null;
             foreach ($results as $member) {
                 $str_adh = $member->id_adh . ' (' . $member->nom_adh . ' ' . $member->prenom_adh . ')';
                 $infos .= $str_adh . "\n";
                 $p = new Picture($member->id_adh);
                 if ($p->hasPicture()) {
                     if (!$p->delete(false)) {
                         Analog::log('Unable to delete picture for member ' . $str_adh, Analog::ERROR);
                         throw new \Exception('Unable to delete picture for member ' . $str_adh);
                     } else {
                         $hist->add(_T("Member Picture deleted"), $str_adh);
                     }
                 }
             }
             //delete contributions
             $del_qry = $zdb->delete(Contribution::TABLE);
             $del_qry->where->in(self::PK, $list);
             $del = $zdb->execute($del_qry);
             //delete transactions
             $del_qry = $zdb->delete(Transaction::TABLE);
             $del_qry->where->in(self::PK, $list);
             $del = $zdb->execute($del_qry);
             //delete groups membership/mamagmentship
             $del = Groups::removeMemberFromGroups((int) $member->id_adh);
             //delete reminders
             $del_qry = $zdb->delete(Reminder::TABLE);
             $del_qry->where->in('reminder_dest', $list);
             $del = $zdb->execute($del_qry);
             //delete members
             $del_qry = $zdb->delete(self::TABLE);
             $del_qry->where->in(self::PK, $list);
             $del = $zdb->execute($del_qry);
             //commit all changes
             $zdb->connection->commit();
             //add an history entry
             $hist->add(_T("Delete members cards, transactions and dues"), $infos);
             return true;
         } catch (\Exception $e) {
             $zdb->connection->rollBack();
             if ($e instanceof \Zend_Db_Statement_Exception && $e->getCode() == 23000) {
                 Analog::log('Member still have existing dependencies in the ' . 'database, maybe a mailing or some content from a ' . 'plugin. Please remove dependencies before trying ' . 'to remove him.', Analog::ERROR);
                 $this->_errors[] = _T("Cannot remove a member who still have dependencies (mailings, ...)");
             } else {
                 Analog::log('Unable to delete selected member(s) |' . $e->getMessage(), Analog::ERROR);
             }
             return false;
         }
     } else {
         //not numeric and not an array: incorrect.
         Analog::log('Asking to remove members, but without providing an array or a single numeric value.', Analog::WARNING);
         return false;
     }
 }