Example #1
1
 public function delete()
 {
     $sourceid = end($this->uri->segment_array());
     if ($sourceid == "delete") {
         $data['errorMsg'] = "One of the parameters: SourceID is not defined. An example request would be delete/1";
         $this->load->view('templates/apierror', $data);
         return;
     }
     $result = $this->sources->delete($sourceid);
     if ($result) {
         if ($this->input->get('ui', TRUE)) {
             addSuccess(getTxt('SourceMetadataDeleted'));
         }
         $output = "success";
     } else {
         if ($this->input->get('ui', TRUE)) {
             addError(getTxt('ProcessingError'));
         }
         $output = "failed";
     }
     $output = array("status" => $output);
     echo json_encode($output);
 }
Example #2
0
 public function add()
 {
     if ($_POST) {
         $dbName = substr(BASEURL2, 0, -1);
         $name = 'topBanner' . $dbName;
         //Processing the SiteImage.
         $config['upload_path'] = './uploads/';
         $config['allowed_types'] = 'gif|jpg|png|jpeg';
         $config['max_size'] = '1024';
         $config['max_width'] = '0';
         $config['max_height'] = '0';
         $config['file_name'] = $name;
         $config['overwrite'] = TRUE;
         $this->load->library('upload', $config);
         if (!$this->upload->do_upload('banner')) {
             addError(getTxt('FailMoveFile') . $this->upload->display_errors());
         } else {
             $uploaddata = $this->upload->data();
             $ext = $uploaddata['file_ext'];
             //Delete any other files.
             $this->deleteOthers($name, $ext);
             addSuccess(getTxt('SiteSuccessfullyEdited'));
         }
     }
     $data = $this->StyleData;
     $this->load->view('banner/add', $data);
 }
Example #3
0
 function deleteall()
 {
     $params = Core::Request();
     $problemModel = $this->loadmodel('SearchModel');
     if ($problemModel->query("DELETE FROM `problems`")) {
         $data['msg'] = addSuccess(lang('history has been deleted.'));
     } else {
         $data['msg'] = addError(lang('Unsuccess delete this history.'));
     }
     $this->index();
 }
Example #4
0
 function update()
 {
     $request = Core::Request();
     if (!empty($request)) {
         //$this->__validusername($request['username']);
         $office = $this->loadmodel('OfficeModel');
         $office->id = $request['params'];
         $office->name = $request['name'];
         $office->address = $request['address'];
         $office->telp = $request['telp'];
         if ($office->Save()) {
             $this->data['msg'] = addSuccess(lang('This office has been updated.'));
             $this->index();
         }
     }
     //pre($request);exit;
 }
Example #5
0
 function update()
 {
     $request = Core::Request();
     if (!empty($request)) {
         //$this->__validusername($request['username']);
         $criteria = $this->loadmodel('CriteriaModel');
         $criteria->id = $request['params'];
         $criteria->criteria = $request['criteria'];
         $criteria->persentase = $request['persentase'];
         $criteria->ncf = $request['ncf'];
         $criteria->nsf = $request['nsf'];
         if ($criteria->Save()) {
             $this->data['msg'] = addSuccess(lang('This criteria has been updated.'));
             $this->index();
         }
     }
     //pre($request);exit;
 }
Example #6
0
 function check_database($password)
 {
     //Field validation succeeded.  Validate against database
     $username = $this->input->post('username');
     //query the database
     $result = $this->users->login($username, $password);
     if ($result) {
         foreach ($result as $row) {
             //Set the SESSION
             fetch_session();
             $_SESSION['username'] = $username;
             $_SESSION['user_auth'] = $row->authority;
             addSuccess(getTxt('LogInSuccess'));
         }
         return TRUE;
     } else {
         addError(getTxt('Incorrect'));
         return false;
     }
 }
Example #7
0
 function delete($post)
 {
     $jurnal = $this->loadmodel('JurnalModel');
     $jurnal->id_jurnal = $post['params'];
     $jurnal->Find();
     $filepath = $jurnal->variables['filepath'];
     $filetext = $jurnal->variables['filetext'];
     if ($jurnal->Delete()) {
         if (!empty($filepath) && file_exists(FILE_PATH . $filepath)) {
             $unlink = unlink(FILE_PATH . $filepath);
         }
         if (!empty($filetext) && file_exists(FILE_DIR . 'xml' . DS . $filetext)) {
             $unlink = unlink(FILE_DIR . 'xml' . DS . $filetext);
         }
         $data['msg'] = addSuccess(lang('1 jurnal has been deleted.'));
     } else {
         $data['msg'] = addError(lang('Unsuccess delete this jurnal.'));
     }
     $data['title'] = lang('Management jurnal');
     $data['header'] = lang('Management jurnal');
     $data['layout'] = 'adminhtml';
     $this->data = $data;
     $this->index();
     $jurnal->All();
     $data['jurnal'] = $jurnal->variables;
 }
Example #8
0
 function update()
 {
     $request = Core::Request();
     //echo '<pre>'; print_r($request);exit;
     if (!empty($request)) {
         //$this->__validusername($request['username']);
         $subcriteria = $this->loadmodel('SubcriteriaModel');
         $subcriteria->id = $request['params'];
         $subcriteria->sub_criteria = $request['sub_criteria'];
         $subcriteria->parent_id = $request['parent_id'];
         $subcriteria->kode = $request['kode'];
         $subcriteria->persentase = $request['persentase'];
         $subcriteria->value = $this->grade($request['persentase']);
         $subcriteria->factor = $request['factor'];
         //echo '<pre>'; print_r($subcriteria);exit;
         if ($subcriteria->Save()) {
             $this->data['msg'] = addSuccess(lang('This sub aspek has been updated.'));
             $this->index();
         } else {
             $this->data['msg'] = addError(lang('This sub aspek unsuccess update.'));
             $this->index();
         }
     }
     //pre($request);exit;
 }
