Esempio n. 1
0
 /**
  * Formulaire d'entité activité
  * @param $builder <i>FormBuilderInterface<i/> 
  * @param $options <i>Array</i> 
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $today = getDate();
     //$jour = $today['wday'];
     $annee = $today['year'];
     $builder->add('sportPratique', 'entity', array('label' => 'Sport', 'empty_value' => 'Sélectionnez un sport', 'class' => 'mooveActiviteBundle:Sport', 'property' => 'nom', 'multiple' => false, 'expanded' => false))->add('niveauRequis', 'entity', array('label' => 'Niveau conseillé', 'empty_value' => 'Sélectionez un niveau', 'class' => 'mooveActiviteBundle:Niveau', 'property' => 'libelle', 'multiple' => false, 'expanded' => false))->add('dateHeureRDV', 'datetime', array('label' => 'Date et heure de rendez-vous', 'years' => range($annee, $annee + 5)))->add('dateFermeture', 'datetime', array('label' => 'Date et heure de fermeture  de l\'activité', 'years' => range($annee, $annee + 5)))->add('duree', 'time', array('label' => 'Durée estimée'))->add('nbPlaces', 'integer', array('label' => 'Nombre de places total (vous inclus)'))->add('description', 'ckeditor', array('required' => false, 'label' => 'Informations', 'config_name' => 'config_description'))->add('adresseLieuRDV', 'text', array('constraints' => new Adresse()))->add('adresseLieuDepart', 'text', array('required' => false, 'constraints' => new Adresse()))->add('adresseLieuArrivee', 'text', array('required' => false, 'constraints' => new Adresse()));
 }
 /**
  * Construct
  * 
  * @param $str_date Any String formatted date understood by strtotime()
  * @link http://www.php.net/manual/en/function.strtotime.php
  */
 function Calendar($str_date = 'now')
 {
     $this->time = strtotime($str_date);
     $this->date = getDate($this->time);
     // use current month and year if not supplied
     $month = $this->date['mon'];
     $year = $this->date['year'];
     // get the dates for the start of this month and next month
     // we don't worry about month=13 as mktime() will take care of this
     $this_month = getDate(mktime(0, 0, 0, $month, 1, $year));
     $next_month = getDate(mktime(0, 0, 0, $month + 1, 1, $year));
     // http://scripts.franciscocharrua.com/php-calendar.php
     $this->day = $this_month["mday"];
     $this->month = $this_month["mon"];
     $this->month_name = $this_month["month"];
     $this->year = $this_month["year"];
     $this->first_day_offset = $this_month["wday"];
     $this->days_count = round(($next_month[0] - $this_month[0]) / (60 * 60 * 24));
     $this->days = array();
     // fill in days
     $week = 1;
     for ($i = 0; $i < $this->days_count + $this->first_day_offset; $i++) {
         if ($i < $this->first_day_offset) {
             $this->days[$week][] = null;
         } else {
             $this->days[$week][] = $i - $this->first_day_offset + 1;
         }
         if ($i % 7 == 6) {
             $week++;
         }
     }
     // localized day names
     $this->day_names = $this->_getFullDayNames();
 }
Esempio n. 3
0
 /**
  * Initialize the Home Page
  *
  * Gather billing stats and account stats from the database, then assign those
  * stats to template variables.
  */
 function init()
 {
     parent::init();
     // Current month
     $now = getDate(time());
     $this->smarty->assign("month", $now['month']);
     // Invoice Summary
     $stats = outstanding_invoices_stats();
     $this->smarty->assign("os_invoices_count", $stats['count']);
     $this->smarty->assign("os_invoices_total", $stats['total']);
     $this->smarty->assign("os_invoices_count_past_due", $stats['count_past_due']);
     $this->smarty->assign("os_invoices_total_past_due", $stats['total_past_due']);
     $this->smarty->assign("os_invoices_count_past_due_30", $stats['count_past_due_30']);
     $this->smarty->assign("os_invoices_total_past_due_30", $stats['total_past_due_30']);
     // Payment Summary
     $stats = payments_stats();
     $this->smarty->assign("payments_count", $stats['count']);
     $this->smarty->assign("payments_total", $stats['total']);
     // Account Summary
     $active_accounts = count_all_AccountDBO("status='Active'");
     $inactive_accounts = count_all_AccountDBO("status='Inactive'");
     $pending_accounts = count_all_AccountDBO("status='Pending'");
     $total_accounts = $active_accounts + $inactive_accounts;
     $this->smarty->assign("active_accounts_count", $active_accounts);
     $this->smarty->assign("inactive_accounts_count", $inactive_accounts);
     $this->smarty->assign("pending_accounts_count", $pending_accounts);
     $this->smarty->assign("total_accounts", $total_accounts);
 }
Esempio n. 4
0
 function getWTCdate($value)
 {
     utc_timezone();
     // "Year and only year" (i.e. 1960) will be treated as HH SS by default
     if (strlen($value) == 4) {
         // Assume this is a year:
         $value = "Jan 1 " . $value;
     } else {
         if (preg_match("/\\d{4}\\-\\d{2}/", $value) === 1) {
             $value = $value . "-01";
         }
     }
     if (($timestamp = strtotime($value)) === false) {
         return false;
     } else {
         $date = getDate($timestamp);
         if ($date['year'] > $this->maxYear) {
             $this->maxYear = $date['year'];
         }
         if ($date['year'] < $this->minYear) {
             $this->minYear = $date['year'];
         }
         return date('Y-m-d\\TH:i:s\\Z', $timestamp);
     }
     reset_timezone();
 }
