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


PHP MY_Model::insert方法代码示例

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


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

示例1: insert

	/**
	 * Insert
	 *
     * @access	public
	 * @param	array	$input
	 * @return	mixed
	 */
    public function insert($input = array())
    {
    	return parent::insert(array(
    		'name' => $input['name'],
    		'data' => $input['data']
        ));
    }
开发者ID:reith2004,项目名称:pyrocms,代码行数:14,代码来源:variables_m.php

示例2: insert

 function insert($data)
 {
     if (empty($data['agency_id'])) {
         $data['agency_id'] = rand(0, 99999);
     }
     return parent::insert($data);
 }
开发者ID:rodrigo2000,项目名称:googleTransitUI,代码行数:7,代码来源:Agencias_model.php

示例3: add

 public function add($type = '', $data = array())
 {
     // Attempt to get description text for this type of event
     $description = $this->_get_description($type, $data);
     // Data to insert into database for this entry
     $entry = array('al_pct_id' => 0, 'al_u_id' => $this->session->userdata('u_id'), 'al_type' => $type, 'al_area' => element('area', $data), 'al_uri' => $this->uri->uri_string(), 'al_description' => $description, 'al_datetime' => date('Y-m-d H:i:s'), 'al_ua' => $this->agent->agent_string(), 'al_browser' => $this->agent->browser() . ' ' . $this->agent->version(), 'al_ip' => $this->input->ip_address());
     return parent::insert($entry);
 }
开发者ID:nomoregrapes,项目名称:Fair-Food-Carlisle---Community-Edition,代码行数:8,代码来源:activity_log_model.php

示例4: insert_gallery

 /**
  * Insert a new gallery into the database
  *
  * @author PyroCMS Dev Team
  * @access public
  * @param array $input The data to insert (a copy of $_POST)
  * @return bool
  */
 public function insert_gallery($input, $skip_validation = false)
 {
     if (is_array($input['folder_id'])) {
         $folder = $input['folder_id'];
         $input['folder_id'] = $this->file_folders_m->insert(array('name' => $folder['name'], 'parent_id' => 0, 'slug' => $folder['slug'], 'date_added' => now()));
     }
     return (int) parent::insert(array('title' => $input['title'], 'slug' => $input['slug'], 'folder_id' => $input['folder_id'], 'thumbnail_id' => !empty($input['gallery_thumbnail']) ? (int) $input['gallery_thumbnail'] : NULL, 'description' => $input['description'], 'enable_comments' => $input['enable_comments'], 'published' => $input['published'], 'updated_on' => time(), 'css' => $input['css'], 'js' => $input['js']));
 }
开发者ID:jacksun101,项目名称:PyroAddons,代码行数:16,代码来源:gallery_m.php

示例5: insert

 /**
  * Insert new media
  */
 public function insert($path)
 {
     if (!file_exists($path)) {
         return false;
     }
     $res = \Cloudinary\Uploader::upload($path);
     $this->public_id = $res['public_id'];
     return parent::insert();
 }
开发者ID:novaskideveloper,项目名称:PeaceLabs,代码行数:12,代码来源:media_model.php

示例6: save

 /**
  * Prepare the text fields and save them
  *
  * @param int $id
  * @return bool|int
  */
 public function save($data = '')
 {
     if (!empty($data[$this->pkey])) {
         $this->delete($data[$this->pkey]);
     }
     $data['full'] = prepare_text($data['original']);
     $data['short'] = mb_strcut($data['full'], 0, 250);
     // @todo: 250 should be in CONFIG
     return parent::insert($data);
 }
开发者ID:ak826843,项目名称:bmf,代码行数:16,代码来源:text.php

示例7: insert_ajax

	/**
	 * Insert a new category into the database via ajax
	 * @access public
	 * @param array $input The data to insert
	 * @return int
	 */
	public function insert_ajax($input = array())
	{
		$this->load->helper('text');
		return parent::insert(array(
				'title'=>$input['title'],
				//is something wrong with convert_accented_characters?
				//'slug'=>url_title(strtolower(convert_accented_characters($input['title'])))
				'slug' => url_title(strtolower($input['title']))
				));
	}
开发者ID:reith2004,项目名称:pyrocms,代码行数:16,代码来源:blog_categories_m.php

示例8: update

 /**
  * Update resource details
  *
  * @access public
  * @param int $resource_id
  * @param array $attributes
  * @return void
  */
 function update($resource_id = 0, $attributes = array())
 {
     if ($resource_id > 0 && !$this->get_by_name($attributes['name'], $resource_id)) {
         // Update
         return parent::update($resource_id, $attributes);
     } elseif (!$this->get_by_name($attributes['name'])) {
         // Insert
         return parent::insert($attributes);
     } else {
         return FALSE;
     }
 }
开发者ID:ardissoebrata,项目名称:ci-beam,代码行数:20,代码来源:Resource_model.php

