コード例 #1
1
 public function actionMarkpaid()
 {
     if (!empty($_REQUEST['id']) && !empty($_REQUEST['rupee'])) {
         $dispatch = Dispatch::model()->findByPk($_REQUEST['id']);
         $dispatch->status = "Paid";
         $dispatch->status_id = 4;
         if ($dispatch->save()) {
             $payment = new Payment();
             $payment->dispatch_id = $_REQUEST['id'];
             $payment->rupee = $_REQUEST['rupee'];
             $payment->court_id = $dispatch->court_id;
             $payment->user_id = Yii::app()->user->id;
             $payment->court_id = $dispatch->court_id;
             $payment->challan_id = $dispatch->challan_id;
             $payment->created = date("Y-m-d H:i:s", time());
             $payment->paid_at = "Court";
             if ($payment->save()) {
                 $challan = Challan::model()->findByPk($dispatch->challan_id);
                 $challan->status_id = 4;
                 $challan->save();
                 echo "1";
             }
         } else {
             echo "0";
         }
     } else {
         echo "-1";
     }
     exit;
 }
コード例 #2
0
ファイル: Utils.php プロジェクト: kentfredric/Dispatcher
 public static function extract_param(array $parammap, array $spec)
 {
     $paramname = $spec['name'];
     $required = $spec['required'];
     $default = null;
     #  = $spec['default'];
     $param = null;
     #
     $has_default = array_key_exists('default', $spec);
     if ($has_default) {
         $default = $spec['default'];
     }
     $has_param = array_key_exists($paramname, $parammap);
     if ($has_param) {
         $param = $parammap[$paramname];
     }
     if ($required && !$has_param) {
         Dispatch::Exception('Parameters_Required', 'required parameter ' . $paramname . ' was not found');
     }
     if (!$has_param && $has_default) {
         return $default;
     }
     if (!$has_param && !$has_default) {
         return null;
     }
     return $param;
 }
コード例 #3
0
    /**
     * Display tabs.
     *
     * @param string $current_tab
     */
    public function tabs($current_tab)
    {
        ?>

		<div class="classes-nav">
			<h3 class="nav-tab-wrapper">
				<?php 
        foreach (Dispatch::get_tabs() as $slug => $tab) {
            ?>
					<a class="nav-tab <?php 
            echo $current_tab == $slug ? 'nav-tab-active' : '';
            ?>
" href="<?php 
            echo $tab['link'];
            ?>
">
						<?php 
            echo $tab['name'];
            ?>
					</a>
				<?php 
        }
        ?>
			</h3>
		</div>

		<?php 
    }
コード例 #4
0
ファイル: kcmvc.php プロジェクト: hfutxrl2011/KCframwork
 function process()
 {
     $input_filter = new InputFilter();
     $input_filter->process($this);
     if (!is_null($this->request->get("method"))) {
         $basic = array('reqip' => $this->request->userip . ':' . $this->request->clientip, 'uri' => $this->request->url, 'method' => $this->request->get("method"), 'logid' => $this->requestId);
     } else {
         $basic = array('reqip' => $this->request->userip . ':' . $this->request->clientip, 'uri' => $this->request->url, 'logid' => $this->requestId);
     }
     kc_log_addbasic($basic);
     $dispatch = new Dispatch($this);
     App::getTimer()->set('framework prepare');
     $dispatch->dispatch_url($this->request->url);
     $this->response->send();
     KC_LOG_TRACE('[TIME COST STATISTIC] [ ' . App::getTimer()->getString() . ' ].');
 }
コード例 #5
0
ファイル: Basic.php プロジェクト: kentfredric/Dispatcher
 public function action($request)
 {
     $action = $this->action;
     if (!isset($this->action)) {
         Dispatch::Exception('Dispatch', 'Cannot get action for ' . get_class($this) . ', no action specified in advance, did you remember to call ->execute( $action ) ?');
     }
     $action->set_param('rule_class', array('value' => get_class($this)));
     $action->set_param('request', array('value' => $request));
     $action->set_param('dispatcher', array('value' => &$this->dispatcher));
     $action->set_param('rule', array('value' => $this));
     return $action;
 }
コード例 #6
0
ファイル: View.class.php プロジェクト: happyxlq/pd
 public static function getPart($module, $action = null, $params = array())
 {
     if (strlen(trim($action)) <= 0) {
         $action = Config::DEFAULT_ACTION;
     }
     $part = Dispatch::getPart($module);
     $part->params = $params;
     //var_dump($params);
     $template = $part->execute($action);
     //var_dump($template);
     include self::getBody("_" . $template);
 }
