コード例 #1
1
 /**
  * Converts a MySQL formatted date (Y-m-d) to AVETMISS format (dmY).
  *
  * @param string $mysql
  *
  * @return string
  */
 public static function toDate($mysql = null)
 {
     if (is_null($mysql)) {
         return null;
     }
     return date_format(new DateTime($mysql), 'dmY');
 }
コード例 #2
0
ファイル: DateTime.php プロジェクト: vn00186388/bibo-test
 /**
  * invoke
  */
 public function __invoke($datetime)
 {
     if ($datetime != null) {
         return date_format($datetime, \TmCommon\Config\Config::DATE_TIME_FORMAT);
     }
     return null;
 }
コード例 #3
0
 /**
  * __construct Contructor that prepare the collection for assign product list
  * @var Int $userId Current logged seller id
  * @var String $filter Search query string
  * @var String $filter_prostatus product status query string
  * @var String filter_data_frm product creation from date query string
  * @var String filter_data_to product creation to date query string
  * @var Object $collection Catalog product collection object
  * @var Array $products Catalog product ids
  * @var Object $collection Assign product collection object
  */
 public function __construct()
 {
     parent::__construct();
     $userId = Mage::getSingleton('customer/session')->getCustomerId();
     $filter = $this->getRequest()->getParam('s') != "" ? $this->getRequest()->getParam('s') : "";
     $filter_prostatus = $this->getRequest()->getParam('prostatus') != "" ? $this->getRequest()->getParam('prostatus') : "";
     $filter_data_frm = $this->getRequest()->getParam('from_date') != "" ? $this->getRequest()->getParam('from_date') : "";
     $filter_data_to = $this->getRequest()->getParam('to_date') != "" ? $this->getRequest()->getParam('to_date') : "";
     $from = null;
     $to = null;
     if ($filter_data_to) {
         $todate = date_create($filter_data_to);
         $to = date_format($todate, 'Y-m-d H:i:s');
     }
     if ($filter_data_frm) {
         $fromdate = date_create($filter_data_frm);
         $from = date_format($fromdate, 'Y-m-d H:i:s');
     }
     $collection = Mage::getModel('catalog/product')->getCollection()->addAttributeToSelect('*')->addFieldToFilter('name', array('like' => "%" . $filter . "%"))->setOrder('entity_id', 'AESC');
     $products = array();
     foreach ($collection as $data) {
         array_push($products, $data->getEntityId());
     }
     $collection = Mage::getModel('mpassignproduct/mpassignproduct')->getCollection()->addFieldToFilter('product_id', array('in' => $products))->addFieldToFilter('created_at', array('datetime' => true, 'from' => $from, 'to' => $to))->addFieldToFilter('seller_id', array('eq' => $userId));
     if ($filter_prostatus != "") {
         $collection->addFieldToFilter('flag', array('eq' => $filter_prostatus));
     }
     $this->setCollection($collection);
 }
コード例 #4
0
ファイル: ActionTesoreria.php プロジェクト: gianpascal/yachay
 public function detalleOrden($codigo, $parametro)
 {
     $o_LTesoreria = new LTesoreria();
     $o_LPersona = new LPersona();
     $combo = $this->comboTipoDocumento('1');
     $arrayDatos = $o_LTesoreria->datosPersonales($codigo, $parametro);
     //$codigo='';
     $nombre = '';
     $fechaNacimiento = '';
     $edad = '';
     $documento = '';
     $filiacion = '';
     //print_r($arrayDatos);
     foreach ($arrayDatos as $fila) {
         //$codigo=$fila[0];
         $nombre = htmlentities($fila[4] . " " . $fila[5] . ", " . $fila[6]);
         $fechaNacimiento = $fila[7];
         $documento = $fila[0];
         $filiacion = $fila[3];
     }
     //date_default_timezone_set('Europe/London');
     $datetime = date_create($fechaNacimiento);
     $fechaNacimiento = date_format($datetime, 'm/d/Y');
     //echo date_format($datetime, DATE_ATOM);
     //echo $fechaNacimiento->format('d-m-y');
     //print_r($arrayDatos);
     $edad = $o_LPersona->formatoEdad($fechaNacimiento);
     //creando la tabla
     $arrayFilas = $o_LTesoreria->obtenerOrdenes($codigo, $parametro);
     $arrayTipo = array("10" => "h", "0" => "c", "1" => "c", "2" => "c", "11" => "h", "3" => "c", "13" => "h", "4" => "c", "5" => "c", "6" => "c", "12" => "c", "7" => "c");
     $arraycabecera = array("10" => " ", "0" => "Nro Orden", "1" => "Fecha", "2" => "Filiación", "11" => " ", "3" => "concepto", "13" => "Nro Comp.", "4" => "Precio", "5" => "Cant.", "6" => "Total", "12" => "....", "7" => "es");
     $arrayColorEstado = array("1" => "1", "2" => "2", "3" => "3", "4" => "4", "5" => "5", "6" => "6", "7" => "7", "8" => "8", "9" => "9");
     $o_Html = new Tabla1($arraycabecera, 15, $arrayFilas, 'tablaOrden', 'filax', 'filay', 'filaSeleccionada', 'onClick', '', 5, $arrayTipo, 7, $arrayColorEstado);
     require_once "../../cvista/tesoreria/detalleOrden.php";
 }
