Example #1
0
 public function __construct($course_id = NULL, $logbook_entries = NULL, $logged_objectives = NULL, $required_objectives = NULL)
 {
     global $ENTRADA_USER, $db;
     $this->course_id = $course_id;
     if ($logbook_entries) {
         $this->logbook_entries = $logbook_entries;
     } else {
         $this->logbook_entries = Models_Logbook_Entry::fetchAll($ENTRADA_USER->GetID());
     }
     if (!$logged_objectives) {
         $logged_objectives = array();
         foreach ($this->logbook_entries as $entry) {
             if (!array_key_exists($entry->getCourseID(), $logged_objectives)) {
                 $logged_objectives[$entry->getCourseID()] = array();
             }
             if (@count($entry->getObjectives())) {
                 foreach ($entry->getObjectives() as $objective) {
                     $logged_objectives[$entry->getCourseID()][$objective->getID()] = $objective;
                 }
             }
         }
     }
     $this->logged_objectives = $logged_objectives;
     if (!$required_objectives) {
         $required_objectives = array();
         $query = "SELECT * FROM `course_objectives`";
         $course_objectives = $db->GetAll($query);
         foreach ($course_objectives as $course_objective) {
             $objective = Models_Objective::fetchRow($course_objective["objective_id"]);
             if ($objective && $objective->getLoggable()) {
                 if (!array_key_exists($course_objective["course_id"], $required_objectives)) {
                     $required_objectives[$course_objective["course_id"]] = array();
                 }
                 if (!array_key_exists($course_objective["course_id"], $logged_objectives) || !array_key_exists($objective->getID(), $logged_objectives[$course_objective["course_id"]])) {
                     $required_objectives[$course_objective["course_id"]][$objective->getID()] = $objective;
                 }
             }
         }
     }
     $this->required_objectives = $required_objectives;
 }
