Changeset 632


Ignore:
Timestamp:
Dec 2, 2014 11:35:56 AM (10 years ago)
Author:
dungnv
Message:
 
Location:
pro-violet-viettel/sourcecode/application
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • pro-violet-viettel/sourcecode/application/helpers/lockfile_helper.php

    r622 r632  
    8282
    8383                $diff = date_diff($datetime1, $datetime2);
     84                //$diff = DateTime::diff($datetime1, $datetime2);
    8485                $total = 0;
    8586                switch( $differenceFormat){
     
    109110        }
    110111}
     112
     113if(!function_exists('date_diff')) {
     114  class DateInterval {
     115    public $y;
     116    public $m;
     117    public $d;
     118    public $h;
     119    public $i;
     120    public $s;
     121    public $invert;
     122    public $days;
     123 
     124    public function format($format) {
     125      $format = str_replace('%R%y',
     126        ($this->invert ? '-' : '+') . $this->y, $format);
     127      $format = str_replace('%R%m',
     128         ($this->invert ? '-' : '+') . $this->m, $format);
     129      $format = str_replace('%R%d',
     130         ($this->invert ? '-' : '+') . $this->d, $format);
     131      $format = str_replace('%R%h',
     132         ($this->invert ? '-' : '+') . $this->h, $format);
     133      $format = str_replace('%R%i',
     134         ($this->invert ? '-' : '+') . $this->i, $format);
     135      $format = str_replace('%R%s',
     136         ($this->invert ? '-' : '+') . $this->s, $format);
     137 
     138      $format = str_replace('%y', $this->y, $format);
     139      $format = str_replace('%m', $this->m, $format);
     140      $format = str_replace('%d', $this->d, $format);
     141      $format = str_replace('%h', $this->h, $format);
     142      $format = str_replace('%i', $this->i, $format);
     143      $format = str_replace('%s', $this->s, $format);
     144 
     145      return $format;
     146    }
     147  }
     148 
     149  function date_diff(DateTime $date1, DateTime $date2) {
     150 
     151    $diff = new DateInterval();
     152 
     153    if($date1 > $date2) {
     154      $tmp = $date1;
     155      $date1 = $date2;
     156      $date2 = $tmp;
     157      $diff->invert = 1;
     158    } else {
     159      $diff->invert = 0;
     160    }
     161 
     162    $diff->y = ((int) $date2->format('Y')) - ((int) $date1->format('Y'));
     163    $diff->m = ((int) $date2->format('n')) - ((int) $date1->format('n'));
     164    if($diff->m < 0) {
     165      $diff->y -= 1;
     166      $diff->m = $diff->m + 12;
     167    }
     168    $diff->d = ((int) $date2->format('j')) - ((int) $date1->format('j'));
     169    if($diff->d < 0) {
     170      $diff->m -= 1;
     171      $diff->d = $diff->d + ((int) $date1->format('t'));
     172    }
     173    $diff->h = ((int) $date2->format('G')) - ((int) $date1->format('G'));
     174    if($diff->h < 0) {
     175      $diff->d -= 1;
     176      $diff->h = $diff->h + 24;
     177    }
     178    $diff->i = ((int) $date2->format('i')) - ((int) $date1->format('i'));
     179    if($diff->i < 0) {
     180      $diff->h -= 1;
     181      $diff->i = $diff->i + 60;
     182    }
     183    $diff->s = ((int) $date2->format('s')) - ((int) $date1->format('s'));
     184    if($diff->s < 0) {
     185      $diff->i -= 1;
     186      $diff->s = $diff->s + 60;
     187    }
     188 
     189    $start_ts   = $date1->format('U');
     190    $end_ts   = $date2->format('U');
     191    $days     = $end_ts - $start_ts;
     192    $diff->days  = round($days / 86400);
     193 
     194    if (($diff->h > 0 || $diff->i > 0 || $diff->s > 0))
     195      $diff->days += ((bool) $diff->invert)
     196        ? 1
     197        : -1;
     198 
     199    return $diff;
     200 
     201  }
     202 
     203}
  • pro-violet-viettel/sourcecode/application/modules/frontend/views/lecture_editor.php

    r631 r632  
    1212                                                                <?php $flashVars.= '&youtubeUrl='.$base_url.'assets/soanbai/Service/fake_youtube.php'.$langParam.'&command=Init OK' ?>
    1313                                                                <?php $flashVars.= '&licenseStatus='.$licenseAvailable ?>
    14                                                                 <?php $flashVars.= '&userId='.$licflashVars['id'] ?>
    15                                                                 <?php $flashVars.= '&appUserName='.$licflashVars['fullname'] ?>
    16                                                                 <?php $flashVars.= '&appAddress='.$licflashVars['school'] ?>
     14                                                                <?php $flashVars.= '&userId='. isset($licflashVars['id']) ? $licflashVars['id']:'' ?>
     15                                                                <?php $flashVars.= '&appUserName='.isset($licflashVars['fullname']) ? $licflashVars['fullname']:'' ?>
     16                                                                <?php $flashVars.= '&appAddress='.isset($licflashVars['school']) ? $licflashVars['school']:'' ?>
    1717 
    1818                                                                <div class="embed-responsive embed-responsive-4by3">
  • pro-violet-viettel/sourcecode/application/modules/services/models/services_model.php

    r629 r632  
    268268               
    269269                $aryTopupResult = $result[$keys[0]];
    270                
     270
     271                $debugMsg = 'Logged time: '. date('Y-m-d H:i:s') ."\n";
     272                $debugMsg .=  'Send:'."\n" .$xml ."\n\n";
     273                $debugMsg .= 'Result:'."\n". var_export($result, TRUE);
     274                write_file('./log/topup_log', $debugMsg);
     275
    271276                if ($aryTopupResult['Success'] == 'false') {
    272277                        return _SBG_CARD_PAY_FAIL;
Note: See TracChangeset for help on using the changeset viewer.