Ejemplo n.º 1
0
 /**
  * Convert a FormalDate to a string
  * @return string
  */
 public function __toString()
 {
     $result = array();
     if ($this->isRecurring) {
         $result[] = "R";
         if ($this->numRepetitions !== null) {
             $result[] = $this->numRepetitions;
         }
         $result[] = "/";
     } elseif ($this->isApproximate) {
         $result[] = "A";
     }
     if ($this->start !== null) {
         $result[] = $this->start->__toString();
     }
     if ($this->isRange) {
         $result[] = "/";
     }
     if ($this->end !== null) {
         $result[] = $this->end->__toString();
     } elseif ($this->duration !== null) {
         $result[] = $this->duration->__toString();
     }
     return implode("", $result);
 }
Ejemplo n.º 2
0
 public function __toObject($myManager, $epObject, $object)
 {
     $object->id = $epObject->oid;
     $object->trackId = $epObject->trackId;
     $object->operator = $epObject->operator;
     $object->date = $epObject->date != 0 ? SimpleDate::fromStamp($epObject->date) : 0;
     $object->content = $epObject->content;
     return $object;
 }
Ejemplo n.º 3
0
 public function __toObject($myManager, $epObject, $object)
 {
     $object->id = $epObject->oid;
     $object->trackId = $epObject->trackId;
     $object->start = $epObject->start != 0 ? SimpleDate::fromStamp($epObject->start) : 0;
     $object->end = $epObject->end != 0 ? SimpleDate::fromStamp($epObject->end) : 0;
     $object->page = $epObject->page;
     return $object;
 }
Ejemplo n.º 4
0
 public function __toObject($myManager, $epObject, $object)
 {
     $object->id = $epObject->oid;
     $object->trackId = $epObject->trackId;
     $object->visitId = $epObject->visitId;
     $object->cancelled = $epObject->cancelled;
     $object->operateType = $epObject->operateType;
     $object->operator = $epObject->operator;
     $object->operatedDate = $epObject->operatedDate != 0 ? SimpleDate::fromStamp($epObject->operatedDate) : 0;
     $object->content = $epObject->content;
     $object->prevOperator = $epObject->prevOperator;
     $object->firstVisited = $epObject->firstVisited;
     return $object;
 }
Ejemplo n.º 5
0
 public function addEvent($title, $location, $content, $startDate, $endDate, $is_all_day_event)
 {
     // Create a new entry using the calendar service's magic factory method
     $event = $this->service->newEventEntry();
     // Populate the event with the desired information
     // Note that each attribute is crated as an instance of a matching class
     $event->title = $this->service->newTitle($title);
     $event->where = array($this->service->newWhere($location));
     $event->content = $this->service->newContent($content);
     $hasTime = !$is_all_day_event;
     $when = $this->service->newWhen();
     $when->startTime = SimpleDate::toUTC($startDate, $hasTime);
     $when->endTime = SimpleDate::toUTC($endDate, $hasTime);
     $event->when = array($when);
     // Upload the event to the calendar server
     // A copy of the event as it is recorded on the server is returned
     $newEvent = $this->service->insertEvent($event);
     return $newEvent->getEditLink()->href;
 }
Ejemplo n.º 6
0
 public function __toObject($myManager, $epObject, $object)
 {
     require_once dirname(__FILE__) . '/ORMpz_ireverse.class.php';
     $object->id = $epObject->oid;
     $object->trackId = $epObject->trackId;
     $object->createdDate = $epObject->createdDate != 0 ? SimpleDate::fromStamp($epObject->createdDate) : 0;
     $object->creator = $epObject->creator;
     $object->weddingDay = $epObject->weddingDay != 0 ? SimpleDate::fromStamp($epObject->weddingDay) : 0;
     $object->brideName = $epObject->brideName;
     $object->bridePhone = $epObject->bridePhone;
     $object->brideMobile = $epObject->brideMobile;
     $object->brideEmail = $epObject->brideEmail;
     $object->brideAddress = $epObject->brideAddress;
     $object->groomName = $epObject->groomName;
     $object->groomPhone = $epObject->groomPhone;
     $object->groomMobile = $epObject->groomMobile;
     $object->groomEmail = $epObject->groomEmail;
     $object->groomAddress = $epObject->groomAddress;
     $object->culturalBackground = $epObject->culturalBackground;
     $object->ceremonyLocation = $epObject->ceremonyLocation;
     $object->receptionLocation = $epObject->receptionLocation;
     $object->source = $epObject->source;
     $object->firstVisitMethod = $epObject->firstVisitMethod;
     $object->firstVisitDate = $epObject->firstVisitDate != 0 ? SimpleDate::fromStamp($epObject->firstVisitDate) : 0;
     $object->status = $epObject->status;
     $object->operatorDate = $epObject->operatorDate != 0 ? SimpleDate::fromStamp($epObject->operatorDate) : 0;
     $object->opponent = $epObject->opponent;
     $object->category = $epObject->category;
     $object->operator = $epObject->operator;
     $object->operatorMessage = $epObject->operatorMessage;
     $object->isVisited = $epObject->isVisited;
     $object->reverses = array();
     if (isset($epObject->reverses)) {
         foreach ($epObject->reverses as &$item) {
             $object->reverses[] = $this->__getObject_4_lvl_1_ep_object($myManager, $item, new ORMpz_ireverse());
         }
     }
     $object->note = $epObject->note;
     return $object;
 }