コード例 #5
0
ファイル: payments_model.php プロジェクト: FaithMaina/Rentit
 public function check_due_date($date)
 {
     echo $date;
     $query = $this->db->query('SELECT * FROM rent_details')->result_array();
     //exit();
     foreach ($query as $key) {
         $due_date = $key['rent_due_date'];
         $rent = $key['rent'];
         $id = $key['id'];
         $rent_balance = $key['rent_balance'];
         $new_rent_balance = $rent_balance + $rent;
         $new_date = date_create($due_date);
         date_add($new_date, date_interval_create_from_date_string("30 days"));
         $new_rent_due_date = date_format($new_date, "Y-m-d");
         echo $new_rent_due_date;
         $date1 = date_create($date);
         $date2 = date_create($due_date);
         $diff = date_diff($date1, $date2);
         $dif = $diff->format("%a");
         if ($dif == 0) {
             if ($new_rent_balance <= 0) {
                 $this->db->query("UPDATE rent_details SET rent_due = '0' WHERE id ='" . $id . "'");
                 # code...
             } else {
                 $this->db->query("UPDATE rent_details SET rent_due = '" . $new_rent_balance . "' WHERE id ='" . $id . "'");
             }
             $this->db->query("UPDATE rent_details SET rent_balance = '" . $new_rent_balance . "' WHERE id ='" . $id . "'");
             $this->db->query("UPDATE rent_details SET rent_due_date = '" . $new_rent_due_date . "' WHERE id ='" . $id . "'");
         } else {
             //$this->db->query('UPDATE rent_details SET rent_due = '0'');
         }
     }
 }
コード例 #6
0
 public function createItemsHtml($program = '', $loja = '', $name = '', $endDate = '', $description = '', $title = '', $trackingLink = '', $firstCupomLoja)
 {
     $htmlItem = '';
     $nameString = $this->revealName($program);
     //string usada nas imagens
     $nameCode = str_replace(" ", "-", $nameString);
     if ($firstCupomLoja) {
         $htmlItem .= '<h2 class="h-cupom" id="h-cupom-' . $nameString . '">Cupons ' . $program . '</h2>';
     }
     $htmlItem .= '<div class="campo-cupom">';
     $htmlItem .= '<span class="logo-cupom"><img src="/wp-content/themes/THEME/images/logo-cupom/cupom-de-desconto-logo-' . strtolower($nameCode) . '.jpg"></span>';
     $htmlItem .= '<h3 class="titulo-cupom">' . $name . '</h3>';
     $htmlItem .= '<a class="botao-cupom" data-title="' . title . '" data-heading="Aqui está seu cupom da ' . $nameString . '" data-subheading="' . $program . '" data-description="' . $description . '" href="' . $trackingLink . '" target="_blank"><img src="/wp-content/uploads/2015/12/botao-ver-cupom.jpg"></a>';
     if (!empty($endDate)) {
         $endDate = explode('T', $endDate)[0];
         $date = date_create($endDate);
         $endDate = date_format($date, "d/m/Y");
         $htmlItem .= '<p class="prazo-cupom">Válido até ' . $endDate . '</p>';
     }
     if (!empty($description)) {
         $htmlItem .= '<p class="info-cupom">Mais informações</p>';
         $htmlItem .= '<div class="more-information more-information-hide"><span>Mais informações</span><br/>' . $description . '</div>';
     }
     $htmlItem .= '</div>';
     $html .= $htmlItem;
     return $html;
 }
コード例 #7
0
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     $dados = $request->all();
     $date = date_create($dados["data"]);
     $dados["data"] = date_format($date, "Y-m-d H:i");
     return \DB::connection('mysql')->table('feira')->where('id', $id)->update(['tipo' => $dados['tipo'], 'tema' => $dados['tema'], 'local' => $dados['local'], 'data' => $dados['data'], 'status' => $dados['status'], 'observacao' => $dados['observacao']]);
 }
