public function __construct() { parent::__construct('photo'); user_can_rule(); $this->load->model(array('photo', 'module')); $this->load->library(array('thumb_lib')); $this->photo->file_dir = FCPATH . $this->path; }
/** * Method saves the picture in post $post_id, module $module_id * * @param number $post_id * @param number $module_id */ public function save($post_id, $module_id) { $post = $this->post->find($post_id, 1); user_can_rule($post); // Uploading an image file & resize if (!empty($_FILES['image'])) { try { $this->picture->upload('image')->resize_image(array('width' => $this->settings['max_width'], 'height' => $this->settings['max_height'], 'thumb' => TRUE)); $data['image'] = $this->picture->file_name; $data['alt'] = param('alt'); $data['module_id'] = $module_id; $this->picture->save($data); set_flash_ok('Изображение сохранено'); } catch (Exception $e) { log_message('error', $e->getCode() . ' : ' . $e->getMessage()); set_flash_ok('Ошибка во время сохранения изображения'); redirect(post_form_save_path($post, $module_id)); } } redirect(post_form_path($post)); }
public function module_delete($post_id, $module_id) { $module = $this->module->find($module_id, 1); $post = $this->post->find($post_id, 1); user_can_rule($post); if (empty($module)) { set_flash_error('Не удалось найти этот модуль'); redirect('post/form/' . $post_id); } Modules::run($module['name'] . '/set_params', $post_id, $module['id']); Modules::run($module['name'] . '/delete', $post_id, $module_id); $this->module->delete($module_id); set_flash_ok('Блок успешно удалён'); redirect(post_form_save_path($post, $module_id)); }
public function __construct() { parent::__construct(); user_can_rule(); $this->load->model(array('text')); }
public function __construct() { parent::__construct(); user_can_rule(); }
/** * Constructor */ public function __construct() { parent::__construct('livejournal'); user_can_rule(); }