Ejemplo n.º 7
0
<?php

include '../src/date.php';
$sd = new SimpleDate();
$retval = $sd->getDate();
print_r($retval);
Ejemplo n.º 8
0
<?php

require_once dirname(__FILE__) . '/common/common.inc.php';
if (isset($_COOKIE[OPERATOR])) {
    $_SESSION[OPERATOR] = json_decode($_COOKIE[OPERATOR]);
}
$template = MiscUtils::getParam('t', 'signin');
$options = MiscUtils::getParam('opts', MiscUtils::encode(array()));
$smarty->assign('operator', MiscUtils::encode(array()));
$smarty->assign('now', MiscUtils::encode(SimpleDate::create()));
$smarty->assign('options', $options);
$smarty->assign('template', $template);
$smarty->display('gui/base.tpl');
Ejemplo n.º 9
0
function findByRequest($myPdo)
{
    global $tableVisitor;
    $result = new stdClass();
    $result->data = array();
    $sql = MiscUtils::getParam('sql', '');
    $date = MiscUtils::getParam('date', NULL);
    $sql .= $date ? ' OR (v.weddingDay = \'' . SimpleDate::toStamp(json_decode($date)) . '\')' : '';
    if ($sql) {
        try {
            $stmt = $myPdo->prepare($sql);
            $stmt->execute();
            $i = 0;
            $count = 0;
            while ($i < $stmt->rowCount()) {
                $tmp = $stmt->fetch(PDO::FETCH_OBJ);
                $tmp->weddingDay = $tmp->weddingDay ? SimpleDate::fromStamp($tmp->weddingDay) : NULL;
                $result->data[] = $tmp;
                $i++;
            }
            echo json_encode($result);
        } catch (PDOException $e) {
            echo $e->getMessage();
        }
    }
}
Ejemplo n.º 10
0
 /**
  * Get a range of dates for a range of months, 
  * taking into account the maximum date of each month
  * 
  * @param int $aCountMonth
  * @return array
  */
 public function getDateRange($aCountMonth)
 {
     $arrDates = array();
     //-------------------
     $arrDates[] = $this->get();
     //Получим день месяца
     $day = $this->day_month();
     //Получим дату с 1 днем
     list($y, $m, $d) = explode("-", $this->date);
     $strDate = $y . '-' . $m . '-' . '01';
     $dt = new SimpleDate($strDate);
     //Получим диапазон дат для последующих месяцев
     for ($index = 1; $index <= $aCountMonth; $index++) {
         list($y, $m, $d) = explode("-", $dt->date);
         $strDate = $y . '-' . $m . '-' . '01';
         $dt = new SimpleDate($strDate);
         //Получим новую дату для следующего месяца
         $newDate = $dt->add_months(1);
         $dt = $newDate->date_end_of_month();
         $maxDay = $dt->day_month();
         if ($day > $maxDay) {
             $arrDates[] = $dt->get();
         } else {
             list($y, $m, $d) = explode("-", $dt->get());
             $strDate = $y . '-' . $m . '-' . $day;
             $dt = new SimpleDate($strDate);
             $arrDates[] = $dt->get();
         }
     }
     return $arrDates;
 }
Ejemplo n.º 11
0
function visitors($myManager)
{
    $args = json_decode(MiscUtils::decryptParam('a', '[]'));
    $function = MiscUtils::getParam('f', NULL);
    $order = MiscUtils::getParam('o', 'd.e_oid');
    $queue = MiscUtils::getParam('q', 'DESC');
    $page = MiscUtils::getParam('p', START);
    $size = MiscUtils::getParam('s', 8);
    $datefrom = MiscUtils::getParam('datefrom', NULL);
    $dateto = MiscUtils::getParam('dateto', NULL);
    $createdFrom = MiscUtils::getParam('from', NULL);
    $createdTo = MiscUtils::getParam('to', NULL);
    $condition .= $datefrom ? ' AND (d.weddingDay >= \'' . SimpleDate::toStamp(json_decode($datefrom)) . '\')' : '';
    $condition .= $dateto ? ' AND (vd.weddingDay <= \'' . SimpleDate::toStamp(json_decode($dateto)) . '\')' : '';
    $condition .= $createdFrom ? ' AND (d.createdDate >= \'' . SimpleDate::toStamp(json_decode($createdFrom)) . '\')' : '';
    $condition .= $createdTo ? ' AND (d.createdDate <= \'' . SimpleDate::toStamp(json_decode($createdTo)) . '\')' : '';
    $orm = classToOrm('pz_visitor');
    if ($orm) {
        try {
            $result = $orm->find($myManager, $page, $size, $order, $queue, $condition, $function);
            $result->total = count($orm->find($myManager, START, INFINITE, NULL, NULL, $condition, NULL)->data);
            echo json_encode($result);
        } catch (PDOException $e) {
            echo $e->getMessage();
        }
    }
}