Example #9
0
 public function updateSC()
 {
     $connection = mysqli_connect($this->config->item('database_host'), $this->config->item('database_username'), $this->config->item('database_password'), $this->config->item('database_name')) or die("<p>Error connecting to database: " . mysqli_error() . "</p>");
     mysqli_set_charset($connection, "utf8");
     require_once APPPATH . '../assets/update_series_catalog.php';
     addSuccess("Series Catalog Updated");
 }
Example #10
0
 function update()
 {
     $request = Core::Request();
     //print_r($request);
     if (!empty($request)) {
         //$this->__validusername($request['username']);
         $user = $this->loadmodel('UserModel');
         $user->id = $request['params'];
         if (!empty($request['password'])) {
             $user->password = $request['password'];
         }
         $user->address = $request['address'];
         $user->name = $request['name'];
         if ($user->Save()) {
             $this->data['msg'] = addSuccess(lang('This user has been updated.'));
             $this->index();
         } else {
             $this->data['msg'] = addError(lang('This user unsuccess update.'));
             $this->index();
         }
     }
     //pre($request);exit;
 }
Example #11
0
 function delete()
 {
     $post = Core::Request();
     $Student = $this->loadmodel('StudentModel');
     $Student->nim = $post['params'];
     if ($Student->Delete()) {
         $data['msg'] = addSuccess(lang('1 Student has been deleted.'));
     } else {
         $data['msg'] = addError(lang('Unsuccess delete this Student.'));
     }
     $data['title'] = lang('Management student');
     $data['header'] = lang('Management student');
     $data['layout'] = 'adminhtml';
     $this->data = $data;
     $this->index();
     $Student->All();
     $data['students'] = $Student->variables;
 }
Example #12
0
 public function delete()
 {
     if (isStudent()) {
         $this->kickOut();
     }
     if ($_POST) {
         $this->form_validation->set_rules('username', 'Username', 'trim|required|xss_clean');
     }
     if ($this->form_validation->run() == FALSE) {
         $errors = validation_errors();
         if (!empty($errors)) {
             addError($errors);
         }
     } else {
         $uname = $this->input->post('username');
         $result = $this->users->removeUser($uname);
         if ($result) {
             addSuccess(getTxt('CongratsRemoved') . " " . $this->input->post('username'));
         } else {
             addError(getTxt('ProcessingError'));
         }
     }
     //List of CSS to pass to this view
     $data = $this->StyleData;
     $data['option_block'] = $this->getUserList();
     $this->load->view('users/delete', $data);
 }
Example #13
0
 function update()
 {
     $request = Core::Request();
     // pre($request);exit;
     if (!empty($request) && $request['action'] == 'update') {
         $succes = 0;
         foreach ($request['sub'] as $key => $subs) {
             $profile_option = $this->loadmodel('ProfileOptionModel');
             //$profile_option->setPK('sub_criteria_id') ;
             $profile_option->id = $key;
             $profile_option->profile_id = $request['profile_id'];
             foreach ($subs as $subkey => $value) {
                 $profile_option->sub_criteria_id = $subkey;
                 $profile_option->profile_persentase = $value;
                 $profile_option->profile_value = $this->grade($value);
             }
             //pre($profile_option);
             if ($profile_option->Save()) {
                 $succes = true;
             }
         }
         $this->data['msg'] = addSuccess(lang('Penilaian berhasil diubah.'));
         $this->index();
     }
     //pre($request);exit;
 }
Example #14
0
 function delete()
 {
     $post = Core::Request();
     $lecturer = $this->loadmodel('LecturerModel');
     $lecturer->id_lecturer = $post['params'];
     if ($lecturer->Delete()) {
         $data['msg'] = addSuccess(lang('1 lecturer has been deleted.'));
     } else {
         $data['msg'] = addError(lang('Unsuccess delete this lecturer.'));
     }
     $data['title'] = lang('Management lecturer');
     $data['header'] = lang('Management lecturer');
     $data['layout'] = 'adminhtml';
     $this->data = $data;
     $this->index();
     $lecturer->All();
     $data['lecturer'] = $lecturer->variables;
 }
Example #15
-1
 public function importfile()
 {
     if ($_POST) {
         $result = $this->fileUploadHandler();
         if ($result) {
             $dataset = $this->processFiles($result);
             if ($dataset) {
                 $rows = count($dataset);
                 $result = $this->datapoints->addPoints($dataset);
                 if ($result) {
                     addSuccess(getTxt('Success'));
                     $this->updateSC();
                 } else {
                     addError(getTxt('ProcessingError') . "Error in data input");
                 }
             }
         }
     }
     //GetSources
     $sources = $this->sources->getAll();
     $sourceOptions = optionsSource($sources);
     //Get Variables
     $variables = $this->variables->getAll();
     $varOptions = optionsVariable($variables);
     //List of CSS to pass to this view
     $data = $this->StyleData;
     $data['sourcesOptions'] = $sourceOptions;
     $data['variableOptions'] = $varOptions;
     $this->load->view('datapoint/importfile', $data);
 }