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


PHP CakeTime::isPast方法代码示例

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


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

示例1: login

 /**
  * login method
  *
  * @return void
  */
 public function login()
 {
     $user_id = $this->Session->read('user_id');
     $group_id = $this->Auth->user('group_id');
     if (!isset($this->data['User']['username'])) {
         $this->Auth->authenticate['Form'] = array('fields' => array('username' => 'email'));
     }
     if (!isset($user_id)) {
         //            if (empty($this->data)) {
         //                $cookie = $this->Cookie->read('Auth.User');
         //                if (!is_null($cookie)) {
         //                    if ($this->Auth->login($cookie)) {
         //                        $id_user = $this->Auth->user('id');
         //                        $this->Session->write('user_id', $id_user);
         //                        $username = $this->Auth->user('full_name');
         //                        $this->Session->write('username', $username);
         //                        $email = $this->Auth->user('email');
         //                        $this->Session->write('email', $email);
         //                        $group_id = $this->Auth->user('group_id');
         //                        $this->Session->write('group_id', $group_id);
         //                        $image = $this->Auth->user('image');
         //                        if (isset($image)) {
         //                            $extension = $this->Auth->user('image_extension');
         //                            $image = 'data:' . $extension . ';base64,' . base64_encode($this->Auth->user('image'));
         //                        }
         //                        $this->Session->write('image', $image);
         //
         //
         //                        if ($group_id == 1)
         //                            $this->redirect(array('controller' => 'Projects', 'action' => 'index'));
         //                        else
         //                            $this->redirect(array('controller' => 'usersRounds', 'action' => 'index'));
         //                    } else {// Delete invalid Cookie
         //                        $this->Cookie->destroy('Auth.User');
         //                        $this->Session->setFlash(__('Your username or pasword is incorrect'));
         //                        $this->redirect(array('controller' => 'Posts', 'action' => 'publicIndex'));
         //                    }
         //                }
         //
         //                $this->Session->setFlash(__('You are not authorized to access this location (user Login)'));
         //            }
         if ($this->request->is('post')) {
             if ($this->Auth->login()) {
                 $user_id = $this->Auth->user('id');
                 $this->Session->write('user_id', $user_id);
                 $username = $this->Auth->user('full_name');
                 $this->Session->write('username', $username);
                 $email = $this->Auth->user('email');
                 $this->Session->write('email', $email);
                 $group_id = $this->Auth->user('group_id');
                 $this->Session->write('group_id', $group_id);
                 $image = $this->Auth->user('image');
                 if (isset($image)) {
                     $extension = $this->Auth->user('image_type');
                     $image = 'data:' . $extension . ';base64,' . base64_encode($this->Auth->user('image'));
                 }
                 $this->Session->write('image', $image);
                 //                    if (!empty($this->data) && $this->data['User']['remember_me']) {
                 //                        $cookie = array();
                 //                        $cookie['username'] = $username;
                 //                        $cookie['password'] = $this->data['User']['password'];
                 //                        $cookie['user_id'] = $id_user;
                 //                        $cookie['group_id'] = $group_id;
                 //                        $this->Cookie->write('Auth.User', $cookie, true, '+2 weeks');
                 //                        unset($this->data['User']['remember_me']);
                 //                    }
                 //ver si el usuario esta ya logueado
                 App::uses('CakeTime', 'Utility');
                 $date = $this->Auth->user('logged_until');
                 $isPast = CakeTime::isPast($date);
                 if (!$isPast) {
                     return $this->redirect(array('action' => 'logout', true));
                 }
                 $connectionLog = Configure::read('connectionLog');
                 if ($connectionLog) {
                     $ip = $this->request->clientIp();
                     //                        $ip = "4.4.4.4";
                     $connectionLogProxy = Configure::read('connectionLogProxy');
                     if ($connectionLogProxy && isset($this->request->data['User']['connection-details'])) {
                         $details = $this->request->data['User']['connection-details'];
                         $copyDetails = json_decode($details, true);
                         $ip = $copyDetails['ip'];
                     } else {
                         $details = @file_get_contents("http://ipinfo.io/{$ip}/json");
                     }
                     if ($details && $ip != '127.0.0.1') {
                         $details = json_decode($details, true);
                     } else {
                         $details = array();
                         $details['city'] = "unknown";
                         $details['country'] = "unknown";
                     }
                     $region = "";
                     if (isset($details['region'])) {
                         $region = $details['region'];
//.........这里部分代码省略.........
开发者ID:sing-group,项目名称:Markyt,代码行数:101,代码来源:UsersController.php

示例2: start

 public function start($round_id = null, $user_id = null, $operation = null)
 {
     $this->Round = $this->AnnotatedDocument->Round;
     $this->User = $this->Round->User;
     $this->UsersRound = $this->Round->UsersRound;
     $this->Project = $this->Round->Project;
     $this->Document = $this->Project->Document;
     $this->Type = $this->Round->Type;
     $this->Relation = $this->Project->Relation;
     $this->DocumentsProject = $this->Project->DocumentsProject;
     $this->Annotation = $this->Round->Annotation;
     $this->AnnotationsInterRelation = $this->Annotation->AnnotationsInterRelation;
     $this->Job = $this->User->Job;
     $find = false;
     $isReviewAutomaticAnnotation = false;
     switch ($operation) {
         case "find":
             $find = true;
             break;
         case "lastAutomatic":
             $isReviewAutomaticAnnotation = true;
             break;
     }
     $this->Round->id = $round_id;
     if (!$this->Round->exists()) {
         throw new NotFoundException(__('Invalid round'));
     }
     //
     $group_id = $this->Session->read('group_id');
     if ($group_id > 1) {
         $redirect = array('controller' => 'rounds', 'action' => 'index');
         $user_id = $this->Session->read('user_id');
     } else {
         $redirect = array('controller' => 'rounds', 'action' => 'view', $round_id);
     }
     if ($isReviewAutomaticAnnotation) {
         $documents = $this->Job->find('first', array('recursive' => -1, 'fields' => array("comments"), 'conditions' => array('Job.comments IS NOT NULL', 'Job.exception IS NULL', 'Job.user_id' => $user_id, 'Job.round_id' => $round_id, 'program' => 'Automatic_Dictionary_Annotation'), 'order' => array('Job.modified DESC')));
         if (!empty($documents)) {
             $documents = json_decode($documents['Job']['comments'], true);
             if (json_last_error() == JSON_ERROR_NONE) {
                 $documents = array_keys($documents["documentsWithAnnotations"]);
                 if (empty($documents)) {
                     $this->Session->setFlash(__('There are no recommendations for you [JSON empty]'));
                     $this->redirect($redirect);
                 }
             } else {
                 $this->Session->setFlash(__('There are no recommendations for you [JSON parser error]'));
                 $this->redirect($redirect);
             }
         } else {
             $this->Session->setFlash(__('There are no recommendations for you'));
             $this->redirect($redirect);
         }
     }
     $this->User->id = $user_id;
     if (!$this->User->exists()) {
         throw new NotFoundException(__('Invalid User'));
     }
     //
     $userRound = $this->UsersRound->find('first', array('recursive' => -1, 'fields' => 'id', 'conditions' => array('user_id' => $user_id, 'round_id' => $round_id)));
     $users_round_id = $userRound['UsersRound']['id'];
     $this->UsersRound->id = $userRound['UsersRound']['id'];
     if ($this->UsersRound->field('state') != 0) {
         $this->Session->setFlash(__('There are one process working in this documents'));
         $this->redirect($redirect);
     }
     $isMultiDocument = Configure::read('documentsPerPage') > 1;
     if ($find && $group_id == 1) {
         $isMultiDocument = false;
     } else {
         $find = false;
     }
     $round_id = $this->UsersRound->field('round_id');
     //        $round = Cache::read('round-id-' . $round_id, 'short');
     //        if (!$round) {
     //buscamos el round para saber la fecha de finalizacion
     $round = $this->Round->find('first', array('recursive' => -1, 'conditions' => array('Round.id' => $round_id)));
     //            Cache::write('round-id-' . $round_id, $round, 'short');
     //        }
     if (empty($round)) {
         throw new NotFoundException(__('Empty round data'));
     }
     App::uses('CakeTime', 'Utility');
     $isEnd = CakeTime::isPast($round['Round']['ends_in_date']);
     if ($group_id > 1) {
         if (isset($round['Round']['start_document'])) {
             $offset = $round['Round']['start_document'] - 1;
             if ($offset < 0) {
                 $offset = 0;
             }
             $limit = $round['Round']['end_document'];
         } else {
             $offset = 0;
             $limit = 0;
         }
     } else {
         $offset = 0;
         $limit = 0;
         $isEnd = true;
     }
//.........这里部分代码省略.........
开发者ID:sing-group,项目名称:Markyt,代码行数:101,代码来源:AnnotatedDocumentsController.php

示例3: days

 /**
  *    Days in theme
  *    @param int $theme_id
  */
 public function days($theme_id = null, $user_id = null)
 {
     if (!$theme_id) {
         return;
     }
     $options = array('recursive' => -1, 'conditions' => array('Day.theme_id' => $theme_id), 'order' => array('data ASC'));
     $rows = $this->Day->find('all', $options);
     foreach ($rows as $key => $row) {
         $row['Day']['isFuture'] = false;
         $row['Day']['isPast'] = false;
         $row['Day']['isToday'] = false;
         $row['Day']['comments'] = $this->Comment->find('count', array('conditions' => array('Comment.user_id' => !$this->isUser() ? $user_id : $this->getUserId(), 'Comment.day_id' => $row['Day']['id'])));
         if (CakeTime::isFuture($row['Day']['data'])) {
             $row['Day']['isFuture'] = true;
         }
         if (CakeTime::isPast($row['Day']['data'])) {
             $row['Day']['isPast'] = true;
         }
         if (CakeTime::isToday($row['Day']['data'])) {
             $row['Day']['isToday'] = true;
         }
         $data[] = $row['Day'];
     }
     $this->set($data);
     $this->set('_serialize', array_keys($data));
 }
开发者ID:ranostaj,项目名称:iqualJs,代码行数:30,代码来源:ThemesController.php

示例4: start2

 public function start2($round_id = null, $user_id = null, $find = null)
 {
     $group_id = $this->Session->read('group_id');
     if ($group_id > 1) {
         $redirect = array('controller' => 'rounds', 'action' => 'index');
         $user_id = $this->Session->read('user_id');
     } else {
         if (!$this->Session->check('users_round_id')) {
             $this->Session->write('users_round_id', $user_id);
         } else {
             $last_user_id = $this->Session->read('users_round_id');
             if (isset($user_id) && $user_id != $last_user_id) {
                 $this->Session->write('users_round_id', $user_id);
             }
             $user_id = $this->Session->read('users_round_id');
         }
         $redirect = array('controller' => 'rounds', 'action' => 'view', $round_id);
     }
     $multiDocument = Configure::read('documentsPerPage') > 1;
     if ($find && $group_id == 1) {
         $multiDocument = false;
     } else {
         $find = false;
     }
     $round = Cache::read('round-id-' . $round_id, 'short');
     if (!$round) {
         //buscamos el round para saber la fecha de finalizacion
         $round = $this->UsersRound->Round->find('first', array('recursive' => -1, 'conditions' => array('Round.id' => $round_id)));
         Cache::write('round-id-' . $round_id, $round, 'short');
     }
     if (empty($round)) {
         throw new NotFoundException(__('Invalid round'));
     }
     App::uses('CakeTime', 'Utility');
     $isEnd = CakeTime::isPast($round['Round']['ends_in_date']);
     if ($group_id > 1) {
         if (isset($round['Round']['start_document'])) {
             $offset = $round['Round']['start_document'] - 1;
             if ($offset < 0) {
                 $offset = 0;
             }
             $limit = $round['Round']['end_document'];
         } else {
             $offset = 0;
             $limit = 0;
         }
     } else {
         $offset = 0;
         $limit = 0;
         $isEnd = true;
     }
     $projectId = $round['Round']['project_id'];
     $onlyAnnotated = false;
     if ($group_id == 1 || $isEnd) {
         $onlyAnnotated = true;
     }
     //buscamos todos los documentos del proyecto para el selector
     if ($onlyAnnotated) {
         $documents = Cache::read('documents-list-project-id-onlyAnnotated' . $round_id . '-' . $user_id, 'short');
     } else {
         $documents = Cache::read('documents-list-project-id-' . $projectId, 'short');
     }
     if (!$documents) {
         if ($onlyAnnotated) {
             $documentsAll = $this->UsersRound->Round->Project->Document->find('all', array('recursive' => -1, 'fields' => array('id', 'title', 'external_id'), 'joins' => array(array('table' => 'users_rounds', 'alias' => 'UsersRounds', 'type' => 'LEFT', 'conditions' => array('UsersRounds.document_id = Document.id', 'UsersRounds.text_marked IS NOT NULL'))), 'conditions' => array('UsersRounds.round_id' => $round_id, 'UsersRounds.user_id' => $user_id), 'limit' => $limit, 'offset' => $offset, 'order' => array('document_id Asc')));
         } else {
             $documentsAll = $this->UsersRound->Round->Project->Document->find('all', array('recursive' => -1, 'fields' => array('id', 'title', 'external_id'), 'joins' => array(array('table' => 'documents_projects', 'alias' => 'DocumentsProject', 'type' => 'INNER', 'conditions' => array('DocumentsProject.document_id = Document.id'))), 'conditions' => array('DocumentsProject.project_id' => $projectId), 'limit' => $limit, 'offset' => $offset, 'order' => array('document_id Asc')));
         }
         $documents = array();
         $tam = count($documentsAll);
         for ($index = 0; $index < $tam; $index++) {
             $id = $documentsAll[$index]['Document']['id'];
             $title = "";
             if (isset($documentsAll[$index]['Document']['external_id'])) {
                 $title .= $documentsAll[$index]['Document']['external_id'] . " - ";
             }
             $title .= $documentsAll[$index]['Document']['title'];
             $documents[$id] = $title;
         }
         if ($onlyAnnotated) {
             Cache::write('documents-list-project-id-onlyAnnotated' . $round_id . '-' . $user_id, $documents, 'short');
         } else {
             Cache::write('documents-list-project-id-' . $projectId, $documents, 'short');
         }
     }
     $ids = array_keys($documents);
     if (isset($this->params['named']['page'])) {
         $page = $this->params['named']['page'];
         if ($page <= 0) {
             $page = 1;
         }
         if (!$multiDocument) {
             $document_id = $ids[$page - 1];
         }
     } else {
         $page = 1;
         if (!$multiDocument) {
             $document_id = $ids[0];
         }
     }
//.........这里部分代码省略.........
开发者ID:sing-group,项目名称:Markyt,代码行数:101,代码来源:UsersRoundsController.php

示例5: addEntry

 /**
  *Agrega entrada a la bitácora actual
  */
 public function addEntry($uId, $pId)
 {
     if ($this->request->is('post') || $this->request->is('get')) {
         $record = $this->Record->findByUserIdAndProjectIdAndActiva($uId, $pId, true);
         $this->set('proyecto', $this->Record->Project->findById($pId));
         $this->set('usuario', $this->Record->User->findById($uId));
         if ($record) {
             if (CakeTime::isPast($record['Record']['fecha_fin'])) {
                 //Se cambia para que no esté activa la bitácora actual
                 $this->Record->id = $record['Record']['id'];
                 $this->Record->save(array('activa' => false));
                 //Se crea la nueva bitácora
                 $this->Record->create();
                 $entrada = $this->request->data;
                 //como las bitácoras son semanales hay que hacerlo con fechas secuenciales
                 $entrada['Record']['fecha_inicio'] = date("Y-m-d", strtotime("+1 days", strtotime($record['Record']['fecha_fin'])));
                 $entrada['Record']['fecha_fin'] = date("Y-m-d", strtotime("+8 days", strtotime($record['Record']['fecha_fin'])));
                 $entrada['Record']['project_id'] = $pId;
                 $entrada['Record']['user_id'] = $uId;
                 if ($this->Record->save($entrada)) {
                     $RecId = $this->Record->id;
                     $this->Record->RecordEntry->create();
                     $this->Record->RecordEntry->save(array('RecordEntry' => array('timestamp' => CakeTime::format(time(), '%B %e, %Y %H:%M %p'), 'cuerpo' => $this->request->data['Record']['cuerpo'], 'record_id' => $RecId)));
                     $this->Flash->success('Nueva bitácora creada.');
                     if ($this->Auth->user()['rol'] == 3) {
                         return $this->redirect(array('pm' => true, 'action' => 'displayRecords', $uId, $pId));
                     }
                     return $this->redirect(array('action' => 'displayRecords', $uId, $pId));
                 } else {
                     $this->Flash->set(__('No se puedo crear la nueva bitácora.'));
                 }
             } else {
                 if ($this->request->is('post') && $this->request->data) {
                     $this->Record->id = $record['Record']['id'];
                     $entrada = $this->request->data;
                     if ($this->Record->save($entrada)) {
                         $RecId = $this->Record->id;
                         $this->Record->RecordEntry->create();
                         $this->Record->RecordEntry->save(array('RecordEntry' => array('timestamp' => CakeTime::format(time(), '%B %e, %Y %H:%M %p'), 'cuerpo' => $this->request->data['Record']['cuerpo'], 'record_id' => $RecId)));
                         $this->Flash->success('Entrada añadida.');
                         if ($this->Auth->user()['rol'] == 3) {
                             return $this->redirect(array('pm' => true, 'action' => 'displayRecords', $uId, $pId));
                         }
                         return $this->redirect(array('action' => 'displayRecords', $uId, $pId));
                     } else {
                         $this->Flash->set(__('No se puedo salvar la entrada.'));
                     }
                 }
             }
         } else {
             $this->Record->create();
             $entrada = $this->request->data;
             $entrada['Record']['fecha_inicio'] = CakeTime::format(time(), '%y-%m-%d');
             $entrada['Record']['fecha_fin'] = CakeTime::format('+7 days', '%y-%m-%d');
             $entrada['Record']['project_id'] = $pId;
             $entrada['Record']['user_id'] = $uId;
             if ($this->Record->save($entrada)) {
                 $RecId = $this->Record->id;
                 $this->Record->RecordEntry->create();
                 $this->Record->RecordEntry->save(array('RecordEntry' => array('timestamp' => CakeTime::format(time(), '%B %e, %Y %H:%M %p'), 'cuerpo' => $this->request->data['Record']['cuerpo'], 'record_id' => $RecId)));
                 $this->Flash->success('Bitácora creada.');
                 if ($this->Auth->user()['rol'] == 3) {
                     return $this->redirect(array('pm' => true, 'action' => 'displayRecords', $uId, $pId));
                 }
                 return $this->redirect(array('action' => 'displayRecords', $uId, $pId));
             } else {
                 $this->Flash->set(__('No se puedo crear la bitácora.'));
             }
         }
     }
 }
开发者ID:Errantgod,项目名称:manejo_proyectos_inge1,代码行数:74,代码来源:RecordsController.php

示例6: automaticAnnotation

 function automaticAnnotation()
 {
     $this->Job = $this->Round->User->Job;
     $this->UsersRound = $this->Round->UsersRound;
     $this->User = $this->Round->User;
     $enableJavaActions = Configure::read('enableJavaActions');
     if ($this->request->is('post') && $enableJavaActions) {
         $user_id = $this->request->data['user_id'];
         $round_id = $this->request->data['round_id'];
         $group_id = $this->Session->read('group_id');
         if ($group_id > 1) {
             $user_id = $this->Session->read('user_id');
             $this->User->id = $user_id;
         }
         $this->Round->id = $this->request->data['round_id'];
         $userRound = $this->UsersRound->find('first', array('recursive' => -1, 'fields' => array('id', 'state'), 'conditions' => array('user_id' => $user_id, 'round_id' => $round_id)));
         if (empty($userRound)) {
             throw new NotFoundException(__('Invalid Round'));
         }
         $operation = $this->request->data['operation'];
         App::uses('CakeTime', 'Utility');
         $group_id = $this->Session->read('group_id');
         $isEnd = false;
         if ($group_id > 1) {
             $isEnd = CakeTime::isPast($this->Round->field('ends_in_date'));
         }
         //            $this->Job->find->hasAny(array('user_id'))
         if ($operation == -1) {
             $this->killJob($this->request->data['job_id']);
         } else {
             $programName = "Automatic_Dictionary_Annotation";
             if (!$isEnd && $userRound['UsersRound']['state'] == 0) {
                 $this->Job->create();
                 $data = array('user_id' => $user_id, 'round_id' => $round_id, 'percentage' => 0, '' => $programName, 'status' => 'Starting...');
                 if ($this->Job->save($data)) {
                     $id = $this->Job->id;
                     switch ($operation) {
                         // Kill process
                         case -1:
                             break;
                             // Anotacion en base a las anotaciones del usuario.
                         // Anotacion en base a las anotaciones del usuario.
                         case 1:
                             $operationId = 6;
                             $types = json_encode($this->request->data['types']);
                             if (!empty($types)) {
                                 $arguments = "{$operationId}\t{$id}\t{$user_id}\t{$round_id}\t{$types}";
                                 return $this->sendJob($id, $programName, $arguments);
                             } else {
                                 return $this->correctResponseJson(json_encode(array('success' => false, 'message' => "The task could not be performed successfully. Other operation is in progress. Please select at least one type")));
                             }
                             break;
                         case 2:
                             $operationId = 9;
                             App::uses('Folder', 'Utility');
                             $dictionary = new File($this->request->data['File']['tmp_name'], false, 0777);
                             if ($dictionary->exists()) {
                                 $path = Configure::read('uploadFolder');
                                 $newPath = $path . uniqid();
                                 $dictionary->copy($newPath);
                                 $project_id = $this->Round->field('project_id');
                                 $arguments = "{$operationId}\t{$id}\t{$user_id}\t{$round_id}\t{$project_id}\t{$newPath}";
                                 $this->sendJob($id, $programName, $arguments, false);
                                 if ($this->request->is("ajax")) {
                                     return $this->correctResponseJson(json_encode(array('success' => true)));
                                 } else {
                                     return $this->redirect(array('controller' => 'jobs', 'action' => 'index'));
                                 }
                                 break;
                             }
                     }
                 }
             }
             if ($this->request->is("ajax")) {
                 return $this->correctResponseJson(json_encode(array('success' => false, 'message' => "The task could not be performed successfully. ")));
             } else {
                 $this->Session->setFlash(__('The task could not be performed successfully'));
                 return $this->redirect(array('controller' => 'jobs', 'action' => 'index'));
             }
         }
     }
 }
开发者ID:sing-group,项目名称:Markyt,代码行数:82,代码来源:RoundsController.php

示例7: uploadFinalPredictions

 function uploadFinalPredictions()
 {
     $this->Cookie = $this->Components->load('Cookie');
     $this->Cookie->type('rijndael');
     //        $this->Cookie->time = '999 hours';
     if ($this->request->is(array('post', 'put'))) {
         //            debug($this->request->data);
         $email = $this->request->data['Participant']['email'];
         $code = $this->request->data['Participant']['code'];
         $task = $this->request->data['Participant']["task"];
         $run = $this->request->data['Participant']["run"];
         $maxUploadTask = Configure::read('max_participant_task_upload');
         $tasks = Configure::read('biocreative_tasks');
         $finalDate = Configure::read('final_date_to_upload_tasks');
         $startDate = Configure::read('initial_date_to_upload_tasks');
         if (!in_array($task, $tasks) && $run < 0 && $run > 5) {
             $this->Session->setFlash("Incorrect data");
             return $this->redirect(array('controller' => 'Participants', 'action' => 'analysis'));
         }
         App::uses('CakeTime', 'Utility');
         $isEnd = CakeTime::isPast($finalDate);
         $isFuture = CakeTime::isFuture($startDate);
         if ($isEnd || $isFuture) {
             $this->Session->setFlash("The final delivery date has expired");
             return $this->redirect(array('controller' => 'Participants', 'action' => 'analysis'));
         }
         $project_id = -1;
         if ($this->data['Participant']['remember_me'] && isset($code) && isset($email)) {
             $cookie = array();
             $cookie['email'] = $email;
             $cookie['code'] = $code;
             $this->Cookie->write('participantData', $cookie, true, '+2 weeks');
         } else {
             if ($this->Cookie->check('participantData')) {
                 $this->Cookie->destroy('participantData');
             }
         }
         App::uses('Folder', 'Utility');
         App::uses('File', 'Utility');
         //            debug($this->request->data);
         if ($this->request->data['Participant']['final_prediction']['size'] > 0) {
             /* ============================================= */
             /* ==============Load analysis=================== */
             /* ============================================= */
             if ($this->request->data['Participant']['final_prediction']['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'));
             }
             $file = $this->request->data['Participant']['final_prediction']['name'];
             if (pathinfo($file, PATHINFO_EXTENSION) != 'tsv') {
                 $this->Session->setFlash("The file must be in TSV format");
                 return $this->redirect(array('controller' => 'Participants', 'action' => 'analysis'));
             }
             $file = new File($this->request->data['Participant']['final_prediction']['tmp_name']);
             if ($file->readable()) {
                 $content = $file->read();
                 $file->close();
                 $lines = explode("\n", $content);
                 $incorrectFormat = empty($lines);
                 $count = 0;
                 $size = count($lines);
                 $correctColumns = 5;
                 if ($task == "CPD") {
                     $correctColumns = 4;
                 }
                 for ($index = 0; $index < $size; $index++) {
                     if (strlen(trim($lines[$index])) > 0) {
                         if (!$incorrectFormat) {
                             $columns = explode("\t", $lines[$index]);
                             for ($i = 0; $i < count($columns); $i++) {
                                 if (strlen(trim($columns[$i])) == 0) {
                                     $incorrectFormat = true;
                                 }
                             }
                             $incorrectFormat = $incorrectFormat || sizeof($columns) != $correctColumns;
                             $count++;
                         } else {
                             break;
                         }
                     }
                 }
                 //                    $correctFormat = $this->correctTsvFormat($file, 5);
                 if ($incorrectFormat) {
                     //                        $count=$this->incorrecLineTsvFormat($file);
                     if ($task == "CPD") {
                         $this->Session->setFlash("Incorrect content file. Line {$count} is incorrect. " . "Content file must be contain 4 columns");
                     } else {
                         $this->Session->setFlash("Incorrect content file. Line {$count} is incorrect. " . "Content file must be in this format WO2009026621A1->A:12:24->1->0.99->paliperidone");
                     }
                     return $this->redirect(array('controller' => 'Participants', 'action' => 'analysis'));
                 }
                 $participant = $this->Participant->find('first', array("recursive" => -1, "fields" => array("id", "team_id"), "conditions" => array('Participant.email' => $email, 'Participant.code' => $code)));
                 $participantID = $participant["Participant"]["id"];
                 $team_id = $participant["Participant"]["team_id"];
                 $this->request->data['Participant']['id'] = $participantID;
                 $this->participantSaveConnection($this->request->data['Participant'], "uploadTeamPrediction");
                 $path = Configure::read('participantsPath');
                 $path = $path . DS . $task . DS . $team_id;
                 $dir = new Folder($path, true, 0755);
                 $tempPath = $this->request->data['Participant']['final_prediction']['tmp_name'];
//.........这里部分代码省略.........
开发者ID:sing-group,项目名称:Markyt,代码行数:101,代码来源:ParticipantsController.php


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