Esempio n. 5
0
 /**
  * timestamp转换成显示时间格式
  * @param $timestamp
  * @return unknown_type
  */
 public static function tTimeFormat($timestamp)
 {
     $curTime = time();
     $space = $curTime - $timestamp;
     //1分钟
     if ($space < 60) {
         $string = "刚刚";
         return $string;
     } elseif ($space < 3600) {
         //一小时前
         $string = floor($space / 60) . "分钟前";
         return $string;
     }
     $curtimeArray = getdate($curTime);
     $timeArray = getDate($timestamp);
     if ($curtimeArray['year'] == $timeArray['year']) {
         if ($curtimeArray['yday'] == $timeArray['yday']) {
             $format = "%H:%M";
             $string = strftime($format, $timestamp);
             return "今天 {$string}";
         } elseif ($curtimeArray['yday'] - 1 == $timeArray['yday']) {
             $format = "%H:%M";
             $string = strftime($format, $timestamp);
             return "昨天 {$string}";
         } else {
             $string = sprintf("%d月%d日 %02d:%02d", $timeArray['mon'], $timeArray['mday'], $timeArray['hours'], $timeArray['minutes']);
             return $string;
         }
     }
     $string = sprintf("%d年%d月%d日 %02d:%02d", $timeArray['year'], $timeArray['mon'], $timeArray['mday'], $timeArray['hours'], $timeArray['minutes']);
     return $string;
 }
Esempio n. 6
0
 public function __construct(&$doorGets)
 {
     $this->doorGets = $doorGets;
     $time = time();
     $range = array('month');
     $limitMax = $time - 86400;
     $isUser = $doorGets->dbQA('_users_info', ' ORDER BY date_creation ASC LIMIT 1');
     if (!empty($isUser)) {
         $limitMax = (int) $isUser[0]['date_creation'];
     }
     //$limitMax = $time - (86400 * 30);
     $timeleft = $time - $limitMax;
     $hourLeft = ceil($timeleft / 3600);
     $dayLeft = ceil($timeleft / 86400);
     $monthLeft = ceil($timeleft / (86400 * 30));
     $yearLeft = ceil($timeleft / (86400 * 364));
     $final = 31;
     foreach ($range as $unit) {
         switch ($unit) {
             // case 'day':
             //     $final = $dayLeft;
             //     $timeAdd = 86400;
             //     break;
             case 'month':
                 $final = $monthLeft;
                 $timeAdd = 86400 * 31;
                 break;
                 // case 'year':
                 //     $final = $yearLeft;
                 //     $timeAdd = 86400 * 364;
                 //     break;
         }
         for ($i = 0; $i <= $final; $i++) {
             $timeStart = $time - $i * $timeAdd;
             $date = getDate($timeStart);
             $dateFormat = $date['year'] . '-' . $date['mon'] . '-' . $date['mday'];
             $timeEnd = $time - ($i + 1) * $timeAdd;
             $dateEnd = getDate($timeEnd);
             $dateEndFormat = $dateEnd['year'] . '-' . $dateEnd['mon'] . '-' . $dateEnd['mday'];
             $start = strtotime($dateFormat . ' 23:59:59');
             $end = strtotime($dateEndFormat . ' 23:59:59');
             if ($unit === 'day') {
                 $dateFormat = GetDate::in($start, 2, $this->doorGets->myLanguage);
             } elseif ($unit === 'year') {
                 $dateFormat = ' ' . $date['year'];
             } else {
                 $dateFormat = $date['mon'] . '-' . $date['year'];
             }
             $this->data['accounts'][$unit]["{$dateFormat}"] = $this->getAccounts($start, $end);
             //$this->data['orders'][$unit]["$dateFormat"] = $this->getOrders($start,$end);
             $this->data['comments'][$unit]["{$dateFormat}"] = $this->getComments($start, $end);
             //$this->data['carts'][$unit]["$dateFormat"] = $this->getCarts($start,$end);
             $this->data['contributions'][$unit]["{$dateFormat}"] = $this->getContributions($start, $end);
             $this->data['tickets'][$unit]["{$dateFormat}"] = $this->getTickets($start, $end);
             $this->data['cloud'][$unit]["{$dateFormat}"] = $this->getCloud($start, $end);
         }
         $this->data['accounts'][$unit] = array_reverse($this->data['accounts'][$unit]);
     }
 }
Esempio n. 7
0
 protected function GetFormatDate($date = null)
 {
     $dtn = null;
     if (!isset($date)) {
         $dtn = getDate();
     } else {
         $dtn = date('Y-m-d', $date / 1000);
     }
     return array($dtn['year'], $dtn['mday'], $dtn['mon'], 0, 0, 0);
 }
