~budgester/irm/trunk

« back to all changes in this revision

Viewing changes to include/tracking.class.php

  • Committer: Martin N Stevens
  • Date: 2008-06-23 23:52:22 UTC
  • Revision ID: budgester@budgester.com-20080623235222-0av7i5hfx2xojwky
Tracking class clean up

Show diffs side-by-side

added added

removed removed

Lines of Context:
475
475
                return $this->UserName;
476
476
        }
477
477
 
478
 
        function addNew()
479
 
        {
480
 
 
 
478
        function addNew(){
481
479
                AuthCheck("post-only");
482
480
                commonHeader(_("Tracking") . " - " . _("Added"));
483
481
                $date = date("Y-m-d H:i:s");
484
 
                if ($is_group == "") 
485
 
                {
 
482
                if ($is_group == "") {
486
483
                        $is_group = "no";
487
484
                }
488
 
                                
489
485
                $this->setDateEntered($date);
490
486
                $this->setStatus($_REQUEST['status']);
491
487
                $this->setAuthor($this->UserName());
497
493
                $this->setEmailUpdatesToAuthor($_REQUEST['emailupdates']);
498
494
                $this->setOtherEmails($_REQUEST['other_emails']);
499
495
                $this->setDevice($_REQUEST['deviceType']);
500
 
                
501
496
                $this->add();
502
 
 
503
497
                logevent($_REQUEST['ID'], _("computers"), 4, _("tracking"), _("New tracking job opened")); 
504
 
 
505
498
                __("Your tracking job has been placed into the database.");
506
 
 
507
499
                commonFooter();
508
500
        }
509
501
        
510
 
        function TrackingListHeader()
511
 
        {
 
502
        function TrackingListHeader(){
512
503
                global $IRMName;
513
504
                PRINT "<table>";
514
505
 
515
 
                if($this->advanced_tracking == "yes")
516
 
                {
 
506
                if($this->advanced_tracking == "yes"){
517
507
                        $this->AdvancedTrackingHeader();
518
508
                }
519
509
                PRINT '<tr class="trackingheader">';
550
540
                                'unassigned' => _("Show only tracking not assigned to anyone")
551
541
                                );
552
542
 
553
 
                foreach (User::AllUsers() as $id => $name)
554
 
                {
 
543
                foreach (User::AllUsers() as $id => $name){
555
544
                        $opts["u:$name"] = sprintf(_("Show only tracking assigned to %s"), $name);
556
545
                }
557
546
 
615
604
                $this->advanced_tracking = $result['advanced_tracking'];
616
605
                $tracking_order = $result["tracking_order"];
617
606
 
618
 
                if($tracking_order == "yes")
619
 
                {
 
607
                if($tracking_order == "yes"){
620
608
                        $tracking_order = "ASC";
621
609
                } else {
622
610
                        $tracking_order = "DESC";
623
611
                }
624
612
 
625
 
                if (@$_REQUEST['sort'])
626
 
                {
 
613
                if (@$_REQUEST['sort']) {
627
614
                        $tracking_order = $_REQUEST['sort']." $tracking_order";
628
615
                } else {
629
616
                        $tracking_order = "date $tracking_order";
630
617
                }
631
618
 
632
 
                if (!isset($show))
633
 
                {
 
619
                if (!isset($show)){
634
620
                        $show = '';
635
621
                }
636
622
                $this->trackingIDs = $this->getNotClosed($this->advanced_tracking, $_REQUEST['show'], $tracking_order);
975
961
                }
976
962
 
977
963
                // Prefix the sort field by it's table
978
 
                if (substr($Order, 0, 8) == 'location')
979
 
                {
 
964
                $Order = "tracking.$Order";
 
965
                if (substr($Order, 0, 8) == 'location') {
980
966
                        $Order = "computers.$Order";
981
967
                }
982
 
                else
983
 
                {
984
 
                        $Order = "tracking.$Order";
985
 
                }
986
 
 
987
968
                $sort = "ORDER BY $Order";
988
969
 
989
970
                if ($Advanced == "yes")
990
971
                {
 
972
                        #TODO Moved to a switch statement
991
973
                        if ($Show == "allandclosed")
992
974
                        {
993
975
                                $where = "WHERE (tracking_status.status=tracking.status)";
1028
1010
                                        AND (tracking_status.status=tracking.status)
1029
1011
                                        AND (tracking.assign = $quser)";
1030
1012
                        }
1031
 
                }
1032
 
                else
1033
 
                {
 
1013
                } else {
1034
1014
                        $where = "WHERE (tracking_status.closed = 0)
1035
1015
                                AND (tracking_status.status=tracking.status)
1036
1016
                                AND ((tracking.assign='" . $this->UserName() . "')
1053
1033
        {
1054
1034
                global $IRMName;
1055
1035
        
1056
 
                if($username === NULL)
1057
 
                {
 
1036
                if($username === NULL){
1058
1037
                        $username = $IRMName;
1059
1038
                }
1060
1039
                $username = $this->DB->getTextValue($username);
1061
1040
 
1062
1041
                $sort = '';
1063
 
                if (strtolower($Order) == 'asc')
1064
 
                {
 
1042
                if (strtolower($Order) == 'asc'){
1065
1043
                        $sort = "ORDER BY date";
1066
 
                }
1067
 
                else if (strtolower($Order) == 'desc')
1068
 
                {
 
1044
                } else if (strtolower($Order) == 'desc') {
1069
1045
                        $sort = "ORDER BY date DESC";
1070
1046
                }
1071
1047
                
1151
1127
                {
1152
1128
                        $location = $result['locations'];
1153
1129
                }
1154
 
        
1155
 
                if ($location == '')
1156
 
                {
1157
 
                        $location = '&nbsp;';
1158
 
                }
1159
1130
                
1160
1131
                PRINT '<tr class="trackingdetail">';
1161
1132
                PRINT '<td align="center">';
1175
1146
                        PRINT $authorfullname;
1176
1147
                }
1177
1148
 
1178
 
                if((Config::Get('userupdates')) && ($this->EmailUpdatesToAuthor == "yes"))
1179
 
                {
 
1149
                if((Config::Get('userupdates')) && ($this->EmailUpdatesToAuthor == "yes")){
1180
1150
                        PRINT "(U)";
1181
1151
                }
1182
 
 
1183
1152
                PRINT "</td>";
1184
1153
 
 
1154
                $assignedTo = "";               
1185
1155
                if($this->Assign == "") {
1186
 
                        PRINT "<td>["._("Nobody")."]</td>";
 
1156
                        $assignedTo = "[" . _("Nobody") . "]";
1187
1157
                } else {
1188
 
                        PRINT "<td>\n";
1189
1158
                        if($assignExists){
1190
 
                                PRINT '<a href="'. $this->userbase .'/users-info.php?ID='. $this->Assign .'">' . $assignfullname . '</a>';
 
1159
                                $assignedTo = '<a href="'. $this->userbase .'/users-info.php?ID='. $this->Assign .'">' . $assignfullname . '</a>';
1191
1160
                        } else {
1192
 
                                PRINT $assignfullname;
 
1161
                                $assignedTo = $assignfullname;
1193
1162
                        }
1194
 
                        PRINT "</td>";
1195
1163
                }
1196
1164
 
 
1165
                PRINT "<td>\n";
 
1166
                PRINT $assignedTo;
 
1167
                PRINT "</td>";
 
1168
 
1197
1169
                PRINT "<td>";
1198
1170
                $this->groupInfo();
1199
1171
                PRINT "</td>";