Esempio n. 1
0
File: ward.php Progetto: haoa2/SS
function unward($secret_id, $user_id)
{
    $l_ = new Ward();
    $l = $l_->where("secret_id = {$secret_id} and user_id = {$user_id}");
    $l[0]->drop();
    return 1;
}
Esempio n. 2
0
 public function executeAdd(sfWebRequest $request)
 {
     if ($request->isMethod('Post')) {
         $ward = new Ward();
         $ward->setTitle($request->getParameter('title'));
         //$ward->setDescription($request->getParameter('description'));
         $ward->setStatus(Constant::RECORD_STATUS_ACTIVE);
         $ward->save();
         $this->getUser()->setFlash('SUCCESS_MESSAGE', Constant::RECORD_ADDED_SUCCESSFULLY);
         $this->redirect('Ward/list');
     }
     //end if
 }
Esempio n. 3
0
 public static function getLocation($ward_id, $district_id, $province_id)
 {
     $ward_type = null;
     $ward_name = null;
     $district_type = null;
     $district_name = null;
     $province_type = null;
     $province_name = null;
     if (isset($ward_id)) {
         $ward = Ward::model()->findByPk($ward_id);
         if ($ward) {
             $ward_type = $ward->type;
             $ward_name = $ward->name;
         }
     }
     if (isset($district_id)) {
         $district = District::model()->findByPk($district_id);
         if ($district) {
             $district_type = $district->type;
             $district_name = $district->name;
         }
     }
     if (isset($province_id)) {
         $province = Province::model()->findByPk($province_id);
         if ($province) {
             $province_type = $province->type;
             $province_name = $province->name;
         }
     }
     return $ward_type . " " . $ward_name . ", " . $district_type . " " . $district_name . ", " . $province_type . " " . $province_name;
 }
Esempio n. 4
0
 public function __construct($name = null, $wardID = 0, $preset = false)
 {
     if (!$name || strlen(trim($name)) == 0 || !$wardID) {
         return;
     }
     if (!Ward::Load($wardID)) {
         fail("Could not create calling because the ward ID passed in is invalid.");
     }
     $this->Name = strip_tags($name);
     $this->Preset = $preset;
     $this->WardID = $wardID;
     $this->Save();
 }
Esempio n. 5
0
 public function Save()
 {
     // The ward ID and question content is required!
     if (!$this->WardID || !trim($this->Question)) {
         fail("ERROR > Cannot save this question without a ward ID and question text.");
     }
     if (!Ward::Load($this->WardID)) {
         fail("ERROR > Cannot save question \"" . $this->Question . "\" because the ward ID (" . $this->WardID . ") is found to be invalid.");
     }
     // Make sure the question is unique
     $safeQ = DB::Safe($this->Question);
     $q = "SELECT 1 FROM SurveyQuestions WHERE Question='{$safeQ}' AND WardID='{$this->WardID}' AND ID!='{$this->ID}' LIMIT 1";
     if (mysql_num_rows(DB::Run($q)) > 0) {
         fail("Oops. Could not save question; that question already exists in this ward.");
     }
     $q = DB::BuildSaveQuery($this, get_object_vars($this));
     $r = DB::Run($q);
     if (!$this->ID) {
         $this->ID = mysql_insert_id();
     }
     return $r ? true : false;
 }
