public function delete($field_id) { $this->db->where('field_id', $field_id); $field = $this->db->get('mcb_fields')->row(); $this->drop_column($field->object_id, 'custom_' . $field->field_index); parent::delete(array('field_id' => $field_id)); }
public function delete($id) { // Delete a page parent::delete($id); // Reset parent ID for its children $this->db->set(['parent_id' => 0])->where('parent_id', $id)->update($this->_table_name); }
public function delete($id) { /* Delete a page */ parent::delete($id); /* Reset parent ID for its children */ $this->db->set(array('parent_id' => 0))->where('parent_id', $id)->update($this->_table_name); }
public function delete($tenancy_id) { $this->load->model('miniant/tenancy_log_model'); parent::delete($tenancy_id); $this->tenancy_log_model->delete_tenancy($tenancy_id); return null; }
public function delete($id) { $custom_field = $this->get_by_id($id); $exists = $this->db->query("SHOW COLUMNS FROM `" . $custom_field->custom_field_table . "` LIKE " . $this->db->escape($custom_field->custom_field_column)); if ($exists->num_rows() == 1) { $this->db->query("ALTER TABLE `" . $custom_field->custom_field_table . "` DROP `" . $custom_field->custom_field_column . "`"); } parent::delete($id); }
function delete($id = 0) { $this->load->helper('file'); // Delete all files within the album delete_files($this->albums_dir . $id, TRUE); // Delete the album too @rmdir($this->albums_dir . $id); $this->db->delete('photos', array('album_id' => $id)); return parent::delete($id); }
public function hapus_slide($id = 0) { $data = parent::get($id); if (file_exists($data->slide_image)) { unlink($data->slide_image); } if (file_exists($data->slide_thumb)) { unlink($data->slide_thumb); } parent::delete($id); }
/** * Deletes a blog category only if it doesn't have any articles in it * @param int $id Blog Category ID * @return bool */ public function delete($id) { if (empty($id)) { return FALSE; } // get portfolios by category id $articles = $this->check_article_by_cat($id); if (!empty((array) $articles)) { return json_encode(array('error' => 1)); } return parent::delete($id); }
public function delete($id_or_fields) { if (is_array($id_or_fields)) { $job_sites = $this->get($id_or_fields); } else { $job_sites = array($this->get($id_or_fields)); } $result = parent::delete($id_or_fields); foreach ($job_sites as $job_site) { $bookings = $this->booking_model->get(array('job_site_id' => $job_site->id)); foreach ($bookings as $booking) { $this->booking_model->delete($booking->id); } } $this->db->query("DELETE FROM `building_bookings` WHERE job_site_id NOT IN ( SELECT id FROM building_job_sites)"); return $result; }
public function delete($id_or_fields) { if (is_array($id_or_fields)) { $tradesmen = $this->get($id_or_fields); } else { $tradesmen = array($this->get($id_or_fields)); } $result = parent::delete($id_or_fields); foreach ($tradesmen as $tradesman) { $bookings = $this->booking_model->get(array('tradesman_id' => $tradesman->id)); foreach ($bookings as $booking) { $this->booking_model->delete($booking->id); } } $this->db->query("DELETE FROM `building_bookings` WHERE tradesman_id NOT IN ( SELECT id FROM building_tradesmen)"); return $result; }
public function delete($id_or_fields) { if (is_array($id_or_fields)) { $bookings = $this->get($id_or_fields); } else { $bookings = array($this->get($id_or_fields)); } $result = parent::delete($id_or_fields); foreach ($bookings as $booking) { $recipients = $this->booking_recipient_model->get(array('booking_id' => $booking->id)); foreach ($recipients as $recipient) { $this->booking_recipient_model->delete($recipient->id); } } $this->db->query("DELETE FROM `building_booking_recipients` WHERE booking_id NOT IN ( SELECT id FROM building_bookings)"); return $result; }
public function delete($client_id) { $this->load->model('invoices/mdl_invoices'); /* Delete the client record */ parent::delete(array('client_id' => $client_id)); /* Delete any related contacts */ $this->db->where('client_id', $client_id); $this->db->delete('mcb_contacts'); /* * Delete any related invoices, but use the invoice model so records * related to the invoice are also deleted */ $this->db->select('invoice_id'); $this->db->where('client_id', $client_id); $invoices = $this->db->get('mcb_invoices')->result(); foreach ($invoices as $invoice) { $this->mdl_invoices->delete($invoice->invoice_id); } }
function delete($id) { /* TODO: This code does not work anymore. We should fix. // Delete files from the file host. if($data = $this->get_by_id($id)) { switch($data['CMS_MediaStore']) { case 'rackspace-cloud-files': $this->load->spark('cloudmanic-storage/1.0.4'); $this->storage->load_driver('rackspace-cf'); $this->storage->delete_file($this->data['cms']['cp_media_rackspace_container'], $data['CMS_MediaPath'] . $data['CMS_MediaFile']); // Delete thumb if($data['CMS_MediaIsImage']) { $this->storage->delete_file($this->data['cms']['cp_media_rackspace_container'], $data['CMS_MediaPathThumb'] . $data['CMS_MediaFileThumb']); } break; case 'amazon-web-services-s3': $this->load->spark('cloudmanic-storage/1.0.4'); $this->storage->load_driver('amazon-s3'); $this->storage->delete_file($this->data['cms']['cp_media_amazon_s3_container'], $data['CMS_MediaPath'] . $data['CMS_MediaFile']); // Delete thumb if($data['CMS_MediaIsImage']) { $this->storage->delete_file($this->data['cms']['cp_media_amazon_s3_container'], $data['CMS_MediaPathThumb'] . $data['CMS_MediaFileThumb']); } break; case 'local-files': @unlink($this->data['cms']['cp_media_local_dir'] . $data['CMS_MediaFile']); @unlink($this->data['cms']['cp_media_local_dir'] . $data['CMS_MediaFileThumb']); break; } } */ return parent::delete($id); }
/** * In addition to deleting the user record, this also deletes associated contacts and role assignments * @param int $user_id * @return bool */ public function delete($user_id) { $user = $this->get($user_id); $result = parent::delete($user_id); if ($result) { $contacts = $this->user_contact_model->get(array('user_id' => $user_id)); $roles = $this->get_roles($user_id); if (!empty($contacts)) { foreach ($contacts as $contact) { $this->user_contact_model->delete($contact->id); } } if (!empty($roles)) { foreach ($roles as $role) { $this->unassign_role($user_id, $role->id); } } } return $result; }
/** * In addition to deleting this contact, if it is the default_choice, assign default_choice to another contact of the same type if it exists * @param $contact_id ID of the contact detail * @return boolean true unless something goes majorly wrong in SQL */ public function delete($contact_id) { $contact = $this->user_contact_model->get($contact_id, true); $result = parent::delete($contact_id); if (!$result) { return false; } if ($contact->default_choice) { $otherdefaultcontacts = $this->user_contact_model->get(array('user_id' => $contact->user_id, 'default_choice' => 1, 'type' => $contact->type), true); // If at least one other contact is already default, do nothing else if ($otherdefaultcontacts) { return true; } $othernondefaultcontact = $this->user_contact_model->get(array('user_id' => $contact->user_id, 'default_choice' => 0, 'type' => $contact->type), true); if (!empty($othernondefaultcontact)) { $this->user_contact_model->edit($othernondefaultcontact->id, array('default_choice' => 1)); } } return true; }
function delete($conditions) { return parent::delete('alertas', $conditions); }
public function delete_automation_rec($id) { parent::delete($id); }
public function delete_expense($id) { parent::delete($id); }
/** * Delete media */ public function delete() { /* if (isset($this->id)) { if (file_exists($this->get_path(self::STYLE_ROOT))) unlink($this->get_path(self::STYLE_ROOT)); }*/ if ($this->public_id) { \Cloudinary\Uploader::destroy($this->public_id); } return parent::delete(); }
public function delete_classes($id) { parent::delete($id); }
public function delete_module($id) { parent::delete($id); }
public function delete_lmember($id) { parent::delete($id); }
public function delete_reply_msg($id) { parent::delete($id); }
public function delete_feetype($id) { parent::delete($id); }
/** * Delete a group * * * @param int $id The ID of the group to delete * @return */ public function delete($id = 0) { $this->load->model('users/user_m'); // don't delete the group if there are still users assigned to it if ($this->user_m->count_by(array('group_id' => $id)) > 0) { return false; } // Dont let them delete the "admin" group or the "user" group. // The interface does not have a delete button for these, this is just insurance $this->db->where_not_in('name', array('user', 'admin')); return parent::delete($id); }
/** * Update an existing image * * @author Yorick Peterse - PyroCMS Dev Team * @modified by Jerel Unruh - PyroCMS Dev Team to add crop * @access public * @param int $id The ID of the image * @param array $input The data used for updating the image * @return mixed */ public function update_image($id, $input) { // Get the data related to the image we're working with $image = $this->db->from('gallery_images')->join('galleries', 'gallery_images.gallery_id = galleries.id')->where('gallery_images.id', $id)->get()->row(); // Set the paths $full_path = 'uploads/galleries/' . $image->slug . '/full/' . $image->filename . $image->extension; $thumb_path = 'uploads/galleries/' . $image->slug . '/thumbs/' . $image->filename . '_thumb' . $image->extension; // Crop an existing thumbnail if ($input['thumb_width'] && $input['thumb_height'] > '1') { // Get the required values for cropping the thumbnail $size_array = getimagesize($full_path); $width = $size_array[0]; $height = $size_array[1]; $scaled_height = $input['scaled_height']; $scaled_percent = $scaled_height / $height; $options['width'] = $input['thumb_width'] / $scaled_percent; $options['height'] = $input['thumb_height'] / $scaled_percent; $options['x_axis'] = $input['thumb_x'] / $scaled_percent; $options['y_axis'] = $input['thumb_y'] / $scaled_percent; $options['create_thumb'] = FALSE; $options['maintain_ratio'] = $input['ratio']; // Crop the fullsize image first if ($this->resize('crop', $full_path, $full_path, $options) !== TRUE) { return FALSE; } //Create a new thumbnail from the newly cropped image // Is the current size larger? If so, resize to a width/height of X pixels (determined by the config file) if ($options['width'] > $this->config->item('image_thumb_width')) { $options['width'] = $this->config->item('image_thumb_width'); } if ($options['height'] > $this->config->item('image_thumb_height')) { $options['height'] = $this->config->item('image_thumb_height'); } // Set the thumbnail option $options['create_thumb'] = TRUE; $options['maintain_ratio'] = TRUE; //create the thumbnail if ($this->resize('resize', $full_path, 'uploads/galleries/' . $image->slug . '/thumbs/', $options) !== TRUE) { return FALSE; } } else { if (isset($input['delete'])) { // First we'll delete it from the DB if (parent::delete($id)) { // Change the table $this->table = 'galleries'; // Unset the thumbnail for each gallery that was using this image if (parent::update_by('thumbnail_id', $id, array('thumbnail_id' => NULL))) { // Change the table back $this->table = 'gallery_images'; // Delete the files if (unlink($full_path) === TRUE and unlink($thumb_path) === TRUE) { return TRUE; } else { return FALSE; } } else { return FALSE; } } else { return FALSE; } } } // Just save it already, do note that data isn't saved if the user decides to delete an image $to_update['title'] = $input['title']; $to_update['description'] = $input['description']; $to_update['updated_on'] = time(); return parent::update($id, $to_update); }
public function delete($id) { $custom_field = $this->get_by_id($id); if ($this->db->field_exists($custom_field->custom_field_column, $custom_field->custom_field_table)) { $this->load->dbforge(); $this->dbforge->drop_column($custom_field->custom_field_table, $custom_field->custom_field_column); } parent::delete($id); }
public function delete($invoice_id) { $this->db->query('DELETE FROM mcb_inventory_stock WHERE invoice_item_id IN (SELECT invoice_item_id FROM mcb_invoice_items WHERE invoice_id = ' . $invoice_id . ')'); parent::delete(array('invoice_id' => $invoice_id)); $this->delete_orphans(); }
public function delete_alert($id) { parent::delete($id); }
function delete_user($id) { parent::delete($id); }