本文整理汇总了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);
}
示例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);
}
}
示例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;
}
示例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);
}
}
示例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);
}
示例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));
}
示例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));
}
示例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);
}
示例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);
}
示例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;
}
示例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();
}
示例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();
}
}
示例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);
}
示例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);
}
示例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);
}