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


PHP Model::update方法代码示例

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


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

示例1: update

 function update($data, Criteria $c)
 {
     parent::update($data, $c);
     $comment = $this->find($c);
     $siteId = $comment->siteId;
     $this->updateSiteCommentsCount($siteId);
 }
开发者ID:reinfire,项目名称:arfooo,代码行数:7,代码来源:CommentModel.php

示例2: edit

 public function edit($postArr)
 {
     if (empty($postArr['Id'])) {
         return array('status' => -1, 'msg' => '请选择要更新的问卷', 'href' => 1);
     }
     if (empty($postArr['title'])) {
         return array('status' => -1, 'msg' => '请填写标题', 'href' => 1);
     }
     if (empty($postArr['description'])) {
         return array('status' => -1, 'msg' => '请填写描述', 'href' => 1);
     }
     if (empty($postArr['start_time'])) {
         return array('status' => -1, 'msg' => '请选择开始时间', 'href' => 1);
     }
     if (empty($postArr['end_time'])) {
         return array('status' => -1, 'msg' => '请选择结束时间', 'href' => 1);
     }
     $this->_utilRbac = $this->_getGlobalData('Util_Rbac', 'object');
     $userClass = $this->_utilRbac->getUserClass();
     $updateArr = array();
     $updateArr['title'] = $postArr['title'];
     $updateArr['description'] = $postArr['description'];
     $updateArr['start_time'] = strtotime($postArr['start_time']);
     $updateArr['end_time'] = strtotime($postArr['end_time']);
     $updateArr['status'] = $postArr['status'];
     $updateArr['user_id'] = $userClass['_id'];
     if (parent::update($updateArr, "Id={$postArr['Id']}")) {
         return array('status' => 1, 'msg' => false, 'href' => 1);
     } else {
         return array('status' => -2, 'msg' => '编辑问卷失败', 'href' => 1);
     }
 }
开发者ID:huangwei2wei,项目名称:kfxt,代码行数:32,代码来源:Askform.class.php

示例3: update

 /**
  *
  */
 public function update($data, $cond = null, $bind_params = null)
 {
     $cond = 'WHERE id = :id';
     $bind_params = array(':id' => $data[$this->table_name]['id']);
     $res = parent::update($data, $cond, $bind_params);
     return $res;
 }
开发者ID:nikitiki,项目名称:matching-system,代码行数:10,代码来源:team.php

示例4: save

 /**
  * Save user data
  * 
  * @param type $userInfo
  * @return int userId
  */
 public function save($userInfo)
 {
     if (isset($userInfo["id"]) && (int) $userInfo["id"] > 0) {
         return parent::update($userInfo, array('id' => $userInfo["id"]));
     } else {
         return parent::create($userInfo);
     }
 }
开发者ID:afgundogdu,项目名称:peaky,代码行数:14,代码来源:User_Model.php

示例5: setLoginDetails

 public function setLoginDetails()
 {
     $where = array("user='{$this->R['user']}'");
     $updateData['login_count'] = array('login_count+1');
     $updateData['last_ip'] = Tool::getIP();
     $updateData['last_time'] = Tool::getDate();
     parent::update($where, $updateData);
 }
开发者ID:zhendeguoke1008,项目名称:shop-1,代码行数:8,代码来源:ManageModel.class.php

示例6: selected

 public function selected()
 {
     $where = array("id='{$this->R['id']}'");
     if (!$this->check->checkOne($this, $where)) {
         $this->check->showError();
     }
     parent::update(array("user='{$_COOKIE['user']}'"), array('selected' => 0));
     return parent::update($where, array('selected' => 1));
 }
开发者ID:zhendeguoke1008,项目名称:shop-1,代码行数:9,代码来源:AddressModel.class.php

示例7: setFirst

 public function setFirst()
 {
     $where = array("id='{$this->R['id']}'");
     if (!$this->check->checkOne($this, array("id='{$this->R['id']}'"))) {
         $this->check->showError();
     }
     parent::update(array("first=1"), array('first' => 0));
     return parent::update($where, array('first' => 1));
 }
开发者ID:zhendeguoke1008,项目名称:shop-1,代码行数:9,代码来源:ServiceModel.class.php

