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


PHP CakeTime::isThisWeek方法代码示例

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


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

示例1: isThisWeek

 /**
  * Returns true if given datetime string is within this week.
  *
  * @param int|string|DateTime $dateString UNIX timestamp, strtotime() valid string or DateTime object
  * @param string|DateTimeZone $timezone   User's timezone string or DateTimeZone object
  *
  * @return bool True if datetime string is within current week
  * @see  CakeTime::isThisWeek()
  * @link http://book.cakephp.org/2.0/en/core-libraries/helpers/time.html#testing-time
  */
 public function isThisWeek($dateString, $timezone = NULL)
 {
     return $this->_engine->isThisWeek($dateString, $timezone);
 }
开发者ID:mrbadao,项目名称:api-official,代码行数:14,代码来源:TimeHelper.php

示例2: analysis


//.........这里部分代码省略.........
                 $this->Session->setFlash("Your predictions are being processed, we will send you an email when the analysis finish", 'success');
                 return $this->redirect(array('controller' => 'Participants', 'action' => 'analysis'));
             }
         } else {
             if (isset($this->request->data['Participant']['results_File']['size']) && $this->request->data['Participant']['results_File']['size'] > 0) {
                 if ($this->request->data['Participant']['results_File']['size'] > $this->filesize2bytes(Configure::read('max_file_size'))) {
                     $this->Session->setFlash("The file can not be more than " . Configure::read('max_file_size'));
                     return $this->redirect(array('controller' => 'Participants', 'action' => 'analysis'));
                 }
                 /* ============================================= */
                 /* =====================Results================= */
                 /* ============================================= */
                 $file = new File($this->request->data['Participant']['results_File']['tmp_name']);
                 if ($file->readable()) {
                     $content = $file->read();
                     $file->close();
                     $content = $this->decrypt($content);
                     $results = json_decode(trim($content), true);
                     //                        debug($results);
                     if (!empty($results)) {
                         $projects = $this->getParticipantProjects($email, $code, $results['project_id']);
                         if (!empty($projects)) {
                             $goldenSet = $this->Participant->GoldenProject->find('first', array('recursive' => -1, 'fields' => array('user_id', 'round_id'), 'conditions' => array('project_id' => $results['project_id'])));
                             if (!empty($goldenSet)) {
                                 $isModified = !$this->Participant->PredictionFile->hasAny(array('participant_id' => $results['Participant']['id'], 'modified' => $results['date']));
                                 $results['Participant']['isModified'] = $isModified;
                                 $results['Golden']['user_id'] = $goldenSet['GoldenProject']['user_id'];
                                 $results['Golden']['round_id'] = $goldenSet['GoldenProject']['round_id'];
                                 $this->Session->write("analysisResults", $results);
                                 $this->redirect(array('action' => 'results'));
                             } else {
                                 $this->Session->setFlash("This golden set have been deleted");
                             }
                         } else {
                             $this->Session->setFlash("This file does not correspond to your credentials");
                         }
                     } else {
                         $this->Session->setFlash("This file is corrupted");
                     }
                 } else {
                     $this->Session->setFlash("This file is corrupted");
                 }
             } else {
                 if (empty($projects)) {
                     $this->Session->setFlash("You are not in any project");
                 } else {
                     $this->Session->setFlash("One team prediction file or one result file is needed");
                 }
             }
         }
     } else {
         $cookie = $this->Cookie->read('participantData');
         if (isset($cookie)) {
             if (isset($cookie['email']) && $cookie['code']) {
                 $this->request->data['Participant']['email'] = $cookie['email'];
                 $this->request->data['Participant']['code'] = $cookie['code'];
                 $this->request->data['Participant']['remember_me'] = true;
                 if (isset($cookie['project_id'])) {
                     $this->request->data['Project']['Project'] = $cookie['project_id'];
                 }
                 $projects = $this->getParticipantProjects($cookie['email'], $cookie['code']);
                 if (empty($projects)) {
                     $this->Cookie->destroy('participantData');
                 }
             } else {
                 $this->Cookie->destroy('participantData');
             }
         }
         $this->loadModel('Post');
         $this->Post->recursive = -1;
         $this->Post->contain(false, array('User' => array('username', 'surname', 'full_name', 'image', 'image_type', 'id')));
         $this->Post->paginate = array('limit' => 5, 'order' => array('modified' => 'DESC'));
         $this->set("posts", $this->paginate($this->Post));
     }
     $this->set('projects', $projects);
     App::uses('CakeTime', 'Utility');
     $finalDate = Configure::read('final_date_to_upload_tasks');
     $startDate = Configure::read('initial_date_to_upload_tasks');
     $isEnd = CakeTime::isPast($finalDate);
     $isFuture = CakeTime::isFuture($startDate);
     $isThisWeek = CakeTime::isThisWeek($finalDate);
     $isToday = CakeTime::isTomorrow(CakeTime::fromString($finalDate));
     $finalDate = CakeTime::format($finalDate, "%B %e, %Y");
     $startDate = CakeTime::format($startDate, "%B %e, %Y");
     $this->set('isEnd', $isEnd);
     $this->set('isFuture', $isFuture);
     $this->set('isThisWeek', $isThisWeek);
     $this->set('isToday', $isToday);
     $this->set('finalDate', $finalDate);
     $this->set('startDate', $startDate);
     ////        $key = "xVO5JLSLOTpKX4YRyFpJXNYb1STQK26mHAzgNK6bwS697XzK8ZE5kEA8R7gajaI9fE6HfemeLhg28nqbGTmh5Dv5uKydSOoM4BHlQ43mvH4h0Jl3xFDcv95fRnY9wYAluS1WFi9QOLc2JDUOsN3ggNzypHuZcPaAjBklfsNH98qkX5brqEnfMUubPOUCtpTEUmtvVNq2oTGKSArEuSuuKRnMHtlbKvl4XbaAUvSfajF4DtHwLa2qaWU6pNXLHf16";
     ////        $key = "FFF3454D1E9CCDE00101010101010101";
     //        $value = "63612bb6b56ef964bc2a6add5e0697deadde735fd4ca966d7b762f61b2b4cb14a14500";
     ////        $value = base64_decode($value);
     ////        debug($value);
     ////        $result = Security::rijndael($value, $key, 'decrypt');
     //        $result = $this->decrypt($value);
     ////        $resultE = Security::rijndael($value, $key, 'encrypt');
     //        $this->set(compact('result', 'resultE'));
 }
开发者ID:sing-group,项目名称:Markyt,代码行数:101,代码来源:ParticipantsController.php


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