Esempio n. 8
0
 public function run()
 {
     if ($this->sectionId !== null && isset($_POST['eventsCalendarWidgetDate']) && (!isset($_POST['eventsCalendarWidgetSectionId']) || $_POST['eventsCalendarWidgetSectionId'] != $this->sectionId)) {
         return;
     }
     Yii::app()->clientScript->registerCssFile(Yii::app()->getAssetManager()->publish(Yii::getPathOfAlias('event.assets'), false, -1, YII_DEBUG) . '/css/events-calendar-widget.css');
     if (Yii::app()->request->isAjaxRequest && isset($_POST['eventsCalendarWidgetDate'])) {
         $date = getdate(strtotime($_POST['eventsCalendarWidgetDate']));
     } else {
         $date = getdate();
     }
     $dateSqlStart = $date['year'] . '-' . str_pad($date['mon'], 2, '0', STR_PAD_LEFT) . '-01';
     $nextMonth = getDate(mktime(0, 0, 0, $date['mon'] + 1, 1, $date['year']));
     $dateSqlEnd = $date['year'] . '-' . str_pad($nextMonth['mon'], 2, '0', STR_PAD_LEFT) . '-01';
     if ($this->sectionId !== null) {
         $eventModels = Event::model()->findAll(array('condition' => 't.date_start < :dateend AND t.date_end >= :datestart AND t.section_id = :sectionId', 'params' => array(':datestart' => $dateSqlStart, ':dateend' => $dateSqlEnd, ':sectionId' => $this->sectionId)));
     } else {
         $eventModels = Event::model()->findAll(array('condition' => 't.date_start < :dateend AND t.date_end >= :datestart', 'params' => array(':datestart' => $dateSqlStart, ':dateend' => $dateSqlEnd)));
     }
     $events = array();
     foreach ($eventModels as $eventModel) {
         $monthStart = substr($eventModel->date_start, 5, 2);
         $yearStart = substr($eventModel->date_start, 0, 4);
         $dayStart = substr($eventModel->date_start, 8, 2);
         $dayEnd = substr($eventModel->date_end, 8, 2);
         $monthEnd = substr($eventModel->date_end, 5, 2);
         $yearEnd = substr($eventModel->date_end, 0, 4);
         if ($monthStart == $monthEnd && $yearStart == $yearEnd) {
             $dayEnd = substr($eventModel->date_end, 8, 2);
         } elseif (($monthStart < $monthEnd || $yearStart < $yearEnd) && ($date['mon'] == $monthEnd && $date['year'] == $yearEnd)) {
             $dayStart = 1;
         } elseif (($monthStart < $monthEnd || $yearStart < $yearEnd) && ($date['mon'] == $monthStart && $date['year'] == $yearStart)) {
             $dayEnd = 31;
         } else {
             $dayStart = 1;
             $dayEnd = 31;
         }
         for ($i = (int) $dayStart; $i <= $dayEnd; $i++) {
             if (!isset($events[$i])) {
                 $events[$i] = array();
             }
             $events[$i][] = $eventModel;
         }
     }
     $render = $this->render('eventsCalendarWidget', array('events' => $events, 'date' => $date), true);
     if (Yii::app()->request->isAjaxRequest) {
         echo "\n" . '<div id="events-calendar-widget-render">' . "\n";
         echo $render;
         echo "\n" . '</div>' . "\n";
         Yii::app()->end();
     } else {
         echo $render;
     }
 }
Esempio n. 9
0
 /** Gets the DBF file as a binary string
  * @see DBF::write()
  * @return string a binary string containing the DBF file.
  */
 public static function getBinary(array $schema, array $records, $pDate, $ismemofile)
 {
     if (is_numeric($pDate)) {
         $date = getDate($pDate);
     } elseif ($pDate == null) {
         $date = getDate();
     } else {
         $date = $pDate;
     }
     return self::makeHeader($date, $schema, $records, $ismemofile) . self::makeSchema($schema) . self::makeRecords($schema, $records);
 }
 /**
  * @param bool $inFullName
  * @return mixed
  */
 public function getWhatDay($inFullName = true)
 {
     $typeKey = 'full';
     if ($inFullName != true) {
         $typeKey = 'abbr';
     }
     $this->dateInfoArray = @getDate();
     $weekday = $this->dateInfoArray[self::KEY_WEEKDAY];
     //曜日
     return static::$nameOfhDays[$weekday][$typeKey];
 }
Esempio n. 11
0
function get_server_time()
{
    $now = getDate();
    if ($now["minutes"] < 10) {
        $now["minutes"] = "0" . $now["minutes"];
    }
    if ($now["seconds"] < 10) {
        $now["seconds"] = "0" . $now["seconds"];
    }
    echo $now["minutes"] . " " . $now["seconds"];
}
Esempio n. 12
0
 public function onLoad($param)
 {
     parent::onLoad($param);
     if (!$this->isPostBack) {
         $date = getDate();
         if (Prado::getApplication()->getSession()->contains('nonWorkingDayYear')) {
             $this->until->setTimeStamp(mktime(0, 0, 0, 1, 1, $this->Session['nonWorkingDayYear']));
             $this->from->setTimeStamp(mktime(0, 0, 0, 1, 1, $this->Session['nonWorkingDayYear']));
         } else {
             $this->until->setTimeStamp(mktime(0, 0, 0, 1, 1, $date['year']));
             $this->from->setTimeStamp(mktime(0, 0, 0, 1, 1, $date['year']));
         }
     }
 }
 function creatOrg($org = null)
 {
     $this->org = $org;
     $basepath = '/millersville/services/csil/organizations/profiles';
     $sysname = $this->cleanAssetName($this->org['orgname']);
     # Setup the structured data.
     $this->_setupOfficerArray($this->org['officers']);
     $this->_setupAdvisorArray($this->org['advisors']);
     # Prepare the selected categories.
     $temp = '';
     if ($this->org['category']) {
         foreach ($this->org['category'] as $cat) {
             $temp .= '::CONTENT-XML-SELECTOR::' . str_replace('&', 'and', $cat);
         }
     }
     $this->org['category'] = $temp;
     $this->sData[] = array('type' => 'group', 'identifier' => 'about', 'structuredDataNodes' => array('structuredDataNode' => array(array('type' => 'text', 'identifier' => 'purpose', 'text' => $this->org['purpose']), array('type' => 'text', 'identifier' => 'category', 'text' => $this->org['category']), array('type' => 'text', 'identifier' => 'website', 'text' => $this->org['website'] != 'http://' ? $this->org['website'] : ''), array('type' => 'text', 'identifier' => 'displayWebsite', 'text' => $this->org['confidential'] == 'Y' ? 'Yes' : 'No'), array('type' => 'text', 'identifier' => 'numMembers', 'text' => $this->org['nummembers']), array('type' => 'group', 'identifier' => 'meetings', 'structuredDataNodes' => array('structuredDataNode' => array(array('type' => 'text', 'identifier' => 'day', 'text' => $this->org['day']), array('type' => 'text', 'identifier' => 'time', 'text' => $this->org['time']), array('type' => 'text', 'identifier' => 'location', 'text' => $this->org['location'])))))));
     # Find the expiration date and folder.
     #
     # If the Month is after August, the expiration date needs to be the next year
     # If the Month is August and the Day is greater than 20, the experiation date needs to be the next year
     # If the Month is before August or August 20th, the expiration date needs to be the current year
     #
     $currentDate = getDate();
     if ($currentDate['mon'] > 8 || $currentDate['mon'] == 8 && $currentDate['mday'] > 20) {
         $expirationDate = mktime(0, 0, 0, 8, 20, $currentDate['year'] + 1);
         $expirationFolder = $basepath . '/archived/' . $currentDate['year'] . '_' . ($currentDate['year'] + 1);
     } else {
         $expirationDate = mktime(0, 0, 0, 8, 20, $currentDate['year']);
         $expirationFolder = $basepath . '/archived/' . ($currentDate['year'] - 1) . '_' . $currentDate['year'];
     }
     //echo $expirationFolder;
     # Check to be sure the archived folder exists (i.e. archives/YYYY).
     #	If not, create the folder.
     if (!$this->isAssetAlreadyCreated($expirationFolder, 'folder')) {
         # Create the root public folder
         $data = array('system-name' => str_replace($basepath . '/archived/', '', $expirationFolder), 'path' => $basepath . '/archived', 'indexable' => 0, 'publishable' => 0);
         if (!$this->createFolder($data)) {
             return false;
         }
     }
     # Create the page.
     $data = array('name' => $sysname, 'parentFolderPath' => $basepath . '/pending', 'shouldBePublished' => true, 'shouldBeIndexed' => true, 'expirationFolderPath' => $expirationFolder, 'metadata' => array('displayName' => $this->org['orgname'], 'title' => $this->org['orgname'], 'endDate' => $expirationDate), 'contentTypeId' => '5d9f032c7f000001000225f08612c787', 'structuredData' => array('structuredDataNodes' => array('structuredDataNode' => $this->sData)));
     if (!$this->createPage($data)) {
         return false;
     }
     unset($data);
     return true;
 }
