Model/Ticket.php

Go to the documentation of this file.
00001 <?php
00003 // {{{ license
00004 
00005 // +----------------------------------------------------------------------+
00006 // | FastFrame Application Framework                                      |
00007 // +----------------------------------------------------------------------+
00008 // | Copyright (c) 2002-2006 The Codejanitor Group                        |
00009 // +----------------------------------------------------------------------+
00010 // | This source file is subject to the GNU Lesser Public License (LGPL), |
00011 // | that is bundled with this package in the file LICENSE, and is        |
00012 // | available at through the world-wide-web at                           |
00013 // | http://www.fsf.org/copyleft/lesser.html                              |
00014 // | If you did not receive a copy of the LGPL and are unable to          |
00015 // | obtain it through the world-wide-web, you can get it by writing the  |
00016 // | Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, |
00017 // | MA 02111-1307, USA.                                                  |
00018 // +----------------------------------------------------------------------+
00019 // | Authors: Jason Rust <jrust@codejanitor.com>                          |
00020 // +----------------------------------------------------------------------+
00021 
00022 // }}}
00023 // {{{ requires
00024 
00025 require_once FASTFRAME_ROOT . 'lib/FastFrame/Model.php';
00026 require_once FASTFRAME_ROOT . 'lib/FastFrame/Util.php';
00027 
00028 // }}}
00029 // {{{ class FF_Model_Ticket
00030 
00040 // }}}
00041 class FF_Model_Ticket extends FF_Model {
00042     // {{{ properties
00043 
00048     var $extraValues = array();
00049 
00054     var $createDate;
00055 
00060     var $lastUpdated;
00061 
00066     var $lastCommentUpdate;
00067     
00072     var $dueDate;
00073     
00078     var $reporterId = 0;
00079 
00084     var $handlerId = 0;
00085 
00090     var $handlerName = null;
00091 
00096     var $reporterName = null;
00097 
00102     var $reporterPhone = null;
00103 
00108     var $reporterDepartment = null;
00109 
00114     var $reporterEmail = null;
00115 
00120     var $summary;
00121 
00126     var $description;
00127 
00132     var $points;
00133 
00138     var $locationId;
00139 
00144     var $statusId;
00145 
00150     var $statusName;
00151 
00156     var $statusColor;
00157 
00162     var $resolutionId;
00163 
00168     var $categoryId;
00169 
00174     var $lastAction;
00175 
00180     var $lastViewTime = 0;
00181 
00186     var $progress = 0;
00187 
00192     var $numAttachments = 0;
00193      
00194     // }}}
00195     // {{{ reset()
00196 
00203     function reset()
00204     {
00205         $this->id = null;
00206         $this->createDate = null;
00207         $this->dueDate = null;
00208         $this->lastUpdated = 0;
00209         $this->lastCommentUpdate = 0;
00210         $this->reporterId = 0;
00211         $this->handlerId = 0;
00212         $this->summary = null;
00213         $this->description = null;
00214         $this->points = null;
00215         $this->locationId = null;
00216         $this->statusId = null;
00217         $this->resolutionId = null;
00218         $this->categoryId = null;
00219         $this->statusName = null;
00220         $this->statusColor = null;
00221         $this->lastAction = null;
00222         $this->lastViewTime = 0;
00223         $this->progress = 0;
00224         $this->numAttachments = 0;
00225     }
00226 
00227     // }}}
00228     // {{{ importFromArray()
00229 
00238     function importFromArray($in_data)
00239     {
00240         $this->setId($in_data['id']);
00241         $this->setCreateDate(@$in_data['create_date']);
00242         $this->setDueDate(@$in_data['due_date']);
00243         $this->setReporterId(@$in_data['reporter_id']);
00244         $this->setHandlerId(@$in_data['handler_id']);
00245         $this->setSummary($in_data['summary']);
00246         $this->setDescription(@$in_data['description']);
00247         $this->setPoints($in_data['points']);
00248         $this->setLocationId(@$in_data['location_id']);
00249         $this->setStatusId(@$in_data['status_id']);
00250         $this->setResolutionId(@$in_data['resolution_id']);
00251         $this->setCategoryId(@$in_data['category_id']);
00252         $this->lastUpdated = @$in_data['last_updated'];
00253         $this->lastCommentUpdate = @$in_data['last_comment_update'];
00254         $this->statusName = @$in_data['status_name'];
00255         $this->statusColor = @$in_data['status_color'];
00256         $this->categoryName = @$in_data['category_name'];
00257         $this->handlerName = @$in_data['handler_name'];
00258         $this->reporterName = @$in_data['reporter_name'];
00259         $this->reporterPhone = @$in_data['reporter_phone'];
00260         $this->reporterDepartment = @$in_data['reporter_dept'];
00261         $this->reporterEmail = @$in_data['reporter_email'];
00262         $this->lastAction = @$in_data['last_action'];
00263         $this->progress = @$in_data['progress'];
00264         $this->numAttachments = @$in_data['num_attachments'];
00265         $this->lastViewTime = @$in_data['last_view_time'];
00266 
00267         // Since extra values aren't model properties, repopulate them as POST data
00268         if (isset($in_data['extra_values'])) {
00269             foreach ($in_data['extra_values'] as $s_name => $s_value) {
00270                 FF_Request::setParam($s_name, $s_value, 'p');
00271             }
00272         }
00273     }
00274 
00275     // }}}
00276     // {{{ exportToArray()
00277 
00286     function exportToArray()
00287     {
00288         $a_data = array();
00289         $a_data['id'] = $this->getId();
00290         $a_data['create_date'] = $this->getCreateDate();
00291         $a_data['due_date'] = $this->getDueDate();
00292         $a_data['reporter_id'] = $this->getReporterId();
00293         $a_data['reporter_name'] = $this->getReporterName();
00294         $a_data['reporter_phone'] = $this->getReporterPhone();
00295         $a_data['reporter_dept'] = $this->getReporterDepartment();
00296         $a_data['reporter_email'] = $this->getReporterEmail();
00297         $a_data['handler_id'] = $this->getHandlerId();
00298         $a_data['summary'] = $this->getSummary();
00299         $a_data['description'] = $this->getDescription();
00300         $a_data['points'] = $this->getPoints();
00301         $a_data['location_id'] = $this->getLocationId();
00302         $a_data['status_id'] = $this->getStatusId();
00303         $a_data['resolution_id'] = $this->getResolutionId(false);
00304         $a_data['category_id'] = $this->getCategoryId();
00305         $a_data['last_action'] = $this->getLastAction();
00306         $a_data['progress'] = $this->getProgress();
00307         $a_data['num_attachments'] = $this->getNumAttachments();
00308         $a_data['extra_values'] = $this->extraValues;
00309         return $a_data;
00310     }
00311 
00312     // }}}
00313     // {{{ setExtraValueToExport()
00314 
00325     function setExtraValueToExport($in_field, $in_value)
00326     {
00327         $this->extraValues[$in_field] = $in_value;
00328     }
00329 
00330     // }}}
00331     // {{{ email()
00332 
00342     function email($in_emails, $in_short = false)
00343     {
00344                 return;
00345         $o_result = new FF_Result();
00346         // remove any empty or duplicate values
00347         $in_emails = array_filter(array_unique($in_emails));
00348         $s_email = implode(',', $in_emails);
00349         if (empty($s_email)) {
00350             return $o_result;
00351         }
00352 
00353         require_once 'Mail.php';
00354         $o_registry =& FF_Registry::singleton();
00355         $o_mail =& Mail::factory($o_registry->getConfigParam('mailer/type'),
00356                 $o_registry->getConfigParam('mailer/params'));
00357         if (PEAR::isError($o_mail)) {
00358             $o_result->addMessage($o_mail->getMessage());
00359             $o_result->setSuccess(false);
00360             return $o_result;
00361         }
00362 
00363         $a_headers = array();
00364         $a_headers['From'] = $o_registry->getConfigParam('mailer/default_from');
00365         $a_headers['To'] = $s_email;
00366         $tmp_summary = $this->getSummary();
00367         $tmp_summary = strlen($tmp_summary) > 50 ? substr($tmp_summary, 0, 50) . '...' : $tmp_summary;
00368         switch ($this->getLastAction()) {
00369             case ACTION_ADD_SUBMIT:
00370                 $a_headers['Subject'] = sprintf(_('[Mayday] %s Opened: %s'), $this->getId(), $tmp_summary);
00371             break;
00372             case ACTION_EDIT_SUBMIT:
00373             case 'new_private_comment':
00374             case 'new_public_comment':
00375                 $a_headers['Subject'] = sprintf(_('[Mayday] %s Updated: %s'), $this->getId(), $tmp_summary);
00376             break;
00377             case ACTION_RESOLVE_SUBMIT:
00378                 $a_headers['Subject'] = sprintf(_('[Mayday] %s Closed: %s'), $this->getId(), $tmp_summary);
00379             break;
00380             default:
00381                 $a_headers['Subject'] = sprintf(_('[Mayday] %s: %s'), $this->getId(), $tmp_summary);
00382             break;
00383         }
00384 
00385         if ($in_short) {
00386             // Make from as short as possible
00387             $a_headers['From'] = preg_replace('/.*?<(.*?)>/', '\\1', $a_headers['From']);
00388             $a_headers['Subject'] = '[Mayday] ' . $tmp_summary;
00389             $a_headers['Bcc'] = $a_headers['To'];
00390             unset($a_headers['To']);
00391             $s_phone = $this->getReporterPhone();
00392             $s_phone = empty($s_phone) ? '' : ' (' . $s_phone . ')';
00393             $s_body = $this->getReporterName() . $s_phone . '. ';
00394             // Make the maximum length of the text-message 100 characters
00395             if (strlen($s_body) < 100) {
00396                 $s_body .= substr($this->getDescription(), 0, 100 - strlen($s_body));
00397             }
00398         }
00399         else {
00400             require_once dirname(__FILE__) . '/../Action/TicketDisplay.php';
00401             $o_display =& new FF_Action_Display_Ticket($this);
00402             $a_data = $o_display->getTableData(true);
00403             $o_output = FF_Output::factory();
00404             // Put comments at top, and description below
00405             array_splice($a_data, 4, 0, array($a_data[2]));
00406             unset($a_data[2]);
00407             $s_url = FastFrame::url('index.php', array(
00408                 'objectId' => $this->getId(), session_name() => false,
00409                 'actionId' => ACTION_DISPLAY, 'app' => 'mayday'), true);
00410             array_splice($a_data, 4, 0, array(
00411                     array('title' => _('URL:'), 'data' => $o_output->link($s_url, $s_url))));
00412             $s_body = '';
00413             foreach ($a_data as $a_element) {
00414                 $s_body .= str_pad($a_element['title'], 20, ' ', STR_PAD_RIGHT) . ' ' . $a_element['data'] . "\n";
00415             }
00416 
00417             $s_body .= $o_registry->getConfigParam('mayday/footer');
00418             require_once 'Mail/mime.php';
00419             $o_mime =& new Mail_mime("\n");
00420             $o_mime->setTXTBody(strip_tags($s_body));
00421             $o_mime->setHTMLBody('<html><body><pre>' . $s_body . '</pre></body></html>');
00422             $s_body = $o_mime->get();
00423             $a_headers = $o_mime->headers($a_headers);
00424         }
00425 
00426         $tmp_result =& $o_mail->send($s_email, $a_headers, $s_body);
00427         if (PEAR::isError($tmp_result)) {
00428             $o_result->addMessage($tmp_result->getMessage());
00429             $o_result->setSuccess(false);
00430         }
00431 
00432         return $o_result;
00433     }
00434 
00435     // }}}
00436     // {{{ getLastViewTime()
00437 
00441     function getLastViewTime()
00442     {        
00443         return $this->lastViewTime;
00444     }
00445 
00446     // }}}
00447     // {{{ hasNewComment()
00448 
00452     function hasNewComment()
00453     {
00454         return $this->getLastCommentUpdate() > $this->getLastViewTime();
00455     }
00456 
00457     // }}}
00458      // {{{ markRead()
00459 
00465     function markRead($in_userId)
00466     {        
00467         $o_dao =& FF_DataAccess::factory('TicketComment');
00468         $o_dao->markRead($this->id, $in_userId);
00469     }
00470 
00471     // }}}
00472     // {{{ getSummaryInfo()
00473 
00487     function getSummaryInfo($in_id, $in_type, &$in_list)
00488     {
00489         if ($in_type == SUMMARY_FILTER) {
00490             require_once dirname(__FILE__) . '/Filter.php';
00491             $o_model =& new FF_Model_Filter();
00492             if ($o_model->fillById($in_id)) {
00493                 $s_desc = $o_model->getName();
00494                 $in_list->setSortField($o_model->getSortField());
00495                 $in_list->setSortOrder($o_model->getSortOrder());
00496             }
00497             else {
00498                 return '<i>' . _('Invalid Filter Specified') . '</i>';
00499             }
00500         }
00501         else {
00502             require_once dirname(__FILE__) . '/Category.php';
00503             $o_model =& new FF_Model_Category();
00504             $in_list->setSortField('points');
00505             $in_list->setSortOrder(0);
00506             if ($o_model->fillById($in_id)) {
00507                 $s_desc = $o_model->getName() . ' ' . _('Category');
00508             }
00509             else {
00510                 return '<i>' . _('Invalid Category Specified') . '</i>';
00511             }
00512         }
00513 
00514         return array($s_desc, 
00515                 $this->o_dataAccess->getSummaryData($o_model, $in_list->getSortField(), $in_list->getSortOrder()));
00516     }
00517 
00518     // }}}
00519     // {{{ getNavigationIds()
00520 
00530     function getNavigationIds($in_currentBlock)
00531     {
00532         @list($s_blockId, $s_blockType) = explode(':', $in_currentBlock);
00533         if (empty($s_blockId)) {
00534             return array();
00535         }
00536 
00537         // Need constants
00538         require_once dirname(__FILE__) . '/MaydayProfile.php';
00539         if ($s_blockType == SUMMARY_FILTER) {
00540             require_once dirname(__FILE__) . '/Filter.php';
00541             $o_model =& new FF_Model_Filter();
00542             if (!$o_model->fillById($s_blockId)) {
00543                 return array();
00544             }
00545         }
00546         else {
00547             require_once dirname(__FILE__) . '/Category.php';
00548             $o_model =& new FF_Model_Category();
00549             if (!$o_model->fillById($s_blockId)) {
00550                 return array();
00551             }
00552         }
00553 
00554         return $this->o_dataAccess->getNavigationIds($this->getId(), $o_model);
00555     }
00556 
00557     // }}}
00558     // {{{ getModuleName()
00559 
00569     function getModuleName($in_id, $in_moduleName)
00570     {
00571         $o_moduleDao =& FF_DataAccess::factory($in_moduleName);
00572         $tmp_method = 'get' . $in_moduleName . 'Name';
00573         return $o_moduleDao->$tmp_method($in_id);
00574     }
00575 
00576     // }}}
00577     // {{{ getModuleOptions()
00578 
00590     function getModuleOptions($in_moduleName, $in_extraOptions = array())
00591     {
00592         $a_options = array();
00593         if (!empty($in_extraOptions['addAll'])) {
00594             $a_options = array('__all' => _('All'));
00595         }
00596 
00597         $o_moduleDao =& FF_DataAccess::factory($in_moduleName);
00598         $tmp_method = 'get' . $in_moduleName . 'Options';        
00599         $a_options += $o_moduleDao->$tmp_method($in_extraOptions);
00600 
00601 
00602         return $a_options;
00603     }
00604 
00605     // }}}
00606     // {{{ getModuleDefault()
00607 
00616     function getModuleDefault($in_moduleName)
00617     {
00618         $o_moduleDao =& FF_DataAccess::factory($in_moduleName);
00619         return $o_moduleDao->getDefaultValue();
00620     }
00621 
00622     // }}}
00623    // {{{ getFormattedDueDate()
00624 
00625     function getFormattedDueDate($in_showShortDate = false)
00626     {
00627         return $this->getDueDate() ? FF_Util::formatRelativeDate($this->getDueDate(), $in_showShortDate) : _('N/A');
00628     }
00629 
00630     // }}}
00631     // {{{ getDueDate()
00632 
00633     function getDueDate()
00634     {
00635         return $this->dueDate;
00636     }
00637 
00638     // }}}
00639     // {{{ setDueDate()
00640 
00641     function setDueDate($in_value)
00642     {
00643         $this->dueDate = $in_value;
00644     }
00645 
00646     // }}}
00647     // {{{ getFormattedCreateDate()
00648 
00649     function getFormattedCreateDate($in_showShortDate = false)
00650     {
00651         return FF_Util::formatRelativeDate($this->getCreateDate(), $in_showShortDate);
00652     }
00653 
00654     // }}}
00655     // {{{ getCreateDate()
00656 
00657     function getCreateDate()
00658     {
00659         return $this->createDate;
00660     }
00661 
00662     // }}}
00663     // {{{ setCreateDate()
00664 
00665     function setCreateDate($in_value)
00666     {
00667         $this->createDate = $in_value;
00668     }
00669 
00670     // }}}
00671     // {{{ getFormattedLastUpdated()
00672 
00673     function getFormattedLastUpdated()
00674     {
00675         return FF_Util::formatRelativeDate($this->getLastUpdated());
00676     }
00677 
00678     // }}}
00679     // {{{ getLastCommentUpdate()
00680 
00681     function getLastCommentUpdate()
00682     {
00683         return $this->lastCommentUpdate;
00684     }
00685 
00686     // }}}
00687     // {{{ getLastUpdated()
00688 
00689     function getLastUpdated()
00690     {
00691         return $this->lastUpdated;
00692     }
00693 
00694     // }}}
00695     // {{{ getProgress()
00696 
00697     function getProgress()
00698     {
00699         return (int) $this->progress;
00700     }
00701 
00702     // }}}
00703     // {{{ setProgress()
00704 
00705     function setProgress($in_value)
00706     {
00707         $this->progress = $in_value;
00708     }
00709 
00710     // }}}
00711     // {{{ getReporterName()
00712 
00713     function getReporterName()
00714     {
00715         return $this->reporterName;
00716     }
00717 
00718     // }}}
00719     // {{{ getReporterPhone()
00720 
00727     function getReporterPhone()
00728     {
00729         if (empty($this->reporterPhone)) {
00730             return;
00731         }
00732         elseif (strlen($this->reporterPhone) >= 10) {
00733             return preg_replace('/(\d{3})(\d{3})(\d{4})/', '\\1-\\2-\\3', $this->reporterPhone);
00734         }
00735         else {
00736             return preg_replace('/(\d{3})(\d{4})/', '\\1-\\2', $this->reporterPhone);
00737         }
00738     }
00739 
00740     // }}}
00741     // {{{ getReporterDepartment()
00742 
00743     function getReporterDepartment()
00744     {
00745         return $this->reporterDepartment;
00746     }
00747 
00748     // }}}
00749     // {{{ getReporterEmail()
00750 
00751     function getReporterEmail()
00752     {
00753         return $this->reporterEmail;
00754     }
00755 
00756     // }}}
00757     // {{{ getReporterId()
00758 
00759     function getReporterId()
00760     {
00761         return $this->reporterId;
00762     }
00763 
00764     // }}}
00765     // {{{ setReporterId()
00766 
00767     function setReporterId($in_value)
00768     {
00769         $this->reporterId = $in_value;
00770     }
00771 
00772     // }}}
00773     // {{{ getHandlerOptions()
00774     
00786     function getHandlerOptions($in_addUnassigned = false, $in_addAny = false, $in_catId = null)
00787     {
00788         $a_users = array();
00789         if ($in_addAny) {
00790             $a_users['__any'] = _('Any User');
00791         }
00792 
00793         if ($in_addUnassigned) {
00794             $a_users[0] = _('Unassigned');
00795         }
00796 
00797         $in_catId = is_null($in_catId) ? $this->getCategoryId() : ($in_catId == '__all' ? 'any' : $in_catId);
00798         $o_dao =& FF_DataAccess::factory('Permissions', 'permissions');
00799         $a_users += $o_dao->getUsersForObject($in_catId, PERMS_EDIT, 'Category');
00800         return $a_users;
00801     }
00802 
00803     // }}}
00804     // {{{ changeHandler()
00805 
00815     function changeHandler($in_id, $in_userId)
00816     {
00817         // History needs to know it changed
00818         $this->setHandlerId($in_userId);
00819         $o_result = $this->o_dataAccess->changeHandler($in_id, $in_userId);
00820         return !PEAR::isError($o_result);
00821     }
00822 
00823     // }}}
00824     // {{{ getHandlerName()
00825 
00826     function getHandlerName($in_force = false)
00827     {
00828         if ($this->getHandlerId() == 0) {
00829             return _('Unassigned');
00830         }
00831         else {
00832             if (empty($this->handlerName) || $in_force) {
00833                 $o_dao =& FF_DataAccess::factory('Profile', 'profile');
00834                 $this->handlerName = $o_dao->getFullNameById($this->getHandlerId());
00835             }
00836 
00837             return $this->handlerName;
00838         }
00839     }
00840 
00841     // }}}
00842     // {{{ getHandlerId()
00843 
00844     function getHandlerId()
00845     {
00846         return $this->handlerId;
00847     }
00848 
00849     // }}}
00850     // {{{ setHandlerId()
00851 
00852     function setHandlerId($in_value)
00853     {
00854         $this->handlerId = $in_value;
00855     }
00856 
00857     // }}}
00858     // {{{ getSummary()
00859 
00860     function getSummary()
00861     {
00862         return $this->summary;
00863     }
00864 
00865     // }}}
00866     // {{{ setSummary()
00867 
00868     function setSummary($in_value)
00869     {
00870         $this->summary = $in_value;
00871     }
00872 
00873     // }}}
00874     // {{{ getDescription()
00875 
00876     function getDescription($in_formatted = false)
00877     {
00878         if ($in_formatted) {
00879             $tmp_desc = $this->description;
00880             $tmp_desc = strlen($tmp_desc) > 100 ? substr($tmp_desc, 0, 100) . '...' : $tmp_desc;
00881             $tmp_desc = str_replace(array("\n", "\r"), array(' ', ' '), htmlspecialchars($tmp_desc));
00882             return $tmp_desc;
00883         }
00884         else {
00885             return $this->description;
00886         }
00887     }
00888 
00889     // }}}
00890     // {{{ setDescription()
00891 
00892     function setDescription($in_value)
00893     {
00894         $this->description = $in_value;
00895     }
00896 
00897     // }}}
00898     // {{{ getPriorityAlerts()
00899 
00900     function getPriorityAlerts()
00901     {
00902         $o_dao =& FF_DataAccess::factory('Priority');
00903         return $o_dao->getPriorityAlerts();
00904     }
00905 
00906     // }}}
00907     // {{{ changePoints()
00908 
00917     function changePoints($in_dir)
00918     {
00919         $o_result = new FF_Result();
00920         $o_dao =& FF_DataAccess::factory('Priority');
00921         $a_next = $o_dao->getNextPriority($this->getPoints(), $in_dir);
00922         if (empty($a_next)) {
00923             $o_result->setSuccess(false);
00924             $o_result->addMessage(sprintf(_('The ticket is already at the %s priority.'), $in_dir ? _('highest') : _('lowest')));
00925             return array($o_result, null);
00926         }
00927         else {
00928             // History needs to know it changed
00929             $this->setPoints($a_next['points']);
00930             $tmp_result = $this->o_dataAccess->changePoints($this->getId(), $this->getPoints());
00931             if (!PEAR::isError($tmp_result)) {
00932                 $o_result->addMessage(sprintf(_('Successfully changed the priority to %s'), $a_next['name']));
00933             }
00934             else {
00935                 $o_result->setSuccess(false);
00936                 $o_result->addMessage($tmp_result->getMessage());
00937             }
00938         }
00939 
00940         return array($o_result, $a_next['name']);
00941     }
00942 
00943     // }}}
00944     // {{{ getPriorityDesc()
00945 
00946     function getPriorityDesc()
00947     {
00948         $o_dao =& FF_DataAccess::factory('Priority');
00949         $a_data = $o_dao->getClosestPriority($this->points);
00950         return $a_data['name'] . ' (' . $this->points . ' ' . _('points') . ')';
00951     }
00952 
00953     // }}}
00954     // {{{ getPoints()
00955 
00956     function getPoints($in_closest = false)
00957     {
00958         if (is_null($this->points)) {
00959             return $this->getModuleDefault('Priority');
00960         }
00961         else {
00962             // If looking for the closest actual priority we need to query the database
00963             if ($in_closest) {
00964                 $o_dao =& FF_DataAccess::factory('Priority');
00965                 $a_data = $o_dao->getClosestPriority($this->points);
00966                 return $a_data['points'];
00967             }
00968             else {
00969                 return $this->points;
00970             }
00971         }
00972     }
00973 
00974     // }}}
00975     // {{{ setPoints()
00976 
00977     function setPoints($in_value)
00978     {
00979         // Don't let points go out of range
00980         $in_value = $in_value < 0 ? 0 : $in_value;
00981         $in_value = $in_value > 100 ? 100 : $in_value;
00982         $this->points = $in_value;
00983     }
00984 
00985     // }}}
00986     // {{{ getLocationId()
00987 
00988     function getLocationId()
00989     {
00990         return is_null($this->locationId) ? $this->getModuleDefault('Location') : $this->locationId;
00991     }
00992 
00993     // }}}
00994     // {{{ setLocationId()
00995 
00996     function setLocationId($in_value)
00997     {
00998         $this->locationId = $in_value;
00999     }
01000 
01001     // }}}
01002     // {{{ getNumAttachments()
01003 
01004     function getNumAttachments()
01005     {
01006         return $this->numAttachments;
01007     }
01008 
01009     // }}}
01010     // {{{ setNumAttachments()
01011 
01012     function setNumAttachments($in_value)
01013     {
01014         $this->numAttachments = $in_value;
01015     }
01016 
01017     // }}}
01018     // {{{ updateNumAttachments()
01019 
01020     function updateNumAttachments($in_num) 
01021     {
01022         $this->o_dataAccess->updateNumAttachments($this->getId(), $in_num);
01023     }
01024 
01025     // }}}
01026     // {{{ getStatusName()
01027 
01028     function getStatusName()
01029     {
01030         return $this->statusName;
01031     }
01032 
01033     // }}}
01034     // {{{ getStatusColor()
01035 
01042     function getStatusColor()
01043     {
01044         return $this->statusColor;
01045     }
01046 
01047     // }}}
01048     // {{{ isTicketResolved()
01049 
01056     function isTicketResolved()
01057     {
01058         static $s_resolveId;
01059         if (!isset($s_resolveId)) {
01060             $o_dao =& FF_DataAccess::factory('Status');
01061             $s_resolveId = $o_dao->getResolutionStatus();
01062         }
01063 
01064         return $s_resolveId == $this->getStatusId();
01065     }
01066 
01067     // }}}
01068     // {{{ getStatusId()
01069 
01070     function getStatusId($in_checkInProgress = false)
01071     {
01072         // Check to see if we sould return the in progress status id
01073         if ($in_checkInProgress) {
01074             $o_dao =& FF_DataAccess::factory('Status');
01075             if (($s_progressId = $o_dao->getInProgressStatus()) &&
01076                 $this->statusId == $this->getModuleDefault('Status')) {
01077                 $this->statusId = $s_progressId;
01078             }
01079         }
01080 
01081         return is_null($this->statusId) ? $this->getModuleDefault('Status') : $this->statusId;
01082     }
01083 
01084     // }}}
01085     // {{{ setStatusId()
01086 
01087     function setStatusId($in_value)
01088     {
01089         $this->statusId = $in_value;
01090     }
01091 
01092     // }}}
01093     // {{{ getResolutionResponses()
01094 
01095     function getResolutionResponses()
01096     {
01097         $o_dao =& FF_DataAccess::factory('Resolution');
01098         return $o_dao->getResolutionResponses();
01099     }
01100 
01101     // }}}
01102     // {{{ getResolutionId()
01103 
01104     function getResolutionId($in_checkDefault = true)
01105     {
01106         if ($in_checkDefault) {
01107             return empty($this->resolutionId) ? $this->getModuleDefault('Resolution') : $this->resolutionId;
01108         }
01109         else {
01110             return $this->resolutionId;
01111         }
01112     }
01113 
01114     // }}}
01115     // {{{ setResolutionId()
01116 
01117     function setResolutionId($in_value)
01118     {
01119         $this->resolutionId = $in_value;
01120     }
01121 
01122     // }}}
01123     // {{{ getCategoryName()
01124 
01125     function getCategoryName()
01126     {
01127         return $this->categoryName;
01128     }
01129 
01130     // }}}
01131     // {{{ getCategoryId()
01132 
01133     function getCategoryId()
01134     {
01135         return is_null($this->categoryId) ? $this->getModuleDefault('Category') : $this->categoryId;
01136     }
01137 
01138     // }}}
01139     // {{{ setCategoryId()
01140 
01141     function setCategoryId($in_value)
01142     {
01143         $this->categoryId = $in_value;
01144     }
01145 
01146     // }}}
01147     // {{{ getLastAction()
01148 
01149     function getLastAction()
01150     {
01151         return $this->lastAction;
01152     }
01153 
01154     // }}}
01155     // {{{ setLastAction()
01156 
01157     function setLastAction($in_value)
01158     {
01159         $this->lastAction = $in_value;
01160     }
01161 
01162     // }}}
01163     // {{{ _initDataAccess()
01164 
01171     function _initDataAccess()
01172     {
01173         $this->o_dataAccess =& FF_DataAccess::factory('Ticket');
01174     }
01175 
01176     // }}}
01177 }
01178 ?>

Generated on Fri Jun 23 11:38:18 2006 for FastFrame by  doxygen 1.4.4