function display_image($ImageID) { if (!is_a($ImageID, static::$model)) { $ImageID = new static::$model($ImageID); } $Carousel = new mCarouselImage(); $Carousel->load($ImageID); data('Image', $ImageID); data('Carousel', $Carousel); display_view('carousel/image'); }
function update($CarouselID) { if ($_POST['field'] == 'title') { $Carousel = new mCarouselImage($CarouselID); $Model = $Carousel->image; } else { $Model = new mCarouselImage($CarouselID); } if ($_POST['field'] == 'order') { $Other = new mCarouselImage(); $Other->order = $_POST['value']; $Other->load(); $Other->order = $Model->order; } $Model->{$_POST['field']} = $_POST['value']; $Result['result'] = $Model->save(); $this->output->delete_cache('/'); if ($Result['result'] === true && isset($Other) && $Other->is_loaded()) { $Other->save(); } echo json_encode($Result); }