alerts.module

module file for Alerts

File

modules/alerts/alerts.module
View source
  1. <?php
  2. /**
  3. * @file
  4. * module file for Alerts
  5. */
  6. // Define a constant for a "system-generated" alert
  7. define('ALERT_SYSTEM_USER_ID', -99);
  8. function alerts_menu() {
  9. $items = array();
  10. $items["alerts"] = array(
  11. "title" => "Alerts%ALERTS_ADVISEE_ALERTS_COUNT%",
  12. "page_callback" => "fp_render_form",
  13. "page_arguments" => array("alerts_advisees_alerts_form"),
  14. "access_arguments" => array("view_advisee_alerts"),
  15. "tab_family" => "alerts",
  16. "weight" => 10,
  17. "type" => MENU_TYPE_TAB,
  18. "page_settings" => array(
  19. "menu_links" => array(
  20. 0 => array(
  21. "text" => "Dashboard",
  22. "path" => "main",
  23. ),
  24. ),
  25. ),
  26. );
  27. $items["advisee-activities"] = array(
  28. "title" => "Advisee Activities",
  29. "page_callback" => "alerts_display_advisee_activities_page",
  30. "access_arguments" => array('can_view_advisee_activity_records'),
  31. "type" => MENU_TYPE_TAB,
  32. 'tab_family' => 'alerts',
  33. 'weight' => 20,
  34. "page_settings" => array(
  35. "menu_links" => array(
  36. 0 => array(
  37. "text" => "Dashboard",
  38. "path" => "main",
  39. ),
  40. ),
  41. ),
  42. );
  43. // Settings screen
  44. $items["admin/config/alerts-settings"] = array(
  45. "title" => "Alerts settings",
  46. "description" => "Configure settings for Alerts in the system",
  47. "page_callback" => "fp_render_form",
  48. "page_arguments" => array("alerts_settings_form", "system_settings"),
  49. "access_arguments" => array("administer_alerts"),
  50. "page_settings" => array(
  51. "page_hide_report_error" => TRUE,
  52. "menu_links" => array(
  53. 0 => array(
  54. "text" => "Admin Console",
  55. "path" => "admin-tools/admin",
  56. ),
  57. ),
  58. "menu_icon" => fp_get_module_path('system') . "/icons/bell.png",
  59. ),
  60. "type" => MENU_TYPE_NORMAL_ITEM,
  61. "tab_parent" => "admin-tools/admin",
  62. );
  63. return $items;
  64. }
  65. function alerts_settings_form($school_id = 0) {
  66. $form = array();
  67. $school_id = intval($school_id);
  68. $fs = ""; // The field name suffix. We will add this to the end of all of our field names. If this is the default school, leave blank.
  69. if (module_enabled("schools")) {
  70. $school_name = schools_get_school_name_for_id($school_id);
  71. fp_set_title(t("Configure %school Alerts settings", array('%school' => $school_name)));
  72. if ($school_id !== 0) {
  73. $fs = "~~school_" . $school_id;
  74. }
  75. }
  76. $form['school_id'] = array(
  77. 'type' => 'hidden',
  78. 'value' => $school_id,
  79. );
  80. $form['alerts_tags' . $fs] = array(
  81. 'label' => t("Tags"),
  82. 'type' => 'textarea',
  83. 'value' => variable_get_for_school("alerts_tags", "", $school_id, TRUE),
  84. 'description' => t("These are tags wich may be selected when creating a new Alert.
  85. Enter tags one per line. For example:
  86. <br> &nbsp; Academics<br> &nbsp; Financial Aid<br> &nbsp; English"),
  87. );
  88. return $form;
  89. }
  90. /**
  91. * implements hook_menu_handle_replacement_pattern
  92. */
  93. function alerts_menu_handle_replacement_pattern($str) {
  94. if (strstr($str, "%ALERTS_ADVISEE_ALERTS_COUNT%")) {
  95. // Get our count.
  96. $alert_counts = fp_get_alert_count_by_type();
  97. $c = intval($alert_counts['alerts']['alert']['unread']);
  98. $x = "";
  99. if ($c > 0) {
  100. $x .= " ($c)";
  101. }
  102. $str = str_replace("%ALERTS_ADVISEE_ALERTS_COUNT%", $x, $str);
  103. }
  104. return $str;
  105. }
  106. /**
  107. * Implements hook_get_count_for_alert_type
  108. *
  109. * Set and Return back "unread" (not in content_last_access)
  110. *
  111. */
  112. function alerts_get_alert_count_by_type($account = NULL) {
  113. global $user;
  114. if ($account === NULL) $account = $user;
  115. if ($account->id == 0) return FALSE;
  116. $rtn = array();
  117. $types = array('alert');
  118. // We need to know this user's list of advisees.
  119. $advisees = advise_get_advisees($account->cwid);
  120. $advisee_line = "";
  121. if ($advisees && count($advisees) > 0) {
  122. $advisees_list = "'" . join("','", $advisees) . "'";
  123. $advisee_line = " AND b.field__student_id IN (" . $advisees_list . ") ";
  124. }
  125. else {
  126. $advisee_line = " AND b.field__student_id IN ('') "; // Meaning, no advisees. We do this so as not to break the queries and return back ALL alerts.
  127. }
  128. // If you have no advisees, that's OK, because you might have alerts which are targetting you.
  129. $total_count = $read_count = 0;
  130. foreach ($types as $type) {
  131. $total_count = intval(db_result(db_query("SELECT COUNT(*) as mycount
  132. FROM content__$type b,
  133. content n
  134. WHERE n.type = ?
  135. AND n.published = 1
  136. AND n.delete_flag = 0
  137. AND b.vid = n.vid
  138. AND b.cid = n.cid
  139. AND b.field__exclude_advisor != 1
  140. $advisee_line ", array($type))));
  141. // Also search for alerts which are targeting the account user.
  142. $total_count += intval(db_result(db_query("SELECT COUNT(*) as mycount
  143. FROM content__$type b,
  144. content n
  145. WHERE n.type = ?
  146. AND n.published = 1
  147. AND n.delete_flag = 0
  148. AND b.vid = n.vid
  149. AND b.cid = n.cid
  150. AND b.field__target_faculty_id = ?
  151. ", array($type, $account->cwid))));
  152. ////////////////////////
  153. // Get Read count for alerts
  154. $read_count = intval(db_result(db_query("SELECT COUNT(*) as mycount
  155. FROM content_last_access a,
  156. content__$type b,
  157. content n
  158. WHERE n.type = ?
  159. AND n.published = 1
  160. AND n.delete_flag = 0
  161. AND n.cid = a.cid
  162. AND b.vid = n.vid
  163. AND n.cid = b.cid
  164. AND b.field__exclude_advisor != 1
  165. $advisee_line
  166. AND a.user_id = ?", array($type, $account->id))));
  167. // Also search for read alerts which are targeting the account user.
  168. $read_count += intval(db_result(db_query("SELECT COUNT(*) as mycount
  169. FROM content_last_access a,
  170. content__$type b,
  171. content n
  172. WHERE n.type = ?
  173. AND n.published = 1
  174. AND n.delete_flag = 0
  175. AND n.cid = a.cid
  176. AND b.vid = n.vid
  177. AND n.cid = b.cid
  178. AND b.field__target_faculty_id = ?
  179. AND a.user_id = ?", array($type, $account->cwid, $account->id))));
  180. $rtn[$type]['total'] = $total_count;
  181. $rtn[$type]['read'] = $read_count;
  182. $rtn[$type]['unread'] = $total_count - $read_count;
  183. // TODO: A setting such that "read" is actually "closed" and "unread" means "open".
  184. } // foreach types
  185. return $rtn;
  186. } // alerts_get_alert_count_by_type
  187. /**
  188. * Display all advisee activities since the beginning of time, thanks to pager query.
  189. *
  190. *
  191. *
  192. */
  193. function alerts_display_advisee_activities_page() {
  194. $rtn = "";
  195. fp_add_css(fp_get_module_path('alerts') . '/css/style.css');
  196. fp_set_title('');
  197. // Needs to only be within my advisees list....
  198. $student_ids = advise_get_advisees($user->cwid);
  199. $students_line = "''";
  200. if ($student_ids && count($student_ids) > 0) {
  201. $students_line = "'" . join("','", $student_ids) . "'";
  202. }
  203. $icons = array(
  204. 'alert' => 'fa-bell-o',
  205. 'mail' => 'fa-envelope-o',
  206. 'comment' => 'fa-comment-o',
  207. 'calendar' => 'fa-calendar-o',
  208. );
  209. if ($students_line) {
  210. $students_line = " AND field__student_id IN ($students_line) ";
  211. }
  212. $table_headers = array();
  213. $table_headers[] = array("label" => "Type", "field" => "field__activity_type");
  214. $table_headers[] = array("label" => "Student");
  215. $table_headers[] = array("label" => "Description", "field" => "title");
  216. $table_headers[] = array("label" => "Posted", "field" => "n.updated");
  217. // Set our initial sort, if none is already set.
  218. theme_table_header_sortable_set_initial_sort('n.updated', 'DESC');
  219. $rtn .= "<table border='0' class='advisees-alerts'>";
  220. // Draw our our table headers, with links....
  221. $rtn .= theme_table_header_sortable($table_headers);
  222. // Get our order by clause based on selected table header, if any.
  223. $order_by = theme_table_header_sortable_order_by($table_headers);
  224. $filter_line = "";
  225. $filter_params = array();
  226. $limit = 20;
  227. // Now, we are going to search for alerts about these students, in the form of a pager query.
  228. // Query for alerts for this student. We will be using a pager_query, so we can display a complete history, if we wish.
  229. $res = pager_query("SELECT DISTINCT(a.cid) FROM content__activity_record a, content n
  230. WHERE a.vid = n.vid
  231. AND a.cid = n.cid
  232. AND n.delete_flag = 0
  233. AND n.published = 1
  234. $students_line
  235. $filter_line
  236. $order_by", $filter_params, $limit, 0, "SELECT COUNT(DISTINCT(a.cid)) FROM content__activity_record a, content n
  237. WHERE a.vid = n.vid
  238. AND a.cid = n.cid
  239. AND n.delete_flag = 0
  240. AND n.published = 1
  241. $students_line
  242. $filter_line
  243. $order_by");
  244. while ($cur = db_fetch_object($res)) {
  245. $cid = $cur->cid;
  246. $content = content_load($cid);
  247. $student_name = fp_get_student_name($content->field__student_id['value'], TRUE);
  248. $disp_date = date("m/d/Y g:ia", convert_time($content->updated));
  249. $icon = $icons[$content->field__activity_type['value']];
  250. $rtn .= "
  251. <tr>
  252. <td class='type'><i class='fa $icon'></i></td>
  253. <td class='student'>$student_name</td>
  254. <td class='short-desc'><div class='short-desc-wrapper'>{$content->title}</div></td>
  255. <td class='updated'>$disp_date</td>
  256. </tr>
  257. ";
  258. } // while cur
  259. $rtn .= "</table>";
  260. $rtn .= theme_pager(array(t('« newest'), t('‹ newer'), '', t('older ›'), t('oldest »')));
  261. return $rtn;
  262. } // alerts_display_advisee_activities_page
  263. /**
  264. * Displays alerts for our various advisees.
  265. */
  266. function alerts_advisees_alerts_form($only_student_id = "", $limit = 25) {
  267. global $user;
  268. $html = "";
  269. $form = array();
  270. fp_set_title('');
  271. fp_add_css(fp_get_module_path('alerts') . '/css/style.css');
  272. $students_line = "'$only_student_id'";
  273. if ($only_student_id == "") {
  274. $student_ids = advise_get_advisees($user->cwid);
  275. if ($student_ids && count($student_ids) > 0) {
  276. $students_line = "'" . join("','", $student_ids) . "'";
  277. }
  278. }
  279. $filter_status = @trim($_SESSION['alerts_filter_status']);
  280. $filter_line = "";
  281. $filter_params = array();
  282. $filter_params[':faculty_id'] = $user->cwid;
  283. if ($filter_status) {
  284. $filter_line = "AND field__alert_status = :status";
  285. $filter_params[":status"] = $filter_status;
  286. }
  287. // filter options form. Ex: Status
  288. $form['filter_status'] = array(
  289. 'label' => t('Filter by:'),
  290. 'type' => 'select',
  291. 'options' => array('open' => 'Open', 'closed' => 'Closed'),
  292. 'value' => $filter_status,
  293. );
  294. $form['submit_btn'] = array(
  295. 'type' => 'submit',
  296. 'value' => t('Submit'),
  297. );
  298. $table_headers = array();
  299. $table_headers[] = array("label" => t("Actions"));
  300. $table_headers[] = array("label" => t("Status"), "field" => "field__alert_status");
  301. if (!$only_student_id) {
  302. $table_headers[] = array("label" => t("Student"));
  303. }
  304. $table_headers[] = array("label" => t("To Faculty/Staff"));
  305. $table_headers[] = array("label" => t("Short Description"));
  306. $table_headers[] = array("label" => t("Author"));
  307. $table_headers[] = array("label" => t("Updated"), "field" => "n.updated");
  308. // Set our initial sort, if none is already set.
  309. theme_table_header_sortable_set_initial_sort('n.updated', 'DESC');
  310. $html .= "<table border='0' class='advisees-alerts'>";
  311. // Draw our our table headers, with links....
  312. $html .= theme_table_header_sortable($table_headers);
  313. // Get our order by clause based on selected table header, if any.
  314. $order_by = theme_table_header_sortable_order_by($table_headers);
  315. // Now, we are going to search for alerts about these students, in the form of a pager query.
  316. // Query for alerts for this student. We will be using a pager_query, so we can display a complete history, if we wish.
  317. $res = pager_query("SELECT DISTINCT(a.cid) FROM content__alert a, content n
  318. WHERE
  319. (
  320. (field__student_id IN ($students_line) AND a.field__exclude_advisor != 1)
  321. OR
  322. (field__target_faculty_id = :faculty_id)
  323. )
  324. AND a.vid = n.vid
  325. AND a.cid = n.cid
  326. AND n.delete_flag = 0
  327. AND n.published = 1
  328. $filter_line
  329. $order_by", $filter_params, $limit, 0, "SELECT COUNT(DISTINCT(a.cid)) FROM content__alert a, content n
  330. WHERE
  331. (
  332. (field__student_id IN ($students_line) AND a.field__exclude_advisor != 1)
  333. OR
  334. (field__target_faculty_id = :faculty_id)
  335. )
  336. AND a.vid = n.vid
  337. AND a.cid = n.cid
  338. AND n.delete_flag = 0
  339. AND n.published = 1
  340. $filter_line
  341. $order_by");
  342. while ($cur = db_fetch_object($res)) {
  343. $cid = $cur->cid;
  344. $content = content_load($cid);
  345. $updated = format_date($content->updated, 'short');
  346. $author = "System";
  347. if ($content->user_id != ALERT_SYSTEM_USER_ID) {
  348. $tuser = fp_load_user($content->user_id);
  349. $author = fp_get_faculty_name($tuser->cwid);
  350. }
  351. $bool_no_student = TRUE;
  352. $student_id = $content->field__student_id['value'];
  353. $faculty_id = $content->field__target_faculty_id['value'];
  354. $student_name = t("N/A");
  355. if ($student_id) {
  356. $bool_no_student = FALSE;
  357. $student_name = fp_get_student_name($student_id, TRUE);
  358. }
  359. $faculty_name = t("- Advisor -");
  360. if ($faculty_id) {
  361. $faculty_name = fp_get_faculty_name($faculty_id);
  362. }
  363. $extra_class = "";
  364. // If this content hasn't been read by this user, mark as "unread"
  365. if (!content_get_last_access($cid)) {
  366. $extra_class .= " unread";
  367. }
  368. $student_url = fp_url('student-profile', "current_student_id=$student_id");
  369. $view_url = fp_url("content/$cid", "window_mode=popup&content_tabs=false");
  370. $dtitle = t("View Alert");
  371. $view_link = "<a href='javascript:fpOpenLargeIframeDialog(\"$view_url\",\"$dtitle\");' title='" . t("View") . "' class='action-link' ><i class='fa fa-eye'></i></a>";
  372. $student_profile_link = "<a href='$student_url' title='" . t("Student Profile") . "' class='action-link'><i class='fa fa-user'></i></a>";
  373. if ($only_student_id || $bool_no_student == TRUE) $student_profile_link = "";
  374. $edit_link = "";
  375. if (user_has_permission('can_edit_alerts')) {
  376. $edit_url = fp_url("content/$cid/edit", "window_mode=popup&content_tabs=false");
  377. $dtitle = t("Edit Alert");
  378. $edit_link = "<a href='javascript:fpOpenLargeIframeDialog(\"$edit_url\",\"$dtitle\");' title='" . t("Edit") . "' class='action-link'><i class='fa fa-pencil'></i></a>";
  379. }
  380. $remove_link = "";
  381. if (user_has_permission('can_remove_alerts')) {
  382. // Load dialog with a custom "remove" screen. Either "Yes" or "Cancel". If we hit yes, we redirect to wherever we are supposed to, just as if we saved. Cancel closes
  383. // the dialog window.
  384. $remove_url = fp_url("content/$cid/remove", "window_mode=popup&content_tabs=false&type=alert");
  385. $dtitle = t("Remove Alert");
  386. $remove_link = "<a href='javascript:fpOpenLargeIframeDialog(\"$remove_url\",\"$dtitle\");' title='" . t("Remove") . "' class='action-link action-link-remove'><i class='fa fa-remove'></i></a>";
  387. }
  388. $html .= "
  389. <tr class='{$content->field__alert_status['value']} $extra_class'>
  390. <td class='actions'>$view_link $edit_link $remove_link $student_profile_link</td>
  391. <td class='status'>{$content->field__alert_status['display_value']}</td>
  392. ";
  393. if ($only_student_id == "") {
  394. $html .= "<td class='student'>$student_name</td>";
  395. }
  396. $html .= "
  397. <td class='faculty'>$faculty_name</td>
  398. <td class='short-desc'><div class='short-desc-wrapper'>{$content->title}</div></td>
  399. <td class='author'>$author</td>
  400. <td class='updated'>$updated</td>
  401. </tr>
  402. ";
  403. } // while cur
  404. $html .= "</table>";
  405. $html .= theme_pager(array(t('« newest'), t('‹ newer'), '', t('older ›'), t('oldest »')));
  406. $form['mark_table'] = array(
  407. 'type' => 'markup',
  408. 'value' => $html,
  409. );
  410. return $form;
  411. } // alerts_advisees_alerts_form
  412. /**
  413. * Our main goal with this submit handler is just to place our filter values
  414. * into a session variable, so we can remember them later.
  415. */
  416. function alerts_advisees_alerts_form_submit($form, $form_state) {
  417. $filter_status = @trim($form_state['values']['filter_status']);
  418. $_SESSION['alerts_filter_status'] = $filter_status;
  419. }
  420. /**
  421. * For use with the content module. We will register our custom content type(s)
  422. * for use with this module.
  423. */
  424. function alerts_content_register_content_type() {
  425. global $current_student_id;
  426. $school_id = db_get_school_id_for_student_id($current_student_id);
  427. $arr = array();
  428. $arr['alert'] = array(
  429. 'title' => 'Alert',
  430. 'description' => 'Signal an alert, notification, or issue to be resolved for a student.',
  431. 'settings' => array(
  432. 'title' => array(
  433. 'label' => t('Title / Short Description'),
  434. 'weight' => 15,
  435. ),
  436. ),
  437. );
  438. $arr['activity_record'] = array(
  439. 'title' => 'Activity Record',
  440. 'description' => 'This is generally created directly by FlightPath, and is a note that some activity has occured which, while not an alert, should be
  441. brought to the advisors attention. For example, the student sent a text message, or opened an email.',
  442. 'settings' => array(
  443. 'title' => array(
  444. 'label' => t('Title / Short Description'),
  445. 'weight' => 15,
  446. ),
  447. ),
  448. );
  449. // If we are in a popup (dialog)...
  450. if (@$_GET['window_mode'] == 'popup') {
  451. // We want to make sure we redirect to our handler URL, which will close the dialog.
  452. $arr['alert']['settings']['#redirect'] = array(
  453. 'path' => 'content-dialog-handle-after-save',
  454. 'query' => '',
  455. );
  456. // We want to make sure we redirect to our handler URL, which will close the dialog.
  457. $arr['activity_record']['settings']['#redirect'] = array(
  458. 'path' => 'content-dialog-handle-after-save',
  459. 'query' => '',
  460. );
  461. }
  462. $fields = array();
  463. $fields['student_id'] = array(
  464. 'type' => 'textfield',
  465. 'label' => 'Student',
  466. 'weight' => 10,
  467. );
  468. $fields['target_faculty_id'] = array(
  469. 'type' => 'hidden',
  470. 'value' => '',
  471. );
  472. $fields['exclude_advisor'] = array(
  473. 'type' => 'hidden',
  474. 'value' => '0',
  475. );
  476. $fields['alert_status'] = array(
  477. 'type' => 'select',
  478. 'label' => 'Status',
  479. 'options' => array(
  480. 'open' => t('Open'),
  481. 'closed' => t('Closed'),
  482. ),
  483. 'required' => TRUE,
  484. 'hide_please_select' => TRUE,
  485. 'weight' => 40,
  486. );
  487. $options = csv_to_form_api_array(variable_get_for_school('alerts_tags', '', $school_id), "\n");
  488. $fields['tags'] = array(
  489. 'type' => 'checkboxes',
  490. 'options' => $options,
  491. 'label' => 'Tags',
  492. 'weight' => 60,
  493. );
  494. $fields['alert_msg'] = array(
  495. 'type' => 'textarea_editor',
  496. 'label' => 'Message',
  497. 'filter' => 'basic',
  498. 'weight' => 70,
  499. );
  500. $fields['visibility'] = array(
  501. 'type' => 'radios',
  502. 'label' => 'Visible to:',
  503. 'options' => array('public' => 'Anyone (incl. student)', 'faculty' => 'Faculty/Staff only'),
  504. 'weight' => 80,
  505. );
  506. $arr['alert']['fields'] = $fields;
  507. ///////////////////////////////////
  508. $fields = array();
  509. $fields['student_id'] = array(
  510. 'type' => 'textfield',
  511. 'label' => 'Student',
  512. 'weight' => 10,
  513. );
  514. $fields['faculty_id'] = array(
  515. 'type' => 'textfield',
  516. 'label' => 'Faculty',
  517. 'weight' => 15,
  518. 'description' => 'optional',
  519. );
  520. $fields['activity_type'] = array(
  521. 'type' => 'select',
  522. 'label' => 'Activity Type (sets the icon)',
  523. 'options' => array(
  524. 'alert' => t('Alert - Bell'),
  525. 'mail' => t('Mail - Envelope'),
  526. 'comment' => t('Comment - txt message'),
  527. 'calendar' => t('Calendar - appointment related'),
  528. ),
  529. 'required' => TRUE,
  530. 'hide_please_select' => TRUE,
  531. 'weight' => 40,
  532. );
  533. $arr['activity_record']['fields'] = $fields;
  534. return $arr;
  535. } // hook_content_register_content_type
  536. function alerts_form_alter(&$form, $form_id) {
  537. if ($form_id == 'content_edit_content_form') {
  538. if (@$form['type']['value'] == 'alert') {
  539. fp_add_css(fp_get_module_path('alerts') . '/css/style.css');
  540. $db = get_global_database_handler();
  541. // If this is a NEW form, then check for values in the URL to auto-fill.
  542. if ($form['cid']['value'] === 'new') {
  543. if (isset($_GET['student_id'])) {
  544. $form['student_id']['value'] = $_GET['student_id'];
  545. $form['student_id']['attributes'] = array('class' => 'hidden');
  546. $extra_mark = "";
  547. if ($form['student_id']['value'] != "") {
  548. $form['mark_to'] = array(
  549. 'type' => 'markup',
  550. 'value' => "<div class='alert-field-mark alert-student'>
  551. " . $db->get_student_name($form['student_id']['value'], TRUE) . "<span class='alert-student-extra-mark'>$extra_mark</span>
  552. </div>",
  553. 'weight' => $form['student_id']['weight'],
  554. );
  555. }
  556. } // if _GET[student_id]
  557. } // if "new"
  558. else {
  559. // This is NOT new! We display display the student information and hide the field.
  560. $form['student_id']['attributes'] = array('class' => 'hidden');
  561. $extra_mark = "";
  562. if ($form['student_id']['value'] != "") {
  563. $form['mark_to'] = array(
  564. 'type' => 'markup',
  565. 'value' => "<div class='alert-field-mark alert-student'>
  566. " . $db->get_student_name($form['student_id']['value'], TRUE) . "<span class='alert-student-extra-mark'>$extra_mark</span>
  567. </div>",
  568. 'weight' => $form['student_id']['weight'],
  569. );
  570. }
  571. }
  572. } // if type == alert
  573. } // if form_id
  574. } // hook_form_alter
  575. function alerts_perm() {
  576. return array(
  577. 'administer_alerts' => array(
  578. 'title' => t('Administer Alerts Settings'),
  579. 'description' => t('The user may configure various settings involving Alerts in the system.'),
  580. ),
  581. 'can_view_alerts' => array(
  582. 'title' => t('Can view Alerts'),
  583. 'description' => t('The user may view alerts (only "Anyone" by default)'),
  584. ),
  585. 'can_edit_alerts' => array(
  586. 'title' => t("Can edit Alerts"),
  587. 'description' => t("The user is allowed to change the status (open/closed), comments, etc. of alerts. Give this
  588. to users who will be directly responsible for responding to alerts."),
  589. ),
  590. 'can_remove_alerts' => array(
  591. 'title' => t("Can remove Alerts"),
  592. 'description' => t("The user is allowed to 'remove' an alert, effectively deleting it. It will no longer be available
  593. in reports."),
  594. ),
  595. 'can_view_faculty_alerts' => array(
  596. 'title' => t('View "Faculty/Staff" Alerts'),
  597. 'description' => t('The user is allowed to view alerts marked visible for "Faculty/Staff".'),
  598. ),
  599. 'view_advisee_alerts' => array(
  600. 'title' => t('View Advisee Alerts'),
  601. 'description' => t('The user may view alerts from all of their advisees. Only give to faculty/staff users.'),
  602. ),
  603. 'can_view_advisee_activity_records' => array(
  604. 'title' => t('View Activity Records for advisees'),
  605. 'description' => t('The user is allowed to view activity records for their advisees. Give to users who would have such advisees.'),
  606. ),
  607. );
  608. }

Functions

Namesort descending Description
alerts_advisees_alerts_form Displays alerts for our various advisees.
alerts_advisees_alerts_form_submit Our main goal with this submit handler is just to place our filter values into a session variable, so we can remember them later.
alerts_content_register_content_type For use with the content module. We will register our custom content type(s) for use with this module.
alerts_display_advisee_activities_page Display all advisee activities since the beginning of time, thanks to pager query.
alerts_form_alter
alerts_get_alert_count_by_type Implements hook_get_count_for_alert_type
alerts_menu
alerts_menu_handle_replacement_pattern implements hook_menu_handle_replacement_pattern
alerts_perm
alerts_settings_form

Constants