Exemplo n.º 1
0
function createProject()
{
    $account = getAccount();
    $projdue = tryRetrieve($_POST, 'projDue');
    $projtime = strtotime($projdue);
    $duedate = sqlsafe(date("Y-m-d H:i:s", $projtime));
    $title = sqlSafe(tryRetrieve($_POST, 'projName'));
    //$notes = sqlSafe(tryRetrieve($_POST, 'projNotes'));
    $query = "INSERT INTO projects (account_id, duedate, title) VALUES ({$account}, {$duedate}, {$title})";
    if (writeQuery($query)) {
        $id = getInsertID();
        //Now give the project a hash
        $hash = sqlSafe(hash('adler32', $id));
        $query = "UPDATE projects SET hash={$hash} where id='{$id}'";
        if (writeQuery($query)) {
            $_SESSION['project'] = $id;
            return getProjectInfo();
        }
    }
    return null;
}
Exemplo n.º 2
0
function genSD($projectID)
{
    $file = genPDF($projectID, true);
    $info = getProjectInfo($projectID);
    $xml = "<Operation>\n    <Details>";
    $xml .= addParam("requesttemplate", "API");
    $xml .= addParam("requester", $info["name"]);
    $xml .= addParam("email", $info["email"]);
    $xml .= addParam("subject", $info["title"]);
    $xml .= addParam("description", $info["notes"]);
    $date = strtotime($info["duedate"]);
    $datestr = date("j F Y", $date) . ", 23:59:59";
    $xml .= addParam("Due Date", $datestr);
    $xml .= "</Details>\n          </Operation>";
    $key = getSDkey();
    $method = "ADD_REQUEST";
    $postvars = array("OPERATION_NAME" => $method, "TECHNICIAN_KEY" => $key, "INPUT_DATA" => $xml);
    $url = getSDBaseURL() . "sdpapi/request/";
    $res = postAPI($url, $postvars, null, false);
    $resp = simplexml_load_string($res);
    if (isset($resp->response->operation->Details[0]->workorderid)) {
        $wo = $resp->response->operation->Details[0]->workorderid;
        $url = getSDBaseURL() . "sdpapi/request/{$wo}/attachment?OPERATION_NAME=ADD_ATTACHMENT&TECHNICIAN_KEY={$key}";
        $fields = array("file" => '@' . $file);
        $headers = array('Content-Type: multipart/form-data');
        $res = postAPI($url, $fields, $headers, false, false);
        $resp = simplexml_load_string($res);
        if (isset($resp->response->operation->result->status)) {
            if ($resp->response->operation->result->status == "Success") {
                //complete
            }
        }
        return array('url' => getSDBaseURL() . "WorkOrder.do?woMode=viewWO&woID={$wo}", 'ID' => $wo);
    } else {
        return null;
    }
}
Exemplo n.º 3
0
<?php

