Ver Fonte

changed premissions

Bachir Soussi Chiadmi há 12 anos atrás
pai
commit
8672e5eb9f

Diff do ficheiro suprimidas por serem muito extensas
+ 0 - 4
images/search.ai


+ 3 - 0
js/materio_search_api_ajax.js

@@ -1,4 +1,7 @@
 // @codekit-prepend "gui.js"
+// @koala-prepend "gui.js"
+
+
 
 (function($) {
 

Diff do ficheiro suprimidas por serem muito extensas
+ 0 - 0
js/materio_search_api_ajax.min.js


+ 1 - 1
materio_didactique.info

@@ -24,7 +24,7 @@ function materio_search_api_ajax_init() {
     // ),
     'languages' => isset($languages) ? $languages[1] : array(),
   )), 'setting');
-  drupal_add_js(drupal_get_path('module', 'materio_search_api_ajax').'/js/materio_search_api_ajax-ck.js');
+  drupal_add_js(drupal_get_path('module', 'materio_search_api_ajax').'/js/materio_search_api_ajax.min.js');
 }
 
 /**

+ 95 - 1
materio_search_api_ajax.pages.inc

@@ -120,9 +120,57 @@ function materio_user_form_alter(&$form, &$form_state, $form_id) {
   if( $form_id == "webform_client_form_11186" ){
     // dsm($form, '$form');
     $form['#validate'][] = "materio_user_webform_client_111186_validate";
+    $form['#submit'][] = "materio_user_webform_client_111186_submit";
+  }
+
+
+  if( $form_id == "user_profile_form" ){
+    //dsm($form, '$form');
+    $form['account']['pass']['#type'] = "new_password_confirm";
   }
 }
 
+function materio_user_element_info() {
+  return array(
+    "new_password_confirm" => array(
+      '#input' => TRUE,
+      '#process' => array('materio_user_process_new_password_confirm'),
+      '#theme_wrappers' => array('form_element'),
+    ),
+  );
+}
+
+
+/**
+ * Expand a password_confirm field into two text boxes.
+ */
+function materio_user_process_new_password_confirm($element) {
+  $element['pass1'] =  array(
+    '#type' => 'password',
+    '#title' => t('New password'),
+    '#value' => empty($element['#value']) ? NULL : $element['#value']['pass1'],
+    '#required' => $element['#required'],
+    '#attributes' => array('class' => array('password-field')),
+  );
+  $element['pass2'] =  array(
+    '#type' => 'password',
+    '#title' => t('Confirm password'),
+    '#value' => empty($element['#value']) ? NULL : $element['#value']['pass2'],
+    '#required' => $element['#required'],
+    '#attributes' => array('class' => array('password-confirm')),
+  );
+  $element['#element_validate'] = array('password_confirm_validate');
+  $element['#tree'] = TRUE;
+
+  if (isset($element['#size'])) {
+    $element['pass1']['#size'] = $element['pass2']['#size'] = $element['#size'];
+  }
+
+  return $element;
+}
+
+
+
 function materio_user_user_register_form_submit($form, &$form_state){
   // dsm($form, 'form');
   // dsm($form_state, 'form_state');
@@ -166,6 +214,9 @@ function materio_user_webform_client_111186_validate($form, &$form_state){
           $field_name = 'submitted][collaborators]['.$coll_key.']['.$field_key;
           // dsm($field_name, 'field_name');
 
+          // TODO : tester si les email ne sont pas deja inscrit sur le site
+
+
           form_set_error($field_name, t('You must provide a value for the !name field.', array('!name'=>$human_field_name)));      
         }
       }
@@ -174,6 +225,45 @@ function materio_user_webform_client_111186_validate($form, &$form_state){
 
   } 
 
+}
+
+function materio_user_webform_client_111186_submit($form, &$form_state){
+  dsm($form, 'form');
+  dsm($form_state, 'form_state');
+  $values = $form_state['values']['submitted_tree'];
+  if ($values['membership_options'] == 3) {
+    $i = 1;
+    foreach ($values['collaborators'] as $coll_key => $coll) {
+      // foreach ($coll as $field_key => $field_value) {
+      //   if($field_value == ''){
+      //     $human_field_name = $form['submitted']['collaborators'][$coll_key]['#title'] . " : " . $form['submitted']['collaborators'][$coll_key][$field_key]['#title'];
+      //     $field_name = 'submitted][collaborators]['.$coll_key.']['.$field_key;
+      //     // dsm($field_name, 'field_name');
+
+      //     form_set_error($field_name, t('You must provide a value for the !name field.', array('!name'=>$human_field_name)));      
+      //   }
+      // }
+      $userinfo = array(
+        'mail' => $coll['e_mail_collab_'.$i],
+        'name' => user_password(),
+        'pass' => user_password(), // Generate password
+        // 'init' => $data['components']['username']['value'],
+        'status' => 0,
+        'access' => REQUEST_TIME,
+        'memo' => 'from webform',
+      );
+      $account = drupal_anonymous_user();
+      $account->is_new = TRUE;
+      user_save($account, $userinfo);
+      // module_invoke_all('user_insert', $edit, $account);
+      $i++;
+    }
+    
+
+  } 
+
+  // enregistrer le type d'adonnement chez les user
+
 }
 /**
  * Implements hook_help().
@@ -223,7 +313,11 @@ define('MATERIO_USER_CONFIRMED_USER_ROLE', 'Utilisateur'); // add role name here
 /**
  * Implement hook_user
  */
-function __materio_user_user_update(&$edit, $account, $category){
+function materio_user_user_update(&$edit, $account, $category){
+  // dsm($edit, 'edit');
+  // dsm($account, 'account');
+  // dsm($category, 'category');
+  
   // This is only fired when a user confirms their email address, logintoboggan style
   if (isset($account->logintoboggan_email_validated) && $account->logintoboggan_email_validated == TRUE) {    
     $confirmed_rid = materio_user_get_role_by_name(MATERIO_USER_CONFIRMED_USER_ROLE);    

+ 0 - 0
templates/materio-didactique-home-block.tpl.php


Alguns ficheiros não foram mostrados porque muitos ficheiros mudaram neste diff