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


PHP ActiveRecord::update方法代码示例

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


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

示例1: Modificar

 public function Modificar()
 {
     $data = $this->VerPerfil();
     $db = new db();
     $db->connect();
     $C = new ActiveRecord('fk_perfiles');
     $C->fields['nombre_perfil'] = $this->nombre_perfil;
     $C->fields['descripcion'] = $this->descripcion;
     if ($data) {
         $C->fields['id_perfil'] = $this->id_perfil;
         $C->update();
     } else {
         $C->insert();
     }
     $db->close();
 }
开发者ID:mtaisigue,项目名称:albaranes,代码行数:16,代码来源:Perfil.php

示例2: saveObject

 /**
  * @return bool
  */
 public function saveObject()
 {
     if (!$this->beforeSave()) {
         return false;
     }
     global $ilUser;
     /**
      * @var ilObjUser $ilUser
      */
     if (!$this->setArFieldsAfterSubmit()) {
         return false;
     }
     $modified_by_field = $this->getFields()->getModifiedByField();
     if ($modified_by_field) {
         $set_modified_by_function = $modified_by_field->getSetFunctionName();
         $this->ar->{$set_modified_by_function}($ilUser->getId());
     }
     $modification_date_field = $this->getFields()->getModificationDateField();
     if ($modification_date_field) {
         $set_modification_date_function = $modification_date_field->getSetFunctionName();
         $datetime = new ilDateTime(time(), IL_CAL_UNIX);
         $this->ar->{$set_modification_date_function}($datetime);
     }
     if ($this->ar->getPrimaryFieldValue() != 0) {
         $this->ar->update();
     } else {
         $created_by_field = $this->getFields()->getCreatedByField();
         if ($created_by_field) {
             $set_created_by_function = $created_by_field->getSetFunctionName();
             $this->ar->{$set_created_by_function}($ilUser->getId());
         }
         $creation_date_field = $this->getFields()->getCreationDateField();
         if ($creation_date_field) {
             $set_creation_date_function = $creation_date_field->getSetFunctionName();
             $datetime = new ilDateTime(time(), IL_CAL_UNIX);
             $this->ar->{$set_creation_date_function}($datetime);
         }
         $this->ar->create();
     }
     return $this->afterSave();
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:44,代码来源:class.arEditGUI.php

示例3: update

 public function update()
 {
     global $ilUser;
     $this->setOwner($ilUser->getId());
     $this->setUpdateDate(time());
     parent::update();
 }
开发者ID:JKN-INC,项目名称:UserDefaults,代码行数:7,代码来源:class.ilUDFCheck.php

示例4: update

 public function update()
 {
     global $ilUser;
     $this->setOwner($ilUser->getId());
     $this->setUpdateDate(time());
     if (!$this->hasChecks() and $this->getStatus() == self::STATUS_ACTIVE) {
         ilUtil::sendInfo(ilUserDefaultsPlugin::getInstance()->txt('msg_activation_failed'));
         ilUtil::sendInfo(ilUserDefaultsPlugin::getInstance()->txt('msg_activation_failed'), true);
         $this->setStatus(self::STATUS_INACTIVE);
     }
     parent::update();
 }
开发者ID:JKN-INC,项目名称:UserDefaults,代码行数:12,代码来源:class.ilUserSetting.php

示例5: saveLines

 private function saveLines()
 {
     $tableId = $this->tableId;
     $total = fk_post($tableId . '_tot');
     for ($i = 1; $i <= $total; $i++) {
         $id_rec = fk_post($tableId . '_recId-' . $i);
         $Ar = new ActiveRecord($this->table_name);
         if ($id_rec > 0) {
             //UPDATE
             //procesar fields to save
             foreach ($this->fields_to_save as $key => $value_from) {
                 $arr_src = array('{table-id}', '{row-id}');
                 $arr_repl = array($tableId . '_', '-' . $i);
                 $value = str_replace($arr_src, $arr_repl, $value_from);
                 $Ar->fields[$key] = fk_post($value);
             }
             $Ar->fields[$this->record_id_name] = $id_rec;
             $Ar->display_queries = true;
             $Ar->update();
         } else {
             //INSERT
             //procesar fields to save
             foreach ($this->fields_to_save as $key => $value_from) {
                 $arr_src = array('{table-id}', '{row-id}');
                 $arr_repl = array($tableId . '_', '-' . $i);
                 $value = str_replace($arr_src, $arr_repl, $value_from);
                 $Ar->fields[$key] = fk_post($value);
             }
             $Ar->insert();
         }
     }
 }
开发者ID:mmendoza000,项目名称:freekore,代码行数:32,代码来源:AppSpreadSheet.php

示例6: update

 /**
  * Also update placeholder values and settings.
  * If the certificate type did change, delete old settings/placeholder values and create new default ones from new type.
  *
  */
 public function update()
 {
     /** @var $setting srCertificateDefinitionSetting */
     /** @var $pl srCertificatePlaceholderValue */
     if ($this->type_changed) {
         $this->signature_id = 0;
         // Reset signature
     }
     parent::update();
     // If the type did change, we destroy all settings + placeholder values from the old type and create new ones
     if ($this->type_changed) {
         foreach ($this->getSettings() as $setting) {
             $setting->delete();
         }
         foreach ($this->getCustomSettings() as $custom_setting) {
             $custom_setting->delete();
         }
         foreach ($this->getPlaceholderValues() as $pl) {
             $pl->delete();
         }
         $this->createSettings();
         $this->createPlaceholderValues();
     } else {
         foreach ($this->getSettings() as $setting) {
             $setting->update();
         }
         foreach ($this->getCustomSettings() as $setting) {
             $setting->update();
         }
         foreach ($this->getPlaceholderValues() as $pl) {
             $pl->update();
         }
     }
 }
开发者ID:studer-raimann,项目名称:Certificate,代码行数:39,代码来源:class.srCertificateDefinition.php

示例7: generarConsecutivo

 public static function generarConsecutivo($codigo, $increment = true)
 {
     // GenerarConsecutivo
     $Configsys = new ActiveRecord('config_sys');
     $tot_contador = $Configsys->find_where('config_code = "' . $codigo . '" ');
     if ($tot_contador == 0) {
         // No existe
         $numero_consecutivo = 1;
         if ($increment == true) {
             $Configsys->fields['config_code'] = $codigo;
             $Configsys->fields['config_value'] = $numero_consecutivo;
             $Configsys->insert();
         }
     } else {
         // Si existe
         $numero_consecutivo = $Configsys->fields['config_value'] + 1;
         // INCREMENTA
         if ($increment == true) {
             $Configsys->fields['config_value'] = $numero_consecutivo;
             $numero_consecutivo = $Configsys->fields['config_value'];
             $Configsys->update();
         }
     }
     return $numero_consecutivo;
 }
开发者ID:mmendoza000,项目名称:freekore,代码行数:25,代码来源:appform.v2.php

示例8: ModificarAdmin

 public function ModificarAdmin()
 {
     $data = $this->VerUsuario();
     $db = new db();
     $db->connect();
     $C = new ActiveRecord('usuarios');
     $C->fields['usuario'] = $this->usuario;
     $C->fields['nombre'] = $this->nombre;
     $C->fields['apellidos'] = $this->apellidos;
     $C->fields['id_tipo'] = $this->id_tipo;
     $un = strtoupper($this->nombre[0] . $this->apellidos[0]);
     $x = '';
     do {
         $username = $un . $x;
         $sql = 'SELECT * FROM usuarios WHERE usuario = "' . $username . '"';
         if ($data) {
             $sql .= ' AND id_usuario != ' . $this->id_usuario;
         }
         $db->query($sql);
         $f = $db->next();
         $x++;
     } while ($f != 0);
     $C->fields['usuario'] = $username;
     if ($this->password != '') {
         $C->fields['password'] = md5($this->password);
     }
     $C->fields['email'] = $this->email;
     if ($this->id_perfil != 0) {
         $C->fields['id_perfil'] = $this->id_perfil;
     }
     if ($data) {
         $C->fields['id_usuario'] = $this->id_usuario;
         $C->update();
     } else {
         $C->fields['fecha_reg'] = $this->fecha_reg;
         $C->insert();
     }
     $db->close();
 }
开发者ID:mtaisigue,项目名称:albaranes,代码行数:39,代码来源:Usuario.php

示例9: update

 protected function update()
 {
     $this->executePlugins($this, 'update');
     $res = parent::update();
     $this->executePlugins($this, 'save');
     return $res;
 }
开发者ID:saiber,项目名称:www,代码行数:7,代码来源:ActiveRecordModel.php

示例10: update

 public function update()
 {
     parent::update();
     if ($this->hasStatusChanged()) {
         // Status has changed
         $this->event_handler->raise('Certificate/srCertificate', 'changeStatus', array('object' => $this, 'old_status' => $this->old_status, 'new_status' => $this->status));
     }
     $this->event_handler->raise('Certificate/srCertificate', 'update', array('object' => $this));
     $this->old_status = null;
 }
开发者ID:studer-raimann,项目名称:Certificate,代码行数:10,代码来源:class.srCertificate.php

示例11: send_password

 public function send_password()
 {
     Context::get('db')->start_transaction();
     // set new password
     $this->password = substr(str_shuffle('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'), 0, 8);
     $this->create_new_salt();
     $this->encrypt_password($this->password, $this->salt);
     parent::update();
     // send email
     text_mail($this->email, "임시 비밀번호 발급 안내", "임시 비밀번호는 \"{$this->password}\" 입니다.");
     Context::get('db')->commit();
 }
开发者ID:utumdol,项目名称:codeseed,代码行数:12,代码来源:user.class.php

示例12: update

 public function update()
 {
     $this->mapToActiveRecord();
     parent::update();
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:5,代码来源:class.arStorage.php


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