当前位置: 首页>>代码示例>>PHP>>正文


PHP Dept::lookup方法代码示例

本文整理汇总了PHP中Dept::lookup方法的典型用法代码示例。如果您正苦于以下问题:PHP Dept::lookup方法的具体用法?PHP Dept::lookup怎么用?PHP Dept::lookup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Dept的用法示例。


在下文中一共展示了Dept::lookup方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getDept

 function getDept()
 {
     if (!$this->dept && $this->getDeptId()) {
         $this->dept = Dept::lookup($this->getDeptId());
     }
     return $this->dept;
 }
开发者ID:nicolap,项目名称:osTicket-1.7,代码行数:7,代码来源:class.email.php

示例2: elseif

         if ($ticket->isClosed() && $wasOpen) {
             $ticket = null;
         }
     } elseif (!$errors['err']) {
         $errors['err'] = 'Unable to post the reply. Correct the errors below and try again!';
     }
     break;
 case 'transfer':
     /** Transfer ticket **/
     //Check permission
     if ($thisstaff && $thisstaff->canTransferTickets()) {
         if (!$_POST['deptId']) {
             $errors['deptId'] = 'Select department';
         } elseif ($_POST['deptId'] == $ticket->getDeptId()) {
             $errors['deptId'] = 'Ticket already in the Dept.';
         } elseif (!($dept = Dept::lookup($_POST['deptId']))) {
             $errors['deptId'] = 'Unknown or invalid department';
         }
         if (!$_POST['transfer_message']) {
             $errors['transfer_message'] = 'Transfer comments/notes required';
         } elseif (strlen($_POST['transfer_message']) < 5) {
             $errors['transfer_message'] = 'Transfer comments too short!';
         }
         $currentDept = $ticket->getDeptName();
         //save current dept name.
         if (!$errors && $ticket->transfer($_POST['deptId'], $_POST['transfer_message'])) {
             $msg = 'Ticket transferred successfully to ' . $ticket->getDeptName();
             //ticket->transfer does a reload...new dept at this point.
             $title = 'Dept. Transfer from ' . $currentDept . ' to ' . $ticket->getDeptName();
             /*** log the message as internal note - with alerts disabled - ***/
             $ticket->postNote($title, $_POST['transfer_message'], false);
开发者ID:nunomartins,项目名称:osTicket-1.7,代码行数:31,代码来源:tickets.php

示例3: getNameById

 function getNameById($id)
 {
     if ($id && ($dept = Dept::lookup($id))) {
         $name = $dept->getName();
     }
     return $name;
 }
开发者ID:dmiguel92,项目名称:osTicket-1.8,代码行数:7,代码来源:class.dept.php

示例4: create

 function create($vars, &$errors, $origin, $autorespond = true, $alertstaff = true)
 {
     global $cfg, $thisclient, $_FILES;
     //Make sure the email is not banned
     if ($vars['email'] && EmailFilter::isBanned($vars['email'])) {
         $errors['err'] = 'Ticket denied. Error #403';
         Sys::log(LOG_WARNING, 'Ticket denied', 'Banned email - ' . $vars['email']);
         return 0;
     }
     $id = 0;
     $fields = array();
     $fields['name'] = array('type' => 'string', 'required' => 1, 'error' => 'Name required');
     $fields['email'] = array('type' => 'email', 'required' => 1, 'error' => 'Valid email required');
     $fields['subject'] = array('type' => 'string', 'required' => 1, 'error' => 'Subject required');
     $fields['message'] = array('type' => 'text', 'required' => 1, 'error' => 'Message required');
     switch (strtolower($origin)) {
         case 'web':
             $fields['topicId'] = array('type' => 'int', 'required' => 1, 'error' => 'Select help topic');
             break;
         case 'staff':
             $fields['deptId'] = array('type' => 'int', 'required' => 1, 'error' => 'Dept. required');
             $fields['topicId'] = array('type' => 'int', 'required' => 1, 'error' => 'Topic required');
             $fields['duedate'] = array('type' => 'date', 'required' => 0, 'error' => 'Invalid date - must be MM/DD/YY');
         case 'api':
             $fields['source'] = array('type' => 'string', 'required' => 1, 'error' => 'Indicate source');
             break;
         case 'email':
             $fields['emailId'] = array('type' => 'int', 'required' => 1, 'error' => 'Email unknown');
             break;
         default:
             # TODO: Return error message
             $errors['origin'] = 'Invalid origin given';
     }
     $fields['pri'] = array('type' => 'int', 'required' => 0, 'error' => 'Invalid Priority');
     $fields['phone'] = array('type' => 'phone', 'required' => 0, 'error' => 'Valid phone # required');
     if (!Validator::process($fields, $vars, $errors) && !$errors['err']) {
         $errors['err'] = 'Missing or invalid data - check the errors and try again';
     }
     //Make sure phone extension is valid
     if ($vars['phone_ext']) {
         if (!is_numeric($vars['phone_ext']) && !$errors['phone']) {
             $errors['phone'] = 'Invalid phone ext.';
         } elseif (!$vars['phone']) {
             //make sure they just didn't enter ext without phone # XXX: reconsider allowing!
             $errors['phone'] = 'Phone number required';
         }
     }
     //Make sure the due date is valid
     if ($vars['duedate']) {
         if (!$vars['time'] || strpos($vars['time'], ':') === false) {
             $errors['time'] = 'Select time';
         } elseif (strtotime($vars['duedate'] . ' ' . $vars['time']) === false) {
             $errors['duedate'] = 'Invalid duedate';
         } elseif (strtotime($vars['duedate'] . ' ' . $vars['time']) <= time()) {
             $errors['duedate'] = 'Due date must be in the future';
         }
     }
     //check attachment..if any is set ...only set on webbased tickets..
     //XXX:?? Create ticket anyway and simply drop the attachments?? We're already doing so with emails.
     if ($_FILES['attachment']['name'] && $cfg->allowOnlineAttachments()) {
         if (!$cfg->canUploadFileType($_FILES['attachment']['name'])) {
             $errors['attachment'] = 'Invalid file type [ ' . Format::htmlchars($_FILES['attachment']['name']) . ' ]';
         } elseif ($_FILES['attachment']['size'] > $cfg->getMaxFileSize()) {
             $errors['attachment'] = 'File is too big. Max ' . $cfg->getMaxFileSize() . ' bytes allowed';
         }
     }
     # Perform email filter actions on the new ticket arguments XXX: Move filter to the top and check for reject...
     if (!$errors && ($ef = new EmailFilter($vars))) {
         $ef->apply($vars);
     }
     # Some things will need to be unpacked back into the scope of this
     # function
     if (isset($vars['autorespond'])) {
         $autorespond = $vars['autorespond'];
     }
     //check ticket limits..if limit set is >0
     //TODO: Base ticket limits on SLA... XXX: move it elsewhere??
     if ($vars['email'] && !$errors && $cfg->getMaxOpenTickets() > 0 && strcasecmp($origin, 'staff')) {
         $openTickets = Ticket::getOpenTicketsByEmail($vars['email']);
         if ($openTickets >= $cfg->getMaxOpenTickets()) {
             $errors['err'] = "You've reached the maximum open tickets allowed.";
             //Send the notice only once (when the limit is reached) incase of autoresponders at client end.
             if ($cfg->getMaxOpenTickets() == $openTickets && $cfg->sendOverlimitNotice()) {
                 if ($vars['deptId']) {
                     $dept = Dept::lookup($vars['deptId']);
                 }
                 if (!$dept || !($tpl = $dept->getTemplate())) {
                     $tpl = $cfg->getDefaultTemplate();
                 }
                 if (!$dept || !($email = $dept->getAutoRespEmail())) {
                     $email = $cfg->getDefaultEmail();
                 }
                 if ($tpl && ($msg = $tpl->getOverlimitMsgTemplate()) && $email) {
                     $body = str_replace('%name', $vars['name'], $msg['body']);
                     $body = str_replace('%email', $vars['email'], $msg['body']);
                     $body = str_replace('%url', $cfg->getBaseUrl(), $body);
                     $body = str_replace('%signature', $dept && $dept->isPublic() ? $dept->getSignature() : '', $body);
                     $email->send($vars['email'], $msg['subj'], $body);
                 }
                 //Log + Alert admin...this might be spammy (no option to disable)...but it is helpful..I think.
//.........这里部分代码省略.........
开发者ID:ryan1432,项目名称:osTicket-1.7fork,代码行数:101,代码来源:class.ticket.php

示例5: setDeptId

 function setDeptId($deptId)
 {
     //Make sure it's a valid department//
     if (!($dept = Dept::lookup($deptId)) || $dept->getId() == $this->getDeptId()) {
         return false;
     }
     $sql = 'UPDATE ' . TICKET_TABLE . ' SET updated=NOW(), dept_id=' . db_input($deptId) . ' WHERE ticket_id=' . db_input($this->getId());
     return db_query($sql) && db_affected_rows();
 }
开发者ID:gizur,项目名称:osticket,代码行数:9,代码来源:class.ticket.php

示例6: sprintf

                 $warn = sprintf(__('%1$d of %2$d %3$s made PRIVATE'), $num, $count, _N('selected department', 'selected departments', $count));
             }
         } else {
             $errors['err'] = sprintf(__('Unable to make %s private. Possibly already private!'), _N('selected department', 'selected departments', $count));
         }
         break;
     case 'delete':
         //Deny all deletes if one of the selections has members in it.
         $sql = 'SELECT count(staff_id) FROM ' . STAFF_TABLE . ' WHERE dept_id IN (' . implode(',', db_input($_POST['ids'])) . ')';
         list($members) = db_fetch_row(db_query($sql));
         if ($members) {
             $errors['err'] = __('Departments with agents can not be deleted. Move the agents first.');
         } else {
             $i = 0;
             foreach ($_POST['ids'] as $k => $v) {
                 if ($v != $cfg->getDefaultDeptId() && ($d = Dept::lookup($v)) && $d->delete()) {
                     $i++;
                 }
             }
             if ($i && $i == $count) {
                 $msg = sprintf(__('Successfully deleted %s'), _N('selected department', 'selected departments', $count));
             } elseif ($i > 0) {
                 $warn = sprintf(__('%1$d of %2$d %3$s deleted'), $i, $count, _N('selected department', 'selected departments', $count));
             } elseif (!$errors['err']) {
                 $errors['err'] = sprintf(__('Unable to delete %s.'), _N('selected department', 'selected departments', $count));
             }
         }
         break;
     default:
         $errors['err'] = __('Unknown action - get technical help.');
 }
开发者ID:dmiguel92,项目名称:osTicket-1.8,代码行数:31,代码来源:departments.php

示例7: require

<?php

require('staff.inc.php');
require_once(INCLUDE_DIR.'class.ticket.php');
require_once(INCLUDE_DIR.'class.dept.php');

if($_REQUEST['transferDeptId']==0)
{
	echo ("not an available department");
}
else{
    $dept=Dept::lookup($_REQUEST['transferDeptId']);
    $count = count($_REQUEST['tids']);
    $i=0;
    foreach ($_REQUEST['tids'] as $tid) {
        if (($ticket=Ticket::lookup($tid)))
        {
        	$ticket->setDeptId($_REQUEST['transferDeptId']);
        	$ticket->setStaffId(0);
        	$ticket->setTeamId(0);
            $ticket->setSLAId($dept->getSLAId());

        	if($ticket->getTeamId()==0&&$ticket->getStaffId()==0)
        		$i++;
        }

    }

	echo "Transferred ".$i." tickets successfully";
}
?>
开发者ID:KingsleyGU,项目名称:osticket,代码行数:31,代码来源:transferTicketToDepartment.php

示例8: getSignature

 function getSignature($type, $id = null)
 {
     global $thisstaff;
     if (!$thisstaff) {
         Http::response(403, 'Login Required');
     }
     switch ($type) {
         case 'none':
             break;
         case 'mine':
             echo Format::viewableImages($thisstaff->getSignature());
             break;
         case 'dept':
             if (!($dept = Dept::lookup($id))) {
                 Http::response(404, 'No such department');
             }
             echo Format::viewableImages($dept->getSignature());
             break;
         default:
             Http::response(400, 'Unknown signature type');
             break;
     }
 }
开发者ID:ed00m,项目名称:osTicket-1.8,代码行数:23,代码来源:ajax.content.php


注:本文中的Dept::lookup方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。