Changeset 142


Ignore:
Timestamp:
Jan 26, 2007 3:48:17 PM (6 years ago)
Author:
dkg
Message:

JPDD: added attendance overview table for Phyllis.

Location:
trunk/jpdd
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/jpdd/class.jpdd.php

    r140 r142  
    5555 
    5656      if ($this->isAuthenticated()) { 
    57         if ($this->_authenticated_user->hasAnyOfThesePrivileges('Update Workshops')) 
     57        if ($this->_authenticated_user->hasAnyOfThesePrivileges('Update Workshops')) { 
    5858          $links['Workshops'] = 'workshop'; 
     59          $links['Review Signups'] = 'attendance'; 
     60        } 
    5961        if ($this->_authenticated_user->hasAnyOfThesePrivileges('List People')) 
    6062          $links['People'] = 'person'; 
     
    109111 
    110112    function getAllowedActions() { 
    111       return array_merge(parent::getAllowedActions(), array('signup', 'printout')); 
    112     } 
    113  
     113      return array_merge(parent::getAllowedActions(), array('signup', 'printout', 'attendance')); 
     114    } 
     115 
     116 
     117    function getWorkshopOverviewWithAttendence() { 
     118      return '<table><tr><th>workshop</th><th>max</th><th>min</th><th>total</th><th>by school</th></tr>'."\n<tbody>\n". 
     119        join('', array_map(create_function('$w', 'return $w->getOverviewRowWithAttendence();'), $this->getAll('workshop'))). 
     120        '</tbody></table>'."\n"; 
     121    } 
    114122 
    115123    function handleSignup() { 
     
    184192          $pdf->Output($pdfname, 'I'); 
    185193        } 
    186       }  
     194      } elseif ($this->_action = 'attendance') { 
     195        if ($this->isAuthenticated() && $this->_authenticated_user->hasAnyOfThesePrivileges('Update Workshops')) 
     196          return $this->getWorkshopOverviewWithAttendence(); 
     197        else 
     198          $this->permissionDenied('You are not authorized to view this overview.'); 
     199      } 
    187200      return parent::getMainContentExtended(); 
    188201    } 
  • trunk/jpdd/class.jpdd.workshop.php

    r139 r142  
    138138    } 
    139139 
     140    function getAudienceListBySchoolCount() { 
     141      global $jpdd; 
     142      $sql = 'SELECT organization.id, MAX(organization.title) AS title, COUNT(*) AS count  FROM audience LEFT JOIN affiliation ON (audience.person_id = affiliation.person_id) LEFT JOIN organization ON (affiliation.organization_id = organization.id)  WHERE workshop_id = '.$this->getID().' GROUP BY organization.id ORDER BY MAX(organization.title)'; 
     143      $x = $jpdd->getSeriesFromSQL($sql); 
     144      // FIXME: link these schools! 
     145      return "<ul>\n".join('', array_map(create_function('$x', 'return "<li>".(int)$x["count"]." ".(is_null($x["title"]) ? "unaffiliated" : " from ".htmlentities($x["title"]));'), $x))."</ul>\n"; 
     146    } 
     147 
     148    function getOverviewRowWithAttendence() { 
     149      return '<tr><td>'.$this->getLinkedTitle().$this->getPresentersWithOrgs().'</td>'. 
     150        '<td class="attendance">'.(int)$this->_max_attendees.'</td>'. 
     151        '<td class="attendance">'.(int)$this->_min_attendees.'</td>'. 
     152        '<td class="attendance">'.$this->getAudienceCount().'</td>'. 
     153        '<td>'.$this->getAudienceListBySchoolCount().'</td></tr>'."\n"; 
     154    } 
     155 
    140156        function getDetailTopInnards() { 
    141157      return $this->getPresentersWithOrgs(); 
  • trunk/jpdd/web/jpdd.css

    r141 r142  
    150150} 
    151151 
     152 
     153table {  
     154 border: thin solid black; 
     155} 
     156 
     157td {  
     158 border: thin solid black; 
     159} 
     160 
     161td.attendance { 
     162 text-align: center; 
     163} 
     164 
    152165@media print {  
    153166 
Note: See TracChangeset for help on using the changeset viewer.