/** * Deletes one Element Definition * */ function delete($id) { // Fields from this element $cond = array('parent' => 'element', 'id_parent' => $id); $fields = $this->extend_field_model->get_list($cond); // Instances of Elements using this definition $cond = array('id_element_definition' => $id); $elements = $this->element_model->get_elements($cond); // No delete if used if (!empty($fields) or !empty($elements)) { $this->error(lang('ionize_message_element_in_use')); } else { $this->element_definition_model->delete($id); // Reload Elements definitions list $this->callback = array(array('fn' => 'ION.HTML', 'args' => array('element_definition/get_element_definition_list', '', array('update' => 'elementContainer')))); $this->success(lang('ionize_message_operation_ok')); } }
function link_element() { $result = FALSE; $id_element = $this->input->post('id_element'); $parent = $this->input->post('parent'); $id_parent = $this->input->post('id_parent'); $old_parent = $this->input->post('old_parent'); $old_id_parent = $this->input->post('old_id_parent'); $copy = $this->input->post('copy'); // TRUE / FALSE : is the element copied from one block to another ? $where = array('id_element' => $id_element, 'parent' => $parent, 'id_parent' => $id_parent); $message = lang('ionize_message_element_moved'); // Copy if ($copy !== FALSE) { $result = $this->element_model->copy($where); $message = lang('ionize_message_element_copied'); } else { $result = $this->element_model->move($where); } if ($result !== FALSE) { $this->callback = array(array('fn' => 'ION.getContentElements', 'args' => array($old_parent, $old_id_parent)), array('fn' => 'ION.notification', 'args' => array('success', $message))); } $this->response(); }