コード例 #8
0
 /**
  * Formatar data e hora
  *
  * @param string $data_hora string contendo uma representação de data ou hora
  * @param string $formato   string contendo o formtado da data e/ou hora desejado. O farmato deve ser aceito pela
  *                          função date();
  *
  * @return bool|mixed|string
  */
 public static function formatarDataHora($data_hora, $formato)
 {
     # Se $formato estiver em branco retornar a data sem nenhum alteração
     if (empty($formato)) {
         return $data_hora;
     }
     // Fim if
     /*
      * Essas strings não serão aceitas, por se tratarem de datas e / ou horas inválidas
      */
     $nao_aceito = ['0000-00-00', '0000-00-00 00:00:00'];
     if (!empty($data_hora) && !in_array($data_hora, $nao_aceito)) {
         # Se a string de data não foi válida para a conversão retorná-la com uma mensagem de erro
         if (!strtotime($data_hora)) {
             return "{$data_hora} - Data informada inválida";
         }
         // Fim if
         /*
          * A função strtotime() não aceita a string da data no formato brasileiro com a '/' barra separando dia, mês e ano.
          * Portanto, caso a data seja informada dessa forma substituir a '/' barra pelo '-' hifém
          */
         if (strpos($data_hora, '/') > -1) {
             $data_hora = str_replace('/', '-', $data_hora);
         }
         // Fim if
         return date_format(date_create($data_hora), $formato);
     }
     // Fim if
 }
コード例 #9
0
 public function editAction()
 {
     $request = $this->getRequest();
     $id = $request->getParam('id');
     if ($id !== NULL) {
         $form = new Application_Form_Goal();
         $goalMapper = new Application_Model_GoalMapper();
         $auth = Zend_Auth::getInstance();
         $identity = $auth->getIdentity();
         $goal = new Application_Model_Goal();
         $goalMapper->find($id, $goal);
         $data = array('goal' => $goal->getGoal(), 'notes' => $goal->getNotes(), 'goal_date' => date_format(new DateTime($goal->getGoalDate()), 'Y-m-d'), 'done' => $goal->getDone());
         $form->populate($data);
         if ($request->isPost()) {
             if ($form->isValid($request->getPost())) {
                 $goalMapper = new Application_Model_GoalMapper();
                 $goal = new Application_Model_Goal($form->getValues());
                 $auth = Zend_Auth::getInstance();
                 $identity = $auth->getIdentity();
                 $goal->setId($id);
                 $goal->setUserId($identity->id);
                 $goalMapper->save($goal);
                 $goalNamespace = new Zend_Session_Namespace('goal');
                 $data = array('id' => $goal->getId(), 'goal' => $goal->getGoal(), 'notes' => $goal->getNotes(), 'goal_date' => $goal->getGoalDate(), 'done' => $goal->getDone(), 'user_id' => $goal->getUserId());
                 $goalNamespace->data = $data;
                 $this->_redirect('/goal/view/');
             }
         }
         $this->view->form = $form;
     } else {
         $this->_redirect('/dashboard');
     }
 }
 public static function init_import($args = false)
 {
     $options = get_option('fpi_option');
     $fb = self::init();
     try {
         // Returns a `Facebook\FacebookResponse` object
         $response = $fb->get('/' . $options['fpi_page_id'] . '/feed?fields=link,full_picture,story,message,created_time,actions', $options['fpi_access_token']);
         // {"fields":"link,full_picture,story,message,created_time,actions"},
     } catch (Facebook\Exceptions\FacebookResponseException $e) {
         echo 'Graph returned an error: ' . $e->getMessage();
         exit;
     } catch (Facebook\Exceptions\FacebookSDKException $e) {
         echo 'Facebook SDK returned an error: ' . $e->getMessage();
         exit;
     }
     $graphEdge = $response->getGraphEdge();
     $list = array();
     foreach ($graphEdge as $graphNode) {
         $item = $graphNode->asArray();
         $elem = array('id' => $item['id'], 'story' => isset($item['story']) ? $item['story'] : false, 'message' => $item['message'], 'created_time' => $item['created_time'], 'created_time' => date_format($item['created_time'], 'd/m/Y'), 'permalink' => $item['actions'][0]['link'], 'full_picture' => isset($item['full_picture']) ? $item['full_picture'] : false, 'direct_url' => $item['actions'][0]['link'], 'post_date' => date_format($item['created_time'], 'Y-m-d H:i:s'));
         array_push($list, $elem);
     }
     $new_import = new FPI_Import($list);
     if ($new_import->get_status() == 200 && (isset($args['display_notices']) && $args['display_notices'] == 1)) {
         echo '<div class="notice notice-success is-dismissible"><p>Success! <a href="' . admin_url('edit.php?post_type=facebookposts') . '">See your Facebook posts here</a></p></div>';
     }
 }
コード例 #11
0
ファイル: Date.php プロジェクト: svenhartmann/cicbase
 /**
  * @param integer $monthInteger
  * @param string $format
  * @return bool|string
  */
 public static function monthIntegerToString($monthInteger, $format = 'F')
 {
     if (is_string($monthInteger) && in_array(strtolower($monthInteger), self::$months)) {
         return $monthInteger;
     }
     return date_format(date_create("1/{$monthInteger}/2000"), $format);
 }
