public function typeBtnJson() { $value = Ajde::app()->getRequest()->getPostParam('type'); $id = Ajde::app()->getRequest()->getPostParam('id', false); $model = new MediaModel(); if (!is_array($id)) { $id = [$id]; } foreach ($id as $elm) { $model->loadByPK($elm); $model->set('mediatype', $value); $model->save(); } return ['success' => true, 'message' => Ajde_Component_String::makePlural(count($id), 'media') . ' changed']; }