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


PHP Ticket类代码示例

本文整理汇总了PHP中Ticket的典型用法代码示例。如果您正苦于以下问题:PHP Ticket类的具体用法?PHP Ticket怎么用?PHP Ticket使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: validateTicket

 public function validateTicket(Ticket $ticket)
 {
     // this is all the numbers that has been matched for the ticket
     $numbers = [[], [], []];
     // this is the count of the different rows
     $rows = [0, 0, 0];
     // this is the array of the numbers that completed the different rows
     $winningNumbers = [0, 0, 0];
     // the number of rows completed
     $completedRows = 0;
     // the last row with a valid number
     $winningRow = 0;
     foreach ($this->drawnNumbers as $number) {
         $row = $ticket->getNumberRow($number);
         // number is located in a row in the ticket
         if (!is_null($row)) {
             $numbers[$row][] = $number;
             $winningRow = $row;
             if (++$rows[$row] == 5) {
                 $winningNumbers[$completedRows] = $number;
                 $completedRows++;
             }
         }
     }
     if ($completedRows >= $this->rows) {
         return ["win" => True, "numbers" => $numbers, "winningNumbers" => $winningNumbers, "winningRow" => $winningRow];
     } else {
         return ["win" => False, "numbers" => $numbers, "winningNumbers" => $winningNumbers, "winningRow" => $winningRow];
     }
 }
开发者ID:jorzhikgit,项目名称:bingo,代码行数:30,代码来源:Round.php

示例2: getallAction

 protected function getallAction()
 {
     $translate = $this->application->getBootstrap()->getResource('translate');
     $view = $this->application->getBootstrap()->getResource('view');
     $view->setScriptPath(APPLICATION_PATH . '/views/scripts');
     $acl = Zend_Controller_Front::getInstance()->getParam('bootstrap')->getResource('formacl');
     $queueticketObj = new Queueticket();
     $queueticketRows = $queueticketObj->fetchAll("ghost = false");
     foreach ($queueticketRows as $queueticketRow) {
         try {
             $mail = new Zend_Mail_Storage_Imap(array('host' => $queueticketRow['input_email_host'], 'user' => $queueticketRow['input_email_user'], 'password' => $queueticketRow['input_email_password']));
             for ($i = 1; $i <= $mail->countMessages(); $i++) {
                 $message = $mail->getMessage($i);
                 if (!$message->hasFlag(Zend_Mail_Storage::FLAG_SEEN)) {
                     $values = array('subject' => $message->subject, 'content' => $message->getContent(), 'priority' => substr($queueticketRow['available_priority'], 0, 1), 'state' => substr($queueticketRow['available_states'], 0, 1), 'start' => date("c"), 'id_queue' => $queueticketRow['id']);
                     $model = new Ticket();
                     $row = $model->createRow($values);
                     $row->save();
                     $mail->setFlags($i, array(Zend_Mail_Storage::FLAG_SEEN));
                 }
             }
         } catch (Exception $e) {
             print_r($e->getMessage());
         }
     }
 }
开发者ID:knatorski,项目名称:SMS,代码行数:26,代码来源:ticketgeter.php