コード例 #7
0
ファイル: BaseController.php プロジェクト: birdiebel/G2016
 /**
  * @param $id
  * @param $backUrl
  * @return \Illuminate\Http\RedirectResponse
  * @throws Exception
  */
 public function delete($backUrl = 'home', $id)
 {
     if (method_exists($this, 'beforeDelete')) {
         return $this->beforeDelete($id);
     }
     // Defini content
     $this->dsp->template = 'layouts.templates.user';
     $this->dsp->content = $this->dsp->delete;
     // Find
     $mod = $this->model;
     $datas = $mod::find($id);
     $delRoute = $this->prefix . '.dodelete';
     // Param delete
     $this->dsp->addVar('param', ['titre' => gl('Supression'), 'backUrl' => $backUrl, 'delRoute' => $delRoute, 'datas' => $datas]);
     return View::make('dispatch')->with(['dsp' => $this->dsp]);
 }
コード例 #8
0
 public function run()
 {
     if (strpos($_SERVER["REQUEST_URI"], "?")) {
         $a_request_uri = explode("?", $_SERVER["REQUEST_URI"]);
         $request_uri = $a_request_uri[0];
     } else {
         $request_uri = $_SERVER["REQUEST_URI"];
     }
     $request_uri = explode(Settings::getItem('webroot'), $request_uri);
     $route = Routes::getByUrl(Routes::getRealPathOfRequest($request_uri[1]));
     if (Routes::verifyRoute($request_uri[1])) {
         if (Settings::getItem('authentication') === true and Auth::verifyControllerAuth($route["controller"], $route["action"])) {
             if (Auth::verifyAuth()) {
                 Dispatch::dispatch($request_uri[1], $route["controller"] . "Controller", $route["action"]);
             } else {
                 foreach (Routes::getParse() as $route) {
                     if (array_key_exists('behavior', $route)) {
                         if ($route["behavior"] == "login") {
                             Routes::httpRedirect(Routes::getUrlByName($route["name"]));
                         }
                     }
                 }
             }
         } else {
             Dispatch::dispatch($request_uri[1], $route["controller"] . "Controller", $route["action"]);
         }
     } else {
         foreach (Routes::getParse() as $route) {
             if (array_key_exists('behavior', $route)) {
                 if ($route["behavior"] == "404") {
                     Routes::httpRedirect(Routes::getUrlByName($route["name"]));
                 }
             }
         }
     }
 }
コード例 #9
0
ファイル: dispatch-test.php プロジェクト: hmmbug/unbindery
    public $colors = array("red", "orange", "yellow", "green", "blue", "indigo", "violet");
    public function getNextColor()
    {
        $color = array_pop($this->colors);
        return $color;
    }
}
$colors = new Colors();
// Get next available item function
function getNextAvailable($params)
{
    global $colors;
    return $colors->getNextColor();
}
// Test code
$dispatch = new Dispatch();
$dispatch->register('getNextAvailable');
$dispatch->init(array('colors' => $colors));
echo "Getting next item: ";
$color = $dispatch->next();
echo $color ? $color : 'end of list';
echo "\nGetting next item: ";
$color = $dispatch->next();
echo $color ? $color : 'end of list';
echo "\nGetting next item: ";
$color = $dispatch->next();
echo $color ? $color : 'end of list';
echo "\nGetting next item: ";
$color = $dispatch->next();
echo $color ? $color : 'end of list';
echo "\nGetting next item: ";
コード例 #10
0
ファイル: Router.php プロジェクト: noikiy/inovi
 private static function defaultRoute()
 {
     $tab = explode('/', substr(static::$_uri, 1));
     if (count($tab) > 1) {
         if (3 != count($tab)) {
             $module = container()->getConfig()->getDefaultModule();
             $module = Inflector::lower($module);
             $controller = Inflector::lower(Arrays::first($tab));
             $action = $tab[1];
         } else {
             list($module, $controller, $action) = $tab;
             $module = Inflector::lower($module);
             $controller = Inflector::lower($controller);
             $action = Inflector::lower($action);
         }
         $action = repl(array('.html', '.php', '.asp', '.jsp', '.cfm', '.py', '.pl'), array('', '', '', '', '', '', ''), $action);
         if (true === container()->getMultiSite()) {
             $moduleDir = APPLICATION_PATH . DS . SITE_NAME . DS . 'modules' . DS . $module;
         } else {
             $moduleDir = APPLICATION_PATH . DS . 'modules' . DS . $module;
         }
         $controllerDir = $moduleDir . DS . 'controllers';
         $controllerFile = $controllerDir . DS . $controller . 'Controller.php';
         if (true === File::exists($controllerFile)) {
             require_once $controllerFile;
             $controllerClass = 'Thin\\' . $controller . 'Controller';
             $controllerInstance = new $controllerClass();
             $actions = get_class_methods($controllerInstance);
             $actionName = $action . 'Action';
             if (Arrays::inArray($actionName, $actions)) {
                 $dispatch = new Dispatch();
                 $dispatch->setModule($module);
                 $dispatch->setController($controller);
                 $dispatch->setAction(Inflector::uncamelize($action, '-'));
                 Utils::set('appDispatch', $dispatch);
                 return true;
             }
         }
     }
     return null;
 }
