public function deleteAction() { if ($this->admin_menu_items_model->doDelete((int) $this->_getParam('id', 0))) { My_Utilities::fmsg('Record is succesfully deleted.', 'success'); } else { My_Utilities::fmsg('Record is not deleted.', 'error'); } $this->_redirect('admin/menu-items/index/page/' . $this->_getParam('page', 1)); }
public function deleteAction() { $model_translate_keys = new Locale_Model_TranslateKeys(); if ($model_translate_keys->doDelete((int) $this->_getParam('id', 0))) { My_Utilities::fmsg('Data successfully deleted.', 'success'); } else { My_Utilities::fmsg('Error. Record not deleted.', 'error'); } $this->_redirect('/locale/translate-keys/index/' . $this->_getParam('page', 1)); }
public function privilegesAction() { // Try to find record by user id $this->view->existing = $this->roles_model->getById((int) $this->_request->getParam('id', 0)); // If row does not exist, redirect to usersgroups if (!isset($this->view->existing->id) || empty($this->view->existing->id)) { My_Utilities::fmsg('Record not found.', 'warning'); $this->_redirect('admin/admin-usersgroups'); } $this->view->form = new Admin_Form_Privileges(array('roleid' => $this->view->existing->id)); // Check is post and is posted data valid if ($this->_request->isPost() && $this->view->form->isValid($_POST)) { // First delete than insert $this->permissions_model->doDeleteSpecialPermisionsByRole($this->view->existing->id); foreach ($this->view->form->getValues() as $key => $rec) { if (strstr($key, '_')) { $exp = explode('_', $key); foreach (explode(';', $rec) as $action) { if (!$action) { continue; } $data = array('role_id' => $this->view->existing->id, 'resource_id' => $exp[0], 'action' => trim($action), 'is_allowed' => $exp[1] == 'allow' ? 't' : 'f'); $this->permissions_model->doSave($data); } } } My_Utilities::fmsg('Changes are saved.'); $this->_redirect('admin/admin-usersgroups/index/page/' . $this->_getParam('page', 1)); } }
public function deactivateAction() { $this->view->existing = $this->admin_users_model->getById((int) $this->_getParam('id', 0)); if ($this->admin_users_model->doSave(array('is_active' => false), (int) $this->_getParam('id', 0))) { My_Utilities::fmsg('Record is deactivated.'); } else { My_Utilities::fmsg('Record is not succesfully deactivated.', 'error'); } $this->_redirect('admin/admin-users/index/page/' . $this->_getParam('page', 1)); }
public function deleteAction() { $media_id = (int) $this->_getParam('id', 0); $media = $this->medias_model->getById($media_id); if ($this->deleteMedia($media_id)) { My_Utilities::fmsg('Zapis je uspešno obrisan.', 'success'); } else { My_Utilities::fmsg('Zapis nije obrisan.', 'error'); } $this->_redirect('/cms/medias/index/library_id/' . $media->media_library_id . '/page/' . $this->_getParam('page', 1)); }
public function deactivateAction() { $countries = new Locale_Model_Countries(); if ($countries->doSave(array('is_active' => false), (int) $this->_getParam('id', 0))) { My_Utilities::fmsg('Record deactivated'); } else { My_Utilities::fmsg('Error. Record not deactivated', 'error'); } $this->_redirect('locale/countries/index/page/' . $this->_getParam('page', 1)); }
public function deleteAction() { $id = (int) $this->_getParam('id', 0); $media_ids = $this->medias_model->getIdsArrayByMediaLibId($id); $media_lib = $this->media_libraries_model->getById($id); $dir = Zend_Registry::get('upload_media_path') . '/' . $media_lib['path']; if (!My_Utilities::deleteDirectory($dir)) { My_Utilities::fmsg('Greška. Nije izbrisan folder.', 'error'); $this->_redirect('/cms/media-libraries/index/page/' . $this->_getParam('page', 1)); } if ($this->media_libraries_model->doDelete($id)) { $this->media_libraries_medias_model->doDeleteByMediaLibraryId($id); $this->medias_model->doDeleteByIdsArray($media_ids); My_Utilities::fmsg('Zapis je uspešno obrisan.', 'success'); } else { My_Utilities::fmsg('Zapis nije obrisan.', 'error'); } $this->_redirect('/cms/media-libraries/index/page/' . $this->_getParam('page', 1)); }
/** * Upload CSV file. Delete all records from DB table and insert them again */ public function uploadAction() { $this->view->form = new Locale_Form_UploadTranslate(); //We don't want to save file but only read content if ($this->_request->isPost() && $this->view->form->isValid($_POST)) { $data = My_Utilities::readCsv($_FILES['file']['tmp_name']); if ($data === false || !count($data)) { My_Utilities::fmsg("Error, data not uploaded.", 'error'); return; } $result = $this->_model_t_messages->doSaveUpload($data); if ($result['success']) { My_Utilities::fmsg("Translation succsessfully uploaded."); $this->deleteCache(); $this->_redirect('/locale/translate-messages/index/' . $this->_getParam('page', 1)); } else { My_Utilities::fmsg("Writting into DB not accomplished." . $result['error'], 'error'); } } }
public function deactivateAction() { if ($this->languages_model->doSave(array('is_active' => false), (int) $this->_getParam('id', 0))) { My_Utilities::fmsg('Record deactivated'); } else { My_Utilities::fmsg('Error. Record not deactivated', 'error'); } $this->_redirect('locale/languages/index/page/' . $this->_getParam('page', 1)); }