示例9: insert_gallery

 /**
  * Insert a new gallery into the database
  *
  * @author Yorick Peterse - PyroCMS Dev Team
  * @access public
  * @param array $input The data to insert (a copy of $_POST)
  * @return bool
  */
 public function insert_gallery($input)
 {
     // Get rid of everything we don't need
     $to_insert = array('title' => $input['title'], 'slug' => $this->generate_slug($input['title']), 'parent' => !empty($input['parent_id']) ? (int) $input['parent_id'] : 0, 'description' => $input['description'], 'enable_comments' => $input['enable_comments'], 'published' => $input['published'], 'updated_on' => time());
     // First we create the directories (so that we can delete them in case something goes wrong)
     if ($this->create_folders($input['title']) === TRUE) {
         // Insert the data into the database
         $insert_id = parent::insert($to_insert);
         // Everything ok?
         return $insert_id >= 0;
     }
     return FALSE;
 }
开发者ID:revolveweb,项目名称:pyrocms,代码行数:21,代码来源:galleries_m.php

示例10: insert

 function insert($image = array(), $album_id = '', $description)
 {
     $this->load->helper('date');
     $filename = $image['file_name'];
     $image_cfg['image_library'] = 'GD2';
     $image_cfg['source_image'] = APPPATH . 'assets/img/photos/' . $album_id . '/' . $filename;
     $image_cfg['create_thumb'] = TRUE;
     $image_cfg['maintain_ratio'] = TRUE;
     $image_cfg['width'] = '150';
     $image_cfg['height'] = '125';
     $this->load->library('image_lib', $image_cfg);
     $this->image_lib->resize();
     return parent::insert(array('filename' => $filename, 'album_id' => $album_id, 'description' => $description, 'updated_on' => now()));
 }
开发者ID:netfreak,项目名称:pyrocms,代码行数:14,代码来源:photos_m.php

示例11: update_site_views

 /**
  * Updates (unique) site view. Works by checking
  * if visitor's IP or user ID is already in the database,
  * if it's not then inserts a view into the database
  * @param  int $userID User ID
  * @return object
  */
 public function update_site_views($userID = NULL)
 {
     // Set MY_Model table
     $this->_table = 'site_views';
     // Get IP and convert it to int
     $ip = ip2long($_SERVER['REMOTE_ADDR']);
     // Set date
     $date = date('Y-m-d H:i:m');
     // Check for unique view
     if (!$this->has_viewed($ip, $userID)) {
         $data = array('ip' => $ip, 'user' => $userID, 'date' => $date);
         parent::insert($data);
     }
 }
开发者ID:karlomikus,项目名称:CometCI,代码行数:21,代码来源:comet_m.php

示例12: save_activity

 public function save_activity($uid, $activity_type, $link = null, $descr = null)
 {
     $activity = ['user_id' => $uid, 'activity' => $activity_type];
     if ($link != null) {
         $activity['link'] = $link;
     }
     if ($descr != null) {
         $activity['description'] = $descr;
     }
     if (parent::insert($activity)) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:andela-cnnadi,项目名称:paruto,代码行数:15,代码来源:activity_model.php

示例13: insert

 public function insert($story, $user_id)
 {
     $this->form_validation->set_rules('headline', 'Headline', 'trim|required|min_length[3]|max_length[100]|xss_clean');
     $this->form_validation->set_rules('story', 'News Content', 'trim|required|xss_clean');
     if ($this->form_validation->run()) {
         $story['user_id'] = $user_id;
         if ($id = parent::insert($story)) {
             return isset($id) ? $id : true;
         } else {
             return false;
         }
     } else {
         return false;
     }
 }
开发者ID:andela-cnnadi,项目名称:paruto,代码行数:15,代码来源:story_model.php

示例14: add

    function add($input = array())
    {
	$this->load->helper('date');

        return parent::insert(array(
	    'email'				=> $input->email,
	    'password'			=> $input->password,
	    'salt'				=> $input->salt,
	    'first_name' 		=> ucwords(strtolower($input->first_name)),
	    'last_name' 		=> ucwords(strtolower($input->last_name)),
	    'role' 				=> empty($input->role) ? 'user' : $input->role,
	    'is_active' 		=> 0,
	    'lang'				=> $this->config->item('default_language'),
	    'activation_code' 	=> $input->activation_code,
	    'created_on' 		=> now(),
	    'last_login'		=> now(),
	    'ip' 				=> $this->input->ip_address()
        ));
    }
开发者ID:JamieLomas,项目名称:pyrocms,代码行数:19,代码来源:users_m.php

示例15: insert

	public function insert($data=array()) 
	{
		list($password, $salt) = $this->hash_password($data['password']);
		
		unset($data['password'], $data['pass_confirm'], $data['submit']);
		
		$data['password_hash'] = $password;
		$data['salt'] = $salt;
		
		$data['zipcode'] = isset($data['zipcode']) ? (int)$data['zipcode'] : null;
		$data['zip_extra'] = isset($data['zip_extra']) ? (int)$data['zip_extra'] : null;
		
		// What's the default role?
		if (!isset($data['role_id']))
		{
			$data['role_id'] = $this->role_model->default_role_id();
		}
		
		return parent::insert($data);
	}
开发者ID:ndcisiv,项目名称:Bonfire,代码行数:20,代码来源:user_model.php


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