Changeset 153


Ignore:
Timestamp:
Jan 27, 2007 11:43:46 PM (6 years ago)
Author:
dkg
Message:

JPDD: Created new overview which shows accounts who have not signed up for anything yet.

Location:
trunk/jpdd
Files:
2 edited

Legend:

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

    r150 r153  
    1010 
    1111        function getTitle() { 
    12           global $jpdd; 
    13           $x = '_'.$jpdd->users['username']; 
     12          global $dkg_site; 
     13          $x = '_'.$dkg_site->users['username']; 
    1414          return $this->$x; 
    1515        } 
     
    2020 
    2121        function getPrivileges() { 
    22           global $jpdd; 
    23           return $jpdd->getSeriesFromSQL('SELECT title, description FROM person_privilege JOIN privilege ON (privilege.id = person_privilege.privilege_id) WHERE person_id = '.$this->getID(), 'DKG_Row'); 
     22          global $dkg_site; 
     23          return $dkg_site->getSeriesFromSQL('SELECT title, description FROM person_privilege JOIN privilege ON (privilege.id = person_privilege.privilege_id) WHERE person_id = '.$this->getID(), 'DKG_Row'); 
    2424        } 
     25     
     26    function getLinkedEmail() { 
     27      global $dkg_site; 
     28      if (is_null($this->_email)) 
     29        return ''; 
     30      $errs = $dkg_site->isValid('email', $this->_email); 
     31      return (is_null($errs) ? "<a class=\"email\" href=\"mailto:".$this->_email."\">&lt;".$this->_email."&gt;</a>" : '<span class="error">'.$errs.': '.htmlentities($this->_email).'</span>'); 
     32    } 
    2533 
    2634        function hasAnyOfThesePrivileges() { 
  • trunk/jpdd/class.jpdd.php

    r152 r153  
    120120        '<li>Workshop attendees: '.(int)$this->getValueFromSQL('SELECT COUNT(*) AS foo FROM audience', 'foo')."\n". 
    121121        '<li>Complete on-line accounts: '.$this->getValueFromSQL('SELECT COUNT(*) AS foo FROM person WHERE pass IS NOT NULL', 'foo')."\n". 
    122         '<ul><li>who aren\'t presenters or attendees yet: '.(int)$this->getValueFromSQL('SELECT COUNT(*) AS foo FROM (SELECT id FROM person WHERE pass IS NOT NULL) AS p LEFT JOIN attendance ON (p.id = attendance.person_id) WHERE workshop_id IS NULL', 'foo')."\n". 
     122        '<ul><li>who <a href="'.$this->Path('overview', 'noworkshop').'">aren\'t presenters or attendees</a> yet: '.(int)$this->getValueFromSQL('SELECT COUNT(*) AS foo FROM (SELECT id FROM person WHERE pass IS NOT NULL) AS p LEFT JOIN attendance ON (p.id = attendance.person_id) WHERE workshop_id IS NULL', 'foo')."\n". 
    123123        '<li>who are <a href="'.$this->Path('overview', 'unaffiliated').'">unaffiliated with any school</a>: '.(int)$this->getValueFromSQL('SELECT COUNT(*) AS foo FROM (SELECT id FROM person WHERE pass IS NOT NULL) AS p LEFT JOIN affiliation ON (p.id = affiliation.person_id) WHERE organization_id IS NULL', 'foo')."</ul>\n". 
    124124        '<li>People without e-mail addresses: '.(int)$this->getValueFromSQL('SELECT COUNT(*) AS foo FROM person WHERE email IS NULL', 'foo')."\n". 
     
    127127 
    128128    function getUnaffiliatedAccounts() { 
    129       $sql = 'SELECT person.* FROM person LEFT JOIN affiliation ON (person.id = affiliation.person_id) WHERE affiliation.id IS NULL AND person.pass IS NOT NULL ORDER BY last_name, first_name'; 
     129      $sql = 'SELECT person.* FROM person LEFT JOIN affiliation ON (person.id = affiliation.person_id) WHERE organization_id IS NULL AND person.pass IS NOT NULL ORDER BY last_name, first_name'; 
    130130      $us = $this->getSeriesFromSQL($sql, 'JPDD_Person'); 
    131       return "<h3>Unaffiliated accounts<ul>\n".join('', array_map(create_function('$x', 'return "<li>".$x->getLinkedTitle().(is_null($x->_email) ? "" : " - <a class=\"email\" href=\"mailto:".$x->_email."\">&lt;".$x->_email."&gt;</a>")."\n";'), $us))."</ul>"; 
     131      return "<h3>Unaffiliated accounts<ul>\n".join('', array_map(create_function('$x', 'return "<li>".$x->getLinkedTitle()." ".$x->getLinkedEmail()."\n";'), $us))."</ul>"; 
     132    } 
     133    function getAccountsWithNoWorkshop() { 
     134      $sql = 'SELECT person.* FROM person LEFT JOIN attendance ON (person.id = attendance.person_id) WHERE workshop_id IS NULL AND person.pass IS NOT NULL ORDER BY last_name, first_name'; 
     135      $us = $this->getSeriesFromSQL($sql, 'JPDD_Person'); 
     136      return "<h3>Accounts who are not presenters or attendees<ul>\n".join('', array_map(create_function('$x', 'return "<li>".$x->getNameWithOrgs()." ".$x->getLinkedEmail()."\n";'), $us))."</ul>"; 
    132137    } 
    133138 
     
    252257      } elseif ($which == 'unaffiliated') { 
    253258        $ret .= $this->getUnaffiliatedAccounts(); 
     259      } elseif ($which == 'noworkshop') { 
     260        $ret .= $this->getAccountsWithNoWorkshop(); 
    254261      } else { 
    255262        $ret .= $this->getGenericOverview(); 
Note: See TracChangeset for help on using the changeset viewer.