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


PHP helper::date2timestamp方法代码示例

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


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

示例1: run

 /**
  * run - display template and edit data
  *
  * @access public
  */
 public function run()
 {
     $tpl = new template();
     $helper = new helper();
     $values = array('description' => '', 'dateFrom' => '', 'dateTo' => '', 'allDay' => '');
     if (isset($_POST['save']) === true) {
         if (isset($_POST['allDay']) === true) {
             $allDay = 'true';
         } else {
             $allDay = 'false';
         }
         if (isset($_POST['dateFrom']) === true && isset($_POST['timeFrom']) === true) {
             $dateFrom = $helper->date2timestamp($_POST['dateFrom'], $_POST['timeFrom']);
         }
         if (isset($_POST['dateTo']) === true && isset($_POST['timeTo']) === true) {
             $dateTo = $helper->date2timestamp($_POST['dateTo'], $_POST['timeTo']);
         }
         $values = array('description' => $_POST['description'], 'dateFrom' => $dateFrom, 'dateTo' => $dateTo, 'allDay' => $allDay);
         if ($values['description'] !== '') {
             if ($helper->validateTime($_POST['timeFrom']) === true) {
                 $this->addEvent($values);
                 $msgKey = $tpl->setNotification('SAVE_SUCCESS', 'success');
             } else {
                 $tpl->setNotification('WRONG_TIME_FORMAT', 'error');
             }
         } else {
             $tpl->setNotification('NO_DESCRIPTION', 'error');
         }
         $tpl->assign('values', $values);
     }
     $tpl->assign('helper', $helper);
     $tpl->display('calendar.addEvent');
 }
开发者ID:DevelopIdeas,项目名称:leantime,代码行数:38,代码来源:class.addEvent.php

示例2: run

 /**
  * run - display template and edit data
  *
  * @access public
  */
 public function run()
 {
     $tpl = new template();
     $msgKey = '';
     $helper = new helper();
     if (isset($_GET['id']) === true) {
         $id = $_GET['id'];
         $row = $this->getEvent($id);
         $values = array('description' => $row['description'], 'dateFrom' => $row['dateFrom'], 'dateTo' => $row['dateTo'], 'allDay' => $row['allDay']);
         if (isset($_POST['save']) === true) {
             if (isset($_POST['allDay']) === true) {
                 $allDay = 'true';
             } else {
                 $allDay = 'false';
             }
             if (isset($_POST['dateFrom']) === true && isset($_POST['timeFrom']) === true) {
                 $dateFrom = $helper->date2timestamp($_POST['dateFrom'], $_POST['timeFrom']);
                 //						$dateFrom = ''.($helper->timestamp2date($_POST['dateFrom'],6)).' '.($_POST['timeFrom']).'';
             }
             if (isset($_POST['dateTo']) === true && isset($_POST['timeTo']) === true) {
                 $dateTo = $helper->date2timestamp($_POST['dateTo'], $_POST['timeTo']);
                 //						$dateTo = ''.($helper->timestamp2date($_POST['dateTo'],6)).' '.($_POST['timeTo']).'';
             }
             $values = array('description' => $_POST['description'], 'dateFrom' => $dateFrom, 'dateTo' => $dateTo, 'allDay' => $allDay);
             if ($values['description'] !== '') {
                 if ($helper->validateTime($_POST['timeFrom']) === true) {
                     $this->editEvent($values, $id);
                     $msgKey = 'Termin bearbeitet';
                 } else {
                     $msgKey = 'Zeit hat falsches Format hh:mm';
                 }
             } else {
                 $msgKey = 'Keine Beschreibung angegeben';
             }
         }
         $tpl->assign('values', $values);
         $tpl->assign('helper', $helper);
         $tpl->assign('info', $msgKey);
         $tpl->display('calendar.editEvent');
     } else {
         $tpl->display('general.error');
     }
 }
开发者ID:DevelopIdeas,项目名称:leantime,代码行数:48,代码来源:class.editEvent.php