Esempio n. 14
0
 public function publishNewHood($hood)
 {
     $today = getDate();
     $hood['date'] = $today['year'] . "-" . $today['mon'] . "-" . $today['mday'];
     $hood['time'] = $today['hours'] . ":" . $today['minutes'] . ":" . $today['seconds'];
     if (strlen($hood['text']) <= 500 && strlen($hood['text']) >= 1) {
         $idHood = $this->hood_model->insertNewHood($hood);
         $data['idHood'] = $idHood[0];
         echo $this->session->userdata('id');
     } else {
         $data['error'] = 'Error el Hood debe contener entre 1 - 500 caracteres';
         $data['main_content'] = '';
         $this->load->view('includes/template', $data);
     }
 }
 /**
  *
  * @param array $files Data table containing the name of data files
  * @param array $datas Data table containing picked datas
  * @param string $context_datas Will be written in the log files.
  * @throws Exception Both arrays must have the same size.
  */
 public function __construct($storage_directory, $datas, $context_datas)
 {
     $this->storage_directory = $storage_directory;
     $this->week_suffix = "." . date("y") . '\'' . date("W");
     $this->date = getDate();
     $this->context_datas = $context_datas;
     $this->files = array();
     $this->data_file_name = $this->storage_directory . $this->data_file_name;
     $this->datas = array();
     foreach ($datas as $index => $data) {
         $this->files[] = $this->storage_directory . $index;
         $this->datas[] = $data;
     }
     $this->updateLogFiles();
 }
Esempio n. 16
0
function get_festivos($anio)
{
    global $festivos;
    global $festivos_tmp;
    festivo_religioso(pascua($anio), 'Jueves Santo', 0);
    festivo_religioso(pascua($anio), 'Viernes Santo', 0);
    festivo_religioso(pascua($anio), 'Asension', 1);
    festivo_religioso(pascua($anio), 'Corpus Cristi', 1);
    festivo_religioso(pascua($anio), 'Sagrado Corazon', 1);
    for ($i = 1; $i <= 12; $i++) {
        $this_month = getDate(mktime(0, 0, 0, $i, 1, $anio));
        $next_month = getDate(mktime(0, 0, 0, $i + 1, 1, $anio));
        $days = round(($next_month[0] - $this_month[0]) / (60 * 60 * 24));
        for ($i_day = 1; $i_day <= $days; $i_day++) {
            $festivo = date("w", mktime(0, 0, 0, $i, $i_day, $anio));
            if ($festivo == 0 || $festivo == 6) {
                $festivo_month = $festivos[$i];
                array_push($festivo_month, $i_day);
                $festivos[$i] = $festivo_month;
            }
            $fiesta_tmp = $festivos_tmp[$i];
            foreach ($fiesta_tmp as $fiesta) {
                if ($fiesta == $i_day) {
                    $festivo_mov = date("w", mktime(0, 0, 0, $i, $i_day, $anio));
                    $festivo_month = $festivos[$i];
                    if ($festivo_mov != 1) {
                        $num = sig_lunes($festivo_mov);
                        $festivo_new = date("Y-m-d", mktime(0, 0, 0, $i, $i_day, $anio) + $num * 24 * 60 * 60);
                        list($f_anio, $f_mes, $f_dia) = parte_fecha($festivo_new);
                        if (substr($f_mes, 0, 1) == 0) {
                            $f_mes = substr($f_mes, 1, 2);
                        }
                        if (substr($f_dia, 0, 1) == 0) {
                            $f_dia = substr($f_dia, 1, 2);
                        }
                        $festivo_month = $festivos[$f_mes];
                        array_push($festivo_month, $f_dia);
                        $festivos[$f_mes] = $festivo_month;
                    } else {
                        array_push($festivo_month, $i_day);
                        $festivos[$i] = $festivo_month;
                    }
                }
            }
        }
    }
}
Esempio n. 17
0
 function XoopsFormDateTime($caption, $name, $size = 15, $value = 0)
 {
     $this->XoopsFormElementTray($caption, '&nbsp;');
     $value = intval($value);
     $this->addElement(new XoopsFormTextDateSelect('', $name . '[date]', $size, $value));
     $timearray = array();
     for ($i = 0; $i < 24; $i++) {
         for ($j = 0; $j < 60; $j = $j + 10) {
             $key = $i * 3600 + $j * 60;
             $timearray[$key] = $j != 0 ? $i . ':' . $j : $i . ':0' . $j;
         }
     }
     ksort($timearray);
     $datetime = $value > 0 ? getDate($value) : getdate(time());
     $timeselect = new XoopsFormSelect('', $name . '[time]', $datetime['hours'] * 3600 + 600 * ceil($datetime['minutes'] / 10));
     $timeselect->addOptionArray($timearray);
     $this->addElement($timeselect);
 }