示例8: updateById

 /**
  * @param $id
  * @param array $values
  * @param array $valuesUnescaped
  * @throws DbalException
  * @return bool|int|string
  */
 public function updateById($id, $values = array(), $valuesUnescaped = array())
 {
     if (!intval($id)) {
         throw new DbalException('Id required');
     }
     $this->deleteNonExistingColumns($values);
     $this->deleteNonExistingColumns($valuesUnescaped);
     return $this->model->update($this->table, $this->idColum, intval($id), $values, $valuesUnescaped);
 }
开发者ID:kxopa,项目名称:slim-boilerplate,代码行数:16,代码来源:TableModel.php

示例9: updateUser

 /**
  * 更新用户信息
  *
  * @param int $uid
  * @param array $setdata
  * @return bool
  */
 public function updateUser($uid, $setdata)
 {
     $updata = array();
     foreach ($setdata as $key => $val) {
         $updata[$key] = addslashes(trim($val));
     }
     unset($setdata);
     $where = $this->getAdapter()->bind('uid = ?', $uid);
     return parent::update($updata, $where);
 }
开发者ID:atlas1308,项目名称:testtesttestfarm,代码行数:17,代码来源:user.php

示例10: edit

 public static function edit($fields, $id)
 {
     ///clean all fields so they are not harmful to the database
     $fields = Model::cleanData($fields);
     //construct sql query to update username
     $sql = 'UPDATE posts SET title = "' . $fields['title'] . '", text = "' . $fields['text'] . '" WHERE id = ' . $id;
     $results = Model::update($sql);
     //return results to controller
     return $results;
 }
开发者ID:SafirX,项目名称:gdi-php-mvc,代码行数:10,代码来源:post.php

示例11: update

 function update()
 {
     // clear all null keys (use array_filter?)
     foreach ($this->rs as $k => $v) {
         if (is_null($v)) {
             unset($this->rs[$k]);
         }
     }
     $this->rs['updated'] = time('now');
     return parent::update();
 }
开发者ID:makesites,项目名称:kisscms,代码行数:11,代码来源:Page.php

示例12: updateData

 private function updateData()
 {
     $tempData = reset($this->modelInstance->getWithField2($this->secondaryKey, $this->modelData[$this->secondaryKey]));
     if ($tempData !== false) {
         if ($this->tertiaryKey != "") {
             $this->modelData[$this->primaryKey] = $tempData[$this->primaryKey];
             $this->modelData[$this->tertiaryKey] = $tempData[$this->tertiaryKey];
         }
         $validated = $this->modelInstance->setData($this->modelData, $this->primaryKey, $tempData[$this->primaryKey]);
         if ($validated === true) {
             $this->modelInstance->update($this->primaryKey, $tempData[$this->primaryKey]);
             $this->updated++;
             return 'Updated';
         } else {
             return $validated;
         }
     } else {
         return $this->addData();
     }
 }
开发者ID:ekowabaka,项目名称:wyf,代码行数:20,代码来源:MCDataImporterJob.php

示例13: update

 public function update()
 {
     $where = array("id='{$this->R['id']}'");
     if (!$this->check->checkOne($this, $where)) {
         $this->check->showError();
     }
     if (!$this->check->checkUpdate($this)) {
         $this->check->showError();
     }
     $updateData = $this->getRequest()->filter($this->fields);
     return parent::update($where, $updateData);
 }
开发者ID:zhendeguoke1008,项目名称:shop-1,代码行数:12,代码来源:BrandModel.class.php

示例14: update

 public function update()
 {
     $_where = array("id='{$this->_R['id']}'");
     if (!$this->_check->oneCheck($this, $_where)) {
         $this->_check->error();
     }
     if (!$this->_check->updateCheck($this)) {
         $this->_check->error();
     }
     $_updateData = $this->getRequest()->filter($this->_fields);
     return parent::update($_where, $_updateData);
 }
开发者ID:yjf0503,项目名称:Mall,代码行数:12,代码来源:DeliveryModel.class.php

示例15: update

 public function update()
 {
     $where = array("id='{$this->R['id']}'");
     if (!$this->check->checkOne($this, $where)) {
         $this->check->showError();
     }
     if (!$this->check->checkUpdate($this, array("id<>'{$this->R['id']}'", "name='{$this->R['name']}'"))) {
         $this->check->showError();
     }
     $updateData = $this->getRequest()->filter($this->fields);
     $updateData['nav'] = implode(',', $updateData['nav']);
     return parent::update($where, $updateData);
 }
开发者ID:zhendeguoke1008,项目名称:shop-1,代码行数:13,代码来源:AttrModel.class.php


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