コード例 #12
0
ファイル: LogController.php プロジェクト: spiasecki/ubirimi
 public function indexAction(Request $request, SessionInterface $session)
 {
     Util::checkUserIsLoggedInAndRedirect();
     $loggedInUserId = $session->get('user/id');
     $issueId = $request->request->get('id');
     $timeSpentPost = trim(str_replace(" ", '', $request->request->get('time_spent')));
     $dateStartedString = $request->request->get('date_started');
     $remainingTime = $request->request->get('remaining');
     $comment = $request->request->get('comment');
     $dateStarted = \DateTime::createFromFormat('d-m-Y H:i', $dateStartedString);
     $dateStartedString = date_format($dateStarted, 'Y-m-d H:i');
     if (is_numeric($timeSpentPost)) {
         $timeSpentPost = $timeSpentPost . $session->get('yongo/settings/time_tracking_default_unit');
     }
     if ($timeSpentPost) {
         $currentDate = Util::getServerCurrentDateTime();
         $issueQueryParameters = array('issue_id' => $issueId);
         $issue = $this->getRepository(Issue::class)->getByParameters($issueQueryParameters, $loggedInUserId);
         $this->getRepository(WorkLog::class)->addLog($issueId, $loggedInUserId, $timeSpentPost, $dateStartedString, $comment, $currentDate);
         $remainingTime = $this->getRepository(WorkLog::class)->adjustRemainingEstimate($issue, $timeSpentPost, $remainingTime, $session->get('yongo/settings/time_tracking_hours_per_day'), $session->get('yongo/settings/time_tracking_days_per_week'), $loggedInUserId);
         $fieldChanges = array(array('time_spent', null, $timeSpentPost), array('remaining_estimate', $issue['remaining_estimate'], $remainingTime));
         $this->getRepository(Issue::class)->updateHistory($issue['id'], $loggedInUserId, $fieldChanges, $currentDate);
         // update the date_updated field
         $this->getRepository(Issue::class)->updateById($issueId, array('date_updated' => $currentDate), $currentDate);
         $project = $this->getRepository(YongoProject::class)->getById($issue['issue_project_id']);
         $issueEventData = array('user_id' => $loggedInUserId, 'comment' => $comment, 'date_started' => $dateStartedString, 'time_spent' => $timeSpentPost);
         $issueEvent = new IssueEvent($issue, $project, IssueEvent::STATUS_UPDATE, $issueEventData);
         UbirimiContainer::get()['dispatcher']->dispatch(YongoEvents::YONGO_ISSUE_WORK_LOGGED, $issueEvent);
     }
     if (null == $remainingTime || '' == $remainingTime) {
         $remainingTime = -1;
     }
     return new Response($remainingTime);
 }
コード例 #13
0
ファイル: indo_helper.php プロジェクト: ibnoe/rsudapp
function umur($tgl_lahir)
{
    $thn_lahir = date_format(date_create($tgl_lahir), 'Y');
    $thn_skrg = date('Y');
    $umur = $thn_skrg - $thn_lahir;
    return $umur;
}
コード例 #14
0
 public function adata_edit($id)
 {
     $data = $this->request->data;
     $date = date_create_from_format("m\\/d\\/Y", $this->data['start_date']);
     $data['start_date'] = date_format($date, 'Y-m-d H:i:s');
     $date = date_create_from_format("m\\/d\\/Y", $this->data['end_date']);
     $data['end_date'] = date_format($date, 'Y-m-d H:i:s');
     $coursemodulemap = $this->CourseLessonMap->find("first", array('conditions' => array('CourseLessonMap.lesson_id =' => $id, 'CourseLessonMap.course_id =' => $data['courseid'])));
     $old_data = $this->Lesson->findById($id);
     if ($old_data['Lesson']['published'] == 0 && $data['published'] == 1) {
         $data['published_date'] = date('Y-m-d H:i:s');
         $coursemodulemap['CourseLessonMap']['published_date'] = $data['published_date'];
     } else {
         if ($old_data['Lesson']['published'] == 1 && $data['published'] == 0) {
             $data['published_date'] = "0000-00-00 00:00:00";
             $coursemodulemap['CourseLessonMap']['published_date'] = $data['published_date'];
         }
     }
     $coursemodulemap['CourseLessonMap']['published'] = $data['published'];
     $coursemodulemap['CourseLessonMap']['lesson_type'] = $old_data['Lesson']['type'];
     $this->CourseLessonMap->save($coursemodulemap);
     $this->Lesson->id = $id;
     $courseid = $this->Lesson->save($data);
     $this->redirect("/admin/lesson/" . $data['courseid']);
 }
コード例 #15
0
 /**
  * Update the date of the date column. The specific time of the DateTime object will be ignored.
  *
  * @api
  *
  * @param \DateTime $dateTime The new date
  *
  * @since 0.1.0
  */
 public function updateValue($dateTime)
 {
     $url = sprintf("%s/%d/columns/%s/date.json", self::apiEndpoint(), $this->board_id, $this->column_id);
     $postParams = array("pulse_id" => $this->pulse_id, "date_str" => date_format($dateTime, "Y-m-d"));
     self::sendPut($url, $postParams);
     $this->column_value = $dateTime;
 }
