Changeset 144
- Timestamp:
- Jan 27, 2007 9:36:42 PM (6 years ago)
- Location:
- trunk/jpdd
- Files:
-
- 6 edited
-
class.dkg.row.php (modified) (1 diff)
-
class.jpdd.php (modified) (4 diffs)
-
class.jpdd.workshop.php (modified) (1 diff)
-
sql/basics.sql (modified) (2 diffs)
-
sql/db.sql (modified) (4 diffs)
-
web/jpdd.css (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/jpdd/class.dkg.row.php
r139 r144 107 107 if (count($nonpeers)) 108 108 $ret .= '<label>'.(count($peers) ? $add_title.'<br/>' : '' ).'<select name="add_'.$jointable.'[]"> 109 <option value=""> </option>109 <option value="">None</option> 110 110 '.join("\n", array_map(create_function('$h', "return '<option value=\"'.\$h->getID().'\">'.\$h->getTitle().'</option>';"), $nonpeers)).' 111 111 </select></label> -
trunk/jpdd/class.jpdd.php
r142 r144 46 46 47 47 function getNavLink($title,$targ) { 48 return '<a '.( $this->_type == $targ? 'class="current" ' : '').'href='.$this->Path($targ).'>'.$title.'</a>';48 return '<a '.(($this->_action == $targ || (in_array($this->_action, array('view', 'edit')) && $this->_type == $targ)) ? 'class="current" ' : '').'href='.$this->Path($targ).'>'.$title.'</a>'; 49 49 } 50 50 … … 114 114 } 115 115 116 function getSchoolOverview() { 117 $sql = 'SELECT MAX(organization.title) AS title, organization.id, COUNT(*) AS registrations FROM audience LEFT JOIN affiliation ON (audience.person_id = affiliation.person_id) LEFT JOIN organization ON (affiliation.organization_id = organization.id) GROUP BY organization.id ORDER BY MAX(organization.title)'; 118 $os = $this->getSeriesFromSQL($sql); 119 return '<table><tr><th>school</th><th>signups</th></tr>'."\n<tbody>\n". 120 join('', array_map(create_function('$o', 'global $jpdd; return "<tr><td>".($jpdd->isEmpty($o["title"]) ? "unaffiliated" : "<a href=\"".$jpdd->Path("organization", $o["id"])."\">".htmlentities($o["title"])."</a>")."</td><td class=\"attendance\">".(int)$o["registrations"]."</td></tr>\n";'), $os)). 121 '</tbody></table>'."\n"; 122 } 116 123 117 124 function getWorkshopOverviewWithAttendence() { … … 193 200 } 194 201 } elseif ($this->_action = 'attendance') { 195 if ($this->isAuthenticated() && $this->_authenticated_user->hasAnyOfThesePrivileges('Update Workshops')) 196 return $this->get WorkshopOverviewWithAttendence();197 else202 if ($this->isAuthenticated() && $this->_authenticated_user->hasAnyOfThesePrivileges('Update Workshops')) { 203 return $this->getOverview($this->_type); 204 } else { 198 205 $this->permissionDenied('You are not authorized to view this overview.'); 206 } 199 207 } 200 208 return parent::getMainContentExtended(); 201 209 } 202 210 211 function getOverview($which) { 212 global $jpdd; 213 if ($jpdd->isEmpty($which)) 214 $which = 'workshop'; 215 216 $ret = '<div class="overviewnav">'; 217 218 // choice of administrator overviews: 219 $overviews = array('By Workshop' => 'workshop', 220 'By School' => 'organization'); 221 222 reset($overviews); 223 while (list($t,$v) = each($overviews)) { 224 $ret .= '<a '.($which == $v ? 'class="current" ' : '').'href="'.$this->Path('attendance', $v).'">'.$t.'</a> '; 225 } 226 $ret .= '</div>'; 227 228 if ($which == 'workshop') { 229 $ret .= $this->getWorkshopOverviewWithAttendence(); 230 } elseif ($which == 'organization') { 231 $ret .= $this->getSchoolOverview(); 232 } 233 return $ret; 234 } 203 235 204 236 … … 209 241 $lasterr = (($_SERVER['REQUEST_METHOD'] == 'POST') && $this->isEmpty($_POST['last_name'])); 210 242 $orgs = $this->getAll('organization'); 211 $this->addSourcedScript('scripts/dkg.base.js');212 $this->addScriptChunk('DKG.onLoadScripts.push(\'DKG.ShowOnValue("", "other", "org_title");\');');243 // $this->addSourcedScript('scripts/dkg.base.js'); 244 // $this->addScriptChunk('DKG.onLoadScripts.push(\'DKG.ShowOnValue("", "other", "org_title");\');'); 213 245 $acct = $this->getItem('person', (int)$this->_identifier); 214 246 -
trunk/jpdd/class.jpdd.workshop.php
r142 r144 143 143 $x = $jpdd->getSeriesFromSQL($sql); 144 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";145 return "<ul>\n".join('', array_map(create_function('$x', 'global $jpdd; return "<li>".(int)$x["count"]." ".(is_null($x["title"]) ? "unaffiliated" : " from <a href=\"".$jpdd->Path("organization", (int)$x["id"])."\">".htmlentities($x["title"])."</a>");'), $x))."</ul>\n"; 146 146 } 147 147 -
trunk/jpdd/sql/basics.sql
r117 r144 13 13 -- 14 14 15 SELECT pg_catalog.setval(pg_catalog.pg_get_serial_sequence('category', 'id'), 14, true);15 SELECT pg_catalog.setval(pg_catalog.pg_get_serial_sequence('category', 'id'), 35, true); 16 16 17 17 … … 34 34 12 Social Studies \N 35 35 13 Technology \N 36 14 Cooking 36 15 Art 37 16 Writing 38 17 School Community 39 18 Electives 40 19 Differentiated Instruction 41 20 Methodologies 42 21 School Quality Reviews 43 22 College Information 44 23 Community Service 45 24 Counseling, Discipline, Support 46 25 English 47 26 Discussion 48 27 Consortium DYO 49 28 Assessments 50 29 Parents and Guardians 51 30 Union 52 31 Middle School 37 53 \. 38 54 -
trunk/jpdd/sql/db.sql
r118 r144 57 57 58 58 ALTER TABLE public.audience OWNER TO dkg; 59 60 -- 61 -- Name: organization; Type: TABLE; Schema: public; Owner: dkg; Tablespace: 62 -- 63 64 CREATE TABLE organization ( 65 id serial NOT NULL, 66 title character varying NOT NULL, 67 description text, 68 website character varying 69 ); 70 71 72 ALTER TABLE public.organization OWNER TO dkg; 73 74 -- 75 -- Name: audience_by_organization; Type: VIEW; Schema: public; Owner: dkg 76 -- 77 78 CREATE VIEW audience_by_organization AS 79 SELECT affiliation.organization_id, count(*) AS count FROM ((audience LEFT JOIN affiliation ON ((audience.person_id = affiliation.person_id))) LEFT JOIN organization ON ((affiliation.organization_id = organization.id))) GROUP BY affiliation.organization_id; 80 81 82 ALTER TABLE public.audience_by_organization OWNER TO dkg; 59 83 60 84 -- … … 102 126 103 127 ALTER TABLE public.mail_log OWNER TO dkg; 104 105 --106 -- Name: organization; Type: TABLE; Schema: public; Owner: dkg; Tablespace:107 --108 109 CREATE TABLE organization (110 id serial NOT NULL,111 title character varying NOT NULL,112 description text,113 website character varying114 );115 116 117 ALTER TABLE public.organization OWNER TO dkg;118 128 119 129 -- … … 552 562 553 563 -- 564 -- Name: organization; Type: ACL; Schema: public; Owner: dkg 565 -- 566 567 REVOKE ALL ON TABLE organization FROM PUBLIC; 568 REVOKE ALL ON TABLE organization FROM dkg; 569 GRANT ALL ON TABLE organization TO dkg; 570 GRANT INSERT,SELECT,UPDATE ON TABLE organization TO "www-data"; 571 572 573 -- 554 574 -- Name: category; Type: ACL; Schema: public; Owner: dkg 555 575 -- … … 608 628 REVOKE ALL ON TABLE mail_log_id_seq FROM dkg; 609 629 GRANT ALL ON TABLE mail_log_id_seq TO dkg; 610 GRANT SELECT,UPDATE ON TABLE mail_log_id_seq TO "www-data"; 611 612 613 -- 614 -- Name: organization; Type: ACL; Schema: public; Owner: dkg 615 -- 616 617 REVOKE ALL ON TABLE organization FROM PUBLIC; 618 REVOKE ALL ON TABLE organization FROM dkg; 619 GRANT ALL ON TABLE organization TO dkg; 620 GRANT INSERT,SELECT,UPDATE ON TABLE organization TO "www-data"; 630 GRANT INSERT,UPDATE ON TABLE mail_log_id_seq TO "www-data"; 621 631 622 632 -
trunk/jpdd/web/jpdd.css
r142 r144 89 89 } 90 90 91 92 .overviewnav { 93 margin: 0.5em; 94 } 95 .overviewnav a { 96 padding: 0.5em; 97 } 98 .overviewnav a:hover { 99 background: #77f; 100 outline: 1px solid blue; 101 color: white; 102 } 103 .overviewnav a.current { 104 background: #003; 105 color: white; 106 } 107 108 91 109 a.outlink:hover { 92 110 background: #77f; … … 163 181 } 164 182 183 165 184 @media print { 166 185
Note: See TracChangeset
for help on using the changeset viewer.

