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


PHP AppController::archive方法代码示例

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


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

示例1: edit

 function edit($id = null)
 {
     if (!$id && empty($this->data)) {
         $this->Session->setFlash(__('Invalid ResultLookup', true));
         $this->redirect(array('action' => 'index'));
     }
     if (!empty($this->data)) {
         parent::archive($id);
         $this->data = Set::insert($this->data, 'ResultLookup.user_id', $this->Auth->user('id'));
         if ($this->ResultLookup->save($this->data)) {
             $this->Session->setFlash(__('The ResultLookup has been saved', true));
             $this->redirect(array('action' => 'index'));
         } else {
             $this->Session->setFlash(__('The ResultLookup could not be saved. Please, try again.', true));
         }
     }
     if (empty($this->data)) {
         $this->data = $this->ResultLookup->read(null, $id);
         $test_id = $this->data['ResultLookup']['test_id'];
         $this->set('test_id', $test_id);
         $this->set('id', $id);
     }
     $tests = $this->ResultLookup->Test->find('list');
     $this->set(compact('tests'));
 }
开发者ID:kenners,项目名称:uamuzi-bora,代码行数:25,代码来源:result_lookups_controller.php

示例2: delete

 function delete($id = null)
 {
     if (!$id) {
         $this->Session->setFlash(__('Invalid id for Group', true));
         $this->redirect(array('action' => 'index'));
     }
     parent::archive($id);
     if ($this->Group->del($id)) {
         $this->Session->setFlash(__('Group deleted', true));
         $this->redirect(array('action' => 'index'));
     }
 }
开发者ID:kenners,项目名称:uamuzi-bora,代码行数:12,代码来源:groups_controller.php

示例3: edit

 function edit($id = null)
 {
     if (!$id && empty($this->data)) {
         $this->Session->setFlash(__('Invalid Test', true));
         $this->redirect(array('action' => 'index'));
     }
     if (!empty($this->data)) {
         parent::archive($id);
         $this->data = Set::insert($this->data, 'Test.user_id', $this->Auth->user('id'));
         if ($this->Test->save($this->data)) {
             $this->Session->setFlash(__('The Test has been saved', true));
             $this->redirect(array('action' => 'index'));
         } else {
             $this->Session->setFlash(__('The Test could not be saved. Please, try again.', true));
         }
     }
     if (empty($this->data)) {
         $this->data = $this->Test->read(null, $id);
     }
 }
开发者ID:kenners,项目名称:uamuzi-bora,代码行数:20,代码来源:tests_controller.php

示例4: toggleStatus

 /**
  * If the status of the row with PID $pid is FALSE (i.e. the patient is
  * inactive) then toggle to active (with appropriate auditing) and redirect
  * to the referring page.  Otherwise, show a form for InactiveReason which, 
  * when submitted and written to database, redirects to the original
  * referer.
  */
 function toggleStatus($pid = NULL)
 {
     // Check $pid is valid
     if (!$pid || !$this->Patient->isValidPID($pid) || !$this->Patient->valueExists($pid, 'Patient', 'pid')) {
         $this->redirect(array('action' => 'index'));
     }
     $this->Patient->id = $pid;
     if ($this->Patient->field('status')) {
         // `status' is currently TRUE, so we either need to display the form to
         // choose an inactive reason, or receive the submission of said form
         if (isset($this->data)) {
             // Archive the current row
             parent::archive($pid);
             // Perform the toggle
             $data['Patient']['pid'] = $pid;
             $data['Patient']['status'] = FALSE;
             $data['Patient']['inactive_reason_id'] = $this->data['Patient']['inactive_reason_id'];
             $data['Patient']['status_timestamp'] = $this->data['Patient']['status_timestamp'];
             $this->Patient->save($data);
             // Redirect back to where you came from
             $this->redirect($this->data['Patient']['referer']);
         } else {
             $this->set(array('pid' => $pid, 'referer' => $this->referer(), 'inactive_reasons' => $this->InactiveReason->find('list')));
         }
     } else {
         // `status' is currently FALSE, so toggle it to true
         // Archive the current row
         parent::archive($pid);
         // Perform the toggle
         $data['Patient']['pid'] = $pid;
         $data['Patient']['status'] = TRUE;
         $data['Patient']['inactive_reason_id'] = NULL;
         $data['Patient']['status_timestamp'] = date('c');
         $this->Patient->save($data);
         // Redirect back to where you came from
         $this->redirect($this->referer());
     }
 }
开发者ID:kenners,项目名称:uamuzi-bora,代码行数:45,代码来源:patients_controller.php