include_once '../function_header.php';
$objectId = $_REQUEST['objectId'];
$additionalId = $_REQUEST['additionalId'];
$infoNeed = $_REQUEST['type'];
$response['type'] = $infoNeed;
//type = projectInfo | supplierInfo | materialPrice
switch ($infoNeed) {
    case 'projectInfo':
        $projectInfo = getProjectInfo($conexion, $objectId);
        $response['displayFrom'] = $projectInfo['projectName'] . " @ " . $projectInfo['addressLine1'];
        break;
    case 'supplierInfo':
        $supplierInfo = getSupplierInfo($conexion, $objectId);
        $response['displayTo'] = $supplierInfo['supplierName'] . " @ " . $supplierInfo['addressLine1'];
        break;
    case 'materialPrice':
        //echo "SELECT * FROM suppliermaterial WHERE materialId = '$objectId' AND supplierId = '$additionalId'";
        $materialInfo = mysql_fetch_assoc(mysql_query("SELECT * FROM suppliermaterial WHERE materialId = '{$objectId}' AND supplierId = '{$additionalId}'", $conexion));
        $response['materialPrice'] = $materialInfo['supplierMaterialPrice'];
        $response['materialLast'] = to_MDY($materialInfo['supplierMaterialLastModified']);
        break;
}
echo json_encode($response);
Exemplo n.º 4
0
function addIntro($pdf, $id)
{
    $info = getProjectInfo($id);
    $pdf->SetFont("helvetica", "", 16);
    $w = $pdf->getPageWidth();
    $m = $pdf->getMargins();
    $w -= $m['left'] + $m['right'];
    $pdf->cell($w, 0, $info['title'], 0, 1, 'C');
    $pdf->setCellHeightRatio(1);
    $cwKey = $w / 8;
    $cwVal = $w / 2 - $cwKey;
    $pdf->SetFont("helvetica", "B", 10);
    $pdf->MultiCell($cwKey, 0, 'Requested By', 0, 'R', 0, 0);
    $pdf->SetFont("helvetica", "", 10);
    $pdf->MultiCell($cwVal, 0, $info['name'], 0, 'L', 0, 0);
    $lh = $pdf->getLastH();
    $pdf->SetFont("helvetica", "B", 10);
    $pdf->MultiCell($cwKey, 0, 'Move To', 0, 'R', 0, 0);
    $pdf->SetFont("helvetica", "", 10);
    $pdf->MultiCell($cwVal, 0, $info['moveto'], 0, 'L', 0, 1);
    $lh = $pdf->getLastH();
    if (!empty($info['notes'])) {
        $pdf->SetFont("helvetica", "B", 10);
        $pdf->MultiCell($cwKey, 0, 'Notes', 0, 'R', 0, 0);
        $pdf->SetFont("helvetica", "", 10);
        $pdf->MultiCell($cwVal, 0, $info['notes'], 0, 'L', 0, 0);
        $lh = $pdf->getLastH();
    }
    if ($info['duedate'] != '0000-00-00 00:00:00') {
        $time = strtotime($info['duedate']);
        $date = date('n/j/Y', $time);
        $pdf->SetFont("helvetica", "B", 10);
        $pdf->MultiCell($cwKey, 0, 'Due', 0, 'R', 0, 0);
        $pdf->SetFont("helvetica", "", 10);
        $pdf->MultiCell($cwVal, 0, $date, 0, 'L', 0, 0);
    }
    $pdf->SetY($pdf->GetY() + $lh);
    $pdf->Ln();
    $pdf->setCellHeightRatio(0.4);
}
Exemplo n.º 5
0
<?php

require_once '../config.php';
require_once filepath() . "app/project.php";
require_once filepath() . "app/auth.php";
if (checkAuth()) {
} else {
    redirect(sitepath());
}
if (!isset($_SESSION['project'])) {
    //Return to home
    redirect(sitepath() . "home/");
}
$info = getProjectInfo();
?>
<!DOCTYPE html>
<html>
  <head>
    <?php 
head();
?>
    <script type="text/javascript" src="search.js"></script>
  </head>
  <body>
    <?php 
topbar($info['title'], true);
?>
    <div class='padded'>
      <ul id="tabs" class="nav nav-tabs" data-tabs="tabs">
        <li class="active"><a href="#single" data-toggle="tab">Single Object</a></li>
        <li ><a href="#holder" data-toggle="tab">Holder</a></li>
Exemplo n.º 6
0
<?php

$customer = 0;
$supplier = 0;
$project = 0;
$material = 0;
$displayFrom = "";
$displayTo = "";
$materialPrice = "";
if (isset($_GET['customerId'])) {
    $customer = $_GET['customerId'];
}
if (isset($_GET['projectId'])) {
    $project = $_GET['projectId'];
    $projectInfo = getProjectInfo($conexion, $project);
    $displayFrom = $projectInfo['projectName'] . " @ " . $projectInfo['addressLine1'];
}
if (isset($_GET['supplierId'])) {
    $supplier = $_GET['supplierId'];
    $supplierInfo = getSupplierInfo($conexion, $supplier);
    $displayTo = $supplierInfo['supplierName'] . " @ " . $supplierInfo['addressLine1'];
}
if (isset($_GET['materialId']) && isset($_GET['supplierId'])) {
    $material = $_GET['materialId'];
    $materialInfo = mysql_fetch_assoc(mysql_query("SELECT * FROM suppliermaterial WHERE materialId = '{$material}' AND supplierId = '{$supplier}'", $conexion));
    $materialPrice = decimalPad($materialInfo['supplierMaterialPrice']);
}
/*
switch($infoNeed) {
	case 'projectInfo':
		$projectInfo = getProjectInfo($conexion,$objectId);
     createProject();
     // ya
     break;
 case "DELETEPROJECT":
     deleteProject();
     // ya
     break;
 case "ADDUSER":
     addUser();
     break;
 case "GETPROJECTS":
     getProjects();
     // ya
     break;
 case "GETPROJECTINFO":
     getProjectInfo();
     break;
 case "GETTASKS":
     getTasks();
     break;
 case "ADDTASK":
     addTask();
     break;
 case "COMPLETETASK":
     completeTask();
     break;
 case "SEARCHCOLLABORATORS":
     searchCollaborator();
     break;
 case "EDITPROJECT":
     editProject();