Skip to content
Snippets Groups Projects
Select Git revision
  • aeb3573d216d66e285a55d3afa030600a3e91f74
  • 3.9 default
  • develop
  • 6.0
  • 5.0
  • 4.0
  • scrutinizer-patch-4
  • scrutinizer-patch-3
  • scrutinizer-patch-2
  • scrutinizer-patch-1
  • 3.7
  • 3.8
  • 3.6
  • 3.9_backported
  • 3.8_backported
  • 3.7_backported
  • 3.5
  • 3.6_backported
  • 3.5_backported
  • 3.4
  • 3.3_backported
  • 6.0.4
  • 6.0.3
  • 5.0.7
  • 6.0.2
  • 6.0.1
  • 5.0.6
  • 6.0.0
  • 5.0.5
  • 6.0.0-rc
  • 5.0.4
  • 6.0.0-beta
  • 5.0.3
  • 4.0.6
  • 5.0.2
  • 5.0.1
  • 4.0.5
  • 5.0.0
  • 4.0.4
  • 5.0.0-rc2
  • 5.0.0-rc1
41 results

project.php

Blame
  • ApprovalActionsQueue.php 1.70 KiB
    <?php
    
    require_once 'ApprovalActionTable/Interface.php';
    
    class ApprovalActionsQueue extends Nmc_Db_Table
                               implements Application_ApprovalActionTable_Interface
    {
        protected $_primary = 'approvalActionId';
        protected $_rowClass = 'ApprovalActionQueue';
    
        /**
         * The one true instance
         *
         * @var ApprovalActionsQueue
         */
        static protected $_instance;
    
        /**
         * Return the one true instance
         *
         * @return ApprovalActionsQueue
         */
        static public function getInstance($config = array())
        {
            if (!self::$_instance) {
                self::$_instance = new ApprovalActionsQueue($config);
            }
            return self::$_instance;
        }
    
        public function getActionName()
        {
            return 'Queue';
        }
    
        public function getResultStatusStrings()
        {
            return array('Approved' => 'Approved',
                         'Denied' => 'Denied');
        }
    
        public function getEditTemplate()
        {
            return 'approval_actions/ApprovalActionQueue.xhtml';
        }
    
        public function fetchNew($formData = null)
        {
            if (!$formData) {
                return parent::fetchNew();
            }
    
            $new = parent::fetchNew();
            $new->className = 'ApprovalActionQueue';
    
            return $new;
        }
    
        static public function advanceQueues()
        {
            $datesTable = ApprovalActionsQueueDates::getInstance();
            $db = $datesTable->getAdapter();
    
            $where = $db->quoteInto('date <= ?', time());
            $requestQueues = $datesTable->fetchAll($where);
    
            foreach ($requestQueues as $requestQueue) {
                $requestQueue->approvalAction->advanceQueue($requestQueue->date);
                $requestQueue->delete();
            }
        }
    
    
    }