function display_image($ImageID) { if (!is_a($ImageID, static::$model)) { $ImageID = new static::$model($ImageID); } $StoreImage = new mStoreItemImage(); $StoreImage->load($ImageID); data('Image', $ImageID); data('StoreImage', $StoreImage); display_view('store/image'); }
function updateimage($StoreItem) { $Model = new mStoreItemImage($StoreItem); if ($_POST['field'] == 'order') { $Other = new mStoreItemImage(); $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); }