/** * @internal Removes a term. * * Removes a term from all translations. * @param string $term The term to remove * @return void * @attribute[RequestParam('term','string')] */ function Remove($term) { default_string("TITLE_REMOVE_TERM", "Remove term"); default_string("TXT_REMOVE_TERM", "Do you really want to remove this term? This cannot be undone!"); if (!AjaxAction::IsConfirmed("REMOVE_TERM")) { return AjaxAction::Confirm("REMOVE_TERM", 'TranslationAdmin', 'Remove', array('term' => $term)); } $this->ds->ExecuteSql("DELETE FROM wdf_translations WHERE id=?", $term); return AjaxResponse::Redirect('TranslationAdmin', 'Translate', array('lang' => $_SESSION['trans_admin_lang'], 'offset' => $_SESSION['trans_admin_offset'], 'search' => $_SESSION['trans_admin_search'])); }
/** * @attribute[RequestParam('table','string',false)] * @attribute[RequestParam('action','string',false)] * @attribute[RequestParam('model','array',false)] * @attribute[RequestParam('row','string',false)] */ function DelProduct($table, $action, $model, $row) { $this->_login(); // require admin to be logged in // we use the ajax confirm features of the framework which require some translated string, so we set them up here // normally we would start the sysadmin and create some, but for this sample we ignore that. default_string('TITLE_DELPRODUCT', 'Delete Product'); default_string('TXT_DELPRODUCT', 'Do you really want to remove this product? This cannot be undone!'); if (!AjaxAction::IsConfirmed('DELPRODUCT')) { return AjaxAction::Confirm('DELPRODUCT', 'Admin', 'DelProduct', array('model' => $model)); } // load and delete the product dataset $ds = model_datasource('system'); $prod = $ds->Query('products')->eq('id', $model['id'])->current(); $prod->Delete(); // delete the image too if present if ($prod->image) { $image = __DIR__ . '/../images/' . $prod->image; if (file_exists($image)) { unlink($image); } } return AjaxResponse::Redirect('Admin'); }