コード例 #16
0
ファイル: import.php プロジェクト: TaylorMonacelli/phplib
function date_time_format($str)
{
    global $k;
    list($datepart, $timepart) = explode(" ", $str);
    if ($datepart . " " . $timepart == $str) {
        $df = date_format($datepart);
        $tf = time_format($timepart);
        if ($GLOBALS["debug"]) {
            echo " _{$k}_ {$df} {$tf} _ ";
        }
        if ($df and $tf) {
            return "{$df} {$tf}";
        }
    } else {
        if (preg_match('/^[0-9]+$/', $str)) {
            switch (strlen($str)) {
                case 14:
                    return "YmdHis";
                case 12:
                    return "ymdHis";
            }
        }
    }
    return false;
}
コード例 #17
0
 public function getIndex(Request $r)
 {
     if (!isset($r->offset) || !isset($r->limit)) {
         $sql = RumputLaut::orderBy('id', 'desc')->first();
         if ($sql) {
             // Jika sudah ada data
             // limit = Tanggal terbaru
             // offset = Limit - 3 bulan
             $limit1 = date_format(date_create($sql->created_at), "Y-m-d");
             $limit = strtotime("{$limit1} +1 day");
             $limit = date("Y-m-d", $limit);
             $offset = strtotime("{$limit1} -3 months");
             $offset = date("Y-m-d", $offset);
         } else {
             // Jika belum ada data offset = tgl skrang, limit = offset + 3 bulan
             $offset = date('Y-m-d');
             $limit = strtotime("{$offset} +3 months");
             $limit = date("Y-m-d", $limit);
         }
         return redirect('/app/rumputlaut?offset=' . $offset . '&limit=' . $limit);
     }
     $limit = 10;
     $data['rumputlaut'] = RumputLaut::whereBetween('created_at', [$r->offset, $r->limit])->paginate($limit);
     return view('app.laporan-produksi.rumputlaut.index', $data)->with('limit', $limit);
 }
コード例 #18
0
ファイル: SitemapCronController.php プロジェクト: Ajuz/hinter
 /**
  * @param string $url
  * @param int $lastmod Timestamp
  * @param string $changefreq
  * @param real $priority
  */
 private function addUrlToSitemap($url, $lastmod = 0, $changefreq = self::NODE_CHANGEFREQ_MONTHLY, $priority = 0.5)
 {
     if (empty($url)) {
         throw new \InvalidArgumentException('Параметр $url не может быть пустым!');
     }
     if (substr($url, 0, 1) == '/') {
         $url = $this->getProtocol() . '://' . $_SERVER['HTTP_HOST'] . $url;
     }
     $ue = $this->sxe->addChild('url');
     $ue->addChild('loc', htmlspecialchars($url));
     if (!empty($lastmod)) {
         $ue->addChild('lastmod', date_format(new \DateTime("@" . (int) $lastmod), 'Y-m-d'));
     }
     if (!empty($changefreq)) {
         $ue->addChild('changefreq', (string) $changefreq);
     }
     if (!empty($priority)) {
         $ue->addChild('priority', (double) $priority);
     }
     /*
      *  <url>
      *      <loc>http://www.example.com/</loc>
      *      <lastmod>2005-01-01</lastmod>
      *      <changefreq>monthly</changefreq>
      *      <priority>0.8</priority>
      *  </url>   
      */
 }
コード例 #19
0
ファイル: BTVClub.php プロジェクト: volker2014/btv_medenlist
 private function setTimeFrame()
 {
     if ($this->Input->post('all')) {
         $this->Template->fromDate = date("d.m.Y", mktime(0, 0, 0, 5, 1, 2014));
         $this->Template->toDate = date("d.m.Y", mktime(0, 0, 0, 7, 31, 2014));
     } else {
         if ($this->Input->post('past')) {
             $this->Template->fromDate = date("d.m.Y", strtotime($this->Template->fromDate) - $this->past_days);
             $this->Template->toDate = date("d.m.Y", strtotime($this->Template->toDate) - $this->future_days);
         } else {
             if ($this->Input->post('future')) {
                 $this->Template->fromDate = date("d.m.Y", strtotime($this->Template->fromDate) + $this->past_days);
                 $this->Template->toDate = date("d.m.Y", strtotime($this->Template->toDate) + $this->future_days);
             } else {
                 $this->Template->fromDate = date("d.m.Y", mktime(0, 0, 0, date("m"), date("d") - $this->past_days, date("Y")));
                 $this->Template->toDate = date("d.m.Y", mktime(0, 0, 0, date("m"), date("d") + $this->future_days, date("Y")));
             }
         }
     }
     if ($this->Input->post('fromDate')) {
         $this->Template->fromDate = date_format(date_create($this->Input->post('fromDate')), 'd.m.Y');
     }
     if ($this->Input->post('toDate')) {
         $this->Template->toDate = date_format(date_create($this->Input->post('toDate')), 'd.m.Y');
     }
 }