コード例 #11
0
ファイル: init.php プロジェクト: happyxlq/pd
require_once 'zee/message/Errors.class.php';
require_once 'zee/message/Messages.class.php';
require_once 'zee/lang/Language.class.php';
require_once 'zee/lang/LanguageContentValue.class.php';
require_once 'zee/lang/LanguageValue.class.php';
require_once 'zee/lang/LanguageService.class.php';
require_once 'zee/lang/LanguageContentService.class.php';
//==================
// Request
//==================
Request::init($_REQUEST);
//==================
// DB
//==================
Zee::register('DB', new DB());
//==================
// Language
//==================
//==================
// Exec Pre Filters
//==================
FilterHelper::execFilters(FilterHelper::PRE_FILTER);
//==================
// Do Module
//==================
$controller = Dispatch::getController(Request::getModule());
$controller->execute(Request::getAction());
//==================
// Exec Post Filters
//==================
FilterHelper::execFilters(FilterHelper::POST_FILTER);
コード例 #12
0
<div class="information white">

    <div class="bloc-page-titre">
        <table width="100%">
            <tr>
                <td>{{ gl('Les configurations de départs') }}</td>
                <td class="right">{{ Xbutton::bttAdd('configdepart.create',['tour'],'Ajouter une Configuration') }}</td>
            </tr>
        </table>
    </div>

    <div>
        <?php 
$cat['datas'] = MySession::getModel('tour')->configdeparts;
$cat['module'] = '';
$cat['actions'] = 'edit,delete';
$cat['backUrl'] = 'tour';
$catDatas = Dispatch::displayList($cat);
?>
        {{ $catDatas['code'] }}
    </div>