示例3: run

 /**
  * run - display template and edit data
  *
  * @access public
  */
 public function run()
 {
     $tpl = new template();
     $info = '';
     //Only admins and employees
     if ($_SESSION['userdata']['role'] == 'admin' || $_SESSION['userdata']['role'] == 'employee') {
         if (isset($_GET['id']) === true) {
             $projects = new projects();
             $helper = new helper();
             $tickets = new tickets();
             $id = $_GET['id'];
             $timesheet = $this->getTimesheet($id);
             $values = array('id' => $id, 'userId' => $timesheet['userId'], 'ticket' => $timesheet['ticketId'], 'project' => $timesheet['projectId'], 'date' => $timesheet['workDate'], 'kind' => $timesheet['kind'], 'hours' => $timesheet['hours'], 'description' => $timesheet['description'], 'invoicedEmpl' => $timesheet['invoicedEmpl'], 'invoicedComp' => $timesheet['invoicedComp'], 'invoicedEmplDate' => $timesheet['invoicedEmplDate'], 'invoicedCompDate' => $timesheet['invoicedCompDate']);
             if ($_SESSION['userdata']['role'] == 'admin' || $_SESSION['userdata']['id'] == $values['userId']) {
                 if (isset($_POST['save']) === true) {
                     if (isset($_POST['tickets']) && $_POST['tickets'] != '') {
                         $temp = $_POST['tickets'];
                         $tempArr = explode('|', $temp);
                         $values['project'] = $tempArr[0];
                         $values['ticket'] = $tempArr[1];
                     }
                     if (isset($_POST['kind']) && $_POST['kind'] != '') {
                         $values['kind'] = $_POST['kind'];
                     }
                     if (isset($_POST['date']) && $_POST['date'] != '') {
                         $dateFormat = $values['date'];
                         $values['date'] = $helper->date2timestamp($_POST['date']);
                         //($helper->timestamp2date($_POST['date'], 4));
                     }
                     if (isset($_POST['hours']) && $_POST['hours'] != '') {
                         $values['hours'] = $_POST['hours'];
                     }
                     if (isset($_POST['description']) && $_POST['description'] != '') {
                         $values['description'] = $_POST['description'];
                     }
                     if (isset($_POST['invoicedEmpl']) && $_POST['invoicedEmpl'] != '') {
                         if ($_POST['invoicedEmpl'] == 'on') {
                             $values['invoicedEmpl'] = 1;
                         }
                         if (isset($_POST['invoicedEmplDate']) && $_POST['invoicedEmplDate'] != '') {
                             $values['invoicedEmplDate'] = $helper->timestamp2date($_POST['invoicedEmplDate'], 4);
                         } else {
                             $values['invoicedEmplDate'] = date("Y-m-d");
                         }
                     } else {
                         $values['invoicedEmpl'] = 0;
                         $values['invoicedEmplDate'] = '';
                     }
                     if ($_SESSION['userdata']['role'] == 'admin') {
                         if (isset($_POST['invoicedComp']) && $_POST['invoicedComp'] != '') {
                             if ($_POST['invoicedComp'] == 'on') {
                                 $values['invoicedComp'] = 1;
                             }
                             if (isset($_POST['invoicedCompDate']) && $_POST['invoicedCompDate'] != '') {
                                 $values['invoicedCompDate'] = $helper->timestamp2date($_POST['invoicedCompDate'], 4);
                             } else {
                                 $values['invoicedCompDate'] = date("Y-m-d");
                             }
                         } else {
                             $values['invoicedComp'] = 0;
                             $values['invoicedCompDate'] = '';
                         }
                     }
                     if ($values['ticket'] != '' && $values['project'] != '') {
                         if ($values['kind'] != '') {
                             if ($values['date'] != '') {
                                 if ($values['hours'] != '' && $values['hours'] > 0) {
                                     $this->updateTime($values);
                                     $tpl->setNotification('SAVE_SUCCESS', 'success');
                                     $values['description'] = $_POST['description'];
                                 } else {
                                     $tpl->setNotification('NO_HOURS', 'error');
                                 }
                             } else {
                                 $tpl->setNotification('NO_DATE', 'error');
                             }
                         } else {
                             $tpl->setNotification('NO_KIND', 'error');
                         }
                     } else {
                         $tpl->setNotification('NO_TICKET', 'error');
                     }
                 }
                 $values['date'] = $helper->timestamp2date($values['date'], 2);
                 $values['invoicedCompDate'] = $helper->timestamp2date($values['invoicedCompDate'], 2);
                 $values['invoicedEmplDate'] = $helper->timestamp2date($values['invoicedEmplDate'], 2);
                 if (isset($dateFormat)) {
                     $values['date'] = $dateFormat;
                 }
                 $tpl->assign('values', $values);
                 $tpl->assign('info', $info);
                 $tpl->assign('allProjects', $projects->getAll());
                 $tpl->assign('allTickets', $tickets->getAll());
                 $tpl->assign('kind', $this->kind);
                 $tpl->display('timesheets.editTime');
//.........这里部分代码省略.........
开发者ID:DevelopIdeas,项目名称:leantime,代码行数:101,代码来源:class.editTime.php

示例4: run

 /**
  * run - display template and edit data
  *
  * @access public
  *
  */
 public function run()
 {
     $tpl = new template();
     $msgKey = '';
     if (isset($_GET['id']) === true) {
         $id = (int) $_GET['id'];
         $ticket = $this->getTicket($id);
         $editable = true;
         if (!empty($ticket)) {
             $helper = new helper();
             $file = new files();
             $user = new users();
             $comment = new comments();
             // Has the user seen this ticket already
             $read = new read();
             if (!$read->isRead('ticket', $id, $_SESSION['userdata']['id'])) {
                 $read->markAsRead('ticket', $id, $_SESSION['userdata']['id']);
             }
             //TODO New access right management...This is dumb
             if ($ticket['userId'] == $_SESSION['userdata']['id'] || $ticket['editorId'] == $_SESSION['userdata']['id'] || $ticket['editorId'] == '') {
                 $editable = true;
             }
             //Punch times
             if (isset($_POST['punchIn']) && $this->isClocked($_SESSION['userdata']['id']) != true) {
                 $this->punchIn($ticket['id']);
             } else {
                 if (isset($_POST['punchOut']) && $this->isClocked($_SESSION['userdata']['id']) == true) {
                     $this->punchOut($ticket['id']);
                 }
             }
             //Upload File
             if (isset($_POST['upload'])) {
                 if (isset($_FILES['file'])) {
                     if ($file->upload($_FILES, 'ticket', $id) !== false) {
                         $tpl->setNotification('FILE_UPLOADED', 'success');
                     } else {
                         $tpl->setNotification('ERROR_WHILE_UPLOADING', 'error');
                     }
                 } else {
                     $tpl->setNotification('NO_FILE', 'error');
                 }
             }
             //Add comment
             if (isset($_POST['comment']) === true) {
                 $mail = new mailer();
                 $values = array('text' => $_POST['text'], 'date' => date("Y-m-d H:i:s"), 'userId' => $_SESSION['userdata']['id'], 'moduleId' => $id, 'commentParent' => $_POST['father']);
                 $comment->addComment($values, 'ticket');
                 $tpl->setNotification('COMMENT_ADDED', 'success');
             }
             //Only admins
             if ($_SESSION['userdata']['role'] == 'admin') {
                 $editable = true;
                 //Delete file
                 if (isset($_GET['delFile']) === true) {
                     $file = $_GET['delFile'];
                     $upload = new fileupload();
                     $upload->initFile($file);
                     //Delete file from server
                     $upload->deleteFile($file);
                     //Delete file from db
                     $this->deleteFile($file);
                     $msgKey = 'FILE_DELETED';
                 }
                 //Delete comment
                 if (isset($_GET['delComment']) === true) {
                     $commentId = (int) $_GET['delComment'];
                     $comment->deleteComment($commentId);
                     $msgKey = 'COMMENT_DELETED';
                 }
             }
             $allHours = 0;
             $values = array('userId' => $_SESSION['userdata']['id'], 'ticket' => $id, 'date' => '', 'kind' => '', 'hours' => '', 'description' => '', 'invoicedEmpl' => '', 'invoicedComp' => '', 'invoicedEmplDate' => '', 'invoicedCompDate' => '');
             $timesheets = new timesheets();
             $ticketHours = $timesheets->getTicketHours($id);
             $tpl->assign('ticketHours', $ticketHours);
             $tpl->assign('userHours', $timesheets->getUsersTicketHours($id, $_SESSION['userdata']['id']));
             $userinfo = $user->getUser($values['userId']);
             $tpl->assign('kind', $timesheets->kind);
             $tpl->assign('userInfo', $userinfo);
             if (isset($_POST['saveTimes']) === true) {
                 if (isset($_POST['kind']) && $_POST['kind'] != '') {
                     $values['kind'] = $_POST['kind'];
                 }
                 if (isset($_POST['date']) && $_POST['date'] != '') {
                     $date = $helper->date2timestamp($_POST['date']);
                     //die($date);
                     //$values['date'] = ($helper->timestamp2date($date, 4));
                     $values['date'] = $date;
                 }
                 $values['rate'] = $userinfo['wage'];
                 if (isset($_POST['hours']) && $_POST['hours'] != '') {
                     $values['hours'] = $_POST['hours'];
                 }
                 if (isset($_POST['description']) && $_POST['description'] != '') {
//.........这里部分代码省略.........
开发者ID:DevelopIdeas,项目名称:leantime,代码行数:101,代码来源:class.showTicket.php

示例5: run

 /**
  * run - display template and edit data
  *
  * @access public
  *
  */
 public function run()
 {
     $tpl = new template();
     $projects = new projects();
     $user = new users();
     $helper = new helper();
     $language = new language();
     $language->setModule('tickets');
     $lang = $language->readIni();
     $projects = $projects->getUserProjects("open");
     $msgKey = '';
     if (isset($_GET['id']) === true) {
         $id = (int) $_GET['id'];
     }
     $row = $this->getTicket($id);
     $values = array('id' => $row['id'], 'headline' => $row['headline'], 'type' => $row['type'], 'description' => $row['description'], 'priority' => $row['priority'], 'production' => $row['production'], 'staging' => $row['staging'], 'projectId' => $row['projectId'], 'userId' => $row['userId'], 'date' => $helper->timestamp2date($row['date'], 2), 'dateToFinish' => $helper->timestamp2date($row['dateToFinish'], 2), 'status' => $row['status'], 'browser' => $row['browser'], 'os' => $row['os'], 'resolution' => $row['resolution'], 'version' => $row['version'], 'url' => $row['url'], 'planHours' => $row['planHours'], 'dependingTicketId' => $row['dependingTicketId'], 'editFrom' => $helper->timestamp2date($row['editFrom'], 2), 'editTo' => $helper->timestamp2date($row['editTo'], 2), 'editorId' => $row['editorId'], 'userFirstname' => $row['userFirstname'], 'userLastname' => $row['userLastname']);
     //Make copy of array for comparison later)
     $oldValues = $values;
     if (!empty($row) && $values['headline'] !== null) {
         if (isset($_POST['save'])) {
             $timesheet = new timesheets();
             //Set admin inputs to old values, no need to use hidden fields
             if ($_SESSION['userdata']['role'] === 'client') {
                 $_POST['userId'] = $oldValues['userId'];
                 $_POST['editFrom'] = $oldValues['editFrom'];
                 $_POST['editTo'] = $oldValues['editTo'];
                 $_POST['editorId'] = $oldValues['editorId'];
                 $_POST['planHours'] = $oldValues['planHours'];
                 $_POST['dependingTicketId'] = $oldValues['dependingTicketId'];
             }
             if (!isset($_POST['production'])) {
                 $_POST['production'] = 0;
             } else {
                 $_POST['production'] = 1;
             }
             if (!isset($_POST['staging'])) {
                 $_POST['staging'] = 0;
             } else {
                 $_POST['staging'] = 1;
             }
             if (isset($_POST['editorId']) && count($_POST['editorId'])) {
                 $editorId = implode(',', $_POST['editorId']);
             } else {
                 $editorId = '';
             }
             $values = array('id' => $id, 'headline' => $_POST['headline'], 'type' => $_POST['type'], 'description' => $_POST['description'], 'projectId' => $_POST['project'], 'priority' => $_POST['priority'], 'editorId' => $editorId, 'staging' => $_POST['staging'], 'production' => $_POST['production'], 'date' => $helper->timestamp2date(date("Y-m-d H:i:s"), 2), 'dateToFinish' => $_POST['dateToFinish'], 'status' => $_POST['status'], 'browser' => $_POST['browser'], 'os' => $_POST['os'], 'planHours' => $_POST['planHours'], 'resolution' => $_POST['resolution'], 'version' => $_POST['version'], 'url' => $_POST['url'], 'editFrom' => $_POST['editFrom'], 'editTo' => $_POST['editTo'], 'dependingTicketId' => $_POST['dependingTicketId'], 'userFirstname' => $row['userFirstname'], 'userLastname' => $row['userLastname'], 'userId' => $row['userId']);
             if ($values['headline'] === '') {
                 $tpl->setNotification('ERROR_NO_HEADLINE', 'error');
                 $msgKey = "ERROR_NO_HEADLINE";
             } elseif ($values['description'] === '') {
                 $tpl->setNotification('ERROR_NO_DESCRIPTION', 'error');
             } else {
                 //Prepare dates for db
                 $values['date'] = $helper->date2timestamp($values['date']);
                 $values['dateToFinish'] = $helper->date2timestamp($values['dateToFinish']);
                 $values['editFrom'] = $helper->date2timestamp($values['editFrom']);
                 $values['editTo'] = $helper->date2timestamp($values['editTo']);
                 //Update Ticket
                 $this->updateTicket($values, $id);
                 //Take the old value to avoid nl character
                 $values['description'] = $_POST['description'];
                 $values['date'] = $helper->timestamp2date($values['date'], 2);
                 $values['dateToFinish'] = $helper->timestamp2date($values['dateToFinish'], 2);
                 $values['editFrom'] = $helper->timestamp2date($values['editFrom'], 2);
                 $values['editTo'] = $helper->timestamp2date($values['editTo'], 2);
                 $tpl->setNotification('EDIT_SUCCESS', 'success');
                 //						$msgKey = "TICKET_EDITED";
             }
         }
         //File upload
         if (isset($_POST['upload'])) {
             if (htmlspecialchars($_FILES['file']['name']) !== '') {
                 $upload = new fileupload();
                 $upload->initFile($_FILES['file']);
                 $tpl->assign('info', $upload->error);
                 if ($upload->error == '') {
                     // hash name on server for securty reasons
                     $newname = md5($id . time());
                     $upload->renameFile($newname);
                     if ($upload->upload() === true) {
                         $fileValues = array('encName' => $upload->file_name, 'realName' => $upload->real_name, 'date' => date("Y-m-d H:i:s"), 'ticketId' => $id, 'userId' => $_SESSION['userdata']['id']);
                         $this->addFile($fileValues);
                         $tpl->setNotification('FILE_UPLOADED', 'success');
                     } else {
                         $tpl->setNotification('ERROR_FILEUPLOAD_' . $upload->error . '', 'error');
                     }
                 } else {
                     $tpl->setNotification('ERROR_FILEUPLOAD_' . $upload->error . '', 'error');
                 }
             } else {
                 $tpl->setNotification('NO_FILE', 'error');
             }
         }
         //				var_dump($values); die();
//.........这里部分代码省略.........
开发者ID:DevelopIdeas,项目名称:leantime,代码行数:101,代码来源:class.editTicket.php


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