Esempio n. 1
0
 function addProjectFromExcel($inputFileName)
 {
     include "./include/PHPExcel/IOFactory.php";
     $objReader = new PHPExcel_Reader_Excel2007();
     $objPHPExcel = $objReader->load($inputFileName);
     $sheetData = $objPHPExcel->getActiveSheet()->toArray(null, true, true, true);
     $limiter = "#";
     $projectObj = new project();
     $userObj = new user();
     $milestoneObj = new milestone();
     $tasklistObj = new tasklist();
     $taskObj = new task();
     $companyObj = new company();
     $projectname = $sheetData[2]["A"];
     $projectdescription = $sheetData[3]["A"];
     $projectdue = $sheetData[4]["A"];
     $projectbudget = $sheetData[5]["A"];
     $projectcustomer = $sheetData[6]["A"];
     $projectpriority = $sheetData[7]["A"];
     $projectId = $projectObj->add($projectname, $projectdescription, $projectdue, $projectbudget, $projectpriority);
     $customer = $companyObj->getCompanyByName($projectcustomer);
     if ($customer) {
         $companyObj->assign($customer["ID"], $projectId);
     }
     // USERS
     for ($i = 1; $i < count($sheetData); $i++) {
         $username = $sheetData[$i]["B"];
         if ($username) {
             $user = $userObj->getUserByName($username);
             if ($user) {
                 $projectObj->assign($user["ID"], $projectId);
             }
         } else {
             break;
         }
     }
     // MILESTONES
     for ($i = 1; $i < count($sheetData); $i++) {
         $milestone = explode($limiter, $sheetData[$i]["C"]);
         if ($milestone) {
             $milestoneObj->add($projectId, $milestone[0], $milestone[1], $milestone[2], $milestone[3]);
         } else {
             break;
         }
     }
     // TASK LISTS
     for ($i = 1; $i < count($sheetData); $i++) {
         $tasklist = explode($limiter, $sheetData[$i]["D"]);
         if ($tasklist) {
             if ($tasklist[3]) {
                 $milestone = $milestoneObj->getMilestoneByName($tasklist[3]);
                 if ($milestone) {
                     $tasklistObj->add_liste($projectId, $tasklist[0], $tasklist[1], $tasklist[2], 0, $milestone["ID"]);
                 }
             } else {
                 $tasklistObj->add_liste($projectId, $tasklist[0], $tasklist[1], $tasklist[2]);
             }
         } else {
             break;
         }
     }
     // TASKS
     for ($i = 1; $i < count($sheetData); $i++) {
         $task = explode($limiter, $sheetData[$i]["E"]);
         if ($task) {
             $tasklist = $tasklistObj->getTasklistByName($task[5]);
             $taskid = $taskObj->add($task[2], $task[3], $task[0], $task[4], $tasklist["ID"], $projectId, $task[6], $task[7]);
             $user = $userObj->getUserByName($task[1]);
             if ($taskid) {
                 if ($user) {
                     $taskObj->assign($taskid, $user["ID"]);
                 }
             }
         } else {
             break;
         }
     }
     return $projectId;
 }
Esempio n. 2
0
    $template->assign("users", $users);
    $template->assign("clopros", $clopros);
    $template->display("adminprojects.tpl");
} elseif ($action == "addpro") {
    if (!$userpermissions["projects"]["add"]) {
        $errtxt = $langfile["nopermission"];
        $noperm = $langfile["accessdenied"];
        $template->assign("errortext", "{$errtxt}<br>{$noperm}");
        $template->display("error.tpl");
        die;
    }
    if (!$end) {
        $end = 0;
    }
    //add the project
    $add = $project->add($name, $desc, $end, $budget, 0);
    //project has been added
    if ($add) {
        foreach ($assignto as $member) {
            $project->assign($member, $add);
            if ($settings["mailnotify"]) {
                $usr = (object) new user();
                $user = $usr->getProfile($member);
                if (!empty($user["email"])) {
                    $userlang = readLangfile($user['locale']);
                    $subject = $userlang["projectassignedsubject"] . ' (' . $userlang['by'] . ' ' . $username . ')';
                    $mailcontent = $userlang["hello"] . ",<br /><br/>" . $userlang["projectassignedtext"] . " <a href = \"" . $url . "manageproject.php?action=showproject&id={$add}\">" . $url . "manageproject.php?action=showproject&id={$add}</a>";
                    // send email
                    $themail = new emailer($settings);
                    $themail->send_mail($user["email"], $subject, $mailcontent);
                }
Esempio n. 3
0
session_start();
require_once $_SERVER['DOCUMENT_ROOT'] . "/common/class/common.class.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/common/class/project.class.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/common/class/user.class.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/common/class/config.class.php";
$objuser = new user();
$objuser->checkLoginAjax();
if (strtoupper($_SESSION['foongigs_usertype']) == "PROVIDER") {
    echo "script: messageBox('Sorry!, Only SEEKER can post a project');";
    exit;
}
/* if(isset($_SESSION['counter']))
	$_SESSION['counter']++;
else
	$_SESSION['counter']=1;
echo $_SESSION['counter'];
print_r($_POST);
exit();
*/
if (is_array($_POST)) {
    $objproject = new project();
    $projectid = $objproject->add($_POST);
    if (isset($_SESSION['tempfilename'])) {
        $fp = fopen($_SESSION['tempfilename'], 'r');
        $content = fread($fp, $_SESSION['filesize']);
        fclose($fp);
        $objproject->addfile($_SESSION['filename'], $_SESSION['filetype'], $_SESSION['filesize'], $content, $projectid);
    }
    echo "script: messageBox('Project Posted',function() { window.location='account.php'; });";
}