</div>
コード例 #13
0
try {
    require_once "vanilla/setup.php";
} catch (Exception $e) {
    lib::log_exception($e);
    print lib::debugbox();
    exit;
}
# if the application's setup code doesn't define a class named Dispatch,
# create one here which is just empty
if (!class_exists('Dispatch')) {
    class Dispatch extends AbstractDispatch
    {
    }
}
try {
    $dispatch = new Dispatch();
    $dispatch->parse_request();
    $dispatch->invoke_form_handler();
    $dispatch->find_controller_class();
    $dispatch->create_controller();
    $dispatch->render();
} catch (HTTPException $e) {
    header("HTTP/1.1 " . $e->getCode() . ' ' . $e->getMessage());
    header("Content-type: text/html");
    if ($loc = $e->location()) {
        header("Location: {$loc}");
    }
    print $e->body();
    print lib::debugbox();
} catch (DataException $e) {
    header("HTTP/1.1 404 Data Exception");
コード例 #14
0
                   
                    <label><b>Dispatch Report <?php 
echo $hoy = date("F j, Y, g:i a");
?>
</b></label>
                    <br/><br/>
                     <table align="center" border="0" style="width: 200px">
                        <tr>
                            <td>
                                <label><b>Sales</b></label>
                            </td>
                        </tr>
                    
                    <?php 
include_once "../model/Dispatch.php";
$objDispatch = new Dispatch();
$sales = $objDispatch->getSalesByCustomer();
?>
                      <tr>
                            <td><?php 
echo $sales;
?>
</td>
                      </tr>  
                    <?php 
$totaSales = $objDispatch->getTotalSales();
?>
                      <tr>
                            <td><?php 
echo $totaSales;
?>
コード例 #15
0
 public function GetDispatchList($page, $destinationId = null, $courseId = null, $dispatchId = null, $tagList = null)
 {
     $request = new ServiceRequest($this->_configuration);
     $params = array("page" => $page);
     if ($destinationId != null) {
         $params['destinationid'] = $destinationId;
     }
     if ($courseId != null) {
         $params['courseid'] = $courseId;
     }
     if ($tagList != null && count($tagList) > 0) {
         $params['tags'] = implode(',', $tagList);
     }
     $request->setMethodParams($params);
     $response = $request->CallService("rustici.dispatch.getDispatchList");
     return Dispatch::parseDispatchList($response);
 }
コード例 #16
0
ファイル: scheduler.php プロジェクト: rjmackay/Ushahidi_Web
 public function index()
 {
     // Debug
     $debug = "";
     // @todo abstract most of this into a library, especially locking
     // Ensure settings entry for `scheduler_lock` exists
     Database::instance()->query("INSERT IGNORE INTO `" . Kohana::config('database.default.table_prefix') . "settings`\n\t\t\t(`key`, `value`) VALUES ('scheduler_lock', 0)");
     // Now try and update the scheduler_lock
     $result = Database::instance()->query("UPDATE `" . Kohana::config('database.default.table_prefix') . "settings`\n\t\t\tSET `value` = UNIX_TIMESTAMP() + 180\n\t\t\tWHERE `value` < UNIX_TIMESTAMP() AND `key` = 'scheduler_lock';");
     // If no entries were changed, scheduler is already running
     if ($result->count() <= 0) {
         Kohana::log('info', 'Could not acquire scheduler lock');
         if (isset($_GET['debug']) and $_GET['debug'] == 1) {
             echo 'Could not acquire scheduler lock';
         }
         return;
     }
     // Get all active scheduled items
     foreach (ORM::factory('scheduler')->where('scheduler_active', '1')->find_all() as $scheduler) {
         $scheduler_id = $scheduler->id;
         $scheduler_last = $scheduler->scheduler_last;
         // Next run time
         $scheduler_weekday = $scheduler->scheduler_weekday;
         // Day of the week
         $scheduler_day = $scheduler->scheduler_day;
         // Day of the month
         $scheduler_hour = $scheduler->scheduler_hour;
         // Hour
         $scheduler_minute = $scheduler->scheduler_minute;
         // Minute
         // Controller that performs action
         $scheduler_controller = $scheduler->scheduler_controller;
         if ($scheduler_day <= -1) {
             // Ran every day?
             $scheduler_day = "*";
         }
         if ($scheduler_weekday <= -1) {
             // Ran every day?
             $scheduler_weekday = "*";
         }
         if ($scheduler_hour <= -1) {
             // Ran every hour?
             $scheduler_hour = "*";
         }
         if ($scheduler_minute <= -1) {
             // Ran every minute?
             $scheduler_minute = "*";
         }
         $scheduler_cron = $scheduler_minute . " " . $scheduler_hour . " " . $scheduler_day . " * " . $scheduler_weekday;
         //Start new cron parser instance
         $cron = new CronParser();
         if (!$cron->calcLastRan($scheduler_cron)) {
             echo "Error parsing CRON";
         }
         $lastRan = $cron->getLastRan();
         //Array (0=minute, 1=hour, 2=dayOfMonth, 3=month, 4=week, 5=year)
         $cronRan = mktime($lastRan[1], $lastRan[0], 0, $lastRan[3], $lastRan[2], $lastRan[5]);
         if (isset($_GET['debug']) and $_GET['debug'] == 1) {
             $debug .= "~~~~~~~~~~~~~~~~~~~~~~~~~~~" . "<BR />~~~~~~~~~~~~~~~~~~~~~~~~~~~" . "<BR />RUNNING: " . $scheduler->scheduler_name . "<BR />~~~~~~~~~~~~~~~~~~~~~~~~~~~" . "<BR /> LAST RUN: " . date("r", $scheduler_last) . "<BR /> LAST DUE AT: " . date('r', $cron->getLastRanUnix()) . "<BR /> SCHEDULE: <a href=\"http://en.wikipedia.org/wiki/Cron\" target=\"_blank\">" . $scheduler_cron . "</a>";
         }
         if ($scheduler_controller and (!($scheduler_last > $cronRan) or $scheduler_last == 0)) {
             $run = FALSE;
             // Catch errors from missing scheduler or other bugs
             try {
                 $dispatch = Dispatch::controller($scheduler_controller, "scheduler/");
                 if ($dispatch instanceof Dispatch && method_exists($dispatch, 'method')) {
                     $run = $dispatch->method('index', '');
                 }
             } catch (Exception $e) {
                 // Nada.
             }
             // @todo allow tasks to save state between runs.
             if ($run !== FALSE) {
                 // Set last time of last execution
                 $schedule_time = time();
                 $scheduler->scheduler_last = $schedule_time;
                 $scheduler->save();
                 // Record Action to Log
                 $scheduler_log = new Scheduler_Log_Model();
                 $scheduler_log->scheduler_id = $scheduler_id;
                 $scheduler_log->scheduler_status = "200";
                 $scheduler_log->scheduler_date = $schedule_time;
                 $scheduler_log->save();
                 if (isset($_GET['debug']) and $_GET['debug'] == 1) {
                     $debug .= "<BR /> STATUS: {{ EXECUTED }}";
                 }
             } else {
                 if (isset($_GET['debug']) and $_GET['debug'] == 1) {
                     $debug .= "<BR /> STATUS: {{ SCHEDULER NOT FOUND! }}";
                 }
             }
         } else {
             if (isset($_GET['debug']) and $_GET['debug'] == 1) {
                 $debug .= "<BR /> STATUS: {{ NOT RUN }}";
             }
         }
         if (isset($_GET['debug']) and $_GET['debug'] == 1) {
             //$debug .= "<BR /><BR />CRON DEBUG:<BR />".nl2br($cron->getDebug());
             $debug .= "<BR />~~~~~~~~~~~~~~~~~~~~~~~~~~~<BR />~~~~~~~~~~~~~~~~~~~~~~~~~~~<BR /><BR /><BR />";
         }
     }
     if (Kohana::config('cdn.cdn_gradual_upgrade') != FALSE) {
         cdn::gradual_upgrade();
     }
     // If DEBUG is TRUE echo DEBUG info instead of transparent GIF
     if (isset($_GET['debug']) and $_GET['debug'] == 1) {
         echo $debug;
         if (isset($this->profiler)) {
             echo $this->profiler->render(TRUE);
         }
     } else {
         // Transparent GIF
         Header("Content-type: image/gif");
         Header("Expires: Wed, 11 Nov 1998 11:11:11 GMT");
         Header("Cache-Control: no-cache");
         Header("Cache-Control: must-revalidate");
         Header("Content-Length: 49");
         echo pack('H*', '47494638396101000100910000000000ffffffff' . 'ffff00000021f90405140002002c000000000100' . '01000002025401003b');
     }
     // Release lock
     $result = Database::instance()->query("UPDATE `" . Kohana::config('database.default.table_prefix') . "settings`\n\t\t\tSET `value` = 0\n\t\t\tWHERE `key` = 'scheduler_lock';");
 }
コード例 #17
0
ファイル: index.php プロジェクト: nongfuguoyuan/accountant
<?php

if (version_compare(PHP_VERSION, "5.3.0", "<")) {
    die("require PHP > 5.3.0!");
}
// header('Access-Control-Allow-Origin: *');
// header("Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept");
// header('Access-Control-Allow-Methods: GET, POST, PUT');
// header("Content-type:text/plain");
error_reporting(E_ERROR | E_WARNING);
// error_reporting(E_ALL);
session_start();
require "config.php";
require "log.php";
require M_PATH . 'function.php';
if (preg_match("/.*\\/v\\d+\\//", $_SERVER['REQUEST_URI'])) {
    require CUSTOMER . "/engine/commonmodel.php";
    require CUSTOMER . "/engine/dispatch.php";
    $dispatch = new Dispatch();
    echo $dispatch->start();
} else {
    require M_PATH . 'model.php';
    require C_PATH . 'zjhcontroller.php';
    require CONFIG_PATH . "permission.php";
    require M_PATH . "Main.php";
    $main = new Main();
    $result = $main->start();
    echo $result;
}
コード例 #18
0
            die($content);
        } else {
            return false;
        }
    }
    /**
     * 定义系统常量
     */
    private function define_GF_constant()
    {
        if ($this->url_model != 3) {
            define('__ROOT__', 'http://' . $_SERVER['HTTP_HOST']);
            //根目录URL路径
            define('__GROUP__', __ROOT__ . '/' . $this->group_name . '/');
            if ($this->group_name == C('default_group')) {
                define('__URL__', __ROOT__ . '/' . $this->module_name . '/');
                define('__ACTION__', __ROOT__ . '/' . $this->module_name . '/' . $this->action_name);
            } else {
                define('__URL__', __ROOT__ . '/' . $this->group_name . '/' . $this->module_name . '/');
                define('__ACTION__', __ROOT__ . '/' . $this->group_name . '/' . $this->module_name . '/' . $this->action_name);
            }
            define('__SELF__', __ROOT__ . $_SERVER['REQUEST_URI']);
        }
        define('GROUP_NAME', $this->group_name);
        define('MODULE_NAME', $this->module_name);
        define('ACTION_NAME', $this->action_name);
    }
}
//页面具体执行,从这一段开始
$D = new Dispatch();
$D->dispatch();
コード例 #19
0
ファイル: index.php プロジェクト: marceloweb/redshirt
<?php

