mailRe: [Galette-discussion] Une deuxième photo (conjo int(e))


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by laperdrix on November 07, 2011 - 13:38:
Bonjour,
Tu peux me faire parvenir un patch en PJ, oui (je préfère les patchs 
au fichiers complets modifiés, d'autant que j'utilise Git qui rend 
encore plus simple leur application).

c'est fait: un diff + la classe + le sql de la table
j'ai aussi un peu modifié le css pour voir 


Heu... Là, il faut envisager directement un plugin à mon humble avis ;
ça n'a pas grand chose à voir avec la gestion de groupes cette 
histoire de voyages (d'ailleurs, on pourrait envisager une  
association similaire qui aurait besoin des deux dans l'absolu).

Pourquoi les groupes ne sont pas un plugin, ce qui ne sert pas à
toutes les associations ... dans mon asso j'ai du mal à voir l'utilité
à part les voyages ( un voyage = un groupe, un accompagnateur, gestion
(dés)inscription, participation financière, édition liste, trombi, ...)
 
plus intéressant d'implémenter la notion de familles, car ce sera plus
générique. Tu peux y réfléchir si tu le souhaites
Oui, mais avant tout , je dois comprendre et apprendre le fonctionnement des 
plugins !!!

Bonne journée
daniel




diff -cr galette1538//ajouter_adherent.php galette07-dev//ajouter_adherent.php
*** galette1538//ajouter_adherent.php   2011-11-06 20:20:34.878171009 +0100
--- galette07-dev//ajouter_adherent.php 2011-11-06 20:32:24.679983142 +0100
***************
*** 292,303 ****
                  );
              }
          }
! 
          if ( isset($_POST['del_photo']) ) {
              if ( !$member->picture->delete($member->id) ) {
                  $error_detected[] = _T("Delete failed");
              }
          }
  
          // dynamic fields
          set_all_dynamic_fields('adh', $member->id, $adherent['dyn']);
--- 292,327 ----
                  );
              }
          }
! if ( isset($_FILES['photo_conjoint']) ) {
!             if ( $_FILES['photo_conjoint']['error'] === UPLOAD_ERR_OK ) {
!                 if ( $_FILES['photo_conjoint']['tmp_name'] !='' ) {
!                     if ( 
is_uploaded_file($_FILES['photo_conjoint']['tmp_name']) ) {
!                         $res = 
$member->picture_c->store($_FILES['photo_conjoint']);  
!                         if ( $res < 0 ) {
!                             $error_detected[] = 
Picture::getErrorMessage($res);
!                         }
!                     }
!                 }
!             } else if ($_FILES['photo_conjoint']['error'] !== 
UPLOAD_ERR_NO_FILE) {
!                 $log->log(
!                     
$member->picture->getPhpErrorMessage($_FILES['photo_conjoint']['error']),
!                     PEAR_LOG_WARNING
!                 );
!                 $error_detected[] = $member->picture->getPhpErrorMessage(
!                     $_FILES['photo_conjoint']['error']
!                 );
!             }
!         }
          if ( isset($_POST['del_photo']) ) {
              if ( !$member->picture->delete($member->id) ) {
                  $error_detected[] = _T("Delete failed");
              }
          }
+         if ( isset($_POST['del_photo_c']) ) {
+             if ( !$member->picture_c->delete($member->id) ) {
+                 $error_detected[] = _T("Delete failed");
+             }  
+         }
  
          // dynamic fields
          set_all_dynamic_fields('adh', $member->id, $adherent['dyn']);
diff -cr galette1538//classes/adherent.class.php 
galette07-dev//classes/adherent.class.php
*** galette1538//classes/adherent.class.php     2011-11-06 20:20:31.366241225 
+0100
--- galette07-dev//classes/adherent.class.php   2011-11-06 20:32:24.679983142 
+0100
***************
*** 40,46 ****
  require_once 'status.class.php';
  require_once 'fields_config.class.php';
  require_once 'fields_categories.class.php';
! require_once 'picture.class.php';
  require_once 'contribution.class.php';
  require_once 'galette_password.class.php';
  require_once 'groups.class.php';
--- 40,46 ----
  require_once 'status.class.php';
  require_once 'fields_config.class.php';
  require_once 'fields_categories.class.php';
! require_once 'picture_conjoint.class.php';
  require_once 'contribution.class.php';
  require_once 'galette_password.class.php';
  require_once 'groups.class.php';
***************
*** 100,105 ****
--- 100,106 ----
      private $_others_infos;
      private $_others_infos_admin;
      private $_picture;