コード例 #20
0
 private function currentDateTime()
 {
     date_default_timezone_set("Asia/Colombo");
     $date = date_create();
     $current_time = date_format($date, 'Y-m-d H:i:s');
     return $current_time;
 }
コード例 #21
0
ファイル: modelo.php プロジェクト: estrategasdigitales/kanet
 public function historico_acceso($data, $limit = -1, $offset = -1)
 {
     $fecha = date_create(date('Y-m-j'));
     date_add($fecha, date_interval_create_from_date_string('-1 month'));
     $data['fecha_inicial'] = date_format($fecha, 'm');
     $data['fecha_final'] = $data['fecha_final'] = date('m');
     $this->db->select("AES_DECRYPT(h.email,'{$this->key_hash}') AS email", FALSE);
     $this->db->select('p.id_perfil, p.perfil, p.operacion');
     $this->db->select('u.nombre,u.apellidos');
     $this->db->select('h.ip_address, h.user_agent, h.id_usuario');
     $this->db->select("( CASE WHEN h.fecha = 0 THEN '' ELSE DATE_FORMAT(FROM_UNIXTIME(h.fecha),'%d-%m-%Y %H:%i:%s') END ) AS fecha", FALSE);
     $this->db->from($this->historico_acceso . ' As h');
     $this->db->join($this->usuarios . ' As u', 'u.id = h.id_usuario', 'LEFT');
     $this->db->join($this->perfiles . ' As p', 'u.id_perfil = p.id_perfil', 'LEFT');
     //gmt_to_local( $timestamp, 'UM1', TRUE) )
     if ($data['fecha_inicial'] and $data['fecha_final']) {
         $this->db->where("( CASE WHEN h.fecha = 0 THEN '' ELSE DATE_FORMAT(FROM_UNIXTIME(h.fecha),'%m') END ) = ", $data['fecha_inicial']);
         $this->db->or_where("( CASE WHEN h.fecha = 0 THEN '' ELSE DATE_FORMAT(FROM_UNIXTIME(h.fecha),'%m') END ) = ", $data['fecha_final']);
     }
     if ($limit != -1) {
         $this->db->limit($limit, $offset);
     }
     $this->db->order_by('h.fecha', 'desc');
     $login = $this->db->get();
     if ($login->num_rows() > 0) {
         return $login->result();
     } else {
         return FALSE;
     }
     $login->free_result();
 }
コード例 #22
0
ファイル: billing.php プロジェクト: Tatermen/librenms
function getDates($dayofmonth, $months = 0)
{
    $dayofmonth = zeropad($dayofmonth);
    $year = date('Y');
    $month = date('m');
    if (date('d') > $dayofmonth) {
        // Billing day is past, so it is next month
        $date_end = date_create($year . '-' . $month . '-' . $dayofmonth);
        $date_start = date_create($year . '-' . $month . '-' . $dayofmonth);
        date_add($date_end, date_interval_create_from_date_string('1 month'));
    } else {
        // Billing day will happen this month, therefore started last month
        $date_end = date_create($year . '-' . $month . '-' . $dayofmonth);
        $date_start = date_create($year . '-' . $month . '-' . $dayofmonth);
        date_sub($date_start, date_interval_create_from_date_string('1 month'));
    }
    if ($months > 0) {
        date_sub($date_start, date_interval_create_from_date_string($months . ' month'));
        date_sub($date_end, date_interval_create_from_date_string($months . ' month'));
    }
    // date_sub($date_start, date_interval_create_from_date_string('1 month'));
    date_sub($date_end, date_interval_create_from_date_string('1 day'));
    $date_from = date_format($date_start, 'Ymd') . '000000';
    $date_to = date_format($date_end, 'Ymd') . '235959';
    date_sub($date_start, date_interval_create_from_date_string('1 month'));
    date_sub($date_end, date_interval_create_from_date_string('1 month'));
    $last_from = date_format($date_start, 'Ymd') . '000000';
    $last_to = date_format($date_end, 'Ymd') . '235959';
    $return = array();
    $return['0'] = $date_from;
    $return['1'] = $date_to;
    $return['2'] = $last_from;
    $return['3'] = $last_to;
    return $return;
}
コード例 #23
0
 public function postAppointmentsAction(Request $req)
 {
     $id = $this->doctorLogin($username, $password);
     if (is_null($username) || $username == "" || is_null($password) || $password == "") {
         $apps = array('ERROR');
     } else {
         if ($id == -1) {
             $apps = array('NOK');
         } else {
             $apps = array();
             $appointments = $this->getAppointments($id);
             foreach ($appointments as $key => $value) {
                 $toAdd = array();
                 $toAdd['id'] = $value->getId();
                 $toAdd['start'] = date_format($value->getAppointmentStart(), "D, d/m H:i");
                 $toAdd['end'] = date_format($value->getAppointmentEnd(), "D, d/m H:i");
                 $toAdd['doctor'] = $value->getDoctor()->getName();
                 if (is_null($value->getPatient())) {
                     $toAdd['patient'] = 'No patient';
                 } else {
                     $toAdd['patient'] = $value->getPatient()->getName();
                 }
                 $apps[$key] = $toAdd;
             }
         }
     }
     $data = new AppointmentResponse($apps);
     $view = new View($data);
     $response = $this->get('fos_rest.view_handler')->handle($view);
     $response->headers->set('Access-Control-Allow-Origin', '*');
     return $response;
 }