require_once "../Autoloader.php";
$autoloader = new Autoloader();
$init = new Dispatch();
$init->run();
コード例 #20
0
ファイル: Factory.php プロジェクト: wscore/pages
 /**
  * @param ControllerAbstract $controller
  * @return Dispatch
  */
 public static function getDispatch($controller)
 {
     $dispatch = new Dispatch(static::getRequest(), static::getPageView(), static::getSession());
     $dispatch->setController($controller);
     return $dispatch;
 }
コード例 #21
0
ファイル: scheduler.php プロジェクト: kjgarza/ushahidi
 public function index()
 {
     // Debug
     $debug = "";
     // Get all active scheduled items
     foreach (ORM::factory('scheduler')->where('scheduler_active', '1')->find_all() as $scheduler) {
         $scheduler_id = $scheduler->id;
         $scheduler_last = $scheduler->scheduler_last;
         // Next run time
         $scheduler_weekday = $scheduler->scheduler_weekday;
         // Day of the week
         $scheduler_day = $scheduler->scheduler_day;
         // Day of the month
         $scheduler_hour = $scheduler->scheduler_hour;
         // Hour
         $scheduler_minute = $scheduler->scheduler_minute;
         // Minute
         // Controller that performs action
         $scheduler_controller = $scheduler->scheduler_controller;
         if ($scheduler_day <= -1) {
             // Ran every day?
             $scheduler_day = "*";
         }
         if ($scheduler_weekday <= -1) {
             // Ran every day?
             $scheduler_weekday = "*";
         }
         if ($scheduler_hour <= -1) {
             // Ran every hour?
             $scheduler_hour = "*";
         }
         if ($scheduler_minute <= -1) {
             // Ran every minute?
             $scheduler_minute = "*";
         }
         $scheduler_cron = $scheduler_minute . " " . $scheduler_hour . " " . $scheduler_day . " * " . $scheduler_weekday;
         //Start new cron parser instance
         $cron = new CronParser();
         if (!$cron->calcLastRan($scheduler_cron)) {
             echo "Error parsing CRON";
         }
         $lastRan = $cron->getLastRan();
         //Array (0=minute, 1=hour, 2=dayOfMonth, 3=month, 4=week, 5=year)
         $cronRan = mktime($lastRan[1], $lastRan[0], 0, $lastRan[3], $lastRan[2], $lastRan[5]);
         if (isset($_GET['debug']) and $_GET['debug'] == 1) {
             $debug .= "~~~~~~~~~~~~~~~~~~~~~~~~~~~" . "<BR />~~~~~~~~~~~~~~~~~~~~~~~~~~~" . "<BR />RUNNING: " . $scheduler->scheduler_name . "<BR />~~~~~~~~~~~~~~~~~~~~~~~~~~~" . "<BR /> LAST RUN: " . date("r", $scheduler_last) . "<BR /> LAST DUE AT: " . date('r', $cron->getLastRanUnix()) . "<BR /> SCHEDULE: <a href=\"http://en.wikipedia.org/wiki/Cron\" target=\"_blank\">" . $scheduler_cron . "</a>";
         }
         if (!($scheduler_last > $cronRan) || $scheduler_last == 0) {
             $run = Dispatch::controller("{$scheduler_controller}", "scheduler/")->method('index', '');
             if ($run !== FALSE) {
                 // Set last time of last execution
                 $schedule_time = time();
                 $scheduler->scheduler_last = $schedule_time;
                 $scheduler->save();
                 // Record Action to Log
                 $scheduler_log = new Scheduler_Log_Model();
                 $scheduler_log->scheduler_id = $scheduler_id;
                 $scheduler_log->scheduler_name = $scheduler->scheduler_name;
                 $scheduler_log->scheduler_status = "200";
                 $scheduler_log->scheduler_date = $schedule_time;
                 $scheduler_log->save();
                 if (isset($_GET['debug']) and $_GET['debug'] == 1) {
                     $debug .= "<BR /> STATUS: {{ EXECUTED }}";
                 }
             } else {
                 if (isset($_GET['debug']) and $_GET['debug'] == 1) {
                     $debug .= "<BR /> STATUS: {{ SCHEDULER NOT FOUND! }}";
                 }
             }
         } else {
             if (isset($_GET['debug']) and $_GET['debug'] == 1) {
                 $debug .= "<BR /> STATUS: {{ NOT RUN }}";
             }
         }
         if (isset($_GET['debug']) and $_GET['debug'] == 1) {
             //$debug .= "<BR /><BR />CRON DEBUG:<BR \>".nl2br($cron->getDebug());
             $debug .= "<BR \\>~~~~~~~~~~~~~~~~~~~~~~~~~~~<BR />~~~~~~~~~~~~~~~~~~~~~~~~~~~<BR /><BR /><BR />";
         }
     }
     // If DEBUG is TRUE echo DEBUG info instead of transparent GIF
     if (isset($_GET['debug']) and $_GET['debug'] == 1) {
         echo $debug;
     } else {
         // Transparent GIF
         Header("Content-type: image/gif");
         Header("Expires: Wed, 11 Nov 1998 11:11:11 GMT");
         Header("Cache-Control: no-cache");
         Header("Cache-Control: must-revalidate");
         Header("Content-Length: 49");
         echo pack('H*', '47494638396101000100910000000000ffffffff' . 'ffff00000021f90405140002002c000000000100' . '01000002025401003b');
     }
 }