Esempio n. 6
0
 public static function Create($name, $stakeID, $rawPwd)
 {
     if (!strlen(trim($name)) || !$stakeID || !strlen(trim($rawPwd))) {
         fail("Cannot create a ward without a name, stake ID, and password (and residences are strongly recommended, if possible).");
     }
     if (!Stake::Load($stakeID)) {
         fail("Could not create ward because stake ID was found to be invalid.");
     }
     $ward = new Ward();
     $ward->Name = strip_tags($name);
     $ward->StakeID = $stakeID;
     $ward->Salt = salt();
     $ward->Password = hashPwd($rawPwd, $ward->Salt);
     $ward->Balance = 2.5;
     $ward->Deleted = false;
     if (!$ward->Save()) {
         return null;
     }
     // Set up pre-defined callings, privileges, permissions, and a sample survey question or two.
     $callings = array();
     $callings[1] = new Calling("Bishop", $ward->ID, true);
     $callings[2] = new Calling("Bishopric 1st Counselor", $ward->ID, true);
     $callings[3] = new Calling("Bishopric 2nd Counselor", $ward->ID, true);
     $callings[4] = new Calling("Executive Secretary", $ward->ID, true);
     $callings[5] = new Calling("Elders Quorum President", $ward->ID, true);
     $callings[6] = new Calling("Elders Quorum 1st Counselor", $ward->ID, true);
     $callings[7] = new Calling("Elders Quorum 2nd Counselor", $ward->ID, true);
     $callings[8] = new Calling("Elders Quorum Secretary", $ward->ID, true);
     $callings[9] = new Calling("Relief Society President", $ward->ID, true);
     $callings[10] = new Calling("Relief Society 1st Counselor", $ward->ID, true);
     $callings[11] = new Calling("Relief Society 2nd Counselor", $ward->ID, true);
     $callings[12] = new Calling("Relief Society Secretary", $ward->ID, true);
     $callings[13] = new Calling("Ward Clerk", $ward->ID, true);
     $callings[14] = new Calling("Membership Clerk", $ward->ID, true);
     foreach ($callings as $c) {
         $c->Save();
     }
     // Save each calling
     // Compile an array of each privilege in the database; currently, we have IDs 1 through 13
     $privileges = array();
     $priv_count = mysql_fetch_row(DB::Run("SELECT COUNT(1) FROM Privileges"))[0];
     for ($i = 1; $i <= $priv_count; $i++) {
         $privileges[$i] = Privilege::Load($i);
     }
     // Bishopric (excluding executive secretary) can mass email all ward members,
     // see everything in the export file, and manage privileges, and send texts
     for ($i = 1; $i <= 3; $i++) {
         $privileges[PRIV_EMAIL_ALL]->GrantToCalling($callings[$i]->ID());
         $privileges[PRIV_EXPORT_EMAIL]->GrantToCalling($callings[$i]->ID());
         $privileges[PRIV_EXPORT_PHONE]->GrantToCalling($callings[$i]->ID());
         $privileges[PRIV_EXPORT_BDATE]->GrantToCalling($callings[$i]->ID());
         $privileges[PRIV_MNG_SITE_PRIV]->GrantToCalling($callings[$i]->ID());
         $privileges[PRIV_TEXT_ALL]->GrantToCalling($callings[$i]->ID());
     }
     // Executive secretary gets all privileges (except redundant ones 2 and 3 - mass email brothers/sisters)
     for ($i = PRIV_EMAIL_ALL; $i <= PRIV_TEXT_ALL; $i++) {
         if ($i != PRIV_EMAIL_BRO && $i != PRIV_EMAIL_SIS) {
             $privileges[$i]->GrantToCalling($callings[4]->ID());
         }
     }
     // EQ presidency gets to mass-email all brothers
     for ($i = 5; $i <= 8; $i++) {
         $privileges[PRIV_EMAIL_BRO]->GrantToCalling($callings[$i]->ID());
     }
     // The EQ president needs to see more in the export file
     $privileges[PRIV_EXPORT_EMAIL]->GrantToCalling($callings[5]->ID());
     $privileges[PRIV_EXPORT_PHONE]->GrantToCalling($callings[5]->ID());
     $privileges[PRIV_EXPORT_BDATE]->GrantToCalling($callings[5]->ID());
     // RS presidency gets to mass-email all sisters
     for ($i = 9; $i <= 12; $i++) {
         $privileges[PRIV_EMAIL_SIS]->GrantToCalling($callings[$i]->ID());
     }
     // RS president can see more in the export file, too
     $privileges[PRIV_EXPORT_EMAIL]->GrantToCalling($callings[9]->ID());
     $privileges[PRIV_EXPORT_PHONE]->GrantToCalling($callings[9]->ID());
     $privileges[PRIV_EXPORT_BDATE]->GrantToCalling($callings[9]->ID());
     // Ward clerks can see all info in export file and manage site privileges
     $privileges[PRIV_EXPORT_EMAIL]->GrantToCalling($callings[13]->ID());
     $privileges[PRIV_EXPORT_PHONE]->GrantToCalling($callings[13]->ID());
     $privileges[PRIV_EXPORT_BDATE]->GrantToCalling($callings[13]->ID());
     $privileges[PRIV_MNG_SITE_PRIV]->GrantToCalling($callings[13]->ID());
     // Membership clerks needs to see all info in export file, and can
     // manage callings, profile pictures, and delete accounts
     $privileges[PRIV_EXPORT_EMAIL]->GrantToCalling($callings[14]->ID());
     $privileges[PRIV_EXPORT_PHONE]->GrantToCalling($callings[14]->ID());
     $privileges[PRIV_EXPORT_BDATE]->GrantToCalling($callings[14]->ID());
     $privileges[PRIV_MNG_CALLINGS]->GrantToCalling($callings[14]->ID());
     $privileges[PRIV_MNG_PROFILE_PICS]->GrantToCalling($callings[14]->ID());
     $privileges[PRIV_DELETE_ACCTS]->GrantToCalling($callings[14]->ID());
     // --------------------------------------------------- //
     // Create a sample/starter question.
     $qu = new SurveyQuestion();
     $qu->Question = "Welcome to the singles ward! Do you prefer blue, brown, or green eyes?";
     $qu->QuestionType = QuestionType::MultipleChoice;
     $qu->Required = false;
     $qu->Visible = true;
     $qu->WardID = $ward->ID();
     $qu->Save();
     $qu->AddAnswerOption("Brown eyes");
     $qu->AddAnswerOption("Blue eyes");
     $qu->AddAnswerOption("Green eyes");
     // Let a few people see it: Bishop, Exec. Sec, EQP, and RSP
     $p = new Permission();
     $p->QuestionID($qu->ID());
     $p->Allow($callings[1]->ID(), "Calling", true);
     $p->Allow($callings[4]->ID(), "Calling", true);
     $p->Allow($callings[5]->ID(), "Calling", true);
     $p->Allow($callings[9]->ID(), "Calling", true);
     // I think we're all done here!
     return $ward;
 }