Esempio n. 18
0
 public function __construct(&$doorGets)
 {
     $this->doorGets = $doorGets;
     $this->total['paid'] = $this->getTotalAmountPaid();
     $this->total['cancel'] = $this->getTotalAmountCancel();
     $this->total['waiting'] = $this->getTotalAmountWaiting();
     $this->total['profit'] = $this->getTotalAmountProfit();
     $time = time();
     $dateToday = getDate($time);
     $dateTodayFormat = $dateToday['year'] . '-' . $dateToday['mon'] . '-' . $dateToday['mday'];
     $startToday = strtotime($dateTodayFormat . ' 00:00:01');
     $endToday = strtotime($dateTodayFormat . ' 23:59:59');
     $this->today['paid'] = $this->getAmountPaidByDate($startToday, $endToday);
     $this->today['cancel'] = $this->getAmountCancelByDate($startToday, $endToday);
     $this->today['waiting'] = $this->getAmountWaitingByDate($startToday, $endToday);
     $this->today['profit'] = $this->getAmountProfitByDate($startToday, $endToday);
     $timeYesterday = $startToday - 10;
     $dateYesterday = getDate($timeYesterday);
     $dateYesterdayFormat = $dateYesterday['year'] . '-' . $dateYesterday['mon'] . '-' . $dateYesterday['mday'];
     $startYesterday = strtotime($dateYesterdayFormat . ' 00:00:01');
     $endYesterday = strtotime($dateYesterdayFormat . ' 23:59:59');
     $this->yesterday['paid'] = $this->getAmountPaidByDate($startYesterday, $endYesterday);
     $this->yesterday['cancel'] = $this->getAmountCancelByDate($startYesterday, $endYesterday);
     $this->yesterday['waiting'] = $this->getAmountWaitingByDate($startYesterday, $endYesterday);
     $this->yesterday['profit'] = $this->getAmountProfitByDate($startYesterday, $endYesterday);
     $timeWeek = $startToday - 604800;
     $dateWeek = getDate($timeWeek);
     $dateWeekFormat = $dateWeek['year'] . '-' . $dateWeek['mon'] . '-' . $dateWeek['mday'];
     $startWeek = strtotime($dateWeekFormat . ' 00:00:01');
     $endWeek = $endToday;
     $this->week['paid'] = $this->getAmountPaidByDate($startWeek, $endWeek);
     $this->week['cancel'] = $this->getAmountCancelByDate($startWeek, $endWeek);
     $this->week['waiting'] = $this->getAmountWaitingByDate($startWeek, $endWeek);
     $this->week['profit'] = $this->getAmountProfitByDate($startWeek, $endWeek);
     $timeMonth = $startToday - 2592000;
     $dateMonth = getDate($timeMonth);
     $dateMonthFormat = $dateMonth['year'] . '-' . $dateMonth['mon'] . '-' . $dateMonth['mday'];
     $startMonth = strtotime($dateMonthFormat . ' 00:00:01');
     $endMonth = $endToday;
     $this->month['paid'] = $this->getAmountPaidByDate($startMonth, $endMonth);
     $this->month['cancel'] = $this->getAmountCancelByDate($startMonth, $endMonth);
     $this->month['waiting'] = $this->getAmountWaitingByDate($startMonth, $endMonth);
     $this->month['profit'] = $this->getAmountProfitByDate($startMonth, $endMonth);
 }
Esempio n. 19
0
 /**
  * Initialize Billing Page
  *
  * Gather billing statistics from the database and assign them to template variables
  */
 function init()
 {
     parent::init();
     // Current month
     $now = getDate(time());
     $this->smarty->assign("month", $now['month']);
     // Invoice Summary
     $stats = outstanding_invoices_stats();
     $this->smarty->assign("os_invoices_count", $stats['count']);
     $this->smarty->assign("os_invoices_total", $stats['total']);
     $this->smarty->assign("os_invoices_count_past_due", $stats['count_past_due']);
     $this->smarty->assign("os_invoices_total_past_due", $stats['total_past_due']);
     $this->smarty->assign("os_invoices_count_past_due_30", $stats['count_past_due_30']);
     $this->smarty->assign("os_invoices_total_past_due_30", $stats['total_past_due_30']);
     // Payment Summary
     $stats = payments_stats();
     $this->smarty->assign("payments_count", $stats['count']);
     $this->smarty->assign("payments_total", $stats['total']);
 }
