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


PHP ActiveRecord::insert方法代码示例

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


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

示例1: GuardarAlbaranes

 public function GuardarAlbaranes()
 {
     $db = new db();
     $db->connect();
     $C = new ActiveRecord('albaranes');
     $C->fields["fecha"] = $this->fecha;
     $C->fields["operacion"] = $this->operacion;
     $C->fields["guia"] = $this->guia;
     $C->fields["remitente"] = $this->remitente;
     $C->fields["beneficiario"] = $this->beneficiario;
     $C->fields["documento"] = $this->documento;
     $C->fields["pais"] = $this->pais;
     $C->fields["direccion"] = $this->direccion;
     $C->fields["ciudad"] = $this->ciudad;
     $C->fields["telefono"] = $this->telefono;
     $C->fields["descripcion"] = $this->descripcion;
     $C->fields["peso"] = $this->peso;
     $C->fields["comision"] = $this->comision;
     $C->fields["seguro"] = $this->seguro;
     $C->fields["iv"] = $this->iv;
     $C->fields["total"] = $this->total;
     $C->fields["direccion_agencia"] = $this->direccion_agencia;
     $C->insert();
     $db->close();
 }
开发者ID:mtaisigue,项目名称:albaranes,代码行数:25,代码来源:Pais.php

示例2: importToDB

 public function importToDB()
 {
     $GLOBALS['FORCE_INSERT_ID'] = true;
     $rows = fk_post('rows');
     $Ar = new ActiveRecord($this->tableName);
     $tot_importados = 0;
     if (count($rows) > 0) {
         foreach ($rows as $lineNo) {
             $cols = fk_post('txt_' . $lineNo);
             // Campos importados
             foreach ($cols as $colNo => $colVal) {
                 // procesar reglas
                 $fieldName = fk_post('col-' . $colNo);
                 $colVal = $this->getVal($colVal, $fieldName);
                 if ($fieldName != '') {
                     $Ar->fields[$fieldName] = utf8_decode($colVal);
                     //echo $colVal;
                 }
             }
             // Campos fijos [SOBRE ESCRIBE]
             foreach ($this->fixedC as $fixedColNo => $FixedColVal) {
                 $Ar->fields[$fixedColNo] = $FixedColVal;
             }
             if ($Ar->insert()) {
                 $this->registros_importados++;
             }
         }
         return true;
     } else {
         $this->result_message = 'No se importo ningun registro';
         return false;
     }
 }
开发者ID:mmendoza000,项目名称:freekore,代码行数:33,代码来源:FileImporter.class.php

示例3: CrearPerfilPriv

 public function CrearPerfilPriv()
 {
     $db = new db();
     $db->connect();
     $C = new ActiveRecord('fk_perfiles_privs');
     $C->fields['id_usuario'] = $this->id_perfil;
     $C->fields['id_priv'] = $this->id_priv;
     $C->fields['access'] = $this->access;
     $C->insert();
     $db->close();
 }
开发者ID:mtaisigue,项目名称:albaranes,代码行数:11,代码来源:Perfil.php

示例4: createSelectRecords

 /**
  *@package AppForm
  *@method createSelectRecords()
  *@desc allows adding records to a select list from appform
  *@since v0.3.4
  **/
 private function createSelectRecords($operation)
 {
     //crear opciones de <select> nuevas
     if ($operation == 'save') {
         foreach ($this->DbRecord->form_fields as $field => $properties) {
             $post_field_name = $this->encode_fields ? encode($field) : $field;
             if ($properties['Type'] == 'select' && fk_post($post_field_name) == 'new') {
                 // if allows adding new
                 if (isset($properties['add_new'])) {
                     //
                     $Ar = new ActiveRecord($properties['add_new']['table_name']);
                     foreach ($properties['add_new']['field'] as $new_field => $new_val) {
                         $Ar->fields[$new_field] = utf8_decode($new_val);
                     }
                     $Ar->insert();
                     $_POST[$post_field_name] = $Ar->inserted_id();
                 }
             }
             // if allows adding new
         }
         // foreach field
     }
     // if save
 }
开发者ID:mmendoza000,项目名称:freekore,代码行数:30,代码来源:appform.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: 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

示例7: insert

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


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