Пример #1
0
 $pdf->SetFont($config->ParameterArray["PDFfont"], "", 12);
 $pdf->Cell(0, 5, $deptRow->ExecSponsor);
 $pdf->Ln();
 $pdf->SetFont($config->ParameterArray["PDFfont"], "B", 12);
 $pdf->Cell(80, 5, __("Service Delivery Manager") . ":");
 $pdf->SetFont($config->ParameterArray["PDFfont"], "", 12);
 $pdf->Cell(0, 5, $deptRow->SDM);
 $pdf->Ln();
 $pdf->SetFont($config->ParameterArray["PDFfont"], "", 8);
 $headerTags = array(__("UserName"), __("UserID"), __("Phone1"), __("Phone2"), __("Phone3"), __("Email"));
 $cellWidths = array(50, 20, 25, 25, 25, 50);
 for ($col = 0; $col < count($headerTags); $col++) {
     $pdf->Cell($cellWidths[$col], 7, $headerTags[$col], 1, 0, "C", 1);
 }
 $pdf->Ln();
 $contactList = $con->GetPeopleByDepartment($deptRow->DeptID);
 $fill = 0;
 foreach ($contactList as $contact) {
     $pdf->Cell($cellWidths[0], 6, $contact->LastName . ", " . $contact->FirstName, "LBRT", 0, "L", $fill);
     $pdf->Cell($cellWidths[1], 6, $contact->UserID, "LBRT", 0, "L", $fill);
     $pdf->Cell($cellWidths[2], 6, $contact->Phone1, "LBRT", 0, "L", $fill);
     $pdf->Cell($cellWidths[3], 6, $contact->Phone2, "LBRT", 0, "L", $fill);
     $pdf->Cell($cellWidths[4], 6, $contact->Phone3, "LBRT", 0, "L", $fill);
     $pdf->Cell($cellWidths[5], 6, $contact->Email, "LBRT", 1, "L", $fill);
     $fill = !$fill;
 }
 $pdf->Ln();
 $dev->Owner = $deptRow->DeptID;
 $devList = $dev->GetDevicesbyOwner();
 $TotalRU = 0;
 $TotalBTU = 0;
Пример #2
0
 function DeleteDepartment($TransferTo = null)
 {
     // Make sure we have a real department to delete so we don't pull some bonehead move and delete everything set to 0
     if (!$this->GetDeptByID()) {
         return false;
     }
     // Get people and objects that still belong to this department
     $dev = new Device();
     $cab = new Cabinet();
     $dev->Owner = $cab->AssignedTo = $this->DeptID;
     $person = new People();
     $devices = $dev->GetDevicesbyOwner();
     $cabinets = $cab->GetCabinetsByDept();
     $users = $person->GetPeopleByDepartment($this->DeptID);
     foreach ($devices as $d) {
         // We've designated a new owner for this equipment, zero is valid as they might be setting it to general
         if (!is_null($TransferTo)) {
             $d->Owner = $TransferTo;
             $d->UpdateDevice();
         } else {
             // This option is not being provided but us at this time, maybe through the API
             $d->DeleteDevice();
         }
     }
     foreach ($cabinets as $c) {
         // We've designated a new owner for these cabinets, zero is valid as they might be setting it to general
         if (!is_null($TransferTo)) {
             $c->AssignedTo = $TransferTo;
             $c->UpdateCabinet();
         } else {
             // This option is not being provided but us at this time, maybe through the API
             $c->DeleteCabinet();
         }
     }
     foreach ($users as $p) {
         // If we don't have a value over 0 then we're just removing this department and they won't be added to another group
         if (!is_null($TransferTo) && intval($TransferTo) > 0) {
             // Add this user into the new department
             $sql = "INSERT INTO fac_DeptContacts SET DeptID=" . intval($TransferTo) . ", ContactID={$p->PersonID};";
             $this->exec($sql);
         }
     }
     // Clear any users from this department
     $sql = "DELETE FROM fac_DeptContacts WHERE DeptID={$this->DeptID};";
     $this->exec($sql);
     // By this point all devices, objects, and users should have been shoved into a new department so finish cleaning up.
     $sql = "DELETE FROM fac_Department WHERE DeptID={$this->DeptID};";
     if (!$this->exec($sql)) {
         global $dbh;
         $info = $dbh->errorInfo();
         error_log("PDO Error: {$info[2]} SQL={$sql}");
         return false;
     }
     class_exists('LogActions') ? LogActions::LogThis($this) : '';
     return true;
 }
Пример #3
0
}
// This page has no function without a valid dept id
if (!isset($_REQUEST['deptid'])) {
    echo "How'd you get here without a referral?";
    exit;
}
$dept = new Department();
$person = new People();
$dept->DeptID = isset($_POST['deptid']) ? $_POST['deptid'] : $_GET['deptid'];
$dept->GetDeptByID();
// Update if form was submitted and action is set
if (isset($_POST['action']) && $_POST['action'] == "Submit") {
    $grpMembers = $_POST['chosen'];
    $dept->AssignContacts($grpMembers);
}
$deptList = $person->GetPeopleByDepartment($dept->DeptID);
$contactList = $person->GetUserList();
$possibleList = array_obj_diff($contactList, $deptList);
function array_obj_diff($array1, $array2)
{
    foreach ($array1 as $key => $value) {
        $array1[$key] = serialize($value);
    }
    foreach ($array2 as $key => $value) {
        $array2[$key] = serialize($value);
    }
    $array_diff = array_diff($array1, $array2);
    foreach ($array_diff as $key => $value) {
        $array_diff[$key] = unserialize($value);
    }
    return $array_diff;