Esempio n. 20
0
 function __construct($caption, $name, $size = 15, $value = 0)
 {
     parent::__construct($caption, '&nbsp;');
     $value = intval($value);
     $value = $value > 0 ? $value : time();
     $datetime = getDate($value);
     $this->addElement(new Xmf_Form_Element_Text_DateSelect('', $name . '[date]', $size, $value));
     $timearray = array();
     for ($i = 0; $i < 24; $i++) {
         for ($j = 0; $j < 60; $j = $j + 10) {
             $key = $i * 3600 + $j * 60;
             $timearray[$key] = $j != 0 ? $i . ':' . $j : $i . ':0' . $j;
         }
     }
     ksort($timearray);
     $timeselect = new Xmf_Form_Element_Select('', $name . '[time]', $datetime['hours'] * 3600 + 600 * ceil($datetime['minutes'] / 10));
     $timeselect->addOptionArray($timearray);
     $this->addElement($timeselect);
 }
Esempio n. 21
0
	public static function formatDate($date) {

		if (!is_numeric($date))
			$date = strtotime($date);	// make sure $date is a proper timestamp

		$now = getDate();			// generate date arrays
		$due = getDate($date);	// for calculations
		//$date = mktime(23,59,59,$due['mon'],$due['mday'],$due['year']);	// give them until 11:59 PM to finish the action
		//$due = getDate($date);
	
		if ($due['year'] == $now['year']) {		// is the due date this year?
			if ($due['yday'] == $now['yday'])		// is the due date today?
				return Yii::t('app','Today');
			else if ($due['yday'] == $now['yday']+1)	// is it tomorrow?
				return Yii::t('app','Tomorrow');
			else 
				return Yii::app()->dateFormatter->format('MMM d',$date);	// any other day this year
		} else {
			return Yii::app()->dateFormatter->format('MMM d, yyyy',$date);	// due date is after this year
		}
	}
Esempio n. 22
0
/**
 * Payment Stats
 *
 * Retrieve stats associated with Payments
 *
 * @return array Payment stats
 */
function payments_stats()
{
    // Count payments for the current month
    $payments_this_month = 0;
    // ... and total them
    $total_payments_this_month = 0.0;
    // Get all payments for this month
    $now = getDate(time());
    $first_of_month = mktime(0, 0, 1, $now['mon'], 1, $now['year']);
    try {
        // Iterate through the payments
        $paymentdbo_array = load_array_PaymentDBO("UNIX_TIMESTAMP(date) > " . $first_of_month);
        foreach ($paymentdbo_array as $payment) {
            // Add payment to totals
            $payments_this_month++;
            $total_payments_this_month += $payment->getAmount();
        }
    } catch (DBNoRowsFoundException $e) {
    }
    return array("count" => $payments_this_month, "total" => $total_payments_this_month);
}
Esempio n. 23
0
 function publishNewHood()
 {
     $newhood['text'] = $this->input->post('texthood');
     $newhood['TUsers_idUsers'] = $this->session->userdata('id');
     //$this->load->library('form_validation');
     //$this->form_validation->set_rules('texthood', 'Usuario', 'trim|required|alphanumeric|min_length[1]|max_length[500]');
     $today = getDate();
     $newhood['date'] = $today['year'] . "-" . $today['mon'] . "-" . $today['mday'];
     $newhood['time'] = $today['hours'] . ":" . $today['minutes'] . ":" . $today['seconds'];
     //Cambiar esta validacion por la que va a hacer Ricardo
     if (strlen($newhood['text']) <= 500 && strlen($newhood['text']) >= 1) {
         $this->load->model("hoods_model");
         $this->hoods_model->insertNewHood($newhood);
         redirect('/leposte');
     } else {
         $data['error'] = 'Error el Hood debe contener entre 1 - 500 caracteres';
         $data['main_content'] = '';
         $this->load->view('includes/template', $data);
     }
     //Hasta aqui la validacion que hay q cambiar
 }
Esempio n. 24
0
 /**
  * get Date 
  *
  * @param  Array $date 
  * @return View
  */
 public function getDate($date)
 {
     $month = getDate()['mon'];
     $current_month = getDate()['mon'] - 1;
     /* Inisialisation for array */
     $dates = ['2014-12-31'];
     $current_month = DB::select(DB::raw("SELECT date_report FROM savings_products\n\t\t\t\t\t\t\t WHERE DATE_FORMAT(date_report, '%m') = '{$current_month}'\n\t\t\t\t\t\t\t GROUP BY date_report\n\t\t\t\t\t\t\t ORDER BY date_report desc\n\t\t\t\t\t\t\t LIMIT 1"));
     if ($month == 12) {
         $this_year = getDate()['year'];
         $month = DB::select(DB::raw("SELECT date_report FROM savings_products\n\t\t\t\t\t\t\t WHERE DATE_FORMAT(date_report, '%m') = '{$month}' AND DATE_FORMAT(date_report, '%y') = '{$this_year}'\n\t\t\t\t\t\t\t GROUP BY date_report\n\t\t\t\t\t\t\t ORDER BY date_report DESC\n\t\t\t\t\t\t\t LIMIT 1"));
     } else {
         $month = DB::select(DB::raw("SELECT date_report FROM savings_products\n\t\t\t\t\t\t\t WHERE DATE_FORMAT(date_report, '%m') = '{$month}'\n\t\t\t\t\t\t\t GROUP BY date_report\n\t\t\t\t\t\t\t ORDER BY date_report DESC\n\t\t\t\t\t\t\t LIMIT 1"));
     }
     if (!empty($current_month)) {
         array_push($dates, $current_month[0]->date_report);
     }
     if (!empty($month)) {
         array_push($dates, $this_month[0]->date_report);
     }
     return $dates;
 }