示例5: edit

 /**
  * Edit a row in the MedicalInformation table, with appropriate auditing
  */
 function edit($pid = NULL)
 {
     // Check $pid is okay
     if (empty($pid) || !$this->Patient->isValidPID($pid) || !$this->Patient->valueExists($pid, 'Patient', 'pid')) {
         $this->redirect(array('controller' => 'patients', 'action' => 'index'));
     }
     // If there's somehow not a row in the medical_informations table, then
     // create it now.  Hopefully this will never happen, but it might if, say
     // the connection was lost in the middle of adding a new patient.
     if (!$this->MedicalInformation->valueExists($pid, 'MedicalInformation', 'pid')) {
         $this->MedicalInformation->save(array('MedicalInformation' => array('pid' => $pid)));
     }
     // If some data has been sent, then archive and edit the database table,
     // then redirect to PatientsController::view
     if (isset($this->data)) {
         $this->data['MedicalInformation']['user_id'] = $this->Auth->user('id');
         // Necessary because if validation fails we want $this->data to be
         // pristine
         $data = $this->data;
         // Fix all of the dates to ISO 8601
         foreach (array('hiv_positive_date', 'hiv_positive_clinic_start_date', 'art_start_date', 'art_eligibility_date', 'transfer_in_date', 'transfer_out_date') as $dateField) {
             if (!empty($data['MedicalInformation'][$dateField]['day']) && !empty($data['MedicalInformation'][$dateField]['month']) && !empty($data['MedicalInformation'][$dateField]['year'])) {
                 $data['MedicalInformation'][$dateField] = $data['MedicalInformation'][$dateField]['year'] . '-' . $data['MedicalInformation'][$dateField]['month'] . '-' . $data['MedicalInformation'][$dateField]['day'];
             } else {
                 $data['MedicalInformation'][$dateField] = NULL;
             }
         }
         // Archive the existing data
         parent::archive($pid);
         $medicalInformation = $this->data['MedicalInformation'];
         $artRegimen = $this->data['ArtRegimen'];
         $artInterruption = $this->data['ArtInterruption'];
         $artSubstitution = $this->data['ArtSubstitution'];
         $invalidReg = array();
         $invalidInt = array();
         $invalidSub = array();
         $invalidMed = array();
         $intAdd = array();
         $subAdd = array();
         $regAdd = array();
         $this->MedicalInformation->set(array('MedicalInformation' => $medicalInformation));
         if (!$this->MedicalInformation->validates()) {
             $invalidMed = $this->MedicalInformation->validationErrors;
             unset($this->MedicalInformation->validationErrors);
         }
         $counter = 0;
         foreach ($artRegimen as $i) {
             if ($i['regimen_id'] != Null) {
                 $i = Set::insert($i, 'pid', $pid);
                 $this->MedicalInformation->ArtRegimen->set(array('ArtRegimen' => $i));
                 if (!$this->MedicalInformation->ArtRegimen->validates()) {
                     $invalidReg[$counter] = $this->MedicalInformation->ArtRegimen->validationErrors;
                     unset($this->MedicalInformation->ArtRegimen->validationErrors);
                 }
                 $regAdd[] = $i;
             }
             $counter++;
         }
         $counter = 0;
         foreach ($artInterruption as $i) {
             if ($i['interruption_date'] != Null and $i['art_interruption_reason_id'] != Null and $i['restart_date'] != Null) {
                 $i = Set::insert($i, 'pid', $pid);
                 $this->MedicalInformation->ArtInterruption->set(array('ArtInterruption' => $i));
                 if (!$this->MedicalInformation->ArtInterruption->validates()) {
                     $invalidInt[$counter] = $this->MedicalInformation->ArtInterruption->validationErrors;
                     unset($this->MedicalInformation->ArtInterruption->validationErrors);
                 }
                 $intAdd[] = $i;
             }
             $counter++;
         }
         $counter = 0;
         foreach ($artSubstitution as $i) {
             if ($i['date'] != Null and $i['regimen_id'] != Null and $i['art_substitution_reason_id'] != Null) {
                 $i = Set::insert($i, 'pid', $pid);
                 $this->MedicalInformation->ArtSubstitution->set(array('ArtSubstitution' => $i));
                 if (!$this->MedicalInformation->ArtSubstitution->validates()) {
                     debug('hei');
                     $invalidSub[$counter] = $this->MedicalInformation->ArtSubstitution->validationErrors;
                     unset($this->MedicalInformation->ArtSubstitution->validationErrors);
                 }
                 $subAdd[] = $i;
             }
             $counter++;
         }
         if (empty($invalidReg) and empty($invalidInt) and empty($invalidSub) and empty($invalidMed)) {
             $this->MedicalInformation->create();
             $this->MedicalInformation->save(array('MedicalInformation' => $medicalInformation));
             foreach ($subAdd as $value) {
                 $this->MedicalInformation->ArtSubstitution->create();
                 $this->MedicalInformation->ArtSubstitution->save(array('ArtSubstitution' => $value));
             }
             foreach ($intAdd as $value) {
                 $this->MedicalInformation->ArtInterruption->create();
                 $this->MedicalInformation->ArtInterruption->save(array('ArtInterruption' => $value));
             }
             foreach ($regAdd as $value) {
//.........这里部分代码省略.........
开发者ID:kenners,项目名称:uamuzi-bora,代码行数:101,代码来源:medical_informations_controller.php


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