コード例 #24
0
 public function createStatement($subjectOfChange, $createdDate, $creatorName, $changeReason, $removals, $additions, $precedingChangeSet, $namespace = NULL)
 {
     if (NULL === $namespace) {
         $namespace = $this->queryService->defaultGraphURI;
     }
     $subjectOfChange = $this->queryService->escapeValue($subjectOfChange);
     $creatorName = $this->queryService->escapeValue($creatorName);
     $changeReason = $this->queryService->escapeValue($changeReason);
     $createdDate = date_format($createdDate, "Y-m-d\\TH:i:s\\Z");
     $subject = self::BNODE_PREFIX . uniqid("changeset-");
     $statement = "INSERT INTO <{$namespace}> {\n";
     $statement .= "<{$subject}> a <" . self::CHANGESET_TYPE_URI . "> ; \n";
     $statement .= "           <" . self::CHANGESET_SUBJECT_OF_CHANGE_URI . "> <{$subjectOfChange}> ; \n";
     if (NULL !== $precedingChangeSet) {
         $statement .= "           <" . self::CHANGESET_PRECEDING_CHANGE_SET_URI . "> <{$precedingChangeSet}> ; \n";
     }
     $statement .= "           <" . self::CHANGESET_CREATED_DATE_URI . "> \"{$createdDate}\"^^<" . self::RDFS_DATE_TIME_DATATYPE_URI . "> ; \n";
     $statement .= "           <" . self::CHANGESET_CREATOR_NAME_URI . "> \"{$creatorName}\" ; \n";
     $statement .= "           <" . self::CHANGESET_CHANGE_REASON_URI . "> \"{$changeReason}\" . \n";
     if (0 < count($additions)) {
         $statement .= $this->getChanges($subject, $subjectOfChange, $additions, self::CHANGE_ADDITION_NAME);
     }
     if (0 < count($removals)) {
         $statement .= $this->getChanges($subject, $subjectOfChange, $removals, self::CHANGE_REMOVAL_NAME);
     }
     $statement .= "}";
     return $statement;
 }
コード例 #25
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $a = new \App\Popups();
     $a->judul = Input::get('judul');
     $a->slug = str_slug(Input::get('judul'));
     $a->deskripsi = Input::get('keterangan');
     $a->tipe_valid = Input::get('type_valid');
     if ($a->tipe_valid == "by_datetime" or $a->tipe_valid == "by_date") {
         $a->date_valid_start = date_format(date_create(Input::get('date_valid_start')), "Y-m-d");
         $a->date_valid_end = date_format(date_create(Input::get('date_valid_end')), "Y-m-d");
     }
     if ($a->tipe_valid == "by_datetime" or $a->tipe_valid == "by_time") {
         $a->time_valid_start = date_format(date_create(Input::get('time_valid_start')), "H:i:s");
         $a->time_valid_end = date_format(date_create(Input::get('time_valid_end')), "H:i:s");
     }
     if (Input::hasFile('image') and Input::file('image')->isValid()) {
         $image = date("YmdHis") . uniqid() . "." . Input::file('image')->getClientOriginalExtension();
         Input::file('image')->move(storage_path() . '/popup_image', $image);
         $a->image = $image;
     }
     $a->keep_open = Input::get('keep_open');
     $a->hotlink = Input::get('hotlink');
     $a->idpengguna = Auth::user()->id;
     $a->save();
     return redirect(url('admin/popups'));
 }
コード例 #26
0
ファイル: functions.php プロジェクト: Wassawah/Finance-v0
 public static function checkDate($date, $class)
 {
     //check if set and date null
     //return error
     if (!isset($class->date) && $date == null) {
         //return error code and msg if there is no date set;
         $error = Functions::error(100, "Date is not set");
     } else {
         if ($date == null) {
             //set date from class
             $date = $class->date;
         }
     }
     //check if format is right
     $date = date_create_from_format('d.m.Y', $date);
     //if format is not correct
     if ($date == false) {
         $error = Functions::error(100, "Date is not in right format  (d.m.Y)");
     }
     //get format back, no clock needed
     $date = date_format($date, 'd.m.Y');
     //return right date
     //date in function getData('date') is more imporatant than set date in class
     return $date;
 }