+     private $_picture_c;
      private $_oldness;
      private $_days_remaining;
      private $_groups;
***************
*** 448,453 ****
--- 449,455 ----
              $gp = new GalettePassword();
              $this->_password = $gp->makeRandomPassword();
              $this->_picture = new Picture();
+             $this->_picture_c = new Picture_conjoint;
              if ( is_int($args) && $args > 0 ) {
                  $this->load($args);
              }
***************
*** 585,590 ****
--- 587,593 ----
          $this->_others_infos = $r->info_public_adh;
          $this->_others_infos_admin = $r->info_adh;
          $this->_picture = new Picture($this->_id);
+         $this->_picture_c = new Picture_conjoint($this->_id);
          $this->_groups = Groups::loadGroups($this->_id);
          $this->_checkDues();
      }
***************
*** 707,713 ****
      {
          return $this->_picture->hasPicture();
      }
! 
      /**
      * Get row class related to current fee status
      *
--- 710,719 ----
      {
          return $this->_picture->hasPicture();
      }
!     public function hasPicture_c()
!     {
!         return $this->_picture_c->hasPicture();
!     }
      /**
      * Get row class related to current fee status
      *
***************
*** 1057,1062 ****
--- 1063,1069 ----
                  if ( $add > 0) {
                      $this->_id = $zdb->db->lastInsertId();
                      $this->_picture = new Picture($this->_id);
+                     $this->_picture_c = new Picture_conjoint($this->_id);
                      // logging
                      $hist->add(
                          _T("Member card added"),
diff -cr galette1538//classes/picture.class.php 
galette07-dev//classes/picture.class.php
*** galette1538//classes/picture.class.php      2011-11-06 20:20:31.406240427 
+0100
--- galette07-dev//classes/picture.class.php    2011-11-06 20:32:24.683983057 
+0100
***************
*** 100,107 ****
      protected $mime;
      protected $has_picture = true;
      protected $store_path = GALETTE_PHOTOS_PATH;
!     protected $max_width = 200;
!     protected $max_height = 200;
  
      /**
      * Default constructor.
--- 100,107 ----
      protected $mime;
      protected $has_picture = true;
      protected $store_path = GALETTE_PHOTOS_PATH;
!     protected $max_width = 120;
!     protected $max_height = 120;
  
      /**
      * Default constructor.
Seulement dans galette07-dev//config: config.inc.php
Seulement dans galette07-dev//logs: galette.log
Seulement dans galette07-dev//photos: 2.jpg
Seulement dans galette07-dev//photos: C2.jpg
Seulement dans galette07-dev//photos: C4.jpg
Seulement dans galette07-dev//photos: C5.jpg
Seulement dans galette07-dev//photos: C6.jpg
diff -cr galette1538//picture.php galette07-dev//picture.php
*** galette1538//picture.php    2011-11-06 20:20:34.838171809 +0100
--- galette07-dev//picture.php  2011-11-06 20:32:24.683983057 +0100
***************
*** 56,62 ****
  
          $picture = null;
          if ( $login->isAdmin() || $adh->appearsInMembersList() || 
$login->login == $adh->login ) {
!             $picture = $adh->picture; //new Picture($id_adh);
          } else {
              $picture = new Picture();
          }
--- 56,66 ----
  
          $picture = null;
          if ( $login->isAdmin() || $adh->appearsInMembersList() || 
$login->login == $adh->login ) {
!            if (  isset($_GET['conj']) && $_GET['conj'] == 'true' ) {
!                               $picture = $adh->picture_c; //new 
Picture($id_adh);
!                       } else {
!                               $picture = $adh->picture;       
!                       }
          } else {
              $picture = new Picture();
          }
diff -cr galette1538//templates/default/member.tpl 
galette07-dev//templates/default/member.tpl
*** galette1538//templates/default/member.tpl   2011-11-06 20:20:33.854191480 
+0100
--- galette07-dev//templates/default/member.tpl 2011-11-06 20:32:24.687982973 
+0100
***************
*** 37,52 ****
                        <fieldset class="cssform">
                                <legend class="ui-state-active 
ui-corner-top">{_T string="Identity:"}</legend>
                                <div>
!     {if !$self_adh}
                                        <p>
                                                <span class="bline">{_T 
string="Picture:"}</span>
!                                               <img 
src="{$galette_base_path}picture.php?id_adh={$member->id}&amp;rand={$time}" 
class="picture" width="{$member->picture->getOptimalWidth()}" 
height="{$member->picture->getOptimalHeight()}" alt="{_T 
string="Picture"}"/><br/>
          {if $member->hasPicture() eq 1 }
!                                               <span 
class="labelalign"><label for="del_photo">{_T string="Delete 
image"}</label></span><input type="checkbox" name="del_photo" id="del_photo" 
value="1"/><br/>
          {/if}
                                                <input class="labelalign" 
type="file" name="photo"/>
                                        </p>
!     {/if}
                                        <p>
                                                <span class="bline">{_T 
string="Title:"}</span>
                                                {if $disabled.titre_adh != ''}
--- 37,58 ----
                        <fieldset class="cssform">
                                <legend class="ui-state-active 
ui-corner-top">{_T string="Identity:"}</legend>
                                <div>
!         {if !$self_adh}
                                        <p>
                                                <span class="bline">{_T 
string="Picture:"}</span>
!                                               <span class="pict"><img 
src="{$galette_base_path}picture.php?id_adh={$member->id}&amp;rand={$time}" 
class="picture" width="{$member->picture->getOptimalWidth()}" 
height="{$member->picture->getOptimalHeight()}" alt="{_T 
string="Picture"}"/></span>
!                                               <span class="pict"><img 
src="{$galette_base_path}picture.php?conj=true&amp; 
id_adh={$member->id}&amp;rand={$time}" class="picture" 
width="{$member->picture_c->getOptimalWidth()}" 
height="{$member->picture_c->getOptimalHeight()}" alt="{_T 
string="Picture"}"/></span><br/>
          {if $member->hasPicture() eq 1 }
!                                               <span 
class="labelalign"><label for="del_photo">{_T string="Delete 
image"}</label></span><input type="checkbox" name="del_photo" id="del_photo" 
value="1"/>
          {/if}
+         {if $member->hasPicture_c() eq 1 }
+                                               <span class="pict"><label 
for="del_photo">{_T string="Delete image"}</label></span><input 
type="checkbox" name="del_photo_c" id="del_photo" value="1"/>
+         {/if}
+         <br/>
                                                <input class="labelalign" 
type="file" name="photo"/>
+                                               <input class="labelalign" 
type="file" name="photo_conjoint"/>
                                        </p>
!                       {/if}
                                        <p>
                                                <span class="bline">{_T 
string="Title:"}</span>
                                                {if $disabled.titre_adh != ''}
diff -cr galette1538//templates/default/voir_adherent.tpl 
galette07-dev//templates/default/voir_adherent.tpl
*** galette1538//templates/default/voir_adherent.tpl    2011-11-06 
20:20:33.862191326 +0100
--- galette07-dev//templates/default/voir_adherent.tpl  2011-11-06 
20:32:24.687982973 +0100
***************
*** 56,62 ****
                        <tr>
                                <th>{_T string="Name:"}</th>
                                <td>{$member->spoliteness} {$member->name} 
{$member->surname}</td>
!                               <td rowspan="6" class="photo"><img 
src="{$galette_base_path}picture.php?id_adh={$member->id}&amp;rand={$time}" 
width="{$member->picture->getOptimalWidth()}" 
height="{$member->picture->getOptimalHeight()}" alt="{_T 
string="Picture"}"/></td>
                        </tr>
                        <tr>
                                <th>{_T string="Nickname:"}</th>
--- 56,63 ----
                        <tr>
                                <th>{_T string="Name:"}</th>
                                <td>{$member->spoliteness} {$member->name} 
{$member->surname}</td>
!                               <td rowspan="6" class="photo"><img 
src="{$galette_base_path}picture.php?id_adh={$member->id}&amp;rand={$time}" 
width="{$member->picture->getOptimalWidth()}" 
height="{$member->picture->getOptimalHeight()}" alt="{_T string="Picture"}"/>
!                                                             <img 
src="{$galette_base_path}picture.php?conj=true&amp; 
id_adh={$member->id}&amp;rand={$time}" 
width="{$member->picture_c->getOptimalWidth()}" 
height="{$member->picture_c->getOptimalHeight()}" alt="{_T 
string="Picture"}"/></td>
                        </tr>
                        <tr>
                                <th>{_T string="Nickname:"}</th>

Attachment: picture_conjoint.class.php
Description: application/php


-- Structure de la table `galette_pictures_conjoint`
--

CREATE TABLE IF NOT EXISTS `galette_pictures_conjoint` (
  `id_adh` int(10) unsigned NOT NULL DEFAULT '0',
  `picture` mediumblob NOT NULL,
  `format` varchar(10) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  PRIMARY KEY (`id_adh`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;



Related Messages


Powered by MHonArc, Updated Mon Nov 07 19:20:13 2011