$thisfile = basename($_SERVER['PHP_SELF']);
if (isset($retpath)) {
    switch ($retpath) {
        case 'quick':
            $breakfile = 'nursing-schnellsicht.php' . URL_APPEND;
            break;
        case 'ward_mng':
            $breakfile = 'nursing-station-info.php' . URL_APPEND . '&ward_nr=' . $ward_nr . '&mode=show';
            break;
        case 'search_patient':
            $breakfile = 'nursing-patient-such-start.php' . URL_APPEND;
    }
}
# Create ward object
require_once $root_path . 'include/care_api_classes/class_ward.php';
$ward_obj = new Ward();
# Create insurance object
include_once $root_path . 'include/care_api_classes/class_tz_insurance.php';
$ins_obj = new Insurance_tz();
# create multi functional object
include_once $root_path . 'include/care_api_classes/class_multi.php';
$multi_obj = new multi();
$vct = $multi_obj->__genNumbers();
# Create insurance object
include_once $root_path . 'include/care_api_classes/class_mini_dental.php';
$mini_obj = new dental();
# Load date formatter
require_once $root_path . 'include/inc_date_format_functions.php';
require_once $root_path . 'global_conf/inc_remoteservers_conf.php';
if ($mode == '' || $mode == 'fresh') {
    if ($ward_info =& $ward_obj->getWardInfo($ward_nr)) {
     //while(list($x,$v)=each($row))	$$x=$v;
     extract($row);
 }
 $addr_citytown_name = $person_obj->CityTownName($addr_citytown_nr);
 $encoder = $encounter_obj->RecordModifierID();
 # Get current encounter to check if current encounter is this encounter nr
 $current_encounter = $person_obj->CurrentEncounter($pid);
 # Get the overall status
 if ($stat =& $encounter_obj->AllStatus($encounter_nr)) {
     $enc_status = $stat->FetchRow();
 }
 # Get ward or department infos
 if ($encounter_class_nr == 1) {
     # Get ward name
     include_once $root_path . 'include/care_api_classes/class_ward.php';
     $ward_obj = new Ward();
     $current_ward_name = $ward_obj->WardName($current_ward_nr);
 } elseif ($encounter_class_nr == 2) {
     # Get ward name
     include_once $root_path . 'include/care_api_classes/class_department.php';
     $dept_obj = new Department();
     //$current_dept_name=$dept_obj->FormalName($current_dept_nr);
     $current_dept_LDvar = $dept_obj->LDvar($current_dept_nr);
     if (isset(${$current_dept_LDvar}) && !empty(${$current_dept_LDvar})) {
         $current_dept_name = ${$current_dept_LDvar};
     } else {
         $current_dept_name = $dept_obj->FormalName($current_dept_nr);
     }
 }
 $count = 2;
 $type = "R";
Esempio n. 9
0
        if ($ergebnis->RecordCount()) {
            $result = $ergebnis->FetchRow();
        }
    }
    // else {print "<p>$sql$LDDbNoRead"; exit;} /* Remove comment for debugging*/
    include_once $root_path . 'include/inc_date_format_functions.php';
    //$date_format=getDateFormat($link,$DBLink_OK);
    /* Get the patient global configs */
    include_once $root_path . 'include/care_api_classes/class_globalconfig.php';
    $glob_obj = new GlobalConfig($GLOBAL_CONFIG);
    $glob_obj->getConfig('patient_%');
    # Create insurance object
    include_once $root_path . 'include/care_api_classes/class_insurance.php';
    $ins_obj = new Insurance();
    include_once $root_path . 'include/care_api_classes/class_ward.php';
    $obj = new Ward();
    # Get location data
    $location =& $obj->EncounterLocationsInfo($en);
    //   $result['date_birth']=formatDate2Local($result['date_birth'],$date_format);
} else {
    print "{$LDDbNoLink}<br>{$sql}<br>";
}
switch ($result['encounter_class_nr']) {
    case '1':
        $full_en = $en + $GLOBAL_CONFIG['patient_inpatient_nr_adder'];
        $result['encounter_class'] = $LDStationary;
        break;
    case '2':
        $full_en = $en + $GLOBAL_CONFIG['patient_outpatient_nr_adder'];
        $result['encounter_class'] = $LDAmbulant;
    default:
Esempio n. 10
0
	<head>
		
	</head>
</html>
<?php 
require './roots.php';
require $root_path . 'include/inc_environment_global.php';
$lang_tables[] = 'date_time.php';
$lang_tables[] = 'reporting.php';
require $root_path . 'include/inc_front_chain_lang.php';
require $root_path . 'language/en/lang_en_reporting.php';
require $root_path . 'language/en/lang_en_date_time.php';
require $root_path . 'include/inc_date_format_functions.php';
require_once $root_path . 'include/care_api_classes/class_tz_insurance.php';
require_once $root_path . 'include/care_api_classes/class_ward.php';
$ward_obj = new Ward();
$items = 'nr,name';
$TP_SELECT_BLOCK_IN = '';
$ward_info = $ward_obj->getAllWardsItemsObject($items);
$TP_SELECT_BLOCK_IN .= '<select name="current_ward_nr" size="1"><option value="all_ipd">all</option>';
if (!empty($ward_info) && $ward_info->RecordCount()) {
    while ($station = $ward_info->FetchRow()) {
        $TP_SELECT_BLOCK_IN .= '
								<option value="' . $station['nr'] . '" ';
        if (isset($current_ward_nr) && $current_ward_nr == $station['nr']) {
            $TP_SELECT_BLOCK .= 'selected';
        }
        $TP_SELECT_BLOCK_IN .= '>' . $station['name'] . '</option>';
    }
}
$TP_SELECT_BLOCK_IN .= '</select>';
require $root_path . 'include/inc_environment_global.php';
/**
* CARE2X Integrated Hospital Information System Deployment 2.1 - 2004-10-02
* GNU General Public License
* Copyright 2002,2003,2004,2005 Elpidio Latorilla
* elpidio@care2x.org, 
*
* See the file "copy_notice.txt" for the licence notice
*/
$lang_tables = array('prompt.php');
define('LANG_FILE', 'nursing.php');
$local_user = '******';
require_once $root_path . 'include/inc_front_chain_lang.php';
require_once $root_path . 'include/care_api_classes/class_ward.php';
## Load all wards info
$ward_obj = new Ward();
$items = 'nr,ward_id,name';
$ward_info =& $ward_obj->getAllWardsItemsObject($items);
$ward_count = $ward_obj->LastRecordCount();
# Start Smarty templating here
/**
 * LOAD Smarty
 */
# Note: it is advisable to load this after the inc_front_chain_lang.php so
# that the smarty script can use the user configured template theme
require_once $root_path . 'gui/smarty_template/smarty_care.class.php';
$smarty = new smarty_care('nursing');
# Title in toolbar
$smarty->assign('sToolbarTitle', $LDTransferPatient);
# hide back button
$smarty->assign('pbBack', FALSE);
Esempio n. 12
0
 /**
  * Adds an object to the instance pool.
  *
  * Propel keeps cached copies of objects in an instance pool when they are retrieved
  * from the database.  In some cases -- especially when you override doSelect*()
  * methods in your stub classes -- you may need to explicitly add objects
  * to the cache in order to ensure that the same objects are always returned by doSelect*()
  * and retrieveByPK*() calls.
  *
  * @param      Ward $value A Ward object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool(Ward $obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = (string) $obj->getId();
         }
         // if key === null
         self::$instances[$key] = $obj;
     }
 }
Esempio n. 13
0
<?php

require_once "../lib/init.php";
// Returns 200 OK if the submitted password
// is a correct ward/password combination.
// Also sets the ward_id session variable.
// A successful result should let the user
// proceed to registration.
@($wardID = $_POST['ward_id']);
@($pwd = trim($_POST['pwd']));
$ward = Ward::Load($wardID);
if (!$ward) {
    Response::Send(404, "Please choose a ward. If you did, contact your ward website person.");
}
if (!$ward->PasswordMatches($pwd)) {
    Response::Send(401, "Wrong ward/password combination. Please try again!");
}
// If they get to this point, successful authentication. A-OK.
$_SESSION['ward_id'] = $ward->ID();
Response::Send(200);
Esempio n. 14
0
 public function actionInputPharmacy()
 {
     $this->checkLogin();
     $ward = Ward::model()->findAll();
     $district = District::model()->findAll();
     $province = Province::model()->findAll();
     $this->render('inputPharmacy', array('ward' => $ward, 'district' => $district, 'province' => $province));
 }
Esempio n. 15
0
 public function ChangeWard($wardid)
 {
     if (dayDifference($this->RegistrationDate) < 7) {
         fail("Cannot change wards within 7 days of being in a new ward.");
     }
     $new_ward = Ward::Load($wardid);
     if (!$new_ward) {
         fail("Could not change ward: ward ID {$wardid} not valid.");
     }
     $this->DeleteWardItems();
     $this->WardID = $wardid;
     $this->RegistrationDate = now();
     $this->LastUpdated = 0;
     $this->Save();
 }
Esempio n. 16
0
require_once $root_path . 'include/inc_front_chain_lang.php';
require_once $root_path . 'include/care_api_classes/class_userconfig.php';
$user = new UserConfig();
//$db->debug=true;
if ($user->getConfig($_COOKIE['ck_config'])) {
    $config =& $user->getConfigData();
} else {
    $config = array();
}
/* Load the dept object */
require_once $root_path . 'include/care_api_classes/class_department.php';
$dept = new Department();
$depts =& $dept->getAllActive();
// Load the ward object and wards info
require_once $root_path . 'include/care_api_classes/class_ward.php';
$ward_obj = new Ward();
$items = 'nr,ward_id,name';
// set the items to be fetched
$ward_info =& $ward_obj->getAllWardsItemsArray($items);
if (isset($mode) && $mode == 'save') {
    $config['thispc_dept_nr'] = $_POST['thispc_dept_nr'];
    $config['thispc_ward_nr'] = $_POST['thispc_ward_nr'];
    $config['thispc_room_nr'] = $_POST['thispc_room_nr'];
    $config['thispc_phone'] = $_POST['thispc_phone'];
    $config['thispc_intercom'] = $_POST['thispc_intercom'];
    $user->saveConfig($_COOKIE['ck_config'], $config);
    header("location: login-pc-config.php?sid={$sid}&lang={$lang}&saved=1");
    exit;
}
# Start Smarty templating here
/**
         $selian_pid = $test_request['selian_pid'];
     }
 } else {
     echo "<p>{$sql}<p>{$LDDbNoRead}";
     exit;
 }
 $mode = "show";
 if (!empty($_GET['tracker'])) {
     $h_batch_nr = $_GET['batch_nr'];
 } else {
     $h_batch_nr = $batch_nr;
 }
 include_once $root_path . 'include/care_api_classes/class_department.php';
 $dept_obj = new Department();
 include_once $root_path . 'include/care_api_classes/class_ward.php';
 $ward_obj = new Ward();
 /* prepare selection to show the headline... */
 $sql_headline = "SELECT care_person.pid, care_person.selian_pid, name_first, name_last, sex, batch_nr, \r\ndate_birth,care_encounter.encounter_class_nr,care_encounter.current_ward_nr,care_encounter.current_dept_nr, \r\ntr.encounter_nr,tr.send_date,dept_nr,room_nr,tr.create_id FROM care_test_request_" . $subtarget . " tr, care_encounter, care_person\r\n\t\t\t\t\t\t         WHERE (tr.status='pending' OR tr.status='') AND\r\n\t\t\t\t\t\t         tr.encounter_nr = care_encounter.encounter_nr AND\r\n\t\t\t\t\t\t         care_encounter.pid = care_person.pid\r\n\t\t\t\t\t\t         AND tr.batch_nr = " . $h_batch_nr . "\r\n\t\t\t\t\t\t         ORDER BY  tr.send_date DESC";
 if ($h_requests = $db->Execute($sql_headline)) {
     if ($test_request_headline = $h_requests->FetchRow()) {
         $h_pid = $test_request_headline['pid'];
         $h_batch_nr = $test_request_headline['batch_nr'];
         $h_encounter_nr = $test_request_headline['encounter_nr'];
         $h_encounter_class_nr = $test_request_headline['encounter_class_nr'];
         $h_ipd_admission = $ward_obj->WardName($test_request_headline['current_ward_nr']);
         $h_opd_admission = $dept_obj->DeptName($test_request_headline['current_dept_nr']);
         $h_selian_file_number = $test_request_headline['selian_pid'];
         $h_name_first = $test_request_headline['name_first'];
         $h_name_last = $test_request_headline['name_last'];
         $h_birthdate = $test_request_headline['date_birth'];
         $h_sex = $test_request_headline['sex'];
}
if (!isset($pyear) || empty($pyear)) {
    $pyear = date('Y');
}
$s_date = $pyear . '-' . $pmonth . '-' . $pday;
if ($s_date == date('Y-m-d')) {
    $is_today = true;
} else {
    $is_today = false;
}
$fileappend = "&edit=1&mode=&pday={$pday}&pmonth={$pmonth}&pyear={$pyear}&station={$station}&ward_nr={$ward_nr}";
$breakfile = "location:nursing-station.php" . URL_APPEND . $fileappend;
$forwardfile = "location:nursing-station.php" . URL_REDIRECT_APPEND . $fileappend;
# Create ward object
require_once $root_path . 'include/care_api_classes/class_ward.php';
$ward_obj = new Ward();
if (isset($mode) && ($mode == 'transferbed' || $mode == 'transferward')) {
    $date = date('Y-m-d');
    $time = date('H:i:s');
    # Determine the reason for temporary discharge
    if ($mode == 'transferward') {
        $dis_type = 4;
        # transfer of ward
    } else {
        $dis_type = 6;
        # transfer of bed
    }
    # First, discharge the patient from the current assignment
    if ($ward_nr == -1) {
        //transfer from station to ward
        //echo 'transfer from station to ward';
Esempio n. 19
0
<?php

require_once "../lib/init.php";
protectPage(0, true);
// This file allows a stake leader (ONLY) to change current wards.
@($id = trim($_GET['id']));
if (!$LEADER || !$id) {
    // User is not a stake leader or no ward ID was specified
    header("Location: /");
    exit;
}
$ward = Ward::Load($id);
if (!$ward || $ward->StakeID() != $LEADER->StakeID) {
    // Bad ward ID or ward is not in this leader's stake
    header("Location: /");
    exit;
}
if ($ward->Deleted) {
    fail("That ward is no longer available on this site.");
}
// Set new ward ID
$_SESSION['wardID'] = $id;
// Redirect.
header("Location: /directory");
Esempio n. 20
0
// Keep users logged in for a month... TODO: This doesn't work??
$SESSION_LIFETIME = 60 * 60 * 24 * 30;
session_set_cookie_params($SESSION_LIFETIME);
ini_set('session.gc_maxlifetime', $SESSION_LIFETIME);
// Start session... we'll need it
session_start();
require_once "common.php";
// Open a persistent connection to the database
$DB = new DB();
// If the user is logged in, update last activity.
// They could be a leader or a regular member.
$MEMBER = Member::Current();
$LEADER = null;
$WARD = null;
if ($MEMBER) {
    $MEMBER->UpdateLastActivity();
} else {
    $LEADER = StakeLeader::Current();
    if ($LEADER) {
        $LEADER->UpdateLastActivity();
    }
}
if ($MEMBER) {
    $WARD = Ward::Load($MEMBER->WardID);
} else {
    if ($LEADER) {
        $WARD = Ward::Load($_SESSION['wardID']);
    }
}
$USER = $MEMBER ? $MEMBER : $LEADER;
define('IS_MOBILE', isMobile());
    $pyear = date('Y');
}
$s_date = $pyear . '-' . $pmonth . '-' . $pday;
if ($s_date == date('Y-m-d')) {
    $is_today = true;
} else {
    $is_today = false;
}
if (!isset($mode)) {
    $mode = '';
}
$breakfile = 'javascript:window.close()';
# Set default breakfile
/* Create ward object */
require_once $root_path . 'include/care_api_classes/class_ward.php';
$ward_obj = new Ward();
# Load date formatter
require_once $root_path . 'include/inc_date_format_functions.php';
if ($mode == '' || $mode == 'fresh') {
    if ($ward_info =& $ward_obj->getWardInfo($ward_nr)) {
        $room_obj =& $ward_obj->getRoomInfo($ward_nr, $ward_info['room_nr_start'], $ward_info['room_nr_end']);
        if (is_object($room_obj)) {
            $room_ok = true;
        } else {
            $room_ok = false;
        }
        # GEt the number of beds
        $nr_beds = $ward_obj->countBeds($ward_nr);
        # Get ward patients
        if ($is_today) {
            $patients_obj =& $ward_obj->getDayWardOccupants($ward_nr);
* GNU General Public License
* Copyright 2002,2003,2004,2005 Elpidio Latorilla
* elpidio@care2x.org, 
*
* See the file "copy_notice.txt" for the licence notice
*/
define('DEFAULT_NR_OF_BEDS', 2);
// Define here the default number of beds if the bed value is empty or 0
define('LANG_FILE', 'nursing.php');
$local_user = '******';
require_once $root_path . 'include/inc_front_chain_lang.php';
$thisfile = basename($_SERVER['PHP_SELF']);
$breakfile = 'nursing-station-info.php?sid=' . $sid . '&lang=' . $lang;
/* Load the ward object */
require_once $root_path . 'include/care_api_classes/class_ward.php';
$ward_obj = new Ward($ward_nr);
//$db->debug=1;
if (isset($mode) && $mode == 'save_beds') {
    $saved_ok = false;
    // Set the values common to all rooms
    $_POST['date_create'] = date('Y-m-d');
    $_POST['history'] = "Created: " . date('Y-m-d H:i:s') . " " . $_SESSION['sess_user_name'] . "\n";
    //$_POST['modify_id']=$_SESSION['sess_user_name'];
    $_POST['create_id'] = $_SESSION['sess_user_name'];
    $_POST['create_time'] = date('YmdHis');
    //$db->debug=1;
    for ($i = $room_nr_start; $i <= $room_nr_end; $i++) {
        if (!$ward_obj->RoomExists($i)) {
            $beds = 'beds' . $i;
            $info = 'info' . $i;
            $_POST['room_nr'] = $i;
Esempio n. 23
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     //
     $wards = Ward::all();
     return view('index', compact('wards'));
 }
Esempio n. 24
0
* GNU General Public License
* Copyright 2002,2003,2004,2005 Elpidio Latorilla
* elpidio@care2x.org,
*
* See the file "copy_notice.txt" for the licence notice
*/
define('LANG_FILE', 'nursing.php');
$local_user = '******';
require_once $root_path . 'include/inc_front_chain_lang.php';
if ($ward_nr == '') {
    $ward_nr = $_POST['nr'];
}
$thisfile = basename($_SERVER['PHP_SELF']);
/* Load the ward object */
require_once $root_path . 'include/care_api_classes/class_ward.php';
$ward_obj = new Ward($ward_nr);
$rows = 0;
//$db->debug=1;
/* Load the date formatter */
include_once $root_path . 'include/inc_date_format_functions.php';
switch ($mode) {
    case 'show':
        if ($ward =& $ward_obj->getWardInfo($ward_nr)) {
            $rooms =& $ward_obj->getAllActiveRoomsInfo();
            $roomsTemp =& $rooms;
            $rows = true;
            extract($ward);
            // Get all medical departments
            /* Load the dept object */
            /*				if($edit){
            					include_once($root_path.'include/care_api_classes/class_department.php');
Esempio n. 25
0
if (isset(${$encounter_class}['LD_var']) && !empty(${$encounter_class}['LD_var'])) {
    $eclass = ${$encounter_class}['LD_var'];
} else {
    $eclass = $encounter_class['name'];
}
# Resolve the insurance class name
if (isset(${$insurance_class}['LD_var']) && !empty(${$insurance_class}['LD_var'])) {
    $insclass = ${$insurance_class}['LD_var'];
} else {
    $insclass = $insurance_class['name'];
}
# Get ward or department infos
if ($encounter['encounter_class_nr'] == 1) {
    # Get ward name
    include_once $root_path . 'include/care_api_classes/class_ward.php';
    $ward_obj = new Ward();
    $current_ward_name = $ward_obj->WardName($encounter['current_ward_nr']);
} elseif ($encounter['encounter_class_nr'] == 2) {
    # Get ward name
    include_once $root_path . 'include/care_api_classes/class_department.php';
    $dept_obj = new Department();
    //$current_dept_name=$dept_obj->FormalName($current_dept_nr);
    $current_dept_LDvar = $dept_obj->LDvar($encounter['current_dept_nr']);
    if (isset(${$current_dept_LDvar}) && !empty(${$current_dept_LDvar})) {
        $current_dept_name = ${$current_dept_LDvar};
    } else {
        $current_dept_name = $dept_obj->FormalName($encounter['current_dept_nr']);
    }
}
require_once $root_path . 'include/care_api_classes/class_insurance.php';
$insurance_obj = new Insurance();
Esempio n. 26
0
    echo 'selected';
}
?>
>Select a ward</option>
<?php 
foreach ($stakes as $sid => $wards) {
    $stakeObj = Stake::Load($sid);
    ?>
	<optgroup label="<?php 
    echo $stakeObj->Name;
    ?>
">
<?php 
    foreach ($wards as $wid) {
        // Get the bishop's name, if any.
        $ward = Ward::Load($wid);
        $bishop = $ward->GetBishop();
        ?>
		<option value="<?php 
        echo $wid;
        ?>
"<?php 
        if (isset($WARD) && $WARD->ID() == $wid) {
            echo 'selected="selected"';
        }
        ?>
><?php 
        echo $ward->Name;
        if ($bishop) {
            echo " (Bishop " . $bishop->LastName . ")";
        }
Esempio n. 27
0
@($city = $_POST['city']);
@($state = $_POST['state']);
@($zipcode = $_POST['zipcode']);
@($phone = trim($_POST['phone']));
@($hidePhone = isset($_POST['hidePhone']) ? 1 : 0);
@($receiveSms = isset($_POST['receiveSms']) ? 1 : 0);
@($address = trim($_POST['address']));
@($pic = $_FILES['profilepic']);
$isChangingWards = $WARD->ID() != $wardid && $wardid > 0;
// Required fields filled out?
if (!$email || !$fname || !$lname || !$gender || !$resID || !$dob || $isChangingWards && !$wardpwd) {
    Response::Send(400, "Please fill out all required fields.");
}
// If changing wards, make sure ward password is correct
if ($isChangingWards) {
    $newWard = Ward::Load($wardid);
    if ($newWard != null && !$newWard->PasswordMatches($wardpwd)) {
        Response::Send(401, "Your new ward's password is incorrect. Please make sure you typed the ward password correctly.");
    }
}
$newResIsCustom = $resID == "-";
// Make sure necessary Residence information is filled out
if (!$newResIsCustom && !$aptnum) {
    Response::Send(400, "Oops - could you please fill out your apartment number? We need that. Thanks!");
}
if ($newResIsCustom && (!$address || !$streetAddress || !$city || !$state || !$zipcode)) {
    Response::Send(400, "Oops - could you please type your full address and click the little check-mark to verify it? We'll need to know where you live.");
}
// Passwords match?
if ($pwd1 && $pwd2 && $pwd1 != $pwd2 || $pwd1 && !$pwd2) {
    Response::Send(400, "Oops! Your passwords don't match. Please make sure they're the same in order to change your password.");
$lang_tables[] = 'aufnahme.php';
define('LANG_FILE', 'konsil.php');
define('NO_CHAIN', 1);
require_once $root_path . 'include/inc_front_chain_lang.php';
header('Content-type: image/png');
/*
if(file_exists("../cache/barcodes/pn_".$pn."_bclabel_".$lang.".png"))
{
    $im = ImageCreateFrompng("../cache/barcodes/pn_".$pn."_bclabel_".$lang.".png");
    Imagepng($im);
}
else
{
*/
include_once $root_path . 'include/care_api_classes/class_ward.php';
$obj = new Ward();
if ($obj->loadEncounterData($en)) {
    $result =& $obj->encounter;
}
# Create insurance object
include_once $root_path . 'include/care_api_classes/class_insurance.php';
$ins_obj = new Insurance();
$fen = $en;
/*// get orig data
	    $dbtable="care_admission_patient";
	    $sql="SELECT * FROM $dbtable WHERE patnum='$pn' ";
	    if($ergebnis=$db->Execute($sql))
       	{
			if($rows=$ergebnis->RecordCount())
				{
					$result=$ergebnis->FetchRow();
        $occup = true;
    }
    # If location name is empty, fetch by location nr
    if (!isset($station) || empty($station)) {
        # Know where we are
        switch ($_SESSION['sess_user_origin']) {
            case 'amb':
                # Create nursing notes object
                include_once $root_path . 'include/care_api_classes/class_department.php';
                $obj = new Department();
                $station = $obj->FormalName($dept_nr);
                break;
            default:
                # Create nursing notes object
                include_once $root_path . 'include/care_api_classes/class_ward.php';
                $obj = new Ward();
                $station = $obj->WardName($location_nr);
        }
        echo $obj->getLastQuery();
    }
}
# Start Smarty templating here
/**
 * LOAD Smarty
 */
# Note: it is advisable to load this after the inc_front_chain_lang.php so
# that the smarty script can use the user configured template theme
require_once $root_path . 'gui/smarty_template/smarty_care.class.php';
$smarty = new smarty_care('nursing');
# Title in toolbar
$smarty->assign('sToolbarTitle', $LDNotes . ' :: ' . ${$station} . ' (' . formatDate2Local($s_date, $date_format) . ')');
Esempio n. 30
0
$m->Email = $email;
$m->HideEmail = $hideEmail;
$m->Gender = $gender;
$m->SetPassword($pwd1);
$m->PhoneNumber = $phone;
$m->HidePhone = $hidePhone;
$m->Birthday = sqldate($dob);
$m->HideBirthday = $hideBirthday;
$m->ReceiveEmails = true;
$m->ReceiveTexts = true;
// Fill out housing/Residence info
if (!$resIsCustom) {
    $m->ResidenceID = $resID;
    $m->Apartment = strtoupper(preg_replace("/[^A-Za-z0-9 ]/", '', $aptnum));
} else {
    $ward = Ward::Load($_SESSION['ward_id']);
    $newRes = $ward->AddResidence("", $streetAddress, $city, $state, $zipcode, true);
    $m->ResidenceID = $newRes->ID();
    $m->Apartment = "";
}
// Pull the trigger: save the account.
// (Profile picture upload DOES happen; look down)
$m->Save();
// No need to 'register' anymore.
unset($_SESSION['ward_id']);
// Log member in so the survey can be filled out
$m->Login($email, $pwd1);
// Trigger to tell the user on the next page
// that they aren't done yet...!
// (Do this before the profile picture in case there's problems)
$_SESSION['isNew'] = true;