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


PHP cron::select_all方法代码示例

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


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

示例1: run

	public function run()
	{
        global $db;
        global $auth_session;
        
        $SI_BILLER = new SimpleInvoices_Db_Table_Biller();
        $SI_PREFERENCES = new SimpleInvoices_Db_Table_Preferences();

        $today = date('Y-m-d');
        $domain_id = domain_id::get($this->domain_id);

        $cron_log = new cronlog();
        $cron_log->run_date = empty($this->run_date) ? $today : $this->run_date;
        $check_cron_log = $cron_log->check();        	

        //only proceed if cron has not been run for today
        $cron = new cron();
        $data = $cron->select_all('no_limit');

        $return['cron_message'] ="Cron started";
        $number_of_crons_run = "0";	
        foreach ($data as $key=>$value)
        {

            $cron_log = new cronlog();
            $cron_log->run_date = empty($this->run_date) ? $today : $this->run_date;
            $cron_log->cron_id = $data[$key]['cron_id'];
            $check_cron_log = $cron_log->check();        	

            $i="0";
            if ($check_cron_log == 0)
            {
                $run_cron ='false';
                $start_date = date('Y-m-d', strtotime( $data[$key]['start_date'] ) );
                $end_date = $data[$key]['end_date'] ;

                $diff = number_format((strtotime($today) - strtotime($start_date)) / (60 * 60 * 24),0);
                

                //only check if diff is positive
                if (($diff >= 0) AND ($end_date =="" OR $end_date >= $today))
                {

                    if($data[$key]['recurrence_type'] == 'day')
                    {
                        $modulus = $diff % $data[$key]['recurrence'] ;
                        if($modulus == 0)
                        { 
                            $run_cron ='true';
                        } else {
                            #$return .= "cron does not runs TODAY-days";

                        }

                    }

                    if($data[$key]['recurrence_type'] == 'week')
                    {
                        $period = 7 * $data[$key]['recurrence'];
                        $modulus = $diff % $period ;
                        if($modulus == 0)
                        { 
                            $run_cron ='true';
                        } else {
                            #$return .= "cron is not runs TODAY-week";
                        }

                    }
                    if($data[$key]['recurrence_type'] == 'month')
                    {
                        $start_day = date('d', strtotime( $data[$key]['start_date'] ) );
                        $start_month = date('m', strtotime( $data[$key]['start_date'] ) );
                        $start_year = date('Y', strtotime( $data[$key]['start_date'] ) );
                        $today_day = date('d');	
                        $today_month = date('m');	
                        $today_year = date('Y'); 	

                        $months = ($today_month-$start_month)+12*($today_year-$start_year);
                        $modulus =  $months % $data[$key]['recurrence']  ;
                        if( ($modulus == 0) AND ( $start_day == $today_day ) )
                        { 
                            $run_cron ='true';
                        } else {
                            #$return .= "cron is not runs TODAY-month";
                        }

                    }
                    if($data[$key]['recurrence_type'] == 'year')
                    {
                        $start_day = date('d', strtotime( $data[$key]['start_date'] ) );
                        $start_month = date('m', strtotime( $data[$key]['start_date'] ) );
                        $start_year = date('Y', strtotime( $data[$key]['start_date'] ) );
                        $today_day = date('d');	
                        $today_month = date('m');	
                        $today_year = date('Y'); 	

                        $years = $today_year-$start_year;
                        $modulus =  $years % $data[$key]['recurrence']  ;
                        if( ($modulus == 0) AND ( $start_day == $today_day ) AND  ( $start_month == $today_month ) )
                        { 
//.........这里部分代码省略.........
开发者ID:CalhounGaming,项目名称:simpleinvoices,代码行数:101,代码来源:cron.php

示例2: isset

<?php

header("Content-type: text/xml");
//$start = (isset($_POST['start'])) ? $_POST['start'] : "0" ;
$dir = isset($_POST['sortorder']) ? $_POST['sortorder'] : "DESC";
$sort = isset($_POST['sortname']) ? $_POST['sortname'] : "id";
$rp = isset($_POST['rp']) ? $_POST['rp'] : "25";
$page = isset($_POST['page']) ? $_POST['page'] : "1";
//$sql = "SELECT * FROM ".TB_PREFIX."invoices LIMIT $start, $limit";
$cron = new cron();
$cron->sort = $sort;
$crons = $cron->select_all('', $dir, $rp, $page);
$sth_count_rows = $cron->select_all('count', $dir, $rp, $page);
$xml = "";
$count = $sth_count_rows;
$xml .= "<rows>";
$xml .= "<page>{$page}</page>";
$xml .= "<total>{$count}</total>";
foreach ($crons as $row) {
    $row['email_biller_nice'] = $row['email_biller'] == 1 ? $LANG['yes'] : $LANG['no'];
    $row['email_customer_nice'] = $row['email_customer'] == 1 ? $LANG['yes'] : $LANG['no'];
    $xml .= "<row id='" . $row['id'] . "'>";
    $xml .= "<cell><![CDATA[\r\n\t\t<a class='index_table' title='{$LANG['view']} " . $row['name'] . "' href='index.php?module=cron&view=view&id={$row['id']}'><img src='images/common/view.png' height='16' border='-5px' padding='-4px' valign='bottom' /></a>\r\n\t\t<a class='index_table' title='{$LANG['edit']} " . $row['name'] . "' href='index.php?module=cron&view=edit&id={$row['id']}'><img src='images/common/edit.png' height='16' border='-5px' padding='-4px' valign='bottom' /></a>\r\n\t\t]]></cell>";
    $xml .= "<cell><![CDATA[" . $row['index_name'] . "]]></cell>";
    #$xml .= "<cell><![CDATA[".siLocal::date($row['start_date'])."]]></cell>";
    #$xml .= "<cell><![CDATA[".siLocal::date($row['end_date'])."]]></cell>";
    $xml .= "<cell><![CDATA[" . $row['start_date'] . "]]></cell>";
    $xml .= "<cell><![CDATA[" . $row['end_date'] . "]]></cell>";
    $xml .= "<cell><![CDATA[" . $row['recurrence'] . " " . $row['recurrence_type'] . "]]></cell>";
    $xml .= "<cell><![CDATA[" . $row['email_biller_nice'] . "]]></cell>";
    $xml .= "<cell><![CDATA[" . $row['email_customer_nice'] . "]]></cell>";
开发者ID:alachaum,项目名称:simpleinvoices,代码行数:31,代码来源:xml.php


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