コード例 #22
0
ファイル: runtime.php プロジェクト: im286er/hobby
<?php

require_once "global.func.php";
require_once "dispatch.php";
require_once "control.php";
require_once "model.php";
require_once "dao.php";
Dispatch::init();
Dispatch::start();
コード例 #23
0
ファイル: scheduler.php プロジェクト: kjgarza/thrasos
 function index()
 {
     $this->template->content = new View('admin/scheduler');
     // Check if we should be running the scheduler and then do it
     if (isset($_GET['run_scheduler'])) {
         // Get all active scheduled items
         foreach (ORM::factory('scheduler')->where('scheduler_active', '1')->find_all() as $scheduler) {
             $s_controller = $scheduler->scheduler_controller;
             $run = Dispatch::controller("{$s_controller}", "scheduler/")->method('index', '');
             if ($run !== FALSE) {
                 // Set last time of last execution
                 $schedule_time = time();
                 $scheduler->scheduler_last = $schedule_time;
                 $scheduler->save();
                 // Record Action to Log
                 $scheduler_log = new Scheduler_Log_Model();
                 $scheduler_log->scheduler_id = $scheduler->id;
                 $scheduler_log->scheduler_name = $scheduler->scheduler_name;
                 $scheduler_log->scheduler_status = "200";
                 $scheduler_log->scheduler_date = $schedule_time;
                 $scheduler_log->save();
             }
         }
     }
     // setup and initialize form field names
     $form = array('action' => '', 'schedule_id' => '', 'scheduler_weekday' => '', 'scheduler_day' => '', 'scheduler_hour' => '', 'scheduler_minute' => '', 'scheduler_active' => '');
     //  copy the form as errors, so the errors will be stored with keys corresponding to the form field names
     $errors = $form;
     $form_error = FALSE;
     $form_saved = FALSE;
     $form_action = "";
     if ($_POST) {
         //print_r($_POST);
         $post = Validation::factory($_POST);
         //  Add some filters
         $post->pre_filter('trim', TRUE);
         if ($post->action == 'a') {
             // Add some rules, the input field, followed by a list of checks, carried out in order
             $post->add_rules('scheduler_weekday', 'required', 'between[1,7]');
             $post->add_rules('scheduler_day', 'required', 'between[-1,31]');
             $post->add_rules('scheduler_hour', 'required', 'between[-1,23]');
             $post->add_rules('scheduler_minute', 'required', 'between[-1,59]');
         }
         if ($post->validate()) {
             $scheduler_id = $post->scheduler_id;
             $scheduler = new Scheduler_Model($scheduler_id);
             if ($post->action == 'v') {
                 // Active/Inactive Action
                 if ($scheduler->loaded == TRUE) {
                     $scheduler->scheduler_active = $scheduler->scheduler_active == 1 ? 0 : 1;
                     $scheduler->save();
                     $form_saved = TRUE;
                     $form_action = strtoupper(Kohana::lang('ui_admin.modified'));
                 }
             } else {
                 // SAVE Schedule
                 $scheduler->scheduler_weekday = $post->scheduler_weekday;
                 $scheduler->scheduler_day = $post->scheduler_day;
                 $scheduler->scheduler_hour = $post->scheduler_hour;
                 $scheduler->scheduler_minute = $post->scheduler_minute;
                 $scheduler->save();
                 $form_saved = TRUE;
                 $form_action = strtoupper(Kohana::lang('ui_admin.added_edited'));
             }
         } else {
             // repopulate the form fields
             $form = arr::overwrite($form, $post->as_array());
             // populate the error fields, if any
             $errors = arr::overwrite($errors, $post->errors('scheduler'));
             $form_error = TRUE;
         }
     }
     // Pagination
     $pagination = new Pagination(array('query_string' => 'page', 'items_per_page' => $this->items_per_page, 'total_items' => ORM::factory('scheduler')->count_all()));
     $schedules = ORM::factory('scheduler')->orderby('scheduler_name', 'asc')->find_all($this->items_per_page, $pagination->sql_offset);
     $this->template->content->weekday_array = array("-1" => "ALL", "0" => "Sunday", "1" => "Monday", "2" => "Tuesday", "3" => "Wednesday", "4" => "Thursday", "5" => "Friday", "6" => "Saturday");
     for ($i = 0; $i <= 31; $i++) {
         $day_array = $i;
     }
     $this->template->content->day_array = $day_array;
     $day_array = array();
     $day_array[-1] = "ALL";
     for ($i = 1; $i <= 31; $i++) {
         $day_array[] = $i;
     }
     $this->template->content->day_array = $day_array;
     $hour_array = array();
     $hour_array[-1] = "ALL";
     for ($i = 0; $i <= 23; $i++) {
         $hour_array[] = $i;
     }
     $this->template->content->hour_array = $hour_array;
     $minute_array = array();
     $minute_array[-1] = "ALL";
     for ($i = 0; $i <= 59; $i++) {
         $minute_array[] = $i;
     }
     $this->template->content->minute_array = $minute_array;
     $this->template->content->form_error = $form_error;
     $this->template->content->form_saved = $form_saved;
     $this->template->content->form_action = $form_action;
     $this->template->content->pagination = $pagination;
     $this->template->content->total_items = $pagination->total_items;
     $this->template->content->schedules = $schedules;
     $this->template->content->errors = $errors;
     // Javascript Header
     $this->template->js = new View('admin/scheduler_js');
 }
