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


PHP Participant::update方法代码示例

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


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

示例1: update

 public static function update($id)
 {
     self::check_admin_logged_in();
     $attributes = self::get_attributes();
     $attributes['id'] = $id;
     $attributes['competition_name'] = Competition::find($attributes['competition_id'])->name;
     $attributes['competitor_name'] = Competitor::find($attributes['competitor_id'])->name;
     $attributes['standing'] = Participant::find($id)->standing;
     $participant = new Participant($attributes);
     $errors = $participant->validate_number();
     if (count($errors) == 0) {
         $participant->update();
         Redirect::to('/competition/' . $participant->competition_id . '/participants', array('message' => 'Kilpailijan numeroa muokattu onnistuneesti!'));
     } else {
         self::edit_view(array(Competition::find($participant->competition_id)), array(Competitor::find($participant->competitor_id)), $attributes, $errors);
     }
 }
开发者ID:eerojala,项目名称:Hiihtokilpailujen-tulospalvelu,代码行数:17,代码来源:participant_controller.php

示例2: applySettingsToParticipants

 private function applySettingsToParticipants()
 {
     //only checked attributes are processed
     //returns FALSE if no attribute and/or no participant is checked
     //works only for single-Select-Inputs!
     //checked value = COL_NAME
     //form control name = COL_NAME
     //form control value = CELL_VALUE
     $partAttrs = $this->getRequest()->getParam('participantAttributeChecked');
     if ($partAttrs == NULL) {
         //no attribute checked
         return FALSE;
     }
     $data = array();
     foreach ($partAttrs as $attr => $attrName) {
         $attrValue = $this->getRequest()->getParam($attrName);
         //boolean: write 1 instead of "on" to database
         if ($attrName == Participant::COL_STOCK_ASSESSMENT && $attrValue == "on") {
             $attrValue = 1;
         }
         $data = $data + array($attrName => $attrValue);
     }
     //echo $data;
     $partIds = $this->getRequest()->getParam(Participant::COL_ID);
     if ($partIds == NULL) {
         //no participant checked
         return FALSE;
     }
     $part = new Participant();
     foreach ($partIds as $partId) {
         $where = $part->getAdapter()->quoteInto(Participant::COL_ID . ' = ?', $partId);
         $part->update($data, $where);
     }
     $this->redirectTo('index');
     return TRUE;
 }
开发者ID:blackskaarj,项目名称:webgr,代码行数:36,代码来源:EditparticipantsController.php


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