function alerts_content_register_content_type
Search API
6.x alerts.module | alerts_content_register_content_type() |
For use with the content module. We will register our custom content type(s) for use with this module.
File
- modules/
alerts/ alerts.module, line 586 - module file for Alerts
Code
function alerts_content_register_content_type() {
global $current_student_id;
$school_id = db_get_school_id_for_student_id($current_student_id);
$arr = array();
$arr ['alert'] = array(
'title' => 'Alert',
'description' => 'Signal an alert, notification, or issue to be resolved for a student.',
'settings' => array(
'title' => array(
'label' => t('Title / Short Description'),
'weight' => 15,
),
),
);
$arr ['activity_record'] = array(
'title' => 'Activity Record',
'description' => 'This is generally created directly by FlightPath, and is a note that some activity has occured which, while not an alert, should be
brought to the advisors attention. For example, the student sent a text message, or opened an email.',
'settings' => array(
'title' => array(
'label' => t('Title / Short Description'),
'weight' => 15,
),
),
);
// If we are in a popup (dialog)...
if (@$_GET ['window_mode'] == 'popup') {
// We want to make sure we redirect to our handler URL, which will close the dialog.
$arr ['alert']['settings']['#redirect'] = array(
'path' => 'content-dialog-handle-after-save',
'query' => '',
);
// We want to make sure we redirect to our handler URL, which will close the dialog.
$arr ['activity_record']['settings']['#redirect'] = array(
'path' => 'content-dialog-handle-after-save',
'query' => '',
);
}
$fields = array();
$fields ['student_id'] = array(
'type' => 'textfield',
'label' => 'Student',
'weight' => 10,
);
$fields ['target_faculty_id'] = array(
'type' => 'hidden',
'value' => '',
);
$fields ['exclude_advisor'] = array(
'type' => 'hidden',
'value' => '0',
);
$fields ['alert_status'] = array(
'type' => 'select',
'label' => 'Status',
'options' => array(
'open' => t('Open'),
'closed' => t('Closed'),
),
'required' => TRUE,
'hide_please_select' => TRUE,
'weight' => 40,
);
$options = csv_to_form_api_array(variable_get_for_school('alerts_tags', '', $school_id), "\n");
$fields ['tags'] = array(
'type' => 'checkboxes',
'options' => $options,
'label' => 'Tags',
'weight' => 60,
);
$fields ['alert_msg'] = array(
'type' => 'textarea_editor',
'label' => 'Message',
'filter' => 'basic',
'weight' => 70,
);
$fields ['visibility'] = array(
'type' => 'radios',
'label' => 'Visible to:',
'options' => array('public' => 'Anyone (incl. student)', 'faculty' => 'Faculty/Staff only'),
'weight' => 80,
);
$arr ['alert']['fields'] = $fields;
///////////////////////////////////
$fields = array();
$fields ['student_id'] = array(
'type' => 'textfield',
'label' => 'Student',
'weight' => 10,
);
$fields ['faculty_id'] = array(
'type' => 'textfield',
'label' => 'Faculty',
'weight' => 15,
'description' => 'optional',
);
$fields ['activity_type'] = array(
'type' => 'select',
'label' => 'Activity Type (sets the icon)',
'options' => array(
'alert' => t('Alert - Bell'),
'mail' => t('Mail - Envelope'),
'comment' => t('Comment - txt message'),
'calendar' => t('Calendar - appointment related'),
),
'required' => TRUE,
'hide_please_select' => TRUE,
'weight' => 40,
);
$arr ['activity_record']['fields'] = $fields;
return $arr;
}