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


PHP Participant::delete方法代码示例

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


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

示例1: destroy

 public static function destroy($id)
 {
     self::check_admin_logged_in();
     $participant = Participant::find($id);
     Participant::delete($id);
     Participant::nullify_and_update_competition_standings($participant->competition_id);
     Redirect::to('/competition/' . $participant->competition_id . '/participants', array('message' => 'Kilpailija ' . $participant->competitor_name . ' poistettiin onnistuneesti kilpailusta ' . $participant->competition_name));
 }
开发者ID:eerojala,项目名称:Hiihtokilpailujen-tulospalvelu,代码行数:8,代码来源:participant_controller.php

示例2: testfixEventLevel

 /**
  * FixEventLevel() method (Setting ',' values), resolveDefaults(assinging value to array) method
  */
 public function testfixEventLevel()
 {
     $paramsSet['title'] = 'Price Set';
     $paramsSet['name'] = CRM_Utils_String::titleToVar('Price Set');
     $paramsSet['is_active'] = FALSE;
     $paramsSet['extends'] = 1;
     $priceset = CRM_Price_BAO_PriceSet::create($paramsSet);
     //Checking for priceset added in the table.
     $this->assertDBCompareValue('CRM_Price_BAO_PriceSet', $priceset->id, 'title', 'id', $paramsSet['title'], 'Check DB for created priceset');
     $paramsField = array('label' => 'Price Field', 'name' => CRM_Utils_String::titleToVar('Price Field'), 'html_type' => 'Text', 'price' => 10, 'option_label' => array('1' => 'Price Field'), 'option_value' => array('1' => 10), 'option_name' => array('1' => 10), 'option_weight' => array('1' => 1), 'is_display_amounts' => 1, 'weight' => 1, 'options_per_line' => 1, 'is_active' => array('1' => 1), 'price_set_id' => $priceset->id, 'is_enter_qty' => 1);
     $ids = array();
     $pricefield = CRM_Price_BAO_PriceField::create($paramsField, $ids);
     //Checking for priceset added in the table.
     $this->assertDBCompareValue('CRM_Price_BAO_PriceField', $pricefield->id, 'label', 'id', $paramsField['label'], 'Check DB for created pricefield');
     $eventId = $this->_eventId;
     $participantParams = array('send_receipt' => 1, 'is_test' => 0, 'is_pay_later' => 0, 'event_id' => $eventId, 'register_date' => date('Y-m-d') . " 00:00:00", 'role_id' => 1, 'status_id' => 1, 'source' => 'Event_' . $eventId, 'contact_id' => $this->_contactId, 'note' => 'Note added for Event_' . $eventId, 'fee_level' => 'Price_Field - 55');
     $participant = CRM_Event_BAO_Participant::add($participantParams);
     //Checking for participant added in the table.
     $this->assertDBCompareValue('CRM_Event_BAO_Participant', $this->_contactId, 'id', 'contact_id', $participant->id, 'Check DB for created participant');
     $values = array();
     $ids = array();
     $params = array('id' => $participant->id);
     CRM_Event_BAO_Participant::getValues($params, $values, $ids);
     $this->assertNotEquals(count($values), 0, 'Checking for empty array.');
     CRM_Event_BAO_Participant::resolveDefaults($values[$participant->id]);
     if ($values[$participant->id]['fee_level']) {
         CRM_Event_BAO_Participant::fixEventLevel($values[$participant->id]['fee_level']);
     }
     $deletePricefield = CRM_Price_BAO_PriceField::deleteField($pricefield->id);
     $this->assertDBNull('CRM_Price_BAO_PriceField', $pricefield->id, 'name', 'id', 'Check DB for non-existence of Price Field.');
     $deletePriceset = CRM_Price_BAO_PriceSet::deleteSet($priceset->id);
     $this->assertDBNull('CRM_Price_BAO_PriceSet', $priceset->id, 'title', 'id', 'Check DB for non-existence of Price Set.');
     Participant::delete($participant->id);
     Contact::delete($this->_contactId);
     Event::delete($eventId);
 }
开发者ID:nganivet,项目名称:civicrm-core,代码行数:39,代码来源:ParticipantTest.php

示例3: deleteParticipants

 private function deleteParticipants()
 {
     //TODO check if participant has any anno in ce
     $params = $this->myNamespace->params;
     $ceId = $this->defaultNamespace->callingActionId;
     if (!isset($params[Participant::COL_ID])) {
         return FALSE;
     }
     $dbAdapter = Zend_Registry::get('DB_CONNECTION1');
     $select = $dbAdapter->select();
     $select->from(array('anno' => Annotations::TABLE_NAME));
     $select->joinLeft(array('cehim' => CeHasImage::TABLE_NAME), 'anno.' . Annotations::COL_CE_HAS_IMAGE_ID . '=' . 'cehim.' . CeHasImage::COL_ID);
     //continue select in loop
     $partIds = $params[Participant::COL_ID];
     foreach ($partIds as $partId) {
         $select->where('anno.' . Annotations::COL_PART_ID . ' = ?', $partId);
         $resultArray = $dbAdapter->fetchAll($select);
         if (empty($resultArray)) {
             //if result array is empty = Array[0], the participant has no annotations in this calibration exercise
             //delete participant
             $part = new Participant();
             $where = $part->getAdapter()->quoteInto(Participant::COL_ID . '= ?', $partId);
             $part->delete($where);
         }
     }
     return TRUE;
 }
开发者ID:blackskaarj,项目名称:webgr,代码行数:27,代码来源:EditparticipantsController.php

示例4: change_group

 public function change_group($participant_id)
 {
     $group_id = $this->input->post('group_id');
     $this->_transaction_isolation();
     $this->db->trans_begin();
     $participant = new Participant();
     $participant->get_by_id($participant_id);
     $group = new Group();
     $group->get_by_id($group_id);
     $course = $participant->course->get();
     if ($group->exists()) {
         if ($group->is_related_to($course)) {
             $participant->save($group);
         }
     } else {
         $current_group = $participant->group->get();
         $participant->delete($current_group);
     }
     $is_ok = TRUE;
     if ($group->exists()) {
         if ($participant->allowed == 1) {
             $group_for_test = new Group();
             $rooms = $group_for_test->room;
             $rooms->select_min('capacity');
             $rooms->where('group_id', '${parent}.id', FALSE);
             $group_for_test->select_subquery($rooms, 'group_capacity');
             $group_for_test->include_related_count('participant');
             $group_for_test->where_related_participant('allowed', 1);
             $group_for_test->get_by_id(intval($participant->group_id));
             if ($group_for_test->exists()) {
                 if (intval($group_for_test->participant_count) > intval($group_for_test->group_capacity)) {
                     $is_ok = FALSE;
                 }
             }
         }
     }
     if ($is_ok && $this->db->trans_status()) {
         $this->db->trans_commit();
         $this->_action_success();
         $this->output->set_internal_value('student_id', $participant->student_id);
         $this->output->set_internal_value('course_id', $participant->course_id);
     } else {
         $this->db->trans_rollback();
     }
     $participant->include_related('group', 'name');
     $participant->get_by_id($participant_id);
     $this->parser->parse('backend/participants/group_column.tpl', array('participant' => $participant));
 }
开发者ID:andrejjursa,项目名称:list-lms,代码行数:48,代码来源:participants.php


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