コード例 #27
0
ファイル: convert.php プロジェクト: red-sight/promobot
 public function weekday($date)
 {
     $CI =& get_instance();
     $time = date_create($date);
     $weekday_num = date_format($time, 'N');
     switch ($weekday_num) {
         case '1':
             $weekday = 'пн';
             break 1;
         case '2':
             $weekday = 'вт';
             break 1;
         case '3':
             $weekday = 'ср';
             break 1;
         case '4':
             $weekday = 'чт';
             break 1;
         case '5':
             $weekday = 'пт';
             break 1;
         case '6':
             $weekday = 'сб';
             break 1;
         case '7':
             $weekday = 'вс';
             break 1;
     }
     return $weekday;
 }
コード例 #28
0
 public function getEventList()
 {
     error_log("getEventList called.");
     $eventList = array();
     // Start with today's date
     $currentTime = new DateTimeImmutable("now");
     error_log("Current time: " . date_format($currentTime, "m/d/Y H:i"));
     // For simplicity, all plays start at 7:00 PM
     $currentTime = $currentTime->setTime(19, 0, 0);
     error_log("Current time adjusted: " . date_format($currentTime, "m/d/Y H:i"));
     // Intervals for date manipulation
     $oneDay = new DateInterval("P1D");
     $playDuration = new DateInterval("PT3H");
     foreach ($this->_eventTitles as $title) {
         $event = new Event();
         $event->title = $title;
         $event->location = $this->_eventLocations[mt_rand(0, sizeof($this->_eventLocations) - 1)];
         $event->voucherRequired = mt_rand(0, 1) == 1;
         $event->startTime = $currentTime->add($oneDay);
         error_log("Start time: " . date_format($event->startTime, "m/d/Y H:i"));
         $event->endTime = $event->startTime->add($playDuration);
         error_log("End time: " . date_format($event->endTime, "m/d/Y H:i"));
         $eventList[] = $event;
         $currentTime = $currentTime->add($oneDay);
     }
     return $eventList;
 }
コード例 #29
0
 public function indexAction()
 {
     // display the profile form and populate if profile exists
     $request = $this->getRequest();
     $form = new Application_Form_Profile();
     $auth = Zend_Auth::getInstance();
     $identity = $auth->getIdentity();
     $profileMapper = new Application_Model_ProfileMapper();
     $profile = new Application_Model_Profile();
     $exists = $profileMapper->exists($identity->id);
     if ($request->isPost()) {
         if ($form->isValid($request->getPost())) {
             $profile->setOptions($form->getValues());
             $profile->setUserId($identity->id);
             $profileMapper->save($profile, $exists);
             // display success message
             $this->view->msg = "<p class='msg'>Profile saved</p>";
         }
     } else {
         $profileMapper->find($identity->id, $profile);
         $data = array('first_name' => $profile->getFirstName(), 'last_name' => $profile->getLastName(), 'birthdate' => date_format(new DateTime($profile->getBirthdate()), 'Y-m-d'), 'gender' => $profile->getGender());
         $form->populate($data);
     }
     $this->view->form = $form;
 }
コード例 #30
0
 function index()
 {
     //** set date
     $today = date("Y-m-d");
     $year = date('Y');
     $month = date('m');
     $date_ym = DateTime::createFromFormat('Y-m-d', $year . '-' . $month . '-01');
     $this_month = date_format($date_ym, 'Y-m');
     //$date_lastmonth = $date_ym->modify('-1 month');
     //$last_month = date_format($date_lastmonth, 'Y-m');
     //**
     // get sale amount
     $total = $this->Order->get_sale_amount();
     $total_year = $this->Order->get_sale_amount(array('DATE_FORMAT(order_datetime, "%Y") =' => $year));
     $total_month = $this->Order->get_sale_amount(array('DATE_FORMAT(order_datetime, "%Y-%m") =' => $this_month));
     $total_day = $this->Order->get_sale_amount(array('DATE(order_datetime)' => $today));
     $order_filt['order_order_status_id = 1 OR order_order_status_id = 2'] = NULL;
     $lim = 15;
     $off = 0;
     $last_orders = $orders = $this->Order->list_orders_with_dealer($order_filt, $lim, $off, 'obj', 'order_datetime DESC');
     $data['sale_total'] = $total['amount'];
     $data['sale_this_year'] = $total_year['amount'];
     $data['sale_this_month'] = $total_month['amount'];
     $data['sale_this_day'] = $total_day['amount'];
     $data['orders'] = $last_orders;
     $data['off'] = $off;
     $this->load->view('admin_v/index', $data);
 }