This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Create new multichoice questions. | |
| */ | |
| function cba_quiz_new_multichoice_question() { | |
| global $user; | |
| $question = new stdClass(); | |
| $question->title = t('Questions template'); | |
| $question->type = 'multichoice'; | |
| $question->body = array(LANGUAGE_NONE => array(array('value' => t('Your questions text')))); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CREATE TABLE example_table ( | |
| nid INT(11) NOT NULL, | |
| plain_text_field VARCHAR(32, | |
| numeric_field INT(11), | |
| boolean_field INT(1), | |
| timestamp_field INT(8), | |
| PRIMARY KEY(nid) | |
| ); | |
| function mymodule_views_data() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $fields = field_info_fields(); | |
| $races_list = list_allowed_values($fields['field_race']); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $form['cancel'] = array( | |
| '#type' => 'button', | |
| '#value' => t('Cancel'), | |
| '#attributes' => array('onClick' => 'Drupal.CTools.Modal.dismiss();'), | |
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $form['startdate'] = array( | |
| '#type' => 'date_popup', | |
| '#title' => t('Lesson start date'), | |
| '#timepicker' => 'timepicker', | |
| '#timepicker_options' => array( | |
| 'rows' => 6, | |
| 'minutes' => array( | |
| 'starts' => 0, | |
| 'ends' => 56, | |
| 'interval' => 4, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Implements hook_entity_info_alter(). | |
| */ | |
| function cba_events_entity_info_alter(&$entity_info) { | |
| // Update exam events path. | |
| $entity_info['event']['bundles']['exam_event']['crud']['edit']['path'] = 'event/exam/%eckentity/edit'; | |
| $entity_info['event']['bundles']['exam_event']['crud']['delete']['path'] = 'event/exam/%eckentity/delete'; | |
| // Update default event path. | |
| $entity_info['event']['bundles']['default']['crud']['add']['path'] = 'event/default/add'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Create default entity in ctools popup. | |
| */ | |
| function cba_events_create_default_entity_in_popup($js, $user_id) { | |
| if (!$js) { | |
| return drupal_goto('event/default/add'); | |
| } | |
| ctools_include('ajax'); | |
| ctools_include('modal'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ctools_include('ajax'); | |
| ctools_include('modal'); | |
| ctools_modal_add_js(); | |
| drupal_set_message('test'); | |
| ctools_modal_render('test', theme('status_messages')); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $q = new EntityFieldQuery; | |
| $exam_id = $exam_wrp->field_event_exan_id->value(); | |
| $assignee_user = $q->entityCondition('entity_type', 'event') | |
| ->propertyCondition('type', 'exam_event') | |
| ->fieldCondition('field_start_event_date', 'value', date('Y-m-d'), '>') | |
| ->fieldCondition('field_event_exan_id', 'value', $exam_id, '=') | |
| ->fieldCondition('field_assignee', 'target_id', array($GLOBALS['user']->uid), 'IN') | |
| ->execute(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $exam_wrp = entity_metadata_wrapper('event', 10); | |
| $exam_wrp->field_assignee[ITEM_KEY]->set(); | |
| $exam_wrp->save(); |