/** * Ajax callback to save journal field. */ public function saveJournalAjax(array &$form, FormStateInterface $form_state) { $valid = $this->validateJournal($form, $form_state); $current_uri = \Drupal::request()->getRequestUri(); $path_args = array_slice(explode('/', $current_uri), -2, 2); $condition = array('co_degre' => $path_args[0], 'co_modu' => explode('?', $path_args[1])[0]); $entry = array('organisation' => $form_state->getValue('organisation')); $module = BbCrudController::update('gbb_gmodu_plus', $entry, $condition); $response = new AjaxResponse(); return $response; }
public function submitForm(array &$form, FormStateInterface $form_state) { // $valid = $this->validateJournal($form, $form_state); $current_uri = \Drupal::request()->getRequestUri(); $path_args = array_slice(explode('/', $current_uri), -2, 2); $condition = array('co_degre' => $path_args[0], 'co_modu' => $path_args[1]); $entry = array('convoc_info_off' => $form_state->getValue('infospasconvocform')['value']); $module = BbCrudController::update('gbb_gmodu_plus', $entry, $condition); // drupal_set_message('Submitted.'.$path_args[0].'-'.$path_args[1]); // dpm($condition); // dpm($entry); return TRUE; }
public function sessionduplicate($co_degre, $co_modu, $sessid) { // load session informations $entry = array('sess_id' => $sessid); $session = BbCrudController::load('gbb_session', $entry); foreach ($session['0'] as $field => $val) { $tab[$field] = $val; } // kill unwanted informations unset($tab['sess_id']); unset($tab['denom_comp'], $tab['sigle']); unset($tab['nomu'], $tab['prenom']); // insert new row $DBWriteStatus = BbCrudController::create('gbb_session', $tab); $routeparameters = array('co_degre' => $co_degre, 'co_modu' => $co_modu); return $this->redirect('bb.moduleng', $routeparameters, array('fragment' => 'sessions')); }
public function deleteForm(array &$form, FormStateInterface $form_state) { /* Fetch the array of the file stored temporarily in database */ $afile = $form_state->getValue('fileToDelete'); // ************************* // POURQUOI CA MARCHE PAS ???? // ************************* /* Load the object of the file by it's fid */ // $file = File::load( $afile ); /* Set the status flag temporary of the file object */ // $file->setTemporary(); /* Save the file in database */ // $file->save(); $current_uri = \Drupal::request()->getRequestUri(); $path_args = array_slice(explode('/', $current_uri), -2, 2); $entry = array('fid' => $afile); dpm($afile); $module = BbCrudController::delete('gbb_file', $entry); }
/** * {@inheritdoc} */ public function submitForm(array &$form, FormStateInterface $form_state) { $account = \Drupal::currentUser(); $entry = array('uid' => $account->id(), 'co_modu' => $form_state->getValue('co_modu'), 'co_degre' => $form_state->getValue('co_degre'), 'date' => $form_state->getValue('date'), 'date_ts' => strtotime($form_state->getValue('date')), 'horaires' => $form_state->getValue('horaires'), 'co_lieu' => $form_state->getValue('lieu'), 'co_resp' => $form_state->getValue('formateur'), 'duree_a_payer' => $form_state->getValue('duree_a_payer'), 'duree_prevue' => $form_state->getValue('duree_prevue'), 'type_paiement' => $form_state->getValue('type_paiement'), 'groupe' => $form_state->getValue('groupe'), 'date_modif' => date("Y-m-d H:i:s")); if ($form_state->getValue('sess_id') == 1) { // Insert $DBWriteStatus = BbCrudController::create('gbb_session', $entry); } else { // Update $entry['sess_id'] = $form_state->getValue('sess_id'); $DBWriteStatus = BbCrudController::update('gbb_session', $entry, array('sess_id' => $form_state->getValue('sess_id'))); } $form_state->setRedirect('bb.moduleng', array('co_degre' => $form_state->getValue('co_degre'), 'co_modu' => $form_state->getValue('co_modu')), array('fragment' => 'sessions')); }