if (!defined("PARENT_INCLUDED") || !defined("IN_ENCOUNTER_TRACKING")) {
    exit;
} elseif (!isset($_SESSION["isAuthorized"]) || !$_SESSION["isAuthorized"]) {
    exit;
} elseif (!$ENTRADA_ACL->amIAllowed('encounter_tracking', 'read')) {
    exit;
    application_log("error", "Group [" . $_SESSION["permissions"][$ENTRADA_USER->getAccessId()]["group"] . "] and role [" . $_SESSION["permissions"][$ENTRADA_USER->getAccessId()]["role"] . "] does not have access to this module [" . $MODULE . "]");
} else {
    ob_clear_open_buffers();
    if (isset($_GET["proxy_id"]) && (int) $_GET["proxy_id"]) {
        $proxy_id = (int) $_GET["proxy_id"];
    } else {
        $proxy_id = $ENTRADA_USER->getID();
    }
    $output = array("aaData" => array());
    $entries = Models_Logbook_Entry::fetchAll($proxy_id);
    $count = 0;
    if ($entries) {
        /*
         * Ordering
         */
        if (isset($_GET["iSortCol_0"]) && in_array($_GET["iSortCol_0"], array(1, 2, 3, 4))) {
            $aColumns = array("lentry_id", "course", "encounter_date", "institution", "location");
            $sort_array = array();
            foreach ($entries as $entry) {
                switch ($_GET["iSortCol_0"]) {
                    default:
                    case 1:
                        $course = $entry->getCourseName();
                        break;
                    case 2:
Example #3
0
                     add_statistic("encounter_tracking", "update", "lentry_id", $PROCESSED["lentry_id"], $ENTRADA_USER->getID());
                 } else {
                     add_error("An error occurred when attempting to update a logbook entry [" . $PROCESSED["lentry_id"] . "], an administrator has been informed, please try again later.");
                     application_log("error", "Error occurred when updating logbook entry, DB said: " . $db->ErrorMsg());
                 }
             } else {
                 if ($entry->fromArray($PROCESSED)->insert()) {
                     add_success("The entry has successfully been updated. You will be redirected to the logbook index in 5 seconds, or you can <a href=\"" . ENTRADA_URL . "/logbook\">click here</a> if you do not wish to wait.");
                     add_statistic("encounter_tracking", "insert", "lentry_id", $db->Insert_ID(), $ENTRADA_USER->getID());
                 } else {
                     add_error("An error occurred when attempting to create a new logbook entry, an administrator has been informed, please try again later.");
                     application_log("error", "Error occurred when updating logbook entry, DB said: " . $db->ErrorMsg());
                 }
             }
         } else {
             $entry = new Models_Logbook_Entry();
             $entry->fromArray($PROCESSED);
             $STEP = 1;
         }
         break;
     default:
         break;
 }
 switch ($STEP) {
     case 2:
         if ($ERROR) {
             echo display_error();
             $ONLOAD[] = "setTimeout('window.location=\\'" . ENTRADA_URL . "/logbook\\'', 5000)";
         }
         if ($SUCCESS) {
             echo display_success();
 if (isset($_POST["course_id"]) && (int) $_POST["course_id"]) {
     $course_id = (int) $_POST["course_id"];
 }
 if (isset($_POST["entry_id"]) && (int) $_POST["entry_id"]) {
     $entry_id = (int) $_POST["entry_id"];
 }
 if (isset($_POST["objective_ids"]) && ($temp_objective_ids = explode(",", $_POST["objective_ids"])) && @count($temp_objective_ids)) {
     $objective_ids = $temp_objective_ids;
 }
 if (isset($course_id) && $course_id) {
     if (!isset($entry)) {
         if (isset($entry_id) && $entry_id) {
             $entry = Models_Logbook_Entry::fetchRow($entry_id);
             $entry->setCourseID($course_id);
         } else {
             $entry = new Models_Logbook_Entry();
             $entry->setCourseID($course_id);
         }
     }
     if (isset($objective_ids) && $objective_ids) {
         foreach ($objective_ids as $objective_id) {
             $entry->addObjective($objective_id);
         }
     }
     $objectives = $entry->getCourseObjectives();
     if (@count($objectives["required"]) || @count($objectives["logged"]) || @count($objectives["disabled"])) {
         ?>
         <select id="objective_id" name="objective_id" onchange="addObjective(this.options[this.selectedIndex].value, 3)">
             <option value="" selected="selected">--- Select an Objective ---</option>
             <?php 
         if (@count($objectives["required"])) {
Example #5
0
 *
*/
if (!defined("PARENT_INCLUDED") || !defined("IN_ENCOUNTER_TRACKING")) {
    exit;
} elseif (!isset($_SESSION["isAuthorized"]) || !$_SESSION["isAuthorized"]) {
    header("Location: " . ENTRADA_URL);
    exit;
} elseif (!$ENTRADA_ACL->amIAllowed('encounter_tracking', 'read')) {
    $ONLOAD[] = "setTimeout('window.location=\\'" . ENTRADA_URL . "/admin/" . $MODULE . "\\'', 15000)";
    $ERROR++;
    $ERRORSTR[] = "Your account does not have the permissions required to use this feature of this module.<br /><br />If you believe you are receiving this message in error please contact <a href=\"mailto:" . html_encode($AGENT_CONTACTS["administrator"]["email"]) . "\">" . html_encode($AGENT_CONTACTS["administrator"]["name"]) . "</a> for assistance.";
    echo display_error();
    application_log("error", "Group [" . $_SESSION["permissions"][$ENTRADA_USER->getAccessId()]["group"] . "] and role [" . $_SESSION["permissions"][$ENTRADA_USER->getAccessId()]["role"] . "] does not have access to this module [" . $MODULE . "]");
} else {
    echo "<h1>Encounter Tracking Entries</h1>";
    $entries = Models_Logbook_Entry::fetchAll($ENTRADA_USER->GetID());
    $HEAD[] = "<script type=\"text/javascript\" src=\"" . ENTRADA_URL . "/javascript/jquery/jquery.dataTables.min.js\"></script>";
    $HEAD[] = "<script type=\"text/javascript\">\n\n        jQuery(function(\$) {\n            jQuery('#entries').dataTable(\n                {\n                    'sPaginationType': 'full_numbers',\n                    'bInfo': false,\n                    'bAutoWidth': false,\n                    'sAjaxSource': '?section=api-list',\n                    'bServerSide': true,\n                    'bProcessing': true,\n                    'aoColumns': [\n                        { 'mDataProp': 'checkbox', 'bSortable': false },\n                        { 'mDataProp': 'course' },\n                        { 'mDataProp': 'date' },\n                        { 'mDataProp': 'institution' },\n                        { 'mDataProp': 'location' }\n                    ],\n                    'oLanguage': {\n                        'sEmptyTable': 'There are currently no entries in the system. Use the Log Entry button to create a new encounter tracking entry.',\n                        'sZeroRecords': 'No encounter tracking entries found to display.'\n                    }\n                }\n            );\n        });\n    </script>";
    add_statistic("encounter_tracking", "view", "lentry_id", NULL, $ENTRADA_USER->getID());
    ?>
	<?php 
    if ($ENTRADA_ACL->amIAllowed('encounter_tracking', 'read')) {
        ?>
	<div class="row-fluid">
		<a href="<?php 
        echo html_encode(ENTRADA_URL);
        ?>
/logbook?section=add" class="btn btn-primary pull-right">Log Entry</a>
	</div>
	<br />
	<?php 
Example #6
0
    header("Location: " . ENTRADA_URL);
    exit;
} elseif (!$ENTRADA_ACL->amIAllowed('encounter_tracking', 'delete', false)) {
    $ONLOAD[] = "setTimeout('window.location=\\'" . ENTRADA_URL . "/admin/" . $MODULE . "\\'', 15000)";
    $ERROR++;
    $ERRORSTR[] = "Your account does not have the permissions required to use this feature of this module.<br /><br />If you believe you are receiving this message in error please contact <a href=\"mailto:" . html_encode($AGENT_CONTACTS["administrator"]["email"]) . "\">" . html_encode($AGENT_CONTACTS["administrator"]["name"]) . "</a> for assistance.";
    echo display_error();
    application_log("error", "Group [" . $_SESSION["permissions"][$ENTRADA_USER->getAccessId()]["group"] . "] and role [" . $_SESSION["permissions"][$ENTRADA_USER->getAccessId()]["role"] . "] does not have access to this module [" . $MODULE . "]");
} else {
    $BREADCRUMB[] = array("url" => ENTRADA_URL . "/logbook?section=delete", "title" => "Delete Logbook Entry");
    echo "<h1>Delete Logbook Entry</h1>";
    if (isset($_POST["delete"])) {
        foreach ($_POST["delete"] as $entry_id) {
            if ($tmp_input = clean_input($entry_id, "numeric")) {
                $PROCESSED["delete"][] = $tmp_input;
                $entries[] = Models_Logbook_Entry::fetchRow($tmp_input);
            }
        }
    }
    switch ($STEP) {
        case 2:
            foreach ($entries as $entry) {
                $entry_data = $entry->toArray();
                $entry_data["entry_active"] = 0;
                if ($entry->fromArray($entry_data)->update()) {
                    add_statistic("encounter_tracking", "delete", "lentry_id", $entry->getID(), $ENTRADA_USER->getID());
                    if (!$ERROR) {
                        add_success("Successfully deleted a <strong>Logbook Entry</strong>. You will now be redirected to the logbook index; this will happen <strong>automatically</strong> in 5 seconds or <a href=\"" . ENTRADA_URL . "/logbook\"><strong>click here</strong></a> to continue.");
                    }
                } else {
                    add_error("Failed to delete a <strong>Logbook Entry</strong>, an Administrator has been informed, please try again later. You will now be redirected to the logbook index; this will happen <strong>automatically</strong> in 5 seconds or <a href=\"" . ENTRADA_URL . "/logbook\"><strong>click here</strong></a> to continue.");
Example #7
0
             $objective_array["objective"] = $objective;
             $objective_array["objective_id"] = $objective_id;
             $objective_array["lentry_id"] = isset($entry_id) && $entry_id ? $entry_id : NULL;
             $objective_array["participation_level"] = isset($_POST["obj_participation_level"][$objective_id]) && $_POST["obj_participation_level"][$objective_id] ? $_POST["obj_participation_level"][$objective_id] : 3;
             $objective_array["updated_date"] = time();
             $objective_array["updated_by"] = $ENTRADA_USER->getID();
             $objective_array["objective_active"] = 1;
             $entry_objective = new Models_Logbook_Entry_Objective();
             $PROCESSED["objectives"][$objective_id] = $entry_objective->fromArray($objective_array);
         }
     }
 } else {
     add_error("Please select at least one objective");
 }
 if (!$ERROR) {
     $entry = new Models_Logbook_Entry();
     $PROCESSED["proxy_id"] = $ENTRADA_USER->getID();
     $PROCESSED["updated_by"] = $ENTRADA_USER->getID();
     $PROCESSED["updated_date"] = time();
     if (isset($entry_id)) {
         if ($entry->fromArray($PROCESSED)->update()) {
             add_statistic("encounter_tracking", "update", "lentry_id", $PROCESSED["lentry_id"], $ENTRADA_USER->getID());
             echo json_encode(array("status" => "success", "data" => "Successfully updated entry."));
         } else {
             application_log("error", "Error occurred when updating logbook entry, DB said: " . $db->ErrorMsg());
             echo json_encode(array("status" => "error", "data" => array("An error occured while attemptin to update this entry.")));
         }
     } else {
         if ($entry->fromArray($PROCESSED)->insert()) {
             add_statistic("encounter_tracking", "insert", "lentry_id", $db->Insert_ID(), $ENTRADA_USER->getID());
             echo json_encode(array("status" => "success", "data" => array("The entry has been saved successfully.")));