Esempio n. 25
0
 function ExtcalFormDateTime(&$form, $startTS = 0, $endTS = 0)
 {
     $startTS = intval($startTS);
     $startTS = $startTS > 0 ? $startTS : time();
     $startDatetime = getDate($startTS);
     $endTS = intval($endTS);
     $endTS = $endTS > 0 ? $endTS : time();
     $endDatetime = getDate($endTS);
     $timearray = array();
     for ($i = 0; $i < 24; $i++) {
         for ($j = 0; $j < 60; $j = $j + 10) {
             $key = $i * 3600 + $j * 60;
             $timearray[$key] = $j != 0 ? $i . ':' . $j : $i . ':0' . $j;
         }
     }
     ksort($timearray);
     // Start date element's form
     $startElmtTray = new XoopsFormElementTray(_MD_EXTCAL_START_DATE, '&nbsp;');
     $startDate = new XoopsFormTextDateSelect('', 'event_start[date]', 15, $startTS);
     $startDate->setExtra('onBlur=\'validDate("event_start[date]", "event_start[time]", "event_end[date]", "event_end[time]");\'');
     $startElmtTray->addElement($startDate);
     $startTime = new XoopsFormSelect('', 'event_start[time]', $startDatetime['hours'] * 3600 + 600 * ceil($startDatetime['minutes'] / 10));
     $startTime->setExtra('onChange=\'validDate("event_start[date]", "event_start[time]", "event_end[date]", "event_end[time]");\'');
     $startTime->addOptionArray($timearray);
     $startElmtTray->addElement($startTime);
     $form->addElement($startElmtTray, true);
     // End date element's form
     $endElmtTray = new XoopsFormElementTray(_MD_EXTCAL_END_DATE, '<br />');
     $endDateElmtTray = new XoopsFormElementTray('', "&nbsp;");
     $endElmtTray->addElement(new XoopsFormRadioYN(_MD_EXTCAL_EVENT_END, 'have_end', 1));
     $endDate = new XoopsFormTextDateSelect('', 'event_end[date]', 15, $endTS);
     $endDate->setExtra('onBlur=\'validDate("event_start[date]", "event_start[time]", "event_end[date]", "event_end[time]");\'');
     $endDateElmtTray->addElement($endDate);
     $endTime = new XoopsFormSelect('', 'event_end[time]', $endDatetime['hours'] * 3600 + 600 * ceil($endDatetime['minutes'] / 10));
     $endTime->setExtra('onChange=\'validDate("event_start[date]", "event_start[time]", "event_end[date]", "event_end[time]");\'');
     $endTime->addOptionArray($timearray);
     $endDateElmtTray->addElement($endTime);
     $endElmtTray->addElement($endDateElmtTray);
     $form->addElement($endElmtTray);
 }
Esempio n. 26
0
 /**
  * Get public holidays for this year the previous year and the next year
  *
  */
 public static function getPublicHolidays()
 {
     $now = getDate();
     //Initilized with french public holidays: easter ..
     $list = array(date("Ymd", easter_date($now['year'] - 1)), date("Ymd", easter_date($now['year'] - 1) + 39 * (24 * 3600)), date("Ymd", easter_date($now['year'] - 1) + 50 * (24 * 3600)), date("Ymd", easter_date($now['year'])), date("Ymd", easter_date($now['year']) + 39 * (24 * 3600)), date("Ymd", easter_date($now['year']) + 50 * (24 * 3600)), date("Ymd", easter_date($now['year'] + 1)), date("Ymd", easter_date($now['year'] + 1) + 39 * (24 * 3600)), date("Ymd", easter_date($now['year'] + 1) + 50 * (24 * 3600)));
     //get others public holidays from file
     $arrayHolidays = file(dirname(__FILE__) . '/../../misc/holidays/fr');
     //remove easter
     array_shift($arrayHolidays);
     $holifile = array();
     foreach ($arrayHolidays as $holidays) {
         preg_match('/(.*)\\t(.*)\\t(Bank)/', $holidays, $matches);
         if ($matches[0]) {
             $strholi = substr($matches[0], 0, 5);
             $strholiArray = explode('-', $strholi);
             array_push($list, date("Ymd", mktime(0, 0, 0, $strholiArray[0], $strholiArray[1], $now['year'] - 1)));
             array_push($list, date("Ymd", mktime(0, 0, 0, $strholiArray[0], $strholiArray[1], $now['year'])));
             array_push($list, date("Ymd", mktime(0, 0, 0, $strholiArray[0], $strholiArray[1], $now['year'] + 1)));
         }
     }
     return $list;
 }
Esempio n. 27
0
 /**
  * this adds an Order to the table
  * @param INT $user_id ID of the user who is placing the order
  * @param ARRAY $quantities Quantities of the tacos whose toppings are in the same index in $toppings
  * @param ARRAY $toppings Two dimensional array holding the toppings of the tacos in the same index in $quantities as the first dimension of $toppings
  */
 public function addOrder($user_id, $quantities, $toppings)
 {
     date_default_timezone_set('UTC');
     $date = getDate();
     $formattedDate = $date['year'] . "-" . $date['mon'] . "-" . $date['mday'] . " " . $date['hours'] . ":" . $date['minutes'] . ":" . $date['seconds'];
     $query = "INSERT INTO orders(user_id,order_dates) VALUES(?,?)";
     $results = $this->db->insert($query, array($user_id, $formattedDate));
     $results1;
     $count = 0;
     foreach ($quantities as $quantity) {
         $query = "INSERT INTO tacos (quantity,order_id)VALUES(?,?)";
         $results1[$count] = $this->db->insert($query, array($quantity, $results));
         $count++;
     }
     for ($taco_iter = 0; $taco_iter < $count; $taco_iter++) {
         for ($topping_iter = 0; $topping_iter < count($toppings[$taco_iter]); $topping_iter++) {
             echo $toppings[$taco_iter][$topping_iter];
             $query = "INSERT INTO tacoToppings(topping_id,taco_id)VALUES(?,?)";
             $attributes = $this->db->insert($query, array($toppings[$taco_iter][$topping_iter], $results1[$taco_iter]));
             echo $results1[$taco_iter];
         }
     }
 }