示例3: afterAdd

 static function afterAdd(Group_Ticket $item)
 {
     global $DB;
     //Toolbox::logDebug(__METHOD__, $item);
     $config = PluginBehaviorsConfig::getInstance();
     if ($config->getField('add_notif')) {
         if ($item->getField('type') == CommonITILActor::ASSIGN) {
             $ticket = new Ticket();
             if ($ticket->getFromDB($item->getField('tickets_id'))) {
                 NotificationEvent::raiseEvent('plugin_behaviors_ticketnewgrp', $ticket);
             }
         }
     }
     // Check is the connected user is a tech
     if (!is_numeric(Session::getLoginUserID(false)) || !Session::haveRight('own_ticket', 1)) {
         return false;
         // No check
     }
     $config = PluginBehaviorsConfig::getInstance();
     if ($config->getField('single_tech_mode') != 0 && $item->input['type'] == CommonITILActor::ASSIGN) {
         $crit = array('tickets_id' => $item->input['tickets_id'], 'type' => CommonITILActor::ASSIGN);
         foreach ($DB->request('glpi_groups_tickets', $crit) as $data) {
             if ($data['id'] != $item->getID()) {
                 $gu = new Group_Ticket();
                 $gu->delete($data);
             }
         }
         if ($config->getField('single_tech_mode') == 2) {
             foreach ($DB->request('glpi_tickets_users', $crit) as $data) {
                 $gu = new Ticket_User();
                 $gu->delete($data);
             }
         }
     }
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:35,代码来源:group_ticket.class.php

示例4: testCreateTicketWithActors

 /**
  * @dataProvider ticketProvider
  */
 public function testCreateTicketWithActors($ticketActors)
 {
     $ticket = new Ticket();
     $ticket->add(array('name' => 'ticket title', 'description' => 'a description') + $ticketActors);
     $this->assertFalse($ticket->isNewItem());
     $ticketId = $ticket->getID();
     foreach ($ticketActors as $actorType => $actorsList) {
         // Convert single actor (scalar value) to array
         if (!is_array($actorsList)) {
             $actorsList = array($actorsList);
         }
         // Check all actors are assigned to the ticket
         foreach ($actorsList as $index => $actor) {
             $notify = isset($actorList['_users_id_requester_notif']['use_notification'][$index]) ? $actorList['_users_id_requester_notif']['use_notification'][$index] : 1;
             $alternateEmail = isset($actorList['_users_id_requester_notif']['use_notification'][$index]) ? $actorList['_users_id_requester_notif']['alternative_email'][$index] : '';
             switch ($actorType) {
                 case '_users_id_assign':
                     $this->_testTicketUser($ticket, $actor, CommonITILActor::REQUESTER, $notify, $alternateEmail);
                     break;
                 case '_users_id_observer':
                     $this->_testTicketUser($ticket, $actor, CommonITILActor::OBSERVER, $notify, $alternateEmail);
                     break;
                 case '_users_id_assign':
                     $this->_testTicketUser($ticket, $actor, CommonITILActor::ASSIGN, $notify, $alternateEmail);
                     break;
             }
         }
     }
 }
开发者ID:glpi-project,项目名称:glpi,代码行数:32,代码来源:TicketTest.php

示例5: plugin_vip_item_delete

 static function plugin_vip_item_delete(Ticket $ticket)
 {
     global $DB;
     $ticketid = $ticket->getField('id');
     $delticketquery = "DELETE FROM glpi_plugin_vip_tickets\n\t\t\t\t\t\t\t\t WHERE id = " . $ticketid;
     $delvipticket = $DB->query($delticketquery);
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:7,代码来源:ticket.class.php

示例6: pdfForTicket

 static function pdfForTicket(PluginPdfSimplePDF $pdf, Ticket $ticket)
 {
     $survey = new TicketSatisfaction();
     $pdf->setColumnsSize(100);
     $pdf->displayTitle("<b>" . __('Satisfaction survey') . "</b>");
     if (!$survey->getFromDB($ticket->getID())) {
         $pdf->displayLine(__('No generated survey'));
     } else {
         if ($survey->getField('type') == 2) {
             $url = Entity::generateLinkSatisfaction($ticket);
             $pdf->displayLine(sprintf(__('%1$s (%2$s)'), __('External survey'), $url));
         } else {
             if ($survey->getField('date_answered')) {
                 $sat = $survey->getField('satisfaction');
                 $tabsat = array(0 => __('None'), 1 => __('1 star', 'pdf'), 2 => __('2 stars', 'pdf'), 3 => __('3 stars', 'pdf'), 4 => __('4 stars', 'pdf'), 5 => __('5 stars', 'pdf'));
                 if (isset($tabsat[$sat])) {
                     $sat = $tabsat[$sat] . "  ({$sat}/5)";
                 }
                 $pdf->displayLine('<b>' . sprintf(__('%1$s: %2$s'), __('Response date to the satisfaction survey') . '</b>', Html::convDateTime($survey->getField('date_answered'))));
                 $pdf->displayLine('<b>' . sprintf(__('%1$s: %2$s'), __('Satisfaction with the resolution of the ticket') . '</b>', $sat));
                 $pdf->displayText('<b>' . sprintf(__('%1$s: %2$s'), __('Comments') . '</b>', $survey->getField('comment')));
             } else {
                 // No answer
                 $pdf->displayLine(sprintf(__('%1$s: %2$s'), __('Creation date of the satisfaction survey'), Html::convDateTime($survey->getField('date_begin'))));
                 $pdf->displayLine(__('No answer', 'pdf'));
             }
         }
     }
     $pdf->displaySpace();
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:30,代码来源:ticketsatisfaction.class.php

示例7: pdfForTicket

 static function pdfForTicket(PluginPdfSimplePDF $pdf, Ticket $job)
 {
     global $CFG_GLPI, $DB;
     $ID = $job->getField('id');
     //////////////followups///////////
     $query = "SELECT *\n                FROM `glpi_ticketcosts`\n                WHERE `tickets_id` = '{$ID}'\n                ORDER BY `begin_date`";
     $result = $DB->query($query);
     if (!$DB->numrows($result)) {
         $pdf->setColumnsSize(100);
         $pdf->displayLine(__('No ticket cost for this ticket', 'pdf'));
     } else {
         $pdf->setColumnsSize(60, 20, 20);
         $pdf->displayTitle("<b>" . TicketCost::getTypeName($DB->numrows($result)), __('Ticket duration'), CommonITILObject::getActionTime($job->fields['actiontime']) . "</b>");
         $pdf->setColumnsSize(20, 10, 10, 10, 10, 10, 10, 10, 10);
         $pdf->setColumnsAlign('center', 'center', 'center', 'left', 'right', 'right', 'right', 'right', 'right');
         $pdf->displayTitle("<b><i>" . __('Name') . "</i></b>", "<b><i>" . __('Begin date') . "</i></b>", "<b><i>" . __('End date') . "</i></b>", "<b><i>" . __('Budget') . "</i></b>", "<b><i>" . __('Duration') . "</i></b>", "<b><i>" . __('Time cost') . "</i></b>", "<b><i>" . __('Fixed cost') . "</i></b>", "<b><i>" . __('Material cost') . "</i></b>", "<b><i>" . __('Total cost') . "</i></b>");
         while ($data = $DB->fetch_array($result)) {
             $cost = TicketCost::computeTotalCost($data['actiontime'], $data['cost_time'], $data['cost_fixed'], $data['cost_material']);
             $pdf->displayLine($data['name'], Html::convDate($data['begin_date']), Html::convDate($data['end_date']), Dropdown::getDropdownName('glpi_budgets', $data['budgets_id']), CommonITILObject::getActionTime($data['actiontime']), Html::formatNumber($data['cost_time']), Html::formatNumber($data['cost_fixed']), Html::formatNumber($data['cost_material']), Html::formatNumber($cost));
             $total_time += $data['actiontime'];
             $total_costtime += $data['actiontime'] * $data['cost_time'] / HOUR_TIMESTAMP;
             $total_fixed += $data['cost_fixed'];
             $total_material += $data['cost_material'];
             $total += $cost;
         }
         $pdf->setColumnsSize(50, 10, 10, 10, 10, 10);
         $pdf->setColumnsAlign('right', 'right', 'right', 'right', 'right', 'right');
         $pdf->displayLine('<b>' . __('Total'), CommonITILObject::getActionTime($total_time), Html::formatNumber($total_costtime), Html::formatNumber($total_fixed), Html::formatNumber($total_material), Html::formatNumber($total));
     }
     $pdf->displaySpace();
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:31,代码来源:ticketcost.class.php

示例8: pdfForTicket

 static function pdfForTicket(PluginPdfSimplePDF $pdf, Ticket $ticket)
 {
     global $CFG_GLPI, $DB;
     $pdf->setColumnsSize(100);
     $pdf->displayTitle("<b>" . __('Approvals for the ticket') . "</b>");
     if (!Session::haveRight('validate_request', 1) && !Session::haveRight('validate_incident', 1) && !Session::haveRight('create_incident_validation', 1) && !Session::haveRight('create_request_validation', 1)) {
         return false;
     }
     $ID = $ticket->getField('id');
     $query = "SELECT *\n                FROM `glpi_ticketvalidations`\n                WHERE `tickets_id` = '" . $ticket->getField('id') . "'\n                ORDER BY submission_date DESC";
     $result = $DB->query($query);
     $number = $DB->numrows($result);
     if ($number) {
         $pdf->setColumnsSize(20, 19, 21, 19, 21);
         $pdf->displayTitle(_x('item', 'State'), __('Request date'), __('Approval requester'), __('Approval date'), __('Approver'));
         while ($row = $DB->fetch_assoc($result)) {
             $pdf->setColumnsSize(20, 19, 21, 19, 21);
             $pdf->displayLine(TicketValidation::getStatus($row['status']), Html::convDateTime($row["submission_date"]), getUserName($row["users_id"]), Html::convDateTime($row["validation_date"]), getUserName($row["users_id_validate"]));
             $tmp = trim($row["comment_submission"]);
             $pdf->displayText("<b><i>" . sprintf(__('%1$s: %2$s'), __('Request comments') . "</i></b>", empty($tmp) ? __('None') : $tmp, 1));
             if ($row["validation_date"]) {
                 $tmp = trim($row["comment_validation"]);
                 $pdf->displayText("<b><i>" . sprintf(__('%1$s: %2$s'), __('Approval comments') . "</i></b>", empty($tmp) ? __('None') : $tmp, 1));
             }
         }
     } else {
         $pdf->displayLine(__('No item found'));
     }
     $pdf->displaySpace();
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:30,代码来源:ticketvalidation.class.php

示例9: loadCustomCssJs

    /**
     * Register custom CSS/JS for the page
     * @return void
     */
    public function loadCustomCssJs()
    {
        $html = $this->head['html'];
        parent::loadCustomCssJs();
        $this->head['html'] = $html;
        if (is_null($this->resourceArray['properties'])) {
            $this->resourceArray['properties'] = array();
        }
        $this->resourceArray['properties']['tickets'] = $this->resource->getProperties('tickets');
        /** @var Tickets $Tickets */
        $Tickets = $this->modx->getService('Tickets');
        $Tickets->loadManagerFiles($this, array('config' => true, 'utils' => true, 'css' => true, 'ticket' => true, 'comments' => true));
        $this->addLastJavascript($Tickets->config['jsUrl'] . 'mgr/ticket/update.js');
        $ready = array('xtype' => 'tickets-page-ticket-update', 'resource' => $this->resource->get('id'), 'record' => $this->resourceArray, 'publish_document' => (int) $this->canPublish, 'preview_url' => $this->previewUrl, 'locked' => (int) $this->locked, 'lockedText' => $this->lockedText, 'canSave' => (int) $this->canSave, 'canEdit' => (int) $this->canEdit, 'canCreate' => (int) $this->canCreate, 'canDuplicate' => (int) $this->canDuplicate, 'canDelete' => (int) $this->canDelete, 'show_tvs' => (int) (!empty($this->tvCounts)), 'mode' => 'update');
        $this->addHtml('
		<script type="text/javascript">
		// <![CDATA[
		MODx.config.publish_document = ' . (int) $this->canPublish . ';
		MODx.onDocFormRender = "' . $this->onDocFormRender . '";
		MODx.ctx = "' . $this->ctx . '";
		Ext.onReady(function() {
			MODx.load(' . $this->modx->toJSON($ready) . ');
		});
		// ]]>
		</script>');
    }
开发者ID:soulcreate,项目名称:Tickets,代码行数:30,代码来源:update.class.php

示例10: ticket_count

 function ticket_count()
 {
     $cc = new ConstraintChain();
     $cc->add(new Constraint('ticket_release_version_id', '=', $this->id));
     $ticket = new Ticket();
     $tickets = $ticket->getAll($cc);
     return count($tickets);
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:8,代码来源:TicketReleaseVersion.php

示例11: post_addItem

 function post_addItem()
 {
     if ($this->fields['itemtype'] == 'Ticket') {
         $ticket = new Ticket();
         $ticket->update(array('id' => $this->fields['items_id'], 'date_mod' => $_SESSION["glpi_currenttime"], '_forcenotif' => true, '_donotadddocs' => true));
     }
     parent::post_addItem();
 }
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:8,代码来源:document_item.class.php

示例12: afterUpdate

 static function afterUpdate(TicketSatisfaction $ticketsatisfaction)
 {
     $config = PluginBehaviorsConfig::getInstance();
     $ticket = new Ticket();
     if ($config->getField('add_notif') && $ticket->getFromDB($ticketsatisfaction->getField('tickets_id')) && $ticketsatisfaction->input["date_answered"]) {
         NotificationEvent::raiseEvent('plugin_behaviors_replysurvey', $ticket);
     }
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:8,代码来源:ticketsatisfaction.class.php

示例13: garbage

 function garbage()
 {
     $deadline = date('Y-m-d H:i:s', time() - 24 * 60 * 60 * 5);
     // keep tickets for 5 days.
     App::import('model', 'Core.Ticket');
     $ticketObj = new Ticket();
     $data = $ticketObj->query('DELETE from tickets WHERE created < \'' . $deadline . '\'');
 }
开发者ID:jamiemill,项目名称:missioncontrol_core,代码行数:8,代码来源:tickets.php

示例14: reply_on_ticket

/**
* This function is beign used to reply on a ticket.
* It will first check if the user who executed this function is a mod/admin or the topic creator himself. If this is not the case the page will be redirected to an error page.
* in case the isset($_POST['hidden'] is set and the user is a mod, the message will be hidden for the topic starter. The reply will be created. If $_POST['ChangeStatus']) & $_POST['ChangePriority'] is set
* it will try to update the status and priority. Afterwards the page is being redirecte to the ticket again.
* @author Daan Janssens, mentored by Matthew Lagoe
*/
function reply_on_ticket()
{
    global $INGAME_WEBPATH;
    global $WEBPATH;
    //if logged in
    if (WebUsers::isLoggedIn() && isset($_POST['ticket_id'])) {
        $ticket_id = filter_var($_POST['ticket_id'], FILTER_SANITIZE_NUMBER_INT);
        $target_ticket = new Ticket();
        $target_ticket->load_With_TId($ticket_id);
        //check if the user who executed this function is a mod/admin or the topic creator himself.
        if ($target_ticket->getAuthor() == unserialize($_SESSION['ticket_user'])->getTUserId() || Ticket_User::isMod(unserialize($_SESSION['ticket_user']))) {
            try {
                $author = unserialize($_SESSION['ticket_user'])->getTUserId();
                if (isset($_POST['Content'])) {
                    $content = $_POST['Content'];
                } else {
                    $content = "";
                }
                $hidden = 0;
                if (isset($_POST['hidden']) && Ticket_User::isMod(unserialize($_SESSION['ticket_user']))) {
                    $hidden = 1;
                }
                //create the reply
                Ticket::createReply($content, $author, $ticket_id, $hidden);
                //try to update the status & priority in case these are set.
                if (isset($_POST['ChangeStatus']) && isset($_POST['ChangePriority']) && Ticket_User::isMod(unserialize($_SESSION['ticket_user']))) {
                    $newStatus = filter_var($_POST['ChangeStatus'], FILTER_SANITIZE_NUMBER_INT);
                    $newPriority = filter_var($_POST['ChangePriority'], FILTER_SANITIZE_NUMBER_INT);
                    Ticket::updateTicketStatusAndPriority($ticket_id, $newStatus, $newPriority, $author);
                }
                header("Cache-Control: max-age=1");
                if (Helpers::check_if_game_client()) {
                    header("Location: " . $INGAME_WEBPATH . "?page=show_ticket&id=" . $ticket_id);
                } else {
                    header("Location: " . $WEBPATH . "?page=show_ticket&id=" . $ticket_id);
                }
                throw new SystemExit();
            } catch (PDOException $e) {
                //ERROR: LIB DB is not online!
                print_r($e);
                //header("Location: index.php");
                throw new SystemExit();
            }
        } else {
            //ERROR: No access!
            $_SESSION['error_code'] = "403";
            header("Cache-Control: max-age=1");
            header("Location: index.php?page=error");
            throw new SystemExit();
        }
    } else {
        //ERROR: not logged in!
        header("Cache-Control: max-age=1");
        header("Location: index.php");
        throw new SystemExit();
    }
}
开发者ID:cls1991,项目名称:ryzomcore,代码行数:64,代码来源:reply_on_ticket.php

示例15: afterPurge

 static function afterPurge(Document_Item $document_item)
 {
     $config = PluginBehaviorsConfig::getInstance();
     if ($config->getField('add_notif') && $document_item->fields['itemtype'] == 'Ticket' && isset($_POST['item'])) {
         // prevent not use in case of purge ticket
         $ticket = new Ticket();
         $ticket->getFromDB($document_item->fields['items_id']);
         NotificationEvent::raiseEvent('plugin_behaviors_document_itemdel', $ticket);
     }
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:10,代码来源:document_item.class.php


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