コード例 #24
0
ファイル: divers.blade.php プロジェクト: birdiebel/G2016
{{ openContent('modal-delete') }}

<button type="button" class="modal-delete">Delete</button>


{{ closeContent() }}

{{ openContent('Direct list Players') }}

    <?php 
$player['datas'] = Player::with('club')->take(1)->get();
$player['module'] = 'lineItem';
$player['actions'] = 'open';
$player['backUrl'] = 'test.divers';
$playerDatas = Dispatch::displayList($player);
?>

    <div class="row">
        <div class="col-md-5">
            {{ $playerDatas['code'] }}
        </div>
    </div>

{{ closeContent() }}

{{ openContent('Ajax list') }}
<!-- Résultats -->
<div id="testList" class="box">
    <div class="information dark center">Résultats de la recherche</div>
    <!-- Message erreur -->
    <div id="seekMessage" class="information danger center table-seek-message"></div>
コード例 #25
0
ファイル: index.php プロジェクト: hmmbug/unbindery
$auth->init();
Settings::setProtected('auth', $auth);
// Initialize database
// --------------------------------------------------
$dbengine = Settings::getProtected('db');
require_once "../modules/db/{$dbengine}/Db{$dbengine}.class.php";
// Load the appropriate database engine class
$dbClass = "Db{$dbengine}";
$db = new $dbClass();
$dbsettings = Settings::getProtected('database');
$db->create($dbsettings['host'], $dbsettings['username'], $dbsettings['password'], $dbsettings['database']);
// Save it to the settings manager
Settings::setProtected('db', $db);
// Initialize dispatcher
// --------------------------------------------------
$dispatch = new Dispatch();
$dispatch->register(array('DispatchController', 'getNextAvailableItem'));
Settings::setProtected('dispatch', $dispatch);
// Initialize event manager
// --------------------------------------------------
$eventManager = new EventManager();
Settings::setProtected('eventManager', $eventManager);
// Initialize transcript controller
// --------------------------------------------------
Transcript::setEventManager($eventManager);
Transcript::register('load', array('TranscriptController', 'load'));
Transcript::register('save', array('TranscriptController', 'save'));
Transcript::register('diff', array('TranscriptController', 'diff'));
// Initialize workflow controller
// --------------------------------------------------
Workflow::register('callback', array('WorkflowController', 'parse'));
コード例 #26
0
 public function actionDispatchNoWise()
 {
     $this->layout = "";
     $challan = new Challan();
     $sent = array();
     $failed = array();
     if (!empty($_POST['dispatch'])) {
         foreach ($_POST['dispatch']['chk'] as $k => $m) {
             $challan = Challan::model()->with('placeOfOffence')->findByPk($m);
             $dispatch = new Dispatch();
             $dispatch->user_id = Yii::app()->user->id;
             $dispatch->created = date("Y-m-d H:i:s", time());
             $dispatch->challan_id = $m;
             $dispatch->status = "Dispatched to CJM";
             $dispatch->status_id = 3;
             $dispatch->message = $_POST['dispatch']['message'];
             $dispatch->court_id = $challan->placeOfOffence->court_id;
             if ($dispatch->save()) {
                 $sent[] = $challan->id;
                 $challan = Challan::model()->with('placeOfOffence')->findByPk($m);
                 $challan->status_id = 3;
                 $challan->save();
             } else {
                 $failed[] = $challan->id;
             }
         }
         Yii::app()->user->setFlash('success1 message1', "Dispatch of following challan(s) was successful");
         return $this->render('dispatchReport', array('model' => new Challan(), 'challan' => $challan, 'sent' => $sent, 'failed' => $failed));
     } else {
         $days_ago = date('Y-m-d', strtotime('-1 days', time()));
         //$challan = Challan::model()->with('placeOfOffence')->findAllByAttributes('status_id = 1 and date_time_offence < "'.$days_ago.'"');
         $criteria = new CDbCriteria();
         $criteria->select = '*';
         $criteria->condition = 'status_id = 1 and vehicle_impounded = 1 and date_time_offence < "' . $days_ago . '"';
         $criteria->order = "date_time_offence DESC";
         $challan = Challan::model()->findAll($criteria);
         return $this->render('dispatchNoWise', array('model' => new Challan(), 'challan' => $challan));
     }
     return $this->render('dispatchNoWise', array('model' => new Challan(), 'challan' => $challan));
 }