Esempio n. 28
0
 /**
  * Sets the due date for a reviewer to respond to a review request.
  * @param $monographId int
  * @param $reviewId int
  * @param $dueDate string
  */
 function setResponseDueDate($monographId, $reviewId, $dueDate = null, $numWeeks = null)
 {
     $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
     $userDao =& DAORegistry::getDAO('UserDAO');
     $user =& Request::getUser();
     $reviewAssignment =& $reviewAssignmentDao->getById($reviewId);
     $reviewer =& $userDao->getUser($reviewAssignment->getReviewerId());
     if (!isset($reviewer)) {
         return false;
     }
     if ($reviewAssignment->getSubmissionId() == $monographId && !HookRegistry::call('SeriesEditorAction::setDueDate', array(&$reviewAssignment, &$reviewer, &$dueDate, &$numWeeks))) {
         $today = getDate();
         $todayTimestamp = mktime(0, 0, 0, $today['mon'], $today['mday'], $today['year']);
         if ($dueDate != null) {
             $dueDateParts = explode('-', $dueDate);
             // Ensure that the specified due date is today or after today's date.
             if ($todayTimestamp <= strtotime($dueDate)) {
                 $reviewAssignment->setDateDue(date('Y-m-d H:i:s', mktime(0, 0, 0, $dueDateParts[1], $dueDateParts[2], $dueDateParts[0])));
             } else {
                 $reviewAssignment->setDateDue(date('Y-m-d H:i:s', $todayTimestamp));
             }
         } else {
             // Add the equivilant of $numWeeks weeks, measured in seconds, to $todaysTimestamp.
             $numWeeks = max((int) $numWeeks, 2);
             $newDueDateTimestamp = $todayTimestamp + $numWeeks * 7 * 24 * 60 * 60;
             $reviewAssignment->setDateDue(date('Y-m-d H:i:s', $newDueDateTimestamp));
         }
         $reviewAssignment->stampModified();
         $reviewAssignmentDao->updateObject($reviewAssignment);
     }
 }
Esempio n. 29
0
 public function executeSparkline()
 {
     $query = "SELECT year(date) year, month(date) month, IFNULL(MAX(r.sum), 0) AS sum\n\t\t\t\tFROM sf_review_type_entity  r\n\t\t\t\tWHERE r.value = 1 \n\t\t\t\tAND r.entity_id = ? AND r.sf_review_type_id = ?\n\t\t\t\tGROUP BY year, month\n\t\t\t\tORDER BY year, month\n\t\t\t\t";
     $connection = Propel::getConnection();
     $statement = $connection->prepare($query);
     $statement->bindValue(1, $this->reviewable->getId());
     $statement->bindValue(2, $this->reviewable->getType());
     $statement->execute();
     $data = $statement->fetchAll(PDO::FETCH_OBJ);
     $this->sparklineData = "";
     $last = 0;
     $idx = 0;
     $firstDate = getDate(mktime(0, 0, 0, date("m") - 7, date("d"), date("Y")));
     $aMonth = $firstDate['mon'];
     $aYear = $firstDate['year'];
     if (count($data) == 0) {
         $this->sparklineData = "0,0";
     }
     foreach ($data as $element) {
         $idx++;
         if ($idx == 1) {
             while ($element->year > $aYear || $element->year == $aYear && $element->month > $aMonth) {
                 $aMonth++;
                 if ($aMonth == 13) {
                     $aMonth = 1;
                     $aYear++;
                 }
                 $this->sparklineData .= ($this->sparklineData ? ", " : '') . "0";
             }
         }
         $this->sparklineData .= ($this->sparklineData ? ", " : '') . "" . ($element->sum - $last) . "";
         $last = $element->sum;
     }
 }
Esempio n. 30
0
 /**
  * Returns a formatted review due date
  * @param $dueDate string
  * @param $numWeeks int
  * @return string
  */
 function getReviewDueDate($dueDate = null, $numWeeks = null)
 {
     $today = getDate();
     $todayTimestamp = mktime(0, 0, 0, $today['mon'], $today['mday'], $today['year']);
     if ($dueDate) {
         $dueDateParts = explode('-', $dueDate);
         // Ensure that the specified due date is today or after today's date.
         if ($todayTimestamp <= strtotime($dueDate)) {
             return date('Y-m-d H:i:s', mktime(0, 0, 0, $dueDateParts[1], $dueDateParts[2], $dueDateParts[0]));
         } else {
             return date('Y-m-d H:i:s', $todayTimestamp);
         }
     } elseif ($numWeeks) {
         return date('Y-m-d H:i:s', $todayTimestamp + $numWeeks * 7 * 24 * 60 * 60);
     } else {
         $journal =& Request::getJournal();
         $settingsDao =& DAORegistry::getDAO('JournalSettingsDAO');
         $numWeeks =& $settingsDao->getSetting($journal->getId(), 'numWeeksPerReview');
         if (!isset($numWeeks) || (int) $numWeeks < 0) {
             $numWeeks = 0;
         }
         return date('Y-m-d H:i:s', $todayTimestamp + $numWeeks * 7 * 24 * 60 * 60);
     }
 }