Merge branch 'owenleonard/ht_sandbox' of git@github.com:apippin/tc into ht_sandbox
[eq/.git] / inc / class.tc.inc.php
index 630fe14ec1526a47f9d7aad2c2294454df6a10d7..8b435da2e86976cd158a45aad9f6c99bd59c706b 100644 (file)
@@ -79,6 +79,9 @@ class tc
                        include("setup/tc_config");
                }
 
+               $this->jquery_url = $GLOBALS['phpgw']->link('inc/jquery/jquery.js');
+               $this->jquery_tablesorter_url = $GLOBALS['phpgw']->link('inc/jquery/jquery.tablesorter.js');
+               
                $this->script_path = "$this->application_path"."/bin";
                $this->max_presidency_members = 99;
                $this->max_appointments = 32768;
@@ -92,6 +95,11 @@ class tc
                $this->grants     = $GLOBALS['phpgw']->acl->get_grants('tc');
                $this->grants[$this->account] = PHPGW_ACL_READ + PHPGW_ACL_ADD + PHPGW_ACL_EDIT + PHPGW_ACL_DELETE;
 
+               $GLOBALS['phpgw_info']['flags']['css'] .= "-->\n</style>\n"
+                  . '<link rel="stylesheet" type="text/css" media="all" href="'
+                  . $GLOBALS['phpgw']->link('inc/jquery/jquery.tablesorter.css').'"/>'
+                  . "\n<style type=\"text/css\">\n<!--\n";
+
                $this->jscal = CreateObject('tc.jscalendar');   // before phpgw_header() !!!
                $this->cal_options = 'daFormat    : "%Y-%m-%d",
                                      ifFormat    : "%Y-%m-%d",
@@ -412,7 +420,7 @@ class tc
                $this->t->set_block('ht_sandbox_t','companionship_table_list','ct_list');
 
                $this->t->set_var('submit_action',$GLOBALS['phpgw']->link('/tc/index.php','menuaction=tc.tc.ht_sandbox&action=add'));
-           $this->t->set_var('jquery_url',$GLOBALS['phpgw']->link('inc/jquery.js'));
+           $this->t->set_var('jquery_url',$this->jquery_url);
                 
            $action = get_var('action',array('GET','POST'));
 
@@ -3933,36 +3941,11 @@ class tc
        function org_view()
        {
                $this->t->set_file(array('org_view_t' => 'org_view.tpl'));
-               $this->t->set_block('org_view_t','calling_list','list1');
-               $this->t->set_block('org_view_t','org_list','list2');
-
-               # Display a list ordered alphabetically
-               $sql = "SELECT * FROM tc_calling AS tc JOIN tc_individual AS ti WHERE tc.individual=ti.individual ORDER BY name ASC";
-               $this->db->query($sql,__LINE__,__FILE__);
-               $i=0;
-               while ($this->db->next_record()) {
-                       $calling[$i]['name'] = $this->db->f('name');
-                       $calling[$i]['position'] = $this->db->f('position');
-                       $calling[$i]['sustained'] = $this->db->f('sustained');
-                       $calling[$i]['organization'] = $this->db->f('organization');
-                       $i++;
-               }   
-               for ($i=0; $i < count($calling); $i++) {
-                       $name = $calling[$i]['name'];
-                       $position = $calling[$i]['position'];
-                       $sustained = $calling[$i]['sustained'];
-                       $organization = $calling[$i]['organization'];
-                       $this->t->set_var('name', $name);
-                       $this->t->set_var('position', $position);
-                       $this->t->set_var('sustained', $sustained);
-                       $this->t->set_var('organization', $organization);
-                       $tr_color = $this->nextmatchs->alternate_row_color($tr_color);
-                       $this->t->set_var('tr_color',$tr_color);
-                       $this->t->fp('list1','calling_list',True);
-               }
+               $this->t->set_block('org_view_t','calling_list','list');
+           $this->t->set_var('jquery_url',$this->jquery_url);
+           $this->t->set_var('jquery_tablesorter_url',$this->jquery_tablesorter_url);
 
-               # Display a list ordered by organization
-               $sql = "SELECT * FROM tc_calling AS tc JOIN tc_individual AS ti where tc.individual=ti.individual ORDER BY organization ASC";
+               $sql = "SELECT * FROM tc_calling AS tc JOIN tc_individual AS ti where tc.individual=ti.individual ORDER BY name ASC";
                $this->db->query($sql,__LINE__,__FILE__);
                $i=0;
                while ($this->db->next_record()) {
@@ -3983,7 +3966,7 @@ class tc
                        $this->t->set_var('organization', $organization);
                        $tr_color = $this->nextmatchs->alternate_row_color($tr_color);
                        $this->t->set_var('tr_color',$tr_color);
-                       $this->t->fp('list2','org_list',True);
+                       $this->t->fp('list','calling_list',True);
                }
 
                $this->t->pfp('out','org_view_t');